babylonjs-loaders 7.51.0 → 7.51.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t,n,r={597:t=>{t.exports=e}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e](n,n.exports,a),n.exports}n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);a.r(o);var i={};t=t||[null,n({}),n([]),n(n)];for(var s=2&r&&e;"object"==typeof s&&!~t.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,a.d(o,i),o},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.d(i,{default:()=>Et});var s={};a.r(s),a.d(s,{GLTFValidation:()=>w});var l={};a.r(l),a.d(l,{GLTFFileLoader:()=>E,GLTFLoaderAnimationStartMode:()=>T,GLTFLoaderCoordinateSystemMode:()=>A,GLTFLoaderState:()=>x});var c={};a.r(c),a.d(c,{EXT_lights_ies:()=>te,EXT_lights_image_based:()=>q,EXT_mesh_gpu_instancing:()=>W,EXT_meshopt_compression:()=>z,EXT_texture_avif:()=>$,EXT_texture_webp:()=>Q,ExtrasAsMetadata:()=>wt,KHR_animation_pointer:()=>ot,KHR_draco_mesh_compression:()=>re,KHR_interactivity:()=>gt,KHR_lights:()=>ae,KHR_materials_anisotropy:()=>_e,KHR_materials_clearcoat:()=>de,KHR_materials_diffuse_transmission:()=>Se,KHR_materials_dispersion:()=>Ie,KHR_materials_emissive_strength:()=>ye,KHR_materials_ior:()=>xe,KHR_materials_iridescence:()=>fe,KHR_materials_pbrSpecularGlossiness:()=>se,KHR_materials_sheen:()=>be,KHR_materials_specular:()=>Ae,KHR_materials_transmission:()=>Le,KHR_materials_unlit:()=>ce,KHR_materials_variants:()=>Oe,KHR_materials_volume:()=>Pe,KHR_mesh_quantization:()=>Be,KHR_node_visibility:()=>Tt,KHR_texture_basisu:()=>Ge,KHR_texture_transform:()=>Ve,KHR_xmp_json_ld:()=>Ke,MSFT_audio_emitter:()=>it,MSFT_lod:()=>lt,MSFT_minecraftMesh:()=>ut,MSFT_sRGBFactors:()=>ht});var u={};a.r(u);var d={};a.r(d),a.d(d,{ArrayItem:()=>U,EXT_lights_ies:()=>te,EXT_lights_image_based:()=>q,EXT_mesh_gpu_instancing:()=>W,EXT_meshopt_compression:()=>z,EXT_texture_avif:()=>$,EXT_texture_webp:()=>Q,ExtrasAsMetadata:()=>wt,GLTFFileLoader:()=>E,GLTFLoader:()=>H,KHR_animation_pointer:()=>ot,KHR_draco_mesh_compression:()=>re,KHR_interactivity:()=>gt,KHR_lights:()=>ae,KHR_materials_anisotropy:()=>_e,KHR_materials_clearcoat:()=>de,KHR_materials_diffuse_transmission:()=>Se,KHR_materials_dispersion:()=>Ie,KHR_materials_emissive_strength:()=>ye,KHR_materials_ior:()=>xe,KHR_materials_iridescence:()=>fe,KHR_materials_pbrSpecularGlossiness:()=>se,KHR_materials_sheen:()=>be,KHR_materials_specular:()=>Ae,KHR_materials_transmission:()=>Le,KHR_materials_unlit:()=>ce,KHR_materials_variants:()=>Oe,KHR_materials_volume:()=>Pe,KHR_mesh_quantization:()=>Be,KHR_node_visibility:()=>Tt,KHR_texture_basisu:()=>Ge,KHR_texture_transform:()=>Ve,KHR_xmp_json_ld:()=>Ke,LoadBoundingInfoFromPositionAccessor:()=>K,MSFT_audio_emitter:()=>it,MSFT_lod:()=>lt,MSFT_minecraftMesh:()=>ut,MSFT_sRGBFactors:()=>ht,registerGLTFExtension:()=>D,registeredGLTFExtensions:()=>G,unregisterGLTFExtension:()=>V});var h={};a.r(h),a.d(h,{GLTF2:()=>d,GLTFFileLoader:()=>E,GLTFLoaderAnimationStartMode:()=>T,GLTFLoaderCoordinateSystemMode:()=>A,GLTFLoaderState:()=>x,GLTFValidation:()=>w});var f=function(e,t){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},f(e,t)};function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var _=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function m(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}l((r=r.apply(e,t||[])).next())}))}function y(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=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 v=a(597);function b(e,t,n,r){var o={externalResourceFunction:r};return n&&(o.uri="file:"===t?n:t+n),ArrayBuffer.isView(e)?GLTFValidator.validateBytes(e,o):GLTFValidator.validateString(e,o)}function g(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":b(n.data,n.rootUrl,n.fileName,(function(t){return new Promise((function(n,r){var o=e.length;e.push({resolve:n,reject:r}),postMessage({id:"getExternalResource",index:o,uri:t})}))})).then((function(e){postMessage({id:"validate.resolve",value:e})}),(function(e){postMessage({id:"validate.reject",reason:e})}));break;case"getExternalResource.resolve":e[n.index].resolve(n.value);break;case"getExternalResource.reject":e[n.index].reject(n.reason)}}}var A,T,x,w=function(){function e(){}return e.ValidateAsync=function(e,t,n,r){var o=this;return"function"==typeof Worker?new Promise((function(a,i){var s="".concat(b,"(").concat(g,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),c=new Worker(l),u=function(e){c.removeEventListener("error",u),c.removeEventListener("message",d),i(e)},d=function(e){var t=e.data;switch(t.id){case"getExternalResource":r(t.uri).then((function(e){c.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e.buffer])}),(function(e){c.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})}));break;case"validate.resolve":c.removeEventListener("error",u),c.removeEventListener("message",d),a(t.value),c.terminate();break;case"validate.reject":c.removeEventListener("error",u),c.removeEventListener("message",d),i(t.reason),c.terminate()}};if(c.addEventListener("error",u),c.addEventListener("message",d),c.postMessage({id:"init",url:v.Tools.GetBabylonScriptURL(o.Configuration.url)}),ArrayBuffer.isView(e)){var h=e.slice();c.postMessage({id:"validate",data:h,rootUrl:t,fileName:n},[h.buffer])}else c.postMessage({id:"validate",data:e,rootUrl:t,fileName:n})})):(this._LoadScriptPromise||(this._LoadScriptPromise=v.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return b(e,t,n,r)})))},e.Configuration={url:"".concat(v.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),O="Z2xURg",C="gltf",M={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};function L(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(A||(A={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(T||(T={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(x||(x={}));var E=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new v.Observable,n.onMeshLoadedObservable=new v.Observable,n.onSkinLoadedObservable=new v.Observable,n.onTextureLoadedObservable=new v.Observable,n.onMaterialLoadedObservable=new v.Observable,n.onCameraLoadedObservable=new v.Observable,n.onCompleteObservable=new v.Observable,n.onErrorObservable=new v.Observable,n.onDisposeObservable=new v.Observable,n.onExtensionLoadedObservable=new v.Observable,n.validate=!1,n.onValidatedObservable=new v.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=C,n.extensions=M,n.onLoaderStateChangedObservable=new v.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(t),n}return p(t,e),Object.defineProperty(t.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),e&&(this._onParsedObserver=this.onParsedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),e&&(this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSkinLoaded",{set:function(e){this._onSkinLoadedObserver&&this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver),e&&(this._onSkinLoadedObserver=this.onSkinLoadedObservable.add((function(t){return e(t.node,t.skinnedNode)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),e&&(this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),e&&(this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),e&&(this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.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:!1,configurable:!0}),Object.defineProperty(t.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:!1,configurable:!0}),Object.defineProperty(t.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},t.prototype.loadFile=function(e,t,n,r,o,a,i,s){var l=this;if(ArrayBuffer.isView(t))return this._loadBinary(e,t,n,r,i,s),null;this._progressCallback=o;var c=t.name||v.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&v.Logger.Warn("glTF validation is not supported when range requests are enabled");var u={abort:function(){},onCompleteObservable:new v.Observable},d={readAsync:function(n,r){return new Promise((function(o,a){l._loadFile(e,t,(function(e){o(new Uint8Array(e))}),!0,(function(e){a(e)}),(function(e){e.setRequestHeader("Range","bytes=".concat(n,"-").concat(n+r-1))}))}))},byteLength:0};return this._unpackBinaryAsync(new v.DataReader(d)).then((function(e){u.onCompleteObservable.notifyObservers(u),r(e)}),i?function(e){return i(void 0,e)}:void 0),u}return this._loadFile(e,t,(function(t){l._validate(e,new Uint8Array(t,0,t.byteLength),n,c),l._unpackBinaryAsync(new v.DataReader({readAsync:function(e,n){return L(t,e,n)},byteLength:t.byteLength})).then((function(e){r(e)}),i?function(e){return i(void 0,e)}:void 0)}),!0,i)}return this._loadFile(e,t,(function(t){try{l._validate(e,t,n,c),r({json:l._parseJson(t)})}catch(e){i&&i()}}),!1,i)},t.prototype._loadBinary=function(e,t,n,r,o,a){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n,a),this._unpackBinaryAsync(new v.DataReader({readAsync:function(e,n){return function(e,t,n){try{if(t<0||t>=e.byteLength)throw new RangeError("Offset is out of range.");if(t+n>e.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,n))}catch(e){return Promise.reject(e)}}(t,e,n)},byteLength:t.byteLength})).then((function(e){r(e)}),o?function(e){return o(void 0,e)}:void 0)},t.prototype.importMeshAsync=function(e,t,n,r,o,a){var i=this;return Promise.resolve().then((function(){return i.onParsedObservable.notifyObservers(n),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(n),i._loader.importMeshAsync(e,t,null,n,r,o,a)}))},t.prototype.loadAsync=function(e,t,n,r,o){var a=this;return Promise.resolve().then((function(){return a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t),a._loader.loadAsync(e,t,n,r,o)}))},t.prototype.loadAssetContainerAsync=function(e,t,n,r,o){var a=this;return Promise.resolve().then((function(){a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(t);var i=new v.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var c=[];a.onCameraLoadedObservable.add((function(e){c.push(e)}));var u=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&u.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,n,r,o).then((function(e){return Array.prototype.push.apply(i.geometries,e.geometries),Array.prototype.push.apply(i.meshes,e.meshes),Array.prototype.push.apply(i.particleSystems,e.particleSystems),Array.prototype.push.apply(i.skeletons,e.skeletons),Array.prototype.push.apply(i.animationGroups,e.animationGroups),Array.prototype.push.apply(i.materials,s),Array.prototype.push.apply(i.textures,l),Array.prototype.push.apply(i.lights,e.lights),Array.prototype.push.apply(i.transformNodes,e.transformNodes),Array.prototype.push.apply(i.cameras,c),Array.prototype.push.apply(i.morphTargetManagers,u),i}))}))},t.prototype.canDirectLoad=function(e){return function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+O)||e.startsWith("data:;base64,"+O)||e.startsWith("data:application/octet-stream;base64,"+O)||e.startsWith("data:model/gltf-binary;base64,"+O)}(e)},t.prototype.directLoad=function(e,t){if(t.startsWith("base64,"+O)||t.startsWith(";base64,"+O)||t.startsWith("application/octet-stream;base64,"+O)||t.startsWith("model/gltf-binary;base64,"+O)){var n=(0,v.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new v.DataReader({readAsync:function(e,t){return L(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})},t.prototype.createPlugin=function(e){return new t(e[C])},Object.defineProperty(t.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,n){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){n(e)}))}))},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(x[this._state]))},t.prototype._loadFile=function(e,t,n,r,o,a){var i=this,s=e._loadFile(t,n,(function(e){i._onProgress(e,s)}),!0,r,o,a);return s.onCompleteObservable.add((function(){s._lengthComputable=!0,s._total=s._loaded})),this._requests.push(s),s},t.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var n=!0,r=0,o=0,a=0,i=this._requests;a<i.length;a++){var s=i[a];if(void 0===s._lengthComputable||void 0===s._loaded||void 0===s._total)return;n=n&&s._lengthComputable,r+=s._loaded,o+=s._total}this._progressCallback({lengthComputable:n,loaded:r,total:n?o:0})}},t.prototype._validate=function(e,t,n,r){var o=this;void 0===n&&(n=""),void 0===r&&(r=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),w.ValidateAsync(t,n,r,(function(t){return o.preprocessUrlAsync(n+t).then((function(t){return e._loadFileAsync(t,void 0,!0,!0).then((function(e){return new Uint8Array(e,0,e.byteLength)}))}))})).then((function(e){o._endPerformanceCounter("Validate JSON"),o.onValidatedObservable.notifyObservers(e),o.onValidatedObservable.clear()}),(function(e){o._endPerformanceCounter("Validate JSON"),v.Tools.Warn("Failed to validate: ".concat(e.message)),o.onValidatedObservable.clear()})))},t.prototype._getLoader=function(e){var n=e.json.asset||{};this._log("Asset version: ".concat(n.version)),n.minVersion&&this._log("Asset minimum version: ".concat(n.minVersion)),n.generator&&this._log("Asset generator: ".concat(n.generator));var r=t._parseVersion(n.version);if(!r)throw new Error("Invalid version: "+n.version);if(void 0!==n.minVersion){var o=t._parseVersion(n.minVersion);if(!o)throw new Error("Invalid minimum version: "+n.minVersion);if(t._compareVersion(o,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+n.minVersion)}var a={1:t._CreateGLTF1Loader,2:t._CreateGLTF2Loader}[r.major];if(!a)throw new Error("Unsupported version: "+n.version);return a(this)},t.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: ".concat(e.length));var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},t.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var n=e.readUint32();if(1179937895!==n)throw new v.RuntimeError("Unexpected magic: "+n,v.ErrorCodes.GLTFLoaderUnexpectedMagicError);var r=e.readUint32();t.loggingEnabled&&t._log("Binary version: ".concat(r));var o,a=e.readUint32();switch(t.useRangeRequests||a===e.buffer.byteLength||v.Logger.Warn("Length in header does not match actual data length: ".concat(a," != ").concat(e.buffer.byteLength)),r){case 1:o=t._unpackBinaryV1Async(e,a);break;case 2:o=t._unpackBinaryV2Async(e,a);break;default:throw new Error("Unsupported version: "+r)}return t._endPerformanceCounter("Unpack Binary"),o}))},t.prototype._unpackBinaryV1Async=function(e,t){var n=e.readUint32(),r=e.readUint32();if(0!==r)throw new Error("Unexpected content format: ".concat(r));var o=t-e.byteOffset,a={json:this._parseJson(e.readString(n)),bin:null};if(0!==o){var i=e.byteOffset;a.bin={readAsync:function(t,n){return e.buffer.readAsync(i+t,n)},byteLength:o}}return Promise.resolve(a)},t.prototype._unpackBinaryV2Async=function(e,t){var n=this,r=1313821514,o=e.readUint32();if(e.readUint32()!==r)throw new Error("First chunk format is not JSON");return e.byteOffset+o===t?e.loadAsync(o).then((function(){return{json:n._parseJson(e.readString(o)),bin:null}})):e.loadAsync(o+8).then((function(){var a={json:n._parseJson(e.readString(o)),bin:null},i=function(){var n=e.readUint32();switch(e.readUint32()){case r:throw new Error("Unexpected JSON chunk");case 5130562:var o=e.byteOffset;a.bin={readAsync:function(t,n){return e.buffer.readAsync(o+t,n)},byteLength:n},e.skipBytes(n);break;default:e.skipBytes(n)}return e.byteOffset!==t?e.loadAsync(8).then(i):Promise.resolve(a)};return i()}))},t._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},t._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},t.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},t.prototype._logClose=function(){--this._logIndentLevel},t.prototype._logEnabled=function(e){var n=t._logSpaces.substring(0,2*this._logIndentLevel);v.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){v.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){v.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(function(){function e(){this.coordinateSystemMode=A.AUTO,this.animationStartMode=T.FIRST,this.loadNodeAnimations=!0,this.loadSkins=!0,this.loadMorphTargets=!0,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this.useRangeRequests=!1,this.createInstances=!0,this.alwaysComputeBoundingBox=!1,this.loadAllMaterials=!1,this.loadOnlyMaterials=!1,this.skipMaterials=!1,this.useSRGBBuffers=!0,this.targetFps=60,this.alwaysComputeSkeletonRootNode=!1,this.useGltfTextureNames=!1,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.extensionOptions={}}return e.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,c,u,d,h,f,p,_,m,y,v,b,g,A;e&&(this.onParsed=e.onParsed,this.coordinateSystemMode=null!==(t=e.coordinateSystemMode)&&void 0!==t?t:this.coordinateSystemMode,this.animationStartMode=null!==(n=e.animationStartMode)&&void 0!==n?n:this.animationStartMode,this.loadNodeAnimations=null!==(r=e.loadNodeAnimations)&&void 0!==r?r:this.loadNodeAnimations,this.loadSkins=null!==(o=e.loadSkins)&&void 0!==o?o:this.loadSkins,this.loadMorphTargets=null!==(a=e.loadMorphTargets)&&void 0!==a?a:this.loadMorphTargets,this.compileMaterials=null!==(i=e.compileMaterials)&&void 0!==i?i:this.compileMaterials,this.useClipPlane=null!==(s=e.useClipPlane)&&void 0!==s?s:this.useClipPlane,this.compileShadowGenerators=null!==(l=e.compileShadowGenerators)&&void 0!==l?l:this.compileShadowGenerators,this.transparencyAsCoverage=null!==(c=e.transparencyAsCoverage)&&void 0!==c?c:this.transparencyAsCoverage,this.useRangeRequests=null!==(u=e.useRangeRequests)&&void 0!==u?u:this.useRangeRequests,this.createInstances=null!==(d=e.createInstances)&&void 0!==d?d:this.createInstances,this.alwaysComputeBoundingBox=null!==(h=e.alwaysComputeBoundingBox)&&void 0!==h?h:this.alwaysComputeBoundingBox,this.loadAllMaterials=null!==(f=e.loadAllMaterials)&&void 0!==f?f:this.loadAllMaterials,this.loadOnlyMaterials=null!==(p=e.loadOnlyMaterials)&&void 0!==p?p:this.loadOnlyMaterials,this.skipMaterials=null!==(_=e.skipMaterials)&&void 0!==_?_:this.skipMaterials,this.useSRGBBuffers=null!==(m=e.useSRGBBuffers)&&void 0!==m?m:this.useSRGBBuffers,this.targetFps=null!==(y=e.targetFps)&&void 0!==y?y:this.targetFps,this.alwaysComputeSkeletonRootNode=null!==(v=e.alwaysComputeSkeletonRootNode)&&void 0!==v?v:this.alwaysComputeSkeletonRootNode,this.useGltfTextureNames=null!==(b=e.useGltfTextureNames)&&void 0!==b?b:this.useGltfTextureNames,this.preprocessUrlAsync=null!==(g=e.preprocessUrlAsync)&&void 0!==g?g:this.preprocessUrlAsync,this.customRootNode=e.customRootNode,this.onMeshLoaded=e.onMeshLoaded,this.onSkinLoaded=e.onSkinLoaded,this.onTextureLoaded=e.onTextureLoaded,this.onMaterialLoaded=e.onMaterialLoaded,this.onCameraLoaded=e.onCameraLoaded,this.extensionOptions=null!==(A=e.extensionOptions)&&void 0!==A?A:this.extensionOptions)},e}());(0,v.RegisterSceneLoaderPlugin)(new E);var S=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==S){for(var R in S.BABYLON=S.BABYLON||{},l)S.BABYLON[R]=l[R];for(var R in s)S.BABYLON[R]=s[R]}function P(e,t,n,r){return v.Vector3.FromArray(t,n).scaleInPlace(r)}var N=function(){function e(e,t,n,r){this.type=e,this.name=t,this.getValue=n,this.getStride=r}return e.prototype._buildAnimation=function(e,t,n){var r=new v.Animation(e,this.name,t,this.type);return r.setKeys(n),r},e}(),I=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.buildAnimations=function(e,t,n,r,o){o(e._babylonTransformNode,this._buildAnimation(t,n,r))},t}(N),F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.buildAnimations=function(e,t,n,r,o){if(e._numMorphTargets)for(var a=function(a){var s=new v.Animation("".concat(t,"_").concat(a),i.name,n,i.type);if(s.setKeys(r.map((function(e){return{frame:e.frame,inTangent:e.inTangent?e.inTangent[a]:void 0,value:e.value[a],outTangent:e.outTangent?e.outTangent[a]:void 0,interpolation:e.interpolation}}))),e._primitiveBabylonMeshes)for(var l=0,c=e._primitiveBabylonMeshes;l<c.length;l++){var u=c[l];if(u.morphTargetManager){var d=u.morphTargetManager.getTarget(a),h=s.clone();d.animations.push(h),o(d,h)}}},i=this,s=0;s<e._numMorphTargets;s++)a(s)},t}(N),B={translation:[new I(v.Animation.ANIMATIONTYPE_VECTOR3,"position",P,(function(){return 3}))],rotation:[new I(v.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",(function(e,t,n,r){return v.Quaternion.FromArray(t,n).scaleInPlace(r)}),(function(){return 4}))],scale:[new I(v.Animation.ANIMATIONTYPE_VECTOR3,"scaling",P,(function(){return 3}))],weights:[new F(v.Animation.ANIMATIONTYPE_FLOAT,"influence",(function(e,t,n,r){for(var o=new Array(e._numMorphTargets),a=0;a<o.length;a++)o[a]=t[n++]*r;return o}),(function(e){return e._numMorphTargets}))]},k=new Map,G=k;function D(e,t,n){V(e)&&v.Logger.Warn("Extension with the name '".concat(e,"' already exists")),k.set(e,{isGLTFExtension:t,factory:n})}function V(e){return k.delete(e)}var U=function(){function e(){}return e.Get=function(e,t,n){if(!t||null==n||!t[n])throw new Error("".concat(e,": Failed to find index (").concat(n,")"));return t[n]},e.TryGet=function(e,t){return e&&null!=t&&e[t]?e[t]:null},e.Assign=function(e){if(e)for(var t=0;t<e.length;t++)e[t].index=t},e}();function K(e){if(e.min&&e.max){var t=e.min,n=e.max,r=v.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=v.TmpVectors.Vector3[1].copyFromFloats(n[0],n[1],n[2]);if(e.normalized&&5126!==e.componentType){var a=1;switch(e.componentType){case 5120:a=127;break;case 5121:a=255;break;case 5122:a=32767;break;case 5123:a=65535}var i=1/a;r.scaleInPlace(i),o.scaleInPlace(i)}return new v.BoundingInfo(r,o)}return null}var H=function(){function e(e){this._completePromises=new Array,this._assetContainer=null,this._babylonLights=[],this._disableInstancedMesh=0,this._allMaterialsDirtyRequired=!1,this._extensions=new Array,this._disposed=!1,this._rootUrl=null,this._fileName=null,this._uniqueRootUrl=null,this._bin=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions=new Array,this._parent=e}return e.RegisterExtension=function(e,t){D(e,!1,t)},e.UnregisterExtension=function(e){return V(e)},Object.defineProperty(e.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootUrl",{get:function(){return this._rootUrl},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._completePromises.length=0,this._extensions.forEach((function(e){return e.dispose&&e.dispose()})),this._extensions.length=0,this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())},e.prototype.importMeshAsync=function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),Promise.resolve().then((function(){s._babylonScene=t,s._assetContainer=n,s._loadData(r);var a=null;if(e){var l={};if(s._gltf.nodes)for(var c=0,u=s._gltf.nodes;c<u.length;c++){var d=u[c];d.name&&(l[d.name]=d.index)}a=(e instanceof Array?e:[e]).map((function(e){var t=l[e];if(void 0===t)throw new Error("Failed to find node '".concat(e,"'"));return t}))}return s._loadAsync(o,i,a,(function(){return{meshes:s._getMeshes(),particleSystems:[],skeletons:s._getSkeletons(),animationGroups:s._getAnimationGroups(),lights:s._babylonLights,transformNodes:s._getTransformNodes(),geometries:s._getGeometries(),spriteManagers:[]}}))}))},e.prototype.loadAsync=function(e,t,n,r,o){var a=this;return void 0===o&&(o=""),Promise.resolve().then((function(){return a._babylonScene=e,a._loadData(t),a._loadAsync(n,o,null,(function(){}))}))},e.prototype._loadAsync=function(e,t,n,r){var o=this;return Promise.resolve().then((function(){return m(o,void 0,void 0,(function(){var o,a,i,s,l,c,u,d,h,f,p=this;return y(this,(function(_){switch(_.label){case 0:return this._rootUrl=e,this._uniqueRootUrl=!e.startsWith("file:")&&t?e:"".concat(e).concat(Date.now(),"/"),this._fileName=t,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:if(_.sent(),o="".concat(x[x.LOADING]," => ").concat(x[x.READY]),a="".concat(x[x.LOADING]," => ").concat(x[x.COMPLETE]),this._parent._startPerformanceCounter(o),this._parent._startPerformanceCounter(a),this._parent._setState(x.LOADING),this._extensionsOnLoading(),i=new Array,s=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(n?i.push(this.loadSceneAsync("/nodes",{nodes:n,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(l=U.Get("/scene",this._gltf.scenes,this._gltf.scene||0),i.push(this.loadSceneAsync("/scenes/".concat(l.index),l)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(c=0;c<this._gltf.materials.length;++c)u=this._gltf.materials[c],d="/materials/"+c,h=v.Material.TriangleFillMode,i.push(this._loadMaterialAsync(d,u,null,h,(function(){})));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=s:this._babylonScene._forceBlockMaterialDirtyMechanism(s),this._parent.compileMaterials&&i.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&i.push(this._compileShadowGeneratorsAsync()),f=Promise.all(i).then((function(){p._rootBabylonMesh&&p._rootBabylonMesh!==p._parent.customRootNode&&p._rootBabylonMesh.setEnabled(!0);for(var e=0,t=p._babylonScene.materials;e<t.length;e++){var n=t[e];void 0!==n.maxSimultaneousLights&&(n.maxSimultaneousLights=Math.max(n.maxSimultaneousLights,p._babylonScene.lights.length))}return p._extensionsOnReady(),p._parent._setState(x.READY),p._startAnimations(),r()})),[2,f.then((function(e){return p._parent._endPerformanceCounter(o),v.Tools.SetImmediate((function(){p._disposed||Promise.all(p._completePromises).then((function(){p._parent._endPerformanceCounter(a),p._parent._setState(x.COMPLETE),p._parent.onCompleteObservable.notifyObservers(void 0),p._parent.onCompleteObservable.clear(),p.dispose()}),(function(e){p._parent.onErrorObservable.notifyObservers(e),p._parent.onErrorObservable.clear(),p.dispose()}))})),e}))]}}))}))})).catch((function(e){throw o._disposed||(o._parent.onErrorObservable.notifyObservers(e),o._parent.onErrorObservable.clear(),o.dispose()),e}))},e.prototype._loadData=function(e){if(this._gltf=e.json,this._setupData(),e.bin){var t=this._gltf.buffers;if(t&&t[0]&&!t[0].uri){var n=t[0];(n.byteLength<e.bin.byteLength-3||n.byteLength>e.bin.byteLength)&&v.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else v.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(U.Assign(this._gltf.accessors),U.Assign(this._gltf.animations),U.Assign(this._gltf.buffers),U.Assign(this._gltf.bufferViews),U.Assign(this._gltf.cameras),U.Assign(this._gltf.images),U.Assign(this._gltf.materials),U.Assign(this._gltf.meshes),U.Assign(this._gltf.nodes),U.Assign(this._gltf.samplers),U.Assign(this._gltf.scenes),U.Assign(this._gltf.skins),U.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},t=0,n=this._gltf.nodes;t<n.length;t++)if((l=n[t]).children)for(var r=0,o=l.children;r<o.length;r++)e[o[r]]=l.index;for(var a=this._createRootNode(),i=0,s=this._gltf.nodes;i<s.length;i++){var l,c=e[(l=s[i]).index];l.parent=void 0===c?a:this._gltf.nodes[c]}}},e.prototype._loadExtensionsAsync=function(){return m(this,void 0,void 0,(function(){var e,t,n,r,o,a,i,s,l,c,u,d=this;return y(this,(function(h){switch(h.label){case 0:return e=[],G.forEach((function(t,n){var r;!1===(null===(r=d.parent.extensionOptions[n])||void 0===r?void 0:r.enabled)?t.isGLTFExtension&&d.isExtensionUsed(n)&&v.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!d.isExtensionUsed(n)||e.push(m(d,void 0,void 0,(function(){var e;return y(this,(function(r){switch(r.label){case 0:return[4,t.factory(this)];case 1:return(e=r.sent()).name!==n&&v.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(n)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}}))})))})),n=(t=(c=this._extensions).push).apply,r=[c],[4,Promise.all(e)];case 1:if(n.apply(t,r.concat([h.sent()])),this._extensions.sort((function(e,t){return(e.order||Number.MAX_VALUE)-(t.order||Number.MAX_VALUE)})),this._parent.onExtensionLoadedObservable.clear(),this._gltf.extensionsRequired)for(o=function(e){if(!a._extensions.some((function(t){return t.name===e&&t.enabled}))){if(!1===(null===(u=a.parent.extensionOptions[e])||void 0===u?void 0:u.enabled))throw new Error("Required extension ".concat(e," is disabled"));throw new Error("Required extension ".concat(e," is not available"))}},a=this,i=0,s=this._gltf.extensionsRequired;i<s.length;i++)l=s[i],o(l);return[2]}}))}))},e.prototype._createRootNode=function(){if(void 0!==this._parent.customRootNode)return this._rootBabylonMesh=this._parent.customRootNode,{_babylonTransformNode:null===this._rootBabylonMesh?void 0:this._rootBabylonMesh,index:-1};this._babylonScene._blockEntityCollection=!!this._assetContainer;var t=new v.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=t,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var n={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case A.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case A.FORCE_RIGHT_HANDED:this._babylonScene.useRightHandedSystem=!0;break;default:throw new Error("Invalid coordinate system mode (".concat(this._parent.coordinateSystemMode,")"))}return this._parent.onMeshLoadedObservable.notifyObservers(t),n},e.prototype.loadSceneAsync=function(e,t){var n=this,r=this._extensionsLoadSceneAsync(e,t);if(r)return r;var o=new Array;if(this.logOpen("".concat(e," ").concat(t.name||"")),t.nodes)for(var a=0,i=t.nodes;a<i.length;a++){var s=i[a],l=U.Get("".concat(e,"/nodes/").concat(s),this._gltf.nodes,s);o.push(this.loadNodeAsync("/nodes/".concat(l.index),l,(function(e){e.parent=n._rootBabylonMesh})))}for(var c=0,u=this._postSceneLoadActions;c<u.length;c++)(0,u[c])();return o.push(this._loadAnimationsAsync()),this.logClose(),Promise.all(o).then((function(){}))},e.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var n=0,r=e._primitiveBabylonMeshes;n<r.length;n++)t(r[n])},e.prototype._getGeometries=function(){var e=[],t=this._gltf.nodes;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];this._forEachPrimitive(o,(function(t){var n=t.geometry;n&&-1===e.indexOf(n)&&e.push(n)}))}return e},e.prototype._getMeshes=function(){var e=[];this._rootBabylonMesh instanceof v.AbstractMesh&&e.push(this._rootBabylonMesh);var t=this._gltf.nodes;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];this._forEachPrimitive(o,(function(t){e.push(t)}))}return e},e.prototype._getTransformNodes=function(){var e=[],t=this._gltf.nodes;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];o._babylonTransformNode&&"TransformNode"===o._babylonTransformNode.getClassName()&&e.push(o._babylonTransformNode),o._babylonTransformNodeForSkin&&e.push(o._babylonTransformNodeForSkin)}return e},e.prototype._getSkeletons=function(){var e=[],t=this._gltf.skins;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];o._data&&e.push(o._data.babylonSkeleton)}return e},e.prototype._getAnimationGroups=function(){var e=[],t=this._gltf.animations;if(t)for(var n=0,r=t;n<r.length;n++){var o=r[n];o._babylonAnimationGroup&&e.push(o._babylonAnimationGroup)}return e},e.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case T.NONE:break;case T.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case T.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void v.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},e.prototype.loadNodeAsync=function(t,n,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadNodeAsync(t,n,r);if(a)return a;if(n._babylonTransformNode)throw new Error("".concat(t,": Invalid recursive node hierarchy"));var i=new Array;this.logOpen("".concat(t," ").concat(n.name||""));var s=function(a){if(e.AddPointerMetadata(a,t),e._LoadTransform(n,a),null!=n.camera){var s=U.Get("".concat(t,"/camera"),o._gltf.cameras,n.camera);i.push(o.loadCameraAsync("/cameras/".concat(s.index),s,(function(e){e.parent=a})))}if(n.children)for(var l=0,c=n.children;l<c.length;l++){var u=c[l],d=U.Get("".concat(t,"/children/").concat(u),o._gltf.nodes,u);i.push(o.loadNodeAsync("/nodes/".concat(d.index),d,(function(e){e.parent=a})))}r(a)},l=null!=n.mesh,c=this._parent.loadSkins&&null!=n.skin;if(!l||c){var u=n.name||"node".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var d=new v.TransformNode(u,this._babylonScene);d._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==n.mesh?n._babylonTransformNode=d:n._babylonTransformNodeForSkin=d,s(d)}if(l)if(c){var h=U.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh);i.push(this._loadMeshAsync("/meshes/".concat(h.index),n,h,(function(e){var r=n._babylonTransformNodeForSkin;e.metadata=(0,v.deepMerge)(r.metadata,e.metadata||{});var a=U.Get("".concat(t,"/skin"),o._gltf.skins,n.skin);i.push(o._loadSkinAsync("/skins/".concat(a.index),n,a,(function(t){o._forEachPrimitive(n,(function(e){e.skeleton=t})),o._postSceneLoadActions.push((function(){if(null!=a.skeleton){var t=U.Get("/skins/".concat(a.index,"/skeleton"),o._gltf.nodes,a.skeleton).parent;n.index===t.index?e.parent=r.parent:e.parent=t._babylonTransformNode}else e.parent=o._rootBabylonMesh;o._parent.onSkinLoadedObservable.notifyObservers({node:r,skinnedNode:e})}))})))})))}else h=U.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh),i.push(this._loadMeshAsync("/meshes/".concat(h.index),n,h,s));return this.logClose(),Promise.all(i).then((function(){return o._forEachPrimitive(n,(function(e){e.geometry&&e.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)})),n._babylonTransformNode}))},e.prototype._loadMeshAsync=function(e,t,n,r){var o=n.primitives;if(!o||!o.length)throw new Error("".concat(e,": Primitives are missing"));null==o[0].index&&U.Assign(o);var a=new Array;this.logOpen("".concat(e," ").concat(n.name||""));var i=t.name||"node".concat(t.index);if(1===o.length){var s=n.primitives[0];a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),i,t,n,s,(function(e){t._babylonTransformNode=e,t._primitiveBabylonMeshes=[e]})))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new v.TransformNode(i,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(var l=0,c=o;l<c.length;l++)s=c[l],a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),"".concat(i,"_primitive").concat(s.index),t,n,s,(function(e){e.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(e)})))}return r(t._babylonTransformNode),this.logClose(),Promise.all(a).then((function(){return t._babylonTransformNode}))},e.prototype._loadMeshPrimitiveAsync=function(t,n,r,o,a,i){var s=this,l=this._extensionsLoadMeshPrimitiveAsync(t,n,r,o,a,i);if(l)return l;this.logOpen("".concat(t));var c,u,d=0===this._disableInstancedMesh&&this._parent.createInstances&&null==r.skin&&!o.primitives[0].targets;if(d&&a._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(c=a._instanceData.babylonSourceMesh.createInstance(n))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,u=a._instanceData.promise;else{var h=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var f=new v.Mesh(n,this._babylonScene);f._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,f.sideOrientation=this._babylonScene.useRightHandedSystem?v.Material.CounterClockWiseSideOrientation:v.Material.ClockWiseSideOrientation,this._createMorphTargets(t,r,o,a,f),h.push(this._loadVertexDataAsync(t,a,f).then((function(e){return s._loadMorphTargetsAsync(t,a,f,e).then((function(){s._disposed||(s._babylonScene._blockEntityCollection=!!s._assetContainer,e.applyToMesh(f),e._parentContainer=s._assetContainer,s._babylonScene._blockEntityCollection=!1)}))})));var p=e._GetDrawMode(t,a.mode);if(null==a.material){var _=this._defaultBabylonMaterialData[p];_||(_=this._createDefaultMaterial("__GLTFLoader._default",p),this._parent.onMaterialLoadedObservable.notifyObservers(_),this._defaultBabylonMaterialData[p]=_),f.material=_}else if(!this.parent.skipMaterials){var m=U.Get("".concat(t,"/material"),this._gltf.materials,a.material);h.push(this._loadMaterialAsync("/materials/".concat(m.index),m,f,p,(function(e){f.material=e})))}u=Promise.all(h),d&&(a._instanceData={babylonSourceMesh:f,promise:u}),c=f}return e.AddPointerMetadata(c,t),this._parent.onMeshLoadedObservable.notifyObservers(c),i(c),this.logClose(),u.then((function(){return c}))},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this,o=this._extensionsLoadVertexDataAsync(e,t,n);if(o)return o;var a=t.attributes;if(!a)throw new Error("".concat(e,": Attributes are missing"));var i=new Array,s=new v.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=U.Get("".concat(e,"/indices"),this._gltf.accessors,t.indices);i.push(this._loadIndicesAccessorAsync("/accessors/".concat(l.index),l).then((function(e){s.setIndices(e)})))}var c=function(t,o,l){if(null!=a[t]){n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o);var c=U.Get("".concat(e,"/attributes/").concat(t),r._gltf.accessors,a[t]);i.push(r._loadVertexAccessorAsync("/accessors/".concat(c.index),c,o).then((function(e){if(e.getKind()===v.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=K(c);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,c.count)}))),o==v.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(c)}};return c("POSITION",v.VertexBuffer.PositionKind),c("NORMAL",v.VertexBuffer.NormalKind),c("TANGENT",v.VertexBuffer.TangentKind),c("TEXCOORD_0",v.VertexBuffer.UVKind),c("TEXCOORD_1",v.VertexBuffer.UV2Kind),c("TEXCOORD_2",v.VertexBuffer.UV3Kind),c("TEXCOORD_3",v.VertexBuffer.UV4Kind),c("TEXCOORD_4",v.VertexBuffer.UV5Kind),c("TEXCOORD_5",v.VertexBuffer.UV6Kind),c("JOINTS_0",v.VertexBuffer.MatricesIndicesKind),c("WEIGHTS_0",v.VertexBuffer.MatricesWeightsKind),c("JOINTS_1",v.VertexBuffer.MatricesIndicesExtraKind),c("WEIGHTS_1",v.VertexBuffer.MatricesWeightsExtraKind),c("COLOR_0",v.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(n.hasVertexAlpha=!0)})),Promise.all(i).then((function(){return s}))},e.prototype._createMorphTargets=function(e,t,n,r,o){if(r.targets&&this._parent.loadMorphTargets){if(null==t._numMorphTargets)t._numMorphTargets=r.targets.length;else if(r.targets.length!==t._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var a=n.extras?n.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,o.morphTargetManager=new v.MorphTargetManager(this._babylonScene),o.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,o.morphTargetManager.areUpdatesFrozen=!0;for(var i=0;i<r.targets.length;i++){var s=t.weights?t.weights[i]:n.weights?n.weights[i]:0,l=a?a[i]:"morphTarget".concat(i);o.morphTargetManager.addTarget(new v.MorphTarget(l,s,o.getScene()))}}},e.prototype._loadMorphTargetsAsync=function(e,t,n,r){if(!t.targets||!this._parent.loadMorphTargets)return Promise.resolve();for(var o=new Array,a=n.morphTargetManager,i=0;i<a.numTargets;i++){var s=a.getTarget(i);o.push(this._loadMorphTargetVertexDataAsync("".concat(e,"/targets/").concat(i),r,t.targets[i],s))}return Promise.all(o).then((function(){a.areUpdatesFrozen=!1}))},e.prototype._loadMorphTargetVertexDataAsync=function(e,t,n,r){var o=this,a=new Array,i=function(r,i,s){if(null!=n[r]){var l=t.getVertexBuffer(i);if(l){var c=U.Get("".concat(e,"/").concat(r),o._gltf.accessors,n[r]);a.push(o._loadFloatAccessorAsync("/accessors/".concat(c.index),c).then((function(e){s(l,e)})))}}};return i("POSITION",v.VertexBuffer.PositionKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setPositions(n)})),i("NORMAL",v.VertexBuffer.NormalKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(n.length,(function(e,r){n[r]=t[r]+e})),r.setNormals(n)})),i("TANGENT",v.VertexBuffer.TangentKind,(function(e,t){var n=new Float32Array(t.length/3*4),o=0;e.forEach(t.length/3*4,(function(e,r){(r+1)%4!=0&&(n[o]=t[o]+e,o++)})),r.setTangents(n)})),i("TEXCOORD_0",v.VertexBuffer.UVKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setUVs(n)})),i("TEXCOORD_1",v.VertexBuffer.UV2Kind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,r){n[r]=t[r]+e})),r.setUV2s(n)})),i("COLOR_0",v.VertexBuffer.ColorKind,(function(t,n){var o=null,a=t.getSize();if(3===a){o=new Float32Array(n.length/3*4),t.forEach(n.length,(function(e,t){var r=Math.floor(t/3),a=t%3;o[4*r+a]=n[3*r+a]+e}));for(var i=0;i<n.length/3;++i)o[4*i+3]=1}else{if(4!==a)throw new Error("".concat(e,": Invalid number of components (").concat(a,") for COLOR_0 attribute"));o=new Float32Array(n.length),t.forEach(n.length,(function(e,t){o[t]=n[t]+e}))}r.setColors(o)})),Promise.all(a).then((function(){}))},e._LoadTransform=function(e,t){if(null==e.skin){var n=v.Vector3.Zero(),r=v.Quaternion.Identity(),o=v.Vector3.One();e.matrix?v.Matrix.FromArray(e.matrix).decompose(o,r,n):(e.translation&&(n=v.Vector3.FromArray(e.translation)),e.rotation&&(r=v.Quaternion.FromArray(e.rotation)),e.scale&&(o=v.Vector3.FromArray(e.scale))),t.position=n,t.rotationQuaternion=r,t.scaling=o}},e.prototype._loadSkinAsync=function(e,t,n,r){var o=this;if(!this._parent.loadSkins)return Promise.resolve();var a=this._extensionsLoadSkinAsync(e,t,n);if(a)return a;if(n._data)return r(n._data.babylonSkeleton),n._data.promise;var i="skeleton".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var s=new v.Skeleton(n.name||i,i,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,n,s);var l=this._loadSkinInverseBindMatricesDataAsync(e,n).then((function(e){o._updateBoneMatrices(s,e)}));return n._data={babylonSkeleton:s,promise:l},r(s),l},e.prototype._loadBones=function(e,t,n){if(null==t.skeleton||this._parent.alwaysComputeSkeletonRootNode){var r=this._findSkeletonRootNode("".concat(e,"/joints"),t.joints);if(r)if(void 0===t.skeleton)t.skeleton=r.index;else{var o=U.Get("".concat(e,"/skeleton"),this._gltf.nodes,t.skeleton);o===r||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1}(o,r)||(v.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index)}else v.Logger.Warn("".concat(e,": Failed to find common root"))}for(var a={},i=0,s=t.joints;i<s.length;i++){var l=s[i],c=U.Get("".concat(e,"/joints/").concat(l),this._gltf.nodes,l);this._loadBone(c,t,n,a)}},e.prototype._findSkeletonRootNode=function(e,t){if(0===t.length)return null;for(var n={},r=0,o=t;r<o.length;r++){for(var a=o[r],i=[],s=U.Get("".concat(e,"/").concat(a),this._gltf.nodes,a);-1!==s.index;)i.unshift(s),s=s.parent;n[a]=i}for(var l=null,c=0;;++c){if(c>=(i=n[t[0]]).length)return l;s=i[c];for(var u=1;u<t.length;++u)if(c>=(i=n[t[u]]).length||s!==i[c])return l;l=s}},e.prototype._loadBone=function(e,t,n,r){e._isJoint=!0;var o=r[e.index];if(o)return o;var a=null;e.index!==t.skeleton&&(e.parent&&-1!==e.parent.index?a=this._loadBone(e.parent,t,n,r):void 0!==t.skeleton&&v.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return o=new v.Bone(e.name||"joint".concat(e.index),n,a,this._getNodeMatrix(e),null,null,i),r[e.index]=o,this._postSceneLoadActions.push((function(){o.linkTransformNode(e._babylonTransformNode)})),o},e.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);var n=U.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("/accessors/".concat(n.index),n)},e.prototype._updateBoneMatrices=function(e,t){for(var n=0,r=e.bones;n<r.length;n++){var o=r[n],a=v.Matrix.Identity(),i=o._index;t&&-1!==i&&(v.Matrix.FromArrayToRef(t,16*i,a),a.invertToRef(a));var s=o.getParent();s&&a.multiplyToRef(s.getAbsoluteInverseBindMatrix(),a),o.updateMatrix(a,!1,!1),o._updateAbsoluteBindMatrices(void 0,!1)}},e.prototype._getNodeMatrix=function(e){return e.matrix?v.Matrix.FromArray(e.matrix):v.Matrix.Compose(e.scale?v.Vector3.FromArray(e.scale):v.Vector3.One(),e.rotation?v.Quaternion.FromArray(e.rotation):v.Quaternion.Identity(),e.translation?v.Vector3.FromArray(e.translation):v.Vector3.Zero())},e.prototype.loadCameraAsync=function(t,n,r){void 0===r&&(r=function(){});var o=this._extensionsLoadCameraAsync(t,n,r);if(o)return o;var a=new Array;this.logOpen("".concat(t," ").concat(n.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var i=new v.FreeCamera(n.name||"camera".concat(n.index),v.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,i.ignoreParentScaling=!0,n._babylonCamera=i,i.rotation.set(0,Math.PI,0),n.type){case"perspective":var s=n.perspective;if(!s)throw new Error("".concat(t,": Camera perspective properties are missing"));i.fov=s.yfov,i.minZ=s.znear,i.maxZ=s.zfar||0;break;case"orthographic":if(!n.orthographic)throw new Error("".concat(t,": Camera orthographic properties are missing"));i.mode=v.Camera.ORTHOGRAPHIC_CAMERA,i.orthoLeft=-n.orthographic.xmag,i.orthoRight=n.orthographic.xmag,i.orthoBottom=-n.orthographic.ymag,i.orthoTop=n.orthographic.ymag,i.minZ=n.orthographic.znear,i.maxZ=n.orthographic.zfar;break;default:throw new Error("".concat(t,": Invalid camera type (").concat(n.type,")"))}return e.AddPointerMetadata(i,t),this._parent.onCameraLoadedObservable.notifyObservers(i),r(i),this.logClose(),Promise.all(a).then((function(){return i}))},e.prototype._loadAnimationsAsync=function(){var e=this._gltf.animations;if(!e)return Promise.resolve();for(var t=new Array,n=0;n<e.length;n++){var r=e[n];t.push(this.loadAnimationAsync("/animations/".concat(r.index),r).then((function(e){0===e.targetedAnimations.length&&e.dispose()})))}return Promise.all(t).then((function(){}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return this._extensionsLoadAnimationAsync(e,t)||Promise.resolve().then(a.t.bind(a,597,23)).then((function(r){var o=r.AnimationGroup;n._babylonScene._blockEntityCollection=!!n._assetContainer;var a=new o(t.name||"animation".concat(t.index),n._babylonScene);a._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1,t._babylonAnimationGroup=a;var i=new Array;U.Assign(t.channels),U.Assign(t.samplers);for(var s=0,l=t.channels;s<l.length;s++){var c=l[s];i.push(n._loadAnimationChannelAsync("".concat(e,"/channels/").concat(c.index),e,t,c,(function(e,t){e.animations=e.animations||[],e.animations.push(t),a.addTargetedAnimation(t,e)})))}return Promise.all(i).then((function(){return a.normalize(0),a}))}))},e.prototype._loadAnimationChannelAsync=function(e,t,n,r,o){var a=this._extensionsLoadAnimationChannelAsync(e,t,n,r,o);if(a)return a;if(null==r.target.node)return Promise.resolve();var i,s=U.Get("".concat(e,"/target/node"),this._gltf.nodes,r.target.node),l=r.target.path,c="weights"===l;if(c&&!s._numMorphTargets||!c&&!s._babylonTransformNode)return Promise.resolve();if(!this._parent.loadNodeAnimations&&!c&&!s._isJoint)return Promise.resolve();switch(l){case"translation":i=B.translation;break;case"rotation":i=B.rotation;break;case"scale":i=B.scale;break;case"weights":i=B.weights;break;default:throw new Error("".concat(e,"/target/path: Invalid value (").concat(r.target.path,")"))}var u={object:s,info:i};return this._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,u,o)},e.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=U.Get("".concat(e,"/sampler"),n.samplers,r.sampler);return this._loadAnimationSamplerAsync("".concat(t,"/samplers/").concat(r.sampler),l).then((function(e){for(var t=0,l=o.object,c=0,u=o.info;c<u.length;c++){var d=u[c],h=d.getStride(l),f=e.input,p=e.output,_=new Array(f.length),m=0;switch(e.interpolation){case"STEP":for(var y=0;y<f.length;y++){var v=d.getValue(l,p,m,1);m+=h,_[y]={frame:f[y]*i,value:v,interpolation:1}}break;case"CUBICSPLINE":for(y=0;y<f.length;y++){var b=d.getValue(l,p,m,s);m+=h,v=d.getValue(l,p,m,1),m+=h;var g=d.getValue(l,p,m,s);m+=h,_[y]={frame:f[y]*i,inTangent:b,value:v,outTangent:g}}break;case"LINEAR":for(y=0;y<f.length;y++)v=d.getValue(l,p,m,1),m+=h,_[y]={frame:f[y]*i,value:v}}if(m>0){var A="".concat(n.name||"animation".concat(n.index),"_channel").concat(r.index,"_").concat(t);d.buildAnimations(l,A,i,_,(function(e,n){++t,a(e,n)}))}}}))},e.prototype._loadAnimationSamplerAsync=function(e,t){if(t._data)return t._data;var n=t.interpolation||"LINEAR";switch(n){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error("".concat(e,"/interpolation: Invalid value (").concat(t.interpolation,")"))}var r=U.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=U.Get("".concat(e,"/output"),this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync("/accessors/".concat(r.index),r),this._loadFloatAccessorAsync("/accessors/".concat(o.index),o)]).then((function(e){var t=e[0],r=e[1];return{input:t,interpolation:n,output:r}})),t._data},e.prototype.loadBufferAsync=function(e,t,n,r){var o=this._extensionsLoadBufferAsync(e,t,n,r);if(o)return o;if(!t._data)if(t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{if(!this._bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));t._data=this._bin.readAsync(0,t.byteLength)}return t._data.then((function(t){try{return new Uint8Array(t.buffer,t.byteOffset+n,r)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}}))},e.prototype.loadBufferViewAsync=function(e,t){var n=this._extensionsLoadBufferViewAsync(e,t);if(n)return n;if(t._data)return t._data;var r=U.Get("".concat(e,"/buffer"),this._gltf.buffers,t.buffer);return t._data=this.loadBufferAsync("/buffers/".concat(r.index),r,t.byteOffset||0,t.byteLength),t._data},e.prototype._loadAccessorAsync=function(t,n,r){var o=this;if(n._data)return n._data;var a=e._GetNumComponents(t,n.type),i=a*v.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new r(s));else{var l=U.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){if(5126!==n.componentType||n.normalized||l.byteStride&&l.byteStride!==i){var c=new r(s);return v.VertexBuffer.ForEach(o,n.byteOffset||0,l.byteStride||i,a,n.componentType,c.length,n.normalized||!1,(function(e,t){c[t]=e})),c}return e._GetTypedArray(t,n.componentType,o,n.byteOffset,s)}))}if(n.sparse){var c=n.sparse;n._data=n._data.then((function(s){var l=s,u=U.Get("".concat(t,"/sparse/indices/bufferView"),o._gltf.bufferViews,c.indices.bufferView),d=U.Get("".concat(t,"/sparse/values/bufferView"),o._gltf.bufferViews,c.values.bufferView);return Promise.all([o.loadBufferViewAsync("/bufferViews/".concat(u.index),u),o.loadBufferViewAsync("/bufferViews/".concat(d.index),d)]).then((function(o){var s,u=o[0],d=o[1],h=e._GetTypedArray("".concat(t,"/sparse/indices"),c.indices.componentType,u,c.indices.byteOffset,c.count),f=a*c.count;if(5126!==n.componentType||n.normalized){var p=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,d,c.values.byteOffset,f);s=new r(f),v.VertexBuffer.ForEach(p,0,i,a,n.componentType,s.length,n.normalized||!1,(function(e,t){s[t]=e}))}else s=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,d,c.values.byteOffset,f);for(var _=0,m=0;m<h.length;m++)for(var y=h[m]*a,b=0;b<a;b++)l[y++]=s[_++];return l}))}))}return n._data},e.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},e.prototype._loadIndicesAccessorAsync=function(t,n){if("SCALAR"!==n.type)throw new Error("".concat(t,"/type: Invalid value ").concat(n.type));if(5121!==n.componentType&&5123!==n.componentType&&5125!==n.componentType)throw new Error("".concat(t,"/componentType: Invalid value ").concat(n.componentType));if(n._data)return n._data;if(n.sparse){var r=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n.componentType);n._data=this._loadAccessorAsync(t,n,r)}else{var o=U.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(o.index),o).then((function(r){return e._GetTypedArray(t,n.componentType,r,n.byteOffset,n.count)}))}return n._data},e.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then((function(e){return new v.Buffer(t,e,!1)})),e._babylonBuffer},e.prototype._loadVertexAccessorAsync=function(t,n,r){var o;if(null===(o=n._babylonVertexBuffer)||void 0===o?void 0:o[r])return n._babylonVertexBuffer[r];n._babylonVertexBuffer||(n._babylonVertexBuffer={});var a=this._babylonScene.getEngine();if(n.sparse||null==n.bufferView)n._babylonVertexBuffer[r]=this._loadFloatAccessorAsync(t,n).then((function(e){return new v.VertexBuffer(a,e,r,!1)}));else{var i=U.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._babylonVertexBuffer[r]=this._loadVertexBufferViewAsync(i).then((function(o){var s=e._GetNumComponents(t,n.type);return new v.VertexBuffer(a,o,r,!1,void 0,i.byteStride,void 0,n.byteOffset,s,n.componentType,n.normalized,!0,void 0,!0)}))}return n._babylonVertexBuffer[r]},e.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return t&&(t.baseColorFactor?(n.albedoColor=v.Color3.FromArray(t.baseColorFactor),n.alpha=t.baseColorFactor[3]):n.albedoColor=v.Color3.White(),n.metallic=null==t.metallicFactor?1:t.metallicFactor,n.roughness=null==t.roughnessFactor?1:t.roughnessFactor,t.baseColorTexture&&r.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),t.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),n.albedoTexture=e}))),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),t.metallicRoughnessTexture,(function(e){e.name="".concat(n.name," (Metallic Roughness)"),n.metallicTexture=e}))),n.useMetallnessFromMetallicTextureBlue=!0,n.useRoughnessFromMetallicTextureGreen=!0,n.useRoughnessFromMetallicTextureAlpha=!1)),Promise.all(r).then((function(){}))},e.prototype._loadMaterialAsync=function(t,n,r,o,a){void 0===a&&(a=function(){});var i=this._extensionsLoadMaterialAsync(t,n,r,o,a);if(i)return i;n._data=n._data||{};var s=n._data[o];if(!s){this.logOpen("".concat(t," ").concat(n.name||""));var l=this.createMaterial(t,n,o);s={babylonMaterial:l,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(t,n,l)},n._data[o]=s,e.AddPointerMetadata(l,t),this._parent.onMaterialLoadedObservable.notifyObservers(l),this.logClose()}return r&&(s.babylonMeshes.push(r),r.onDisposeObservable.addOnce((function(){var e=s.babylonMeshes.indexOf(r);-1!==e&&s.babylonMeshes.splice(e,1)}))),a(s.babylonMaterial),s.promise.then((function(){return s.babylonMaterial}))},e.prototype._createDefaultMaterial=function(e,t){this._babylonScene._blockEntityCollection=!!this._assetContainer;var n=new v.PBRMaterial(e,this._babylonScene);return n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n.fillMode=t,n.enableSpecularAntiAliasing=!0,n.useRadianceOverAlpha=!this._parent.transparencyAsCoverage,n.useSpecularOverAlpha=!this._parent.transparencyAsCoverage,n.transparencyMode=v.PBRMaterial.PBRMATERIAL_OPAQUE,n.metallic=1,n.roughness=1,n},e.prototype.createMaterial=function(e,t,n){var r=this._extensionsCreateMaterial(e,t,n);if(r)return r;var o=t.name||"material".concat(t.index);return this._createDefaultMaterial(o,n)},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this._extensionsLoadMaterialPropertiesAsync(e,t,n);if(r)return r;var o=new Array;return o.push(this.loadMaterialBasePropertiesAsync(e,t,n)),t.pbrMetallicRoughness&&o.push(this._loadMaterialMetallicRoughnessPropertiesAsync("".concat(e,"/pbrMetallicRoughness"),t.pbrMetallicRoughness,n)),this.loadMaterialAlphaProperties(e,t,n),Promise.all(o).then((function(){}))},e.prototype.loadMaterialBasePropertiesAsync=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return n.emissiveColor=t.emissiveFactor?v.Color3.FromArray(t.emissiveFactor):new v.Color3(0,0,0),t.doubleSided&&(n.backFaceCulling=!1,n.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),t.normalTexture,(function(e){e.name="".concat(n.name," (Normal)"),n.bumpTexture=e}))),n.invertNormalMapX=!this._babylonScene.useRightHandedSystem,n.invertNormalMapY=this._babylonScene.useRightHandedSystem,null!=t.normalTexture.scale&&n.bumpTexture&&(n.bumpTexture.level=t.normalTexture.scale),n.forceIrradianceInFragment=!0),t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),t.occlusionTexture,(function(e){e.name="".concat(n.name," (Occlusion)"),n.ambientTexture=e}))),n.useAmbientInGrayScale=!0,null!=t.occlusionTexture.strength&&(n.ambientTextureStrength=t.occlusionTexture.strength)),t.emissiveTexture&&r.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),t.emissiveTexture,(function(e){e.name="".concat(n.name," (Emissive)"),n.emissiveTexture=e}))),Promise.all(r).then((function(){}))},e.prototype.loadMaterialAlphaProperties=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));switch(t.alphaMode||"OPAQUE"){case"OPAQUE":n.transparencyMode=v.PBRMaterial.PBRMATERIAL_OPAQUE,n.alpha=1;break;case"MASK":n.transparencyMode=v.PBRMaterial.PBRMATERIAL_ALPHATEST,n.alphaCutOff=null==t.alphaCutoff?.5:t.alphaCutoff,n.albedoTexture&&(n.albedoTexture.hasAlpha=!0);break;case"BLEND":n.transparencyMode=v.PBRMaterial.PBRMATERIAL_ALPHABLEND,n.albedoTexture&&(n.albedoTexture.hasAlpha=!0,n.useAlphaFromAlbedoTexture=!0);break;default:throw new Error("".concat(e,"/alphaMode: Invalid value (").concat(t.alphaMode,")"))}},e.prototype.loadTextureInfoAsync=function(t,n,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadTextureInfoAsync(t,n,r);if(a)return a;if(this.logOpen("".concat(t)),n.texCoord>=6)throw new Error("".concat(t,"/texCoord: Invalid value (").concat(n.texCoord,")"));var i=U.Get("".concat(t,"/index"),this._gltf.textures,n.index);i._textureInfo=n;var s=this._loadTextureAsync("/textures/".concat(n.index),i,(function(a){a.coordinatesIndex=n.texCoord||0,e.AddPointerMetadata(a,t),o._parent.onTextureLoadedObservable.notifyObservers(a),r(a)}));return this.logClose(),s},e.prototype._loadTextureAsync=function(t,n,r){void 0===r&&(r=function(){});var o=this._extensionsLoadTextureAsync(t,n,r);if(o)return o;this.logOpen("".concat(t," ").concat(n.name||""));var a=null==n.sampler?e.DefaultSampler:U.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=U.Get("".concat(t,"/source"),this._gltf.images,n.source),s=this._createTextureAsync(t,a,i,r,void 0,!n._textureInfo.nonColorData);return this.logClose(),s},e.prototype._createTextureAsync=function(e,t,n,r,o,a){var i=this;void 0===r&&(r=function(){});var s=this._loadSampler("/samplers/".concat(t.index),t),l=new Array,c=new v.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var u={noMipmap:s.noMipMaps,invertY:!1,samplingMode:s.samplingMode,onLoad:function(){i._disposed||c.resolve()},onError:function(t,n){i._disposed||c.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:n.mimeType,loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},d=new v.Texture(null,this._babylonScene,u);return d._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,l.push(c.promise),l.push(this.loadImageAsync("/images/".concat(n.index),n).then((function(e){var t=n.uri||"".concat(i._fileName,"#image").concat(n.index),r="data:".concat(i._uniqueRootUrl).concat(t);d.updateURL(r,e);var o=d.getInternalTexture();o&&(o.label=n.name)}))),d.wrapU=s.wrapU,d.wrapV=s.wrapV,r(d),this._parent.useGltfTextureNames&&(d.name=n.name||n.uri||"image".concat(n.index)),Promise.all(l).then((function(){return d}))},e.prototype._loadSampler=function(t,n){return n._data||(n._data={noMipMaps:9728===n.minFilter||9729===n.minFilter,samplingMode:e._GetTextureSamplingMode(t,n),wrapU:e._GetTextureWrapMode("".concat(t,"/wrapS"),n.wrapS),wrapV:e._GetTextureWrapMode("".concat(t,"/wrapT"),n.wrapT)}),n._data},e.prototype.loadImageAsync=function(e,t){if(!t._data){if(this.logOpen("".concat(e," ").concat(t.name||"")),t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{var n=U.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(n.index),n)}this.logClose()}return t._data},e.prototype.loadUriAsync=function(t,n,r){var o=this,a=this._extensionsLoadUriAsync(t,n,r);if(a)return a;if(!e._ValidateUri(r))throw new Error("".concat(t,": '").concat(r,"' is invalid"));if((0,v.IsBase64DataUrl)(r)){var i=new Uint8Array((0,v.DecodeBase64UrlToBinary)(r));return this.log("".concat(t,": Decoded ").concat(r.substring(0,64),"... (").concat(i.length," bytes)")),Promise.resolve(i)}return this.log("".concat(t,": Loading ").concat(r)),this._parent.preprocessUrlAsync(this._rootUrl+r).then((function(e){return new Promise((function(n,a){o._parent._loadFile(o._babylonScene,e,(function(e){o._disposed||(o.log("".concat(t,": Loaded ").concat(r," (").concat(e.byteLength," bytes)")),n(new Uint8Array(e)))}),!0,(function(e){a(new v.LoadFileError("".concat(t,": Failed to load '").concat(r,"'").concat(e?": "+e.status+" "+e.statusText:""),e))}))}))}))},e.AddPointerMetadata=function(e,t){e.metadata=e.metadata||{};var n=e._internalMetadata=e._internalMetadata||{},r=n.gltf=n.gltf||{};(r.pointers=r.pointers||[]).push(t)},e._GetTextureWrapMode=function(e,t){switch(t=null==t?10497:t){case 33071:return v.Texture.CLAMP_ADDRESSMODE;case 33648:return v.Texture.MIRROR_ADDRESSMODE;case 10497:return v.Texture.WRAP_ADDRESSMODE;default:return v.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),v.Texture.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var n=null==t.magFilter?9729:t.magFilter,r=null==t.minFilter?9987:t.minFilter;if(9729===n)switch(r){case 9728:return v.Texture.LINEAR_NEAREST;case 9729:return v.Texture.LINEAR_LINEAR;case 9984:return v.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return v.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return v.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return v.Texture.LINEAR_LINEAR_MIPLINEAR;default:return v.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),v.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&v.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),r){case 9728:return v.Texture.NEAREST_NEAREST;case 9729:return v.Texture.NEAREST_LINEAR;case 9984:return v.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return v.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return v.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return v.Texture.NEAREST_LINEAR_MIPLINEAR;default:return v.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),v.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,v.GetTypedArrayConstructor)(t)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}},e._GetTypedArray=function(t,n,r,o,a){var i=r.buffer;o=r.byteOffset+(o||0);var s=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n),l=v.VertexBuffer.GetTypeByteLength(n);return o%l!=0?(v.Logger.Warn("".concat(t,": Copying buffer as byte offset (").concat(o,") is not a multiple of component type byte length (").concat(l,")")),new s(i.slice(o,o+a*l),0)):new s(i,o,a)},e._GetNumComponents=function(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error("".concat(e,": Invalid type (").concat(t,")"))},e._ValidateUri=function(e){return v.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return v.Material.PointListDrawMode;case 1:return v.Material.LineListDrawMode;case 2:return v.Material.LineLoopDrawMode;case 3:return v.Material.LineStripDrawMode;case 4:return v.Material.TriangleFillMode;case 5:return v.Material.TriangleStripDrawMode;case 6:return v.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(t,")"))},e.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var n=0,r=this._gltf.materials;n<r.length;n++){var o=r[n];if(o._data)for(var a in o._data)for(var i=o._data[a],s=0,l=i.babylonMeshes;s<l.length;s++){var c=l[s];c.computeWorldMatrix(!0);var u=i.babylonMaterial;t.push(u.forceCompilationAsync(c)),t.push(u.forceCompilationAsync(c,{useInstances:!0})),this._parent.useClipPlane&&(t.push(u.forceCompilationAsync(c,{clipPlane:!0})),t.push(u.forceCompilationAsync(c,{clipPlane:!0,useInstances:!0})))}}return Promise.all(t).then((function(){e._parent._endPerformanceCounter("Compile materials")}))},e.prototype._compileShadowGeneratorsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile shadow generators");for(var t=new Array,n=0,r=this._babylonScene.lights;n<r.length;n++){var o=r[n].getShadowGenerator();o&&t.push(o.forceCompilationAsync())}return Promise.all(t).then((function(){e._parent._endPerformanceCounter("Compile shadow generators")}))},e.prototype._forEachExtensions=function(e){for(var t=0,n=this._extensions;t<n.length;t++){var r=n[t];r.enabled&&e(r)}},e.prototype._applyExtensions=function(e,t,n){for(var r=0,o=this._extensions;r<o.length;r++){var a=o[r];if(a.enabled){var i="".concat(a.name,".").concat(t),s=e;s._activeLoaderExtensionFunctions=s._activeLoaderExtensionFunctions||{};var l=s._activeLoaderExtensionFunctions;if(!l[i]){l[i]=!0;try{var c=n(a);if(c)return c}finally{delete l[i]}}}}return null},e.prototype._extensionsOnLoading=function(){this._forEachExtensions((function(e){return e.onLoading&&e.onLoading()}))},e.prototype._extensionsOnReady=function(){this._forEachExtensions((function(e){return e.onReady&&e.onReady()}))},e.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",(function(n){return n.loadSceneAsync&&n.loadSceneAsync(e,t)}))},e.prototype._extensionsLoadNodeAsync=function(e,t,n){return this._applyExtensions(t,"loadNode",(function(r){return r.loadNodeAsync&&r.loadNodeAsync(e,t,n)}))},e.prototype._extensionsLoadCameraAsync=function(e,t,n){return this._applyExtensions(t,"loadCamera",(function(r){return r.loadCameraAsync&&r.loadCameraAsync(e,t,n)}))},e.prototype._extensionsLoadVertexDataAsync=function(e,t,n){return this._applyExtensions(t,"loadVertexData",(function(r){return r._loadVertexDataAsync&&r._loadVertexDataAsync(e,t,n)}))},e.prototype._extensionsLoadMeshPrimitiveAsync=function(e,t,n,r,o,a){return this._applyExtensions(o,"loadMeshPrimitive",(function(i){return i._loadMeshPrimitiveAsync&&i._loadMeshPrimitiveAsync(e,t,n,r,o,a)}))},e.prototype._extensionsLoadMaterialAsync=function(e,t,n,r,o){return this._applyExtensions(t,"loadMaterial",(function(a){return a._loadMaterialAsync&&a._loadMaterialAsync(e,t,n,r,o)}))},e.prototype._extensionsCreateMaterial=function(e,t,n){return this._applyExtensions(t,"createMaterial",(function(r){return r.createMaterial&&r.createMaterial(e,t,n)}))},e.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,n){return this._applyExtensions(t,"loadMaterialProperties",(function(r){return r.loadMaterialPropertiesAsync&&r.loadMaterialPropertiesAsync(e,t,n)}))},e.prototype._extensionsLoadTextureInfoAsync=function(e,t,n){return this._applyExtensions(t,"loadTextureInfo",(function(r){return r.loadTextureInfoAsync&&r.loadTextureInfoAsync(e,t,n)}))},e.prototype._extensionsLoadTextureAsync=function(e,t,n){return this._applyExtensions(t,"loadTexture",(function(r){return r._loadTextureAsync&&r._loadTextureAsync(e,t,n)}))},e.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",(function(n){return n.loadAnimationAsync&&n.loadAnimationAsync(e,t)}))},e.prototype._extensionsLoadAnimationChannelAsync=function(e,t,n,r,o){return this._applyExtensions(n,"loadAnimationChannel",(function(a){return a._loadAnimationChannelAsync&&a._loadAnimationChannelAsync(e,t,n,r,o)}))},e.prototype._extensionsLoadSkinAsync=function(e,t,n){return this._applyExtensions(n,"loadSkin",(function(r){return r._loadSkinAsync&&r._loadSkinAsync(e,t,n)}))},e.prototype._extensionsLoadUriAsync=function(e,t,n){return this._applyExtensions(t,"loadUri",(function(r){return r._loadUriAsync&&r._loadUriAsync(e,t,n)}))},e.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",(function(n){return n.loadBufferViewAsync&&n.loadBufferViewAsync(e,t)}))},e.prototype._extensionsLoadBufferAsync=function(e,t,n,r){return this._applyExtensions(t,"loadBuffer",(function(o){return o.loadBufferAsync&&o.loadBufferAsync(e,t,n,r)}))},e.LoadExtensionAsync=function(e,t,n,r){if(!t.extensions)return null;var o=t.extensions[n];return o?r("".concat(e,"/extensions/").concat(n),o):null},e.LoadExtraAsync=function(e,t,n,r){if(!t.extras)return null;var o=t.extras[n];return o?r("".concat(e,"/extras/").concat(n),o):null},e.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},e.prototype.logOpen=function(e){this._parent._logOpen(e)},e.prototype.logClose=function(){this._parent._logClose()},e.prototype.log=function(e){this._parent._log(e)},e.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},e.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},e.DefaultSampler={index:-1},e}();E._CreateGLTF2Loader=function(e){return new H(e)};var j="EXT_lights_image_based",q=function(){function e(e){this.name=j,this._loader=e,this.enabled=this._loader.isExtensionUsed(j)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights}},e.prototype.loadSceneAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){n._loader._allMaterialsDirtyRequired=!0;var a=new Array;a.push(n._loader.loadSceneAsync(e,t)),n._loader.logOpen("".concat(r));var i=U.Get("".concat(r,"/light"),n._lights,o.light);return a.push(n._loadLightAsync("/extensions/".concat(n.name,"/lights/").concat(o.light),i).then((function(e){n._loader.babylonScene.environmentTexture=e}))),n._loader.logClose(),Promise.all(a).then((function(){}))}))},e.prototype._loadLightAsync=function(e,t){var n=this;if(!t._loaded){var r=new Array;this._loader.logOpen("".concat(e));for(var o=new Array(t.specularImages.length),a=function(n){var a=t.specularImages[n];o[n]=new Array(a.length);for(var s=function(t){var s="".concat(e,"/specularImages/").concat(n,"/").concat(t);i._loader.logOpen("".concat(s));var l=a[t],c=U.Get(s,i._loader.gltf.images,l);r.push(i._loader.loadImageAsync("/images/".concat(l),c).then((function(e){o[n][t]=e}))),i._loader.logClose()},l=0;l<a.length;l++)s(l)},i=this,s=0;s<t.specularImages.length;s++)a(s);this._loader.logClose(),t._loaded=Promise.all(r).then((function(){var r=new v.RawCubeTexture(n._loader.babylonScene,null,t.specularImageSize);if(r.name=t.name||"environment",t._babylonTexture=r,null!=t.intensity&&(r.level=t.intensity),t.rotation){var a=v.Quaternion.FromArray(t.rotation);n._loader.babylonScene.useRightHandedSystem||(a=v.Quaternion.Inverse(a)),v.Matrix.FromQuaternionToRef(a,r.getReflectionTextureMatrix())}if(!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));var i=v.SphericalHarmonics.FromArray(t.irradianceCoefficients);i.scaleInPlace(t.intensity),i.convertIrradianceToLambertianRadiance();var s=v.SphericalPolynomial.FromHarmonics(i),l=(o.length-1)/Math.log2(t.specularImageSize);return r.updateRGBDAsync(o,s,l)}))}return t._loaded.then((function(){return t._babylonTexture}))},e}();V(j),D(j,!0,(function(e){return new q(e)}));var Y="EXT_mesh_gpu_instancing",W=function(){function e(e){this.name=Y,this._loader=e,this.enabled=this._loader.isExtensionUsed(Y)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(e,o){r._loader._disableInstancedMesh++;var a=r._loader.loadNodeAsync("/nodes/".concat(t.index),t,n);if(r._loader._disableInstancedMesh--,!t._primitiveBabylonMeshes)return a;var i=new Array,s=0,l=function(t){if(null!=o.attributes[t]){var n=U.Get("".concat(e,"/attributes/").concat(t),r._loader.gltf.accessors,o.attributes[t]);if(i.push(r._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===s)s=n.count;else if(s!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else i.push(Promise.resolve(null))};return l("TRANSLATION"),l("ROTATION"),l("SCALE"),a.then((function(e){return Promise.all(i).then((function(n){var r=n[0],o=n[1],a=n[2],i=new Float32Array(16*s);v.TmpVectors.Vector3[0].copyFromFloats(0,0,0),v.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),v.TmpVectors.Vector3[1].copyFromFloats(1,1,1);for(var l=0;l<s;++l)r&&v.Vector3.FromArrayToRef(r,3*l,v.TmpVectors.Vector3[0]),o&&v.Quaternion.FromArrayToRef(o,4*l,v.TmpVectors.Quaternion[0]),a&&v.Vector3.FromArrayToRef(a,3*l,v.TmpVectors.Vector3[1]),v.Matrix.ComposeToRef(v.TmpVectors.Vector3[1],v.TmpVectors.Quaternion[0],v.TmpVectors.Vector3[0],v.TmpVectors.Matrix[0]),v.TmpVectors.Matrix[0].copyToArray(i,16*l);for(var c=0,u=t._primitiveBabylonMeshes;c<u.length;c++)u[c].thinInstanceSetBuffer("matrix",i,16,!0);return e}))}))}))},e}();V(Y),D(Y,!0,(function(e){return new W(e)}));var X="EXT_meshopt_compression",z=function(){function e(e){this.name=X,this.enabled=e.isExtensionUsed(X),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=t;if(a._meshOptData)return a._meshOptData;var i=U.Get("".concat(e,"/buffer"),n._loader.gltf.buffers,o.buffer);return a._meshOptData=n._loader.loadBufferAsync("/buffers/".concat(i.index),i,o.byteOffset||0,o.byteLength).then((function(e){return v.MeshoptCompression.Default.decodeGltfBufferAsync(e,o.count,o.byteStride,o.mode,o.filter)})),a._meshOptData}))},e}();V(X),D(X,!0,(function(e){return new z(e)}));var J="EXT_texture_webp",Q=function(){function e(e){this.name=J,this._loader=e,this.enabled=e.isExtensionUsed(J)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=null==t.sampler?H.DefaultSampler:U.Get("".concat(e,"/sampler"),r._loader.gltf.samplers,t.sampler),s=U.Get("".concat(o,"/source"),r._loader.gltf.images,a.source);return r._loader._createTextureAsync(e,i,s,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)}))},e}();V(J),D(J,!0,(function(e){return new Q(e)}));var Z="EXT_texture_avif",$=function(){function e(e){this.name=Z,this._loader=e,this.enabled=e.isExtensionUsed(Z)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=null==t.sampler?H.DefaultSampler:U.Get("".concat(e,"/sampler"),r._loader.gltf.samplers,t.sampler),s=U.Get("".concat(o,"/source"),r._loader.gltf.images,a.source);return r._loader._createTextureAsync(e,i,s,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)}))},e}();V(Z),D(Z,!0,(function(e){return new $(e)}));var ee="EXT_lights_ies",te=function(){function e(e){this.name=ee,this._loader=e,this.enabled=this._loader.isExtensionUsed(ee)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,U.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return m(r,void 0,void 0,(function(){var r,i,s,l,c,u=this;return y(this,(function(d){switch(d.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t=(i=U.Get(o,u._lights,a.light)).name||e.name;u._loader.babylonScene._blockEntityCollection=!!u._loader._assetContainer,(r=new v.SpotLight(t,v.Vector3.Zero(),v.Vector3.Backward(),0,1,u._loader.babylonScene)).angle=Math.PI/2,r.innerAngle=0,r._parentContainer=u._loader._assetContainer,u._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=r,r.falloffType=v.Light.FALLOFF_GLTF,r.diffuse=a.color?v.Color3.FromArray(a.color):v.Color3.White(),r.intensity=a.multiplier||1,r.range=Number.MAX_VALUE,r.parent=e,u._loader._babylonLights.push(r),H.AddPointerMetadata(r,o),n(e)}))];case 1:return s=d.sent(),i.uri?[4,this._loader.loadUriAsync(e,i,i.uri)]:[3,3];case 2:return l=d.sent(),[3,5];case 3:return c=U.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,i.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(c.index),c)];case 4:l=d.sent(),d.label=5;case 5:return r.iesProfileTexture=new v.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,l,!0,void 0,void 0,void 0,void 0,".ies"),[2,s]}}))}))}))},e}();V(ee),D(ee,!0,(function(e){return new te(e)}));var ne="KHR_draco_mesh_compression",re=function(){function e(e){this.name=ne,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=v.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(ne)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){if(null!=t.mode&&4!==t.mode&&5!==t.mode)throw new Error("".concat(e,": Unsupported mode ").concat(t.mode));var i={},s={},l=function(e,o){var l=a.attributes[e];if(null!=l&&(n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o),i[o]=l,r.useNormalizedFlagFromAccessor)){var c=U.TryGet(r._loader.gltf.accessors,t.attributes[e]);c&&(s[o]=c.normalized||!1)}};l("POSITION",v.VertexBuffer.PositionKind),l("NORMAL",v.VertexBuffer.NormalKind),l("TANGENT",v.VertexBuffer.TangentKind),l("TEXCOORD_0",v.VertexBuffer.UVKind),l("TEXCOORD_1",v.VertexBuffer.UV2Kind),l("TEXCOORD_2",v.VertexBuffer.UV3Kind),l("TEXCOORD_3",v.VertexBuffer.UV4Kind),l("TEXCOORD_4",v.VertexBuffer.UV5Kind),l("TEXCOORD_5",v.VertexBuffer.UV6Kind),l("JOINTS_0",v.VertexBuffer.MatricesIndicesKind),l("WEIGHTS_0",v.VertexBuffer.MatricesWeightsKind),l("COLOR_0",v.VertexBuffer.ColorKind);var c=U.Get(o,r._loader.gltf.bufferViews,a.bufferView);return c._dracoBabylonGeometry||(c._dracoBabylonGeometry=r._loader.loadBufferViewAsync("/bufferViews/".concat(c.index),c).then((function(o){var a=r.dracoDecoder||v.DracoDecoder.Default,l=U.TryGet(r._loader.gltf.accessors,t.attributes.POSITION),c=r._loader.parent.alwaysComputeBoundingBox||n.skeleton||!l?null:K(l);return a._decodeMeshToGeometryForGltfAsync(n.name,r._loader.babylonScene,o,i,s,c).catch((function(t){throw new Error("".concat(e,": ").concat(t.message))}))}))),c._dracoBabylonGeometry}))},e}();V(ne),D(ne,!0,(function(e){return new re(e)}));var oe="KHR_lights_punctual",ae=function(){function e(e){this.name=oe,this._loader=e,this.enabled=this._loader.isExtensionUsed(oe)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,U.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return r._loader._allMaterialsDirtyRequired=!0,r._loader.loadNodeAsync(e,t,(function(e){var t,i=U.Get(o,r._lights,a.light),s=i.name||e.name;switch(r._loader.babylonScene._blockEntityCollection=!!r._loader._assetContainer,i.type){case"directional":var l=new v.DirectionalLight(s,v.Vector3.Backward(),r._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new v.PointLight(s,v.Vector3.Zero(),r._loader.babylonScene);break;case"spot":var c=new v.SpotLight(s,v.Vector3.Zero(),v.Vector3.Backward(),0,1,r._loader.babylonScene);c.angle=2*(i.spot&&i.spot.outerConeAngle||Math.PI/4),c.innerAngle=2*(i.spot&&i.spot.innerConeAngle||0),t=c;break;default:throw r._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(o,": Invalid light type (").concat(i.type,")"))}t._parentContainer=r._loader._assetContainer,r._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=t,t.falloffType=v.Light.FALLOFF_GLTF,t.diffuse=i.color?v.Color3.FromArray(i.color):v.Color3.White(),t.intensity=null==i.intensity?1:i.intensity,t.range=null==i.range?Number.MAX_VALUE:i.range,t.parent=e,r._loader._babylonLights.push(t),H.AddPointerMetadata(t,o),n(e)}))}))},e}();V(oe),D(oe,!0,(function(e){return new ae(e)}));var ie="KHR_materials_pbrSpecularGlossiness",se=function(){function e(e){this.name=ie,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(ie)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialBasePropertiesAsync(e,t,n)),i.push(r._loadSpecularGlossinessPropertiesAsync(o,a,n)),r._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(i).then((function(){}))}))},e.prototype._loadSpecularGlossinessPropertiesAsync=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return n.metallic=null,n.roughness=null,t.diffuseFactor?(n.albedoColor=v.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=v.Color3.White(),n.reflectivityColor=t.specularFactor?v.Color3.FromArray(t.specularFactor):v.Color3.White(),n.microSurface=null==t.glossinessFactor?1:t.glossinessFactor,t.diffuseTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),t.diffuseTexture,(function(e){e.name="".concat(n.name," (Diffuse)"),n.albedoTexture=e}))),t.specularGlossinessTexture&&(r.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),t.specularGlossinessTexture,(function(e){e.name="".concat(n.name," (Specular Glossiness)"),n.reflectivityTexture=e,n.reflectivityTexture.hasAlpha=!0}))),n.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(r).then((function(){}))},e}();V(ie),D(ie,!0,(function(e){return new se(e)}));var le="KHR_materials_unlit",ce=function(){function e(e){this.name=le,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(le)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(){return r._loadUnlitPropertiesAsync(e,t,n)}))},e.prototype._loadUnlitPropertiesAsync=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;n.unlit=!0;var o=t.pbrMetallicRoughness;return o&&(o.baseColorFactor?(n.albedoColor=v.Color3.FromArray(o.baseColorFactor),n.alpha=o.baseColorFactor[3]):n.albedoColor=v.Color3.White(),o.baseColorTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),o.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),n.albedoTexture=e})))),t.doubleSided&&(n.backFaceCulling=!1,n.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(r).then((function(){}))},e}();V(le),D(le,!0,(function(e){return new ce(e)}));var ue="KHR_materials_clearcoat",de=function(){function e(e){this.name=ue,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ue)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadClearCoatPropertiesAsync(o,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadClearCoatPropertiesAsync=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return n.clearCoat.isEnabled=!0,n.clearCoat.useRoughnessFromMainTexture=!1,n.clearCoat.remapF0OnInterfaceChange=!1,null!=t.clearcoatFactor?n.clearCoat.intensity=t.clearcoatFactor:n.clearCoat.intensity=0,t.clearcoatTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatTexture"),t.clearcoatTexture,(function(e){e.name="".concat(n.name," (ClearCoat)"),n.clearCoat.texture=e}))),null!=t.clearcoatRoughnessFactor?n.clearCoat.roughness=t.clearcoatRoughnessFactor:n.clearCoat.roughness=0,t.clearcoatRoughnessTexture&&(t.clearcoatRoughnessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatRoughnessTexture"),t.clearcoatRoughnessTexture,(function(e){e.name="".concat(n.name," (ClearCoat Roughness)"),n.clearCoat.textureRoughness=e})))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatNormalTexture"),t.clearcoatNormalTexture,(function(e){e.name="".concat(n.name," (ClearCoat Normal)"),n.clearCoat.bumpTexture=e}))),n.invertNormalMapX=!n.getScene().useRightHandedSystem,n.invertNormalMapY=n.getScene().useRightHandedSystem,null!=t.clearcoatNormalTexture.scale&&(n.clearCoat.bumpTexture.level=t.clearcoatNormalTexture.scale)),Promise.all(r).then((function(){}))},e}();V(ue),D(ue,!0,(function(e){return new de(e)}));var he="KHR_materials_iridescence",fe=function(){function e(e){this.name=he,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(he)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadIridescencePropertiesAsync(o,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadIridescencePropertiesAsync=function(e,t,n){var r,o,a,i,s;if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var l=new Array;return n.iridescence.isEnabled=!0,n.iridescence.intensity=null!==(r=t.iridescenceFactor)&&void 0!==r?r:0,n.iridescence.indexOfRefraction=null!==(a=null!==(o=t.iridescenceIor)&&void 0!==o?o:t.iridescenceIOR)&&void 0!==a?a:1.3,n.iridescence.minimumThickness=null!==(i=t.iridescenceThicknessMinimum)&&void 0!==i?i:100,n.iridescence.maximumThickness=null!==(s=t.iridescenceThicknessMaximum)&&void 0!==s?s:400,t.iridescenceTexture&&l.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceTexture"),t.iridescenceTexture,(function(e){e.name="".concat(n.name," (Iridescence)"),n.iridescence.texture=e}))),t.iridescenceThicknessTexture&&l.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceThicknessTexture"),t.iridescenceThicknessTexture,(function(e){e.name="".concat(n.name," (Iridescence Thickness)"),n.iridescence.thicknessTexture=e}))),Promise.all(l).then((function(){}))},e}();V(he),D(he,!0,(function(e){return new fe(e)}));var pe="KHR_materials_anisotropy",_e=function(){function e(e){this.name=pe,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(pe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadIridescencePropertiesAsync(o,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadIridescencePropertiesAsync=function(e,t,n){var r,o;if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var a=new Array;return n.anisotropy.isEnabled=!0,n.anisotropy.intensity=null!==(r=t.anisotropyStrength)&&void 0!==r?r:0,n.anisotropy.angle=null!==(o=t.anisotropyRotation)&&void 0!==o?o:0,t.anisotropyTexture&&(t.anisotropyTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/anisotropyTexture"),t.anisotropyTexture,(function(e){e.name="".concat(n.name," (Anisotropy Intensity)"),n.anisotropy.texture=e})))),Promise.all(a).then((function(){}))},e}();V(pe),D(pe,!0,(function(e){return new _e(e)}));var me="KHR_materials_emissive_strength",ye=function(){function e(e){this.name=me,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(me)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return r._loader.loadMaterialPropertiesAsync(e,t,n).then((function(){r._loadEmissiveProperties(o,a,n)}))}))},e.prototype._loadEmissiveProperties=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));void 0!==t.emissiveStrength&&(n.emissiveIntensity=t.emissiveStrength)},e}();V(me),D(me,!0,(function(e){return new ye(e)}));var ve="KHR_materials_sheen",be=function(){function e(e){this.name=ve,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ve)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadSheenPropertiesAsync(o,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadSheenPropertiesAsync=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return n.sheen.isEnabled=!0,n.sheen.intensity=1,null!=t.sheenColorFactor?n.sheen.color=v.Color3.FromArray(t.sheenColorFactor):n.sheen.color=v.Color3.Black(),t.sheenColorTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),t.sheenColorTexture,(function(e){e.name="".concat(n.name," (Sheen Color)"),n.sheen.texture=e}))),void 0!==t.sheenRoughnessFactor?n.sheen.roughness=t.sheenRoughnessFactor:n.sheen.roughness=0,t.sheenRoughnessTexture&&(t.sheenRoughnessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),t.sheenRoughnessTexture,(function(e){e.name="".concat(n.name," (Sheen Roughness)"),n.sheen.textureRoughness=e})))),n.sheen.albedoScaling=!0,n.sheen.useRoughnessFromMainTexture=!1,Promise.all(r).then((function(){}))},e}();V(ve),D(ve,!0,(function(e){return new be(e)}));var ge="KHR_materials_specular",Ae=function(){function e(e){this.name=ge,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ge)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadSpecularPropertiesAsync(o,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadSpecularPropertiesAsync=function(e,t,n){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return void 0!==t.specularFactor&&(n.metallicF0Factor=t.specularFactor),void 0!==t.specularColorFactor&&(n.metallicReflectanceColor=v.Color3.FromArray(t.specularColorFactor)),t.specularTexture&&(t.specularTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),t.specularTexture,(function(e){e.name="".concat(n.name," (Specular)"),n.metallicReflectanceTexture=e,n.useOnlyMetallicFromMetallicReflectanceTexture=!0})))),t.specularColorTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),t.specularColorTexture,(function(e){e.name="".concat(n.name," (Specular Color)"),n.reflectanceTexture=e}))),Promise.all(r).then((function(){}))},e}();V(ge),D(ge,!0,(function(e){return new Ae(e)}));var Te="KHR_materials_ior",xe=function(){function e(e){this.name=Te,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(Te)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadIorPropertiesAsync(o,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadIorPropertiesAsync=function(t,n,r){if(!(r instanceof v.PBRMaterial))throw new Error("".concat(t,": Material type not supported"));return void 0!==n.ior?r.indexOfRefraction=n.ior:r.indexOfRefraction=e._DEFAULT_IOR,Promise.resolve()},e._DEFAULT_IOR=1.5,e}();V(Te),D(Te,!0,(function(e){return new xe(e)}));var we="KHR_materials_variants",Oe=function(){function e(e){this.name=we,this._loader=e,this.enabled=this._loader.isExtensionUsed(we)}return e.prototype.dispose=function(){this._loader=null},e.GetAvailableVariants=function(e){var t=this._GetExtensionMetadata(e);return t?Object.keys(t.variants):[]},e.prototype.getAvailableVariants=function(t){return e.GetAvailableVariants(t)},e.SelectVariant=function(e,t){var n=this._GetExtensionMetadata(e);if(!n)throw new Error("Cannot select variant on a glTF mesh that does not have the ".concat(we," extension"));var r=function(e){var t=n.variants[e];if(t)for(var r=0,o=t;r<o.length;r++){var a=o[r];a.mesh.material=a.material}};if(t instanceof Array)for(var o=0,a=t;o<a.length;o++)r(a[o]);else r(t);n.lastSelected=t},e.prototype.selectVariant=function(t,n){e.SelectVariant(t,n)},e.Reset=function(e){var t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot reset on a glTF mesh that does not have the ".concat(we," extension"));for(var n=0,r=t.original;n<r.length;n++){var o=r[n];o.mesh.material=o.material}t.lastSelected=null},e.prototype.reset=function(t){e.Reset(t)},e.GetLastSelectedVariant=function(e){var t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot get the last selected variant on a glTF mesh that does not have the ".concat(we," extension"));return t.lastSelected},e.prototype.getLastSelectedVariant=function(t){return e.GetLastSelectedVariant(t)},e._GetExtensionMetadata=function(e){var t,n;return(null===(n=null===(t=null==e?void 0:e._internalMetadata)||void 0===t?void 0:t.gltf)||void 0===n?void 0:n[we])||null},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._variants=t.variants}},e.prototype.onReady=function(){var t,n,r=this._loader.rootBabylonMesh;r&&(null===(n=null===(t=this._loader.parent.extensionOptions[we])||void 0===t?void 0:t.onLoaded)||void 0===n||n.call(t,{get variants(){return e.GetAvailableVariants(r)},get selectedVariant(){var t=e.GetLastSelectedVariant(r);return t?Array.isArray(t)?t[0]:t:e.GetAvailableVariants(r)[0]},set selectedVariant(t){e.SelectVariant(r,t)}}))},e.prototype._loadMeshPrimitiveAsync=function(t,n,r,o,a,i){var s=this;return H.LoadExtensionAsync(t,a,this.name,(function(l,c){var u=new Array;return u.push(s._loader._loadMeshPrimitiveAsync(t,n,r,o,a,(function(n){if(i(n),n instanceof v.Mesh){var r=H._GetDrawMode(t,a.mode),o=s._loader.rootBabylonMesh,d=o?o._internalMetadata=o._internalMetadata||{}:{},h=d.gltf=d.gltf||{},f=h[we]=h[we]||{lastSelected:null,original:[],variants:{}};f.original.push({mesh:n,material:n.material});for(var p=function(t){var a=c.mappings[t],i=U.Get("".concat(l,"/mappings/").concat(t,"/material"),s._loader.gltf.materials,a.material);u.push(s._loader._loadMaterialAsync("#/materials/".concat(a.material),i,n,r,(function(t){for(var r=function(r){var i=a.variants[r],l=U.Get("/extensions/".concat(we,"/variants/").concat(i),s._variants,i);f.variants[l.name]=f.variants[l.name]||[],f.variants[l.name].push({mesh:n,material:t}),n.onClonedObservable.add((function(t){var r=t,a=null,i=r;do{if(!(i=i.parent))return;a=e._GetExtensionMetadata(i)}while(null===a);if(o&&a===e._GetExtensionMetadata(o)){for(var s in i._internalMetadata={},o._internalMetadata)i._internalMetadata[s]=o._internalMetadata[s];for(var s in i._internalMetadata.gltf=[],o._internalMetadata.gltf)i._internalMetadata.gltf[s]=o._internalMetadata.gltf[s];i._internalMetadata.gltf[we]={lastSelected:null,original:[],variants:{}};for(var c=0,u=a.original;c<u.length;c++){var d=u[c];i._internalMetadata.gltf[we].original.push({mesh:d.mesh,material:d.material})}for(var s in a.variants)if(Object.prototype.hasOwnProperty.call(a.variants,s)){i._internalMetadata.gltf[we].variants[s]=[];for(var h=0,f=a.variants[s];h<f.length;h++){var p=f[h];i._internalMetadata.gltf[we].variants[s].push({mesh:p.mesh,material:p.material})}}a=i._internalMetadata.gltf[we]}for(var _=0,m=a.original;_<m.length;_++)(b=m[_]).mesh===n&&(b.mesh=r);for(var y=0,v=a.variants[l.name];y<v.length;y++){var b;(b=v[y]).mesh===n&&(b.mesh=r)}}))},i=0;i<a.variants.length;++i)r(i)})))},_=0;_<c.mappings.length;++_)p(_)}}))),Promise.all(u).then((function(e){return e[0]}))}))},e}();V(we),D(we,!0,(function(e){return new Oe(e)}));var Ce=function(){function e(t,n){var r=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=_(_({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this.onErrorObservable=new v.Observable,this._scene.onDisposeObservable.addOnce((function(){r.dispose()})),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:v.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},e.prototype.updateOptions=function(e){var t=this,n=Object.keys(e).filter((function(n){return t._options[n]!==e[n]}));if(n.length){var r=_(_({},this._options),e),o=this._options;this._options=r,r.renderSize===o.renderSize&&r.renderTargetTextureType===o.renderTargetTextureType&&r.generateMipmaps===o.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=r.samples,this._opaqueRenderTarget.lodGenerationScale=r.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=r.lodGenerationOffset):this._setupRenderTargets()}},e.prototype.getOpaqueTarget=function(){return this._opaqueRenderTarget},e.prototype._shouldRenderAsTransmission=function(e){return!!e&&!!(e instanceof v.PBRMaterial&&e.subSurface.isRefractionEnabled)},e.prototype._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),v.Tools.SetImmediate((function(){t._shouldRenderAsTransmission(e.material)?(e.material.refractionTexture=t._opaqueRenderTarget,-1===t._transparentMeshesCache.indexOf(e)&&t._transparentMeshesCache.push(e)):-1===t._opaqueMeshesCache.indexOf(e)&&t._opaqueMeshesCache.push(e)}))},e.prototype._removeMesh=function(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];var t=this._transparentMeshesCache.indexOf(e);-1!==t&&this._transparentMeshesCache.splice(t,1),-1!==(t=this._opaqueMeshesCache.indexOf(e))&&this._opaqueMeshesCache.splice(t,1)},e.prototype._parseScene=function(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))},e.prototype._onMeshMaterialChanged=function(e){var t=this._transparentMeshesCache.indexOf(e),n=this._opaqueMeshesCache.indexOf(e);this._shouldRenderAsTransmission(e.material)?(e.material instanceof v.PBRMaterial&&(e.material.subSurface.refractionTexture=this._opaqueRenderTarget),-1!==n?(this._opaqueMeshesCache.splice(n,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)):-1!==t?(this._transparentMeshesCache.splice(t,1),this._opaqueMeshesCache.push(e)):-1===n&&this._opaqueMeshesCache.push(e)},e.prototype._isRenderTargetValid=function(){var e;return null!==(null===(e=this._opaqueRenderTarget)||void 0===e?void 0:e.getInternalTexture())},e.prototype._setupRenderTargets=function(){var e,t,n,r,o=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new v.RenderTargetTexture("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=null!==(t=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==t?t:this._scene.clearColor.clone(),this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.renderSprites=!0,this._opaqueRenderTarget.renderParticles=!0,this._opaqueRenderTarget.onBeforeBindObservable.add((function(e){r=o._scene.environmentIntensity,o._scene.environmentIntensity=1,n=o._scene.imageProcessingConfiguration.applyByPostProcess,o._options.clearColor?e.clearColor.copyFrom(o._options.clearColor):o._scene.clearColor.toLinearSpaceToRef(e.clearColor,o._scene.getEngine().useExactSrgbConversions),o._scene.imageProcessingConfiguration._applyByPostProcess=!0})),this._opaqueRenderTarget.onAfterUnbindObservable.add((function(){o._scene.environmentIntensity=r,o._scene.imageProcessingConfiguration._applyByPostProcess=n})),this._transparentMeshesCache.forEach((function(e){o._shouldRenderAsTransmission(e.material)&&(e.material.refractionTexture=o._opaqueRenderTarget)}))},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},e}(),Me="KHR_materials_transmission",Le=function(){function e(e){this.name=Me,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(Me),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadTransparentPropertiesAsync(o,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadTransparentPropertiesAsync=function(e,t,n,r){var o,a;if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var i=n;if(i.subSurface.isRefractionEnabled=!0,i.subSurface.volumeIndexOfRefraction=1,i.subSurface.useAlbedoToTintRefraction=!0,void 0===r.transmissionFactor)return i.subSurface.refractionIntensity=0,i.subSurface.isRefractionEnabled=!1,Promise.resolve();i.subSurface.refractionIntensity=r.transmissionFactor;var s=i.getScene();return i.subSurface.refractionIntensity&&!s._transmissionHelper?new Ce({},i.getScene()):i.subSurface.refractionIntensity&&!(null===(o=s._transmissionHelper)||void 0===o?void 0:o._isRenderTargetValid())&&(null===(a=s._transmissionHelper)||void 0===a||a._setupRenderTargets()),i.subSurface.minimumThickness=0,i.subSurface.maximumThickness=0,r.transmissionTexture?(r.transmissionTexture.nonColorData=!0,this._loader.loadTextureInfoAsync("".concat(e,"/transmissionTexture"),r.transmissionTexture,void 0).then((function(e){e.name="".concat(n.name," (Transmission)"),i.subSurface.refractionIntensityTexture=e,i.subSurface.useGltfStyleTextures=!0}))):Promise.resolve()},e}();V(Me),D(Me,!0,(function(e){return new Le(e)}));var Ee="KHR_materials_diffuse_transmission",Se=function(){function e(e){this.name=Ee,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ee),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadTranslucentPropertiesAsync(o,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadTranslucentPropertiesAsync=function(e,t,n,r){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=n;if(o.subSurface.isTranslucencyEnabled=!0,o.subSurface.volumeIndexOfRefraction=1,o.subSurface.minimumThickness=0,o.subSurface.maximumThickness=0,o.subSurface.useAlbedoToTintTranslucency=!1,void 0===r.diffuseTransmissionFactor)return o.subSurface.translucencyIntensity=0,o.subSurface.isTranslucencyEnabled=!1,Promise.resolve();o.subSurface.translucencyIntensity=r.diffuseTransmissionFactor;var a=new Array;return o.subSurface.useGltfStyleTextures=!0,r.diffuseTransmissionTexture&&(r.diffuseTransmissionTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),r.diffuseTransmissionTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission)"),o.subSurface.translucencyIntensityTexture=e})))),void 0!==r.diffuseTransmissionColorFactor?o.subSurface.translucencyColor=v.Color3.FromArray(r.diffuseTransmissionColorFactor):o.subSurface.translucencyColor=v.Color3.White(),r.diffuseTransmissionColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),r.diffuseTransmissionColorTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission Color)"),o.subSurface.translucencyColorTexture=e}))),Promise.all(a).then((function(){}))},e}();V(Ee),D(Ee,!0,(function(e){return new Se(e)}));var Re="KHR_materials_volume",Pe=function(){function e(e){this.name=Re,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(Re),this.enabled&&this._loader._disableInstancedMesh++}return e.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadVolumePropertiesAsync(o,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadVolumePropertiesAsync=function(e,t,n,r){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));if(!n.subSurface.isRefractionEnabled&&!n.subSurface.isTranslucencyEnabled||!r.thicknessFactor)return Promise.resolve();n.subSurface.volumeIndexOfRefraction=n.indexOfRefraction;var o=void 0!==r.attenuationDistance?r.attenuationDistance:Number.MAX_VALUE;return n.subSurface.tintColorAtDistance=o,void 0!==r.attenuationColor&&3==r.attenuationColor.length&&n.subSurface.tintColor.copyFromFloats(r.attenuationColor[0],r.attenuationColor[1],r.attenuationColor[2]),n.subSurface.minimumThickness=0,n.subSurface.maximumThickness=r.thicknessFactor,n.subSurface.useThicknessAsDepth=!0,r.thicknessTexture?(r.thicknessTexture.nonColorData=!0,this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),r.thicknessTexture).then((function(e){e.name="".concat(n.name," (Thickness)"),n.subSurface.thicknessTexture=e,n.subSurface.useGltfStyleTextures=!0}))):Promise.resolve()},e}();V(Re),D(Re,!0,(function(e){return new Pe(e)}));var Ne="KHR_materials_dispersion",Ie=function(){function e(e){this.name=Ne,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ne)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=new Array;return i.push(r._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(r._loadDispersionPropertiesAsync(o,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadDispersionPropertiesAsync=function(e,t,n,r){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));return n.subSurface.isRefractionEnabled&&r.dispersion?(n.subSurface.isDispersionEnabled=!0,n.subSurface.dispersion=r.dispersion,Promise.resolve()):Promise.resolve()},e}();V(Ne),D(Ne,!0,(function(e){return new Ie(e)}));var Fe="KHR_mesh_quantization",Be=function(){function e(e){this.name=Fe,this.enabled=e.isExtensionUsed(Fe)}return e.prototype.dispose=function(){},e}();V(Fe),D(Fe,!0,(function(e){return new Be(e)}));var ke="KHR_texture_basisu",Ge=function(){function e(e){this.name=ke,this._loader=e,this.enabled=e.isExtensionUsed(ke)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){var i=null==t.sampler?H.DefaultSampler:U.Get("".concat(e,"/sampler"),r._loader.gltf.samplers,t.sampler),s=U.Get("".concat(o,"/source"),r._loader.gltf.images,a.source);return r._loader._createTextureAsync(e,i,s,(function(e){n(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)}))},e}();V(ke),D(ke,!0,(function(e){return new Ge(e)}));var De="KHR_texture_transform",Ve=function(){function e(e){this.name=De,this._loader=e,this.enabled=this._loader.isExtensionUsed(De)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return r._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof v.Texture))throw new Error("".concat(o,": Texture type not supported"));a.offset&&(e.uOffset=a.offset[0],e.vOffset=a.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,a.rotation&&(e.wAng=-a.rotation),a.scale&&(e.uScale=a.scale[0],e.vScale=a.scale[1]),null!=a.texCoord&&(e.coordinatesIndex=a.texCoord),n(e)}))}))},e}();V(De),D(De,!0,(function(e){return new Ve(e)}));var Ue="KHR_xmp_json_ld",Ke=function(){function e(e){this.name=Ue,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ue)}return e.prototype.dispose=function(){this._loader=null},e.prototype.onLoading=function(){var e,t,n;if(null!==this._loader.rootBabylonMesh){var r=null===(e=this._loader.gltf.extensions)||void 0===e?void 0:e.KHR_xmp_json_ld,o=null===(n=null===(t=this._loader.gltf.asset)||void 0===t?void 0:t.extensions)||void 0===n?void 0:n.KHR_xmp_json_ld;if(r&&o){var a=+o.packet;r.packets&&a<r.packets.length&&(this._loader.rootBabylonMesh.metadata=this._loader.rootBabylonMesh.metadata||{},this._loader.rootBabylonMesh.metadata.xmp=r.packets[a])}}},e}();function He(e,t,n,r){return v.Color3.FromArray(t,n).scale(r)}function je(e,t,n,r){return t[n]*r}function qe(e,t,n,r){return-t[n]*r}function Ye(e,t,n,r){return t[n+1]*r}function We(e,t,n,r){return t[n]*r*2}function Xe(e){return{scale:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),je,(function(){return 2})),new Je(v.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),Ye,(function(){return 2}))],offset:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),je,(function(){return 2})),new Je(v.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),Ye,(function(){return 2}))],rotation:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),qe,(function(){return 1}))]}}V(Ue),D(Ue,!0,(function(e){return new Ke(e)}));var ze=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.buildAnimations=function(e,t,n,r,o){o(e._babylonCamera,this._buildAnimation(t,n,r))},t}(N),Je=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.buildAnimations=function(e,t,n,r,o){for(var a in e._data)o(e._data[a].babylonMaterial,this._buildAnimation(t,n,r))},t}(N),Qe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return p(t,e),t.prototype.buildAnimations=function(e,t,n,r,o){o(e._babylonLight,this._buildAnimation(t,n,r))},t}(N),Ze={__array__:_({__target__:!0},B)},$e={__array__:{__target__:!0,orthographic:{xmag:[new ze(v.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",qe,(function(){return 1})),new ze(v.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",Ye,(function(){return 1}))],ymag:[new ze(v.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",qe,(function(){return 1})),new ze(v.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",Ye,(function(){return 1}))],zfar:[new ze(v.Animation.ANIMATIONTYPE_FLOAT,"maxZ",je,(function(){return 1}))],znear:[new ze(v.Animation.ANIMATIONTYPE_FLOAT,"minZ",je,(function(){return 1}))]},perspective:{yfov:[new ze(v.Animation.ANIMATIONTYPE_FLOAT,"fov",je,(function(){return 1}))],zfar:[new ze(v.Animation.ANIMATIONTYPE_FLOAT,"maxZ",je,(function(){return 1}))],znear:[new ze(v.Animation.ANIMATIONTYPE_FLOAT,"minZ",je,(function(){return 1}))]}}},et={nodes:Ze,materials:{__array__:{__target__:!0,pbrMetallicRoughness:{baseColorFactor:[new Je(v.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",He,(function(){return 4})),new Je(v.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,r){return t[n+3]*r}),(function(){return 4}))],metallicFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"metallic",je,(function(){return 1}))],roughnessFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"roughness",je,(function(){return 1}))],baseColorTexture:{extensions:{KHR_texture_transform:Xe("albedoTexture")}},metallicRoughnessTexture:{extensions:{KHR_texture_transform:Xe("metallicTexture")}}},emissiveFactor:[new Je(v.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",He,(function(){return 3}))],normalTexture:{scale:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",je,(function(){return 1}))],extensions:{KHR_texture_transform:Xe("bumpTexture")}},occlusionTexture:{strength:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",je,(function(){return 1}))],extensions:{KHR_texture_transform:Xe("ambientTexture")}},emissiveTexture:{extensions:{KHR_texture_transform:Xe("emissiveTexture")}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",je,(function(){return 1}))],anisotropyRotation:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",je,(function(){return 1}))],anisotropyTexture:{extensions:{KHR_texture_transform:Xe("anisotropy.texture")}}},KHR_materials_clearcoat:{clearcoatFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",je,(function(){return 1}))],clearcoatRoughnessFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",je,(function(){return 1}))],clearcoatTexture:{extensions:{KHR_texture_transform:Xe("clearCoat.texture")}},clearcoatNormalTexture:{scale:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",je,(function(){return 1}))],extensions:{KHR_texture_transform:Xe("clearCoat.bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:Xe("clearCoat.textureRoughness")}}},KHR_materials_dispersion:{dispersion:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",je,(function(){return 1}))]},KHR_materials_emissive_strength:{emissiveStrength:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",je,(function(){return 1}))]},KHR_materials_ior:{ior:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",je,(function(){return 1}))]},KHR_materials_iridescence:{iridescenceFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",je,(function(){return 1}))],iridescenceIor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",je,(function(){return 1}))],iridescenceThicknessMinimum:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",je,(function(){return 1}))],iridescenceThicknessMaximum:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",je,(function(){return 1}))],iridescenceTexture:{extensions:{KHR_texture_transform:Xe("iridescence.texture")}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:Xe("iridescence.thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:[new Je(v.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",He,(function(){return 3}))],sheenRoughnessFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",je,(function(){return 1}))],sheenColorTexture:{extensions:{KHR_texture_transform:Xe("sheen.texture")}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:Xe("sheen.textureRoughness")}}},KHR_materials_specular:{specularFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",je,(function(){return 1}))],specularColorFactor:[new Je(v.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",He,(function(){return 3}))],specularTexture:{extensions:{KHR_texture_transform:Xe("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:Xe("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",je,(function(){return 1}))],transmissionTexture:{extensions:{KHR_texture_transform:Xe("subSurface.refractionIntensityTexture")}}},KHR_materials_volume:{attenuationColor:[new Je(v.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",He,(function(){return 3}))],attenuationDistance:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",je,(function(){return 1}))],thicknessFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",je,(function(){return 1}))],thicknessTexture:{extensions:{KHR_texture_transform:Xe("subSurface.thicknessTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:[new Je(v.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",je,(function(){return 1}))],diffuseTransmissionTexture:{extensions:{KHR_texture_transform:Xe("subSurface.translucencyIntensityTexture")}},diffuseTransmissionColorFactor:[new Je(v.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",He,(function(){return 3}))],diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:Xe("subSurface.translucencyColorTexture")}}}}}},cameras:$e,extensions:{KHR_lights_punctual:{lights:{__array__:{__target__:!0,color:[new Qe(v.Animation.ANIMATIONTYPE_COLOR3,"diffuse",He,(function(){return 3}))],intensity:[new Qe(v.Animation.ANIMATIONTYPE_FLOAT,"intensity",je,(function(){return 1}))],range:[new Qe(v.Animation.ANIMATIONTYPE_FLOAT,"range",je,(function(){return 1}))],spot:{innerConeAngle:[new Qe(v.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",We,(function(){return 1}))],outerConeAngle:[new Qe(v.Animation.ANIMATIONTYPE_FLOAT,"angle",We,(function(){return 1}))]}}}},EXT_lights_ies:{lights:{__array__:{__target__:!0,color:[new Qe(v.Animation.ANIMATIONTYPE_COLOR3,"diffuse",He,(function(){return 3}))],multiplier:[new Qe(v.Animation.ANIMATIONTYPE_FLOAT,"intensity",je,(function(){return 1}))]}}}}},tt=function(){function e(e,t){this._gltf=e,this._infoTree=t}return e.prototype.convert=function(e){var t=this._gltf,n=this._infoTree,r=void 0;if(!e.startsWith("/"))throw new Error("Path must start with a /");var o=e.split("/");o.shift();for(var a=0,i=o;a<i.length;a++){var s=i[a];if(n.__array__)n=n.__array__;else if(!(n=n[s]))throw new Error("Path ".concat(e," is invalid"));if(void 0===t)throw new Error("Path ".concat(e," is invalid"));t=t[s],n.__target__&&(r=t)}return{object:r,info:n}},e}(),nt="KHR_animation_pointer",rt=function(e){function t(t){return e.call(this,t,et)||this}return p(t,e),t}(tt),ot=function(){function e(e){this.name=nt,this._loader=e,this._pathToObjectConverter=new rt(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(nt)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,t,n,r,o){var a,i=null===(a=r.target.extensions)||void 0===a?void 0:a.KHR_animation_pointer;if(!i||!this._pathToObjectConverter)return null;"pointer"!==r.target.path&&v.Logger.Warn("".concat(e,"/target/path: Value (").concat(r.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=r.target.node&&v.Logger.Warn("".concat(e,"/target/node: Value (").concat(r.target.node,") must not be present when using the ").concat(this.name," extension"));var s="".concat(e,"/extensions/").concat(this.name),l=i.pointer;if(!l)throw new Error("".concat(s,": Pointer is missing"));try{var c=this._pathToObjectConverter.convert(l);return this._loader._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,c,o)}catch(e){return v.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();V(nt),D(nt,!0,(function(e){return new ot(e)}));var at="MSFT_audio_emitter",it=function(){function e(e){this.name=at,this._loader=e,this.enabled=this._loader.isExtensionUsed(at)}return e.prototype.dispose=function(){this._loader=null,this._clips=null,this._emitters=null},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._clips=t.clips,this._emitters=t.emitters,U.Assign(this._clips),U.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;a.push(n._loader.loadSceneAsync(e,t));for(var i=0,s=o.emitters;i<s.length;i++){var l=s[i],c=U.Get("".concat(r,"/emitters"),n._emitters,l);if(null!=c.refDistance||null!=c.maxDistance||null!=c.rolloffFactor||null!=c.distanceModel||null!=c.innerAngle||null!=c.outerAngle)throw new Error("".concat(r,": Direction or Distance properties are not allowed on emitters attached to a scene"));a.push(n._loadEmitterAsync("".concat(r,"/emitters/").concat(c.index),c))}return Promise.all(a).then((function(){}))}))},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(e,o){var a=new Array;return r._loader.loadNodeAsync(e,t,(function(t){for(var i=function(n){var o=U.Get("".concat(e,"/emitters"),r._emitters,n);a.push(r._loadEmitterAsync("".concat(e,"/emitters/").concat(o.index),o).then((function(){for(var e=0,n=o._babylonSounds;e<n.length;e++){var r=n[e];r.attachToMesh(t),null==o.innerAngle&&null==o.outerAngle||(r.setLocalDirectionToMesh(v.Vector3.Forward()),r.setDirectionalCone(2*v.Tools.ToDegrees(null==o.innerAngle?Math.PI:o.innerAngle),2*v.Tools.ToDegrees(null==o.outerAngle?Math.PI:o.outerAngle),0))}})))},s=0,l=o.emitters;s<l.length;s++)i(l[s]);n(t)})).then((function(e){return Promise.all(a).then((function(){return e}))}))}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){return n._loader.loadAnimationAsync(e,t).then((function(a){var i=new Array;U.Assign(o.events);for(var s=0,l=o.events;s<l.length;s++){var c=l[s];i.push(n._loadAnimationEventAsync("".concat(r,"/events/").concat(c.index),e,t,c,a))}return Promise.all(i).then((function(){return a}))}))}))},e.prototype._loadClipAsync=function(e,t){if(t._objectURL)return t._objectURL;var n;if(t.uri)n=this._loader.loadUriAsync(e,t,t.uri);else{var r=U.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,t.bufferView);n=this._loader.loadBufferViewAsync("/bufferViews/".concat(r.index),r)}return t._objectURL=n.then((function(e){return URL.createObjectURL(new Blob([e],{type:t.mimeType}))})),t._objectURL},e.prototype._loadEmitterAsync=function(e,t){var n=this;if(t._babylonSounds=t._babylonSounds||[],!t._babylonData){for(var r=new Array,o=t.name||"emitter".concat(t.index),a={loop:!1,autoplay:!1,volume:null==t.volume?1:t.volume},i=function(e){var i="/extensions/".concat(s.name,"/clips"),l=U.Get(i,s._clips,t.clips[e].clip);r.push(s._loadClipAsync("".concat(i,"/").concat(t.clips[e].clip),l).then((function(r){var i=t._babylonSounds[e]=new v.Sound(o,r,n._loader.babylonScene,null,a);i.refDistance=t.refDistance||1,i.maxDistance=t.maxDistance||256,i.rolloffFactor=t.rolloffFactor||1,i.distanceModel=t.distanceModel||"exponential"})))},s=this,l=0;l<t.clips.length;l++)i(l);var c=Promise.all(r).then((function(){var e=t.clips.map((function(e){return e.weight||1})),n=new v.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*v.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*v.Tools.ToDegrees(t.outerAngle)),t.volume&&(n.volume=t.volume),t._babylonData.sound=n}));t._babylonData={loaded:c}}return t._babylonData.loaded},e.prototype._getEventAction=function(e,t,n,r,o){switch(n){case"play":return function(e){var n=(o||0)+(e-r);t.play(n)};case"stop":return function(){t.stop()};case"pause":return function(){t.pause()};default:throw new Error("".concat(e,": Unsupported action ").concat(n))}},e.prototype._loadAnimationEventAsync=function(e,t,n,r,o){var a=this;if(0==o.targetedAnimations.length)return Promise.resolve();var i=o.targetedAnimations[0],s=r.emitter,l=U.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,s);return this._loadEmitterAsync(e,l).then((function(){var t=l._babylonData.sound;if(t){var n=new v.AnimationEvent(r.time,a._getEventAction(e,t,r.action,r.time,r.startOffset));i.animation.addEvent(n),o.onAnimationGroupEndObservable.add((function(){t.stop()})),o.onAnimationGroupPauseObservable.add((function(){t.pause()}))}}))},e}();V(at),D(at,!0,(function(e){return new it(e)}));var st="MSFT_lod",lt=function(){function e(e){var t,n;this.name=st,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new v.Observable,this.onMaterialLODsLoadedObservable=new v.Observable,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.maxLODsToLoad=null!==(n=null===(t=this._loader.parent.extensionOptions[st])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(st)}return e.prototype.dispose=function(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()},e.prototype.onReady=function(){for(var e=this,t=function(t){var r=Promise.all(n._nodePromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Node LOD ".concat(t)),e._loader.log("Loaded node LOD ".concat(t))),e.onNodeLODsLoadedObservable.notifyObservers(t),t!==e._nodePromiseLODs.length-1&&(e._loader.startPerformanceCounter("Node LOD ".concat(t+1)),e._loadBufferLOD(e._nodeBufferLODs,t+1),e._nodeSignalLODs[t]&&e._nodeSignalLODs[t].resolve())}));n._loader._completePromises.push(r)},n=this,r=0;r<this._nodePromiseLODs.length;r++)t(r);var o=function(t){var n=Promise.all(a._materialPromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Material LOD ".concat(t)),e._loader.log("Loaded material LOD ".concat(t))),e.onMaterialLODsLoadedObservable.notifyObservers(t),t!==e._materialPromiseLODs.length-1&&(e._loader.startPerformanceCounter("Material LOD ".concat(t+1)),e._loadBufferLOD(e._materialBufferLODs,t+1),e._materialSignalLODs[t]&&e._materialSignalLODs[t].resolve())}));a._loader._completePromises.push(n)},a=this;for(r=0;r<this._materialPromiseLODs.length;r++)o(r)},e.prototype.loadSceneAsync=function(e,t){var n=this._loader.loadSceneAsync(e,t);return this._loadBufferLOD(this._bufferLODs,0),n},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(e,o){var a,i=r._getLODs(e,t,r._loader.gltf.nodes,o.ids);r._loader.logOpen("".concat(e));for(var s=function(e){var t=i[e];0!==e&&(r._nodeIndexLOD=e,r._nodeSignalLODs[e]=r._nodeSignalLODs[e]||new v.Deferred);var o=r._loader.loadNodeAsync("/nodes/".concat(t.index),t,(function(e){n(e),e.setEnabled(!1)})).then((function(t){if(0!==e){var n=i[e-1];n._babylonTransformNode&&(r._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t}));r._nodePromiseLODs[e]=r._nodePromiseLODs[e]||[],0===e?a=o:(r._nodeIndexLOD=null,r._nodePromiseLODs[e].push(o))},l=0;l<i.length;l++)s(l);return r._loader.logClose(),a}))},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var a=this;return this._nodeIndexLOD?null:H.LoadExtensionAsync(e,t,this.name,(function(e,i){var s,l=a._getLODs(e,t,a._loader.gltf.materials,i.ids);a._loader.logOpen("".concat(e));for(var c=function(e){var t=l[e];0!==e&&(a._materialIndexLOD=e);var i=a._loader._loadMaterialAsync("/materials/".concat(t.index),t,n,r,(function(t){0===e&&o(t)})).then((function(t){if(0!==e){o(t);var n=l[e-1]._data;n[r]&&(a._disposeMaterials([n[r].babylonMaterial]),delete n[r])}return t}));a._materialPromiseLODs[e]=a._materialPromiseLODs[e]||[],0===e?s=i:(a._materialIndexLOD=null,a._materialPromiseLODs[e].push(i))},u=0;u<l.length;u++)c(u);return a._loader.logClose(),s}))},e.prototype._loadUriAsync=function(e,t,n){var r=this;if(null!==this._nodeIndexLOD){this._loader.log("deferred");var o=this._nodeIndexLOD-1;return this._nodeSignalLODs[o]=this._nodeSignalLODs[o]||new v.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return r._loader.loadUriAsync(e,t,n)}))}return null!==this._materialIndexLOD?(this._loader.log("deferred"),o=this._materialIndexLOD-1,this._materialSignalLODs[o]=this._materialSignalLODs[o]||new v.Deferred,this._materialSignalLODs[o].promise.then((function(){return r._loader.loadUriAsync(e,t,n)}))):null},e.prototype.loadBufferAsync=function(e,t,n,r){if(this._loader.parent.useRangeRequests&&!t.uri){if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));var o=function(e,t){var o=n,a=o+r-1,i=e[t];return i?(i.start=Math.min(i.start,o),i.end=Math.max(i.end,a)):(i={start:o,end:a,loaded:new v.Deferred},e[t]=i),i.loaded.promise.then((function(e){return new Uint8Array(e.buffer,e.byteOffset+n-i.start,r)}))};return this._loader.log("deferred"),null!==this._nodeIndexLOD?o(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?o(this._materialBufferLODs,this._materialIndexLOD):o(this._bufferLODs,0)}return null},e.prototype._loadBufferLOD=function(e,t){var n=e[t];n&&(this._loader.log("Loading buffer range [".concat(n.start,"-").concat(n.end,"]")),this._loader.bin.readAsync(n.start,n.end-n.start+1).then((function(e){n.loaded.resolve(e)}),(function(e){n.loaded.reject(e)})))},e.prototype._getLODs=function(e,t,n,r){if(this.maxLODsToLoad<=0)throw new Error("maxLODsToLoad must be greater than zero");for(var o=[],a=r.length-1;a>=0;a--)if(o.push(U.Get("".concat(e,"/ids/").concat(r[a]),n,r[a])),o.length===this.maxLODsToLoad)return o;return o.push(t),o},e.prototype._disposeTransformNode=function(e){var t=this,n=[],r=e.material;r&&n.push(r);for(var o=0,a=e.getChildMeshes();o<a.length;o++){var i=a[o];i.material&&n.push(i.material)}e.dispose();var s=n.filter((function(e){return t._loader.babylonScene.meshes.every((function(t){return t.material!=e}))}));this._disposeMaterials(s)},e.prototype._disposeMaterials=function(e){for(var t={},n=0,r=e;n<r.length;n++){for(var o=0,a=(u=r[n]).getActiveTextures();o<a.length;o++){var i=a[o];t[i.uniqueId]=i}u.dispose()}for(var s in t)for(var l=0,c=this._loader.babylonScene.materials;l<c.length;l++){var u;(u=c[l]).hasTexture(t[s])&&delete t[s]}for(var s in t)t[s].dispose()},e}();V(st),D(st,!0,(function(e){return new lt(e)}));var ct="MSFT_minecraftMesh",ut=function(){function e(e){this.name=ct,this._loader=e,this.enabled=this._loader.isExtensionUsed(ct)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtraAsync(e,t,this.name,(function(o,a){if(a){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(o,": Material type not supported"));var i=r._loader.loadMaterialPropertiesAsync(e,t,n);return n.needAlphaBlending()&&(n.forceDepthWrite=!0,n.separateCullingPass=!0),n.backFaceCulling=n.forceDepthWrite,n.twoSidedLighting=!0,i}return null}))},e}();V(ct),D(ct,!0,(function(e){return new ut(e)}));var dt="MSFT_sRGBFactors",ht=function(){function e(e){this.name=dt,this._loader=e,this.enabled=this._loader.isExtensionUsed(dt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtraAsync(e,t,this.name,(function(o,a){if(a){if(!(n instanceof v.PBRMaterial))throw new Error("".concat(o,": Material type not supported"));var i=r._loader.loadMaterialPropertiesAsync(e,t,n),s=n.getScene().getEngine().useExactSrgbConversions;return n.albedoTexture||n.albedoColor.toLinearSpaceToRef(n.albedoColor,s),n.reflectivityTexture||n.reflectivityColor.toLinearSpaceToRef(n.reflectivityColor,s),i}return null}))},e}();V(dt),D(dt,!0,(function(e){return new ht(e)}));var ft={"lifecycle/onStart":v.FlowGraphSceneReadyEventBlock.ClassName,"lifecycle/onTick":v.FlowGraphSceneTickEventBlock.ClassName,log:v.FlowGraphConsoleLogBlock.ClassName,"flow/delay":v.FlowGraphTimerBlock.ClassName,"customEvent/send":v.FlowGraphSendCustomEventBlock.ClassName,"customEvent/receive":v.FlowGraphReceiveCustomEventBlock.ClassName,"flow/sequence":v.FlowGraphSequenceBlock.ClassName,"world/get":v.FlowGraphGetPropertyBlock.ClassName,"world/set":v.FlowGraphSetPropertyBlock.ClassName,"flow/doN":v.FlowGraphDoNBlock.ClassName,"variable/get":v.FlowGraphGetVariableBlock.ClassName,"variable/set":v.FlowGraphSetVariableBlock.ClassName,"flow/whileLoop":v.FlowGraphWhileLoopBlock.ClassName,"math/random":v.FlowGraphRandomBlock.ClassName,"math/e":v.FlowGraphEBlock.ClassName,"math/pi":v.FlowGraphPiBlock.ClassName,"math/inf":v.FlowGraphInfBlock.ClassName,"math/nan":v.FlowGraphNaNBlock.ClassName,"math/abs":v.FlowGraphAbsBlock.ClassName,"math/sign":v.FlowGraphSignBlock.ClassName,"math/trunc":v.FlowGraphTruncBlock.ClassName,"math/floor":v.FlowGraphFloorBlock.ClassName,"math/ceil":v.FlowGraphCeilBlock.ClassName,"math/fract":v.FlowGraphFractBlock.ClassName,"math/neg":v.FlowGraphNegBlock.ClassName,"math/add":v.FlowGraphAddBlock.ClassName,"math/sub":v.FlowGraphSubtractBlock.ClassName,"math/mul":v.FlowGraphMultiplyBlock.ClassName,"math/div":v.FlowGraphDivideBlock.ClassName,"math/rem":v.FlowGraphRemainderBlock.ClassName,"math/min":v.FlowGraphMinBlock.ClassName,"math/max":v.FlowGraphMaxBlock.ClassName,"math/clamp":v.FlowGraphClampBlock.ClassName,"math/saturate":v.FlowGraphSaturateBlock.ClassName,"math/mix":v.FlowGraphInterpolateBlock.ClassName,"math/eq":v.FlowGraphEqBlock.ClassName,"math/lt":v.FlowGraphLessThanBlock.ClassName,"math/le":v.FlowGraphLessThanOrEqualBlock.ClassName,"math/gt":v.FlowGraphGreaterThanBlock.ClassName,"math/ge":v.FlowGraphGreaterThanOrEqualBlock.ClassName,"math/isnan":v.FlowGraphIsNanBlock.ClassName,"math/isinf":v.FlowGraphIsInfBlock.ClassName,"math/rad":v.FlowGraphDegToRadBlock.ClassName,"math/deg":v.FlowGraphRadToDegBlock.ClassName,"math/sin":v.FlowGraphSinBlock.ClassName,"math/cos":v.FlowGraphCosBlock.ClassName,"math/tan":v.FlowGraphTanBlock.ClassName,"math/asin":v.FlowGraphAsinBlock.ClassName,"math/acos":v.FlowGraphAcosBlock.ClassName,"math/atan":v.FlowGraphAtanBlock.ClassName,"math/atan2":v.FlowGraphAtan2Block.ClassName,"math/sinh":v.FlowGraphSinhBlock.ClassName,"math/cosh":v.FlowGraphCoshBlock.ClassName,"math/tanh":v.FlowGraphTanhBlock.ClassName,"math/asinh":v.FlowGraphAsinhBlock.ClassName,"math/acosh":v.FlowGraphAcoshBlock.ClassName,"math/atanh":v.FlowGraphAtanhBlock.ClassName,"math/exp":v.FlowGraphExpBlock.ClassName,"math/log":v.FlowGraphLogBlock.ClassName,"math/log2":v.FlowGraphLog2Block.ClassName,"math/log10":v.FlowGraphLog10Block.ClassName,"math/sqrt":v.FlowGraphSqrtBlock.ClassName,"math/cbrt":v.FlowGraphCubeRootBlock.ClassName,"math/pow":v.FlowGraphPowBlock.ClassName,"math/length":v.FlowGraphLengthBlock.ClassName,"math/normalize":v.FlowGraphNormalizeBlock.ClassName,"math/dot":v.FlowGraphDotBlock.ClassName,"math/cross":v.FlowGraphCrossBlock.ClassName,"math/rotate2d":v.FlowGraphRotate2DBlock.ClassName,"math/rotate3d":v.FlowGraphRotate3DBlock.ClassName,"math/transpose":v.FlowGraphTransposeBlock.ClassName,"math/determinant":v.FlowGraphDeterminantBlock.ClassName,"math/inverse":v.FlowGraphInvertMatrixBlock.ClassName,"math/matmul":v.FlowGraphMatMulBlock.ClassName,"math/not":v.FlowGraphBitwiseNotBlock.ClassName,"math/and":v.FlowGraphBitwiseAndBlock.ClassName,"math/or":v.FlowGraphBitwiseOrBlock.ClassName,"math/xor":v.FlowGraphBitwiseXorBlock.ClassName,"math/asr":v.FlowGraphBitwiseRightShiftBlock.ClassName,"math/lsl":v.FlowGraphBitwiseLeftShiftBlock.ClassName,"math/clz":v.FlowGraphCountLeadingZerosBlock.ClassName,"math/ctz":v.FlowGraphCountTrailingZerosBlock.ClassName,"math/popcnt":v.FlowGraphCountOneBitsBlock.ClassName},pt={float2:"Vector2",float3:"Vector3",float4:"Vector4",float4x4:"Matrix",int:"FlowGraphInteger"};function _t(e,t,n){if(void 0!==e.type){var r=t.types&&t.types[e.type];if(!r)throw new Error("".concat(n,": Unknown type: ").concat(e.type));var o=r.signature;if(!o)throw new Error("".concat(n,": Type ").concat(e.type," has no signature"));var a=pt[o];return{value:e.value,className:a}}return e.value}function mt(e,t,n){var r=ft[t.type];if(!r)throw new Error("/extensions/KHR_interactivity/nodes/".concat(e,": Unknown block type: ").concat(t.type));var o=e.toString(),a=function(e,t,n){for(var r,o={},a=0,i=null!==(r=e.configuration)&&void 0!==r?r:[];a<i.length;a++){var s=i[a];if("customEvent"===s.id){var l=t.customEvents&&t.customEvents[s.value];if(!l)throw new Error("/extensions/KHR_interactivity/nodes/".concat(n,": Unknown custom event: ").concat(s.value));o.eventId=l.id,o.eventData=l.values.map((function(e){return e.id}))}else if("variable"===s.id){var c=t.variables&&t.variables[s.value];if(!c)throw new Error("/extensions/KHR_interactivity/nodes/".concat(n,": Unknown variable: ").concat(s.value));o.variableName=c.id}else if("path"===s.id){var u=s.value;o.path=u}else o[s.id]=_t(s,t,"/extensions/KHR_interactivity/nodes/".concat(n))}return o}(t,n,o);return{className:r,config:a,uniqueId:o,metadata:t.metadata,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[]}}var yt=function(e){function t(t){return e.call(this,t,vt)||this}return p(t,e),t}(tt),vt={nodes:{__array__:{__target__:!0,translation:{type:"Vector3",get:function(e){return e._babylonTransformNode.position},set:function(e,t){t._babylonTransformNode.position=e},getObject:function(e){return e._babylonTransformNode}}}}},bt="KHR_interactivity",gt=function(){function e(e){this._loader=e,this.name=bt,this.enabled=this._loader.isExtensionUsed(bt),this._pathConverter=new yt(this._loader.gltf)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){var e;if(this._loader.babylonScene&&this._pathConverter){var t=this._loader.babylonScene,n=function(e){for(var t,n,r,o={uniqueId:(0,v.RandomGUID)(),_userVariables:{},_connectionValues:{}},a=[o],i=[],s=0;s<e.nodes.length;s++){var l=e.nodes[s],c=mt(s,l,e);i.push(c)}for(s=0;s<e.nodes.length;s++){l=e.nodes[s];for(var u=i[s],d=function(e){var t=e.id,n={uniqueId:(0,v.RandomGUID)(),name:t,_connectionType:1,connectedPointIds:[]};u.signalOutputs.push(n);var r=e.node,o=e.socket,a=i[r];if(!a)throw new Error("/extensions/KHR_interactivity/nodes/".concat(s,": Could not find node with id ").concat(r," that connects its input with with node ").concat(s,"'s output ").concat(t));var l=a.signalInputs.find((function(e){return e.name===o}));l||(l={uniqueId:(0,v.RandomGUID)(),name:o,_connectionType:0,connectedPointIds:[]},a.signalInputs.push(l)),l.connectedPointIds.push(n.uniqueId),n.connectedPointIds.push(l.uniqueId)},h=0,f=null!==(t=l.flows)&&void 0!==t?t:[];h<f.length;h++)d(f[h]);for(var p=function(t){var n=t.id,r={uniqueId:(0,v.RandomGUID)(),name:n,_connectionType:0,connectedPointIds:[]};if(u.dataInputs.push(r),void 0!==t.value){var a=_t(t,e,"/extensions/KHR_interactivity/nodes/".concat(s));o._connectionValues[r.uniqueId]=a}else{if(void 0===t.node||void 0===t.socket)throw new Error("/extensions/KHR_interactivity/nodes/".concat(s,": Invalid socket ").concat(n," in node ").concat(s));var l=t.node,c=t.socket,d=i[l];if(!d)throw new Error("/extensions/KHR_interactivity/nodes/".concat(s,": Could not find node with id ").concat(l," that connects its output with node").concat(s,"'s input ").concat(n));var h=d.dataOutputs.find((function(e){return e.name===c}));h||(h={uniqueId:(0,v.RandomGUID)(),name:c,_connectionType:1,connectedPointIds:[]},d.dataOutputs.push(h)),r.connectedPointIds.push(h.uniqueId),h.connectedPointIds.push(r.uniqueId)}},_=0,m=null!==(n=l.values)&&void 0!==n?n:[];_<m.length;_++)p(m[_])}var y=null!==(r=e.variables)&&void 0!==r?r:[];for(s=0;s<y.length;s++){var b=y[s],g=b.id;o._userVariables[g]=_t(b,e,"/extensions/KHR_interactivity/variables/".concat(s))}return{allBlocks:i,executionContexts:a}}(null===(e=this._loader.gltf.extensions)||void 0===e?void 0:e.KHR_interactivity),r=new v.FlowGraphCoordinator({scene:t});v.FlowGraph.Parse(n,{coordinator:r,pathConverter:this._pathConverter}),r.start()}},e}();V(bt),D(bt,!0,(function(e){return new gt(e)}));var At="KHR_node_visibility",Tt=function(){function e(e){this.name=At,this._loader=e,this.enabled=e.isExtensionUsed(At)}return e.prototype.onReady=function(){return m(this,void 0,void 0,(function(){var e;return y(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,r,o;null===(t=e._primitiveBabylonMeshes)||void 0===t||t.forEach((function(e){e.inheritVisibility=!0})),(null===(n=e.extensions)||void 0===n?void 0:n.KHR_node_visibility)&&!1===(null===(r=e.extensions)||void 0===r?void 0:r.KHR_node_visibility.visible)&&(e._babylonTransformNode&&(e._babylonTransformNode.isVisible=!1),null===(o=e._primitiveBabylonMeshes)||void 0===o||o.forEach((function(e){e.isVisible=!1})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();V(At),D(At,!0,(function(e){return new Tt(e)}));var xt="ExtrasAsMetadata",wt=function(){function e(e){this.name=xt,this.enabled=!0,this._loader=e}return e.prototype._assignExtras=function(e,t){if(t.extras&&Object.keys(t.extras).length>0){var n=e.metadata=e.metadata||{};(n.gltf=n.gltf||{}).extras=t.extras}},e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return this._loader.loadNodeAsync(e,t,(function(e){r._assignExtras(e,t),n(e)}))},e.prototype.loadCameraAsync=function(e,t,n){var r=this;return this._loader.loadCameraAsync(e,t,(function(e){r._assignExtras(e,t),n(e)}))},e.prototype.createMaterial=function(e,t,n){var r=this._loader.createMaterial(e,t,n);return this._assignExtras(r,t),r},e}();V(xt),D(xt,!1,(function(e){return new wt(e)}));var Ot=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Ot){Ot.BABYLON=Ot.BABYLON||{};var Ct=Ot.BABYLON;Ct.GLTF2=Ct.GLTF2||{},Ct.GLTF2.Loader=Ct.GLTF2.Loader||{},Ct.GLTF2.Loader.Extensions=Ct.GLTF2.Loader.Extensions||{};var Mt=[];for(var Lt in c)Ct.GLTF2.Loader.Extensions[Lt]=c[Lt],Mt.push(Lt);for(var Lt in u)Ct.GLTF2.Loader[Lt]=u[Lt],Mt.push(Lt);for(var Lt in d)Mt.indexOf(Lt)>-1||(Ct.GLTF2[Lt]=d[Lt])}const Et=h;return i.default})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-loaders",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-loaders"]=t(require("babylonjs")):e.LOADERS=t(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var t,n,o={274:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphGLTFDataProvider:()=>a});var o=n(322),r=n(597),a=function(e){function t(t){var n,o,a=e.call(this)||this,i=t.glTF,s=(null===(n=i.animations)||void 0===n?void 0:n.map((function(e){return e._babylonAnimationGroup})))||[];a.animationGroups=a.registerDataOutput("animationGroups",r.RichTypeAny,s);var l=(null===(o=i.nodes)||void 0===o?void 0:o.map((function(e){return e._babylonTransformNode})))||[];return a.nodes=a.registerDataOutput("nodes",r.RichTypeAny,l),a}return(0,o.C6)(t,e),t.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},t}(r.FlowGraphBlock)},322:(e,t,n)=>{n.d(t,{C6:()=>r,Cl:()=>a,YH:()=>s,sH:()=>i});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function i(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}l((o=o.apply(e,t||[])).next())}))}function s(e,t){var n,o,r,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=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=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=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},597:t=>{t.exports=e},698:(e,t,n)=>{n.d(t,{oR:()=>f,tQ:()=>c,Wt:()=>u,ZU:()=>d});var o=n(597),r=function(){function e(e,t){this._gltf=e,this._infoTree=t}return e.prototype.convert=function(e){var t=this._gltf,n=this._infoTree,o=void 0;if(!e.startsWith("/"))throw new Error("Path must start with a /");var r=e.split("/");if(r.shift(),r[r.length-1].includes(".length")){var a=r[r.length-1].split(".");r.pop(),r.push.apply(r,a)}for(var i=!1,s=0,l=r;s<l.length;s++){var u=l[s],c="length"===u;if(c&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(i=!0),n.__array__&&!c)n=n.__array__;else if(!(n=n[u]))throw new Error("Path ".concat(e," is invalid"));if(!i){if(void 0===t)throw new Error("Path ".concat(e," is invalid"));c||(t=null==t?void 0:t[u])}(n.__target__||c)&&(o=t)}return{object:o,info:n}},e}();function a(e,t,n,o){var r=i(e);return o?r[n][o]:r[n]}function i(e,t,n){var r,a,i;return null===(i=null===(r=e._data)||void 0===r?void 0:r[null!==(a=null==n?void 0:n.fillMode)&&void 0!==a?a:o.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function s(e,t){return{offset:{componentsCount:2,type:"Vector2",get:function(n,r,i){var s=a(n,0,e,t);return new o.Vector2(null==s?void 0:s.uOffset,null==s?void 0:s.vOffset)},getTarget:i,set:function(n,o,r,i){var s=a(o,0,e,t);s.uOffset=n.x,s.vOffset=n.y},getPropertyName:[function(){return"".concat(e,".").concat(t,".uOffset")},function(){return"".concat(e,".").concat(t,".vOffset")}]},rotation:{type:"number",get:function(n,o,r){var i;return null===(i=a(n,0,e,t))||void 0===i?void 0:i.wAng},getTarget:i,set:function(n,o,r,i){return a(o,0,e,t).wAng=n},getPropertyName:[function(){return"".concat(e,".").concat(t,".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(n,r,i){var s=a(n,0,e,t);return new o.Vector2(null==s?void 0:s.uScale,null==s?void 0:s.vScale)},getTarget:i,set:function(n,o,r,i){var s=a(o,0,e,t);s.uScale=n.x,s.vScale=n.y},getPropertyName:[function(){return"".concat(e,".").concat(t,".uScale")},function(){return"".concat(e,".").concat(t,".vScale")}]}}}var l={cameras:{__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var t,n,r,a;return new o.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoLeft)&&void 0!==n?n:0,null!==(a=null===(r=e._babylonCamera)||void 0===r?void 0:r.orthoRight)&&void 0!==a?a:0)},set:function(e,t){t._babylonCamera&&(t._babylonCamera.orthoLeft=e.x,t._babylonCamera.orthoRight=e.y)},getTarget:function(e){return e},getPropertyName:[function(){return"orthoLeft"},function(){return"orthoRight"}]},ymag:{componentsCount:2,type:"Vector2",get:function(e){var t,n,r,a;return new o.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoBottom)&&void 0!==n?n:0,null!==(a=null===(r=e._babylonCamera)||void 0===r?void 0:r.orthoTop)&&void 0!==a?a:0)},set:function(e,t){t._babylonCamera&&(t._babylonCamera.orthoBottom=e.x,t._babylonCamera.orthoTop=e.y)},getTarget:function(e){return e},getPropertyName:[function(){return"orthoBottom"},function(){return"orthoTop"}]},zfar:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.maxZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.maxZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"maxZ"}]},znear:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.minZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.minZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"minZ"}]}},perspective:{aspectRatio:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.getEngine().getAspectRatio(e._babylonCamera)},getTarget:function(e){return e},getPropertyName:[function(){return"aspectRatio"}],isReadOnly:!0},yfov:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.fov},set:function(e,t){t._babylonCamera&&(t._babylonCamera.fov=e)},getTarget:function(e){return e},getPropertyName:[function(){return"fov"}]},zfar:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.maxZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.maxZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"maxZ"}]},znear:{type:"number",get:function(e){var t;return null===(t=e._babylonCamera)||void 0===t?void 0:t.minZ},set:function(e,t){t._babylonCamera&&(t._babylonCamera.minZ=e)},getTarget:function(e){return e},getPropertyName:[function(){return"minZ"}]}}}},nodes:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map((function(e){return e._babylonTransformNode}))},getPropertyName:[function(){return"length"}]},__array__:{__target__:!0,translation:{type:"Vector3",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.position},set:function(e,t){var n;return null===(n=t._babylonTransformNode)||void 0===n?void 0:n.position.copyFrom(e)},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"position"}]},rotation:{type:"Quaternion",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.rotationQuaternion},set:function(e,t){var n,o;return null===(o=null===(n=t._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion)||void 0===o?void 0:o.copyFrom(e)},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"rotationQuaternion"}]},scale:{type:"Vector3",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.scaling},set:function(e,t){var n;return null===(n=t._babylonTransformNode)||void 0===n?void 0:n.scaling.copyFrom(e)},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"scaling"}]},weights:{length:{type:"number",get:function(e){return e._numMorphTargets},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"influence"}]},__array__:{__target__:!0,type:"number",get:function(e,t){var n,o;return void 0!==t?null===(o=null===(n=e._primitiveBabylonMeshes)||void 0===n?void 0:n[0].morphTargetManager)||void 0===o?void 0:o.getTarget(t).influence:void 0},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"influence"}]},type:"number[]",get:function(e,t){return[0]},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"influence"}]},matrix:{type:"Matrix",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getWorldMatrix()},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"worldMatrix"}]},globalMatrix:{type:"Matrix",get:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getWorldMatrix()},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"_worldMatrix"}],isReadOnly:!0},extensions:{EXT_lights_ies:{multiplier:{type:"number",get:function(e){var t,n;return null===(n=null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof o.SpotLight}),!0)[0])||void 0===n?void 0:n.intensity},getTarget:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof o.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof o.SpotLight}),!0)[0];n&&(n.intensity=e)}}},color:{type:"Color3",get:function(e){var t,n;return null===(n=null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof o.SpotLight}),!0)[0])||void 0===n?void 0:n.diffuse},getTarget:function(e){var t;return null===(t=e._babylonTransformNode)||void 0===t?void 0:t.getChildren((function(e){return e instanceof o.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof o.SpotLight}),!0)[0];n&&(n.diffuse=e)}}}}}}},materials:{__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return i(e,0,n).emissiveColor},set:function(e,t,n,o){return i(t,0,o).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:s("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var o;return null===(o=a(e,0,"bumpTexture"))||void 0===o?void 0:o.level},set:function(e,t,n,o){var r=a(t,0,"bumpTexture");r&&(r.level=e)},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:s("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return i(e,0,n).ambientTextureStrength},set:function(e,t,n,o){var r=i(t,0,o);r&&(r.ambientTextureStrength=e)},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:s("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,t,n){var r=i(e,0,n);return o.Color4.FromColor3(r.albedoColor,r.alpha)},set:function(e,t,n,o){var r=i(t,0,o);r.albedoColor.set(e.r,e.g,e.b),r.alpha=e.a},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:s("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return i(e,0,n).metallic},set:function(e,t,n,o){var r=i(t,0,o);r&&(r.metallic=e)},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return i(e,0,n).roughness},set:function(e,t,n,o){var r=i(t,0,o);r&&(r.roughness=e)},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:s("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return i(e,0,n).anisotropy.intensity},set:function(e,t,n,o){i(t,0,o).anisotropy.intensity=e},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return i(e,0,n).anisotropy.angle},set:function(e,t,n,o){i(t,0,o).anisotropy.angle=e},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:s("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return i(e,0,n).clearCoat.intensity},set:function(e,t,n,o){i(t,0,o).clearCoat.intensity=e},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return i(e,0,n).clearCoat.roughness},set:function(e,t,n,o){i(t,0,o).clearCoat.roughness=e},getTarget:function(e,t,n){return i(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:s("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var o;return null===(o=i(e,0,n).clearCoat.bumpTexture)||void 0===o?void 0:o.level},getTarget:i,set:function(e,t,n,o){return i(t,0,o).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:s("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:s("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return i(e,0,n).subSurface.dispersion},getTarget:i,set:function(e,t,n,o){return i(t,0,o).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return i(e,0,n).emissiveIntensity},getTarget:i,set:function(e,t,n,o){return i(t,0,o).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return i(e,0,n).indexOfRefraction},getTarget:i,set:function(e,t,n,o){return i(t,0,o).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return i(e,0,n).iridescence.intensity},getTarget:i,set:function(e,t,n,o){return i(t,0,o).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return i(e,0,n).iridescence.indexOfRefraction},getTarget:i,set:function(e,t,n,o){return i(t,0,o).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:s("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return i(e,0,n).iridescence.maximumThickness},getTarget:i,set:function(e,t,n,o){return i(t,0,o).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return i(e,0,n).iridescence.minimumThickness},getTarget:i,set:function(e,t,n,o){return i(t,0,o).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:s("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return i(e,0,n).sheen.color},getTarget:i,set:function(e,t,n,o){return i(t,0,o).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:s("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return i(e,0,n).sheen.intensity},getTarget:i,set:function(e,t,n,o){return i(t,0,o).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:s("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return i(e,0,n).metallicF0Factor},getTarget:i,set:function(e,t,n,o){return i(t,0,o).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return i(e,0,n).metallicReflectanceColor},getTarget:i,set:function(e,t,n,o){return i(t,0,o).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:s("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:s("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return i(e,0,n).subSurface.refractionIntensity},getTarget:i,set:function(e,t,n,o){return i(t,0,o).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:s("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return i(e,0,n).subSurface.translucencyIntensity},getTarget:i,set:function(e,t,n,o){return i(t,0,o).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:s("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return i(e,0,n).subSurface.translucencyColor},getTarget:i,set:function(e,t,n,o){var r;return e&&(null===(r=i(t,0,o).subSurface.translucencyColor)||void 0===r?void 0:r.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:s("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return i(e,0,n).subSurface.tintColor},getTarget:i,set:function(e,t,n,o){return i(t,0,o).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return i(e,0,n).subSurface.tintColorAtDistance},getTarget:i,set:function(e,t,n,o){return i(t,0,o).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return i(e,0,n).subSurface.maximumThickness},getTarget:i,set:function(e,t,n,o){return i(t,0,o).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:s("subSurface","thicknessTexture")}}}}}},extensions:{KHR_lights_punctual:{lights:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map((function(e){return e._babylonLight}))},getPropertyName:[function(e){return"length"}]},__array__:{__target__:!0,color:{type:"Color3",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.diffuse},set:function(e,t){var n;return null===(n=t._babylonLight)||void 0===n?void 0:n.diffuse.copyFrom(e)},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"diffuse"}]},intensity:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.intensity},set:function(e,t){return t._babylonLight?t._babylonLight.intensity=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"intensity"}]},range:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.range},set:function(e,t){return t._babylonLight?t._babylonLight.range=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"range"}]},spot:{innerConeAngle:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.innerAngle},set:function(e,t){return t._babylonLight?t._babylonLight.innerAngle=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"innerConeAngle"}]},outerConeAngle:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.angle},set:function(e,t){return t._babylonLight?t._babylonLight.angle=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"outerConeAngle"}]}}}}},EXT_lights_ies:{lights:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map((function(e){return e._babylonLight}))},getPropertyName:[function(e){return"length"}]}}},EXT_lights_image_based:{lights:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map((function(e){return e._babylonTexture}))},getPropertyName:[function(e){return"length"}]},__array__:{__target__:!0,intensity:{type:"number",get:function(e){var t;return null===(t=e._babylonTexture)||void 0===t?void 0:t.level},set:function(e,t){t._babylonTexture&&(t._babylonTexture.level=e)},getTarget:function(e){return e._babylonTexture}},rotation:{type:"Quaternion",get:function(e){var t;return e._babylonTexture&&o.Quaternion.FromRotationMatrix(null===(t=e._babylonTexture)||void 0===t?void 0:t.getReflectionTextureMatrix())},set:function(e,t){var n;t._babylonTexture&&((null===(n=t._babylonTexture.getScene())||void 0===n?void 0:n.useRightHandedSystem)||(e=o.Quaternion.Inverse(e)),o.Matrix.FromQuaternionToRef(e,t._babylonTexture.getReflectionTextureMatrix()))},getTarget:function(e){return e._babylonTexture}}}}}},animations:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map((function(e){return e._babylonAnimationGroup}))},getPropertyName:[function(){return"length"}]},__array__:{}},meshes:{length:{type:"number",get:function(e){return e.length},getTarget:function(e){return e.map((function(e){var t;return null===(t=e.primitives[0]._instanceData)||void 0===t?void 0:t.babylonSourceMesh}))},getPropertyName:[function(){return"length"}]},__array__:{}}};function u(e){return new r(e,l)}function c(e){for(var t=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),n=l,o=0,r=t;o<r.length;o++){var a=r[o];a&&(n=n[a])}if(n&&n.type&&n.get)return n}function d(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),o=l,r=0,a=n;r<a.length;r++){var i=a[r];i&&(o=o[i])}o&&o.type&&o.get&&(o.interpolation=t)}function f(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),o=l,r=0,a=n;r<a.length;r++){var i=a[r];if(i){if(!o[i]){if("?"===i){o.__ignoreObjectTree__=!0;continue}o[i]={},"__array__"===i&&(o[i].__target__=!0)}o=o[i]}}Object.assign(o,t)}},727:(e,t,n)=>{n.r(t),n.d(t,{AnimationPropertyInfo:()=>u,TransformNodeAnimationPropertyInfo:()=>c,WeightAnimationPropertyInfo:()=>d,getQuaternion:()=>s,getVector3:()=>i,getWeights:()=>l});var o=n(322),r=n(597),a=n(698);function i(e,t,n,o){return r.Vector3.FromArray(t,n).scaleInPlace(o)}function s(e,t,n,o){return r.Quaternion.FromArray(t,n).scaleInPlace(o)}function l(e,t,n,o){for(var r=new Array(e._numMorphTargets),a=0;a<r.length;a++)r[a]=t[n++]*o;return r}var u=function(){function e(e,t,n,o){this.type=e,this.name=t,this.getValue=n,this.getStride=o}return e.prototype._buildAnimation=function(e,t,n){var o=new r.Animation(e,this.name,t,this.type);return o.setKeys(n),o},e}(),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,o.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,o){var r=[];return r.push({babylonAnimatable:e._babylonTransformNode,babylonAnimation:this._buildAnimation(t,n,o)}),r},t}(u),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,o.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,o){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new r.Animation("".concat(t,"_").concat(i),s.name,n,s.type);if(l.setKeys(o.map((function(e){return{frame:e.frame,inTangent:e.inTangent?e.inTangent[i]:void 0,value:e.value[i],outTangent:e.outTangent?e.outTangent[i]:void 0,interpolation:e.interpolation}}))),e._primitiveBabylonMeshes)for(var u=0,c=e._primitiveBabylonMeshes;u<c.length;u++){var d=c[u];if(d.morphTargetManager){var f=d.morphTargetManager.getTarget(i),p=l.clone();f.animations.push(p),a.push({babylonAnimatable:f,babylonAnimation:p})}}},s=this,l=0;l<e._numMorphTargets;l++)i(l);return a},t}(u);(0,a.ZU)("/nodes/{}/translation",[new c(r.Animation.ANIMATIONTYPE_VECTOR3,"position",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/rotation",[new c(r.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",s,(function(){return 4}))]),(0,a.ZU)("/nodes/{}/scale",[new c(r.Animation.ANIMATIONTYPE_VECTOR3,"scaling",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/weights",[new d(r.Animation.ANIMATIONTYPE_FLOAT,"influence",l,(function(e){return e._numMorphTargets}))])}},r={};function a(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return o[e](n,n.exports,a),n.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var r=Object.create(null);a.r(r);var i={};t=t||[null,n({}),n([]),n(n)];for(var s=2&o&&e;"object"==typeof s&&!~t.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,a.d(r,i),r},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.d(i,{default:()=>Yt});var s={};a.r(s),a.d(s,{GLTFValidation:()=>b});var l={};a.r(l),a.d(l,{GLTFFileLoader:()=>O,GLTFLoaderAnimationStartMode:()=>v,GLTFLoaderCoordinateSystemMode:()=>y,GLTFLoaderState:()=>g});var u={};a.r(u),a.d(u,{AddObjectAccessorToKey:()=>R.oR,EXT_lights_ies:()=>Y,EXT_lights_image_based:()=>N,EXT_mesh_gpu_instancing:()=>V,EXT_meshopt_compression:()=>H,EXT_texture_avif:()=>Z,EXT_texture_webp:()=>U,ExtrasAsMetadata:()=>Ht,FlowGraphGLTFDataProvider:()=>Kt.FlowGraphGLTFDataProvider,GetMappingForKey:()=>R.tQ,GetPathToObjectConverter:()=>R.Wt,InteractivityGraphToFlowGraphParser:()=>Rt,KHR_animation_pointer:()=>dt,KHR_draco_mesh_compression:()=>X,KHR_interactivity:()=>Lt,KHR_lights:()=>Q,KHR_materials_anisotropy:()=>se,KHR_materials_clearcoat:()=>oe,KHR_materials_diffuse_transmission:()=>Te,KHR_materials_dispersion:()=>Me,KHR_materials_emissive_strength:()=>ue,KHR_materials_ior:()=>me,KHR_materials_iridescence:()=>ae,KHR_materials_pbrSpecularGlossiness:()=>$,KHR_materials_sheen:()=>de,KHR_materials_specular:()=>pe,KHR_materials_transmission:()=>be,KHR_materials_unlit:()=>te,KHR_materials_variants:()=>ye,KHR_materials_volume:()=>we,KHR_mesh_quantization:()=>Re,KHR_node_hoverability:()=>Vt,KHR_node_selectability:()=>It,KHR_node_visibility:()=>Ft,KHR_texture_basisu:()=>Le,KHR_texture_transform:()=>ke,KHR_xmp_json_ld:()=>Be,MSFT_audio_emitter:()=>pt,MSFT_lod:()=>mt,MSFT_minecraftMesh:()=>yt,MSFT_sRGBFactors:()=>gt,SetInterpolationForKey:()=>R.ZU,_AddInteractivityObjectModel:()=>Pt,addNewInteractivityFlowGraphMapping:()=>Tt,getAllSupportedNativeNodeTypes:()=>Mt,getMappingForDeclaration:()=>xt,getMappingForFullOperationName:()=>bt,gltfTypeToBabylonType:()=>Ct});var c={};a.r(c);var d={};a.r(d),a.d(d,{AddObjectAccessorToKey:()=>R.oR,AnimationPropertyInfo:()=>Ie.AnimationPropertyInfo,ArrayItem:()=>F,EXT_lights_ies:()=>Y,EXT_lights_image_based:()=>N,EXT_mesh_gpu_instancing:()=>V,EXT_meshopt_compression:()=>H,EXT_texture_avif:()=>Z,EXT_texture_webp:()=>U,ExtrasAsMetadata:()=>Ht,FlowGraphGLTFDataProvider:()=>Kt.FlowGraphGLTFDataProvider,GLTFFileLoader:()=>O,GLTFLoader:()=>I,GetMappingForKey:()=>R.tQ,GetPathToObjectConverter:()=>R.Wt,InteractivityGraphToFlowGraphParser:()=>Rt,KHR_animation_pointer:()=>dt,KHR_draco_mesh_compression:()=>X,KHR_interactivity:()=>Lt,KHR_lights:()=>Q,KHR_materials_anisotropy:()=>se,KHR_materials_clearcoat:()=>oe,KHR_materials_diffuse_transmission:()=>Te,KHR_materials_dispersion:()=>Me,KHR_materials_emissive_strength:()=>ue,KHR_materials_ior:()=>me,KHR_materials_iridescence:()=>ae,KHR_materials_pbrSpecularGlossiness:()=>$,KHR_materials_sheen:()=>de,KHR_materials_specular:()=>pe,KHR_materials_transmission:()=>be,KHR_materials_unlit:()=>te,KHR_materials_variants:()=>ye,KHR_materials_volume:()=>we,KHR_mesh_quantization:()=>Re,KHR_node_hoverability:()=>Vt,KHR_node_selectability:()=>It,KHR_node_visibility:()=>Ft,KHR_texture_basisu:()=>Le,KHR_texture_transform:()=>ke,KHR_xmp_json_ld:()=>Be,LoadBoundingInfoFromPositionAccessor:()=>B,MSFT_audio_emitter:()=>pt,MSFT_lod:()=>mt,MSFT_minecraftMesh:()=>yt,MSFT_sRGBFactors:()=>gt,SetInterpolationForKey:()=>R.ZU,TransformNodeAnimationPropertyInfo:()=>Ie.TransformNodeAnimationPropertyInfo,WeightAnimationPropertyInfo:()=>Ie.WeightAnimationPropertyInfo,_AddInteractivityObjectModel:()=>Pt,addNewInteractivityFlowGraphMapping:()=>Tt,getAllSupportedNativeNodeTypes:()=>Mt,getMappingForDeclaration:()=>xt,getMappingForFullOperationName:()=>bt,getQuaternion:()=>Ie.getQuaternion,getVector3:()=>Ie.getVector3,getWeights:()=>Ie.getWeights,gltfTypeToBabylonType:()=>Ct,registerGLTFExtension:()=>P,registeredGLTFExtensions:()=>L,unregisterGLTFExtension:()=>k});var f={};a.r(f),a.d(f,{GLTF2:()=>d,GLTFFileLoader:()=>O,GLTFLoaderAnimationStartMode:()=>v,GLTFLoaderCoordinateSystemMode:()=>y,GLTFLoaderState:()=>g,GLTFValidation:()=>b});var p=a(322),h=a(597);function m(e,t,n,o){var r={externalResourceFunction:o};return n&&(r.uri="file:"===t?n:t+n),ArrayBuffer.isView(e)?GLTFValidator.validateBytes(e,r):GLTFValidator.validateString(e,r)}function _(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":m(n.data,n.rootUrl,n.fileName,(function(t){return new Promise((function(n,o){var r=e.length;e.push({resolve:n,reject:o}),postMessage({id:"getExternalResource",index:r,uri:t})}))})).then((function(e){postMessage({id:"validate.resolve",value:e})}),(function(e){postMessage({id:"validate.reject",reason:e})}));break;case"getExternalResource.resolve":e[n.index].resolve(n.value);break;case"getExternalResource.reject":e[n.index].reject(n.reason)}}}var y,v,g,b=function(){function e(){}return e.ValidateAsync=function(e,t,n,o){var r=this;return"function"==typeof Worker?new Promise((function(a,i){var s="".concat(m,"(").concat(_,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),u=new Worker(l),c=function(e){u.removeEventListener("error",c),u.removeEventListener("message",d),i(e)},d=function(e){var t=e.data;switch(t.id){case"getExternalResource":o(t.uri).then((function(e){u.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e.buffer])}),(function(e){u.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})}));break;case"validate.resolve":u.removeEventListener("error",c),u.removeEventListener("message",d),a(t.value),u.terminate();break;case"validate.reject":u.removeEventListener("error",c),u.removeEventListener("message",d),i(t.reason),u.terminate()}};if(u.addEventListener("error",c),u.addEventListener("message",d),u.postMessage({id:"init",url:h.Tools.GetBabylonScriptURL(r.Configuration.url)}),ArrayBuffer.isView(e)){var f=e.slice();u.postMessage({id:"validate",data:f,rootUrl:t,fileName:n},[f.buffer])}else u.postMessage({id:"validate",data:e,rootUrl:t,fileName:n})})):(this._LoadScriptPromise||(this._LoadScriptPromise=h.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return m(e,t,n,o)})))},e.Configuration={url:"".concat(h.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),x="Z2xURg",T="gltf",A={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};function w(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(y||(y={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(v||(v={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(g||(g={}));var O=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new h.Observable,n.onMeshLoadedObservable=new h.Observable,n.onSkinLoadedObservable=new h.Observable,n.onTextureLoadedObservable=new h.Observable,n.onMaterialLoadedObservable=new h.Observable,n.onCameraLoadedObservable=new h.Observable,n.onCompleteObservable=new h.Observable,n.onErrorObservable=new h.Observable,n.onDisposeObservable=new h.Observable,n.onExtensionLoadedObservable=new h.Observable,n.validate=!1,n.onValidatedObservable=new h.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=T,n.extensions=A,n.onLoaderStateChangedObservable=new h.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(t),n}return(0,p.C6)(t,e),Object.defineProperty(t.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),e&&(this._onParsedObserver=this.onParsedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),e&&(this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSkinLoaded",{set:function(e){this._onSkinLoadedObserver&&this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver),e&&(this._onSkinLoadedObserver=this.onSkinLoadedObservable.add((function(t){return e(t.node,t.skinnedNode)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),e&&(this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),e&&(this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),e&&(this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.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:!1,configurable:!0}),Object.defineProperty(t.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:!1,configurable:!0}),Object.defineProperty(t.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},t.prototype.loadFile=function(e,t,n,o,r,a,i,s){var l=this;if(ArrayBuffer.isView(t))return this._loadBinary(e,t,n,o,i,s),null;this._progressCallback=r;var u=t.name||h.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&h.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new h.Observable},d={readAsync:function(n,o){return new Promise((function(r,a){l._loadFile(e,t,(function(e){r(new Uint8Array(e))}),!0,(function(e){a(e)}),(function(e){e.setRequestHeader("Range","bytes=".concat(n,"-").concat(n+o-1))}))}))},byteLength:0};return this._unpackBinaryAsync(new h.DataReader(d)).then((function(e){c.onCompleteObservable.notifyObservers(c),o(e)}),i?function(e){return i(void 0,e)}:void 0),c}return this._loadFile(e,t,(function(t){l._validate(e,new Uint8Array(t,0,t.byteLength),n,u),l._unpackBinaryAsync(new h.DataReader({readAsync:function(e,n){return w(t,e,n)},byteLength:t.byteLength})).then((function(e){o(e)}),i?function(e){return i(void 0,e)}:void 0)}),!0,i)}return this._loadFile(e,t,(function(t){try{l._validate(e,t,n,u),o({json:l._parseJson(t)})}catch(e){i&&i()}}),!1,i)},t.prototype._loadBinary=function(e,t,n,o,r,a){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n,a),this._unpackBinaryAsync(new h.DataReader({readAsync:function(e,n){return function(e,t,n){try{if(t<0||t>=e.byteLength)throw new RangeError("Offset is out of range.");if(t+n>e.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,n))}catch(e){return Promise.reject(e)}}(t,e,n)},byteLength:t.byteLength})).then((function(e){o(e)}),r?function(e){return r(void 0,e)}:void 0)},t.prototype.importMeshAsync=function(e,t,n,o,r,a){var i=this;return Promise.resolve().then((function(){return i.onParsedObservable.notifyObservers(n),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(n),i._loader.importMeshAsync(e,t,null,n,o,r,a)}))},t.prototype.loadAsync=function(e,t,n,o,r){var a=this;return Promise.resolve().then((function(){return a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(r||"")),a._loader=a._getLoader(t),a._loader.loadAsync(e,t,n,o,r)}))},t.prototype.loadAssetContainerAsync=function(e,t,n,o,r){var a=this;return Promise.resolve().then((function(){a.onParsedObservable.notifyObservers(t),a.onParsedObservable.clear(),a._log("Loading ".concat(r||"")),a._loader=a._getLoader(t);var i=new h.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var u=[];a.onCameraLoadedObservable.add((function(e){u.push(e)}));var c=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&c.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,n,o,r).then((function(e){return Array.prototype.push.apply(i.geometries,e.geometries),Array.prototype.push.apply(i.meshes,e.meshes),Array.prototype.push.apply(i.particleSystems,e.particleSystems),Array.prototype.push.apply(i.skeletons,e.skeletons),Array.prototype.push.apply(i.animationGroups,e.animationGroups),Array.prototype.push.apply(i.materials,s),Array.prototype.push.apply(i.textures,l),Array.prototype.push.apply(i.lights,e.lights),Array.prototype.push.apply(i.transformNodes,e.transformNodes),Array.prototype.push.apply(i.cameras,u),Array.prototype.push.apply(i.morphTargetManagers,c),i}))}))},t.prototype.canDirectLoad=function(e){return function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+x)||e.startsWith("data:;base64,"+x)||e.startsWith("data:application/octet-stream;base64,"+x)||e.startsWith("data:model/gltf-binary;base64,"+x)}(e)},t.prototype.directLoad=function(e,t){if(t.startsWith("base64,"+x)||t.startsWith(";base64,"+x)||t.startsWith("application/octet-stream;base64,"+x)||t.startsWith("model/gltf-binary;base64,"+x)){var n=(0,h.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new h.DataReader({readAsync:function(e,t){return w(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})},t.prototype.createPlugin=function(e){return new t(e[T])},Object.defineProperty(t.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,n){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){n(e)}))}))},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(g[this._state]))},t.prototype._loadFile=function(e,t,n,o,r,a){var i=this,s=e._loadFile(t,n,(function(e){i._onProgress(e,s)}),!0,o,r,a);return s.onCompleteObservable.add((function(){s._lengthComputable=!0,s._total=s._loaded})),this._requests.push(s),s},t.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var n=!0,o=0,r=0,a=0,i=this._requests;a<i.length;a++){var s=i[a];if(void 0===s._lengthComputable||void 0===s._loaded||void 0===s._total)return;n=n&&s._lengthComputable,o+=s._loaded,r+=s._total}this._progressCallback({lengthComputable:n,loaded:o,total:n?r:0})}},t.prototype._validate=function(e,t,n,o){var r=this;void 0===n&&(n=""),void 0===o&&(o=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),b.ValidateAsync(t,n,o,(function(t){return r.preprocessUrlAsync(n+t).then((function(t){return e._loadFileAsync(t,void 0,!0,!0).then((function(e){return new Uint8Array(e,0,e.byteLength)}))}))})).then((function(e){r._endPerformanceCounter("Validate JSON"),r.onValidatedObservable.notifyObservers(e),r.onValidatedObservable.clear()}),(function(e){r._endPerformanceCounter("Validate JSON"),h.Tools.Warn("Failed to validate: ".concat(e.message)),r.onValidatedObservable.clear()})))},t.prototype._getLoader=function(e){var n=e.json.asset||{};this._log("Asset version: ".concat(n.version)),n.minVersion&&this._log("Asset minimum version: ".concat(n.minVersion)),n.generator&&this._log("Asset generator: ".concat(n.generator));var o=t._parseVersion(n.version);if(!o)throw new Error("Invalid version: "+n.version);if(void 0!==n.minVersion){var r=t._parseVersion(n.minVersion);if(!r)throw new Error("Invalid minimum version: "+n.minVersion);if(t._compareVersion(r,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+n.minVersion)}var a={1:t._CreateGLTF1Loader,2:t._CreateGLTF2Loader}[o.major];if(!a)throw new Error("Unsupported version: "+n.version);return a(this)},t.prototype._parseJson=function(e){this._startPerformanceCounter("Parse JSON"),this._log("JSON length: ".concat(e.length));var t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t},t.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var n=e.readUint32();if(1179937895!==n)throw new h.RuntimeError("Unexpected magic: "+n,h.ErrorCodes.GLTFLoaderUnexpectedMagicError);var o=e.readUint32();t.loggingEnabled&&t._log("Binary version: ".concat(o));var r,a=e.readUint32();switch(t.useRangeRequests||a===e.buffer.byteLength||h.Logger.Warn("Length in header does not match actual data length: ".concat(a," != ").concat(e.buffer.byteLength)),o){case 1:r=t._unpackBinaryV1Async(e,a);break;case 2:r=t._unpackBinaryV2Async(e,a);break;default:throw new Error("Unsupported version: "+o)}return t._endPerformanceCounter("Unpack Binary"),r}))},t.prototype._unpackBinaryV1Async=function(e,t){var n=e.readUint32(),o=e.readUint32();if(0!==o)throw new Error("Unexpected content format: ".concat(o));var r=t-e.byteOffset,a={json:this._parseJson(e.readString(n)),bin:null};if(0!==r){var i=e.byteOffset;a.bin={readAsync:function(t,n){return e.buffer.readAsync(i+t,n)},byteLength:r}}return Promise.resolve(a)},t.prototype._unpackBinaryV2Async=function(e,t){var n=this,o=1313821514,r=e.readUint32();if(e.readUint32()!==o)throw new Error("First chunk format is not JSON");return e.byteOffset+r===t?e.loadAsync(r).then((function(){return{json:n._parseJson(e.readString(r)),bin:null}})):e.loadAsync(r+8).then((function(){var a={json:n._parseJson(e.readString(r)),bin:null},i=function(){var n=e.readUint32();switch(e.readUint32()){case o:throw new Error("Unexpected JSON chunk");case 5130562:var r=e.byteOffset;a.bin={readAsync:function(t,n){return e.buffer.readAsync(r+t,n)},byteLength:n},e.skipBytes(n);break;default:e.skipBytes(n)}return e.byteOffset!==t?e.loadAsync(8).then(i):Promise.resolve(a)};return i()}))},t._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},t._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},t.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},t.prototype._logClose=function(){--this._logIndentLevel},t.prototype._logEnabled=function(e){var n=t._logSpaces.substring(0,2*this._logIndentLevel);h.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){h.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){h.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(function(){function e(){this.coordinateSystemMode=y.AUTO,this.animationStartMode=v.FIRST,this.loadNodeAnimations=!0,this.loadSkins=!0,this.loadMorphTargets=!0,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this.useRangeRequests=!1,this.createInstances=!0,this.alwaysComputeBoundingBox=!1,this.loadAllMaterials=!1,this.loadOnlyMaterials=!1,this.skipMaterials=!1,this.useSRGBBuffers=!0,this.targetFps=60,this.alwaysComputeSkeletonRootNode=!1,this.useGltfTextureNames=!1,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.extensionOptions={}}return e.prototype.copyFrom=function(e){var t,n,o,r,a,i,s,l,u,c,d,f,p,h,m,_,y,v,g,b,x;e&&(this.onParsed=e.onParsed,this.coordinateSystemMode=null!==(t=e.coordinateSystemMode)&&void 0!==t?t:this.coordinateSystemMode,this.animationStartMode=null!==(n=e.animationStartMode)&&void 0!==n?n:this.animationStartMode,this.loadNodeAnimations=null!==(o=e.loadNodeAnimations)&&void 0!==o?o:this.loadNodeAnimations,this.loadSkins=null!==(r=e.loadSkins)&&void 0!==r?r:this.loadSkins,this.loadMorphTargets=null!==(a=e.loadMorphTargets)&&void 0!==a?a:this.loadMorphTargets,this.compileMaterials=null!==(i=e.compileMaterials)&&void 0!==i?i:this.compileMaterials,this.useClipPlane=null!==(s=e.useClipPlane)&&void 0!==s?s:this.useClipPlane,this.compileShadowGenerators=null!==(l=e.compileShadowGenerators)&&void 0!==l?l:this.compileShadowGenerators,this.transparencyAsCoverage=null!==(u=e.transparencyAsCoverage)&&void 0!==u?u:this.transparencyAsCoverage,this.useRangeRequests=null!==(c=e.useRangeRequests)&&void 0!==c?c:this.useRangeRequests,this.createInstances=null!==(d=e.createInstances)&&void 0!==d?d:this.createInstances,this.alwaysComputeBoundingBox=null!==(f=e.alwaysComputeBoundingBox)&&void 0!==f?f:this.alwaysComputeBoundingBox,this.loadAllMaterials=null!==(p=e.loadAllMaterials)&&void 0!==p?p:this.loadAllMaterials,this.loadOnlyMaterials=null!==(h=e.loadOnlyMaterials)&&void 0!==h?h:this.loadOnlyMaterials,this.skipMaterials=null!==(m=e.skipMaterials)&&void 0!==m?m:this.skipMaterials,this.useSRGBBuffers=null!==(_=e.useSRGBBuffers)&&void 0!==_?_:this.useSRGBBuffers,this.targetFps=null!==(y=e.targetFps)&&void 0!==y?y:this.targetFps,this.alwaysComputeSkeletonRootNode=null!==(v=e.alwaysComputeSkeletonRootNode)&&void 0!==v?v:this.alwaysComputeSkeletonRootNode,this.useGltfTextureNames=null!==(g=e.useGltfTextureNames)&&void 0!==g?g:this.useGltfTextureNames,this.preprocessUrlAsync=null!==(b=e.preprocessUrlAsync)&&void 0!==b?b:this.preprocessUrlAsync,this.customRootNode=e.customRootNode,this.onMeshLoaded=e.onMeshLoaded,this.onSkinLoaded=e.onSkinLoaded,this.onTextureLoaded=e.onTextureLoaded,this.onMaterialLoaded=e.onMaterialLoaded,this.onCameraLoaded=e.onCameraLoaded,this.extensionOptions=null!==(x=e.extensionOptions)&&void 0!==x?x:this.extensionOptions)},e}());(0,h.RegisterSceneLoaderPlugin)(new O);var M=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==M){for(var C in M.BABYLON=M.BABYLON||{},l)M.BABYLON[C]=l[C];for(var C in s)M.BABYLON[C]=s[C]}var R=a(698),E=new Map,L=E;function P(e,t,n){k(e)&&h.Logger.Warn("Extension with the name '".concat(e,"' already exists")),E.set(e,{isGLTFExtension:t,factory:n})}function k(e){return E.delete(e)}var F=function(){function e(){}return e.Get=function(e,t,n){if(!t||null==n||!t[n])throw new Error("".concat(e,": Failed to find index (").concat(n,")"));return t[n]},e.TryGet=function(e,t){return e&&null!=t&&e[t]?e[t]:null},e.Assign=function(e){if(e)for(var t=0;t<e.length;t++)e[t].index=t},e}();function B(e){if(e.min&&e.max){var t=e.min,n=e.max,o=h.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),r=h.TmpVectors.Vector3[1].copyFromFloats(n[0],n[1],n[2]);if(e.normalized&&5126!==e.componentType){var a=1;switch(e.componentType){case 5120:a=127;break;case 5121:a=255;break;case 5122:a=32767;break;case 5123:a=65535}var i=1/a;o.scaleInPlace(i),r.scaleInPlace(i)}return new h.BoundingInfo(o,r)}return null}var I=function(){function e(e){this._completePromises=new Array,this._assetContainer=null,this._babylonLights=[],this._disableInstancedMesh=0,this._allMaterialsDirtyRequired=!1,this._skipStartAnimationStep=!1,this._extensions=new Array,this._disposed=!1,this._rootUrl=null,this._fileName=null,this._uniqueRootUrl=null,this._bin=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions=new Array,this._parent=e}return e.RegisterExtension=function(e,t){P(e,!1,t)},e.UnregisterExtension=function(e){return k(e)},Object.defineProperty(e.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rootUrl",{get:function(){return this._rootUrl},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._completePromises.length=0,this._extensions.forEach((function(e){return e.dispose&&e.dispose()})),this._extensions.length=0,this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())},e.prototype.importMeshAsync=function(e,t,n,o,r,a,i){var s=this;return void 0===i&&(i=""),Promise.resolve().then((function(){s._babylonScene=t,s._assetContainer=n,s._loadData(o);var a=null;if(e){var l={};if(s._gltf.nodes)for(var u=0,c=s._gltf.nodes;u<c.length;u++){var d=c[u];d.name&&(l[d.name]=d.index)}a=(e instanceof Array?e:[e]).map((function(e){var t=l[e];if(void 0===t)throw new Error("Failed to find node '".concat(e,"'"));return t}))}return s._loadAsync(r,i,a,(function(){return{meshes:s._getMeshes(),particleSystems:[],skeletons:s._getSkeletons(),animationGroups:s._getAnimationGroups(),lights:s._babylonLights,transformNodes:s._getTransformNodes(),geometries:s._getGeometries(),spriteManagers:[]}}))}))},e.prototype.loadAsync=function(e,t,n,o,r){var a=this;return void 0===r&&(r=""),Promise.resolve().then((function(){return a._babylonScene=e,a._loadData(t),a._loadAsync(n,r,null,(function(){}))}))},e.prototype._loadAsync=function(e,t,n,o){var r=this;return Promise.resolve().then((function(){return(0,p.sH)(r,void 0,void 0,(function(){var r,a,i,s,l,u,c,d,f,m,_=this;return(0,p.YH)(this,(function(p){switch(p.label){case 0:return this._rootUrl=e,this._uniqueRootUrl=!e.startsWith("file:")&&t?e:"".concat(e).concat(Date.now(),"/"),this._fileName=t,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:if(p.sent(),r="".concat(g[g.LOADING]," => ").concat(g[g.READY]),a="".concat(g[g.LOADING]," => ").concat(g[g.COMPLETE]),this._parent._startPerformanceCounter(r),this._parent._startPerformanceCounter(a),this._parent._setState(g.LOADING),this._extensionsOnLoading(),i=new Array,s=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(n?i.push(this.loadSceneAsync("/nodes",{nodes:n,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(l=F.Get("/scene",this._gltf.scenes,this._gltf.scene||0),i.push(this.loadSceneAsync("/scenes/".concat(l.index),l)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(u=0;u<this._gltf.materials.length;++u)c=this._gltf.materials[u],d="/materials/"+u,f=h.Material.TriangleFillMode,i.push(this._loadMaterialAsync(d,c,null,f,(function(){})));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=s:this._babylonScene._forceBlockMaterialDirtyMechanism(s),this._parent.compileMaterials&&i.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&i.push(this._compileShadowGeneratorsAsync()),m=Promise.all(i).then((function(){_._rootBabylonMesh&&_._rootBabylonMesh!==_._parent.customRootNode&&_._rootBabylonMesh.setEnabled(!0);for(var e=0,t=_._babylonScene.materials;e<t.length;e++){var n=t[e];void 0!==n.maxSimultaneousLights&&(n.maxSimultaneousLights=Math.max(n.maxSimultaneousLights,_._babylonScene.lights.length))}return _._extensionsOnReady(),_._parent._setState(g.READY),_._skipStartAnimationStep||_._startAnimations(),o()})),[2,m.then((function(e){return _._parent._endPerformanceCounter(r),h.Tools.SetImmediate((function(){_._disposed||Promise.all(_._completePromises).then((function(){_._parent._endPerformanceCounter(a),_._parent._setState(g.COMPLETE),_._parent.onCompleteObservable.notifyObservers(void 0),_._parent.onCompleteObservable.clear(),_.dispose()}),(function(e){_._parent.onErrorObservable.notifyObservers(e),_._parent.onErrorObservable.clear(),_.dispose()}))})),e}))]}}))}))})).catch((function(e){throw r._disposed||(r._parent.onErrorObservable.notifyObservers(e),r._parent.onErrorObservable.clear(),r.dispose()),e}))},e.prototype._loadData=function(e){if(this._gltf=e.json,this._setupData(),e.bin){var t=this._gltf.buffers;if(t&&t[0]&&!t[0].uri){var n=t[0];(n.byteLength<e.bin.byteLength-3||n.byteLength>e.bin.byteLength)&&h.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else h.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(F.Assign(this._gltf.accessors),F.Assign(this._gltf.animations),F.Assign(this._gltf.buffers),F.Assign(this._gltf.bufferViews),F.Assign(this._gltf.cameras),F.Assign(this._gltf.images),F.Assign(this._gltf.materials),F.Assign(this._gltf.meshes),F.Assign(this._gltf.nodes),F.Assign(this._gltf.samplers),F.Assign(this._gltf.scenes),F.Assign(this._gltf.skins),F.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},t=0,n=this._gltf.nodes;t<n.length;t++)if((l=n[t]).children)for(var o=0,r=l.children;o<r.length;o++)e[r[o]]=l.index;for(var a=this._createRootNode(),i=0,s=this._gltf.nodes;i<s.length;i++){var l,u=e[(l=s[i]).index];l.parent=void 0===u?a:this._gltf.nodes[u]}}},e.prototype._loadExtensionsAsync=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e,t,n,o,r,a,i,s,l,u,c,d=this;return(0,p.YH)(this,(function(f){switch(f.label){case 0:return e=[],L.forEach((function(t,n){var o;!1===(null===(o=d.parent.extensionOptions[n])||void 0===o?void 0:o.enabled)?t.isGLTFExtension&&d.isExtensionUsed(n)&&h.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!d.isExtensionUsed(n)||e.push((0,p.sH)(d,void 0,void 0,(function(){var e;return(0,p.YH)(this,(function(o){switch(o.label){case 0:return[4,t.factory(this)];case 1:return(e=o.sent()).name!==n&&h.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(n)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}}))})))})),n=(t=(u=this._extensions).push).apply,o=[u],[4,Promise.all(e)];case 1:if(n.apply(t,o.concat([f.sent()])),this._extensions.sort((function(e,t){return(e.order||Number.MAX_VALUE)-(t.order||Number.MAX_VALUE)})),this._parent.onExtensionLoadedObservable.clear(),this._gltf.extensionsRequired)for(r=function(e){if(!a._extensions.some((function(t){return t.name===e&&t.enabled}))){if(!1===(null===(c=a.parent.extensionOptions[e])||void 0===c?void 0:c.enabled))throw new Error("Required extension ".concat(e," is disabled"));throw new Error("Required extension ".concat(e," is not available"))}},a=this,i=0,s=this._gltf.extensionsRequired;i<s.length;i++)l=s[i],r(l);return[2]}}))}))},e.prototype._createRootNode=function(){if(void 0!==this._parent.customRootNode)return this._rootBabylonMesh=this._parent.customRootNode,{_babylonTransformNode:null===this._rootBabylonMesh?void 0:this._rootBabylonMesh,index:-1};this._babylonScene._blockEntityCollection=!!this._assetContainer;var t=new h.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=t,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var n={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case y.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case y.FORCE_RIGHT_HANDED:this._babylonScene.useRightHandedSystem=!0;break;default:throw new Error("Invalid coordinate system mode (".concat(this._parent.coordinateSystemMode,")"))}return this._parent.onMeshLoadedObservable.notifyObservers(t),n},e.prototype.loadSceneAsync=function(e,t){var n=this,o=this._extensionsLoadSceneAsync(e,t);if(o)return o;var r=new Array;if(this.logOpen("".concat(e," ").concat(t.name||"")),t.nodes)for(var a=0,i=t.nodes;a<i.length;a++){var s=i[a],l=F.Get("".concat(e,"/nodes/").concat(s),this._gltf.nodes,s);r.push(this.loadNodeAsync("/nodes/".concat(l.index),l,(function(e){e.parent=n._rootBabylonMesh})))}for(var u=0,c=this._postSceneLoadActions;u<c.length;u++)(0,c[u])();return r.push(this._loadAnimationsAsync()),this.logClose(),Promise.all(r).then((function(){}))},e.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var n=0,o=e._primitiveBabylonMeshes;n<o.length;n++)t(o[n])},e.prototype._getGeometries=function(){var e=[],t=this._gltf.nodes;if(t)for(var n=0,o=t;n<o.length;n++){var r=o[n];this._forEachPrimitive(r,(function(t){var n=t.geometry;n&&-1===e.indexOf(n)&&e.push(n)}))}return e},e.prototype._getMeshes=function(){var e=[];this._rootBabylonMesh instanceof h.AbstractMesh&&e.push(this._rootBabylonMesh);var t=this._gltf.nodes;if(t)for(var n=0,o=t;n<o.length;n++){var r=o[n];this._forEachPrimitive(r,(function(t){e.push(t)}))}return e},e.prototype._getTransformNodes=function(){var e=[],t=this._gltf.nodes;if(t)for(var n=0,o=t;n<o.length;n++){var r=o[n];r._babylonTransformNode&&"TransformNode"===r._babylonTransformNode.getClassName()&&e.push(r._babylonTransformNode),r._babylonTransformNodeForSkin&&e.push(r._babylonTransformNodeForSkin)}return e},e.prototype._getSkeletons=function(){var e=[],t=this._gltf.skins;if(t)for(var n=0,o=t;n<o.length;n++){var r=o[n];r._data&&e.push(r._data.babylonSkeleton)}return e},e.prototype._getAnimationGroups=function(){var e=[],t=this._gltf.animations;if(t)for(var n=0,o=t;n<o.length;n++){var r=o[n];r._babylonAnimationGroup&&e.push(r._babylonAnimationGroup)}return e},e.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case v.NONE:break;case v.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case v.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void h.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},e.prototype.loadNodeAsync=function(t,n,o){var r=this;void 0===o&&(o=function(){});var a=this._extensionsLoadNodeAsync(t,n,o);if(a)return a;if(n._babylonTransformNode)throw new Error("".concat(t,": Invalid recursive node hierarchy"));var i=new Array;this.logOpen("".concat(t," ").concat(n.name||""));var s=function(a){if(e.AddPointerMetadata(a,t),e._LoadTransform(n,a),null!=n.camera){var s=F.Get("".concat(t,"/camera"),r._gltf.cameras,n.camera);i.push(r.loadCameraAsync("/cameras/".concat(s.index),s,(function(e){e.parent=a})))}if(n.children)for(var l=0,u=n.children;l<u.length;l++){var c=u[l],d=F.Get("".concat(t,"/children/").concat(c),r._gltf.nodes,c);i.push(r.loadNodeAsync("/nodes/".concat(d.index),d,(function(e){e.parent=a})))}o(a)},l=null!=n.mesh,u=this._parent.loadSkins&&null!=n.skin;if(!l||u){var c=n.name||"node".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var d=new h.TransformNode(c,this._babylonScene);d._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==n.mesh?n._babylonTransformNode=d:n._babylonTransformNodeForSkin=d,s(d)}if(l)if(u){var f=F.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh);i.push(this._loadMeshAsync("/meshes/".concat(f.index),n,f,(function(e){var o=n._babylonTransformNodeForSkin;e.metadata=(0,h.deepMerge)(o.metadata,e.metadata||{});var a=F.Get("".concat(t,"/skin"),r._gltf.skins,n.skin);i.push(r._loadSkinAsync("/skins/".concat(a.index),n,a,(function(t){r._forEachPrimitive(n,(function(e){e.skeleton=t})),r._postSceneLoadActions.push((function(){if(null!=a.skeleton){var t=F.Get("/skins/".concat(a.index,"/skeleton"),r._gltf.nodes,a.skeleton).parent;n.index===t.index?e.parent=o.parent:e.parent=t._babylonTransformNode}else e.parent=r._rootBabylonMesh;r._parent.onSkinLoadedObservable.notifyObservers({node:o,skinnedNode:e})}))})))})))}else f=F.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh),i.push(this._loadMeshAsync("/meshes/".concat(f.index),n,f,s));return this.logClose(),Promise.all(i).then((function(){return r._forEachPrimitive(n,(function(e){e.geometry&&e.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)})),n._babylonTransformNode}))},e.prototype._loadMeshAsync=function(e,t,n,o){var r=n.primitives;if(!r||!r.length)throw new Error("".concat(e,": Primitives are missing"));null==r[0].index&&F.Assign(r);var a=new Array;this.logOpen("".concat(e," ").concat(n.name||""));var i=t.name||"node".concat(t.index);if(1===r.length){var s=n.primitives[0];a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),i,t,n,s,(function(e){t._babylonTransformNode=e,t._primitiveBabylonMeshes=[e]})))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new h.TransformNode(i,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(var l=0,u=r;l<u.length;l++)s=u[l],a.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(s.index),"".concat(i,"_primitive").concat(s.index),t,n,s,(function(e){e.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(e)})))}return o(t._babylonTransformNode),this.logClose(),Promise.all(a).then((function(){return t._babylonTransformNode}))},e.prototype._loadMeshPrimitiveAsync=function(t,n,o,r,a,i){var s=this,l=this._extensionsLoadMeshPrimitiveAsync(t,n,o,r,a,i);if(l)return l;this.logOpen("".concat(t));var u,c,d=0===this._disableInstancedMesh&&this._parent.createInstances&&null==o.skin&&!r.primitives[0].targets;if(d&&a._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(u=a._instanceData.babylonSourceMesh.createInstance(n))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c=a._instanceData.promise;else{var f=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var p=new h.Mesh(n,this._babylonScene);p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,p.sideOrientation=this._babylonScene.useRightHandedSystem?h.Material.CounterClockWiseSideOrientation:h.Material.ClockWiseSideOrientation,this._createMorphTargets(t,o,r,a,p),f.push(this._loadVertexDataAsync(t,a,p).then((function(e){return s._loadMorphTargetsAsync(t,a,p,e).then((function(){s._disposed||(s._babylonScene._blockEntityCollection=!!s._assetContainer,e.applyToMesh(p),e._parentContainer=s._assetContainer,s._babylonScene._blockEntityCollection=!1)}))})));var m=e._GetDrawMode(t,a.mode);if(null==a.material){var _=this._defaultBabylonMaterialData[m];_||(_=this._createDefaultMaterial("__GLTFLoader._default",m),this._parent.onMaterialLoadedObservable.notifyObservers(_),this._defaultBabylonMaterialData[m]=_),p.material=_}else if(!this.parent.skipMaterials){var y=F.Get("".concat(t,"/material"),this._gltf.materials,a.material);f.push(this._loadMaterialAsync("/materials/".concat(y.index),y,p,m,(function(e){p.material=e})))}c=Promise.all(f),d&&(a._instanceData={babylonSourceMesh:p,promise:c}),u=p}return e.AddPointerMetadata(u,t),this._parent.onMeshLoadedObservable.notifyObservers(u),i(u),this.logClose(),c.then((function(){return u}))},e.prototype._loadVertexDataAsync=function(e,t,n){var o=this,r=this._extensionsLoadVertexDataAsync(e,t,n);if(r)return r;var a=t.attributes;if(!a)throw new Error("".concat(e,": Attributes are missing"));var i=new Array,s=new h.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=F.Get("".concat(e,"/indices"),this._gltf.accessors,t.indices);i.push(this._loadIndicesAccessorAsync("/accessors/".concat(l.index),l).then((function(e){s.setIndices(e)})))}var u=function(t,r,l){if(null!=a[t]){n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(r)&&n._delayInfo.push(r);var u=F.Get("".concat(e,"/attributes/").concat(t),o._gltf.accessors,a[t]);i.push(o._loadVertexAccessorAsync("/accessors/".concat(u.index),u,r).then((function(e){if(e.getKind()===h.VertexBuffer.PositionKind&&!o.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=B(u);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,u.count)}))),r==h.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(u)}};return u("POSITION",h.VertexBuffer.PositionKind),u("NORMAL",h.VertexBuffer.NormalKind),u("TANGENT",h.VertexBuffer.TangentKind),u("TEXCOORD_0",h.VertexBuffer.UVKind),u("TEXCOORD_1",h.VertexBuffer.UV2Kind),u("TEXCOORD_2",h.VertexBuffer.UV3Kind),u("TEXCOORD_3",h.VertexBuffer.UV4Kind),u("TEXCOORD_4",h.VertexBuffer.UV5Kind),u("TEXCOORD_5",h.VertexBuffer.UV6Kind),u("JOINTS_0",h.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",h.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",h.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",h.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",h.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(n.hasVertexAlpha=!0)})),Promise.all(i).then((function(){return s}))},e.prototype._createMorphTargets=function(e,t,n,o,r){if(o.targets&&this._parent.loadMorphTargets){if(null==t._numMorphTargets)t._numMorphTargets=o.targets.length;else if(o.targets.length!==t._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var a=n.extras?n.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,r.morphTargetManager=new h.MorphTargetManager(this._babylonScene),r.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,r.morphTargetManager.areUpdatesFrozen=!0;for(var i=0;i<o.targets.length;i++){var s=t.weights?t.weights[i]:n.weights?n.weights[i]:0,l=a?a[i]:"morphTarget".concat(i);r.morphTargetManager.addTarget(new h.MorphTarget(l,s,r.getScene()))}}},e.prototype._loadMorphTargetsAsync=function(e,t,n,o){if(!t.targets||!this._parent.loadMorphTargets)return Promise.resolve();for(var r=new Array,a=n.morphTargetManager,i=0;i<a.numTargets;i++){var s=a.getTarget(i);r.push(this._loadMorphTargetVertexDataAsync("".concat(e,"/targets/").concat(i),o,t.targets[i],s))}return Promise.all(r).then((function(){a.areUpdatesFrozen=!1}))},e.prototype._loadMorphTargetVertexDataAsync=function(e,t,n,o){var r=this,a=new Array,i=function(o,i,s){if(null!=n[o]){var l=t.getVertexBuffer(i);if(l){var u=F.Get("".concat(e,"/").concat(o),r._gltf.accessors,n[o]);a.push(r._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then((function(e){s(l,e)})))}}};return i("POSITION",h.VertexBuffer.PositionKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,o){n[o]=t[o]+e})),o.setPositions(n)})),i("NORMAL",h.VertexBuffer.NormalKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(n.length,(function(e,o){n[o]=t[o]+e})),o.setNormals(n)})),i("TANGENT",h.VertexBuffer.TangentKind,(function(e,t){var n=new Float32Array(t.length/3*4),r=0;e.forEach(t.length/3*4,(function(e,o){(o+1)%4!=0&&(n[r]=t[r]+e,r++)})),o.setTangents(n)})),i("TEXCOORD_0",h.VertexBuffer.UVKind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,o){n[o]=t[o]+e})),o.setUVs(n)})),i("TEXCOORD_1",h.VertexBuffer.UV2Kind,(function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,(function(e,o){n[o]=t[o]+e})),o.setUV2s(n)})),i("COLOR_0",h.VertexBuffer.ColorKind,(function(t,n){var r=null,a=t.getSize();if(3===a){r=new Float32Array(n.length/3*4),t.forEach(n.length,(function(e,t){var o=Math.floor(t/3),a=t%3;r[4*o+a]=n[3*o+a]+e}));for(var i=0;i<n.length/3;++i)r[4*i+3]=1}else{if(4!==a)throw new Error("".concat(e,": Invalid number of components (").concat(a,") for COLOR_0 attribute"));r=new Float32Array(n.length),t.forEach(n.length,(function(e,t){r[t]=n[t]+e}))}o.setColors(r)})),Promise.all(a).then((function(){}))},e._LoadTransform=function(e,t){if(null==e.skin){var n=h.Vector3.Zero(),o=h.Quaternion.Identity(),r=h.Vector3.One();e.matrix?h.Matrix.FromArray(e.matrix).decompose(r,o,n):(e.translation&&(n=h.Vector3.FromArray(e.translation)),e.rotation&&(o=h.Quaternion.FromArray(e.rotation)),e.scale&&(r=h.Vector3.FromArray(e.scale))),t.position=n,t.rotationQuaternion=o,t.scaling=r}},e.prototype._loadSkinAsync=function(e,t,n,o){var r=this;if(!this._parent.loadSkins)return Promise.resolve();var a=this._extensionsLoadSkinAsync(e,t,n);if(a)return a;if(n._data)return o(n._data.babylonSkeleton),n._data.promise;var i="skeleton".concat(n.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var s=new h.Skeleton(n.name||i,i,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,n,s);var l=this._loadSkinInverseBindMatricesDataAsync(e,n).then((function(e){r._updateBoneMatrices(s,e)}));return n._data={babylonSkeleton:s,promise:l},o(s),l},e.prototype._loadBones=function(e,t,n){if(null==t.skeleton||this._parent.alwaysComputeSkeletonRootNode){var o=this._findSkeletonRootNode("".concat(e,"/joints"),t.joints);if(o)if(void 0===t.skeleton)t.skeleton=o.index;else{var r=F.Get("".concat(e,"/skeleton"),this._gltf.nodes,t.skeleton);r===o||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1}(r,o)||(h.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=o.index)}else h.Logger.Warn("".concat(e,": Failed to find common root"))}for(var a={},i=0,s=t.joints;i<s.length;i++){var l=s[i],u=F.Get("".concat(e,"/joints/").concat(l),this._gltf.nodes,l);this._loadBone(u,t,n,a)}},e.prototype._findSkeletonRootNode=function(e,t){if(0===t.length)return null;for(var n={},o=0,r=t;o<r.length;o++){for(var a=r[o],i=[],s=F.Get("".concat(e,"/").concat(a),this._gltf.nodes,a);-1!==s.index;)i.unshift(s),s=s.parent;n[a]=i}for(var l=null,u=0;;++u){if(u>=(i=n[t[0]]).length)return l;s=i[u];for(var c=1;c<t.length;++c)if(u>=(i=n[t[c]]).length||s!==i[u])return l;l=s}},e.prototype._loadBone=function(e,t,n,o){e._isJoint=!0;var r=o[e.index];if(r)return r;var a=null;e.index!==t.skeleton&&(e.parent&&-1!==e.parent.index?a=this._loadBone(e.parent,t,n,o):void 0!==t.skeleton&&h.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return r=new h.Bone(e.name||"joint".concat(e.index),n,a,this._getNodeMatrix(e),null,null,i),o[e.index]=r,this._postSceneLoadActions.push((function(){r.linkTransformNode(e._babylonTransformNode)})),r},e.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);var n=F.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("/accessors/".concat(n.index),n)},e.prototype._updateBoneMatrices=function(e,t){for(var n=0,o=e.bones;n<o.length;n++){var r=o[n],a=h.Matrix.Identity(),i=r._index;t&&-1!==i&&(h.Matrix.FromArrayToRef(t,16*i,a),a.invertToRef(a));var s=r.getParent();s&&a.multiplyToRef(s.getAbsoluteInverseBindMatrix(),a),r.updateMatrix(a,!1,!1),r._updateAbsoluteBindMatrices(void 0,!1)}},e.prototype._getNodeMatrix=function(e){return e.matrix?h.Matrix.FromArray(e.matrix):h.Matrix.Compose(e.scale?h.Vector3.FromArray(e.scale):h.Vector3.One(),e.rotation?h.Quaternion.FromArray(e.rotation):h.Quaternion.Identity(),e.translation?h.Vector3.FromArray(e.translation):h.Vector3.Zero())},e.prototype.loadCameraAsync=function(t,n,o){void 0===o&&(o=function(){});var r=this._extensionsLoadCameraAsync(t,n,o);if(r)return r;var a=new Array;this.logOpen("".concat(t," ").concat(n.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var i=new h.FreeCamera(n.name||"camera".concat(n.index),h.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,i.ignoreParentScaling=!0,n._babylonCamera=i,i.rotation.set(0,Math.PI,0),n.type){case"perspective":var s=n.perspective;if(!s)throw new Error("".concat(t,": Camera perspective properties are missing"));i.fov=s.yfov,i.minZ=s.znear,i.maxZ=s.zfar||0;break;case"orthographic":if(!n.orthographic)throw new Error("".concat(t,": Camera orthographic properties are missing"));i.mode=h.Camera.ORTHOGRAPHIC_CAMERA,i.orthoLeft=-n.orthographic.xmag,i.orthoRight=n.orthographic.xmag,i.orthoBottom=-n.orthographic.ymag,i.orthoTop=n.orthographic.ymag,i.minZ=n.orthographic.znear,i.maxZ=n.orthographic.zfar;break;default:throw new Error("".concat(t,": Invalid camera type (").concat(n.type,")"))}return e.AddPointerMetadata(i,t),this._parent.onCameraLoadedObservable.notifyObservers(i),o(i),this.logClose(),Promise.all(a).then((function(){return i}))},e.prototype._loadAnimationsAsync=function(){var e=this._gltf.animations;if(!e)return Promise.resolve();for(var t=new Array,n=0;n<e.length;n++){var o=e[n];t.push(this.loadAnimationAsync("/animations/".concat(o.index),o).then((function(e){0===e.targetedAnimations.length&&e.dispose()})))}return Promise.all(t).then((function(){}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return this._extensionsLoadAnimationAsync(e,t)||Promise.resolve().then(a.t.bind(a,597,23)).then((function(o){var r=o.AnimationGroup;n._babylonScene._blockEntityCollection=!!n._assetContainer;var a=new r(t.name||"animation".concat(t.index),n._babylonScene);a._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1,t._babylonAnimationGroup=a;var i=new Array;F.Assign(t.channels),F.Assign(t.samplers);for(var s=0,l=t.channels;s<l.length;s++){var u=l[s];i.push(n._loadAnimationChannelAsync("".concat(e,"/channels/").concat(u.index),e,t,u,(function(e,t){e.animations=e.animations||[],e.animations.push(t),a.addTargetedAnimation(t,e)})))}return Promise.all(i).then((function(){return a.normalize(0),a}))}))},e.prototype._loadAnimationChannelAsync=function(e,t,n,o,r){return(0,p.sH)(this,void 0,void 0,(function(){var i,s,l,u,c,d,f,h,m,_;return(0,p.YH)(this,(function(p){switch(p.label){case 0:return(i=this._extensionsLoadAnimationChannelAsync(e,t,n,o,r))?[2,i]:null==o.target.node?[2,Promise.resolve()]:(s=F.Get("".concat(e,"/target/node"),this._gltf.nodes,o.target.node),l=o.target.path,(u="weights"===l)&&!s._numMorphTargets||!u&&!s._babylonTransformNode?[2,Promise.resolve()]:this._parent.loadNodeAnimations||u||s._isJoint?[4,Promise.resolve().then(a.bind(a,727))]:[2,Promise.resolve()]);case 1:switch(p.sent(),l){case"translation":c=null===(f=(0,R.tQ)("/nodes/{}/translation"))||void 0===f?void 0:f.interpolation;break;case"rotation":c=null===(h=(0,R.tQ)("/nodes/{}/rotation"))||void 0===h?void 0:h.interpolation;break;case"scale":c=null===(m=(0,R.tQ)("/nodes/{}/scale"))||void 0===m?void 0:m.interpolation;break;case"weights":c=null===(_=(0,R.tQ)("/nodes/{}/weights"))||void 0===_?void 0:_.interpolation;break;default:throw new Error("".concat(e,"/target/path: Invalid value (").concat(o.target.path,")"))}if(!c)throw new Error("".concat(e,"/target/path: Could not find interpolation properties for target path (").concat(o.target.path,")"));return d={object:s,info:c},[2,this._loadAnimationChannelFromTargetInfoAsync(e,t,n,o,d,r)]}}))}))},e.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,o,r,a){var i=this.parent.targetFps,s=1/i,l=F.Get("".concat(e,"/sampler"),n.samplers,o.sampler);return this._loadAnimationSamplerAsync("".concat(t,"/samplers/").concat(o.sampler),l).then((function(e){for(var t=0,l=r.object,u=0,c=r.info;u<c.length;u++){var d=c[u],f=d.getStride(l),p=e.input,h=e.output,m=new Array(p.length),_=0;switch(e.interpolation){case"STEP":for(var y=0;y<p.length;y++){var v=d.getValue(l,h,_,1);_+=f,m[y]={frame:p[y]*i,value:v,interpolation:1}}break;case"CUBICSPLINE":for(y=0;y<p.length;y++){var g=d.getValue(l,h,_,s);_+=f,v=d.getValue(l,h,_,1),_+=f;var b=d.getValue(l,h,_,s);_+=f,m[y]={frame:p[y]*i,inTangent:g,value:v,outTangent:b}}break;case"LINEAR":for(y=0;y<p.length;y++)v=d.getValue(l,h,_,1),_+=f,m[y]={frame:p[y]*i,value:v}}if(_>0)for(var x="".concat(n.name||"animation".concat(n.index),"_channel").concat(o.index,"_").concat(t),T=0,A=d.buildAnimations(l,x,i,m);T<A.length;T++){var w=A[T];t++,a(w.babylonAnimatable,w.babylonAnimation)}}}))},e.prototype._loadAnimationSamplerAsync=function(e,t){if(t._data)return t._data;var n=t.interpolation||"LINEAR";switch(n){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error("".concat(e,"/interpolation: Invalid value (").concat(t.interpolation,")"))}var o=F.Get("".concat(e,"/input"),this._gltf.accessors,t.input),r=F.Get("".concat(e,"/output"),this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync("/accessors/".concat(o.index),o),this._loadFloatAccessorAsync("/accessors/".concat(r.index),r)]).then((function(e){var t=e[0],o=e[1];return{input:t,interpolation:n,output:o}})),t._data},e.prototype.loadBufferAsync=function(e,t,n,o){var r=this._extensionsLoadBufferAsync(e,t,n,o);if(r)return r;if(!t._data)if(t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{if(!this._bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));t._data=this._bin.readAsync(0,t.byteLength)}return t._data.then((function(t){try{return new Uint8Array(t.buffer,t.byteOffset+n,o)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}}))},e.prototype.loadBufferViewAsync=function(e,t){var n=this._extensionsLoadBufferViewAsync(e,t);if(n)return n;if(t._data)return t._data;var o=F.Get("".concat(e,"/buffer"),this._gltf.buffers,t.buffer);return t._data=this.loadBufferAsync("/buffers/".concat(o.index),o,t.byteOffset||0,t.byteLength),t._data},e.prototype._loadAccessorAsync=function(t,n,o){var r=this;if(n._data)return n._data;var a=e._GetNumComponents(t,n.type),i=a*h.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new o(s));else{var l=F.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(r){if(5126!==n.componentType||n.normalized||l.byteStride&&l.byteStride!==i){var u=new o(s);return h.VertexBuffer.ForEach(r,n.byteOffset||0,l.byteStride||i,a,n.componentType,u.length,n.normalized||!1,(function(e,t){u[t]=e})),u}return e._GetTypedArray(t,n.componentType,r,n.byteOffset,s)}))}if(n.sparse){var u=n.sparse;n._data=n._data.then((function(s){var l=s,c=F.Get("".concat(t,"/sparse/indices/bufferView"),r._gltf.bufferViews,u.indices.bufferView),d=F.Get("".concat(t,"/sparse/values/bufferView"),r._gltf.bufferViews,u.values.bufferView);return Promise.all([r.loadBufferViewAsync("/bufferViews/".concat(c.index),c),r.loadBufferViewAsync("/bufferViews/".concat(d.index),d)]).then((function(r){var s,c=r[0],d=r[1],f=e._GetTypedArray("".concat(t,"/sparse/indices"),u.indices.componentType,c,u.indices.byteOffset,u.count),p=a*u.count;if(5126!==n.componentType||n.normalized){var m=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,d,u.values.byteOffset,p);s=new o(p),h.VertexBuffer.ForEach(m,0,i,a,n.componentType,s.length,n.normalized||!1,(function(e,t){s[t]=e}))}else s=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,d,u.values.byteOffset,p);for(var _=0,y=0;y<f.length;y++)for(var v=f[y]*a,g=0;g<a;g++)l[v++]=s[_++];return l}))}))}return n._data},e.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},e.prototype._loadIndicesAccessorAsync=function(t,n){if("SCALAR"!==n.type)throw new Error("".concat(t,"/type: Invalid value ").concat(n.type));if(5121!==n.componentType&&5123!==n.componentType&&5125!==n.componentType)throw new Error("".concat(t,"/componentType: Invalid value ").concat(n.componentType));if(n._data)return n._data;if(n.sparse){var o=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n.componentType);n._data=this._loadAccessorAsync(t,n,o)}else{var r=F.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._data=this.loadBufferViewAsync("/bufferViews/".concat(r.index),r).then((function(o){return e._GetTypedArray(t,n.componentType,o,n.byteOffset,n.count)}))}return n._data},e.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then((function(e){return new h.Buffer(t,e,!1)})),e._babylonBuffer},e.prototype._loadVertexAccessorAsync=function(t,n,o){var r;if(null===(r=n._babylonVertexBuffer)||void 0===r?void 0:r[o])return n._babylonVertexBuffer[o];n._babylonVertexBuffer||(n._babylonVertexBuffer={});var a=this._babylonScene.getEngine();if(n.sparse||null==n.bufferView)n._babylonVertexBuffer[o]=this._loadFloatAccessorAsync(t,n).then((function(e){return new h.VertexBuffer(a,e,o,!1)}));else{var i=F.Get("".concat(t,"/bufferView"),this._gltf.bufferViews,n.bufferView);n._babylonVertexBuffer[o]=this._loadVertexBufferViewAsync(i).then((function(r){var s=e._GetNumComponents(t,n.type);return new h.VertexBuffer(a,r,o,!1,void 0,i.byteStride,void 0,n.byteOffset,s,n.componentType,n.normalized,!0,void 0,!0)}))}return n._babylonVertexBuffer[o]},e.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return t&&(t.baseColorFactor?(n.albedoColor=h.Color3.FromArray(t.baseColorFactor),n.alpha=t.baseColorFactor[3]):n.albedoColor=h.Color3.White(),n.metallic=null==t.metallicFactor?1:t.metallicFactor,n.roughness=null==t.roughnessFactor?1:t.roughnessFactor,t.baseColorTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),t.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),n.albedoTexture=e}))),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),t.metallicRoughnessTexture,(function(e){e.name="".concat(n.name," (Metallic Roughness)"),n.metallicTexture=e}))),n.useMetallnessFromMetallicTextureBlue=!0,n.useRoughnessFromMetallicTextureGreen=!0,n.useRoughnessFromMetallicTextureAlpha=!1)),Promise.all(o).then((function(){}))},e.prototype._loadMaterialAsync=function(t,n,o,r,a){void 0===a&&(a=function(){});var i=this._extensionsLoadMaterialAsync(t,n,o,r,a);if(i)return i;n._data=n._data||{};var s=n._data[r];if(!s){this.logOpen("".concat(t," ").concat(n.name||""));var l=this.createMaterial(t,n,r);s={babylonMaterial:l,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(t,n,l)},n._data[r]=s,e.AddPointerMetadata(l,t),this._parent.onMaterialLoadedObservable.notifyObservers(l),this.logClose()}return o&&(s.babylonMeshes.push(o),o.onDisposeObservable.addOnce((function(){var e=s.babylonMeshes.indexOf(o);-1!==e&&s.babylonMeshes.splice(e,1)}))),a(s.babylonMaterial),s.promise.then((function(){return s.babylonMaterial}))},e.prototype._createDefaultMaterial=function(e,t){this._babylonScene._blockEntityCollection=!!this._assetContainer;var n=new h.PBRMaterial(e,this._babylonScene);return n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n.fillMode=t,n.enableSpecularAntiAliasing=!0,n.useRadianceOverAlpha=!this._parent.transparencyAsCoverage,n.useSpecularOverAlpha=!this._parent.transparencyAsCoverage,n.transparencyMode=h.PBRMaterial.PBRMATERIAL_OPAQUE,n.metallic=1,n.roughness=1,n},e.prototype.createMaterial=function(e,t,n){var o=this._extensionsCreateMaterial(e,t,n);if(o)return o;var r=t.name||"material".concat(t.index);return this._createDefaultMaterial(r,n)},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this._extensionsLoadMaterialPropertiesAsync(e,t,n);if(o)return o;var r=new Array;return r.push(this.loadMaterialBasePropertiesAsync(e,t,n)),t.pbrMetallicRoughness&&r.push(this._loadMaterialMetallicRoughnessPropertiesAsync("".concat(e,"/pbrMetallicRoughness"),t.pbrMetallicRoughness,n)),this.loadMaterialAlphaProperties(e,t,n),Promise.all(r).then((function(){}))},e.prototype.loadMaterialBasePropertiesAsync=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return n.emissiveColor=t.emissiveFactor?h.Color3.FromArray(t.emissiveFactor):new h.Color3(0,0,0),t.doubleSided&&(n.backFaceCulling=!1,n.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),t.normalTexture,(function(e){e.name="".concat(n.name," (Normal)"),n.bumpTexture=e}))),n.invertNormalMapX=!this._babylonScene.useRightHandedSystem,n.invertNormalMapY=this._babylonScene.useRightHandedSystem,null!=t.normalTexture.scale&&n.bumpTexture&&(n.bumpTexture.level=t.normalTexture.scale),n.forceIrradianceInFragment=!0),t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),t.occlusionTexture,(function(e){e.name="".concat(n.name," (Occlusion)"),n.ambientTexture=e}))),n.useAmbientInGrayScale=!0,null!=t.occlusionTexture.strength&&(n.ambientTextureStrength=t.occlusionTexture.strength)),t.emissiveTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),t.emissiveTexture,(function(e){e.name="".concat(n.name," (Emissive)"),n.emissiveTexture=e}))),Promise.all(o).then((function(){}))},e.prototype.loadMaterialAlphaProperties=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));switch(t.alphaMode||"OPAQUE"){case"OPAQUE":n.transparencyMode=h.PBRMaterial.PBRMATERIAL_OPAQUE,n.alpha=1;break;case"MASK":n.transparencyMode=h.PBRMaterial.PBRMATERIAL_ALPHATEST,n.alphaCutOff=null==t.alphaCutoff?.5:t.alphaCutoff,n.albedoTexture&&(n.albedoTexture.hasAlpha=!0);break;case"BLEND":n.transparencyMode=h.PBRMaterial.PBRMATERIAL_ALPHABLEND,n.albedoTexture&&(n.albedoTexture.hasAlpha=!0,n.useAlphaFromAlbedoTexture=!0);break;default:throw new Error("".concat(e,"/alphaMode: Invalid value (").concat(t.alphaMode,")"))}},e.prototype.loadTextureInfoAsync=function(t,n,o){var r=this;void 0===o&&(o=function(){});var a=this._extensionsLoadTextureInfoAsync(t,n,o);if(a)return a;if(this.logOpen("".concat(t)),n.texCoord>=6)throw new Error("".concat(t,"/texCoord: Invalid value (").concat(n.texCoord,")"));var i=F.Get("".concat(t,"/index"),this._gltf.textures,n.index);i._textureInfo=n;var s=this._loadTextureAsync("/textures/".concat(n.index),i,(function(a){a.coordinatesIndex=n.texCoord||0,e.AddPointerMetadata(a,t),r._parent.onTextureLoadedObservable.notifyObservers(a),o(a)}));return this.logClose(),s},e.prototype._loadTextureAsync=function(t,n,o){void 0===o&&(o=function(){});var r=this._extensionsLoadTextureAsync(t,n,o);if(r)return r;this.logOpen("".concat(t," ").concat(n.name||""));var a=null==n.sampler?e.DefaultSampler:F.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=F.Get("".concat(t,"/source"),this._gltf.images,n.source),s=this._createTextureAsync(t,a,i,o,void 0,!n._textureInfo.nonColorData);return this.logClose(),s},e.prototype._createTextureAsync=function(e,t,n,o,r,a){var i=this;void 0===o&&(o=function(){});var s=this._loadSampler("/samplers/".concat(t.index),t),l=new Array,u=new h.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var c={noMipmap:s.noMipMaps,invertY:!1,samplingMode:s.samplingMode,onLoad:function(){i._disposed||u.resolve()},onError:function(t,n){i._disposed||u.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:n.mimeType,loaderOptions:r,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},d=new h.Texture(null,this._babylonScene,c);return d._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,l.push(u.promise),l.push(this.loadImageAsync("/images/".concat(n.index),n).then((function(e){var t=n.uri||"".concat(i._fileName,"#image").concat(n.index),o="data:".concat(i._uniqueRootUrl).concat(t);d.updateURL(o,e);var r=d.getInternalTexture();r&&(r.label=n.name)}))),d.wrapU=s.wrapU,d.wrapV=s.wrapV,o(d),this._parent.useGltfTextureNames&&(d.name=n.name||n.uri||"image".concat(n.index)),Promise.all(l).then((function(){return d}))},e.prototype._loadSampler=function(t,n){return n._data||(n._data={noMipMaps:9728===n.minFilter||9729===n.minFilter,samplingMode:e._GetTextureSamplingMode(t,n),wrapU:e._GetTextureWrapMode("".concat(t,"/wrapS"),n.wrapS),wrapV:e._GetTextureWrapMode("".concat(t,"/wrapT"),n.wrapT)}),n._data},e.prototype.loadImageAsync=function(e,t){if(!t._data){if(this.logOpen("".concat(e," ").concat(t.name||"")),t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{var n=F.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(n.index),n)}this.logClose()}return t._data},e.prototype.loadUriAsync=function(t,n,o){var r=this,a=this._extensionsLoadUriAsync(t,n,o);if(a)return a;if(!e._ValidateUri(o))throw new Error("".concat(t,": '").concat(o,"' is invalid"));if((0,h.IsBase64DataUrl)(o)){var i=new Uint8Array((0,h.DecodeBase64UrlToBinary)(o));return this.log("".concat(t,": Decoded ").concat(o.substring(0,64),"... (").concat(i.length," bytes)")),Promise.resolve(i)}return this.log("".concat(t,": Loading ").concat(o)),this._parent.preprocessUrlAsync(this._rootUrl+o).then((function(e){return new Promise((function(n,a){r._parent._loadFile(r._babylonScene,e,(function(e){r._disposed||(r.log("".concat(t,": Loaded ").concat(o," (").concat(e.byteLength," bytes)")),n(new Uint8Array(e)))}),!0,(function(e){a(new h.LoadFileError("".concat(t,": Failed to load '").concat(o,"'").concat(e?": "+e.status+" "+e.statusText:""),e))}))}))}))},e.AddPointerMetadata=function(e,t){e.metadata=e.metadata||{};var n=e._internalMetadata=e._internalMetadata||{},o=n.gltf=n.gltf||{};(o.pointers=o.pointers||[]).push(t)},e._GetTextureWrapMode=function(e,t){switch(t=null==t?10497:t){case 33071:return h.Texture.CLAMP_ADDRESSMODE;case 33648:return h.Texture.MIRROR_ADDRESSMODE;case 10497:return h.Texture.WRAP_ADDRESSMODE;default:return h.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),h.Texture.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var n=null==t.magFilter?9729:t.magFilter,o=null==t.minFilter?9987:t.minFilter;if(9729===n)switch(o){case 9728:return h.Texture.LINEAR_NEAREST;case 9729:return h.Texture.LINEAR_LINEAR;case 9984:return h.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return h.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return h.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return h.Texture.LINEAR_LINEAR_MIPLINEAR;default:return h.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),h.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&h.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),o){case 9728:return h.Texture.NEAREST_NEAREST;case 9729:return h.Texture.NEAREST_LINEAR;case 9984:return h.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return h.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return h.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return h.Texture.NEAREST_LINEAR_MIPLINEAR;default:return h.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),h.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,h.GetTypedArrayConstructor)(t)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}},e._GetTypedArray=function(t,n,o,r,a){var i=o.buffer;r=o.byteOffset+(r||0);var s=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n),l=h.VertexBuffer.GetTypeByteLength(n);return r%l!=0?(h.Logger.Warn("".concat(t,": Copying buffer as byte offset (").concat(r,") is not a multiple of component type byte length (").concat(l,")")),new s(i.slice(r,r+a*l),0)):new s(i,r,a)},e._GetNumComponents=function(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error("".concat(e,": Invalid type (").concat(t,")"))},e._ValidateUri=function(e){return h.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return h.Material.PointListDrawMode;case 1:return h.Material.LineListDrawMode;case 2:return h.Material.LineLoopDrawMode;case 3:return h.Material.LineStripDrawMode;case 4:return h.Material.TriangleFillMode;case 5:return h.Material.TriangleStripDrawMode;case 6:return h.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(t,")"))},e.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var n=0,o=this._gltf.materials;n<o.length;n++){var r=o[n];if(r._data)for(var a in r._data)for(var i=r._data[a],s=0,l=i.babylonMeshes;s<l.length;s++){var u=l[s];u.computeWorldMatrix(!0);var c=i.babylonMaterial;t.push(c.forceCompilationAsync(u)),t.push(c.forceCompilationAsync(u,{useInstances:!0})),this._parent.useClipPlane&&(t.push(c.forceCompilationAsync(u,{clipPlane:!0})),t.push(c.forceCompilationAsync(u,{clipPlane:!0,useInstances:!0})))}}return Promise.all(t).then((function(){e._parent._endPerformanceCounter("Compile materials")}))},e.prototype._compileShadowGeneratorsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile shadow generators");for(var t=new Array,n=0,o=this._babylonScene.lights;n<o.length;n++){var r=o[n].getShadowGenerator();r&&t.push(r.forceCompilationAsync())}return Promise.all(t).then((function(){e._parent._endPerformanceCounter("Compile shadow generators")}))},e.prototype._forEachExtensions=function(e){for(var t=0,n=this._extensions;t<n.length;t++){var o=n[t];o.enabled&&e(o)}},e.prototype._applyExtensions=function(e,t,n){for(var o=0,r=this._extensions;o<r.length;o++){var a=r[o];if(a.enabled){var i="".concat(a.name,".").concat(t),s=e;s._activeLoaderExtensionFunctions=s._activeLoaderExtensionFunctions||{};var l=s._activeLoaderExtensionFunctions;if(!l[i]){l[i]=!0;try{var u=n(a);if(u)return u}finally{delete l[i]}}}}return null},e.prototype._extensionsOnLoading=function(){this._forEachExtensions((function(e){return e.onLoading&&e.onLoading()}))},e.prototype._extensionsOnReady=function(){this._forEachExtensions((function(e){return e.onReady&&e.onReady()}))},e.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",(function(n){return n.loadSceneAsync&&n.loadSceneAsync(e,t)}))},e.prototype._extensionsLoadNodeAsync=function(e,t,n){return this._applyExtensions(t,"loadNode",(function(o){return o.loadNodeAsync&&o.loadNodeAsync(e,t,n)}))},e.prototype._extensionsLoadCameraAsync=function(e,t,n){return this._applyExtensions(t,"loadCamera",(function(o){return o.loadCameraAsync&&o.loadCameraAsync(e,t,n)}))},e.prototype._extensionsLoadVertexDataAsync=function(e,t,n){return this._applyExtensions(t,"loadVertexData",(function(o){return o._loadVertexDataAsync&&o._loadVertexDataAsync(e,t,n)}))},e.prototype._extensionsLoadMeshPrimitiveAsync=function(e,t,n,o,r,a){return this._applyExtensions(r,"loadMeshPrimitive",(function(i){return i._loadMeshPrimitiveAsync&&i._loadMeshPrimitiveAsync(e,t,n,o,r,a)}))},e.prototype._extensionsLoadMaterialAsync=function(e,t,n,o,r){return this._applyExtensions(t,"loadMaterial",(function(a){return a._loadMaterialAsync&&a._loadMaterialAsync(e,t,n,o,r)}))},e.prototype._extensionsCreateMaterial=function(e,t,n){return this._applyExtensions(t,"createMaterial",(function(o){return o.createMaterial&&o.createMaterial(e,t,n)}))},e.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,n){return this._applyExtensions(t,"loadMaterialProperties",(function(o){return o.loadMaterialPropertiesAsync&&o.loadMaterialPropertiesAsync(e,t,n)}))},e.prototype._extensionsLoadTextureInfoAsync=function(e,t,n){return this._applyExtensions(t,"loadTextureInfo",(function(o){return o.loadTextureInfoAsync&&o.loadTextureInfoAsync(e,t,n)}))},e.prototype._extensionsLoadTextureAsync=function(e,t,n){return this._applyExtensions(t,"loadTexture",(function(o){return o._loadTextureAsync&&o._loadTextureAsync(e,t,n)}))},e.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",(function(n){return n.loadAnimationAsync&&n.loadAnimationAsync(e,t)}))},e.prototype._extensionsLoadAnimationChannelAsync=function(e,t,n,o,r){return this._applyExtensions(n,"loadAnimationChannel",(function(a){return a._loadAnimationChannelAsync&&a._loadAnimationChannelAsync(e,t,n,o,r)}))},e.prototype._extensionsLoadSkinAsync=function(e,t,n){return this._applyExtensions(n,"loadSkin",(function(o){return o._loadSkinAsync&&o._loadSkinAsync(e,t,n)}))},e.prototype._extensionsLoadUriAsync=function(e,t,n){return this._applyExtensions(t,"loadUri",(function(o){return o._loadUriAsync&&o._loadUriAsync(e,t,n)}))},e.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",(function(n){return n.loadBufferViewAsync&&n.loadBufferViewAsync(e,t)}))},e.prototype._extensionsLoadBufferAsync=function(e,t,n,o){return this._applyExtensions(t,"loadBuffer",(function(r){return r.loadBufferAsync&&r.loadBufferAsync(e,t,n,o)}))},e.LoadExtensionAsync=function(e,t,n,o){if(!t.extensions)return null;var r=t.extensions[n];return r?o("".concat(e,"/extensions/").concat(n),r):null},e.LoadExtraAsync=function(e,t,n,o){if(!t.extras)return null;var r=t.extras[n];return r?o("".concat(e,"/extras/").concat(n),r):null},e.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},e.prototype.logOpen=function(e){this._parent._logOpen(e)},e.prototype.logClose=function(){this._parent._logClose()},e.prototype.log=function(e){this._parent._log(e)},e.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},e.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},e.DefaultSampler={index:-1},e}();O._CreateGLTF2Loader=function(e){return new I(e)};var S="EXT_lights_image_based",N=function(){function e(e){this.name=S,this._loader=e,this.enabled=this._loader.isExtensionUsed(S)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights}},e.prototype.loadSceneAsync=function(e,t){var n=this;return I.LoadExtensionAsync(e,t,this.name,(function(o,r){n._loader._allMaterialsDirtyRequired=!0;var a=new Array;a.push(n._loader.loadSceneAsync(e,t)),n._loader.logOpen("".concat(o));var i=F.Get("".concat(o,"/light"),n._lights,r.light);return a.push(n._loadLightAsync("/extensions/".concat(n.name,"/lights/").concat(r.light),i).then((function(e){n._loader.babylonScene.environmentTexture=e}))),n._loader.logClose(),Promise.all(a).then((function(){}))}))},e.prototype._loadLightAsync=function(e,t){var n=this;if(!t._loaded){var o=new Array;this._loader.logOpen("".concat(e));for(var r=new Array(t.specularImages.length),a=function(n){var a=t.specularImages[n];r[n]=new Array(a.length);for(var s=function(t){var s="".concat(e,"/specularImages/").concat(n,"/").concat(t);i._loader.logOpen("".concat(s));var l=a[t],u=F.Get(s,i._loader.gltf.images,l);o.push(i._loader.loadImageAsync("/images/".concat(l),u).then((function(e){r[n][t]=e}))),i._loader.logClose()},l=0;l<a.length;l++)s(l)},i=this,s=0;s<t.specularImages.length;s++)a(s);this._loader.logClose(),t._loaded=Promise.all(o).then((function(){var o=new h.RawCubeTexture(n._loader.babylonScene,null,t.specularImageSize);if(o.name=t.name||"environment",t._babylonTexture=o,null!=t.intensity&&(o.level=t.intensity),t.rotation){var a=h.Quaternion.FromArray(t.rotation);n._loader.babylonScene.useRightHandedSystem||(a=h.Quaternion.Inverse(a)),h.Matrix.FromQuaternionToRef(a,o.getReflectionTextureMatrix())}if(!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));var i=h.SphericalHarmonics.FromArray(t.irradianceCoefficients);i.scaleInPlace(t.intensity),i.convertIrradianceToLambertianRadiance();var s=h.SphericalPolynomial.FromHarmonics(i),l=(r.length-1)/Math.log2(t.specularImageSize);return o.updateRGBDAsync(r,s,l)}))}return t._loaded.then((function(){return t._babylonTexture}))},e}();k(S),P(S,!0,(function(e){return new N(e)}));var G="EXT_mesh_gpu_instancing",V=function(){function e(e){this.name=G,this._loader=e,this.enabled=this._loader.isExtensionUsed(G)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(e,r){o._loader._disableInstancedMesh++;var a=o._loader.loadNodeAsync("/nodes/".concat(t.index),t,n);if(o._loader._disableInstancedMesh--,!t._primitiveBabylonMeshes)return a;var i=new Array,s=0,l=function(t){if(null!=r.attributes[t]){var n=F.Get("".concat(e,"/attributes/").concat(t),o._loader.gltf.accessors,r.attributes[t]);if(i.push(o._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===s)s=n.count;else if(s!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else i.push(Promise.resolve(null))};return l("TRANSLATION"),l("ROTATION"),l("SCALE"),a.then((function(e){return Promise.all(i).then((function(n){var o=n[0],r=n[1],a=n[2],i=new Float32Array(16*s);h.TmpVectors.Vector3[0].copyFromFloats(0,0,0),h.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),h.TmpVectors.Vector3[1].copyFromFloats(1,1,1);for(var l=0;l<s;++l)o&&h.Vector3.FromArrayToRef(o,3*l,h.TmpVectors.Vector3[0]),r&&h.Quaternion.FromArrayToRef(r,4*l,h.TmpVectors.Quaternion[0]),a&&h.Vector3.FromArrayToRef(a,3*l,h.TmpVectors.Vector3[1]),h.Matrix.ComposeToRef(h.TmpVectors.Vector3[1],h.TmpVectors.Quaternion[0],h.TmpVectors.Vector3[0],h.TmpVectors.Matrix[0]),h.TmpVectors.Matrix[0].copyToArray(i,16*l);for(var u=0,c=t._primitiveBabylonMeshes;u<c.length;u++)c[u].thinInstanceSetBuffer("matrix",i,16,!0);return e}))}))}))},e}();k(G),P(G,!0,(function(e){return new V(e)}));var D="EXT_meshopt_compression",H=function(){function e(e){this.name=D,this.enabled=e.isExtensionUsed(D),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return I.LoadExtensionAsync(e,t,this.name,(function(o,r){var a=t;if(a._meshOptData)return a._meshOptData;var i=F.Get("".concat(e,"/buffer"),n._loader.gltf.buffers,r.buffer);return a._meshOptData=n._loader.loadBufferAsync("/buffers/".concat(i.index),i,r.byteOffset||0,r.byteLength).then((function(e){return h.MeshoptCompression.Default.decodeGltfBufferAsync(e,r.count,r.byteStride,r.mode,r.filter)})),a._meshOptData}))},e}();k(D),P(D,!0,(function(e){return new H(e)}));var K="EXT_texture_webp",U=function(){function e(e){this.name=K,this._loader=e,this.enabled=e.isExtensionUsed(K)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=null==t.sampler?I.DefaultSampler:F.Get("".concat(e,"/sampler"),o._loader.gltf.samplers,t.sampler),s=F.Get("".concat(r,"/source"),o._loader.gltf.images,a.source);return o._loader._createTextureAsync(e,i,s,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)}))},e}();k(K),P(K,!0,(function(e){return new U(e)}));var j="EXT_texture_avif",Z=function(){function e(e){this.name=j,this._loader=e,this.enabled=e.isExtensionUsed(j)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=null==t.sampler?I.DefaultSampler:F.Get("".concat(e,"/sampler"),o._loader.gltf.samplers,t.sampler),s=F.Get("".concat(r,"/source"),o._loader.gltf.images,a.source);return o._loader._createTextureAsync(e,i,s,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)}))},e}();k(j),P(j,!0,(function(e){return new Z(e)}));var q="EXT_lights_ies",Y=function(){function e(e){this.name=q,this._loader=e,this.enabled=this._loader.isExtensionUsed(q)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,F.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){return(0,p.sH)(o,void 0,void 0,(function(){var o,i,s,l,u,c=this;return(0,p.YH)(this,(function(d){switch(d.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t=(i=F.Get(r,c._lights,a.light)).name||e.name;c._loader.babylonScene._blockEntityCollection=!!c._loader._assetContainer,(o=new h.SpotLight(t,h.Vector3.Zero(),h.Vector3.Backward(),0,1,c._loader.babylonScene)).angle=Math.PI/2,o.innerAngle=0,o._parentContainer=c._loader._assetContainer,c._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=o,o.falloffType=h.Light.FALLOFF_GLTF,o.diffuse=a.color?h.Color3.FromArray(a.color):h.Color3.White(),o.intensity=a.multiplier||1,o.range=Number.MAX_VALUE,o.parent=e,c._loader._babylonLights.push(o),I.AddPointerMetadata(o,r),n(e)}))];case 1:return s=d.sent(),i.uri?[4,this._loader.loadUriAsync(e,i,i.uri)]:[3,3];case 2:return l=d.sent(),[3,5];case 3:return u=F.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,i.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u)];case 4:l=d.sent(),d.label=5;case 5:return o.iesProfileTexture=new h.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,l,!0,void 0,void 0,void 0,void 0,".ies"),[2,s]}}))}))}))},e}();k(q),P(q,!0,(function(e){return new Y(e)}));var W="KHR_draco_mesh_compression",X=function(){function e(e){this.name=W,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=h.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(W)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){if(null!=t.mode&&4!==t.mode&&5!==t.mode)throw new Error("".concat(e,": Unsupported mode ").concat(t.mode));var i={},s={},l=function(e,r){var l=a.attributes[e];if(null!=l&&(n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(r)&&n._delayInfo.push(r),i[r]=l,o.useNormalizedFlagFromAccessor)){var u=F.TryGet(o._loader.gltf.accessors,t.attributes[e]);u&&(s[r]=u.normalized||!1)}};l("POSITION",h.VertexBuffer.PositionKind),l("NORMAL",h.VertexBuffer.NormalKind),l("TANGENT",h.VertexBuffer.TangentKind),l("TEXCOORD_0",h.VertexBuffer.UVKind),l("TEXCOORD_1",h.VertexBuffer.UV2Kind),l("TEXCOORD_2",h.VertexBuffer.UV3Kind),l("TEXCOORD_3",h.VertexBuffer.UV4Kind),l("TEXCOORD_4",h.VertexBuffer.UV5Kind),l("TEXCOORD_5",h.VertexBuffer.UV6Kind),l("JOINTS_0",h.VertexBuffer.MatricesIndicesKind),l("WEIGHTS_0",h.VertexBuffer.MatricesWeightsKind),l("COLOR_0",h.VertexBuffer.ColorKind);var u=F.Get(r,o._loader.gltf.bufferViews,a.bufferView);return u._dracoBabylonGeometry||(u._dracoBabylonGeometry=o._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u).then((function(r){var a=o.dracoDecoder||h.DracoDecoder.Default,l=F.TryGet(o._loader.gltf.accessors,t.attributes.POSITION),u=o._loader.parent.alwaysComputeBoundingBox||n.skeleton||!l?null:B(l);return a._decodeMeshToGeometryForGltfAsync(n.name,o._loader.babylonScene,r,i,s,u).catch((function(t){throw new Error("".concat(e,": ").concat(t.message))}))}))),u._dracoBabylonGeometry}))},e}();k(W),P(W,!0,(function(e){return new X(e)}));var z="KHR_lights_punctual",Q=function(){function e(e){this.name=z,this._loader=e,this.enabled=this._loader.isExtensionUsed(z)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,F.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){return o._loader._allMaterialsDirtyRequired=!0,o._loader.loadNodeAsync(e,t,(function(e){var t,i=F.Get(r,o._lights,a.light),s=i.name||e.name;switch(o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer,i.type){case"directional":var l=new h.DirectionalLight(s,h.Vector3.Backward(),o._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new h.PointLight(s,h.Vector3.Zero(),o._loader.babylonScene);break;case"spot":var u=new h.SpotLight(s,h.Vector3.Zero(),h.Vector3.Backward(),0,1,o._loader.babylonScene);u.angle=2*(i.spot&&i.spot.outerConeAngle||Math.PI/4),u.innerAngle=2*(i.spot&&i.spot.innerConeAngle||0),t=u;break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(r,": Invalid light type (").concat(i.type,")"))}t._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=t,t.falloffType=h.Light.FALLOFF_GLTF,t.diffuse=i.color?h.Color3.FromArray(i.color):h.Color3.White(),t.intensity=null==i.intensity?1:i.intensity,t.range=null==i.range?Number.MAX_VALUE:i.range,t.parent=e,o._loader._babylonLights.push(t),I.AddPointerMetadata(t,r),n(e)}))}))},e}();k(z),P(z,!0,(function(e){return new Q(e)}));var J="KHR_materials_pbrSpecularGlossiness",$=function(){function e(e){this.name=J,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(J)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialBasePropertiesAsync(e,t,n)),i.push(o._loadSpecularGlossinessPropertiesAsync(r,a,n)),o._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(i).then((function(){}))}))},e.prototype._loadSpecularGlossinessPropertiesAsync=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return n.metallic=null,n.roughness=null,t.diffuseFactor?(n.albedoColor=h.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=h.Color3.White(),n.reflectivityColor=t.specularFactor?h.Color3.FromArray(t.specularFactor):h.Color3.White(),n.microSurface=null==t.glossinessFactor?1:t.glossinessFactor,t.diffuseTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),t.diffuseTexture,(function(e){e.name="".concat(n.name," (Diffuse)"),n.albedoTexture=e}))),t.specularGlossinessTexture&&(o.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),t.specularGlossinessTexture,(function(e){e.name="".concat(n.name," (Specular Glossiness)"),n.reflectivityTexture=e,n.reflectivityTexture.hasAlpha=!0}))),n.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(o).then((function(){}))},e}();k(J),P(J,!0,(function(e){return new $(e)}));var ee="KHR_materials_unlit",te=function(){function e(e){this.name=ee,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(ee)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(){return o._loadUnlitPropertiesAsync(e,t,n)}))},e.prototype._loadUnlitPropertiesAsync=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;n.unlit=!0;var r=t.pbrMetallicRoughness;return r&&(r.baseColorFactor?(n.albedoColor=h.Color3.FromArray(r.baseColorFactor),n.alpha=r.baseColorFactor[3]):n.albedoColor=h.Color3.White(),r.baseColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),r.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),n.albedoTexture=e})))),t.doubleSided&&(n.backFaceCulling=!1,n.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(o).then((function(){}))},e}();k(ee),P(ee,!0,(function(e){return new te(e)}));var ne="KHR_materials_clearcoat",oe=function(){function e(e){this.name=ne,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ne)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadClearCoatPropertiesAsync(r,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadClearCoatPropertiesAsync=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return n.clearCoat.isEnabled=!0,n.clearCoat.useRoughnessFromMainTexture=!1,n.clearCoat.remapF0OnInterfaceChange=!1,null!=t.clearcoatFactor?n.clearCoat.intensity=t.clearcoatFactor:n.clearCoat.intensity=0,t.clearcoatTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatTexture"),t.clearcoatTexture,(function(e){e.name="".concat(n.name," (ClearCoat)"),n.clearCoat.texture=e}))),null!=t.clearcoatRoughnessFactor?n.clearCoat.roughness=t.clearcoatRoughnessFactor:n.clearCoat.roughness=0,t.clearcoatRoughnessTexture&&(t.clearcoatRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatRoughnessTexture"),t.clearcoatRoughnessTexture,(function(e){e.name="".concat(n.name," (ClearCoat Roughness)"),n.clearCoat.textureRoughness=e})))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatNormalTexture"),t.clearcoatNormalTexture,(function(e){e.name="".concat(n.name," (ClearCoat Normal)"),n.clearCoat.bumpTexture=e}))),n.invertNormalMapX=!n.getScene().useRightHandedSystem,n.invertNormalMapY=n.getScene().useRightHandedSystem,null!=t.clearcoatNormalTexture.scale&&(n.clearCoat.bumpTexture.level=t.clearcoatNormalTexture.scale)),Promise.all(o).then((function(){}))},e}();k(ne),P(ne,!0,(function(e){return new oe(e)}));var re="KHR_materials_iridescence",ae=function(){function e(e){this.name=re,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(re)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadIridescencePropertiesAsync(r,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadIridescencePropertiesAsync=function(e,t,n){var o,r,a,i,s;if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var l=new Array;return n.iridescence.isEnabled=!0,n.iridescence.intensity=null!==(o=t.iridescenceFactor)&&void 0!==o?o:0,n.iridescence.indexOfRefraction=null!==(a=null!==(r=t.iridescenceIor)&&void 0!==r?r:t.iridescenceIOR)&&void 0!==a?a:1.3,n.iridescence.minimumThickness=null!==(i=t.iridescenceThicknessMinimum)&&void 0!==i?i:100,n.iridescence.maximumThickness=null!==(s=t.iridescenceThicknessMaximum)&&void 0!==s?s:400,t.iridescenceTexture&&l.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceTexture"),t.iridescenceTexture,(function(e){e.name="".concat(n.name," (Iridescence)"),n.iridescence.texture=e}))),t.iridescenceThicknessTexture&&l.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceThicknessTexture"),t.iridescenceThicknessTexture,(function(e){e.name="".concat(n.name," (Iridescence Thickness)"),n.iridescence.thicknessTexture=e}))),Promise.all(l).then((function(){}))},e}();k(re),P(re,!0,(function(e){return new ae(e)}));var ie="KHR_materials_anisotropy",se=function(){function e(e){this.name=ie,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(ie)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadIridescencePropertiesAsync(r,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadIridescencePropertiesAsync=function(e,t,n){var o,r;if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var a=new Array;return n.anisotropy.isEnabled=!0,n.anisotropy.intensity=null!==(o=t.anisotropyStrength)&&void 0!==o?o:0,n.anisotropy.angle=null!==(r=t.anisotropyRotation)&&void 0!==r?r:0,t.anisotropyTexture&&(t.anisotropyTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/anisotropyTexture"),t.anisotropyTexture,(function(e){e.name="".concat(n.name," (Anisotropy Intensity)"),n.anisotropy.texture=e})))),Promise.all(a).then((function(){}))},e}();k(ie),P(ie,!0,(function(e){return new se(e)}));var le="KHR_materials_emissive_strength",ue=function(){function e(e){this.name=le,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(le)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){return o._loader.loadMaterialPropertiesAsync(e,t,n).then((function(){o._loadEmissiveProperties(r,a,n)}))}))},e.prototype._loadEmissiveProperties=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));void 0!==t.emissiveStrength&&(n.emissiveIntensity=t.emissiveStrength)},e}();k(le),P(le,!0,(function(e){return new ue(e)}));var ce="KHR_materials_sheen",de=function(){function e(e){this.name=ce,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ce)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadSheenPropertiesAsync(r,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadSheenPropertiesAsync=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return n.sheen.isEnabled=!0,n.sheen.intensity=1,null!=t.sheenColorFactor?n.sheen.color=h.Color3.FromArray(t.sheenColorFactor):n.sheen.color=h.Color3.Black(),t.sheenColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),t.sheenColorTexture,(function(e){e.name="".concat(n.name," (Sheen Color)"),n.sheen.texture=e}))),void 0!==t.sheenRoughnessFactor?n.sheen.roughness=t.sheenRoughnessFactor:n.sheen.roughness=0,t.sheenRoughnessTexture&&(t.sheenRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),t.sheenRoughnessTexture,(function(e){e.name="".concat(n.name," (Sheen Roughness)"),n.sheen.textureRoughness=e})))),n.sheen.albedoScaling=!0,n.sheen.useRoughnessFromMainTexture=!1,Promise.all(o).then((function(){}))},e}();k(ce),P(ce,!0,(function(e){return new de(e)}));var fe="KHR_materials_specular",pe=function(){function e(e){this.name=fe,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(fe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadSpecularPropertiesAsync(r,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadSpecularPropertiesAsync=function(e,t,n){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return void 0!==t.specularFactor&&(n.metallicF0Factor=t.specularFactor),void 0!==t.specularColorFactor&&(n.metallicReflectanceColor=h.Color3.FromArray(t.specularColorFactor)),t.specularTexture&&(t.specularTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),t.specularTexture,(function(e){e.name="".concat(n.name," (Specular)"),n.metallicReflectanceTexture=e,n.useOnlyMetallicFromMetallicReflectanceTexture=!0})))),t.specularColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),t.specularColorTexture,(function(e){e.name="".concat(n.name," (Specular Color)"),n.reflectanceTexture=e}))),Promise.all(o).then((function(){}))},e}();k(fe),P(fe,!0,(function(e){return new pe(e)}));var he="KHR_materials_ior",me=function(){function e(e){this.name=he,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(he)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadIorPropertiesAsync(r,a,n)),Promise.all(i).then((function(){}))}))},e.prototype._loadIorPropertiesAsync=function(t,n,o){if(!(o instanceof h.PBRMaterial))throw new Error("".concat(t,": Material type not supported"));return void 0!==n.ior?o.indexOfRefraction=n.ior:o.indexOfRefraction=e._DEFAULT_IOR,Promise.resolve()},e._DEFAULT_IOR=1.5,e}();k(he),P(he,!0,(function(e){return new me(e)}));var _e="KHR_materials_variants",ye=function(){function e(e){this.name=_e,this._loader=e,this.enabled=this._loader.isExtensionUsed(_e)}return e.prototype.dispose=function(){this._loader=null},e.GetAvailableVariants=function(e){var t=this._GetExtensionMetadata(e);return t?Object.keys(t.variants):[]},e.prototype.getAvailableVariants=function(t){return e.GetAvailableVariants(t)},e.SelectVariant=function(e,t){var n=this._GetExtensionMetadata(e);if(!n)throw new Error("Cannot select variant on a glTF mesh that does not have the ".concat(_e," extension"));var o=function(e){var t=n.variants[e];if(t)for(var o=0,r=t;o<r.length;o++){var a=r[o];a.mesh.material=a.material}};if(t instanceof Array)for(var r=0,a=t;r<a.length;r++)o(a[r]);else o(t);n.lastSelected=t},e.prototype.selectVariant=function(t,n){e.SelectVariant(t,n)},e.Reset=function(e){var t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot reset on a glTF mesh that does not have the ".concat(_e," extension"));for(var n=0,o=t.original;n<o.length;n++){var r=o[n];r.mesh.material=r.material}t.lastSelected=null},e.prototype.reset=function(t){e.Reset(t)},e.GetLastSelectedVariant=function(e){var t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot get the last selected variant on a glTF mesh that does not have the ".concat(_e," extension"));return t.lastSelected},e.prototype.getLastSelectedVariant=function(t){return e.GetLastSelectedVariant(t)},e._GetExtensionMetadata=function(e){var t,n;return(null===(n=null===(t=null==e?void 0:e._internalMetadata)||void 0===t?void 0:t.gltf)||void 0===n?void 0:n[_e])||null},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._variants=t.variants}},e.prototype.onReady=function(){var t,n,o=this._loader.rootBabylonMesh;o&&(null===(n=null===(t=this._loader.parent.extensionOptions[_e])||void 0===t?void 0:t.onLoaded)||void 0===n||n.call(t,{get variants(){return e.GetAvailableVariants(o)},get selectedVariant(){var t=e.GetLastSelectedVariant(o);return t?Array.isArray(t)?t[0]:t:e.GetAvailableVariants(o)[0]},set selectedVariant(t){e.SelectVariant(o,t)}}))},e.prototype._loadMeshPrimitiveAsync=function(t,n,o,r,a,i){var s=this;return I.LoadExtensionAsync(t,a,this.name,(function(l,u){var c=new Array;return c.push(s._loader._loadMeshPrimitiveAsync(t,n,o,r,a,(function(n){if(i(n),n instanceof h.Mesh){var o=I._GetDrawMode(t,a.mode),r=s._loader.rootBabylonMesh,d=r?r._internalMetadata=r._internalMetadata||{}:{},f=d.gltf=d.gltf||{},p=f[_e]=f[_e]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:n,material:n.material});for(var m=function(t){var a=u.mappings[t],i=F.Get("".concat(l,"/mappings/").concat(t,"/material"),s._loader.gltf.materials,a.material);c.push(s._loader._loadMaterialAsync("#/materials/".concat(a.material),i,n,o,(function(t){for(var o=function(o){var i=a.variants[o],l=F.Get("/extensions/".concat(_e,"/variants/").concat(i),s._variants,i);p.variants[l.name]=p.variants[l.name]||[],p.variants[l.name].push({mesh:n,material:t}),n.onClonedObservable.add((function(t){var o=t,a=null,i=o;do{if(!(i=i.parent))return;a=e._GetExtensionMetadata(i)}while(null===a);if(r&&a===e._GetExtensionMetadata(r)){for(var s in i._internalMetadata={},r._internalMetadata)i._internalMetadata[s]=r._internalMetadata[s];for(var s in i._internalMetadata.gltf=[],r._internalMetadata.gltf)i._internalMetadata.gltf[s]=r._internalMetadata.gltf[s];i._internalMetadata.gltf[_e]={lastSelected:null,original:[],variants:{}};for(var u=0,c=a.original;u<c.length;u++){var d=c[u];i._internalMetadata.gltf[_e].original.push({mesh:d.mesh,material:d.material})}for(var s in a.variants)if(Object.prototype.hasOwnProperty.call(a.variants,s)){i._internalMetadata.gltf[_e].variants[s]=[];for(var f=0,p=a.variants[s];f<p.length;f++){var h=p[f];i._internalMetadata.gltf[_e].variants[s].push({mesh:h.mesh,material:h.material})}}a=i._internalMetadata.gltf[_e]}for(var m=0,_=a.original;m<_.length;m++)(g=_[m]).mesh===n&&(g.mesh=o);for(var y=0,v=a.variants[l.name];y<v.length;y++){var g;(g=v[y]).mesh===n&&(g.mesh=o)}}))},i=0;i<a.variants.length;++i)o(i)})))},_=0;_<u.mappings.length;++_)m(_)}}))),Promise.all(c).then((function(e){return e[0]}))}))},e}();k(_e),P(_e,!0,(function(e){return new ye(e)}));var ve=function(){function e(t,n){var o=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,p.Cl)((0,p.Cl)({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this.onErrorObservable=new h.Observable,this._scene.onDisposeObservable.addOnce((function(){o.dispose()})),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:h.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},e.prototype.updateOptions=function(e){var t=this,n=Object.keys(e).filter((function(n){return t._options[n]!==e[n]}));if(n.length){var o=(0,p.Cl)((0,p.Cl)({},this._options),e),r=this._options;this._options=o,o.renderSize===r.renderSize&&o.renderTargetTextureType===r.renderTargetTextureType&&o.generateMipmaps===r.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=o.samples,this._opaqueRenderTarget.lodGenerationScale=o.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=o.lodGenerationOffset):this._setupRenderTargets()}},e.prototype.getOpaqueTarget=function(){return this._opaqueRenderTarget},e.prototype._shouldRenderAsTransmission=function(e){return!!e&&!!(e instanceof h.PBRMaterial&&e.subSurface.isRefractionEnabled)},e.prototype._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),h.Tools.SetImmediate((function(){t._shouldRenderAsTransmission(e.material)?(e.material.refractionTexture=t._opaqueRenderTarget,-1===t._transparentMeshesCache.indexOf(e)&&t._transparentMeshesCache.push(e)):-1===t._opaqueMeshesCache.indexOf(e)&&t._opaqueMeshesCache.push(e)}))},e.prototype._removeMesh=function(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];var t=this._transparentMeshesCache.indexOf(e);-1!==t&&this._transparentMeshesCache.splice(t,1),-1!==(t=this._opaqueMeshesCache.indexOf(e))&&this._opaqueMeshesCache.splice(t,1)},e.prototype._parseScene=function(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))},e.prototype._onMeshMaterialChanged=function(e){var t=this._transparentMeshesCache.indexOf(e),n=this._opaqueMeshesCache.indexOf(e);this._shouldRenderAsTransmission(e.material)?(e.material instanceof h.PBRMaterial&&(e.material.subSurface.refractionTexture=this._opaqueRenderTarget),-1!==n?(this._opaqueMeshesCache.splice(n,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)):-1!==t?(this._transparentMeshesCache.splice(t,1),this._opaqueMeshesCache.push(e)):-1===n&&this._opaqueMeshesCache.push(e)},e.prototype._isRenderTargetValid=function(){var e;return null!==(null===(e=this._opaqueRenderTarget)||void 0===e?void 0:e.getInternalTexture())},e.prototype._setupRenderTargets=function(){var e,t,n,o,r=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new h.RenderTargetTexture("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=null!==(t=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==t?t:this._scene.clearColor.clone(),this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.renderSprites=!0,this._opaqueRenderTarget.renderParticles=!0,this._opaqueRenderTarget.onBeforeBindObservable.add((function(e){o=r._scene.environmentIntensity,r._scene.environmentIntensity=1,n=r._scene.imageProcessingConfiguration.applyByPostProcess,r._options.clearColor?e.clearColor.copyFrom(r._options.clearColor):r._scene.clearColor.toLinearSpaceToRef(e.clearColor,r._scene.getEngine().useExactSrgbConversions),r._scene.imageProcessingConfiguration._applyByPostProcess=!0})),this._opaqueRenderTarget.onAfterUnbindObservable.add((function(){r._scene.environmentIntensity=o,r._scene.imageProcessingConfiguration._applyByPostProcess=n})),this._transparentMeshesCache.forEach((function(e){r._shouldRenderAsTransmission(e.material)&&(e.material.refractionTexture=r._opaqueRenderTarget)}))},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},e}(),ge="KHR_materials_transmission",be=function(){function e(e){this.name=ge,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(ge),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadTransparentPropertiesAsync(r,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadTransparentPropertiesAsync=function(e,t,n,o){var r,a;if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var i=n;if(i.subSurface.isRefractionEnabled=!0,i.subSurface.volumeIndexOfRefraction=1,i.subSurface.useAlbedoToTintRefraction=!0,void 0===o.transmissionFactor)return i.subSurface.refractionIntensity=0,i.subSurface.isRefractionEnabled=!1,Promise.resolve();i.subSurface.refractionIntensity=o.transmissionFactor;var s=i.getScene();return i.subSurface.refractionIntensity&&!s._transmissionHelper?new ve({},i.getScene()):i.subSurface.refractionIntensity&&!(null===(r=s._transmissionHelper)||void 0===r?void 0:r._isRenderTargetValid())&&(null===(a=s._transmissionHelper)||void 0===a||a._setupRenderTargets()),i.subSurface.minimumThickness=0,i.subSurface.maximumThickness=0,o.transmissionTexture?(o.transmissionTexture.nonColorData=!0,this._loader.loadTextureInfoAsync("".concat(e,"/transmissionTexture"),o.transmissionTexture,void 0).then((function(e){e.name="".concat(n.name," (Transmission)"),i.subSurface.refractionIntensityTexture=e,i.subSurface.useGltfStyleTextures=!0}))):Promise.resolve()},e}();k(ge),P(ge,!0,(function(e){return new be(e)}));var xe="KHR_materials_diffuse_transmission",Te=function(){function e(e){this.name=xe,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(xe),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadTranslucentPropertiesAsync(r,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadTranslucentPropertiesAsync=function(e,t,n,o){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=n;if(r.subSurface.isTranslucencyEnabled=!0,r.subSurface.volumeIndexOfRefraction=1,r.subSurface.minimumThickness=0,r.subSurface.maximumThickness=0,r.subSurface.useAlbedoToTintTranslucency=!1,void 0===o.diffuseTransmissionFactor)return r.subSurface.translucencyIntensity=0,r.subSurface.isTranslucencyEnabled=!1,Promise.resolve();r.subSurface.translucencyIntensity=o.diffuseTransmissionFactor;var a=new Array;return r.subSurface.useGltfStyleTextures=!0,o.diffuseTransmissionTexture&&(o.diffuseTransmissionTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),o.diffuseTransmissionTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission)"),r.subSurface.translucencyIntensityTexture=e})))),void 0!==o.diffuseTransmissionColorFactor?r.subSurface.translucencyColor=h.Color3.FromArray(o.diffuseTransmissionColorFactor):r.subSurface.translucencyColor=h.Color3.White(),o.diffuseTransmissionColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),o.diffuseTransmissionColorTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission Color)"),r.subSurface.translucencyColorTexture=e}))),Promise.all(a).then((function(){}))},e}();k(xe),P(xe,!0,(function(e){return new Te(e)}));var Ae="KHR_materials_volume",we=function(){function e(e){this.name=Ae,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ae),this.enabled&&this._loader._disableInstancedMesh++}return e.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadVolumePropertiesAsync(r,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadVolumePropertiesAsync=function(e,t,n,o){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));if(!n.subSurface.isRefractionEnabled&&!n.subSurface.isTranslucencyEnabled||!o.thicknessFactor)return Promise.resolve();n.subSurface.volumeIndexOfRefraction=n.indexOfRefraction;var r=void 0!==o.attenuationDistance?o.attenuationDistance:Number.MAX_VALUE;return n.subSurface.tintColorAtDistance=r,void 0!==o.attenuationColor&&3==o.attenuationColor.length&&n.subSurface.tintColor.copyFromFloats(o.attenuationColor[0],o.attenuationColor[1],o.attenuationColor[2]),n.subSurface.minimumThickness=0,n.subSurface.maximumThickness=o.thicknessFactor,n.subSurface.useThicknessAsDepth=!0,o.thicknessTexture?(o.thicknessTexture.nonColorData=!0,this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),o.thicknessTexture).then((function(e){e.name="".concat(n.name," (Thickness)"),n.subSurface.thicknessTexture=e,n.subSurface.useGltfStyleTextures=!0}))):Promise.resolve()},e}();k(Ae),P(Ae,!0,(function(e){return new we(e)}));var Oe="KHR_materials_dispersion",Me=function(){function e(e){this.name=Oe,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Oe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=new Array;return i.push(o._loader.loadMaterialPropertiesAsync(e,t,n)),i.push(o._loadDispersionPropertiesAsync(r,t,n,a)),Promise.all(i).then((function(){}))}))},e.prototype._loadDispersionPropertiesAsync=function(e,t,n,o){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));return n.subSurface.isRefractionEnabled&&o.dispersion?(n.subSurface.isDispersionEnabled=!0,n.subSurface.dispersion=o.dispersion,Promise.resolve()):Promise.resolve()},e}();k(Oe),P(Oe,!0,(function(e){return new Me(e)}));var Ce="KHR_mesh_quantization",Re=function(){function e(e){this.name=Ce,this.enabled=e.isExtensionUsed(Ce)}return e.prototype.dispose=function(){},e}();k(Ce),P(Ce,!0,(function(e){return new Re(e)}));var Ee="KHR_texture_basisu",Le=function(){function e(e){this.name=Ee,this._loader=e,this.enabled=e.isExtensionUsed(Ee)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){var i=null==t.sampler?I.DefaultSampler:F.Get("".concat(e,"/sampler"),o._loader.gltf.samplers,t.sampler),s=F.Get("".concat(r,"/source"),o._loader.gltf.images,a.source);return o._loader._createTextureAsync(e,i,s,(function(e){n(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)}))},e}();k(Ee),P(Ee,!0,(function(e){return new Le(e)}));var Pe="KHR_texture_transform",ke=function(){function e(e){this.name=Pe,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(r,a){return o._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof h.Texture))throw new Error("".concat(r,": Texture type not supported"));a.offset&&(e.uOffset=a.offset[0],e.vOffset=a.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,a.rotation&&(e.wAng=-a.rotation),a.scale&&(e.uScale=a.scale[0],e.vScale=a.scale[1]),null!=a.texCoord&&(e.coordinatesIndex=a.texCoord),n(e)}))}))},e}();k(Pe),P(Pe,!0,(function(e){return new ke(e)}));var Fe="KHR_xmp_json_ld",Be=function(){function e(e){this.name=Fe,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Fe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.onLoading=function(){var e,t,n;if(null!==this._loader.rootBabylonMesh){var o=null===(e=this._loader.gltf.extensions)||void 0===e?void 0:e.KHR_xmp_json_ld,r=null===(n=null===(t=this._loader.gltf.asset)||void 0===t?void 0:t.extensions)||void 0===n?void 0:n.KHR_xmp_json_ld;if(o&&r){var a=+r.packet;o.packets&&a<o.packets.length&&(this._loader.rootBabylonMesh.metadata=this._loader.rootBabylonMesh.metadata||{},this._loader.rootBabylonMesh.metadata.xmp=o.packets[a])}}},e}();k(Fe),P(Fe,!0,(function(e){return new Be(e)}));var Ie=a(727);function Se(e,t,n,o){return h.Color3.FromArray(t,n).scale(o)}function Ne(e,t,n,o){return t[n]*o}function Ge(e,t,n,o){return-t[n]*o}function Ve(e,t,n,o){return t[n+1]*o}function De(e,t,n,o){return t[n]*o*2}function He(e){return{scale:[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Ne,(function(){return 2})),new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),Ve,(function(){return 2}))],offset:[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Ne,(function(){return 2})),new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),Ve,(function(){return 2}))],rotation:[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),Ge,(function(){return 1}))]}}var Ke=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,p.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,o){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,o)}]},t}(Ie.AnimationPropertyInfo),Ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,p.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,o){var r=[];for(var a in e._data)r.push({babylonAnimatable:e._data[a].babylonMaterial,babylonAnimation:this._buildAnimation(t,n,o)});return r},t}(Ie.AnimationPropertyInfo),je=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,p.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,o){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,o)}]},t}(Ie.AnimationPropertyInfo);(0,R.ZU)("/cameras/{}/orthographic/xmag",[new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",Ge,(function(){return 1})),new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",Ve,(function(){return 1}))]),(0,R.ZU)("/cameras/{}/orthographic/ymag",[new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",Ge,(function(){return 1})),new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",Ve,(function(){return 1}))]),(0,R.ZU)("/cameras/{}/orthographic/zfar",[new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Ne,(function(){return 1}))]),(0,R.ZU)("/cameras/{}/orthographic/znear",[new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"minZ",Ne,(function(){return 1}))]),(0,R.ZU)("/cameras/{}/perspective/yfov",[new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"fov",Ne,(function(){return 1}))]),(0,R.ZU)("/cameras/{}/perspective/zfar",[new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Ne,(function(){return 1}))]),(0,R.ZU)("/cameras/{}/perspective/znear",[new Ke(h.Animation.ANIMATIONTYPE_FLOAT,"minZ",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new Ue(h.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",Se,(function(){return 4})),new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,o){return t[n+3]*o}),(function(){return 4}))]),(0,R.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"metallic",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"roughness",Ne,(function(){return 1}))]);var Ze=He("albedoTexture");(0,R.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",Ze.scale),(0,R.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",Ze.offset),(0,R.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",Ze.rotation);var qe=He("metallicTexture");(0,R.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",qe.scale),(0,R.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",qe.offset),(0,R.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",qe.rotation),(0,R.ZU)("/materials/{}/emissiveFactor",[new Ue(h.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",Se,(function(){return 3}))]);var Ye=He("bumpTexture");(0,R.ZU)("/materials/{}/normalTexture/scale",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",Ye.scale),(0,R.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",Ye.offset),(0,R.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",Ye.rotation),(0,R.ZU)("/materials/{}/occlusionTexture/strength",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Ne,(function(){return 1}))]);var We=He("ambientTexture");(0,R.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",We.scale),(0,R.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",We.offset),(0,R.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",We.rotation);var Xe=He("emissiveTexture");(0,R.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",Xe.scale),(0,R.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",Xe.offset),(0,R.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",Xe.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Ne,(function(){return 1}))]);var ze=He("anisotropy.texture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",ze.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",ze.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",ze.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Ne,(function(){return 1}))]);var Qe=He("clearCoat.texture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",Qe.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",Qe.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",Qe.rotation);var Je=He("clearCoat.bumpTexture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",Je.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",Je.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",Je.rotation);var $e=He("clearCoat.textureRoughness");(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",$e.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",$e.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",$e.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_ior/ior",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Ne,(function(){return 1}))]);var et=He("iridescence.texture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",et.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",et.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",et.rotation);var tt=He("iridescence.thicknessTexture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",tt.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",tt.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",tt.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new Ue(h.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",Se,(function(){return 3}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Ne,(function(){return 1}))]);var nt=He("sheen.texture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",nt.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",nt.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",nt.rotation);var ot=He("sheen.textureRoughness");(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",ot.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",ot.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",ot.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new Ue(h.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Se,(function(){return 3}))]);var rt=He("metallicReflectanceTexture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",rt.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",rt.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",rt.rotation);var at=He("reflectanceTexture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",at.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",at.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",at.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Ne,(function(){return 1}))]);var it=He("subSurface.refractionIntensityTexture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",it.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",it.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",it.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new Ue(h.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Se,(function(){return 3}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Ne,(function(){return 1}))]),(0,R.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Ne,(function(){return 1}))]);var st=He("subSurface.thicknessTexture");(0,R.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",st.scale),(0,R.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",st.offset),(0,R.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",st.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new Ue(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Ne,(function(){return 1}))]);var lt=He("subSurface.translucencyIntensityTexture");(0,R.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",lt.scale),(0,R.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",lt.offset),(0,R.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",lt.rotation),(0,R.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new Ue(h.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",Se,(function(){return 3}))]);var ut=He("subSurface.translucencyColorTexture");(0,R.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",ut.scale),(0,R.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",ut.offset),(0,R.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",ut.rotation),(0,R.ZU)("/extensions/KHR_lights_punctual/lights/{}/color",[new je(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Se,(function(){return 3}))]),(0,R.ZU)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new je(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ne,(function(){return 1}))]),(0,R.ZU)("/extensions/KHR_lights_punctual/lights/{}/range",[new je(h.Animation.ANIMATIONTYPE_FLOAT,"range",Ne,(function(){return 1}))]),(0,R.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new je(h.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",De,(function(){return 1}))]),(0,R.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new je(h.Animation.ANIMATIONTYPE_FLOAT,"angle",De,(function(){return 1}))]),(0,R.ZU)("/nodes/{}/extensions/EXT_lights_ies/color",[new je(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Se,(function(){return 3}))]),(0,R.ZU)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new je(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ne,(function(){return 1}))]);var ct="KHR_animation_pointer",dt=function(){function e(e){this.name=ct,this._loader=e,this._pathToObjectConverter=(0,R.Wt)(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(ct)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,t,n,o,r){var a,i=null===(a=o.target.extensions)||void 0===a?void 0:a.KHR_animation_pointer;if(!i||!this._pathToObjectConverter)return null;"pointer"!==o.target.path&&h.Logger.Warn("".concat(e,"/target/path: Value (").concat(o.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=o.target.node&&h.Logger.Warn("".concat(e,"/target/node: Value (").concat(o.target.node,") must not be present when using the ").concat(this.name," extension"));var s="".concat(e,"/extensions/").concat(this.name),l=i.pointer;if(!l)throw new Error("".concat(s,": Pointer is missing"));try{var u=this._pathToObjectConverter.convert(l);if(!u.info.interpolation)throw new Error("".concat(s,"/pointer: Interpolation is missing"));return this._loader._loadAnimationChannelFromTargetInfoAsync(e,t,n,o,{object:u.object,info:u.info.interpolation},r)}catch(e){return h.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();k(ct),P(ct,!0,(function(e){return new dt(e)}));var ft="MSFT_audio_emitter",pt=function(){function e(e){this.name=ft,this._loader=e,this.enabled=this._loader.isExtensionUsed(ft)}return e.prototype.dispose=function(){this._loader=null,this._clips=null,this._emitters=null},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._clips=t.clips,this._emitters=t.emitters,F.Assign(this._clips),F.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return I.LoadExtensionAsync(e,t,this.name,(function(o,r){var a=new Array;a.push(n._loader.loadSceneAsync(e,t));for(var i=0,s=r.emitters;i<s.length;i++){var l=s[i],u=F.Get("".concat(o,"/emitters"),n._emitters,l);if(null!=u.refDistance||null!=u.maxDistance||null!=u.rolloffFactor||null!=u.distanceModel||null!=u.innerAngle||null!=u.outerAngle)throw new Error("".concat(o,": Direction or Distance properties are not allowed on emitters attached to a scene"));a.push(n._loadEmitterAsync("".concat(o,"/emitters/").concat(u.index),u))}return Promise.all(a).then((function(){}))}))},e.prototype.loadNodeAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(e,r){var a=new Array;return o._loader.loadNodeAsync(e,t,(function(t){for(var i=function(n){var r=F.Get("".concat(e,"/emitters"),o._emitters,n);a.push(o._loadEmitterAsync("".concat(e,"/emitters/").concat(r.index),r).then((function(){for(var e=0,n=r._babylonSounds;e<n.length;e++){var o=n[e];o.attachToMesh(t),null==r.innerAngle&&null==r.outerAngle||(o.setLocalDirectionToMesh(h.Vector3.Forward()),o.setDirectionalCone(2*h.Tools.ToDegrees(null==r.innerAngle?Math.PI:r.innerAngle),2*h.Tools.ToDegrees(null==r.outerAngle?Math.PI:r.outerAngle),0))}})))},s=0,l=r.emitters;s<l.length;s++)i(l[s]);n(t)})).then((function(e){return Promise.all(a).then((function(){return e}))}))}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return I.LoadExtensionAsync(e,t,this.name,(function(o,r){return n._loader.loadAnimationAsync(e,t).then((function(a){var i=new Array;F.Assign(r.events);for(var s=0,l=r.events;s<l.length;s++){var u=l[s];i.push(n._loadAnimationEventAsync("".concat(o,"/events/").concat(u.index),e,t,u,a))}return Promise.all(i).then((function(){return a}))}))}))},e.prototype._loadClipAsync=function(e,t){if(t._objectURL)return t._objectURL;var n;if(t.uri)n=this._loader.loadUriAsync(e,t,t.uri);else{var o=F.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,t.bufferView);n=this._loader.loadBufferViewAsync("/bufferViews/".concat(o.index),o)}return t._objectURL=n.then((function(e){return URL.createObjectURL(new Blob([e],{type:t.mimeType}))})),t._objectURL},e.prototype._loadEmitterAsync=function(e,t){var n=this;if(t._babylonSounds=t._babylonSounds||[],!t._babylonData){for(var o=new Array,r=t.name||"emitter".concat(t.index),a={loop:!1,autoplay:!1,volume:null==t.volume?1:t.volume},i=function(e){var i="/extensions/".concat(s.name,"/clips"),l=F.Get(i,s._clips,t.clips[e].clip);o.push(s._loadClipAsync("".concat(i,"/").concat(t.clips[e].clip),l).then((function(o){var i=t._babylonSounds[e]=new h.Sound(r,o,n._loader.babylonScene,null,a);i.refDistance=t.refDistance||1,i.maxDistance=t.maxDistance||256,i.rolloffFactor=t.rolloffFactor||1,i.distanceModel=t.distanceModel||"exponential"})))},s=this,l=0;l<t.clips.length;l++)i(l);var u=Promise.all(o).then((function(){var e=t.clips.map((function(e){return e.weight||1})),n=new h.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*h.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*h.Tools.ToDegrees(t.outerAngle)),t.volume&&(n.volume=t.volume),t._babylonData.sound=n}));t._babylonData={loaded:u}}return t._babylonData.loaded},e.prototype._getEventAction=function(e,t,n,o,r){switch(n){case"play":return function(e){var n=(r||0)+(e-o);t.play(n)};case"stop":return function(){t.stop()};case"pause":return function(){t.pause()};default:throw new Error("".concat(e,": Unsupported action ").concat(n))}},e.prototype._loadAnimationEventAsync=function(e,t,n,o,r){var a=this;if(0==r.targetedAnimations.length)return Promise.resolve();var i=r.targetedAnimations[0],s=o.emitter,l=F.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,s);return this._loadEmitterAsync(e,l).then((function(){var t=l._babylonData.sound;if(t){var n=new h.AnimationEvent(o.time,a._getEventAction(e,t,o.action,o.time,o.startOffset));i.animation.addEvent(n),r.onAnimationGroupEndObservable.add((function(){t.stop()})),r.onAnimationGroupPauseObservable.add((function(){t.pause()}))}}))},e}();k(ft),P(ft,!0,(function(e){return new pt(e)}));var ht="MSFT_lod",mt=function(){function e(e){var t,n;this.name=ht,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new h.Observable,this.onMaterialLODsLoadedObservable=new h.Observable,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.maxLODsToLoad=null!==(n=null===(t=this._loader.parent.extensionOptions[ht])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(ht)}return e.prototype.dispose=function(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()},e.prototype.onReady=function(){for(var e=this,t=function(t){var o=Promise.all(n._nodePromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Node LOD ".concat(t)),e._loader.log("Loaded node LOD ".concat(t))),e.onNodeLODsLoadedObservable.notifyObservers(t),t!==e._nodePromiseLODs.length-1&&(e._loader.startPerformanceCounter("Node LOD ".concat(t+1)),e._loadBufferLOD(e._nodeBufferLODs,t+1),e._nodeSignalLODs[t]&&e._nodeSignalLODs[t].resolve())}));n._loader._completePromises.push(o)},n=this,o=0;o<this._nodePromiseLODs.length;o++)t(o);var r=function(t){var n=Promise.all(a._materialPromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Material LOD ".concat(t)),e._loader.log("Loaded material LOD ".concat(t))),e.onMaterialLODsLoadedObservable.notifyObservers(t),t!==e._materialPromiseLODs.length-1&&(e._loader.startPerformanceCounter("Material LOD ".concat(t+1)),e._loadBufferLOD(e._materialBufferLODs,t+1),e._materialSignalLODs[t]&&e._materialSignalLODs[t].resolve())}));a._loader._completePromises.push(n)},a=this;for(o=0;o<this._materialPromiseLODs.length;o++)r(o)},e.prototype.loadSceneAsync=function(e,t){var n=this._loader.loadSceneAsync(e,t);return this._loadBufferLOD(this._bufferLODs,0),n},e.prototype.loadNodeAsync=function(e,t,n){var o=this;return I.LoadExtensionAsync(e,t,this.name,(function(e,r){var a,i=o._getLODs(e,t,o._loader.gltf.nodes,r.ids);o._loader.logOpen("".concat(e));for(var s=function(e){var t=i[e];0!==e&&(o._nodeIndexLOD=e,o._nodeSignalLODs[e]=o._nodeSignalLODs[e]||new h.Deferred);var r=o._loader.loadNodeAsync("/nodes/".concat(t.index),t,(function(e){n(e),e.setEnabled(!1)})).then((function(t){if(0!==e){var n=i[e-1];n._babylonTransformNode&&(o._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t}));o._nodePromiseLODs[e]=o._nodePromiseLODs[e]||[],0===e?a=r:(o._nodeIndexLOD=null,o._nodePromiseLODs[e].push(r))},l=0;l<i.length;l++)s(l);return o._loader.logClose(),a}))},e.prototype._loadMaterialAsync=function(e,t,n,o,r){var a=this;return this._nodeIndexLOD?null:I.LoadExtensionAsync(e,t,this.name,(function(e,i){var s,l=a._getLODs(e,t,a._loader.gltf.materials,i.ids);a._loader.logOpen("".concat(e));for(var u=function(e){var t=l[e];0!==e&&(a._materialIndexLOD=e);var i=a._loader._loadMaterialAsync("/materials/".concat(t.index),t,n,o,(function(t){0===e&&r(t)})).then((function(t){if(0!==e){r(t);var n=l[e-1]._data;n[o]&&(a._disposeMaterials([n[o].babylonMaterial]),delete n[o])}return t}));a._materialPromiseLODs[e]=a._materialPromiseLODs[e]||[],0===e?s=i:(a._materialIndexLOD=null,a._materialPromiseLODs[e].push(i))},c=0;c<l.length;c++)u(c);return a._loader.logClose(),s}))},e.prototype._loadUriAsync=function(e,t,n){var o=this;if(null!==this._nodeIndexLOD){this._loader.log("deferred");var r=this._nodeIndexLOD-1;return this._nodeSignalLODs[r]=this._nodeSignalLODs[r]||new h.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return o._loader.loadUriAsync(e,t,n)}))}return null!==this._materialIndexLOD?(this._loader.log("deferred"),r=this._materialIndexLOD-1,this._materialSignalLODs[r]=this._materialSignalLODs[r]||new h.Deferred,this._materialSignalLODs[r].promise.then((function(){return o._loader.loadUriAsync(e,t,n)}))):null},e.prototype.loadBufferAsync=function(e,t,n,o){if(this._loader.parent.useRangeRequests&&!t.uri){if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));var r=function(e,t){var r=n,a=r+o-1,i=e[t];return i?(i.start=Math.min(i.start,r),i.end=Math.max(i.end,a)):(i={start:r,end:a,loaded:new h.Deferred},e[t]=i),i.loaded.promise.then((function(e){return new Uint8Array(e.buffer,e.byteOffset+n-i.start,o)}))};return this._loader.log("deferred"),null!==this._nodeIndexLOD?r(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?r(this._materialBufferLODs,this._materialIndexLOD):r(this._bufferLODs,0)}return null},e.prototype._loadBufferLOD=function(e,t){var n=e[t];n&&(this._loader.log("Loading buffer range [".concat(n.start,"-").concat(n.end,"]")),this._loader.bin.readAsync(n.start,n.end-n.start+1).then((function(e){n.loaded.resolve(e)}),(function(e){n.loaded.reject(e)})))},e.prototype._getLODs=function(e,t,n,o){if(this.maxLODsToLoad<=0)throw new Error("maxLODsToLoad must be greater than zero");for(var r=[],a=o.length-1;a>=0;a--)if(r.push(F.Get("".concat(e,"/ids/").concat(o[a]),n,o[a])),r.length===this.maxLODsToLoad)return r;return r.push(t),r},e.prototype._disposeTransformNode=function(e){var t=this,n=[],o=e.material;o&&n.push(o);for(var r=0,a=e.getChildMeshes();r<a.length;r++){var i=a[r];i.material&&n.push(i.material)}e.dispose();var s=n.filter((function(e){return t._loader.babylonScene.meshes.every((function(t){return t.material!=e}))}));this._disposeMaterials(s)},e.prototype._disposeMaterials=function(e){for(var t={},n=0,o=e;n<o.length;n++){for(var r=0,a=(c=o[n]).getActiveTextures();r<a.length;r++){var i=a[r];t[i.uniqueId]=i}c.dispose()}for(var s in t)for(var l=0,u=this._loader.babylonScene.materials;l<u.length;l++){var c;(c=u[l]).hasTexture(t[s])&&delete t[s]}for(var s in t)t[s].dispose()},e}();k(ht),P(ht,!0,(function(e){return new mt(e)}));var _t="MSFT_minecraftMesh",yt=function(){function e(e){this.name=_t,this._loader=e,this.enabled=this._loader.isExtensionUsed(_t)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtraAsync(e,t,this.name,(function(r,a){if(a){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(r,": Material type not supported"));var i=o._loader.loadMaterialPropertiesAsync(e,t,n);return n.needAlphaBlending()&&(n.forceDepthWrite=!0,n.separateCullingPass=!0),n.backFaceCulling=n.forceDepthWrite,n.twoSidedLighting=!0,i}return null}))},e}();k(_t),P(_t,!0,(function(e){return new yt(e)}));var vt="MSFT_sRGBFactors",gt=function(){function e(e){this.name=vt,this._loader=e,this.enabled=this._loader.isExtensionUsed(vt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var o=this;return I.LoadExtraAsync(e,t,this.name,(function(r,a){if(a){if(!(n instanceof h.PBRMaterial))throw new Error("".concat(r,": Material type not supported"));var i=o._loader.loadMaterialPropertiesAsync(e,t,n),s=n.getScene().getEngine().useExactSrgbConversions;return n.albedoTexture||n.albedoColor.toLinearSpaceToRef(n.albedoColor,s),n.reflectivityTexture||n.reflectivityColor.toLinearSpaceToRef(n.reflectivityColor,s),i}return null}))},e}();function bt(e){var t=e.split(":");return xt({op:t[0],extension:t[1]})}function xt(e,t){var n;void 0===t&&(t=!0);var o=e.extension?null===(n=At[e.extension])||void 0===n?void 0:n[e.op]:wt[e.op];if(!o&&(h.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),t)){var r={},a={flows:{}};if(e.inputValueSockets)for(var i in r.values={},e.inputValueSockets)r.values[i]={name:i};return e.outputValueSockets&&(a.values={},Object.keys(e.outputValueSockets).forEach((function(e){a.values[e]={name:e}}))),{blocks:[],inputs:r,outputs:a}}return o}function Tt(e,t,n){At[t]||(At[t]={}),At[t][e]=n}k(vt),P(vt,!0,(function(e){return new gt(e)}));var At={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},wt={"event/onStart":{blocks:["FlowGraphSceneReadyEventBlock"],outputs:{flows:{out:{name:"done"}}}},"event/onTick":{blocks:["FlowGraphSceneTickEventBlock"],inputs:{},outputs:{values:{timeSinceLastTick:{name:"deltaTime",gltfType:"number"}},flows:{out:{name:"done"}}}},"event/send":{blocks:["FlowGraphSendCustomEventBlock"],outputs:{flows:{out:{name:"done"}}},extraProcessor:function(e,t,n,o,r){if("event/send"!==t.op||!e.configuration||1!==Object.keys(e.configuration).length)throw new Error("Receive event should have a single configuration object, the event itself");var a=e.configuration.event.value[0];if("number"!=typeof a)throw new Error("Event id should be a number");var i=o.arrays.events[a],s=r[0];return s.config||(s.config={}),s.config.eventId=i.eventId,s.config.eventData=i.eventData,r}},"event/receive":{blocks:["FlowGraphReceiveCustomEventBlock"],outputs:{flows:{out:{name:"done"}}},validation:function(e,t){var n;if(!e.configuration)return h.Logger.Error("Receive event should have a configuration object"),!1;var o=e.configuration.event;if(!o)return h.Logger.Error("Receive event should have a single configuration object, the event itself"),!1;var r=o.value[0];return"number"!=typeof r?(h.Logger.Error("Event id should be a number"),!1):!!(null===(n=t.events)||void 0===n?void 0:n[r])||(h.Logger.Error("Event with id ".concat(r," not found")),!1)},extraProcessor:function(e,t,n,o,r){if("event/receive"!==t.op||!e.configuration||1!==Object.keys(e.configuration).length)throw new Error("Receive event should have a single configuration object, the event itself");var a=e.configuration.event.value[0];if("number"!=typeof a)throw new Error("Event id should be a number");var i=o.arrays.events[a],s=r[0];return s.config||(s.config={}),s.config.eventId=i.eventId,s.config.eventData=i.eventData,r}},"math/e":Ot("FlowGraphEBlock"),"math/pi":Ot("FlowGraphPIBlock"),"math/inf":Ot("FlowGraphInfBlock"),"math/nan":Ot("FlowGraphNaNBlock"),"math/abs":Ot("FlowGraphAbsBlock"),"math/sign":Ot("FlowGraphSignBlock"),"math/trunc":Ot("FlowGraphTruncBlock"),"math/floor":Ot("FlowGraphFloorBlock"),"math/ceil":Ot("FlowGraphCeilBlock"),"math/round":{blocks:["FlowGraphRoundBlock"],configuration:{},inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r){return r[0].config=r[0].config||{},r[0].config.roundHalfAwayFromZero=!0,r}},"math/fract":Ot("FlowGraphFractBlock"),"math/neg":Ot("FlowGraphNegationBlock"),"math/add":Ot("FlowGraphAddBlock",["a","b"],!0),"math/sub":Ot("FlowGraphSubtractBlock",["a","b"],!0),"math/mul":{blocks:["FlowGraphMultiplyBlock"],extraProcessor:function(e,t,n,o,r){r[0].config=r[0].config||{},r[0].config.useMatrixPerComponent=!0;var a=-1;return Object.keys(e.values||{}).find((function(t){var n;return void 0!==(null===(n=e.values)||void 0===n?void 0:n[t].type)&&(a=e.values[t].type,!0)})),-1!==a&&(r[0].config.type=o.arrays.types[a].flowGraphType),r}},"math/div":Ot("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Ot("FlowGraphModuloBlock",["a","b"]),"math/min":Ot("FlowGraphMinBlock",["a","b"]),"math/max":Ot("FlowGraphMaxBlock",["a","b"]),"math/clamp":Ot("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Ot("FlowGraphSaturateBlock"),"math/mix":Ot("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Ot("FlowGraphEqualityBlock",["a","b"]),"math/lt":Ot("FlowGraphLessThanBlock",["a","b"]),"math/le":Ot("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Ot("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Ot("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isnan":Ot("FlowGraphIsNaNBlock"),"math/isinf":Ot("FlowGraphIsInfBlock"),"math/select":{blocks:["FlowGraphConditionalBlock"],inputs:{values:{condition:{name:"condition"},a:{name:"onTrue"},b:{name:"onFalse"}}},outputs:{values:{value:{name:"output"}}}},"math/random":{blocks:["FlowGraphRandomBlock"],outputs:{values:{value:{name:"value"}}}},"math/sin":Ot("FlowGraphSinBlock"),"math/cos":Ot("FlowGraphCosBlock"),"math/tan":Ot("FlowGraphTanBlock"),"math/asin":Ot("FlowGraphASinBlock"),"math/acos":Ot("FlowGraphACosBlock"),"math/atan":Ot("FlowGraphATanBlock"),"math/atan2":Ot("FlowGraphATan2Block",["a","b"]),"math/sinh":Ot("FlowGraphSinhBlock"),"math/cosh":Ot("FlowGraphCoshBlock"),"math/tanh":Ot("FlowGraphTanhBlock"),"math/asinh":Ot("FlowGraphASinhBlock"),"math/acosh":Ot("FlowGraphACoshBlock"),"math/atanh":Ot("FlowGraphATanhBlock"),"math/exp":Ot("FlowGraphExponentialBlock"),"math/log":Ot("FlowGraphLogBlock"),"math/log2":Ot("FlowGraphLog2Block"),"math/log10":Ot("FlowGraphLog10Block"),"math/sqrt":Ot("FlowGraphSquareRootBlock"),"math/cbrt":Ot("FlowGraphCubeRootBlock"),"math/pow":Ot("FlowGraphPowerBlock",["a","b"]),"math/length":Ot("FlowGraphLengthBlock"),"math/normalize":Ot("FlowGraphNormalizeBlock"),"math/dot":Ot("FlowGraphDotBlock",["a","b"]),"math/cross":Ot("FlowGraphCrossBlock",["a","b"]),"math/rotate2d":Ot("FlowGraphRotate2DBlock",["a","b"]),"math/rotate3d":Ot("FlowGraphRotate3DBlock",["a","b","c"]),"math/transform":{blocks:["FlowGraphTransformVectorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/combine2":{blocks:["FlowGraphCombineVector2Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine3":{blocks:["FlowGraphCombineVector3Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine4":{blocks:["FlowGraphCombineVector4Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/extract2":{blocks:["FlowGraphExtractVector2Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"}}}},"math/extract3":{blocks:["FlowGraphExtractVector3Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"}}}},"math/extract4":{blocks:["FlowGraphExtractVector4Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/transpose":Ot("FlowGraphTransposeBlock"),"math/determinant":Ot("FlowGraphDeterminantBlock"),"math/inverse":Ot("FlowGraphInvertMatrixBlock"),"math/matmul":Ot("FlowGraphMatrixMultiplicationBlock",["a","b"]),"math/combine2x2":{blocks:["FlowGraphCombineMatrix2DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r){return r[0].config=r[0].config||{},r[0].config.inputIsColumnMajor=!0,r}},"math/extract2x2":{blocks:["FlowGraphExtractMatrix2DBlock"],inputs:{values:{a:{name:"input",gltfType:"float2x2"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/combine3x3":{blocks:["FlowGraphCombineMatrix3DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r){return r[0].config=r[0].config||{},r[0].config.inputIsColumnMajor=!0,r}},"math/extract3x3":{blocks:["FlowGraphExtractMatrix3DBlock"],inputs:{values:{a:{name:"input",gltfType:"float3x3"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"}}}},"math/combine4x4":{blocks:["FlowGraphCombineMatrixBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"},j:{name:"input_9",gltfType:"number"},k:{name:"input_10",gltfType:"number"},l:{name:"input_11",gltfType:"number"},m:{name:"input_12",gltfType:"number"},n:{name:"input_13",gltfType:"number"},o:{name:"input_14",gltfType:"number"},p:{name:"input_15",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r){return r[0].config=r[0].config||{},r[0].config.inputIsColumnMajor=!0,r}},"math/extract4x4":{blocks:["FlowGraphExtractMatrixBlock"],configuration:{},inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"},9:{name:"output_9"},10:{name:"output_10"},11:{name:"output_11"},12:{name:"output_12"},13:{name:"output_13"},14:{name:"output_14"},15:{name:"output_15"}}}},"math/compose":{blocks:["FlowGraphMatrixCompose"],configuration:{},inputs:{values:{translation:{name:"position",gltfType:"float3"},rotation:{name:"rotationQuaternion",gltfType:"float4"},scale:{name:"scaling",gltfType:"float3"}}},outputs:{values:{value:{name:"output"}}}},"math/decompose":{blocks:["FlowGraphMatrixDecompose"],configuration:{},inputs:{values:{a:{name:"input"}}},outputs:{values:{translation:{name:"position"},rotation:{name:"rotationQuaternion"},scale:{name:"scaling"}}}},"math/not":{blocks:["FlowGraphBitwiseNotBlock"],inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r,a){var i,s;r[0].config=r[0].config||{};var l=r[0].dataInputs[0];return r[0].config.valueType=null!==(s=null===(i=a._connectionValues[l.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:"FlowGraphInteger",r}},"math/and":{blocks:["FlowGraphBitwiseAndBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r,a){var i,s,l,u;r[0].config=r[0].config||{};var c=r[0].dataInputs[0],d=r[0].dataInputs[1];return r[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[c.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:null===(l=a._connectionValues[d.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",r}},"math/or":{blocks:["FlowGraphBitwiseOrBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r,a){var i,s,l,u;r[0].config=r[0].config||{};var c=r[0].dataInputs[0],d=r[0].dataInputs[1];return r[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[c.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:null===(l=a._connectionValues[d.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",r}},"math/xor":{blocks:["FlowGraphBitwiseXorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,o,r,a){var i,s,l,u;r[0].config=r[0].config||{};var c=r[0].dataInputs[0],d=r[0].dataInputs[1];return r[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[c.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:null===(l=a._connectionValues[d.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",r}},"math/asr":Ot("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Ot("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Ot("FlowGraphLeadingZerosBlock"),"math/ctz":Ot("FlowGraphTrailingZerosBlock"),"math/popcnt":Ot("FlowGraphOneBitsCounterBlock"),"math/rad":Ot("FlowGraphDegToRadBlock"),"math/deg":Ot("FlowGraphRadToDegBlock"),"type/boolToInt":Ot("FlowGraphBooleanToInt"),"type/boolToFloat":Ot("FlowGraphBooleanToFloat"),"type/intToBool":Ot("FlowGraphIntToBoolean"),"type/intToFloat":Ot("FlowGraphIntToFloat"),"type/floatToInt":Ot("FlowGraphFloatToInt"),"type/floatToBool":Ot("FlowGraphFloatToBoolean"),"flow/sequence":{blocks:["FlowGraphSequenceBlock"],extraProcessor:function(e,t,n,o,r){var a=r[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows||[]).length,a.signalOutputs.forEach((function(e,t){e.name="out_"+t})),r}},"flow/branch":{blocks:["FlowGraphBranchBlock"],outputs:{flows:{true:{name:"onTrue"},false:{name:"onFalse"}}}},"flow/switch":{blocks:["FlowGraphSwitchBlock"],configuration:{cases:{name:"cases",inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"}}},validation:function(e){if(e.configuration&&e.configuration.cases){var t=e.configuration.cases.value;if(!t.every((function(e){return"number"==typeof e&&/^\d+$/.test(e.toString())})))return e.configuration.cases.value=[],!0;var n=new Set(t);e.configuration.cases.value=Array.from(n)}return!0},extraProcessor:function(e,t,n,o,r){if("flow/switch"!==t.op||!e.flows||0===Object.keys(e.flows).length)throw new Error("Switch should have a single configuration object, the cases array");return r[0].signalOutputs.forEach((function(e){"default"!==e.name&&(e.name="out_"+e.name)})),r}},"flow/while":{blocks:["FlowGraphWhileLoopBlock"],outputs:{flows:{loopBody:{name:"executionFlow"}}}},"flow/for":{blocks:["FlowGraphForLoopBlock"],configuration:{initialIndex:{name:"initialIndex",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{values:{startIndex:{name:"startIndex",gltfType:"number"},endIndex:{name:"endIndex",gltfType:"number"}}},outputs:{values:{index:{name:"index"}},flows:{loopBody:{name:"executionFlow"}}}},"flow/doN":{blocks:["FlowGraphDoNBlock"],configuration:{},inputs:{values:{n:{name:"maxExecutions",gltfType:"number"}}},outputs:{values:{currentCount:{name:"executionCount"}}}},"flow/multiGate":{blocks:["FlowGraphMultiGateBlock"],configuration:{isRandom:{name:"isRandom",gltfType:"boolean",inOptions:!0,defaultValue:!1},isLoop:{name:"isLoop",gltfType:"boolean",inOptions:!0,defaultValue:!1}},extraProcessor:function(e,t,n,o,r){if("flow/multiGate"!==t.op||!e.flows||0===Object.keys(e.flows).length)throw new Error("MultiGate should have a single configuration object, the number of output flows");var a=r[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows).length,a.signalOutputs.forEach((function(e,t){e.name="out_"+t})),r}},"flow/waitAll":{blocks:["FlowGraphWaitAllBlock"],configuration:{inputFlows:{name:"inputSignalCount",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{flows:{"[segment]":{name:"in_$1"}}},validation:function(e){var t,n;return"number"!=typeof(null===(n=null===(t=e.configuration)||void 0===t?void 0:t.inputFlows)||void 0===n?void 0:n.value[0])&&(e.configuration=e.configuration||{inputFlows:{value:[0]}},e.configuration.inputFlows.value=[0]),!0}},"flow/throttle":{blocks:["FlowGraphThrottleBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/setDelay":{blocks:["FlowGraphSetDelayBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/cancelDelay":{blocks:["FlowGraphCancelDelayBlock"]},"variable/get":{blocks:["FlowGraphGetVariableBlock"],validation:function(e){var t,n;return!!(null===(n=null===(t=e.configuration)||void 0===t?void 0:t.variable)||void 0===n?void 0:n.value)||(h.Logger.Error("Variable get block should have a variable configuration"),!1)},configuration:{variable:{name:"variable",gltfType:"number",flowGraphType:"string",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return[t.getVariableName(e[0])]}}}},"variable/set":{blocks:["FlowGraphSetVariableBlock"],configuration:{variable:{name:"variable",gltfType:"number",flowGraphType:"string",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return[t.getVariableName(e[0])]}}}},"variable/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphContextBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing","FlowGraphGetVariableBlock"],configuration:{variable:{name:"propertyName",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return[t.getVariableName(e[0])]}},useSlerp:{name:"animationType",inOptions:!0,defaultValue:!1,dataTransformer:function(e){return!0===e[0]?["Quaternion"]:[void 0]}}},inputs:{values:{value:{name:"value_1"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphBezierCurveEasing"},p2:{name:"controlPoint2",toBlock:"FlowGraphBezierCurveEasing"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"userVariables",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:4,isVariable:!0}],extraProcessor:function(e,t,n,o,r){var a,i,s,l=r[0],u=null===(a=e.configuration)||void 0===a?void 0:a.variable.value[0];if("number"!=typeof u)throw h.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var c=o.arrays.staticVariables[u];void 0===l.config.animationType.value&&(o.arrays.staticVariables,l.config.animationType.value=(0,h.getAnimationTypeByFlowGraphType)(c.type));var d=r[4];return d.config||(d.config={}),(i=d.config).variable||(i.variable={}),d.config.variable.value=o.getVariableName(u),(s=r[3]).config||(s.config={}),r}},"pointer/get":{blocks:["FlowGraphGetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customGetFunction",output:"getFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:function(e,t,n,o,r){return r.forEach((function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)})),r}},"pointer/set":{blocks:["FlowGraphSetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customSetFunction",output:"setFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:function(e,t,n,o,r){return r.forEach((function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)})),r}},"pointer/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphJsonPointerParserBlock","FlowGraphPlayAnimationBlock","FlowGraphEasingBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value_1"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphEasingBlock"},p2:{name:"controlPoint2",toBlock:"FlowGraphEasingBlock"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customBuildAnimation",output:"generateAnimationsFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:function(e,t,n,o,r){return r.forEach((function(t){"FlowGraphJsonPointerParserBlock"===t.className?(t.config||(t.config={}),t.config.outputValue=!0):"FlowGraphInterpolationBlock"===t.className&&(t.config||(t.config={}),Object.keys(e.values||[]).forEach((function(n){var r,a=null===(r=e.values)||void 0===r?void 0:r[n];if("value"===n&&a){var i=a.type;void 0!==i&&(t.config.animationType=o.arrays.types[i].flowGraphType)}})))})),r}},"animation/start":{blocks:["FlowGraphPlayAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},speed:{name:"speed",gltfType:"number"},startTime:{name:"from",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._loader.parent.targetFps]}},endTime:{name:"to",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._loader.parent.targetFps]}}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor:function(e,t,n,o,r,a,i){var s=r[r.length-1];return s.config||(s.config={}),s.config.glTF=i,r}},"animation/stop":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor:function(e,t,n,o,r,a,i){var s=r[r.length-1];return s.config||(s.config={}),s.config.glTF=i,r}},"animation/stopAt":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{},inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},stopTime:{name:"stopAtFrame",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._loader.parent.targetFps]}}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor:function(e,t,n,o,r,a,i){var s=r[r.length-1];return s.config||(s.config={}),s.config.glTF=i,r}}};function Ot(e,t,n){return void 0===t&&(t=["a"]),{blocks:[e],inputs:{values:t.reduce((function(e,t){return e[t]={name:t},e}),{})},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,o,r,a){if(n){a[0].config=a[0].config||{};var i=-1;Object.keys(e.values||{}).find((function(t){var n;return void 0!==(null===(n=e.values)||void 0===n?void 0:n[t].type)&&(i=e.values[t].type,!0)})),-1!==i&&(a[0].config.type=r.arrays.types[i].flowGraphType)}return a}}}function Mt(){return Object.keys(wt)}var Ct={float:{length:1,flowGraphType:"number",elementType:"number"},bool:{length:1,flowGraphType:"boolean",elementType:"boolean"},float2:{length:2,flowGraphType:"Vector2",elementType:"number"},float3:{length:3,flowGraphType:"Vector3",elementType:"number"},float4:{length:4,flowGraphType:"Vector4",elementType:"number"},float4x4:{length:16,flowGraphType:"Matrix",elementType:"number"},float2x2:{length:4,flowGraphType:"Matrix2D",elementType:"number"},float3x3:{length:9,flowGraphType:"Matrix3D",elementType:"number"},int:{length:1,flowGraphType:"FlowGraphInteger",elementType:"number"}},Rt=function(){function e(e,t,n){this._interactivityGraph=e,this._gltf=t,this._loader=n,this._types=[],this._mappings=[],this._staticVariables=[],this._events=[],this._internalEventsCounter=0,this._nodes=[],this._parseTypes(),this._parseDeclarations(),this._parseVariables(),this._parseEvents(),this._parseNodes()}return Object.defineProperty(e.prototype,"arrays",{get:function(){return{types:this._types,mappings:this._mappings,staticVariables:this._staticVariables,events:this._events,nodes:this._nodes}},enumerable:!1,configurable:!0}),e.prototype._parseTypes=function(){if(this._interactivityGraph.types)for(var e=0,t=this._interactivityGraph.types;e<t.length;e++){var n=t[e];this._types.push(Ct[n.signature])}},e.prototype._parseDeclarations=function(){if(this._interactivityGraph.declarations)for(var e=0,t=this._interactivityGraph.declarations;e<t.length;e++){var n=t[e],o=xt(n);if(!o)throw h.Logger.Error(["No mapping found for declaration",n]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:o,fullOperationName:n.extension?n.op+":"+n.extension:n.op})}},e.prototype._parseVariables=function(){if(this._interactivityGraph.variables)for(var e=0,t=this._interactivityGraph.variables;e<t.length;e++){var n=t[e],o=this._parseVariable(n);this._staticVariables.push(o)}},e.prototype._parseVariable=function(e,t){var n=this._types[e.type];if(!n)throw h.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==n.length)throw h.Logger.Error(["Invalid value length for variable",e,n]),new Error("Error parsing variables");var o=e.value||[];if(!o.length)switch(n.flowGraphType){case"boolean":o.push(!1);break;case"FlowGraphInteger":o.push(0);break;case"number":o.push(NaN);break;case"Vector2":o.push(NaN,NaN);break;case"Vector3":o.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":o.fill(NaN,0,4);break;case"Matrix":o.fill(NaN,0,16);break;case"Matrix3D":o.fill(NaN,0,9)}return{type:n.flowGraphType,value:t?t(o,this):o}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var t=function(t){var o={eventId:t.id||"internalEvent_"+n._internalEventsCounter++};t.values&&(o.eventData=Object.keys(t.values).map((function(n){var o,r=null===(o=t.values)||void 0===o?void 0:o[n];if(!r)throw h.Logger.Error(["No value found for event key",n]),new Error("Error parsing events");var a=e._types[r.type];if(!a)throw h.Logger.Error(["No type found for event value",r]),new Error("Error parsing events");var i=void 0!==r.value?e._parseVariable(r):void 0;return{id:n,type:a.flowGraphType,eventData:!0,value:i}}))),n._events.push(o)},n=this,o=0,r=this._interactivityGraph.events;o<r.length;o++)t(r[o])},e.prototype._parseNodes=function(){if(this._interactivityGraph.nodes)for(var e=0,t=this._interactivityGraph.nodes;e<t.length;e++){var n=t[e];if("number"!=typeof n.declaration)throw h.Logger.Error(["No declaration found for node",n]),new Error("Error parsing nodes");var o=this._mappings[n.declaration];if(!o)throw h.Logger.Error(["No mapping found for node",n]),new Error("Error parsing nodes");if(o.flowGraphMapping.validation&&!o.flowGraphMapping.validation(n,this._interactivityGraph,this._gltf))throw new Error("Error validating interactivity node ".concat(n));for(var r=[],a=0,i=o.flowGraphMapping.blocks;a<i.length;a++){var s=i[a],l=this._getEmptyBlock(s,o.fullOperationName);this._parseNodeConfiguration(n,l,o.flowGraphMapping,s),r.push(l)}this._nodes.push({blocks:r,fullOperationName:o.fullOperationName})}},e.prototype._getEmptyBlock=function(e,t){return{uniqueId:(0,h.RandomGUID)(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,t,n,o){var r=this,a=t.config;e.configuration&&Object.keys(e.configuration).forEach((function(t){var i,s,l=null===(i=e.configuration)||void 0===i?void 0:i[t];if(!l)throw h.Logger.Error(["No value found for node configuration",t]),new Error("Error parsing node configuration");var u=null===(s=n.configuration)||void 0===s?void 0:s[t];if(u&&u.toBlock?u.toBlock===o:0===n.blocks.indexOf(o)){var c=(null==u?void 0:u.name)||t;l&&void 0!==l.value||void 0===(null==u?void 0:u.defaultValue)?l.value.length>=1?a[c]={value:1===l.value.length?l.value[0]:l.value}:h.Logger.Warn(["Invalid value for node configuration",l]):a[c]={value:u.defaultValue},u&&u.dataTransformer&&(a[c].value=u.dataTransformer([a[c].value],r)[0])}}))},e.prototype._parseNodeConnections=function(e){for(var t,n,o,r,a,i,s,l,u,c,d,f,p,m,_,y,v,g,b,x=0;x<this._nodes.length;x++){var T=null===(t=this._interactivityGraph.nodes)||void 0===t?void 0:t[x];if(!T)throw h.Logger.Error(["No node found for interactivity node",this._nodes[x]]),new Error("Error parsing node connections");var A=this._nodes[x],w=this._mappings[T.declaration];if(!w)throw h.Logger.Error(["No mapping found for node",T]),new Error("Error parsing node connections");for(var O=T.flows||{},M=Object.keys(O).sort(),C=function(e){var t=O[e],u=null===(o=null===(n=w.flowGraphMapping.outputs)||void 0===n?void 0:n.flows)||void 0===o?void 0:o[e],c=(null==u?void 0:u.name)||e,d=R._createNewSocketConnection(c,!0);(u&&u.toBlock&&A.blocks.find((function(e){return e.className===u.toBlock}))||A.blocks[0]).signalOutputs.push(d);var f=t.node,p=R._nodes[f];if(!p)throw h.Logger.Error(["No node found for input node id",f]),new Error("Error parsing node connections");var m=bt(p.fullOperationName);if(!m)throw h.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var _=null===(a=null===(r=m.inputs)||void 0===r?void 0:r.flows)||void 0===a?void 0:a[t.socket||"in"],y=!1;if(!_)for(var v in null===(i=m.inputs)||void 0===i?void 0:i.flows)v.startsWith("[")&&v.endsWith("]")&&(y=!0,_=null===(l=null===(s=m.inputs)||void 0===s?void 0:s.flows)||void 0===l?void 0:l[v]);var g=_?y?_.name.replace("$1",t.socket||""):_.name:t.socket||"in",b=_&&_.toBlock&&p.blocks.find((function(e){return e.className===_.toBlock}))||p.blocks[0],x=b.signalInputs.find((function(e){return e.name===g}));x||(x=R._createNewSocketConnection(g),b.signalInputs.push(x)),x.connectedPointIds.push(d.uniqueId),d.connectedPointIds.push(x.uniqueId)},R=this,E=0,L=M;E<L.length;E++)C(L[E]);for(var P=T.values||{},k=Object.keys(P),F=function(t){var n=P[t],o=null===(c=null===(u=w.flowGraphMapping.inputs)||void 0===u?void 0:u.values)||void 0===c?void 0:c[t],r=!1;if(!o)for(var a in null===(d=w.flowGraphMapping.inputs)||void 0===d?void 0:d.values)a.startsWith("[")&&a.endsWith("]")&&(r=!0,o=null===(p=null===(f=w.flowGraphMapping.inputs)||void 0===f?void 0:f.values)||void 0===p?void 0:p[a]);var i=o?r?o.name.replace("$1",t):o.name:t,s=B._createNewSocketConnection(i);if((o&&o.toBlock&&A.blocks.find((function(e){return e.className===o.toBlock}))||A.blocks[0]).dataInputs.push(s),void 0!==n.value){var l=B._parseVariable(n,o&&o.dataTransformer);e._connectionValues[s.uniqueId]=l}else{if(void 0===n.node)throw h.Logger.Error(["Invalid value for value connection",n]),new Error("Error parsing node connections");var b=n.node,x=n.socket||"value",T=B._nodes[b];if(!T)throw h.Logger.Error(["No node found for output socket reference",n]),new Error("Error parsing node connections");var O=bt(T.fullOperationName);if(!O)throw h.Logger.Error(["No mapping found for output socket reference",n]),new Error("Error parsing node connections");var M=null===(_=null===(m=O.outputs)||void 0===m?void 0:m.values)||void 0===_?void 0:_[x],C=!1;if(!M)for(var a in null===(y=O.outputs)||void 0===y?void 0:y.values)a.startsWith("[")&&a.endsWith("]")&&(C=!0,M=null===(g=null===(v=O.outputs)||void 0===v?void 0:v.values)||void 0===g?void 0:g[a]);var R=M?C?M.name.replace("$1",x):null==M?void 0:M.name:x,E=M&&M.toBlock&&T.blocks.find((function(e){return e.className===M.toBlock}))||T.blocks[0],L=E.dataOutputs.find((function(e){return e.name===R}));L||(L=B._createNewSocketConnection(R,!0),E.dataOutputs.push(L)),s.connectedPointIds.push(L.uniqueId),L.connectedPointIds.push(s.uniqueId)}},B=this,I=0,S=k;I<S.length;I++)F(S[I]);if(w.flowGraphMapping.interBlockConnectors)for(var N=0,G=w.flowGraphMapping.interBlockConnectors;N<G.length;N++){var V=G[N],D=V.input,H=V.output,K=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],K)}if(w.flowGraphMapping.extraProcessor){var U=null===(b=this._interactivityGraph.declarations)||void 0===b?void 0:b[T.declaration];if(!U)throw h.Logger.Error(["No declaration found for extra processor",T]),new Error("Error parsing node connections");A.blocks=w.flowGraphMapping.extraProcessor(T,U,w.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,t){return{uniqueId:(0,h.RandomGUID)(),name:e,_connectionType:t?1:0,connectedPointIds:[]}},e.prototype._connectFlowGraphNodes=function(e,t,n,o,r){var a=r?n.dataInputs:n.signalInputs,i=r?o.dataOutputs:o.signalOutputs,s=a.find((function(t){return t.name===e}))||this._createNewSocketConnection(e),l=i.find((function(e){return e.name===t}))||this._createNewSocketConnection(t,!0);a.find((function(t){return t.name===e}))||a.push(s),i.find((function(e){return e.name===t}))||i.push(l),s.connectedPointIds.push(l.uniqueId),l.connectedPointIds.push(s.uniqueId)},e.prototype.getVariableName=function(e){return"staticVariable_"+e},e.prototype.serializeToFlowGraph=function(){var e={uniqueId:(0,h.RandomGUID)(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var t=0;t<this._staticVariables.length;t++){var n=this._staticVariables[t];e._userVariables[this.getVariableName(t)]=n}return{rightHanded:!0,allBlocks:this._nodes.reduce((function(e,t){return e.concat(t.blocks)}),[]),executionContexts:[e]}},e}(),Et="KHR_interactivity",Lt=function(){function e(e){this._loader=e,this.name=Et,this.enabled=this._loader.isExtensionUsed(Et),this._pathConverter=(0,R.Wt)(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&Pt(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e,t,n,o,r,a=this;return(0,p.YH)(this,(function(i){switch(i.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(t=null===(r=this._loader.gltf.extensions)||void 0===r?void 0:r.KHR_interactivity)?(n=new h.FlowGraphCoordinator({scene:e}),o=t.graphs.map((function(e){return new Rt(e,a._loader.gltf,a._loader).serializeToFlowGraph()})),[4,Promise.all(o.map((function(e){return(0,h.ParseFlowGraphAsync)(e,{coordinator:n,pathConverter:a._pathConverter})})))]):[2]):[2];case 1:return i.sent(),n.start(),[2]}}))}))},e}();function Pt(e){(0,R.oR)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){return e.activeCamera?h.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize():new h.Quaternion(NaN,NaN,NaN,NaN)},type:"Quaternion",getTarget:function(){return e.activeCamera}}),(0,R.oR)("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){return e.activeCamera?e.activeCamera.position:new h.Vector3(NaN,NaN,NaN)},type:"Vector3",getTarget:function(){return e.activeCamera}}),(0,R.oR)("/animations/{}/extensions/KHR_interactivity/isPlaying",{get:function(e){var t,n;return null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.isPlaying)&&void 0!==n&&n},type:"boolean",getTarget:function(e){return e._babylonAnimationGroup}}),(0,R.oR)("/animations/{}/extensions/KHR_interactivity/minTime",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.from)&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}}),(0,R.oR)("/animations/{}/extensions/KHR_interactivity/maxTime",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.to)&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}}),(0,R.oR)("/animations/{}/extensions/KHR_interactivity/playhead",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.getCurrentFrame())&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}}),(0,R.oR)("/animations/{}/extensions/KHR_interactivity/virtualPlayhead",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.getCurrentFrame())&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}})}(0,h.addToBlockFactory)(Et,"FlowGraphGLTFDataProvider",(function(){return(0,p.sH)(void 0,void 0,void 0,(function(){return(0,p.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(a.bind(a,274))];case 1:return[2,e.sent().FlowGraphGLTFDataProvider]}}))}))})),k(Et),P(Et,!0,(function(e){return new Lt(e)}));var kt="KHR_node_visibility";(0,R.oR)("/nodes/{}/extensions/KHR_node_visibility/visible",{get:function(e){var t=e._babylonTransformNode;return!t||void 0===t.isVisible||t.isVisible},set:function(e,t){var n,o;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach((function(e){e.inheritVisibility=!0})),t._babylonTransformNode&&(t._babylonTransformNode.isVisible=e),null===(o=t._primitiveBabylonMeshes)||void 0===o||o.forEach((function(t){t.isVisible=e}))},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"isVisible"}],type:"boolean"});var Ft=function(){function e(e){this.name=kt,this._loader=e,this.enabled=e.isExtensionUsed(kt)}return e.prototype.onReady=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e;return(0,p.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,o,r;null===(t=e._primitiveBabylonMeshes)||void 0===t||t.forEach((function(e){e.inheritVisibility=!0})),(null===(n=e.extensions)||void 0===n?void 0:n.KHR_node_visibility)&&!1===(null===(o=e.extensions)||void 0===o?void 0:o.KHR_node_visibility.visible)&&(e._babylonTransformNode&&(e._babylonTransformNode.isVisible=!1),null===(r=e._primitiveBabylonMeshes)||void 0===r||r.forEach((function(e){e.isVisible=!1})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();k(kt),P(kt,!0,(function(e){return new Ft(e)}));var Bt="KHR_node_selectability";Tt("event/onSelect",Bt,{blocks:["FlowGraphMeshPickEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return["pickedMesh_"+e[0]]}}},outputs:{values:{selectedNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"},selectionPoint:{name:"pickedPoint"},selectionRayOrigin:{name:"pickOrigin"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"asset",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"pickedMesh",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor:function(e,t,n,o,r,a,i){var s,l,u,c,d,f,p=r[r.length-1];p.config=p.config||{},p.config.glTF=i;var h=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value[0];if(void 0===h||"number"!=typeof h)throw new Error("nodeIndex not found in configuration");var m="pickedMesh_"+h;return r[1].config.variable=m,a._userVariables[m]={className:"Mesh",id:null===(c=null===(u=null==i?void 0:i.nodes)||void 0===u?void 0:u[h]._babylonTransformNode)||void 0===c?void 0:c.id,uniqueId:null===(f=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[h]._babylonTransformNode)||void 0===f?void 0:f.uniqueId},r}}),(0,R.oR)("/nodes/{}/extensions/KHR_node_selectability/selectable",{get:function(e){var t=e._babylonTransformNode;return!t||void 0===t.isPickable||t.isPickable},set:function(e,t){var n;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach((function(t){t.isPickable=e}))},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"isPickable"}],type:"boolean"});var It=function(){function e(e){this.name=Bt,this._loader=e,this.enabled=e.isExtensionUsed(Bt)}return e.prototype.onReady=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e;return(0,p.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,o;(null===(t=e.extensions)||void 0===t?void 0:t.KHR_node_selectability)&&!1===(null===(n=e.extensions)||void 0===n?void 0:n.KHR_node_selectability.selectable)&&(null===(o=e._babylonTransformNode)||void 0===o||o.getChildMeshes().forEach((function(e){e.isPickable=!1})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();k(Bt),P(Bt,!0,(function(e){return new It(e)}));var St="KHR_node_hoverability",Nt="targetMeshPointerOver_";Tt("event/onHoverIn",St,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return[Nt+e[0]]}}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshUnderPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor:function(e,t,n,o,r,a,i){var s,l,u,c,d,f,p=r[r.length-1];p.config=p.config||{},p.config.glTF=i;var h=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value[0];if(void 0===h||"number"!=typeof h)throw new Error("nodeIndex not found in configuration");var m=Nt+h;return r[1].config.variable=m,a._userVariables[m]={className:"Mesh",id:null===(c=null===(u=null==i?void 0:i.nodes)||void 0===u?void 0:u[h]._babylonTransformNode)||void 0===c?void 0:c.id,uniqueId:null===(f=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[h]._babylonTransformNode)||void 0===f?void 0:f.uniqueId},r}});var Gt="targetMeshPointerOut_";Tt("event/onHoverOut",St,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return[Gt+e[0]]}}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshOutOfPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor:function(e,t,n,o,r,a,i){var s,l,u,c,d,f,p=r[r.length-1];p.config=p.config||{},p.config.glTF=i;var h=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value[0];if(void 0===h||"number"!=typeof h)throw new Error("nodeIndex not found in configuration");var m=Gt+h;return r[1].config.variable=m,a._userVariables[m]={className:"Mesh",id:null===(c=null===(u=null==i?void 0:i.nodes)||void 0===u?void 0:u[h]._babylonTransformNode)||void 0===c?void 0:c.id,uniqueId:null===(f=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[h]._babylonTransformNode)||void 0===f?void 0:f.uniqueId},r}}),(0,R.oR)("/nodes/{}/extensions/KHR_node_hoverability/hoverable",{get:function(e){var t=e._babylonTransformNode;return!t||void 0===t.pointerOverDisableMeshTesting||t.pointerOverDisableMeshTesting},set:function(e,t){var n;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach((function(t){t.pointerOverDisableMeshTesting=!e}))},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"pointerOverDisableMeshTesting"}],type:"boolean"});var Vt=function(){function e(e){this.name=St,this._loader=e,this.enabled=e.isExtensionUsed(St)}return e.prototype.onReady=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e;return(0,p.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,o;(null===(t=e.extensions)||void 0===t?void 0:t.KHR_node_hoverability)&&!1===(null===(n=e.extensions)||void 0===n?void 0:n.KHR_node_hoverability.hoverable)&&(null===(o=e._babylonTransformNode)||void 0===o||o.getChildMeshes().forEach((function(e){e.pointerOverDisableMeshTesting=!0})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();k(St),P(St,!0,(function(e){return new Vt(e)}));var Dt="ExtrasAsMetadata",Ht=function(){function e(e){this.name=Dt,this.enabled=!0,this._loader=e}return e.prototype._assignExtras=function(e,t){if(t.extras&&Object.keys(t.extras).length>0){var n=e.metadata=e.metadata||{};(n.gltf=n.gltf||{}).extras=t.extras}},e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var o=this;return this._loader.loadNodeAsync(e,t,(function(e){o._assignExtras(e,t),n(e)}))},e.prototype.loadCameraAsync=function(e,t,n){var o=this;return this._loader.loadCameraAsync(e,t,(function(e){o._assignExtras(e,t),n(e)}))},e.prototype.createMaterial=function(e,t,n){var o=this._loader.createMaterial(e,t,n);return this._assignExtras(o,t),o},e}();k(Dt),P(Dt,!1,(function(e){return new Ht(e)}));var Kt=a(274),Ut=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Ut){Ut.BABYLON=Ut.BABYLON||{};var jt=Ut.BABYLON;jt.GLTF2=jt.GLTF2||{},jt.GLTF2.Loader=jt.GLTF2.Loader||{},jt.GLTF2.Loader.Extensions=jt.GLTF2.Loader.Extensions||{};var Zt=[];for(var qt in u)jt.GLTF2.Loader.Extensions[qt]=u[qt],Zt.push(qt);for(var qt in c)jt.GLTF2.Loader[qt]=c[qt],Zt.push(qt);for(var qt in d)Zt.indexOf(qt)>-1||(jt.GLTF2[qt]=d[qt])}const Yt=f;return i.default})()));
2
2
  //# sourceMappingURL=babylon.glTF2FileLoader.min.js.map