babylonjs-loaders 8.44.1 → 8.45.1
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.
- package/babylon.glTF1FileLoader.js +1 -1
- package/babylon.glTF1FileLoader.min.js +1 -1
- package/babylon.glTF1FileLoader.min.js.map +1 -1
- package/babylon.glTF2FileLoader.js +1 -1
- package/babylon.glTF2FileLoader.min.js +1 -1
- package/babylon.glTF2FileLoader.min.js.map +1 -1
- package/babylon.glTFFileLoader.js +1 -1
- package/babylon.glTFFileLoader.min.js +1 -1
- package/babylon.glTFFileLoader.min.js.map +1 -1
- package/babylonjs.loaders.d.ts +4 -0
- package/babylonjs.loaders.js +1 -1
- package/babylonjs.loaders.min.js +1 -1
- package/babylonjs.loaders.min.js.map +1 -1
- package/babylonjs.loaders.module.d.ts +8 -0
- package/package.json +3 -3
|
@@ -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={274:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphGLTFDataProvider:()=>a});var r=n(322),o=n(597),a=function(e){function t(t){var n,r,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",o.RichTypeAny,s);var l=(null===(r=i.nodes)||void 0===r?void 0:r.map((function(e){return e._babylonTransformNode})))||[];return a.nodes=a.registerDataOutput("nodes",o.RichTypeAny,l),a}return(0,r.C6)(t,e),t.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},t}(o.FlowGraphBlock)},322:(e,t,n)=>{n.d(t,{C6:()=>o,Cl:()=>a,YH:()=>s,sH:()=>i});var r=function(e,t){return r=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])},r(e,t)};function o(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}r(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,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},a.apply(this,arguments)};function i(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 s(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},561:(e,t,n)=>{n.r(t),n.d(t,{PBRMaterialLoadingAdapter:()=>o});var r=n(597),o=function(){function e(e){this._material=e,this._material.enableSpecularAntiAliasing=!0}return Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUnlit",{get:function(){return this._material.unlit},set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._material.backFaceCulling},set:function(e){this._material.backFaceCulling=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"twoSidedLighting",{get:function(){return this._material.twoSidedLighting},set:function(e){this._material.twoSidedLighting=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaCutOff",{get:function(){return this._material.alphaCutOff},set:function(e){this._material.alphaCutOff=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useAlphaFromBaseColorTexture",{get:function(){return this._material.useAlphaFromAlbedoTexture},set:function(e){this._material.useAlphaFromAlbedoTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparencyAsAlphaCoverage",{get:function(){return this._material.useRadianceOverAlpha||this._material.useSpecularOverAlpha},set:function(e){this._material.useRadianceOverAlpha=!e,this._material.useSpecularOverAlpha=!e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColor",{get:function(){return this._material.albedoColor},set:function(e){this._material.albedoColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColorTexture",{get:function(){return this._material.albedoTexture},set:function(e){this._material.albedoTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughness",{get:function(){var e;return null!==(e=this._material.baseDiffuseRoughness)&&void 0!==e?e:0},set:function(e){this._material.baseDiffuseRoughness=e,e>0&&(this._material.brdf.baseDiffuseModel=r.Constants.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughnessTexture",{get:function(){return this._material.baseDiffuseRoughnessTexture},set:function(e){this._material.baseDiffuseRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalness",{get:function(){var e;return null!==(e=this._material.metallic)&&void 0!==e?e:1},set:function(e){this._material.metallic=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalnessTexture",{get:function(){return this._material.metallicTexture},set:function(e){this._material.metallicTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useRoughnessFromMetallicTextureGreen",{set:function(e){this._material.useRoughnessFromMetallicTextureGreen=e,this._material.useRoughnessFromMetallicTextureAlpha=!e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useMetallicFromMetallicTextureBlue",{set:function(e){this._material.useMetallnessFromMetallicTextureBlue=e},enumerable:!1,configurable:!0}),e.prototype.enableSpecularEdgeColor=function(e){void 0===e&&(e=!1),e&&(this._material.brdf.dielectricSpecularModel=r.Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=r.Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR)},Object.defineProperty(e.prototype,"specularWeight",{get:function(){var e;return null!==(e=this._material.metallicF0Factor)&&void 0!==e?e:1},set:function(e){this._material.metallicF0Factor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularWeightTexture",{get:function(){return this._material.metallicReflectanceTexture},set:function(e){e?(this._material.metallicReflectanceTexture=e,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!0):(this._material.metallicReflectanceTexture=null,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColor",{get:function(){return this._material.metallicReflectanceColor},set:function(e){this._material.metallicReflectanceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._material.reflectanceTexture},set:function(e){this._material.reflectanceTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughness",{get:function(){var e;return null!==(e=this._material.roughness)&&void 0!==e?e:1},set:function(e){this._material.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessTexture",{get:function(){return this._material.metallicTexture},set:function(e){this.baseMetalnessTexture||(this._material.metallicTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularIor",{get:function(){return this._material.indexOfRefraction},set:function(e){this._material.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColor",{get:function(){return this._material.emissiveColor},set:function(e){this._material.emissiveColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionLuminance",{get:function(){return this._material.emissiveIntensity},set:function(e){this._material.emissiveIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColorTexture",{get:function(){return this._material.emissiveTexture},set:function(e){this._material.emissiveTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTexture",{get:function(){return this._material.ambientTexture},set:function(e){this._material.ambientTexture=e,e&&(this._material.useAmbientInGrayScale=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTextureStrength",{get:function(){var e;return null!==(e=this._material.ambientTextureStrength)&&void 0!==e?e:1},set:function(e){this._material.ambientTextureStrength=e},enumerable:!1,configurable:!0}),e.prototype.configureCoat=function(){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.remapF0OnInterfaceChange=!1},Object.defineProperty(e.prototype,"coatWeight",{get:function(){return this._material.clearCoat.intensity},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatWeightTexture",{get:function(){return this._material.clearCoat.texture},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColor",{set:function(e){this._material.clearCoat.isTintEnabled=e!=r.Color3.White(),this._material.clearCoat.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColorTexture",{set:function(e){this._material.clearCoat.tintTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughness",{get:function(){var e;return null!==(e=this._material.clearCoat.roughness)&&void 0!==e?e:0},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessTexture",{get:function(){return this._material.clearCoat.textureRoughness},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.textureRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatIor",{set:function(e){this._material.clearCoat.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkening",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkeningTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessAnisotropy",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentAngle",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentTexture",{get:function(){return null},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.subSurface.refractionIntensity},set:function(e){this._material.subSurface.isRefractionEnabled=e>0,this._material.subSurface.refractionIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{set:function(e){this._material.subSurface.isRefractionEnabled=!0,this._material.subSurface.refractionIntensityTexture=e,this._material.subSurface.useGltfStyleTextures=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDepth",{set:function(e){this._material.subSurface.tintColorAtDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){e>0?(this._material.subSurface.isDispersionEnabled=!0,this._material.subSurface.dispersion=20/e):(this._material.subSurface.isDispersionEnabled=!1,this._material.subSurface.dispersion=0)},enumerable:!1,configurable:!0}),e.prototype.configureTransmission=function(){this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.useAlbedoToTintRefraction=!0,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0},Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){this._material.subSurface.thicknessTexture=e,this._material.subSurface.useGltfStyleTextures=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=e,this._material.subSurface.useThicknessAsDepth=!0,e>0&&(this._material.subSurface.volumeIndexOfRefraction=this._material.indexOfRefraction)},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){this._material.subSurface.useGltfStyleTextures=!0,this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0,this._material.subSurface.useAlbedoToTintTranslucency=!1},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return this._material.subSurface.isTranslucencyEnabled?this._material.subSurface.translucencyIntensity:0},set:function(e){this._material.subSurface.isTranslucencyEnabled=e>0,this._material.subSurface.translucencyIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){this._material.subSurface.translucencyIntensityTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){this._material.subSurface.translucencyColorTexture=e},enumerable:!1,configurable:!0}),e.prototype.configureFuzz=function(){this._material.sheen.isEnabled=!0,this._material.sheen.useRoughnessFromMainTexture=!1,this._material.sheen.albedoScaling=!0},Object.defineProperty(e.prototype,"fuzzWeight",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzWeightTexture",{set:function(e){this._material.sheen.texture||(this._material.sheen.texture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColor",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.color=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColorTexture",{set:function(e){this._material.sheen.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughness",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughnessTexture",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.textureRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessAnisotropy",{get:function(){return this._material.anisotropy.intensity},set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentAngle",{set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.angle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentTexture",{get:function(){return this._material.anisotropy.texture},set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.texture=e},enumerable:!1,configurable:!0}),e.prototype.configureGltfStyleAnisotropy=function(e){void 0===e&&(e=!0)},Object.defineProperty(e.prototype,"thinFilmWeight",{set:function(e){this._material.iridescence.isEnabled=e>0,this._material.iridescence.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmIor",{set:function(e){this._material.iridescence.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMinimum",{set:function(e){this._material.iridescence.minimumThickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMaximum",{set:function(e){this._material.iridescence.maximumThickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmWeightTexture",{set:function(e){this._material.iridescence.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessTexture",{set:function(e){this._material.iridescence.thicknessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersion",{set:function(e){this._material._dispersion=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unlit",{set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryOpacity",{get:function(){return this._material.alpha},set:function(e){this._material.alpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryNormalTexture",{get:function(){return this._material.bumpTexture},set:function(e){this._material.bumpTexture=e,this._material.forceIrradianceInFragment=!0},enumerable:!1,configurable:!0}),e.prototype.setNormalMapInversions=function(e,t){this._material.invertNormalMapX=e,this._material.invertNormalMapY=t},Object.defineProperty(e.prototype,"geometryCoatNormalTexture",{get:function(){return this._material.clearCoat.bumpTexture},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.bumpTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatNormalTextureScale",{set:function(e){this._material.clearCoat.bumpTexture&&(this._material.clearCoat.bumpTexture.level=e)},enumerable:!1,configurable:!0}),e}()},597:t=>{t.exports=e},698:(e,t,n)=>{n.d(t,{oR:()=>p,tQ:()=>f,Wt:()=>c,ZU:()=>d});var r=n(597),o=[{regex:new RegExp("^/nodes/\\d+/extensions/")}],a=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 a=e.split("/");if(a.shift(),a[a.length-1].includes(".length")){var i=a[a.length-1].split(".");a.pop(),a.push.apply(a,i)}for(var s=!1,l=0,u=a;l<u.length;l++){var c=u[l],f="length"===c;if(f&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(s=!0),n.__array__&&!f)n=n.__array__;else if(!(n=n[c]))throw new Error("Path ".concat(e," is invalid"));if(!s)if(void 0===t){if(!o.find((function(t){return t.regex.test(e)})))throw new Error("Path ".concat(e," is invalid"))}else f||(t=null==t?void 0:t[c]);(n.__target__||f)&&(r=t)}return{object:r,info:n}},e}();function i(e,t,n,r){var o=s(e);return r?o[n][r]:o[n]}function s(e,t,n){var o,a,i;return null===(i=null===(o=e._data)||void 0===o?void 0:o[null!==(a=null==n?void 0:n.fillMode)&&void 0!==a?a:r.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function l(e,t){return{offset:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uOffset,null==s?void 0:s.vOffset)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uOffset=n.x,s.vOffset=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uOffset")},function(){return"".concat(e).concat(t?"."+t:"",".vOffset")}]},rotation:{type:"number",get:function(n,r,o){var a;return null===(a=i(n,0,e,t))||void 0===a?void 0:a.wAng},getTarget:s,set:function(n,r,o,a){return i(r,0,e,t).wAng=n},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uScale,null==s?void 0:s.vScale)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uScale=n.x,s.vScale=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uScale")},function(){return"".concat(e).concat(t?"."+t:"",".vScale")}]}}}var u={cameras:{__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var t,n,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoLeft)&&void 0!==n?n:0,null!==(a=null===(o=e._babylonCamera)||void 0===o?void 0:o.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,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoBottom)&&void 0!==n?n:0,null!==(a=null===(o=e._babylonCamera)||void 0===o?void 0:o.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,r;return null===(r=null===(n=t._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion)||void 0===r?void 0:r.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,r;return void 0!==t?null===(r=null===(n=e._primitiveBabylonMeshes)||void 0===n?void 0:n[0].morphTargetManager)||void 0===r?void 0:r.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,n,o;return r.Matrix.Compose(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.scaling,null===(n=e._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion,null===(o=e._babylonTransformNode)||void 0===o?void 0:o.position)},getTarget:function(e){return e._babylonTransformNode},isReadOnly:!0},globalMatrix:{type:"Matrix",get:function(e){for(var t,n,o,a,i,s,l,u=r.Matrix.Identity(),c=e.parent;c&&c.parent;)c=c.parent;var f=(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.position._isDirty)||(null===(o=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion)||void 0===o?void 0:o._isDirty)||(null===(a=e._babylonTransformNode)||void 0===a?void 0:a.scaling._isDirty);if(c){var d=null===(i=c._babylonTransformNode)||void 0===i?void 0:i.computeWorldMatrix(!0).invert();d&&(null===(l=null===(s=e._babylonTransformNode)||void 0===s?void 0:s.computeWorldMatrix(f))||void 0===l||l.multiplyToRef(d,u))}else e._babylonTransformNode&&u.copyFrom(e._babylonTransformNode.computeWorldMatrix(f));return u},getTarget:function(e){return e._babylonTransformNode},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 r.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 r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.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 r.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 r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0];n&&(n.diffuse=e)}}}},KHR_node_visibility:{visible:{type:"boolean",get:function(e){return!!e._primitiveBabylonMeshes&&e._primitiveBabylonMeshes[0].isVisible},getTarget:function(){},set:function(e,t){t._primitiveBabylonMeshes&&t._primitiveBabylonMeshes.forEach((function(t){return t.isVisible=e}))}}}}}},materials:{__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).emissiveColor},set:function(e,t,n,r){return s(t,0,r).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:l("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=i(e,0,"bumpTexture"))||void 0===r?void 0:r.level},set:function(e,t,n,r){var o=i(t,0,"bumpTexture");o&&(o.level=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:l("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return s(e,0,n).ambientTextureStrength},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.ambientTextureStrength=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:l("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,t,n){var o=s(e,0,n);return r.Color4.FromColor3(o.albedoColor,o.alpha)},set:function(e,t,n,r){var o=s(t,0,r);o.albedoColor.set(e.r,e.g,e.b),o.alpha=e.a},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:l("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallic},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.metallic=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).roughness},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.roughness=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:l("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.intensity},set:function(e,t,n,r){s(t,0,r).anisotropy.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.angle},set:function(e,t,n,r){s(t,0,r).anisotropy.angle=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:l("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.intensity},set:function(e,t,n,r){s(t,0,r).clearCoat.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.roughness},set:function(e,t,n,r){s(t,0,r).clearCoat.roughness=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:l("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=s(e,0,n).clearCoat.bumpTexture)||void 0===r?void 0:r.level},getTarget:s,set:function(e,t,n,r){return s(t,0,r).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:l("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:l("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.dispersion},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return s(e,0,n).emissiveIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return s(e,0,n).indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:l("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.minimumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:l("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).sheen.color},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:l("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).sheen.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:l("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallicF0Factor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).metallicReflectanceColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:l("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:l("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.refractionIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.translucencyIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.translucencyColor},getTarget:s,set:function(e,t,n,r){var o;return e&&(null===(o=s(t,0,r).subSurface.translucencyColor)||void 0===o?void 0:o.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.tintColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.tintColorAtDistance},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:l("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_area:{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"}]},size:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.height},set:function(e,t){return t._babylonLight?t._babylonLight.height=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"size"}]},rect:{aspect:{type:"number",get:function(e){var t,n;return(null===(t=e._babylonLight)||void 0===t?void 0:t.width)/(null===(n=e._babylonLight)||void 0===n?void 0:n.height)},set:function(e,t){return t._babylonLight?t._babylonLight.width=e*t._babylonLight.height:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"aspect"}]}}}}},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&&r.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=r.Quaternion.Inverse(e)),r.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 c(e){return new a(e,u)}function f(e){for(var t=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),n=u,r=0,o=t;r<o.length;r++){var a=o[r];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__")})),r=u,o=0,a=n;o<a.length;o++){var i=a[o];i&&(r=r[i])}r&&r.type&&r.get&&(r.interpolation=t)}function p(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),r=u,o=0,a=n;o<a.length;o++){var i=a[o];if(i){if(!r[i]){if("?"===i){r.__ignoreObjectTree__=!0;continue}r[i]={},"__array__"===i&&(r[i].__target__=!0)}r=r[i]}}Object.assign(r,t)}},727:(e,t,n)=>{n.r(t),n.d(t,{AnimationPropertyInfo:()=>u,TransformNodeAnimationPropertyInfo:()=>c,WeightAnimationPropertyInfo:()=>f,getQuaternion:()=>s,getVector3:()=>i,getWeights:()=>l});var r=n(322),o=n(597),a=n(698);function i(e,t,n,r){return o.Vector3.FromArray(t,n).scaleInPlace(r)}function s(e,t,n,r){return o.Quaternion.FromArray(t,n).scaleInPlace(r)}function l(e,t,n,r){for(var o=new Array(e._numMorphTargets),a=0;a<o.length;a++)o[a]=t[n++]*r;return o}var u=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 o.Animation(e,this.name,t,this.type);return r.setKeys(n,!0),r},e}(),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=[];return o.push({babylonAnimatable:e._babylonTransformNode,babylonAnimation:this._buildAnimation(t,n,r)}),o},t}(u),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new o.Animation("".concat(t,"_").concat(i),s.name,n,s.type);if(l.setKeys(r.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}})),!0),e._primitiveBabylonMeshes)for(var u=0,c=e._primitiveBabylonMeshes;u<c.length;u++){var f=c[u];if(f.morphTargetManager){var d=f.morphTargetManager.getTarget(i),p=l.clone();d.animations.push(p),a.push({babylonAnimatable:d,babylonAnimation:p})}}},s=this,l=0;l<e._numMorphTargets;l++)i(l);return a},t}(u);(0,a.ZU)("/nodes/{}/translation",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"position",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/rotation",[new c(o.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",s,(function(){return 4}))]),(0,a.ZU)("/nodes/{}/scale",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"scaling",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/weights",[new f(o.Animation.ANIMATIONTYPE_FLOAT,"influence",l,(function(e){return e._numMorphTargets}))])},833:(e,t,n)=>{n.r(t),n.d(t,{OpenPBRMaterialLoadingAdapter:()=>r});var r=function(){function e(e){this._material=e}return Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUnlit",{get:function(){return this._material.unlit},set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._material.backFaceCulling},set:function(e){this._material.backFaceCulling=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"twoSidedLighting",{get:function(){return this._material.twoSidedLighting},set:function(e){this._material.twoSidedLighting=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaCutOff",{get:function(){return.5},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useAlphaFromBaseColorTexture",{get:function(){return!1},set:function(e){this._material._useAlphaFromBaseColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparencyAsAlphaCoverage",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColor",{get:function(){return this._material.baseColor},set:function(e){this._material.baseColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColorTexture",{get:function(){return this._material.baseColorTexture},set:function(e){this._material.baseColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughness",{get:function(){return this._material.baseDiffuseRoughness},set:function(e){this._material.baseDiffuseRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughnessTexture",{get:function(){return this._material.baseDiffuseRoughnessTexture},set:function(e){this._material.baseDiffuseRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalness",{get:function(){return this._material.baseMetalness},set:function(e){this._material.baseMetalness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalnessTexture",{get:function(){return this._material.baseMetalnessTexture},set:function(e){this._material.baseMetalnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useRoughnessFromMetallicTextureGreen",{set:function(e){this._material._useRoughnessFromMetallicTextureGreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useMetallicFromMetallicTextureBlue",{set:function(e){this._material._useMetallicFromMetallicTextureBlue=e},enumerable:!1,configurable:!0}),e.prototype.enableSpecularEdgeColor=function(e){void 0===e&&(e=!1)},Object.defineProperty(e.prototype,"specularWeight",{get:function(){return this._material.specularWeight},set:function(e){this._material.specularWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularWeightTexture",{get:function(){return this._material.specularWeightTexture},set:function(e){this._material.specularColorTexture===e?(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0):this._material.specularWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColor",{get:function(){return this._material.specularColor},set:function(e){this._material.specularColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._material.specularColorTexture},set:function(e){this._material.specularColorTexture=e,this._material.specularWeightTexture===this._material.specularColorTexture&&(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughness",{get:function(){return this._material.specularRoughness},set:function(e){this._material.specularRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessTexture",{get:function(){return this._material.specularRoughnessTexture},set:function(e){this._material.specularRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularIor",{get:function(){return this._material.specularIor},set:function(e){this._material.specularIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColor",{get:function(){return this._material.emissionColor},set:function(e){this._material.emissionColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionLuminance",{get:function(){return this._material.emissionLuminance},set:function(e){this._material.emissionLuminance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColorTexture",{get:function(){return this._material.emissionColorTexture},set:function(e){this._material.emissionColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTexture",{get:function(){return this._material.ambientOcclusionTexture},set:function(e){this._material.ambientOcclusionTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTextureStrength",{get:function(){var e,t=this._material.ambientOcclusionTexture;return null!==(e=null==t?void 0:t.level)&&void 0!==e?e:1},set:function(e){var t=this._material.ambientOcclusionTexture;t&&(t.level=e)},enumerable:!1,configurable:!0}),e.prototype.configureCoat=function(){},Object.defineProperty(e.prototype,"coatWeight",{get:function(){return this._material.coatWeight},set:function(e){this._material.coatWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatWeightTexture",{get:function(){return this._material.coatWeightTexture},set:function(e){this._material.coatWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColor",{set:function(e){this._material.coatColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColorTexture",{set:function(e){this._material.coatColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughness",{get:function(){return this._material.coatRoughness},set:function(e){this._material.coatRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessTexture",{get:function(){return this._material.coatRoughnessTexture},set:function(e){this._material.coatRoughnessTexture=e,e&&(this._material._useCoatRoughnessFromGreenChannel=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatIor",{set:function(e){this._material.coatIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkening",{set:function(e){this._material.coatDarkening=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkeningTexture",{set:function(e){this._material.coatDarkeningTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessAnisotropy",{get:function(){return this._material.coatRoughnessAnisotropy},set:function(e){this._material.coatRoughnessAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentAngle",{set:function(e){this._material.geometryCoatTangentAngle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentTexture",{get:function(){return this._material.geometryCoatTangentTexture},set:function(e){this._material.geometryCoatTangentTexture=e,e&&(this._material._useCoatRoughnessAnisotropyFromTangentTexture=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureTransmission=function(){},Object.defineProperty(e.prototype,"transmissionDepth",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureFuzz=function(){},Object.defineProperty(e.prototype,"fuzzWeight",{set:function(e){this._material.fuzzWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzWeightTexture",{set:function(e){this._material.fuzzWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColor",{set:function(e){this._material.fuzzColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColorTexture",{set:function(e){this._material.fuzzColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughness",{set:function(e){this._material.fuzzRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughnessTexture",{set:function(e){this._material.fuzzRoughnessTexture=e,this._material._useFuzzRoughnessFromTextureAlpha=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessAnisotropy",{get:function(){return this._material.specularRoughnessAnisotropy},set:function(e){this._material.specularRoughnessAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentAngle",{set:function(e){this._material.geometryTangentAngle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentTexture",{get:function(){return this._material.geometryTangentTexture},set:function(e){this._material.geometryTangentTexture=e,this._material._useSpecularRoughnessAnisotropyFromTangentTexture=!0},enumerable:!1,configurable:!0}),e.prototype.configureGltfStyleAnisotropy=function(e){void 0===e&&(e=!0),this._material._useGltfStyleAnisotropy=e},Object.defineProperty(e.prototype,"thinFilmWeight",{set:function(e){this._material.thinFilmWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmIor",{set:function(e){this._material.thinFilmIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMinimum",{set:function(e){this._material.thinFilmThicknessMin=e/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMaximum",{set:function(e){this._material.thinFilmThickness=e/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmWeightTexture",{set:function(e){this._material.thinFilmWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessTexture",{set:function(e){this._material.thinFilmThicknessTexture=e,this._material._useThinFilmThicknessFromTextureGreen=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unlit",{set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryOpacity",{get:function(){return this._material.geometryOpacity},set:function(e){this._material.geometryOpacity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryNormalTexture",{get:function(){return this._material.geometryNormalTexture},set:function(e){this._material.geometryNormalTexture=e},enumerable:!1,configurable:!0}),e.prototype.setNormalMapInversions=function(e,t){},Object.defineProperty(e.prototype,"geometryCoatNormalTexture",{get:function(){return this._material.geometryCoatNormalTexture},set:function(e){this._material.geometryCoatNormalTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatNormalTextureScale",{set:function(e){this._material.geometryCoatNormalTexture&&(this._material.geometryCoatNormalTexture.level=e)},enumerable:!1,configurable:!0}),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}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,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||"function"==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:()=>Yn});var s={};a.r(s),a.d(s,{GLTFValidation:()=>T});var l={};a.r(l),a.d(l,{GLTFFileLoader:()=>M,GLTFLoaderAnimationStartMode:()=>b,GLTFLoaderCoordinateSystemMode:()=>g,GLTFLoaderDefaultOptions:()=>E,GLTFLoaderState:()=>v});var u={};a.r(u),a.d(u,{EBlendingFunction:()=>k,EComponentType:()=>R,ECullingType:()=>S,EParameterType:()=>P,EShaderType:()=>L,ETextureFilterType:()=>F,ETextureFormat:()=>I,ETextureWrapMode:()=>N,GLTFBinaryExtension:()=>ce,GLTFLoader:()=>le,GLTFLoaderBase:()=>se,GLTFLoaderExtension:()=>ue,GLTFMaterialsCommonExtension:()=>fe,GLTFUtils:()=>D});var c={};a.r(c),a.d(c,{AddObjectAccessorToKey:()=>he.oR,EXT_lights_area:()=>He,EXT_lights_ies:()=>Se,EXT_lights_image_based:()=>we,EXT_mesh_gpu_instancing:()=>Ee,EXT_meshopt_compression:()=>Re,EXT_texture_avif:()=>Fe,EXT_texture_webp:()=>Pe,ExtrasAsMetadata:()=>Dn,FlowGraphGLTFDataProvider:()=>Hn.FlowGraphGLTFDataProvider,GetMappingForKey:()=>he.tQ,GetPathToObjectConverter:()=>he.Wt,InteractivityGraphToFlowGraphParser:()=>En,KHR_animation_pointer:()=>un,KHR_draco_mesh_compression:()=>Be,KHR_interactivity:()=>Rn,KHR_lights:()=>Ve,KHR_materials_anisotropy:()=>$e,KHR_materials_clearcoat:()=>Ze,KHR_materials_coat:()=>qe,KHR_materials_diffuse_roughness:()=>xt,KHR_materials_diffuse_transmission:()=>_t,KHR_materials_dispersion:()=>vt,KHR_materials_emissive_strength:()=>tt,KHR_materials_fuzz:()=>at,KHR_materials_ior:()=>ut,KHR_materials_iridescence:()=>Xe,KHR_materials_pbrSpecularGlossiness:()=>je,KHR_materials_sheen:()=>rt,KHR_materials_specular:()=>st,KHR_materials_transmission:()=>ht,KHR_materials_unlit:()=>We,KHR_materials_variants:()=>ft,KHR_materials_volume:()=>gt,KHR_mesh_quantization:()=>Ot,KHR_node_hoverability:()=>Gn,KHR_node_selectability:()=>In,KHR_node_visibility:()=>Nn,KHR_texture_basisu:()=>Ct,KHR_texture_transform:()=>Mt,KHR_xmp_json_ld:()=>Lt,MSFT_audio_emitter:()=>fn,MSFT_lod:()=>pn,MSFT_minecraftMesh:()=>mn,MSFT_sRGBFactors:()=>yn,SetInterpolationForKey:()=>he.ZU,_AddInteractivityObjectModel:()=>Ln,addNewInteractivityFlowGraphMapping:()=>vn,getAllSupportedNativeNodeTypes:()=>wn,getMappingForDeclaration:()=>bn,getMappingForFullOperationName:()=>gn,gltfTypeToBabylonType:()=>Cn});var f={};a.r(f);var d={};a.r(d),a.d(d,{AddObjectAccessorToKey:()=>he.oR,AnimationPropertyInfo:()=>Pt.AnimationPropertyInfo,ArrayItem:()=>Te,EXT_lights_area:()=>He,EXT_lights_ies:()=>Se,EXT_lights_image_based:()=>we,EXT_mesh_gpu_instancing:()=>Ee,EXT_meshopt_compression:()=>Re,EXT_texture_avif:()=>Fe,EXT_texture_webp:()=>Pe,ExtrasAsMetadata:()=>Dn,FlowGraphGLTFDataProvider:()=>Hn.FlowGraphGLTFDataProvider,GLTFFileLoader:()=>M,GLTFLoader:()=>Ae,GetMappingForKey:()=>he.tQ,GetPathToObjectConverter:()=>he.Wt,InteractivityGraphToFlowGraphParser:()=>En,KHR_animation_pointer:()=>un,KHR_draco_mesh_compression:()=>Be,KHR_interactivity:()=>Rn,KHR_lights:()=>Ve,KHR_materials_anisotropy:()=>$e,KHR_materials_clearcoat:()=>Ze,KHR_materials_coat:()=>qe,KHR_materials_diffuse_roughness:()=>xt,KHR_materials_diffuse_transmission:()=>_t,KHR_materials_dispersion:()=>vt,KHR_materials_emissive_strength:()=>tt,KHR_materials_fuzz:()=>at,KHR_materials_ior:()=>ut,KHR_materials_iridescence:()=>Xe,KHR_materials_pbrSpecularGlossiness:()=>je,KHR_materials_sheen:()=>rt,KHR_materials_specular:()=>st,KHR_materials_transmission:()=>ht,KHR_materials_unlit:()=>We,KHR_materials_variants:()=>ft,KHR_materials_volume:()=>gt,KHR_mesh_quantization:()=>Ot,KHR_node_hoverability:()=>Gn,KHR_node_selectability:()=>In,KHR_node_visibility:()=>Nn,KHR_texture_basisu:()=>Ct,KHR_texture_transform:()=>Mt,KHR_xmp_json_ld:()=>Lt,LoadBoundingInfoFromPositionAccessor:()=>xe,MSFT_audio_emitter:()=>fn,MSFT_lod:()=>pn,MSFT_minecraftMesh:()=>mn,MSFT_sRGBFactors:()=>yn,OpenPBRMaterialLoadingAdapter:()=>Un.OpenPBRMaterialLoadingAdapter,PBRMaterialLoadingAdapter:()=>jn.PBRMaterialLoadingAdapter,SetInterpolationForKey:()=>he.ZU,TransformNodeAnimationPropertyInfo:()=>Pt.TransformNodeAnimationPropertyInfo,WeightAnimationPropertyInfo:()=>Pt.WeightAnimationPropertyInfo,_AddInteractivityObjectModel:()=>Ln,addNewInteractivityFlowGraphMapping:()=>vn,getAllSupportedNativeNodeTypes:()=>wn,getMappingForDeclaration:()=>bn,getMappingForFullOperationName:()=>gn,getQuaternion:()=>Pt.getQuaternion,getVector3:()=>Pt.getVector3,getWeights:()=>Pt.getWeights,gltfTypeToBabylonType:()=>Cn,registerGLTFExtension:()=>ye,registeredGLTFExtensions:()=>_e,unregisterGLTFExtension:()=>ge});var p={};a.r(p),a.d(p,{GLTF1:()=>u,GLTF2:()=>d,GLTFFileLoader:()=>M,GLTFLoaderAnimationStartMode:()=>b,GLTFLoaderCoordinateSystemMode:()=>g,GLTFLoaderDefaultOptions:()=>E,GLTFLoaderState:()=>v,GLTFValidation:()=>T});var h=a(322),m=a(597);function _(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 y(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":_(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 g,b,v,T=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(_,"(").concat(y,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),u=new Worker(l),c=function(e){u.removeEventListener("error",c),u.removeEventListener("message",f),i(e)},f=function(e){var t=e.data;switch(t.id){case"getExternalResource":r(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",f),a(t.value),u.terminate();break;case"validate.reject":u.removeEventListener("error",c),u.removeEventListener("message",f),i(t.reason),u.terminate()}};if(u.addEventListener("error",c),u.addEventListener("message",f),u.postMessage({id:"init",url:m.Tools.GetBabylonScriptURL(o.Configuration.url)}),ArrayBuffer.isView(e)){var d=e.slice();u.postMessage({id:"validate",data:d,rootUrl:t,fileName:n},[d.buffer])}else u.postMessage({id:"validate",data:e,rootUrl:t,fileName:n})})):(this._LoadScriptPromise||(this._LoadScriptPromise=m.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return _(e,t,n,r)})))},e.Configuration={url:"".concat(m.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),x="Z2xURg",A="gltf",O={".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"}(g||(g={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(b||(b={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(v||(v={}));var C=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=b.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=g.AUTO,this.createInstances=!0,this.loadAllMaterials=!1,this.loadMorphTargets=!0,this.loadNodeAnimations=!0,this.loadOnlyMaterials=!1,this.loadSkins=!0,this.skipMaterials=!1,this.targetFps=60,this.transparencyAsCoverage=!1,this.useClipPlane=!1,this.useGltfTextureNames=!1,this.useRangeRequests=!1,this.useSRGBBuffers=!0,this.validate=!1,this.useOpenPBR=!1},E=new C,M=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new m.Observable,n.onMeshLoadedObservable=new m.Observable,n.onSkinLoadedObservable=new m.Observable,n.onTextureLoadedObservable=new m.Observable,n.onMaterialLoadedObservable=new m.Observable,n.onCameraLoadedObservable=new m.Observable,n.onCompleteObservable=new m.Observable,n.onErrorObservable=new m.Observable,n.onDisposeObservable=new m.Observable,n.onExtensionLoadedObservable=new m.Observable,n.onValidatedObservable=new m.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=A,n.extensions=O,n.onLoaderStateChangedObservable=new m.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(Object.assign((0,h.Cl)({},E),t)),n}return(0,h.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,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 u=t.name||m.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&m.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new m.Observable},f={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 m.DataReader(f)).then((function(e){c.onCompleteObservable.notifyObservers(c),r(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 m.DataReader({readAsync:function(e,n){return w(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,u),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 m.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 m.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,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,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,m.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new m.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[A])},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(v[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"),T.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"),m.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 m.RuntimeError("Unexpected magic: "+n,m.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||m.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);m.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){m.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){m.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.extensionOptions={},t.preprocessUrlAsync=function(e){return Promise.resolve(e)},t}return(0,h.C6)(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,d,p,h,m,_,y,g,b,v,T,x,A,O,w;e&&(this.alwaysComputeBoundingBox=null!==(t=e.alwaysComputeBoundingBox)&&void 0!==t?t:this.alwaysComputeBoundingBox,this.alwaysComputeSkeletonRootNode=null!==(n=e.alwaysComputeSkeletonRootNode)&&void 0!==n?n:this.alwaysComputeSkeletonRootNode,this.animationStartMode=null!==(r=e.animationStartMode)&&void 0!==r?r:this.animationStartMode,this.capturePerformanceCounters=null!==(o=e.capturePerformanceCounters)&&void 0!==o?o:this.capturePerformanceCounters,this.compileMaterials=null!==(a=e.compileMaterials)&&void 0!==a?a:this.compileMaterials,this.compileShadowGenerators=null!==(i=e.compileShadowGenerators)&&void 0!==i?i:this.compileShadowGenerators,this.coordinateSystemMode=null!==(s=e.coordinateSystemMode)&&void 0!==s?s:this.coordinateSystemMode,this.createInstances=null!==(l=e.createInstances)&&void 0!==l?l:this.createInstances,this.customRootNode=e.customRootNode,this.extensionOptions=null!==(u=e.extensionOptions)&&void 0!==u?u:this.extensionOptions,this.loadAllMaterials=null!==(c=e.loadAllMaterials)&&void 0!==c?c:this.loadAllMaterials,this.loadMorphTargets=null!==(f=e.loadMorphTargets)&&void 0!==f?f:this.loadMorphTargets,this.loadNodeAnimations=null!==(d=e.loadNodeAnimations)&&void 0!==d?d:this.loadNodeAnimations,this.loadOnlyMaterials=null!==(p=e.loadOnlyMaterials)&&void 0!==p?p:this.loadOnlyMaterials,this.loadSkins=null!==(h=e.loadSkins)&&void 0!==h?h:this.loadSkins,this.loggingEnabled=null!==(m=e.loggingEnabled)&&void 0!==m?m:this.loggingEnabled,this.onCameraLoaded=e.onCameraLoaded,this.onMaterialLoaded=e.onMaterialLoaded,this.onMeshLoaded=e.onMeshLoaded,this.onParsed=e.onParsed,this.onSkinLoaded=e.onSkinLoaded,this.onTextureLoaded=e.onTextureLoaded,this.onValidated=e.onValidated,this.preprocessUrlAsync=null!==(_=e.preprocessUrlAsync)&&void 0!==_?_:this.preprocessUrlAsync,this.skipMaterials=null!==(y=e.skipMaterials)&&void 0!==y?y:this.skipMaterials,this.targetFps=null!==(g=e.targetFps)&&void 0!==g?g:this.targetFps,this.transparencyAsCoverage=null!==(b=e.transparencyAsCoverage)&&void 0!==b?b:this.transparencyAsCoverage,this.useClipPlane=null!==(v=e.useClipPlane)&&void 0!==v?v:this.useClipPlane,this.useGltfTextureNames=null!==(T=e.useGltfTextureNames)&&void 0!==T?T:this.useGltfTextureNames,this.useOpenPBR=null!==(x=e.useOpenPBR)&&void 0!==x?x:this.useOpenPBR,this.useRangeRequests=null!==(A=e.useRangeRequests)&&void 0!==A?A:this.useRangeRequests,this.useSRGBBuffers=null!==(O=e.useSRGBBuffers)&&void 0!==O?O:this.useSRGBBuffers,this.validate=null!==(w=e.validate)&&void 0!==w?w:this.validate)},t}(C));(0,m.RegisterSceneLoaderPlugin)(new M);var R,L,P,N,F,I,S,k,B=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==B){for(var G in B.BABYLON=B.BABYLON||{},l)B.BABYLON[G]=l[G];for(var G in s)B.BABYLON[G]=s[G]}!function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.FLOAT=5126]="FLOAT"}(R||(R={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(L||(L={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"}(P||(P={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(N||(N={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9728]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(F||(F={})),function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA"}(I||(I={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(S||(S={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"}(k||(k={}));var V,D=function(){function e(){}return e.SetMatrix=function(e,t,n,r,o){var a=null;if("MODEL"===n.semantic?a=t.getWorldMatrix():"PROJECTION"===n.semantic?a=e.getProjectionMatrix():"VIEW"===n.semantic?a=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===n.semantic?a=m.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===n.semantic?a=t.getWorldMatrix().invert():"VIEWINVERSE"===n.semantic?a=e.getViewMatrix().invert():"PROJECTIONINVERSE"===n.semantic?a=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===n.semantic&&(a=m.Matrix.Transpose(t.getWorldMatrix().invert())),a)switch(n.type){case P.FLOAT_MAT2:o.setMatrix2x2(r,m.Matrix.GetAsMatrix2x2(a));break;case P.FLOAT_MAT3:o.setMatrix3x3(r,m.Matrix.GetAsMatrix3x3(a));break;case P.FLOAT_MAT4:o.setMatrix(r,a)}},e.SetUniform=function(e,t,n,r){switch(r){case P.FLOAT:return e.setFloat(t,n),!0;case P.FLOAT_VEC2:return e.setVector2(t,m.Vector2.FromArray(n)),!0;case P.FLOAT_VEC3:return e.setVector3(t,m.Vector3.FromArray(n)),!0;case P.FLOAT_VEC4:return e.setVector4(t,m.Vector4.FromArray(n)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case N.CLAMP_TO_EDGE:return m.Texture.CLAMP_ADDRESSMODE;case N.MIRRORED_REPEAT:return m.Texture.MIRROR_ADDRESSMODE;case N.REPEAT:default:return m.Texture.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case F.LINEAR:case F.LINEAR_MIPMAP_NEAREST:case F.LINEAR_MIPMAP_LINEAR:return m.Texture.TRILINEAR_SAMPLINGMODE;case F.NEAREST:case F.NEAREST_MIPMAP_NEAREST:return m.Texture.NEAREST_SAMPLINGMODE;default:return m.Texture.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,n,r,o){n=t.byteOffset+n;var a=e.loadedBufferViews[t.buffer];if(n+r>a.byteLength)throw new Error("Buffer access is out of range");var i=a.buffer;switch(n+=a.byteOffset,o){case R.BYTE:return new Int8Array(i,n,r);case R.UNSIGNED_BYTE:return new Uint8Array(i,n,r);case R.SHORT:return new Int16Array(i,n,r);case R.UNSIGNED_SHORT:return new Uint16Array(i,n,r);default:return new Float32Array(i,n,r)}},e.GetBufferFromAccessor=function(t,n){var r=t.bufferViews[n.bufferView],o=n.count*e.GetByteStrideFromType(n);return e.GetBufferFromBufferView(t,r,n.byteOffset,o,n.componentType)},e.DecodeBufferToText=function(e){for(var t="",n=e.byteLength,r=0;r<n;++r)t+=String.fromCharCode(e[r]);return t},e.GetDefaultMaterial=function(t){if(!e._DefaultMaterial){m.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{"," gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),m.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var n={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new m.ShaderMaterial("GLTFDefaultMaterial",t,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},n),e._DefaultMaterial.setColor4("u_emission",new m.Color4(.5,.5,.5,1))}return e._DefaultMaterial},e._DefaultMaterial=null,e}();!function(e){e[e.IDENTIFIER=1]="IDENTIFIER",e[e.UNKNOWN=2]="UNKNOWN",e[e.END_OF_INPUT=3]="END_OF_INPUT"}(V||(V={}));var H=function(){function e(e){this._pos=0,this.currentToken=V.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}return e.prototype.getNextToken=function(){if(this.isEnd())return V.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=V.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=V.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},e.prototype.peek=function(){return this._toParse[this._pos]},e.prototype.read=function(){return this._toParse[this._pos++]},e.prototype.forward=function(){this._pos++},e.prototype.isEnd=function(){return this._pos>=this._maxPos},e}(),U=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],j=["world","view","projection","worldView","worldViewProjection","mBones"],K=["translation","rotation","scale"],W=["position","rotationQuaternion","scaling"],z=function(e,t,n){for(var r in e){var o=e[r];n[t][r]=o}},Z=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},Y=function(e){if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){var t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},q=function(e){var t=null;if(e.translation||e.rotation||e.scale){var n=m.Vector3.FromArray(e.scale||[1,1,1]),r=m.Quaternion.FromArray(e.rotation||[0,0,0,1]),o=m.Vector3.FromArray(e.translation||[0,0,0]);t=m.Matrix.Compose(n,r,o)}else t=m.Matrix.FromArray(e.matrix);return t},Q=function(e,t,n,r){for(var o=0;o<r.bones.length;o++)if(r.bones[o].name===n)return r.bones[o];var a=e.nodes;for(var i in a){var s=a[i];if(s.jointName){var l=s.children;for(o=0;o<l.length;o++){var u=e.nodes[l[o]];if(u.jointName&&u.jointName===n){var c=q(s),f=new m.Bone(s.name||"",r,Q(e,t,s.jointName,r),c);return f.id=i,f}}}}return null},X=function(e,t){for(var n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.node.children.length;o++)if(r.node.children[o]===t)return r.bone;return null},J=function(e,t){var n=e.nodes,r=n[t];if(r)return{node:r,id:t};for(var o in n)if((r=n[o]).jointName===t)return{node:r,id:o};return null},$=function(e,t){for(var n=0;n<e.jointNames.length;n++)if(e.jointNames[n]===t)return!0;return!1},ee=function(e,t,n,r,o){if(o||(e.scene._blockEntityCollection=!!e.assetContainer,(o=new m.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,o.id=r),!t.babylonNode)return o;for(var a,i=[],s=null,l=[],u=[],c=[],f=[],d=0;d<n.length;d++){var p=n[d];if(L=e.meshes[p])for(var h=0;h<L.primitives.length;h++){var _=new m.VertexData,y=L.primitives[h];y.mode;var g=y.attributes,b=null,v=null;for(var T in g)if(b=e.accessors[g[T]],v=D.GetBufferFromAccessor(e,b),"NORMAL"===T)_.normals=new Float32Array(v.length),_.normals.set(v);else if("POSITION"===T){if(M.HomogeneousCoordinates){_.positions=new Float32Array(v.length-v.length/4);for(var x=0;x<v.length;x+=4)_.positions[x]=v[x],_.positions[x+1]=v[x+1],_.positions[x+2]=v[x+2]}else _.positions=new Float32Array(v.length),_.positions.set(v);u.push(_.positions.length)}else if(-1!==T.indexOf("TEXCOORD_")){var A=Number(T.split("_")[1]),O=m.VertexBuffer.UVKind+(0===A?"":A+1),w=new Float32Array(v.length);w.set(v),Z(w),_.set(w,O)}else"JOINT"===T?(_.matricesIndices=new Float32Array(v.length),_.matricesIndices.set(v)):"WEIGHT"===T?(_.matricesWeights=new Float32Array(v.length),_.matricesWeights.set(v)):"COLOR"===T&&(_.colors=new Float32Array(v.length),_.colors.set(v));if(b=e.accessors[y.indices])v=D.GetBufferFromAccessor(e,b),_.indices=new Int32Array(v.length),_.indices.set(v),f.push(_.indices.length);else{var C=[];for(x=0;x<_.positions.length/3;x++)C.push(x);_.indices=new Int32Array(C),f.push(_.indices.length)}s?s.merge(_):s=_;var E=e.scene.getMaterialById(y.material);i.push(null===E?D.GetDefaultMaterial(e.scene):E),l.push(0===l.length?0:l[l.length-1]+u[u.length-2]),c.push(0===c.length?0:c[c.length-1]+f[f.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,i.length>1?(a=new m.MultiMaterial("multimat"+r,e.scene)).subMaterials=i:a=new m.StandardMaterial("multimat"+r,e.scene),1===i.length&&(a=i[0]),a._parentContainer=e.assetContainer,o.material||(o.material=a),new m.Geometry(r,e.scene,s,!1,o),o.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,o.subMeshes=[];var R=0;for(d=0;d<n.length;d++){var L;if(p=n[d],L=e.meshes[p])for(h=0;h<L.primitives.length;h++)L.primitives[h].mode,m.SubMesh.AddToMesh(R,l[R],u[R],c[R],f[R],o,o,!0),R++}return o},te=function(e,t,n,r){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=n),e.scaling&&(e.scaling=r)},ne=function(e,t,n){var r=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(a=ee(e,t,t.meshes,n,t.babylonNode)).skeleton=e.scene.getLastSkeletonById(t.skin),null===a.skeleton&&(a.skeleton=function(e,t,n,r){if(r||(r=new m.Skeleton(t.name||"","",e.scene)),!t.babylonSkeleton)return r;var o=[],a=[];!function(e,t,n,r){for(var o in e.nodes){var a=e.nodes[o],i=o;if(a.jointName&&!$(n,a.jointName)){var s=q(a),l=new m.Bone(a.name||"",t,null,s);l.id=i,r.push({bone:l,node:a,id:i})}}for(var u=0;u<r.length;u++)for(var c=r[u],f=c.node.children,d=0;d<f.length;d++){for(var p=null,h=0;h<r.length;h++)if(r[h].id===f[d]){p=r[h];break}p&&(p.bone._parent=c.bone,c.bone.children.push(p.bone))}}(e,r,t,o),r.bones=[];for(var i=0;i<t.jointNames.length;i++)if(v=J(e,t.jointNames[i])){var s=v.node;if(s){var l=v.id,u=e.scene.getBoneById(l);if(u)r.bones.push(u);else{for(var c=!1,f=null,d=0;d<i;d++){var p=J(e,t.jointNames[d]);if(p){var h=p.node;if(h){var _=h.children;if(_){c=!1;for(var y=0;y<_.length;y++)if(_[y]===l){f=Q(e,t,t.jointNames[d],r),c=!0;break}if(c)break}}else m.Tools.Warn("Joint named "+t.jointNames[d]+" does not exist when looking for parent")}}var g=q(s);!f&&o.length>0&&(f=X(o,l))&&-1===a.indexOf(f)&&a.push(f),new m.Bone(s.jointName||"",r,f,g).id=l}}else m.Tools.Warn("Joint named "+t.jointNames[i]+" does not exist")}var b=r.bones;for(r.bones=[],i=0;i<t.jointNames.length;i++){var v;if(v=J(e,t.jointNames[i]))for(d=0;d<b.length;d++)if(b[d].id===v.id){r.bones.push(b[d]);break}}for(r.prepare(),i=0;i<a.length;i++)r.bones.push(a[i]);return r}(e,o,0,o.babylonSkeleton),o.babylonSkeleton||(o.babylonSkeleton=a.skeleton)),r=a}}else if(t.meshes){var a;r=a=ee(e,t,t.mesh?[t.mesh]:t.meshes,n,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var i=e.cameras[t.camera];if(i){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===i.type){var s=new m.FreeCamera(t.camera,m.Vector3.Zero(),e.scene,!1);s.name=t.name||"",s.mode=m.Camera.ORTHOGRAPHIC_CAMERA,s.attachControl(),r=s,s._parentContainer=e.assetContainer}else if("perspective"===i.type){var l=i[i.type],u=new m.FreeCamera(t.camera,m.Vector3.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),l.aspectRatio||(l.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),l.znear&&l.zfar&&(u.maxZ=l.zfar,u.minZ=l.znear),r=u,u._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var c=e.lights[t.light];if(c)if("ambient"===c.type){var f=c[c.type],d=new m.HemisphericLight(t.light,m.Vector3.Zero(),e.scene);d.name=t.name||"",f.color&&(d.diffuse=m.Color3.FromArray(f.color)),r=d}else if("directional"===c.type){var p=c[c.type],h=new m.DirectionalLight(t.light,m.Vector3.Zero(),e.scene);h.name=t.name||"",p.color&&(h.diffuse=m.Color3.FromArray(p.color)),r=h}else if("point"===c.type){var _=c[c.type],y=new m.PointLight(t.light,m.Vector3.Zero(),e.scene);y.name=t.name||"",_.color&&(y.diffuse=m.Color3.FromArray(_.color)),r=y}else if("spot"===c.type){var g=c[c.type],b=new m.SpotLight(t.light,m.Vector3.Zero(),m.Vector3.Zero(),0,0,e.scene);b.name=t.name||"",g.color&&(b.diffuse=m.Color3.FromArray(g.color)),g.fallOfAngle&&(b.angle=g.fallOfAngle),g.fallOffExponent&&(b.exponent=g.fallOffExponent),r=b}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===r){e.scene._blockEntityCollection=!!e.assetContainer;var v=new m.Mesh(t.name||"",e.scene);v._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,t.babylonNode=v,r=v}}if(null!==r){if(t.matrix&&r instanceof m.Mesh)!function(e,t){if(t.matrix){var n=new m.Vector3(0,0,0),r=new m.Quaternion,o=new m.Vector3(0,0,0);m.Matrix.FromArray(t.matrix).decompose(o,r,n),te(e,n,r,o)}else t.translation&&t.rotation&&t.scale&&te(e,m.Vector3.FromArray(t.translation),m.Quaternion.FromArray(t.rotation),m.Vector3.FromArray(t.scale));e.computeWorldMatrix(!0)}(r,t);else{var T=t.translation||[0,0,0],x=t.rotation||[0,0,0,1],A=t.scale||[1,1,1];te(r,m.Vector3.FromArray(T),m.Quaternion.FromArray(x),m.Vector3.FromArray(A))}r.updateCache(!0),t.babylonNode=r}return r},re=function(e,t,n,r){void 0===r&&(r=!1);var o=e.nodes[t],a=null;if(r=!(e.importOnlyMeshes&&!r&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&r&&null!==(a=ne(e,o,t))&&(a.id=t,a.parent=n),o.children)for(var i=0;i<o.children.length;i++)re(e,o.children[i],a,r)},oe=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null);for(function(e){for(var t in e.animations){var n=e.animations[t];if(n.channels&&n.samplers)for(var r=null,o=0;o<n.channels.length;o++){var a=n.channels[o],i=n.samplers[a.sampler];if(i){var s=null,l=null;n.parameters?(s=n.parameters[i.input],l=n.parameters[i.output]):(s=i.input,l=i.output);var u=D.GetBufferFromAccessor(e,e.accessors[s]),c=D.GetBufferFromAccessor(e,e.accessors[l]),f=a.target.id,d=e.scene.getNodeById(f);if(null===d&&(d=e.scene.getNodeByName(f)),null!==d){var p=d instanceof m.Bone,h=a.target.path,_=K.indexOf(h);-1!==_&&(h=W[_]);var y=m.Animation.ANIMATIONTYPE_MATRIX;p||("rotationQuaternion"===h?(y=m.Animation.ANIMATIONTYPE_QUATERNION,d.rotationQuaternion=new m.Quaternion):y=m.Animation.ANIMATIONTYPE_VECTOR3);var g=null,b=[],v=0,T=!1;p&&r&&r.getKeys().length===u.length&&(g=r,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,g=new m.Animation(t,p?"_matrix":h,1,y,m.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var x=0;x<u.length;x++){var A=null;if("rotationQuaternion"===h?(A=m.Quaternion.FromArray([c[v],c[v+1],c[v+2],c[v+3]]),v+=4):(A=m.Vector3.FromArray([c[v],c[v+1],c[v+2]]),v+=3),p){var O=d,w=m.Vector3.Zero(),C=new m.Quaternion,E=m.Vector3.Zero(),M=O.getBaseMatrix();T&&r&&(M=r.getKeys()[x].value),M.decompose(E,C,w),"position"===h?w=A:"rotationQuaternion"===h?C=A:E=A,A=m.Matrix.Compose(E,C,w)}T?r&&(r.getKeys()[x].value=A):b.push({frame:u[x],value:A})}!T&&g&&(g.setKeys(b),d.animations.push(g)),r=g,e.scene.stopAnimation(d),e.scene.beginAnimation(d,0,u[u.length-1],!0,1)}else m.Tools.Warn("Creating animation named "+t+". But cannot find node named "+f+" to attach to")}}}}(e),n=0;n<e.scene.skeletons.length;n++){var o=e.scene.skeletons[n];e.scene.beginAnimation(o,0,Number.MAX_VALUE,!0,1)}},ae=function(e,t,n){for(var r in t.uniforms){var o=t.uniforms[r],a=t.parameters[o];if(e.currentIdentifier===r&&a.semantic&&!a.source&&!a.node){var i=U.indexOf(a.semantic);if(-1!==i)return delete n[r],j[i]}}return e.currentIdentifier},ie=function(e){for(var t in e.materials)ue.LoadMaterialAsync(e,t,(function(){}),(function(){}))},se=function(){function e(){}return e.CreateRuntime=function(e,t,n){var r={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:n,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&z(e.extensions,"extensions",r),e.extensionsUsed&&z(e.extensionsUsed,"extensionsUsed",r),e.buffers&&function(e,t){for(var n in e){var r=e[n];t.buffers[n]=r,t.buffersCount++}}(e.buffers,r),e.bufferViews&&z(e.bufferViews,"bufferViews",r),e.accessors&&z(e.accessors,"accessors",r),e.meshes&&z(e.meshes,"meshes",r),e.lights&&z(e.lights,"lights",r),e.cameras&&z(e.cameras,"cameras",r),e.nodes&&z(e.nodes,"nodes",r),e.images&&z(e.images,"images",r),e.textures&&z(e.textures,"textures",r),e.shaders&&function(e,t){for(var n in e){var r=e[n];t.shaders[n]=r,t.shaderscount++}}(e.shaders,r),e.programs&&z(e.programs,"programs",r),e.samplers&&z(e.samplers,"samplers",r),e.techniques&&z(e.techniques,"techniques",r),e.materials&&z(e.materials,"materials",r),e.animations&&z(e.animations,"animations",r),e.skins&&z(e.skins,"skins",r),e.scenes&&(r.scenes=e.scenes),e.scene&&e.scenes&&(r.currentScene=e.scenes[e.scene]),r},e.LoadBufferAsync=function(e,t,n,r,o){var a=e.buffers[t];m.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(m.Tools.DecodeBase64(a.uri)))})):m.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),o,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))},e.LoadTextureBufferAsync=function(e,t,n,r){var o=e.textures[t];if(o&&o.source)if(o.babylonTexture)n(null);else{var a=e.images[o.source];m.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(m.Tools.DecodeBase64(a.uri)))})):m.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))}else r("")},e.CreateTextureAsync=function(e,t,n,r){var o=e.textures[t];if(o.babylonTexture)r(o.babylonTexture);else{var a=e.samplers[o.sampler],i=a.minFilter===F.NEAREST_MIPMAP_NEAREST||a.minFilter===F.NEAREST_MIPMAP_LINEAR||a.minFilter===F.LINEAR_MIPMAP_NEAREST||a.minFilter===F.LINEAR_MIPMAP_LINEAR,s=m.Texture.BILINEAR_SAMPLINGMODE,l=null==n?new Blob:new Blob([n]),u=URL.createObjectURL(l),c=function(){return URL.revokeObjectURL(u)},f=new m.Texture(u,e.scene,!i,!0,s,c,c);void 0!==a.wrapS&&(f.wrapU=D.GetWrapMode(a.wrapS)),void 0!==a.wrapT&&(f.wrapV=D.GetWrapMode(a.wrapT)),f.name=t,o.babylonTexture=f,r(f)}},e.LoadShaderStringAsync=function(e,t,n,r){var o=e.shaders[t];if(m.Tools.IsBase64(o.uri)){var a=atob(o.uri.split(",")[1]);n&&n(a)}else m.Tools.LoadFile(e.rootUrl+o.uri,n,void 0,void 0,!1,(function(e){e&&r&&r(e.status+" "+e.statusText)}))},e.LoadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(o.technique){var a=e.techniques[o.technique];if(!a){e.scene._blockEntityCollection=!!e.assetContainer;var i=new m.StandardMaterial(t,e.scene);return i._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,i.diffuseColor=new m.Color3(.5,.5,.5),i.sideOrientation=m.Material.CounterClockWiseSideOrientation,void n(i)}var s=e.programs[a.program],l=a.states,u=m.Effect.ShadersStore[s.vertexShader+"VertexShader"],c=m.Effect.ShadersStore[s.fragmentShader+"PixelShader"],f="",d="",p=new H(u),h=new H(c),_={},y=[],g=[],b=[];for(var v in a.uniforms){var T=a.uniforms[v],x=a.parameters[T];if(_[v]=x,!x.semantic||x.node||x.source)x.type===P.SAMPLER_2D?b.push(v):y.push(v);else{var A=U.indexOf(x.semantic);-1!==A?(y.push(j[A]),delete _[v]):y.push(v)}}for(var O in a.attributes){var w=a.attributes[O];if((M=a.parameters[w]).semantic){var C=Y(M);C&&g.push(C)}}for(;!p.isEnd()&&p.getNextToken();)if(p.currentToken===V.IDENTIFIER){var E=!1;for(var O in a.attributes){w=a.attributes[O];var M=a.parameters[w];if(p.currentIdentifier===O&&M.semantic){f+=Y(M),E=!0;break}}E||(f+=ae(p,a,_))}else f+=p.currentString;for(;!h.isEnd()&&h.getNextToken();)h.currentToken===V.IDENTIFIER?d+=ae(h,a,_):d+=h.currentString;var R={vertex:s.vertexShader+t,fragment:s.fragmentShader+t},L={attributes:g,uniforms:y,samplers:b,needAlphaBlending:l&&l.enable&&-1!==l.enable.indexOf(3042)};m.Effect.ShadersStore[s.vertexShader+t+"VertexShader"]=f,m.Effect.ShadersStore[s.fragmentShader+t+"PixelShader"]=d;var N=new m.ShaderMaterial(t,e.scene,R,L);if(N.onError=function(e,t,n){return function(r,o){t.dispose(!0),n("Cannot compile program named "+e.name+". Error: "+o+". Default material will be applied")}}(s,N,r),N.onCompiled=function(e,t,n,r,o,a){return function(i){!function(e,t,n,r,o){var a=r.values||n.parameters,i=n.uniforms,s=function(n){var s=o[n],l=s.type,u=a[i[n]];if(void 0===u&&(u=s.value),!u)return"continue";var c=function(e){return function(n){s.value&&e&&(t.setTexture(e,n),delete o[e])}};l===P.SAMPLER_2D?ue.LoadTextureAsync(e,r.values?u:s.value,c(n),(function(){return c(null)})):s.value&&D.SetUniform(t,n,r.values?u:s.value,l)&&delete o[n]};for(var l in o)s(l)}(e,t,n,r,o),t.onBind=function(i){!function(e,t,n,r,o,a,i){var s=a.values||o.parameters;for(var l in n){var u=n[l],c=u.type;if(c===P.FLOAT_MAT2||c===P.FLOAT_MAT3||c===P.FLOAT_MAT4)if(!u.semantic||u.source||u.node){if(u.semantic&&(u.source||u.node)){var f=t.scene.getNodeByName(u.source||u.node||"");if(null===f&&(f=t.scene.getNodeById(u.source||u.node||"")),null===f)continue;D.SetMatrix(t.scene,f,u,l,r.getEffect())}}else D.SetMatrix(t.scene,e,u,l,r.getEffect());else{var d=s[o.uniforms[l]];if(!d)continue;if(c===P.SAMPLER_2D){var p=t.textures[a.values?d:u.value].babylonTexture;if(null==p)continue;r.getEffect().setTexture(l,p)}else D.SetUniform(r.getEffect(),l,d,c)}}i(r)}(i,e,o,t,n,r,a)}}}(e,N,a,o,_,n),N.sideOrientation=m.Material.CounterClockWiseSideOrientation,l&&l.functions){var F=l.functions;F.cullFace&&F.cullFace[0]!==S.BACK&&(N.backFaceCulling=!1);var I=F.blendFuncSeparate;I&&(I[0]===k.SRC_ALPHA&&I[1]===k.ONE_MINUS_SRC_ALPHA&&I[2]===k.ONE&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_COMBINE:I[0]===k.ONE&&I[1]===k.ONE&&I[2]===k.ZERO&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_ONEONE:I[0]===k.SRC_ALPHA&&I[1]===k.ONE&&I[2]===k.ZERO&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_ADD:I[0]===k.ZERO&&I[1]===k.ONE_MINUS_SRC_COLOR&&I[2]===k.ONE&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_SUBTRACT:I[0]===k.DST_COLOR&&I[1]===k.ZERO&&I[2]===k.ONE&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_MULTIPLY:I[0]===k.SRC_ALPHA&&I[1]===k.ONE_MINUS_SRC_COLOR&&I[2]===k.ONE&&I[3]===k.ONE&&(N.alphaMode=m.Constants.ALPHA_MAXIMIZED))}}else r&&r("No technique found.")},e}(),le=function(){function e(){}return e.RegisterExtension=function(t){e.Extensions[t.name]?m.Tools.Error('Tool with the same name "'+t.name+'" already exists'):e.Extensions[t.name]=t},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,t,n,r,o,a,i,s){var l=this;return t.useRightHandedSystem=!0,ue.LoadRuntimeAsync(t,n,r,(function(t){t.assetContainer=o,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],m.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],l._createNodes(t);var n=[],r=[];for(var i in t.nodes){var s=t.nodes[i];s.babylonNode instanceof m.AbstractMesh&&n.push(s.babylonNode)}for(var u in t.skins){var c=t.skins[u];c.babylonSkeleton instanceof m.Skeleton&&r.push(c.babylonSkeleton)}l._loadBuffersAsync(t,(function(){l._loadShadersAsync(t,(function(){ie(t),oe(t),!M.IncrementalLoading&&a&&a(n,r)}))})),M.IncrementalLoading&&a&&a(n,r)}),s),!0},e.prototype.importMeshAsync=function(e,t,n,r,o,a){var i=this;return new Promise((function(s,l){i._importMeshAsync(e,t,r,o,n,(function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[],spriteManagers:[]})}),a,(function(e){l(new Error(e))}))}))},e.prototype._loadAsync=function(e,t,n,r,o,a){var i=this;e.useRightHandedSystem=!0,ue.LoadRuntimeAsync(e,t,n,(function(e){ue.LoadRuntimeExtensionsAsync(e,(function(){i._createNodes(e),i._loadBuffersAsync(e,(function(){i._loadShadersAsync(e,(function(){ie(e),oe(e),M.IncrementalLoading||r()}))})),M.IncrementalLoading&&r()}),a)}),a)},e.prototype.loadAsync=function(e,t,n,r){return(0,h.sH)(this,void 0,void 0,(function(){var o=this;return(0,h.YH)(this,(function(a){switch(a.label){case 0:return[4,new Promise((function(a,i){o._loadAsync(e,t,n,(function(){a()}),r,(function(e){i(new Error(e))}))}))];case 1:return[2,a.sent()]}}))}))},e.prototype._loadShadersAsync=function(e,t){var n=!1,r=function(n,r){ue.LoadShaderStringAsync(e,n,(function(o){o instanceof ArrayBuffer||(e.loadedShaderCount++,o&&(m.Effect.ShadersStore[n+(r.type===L.VERTEX?"VertexShader":"PixelShader")]=o),e.loadedShaderCount===e.shaderscount&&t())}),(function(){m.Tools.Error("Error when loading shader program named "+n+" located at "+r.uri)}))};for(var o in e.shaders){n=!0;var a=e.shaders[o];a?r.bind(this,o,a)():m.Tools.Error("No shader named: "+o)}n||t()},e.prototype._loadBuffersAsync=function(e,t){var n=!1,r=function(n,r){ue.LoadBufferAsync(e,n,(function(o){e.loadedBufferCount++,o&&(o.byteLength!=e.buffers[n].byteLength&&m.Tools.Error("Buffer named "+n+" is length "+o.byteLength+". Expected: "+r.byteLength),e.loadedBufferViews[n]=o),e.loadedBufferCount===e.buffersCount&&t()}),(function(){m.Tools.Error("Error when loading buffer named "+n+" located at "+r.uri)}))};for(var o in e.buffers){n=!0;var a=e.buffers[o];a?r.bind(this,o,a)():m.Tools.Error("No buffer named: "+o)}n||t()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null)},e.Extensions={},e}(),ue=function(){function e(e){this._name=e}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),e.prototype.loadRuntimeAsync=function(e,t,n,r,o){return!1},e.prototype.loadRuntimeExtensionsAsync=function(e,t,n){return!1},e.prototype.loadBufferAsync=function(e,t,n,r,o){return!1},e.prototype.loadTextureBufferAsync=function(e,t,n,r){return!1},e.prototype.createTextureAsync=function(e,t,n,r,o){return!1},e.prototype.loadShaderStringAsync=function(e,t,n,r){return!1},e.prototype.loadMaterialAsync=function(e,t,n,r){return!1},e.LoadRuntimeAsync=function(t,n,r,o,a){e._ApplyExtensions((function(e){return e.loadRuntimeAsync(t,n,r,o,a)}),(function(){setTimeout((function(){o&&o(se.CreateRuntime(n.json,t,r))}))}))},e.LoadRuntimeExtensionsAsync=function(t,n,r){e._ApplyExtensions((function(e){return e.loadRuntimeExtensionsAsync(t,n,r)}),(function(){setTimeout((function(){n()}))}))},e.LoadBufferAsync=function(t,n,r,o,a){e._ApplyExtensions((function(e){return e.loadBufferAsync(t,n,r,o,a)}),(function(){se.LoadBufferAsync(t,n,r,o,a)}))},e.LoadTextureAsync=function(t,n,r,o){e._LoadTextureBufferAsync(t,n,(function(a){a&&e._CreateTextureAsync(t,n,a,r,o)}),o)},e.LoadShaderStringAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadShaderStringAsync(t,n,r,o)}),(function(){se.LoadShaderStringAsync(t,n,r,o)}))},e.LoadMaterialAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadMaterialAsync(t,n,r,o)}),(function(){se.LoadMaterialAsync(t,n,r,o)}))},e._LoadTextureBufferAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadTextureBufferAsync(t,n,r,o)}),(function(){se.LoadTextureBufferAsync(t,n,r,o)}))},e._CreateTextureAsync=function(t,n,r,o,a){e._ApplyExtensions((function(e){return e.createTextureAsync(t,n,r,o,a)}),(function(){se.CreateTextureAsync(t,n,r,o)}))},e._ApplyExtensions=function(e,t){for(var n in le.Extensions)if(e(le.Extensions[n]))return;t()},e}();M._CreateGLTF1Loader=function(){return new le};var ce=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return(0,h.C6)(t,e),t.prototype.loadRuntimeAsync=function(e,t,n,r){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,r(se.CreateRuntime(t.json,e,n)),0))},t.prototype.loadBufferAsync=function(e,t,n,r){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(n,(function(e){return r(e.message)})),!0)},t.prototype.loadTextureBufferAsync=function(e,t,n){var r=e.textures[t],o=e.images[r.source];if(!o.extensions||!(this.name in o.extensions))return!1;var a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return n(D.GetBufferFromBufferView(e,i,0,i.byteLength,R.UNSIGNED_BYTE)),!0},t.prototype.loadShaderStringAsync=function(e,t,n){var r=e.shaders[t];if(!r.extensions||!(this.name in r.extensions))return!1;var o=r.extensions[this.name],a=e.bufferViews[o.bufferView],i=D.GetBufferFromBufferView(e,a,0,a.byteLength,R.UNSIGNED_BYTE);return setTimeout((function(){var e=D.DecodeBufferToText(i);n(e)})),!0},t}(ue);le.RegisterExtension(new ce);var fe=function(e){function t(){return e.call(this,"KHR_materials_common")||this}return(0,h.C6)(t,e),t.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var t=e.extensions[this.name];if(!t)return!1;var n=t.lights;if(n)for(var r in n){var o=n[r];switch(o.type){case"ambient":var a=new m.HemisphericLight(o.name,new m.Vector3(0,1,0),e.scene),i=o.ambient;i&&(a.diffuse=m.Color3.FromArray(i.color||[1,1,1]));break;case"point":var s=new m.PointLight(o.name,new m.Vector3(10,10,10),e.scene),l=o.point;l&&(s.diffuse=m.Color3.FromArray(l.color||[1,1,1]));break;case"directional":var u=new m.DirectionalLight(o.name,new m.Vector3(0,-1,0),e.scene),c=o.directional;c&&(u.diffuse=m.Color3.FromArray(c.color||[1,1,1]));break;case"spot":var f=o.spot;f&&(new m.SpotLight(o.name,new m.Vector3(0,10,0),new m.Vector3(0,-1,0),f.fallOffAngle||Math.PI,f.fallOffExponent||0,e.scene).diffuse=m.Color3.FromArray(f.color||[1,1,1]));break;default:m.Tools.Warn('GLTF Material Common extension: light type "'+o.type+"” not supported")}}return!1},t.prototype.loadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(!o||!o.extensions)return!1;var a=o.extensions[this.name];if(!a)return!1;var i=new m.StandardMaterial(t,e.scene);return i.sideOrientation=m.Material.CounterClockWiseSideOrientation,"CONSTANT"===a.technique&&(i.disableLighting=!0),i.backFaceCulling=void 0!==a.doubleSided&&!a.doubleSided,i.alpha=void 0===a.values.transparency?1:a.values.transparency,i.specularPower=void 0===a.values.shininess?0:a.values.shininess,"string"==typeof a.values.ambient?this._loadTexture(e,a.values.ambient,i,"ambientTexture",r):i.ambientColor=m.Color3.FromArray(a.values.ambient||[0,0,0]),"string"==typeof a.values.diffuse?this._loadTexture(e,a.values.diffuse,i,"diffuseTexture",r):i.diffuseColor=m.Color3.FromArray(a.values.diffuse||[0,0,0]),"string"==typeof a.values.emission?this._loadTexture(e,a.values.emission,i,"emissiveTexture",r):i.emissiveColor=m.Color3.FromArray(a.values.emission||[0,0,0]),"string"==typeof a.values.specular?this._loadTexture(e,a.values.specular,i,"specularTexture",r):i.specularColor=m.Color3.FromArray(a.values.specular||[0,0,0]),!0},t.prototype._loadTexture=function(e,t,n,r,o){se.LoadTextureBufferAsync(e,t,(function(o){se.CreateTextureAsync(e,t,o,(function(e){return n[r]=e}))}),o)},t}(ue);le.RegisterExtension(new fe);var de=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==de)for(var pe in de.BABYLON=de.BABYLON||{},de.BABYLON.GLTF1=de.BABYLON.GLTF1||{},u)de.BABYLON.GLTF1[pe]=u[pe];var he=a(698),me=new Map,_e=me;function ye(e,t,n){ge(e)&&m.Logger.Warn("Extension with the name '".concat(e,"' already exists")),me.set(e,{isGLTFExtension:t,factory:n})}function ge(e){return me.delete(e)}var be=new m.Lazy((function(){return Promise.resolve().then(a.t.bind(a,597,23))})),ve=new m.Lazy((function(){return Promise.resolve().then(a.bind(a,727))})),Te=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 xe(e){if(e.min&&e.max){var t=e.min,n=e.max,r=m.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=m.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 m.BoundingInfo(r,o)}return null}var Ae=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._materialAdapterCache=new WeakMap,this._pbrMaterialImpl=null,this._parent=e}return e.RegisterExtension=function(e,t){ye(e,!1,t)},e.UnregisterExtension=function(e){return ge(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._getOrCreateMaterialAdapter=function(e){var t=this._materialAdapterCache.get(e);if(!t){if(!this._pbrMaterialImpl)throw new Error("Appropriate material adapter class not found");t=new this._pbrMaterialImpl.adapterClass(e),this._materialAdapterCache.set(e,t)}return t},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){return(0,h.sH)(this,arguments,void 0,(function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),(0,h.YH)(this,(function(a){switch(a.label){case 0:return[4,Promise.resolve().then((function(){return(0,h.sH)(s,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,h.YH)(this,(function(d){switch(d.label){case 0:if(this._babylonScene=t,this._assetContainer=n,this._loadData(r),a=null,e){if(s={},this._gltf.nodes)for(l=0,u=this._gltf.nodes;l<u.length;l++)(c=u[l]).name&&(s[c.name]=c.index);a=(e instanceof Array?e:[e]).map((function(e){var t=s[e];if(void 0===t)throw new Error("Failed to find node '".concat(e,"'"));return t}))}return[4,this._loadAsync(o,i,a,(function(){return{meshes:f._getMeshes(),particleSystems:[],skeletons:f._getSkeletons(),animationGroups:f._getAnimationGroups(),lights:f._babylonLights,transformNodes:f._getTransformNodes(),geometries:f._getGeometries(),spriteManagers:[]}}))];case 1:return[2,d.sent()]}}))}))}))];case 1:return[2,a.sent()]}}))}))},e.prototype.loadAsync=function(e,t,n,r){return(0,h.sH)(this,arguments,void 0,(function(e,t,n,r,o){return void 0===o&&(o=""),(0,h.YH)(this,(function(r){switch(r.label){case 0:return this._babylonScene=e,this._loadData(t),[4,this._loadAsync(n,o,null,(function(){}))];case 1:return[2,r.sent()]}}))}))},e.prototype._loadAsync=function(e,t,n,r){return(0,h.sH)(this,void 0,void 0,(function(){var o=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return(0,h.sH)(o,void 0,void 0,(function(){var o,i,s,l,u,c,f,d,p,_,y,g,b,T,x=this;return(0,h.YH)(this,(function(h){switch(h.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:return h.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(o=this,b={},[4,Promise.resolve().then(a.t.bind(a,597,23))]):[3,4];case 2:return b.materialClass=h.sent().OpenPBRMaterial,[4,Promise.resolve().then(a.bind(a,833))];case 3:return o._pbrMaterialImpl=(b.adapterClass=h.sent().OpenPBRMaterialLoadingAdapter,b),[3,7];case 4:return i=this,T={},[4,Promise.resolve().then(a.t.bind(a,597,23))];case 5:return T.materialClass=h.sent().PBRMaterial,[4,Promise.resolve().then(a.bind(a,561))];case 6:i._pbrMaterialImpl=(T.adapterClass=h.sent().PBRMaterialLoadingAdapter,T),h.label=7;case 7:if(s="".concat(v[v.LOADING]," => ").concat(v[v.READY]),l="".concat(v[v.LOADING]," => ").concat(v[v.COMPLETE]),this._parent._startPerformanceCounter(s),this._parent._startPerformanceCounter(l),this._parent._setState(v.LOADING),this._extensionsOnLoading(),u=new Array,c=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(n?u.push(this.loadSceneAsync("/nodes",{nodes:n,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(f=Te.Get("/scene",this._gltf.scenes,this._gltf.scene||0),u.push(this.loadSceneAsync("/scenes/".concat(f.index),f)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(d=0;d<this._gltf.materials.length;++d)p=this._gltf.materials[d],_="/materials/"+d,y=m.Material.TriangleFillMode,u.push(this._loadMaterialAsync(_,p,null,y,(function(){})));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=c:this._babylonScene._forceBlockMaterialDirtyMechanism(c),this._parent.compileMaterials&&u.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&u.push(this._compileShadowGeneratorsAsync()),g=Promise.all(u).then((function(){x._rootBabylonMesh&&x._rootBabylonMesh!==x._parent.customRootNode&&x._rootBabylonMesh.setEnabled(!0);for(var e=0,t=x._babylonScene.materials;e<t.length;e++){var n=t[e];void 0!==n.maxSimultaneousLights&&(n.maxSimultaneousLights=Math.max(n.maxSimultaneousLights,x._babylonScene.lights.length))}return x._extensionsOnReady(),x._parent._setState(v.READY),x._skipStartAnimationStep||x._startAnimations(),r()})),[4,g.then((function(e){return x._parent._endPerformanceCounter(s),m.Tools.SetImmediate((function(){x._disposed||Promise.all(x._completePromises).then((function(){x._parent._endPerformanceCounter(l),x._parent._setState(v.COMPLETE),x._parent.onCompleteObservable.notifyObservers(void 0),x._parent.onCompleteObservable.clear(),x.dispose()}),(function(e){x._parent.onErrorObservable.notifyObservers(e),x._parent.onErrorObservable.clear(),x.dispose()}))})),e}))];case 8:return[2,h.sent()]}}))}))})).catch((function(e){throw o._disposed||(o._parent.onErrorObservable.notifyObservers(e),o._parent.onErrorObservable.clear(),o.dispose()),e}))];case 1:return[2,i.sent()]}}))}))},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)&&m.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else m.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(Te.Assign(this._gltf.accessors),Te.Assign(this._gltf.animations),Te.Assign(this._gltf.buffers),Te.Assign(this._gltf.bufferViews),Te.Assign(this._gltf.cameras),Te.Assign(this._gltf.images),Te.Assign(this._gltf.materials),Te.Assign(this._gltf.meshes),Te.Assign(this._gltf.nodes),Te.Assign(this._gltf.samplers),Te.Assign(this._gltf.scenes),Te.Assign(this._gltf.skins),Te.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,u=e[(l=s[i]).index];l.parent=void 0===u?a:this._gltf.nodes[u]}}},e.prototype._loadExtensionsAsync=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a,i,s,l,u,c,f=this;return(0,h.YH)(this,(function(d){switch(d.label){case 0:return e=[],_e.forEach((function(t,n){var r;!1===(null===(r=f.parent.extensionOptions[n])||void 0===r?void 0:r.enabled)?t.isGLTFExtension&&f.isExtensionUsed(n)&&m.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!f.isExtensionUsed(n)||e.push((0,h.sH)(f,void 0,void 0,(function(){var e;return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,t.factory(this)];case 1:return(e=r.sent()).name!==n&&m.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,r=[u],[4,Promise.all(e)];case 1:if(n.apply(t,r.concat([d.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===(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],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 m.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 g.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case g.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=Te.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 u=0,c=this._postSceneLoadActions;u<c.length;u++)(0,c[u])();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 m.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 b.NONE:break;case b.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case b.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void m.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=Te.Get("".concat(t,"/camera"),o._gltf.cameras,n.camera);i.push(o.loadCameraAsync("/cameras/".concat(s.index),s,(function(e){e.parent=a,o._babylonScene.useRightHandedSystem||(a.scaling.x=-1)})))}if(n.children)for(var l=0,u=n.children;l<u.length;l++){var c=u[l],f=Te.Get("".concat(t,"/children/").concat(c),o._gltf.nodes,c);i.push(o.loadNodeAsync("/nodes/".concat(f.index),f,(function(e){e.parent=a})))}r(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 f=new m.TransformNode(c,this._babylonScene);f._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==n.mesh?n._babylonTransformNode=f:n._babylonTransformNodeForSkin=f,s(f)}if(l)if(u){var d=Te.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh);i.push(this._loadMeshAsync("/meshes/".concat(d.index),n,d,(function(e){var r=n._babylonTransformNodeForSkin;e.metadata=(0,m.deepMerge)(r.metadata,e.metadata||{});var a=Te.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=Te.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 d=Te.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh),i.push(this._loadMeshAsync("/meshes/".concat(d.index),n,d,s));return this.logClose(),Promise.all(i).then((function(){return o._forEachPrimitive(n,(function(e){var t=e;!t.isAnInstance&&t.geometry&&t.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&&Te.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 m.TransformNode(i,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(var l=0,u=o;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 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 u,c,f=0===this._disableInstancedMesh&&this._parent.createInstances&&null==r.skin&&!o.primitives[0].targets;if(f&&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 d=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var p=new m.Mesh(n,this._babylonScene);if(p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,p.sideOrientation=this._babylonScene.useRightHandedSystem?m.Material.CounterClockWiseSideOrientation:m.Material.ClockWiseSideOrientation,this._createMorphTargets(t,r,o,a,p),d.push(this._loadVertexDataAsync(t,a,p).then((function(e){return(0,h.sH)(s,void 0,void 0,(function(){var n=this;return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(t,a,p,e).then((function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,e.applyToMesh(p),e._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1)}))];case 1:return[2,r.sent()]}}))}))}))),!this.parent.skipMaterials){var _=e._GetDrawMode(t,a.mode);if(null==a.material){var y=this._defaultBabylonMaterialData[_];y||(y=this._createDefaultMaterial("__GLTFLoader._default",_),this._parent.onMaterialLoadedObservable.notifyObservers(y),this._defaultBabylonMaterialData[_]=y),p.material=y}else{var g=Te.Get("".concat(t,"/material"),this._gltf.materials,a.material);d.push(this._loadMaterialAsync("/materials/".concat(g.index),g,p,_,(function(e){p.material=e})))}}c=Promise.all(d),f&&(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 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 m.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=Te.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,o,l){if(null!=a[t]){n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o);var u=Te.Get("".concat(e,"/attributes/").concat(t),r._gltf.accessors,a[t]);i.push(r._loadVertexAccessorAsync("/accessors/".concat(u.index),u,o).then((function(e){if(e.getKind()===m.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=xe(u);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,u.count)}))),o==m.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(u)}};return u("POSITION",m.VertexBuffer.PositionKind),u("NORMAL",m.VertexBuffer.NormalKind),u("TANGENT",m.VertexBuffer.TangentKind),u("TEXCOORD_0",m.VertexBuffer.UVKind),u("TEXCOORD_1",m.VertexBuffer.UV2Kind),u("TEXCOORD_2",m.VertexBuffer.UV3Kind),u("TEXCOORD_3",m.VertexBuffer.UV4Kind),u("TEXCOORD_4",m.VertexBuffer.UV5Kind),u("TEXCOORD_5",m.VertexBuffer.UV6Kind),u("JOINTS_0",m.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",m.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",m.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",m.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",m.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 m.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 m.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){return(0,h.sH)(this,void 0,void 0,(function(){var o,a,i=this;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return o=new Array,(a=function(r,a,s){if(null!=n[r]){var l=t.getVertexBuffer(a);if(l){var u=Te.Get("".concat(e,"/").concat(r),i._gltf.accessors,n[r]);o.push(i._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then((function(e){s(l,e)})))}}})("POSITION",m.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)})),a("NORMAL",m.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)})),a("TANGENT",m.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)})),a("TEXCOORD_0",m.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)})),a("TEXCOORD_1",m.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)})),a("COLOR_0",m.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)})),[4,Promise.all(o).then((function(){}))];case 1:return[2,s.sent()]}}))}))},e._LoadTransform=function(e,t){if(null==e.skin){var n=m.Vector3.Zero(),r=m.Quaternion.Identity(),o=m.Vector3.One();e.matrix?m.Matrix.FromArray(e.matrix).decompose(o,r,n):(e.translation&&(n=m.Vector3.FromArray(e.translation)),e.rotation&&(r=m.Quaternion.FromArray(e.rotation)),e.scale&&(o=m.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 m.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=Te.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)||(m.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index)}else m.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=Te.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={},r=0,o=t;r<o.length;r++){for(var a=o[r],i=[],s=Te.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,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&&m.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return o=new m.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=Te.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=m.Matrix.Identity(),i=o._index;t&&-1!==i&&(m.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?m.Matrix.FromArray(e.matrix):m.Matrix.Compose(e.scale?m.Vector3.FromArray(e.scale):m.Vector3.One(),e.rotation?m.Quaternion.FromArray(e.rotation):m.Quaternion.Identity(),e.translation?m.Vector3.FromArray(e.translation):m.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 m.FreeCamera(n.name||"camera".concat(n.index),m.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._babylonCamera=i,i.setTarget(new m.Vector3(0,0,-1)),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=m.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;this._parent._startPerformanceCounter("Load animations");var t=this._gltf.animations;if(!t)return Promise.resolve();for(var n=new Array,r=0;r<t.length;r++){var o=t[r];n.push(this.loadAnimationAsync("/animations/".concat(o.index),o).then((function(e){0===e.targetedAnimations.length&&e.dispose()})))}return Promise.all(n).then((function(){e._parent._endPerformanceCounter("Load animations")}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return this._parent._startPerformanceCounter("Load animation"),this._extensionsLoadAnimationAsync(e,t)||be.value.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;Te.Assign(t.channels),Te.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 n._parent._endPerformanceCounter("Load animation"),Promise.all(i).then((function(){return a.normalize(0),a}))}))},e.prototype._loadAnimationChannelAsync=function(e,t,n,r,o){var a=this,i=this._extensionsLoadAnimationChannelAsync(e,t,n,r,o);if(i)return i;if(null==r.target.node)return Promise.resolve();var s=Te.Get("".concat(e,"/target/node"),this._gltf.nodes,r.target.node),l=r.target.path,u="weights"===l;return u&&!s._numMorphTargets||!u&&!s._babylonTransformNode?Promise.resolve():this._parent.loadNodeAnimations||u||s._isJoint?ve.value.then((function(){var i,u,c,f,d;switch(l){case"translation":d=null===(i=(0,he.tQ)("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":d=null===(u=(0,he.tQ)("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":d=null===(c=(0,he.tQ)("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":d=null===(f=(0,he.tQ)("/nodes/{}/weights"))||void 0===f?void 0:f.interpolation;break;default:throw new Error("".concat(e,"/target/path: Invalid value (").concat(r.target.path,")"))}if(!d)throw new Error("".concat(e,"/target/path: Could not find interpolation properties for target path (").concat(r.target.path,")"));var p={object:s,info:d};return a._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,p,o)})):Promise.resolve()},e.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=Te.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,u=0,c=o.info;u<c.length;u++){var f=c[u],d=f.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 g=f.getValue(l,h,_,1);_+=d,m[y]={frame:p[y]*i,value:g,interpolation:1}}break;case"CUBICSPLINE":for(y=0;y<p.length;y++){var b=f.getValue(l,h,_,s);_+=d,g=f.getValue(l,h,_,1),_+=d;var v=f.getValue(l,h,_,s);_+=d,m[y]={frame:p[y]*i,inTangent:b,value:g,outTangent:v}}break;case"LINEAR":for(y=0;y<p.length;y++)g=f.getValue(l,h,_,1),_+=d,m[y]={frame:p[y]*i,value:g}}if(_>0)for(var T="".concat(n.name||"animation".concat(n.index),"_channel").concat(r.index,"_").concat(t),x=0,A=f.buildAnimations(l,T,i,m);x<A.length;x++){var O=A[x];t++,a(O.babylonAnimatable,O.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 r=Te.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=Te.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=Te.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*m.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new r(s));else{var l=Te.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 u=new r(s);return m.VertexBuffer.ForEach(o,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,o,n.byteOffset,s)}))}if(n.sparse){var u=n.sparse;n._data=n._data.then((function(s){var l=s,c=Te.Get("".concat(t,"/sparse/indices/bufferView"),o._gltf.bufferViews,u.indices.bufferView),f=Te.Get("".concat(t,"/sparse/values/bufferView"),o._gltf.bufferViews,u.values.bufferView);return Promise.all([o.loadBufferViewAsync("/bufferViews/".concat(c.index),c),o.loadBufferViewAsync("/bufferViews/".concat(f.index),f)]).then((function(o){var s,c=o[0],f=o[1],d=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 h=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,p);s=new r(p),m.VertexBuffer.ForEach(h,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,f,u.values.byteOffset,p);for(var _=0,y=0;y<d.length;y++)for(var g=d[y]*a,b=0;b<a;b++)l[g++]=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=Te.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 m.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 m.VertexBuffer(a,e,r,!1)}));else{var i=Te.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 m.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){var r=new Array,o=this._getOrCreateMaterialAdapter(n);return t&&(t.baseColorFactor?(o.baseColor=m.Color3.FromArray(t.baseColorFactor),o.geometryOpacity=t.baseColorFactor[3]):o.baseColor=m.Color3.White(),o.baseMetalness=null==t.metallicFactor?1:t.metallicFactor,o.specularRoughness=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)"),o.baseColorTexture=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)"),o.baseMetalnessTexture=e,o.specularRoughnessTexture=e}))),o.useRoughnessFromMetallicTextureGreen=!0,o.useMetallicFromMetallicTextureBlue=!0)),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){if(!this._pbrMaterialImpl)throw new Error("PBR Material class not loaded");this._babylonScene._blockEntityCollection=!!this._assetContainer;var n=new this._pbrMaterialImpl.materialClass(e,this._babylonScene);n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n.fillMode=t,n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE;var r=this._getOrCreateMaterialAdapter(n);return r.transparencyAsAlphaCoverage=this._parent.transparencyAsCoverage,r.baseMetalness=1,r.specularRoughness=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){var r,o=new Array,a=this._getOrCreateMaterialAdapter(n);a.emissionColor=t.emissiveFactor?m.Color3.FromArray(t.emissiveFactor):new m.Color3(0,0,0),t.doubleSided&&(a.backFaceCulling=!1,a.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),t.normalTexture,(function(e){var r;e.name="".concat(n.name," (Normal)"),a.geometryNormalTexture=e,null!=(null===(r=t.normalTexture)||void 0===r?void 0:r.scale)&&(e.level=t.normalTexture.scale)}))),a.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));var i,s=1;return t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),t.occlusionTexture,(function(e){e.name="".concat(n.name," (Occlusion)"),r=e}))),null!=t.occlusionTexture.strength&&(s=t.occlusionTexture.strength)),t.emissiveTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),t.emissiveTexture,(function(e){e.name="".concat(n.name," (Emissive)"),i=e}))),Promise.all(o).then((function(){r&&(a.ambientOcclusionTexture=r,a.ambientOcclusionTextureStrength=s),i&&(a.emissionColorTexture=i)}))},e.prototype.loadMaterialAlphaProperties=function(e,t,n){if(!this._pbrMaterialImpl)throw new Error("".concat(e,": Material type not supported"));var r=this._getOrCreateMaterialAdapter(n),o=r.baseColorTexture;switch(t.alphaMode||"OPAQUE"){case"OPAQUE":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE,n.alpha=1;break;case"MASK":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHATEST,r.alphaCutOff=null==t.alphaCutoff?.5:t.alphaCutoff,o&&(o.hasAlpha=!0);break;case"BLEND":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHABLEND,o&&(o.hasAlpha=!0,r.useAlphaFromBaseColorTexture=!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=Te.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:Te.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=Te.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,s,l=this;void 0===r&&(r=function(){});var u=this._loadSampler("/samplers/".concat(t.index),t),c=new Array,f=new m.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var d={noMipmap:u.noMipMaps,invertY:!1,samplingMode:u.samplingMode,onLoad:function(){l._disposed||f.resolve()},onError:function(t,n){l._disposed||f.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:null!==(i=n.mimeType)&&void 0!==i?i:(0,m.GetMimeType)(null!==(s=n.uri)&&void 0!==s?s:""),loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},p=new m.Texture(null,this._babylonScene,d);return p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c.push(f.promise),c.push(this.loadImageAsync("/images/".concat(n.index),n).then((function(e){var t=n.uri||"".concat(l._fileName,"#image").concat(n.index),r="data:".concat(l._uniqueRootUrl).concat(t);p.updateURL(r,e);var o=p.getInternalTexture();o&&(o.label=n.name)}))),p.wrapU=u.wrapU,p.wrapV=u.wrapV,r(p),this._parent.useGltfTextureNames&&(p.name=n.name||n.uri||"image".concat(n.index)),Promise.all(c).then((function(){return p}))},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=Te.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,m.IsBase64DataUrl)(r)){var i=new Uint8Array((0,m.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 m.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 m.Texture.CLAMP_ADDRESSMODE;case 33648:return m.Texture.MIRROR_ADDRESSMODE;case 10497:return m.Texture.WRAP_ADDRESSMODE;default:return m.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),m.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 m.Texture.LINEAR_NEAREST;case 9729:return m.Texture.LINEAR_LINEAR;case 9984:return m.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return m.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return m.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return m.Texture.LINEAR_LINEAR_MIPLINEAR;default:return m.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),m.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&m.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),r){case 9728:return m.Texture.NEAREST_NEAREST;case 9729:return m.Texture.NEAREST_LINEAR;case 9984:return m.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return m.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return m.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return m.Texture.NEAREST_LINEAR_MIPLINEAR;default:return m.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),m.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,m.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=m.VertexBuffer.GetTypeByteLength(n);return o%l!==0?(m.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 m.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return m.Material.PointListDrawMode;case 1:return m.Material.LineListDrawMode;case 2:return m.Material.LineLoopDrawMode;case 3:return m.Material.LineStripDrawMode;case 4:return m.Material.TriangleFillMode;case 5:return m.Material.TriangleStripDrawMode;case 6:return m.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 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,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 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(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}();M._CreateGLTF2Loader=function(e){return new Ae(e)};var Oe="EXT_lights_image_based",we=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}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,a,i=this;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,(n=new Array).push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen("".concat(r)),a=Te.Get("".concat(r,"/light"),this._lights,o.light),n.push(this._loadLightAsync("/extensions/".concat(this.name,"/lights/").concat(o.light),a).then((function(e){i._loader.babylonScene.environmentTexture=e}))),this._loader.logClose(),[4,Promise.all(n).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},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],u=Te.Get(s,i._loader.gltf.images,l);r.push(i._loader.loadImageAsync("/images/".concat(l),u).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(){return(0,h.sH)(n,void 0,void 0,(function(){var n,r,a,i,s;return(0,h.YH)(this,(function(l){switch(l.label){case 0:if((n=new m.RawCubeTexture(this._loader.babylonScene,null,t.specularImageSize)).name=t.name||"environment",t._babylonTexture=n,null!=t.intensity&&(n.level=t.intensity),t.rotation&&(r=m.Quaternion.FromArray(t.rotation),this._loader.babylonScene.useRightHandedSystem||(r=m.Quaternion.Inverse(r)),m.Matrix.FromQuaternionToRef(r,n.getReflectionTextureMatrix())),!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(a=m.SphericalHarmonics.FromArray(t.irradianceCoefficients)).scaleInPlace(t.intensity),a.convertIrradianceToLambertianRadiance(),i=m.SphericalPolynomial.FromHarmonics(a),s=(o.length-1)/Math.log2(t.specularImageSize),[4,n.updateRGBDAsync(o,i,s)];case 1:return[2,l.sent()]}}))}))}))}return t._loaded.then((function(){return t._babylonTexture}))},e}();ge(Oe),ye(Oe,!0,(function(e){return new we(e)}));var Ce="EXT_mesh_gpu_instancing",Ee=function(){function e(e){this.name=Ce,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ce)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,h.sH)(r,void 0,void 0,(function(){var r,a,i,s,l=this;return(0,h.YH)(this,(function(u){switch(u.label){case 0:return this._loader._disableInstancedMesh++,r=this._loader.loadNodeAsync("/nodes/".concat(t.index),t,n),this._loader._disableInstancedMesh--,t._primitiveBabylonMeshes?[3,2]:[4,r];case 1:case 3:return[2,u.sent()];case 2:return a=new Array,i=0,(s=function(t){if(null!=o.attributes[t]){var n=Te.Get("".concat(e,"/attributes/").concat(t),l._loader.gltf.accessors,o.attributes[t]);if(a.push(l._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===i)i=n.count;else if(i!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else a.push(Promise.resolve(null))})("TRANSLATION"),s("ROTATION"),s("SCALE"),s("_COLOR_0"),[4,r.then((function(e){return(0,h.sH)(l,void 0,void 0,(function(){var n,r,o,s,l,u,c,f,d,p;return(0,h.YH)(this,(function(h){switch(h.label){case 0:return[4,Promise.all(a)];case 1:for(n=h.sent(),r=n[0],o=n[1],s=n[2],l=n[3],u=new Float32Array(16*i),m.TmpVectors.Vector3[0].copyFromFloats(0,0,0),m.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),m.TmpVectors.Vector3[1].copyFromFloats(1,1,1),c=0;c<i;++c)r&&m.Vector3.FromArrayToRef(r,3*c,m.TmpVectors.Vector3[0]),o&&m.Quaternion.FromArrayToRef(o,4*c,m.TmpVectors.Quaternion[0]),s&&m.Vector3.FromArrayToRef(s,3*c,m.TmpVectors.Vector3[1]),m.Matrix.ComposeToRef(m.TmpVectors.Vector3[1],m.TmpVectors.Quaternion[0],m.TmpVectors.Vector3[0],m.TmpVectors.Matrix[0]),m.TmpVectors.Matrix[0].copyToArray(u,16*c);for(f=0,d=t._primitiveBabylonMeshes;f<d.length;f++)(p=d[f]).thinInstanceSetBuffer("matrix",u,16,!0),l&&(l.length===3*i?p.thinInstanceSetBuffer("color",l,3,!0):l.length===4*i?p.thinInstanceSetBuffer("color",l,4,!0):m.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+p.name));return[2,e]}}))}))}))]}}))}))}))},e}();ge(Ce),ye(Ce,!0,(function(e){return new Ee(e)}));var Me="EXT_meshopt_compression",Re=function(){function e(e){this.name=Me,this.enabled=e.isExtensionUsed(Me),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,r,a=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(n=t)._meshOptData?[4,n._meshOptData]:[3,2];case 1:case 3:return[2,i.sent()];case 2:return r=Te.Get("".concat(e,"/buffer"),this._loader.gltf.buffers,o.buffer),n._meshOptData=this._loader.loadBufferAsync("/buffers/".concat(r.index),r,o.byteOffset||0,o.byteLength).then((function(e){return(0,h.sH)(a,void 0,void 0,(function(){return(0,h.YH)(this,(function(t){switch(t.label){case 0:return[4,m.MeshoptCompression.Default.decodeGltfBufferAsync(e,o.count,o.byteStride,o.mode,o.filter)];case 1:return[2,t.sent()]}}))}))})),[4,n._meshOptData]}}))}))}))},e}();ge(Me),ye(Me,!0,(function(e){return new Re(e)}));var Le="EXT_texture_webp",Pe=function(){function e(e){this.name=Le,this._loader=e,this.enabled=e.isExtensionUsed(Le)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ae.DefaultSampler:Te.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Te.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();ge(Le),ye(Le,!0,(function(e){return new Pe(e)}));var Ne="EXT_texture_avif",Fe=function(){function e(e){this.name=Ne,this._loader=e,this.enabled=e.isExtensionUsed(Ne)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ae.DefaultSampler:Te.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Te.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();ge(Ne),ye(Ne,!0,(function(e){return new Fe(e)}));var Ie="EXT_lights_ies",Se=function(){function e(e){this.name=Ie,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ie)}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,Te.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i,s,l,u,c=this;return(0,h.YH)(this,(function(f){switch(f.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t=(i=Te.Get(o,c._lights,a.light)).name||e.name;c._loader.babylonScene._blockEntityCollection=!!c._loader._assetContainer,(r=new m.SpotLight(t,m.Vector3.Zero(),m.Vector3.Backward(),0,1,c._loader.babylonScene)).angle=Math.PI/2,r.innerAngle=0,r._parentContainer=c._loader._assetContainer,c._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=r,r.falloffType=m.Light.FALLOFF_GLTF,r.diffuse=a.color?m.Color3.FromArray(a.color):m.Color3.White(),r.intensity=a.multiplier||1,r.range=Number.MAX_VALUE,r.parent=e,c._loader._babylonLights.push(r),Ae.AddPointerMetadata(r,o),n(e)}))];case 1:return s=f.sent(),i.uri?[4,this._loader.loadUriAsync(e,i,i.uri)]:[3,3];case 2:return l=f.sent(),[3,5];case 3:return u=Te.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,i.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u)];case 4:l=f.sent(),f.label=5;case 5:return r.iesProfileTexture=new m.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}();ge(Ie),ye(Ie,!0,(function(e){return new Se(e)}));var ke="KHR_draco_mesh_compression",Be=function(){function e(e){this.name=ke,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=m.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(ke)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i,s,l,u=this;return(0,h.YH)(this,(function(c){switch(c.label){case 0:if(null!=t.mode&&4!==t.mode&&5!==t.mode)throw new Error("".concat(e,": Unsupported mode ").concat(t.mode));return r={},i={},(s=function(e,o){var s=a.attributes[e];if(null!=s&&(n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o),r[o]=s,u.useNormalizedFlagFromAccessor)){var l=Te.TryGet(u._loader.gltf.accessors,t.attributes[e]);l&&(i[o]=l.normalized||!1)}})("POSITION",m.VertexBuffer.PositionKind),s("NORMAL",m.VertexBuffer.NormalKind),s("TANGENT",m.VertexBuffer.TangentKind),s("TEXCOORD_0",m.VertexBuffer.UVKind),s("TEXCOORD_1",m.VertexBuffer.UV2Kind),s("TEXCOORD_2",m.VertexBuffer.UV3Kind),s("TEXCOORD_3",m.VertexBuffer.UV4Kind),s("TEXCOORD_4",m.VertexBuffer.UV5Kind),s("TEXCOORD_5",m.VertexBuffer.UV6Kind),s("JOINTS_0",m.VertexBuffer.MatricesIndicesKind),s("WEIGHTS_0",m.VertexBuffer.MatricesWeightsKind),s("COLOR_0",m.VertexBuffer.ColorKind),(l=Te.Get(o,this._loader.gltf.bufferViews,a.bufferView))._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){return(0,h.sH)(u,void 0,void 0,(function(){var a,s,l;return(0,h.YH)(this,(function(u){switch(u.label){case 0:return a=this.dracoDecoder||m.DracoDecoder.Default,s=Te.TryGet(this._loader.gltf.accessors,t.attributes.POSITION),l=this._loader.parent.alwaysComputeBoundingBox||n.skeleton||!s?null:xe(s),[4,a._decodeMeshToGeometryForGltfAsync(n.name,this._loader.babylonScene,o,r,i,l).catch((function(t){throw new Error("".concat(e,": ").concat(t.message))}))];case 1:return[2,u.sent()]}}))}))}))),[4,l._dracoBabylonGeometry];case 1:return[2,c.sent()]}}))}))}))},e}();ge(ke),ye(ke,!0,(function(e){return new Be(e)}));var Ge="KHR_lights_punctual",Ve=function(){function e(e){this.name=Ge,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ge)}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,Te.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i=Te.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 m.DirectionalLight(s,m.Vector3.Backward(),r._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new m.PointLight(s,m.Vector3.Zero(),r._loader.babylonScene);break;case"spot":var u=new m.SpotLight(s,m.Vector3.Zero(),m.Vector3.Backward(),0,1,r._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 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=m.Light.FALLOFF_GLTF,t.diffuse=i.color?m.Color3.FromArray(i.color):m.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),Ae.AddPointerMetadata(t,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();ge(Ge),ye(Ge,!0,(function(e){return new Ve(e)}));var De="EXT_lights_area",He=function(){function e(e){this.name=De,this._loader=e,this.enabled=this._loader.isExtensionUsed(De)}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,Te.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i,s=Te.Get(o,r._lights,a.light),l=s.name||e.name;r._loader.babylonScene._blockEntityCollection=!!r._loader._assetContainer;var u=void 0!==s.size?s.size:1;switch(s.type){case"rect":var c=void 0!==(null===(t=s.rect)||void 0===t?void 0:t.aspect)?s.rect.aspect*u:u,f=u;i=new m.RectAreaLight(l,m.Vector3.Zero(),c,f,r._loader.babylonScene);break;case"disk":var d=Math.sqrt(u*u*.25*Math.PI);i=new m.RectAreaLight(l,m.Vector3.Zero(),d,d,r._loader.babylonScene);break;default:throw r._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(o,": Invalid area light type (").concat(s.type,")"))}i._parentContainer=r._loader._assetContainer,r._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=i,i.falloffType=m.Light.FALLOFF_GLTF,i.diffuse=s.color?m.Color3.FromArray(s.color):m.Color3.White(),i.intensity=null==s.intensity?1:s.intensity;var p=new m.TransformNode("".concat(l,"_orientation"),r._loader.babylonScene);p.rotationQuaternion=m.Quaternion.RotationAxis(m.Vector3.Up(),Math.PI),p.parent=e,i.parent=p,r._loader._babylonLights.push(i),Ae.AddPointerMetadata(i,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();ge(De),ye(De,!0,(function(e){return new He(e)}));var Ue="KHR_materials_pbrSpecularGlossiness",je=function(){function e(e){this.name=Ue,this.order=200,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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialBasePropertiesAsync(e,t,n)),r.push(this._loadSpecularGlossinessPropertiesAsync(o,a,n)),this._loader.loadMaterialAlphaProperties(e,t,n),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSpecularGlossinessPropertiesAsync=function(e,t,n){if(!(n instanceof m.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=m.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=m.Color3.White(),n.reflectivityColor=t.specularFactor?m.Color3.FromArray(t.specularFactor):m.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}();ge(Ue),ye(Ue,!0,(function(e){return new je(e)}));var Ke="KHR_materials_unlit",We=function(){function e(e){this.name=Ke,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ke)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadUnlitPropertiesAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))},e.prototype._loadUnlitPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=t.pbrMetallicRoughness;return a&&(a.baseColorFactor&&(r.baseColor=m.Color3.FromArray(a.baseColorFactor),r.geometryOpacity=a.baseColorFactor[3]),a.baseColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),a.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),r.baseColorTexture=e})))),r.isUnlit=!0,t.doubleSided&&(r.backFaceCulling=!1,r.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(o).then((function(){}))},e}();ge(Ke),ye(Ke,!0,(function(e){return new We(e)}));var ze="KHR_materials_clearcoat",Ze=function(){function e(e){this.name=ze,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ze)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadClearCoatPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadClearCoatPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;return r.configureCoat(),r.coatWeight=void 0!==t.clearcoatFactor?t.clearcoatFactor:0,r.coatRoughness=void 0!==t.clearcoatRoughnessFactor?t.clearcoatRoughnessFactor:0,t.clearcoatTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatTexture"),t.clearcoatTexture,(function(e){e.name="".concat(n.name," (ClearCoat)"),r.coatWeightTexture=e}))),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)"),r.coatRoughnessTexture=e})))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatNormalTexture"),t.clearcoatNormalTexture,(function(e){var o;e.name="".concat(n.name," (ClearCoat Normal)"),r.geometryCoatNormalTexture=e,null!=(null===(o=t.clearcoatNormalTexture)||void 0===o?void 0:o.scale)&&(r.geometryCoatNormalTextureScale=t.clearcoatNormalTexture.scale)}))),r.setNormalMapInversions(!n.getScene().useRightHandedSystem,n.getScene().useRightHandedSystem)),Promise.all(o).then((function(){}))},e}();ge(ze),ye(ze,!0,(function(e){return new Ze(e)}));var Ye="KHR_materials_coat",qe=function(){function e(e){this.name=Ye,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ye)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),t.extensions&&t.extensions.KHR_materials_openpbr&&(this.useOpenPBR=!0),r.push(this._loadCoatPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadCoatPropertiesAsync=function(e,t,n){var r,o,a=this._loader._getOrCreateMaterialAdapter(n),i=new Array;a.configureCoat(),a.coatWeight=void 0!==t.coatFactor?t.coatFactor:0,a.coatRoughness=void 0!==t.coatRoughnessFactor?t.coatRoughnessFactor:0,t.coatTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatTexture"),t.coatTexture,(function(e){e.name="".concat(n.name," (Coat)"),a.coatWeightTexture=e}))),t.coatRoughnessTexture&&(t.coatRoughnessTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatRoughnessTexture"),t.coatRoughnessTexture,(function(e){e.name="".concat(n.name," (Coat Roughness)"),a.coatRoughnessTexture=e})))),t.coatNormalTexture&&(t.coatNormalTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatNormalTexture"),t.coatNormalTexture,(function(e){var r;e.name="".concat(n.name," (Coat Normal)"),a.geometryCoatNormalTexture=e,null!=(null===(r=t.coatNormalTexture)||void 0===r?void 0:r.scale)&&(a.geometryCoatNormalTextureScale=t.coatNormalTexture.scale)}))),a.setNormalMapInversions(!n.getScene().useRightHandedSystem,n.getScene().useRightHandedSystem)),a.coatDarkening=void 0!==t.coatDarkeningFactor?t.coatDarkeningFactor:1,a.coatIor=void 0!==t.coatIor?t.coatIor:1.5;var s=m.Color3.White();void 0!==t.coatColorFactor&&s.fromArray(t.coatColorFactor),a.coatColor=s,t.coatColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatColorTexture"),t.coatColorTexture,(function(e){e.name="".concat(n.name," (Coat Color)"),a.coatColorTexture=e})));var l=null!==(r=t.coatAnisotropyStrength)&&void 0!==r?r:0,u=null!==(o=t.coatAnisotropyRotation)&&void 0!==o?o:0;return a.coatRoughnessAnisotropy=l,a.geometryCoatTangentAngle=u,this.useOpenPBR||a.configureGltfStyleAnisotropy(!0),t.coatAnisotropyTexture&&(t.coatAnisotropyTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatAnisotropyTexture"),t.coatAnisotropyTexture,(function(e){e.name="".concat(n.name," (Coat Anisotropy)"),a.geometryCoatTangentTexture=e})))),Promise.all(i).then((function(){}))},e}();ge(Ye),ye(Ye,!0,(function(e){return new qe(e)}));var Qe="KHR_materials_iridescence",Xe=function(){function e(e){this.name=Qe,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Qe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIridescencePropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadIridescencePropertiesAsync=function(e,t,n){var r,o,a,i,s,l=this._loader._getOrCreateMaterialAdapter(n),u=new Array;return l.thinFilmWeight=null!==(r=t.iridescenceFactor)&&void 0!==r?r:0,l.thinFilmIor=null!==(a=null!==(o=t.iridescenceIor)&&void 0!==o?o:t.iridescenceIOR)&&void 0!==a?a:1.3,l.thinFilmThicknessMinimum=null!==(i=t.iridescenceThicknessMinimum)&&void 0!==i?i:100,l.thinFilmThicknessMaximum=null!==(s=t.iridescenceThicknessMaximum)&&void 0!==s?s:400,t.iridescenceTexture&&u.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceTexture"),t.iridescenceTexture,(function(e){e.name="".concat(n.name," (Iridescence)"),l.thinFilmWeightTexture=e}))),t.iridescenceThicknessTexture&&u.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceThicknessTexture"),t.iridescenceThicknessTexture,(function(e){e.name="".concat(n.name," (Iridescence Thickness)"),l.thinFilmThicknessTexture=e}))),Promise.all(u).then((function(){}))},e}();ge(Qe),ye(Qe,!0,(function(e){return new Xe(e)}));var Je="KHR_materials_anisotropy",$e=function(){function e(e){this.name=Je,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Je)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadAnisotropyPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadAnisotropyPropertiesAsync=function(e,t,n){return(0,h.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c;return(0,h.YH)(this,(function(f){switch(f.label){case 0:return r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=null!==(l=t.anisotropyStrength)&&void 0!==l?l:0,i=null!==(u=t.anisotropyRotation)&&void 0!==u?u:0,r.specularRoughnessAnisotropy=a,r.geometryTangentAngle=i,(s=null!==(c=t.extensions)&&void 0!==c?c:{}).EXT_materials_anisotropy_openpbr&&s.EXT_materials_anisotropy_openpbr.openPbrAnisotropyEnabled||r.configureGltfStyleAnisotropy(!0),t.anisotropyTexture&&(t.anisotropyTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/anisotropyTexture"),t.anisotropyTexture,(function(e){e.name="".concat(n.name," (Anisotropy Intensity)"),r.geometryTangentTexture=e})))),[4,Promise.all(o)];case 1:return f.sent(),[2]}}))}))},e}();ge(Je),ye(Je,!0,(function(e){return new $e(e)}));var et="KHR_materials_emissive_strength",tt=function(){function e(e){this.name=et,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(et)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadMaterialPropertiesAsync(e,t,n)];case 1:return r.sent(),this._loadEmissiveProperties(o,a,n),[4,Promise.resolve()];case 2:return[2,r.sent()]}}))}))}))},e.prototype._loadEmissiveProperties=function(e,t,n){void 0!==t.emissiveStrength&&(this._loader._getOrCreateMaterialAdapter(n).emissionLuminance=t.emissiveStrength)},e}();ge(et),ye(et,!0,(function(e){return new tt(e)}));var nt="KHR_materials_sheen",rt=function(){function e(e){this.name=nt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSheenPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSheenPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;r.configureFuzz();var a=void 0!==t.sheenColorFactor?m.Color3.FromArray(t.sheenColorFactor):m.Color3.Black(),i=void 0!==t.sheenRoughnessFactor?t.sheenRoughnessFactor:0;return r.fuzzWeight=1,r.fuzzColor=a,r.fuzzRoughness=i,t.sheenColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),t.sheenColorTexture,(function(e){e.name="".concat(n.name," (Sheen Color)"),r.fuzzColorTexture=e}))),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)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();ge(nt),ye(nt,!0,(function(e){return new rt(e)}));var ot="KHR_materials_fuzz",at=function(){function e(e){this.name=ot,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ot)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadFuzzPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadFuzzPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;return r.configureFuzz(),r.fuzzWeight=void 0!==t.fuzzFactor?t.fuzzFactor:0,r.fuzzColor=void 0!==t.fuzzColorFactor?m.Color3.FromArray(t.fuzzColorFactor):m.Color3.White(),r.fuzzRoughness=void 0!==t.fuzzRoughnessFactor?t.fuzzRoughnessFactor:.5,t.fuzzTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzTexture"),t.fuzzTexture,(function(e){e.name="".concat(n.name," (Fuzz)"),r.fuzzWeightTexture=e}))),t.fuzzColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzColorTexture"),t.fuzzColorTexture,(function(e){e.name="".concat(n.name," (Fuzz Color)"),r.fuzzColorTexture=e}))),t.fuzzRoughnessTexture&&(t.fuzzRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzRoughnessTexture"),t.fuzzRoughnessTexture,(function(e){e.name="".concat(n.name," (Fuzz Roughness)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();ge(ot),ye(ot,!0,(function(e){return new at(e)}));var it="KHR_materials_specular",st=function(){function e(e){this.name=it,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(it)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSpecularPropertiesAsync(o,a,n)),i=this._loader._getOrCreateMaterialAdapter(n),a.extensions&&a.extensions.EXT_materials_specular_edge_color&&a.extensions.EXT_materials_specular_edge_color.specularEdgeColorEnabled&&i.enableSpecularEdgeColor(!0),[4,Promise.all(r).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},e.prototype._loadSpecularPropertiesAsync=function(e,t,n){var r,o=this._loader._getOrCreateMaterialAdapter(n),a=new Array;return o.specularWeight=null!==(r=t.specularFactor)&&void 0!==r?r:1,o.specularColor=void 0!==t.specularColorFactor?m.Color3.FromArray(t.specularColorFactor):new m.Color3(1,1,1),t.specularTexture&&(t.specularTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),t.specularTexture,(function(e){e.name="".concat(n.name," (Specular)"),o.specularWeightTexture=e})))),t.specularColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),t.specularColorTexture,(function(e){e.name="".concat(n.name," (Specular Color)"),o.specularColorTexture=e}))),Promise.all(a).then((function(){}))},e}();ge(it),ye(it,!0,(function(e){return new st(e)}));var lt="KHR_materials_ior",ut=function(){function e(e){this.name=lt,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(lt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIorPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadIorPropertiesAsync=function(t,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=void 0!==n.ior?n.ior:e._DEFAULT_IOR;return o.specularIor=a,Promise.resolve()},e._DEFAULT_IOR=1.5,e}();ge(lt),ye(lt,!0,(function(e){return new ut(e)}));var ct="KHR_materials_variants",ft=function(){function e(e){this.name=ct,this._loader=e,this.enabled=this._loader.isExtensionUsed(ct)&&!this._loader.parent.skipMaterials}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(ct," 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(ct," 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(ct," 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[ct])||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=this._loader.rootBabylonMesh;if(n){var r=this._loader.parent.extensionOptions[ct];(null==r?void 0:r.defaultVariant)&&e.SelectVariant(n,r.defaultVariant),null===(t=null==r?void 0:r.onLoaded)||void 0===t||t.call(r,{get variants(){return e.GetAvailableVariants(n)},get selectedVariant(){var t=e.GetLastSelectedVariant(n);return t?Array.isArray(t)?t[0]:t:e.GetAvailableVariants(n)[0]},set selectedVariant(t){e.SelectVariant(n,t)}})}},e.prototype._loadMeshPrimitiveAsync=function(t,n,r,o,a,i){var s=this;return Ae.LoadExtensionAsync(t,a,this.name,(function(l,u){return(0,h.sH)(s,void 0,void 0,(function(){var s,c=this;return(0,h.YH)(this,(function(f){switch(f.label){case 0:return(s=new Array).push(this._loader._loadMeshPrimitiveAsync(t,n,r,o,a,(function(n){if(i(n),n instanceof m.Mesh){var r=Ae._GetDrawMode(t,a.mode),o=c._loader.rootBabylonMesh,f=o?o._internalMetadata=o._internalMetadata||{}:{},d=f.gltf=f.gltf||{},p=d[ct]=d[ct]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:n,material:n.material});for(var h=function(t){var a=u.mappings[t],i=Te.Get("".concat(l,"/mappings/").concat(t,"/material"),c._loader.gltf.materials,a.material);s.push(c._loader._loadMaterialAsync("#/materials/".concat(a.material),i,n,r,(function(t){for(var r=function(r){var i=a.variants[r],s=Te.Get("/extensions/".concat(ct,"/variants/").concat(i),c._variants,i);p.variants[s.name]=p.variants[s.name]||[],p.variants[s.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 l in i._internalMetadata={},o._internalMetadata)i._internalMetadata[l]=o._internalMetadata[l];for(var l in i._internalMetadata.gltf=[],o._internalMetadata.gltf)i._internalMetadata.gltf[l]=o._internalMetadata.gltf[l];i._internalMetadata.gltf[ct]={lastSelected:null,original:[],variants:{}};for(var u=0,c=a.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[ct].original.push({mesh:f.mesh,material:f.material})}for(var l in a.variants)if(Object.prototype.hasOwnProperty.call(a.variants,l)){i._internalMetadata.gltf[ct].variants[l]=[];for(var d=0,p=a.variants[l];d<p.length;d++){var h=p[d];i._internalMetadata.gltf[ct].variants[l].push({mesh:h.mesh,material:h.material})}}a=i._internalMetadata.gltf[ct]}for(var m=0,_=a.original;m<_.length;m++)(b=_[m]).mesh===n&&(b.mesh=r);for(var y=0,g=a.variants[s.name];y<g.length;y++){var b;(b=g[y]).mesh===n&&(b.mesh=r)}}))},i=0;i<a.variants.length;++i)r(i)})))},_=0;_<u.mappings.length;++_)h(_)}}))),[4,Promise.all(s).then((function(e){return e[0]}))];case 1:return[2,f.sent()]}}))}))}))},e}();ge(ct),ye(ct,!0,(function(e){return new ft(e)}));var dt=function(){function e(t,n){var r=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,h.Cl)((0,h.Cl)({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this.onErrorObservable=new m.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:m.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=(0,h.Cl)((0,h.Cl)({},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){var t;return!!(null===(t=null==e?void 0:e.subSurface)||void 0===t?void 0:t.isRefractionEnabled)},e.prototype._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),m.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);if(this._shouldRenderAsTransmission(e.material)){if(e.material){var r=e.material.subSurface;r&&(r.refractionTexture=this._opaqueRenderTarget)}-1!==n?(this._opaqueMeshesCache.splice(n,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)}else-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=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new m.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.disableImageProcessing=!0,this._opaqueRenderTarget.onBeforeBindObservable.add((function(e){n=r._scene.environmentIntensity,r._scene.environmentIntensity=1,r._options.clearColor?e.clearColor.copyFrom(r._options.clearColor):r._scene.clearColor.toLinearSpaceToRef(e.clearColor,r._scene.getEngine().useExactSrgbConversions)})),this._opaqueRenderTarget.onAfterUnbindObservable.add((function(){r._scene.environmentIntensity=n}));for(var o=0,a=this._transparentMeshesCache;o<a.length;o++){var i=a[o];this._shouldRenderAsTransmission(i.material)&&(i.material.refractionTexture=this._opaqueRenderTarget)}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},e}(),pt="KHR_materials_transmission",ht=function(){function e(e){this.name=pt,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(pt),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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTransparentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadTransparentPropertiesAsync=function(e,t,n,r){var o,a,i=this._loader._getOrCreateMaterialAdapter(n),s=void 0!==r.transmissionFactor?r.transmissionFactor:0;if(0===s)return Promise.resolve();if(i.configureTransmission(),i.transmissionWeight=s,s>0){var l=n.getScene();l._transmissionHelper?(null===(o=l._transmissionHelper)||void 0===o?void 0:o._isRenderTargetValid())||null===(a=l._transmissionHelper)||void 0===a||a._setupRenderTargets():new dt({},n.getScene())}var u=Promise.resolve(null);return r.transmissionTexture&&(r.transmissionTexture.nonColorData=!0,u=this._loader.loadTextureInfoAsync("".concat(e,"/transmissionTexture"),r.transmissionTexture,(function(e){e.name="".concat(n.name," (Transmission)"),i.transmissionWeightTexture=e}))),u.then((function(){}))},e}();ge(pt),ye(pt,!0,(function(e){return new ht(e)}));var mt="KHR_materials_diffuse_transmission",_t=function(){function e(e){this.name=mt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(mt),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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTranslucentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadTranslucentPropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);a.configureSubsurface(),a.subsurfaceWeight=null!==(o=r.diffuseTransmissionFactor)&&void 0!==o?o:0,a.subsurfaceColor=void 0!==r.diffuseTransmissionColorFactor?m.Color3.FromArray(r.diffuseTransmissionColorFactor):m.Color3.White();var i=new Array;return r.diffuseTransmissionTexture&&(r.diffuseTransmissionTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),r.diffuseTransmissionTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission)"),a.subsurfaceWeightTexture=e})))),r.diffuseTransmissionColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),r.diffuseTransmissionColorTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission Color)"),a.subsurfaceColorTexture=e}))),Promise.all(i).then((function(){}))},e}();ge(mt),ye(mt,!0,(function(e){return new _t(e)}));var yt="KHR_materials_volume",gt=function(){function e(e){this.name=yt,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(yt),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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadVolumePropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadVolumePropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);if(0===a.transmissionWeight&&0===a.subsurfaceWeight||!r.thicknessFactor)return Promise.resolve();a.transmissionDepth=void 0!==r.attenuationDistance?r.attenuationDistance:Number.MAX_VALUE,a.transmissionColor=void 0!==r.attenuationColor&&3==r.attenuationColor.length?m.Color3.FromArray(r.attenuationColor):m.Color3.White(),a.volumeThickness=null!==(o=r.thicknessFactor)&&void 0!==o?o:0;var i=new Array;return r.thicknessTexture&&(r.thicknessTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),r.thicknessTexture,(function(e){e.name="".concat(n.name," (Thickness)"),a.volumeThicknessTexture=e})))),Promise.all(i).then((function(){}))},e}();ge(yt),ye(yt,!0,(function(e){return new gt(e)}));var bt="KHR_materials_dispersion",vt=function(){function e(e){this.name=bt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(bt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDispersionPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadDispersionPropertiesAsync=function(e,t,n,r){var o=this._loader._getOrCreateMaterialAdapter(n);return o.transmissionWeight>0||!r.dispersion||(o.transmissionDispersionAbbeNumber=20/r.dispersion),Promise.resolve()},e}();ge(bt),ye(bt,!0,(function(e){return new vt(e)}));var Tt="KHR_materials_diffuse_roughness",xt=function(){function e(e){this.name=Tt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Tt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDiffuseRoughnessPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadDiffuseRoughnessPropertiesAsync=function(e,t,n){var r,o=this._loader._getOrCreateMaterialAdapter(n),a=new Array;return o.baseDiffuseRoughness=null!==(r=t.diffuseRoughnessFactor)&&void 0!==r?r:0,t.diffuseRoughnessTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseRoughnessTexture"),t.diffuseRoughnessTexture,(function(e){e.name="".concat(n.name," (Diffuse Roughness)"),o.baseDiffuseRoughnessTexture=e}))),Promise.all(a).then((function(){}))},e}();ge(Tt),ye(Tt,!0,(function(e){return new xt(e)}));var At="KHR_mesh_quantization",Ot=function(){function e(e){this.name=At,this.enabled=e.isExtensionUsed(At)}return e.prototype.dispose=function(){},e}();ge(At),ye(At,!0,(function(e){return new Ot(e)}));var wt="KHR_texture_basisu",Ct=function(){function e(e){this.name=wt,this._loader=e,this.enabled=e.isExtensionUsed(wt)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ae.DefaultSampler:Te.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Te.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();ge(wt),ye(wt,!0,(function(e){return new Ct(e)}));var Et="KHR_texture_transform",Mt=function(){function e(e){this.name=Et,this._loader=e,this.enabled=this._loader.isExtensionUsed(Et)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof m.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)}))];case 1:return[2,r.sent()]}}))}))}))},e}();ge(Et),ye(Et,!0,(function(e){return new Mt(e)}));var Rt="KHR_xmp_json_ld",Lt=function(){function e(e){this.name=Rt,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Rt)}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}();ge(Rt),ye(Rt,!0,(function(e){return new Lt(e)}));var Pt=a(727);function Nt(e,t,n,r){return m.Color3.FromArray(t,n).scale(r)}function Ft(e,t,n,r){return t[n]*r}function It(e,t,n,r){return-t[n]*r}function St(e,t,n,r){return t[n+1]*r}function kt(e,t,n,r){return t[n]*r*2}function Bt(e){return{scale:[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Ft,(function(){return 2})),new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),St,(function(){return 2}))],offset:[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Ft,(function(){return 2})),new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),St,(function(){return 2}))],rotation:[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),It,(function(){return 1}))]}}var Gt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Pt.AnimationPropertyInfo),Vt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=[];for(var a in e._data)o.push({babylonAnimatable:e._data[a].babylonMaterial,babylonAnimation:this._buildAnimation(t,n,r)});return o},t}(Pt.AnimationPropertyInfo),Dt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Pt.AnimationPropertyInfo),Ht=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=this;return e._primitiveBabylonMeshes?e._primitiveBabylonMeshes.map((function(e){return{babylonAnimatable:e,babylonAnimation:o._buildAnimation(t,n,r)}})):[]},t}(Pt.AnimationPropertyInfo);(0,he.ZU)("/cameras/{}/orthographic/xmag",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",It,(function(){return 1})),new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",St,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/orthographic/ymag",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",It,(function(){return 1})),new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",St,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/orthographic/zfar",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/orthographic/znear",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"minZ",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/perspective/yfov",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"fov",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/perspective/zfar",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/perspective/znear",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"minZ",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",Nt,(function(){return 4})),new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,r){return t[n+3]*r}),(function(){return 4}))]),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"metallic",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"roughness",Ft,(function(){return 1}))]);var Ut=Bt("albedoTexture");(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",Ut.scale),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",Ut.offset),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",Ut.rotation);var jt=Bt("metallicTexture");(0,he.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",jt.scale),(0,he.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",jt.offset),(0,he.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",jt.rotation),(0,he.ZU)("/materials/{}/emissiveFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",Nt,(function(){return 3}))]);var Kt=Bt("bumpTexture");(0,he.ZU)("/materials/{}/normalTexture/scale",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",Kt.scale),(0,he.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",Kt.offset),(0,he.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",Kt.rotation),(0,he.ZU)("/materials/{}/occlusionTexture/strength",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Ft,(function(){return 1}))]);var Wt=Bt("ambientTexture");(0,he.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",Wt.scale),(0,he.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",Wt.offset),(0,he.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",Wt.rotation);var zt=Bt("emissiveTexture");(0,he.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",zt.scale),(0,he.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",zt.offset),(0,he.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",zt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Ft,(function(){return 1}))]);var Zt=Bt("anisotropy.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",Zt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",Zt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",Zt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Ft,(function(){return 1}))]);var Yt=Bt("clearCoat.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",Yt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",Yt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",Yt.rotation);var qt=Bt("clearCoat.bumpTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",qt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",qt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",qt.rotation);var Qt=Bt("clearCoat.textureRoughness");(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",Qt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",Qt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",Qt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_ior/ior",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Ft,(function(){return 1}))]);var Xt=Bt("iridescence.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",Xt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",Xt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",Xt.rotation);var Jt=Bt("iridescence.thicknessTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",Jt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",Jt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",Jt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",Nt,(function(){return 3}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Ft,(function(){return 1}))]);var $t=Bt("sheen.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",$t.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",$t.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",$t.rotation);var en=Bt("sheen.textureRoughness");(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",en.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",en.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",en.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Nt,(function(){return 3}))]);var tn=Bt("metallicReflectanceTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",tn.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",tn.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",tn.rotation);var nn=Bt("reflectanceTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",nn.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",nn.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",nn.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Ft,(function(){return 1}))]);var rn=Bt("subSurface.refractionIntensityTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",rn.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",rn.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",rn.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Nt,(function(){return 3}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Ft,(function(){return 1}))]);var on=Bt("subSurface.thicknessTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",on.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",on.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",on.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Ft,(function(){return 1}))]);var an=Bt("subSurface.translucencyIntensityTexture");(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",an.scale),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",an.offset),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",an.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",Nt,(function(){return 3}))]);var sn=Bt("subSurface.translucencyColorTexture");(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",sn.scale),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",sn.offset),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",sn.rotation),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/color",[new Dt(m.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Nt,(function(){return 3}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/range",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"range",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",kt,(function(){return 1}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"angle",kt,(function(){return 1}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/color",[new Dt(m.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Nt,(function(){return 3}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/intensity",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/size",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"radius",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"radius",Ft,(function(){return 1}))]),(0,he.ZU)("/nodes/{}/extensions/EXT_lights_ies/color",[new Dt(m.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Nt,(function(){return 3}))]),(0,he.ZU)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/nodes/{}/extensions/KHR_node_visibility/visible",[new Ht(m.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Ft,(function(){return 1}))]);var ln="KHR_animation_pointer",un=function(){function e(e){this.name=ln,this._loader=e,this._pathToObjectConverter=(0,he.Wt)(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(ln)},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&&m.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&&m.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 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,r,{object:u.object,info:u.info.interpolation},o)}catch(e){return m.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();ge(ln),ye(ln,!0,(function(e){return new un(e)}));var cn="MSFT_audio_emitter",fn=function(){function e(e){this.name=cn,this._loader=e,this.enabled=this._loader.isExtensionUsed(cn)}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,Te.Assign(this._clips),Te.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,h.YH)(this,(function(u){switch(u.label){case 0:for((n=new Array).push(this._loader.loadSceneAsync(e,t)),a=0,i=o.emitters;a<i.length;a++){if(s=i[a],null!=(l=Te.Get("".concat(r,"/emitters"),this._emitters,s)).refDistance||null!=l.maxDistance||null!=l.rolloffFactor||null!=l.distanceModel||null!=l.innerAngle||null!=l.outerAngle)throw new Error("".concat(r,": Direction or Distance properties are not allowed on emitters attached to a scene"));n.push(this._loadEmitterAsync("".concat(r,"/emitters/").concat(l.index),l))}return[4,Promise.all(n)];case 1:return u.sent(),[2]}}))}))}))},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,h.sH)(r,void 0,void 0,(function(){var r,a,i=this;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=new Array,[4,this._loader.loadNodeAsync(e,t,(function(t){for(var a=function(n){var o=Te.Get("".concat(e,"/emitters"),i._emitters,n);r.push(i._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(m.Vector3.Forward()),r.setDirectionalCone(2*m.Tools.ToDegrees(null==o.innerAngle?Math.PI:o.innerAngle),2*m.Tools.ToDegrees(null==o.outerAngle?Math.PI:o.outerAngle),0))}})))},s=0,l=o.emitters;s<l.length;s++)a(l[s]);n(t)}))];case 1:return a=s.sent(),[4,Promise.all(r)];case 2:return s.sent(),[2,a]}}))}))}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,h.YH)(this,(function(u){switch(u.label){case 0:return[4,this._loader.loadAnimationAsync(e,t)];case 1:for(n=u.sent(),a=new Array,Te.Assign(o.events),i=0,s=o.events;i<s.length;i++)l=s[i],a.push(this._loadAnimationEventAsync("".concat(r,"/events/").concat(l.index),e,t,l,n));return[4,Promise.all(a)];case 2:return u.sent(),[2,n]}}))}))}))},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=Te.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=Te.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 m.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 u=Promise.all(r).then((function(){var e=t.clips.map((function(e){return e.weight||1})),n=new m.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*m.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*m.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,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=Te.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 m.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}();ge(cn),ye(cn,!0,(function(e){return new fn(e)}));var dn="MSFT_lod",pn=function(){function e(e){var t,n;this.name=dn,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new m.Observable,this.onMaterialLODsLoadedObservable=new m.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[dn])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(dn)}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 Ae.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,h.sH)(r,void 0,void 0,(function(){var r,a,i,s,l,u=this;return(0,h.YH)(this,(function(c){switch(c.label){case 0:for(a=this._getLODs(e,t,this._loader.gltf.nodes,o.ids),this._loader.logOpen("".concat(e)),i=function(e){var t=a[e];0!==e&&(s._nodeIndexLOD=e,s._nodeSignalLODs[e]=s._nodeSignalLODs[e]||new m.Deferred);var o=s._loader.loadNodeAsync("/nodes/".concat(t.index),t,(function(e){n(e),e.setEnabled(!1)})).then((function(t){if(0!==e){var n=a[e-1];n._babylonTransformNode&&(u._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t}));s._nodePromiseLODs[e]=s._nodePromiseLODs[e]||[],0===e?r=o:(s._nodeIndexLOD=null,s._nodePromiseLODs[e].push(o))},s=this,l=0;l<a.length;l++)i(l);return this._loader.logClose(),[4,r];case 1:return[2,c.sent()]}}))}))}))},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var a=this;return this._nodeIndexLOD?null:Ae.LoadExtensionAsync(e,t,this.name,(function(e,i){return(0,h.sH)(a,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,h.YH)(this,(function(d){switch(d.label){case 0:for(s=this._getLODs(e,t,this._loader.gltf.materials,i.ids),this._loader.logOpen("".concat(e)),l=function(e){var t=s[e];0!==e&&(u._materialIndexLOD=e);var i=u._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=s[e-1]._data;n[r]&&(f._disposeMaterials([n[r].babylonMaterial]),delete n[r])}return t}));u._materialPromiseLODs[e]=u._materialPromiseLODs[e]||[],0===e?a=i:(u._materialIndexLOD=null,u._materialPromiseLODs[e].push(i))},u=this,c=0;c<s.length;c++)l(c);return this._loader.logClose(),[4,a];case 1:return[2,d.sent()]}}))}))}))},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 m.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))}return null!==this._materialIndexLOD?(this._loader.log("deferred"),o=this._materialIndexLOD-1,this._materialSignalLODs[o]=this._materialSignalLODs[o]||new m.Deferred,this._materialSignalLODs[o].promise.then((function(){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))):null},e.prototype.loadBufferAsync=function(e,t,n,r){var o=this;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 a=function(e,t){return(0,h.sH)(o,void 0,void 0,(function(){var o,a,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return a=(o=n)+r-1,(i=e[t])?(i.start=Math.min(i.start,o),i.end=Math.max(i.end,a)):(i={start:o,end:a,loaded:new m.Deferred},e[t]=i),[4,i.loaded.promise.then((function(e){return new Uint8Array(e.buffer,e.byteOffset+n-i.start,r)}))];case 1:return[2,s.sent()]}}))}))};return this._loader.log("deferred"),null!==this._nodeIndexLOD?a(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?a(this._materialBufferLODs,this._materialIndexLOD):a(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(Te.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=(c=r[n]).getActiveTextures();o<a.length;o++){var i=a[o];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}();ge(dn),ye(dn,!0,(function(e){return new pn(e)}));var hn="MSFT_minecraftMesh",mn=function(){function e(e){this.name=hn,this._loader=e,this.enabled=this._loader.isExtensionUsed(hn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:if(!a)return[3,2];if(!this._loader._pbrMaterialImpl)throw new Error("".concat(o,": Material type not supported"));return r=this._loader.loadMaterialPropertiesAsync(e,t,n),n.needAlphaBlending()&&(n.forceDepthWrite=!0,n.separateCullingPass=!0),n.backFaceCulling=n.forceDepthWrite,n.twoSidedLighting=!0,[4,r];case 1:return[2,i.sent()];case 2:return[2]}}))}))}))},e}();ge(hn),ye(hn,!0,(function(e){return new mn(e)}));var _n="MSFT_sRGBFactors",yn=function(){function e(e){this.name=_n,this._loader=e,this.enabled=this._loader.isExtensionUsed(_n)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,o,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return a?(r=this._loader._getOrCreateMaterialAdapter(n),o=this._loader.loadMaterialPropertiesAsync(e,t,n),i=n.getScene().getEngine().useExactSrgbConversions,r.baseColorTexture||r.baseColor.toLinearSpaceToRef(r.baseColor,i),r.specularColorTexture||r.specularColor.toLinearSpaceToRef(r.specularColor,i),[4,o]):[3,2];case 1:return[2,s.sent()];case 2:return[2]}}))}))}))},e}();function gn(e){var t=e.split(":");return bn({op:t[0],extension:t[1]})}function bn(e,t){var n;void 0===t&&(t=!0);var r=e.extension?null===(n=Tn[e.extension])||void 0===n?void 0:n[e.op]:xn[e.op];if(!r&&(m.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),t)){var o={},a={flows:{}};if(e.inputValueSockets)for(var i in o.values={},e.inputValueSockets)o.values[i]={name:i};return e.outputValueSockets&&(a.values={},Object.keys(e.outputValueSockets).forEach((function(e){a.values[e]={name:e}}))),{blocks:[],inputs:o,outputs:a}}return r}function vn(e,t,n){Tn[t]||(Tn[t]={}),Tn[t][e]=n}ge(_n),ye(_n,!0,(function(e){return new yn(e)}));var Tn={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},xn={"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"],extraProcessor:function(e,t,n,r,o){var a;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 i=null===(a=e.configuration.event.value)||void 0===a?void 0:a[0];if("number"!=typeof i)throw new Error("Event id should be a number");var s=r.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=s.eventId,l.config.eventData=s.eventData,o}},"event/receive":{blocks:["FlowGraphReceiveCustomEventBlock"],outputs:{flows:{out:{name:"done"}}},validation:function(e,t){var n,r;if(!e.configuration)return m.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};var o=e.configuration.event;if(!o)return m.Logger.Error("Receive event should have a single configuration object, the event itself"),{valid:!1,error:"Receive event should have a single configuration object, the event itself"};var a=null===(n=o.value)||void 0===n?void 0:n[0];return"number"!=typeof a?(m.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):(null===(r=t.events)||void 0===r?void 0:r[a])?{valid:!0}:(m.Logger.Error("Event with id ".concat(a," not found")),{valid:!1,error:"Event with id ".concat(a," not found")})},extraProcessor:function(e,t,n,r,o){var a;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 i=null===(a=e.configuration.event.value)||void 0===a?void 0:a[0];if("number"!=typeof i)throw new Error("Event id should be a number");var s=r.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=s.eventId,l.config.eventData=s.eventData,o}},"math/E":An("FlowGraphEBlock"),"math/Pi":An("FlowGraphPIBlock"),"math/Inf":An("FlowGraphInfBlock"),"math/NaN":An("FlowGraphNaNBlock"),"math/abs":An("FlowGraphAbsBlock"),"math/sign":An("FlowGraphSignBlock"),"math/trunc":An("FlowGraphTruncBlock"),"math/floor":An("FlowGraphFloorBlock"),"math/ceil":An("FlowGraphCeilBlock"),"math/round":{blocks:["FlowGraphRoundBlock"],configuration:{},inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.roundHalfAwayFromZero=!0,o}},"math/fract":An("FlowGraphFractBlock"),"math/neg":An("FlowGraphNegationBlock"),"math/add":An("FlowGraphAddBlock",["a","b"],!0),"math/sub":An("FlowGraphSubtractBlock",["a","b"],!0),"math/mul":{blocks:["FlowGraphMultiplyBlock"],extraProcessor:function(e,t,n,r,o){var a;(a=o[0]).config||(a.config={}),o[0].config.useMatrixPerComponent=!0,o[0].config.preventIntegerFloatArithmetic=!0;var i=-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)&&(i=e.values[t].type,!0)})),-1!==i&&(o[0].config.type=r.arrays.types[i].flowGraphType),o},validation:function(e){return e.values?On(e):{valid:!0}}},"math/div":An("FlowGraphDivideBlock",["a","b"],!0),"math/rem":An("FlowGraphModuloBlock",["a","b"]),"math/min":An("FlowGraphMinBlock",["a","b"]),"math/max":An("FlowGraphMaxBlock",["a","b"]),"math/clamp":An("FlowGraphClampBlock",["a","b","c"]),"math/saturate":An("FlowGraphSaturateBlock"),"math/mix":An("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":An("FlowGraphEqualityBlock",["a","b"]),"math/lt":An("FlowGraphLessThanBlock",["a","b"]),"math/le":An("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":An("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":An("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":An("FlowGraphIsNaNBlock"),"math/isInf":An("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":An("FlowGraphSinBlock"),"math/cos":An("FlowGraphCosBlock"),"math/tan":An("FlowGraphTanBlock"),"math/asin":An("FlowGraphASinBlock"),"math/acos":An("FlowGraphACosBlock"),"math/atan":An("FlowGraphATanBlock"),"math/atan2":An("FlowGraphATan2Block",["a","b"]),"math/sinh":An("FlowGraphSinhBlock"),"math/cosh":An("FlowGraphCoshBlock"),"math/tanh":An("FlowGraphTanhBlock"),"math/asinh":An("FlowGraphASinhBlock"),"math/acosh":An("FlowGraphACoshBlock"),"math/atanh":An("FlowGraphATanhBlock"),"math/exp":An("FlowGraphExponentialBlock"),"math/log":An("FlowGraphLogBlock"),"math/log2":An("FlowGraphLog2Block"),"math/log10":An("FlowGraphLog10Block"),"math/sqrt":An("FlowGraphSquareRootBlock"),"math/cbrt":An("FlowGraphCubeRootBlock"),"math/pow":An("FlowGraphPowerBlock",["a","b"]),"math/length":An("FlowGraphLengthBlock"),"math/normalize":An("FlowGraphNormalizeBlock"),"math/dot":An("FlowGraphDotBlock",["a","b"]),"math/cross":An("FlowGraphCrossBlock",["a","b"]),"math/rotate2D":{blocks:["FlowGraphRotate2DBlock"],inputs:{values:{a:{name:"a"},angle:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/rotate3D":{blocks:["FlowGraphRotate3DBlock"],inputs:{values:{a:{name:"a"},rotation:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"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":An("FlowGraphTransposeBlock"),"math/determinant":An("FlowGraphDeterminantBlock"),"math/inverse":An("FlowGraphInvertMatrixBlock"),"math/matMul":An("FlowGraphMatrixMultiplicationBlock",["a","b"]),"math/matCompose":{blocks:["FlowGraphMatrixCompose"],inputs:{values:{translation:{name:"position",gltfType:"float3"},rotation:{name:"rotationQuaternion",gltfType:"float4"},scale:{name:"scaling",gltfType:"float3"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i=o[0].dataInputs.find((function(e){return"rotationQuaternion"===e.name}));if(!i)throw new Error("Rotation quaternion input not found");return a._connectionValues[i.uniqueId]&&(a._connectionValues[i.uniqueId].type="Quaternion"),o}},"math/matDecompose":{blocks:["FlowGraphMatrixDecompose"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{translation:{name:"position"},rotation:{name:"rotationQuaternion"},scale:{name:"scaling"}}}},"math/quatConjugate":An("FlowGraphConjugateBlock",["a"]),"math/quatMul":{blocks:["FlowGraphMultiplyBlock"],inputs:{values:{a:{name:"a",gltfType:"vector4"},b:{name:"b",gltfType:"vector4"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.type="Quaternion",o}},"math/quatAngleBetween":An("FlowGraphAngleBetweenBlock",["a","b"]),"math/quatFromAxisAngle":{blocks:["FlowGraphQuaternionFromAxisAngleBlock"],inputs:{values:{axis:{name:"a",gltfType:"float3"},angle:{name:"b",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/quatToAxisAngle":An("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":An("FlowGraphQuaternionFromDirectionsBlock",["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,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"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,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"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,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"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/not":{blocks:["FlowGraphBitwiseNotBlock"],inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l;(l=o[0]).config||(l.config={});var u=o[0].dataInputs[0];return o[0].config.valueType=null!==(s=null===(i=a._connectionValues[u.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:"FlowGraphInteger",o}},"math/and":{blocks:["FlowGraphBitwiseAndBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],d=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.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",o}},"math/or":{blocks:["FlowGraphBitwiseOrBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],d=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.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",o}},"math/xor":{blocks:["FlowGraphBitwiseXorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],d=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.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",o}},"math/asr":An("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":An("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":An("FlowGraphLeadingZerosBlock"),"math/ctz":An("FlowGraphTrailingZerosBlock"),"math/popcnt":An("FlowGraphOneBitsCounterBlock"),"math/rad":An("FlowGraphDegToRadBlock"),"math/deg":An("FlowGraphRadToDegBlock"),"type/boolToInt":An("FlowGraphBooleanToInt"),"type/boolToFloat":An("FlowGraphBooleanToFloat"),"type/intToBool":An("FlowGraphIntToBoolean"),"type/intToFloat":An("FlowGraphIntToFloat"),"type/floatToInt":An("FlowGraphFloatToInt"),"type/floatToBool":An("FlowGraphFloatToBoolean"),"flow/sequence":{blocks:["FlowGraphSequenceBlock"],extraProcessor:function(e,t,n,r,o){var a=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows||[]).length,a.signalOutputs.forEach((function(e,t){e.name="out_"+t})),o}},"flow/branch":{blocks:["FlowGraphBranchBlock"],outputs:{flows:{true:{name:"onTrue"},false:{name:"onFalse"}}}},"flow/switch":{blocks:["FlowGraphSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"},default:{name:"default"}}},validation:function(e){var t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return m.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}return{valid:!0}},extraProcessor:function(e,t,n,r,o){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 o[0].signalOutputs.forEach((function(e){"default"!==e.name&&(e.name="out_"+e.name)})),o}},"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"}}},extraProcessor:function(e,t,n,r,o){var a=o[0];return a.config||(a.config={}),a.config.incrementIndexWhenLoopDone=!0,o}},"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,r,o){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=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows).length,a.signalOutputs.forEach((function(e,t){e.name="out_"+t})),o}},"flow/waitAll":{blocks:["FlowGraphWaitAllBlock"],configuration:{inputFlows:{name:"inputSignalCount",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{flows:{reset:{name:"reset"},"[segment]":{name:"in_$1"}}},validation:function(e){var t,n,r;return"number"!=typeof(null===(r=null===(n=null===(t=e.configuration)||void 0===t?void 0:t.inputFlows)||void 0===n?void 0:n.value)||void 0===r?void 0:r[0])&&(e.configuration=e.configuration||{inputFlows:{value:[0]}},e.configuration.inputFlows.value=[0]),{valid:!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)?{valid:!0}:(m.Logger.Error("Variable get block should have a variable configuration"),{valid:!1,error:"Variable get block should have a variable configuration"})},configuration:{variable:{name:"variable",gltfType:"number",flowGraphType:"string",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return t.getVariableName(e)}}}},"variable/set":{blocks:["FlowGraphSetVariableBlock"],configuration:{variables:{name:"variables",gltfType:"number",flowGraphType:"string",inOptions:!0,isArray:!0,dataTransformer:function(e,t){return e.map((function(e){return t.getVariableName(e)}))}}},extraProcessor:function(e,t,n,r,o){return o[0].dataInputs.forEach((function(e){e.name=r.getVariableName(+e.name)})),o}},"variable/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphContextBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing","FlowGraphGetVariableBlock"],configuration:{variable:{name:"propertyName",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return t.getVariableName(e)}},useSlerp:{name:"animationType",inOptions:!0,defaultValue:!1,dataTransformer:function(e){return!0===e?"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,r,o){var a,i,s,l,u,c,f=o[0],d=null===(i=null===(a=e.configuration)||void 0===a?void 0:a.variable.value)||void 0===i?void 0:i[0];if("number"!=typeof d)throw m.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var p=r.arrays.staticVariables[d];void 0===(null===(l=null===(s=f.config)||void 0===s?void 0:s.animationType)||void 0===l?void 0:l.value)&&(f.config||(f.config={}),(u=f.config).animationType||(u.animationType={}),f.config.animationType.value=(0,m.getAnimationTypeByFlowGraphType)(p.type));var h=o[4];return h.config||(h.config={}),(c=h.config).variable||(c.variable={}),h.config.variable.value=r.getVariableName(d),o}},"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,r,o){return o.forEach((function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)})),o}},"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,r,o){return o.forEach((function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)})),o}},"pointer/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphJsonPointerParserBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing"],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:"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:"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,r,o){return o.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 o,a=null===(o=e.values)||void 0===o?void 0:o[n];if("value"===n&&a){var i=a.type;void 0!==i&&(t.config.animationType=r.arrays.types[i].flowGraphType)}})))})),o}},"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._animationTargetFps]}},endTime:{name:"to",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._animationTargetFps]}}}},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,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"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,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"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._animationTargetFps]}}}},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,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"math/switch":{blocks:["FlowGraphDataSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"}}},validation:function(e){var t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return m.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}return{valid:!0}},extraProcessor:function(e,t,n,r,o){var a=o[0];return a.dataInputs.forEach((function(e){"default"!==e.name&&"case"!==e.name&&(e.name="in_"+e.name)})),a.config||(a.config={}),a.config.treatCasesAsIntegers=!0,o}},"debug/log":{blocks:["FlowGraphConsoleLogBlock"],configuration:{message:{name:"messageTemplate",inOptions:!0}}}};function An(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,r,o,a){var i;if(n){(i=a[0]).config||(i.config={}),a[0].config.preventIntegerFloatArithmetic=!0;var s=-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)&&(s=e.values[t].type,!0)})),-1!==s&&(a[0].config.type=o.arrays.types[s].flowGraphType)}return a},validation:function(e){return n?On(e):{valid:!0}}}}function On(e){if(e.values){var t=Object.keys(e.values).map((function(t){return e.values[t].type})).filter((function(e){return void 0!==e}));if(!t.every((function(e){return e===t[0]})))return{valid:!1,error:"All inputs must be of the same type"}}return{valid:!0}}function wn(){return Object.keys(xn)}var Cn={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"}},En=function(){function e(e,t,n){void 0===n&&(n=60),this._interactivityGraph=e,this._gltf=t,this._animationTargetFps=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(Cn[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],r=bn(n);if(!r)throw m.Logger.Error(["No mapping found for declaration",n]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:r,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],r=this._parseVariable(n);this._staticVariables.push(r)}},e.prototype._parseVariable=function(e,t){var n=this._types[e.type];if(!n)throw m.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==n.length)throw m.Logger.Error(["Invalid value length for variable",e,n]),new Error("Error parsing variables");var r=e.value||[];if(!r.length)switch(n.flowGraphType){case"boolean":r.push(!1);break;case"FlowGraphInteger":r.push(0);break;case"number":r.push(NaN);break;case"Vector2":r.push(NaN,NaN);break;case"Vector3":r.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":r.fill(NaN,0,4);break;case"Matrix":r.fill(NaN,0,16);break;case"Matrix3D":r.fill(NaN,0,9)}return"number"===n.elementType&&"string"==typeof r[0]&&(r[0]=parseFloat(r[0])),{type:n.flowGraphType,value:t?t(r,this):r}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var t=function(t){var r={eventId:t.id||"internalEvent_"+n._internalEventsCounter++};t.values&&(r.eventData=Object.keys(t.values).map((function(n){var r,o=null===(r=t.values)||void 0===r?void 0:r[n];if(!o)throw m.Logger.Error(["No value found for event key",n]),new Error("Error parsing events");var a=e._types[o.type];if(!a)throw m.Logger.Error(["No type found for event value",o]),new Error("Error parsing events");var i=void 0!==o.value?e._parseVariable(o):void 0;return{id:n,type:a.flowGraphType,eventData:!0,value:i}}))),n._events.push(r)},n=this,r=0,o=this._interactivityGraph.events;r<o.length;r++)t(o[r])},e.prototype._parseNodes=function(){var e;if(this._interactivityGraph.nodes)for(var t=0,n=this._interactivityGraph.nodes;t<n.length;t++){var r=n[t];if("number"!=typeof r.declaration)throw m.Logger.Error(["No declaration found for node",r]),new Error("Error parsing nodes");var o=this._mappings[r.declaration];if(!o)throw m.Logger.Error(["No mapping found for node",r]),new Error("Error parsing nodes");if(o.flowGraphMapping.validation){var a=o.flowGraphMapping.validation(r,this._interactivityGraph,this._gltf);if(!a.valid)throw new Error("Error validating interactivity node ".concat(null===(e=this._interactivityGraph.declarations)||void 0===e?void 0:e[r.declaration].op," - ").concat(a.error))}for(var i=[],s=0,l=o.flowGraphMapping.blocks;s<l.length;s++){var u=l[s],c=this._getEmptyBlock(u,o.fullOperationName);this._parseNodeConfiguration(r,c,o.flowGraphMapping,u),i.push(c)}this._nodes.push({blocks:i,fullOperationName:o.fullOperationName})}},e.prototype._getEmptyBlock=function(e,t){return{uniqueId:(0,m.RandomGUID)(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,t,n,r){var o,a=e.configuration;if(a)for(var i in a){var s=a[i];if(!s)throw new Error("Error parsing node configuration");var l=null===(o=n.configuration)||void 0===o?void 0:o[i];if(l&&l.toBlock?l.toBlock===r:0===n.blocks.indexOf(r)){var u=null==l?void 0:l.defaultValue;(null==s?void 0:s.value)&&(u=s.value),(null==l?void 0:l.isArray)||(1!==u.length&&m.Logger.Warn("Invalid non-array value length: ".concat(u.length)),u=u[0]),(null==l?void 0:l.dataTransformer)&&(u=l.dataTransformer(u,this)),void 0!==u&&(t.config[(null==l?void 0:l.name)||i]={value:u})}}},e.prototype._parseNodeConnections=function(e){for(var t,n,r,o,a,i,s,l,u,c,f,d,p,h,_,y,g,b,v,T=0;T<this._nodes.length;T++){var x=null===(t=this._interactivityGraph.nodes)||void 0===t?void 0:t[T];if(!x)throw m.Logger.Error(["No node found for interactivity node",this._nodes[T]]),new Error("Error parsing node connections");var A=this._nodes[T],O=this._mappings[x.declaration];if(!O)throw m.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var w=x.flows||{},C=Object.keys(w).sort(),E=function(e){var t=w[e],u=null===(r=null===(n=O.flowGraphMapping.outputs)||void 0===n?void 0:n.flows)||void 0===r?void 0:r[e],c=(null==u?void 0:u.name)||e,f=M._createNewSocketConnection(c,!0);(u&&u.toBlock&&A.blocks.find((function(e){return e.className===u.toBlock}))||A.blocks[0]).signalOutputs.push(f);var d=t.node,p=M._nodes[d];if(!p)throw m.Logger.Error(["No node found for input node id",d]),new Error("Error parsing node connections");var h=gn(p.fullOperationName);if(!h)throw m.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var _=null===(a=null===(o=h.inputs)||void 0===o?void 0:o.flows)||void 0===a?void 0:a[t.socket||"in"],y=!1;if(!_)for(var g in null===(i=h.inputs)||void 0===i?void 0:i.flows)g.startsWith("[")&&g.endsWith("]")&&(y=!0,_=null===(l=null===(s=h.inputs)||void 0===s?void 0:s.flows)||void 0===l?void 0:l[g]);var b=_?y?_.name.replace("$1",t.socket||""):_.name:t.socket||"in",v=_&&_.toBlock&&p.blocks.find((function(e){return e.className===_.toBlock}))||p.blocks[0],T=v.signalInputs.find((function(e){return e.name===b}));T||(T=M._createNewSocketConnection(b),v.signalInputs.push(T)),T.connectedPointIds.push(f.uniqueId),f.connectedPointIds.push(T.uniqueId)},M=this,R=0,L=C;R<L.length;R++)E(L[R]);for(var P=x.values||{},N=Object.keys(P),F=function(t){var n=P[t],r=null===(c=null===(u=O.flowGraphMapping.inputs)||void 0===u?void 0:u.values)||void 0===c?void 0:c[t],o=!1;if(!r)for(var a in null===(f=O.flowGraphMapping.inputs)||void 0===f?void 0:f.values)a.startsWith("[")&&a.endsWith("]")&&(o=!0,r=null===(p=null===(d=O.flowGraphMapping.inputs)||void 0===d?void 0:d.values)||void 0===p?void 0:p[a]);var i=r?o?r.name.replace("$1",t):r.name:t,s=I._createNewSocketConnection(i);if((r&&r.toBlock&&A.blocks.find((function(e){return e.className===r.toBlock}))||A.blocks[0]).dataInputs.push(s),void 0!==n.value){var l=I._parseVariable(n,r&&r.dataTransformer);e._connectionValues[s.uniqueId]=l}else{if(void 0===n.node)throw m.Logger.Error(["Invalid value for value connection",n]),new Error("Error parsing node connections");var v=n.node,T=n.socket||"value",x=I._nodes[v];if(!x)throw m.Logger.Error(["No node found for output socket reference",n]),new Error("Error parsing node connections");var w=gn(x.fullOperationName);if(!w)throw m.Logger.Error(["No mapping found for output socket reference",n]),new Error("Error parsing node connections");var C=null===(_=null===(h=w.outputs)||void 0===h?void 0:h.values)||void 0===_?void 0:_[T],E=!1;if(!C)for(var a in null===(y=w.outputs)||void 0===y?void 0:y.values)a.startsWith("[")&&a.endsWith("]")&&(E=!0,C=null===(b=null===(g=w.outputs)||void 0===g?void 0:g.values)||void 0===b?void 0:b[a]);var M=C?E?C.name.replace("$1",T):null==C?void 0:C.name:T,R=C&&C.toBlock&&x.blocks.find((function(e){return e.className===C.toBlock}))||x.blocks[0],L=R.dataOutputs.find((function(e){return e.name===M}));L||(L=I._createNewSocketConnection(M,!0),R.dataOutputs.push(L)),s.connectedPointIds.push(L.uniqueId),L.connectedPointIds.push(s.uniqueId)}},I=this,S=0,k=N;S<k.length;S++)F(k[S]);if(O.flowGraphMapping.interBlockConnectors)for(var B=0,G=O.flowGraphMapping.interBlockConnectors;B<G.length;B++){var V=G[B],D=V.input,H=V.output,U=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],U)}if(O.flowGraphMapping.extraProcessor){var j=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!j)throw m.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=O.flowGraphMapping.extraProcessor(x,j,O.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,t){return{uniqueId:(0,m.RandomGUID)(),name:e,_connectionType:t?1:0,connectedPointIds:[]}},e.prototype._connectFlowGraphNodes=function(e,t,n,r,o){var a=o?n.dataInputs:n.signalInputs,i=o?r.dataOutputs:r.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,m.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}(),Mn="KHR_interactivity",Rn=function(){function e(e){this._loader=e,this.name=Mn,this.enabled=this._loader.isExtensionUsed(Mn),this._pathConverter=(0,he.Wt)(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&Ln(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(t=null===(o=this._loader.gltf.extensions)||void 0===o?void 0:o.KHR_interactivity)?((n=new m.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,r=t.graphs.map((function(e){return new En(e,a._loader.gltf,a._loader.parent.targetFps).serializeToFlowGraph()})),[4,Promise.all(r.map((function(e){return(0,h.sH)(a,void 0,void 0,(function(){return(0,h.YH)(this,(function(t){switch(t.label){case 0:return[4,(0,m.ParseFlowGraphAsync)(e,{coordinator:n,pathConverter:this._pathConverter})];case 1:return[2,t.sent()]}}))}))})))]):[2]):[2];case 1:return i.sent(),n.start(),[2]}}))}))},e}();function Ln(e){(0,he.oR)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new m.Quaternion(NaN,NaN,NaN,NaN);var t=m.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:function(){return e.activeCamera}}),(0,he.oR)("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new m.Vector3(NaN,NaN,NaN);var t=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(t.x*=-1),t},type:"Vector3",getTarget:function(){return e.activeCamera}}),(0,he.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,he.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,he.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,he.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,he.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,m.addToBlockFactory)(Mn,"FlowGraphGLTFDataProvider",(function(){return(0,h.sH)(void 0,void 0,void 0,(function(){return(0,h.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]}}))}))})),ge(Mn),ye(Mn,!0,(function(e){return new Rn(e)}));var Pn="KHR_node_visibility";(0,he.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,r;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach((function(e){e.inheritVisibility=!0})),t._babylonTransformNode&&(t._babylonTransformNode.isVisible=e),null===(r=t._primitiveBabylonMeshes)||void 0===r||r.forEach((function(t){t.isVisible=e}))},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"isVisible"}],type:"boolean"});var Nn=function(){function e(e){this.name=Pn,this._loader=e,this.enabled=e.isExtensionUsed(Pn)}return e.prototype.onReady=function(){if(this._loader){var e=this._loader.gltf.nodes;if(e)for(var t=0,n=e;t<n.length;t++){var r=n[t],o=r._babylonTransformNode;o&&(o.inheritVisibility=!0,r.extensions&&r.extensions.KHR_node_visibility&&!1===r.extensions.KHR_node_visibility.visible&&(o.isVisible=!1))}}},e.prototype.dispose=function(){delete this._loader},e}();ge(Pn),ye(Pn,!0,(function(e){return new Nn(e)}));var Fn="KHR_node_selectability";vn("event/onSelect",Fn,{blocks:["FlowGraphMeshPickEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return"pickedMesh_"+e}}},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,r,o,a,i){var s,l,u,c,f,d,p,h=o[o.length-1];h.config=h.config||{},h.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _="pickedMesh_"+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(p=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}}),(0,he.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 In=function(){function e(e){this.name=Fn,this._loader=e,this.enabled=e.isExtensionUsed(Fn)}return e.prototype.onReady=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e;return(0,h.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,r;(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===(r=e._babylonTransformNode)||void 0===r||r.getChildMeshes().forEach((function(e){e.isPickable=!1})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();ge(Fn),ye(Fn,!0,(function(e){return new In(e)}));var Sn="KHR_node_hoverability",kn="targetMeshPointerOver_";vn("event/onHoverIn",Sn,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return kn+e}}},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,r,o,a,i){var s,l,u,c,f,d,p,h=o[o.length-1];h.config=h.config||{},h.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _=kn+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(p=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}});var Bn="targetMeshPointerOut_";vn("event/onHoverOut",Sn,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return Bn+e}}},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,r,o,a,i){var s,l,u,c,f,d,p,h=o[o.length-1];h.config=h.config||{},h.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _=Bn+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(p=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}}),(0,he.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 Gn=function(){function e(e){this.name=Sn,this._loader=e,this.enabled=e.isExtensionUsed(Sn)}return e.prototype.onReady=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e;return(0,h.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,r;(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===(r=e._babylonTransformNode)||void 0===r||r.getChildMeshes().forEach((function(e){e.pointerOverDisableMeshTesting=!0})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();ge(Sn),ye(Sn,!0,(function(e){return new Gn(e)}));var Vn="ExtrasAsMetadata",Dn=function(){function e(e){this.name=Vn,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.prototype.loadAnimationAsync=function(e,t){var n=this;return this._loader.loadAnimationAsync(e,t).then((function(e){return n._assignExtras(e,t),e}))},e}();ge(Vn),ye(Vn,!1,(function(e){return new Dn(e)}));var Hn=a(274),Un=a(833),jn=a(561),Kn=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Kn){Kn.BABYLON=Kn.BABYLON||{};var Wn=Kn.BABYLON;Wn.GLTF2=Wn.GLTF2||{},Wn.GLTF2.Loader=Wn.GLTF2.Loader||{},Wn.GLTF2.Loader.Extensions=Wn.GLTF2.Loader.Extensions||{};var zn=[];for(var Zn in c)Wn.GLTF2.Loader.Extensions[Zn]=c[Zn],zn.push(Zn);for(var Zn in f)Wn.GLTF2.Loader[Zn]=f[Zn],zn.push(Zn);for(var Zn in d)zn.indexOf(Zn)>-1||(Wn.GLTF2[Zn]=d[Zn])}const Yn=p;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,r={274:(e,t,n)=>{n.r(t),n.d(t,{FlowGraphGLTFDataProvider:()=>a});var r=n(322),o=n(597),a=function(e){function t(t){var n,r,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",o.RichTypeAny,s);var l=(null===(r=i.nodes)||void 0===r?void 0:r.map((function(e){return e._babylonTransformNode})))||[];return a.nodes=a.registerDataOutput("nodes",o.RichTypeAny,l),a}return(0,r.C6)(t,e),t.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},t}(o.FlowGraphBlock)},322:(e,t,n)=>{n.d(t,{C6:()=>o,Cl:()=>a,YH:()=>s,sH:()=>i});var r=function(e,t){return r=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])},r(e,t)};function o(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}r(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,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},a.apply(this,arguments)};function i(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 s(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},561:(e,t,n)=>{n.r(t),n.d(t,{PBRMaterialLoadingAdapter:()=>o});var r=n(597),o=function(){function e(e){this._material=e,this._material.enableSpecularAntiAliasing=!0}return Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUnlit",{get:function(){return this._material.unlit},set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._material.backFaceCulling},set:function(e){this._material.backFaceCulling=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"twoSidedLighting",{get:function(){return this._material.twoSidedLighting},set:function(e){this._material.twoSidedLighting=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaCutOff",{get:function(){return this._material.alphaCutOff},set:function(e){this._material.alphaCutOff=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useAlphaFromBaseColorTexture",{get:function(){return this._material.useAlphaFromAlbedoTexture},set:function(e){this._material.useAlphaFromAlbedoTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparencyAsAlphaCoverage",{get:function(){return this._material.useRadianceOverAlpha||this._material.useSpecularOverAlpha},set:function(e){this._material.useRadianceOverAlpha=!e,this._material.useSpecularOverAlpha=!e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColor",{get:function(){return this._material.albedoColor},set:function(e){this._material.albedoColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColorTexture",{get:function(){return this._material.albedoTexture},set:function(e){this._material.albedoTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughness",{get:function(){var e;return null!==(e=this._material.baseDiffuseRoughness)&&void 0!==e?e:0},set:function(e){this._material.baseDiffuseRoughness=e,e>0&&(this._material.brdf.baseDiffuseModel=r.Constants.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughnessTexture",{get:function(){return this._material.baseDiffuseRoughnessTexture},set:function(e){this._material.baseDiffuseRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalness",{get:function(){var e;return null!==(e=this._material.metallic)&&void 0!==e?e:1},set:function(e){this._material.metallic=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalnessTexture",{get:function(){return this._material.metallicTexture},set:function(e){this._material.metallicTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useRoughnessFromMetallicTextureGreen",{set:function(e){this._material.useRoughnessFromMetallicTextureGreen=e,this._material.useRoughnessFromMetallicTextureAlpha=!e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useMetallicFromMetallicTextureBlue",{set:function(e){this._material.useMetallnessFromMetallicTextureBlue=e},enumerable:!1,configurable:!0}),e.prototype.enableSpecularEdgeColor=function(e){void 0===e&&(e=!1),e&&(this._material.brdf.dielectricSpecularModel=r.Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=r.Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR)},Object.defineProperty(e.prototype,"specularWeight",{get:function(){var e;return null!==(e=this._material.metallicF0Factor)&&void 0!==e?e:1},set:function(e){this._material.metallicF0Factor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularWeightTexture",{get:function(){return this._material.metallicReflectanceTexture},set:function(e){e?(this._material.metallicReflectanceTexture=e,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!0):(this._material.metallicReflectanceTexture=null,this._material.useOnlyMetallicFromMetallicReflectanceTexture=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColor",{get:function(){return this._material.metallicReflectanceColor},set:function(e){this._material.metallicReflectanceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._material.reflectanceTexture},set:function(e){this._material.reflectanceTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughness",{get:function(){var e;return null!==(e=this._material.roughness)&&void 0!==e?e:1},set:function(e){this._material.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessTexture",{get:function(){return this._material.metallicTexture},set:function(e){this.baseMetalnessTexture||(this._material.metallicTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularIor",{get:function(){return this._material.indexOfRefraction},set:function(e){this._material.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColor",{get:function(){return this._material.emissiveColor},set:function(e){this._material.emissiveColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionLuminance",{get:function(){return this._material.emissiveIntensity},set:function(e){this._material.emissiveIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColorTexture",{get:function(){return this._material.emissiveTexture},set:function(e){this._material.emissiveTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTexture",{get:function(){return this._material.ambientTexture},set:function(e){this._material.ambientTexture=e,e&&(this._material.useAmbientInGrayScale=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTextureStrength",{get:function(){var e;return null!==(e=this._material.ambientTextureStrength)&&void 0!==e?e:1},set:function(e){this._material.ambientTextureStrength=e},enumerable:!1,configurable:!0}),e.prototype.configureCoat=function(){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.remapF0OnInterfaceChange=!1},Object.defineProperty(e.prototype,"coatWeight",{get:function(){return this._material.clearCoat.intensity},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatWeightTexture",{get:function(){return this._material.clearCoat.texture},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColor",{set:function(e){this._material.clearCoat.isTintEnabled=e!=r.Color3.White(),this._material.clearCoat.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColorTexture",{set:function(e){this._material.clearCoat.tintTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughness",{get:function(){var e;return null!==(e=this._material.clearCoat.roughness)&&void 0!==e?e:0},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessTexture",{get:function(){return this._material.clearCoat.textureRoughness},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.useRoughnessFromMainTexture=!1,this._material.clearCoat.textureRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatIor",{set:function(e){this._material.clearCoat.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkening",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkeningTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessAnisotropy",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentAngle",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentTexture",{get:function(){return null},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.subSurface.refractionIntensity},set:function(e){this._material.subSurface.isRefractionEnabled=e>0,this._material.subSurface.refractionIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{set:function(e){this._material.subSurface.isRefractionEnabled=!0,this._material.subSurface.refractionIntensityTexture=e,this._material.subSurface.useGltfStyleTextures=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDepth",{set:function(e){this._material.subSurface.tintColorAtDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){e>0?(this._material.subSurface.isDispersionEnabled=!0,this._material.subSurface.dispersion=20/e):(this._material.subSurface.isDispersionEnabled=!1,this._material.subSurface.dispersion=0)},enumerable:!1,configurable:!0}),e.prototype.configureTransmission=function(){this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.useAlbedoToTintRefraction=!0,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0},Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){this._material.subSurface.thicknessTexture=e,this._material.subSurface.useGltfStyleTextures=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=e,this._material.subSurface.useThicknessAsDepth=!0,e>0&&(this._material.subSurface.volumeIndexOfRefraction=this._material.indexOfRefraction)},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){this._material.subSurface.useGltfStyleTextures=!0,this._material.subSurface.volumeIndexOfRefraction=1,this._material.subSurface.minimumThickness=0,this._material.subSurface.maximumThickness=0,this._material.subSurface.useAlbedoToTintTranslucency=!1},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return this._material.subSurface.isTranslucencyEnabled?this._material.subSurface.translucencyIntensity:0},set:function(e){this._material.subSurface.isTranslucencyEnabled=e>0,this._material.subSurface.translucencyIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){this._material.subSurface.translucencyIntensityTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){this._material.subSurface.translucencyColorTexture=e},enumerable:!1,configurable:!0}),e.prototype.configureFuzz=function(){this._material.sheen.isEnabled=!0,this._material.sheen.useRoughnessFromMainTexture=!1,this._material.sheen.albedoScaling=!0},Object.defineProperty(e.prototype,"fuzzWeight",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzWeightTexture",{set:function(e){this._material.sheen.texture||(this._material.sheen.texture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColor",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.color=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColorTexture",{set:function(e){this._material.sheen.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughness",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.roughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughnessTexture",{set:function(e){this._material.sheen.isEnabled=!0,this._material.sheen.textureRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessAnisotropy",{get:function(){return this._material.anisotropy.intensity},set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentAngle",{set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.angle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentTexture",{get:function(){return this._material.anisotropy.texture},set:function(e){this._material.anisotropy.isEnabled=!0,this._material.anisotropy.texture=e},enumerable:!1,configurable:!0}),e.prototype.configureGltfStyleAnisotropy=function(e){void 0===e&&(e=!0)},Object.defineProperty(e.prototype,"thinFilmWeight",{set:function(e){this._material.iridescence.isEnabled=e>0,this._material.iridescence.intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmIor",{set:function(e){this._material.iridescence.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMinimum",{set:function(e){this._material.iridescence.minimumThickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMaximum",{set:function(e){this._material.iridescence.maximumThickness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmWeightTexture",{set:function(e){this._material.iridescence.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessTexture",{set:function(e){this._material.iridescence.thicknessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersion",{set:function(e){this._material._dispersion=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unlit",{set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryOpacity",{get:function(){return this._material.alpha},set:function(e){this._material.alpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryNormalTexture",{get:function(){return this._material.bumpTexture},set:function(e){this._material.bumpTexture=e,this._material.forceIrradianceInFragment=!0},enumerable:!1,configurable:!0}),e.prototype.setNormalMapInversions=function(e,t){this._material.invertNormalMapX=e,this._material.invertNormalMapY=t},Object.defineProperty(e.prototype,"geometryCoatNormalTexture",{get:function(){return this._material.clearCoat.bumpTexture},set:function(e){this._material.clearCoat.isEnabled=!0,this._material.clearCoat.bumpTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatNormalTextureScale",{set:function(e){this._material.clearCoat.bumpTexture&&(this._material.clearCoat.bumpTexture.level=e)},enumerable:!1,configurable:!0}),e}()},597:t=>{t.exports=e},698:(e,t,n)=>{n.d(t,{oR:()=>p,tQ:()=>f,Wt:()=>c,ZU:()=>d});var r=n(597),o=[{regex:new RegExp("^/nodes/\\d+/extensions/")}],a=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 a=e.split("/");if(a.shift(),a[a.length-1].includes(".length")){var i=a[a.length-1].split(".");a.pop(),a.push.apply(a,i)}for(var s=!1,l=0,u=a;l<u.length;l++){var c=u[l],f="length"===c;if(f&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(s=!0),n.__array__&&!f)n=n.__array__;else if(!(n=n[c]))throw new Error("Path ".concat(e," is invalid"));if(!s)if(void 0===t){if(!o.find((function(t){return t.regex.test(e)})))throw new Error("Path ".concat(e," is invalid"))}else f||(t=null==t?void 0:t[c]);(n.__target__||f)&&(r=t)}return{object:r,info:n}},e}();function i(e,t,n,r){var o=s(e);return r?o[n][r]:o[n]}function s(e,t,n){var o,a,i;return null===(i=null===(o=e._data)||void 0===o?void 0:o[null!==(a=null==n?void 0:n.fillMode)&&void 0!==a?a:r.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function l(e,t){return{offset:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uOffset,null==s?void 0:s.vOffset)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uOffset=n.x,s.vOffset=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uOffset")},function(){return"".concat(e).concat(t?"."+t:"",".vOffset")}]},rotation:{type:"number",get:function(n,r,o){var a;return null===(a=i(n,0,e,t))||void 0===a?void 0:a.wAng},getTarget:s,set:function(n,r,o,a){return i(r,0,e,t).wAng=n},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(n,o,a){var s=i(n,0,e,t);return new r.Vector2(null==s?void 0:s.uScale,null==s?void 0:s.vScale)},getTarget:s,set:function(n,r,o,a){var s=i(r,0,e,t);s.uScale=n.x,s.vScale=n.y},getPropertyName:[function(){return"".concat(e).concat(t?"."+t:"",".uScale")},function(){return"".concat(e).concat(t?"."+t:"",".vScale")}]}}}var u={cameras:{__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var t,n,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoLeft)&&void 0!==n?n:0,null!==(a=null===(o=e._babylonCamera)||void 0===o?void 0:o.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,o,a;return new r.Vector2(null!==(n=null===(t=e._babylonCamera)||void 0===t?void 0:t.orthoBottom)&&void 0!==n?n:0,null!==(a=null===(o=e._babylonCamera)||void 0===o?void 0:o.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,r;return null===(r=null===(n=t._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion)||void 0===r?void 0:r.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,r;return void 0!==t?null===(r=null===(n=e._primitiveBabylonMeshes)||void 0===n?void 0:n[0].morphTargetManager)||void 0===r?void 0:r.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,n,o;return r.Matrix.Compose(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.scaling,null===(n=e._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion,null===(o=e._babylonTransformNode)||void 0===o?void 0:o.position)},getTarget:function(e){return e._babylonTransformNode},isReadOnly:!0},globalMatrix:{type:"Matrix",get:function(e){for(var t,n,o,a,i,s,l,u=r.Matrix.Identity(),c=e.parent;c&&c.parent;)c=c.parent;var f=(null===(t=e._babylonTransformNode)||void 0===t?void 0:t.position._isDirty)||(null===(o=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.rotationQuaternion)||void 0===o?void 0:o._isDirty)||(null===(a=e._babylonTransformNode)||void 0===a?void 0:a.scaling._isDirty);if(c){var d=null===(i=c._babylonTransformNode)||void 0===i?void 0:i.computeWorldMatrix(!0).invert();d&&(null===(l=null===(s=e._babylonTransformNode)||void 0===s?void 0:s.computeWorldMatrix(f))||void 0===l||l.multiplyToRef(d,u))}else e._babylonTransformNode&&u.copyFrom(e._babylonTransformNode.computeWorldMatrix(f));return u},getTarget:function(e){return e._babylonTransformNode},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 r.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 r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.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 r.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 r.SpotLight}),!0)[0]},set:function(e,t){if(t._babylonTransformNode){var n=t._babylonTransformNode.getChildren((function(e){return e instanceof r.SpotLight}),!0)[0];n&&(n.diffuse=e)}}}},KHR_node_visibility:{visible:{type:"boolean",get:function(e){return!!e._primitiveBabylonMeshes&&e._primitiveBabylonMeshes[0].isVisible},getTarget:function(){},set:function(e,t){t._primitiveBabylonMeshes&&t._primitiveBabylonMeshes.forEach((function(t){return t.isVisible=e}))}}}}}},materials:{__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).emissiveColor},set:function(e,t,n,r){return s(t,0,r).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:l("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=i(e,0,"bumpTexture"))||void 0===r?void 0:r.level},set:function(e,t,n,r){var o=i(t,0,"bumpTexture");o&&(o.level=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:l("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return s(e,0,n).ambientTextureStrength},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.ambientTextureStrength=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:l("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,t,n){var o=s(e,0,n);return r.Color4.FromColor3(o.albedoColor,o.alpha)},set:function(e,t,n,r){var o=s(t,0,r);o.albedoColor.set(e.r,e.g,e.b),o.alpha=e.a},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:l("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallic},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.metallic=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).roughness},set:function(e,t,n,r){var o=s(t,0,r);o&&(o.roughness=e)},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:l("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.intensity},set:function(e,t,n,r){s(t,0,r).anisotropy.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return s(e,0,n).anisotropy.angle},set:function(e,t,n,r){s(t,0,r).anisotropy.angle=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:l("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.intensity},set:function(e,t,n,r){s(t,0,r).clearCoat.intensity=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).clearCoat.roughness},set:function(e,t,n,r){s(t,0,r).clearCoat.roughness=e},getTarget:function(e,t,n){return s(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:l("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=s(e,0,n).clearCoat.bumpTexture)||void 0===r?void 0:r.level},getTarget:s,set:function(e,t,n,r){return s(t,0,r).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:l("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:l("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.dispersion},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return s(e,0,n).emissiveIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return s(e,0,n).indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.indexOfRefraction},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:l("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return s(e,0,n).iridescence.minimumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:l("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).sheen.color},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:l("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).sheen.intensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:l("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return s(e,0,n).metallicF0Factor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).metallicReflectanceColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:l("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:l("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.refractionIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.translucencyIntensity},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.translucencyColor},getTarget:s,set:function(e,t,n,r){var o;return e&&(null===(o=s(t,0,r).subSurface.translucencyColor)||void 0===o?void 0:o.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:l("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return s(e,0,n).subSurface.tintColor},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.tintColorAtDistance},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return s(e,0,n).subSurface.maximumThickness},getTarget:s,set:function(e,t,n,r){return s(t,0,r).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:l("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_area:{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"}]},size:{type:"number",get:function(e){var t;return null===(t=e._babylonLight)||void 0===t?void 0:t.height},set:function(e,t){return t._babylonLight?t._babylonLight.height=e:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"size"}]},rect:{aspect:{type:"number",get:function(e){var t,n;return(null===(t=e._babylonLight)||void 0===t?void 0:t.width)/(null===(n=e._babylonLight)||void 0===n?void 0:n.height)},set:function(e,t){return t._babylonLight?t._babylonLight.width=e*t._babylonLight.height:void 0},getTarget:function(e){return e._babylonLight},getPropertyName:[function(e){return"aspect"}]}}}}},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&&r.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=r.Quaternion.Inverse(e)),r.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 c(e){return new a(e,u)}function f(e){for(var t=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),n=u,r=0,o=t;r<o.length;r++){var a=o[r];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__")})),r=u,o=0,a=n;o<a.length;o++){var i=a[o];i&&(r=r[i])}r&&r.type&&r.get&&(r.interpolation=t)}function p(e,t){for(var n=e.split("/").map((function(e){return e.replace(/{}/g,"__array__")})),r=u,o=0,a=n;o<a.length;o++){var i=a[o];if(i){if(!r[i]){if("?"===i){r.__ignoreObjectTree__=!0;continue}r[i]={},"__array__"===i&&(r[i].__target__=!0)}r=r[i]}}Object.assign(r,t)}},727:(e,t,n)=>{n.r(t),n.d(t,{AnimationPropertyInfo:()=>u,TransformNodeAnimationPropertyInfo:()=>c,WeightAnimationPropertyInfo:()=>f,getQuaternion:()=>s,getVector3:()=>i,getWeights:()=>l});var r=n(322),o=n(597),a=n(698);function i(e,t,n,r){return o.Vector3.FromArray(t,n).scaleInPlace(r)}function s(e,t,n,r){return o.Quaternion.FromArray(t,n).scaleInPlace(r)}function l(e,t,n,r){for(var o=new Array(e._numMorphTargets),a=0;a<o.length;a++)o[a]=t[n++]*r;return o}var u=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 o.Animation(e,this.name,t,this.type);return r.setKeys(n,!0),r},e}(),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=[];return o.push({babylonAnimatable:e._babylonTransformNode,babylonAnimation:this._buildAnimation(t,n,r)}),o},t}(u),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new o.Animation("".concat(t,"_").concat(i),s.name,n,s.type);if(l.setKeys(r.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}})),!0),e._primitiveBabylonMeshes)for(var u=0,c=e._primitiveBabylonMeshes;u<c.length;u++){var f=c[u];if(f.morphTargetManager){var d=f.morphTargetManager.getTarget(i),p=l.clone();d.animations.push(p),a.push({babylonAnimatable:d,babylonAnimation:p})}}},s=this,l=0;l<e._numMorphTargets;l++)i(l);return a},t}(u);(0,a.ZU)("/nodes/{}/translation",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"position",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/rotation",[new c(o.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",s,(function(){return 4}))]),(0,a.ZU)("/nodes/{}/scale",[new c(o.Animation.ANIMATIONTYPE_VECTOR3,"scaling",i,(function(){return 3}))]),(0,a.ZU)("/nodes/{}/weights",[new f(o.Animation.ANIMATIONTYPE_FLOAT,"influence",l,(function(e){return e._numMorphTargets}))])},833:(e,t,n)=>{n.r(t),n.d(t,{OpenPBRMaterialLoadingAdapter:()=>r});var r=function(){function e(e){this._material=e}return Object.defineProperty(e.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUnlit",{get:function(){return this._material.unlit},set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backFaceCulling",{get:function(){return this._material.backFaceCulling},set:function(e){this._material.backFaceCulling=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"twoSidedLighting",{get:function(){return this._material.twoSidedLighting},set:function(e){this._material.twoSidedLighting=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alphaCutOff",{get:function(){return.5},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useAlphaFromBaseColorTexture",{get:function(){return!1},set:function(e){this._material._useAlphaFromBaseColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transparencyAsAlphaCoverage",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColor",{get:function(){return this._material.baseColor},set:function(e){this._material.baseColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseColorTexture",{get:function(){return this._material.baseColorTexture},set:function(e){this._material.baseColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughness",{get:function(){return this._material.baseDiffuseRoughness},set:function(e){this._material.baseDiffuseRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseDiffuseRoughnessTexture",{get:function(){return this._material.baseDiffuseRoughnessTexture},set:function(e){this._material.baseDiffuseRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalness",{get:function(){return this._material.baseMetalness},set:function(e){this._material.baseMetalness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseMetalnessTexture",{get:function(){return this._material.baseMetalnessTexture},set:function(e){this._material.baseMetalnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useRoughnessFromMetallicTextureGreen",{set:function(e){this._material._useRoughnessFromMetallicTextureGreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"useMetallicFromMetallicTextureBlue",{set:function(e){this._material._useMetallicFromMetallicTextureBlue=e},enumerable:!1,configurable:!0}),e.prototype.enableSpecularEdgeColor=function(e){void 0===e&&(e=!1)},Object.defineProperty(e.prototype,"specularWeight",{get:function(){return this._material.specularWeight},set:function(e){this._material.specularWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularWeightTexture",{get:function(){return this._material.specularWeightTexture},set:function(e){this._material.specularColorTexture===e?(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0):this._material.specularWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColor",{get:function(){return this._material.specularColor},set:function(e){this._material.specularColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._material.specularColorTexture},set:function(e){this._material.specularColorTexture=e,this._material.specularWeightTexture===this._material.specularColorTexture&&(this._material.specularWeightTexture=null,this._material._useSpecularWeightFromSpecularColorTexture=!0,this._material._useSpecularWeightFromAlpha=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughness",{get:function(){return this._material.specularRoughness},set:function(e){this._material.specularRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessTexture",{get:function(){return this._material.specularRoughnessTexture},set:function(e){this._material.specularRoughnessTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularIor",{get:function(){return this._material.specularIor},set:function(e){this._material.specularIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColor",{get:function(){return this._material.emissionColor},set:function(e){this._material.emissionColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionLuminance",{get:function(){return this._material.emissionLuminance},set:function(e){this._material.emissionLuminance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"emissionColorTexture",{get:function(){return this._material.emissionColorTexture},set:function(e){this._material.emissionColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTexture",{get:function(){return this._material.ambientOcclusionTexture},set:function(e){this._material.ambientOcclusionTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ambientOcclusionTextureStrength",{get:function(){var e,t=this._material.ambientOcclusionTexture;return null!==(e=null==t?void 0:t.level)&&void 0!==e?e:1},set:function(e){var t=this._material.ambientOcclusionTexture;t&&(t.level=e)},enumerable:!1,configurable:!0}),e.prototype.configureCoat=function(){},Object.defineProperty(e.prototype,"coatWeight",{get:function(){return this._material.coatWeight},set:function(e){this._material.coatWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatWeightTexture",{get:function(){return this._material.coatWeightTexture},set:function(e){this._material.coatWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColor",{set:function(e){this._material.coatColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatColorTexture",{set:function(e){this._material.coatColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughness",{get:function(){return this._material.coatRoughness},set:function(e){this._material.coatRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessTexture",{get:function(){return this._material.coatRoughnessTexture},set:function(e){this._material.coatRoughnessTexture=e,e&&(this._material._useCoatRoughnessFromGreenChannel=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatIor",{set:function(e){this._material.coatIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkening",{set:function(e){this._material.coatDarkening=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkeningTexture",{set:function(e){this._material.coatDarkeningTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatRoughnessAnisotropy",{get:function(){return this._material.coatRoughnessAnisotropy},set:function(e){this._material.coatRoughnessAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentAngle",{set:function(e){this._material.geometryCoatTangentAngle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatTangentTexture",{get:function(){return this._material.geometryCoatTangentTexture},set:function(e){this._material.geometryCoatTangentTexture=e,e&&(this._material._useCoatRoughnessAnisotropyFromTangentTexture=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureTransmission=function(){},Object.defineProperty(e.prototype,"transmissionDepth",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),e.prototype.configureFuzz=function(){},Object.defineProperty(e.prototype,"fuzzWeight",{set:function(e){this._material.fuzzWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzWeightTexture",{set:function(e){this._material.fuzzWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColor",{set:function(e){this._material.fuzzColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzColorTexture",{set:function(e){this._material.fuzzColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughness",{set:function(e){this._material.fuzzRoughness=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fuzzRoughnessTexture",{set:function(e){this._material.fuzzRoughnessTexture=e,this._material._useFuzzRoughnessFromTextureAlpha=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularRoughnessAnisotropy",{get:function(){return this._material.specularRoughnessAnisotropy},set:function(e){this._material.specularRoughnessAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentAngle",{set:function(e){this._material.geometryTangentAngle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryTangentTexture",{get:function(){return this._material.geometryTangentTexture},set:function(e){this._material.geometryTangentTexture=e,this._material._useSpecularRoughnessAnisotropyFromTangentTexture=!0},enumerable:!1,configurable:!0}),e.prototype.configureGltfStyleAnisotropy=function(e){void 0===e&&(e=!0),this._material._useGltfStyleAnisotropy=e},Object.defineProperty(e.prototype,"thinFilmWeight",{set:function(e){this._material.thinFilmWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmIor",{set:function(e){this._material.thinFilmIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMinimum",{set:function(e){this._material.thinFilmThicknessMin=e/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessMaximum",{set:function(e){this._material.thinFilmThickness=e/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmWeightTexture",{set:function(e){this._material.thinFilmWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thinFilmThicknessTexture",{set:function(e){this._material.thinFilmThicknessTexture=e,this._material._useThinFilmThicknessFromTextureGreen=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unlit",{set:function(e){this._material.unlit=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryOpacity",{get:function(){return this._material.geometryOpacity},set:function(e){this._material.geometryOpacity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryNormalTexture",{get:function(){return this._material.geometryNormalTexture},set:function(e){this._material.geometryNormalTexture=e},enumerable:!1,configurable:!0}),e.prototype.setNormalMapInversions=function(e,t){},Object.defineProperty(e.prototype,"geometryCoatNormalTexture",{get:function(){return this._material.geometryCoatNormalTexture},set:function(e){this._material.geometryCoatNormalTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"geometryCoatNormalTextureScale",{set:function(e){this._material.geometryCoatNormalTexture&&(this._material.geometryCoatNormalTexture.level=e)},enumerable:!1,configurable:!0}),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}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,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||"function"==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:()=>Yn});var s={};a.r(s),a.d(s,{GLTFValidation:()=>T});var l={};a.r(l),a.d(l,{GLTFFileLoader:()=>M,GLTFLoaderAnimationStartMode:()=>b,GLTFLoaderCoordinateSystemMode:()=>g,GLTFLoaderDefaultOptions:()=>E,GLTFLoaderState:()=>v});var u={};a.r(u),a.d(u,{EBlendingFunction:()=>k,EComponentType:()=>R,ECullingType:()=>S,EParameterType:()=>P,EShaderType:()=>L,ETextureFilterType:()=>F,ETextureFormat:()=>I,ETextureWrapMode:()=>N,GLTFBinaryExtension:()=>ce,GLTFLoader:()=>le,GLTFLoaderBase:()=>se,GLTFLoaderExtension:()=>ue,GLTFMaterialsCommonExtension:()=>fe,GLTFUtils:()=>D});var c={};a.r(c),a.d(c,{AddObjectAccessorToKey:()=>he.oR,EXT_lights_area:()=>He,EXT_lights_ies:()=>Se,EXT_lights_image_based:()=>we,EXT_mesh_gpu_instancing:()=>Ee,EXT_meshopt_compression:()=>Re,EXT_texture_avif:()=>Fe,EXT_texture_webp:()=>Pe,ExtrasAsMetadata:()=>Dn,FlowGraphGLTFDataProvider:()=>Hn.FlowGraphGLTFDataProvider,GetMappingForKey:()=>he.tQ,GetPathToObjectConverter:()=>he.Wt,InteractivityGraphToFlowGraphParser:()=>En,KHR_animation_pointer:()=>un,KHR_draco_mesh_compression:()=>Be,KHR_interactivity:()=>Rn,KHR_lights:()=>Ve,KHR_materials_anisotropy:()=>$e,KHR_materials_clearcoat:()=>Ze,KHR_materials_coat:()=>qe,KHR_materials_diffuse_roughness:()=>xt,KHR_materials_diffuse_transmission:()=>_t,KHR_materials_dispersion:()=>vt,KHR_materials_emissive_strength:()=>tt,KHR_materials_fuzz:()=>at,KHR_materials_ior:()=>ut,KHR_materials_iridescence:()=>Xe,KHR_materials_pbrSpecularGlossiness:()=>je,KHR_materials_sheen:()=>rt,KHR_materials_specular:()=>st,KHR_materials_transmission:()=>ht,KHR_materials_unlit:()=>We,KHR_materials_variants:()=>ft,KHR_materials_volume:()=>gt,KHR_mesh_quantization:()=>Ot,KHR_node_hoverability:()=>Gn,KHR_node_selectability:()=>In,KHR_node_visibility:()=>Nn,KHR_texture_basisu:()=>Ct,KHR_texture_transform:()=>Mt,KHR_xmp_json_ld:()=>Lt,MSFT_audio_emitter:()=>fn,MSFT_lod:()=>pn,MSFT_minecraftMesh:()=>mn,MSFT_sRGBFactors:()=>yn,SetInterpolationForKey:()=>he.ZU,_AddInteractivityObjectModel:()=>Ln,addNewInteractivityFlowGraphMapping:()=>vn,getAllSupportedNativeNodeTypes:()=>wn,getMappingForDeclaration:()=>bn,getMappingForFullOperationName:()=>gn,gltfTypeToBabylonType:()=>Cn});var f={};a.r(f);var d={};a.r(d),a.d(d,{AddObjectAccessorToKey:()=>he.oR,AnimationPropertyInfo:()=>Pt.AnimationPropertyInfo,ArrayItem:()=>Te,EXT_lights_area:()=>He,EXT_lights_ies:()=>Se,EXT_lights_image_based:()=>we,EXT_mesh_gpu_instancing:()=>Ee,EXT_meshopt_compression:()=>Re,EXT_texture_avif:()=>Fe,EXT_texture_webp:()=>Pe,ExtrasAsMetadata:()=>Dn,FlowGraphGLTFDataProvider:()=>Hn.FlowGraphGLTFDataProvider,GLTFFileLoader:()=>M,GLTFLoader:()=>Ae,GetMappingForKey:()=>he.tQ,GetPathToObjectConverter:()=>he.Wt,InteractivityGraphToFlowGraphParser:()=>En,KHR_animation_pointer:()=>un,KHR_draco_mesh_compression:()=>Be,KHR_interactivity:()=>Rn,KHR_lights:()=>Ve,KHR_materials_anisotropy:()=>$e,KHR_materials_clearcoat:()=>Ze,KHR_materials_coat:()=>qe,KHR_materials_diffuse_roughness:()=>xt,KHR_materials_diffuse_transmission:()=>_t,KHR_materials_dispersion:()=>vt,KHR_materials_emissive_strength:()=>tt,KHR_materials_fuzz:()=>at,KHR_materials_ior:()=>ut,KHR_materials_iridescence:()=>Xe,KHR_materials_pbrSpecularGlossiness:()=>je,KHR_materials_sheen:()=>rt,KHR_materials_specular:()=>st,KHR_materials_transmission:()=>ht,KHR_materials_unlit:()=>We,KHR_materials_variants:()=>ft,KHR_materials_volume:()=>gt,KHR_mesh_quantization:()=>Ot,KHR_node_hoverability:()=>Gn,KHR_node_selectability:()=>In,KHR_node_visibility:()=>Nn,KHR_texture_basisu:()=>Ct,KHR_texture_transform:()=>Mt,KHR_xmp_json_ld:()=>Lt,LoadBoundingInfoFromPositionAccessor:()=>xe,MSFT_audio_emitter:()=>fn,MSFT_lod:()=>pn,MSFT_minecraftMesh:()=>mn,MSFT_sRGBFactors:()=>yn,OpenPBRMaterialLoadingAdapter:()=>Un.OpenPBRMaterialLoadingAdapter,PBRMaterialLoadingAdapter:()=>jn.PBRMaterialLoadingAdapter,SetInterpolationForKey:()=>he.ZU,TransformNodeAnimationPropertyInfo:()=>Pt.TransformNodeAnimationPropertyInfo,WeightAnimationPropertyInfo:()=>Pt.WeightAnimationPropertyInfo,_AddInteractivityObjectModel:()=>Ln,addNewInteractivityFlowGraphMapping:()=>vn,getAllSupportedNativeNodeTypes:()=>wn,getMappingForDeclaration:()=>bn,getMappingForFullOperationName:()=>gn,getQuaternion:()=>Pt.getQuaternion,getVector3:()=>Pt.getVector3,getWeights:()=>Pt.getWeights,gltfTypeToBabylonType:()=>Cn,registerGLTFExtension:()=>ye,registeredGLTFExtensions:()=>_e,unregisterGLTFExtension:()=>ge});var p={};a.r(p),a.d(p,{GLTF1:()=>u,GLTF2:()=>d,GLTFFileLoader:()=>M,GLTFLoaderAnimationStartMode:()=>b,GLTFLoaderCoordinateSystemMode:()=>g,GLTFLoaderDefaultOptions:()=>E,GLTFLoaderState:()=>v,GLTFValidation:()=>T});var h=a(322),m=a(597);function _(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 y(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":_(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 g,b,v,T=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(_,"(").concat(y,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),u=new Worker(l),c=function(e){u.removeEventListener("error",c),u.removeEventListener("message",f),i(e)},f=function(e){var t=e.data;switch(t.id){case"getExternalResource":r(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",f),a(t.value),u.terminate();break;case"validate.reject":u.removeEventListener("error",c),u.removeEventListener("message",f),i(t.reason),u.terminate()}};if(u.addEventListener("error",c),u.addEventListener("message",f),u.postMessage({id:"init",url:m.Tools.GetBabylonScriptURL(o.Configuration.url)}),ArrayBuffer.isView(e)){var d=e.slice();u.postMessage({id:"validate",data:d,rootUrl:t,fileName:n},[d.buffer])}else u.postMessage({id:"validate",data:e,rootUrl:t,fileName:n})})):(this._LoadScriptPromise||(this._LoadScriptPromise=m.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return _(e,t,n,r)})))},e.Configuration={url:"".concat(m.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),x="Z2xURg",A="gltf",O={".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"}(g||(g={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(b||(b={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(v||(v={}));var C=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=b.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=g.AUTO,this.createInstances=!0,this.loadAllMaterials=!1,this.loadMorphTargets=!0,this.loadNodeAnimations=!0,this.loadOnlyMaterials=!1,this.loadSkins=!0,this.skipMaterials=!1,this.targetFps=60,this.transparencyAsCoverage=!1,this.useClipPlane=!1,this.useGltfTextureNames=!1,this.useRangeRequests=!1,this.useSRGBBuffers=!0,this.validate=!1,this.useOpenPBR=!1,this.dontUseTransmissionHelper=!1},E=new C,M=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new m.Observable,n.onMeshLoadedObservable=new m.Observable,n.onSkinLoadedObservable=new m.Observable,n.onTextureLoadedObservable=new m.Observable,n.onMaterialLoadedObservable=new m.Observable,n.onCameraLoadedObservable=new m.Observable,n.onCompleteObservable=new m.Observable,n.onErrorObservable=new m.Observable,n.onDisposeObservable=new m.Observable,n.onExtensionLoadedObservable=new m.Observable,n.onValidatedObservable=new m.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=A,n.extensions=O,n.onLoaderStateChangedObservable=new m.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(Object.assign((0,h.Cl)({},E),t)),n}return(0,h.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,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 u=t.name||m.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&m.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new m.Observable},f={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 m.DataReader(f)).then((function(e){c.onCompleteObservable.notifyObservers(c),r(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 m.DataReader({readAsync:function(e,n){return w(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,u),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 m.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 m.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,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,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,m.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new m.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[A])},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(v[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"),T.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"),m.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 m.RuntimeError("Unexpected magic: "+n,m.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||m.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);m.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){m.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){m.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.extensionOptions={},t.preprocessUrlAsync=function(e){return Promise.resolve(e)},t}return(0,h.C6)(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,d,p,h,m,_,y,g,b,v,T,x,A,O,w,C;e&&(this.alwaysComputeBoundingBox=null!==(t=e.alwaysComputeBoundingBox)&&void 0!==t?t:this.alwaysComputeBoundingBox,this.alwaysComputeSkeletonRootNode=null!==(n=e.alwaysComputeSkeletonRootNode)&&void 0!==n?n:this.alwaysComputeSkeletonRootNode,this.animationStartMode=null!==(r=e.animationStartMode)&&void 0!==r?r:this.animationStartMode,this.capturePerformanceCounters=null!==(o=e.capturePerformanceCounters)&&void 0!==o?o:this.capturePerformanceCounters,this.compileMaterials=null!==(a=e.compileMaterials)&&void 0!==a?a:this.compileMaterials,this.compileShadowGenerators=null!==(i=e.compileShadowGenerators)&&void 0!==i?i:this.compileShadowGenerators,this.coordinateSystemMode=null!==(s=e.coordinateSystemMode)&&void 0!==s?s:this.coordinateSystemMode,this.createInstances=null!==(l=e.createInstances)&&void 0!==l?l:this.createInstances,this.customRootNode=e.customRootNode,this.extensionOptions=null!==(u=e.extensionOptions)&&void 0!==u?u:this.extensionOptions,this.loadAllMaterials=null!==(c=e.loadAllMaterials)&&void 0!==c?c:this.loadAllMaterials,this.loadMorphTargets=null!==(f=e.loadMorphTargets)&&void 0!==f?f:this.loadMorphTargets,this.loadNodeAnimations=null!==(d=e.loadNodeAnimations)&&void 0!==d?d:this.loadNodeAnimations,this.loadOnlyMaterials=null!==(p=e.loadOnlyMaterials)&&void 0!==p?p:this.loadOnlyMaterials,this.loadSkins=null!==(h=e.loadSkins)&&void 0!==h?h:this.loadSkins,this.loggingEnabled=null!==(m=e.loggingEnabled)&&void 0!==m?m:this.loggingEnabled,this.onCameraLoaded=e.onCameraLoaded,this.onMaterialLoaded=e.onMaterialLoaded,this.onMeshLoaded=e.onMeshLoaded,this.onParsed=e.onParsed,this.onSkinLoaded=e.onSkinLoaded,this.onTextureLoaded=e.onTextureLoaded,this.onValidated=e.onValidated,this.preprocessUrlAsync=null!==(_=e.preprocessUrlAsync)&&void 0!==_?_:this.preprocessUrlAsync,this.skipMaterials=null!==(y=e.skipMaterials)&&void 0!==y?y:this.skipMaterials,this.targetFps=null!==(g=e.targetFps)&&void 0!==g?g:this.targetFps,this.transparencyAsCoverage=null!==(b=e.transparencyAsCoverage)&&void 0!==b?b:this.transparencyAsCoverage,this.useClipPlane=null!==(v=e.useClipPlane)&&void 0!==v?v:this.useClipPlane,this.useGltfTextureNames=null!==(T=e.useGltfTextureNames)&&void 0!==T?T:this.useGltfTextureNames,this.useOpenPBR=null!==(x=e.useOpenPBR)&&void 0!==x?x:this.useOpenPBR,this.useRangeRequests=null!==(A=e.useRangeRequests)&&void 0!==A?A:this.useRangeRequests,this.useSRGBBuffers=null!==(O=e.useSRGBBuffers)&&void 0!==O?O:this.useSRGBBuffers,this.validate=null!==(w=e.validate)&&void 0!==w?w:this.validate,this.dontUseTransmissionHelper=null!==(C=e.dontUseTransmissionHelper)&&void 0!==C?C:this.dontUseTransmissionHelper)},t}(C));(0,m.RegisterSceneLoaderPlugin)(new M);var R,L,P,N,F,I,S,k,B=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==B){for(var G in B.BABYLON=B.BABYLON||{},l)B.BABYLON[G]=l[G];for(var G in s)B.BABYLON[G]=s[G]}!function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.FLOAT=5126]="FLOAT"}(R||(R={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(L||(L={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"}(P||(P={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(N||(N={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9728]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(F||(F={})),function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA"}(I||(I={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(S||(S={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"}(k||(k={}));var V,D=function(){function e(){}return e.SetMatrix=function(e,t,n,r,o){var a=null;if("MODEL"===n.semantic?a=t.getWorldMatrix():"PROJECTION"===n.semantic?a=e.getProjectionMatrix():"VIEW"===n.semantic?a=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===n.semantic?a=m.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===n.semantic?a=t.getWorldMatrix().invert():"VIEWINVERSE"===n.semantic?a=e.getViewMatrix().invert():"PROJECTIONINVERSE"===n.semantic?a=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===n.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===n.semantic&&(a=m.Matrix.Transpose(t.getWorldMatrix().invert())),a)switch(n.type){case P.FLOAT_MAT2:o.setMatrix2x2(r,m.Matrix.GetAsMatrix2x2(a));break;case P.FLOAT_MAT3:o.setMatrix3x3(r,m.Matrix.GetAsMatrix3x3(a));break;case P.FLOAT_MAT4:o.setMatrix(r,a)}},e.SetUniform=function(e,t,n,r){switch(r){case P.FLOAT:return e.setFloat(t,n),!0;case P.FLOAT_VEC2:return e.setVector2(t,m.Vector2.FromArray(n)),!0;case P.FLOAT_VEC3:return e.setVector3(t,m.Vector3.FromArray(n)),!0;case P.FLOAT_VEC4:return e.setVector4(t,m.Vector4.FromArray(n)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case N.CLAMP_TO_EDGE:return m.Texture.CLAMP_ADDRESSMODE;case N.MIRRORED_REPEAT:return m.Texture.MIRROR_ADDRESSMODE;case N.REPEAT:default:return m.Texture.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case F.LINEAR:case F.LINEAR_MIPMAP_NEAREST:case F.LINEAR_MIPMAP_LINEAR:return m.Texture.TRILINEAR_SAMPLINGMODE;case F.NEAREST:case F.NEAREST_MIPMAP_NEAREST:return m.Texture.NEAREST_SAMPLINGMODE;default:return m.Texture.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,n,r,o){n=t.byteOffset+n;var a=e.loadedBufferViews[t.buffer];if(n+r>a.byteLength)throw new Error("Buffer access is out of range");var i=a.buffer;switch(n+=a.byteOffset,o){case R.BYTE:return new Int8Array(i,n,r);case R.UNSIGNED_BYTE:return new Uint8Array(i,n,r);case R.SHORT:return new Int16Array(i,n,r);case R.UNSIGNED_SHORT:return new Uint16Array(i,n,r);default:return new Float32Array(i,n,r)}},e.GetBufferFromAccessor=function(t,n){var r=t.bufferViews[n.bufferView],o=n.count*e.GetByteStrideFromType(n);return e.GetBufferFromBufferView(t,r,n.byteOffset,o,n.componentType)},e.DecodeBufferToText=function(e){for(var t="",n=e.byteLength,r=0;r<n;++r)t+=String.fromCharCode(e[r]);return t},e.GetDefaultMaterial=function(t){if(!e._DefaultMaterial){m.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{"," gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),m.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var n={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new m.ShaderMaterial("GLTFDefaultMaterial",t,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},n),e._DefaultMaterial.setColor4("u_emission",new m.Color4(.5,.5,.5,1))}return e._DefaultMaterial},e._DefaultMaterial=null,e}();!function(e){e[e.IDENTIFIER=1]="IDENTIFIER",e[e.UNKNOWN=2]="UNKNOWN",e[e.END_OF_INPUT=3]="END_OF_INPUT"}(V||(V={}));var H=function(){function e(e){this._pos=0,this.currentToken=V.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}return e.prototype.getNextToken=function(){if(this.isEnd())return V.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=V.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=V.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},e.prototype.peek=function(){return this._toParse[this._pos]},e.prototype.read=function(){return this._toParse[this._pos++]},e.prototype.forward=function(){this._pos++},e.prototype.isEnd=function(){return this._pos>=this._maxPos},e}(),U=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],j=["world","view","projection","worldView","worldViewProjection","mBones"],K=["translation","rotation","scale"],W=["position","rotationQuaternion","scaling"],z=function(e,t,n){for(var r in e){var o=e[r];n[t][r]=o}},Z=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},Y=function(e){if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){var t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},q=function(e){var t=null;if(e.translation||e.rotation||e.scale){var n=m.Vector3.FromArray(e.scale||[1,1,1]),r=m.Quaternion.FromArray(e.rotation||[0,0,0,1]),o=m.Vector3.FromArray(e.translation||[0,0,0]);t=m.Matrix.Compose(n,r,o)}else t=m.Matrix.FromArray(e.matrix);return t},Q=function(e,t,n,r){for(var o=0;o<r.bones.length;o++)if(r.bones[o].name===n)return r.bones[o];var a=e.nodes;for(var i in a){var s=a[i];if(s.jointName){var l=s.children;for(o=0;o<l.length;o++){var u=e.nodes[l[o]];if(u.jointName&&u.jointName===n){var c=q(s),f=new m.Bone(s.name||"",r,Q(e,t,s.jointName,r),c);return f.id=i,f}}}}return null},X=function(e,t){for(var n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.node.children.length;o++)if(r.node.children[o]===t)return r.bone;return null},J=function(e,t){var n=e.nodes,r=n[t];if(r)return{node:r,id:t};for(var o in n)if((r=n[o]).jointName===t)return{node:r,id:o};return null},$=function(e,t){for(var n=0;n<e.jointNames.length;n++)if(e.jointNames[n]===t)return!0;return!1},ee=function(e,t,n,r,o){if(o||(e.scene._blockEntityCollection=!!e.assetContainer,(o=new m.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,o.id=r),!t.babylonNode)return o;for(var a,i=[],s=null,l=[],u=[],c=[],f=[],d=0;d<n.length;d++){var p=n[d];if(L=e.meshes[p])for(var h=0;h<L.primitives.length;h++){var _=new m.VertexData,y=L.primitives[h];y.mode;var g=y.attributes,b=null,v=null;for(var T in g)if(b=e.accessors[g[T]],v=D.GetBufferFromAccessor(e,b),"NORMAL"===T)_.normals=new Float32Array(v.length),_.normals.set(v);else if("POSITION"===T){if(M.HomogeneousCoordinates){_.positions=new Float32Array(v.length-v.length/4);for(var x=0;x<v.length;x+=4)_.positions[x]=v[x],_.positions[x+1]=v[x+1],_.positions[x+2]=v[x+2]}else _.positions=new Float32Array(v.length),_.positions.set(v);u.push(_.positions.length)}else if(-1!==T.indexOf("TEXCOORD_")){var A=Number(T.split("_")[1]),O=m.VertexBuffer.UVKind+(0===A?"":A+1),w=new Float32Array(v.length);w.set(v),Z(w),_.set(w,O)}else"JOINT"===T?(_.matricesIndices=new Float32Array(v.length),_.matricesIndices.set(v)):"WEIGHT"===T?(_.matricesWeights=new Float32Array(v.length),_.matricesWeights.set(v)):"COLOR"===T&&(_.colors=new Float32Array(v.length),_.colors.set(v));if(b=e.accessors[y.indices])v=D.GetBufferFromAccessor(e,b),_.indices=new Int32Array(v.length),_.indices.set(v),f.push(_.indices.length);else{var C=[];for(x=0;x<_.positions.length/3;x++)C.push(x);_.indices=new Int32Array(C),f.push(_.indices.length)}s?s.merge(_):s=_;var E=e.scene.getMaterialById(y.material);i.push(null===E?D.GetDefaultMaterial(e.scene):E),l.push(0===l.length?0:l[l.length-1]+u[u.length-2]),c.push(0===c.length?0:c[c.length-1]+f[f.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,i.length>1?(a=new m.MultiMaterial("multimat"+r,e.scene)).subMaterials=i:a=new m.StandardMaterial("multimat"+r,e.scene),1===i.length&&(a=i[0]),a._parentContainer=e.assetContainer,o.material||(o.material=a),new m.Geometry(r,e.scene,s,!1,o),o.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,o.subMeshes=[];var R=0;for(d=0;d<n.length;d++){var L;if(p=n[d],L=e.meshes[p])for(h=0;h<L.primitives.length;h++)L.primitives[h].mode,m.SubMesh.AddToMesh(R,l[R],u[R],c[R],f[R],o,o,!0),R++}return o},te=function(e,t,n,r){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=n),e.scaling&&(e.scaling=r)},ne=function(e,t,n){var r=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){var o=e.skins[t.skin];(a=ee(e,t,t.meshes,n,t.babylonNode)).skeleton=e.scene.getLastSkeletonById(t.skin),null===a.skeleton&&(a.skeleton=function(e,t,n,r){if(r||(r=new m.Skeleton(t.name||"","",e.scene)),!t.babylonSkeleton)return r;var o=[],a=[];!function(e,t,n,r){for(var o in e.nodes){var a=e.nodes[o],i=o;if(a.jointName&&!$(n,a.jointName)){var s=q(a),l=new m.Bone(a.name||"",t,null,s);l.id=i,r.push({bone:l,node:a,id:i})}}for(var u=0;u<r.length;u++)for(var c=r[u],f=c.node.children,d=0;d<f.length;d++){for(var p=null,h=0;h<r.length;h++)if(r[h].id===f[d]){p=r[h];break}p&&(p.bone._parent=c.bone,c.bone.children.push(p.bone))}}(e,r,t,o),r.bones=[];for(var i=0;i<t.jointNames.length;i++)if(v=J(e,t.jointNames[i])){var s=v.node;if(s){var l=v.id,u=e.scene.getBoneById(l);if(u)r.bones.push(u);else{for(var c=!1,f=null,d=0;d<i;d++){var p=J(e,t.jointNames[d]);if(p){var h=p.node;if(h){var _=h.children;if(_){c=!1;for(var y=0;y<_.length;y++)if(_[y]===l){f=Q(e,t,t.jointNames[d],r),c=!0;break}if(c)break}}else m.Tools.Warn("Joint named "+t.jointNames[d]+" does not exist when looking for parent")}}var g=q(s);!f&&o.length>0&&(f=X(o,l))&&-1===a.indexOf(f)&&a.push(f),new m.Bone(s.jointName||"",r,f,g).id=l}}else m.Tools.Warn("Joint named "+t.jointNames[i]+" does not exist")}var b=r.bones;for(r.bones=[],i=0;i<t.jointNames.length;i++){var v;if(v=J(e,t.jointNames[i]))for(d=0;d<b.length;d++)if(b[d].id===v.id){r.bones.push(b[d]);break}}for(r.prepare(),i=0;i<a.length;i++)r.bones.push(a[i]);return r}(e,o,0,o.babylonSkeleton),o.babylonSkeleton||(o.babylonSkeleton=a.skeleton)),r=a}}else if(t.meshes){var a;r=a=ee(e,t,t.mesh?[t.mesh]:t.meshes,n,t.babylonNode)}else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){var i=e.cameras[t.camera];if(i){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===i.type){var s=new m.FreeCamera(t.camera,m.Vector3.Zero(),e.scene,!1);s.name=t.name||"",s.mode=m.Camera.ORTHOGRAPHIC_CAMERA,s.attachControl(),r=s,s._parentContainer=e.assetContainer}else if("perspective"===i.type){var l=i[i.type],u=new m.FreeCamera(t.camera,m.Vector3.Zero(),e.scene,!1);u.name=t.name||"",u.attachControl(),l.aspectRatio||(l.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),l.znear&&l.zfar&&(u.maxZ=l.zfar,u.minZ=l.znear),r=u,u._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var c=e.lights[t.light];if(c)if("ambient"===c.type){var f=c[c.type],d=new m.HemisphericLight(t.light,m.Vector3.Zero(),e.scene);d.name=t.name||"",f.color&&(d.diffuse=m.Color3.FromArray(f.color)),r=d}else if("directional"===c.type){var p=c[c.type],h=new m.DirectionalLight(t.light,m.Vector3.Zero(),e.scene);h.name=t.name||"",p.color&&(h.diffuse=m.Color3.FromArray(p.color)),r=h}else if("point"===c.type){var _=c[c.type],y=new m.PointLight(t.light,m.Vector3.Zero(),e.scene);y.name=t.name||"",_.color&&(y.diffuse=m.Color3.FromArray(_.color)),r=y}else if("spot"===c.type){var g=c[c.type],b=new m.SpotLight(t.light,m.Vector3.Zero(),m.Vector3.Zero(),0,0,e.scene);b.name=t.name||"",g.color&&(b.diffuse=m.Color3.FromArray(g.color)),g.fallOfAngle&&(b.angle=g.fallOfAngle),g.fallOffExponent&&(b.exponent=g.fallOffExponent),r=b}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;if(null===r){e.scene._blockEntityCollection=!!e.assetContainer;var v=new m.Mesh(t.name||"",e.scene);v._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,t.babylonNode=v,r=v}}if(null!==r){if(t.matrix&&r instanceof m.Mesh)!function(e,t){if(t.matrix){var n=new m.Vector3(0,0,0),r=new m.Quaternion,o=new m.Vector3(0,0,0);m.Matrix.FromArray(t.matrix).decompose(o,r,n),te(e,n,r,o)}else t.translation&&t.rotation&&t.scale&&te(e,m.Vector3.FromArray(t.translation),m.Quaternion.FromArray(t.rotation),m.Vector3.FromArray(t.scale));e.computeWorldMatrix(!0)}(r,t);else{var T=t.translation||[0,0,0],x=t.rotation||[0,0,0,1],A=t.scale||[1,1,1];te(r,m.Vector3.FromArray(T),m.Quaternion.FromArray(x),m.Vector3.FromArray(A))}r.updateCache(!0),t.babylonNode=r}return r},re=function(e,t,n,r){void 0===r&&(r=!1);var o=e.nodes[t],a=null;if(r=!(e.importOnlyMeshes&&!r&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&r&&null!==(a=ne(e,o,t))&&(a.id=t,a.parent=n),o.children)for(var i=0;i<o.children.length;i++)re(e,o.children[i],a,r)},oe=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null);for(function(e){for(var t in e.animations){var n=e.animations[t];if(n.channels&&n.samplers)for(var r=null,o=0;o<n.channels.length;o++){var a=n.channels[o],i=n.samplers[a.sampler];if(i){var s=null,l=null;n.parameters?(s=n.parameters[i.input],l=n.parameters[i.output]):(s=i.input,l=i.output);var u=D.GetBufferFromAccessor(e,e.accessors[s]),c=D.GetBufferFromAccessor(e,e.accessors[l]),f=a.target.id,d=e.scene.getNodeById(f);if(null===d&&(d=e.scene.getNodeByName(f)),null!==d){var p=d instanceof m.Bone,h=a.target.path,_=K.indexOf(h);-1!==_&&(h=W[_]);var y=m.Animation.ANIMATIONTYPE_MATRIX;p||("rotationQuaternion"===h?(y=m.Animation.ANIMATIONTYPE_QUATERNION,d.rotationQuaternion=new m.Quaternion):y=m.Animation.ANIMATIONTYPE_VECTOR3);var g=null,b=[],v=0,T=!1;p&&r&&r.getKeys().length===u.length&&(g=r,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,g=new m.Animation(t,p?"_matrix":h,1,y,m.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var x=0;x<u.length;x++){var A=null;if("rotationQuaternion"===h?(A=m.Quaternion.FromArray([c[v],c[v+1],c[v+2],c[v+3]]),v+=4):(A=m.Vector3.FromArray([c[v],c[v+1],c[v+2]]),v+=3),p){var O=d,w=m.Vector3.Zero(),C=new m.Quaternion,E=m.Vector3.Zero(),M=O.getBaseMatrix();T&&r&&(M=r.getKeys()[x].value),M.decompose(E,C,w),"position"===h?w=A:"rotationQuaternion"===h?C=A:E=A,A=m.Matrix.Compose(E,C,w)}T?r&&(r.getKeys()[x].value=A):b.push({frame:u[x],value:A})}!T&&g&&(g.setKeys(b),d.animations.push(g)),r=g,e.scene.stopAnimation(d),e.scene.beginAnimation(d,0,u[u.length-1],!0,1)}else m.Tools.Warn("Creating animation named "+t+". But cannot find node named "+f+" to attach to")}}}}(e),n=0;n<e.scene.skeletons.length;n++){var o=e.scene.skeletons[n];e.scene.beginAnimation(o,0,Number.MAX_VALUE,!0,1)}},ae=function(e,t,n){for(var r in t.uniforms){var o=t.uniforms[r],a=t.parameters[o];if(e.currentIdentifier===r&&a.semantic&&!a.source&&!a.node){var i=U.indexOf(a.semantic);if(-1!==i)return delete n[r],j[i]}}return e.currentIdentifier},ie=function(e){for(var t in e.materials)ue.LoadMaterialAsync(e,t,(function(){}),(function(){}))},se=function(){function e(){}return e.CreateRuntime=function(e,t,n){var r={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:n,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&z(e.extensions,"extensions",r),e.extensionsUsed&&z(e.extensionsUsed,"extensionsUsed",r),e.buffers&&function(e,t){for(var n in e){var r=e[n];t.buffers[n]=r,t.buffersCount++}}(e.buffers,r),e.bufferViews&&z(e.bufferViews,"bufferViews",r),e.accessors&&z(e.accessors,"accessors",r),e.meshes&&z(e.meshes,"meshes",r),e.lights&&z(e.lights,"lights",r),e.cameras&&z(e.cameras,"cameras",r),e.nodes&&z(e.nodes,"nodes",r),e.images&&z(e.images,"images",r),e.textures&&z(e.textures,"textures",r),e.shaders&&function(e,t){for(var n in e){var r=e[n];t.shaders[n]=r,t.shaderscount++}}(e.shaders,r),e.programs&&z(e.programs,"programs",r),e.samplers&&z(e.samplers,"samplers",r),e.techniques&&z(e.techniques,"techniques",r),e.materials&&z(e.materials,"materials",r),e.animations&&z(e.animations,"animations",r),e.skins&&z(e.skins,"skins",r),e.scenes&&(r.scenes=e.scenes),e.scene&&e.scenes&&(r.currentScene=e.scenes[e.scene]),r},e.LoadBufferAsync=function(e,t,n,r,o){var a=e.buffers[t];m.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(m.Tools.DecodeBase64(a.uri)))})):m.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),o,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))},e.LoadTextureBufferAsync=function(e,t,n,r){var o=e.textures[t];if(o&&o.source)if(o.babylonTexture)n(null);else{var a=e.images[o.source];m.Tools.IsBase64(a.uri)?setTimeout((function(){return n(new Uint8Array(m.Tools.DecodeBase64(a.uri)))})):m.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return n(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&r(e.status+" "+e.statusText)}))}else r("")},e.CreateTextureAsync=function(e,t,n,r){var o=e.textures[t];if(o.babylonTexture)r(o.babylonTexture);else{var a=e.samplers[o.sampler],i=a.minFilter===F.NEAREST_MIPMAP_NEAREST||a.minFilter===F.NEAREST_MIPMAP_LINEAR||a.minFilter===F.LINEAR_MIPMAP_NEAREST||a.minFilter===F.LINEAR_MIPMAP_LINEAR,s=m.Texture.BILINEAR_SAMPLINGMODE,l=null==n?new Blob:new Blob([n]),u=URL.createObjectURL(l),c=function(){return URL.revokeObjectURL(u)},f=new m.Texture(u,e.scene,!i,!0,s,c,c);void 0!==a.wrapS&&(f.wrapU=D.GetWrapMode(a.wrapS)),void 0!==a.wrapT&&(f.wrapV=D.GetWrapMode(a.wrapT)),f.name=t,o.babylonTexture=f,r(f)}},e.LoadShaderStringAsync=function(e,t,n,r){var o=e.shaders[t];if(m.Tools.IsBase64(o.uri)){var a=atob(o.uri.split(",")[1]);n&&n(a)}else m.Tools.LoadFile(e.rootUrl+o.uri,n,void 0,void 0,!1,(function(e){e&&r&&r(e.status+" "+e.statusText)}))},e.LoadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(o.technique){var a=e.techniques[o.technique];if(!a){e.scene._blockEntityCollection=!!e.assetContainer;var i=new m.StandardMaterial(t,e.scene);return i._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,i.diffuseColor=new m.Color3(.5,.5,.5),i.sideOrientation=m.Material.CounterClockWiseSideOrientation,void n(i)}var s=e.programs[a.program],l=a.states,u=m.Effect.ShadersStore[s.vertexShader+"VertexShader"],c=m.Effect.ShadersStore[s.fragmentShader+"PixelShader"],f="",d="",p=new H(u),h=new H(c),_={},y=[],g=[],b=[];for(var v in a.uniforms){var T=a.uniforms[v],x=a.parameters[T];if(_[v]=x,!x.semantic||x.node||x.source)x.type===P.SAMPLER_2D?b.push(v):y.push(v);else{var A=U.indexOf(x.semantic);-1!==A?(y.push(j[A]),delete _[v]):y.push(v)}}for(var O in a.attributes){var w=a.attributes[O];if((M=a.parameters[w]).semantic){var C=Y(M);C&&g.push(C)}}for(;!p.isEnd()&&p.getNextToken();)if(p.currentToken===V.IDENTIFIER){var E=!1;for(var O in a.attributes){w=a.attributes[O];var M=a.parameters[w];if(p.currentIdentifier===O&&M.semantic){f+=Y(M),E=!0;break}}E||(f+=ae(p,a,_))}else f+=p.currentString;for(;!h.isEnd()&&h.getNextToken();)h.currentToken===V.IDENTIFIER?d+=ae(h,a,_):d+=h.currentString;var R={vertex:s.vertexShader+t,fragment:s.fragmentShader+t},L={attributes:g,uniforms:y,samplers:b,needAlphaBlending:l&&l.enable&&-1!==l.enable.indexOf(3042)};m.Effect.ShadersStore[s.vertexShader+t+"VertexShader"]=f,m.Effect.ShadersStore[s.fragmentShader+t+"PixelShader"]=d;var N=new m.ShaderMaterial(t,e.scene,R,L);if(N.onError=function(e,t,n){return function(r,o){t.dispose(!0),n("Cannot compile program named "+e.name+". Error: "+o+". Default material will be applied")}}(s,N,r),N.onCompiled=function(e,t,n,r,o,a){return function(i){!function(e,t,n,r,o){var a=r.values||n.parameters,i=n.uniforms,s=function(n){var s=o[n],l=s.type,u=a[i[n]];if(void 0===u&&(u=s.value),!u)return"continue";var c=function(e){return function(n){s.value&&e&&(t.setTexture(e,n),delete o[e])}};l===P.SAMPLER_2D?ue.LoadTextureAsync(e,r.values?u:s.value,c(n),(function(){return c(null)})):s.value&&D.SetUniform(t,n,r.values?u:s.value,l)&&delete o[n]};for(var l in o)s(l)}(e,t,n,r,o),t.onBind=function(i){!function(e,t,n,r,o,a,i){var s=a.values||o.parameters;for(var l in n){var u=n[l],c=u.type;if(c===P.FLOAT_MAT2||c===P.FLOAT_MAT3||c===P.FLOAT_MAT4)if(!u.semantic||u.source||u.node){if(u.semantic&&(u.source||u.node)){var f=t.scene.getNodeByName(u.source||u.node||"");if(null===f&&(f=t.scene.getNodeById(u.source||u.node||"")),null===f)continue;D.SetMatrix(t.scene,f,u,l,r.getEffect())}}else D.SetMatrix(t.scene,e,u,l,r.getEffect());else{var d=s[o.uniforms[l]];if(!d)continue;if(c===P.SAMPLER_2D){var p=t.textures[a.values?d:u.value].babylonTexture;if(null==p)continue;r.getEffect().setTexture(l,p)}else D.SetUniform(r.getEffect(),l,d,c)}}i(r)}(i,e,o,t,n,r,a)}}}(e,N,a,o,_,n),N.sideOrientation=m.Material.CounterClockWiseSideOrientation,l&&l.functions){var F=l.functions;F.cullFace&&F.cullFace[0]!==S.BACK&&(N.backFaceCulling=!1);var I=F.blendFuncSeparate;I&&(I[0]===k.SRC_ALPHA&&I[1]===k.ONE_MINUS_SRC_ALPHA&&I[2]===k.ONE&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_COMBINE:I[0]===k.ONE&&I[1]===k.ONE&&I[2]===k.ZERO&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_ONEONE:I[0]===k.SRC_ALPHA&&I[1]===k.ONE&&I[2]===k.ZERO&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_ADD:I[0]===k.ZERO&&I[1]===k.ONE_MINUS_SRC_COLOR&&I[2]===k.ONE&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_SUBTRACT:I[0]===k.DST_COLOR&&I[1]===k.ZERO&&I[2]===k.ONE&&I[3]===k.ONE?N.alphaMode=m.Constants.ALPHA_MULTIPLY:I[0]===k.SRC_ALPHA&&I[1]===k.ONE_MINUS_SRC_COLOR&&I[2]===k.ONE&&I[3]===k.ONE&&(N.alphaMode=m.Constants.ALPHA_MAXIMIZED))}}else r&&r("No technique found.")},e}(),le=function(){function e(){}return e.RegisterExtension=function(t){e.Extensions[t.name]?m.Tools.Error('Tool with the same name "'+t.name+'" already exists'):e.Extensions[t.name]=t},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,t,n,r,o,a,i,s){var l=this;return t.useRightHandedSystem=!0,ue.LoadRuntimeAsync(t,n,r,(function(t){t.assetContainer=o,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],m.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],l._createNodes(t);var n=[],r=[];for(var i in t.nodes){var s=t.nodes[i];s.babylonNode instanceof m.AbstractMesh&&n.push(s.babylonNode)}for(var u in t.skins){var c=t.skins[u];c.babylonSkeleton instanceof m.Skeleton&&r.push(c.babylonSkeleton)}l._loadBuffersAsync(t,(function(){l._loadShadersAsync(t,(function(){ie(t),oe(t),!M.IncrementalLoading&&a&&a(n,r)}))})),M.IncrementalLoading&&a&&a(n,r)}),s),!0},e.prototype.importMeshAsync=function(e,t,n,r,o,a){var i=this;return new Promise((function(s,l){i._importMeshAsync(e,t,r,o,n,(function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[],spriteManagers:[]})}),a,(function(e){l(new Error(e))}))}))},e.prototype._loadAsync=function(e,t,n,r,o,a){var i=this;e.useRightHandedSystem=!0,ue.LoadRuntimeAsync(e,t,n,(function(e){ue.LoadRuntimeExtensionsAsync(e,(function(){i._createNodes(e),i._loadBuffersAsync(e,(function(){i._loadShadersAsync(e,(function(){ie(e),oe(e),M.IncrementalLoading||r()}))})),M.IncrementalLoading&&r()}),a)}),a)},e.prototype.loadAsync=function(e,t,n,r){return(0,h.sH)(this,void 0,void 0,(function(){var o=this;return(0,h.YH)(this,(function(a){switch(a.label){case 0:return[4,new Promise((function(a,i){o._loadAsync(e,t,n,(function(){a()}),r,(function(e){i(new Error(e))}))}))];case 1:return[2,a.sent()]}}))}))},e.prototype._loadShadersAsync=function(e,t){var n=!1,r=function(n,r){ue.LoadShaderStringAsync(e,n,(function(o){o instanceof ArrayBuffer||(e.loadedShaderCount++,o&&(m.Effect.ShadersStore[n+(r.type===L.VERTEX?"VertexShader":"PixelShader")]=o),e.loadedShaderCount===e.shaderscount&&t())}),(function(){m.Tools.Error("Error when loading shader program named "+n+" located at "+r.uri)}))};for(var o in e.shaders){n=!0;var a=e.shaders[o];a?r.bind(this,o,a)():m.Tools.Error("No shader named: "+o)}n||t()},e.prototype._loadBuffersAsync=function(e,t){var n=!1,r=function(n,r){ue.LoadBufferAsync(e,n,(function(o){e.loadedBufferCount++,o&&(o.byteLength!=e.buffers[n].byteLength&&m.Tools.Error("Buffer named "+n+" is length "+o.byteLength+". Expected: "+r.byteLength),e.loadedBufferViews[n]=o),e.loadedBufferCount===e.buffersCount&&t()}),(function(){m.Tools.Error("Error when loading buffer named "+n+" located at "+r.uri)}))};for(var o in e.buffers){n=!0;var a=e.buffers[o];a?r.bind(this,o,a)():m.Tools.Error("No buffer named: "+o)}n||t()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)re(e,t.nodes[n],null)},e.Extensions={},e}(),ue=function(){function e(e){this._name=e}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),e.prototype.loadRuntimeAsync=function(e,t,n,r,o){return!1},e.prototype.loadRuntimeExtensionsAsync=function(e,t,n){return!1},e.prototype.loadBufferAsync=function(e,t,n,r,o){return!1},e.prototype.loadTextureBufferAsync=function(e,t,n,r){return!1},e.prototype.createTextureAsync=function(e,t,n,r,o){return!1},e.prototype.loadShaderStringAsync=function(e,t,n,r){return!1},e.prototype.loadMaterialAsync=function(e,t,n,r){return!1},e.LoadRuntimeAsync=function(t,n,r,o,a){e._ApplyExtensions((function(e){return e.loadRuntimeAsync(t,n,r,o,a)}),(function(){setTimeout((function(){o&&o(se.CreateRuntime(n.json,t,r))}))}))},e.LoadRuntimeExtensionsAsync=function(t,n,r){e._ApplyExtensions((function(e){return e.loadRuntimeExtensionsAsync(t,n,r)}),(function(){setTimeout((function(){n()}))}))},e.LoadBufferAsync=function(t,n,r,o,a){e._ApplyExtensions((function(e){return e.loadBufferAsync(t,n,r,o,a)}),(function(){se.LoadBufferAsync(t,n,r,o,a)}))},e.LoadTextureAsync=function(t,n,r,o){e._LoadTextureBufferAsync(t,n,(function(a){a&&e._CreateTextureAsync(t,n,a,r,o)}),o)},e.LoadShaderStringAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadShaderStringAsync(t,n,r,o)}),(function(){se.LoadShaderStringAsync(t,n,r,o)}))},e.LoadMaterialAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadMaterialAsync(t,n,r,o)}),(function(){se.LoadMaterialAsync(t,n,r,o)}))},e._LoadTextureBufferAsync=function(t,n,r,o){e._ApplyExtensions((function(e){return e.loadTextureBufferAsync(t,n,r,o)}),(function(){se.LoadTextureBufferAsync(t,n,r,o)}))},e._CreateTextureAsync=function(t,n,r,o,a){e._ApplyExtensions((function(e){return e.createTextureAsync(t,n,r,o,a)}),(function(){se.CreateTextureAsync(t,n,r,o)}))},e._ApplyExtensions=function(e,t){for(var n in le.Extensions)if(e(le.Extensions[n]))return;t()},e}();M._CreateGLTF1Loader=function(){return new le};var ce=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return(0,h.C6)(t,e),t.prototype.loadRuntimeAsync=function(e,t,n,r){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,r(se.CreateRuntime(t.json,e,n)),0))},t.prototype.loadBufferAsync=function(e,t,n,r){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(n,(function(e){return r(e.message)})),!0)},t.prototype.loadTextureBufferAsync=function(e,t,n){var r=e.textures[t],o=e.images[r.source];if(!o.extensions||!(this.name in o.extensions))return!1;var a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return n(D.GetBufferFromBufferView(e,i,0,i.byteLength,R.UNSIGNED_BYTE)),!0},t.prototype.loadShaderStringAsync=function(e,t,n){var r=e.shaders[t];if(!r.extensions||!(this.name in r.extensions))return!1;var o=r.extensions[this.name],a=e.bufferViews[o.bufferView],i=D.GetBufferFromBufferView(e,a,0,a.byteLength,R.UNSIGNED_BYTE);return setTimeout((function(){var e=D.DecodeBufferToText(i);n(e)})),!0},t}(ue);le.RegisterExtension(new ce);var fe=function(e){function t(){return e.call(this,"KHR_materials_common")||this}return(0,h.C6)(t,e),t.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var t=e.extensions[this.name];if(!t)return!1;var n=t.lights;if(n)for(var r in n){var o=n[r];switch(o.type){case"ambient":var a=new m.HemisphericLight(o.name,new m.Vector3(0,1,0),e.scene),i=o.ambient;i&&(a.diffuse=m.Color3.FromArray(i.color||[1,1,1]));break;case"point":var s=new m.PointLight(o.name,new m.Vector3(10,10,10),e.scene),l=o.point;l&&(s.diffuse=m.Color3.FromArray(l.color||[1,1,1]));break;case"directional":var u=new m.DirectionalLight(o.name,new m.Vector3(0,-1,0),e.scene),c=o.directional;c&&(u.diffuse=m.Color3.FromArray(c.color||[1,1,1]));break;case"spot":var f=o.spot;f&&(new m.SpotLight(o.name,new m.Vector3(0,10,0),new m.Vector3(0,-1,0),f.fallOffAngle||Math.PI,f.fallOffExponent||0,e.scene).diffuse=m.Color3.FromArray(f.color||[1,1,1]));break;default:m.Tools.Warn('GLTF Material Common extension: light type "'+o.type+"” not supported")}}return!1},t.prototype.loadMaterialAsync=function(e,t,n,r){var o=e.materials[t];if(!o||!o.extensions)return!1;var a=o.extensions[this.name];if(!a)return!1;var i=new m.StandardMaterial(t,e.scene);return i.sideOrientation=m.Material.CounterClockWiseSideOrientation,"CONSTANT"===a.technique&&(i.disableLighting=!0),i.backFaceCulling=void 0!==a.doubleSided&&!a.doubleSided,i.alpha=void 0===a.values.transparency?1:a.values.transparency,i.specularPower=void 0===a.values.shininess?0:a.values.shininess,"string"==typeof a.values.ambient?this._loadTexture(e,a.values.ambient,i,"ambientTexture",r):i.ambientColor=m.Color3.FromArray(a.values.ambient||[0,0,0]),"string"==typeof a.values.diffuse?this._loadTexture(e,a.values.diffuse,i,"diffuseTexture",r):i.diffuseColor=m.Color3.FromArray(a.values.diffuse||[0,0,0]),"string"==typeof a.values.emission?this._loadTexture(e,a.values.emission,i,"emissiveTexture",r):i.emissiveColor=m.Color3.FromArray(a.values.emission||[0,0,0]),"string"==typeof a.values.specular?this._loadTexture(e,a.values.specular,i,"specularTexture",r):i.specularColor=m.Color3.FromArray(a.values.specular||[0,0,0]),!0},t.prototype._loadTexture=function(e,t,n,r,o){se.LoadTextureBufferAsync(e,t,(function(o){se.CreateTextureAsync(e,t,o,(function(e){return n[r]=e}))}),o)},t}(ue);le.RegisterExtension(new fe);var de=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==de)for(var pe in de.BABYLON=de.BABYLON||{},de.BABYLON.GLTF1=de.BABYLON.GLTF1||{},u)de.BABYLON.GLTF1[pe]=u[pe];var he=a(698),me=new Map,_e=me;function ye(e,t,n){ge(e)&&m.Logger.Warn("Extension with the name '".concat(e,"' already exists")),me.set(e,{isGLTFExtension:t,factory:n})}function ge(e){return me.delete(e)}var be=new m.Lazy((function(){return Promise.resolve().then(a.t.bind(a,597,23))})),ve=new m.Lazy((function(){return Promise.resolve().then(a.bind(a,727))})),Te=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 xe(e){if(e.min&&e.max){var t=e.min,n=e.max,r=m.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=m.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 m.BoundingInfo(r,o)}return null}var Ae=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._materialAdapterCache=new WeakMap,this._pbrMaterialImpl=null,this._parent=e}return e.RegisterExtension=function(e,t){ye(e,!1,t)},e.UnregisterExtension=function(e){return ge(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._getOrCreateMaterialAdapter=function(e){var t=this._materialAdapterCache.get(e);if(!t){if(!this._pbrMaterialImpl)throw new Error("Appropriate material adapter class not found");t=new this._pbrMaterialImpl.adapterClass(e),this._materialAdapterCache.set(e,t)}return t},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){return(0,h.sH)(this,arguments,void 0,(function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),(0,h.YH)(this,(function(a){switch(a.label){case 0:return[4,Promise.resolve().then((function(){return(0,h.sH)(s,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,h.YH)(this,(function(d){switch(d.label){case 0:if(this._babylonScene=t,this._assetContainer=n,this._loadData(r),a=null,e){if(s={},this._gltf.nodes)for(l=0,u=this._gltf.nodes;l<u.length;l++)(c=u[l]).name&&(s[c.name]=c.index);a=(e instanceof Array?e:[e]).map((function(e){var t=s[e];if(void 0===t)throw new Error("Failed to find node '".concat(e,"'"));return t}))}return[4,this._loadAsync(o,i,a,(function(){return{meshes:f._getMeshes(),particleSystems:[],skeletons:f._getSkeletons(),animationGroups:f._getAnimationGroups(),lights:f._babylonLights,transformNodes:f._getTransformNodes(),geometries:f._getGeometries(),spriteManagers:[]}}))];case 1:return[2,d.sent()]}}))}))}))];case 1:return[2,a.sent()]}}))}))},e.prototype.loadAsync=function(e,t,n,r){return(0,h.sH)(this,arguments,void 0,(function(e,t,n,r,o){return void 0===o&&(o=""),(0,h.YH)(this,(function(r){switch(r.label){case 0:return this._babylonScene=e,this._loadData(t),[4,this._loadAsync(n,o,null,(function(){}))];case 1:return[2,r.sent()]}}))}))},e.prototype._loadAsync=function(e,t,n,r){return(0,h.sH)(this,void 0,void 0,(function(){var o=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return(0,h.sH)(o,void 0,void 0,(function(){var o,i,s,l,u,c,f,d,p,_,y,g,b,T,x=this;return(0,h.YH)(this,(function(h){switch(h.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:return h.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(o=this,b={},[4,Promise.resolve().then(a.t.bind(a,597,23))]):[3,4];case 2:return b.materialClass=h.sent().OpenPBRMaterial,[4,Promise.resolve().then(a.bind(a,833))];case 3:return o._pbrMaterialImpl=(b.adapterClass=h.sent().OpenPBRMaterialLoadingAdapter,b),[3,7];case 4:return i=this,T={},[4,Promise.resolve().then(a.t.bind(a,597,23))];case 5:return T.materialClass=h.sent().PBRMaterial,[4,Promise.resolve().then(a.bind(a,561))];case 6:i._pbrMaterialImpl=(T.adapterClass=h.sent().PBRMaterialLoadingAdapter,T),h.label=7;case 7:if(s="".concat(v[v.LOADING]," => ").concat(v[v.READY]),l="".concat(v[v.LOADING]," => ").concat(v[v.COMPLETE]),this._parent._startPerformanceCounter(s),this._parent._startPerformanceCounter(l),this._parent._setState(v.LOADING),this._extensionsOnLoading(),u=new Array,c=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(n?u.push(this.loadSceneAsync("/nodes",{nodes:n,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(f=Te.Get("/scene",this._gltf.scenes,this._gltf.scene||0),u.push(this.loadSceneAsync("/scenes/".concat(f.index),f)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(d=0;d<this._gltf.materials.length;++d)p=this._gltf.materials[d],_="/materials/"+d,y=m.Material.TriangleFillMode,u.push(this._loadMaterialAsync(_,p,null,y,(function(){})));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=c:this._babylonScene._forceBlockMaterialDirtyMechanism(c),this._parent.compileMaterials&&u.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&u.push(this._compileShadowGeneratorsAsync()),g=Promise.all(u).then((function(){x._rootBabylonMesh&&x._rootBabylonMesh!==x._parent.customRootNode&&x._rootBabylonMesh.setEnabled(!0);for(var e=0,t=x._babylonScene.materials;e<t.length;e++){var n=t[e];void 0!==n.maxSimultaneousLights&&(n.maxSimultaneousLights=Math.max(n.maxSimultaneousLights,x._babylonScene.lights.length))}return x._extensionsOnReady(),x._parent._setState(v.READY),x._skipStartAnimationStep||x._startAnimations(),r()})),[4,g.then((function(e){return x._parent._endPerformanceCounter(s),m.Tools.SetImmediate((function(){x._disposed||Promise.all(x._completePromises).then((function(){x._parent._endPerformanceCounter(l),x._parent._setState(v.COMPLETE),x._parent.onCompleteObservable.notifyObservers(void 0),x._parent.onCompleteObservable.clear(),x.dispose()}),(function(e){x._parent.onErrorObservable.notifyObservers(e),x._parent.onErrorObservable.clear(),x.dispose()}))})),e}))];case 8:return[2,h.sent()]}}))}))})).catch((function(e){throw o._disposed||(o._parent.onErrorObservable.notifyObservers(e),o._parent.onErrorObservable.clear(),o.dispose()),e}))];case 1:return[2,i.sent()]}}))}))},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)&&m.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else m.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(Te.Assign(this._gltf.accessors),Te.Assign(this._gltf.animations),Te.Assign(this._gltf.buffers),Te.Assign(this._gltf.bufferViews),Te.Assign(this._gltf.cameras),Te.Assign(this._gltf.images),Te.Assign(this._gltf.materials),Te.Assign(this._gltf.meshes),Te.Assign(this._gltf.nodes),Te.Assign(this._gltf.samplers),Te.Assign(this._gltf.scenes),Te.Assign(this._gltf.skins),Te.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,u=e[(l=s[i]).index];l.parent=void 0===u?a:this._gltf.nodes[u]}}},e.prototype._loadExtensionsAsync=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a,i,s,l,u,c,f=this;return(0,h.YH)(this,(function(d){switch(d.label){case 0:return e=[],_e.forEach((function(t,n){var r;!1===(null===(r=f.parent.extensionOptions[n])||void 0===r?void 0:r.enabled)?t.isGLTFExtension&&f.isExtensionUsed(n)&&m.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!f.isExtensionUsed(n)||e.push((0,h.sH)(f,void 0,void 0,(function(){var e;return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,t.factory(this)];case 1:return(e=r.sent()).name!==n&&m.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,r=[u],[4,Promise.all(e)];case 1:if(n.apply(t,r.concat([d.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===(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],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 m.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 g.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case g.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=Te.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 u=0,c=this._postSceneLoadActions;u<c.length;u++)(0,c[u])();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 m.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 b.NONE:break;case b.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case b.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void m.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=Te.Get("".concat(t,"/camera"),o._gltf.cameras,n.camera);i.push(o.loadCameraAsync("/cameras/".concat(s.index),s,(function(e){e.parent=a,o._babylonScene.useRightHandedSystem||(a.scaling.x=-1)})))}if(n.children)for(var l=0,u=n.children;l<u.length;l++){var c=u[l],f=Te.Get("".concat(t,"/children/").concat(c),o._gltf.nodes,c);i.push(o.loadNodeAsync("/nodes/".concat(f.index),f,(function(e){e.parent=a})))}r(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 f=new m.TransformNode(c,this._babylonScene);f._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==n.mesh?n._babylonTransformNode=f:n._babylonTransformNodeForSkin=f,s(f)}if(l)if(u){var d=Te.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh);i.push(this._loadMeshAsync("/meshes/".concat(d.index),n,d,(function(e){var r=n._babylonTransformNodeForSkin;e.metadata=(0,m.deepMerge)(r.metadata,e.metadata||{});var a=Te.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=Te.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 d=Te.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh),i.push(this._loadMeshAsync("/meshes/".concat(d.index),n,d,s));return this.logClose(),Promise.all(i).then((function(){return o._forEachPrimitive(n,(function(e){var t=e;!t.isAnInstance&&t.geometry&&t.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&&Te.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 m.TransformNode(i,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(var l=0,u=o;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 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 u,c,f=0===this._disableInstancedMesh&&this._parent.createInstances&&null==r.skin&&!o.primitives[0].targets;if(f&&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 d=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var p=new m.Mesh(n,this._babylonScene);if(p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,p.sideOrientation=this._babylonScene.useRightHandedSystem?m.Material.CounterClockWiseSideOrientation:m.Material.ClockWiseSideOrientation,this._createMorphTargets(t,r,o,a,p),d.push(this._loadVertexDataAsync(t,a,p).then((function(e){return(0,h.sH)(s,void 0,void 0,(function(){var n=this;return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(t,a,p,e).then((function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,e.applyToMesh(p),e._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1)}))];case 1:return[2,r.sent()]}}))}))}))),!this.parent.skipMaterials){var _=e._GetDrawMode(t,a.mode);if(null==a.material){var y=this._defaultBabylonMaterialData[_];y||(y=this._createDefaultMaterial("__GLTFLoader._default",_),this._parent.onMaterialLoadedObservable.notifyObservers(y),this._defaultBabylonMaterialData[_]=y),p.material=y}else{var g=Te.Get("".concat(t,"/material"),this._gltf.materials,a.material);d.push(this._loadMaterialAsync("/materials/".concat(g.index),g,p,_,(function(e){p.material=e})))}}c=Promise.all(d),f&&(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 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 m.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=Te.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,o,l){if(null!=a[t]){n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o);var u=Te.Get("".concat(e,"/attributes/").concat(t),r._gltf.accessors,a[t]);i.push(r._loadVertexAccessorAsync("/accessors/".concat(u.index),u,o).then((function(e){if(e.getKind()===m.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=xe(u);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,u.count)}))),o==m.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(u)}};return u("POSITION",m.VertexBuffer.PositionKind),u("NORMAL",m.VertexBuffer.NormalKind),u("TANGENT",m.VertexBuffer.TangentKind),u("TEXCOORD_0",m.VertexBuffer.UVKind),u("TEXCOORD_1",m.VertexBuffer.UV2Kind),u("TEXCOORD_2",m.VertexBuffer.UV3Kind),u("TEXCOORD_3",m.VertexBuffer.UV4Kind),u("TEXCOORD_4",m.VertexBuffer.UV5Kind),u("TEXCOORD_5",m.VertexBuffer.UV6Kind),u("JOINTS_0",m.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",m.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",m.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",m.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",m.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 m.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 m.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){return(0,h.sH)(this,void 0,void 0,(function(){var o,a,i=this;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return o=new Array,(a=function(r,a,s){if(null!=n[r]){var l=t.getVertexBuffer(a);if(l){var u=Te.Get("".concat(e,"/").concat(r),i._gltf.accessors,n[r]);o.push(i._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then((function(e){s(l,e)})))}}})("POSITION",m.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)})),a("NORMAL",m.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)})),a("TANGENT",m.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)})),a("TEXCOORD_0",m.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)})),a("TEXCOORD_1",m.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)})),a("COLOR_0",m.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)})),[4,Promise.all(o).then((function(){}))];case 1:return[2,s.sent()]}}))}))},e._LoadTransform=function(e,t){if(null==e.skin){var n=m.Vector3.Zero(),r=m.Quaternion.Identity(),o=m.Vector3.One();e.matrix?m.Matrix.FromArray(e.matrix).decompose(o,r,n):(e.translation&&(n=m.Vector3.FromArray(e.translation)),e.rotation&&(r=m.Quaternion.FromArray(e.rotation)),e.scale&&(o=m.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 m.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=Te.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)||(m.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index)}else m.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=Te.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={},r=0,o=t;r<o.length;r++){for(var a=o[r],i=[],s=Te.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,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&&m.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return o=new m.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=Te.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=m.Matrix.Identity(),i=o._index;t&&-1!==i&&(m.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?m.Matrix.FromArray(e.matrix):m.Matrix.Compose(e.scale?m.Vector3.FromArray(e.scale):m.Vector3.One(),e.rotation?m.Quaternion.FromArray(e.rotation):m.Quaternion.Identity(),e.translation?m.Vector3.FromArray(e.translation):m.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 m.FreeCamera(n.name||"camera".concat(n.index),m.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._babylonCamera=i,i.setTarget(new m.Vector3(0,0,-1)),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=m.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;this._parent._startPerformanceCounter("Load animations");var t=this._gltf.animations;if(!t)return Promise.resolve();for(var n=new Array,r=0;r<t.length;r++){var o=t[r];n.push(this.loadAnimationAsync("/animations/".concat(o.index),o).then((function(e){0===e.targetedAnimations.length&&e.dispose()})))}return Promise.all(n).then((function(){e._parent._endPerformanceCounter("Load animations")}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return this._parent._startPerformanceCounter("Load animation"),this._extensionsLoadAnimationAsync(e,t)||be.value.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;Te.Assign(t.channels),Te.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 n._parent._endPerformanceCounter("Load animation"),Promise.all(i).then((function(){return a.normalize(0),a}))}))},e.prototype._loadAnimationChannelAsync=function(e,t,n,r,o){var a=this,i=this._extensionsLoadAnimationChannelAsync(e,t,n,r,o);if(i)return i;if(null==r.target.node)return Promise.resolve();var s=Te.Get("".concat(e,"/target/node"),this._gltf.nodes,r.target.node),l=r.target.path,u="weights"===l;return u&&!s._numMorphTargets||!u&&!s._babylonTransformNode?Promise.resolve():this._parent.loadNodeAnimations||u||s._isJoint?ve.value.then((function(){var i,u,c,f,d;switch(l){case"translation":d=null===(i=(0,he.tQ)("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":d=null===(u=(0,he.tQ)("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":d=null===(c=(0,he.tQ)("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":d=null===(f=(0,he.tQ)("/nodes/{}/weights"))||void 0===f?void 0:f.interpolation;break;default:throw new Error("".concat(e,"/target/path: Invalid value (").concat(r.target.path,")"))}if(!d)throw new Error("".concat(e,"/target/path: Could not find interpolation properties for target path (").concat(r.target.path,")"));var p={object:s,info:d};return a._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,p,o)})):Promise.resolve()},e.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=Te.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,u=0,c=o.info;u<c.length;u++){var f=c[u],d=f.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 g=f.getValue(l,h,_,1);_+=d,m[y]={frame:p[y]*i,value:g,interpolation:1}}break;case"CUBICSPLINE":for(y=0;y<p.length;y++){var b=f.getValue(l,h,_,s);_+=d,g=f.getValue(l,h,_,1),_+=d;var v=f.getValue(l,h,_,s);_+=d,m[y]={frame:p[y]*i,inTangent:b,value:g,outTangent:v}}break;case"LINEAR":for(y=0;y<p.length;y++)g=f.getValue(l,h,_,1),_+=d,m[y]={frame:p[y]*i,value:g}}if(_>0)for(var T="".concat(n.name||"animation".concat(n.index),"_channel").concat(r.index,"_").concat(t),x=0,A=f.buildAnimations(l,T,i,m);x<A.length;x++){var O=A[x];t++,a(O.babylonAnimatable,O.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 r=Te.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=Te.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=Te.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*m.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new r(s));else{var l=Te.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 u=new r(s);return m.VertexBuffer.ForEach(o,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,o,n.byteOffset,s)}))}if(n.sparse){var u=n.sparse;n._data=n._data.then((function(s){var l=s,c=Te.Get("".concat(t,"/sparse/indices/bufferView"),o._gltf.bufferViews,u.indices.bufferView),f=Te.Get("".concat(t,"/sparse/values/bufferView"),o._gltf.bufferViews,u.values.bufferView);return Promise.all([o.loadBufferViewAsync("/bufferViews/".concat(c.index),c),o.loadBufferViewAsync("/bufferViews/".concat(f.index),f)]).then((function(o){var s,c=o[0],f=o[1],d=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 h=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,p);s=new r(p),m.VertexBuffer.ForEach(h,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,f,u.values.byteOffset,p);for(var _=0,y=0;y<d.length;y++)for(var g=d[y]*a,b=0;b<a;b++)l[g++]=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=Te.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 m.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 m.VertexBuffer(a,e,r,!1)}));else{var i=Te.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 m.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){var r=new Array,o=this._getOrCreateMaterialAdapter(n);return t&&(t.baseColorFactor?(o.baseColor=m.Color3.FromArray(t.baseColorFactor),o.geometryOpacity=t.baseColorFactor[3]):o.baseColor=m.Color3.White(),o.baseMetalness=null==t.metallicFactor?1:t.metallicFactor,o.specularRoughness=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)"),o.baseColorTexture=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)"),o.baseMetalnessTexture=e,o.specularRoughnessTexture=e}))),o.useRoughnessFromMetallicTextureGreen=!0,o.useMetallicFromMetallicTextureBlue=!0)),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){if(!this._pbrMaterialImpl)throw new Error("PBR Material class not loaded");this._babylonScene._blockEntityCollection=!!this._assetContainer;var n=new this._pbrMaterialImpl.materialClass(e,this._babylonScene);n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n.fillMode=t,n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE;var r=this._getOrCreateMaterialAdapter(n);return r.transparencyAsAlphaCoverage=this._parent.transparencyAsCoverage,r.baseMetalness=1,r.specularRoughness=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){var r,o=new Array,a=this._getOrCreateMaterialAdapter(n);a.emissionColor=t.emissiveFactor?m.Color3.FromArray(t.emissiveFactor):new m.Color3(0,0,0),t.doubleSided&&(a.backFaceCulling=!1,a.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),t.normalTexture,(function(e){var r;e.name="".concat(n.name," (Normal)"),a.geometryNormalTexture=e,null!=(null===(r=t.normalTexture)||void 0===r?void 0:r.scale)&&(e.level=t.normalTexture.scale)}))),a.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));var i,s=1;return t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),t.occlusionTexture,(function(e){e.name="".concat(n.name," (Occlusion)"),r=e}))),null!=t.occlusionTexture.strength&&(s=t.occlusionTexture.strength)),t.emissiveTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),t.emissiveTexture,(function(e){e.name="".concat(n.name," (Emissive)"),i=e}))),Promise.all(o).then((function(){r&&(a.ambientOcclusionTexture=r,a.ambientOcclusionTextureStrength=s),i&&(a.emissionColorTexture=i)}))},e.prototype.loadMaterialAlphaProperties=function(e,t,n){if(!this._pbrMaterialImpl)throw new Error("".concat(e,": Material type not supported"));var r=this._getOrCreateMaterialAdapter(n),o=r.baseColorTexture;switch(t.alphaMode||"OPAQUE"){case"OPAQUE":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_OPAQUE,n.alpha=1;break;case"MASK":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHATEST,r.alphaCutOff=null==t.alphaCutoff?.5:t.alphaCutoff,o&&(o.hasAlpha=!0);break;case"BLEND":n.transparencyMode=this._pbrMaterialImpl.materialClass.MATERIAL_ALPHABLEND,o&&(o.hasAlpha=!0,r.useAlphaFromBaseColorTexture=!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=Te.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:Te.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=Te.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,s,l=this;void 0===r&&(r=function(){});var u=this._loadSampler("/samplers/".concat(t.index),t),c=new Array,f=new m.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var d={noMipmap:u.noMipMaps,invertY:!1,samplingMode:u.samplingMode,onLoad:function(){l._disposed||f.resolve()},onError:function(t,n){l._disposed||f.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:null!==(i=n.mimeType)&&void 0!==i?i:(0,m.GetMimeType)(null!==(s=n.uri)&&void 0!==s?s:""),loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},p=new m.Texture(null,this._babylonScene,d);return p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c.push(f.promise),c.push(this.loadImageAsync("/images/".concat(n.index),n).then((function(e){var t=n.uri||"".concat(l._fileName,"#image").concat(n.index),r="data:".concat(l._uniqueRootUrl).concat(t);p.updateURL(r,e);var o=p.getInternalTexture();o&&(o.label=n.name)}))),p.wrapU=u.wrapU,p.wrapV=u.wrapV,r(p),this._parent.useGltfTextureNames&&(p.name=n.name||n.uri||"image".concat(n.index)),Promise.all(c).then((function(){return p}))},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=Te.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,m.IsBase64DataUrl)(r)){var i=new Uint8Array((0,m.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 m.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 m.Texture.CLAMP_ADDRESSMODE;case 33648:return m.Texture.MIRROR_ADDRESSMODE;case 10497:return m.Texture.WRAP_ADDRESSMODE;default:return m.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),m.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 m.Texture.LINEAR_NEAREST;case 9729:return m.Texture.LINEAR_LINEAR;case 9984:return m.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return m.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return m.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return m.Texture.LINEAR_LINEAR_MIPLINEAR;default:return m.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),m.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&m.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),r){case 9728:return m.Texture.NEAREST_NEAREST;case 9729:return m.Texture.NEAREST_LINEAR;case 9984:return m.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return m.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return m.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return m.Texture.NEAREST_LINEAR_MIPLINEAR;default:return m.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),m.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,m.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=m.VertexBuffer.GetTypeByteLength(n);return o%l!==0?(m.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 m.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return m.Material.PointListDrawMode;case 1:return m.Material.LineListDrawMode;case 2:return m.Material.LineLoopDrawMode;case 3:return m.Material.LineStripDrawMode;case 4:return m.Material.TriangleFillMode;case 5:return m.Material.TriangleStripDrawMode;case 6:return m.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 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,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 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(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}();M._CreateGLTF2Loader=function(e){return new Ae(e)};var Oe="EXT_lights_image_based",we=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}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,a,i=this;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,(n=new Array).push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen("".concat(r)),a=Te.Get("".concat(r,"/light"),this._lights,o.light),n.push(this._loadLightAsync("/extensions/".concat(this.name,"/lights/").concat(o.light),a).then((function(e){i._loader.babylonScene.environmentTexture=e}))),this._loader.logClose(),[4,Promise.all(n).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},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],u=Te.Get(s,i._loader.gltf.images,l);r.push(i._loader.loadImageAsync("/images/".concat(l),u).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(){return(0,h.sH)(n,void 0,void 0,(function(){var n,r,a,i,s;return(0,h.YH)(this,(function(l){switch(l.label){case 0:if((n=new m.RawCubeTexture(this._loader.babylonScene,null,t.specularImageSize)).name=t.name||"environment",t._babylonTexture=n,null!=t.intensity&&(n.level=t.intensity),t.rotation&&(r=m.Quaternion.FromArray(t.rotation),this._loader.babylonScene.useRightHandedSystem||(r=m.Quaternion.Inverse(r)),m.Matrix.FromQuaternionToRef(r,n.getReflectionTextureMatrix())),!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(a=m.SphericalHarmonics.FromArray(t.irradianceCoefficients)).scaleInPlace(t.intensity),a.convertIrradianceToLambertianRadiance(),i=m.SphericalPolynomial.FromHarmonics(a),s=(o.length-1)/Math.log2(t.specularImageSize),[4,n.updateRGBDAsync(o,i,s)];case 1:return[2,l.sent()]}}))}))}))}return t._loaded.then((function(){return t._babylonTexture}))},e}();ge(Oe),ye(Oe,!0,(function(e){return new we(e)}));var Ce="EXT_mesh_gpu_instancing",Ee=function(){function e(e){this.name=Ce,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ce)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,h.sH)(r,void 0,void 0,(function(){var r,a,i,s,l=this;return(0,h.YH)(this,(function(u){switch(u.label){case 0:return this._loader._disableInstancedMesh++,r=this._loader.loadNodeAsync("/nodes/".concat(t.index),t,n),this._loader._disableInstancedMesh--,t._primitiveBabylonMeshes?[3,2]:[4,r];case 1:case 3:return[2,u.sent()];case 2:return a=new Array,i=0,(s=function(t){if(null!=o.attributes[t]){var n=Te.Get("".concat(e,"/attributes/").concat(t),l._loader.gltf.accessors,o.attributes[t]);if(a.push(l._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===i)i=n.count;else if(i!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else a.push(Promise.resolve(null))})("TRANSLATION"),s("ROTATION"),s("SCALE"),s("_COLOR_0"),[4,r.then((function(e){return(0,h.sH)(l,void 0,void 0,(function(){var n,r,o,s,l,u,c,f,d,p;return(0,h.YH)(this,(function(h){switch(h.label){case 0:return[4,Promise.all(a)];case 1:for(n=h.sent(),r=n[0],o=n[1],s=n[2],l=n[3],u=new Float32Array(16*i),m.TmpVectors.Vector3[0].copyFromFloats(0,0,0),m.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),m.TmpVectors.Vector3[1].copyFromFloats(1,1,1),c=0;c<i;++c)r&&m.Vector3.FromArrayToRef(r,3*c,m.TmpVectors.Vector3[0]),o&&m.Quaternion.FromArrayToRef(o,4*c,m.TmpVectors.Quaternion[0]),s&&m.Vector3.FromArrayToRef(s,3*c,m.TmpVectors.Vector3[1]),m.Matrix.ComposeToRef(m.TmpVectors.Vector3[1],m.TmpVectors.Quaternion[0],m.TmpVectors.Vector3[0],m.TmpVectors.Matrix[0]),m.TmpVectors.Matrix[0].copyToArray(u,16*c);for(f=0,d=t._primitiveBabylonMeshes;f<d.length;f++)(p=d[f]).thinInstanceSetBuffer("matrix",u,16,!0),l&&(l.length===3*i?p.thinInstanceSetBuffer("color",l,3,!0):l.length===4*i?p.thinInstanceSetBuffer("color",l,4,!0):m.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+p.name));return[2,e]}}))}))}))]}}))}))}))},e}();ge(Ce),ye(Ce,!0,(function(e){return new Ee(e)}));var Me="EXT_meshopt_compression",Re=function(){function e(e){this.name=Me,this.enabled=e.isExtensionUsed(Me),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,r,a=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(n=t)._meshOptData?[4,n._meshOptData]:[3,2];case 1:case 3:return[2,i.sent()];case 2:return r=Te.Get("".concat(e,"/buffer"),this._loader.gltf.buffers,o.buffer),n._meshOptData=this._loader.loadBufferAsync("/buffers/".concat(r.index),r,o.byteOffset||0,o.byteLength).then((function(e){return(0,h.sH)(a,void 0,void 0,(function(){return(0,h.YH)(this,(function(t){switch(t.label){case 0:return[4,m.MeshoptCompression.Default.decodeGltfBufferAsync(e,o.count,o.byteStride,o.mode,o.filter)];case 1:return[2,t.sent()]}}))}))})),[4,n._meshOptData]}}))}))}))},e}();ge(Me),ye(Me,!0,(function(e){return new Re(e)}));var Le="EXT_texture_webp",Pe=function(){function e(e){this.name=Le,this._loader=e,this.enabled=e.isExtensionUsed(Le)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ae.DefaultSampler:Te.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Te.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();ge(Le),ye(Le,!0,(function(e){return new Pe(e)}));var Ne="EXT_texture_avif",Fe=function(){function e(e){this.name=Ne,this._loader=e,this.enabled=e.isExtensionUsed(Ne)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ae.DefaultSampler:Te.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Te.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();ge(Ne),ye(Ne,!0,(function(e){return new Fe(e)}));var Ie="EXT_lights_ies",Se=function(){function e(e){this.name=Ie,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ie)}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,Te.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i,s,l,u,c=this;return(0,h.YH)(this,(function(f){switch(f.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t=(i=Te.Get(o,c._lights,a.light)).name||e.name;c._loader.babylonScene._blockEntityCollection=!!c._loader._assetContainer,(r=new m.SpotLight(t,m.Vector3.Zero(),m.Vector3.Backward(),0,1,c._loader.babylonScene)).angle=Math.PI/2,r.innerAngle=0,r._parentContainer=c._loader._assetContainer,c._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=r,r.falloffType=m.Light.FALLOFF_GLTF,r.diffuse=a.color?m.Color3.FromArray(a.color):m.Color3.White(),r.intensity=a.multiplier||1,r.range=Number.MAX_VALUE,r.parent=e,c._loader._babylonLights.push(r),Ae.AddPointerMetadata(r,o),n(e)}))];case 1:return s=f.sent(),i.uri?[4,this._loader.loadUriAsync(e,i,i.uri)]:[3,3];case 2:return l=f.sent(),[3,5];case 3:return u=Te.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,i.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u)];case 4:l=f.sent(),f.label=5;case 5:return r.iesProfileTexture=new m.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}();ge(Ie),ye(Ie,!0,(function(e){return new Se(e)}));var ke="KHR_draco_mesh_compression",Be=function(){function e(e){this.name=ke,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=m.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(ke)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i,s,l,u=this;return(0,h.YH)(this,(function(c){switch(c.label){case 0:if(null!=t.mode&&4!==t.mode&&5!==t.mode)throw new Error("".concat(e,": Unsupported mode ").concat(t.mode));return r={},i={},(s=function(e,o){var s=a.attributes[e];if(null!=s&&(n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(o)&&n._delayInfo.push(o),r[o]=s,u.useNormalizedFlagFromAccessor)){var l=Te.TryGet(u._loader.gltf.accessors,t.attributes[e]);l&&(i[o]=l.normalized||!1)}})("POSITION",m.VertexBuffer.PositionKind),s("NORMAL",m.VertexBuffer.NormalKind),s("TANGENT",m.VertexBuffer.TangentKind),s("TEXCOORD_0",m.VertexBuffer.UVKind),s("TEXCOORD_1",m.VertexBuffer.UV2Kind),s("TEXCOORD_2",m.VertexBuffer.UV3Kind),s("TEXCOORD_3",m.VertexBuffer.UV4Kind),s("TEXCOORD_4",m.VertexBuffer.UV5Kind),s("TEXCOORD_5",m.VertexBuffer.UV6Kind),s("JOINTS_0",m.VertexBuffer.MatricesIndicesKind),s("WEIGHTS_0",m.VertexBuffer.MatricesWeightsKind),s("COLOR_0",m.VertexBuffer.ColorKind),(l=Te.Get(o,this._loader.gltf.bufferViews,a.bufferView))._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){return(0,h.sH)(u,void 0,void 0,(function(){var a,s,l;return(0,h.YH)(this,(function(u){switch(u.label){case 0:return a=this.dracoDecoder||m.DracoDecoder.Default,s=Te.TryGet(this._loader.gltf.accessors,t.attributes.POSITION),l=this._loader.parent.alwaysComputeBoundingBox||n.skeleton||!s?null:xe(s),[4,a._decodeMeshToGeometryForGltfAsync(n.name,this._loader.babylonScene,o,r,i,l).catch((function(t){throw new Error("".concat(e,": ").concat(t.message))}))];case 1:return[2,u.sent()]}}))}))}))),[4,l._dracoBabylonGeometry];case 1:return[2,c.sent()]}}))}))}))},e}();ge(ke),ye(ke,!0,(function(e){return new Be(e)}));var Ge="KHR_lights_punctual",Ve=function(){function e(e){this.name=Ge,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ge)}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,Te.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i=Te.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 m.DirectionalLight(s,m.Vector3.Backward(),r._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new m.PointLight(s,m.Vector3.Zero(),r._loader.babylonScene);break;case"spot":var u=new m.SpotLight(s,m.Vector3.Zero(),m.Vector3.Backward(),0,1,r._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 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=m.Light.FALLOFF_GLTF,t.diffuse=i.color?m.Color3.FromArray(i.color):m.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),Ae.AddPointerMetadata(t,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();ge(Ge),ye(Ge,!0,(function(e){return new Ve(e)}));var De="EXT_lights_area",He=function(){function e(e){this.name=De,this._loader=e,this.enabled=this._loader.isExtensionUsed(De)}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,Te.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,t,(function(e){var t,i,s=Te.Get(o,r._lights,a.light),l=s.name||e.name;r._loader.babylonScene._blockEntityCollection=!!r._loader._assetContainer;var u=void 0!==s.size?s.size:1;switch(s.type){case"rect":var c=void 0!==(null===(t=s.rect)||void 0===t?void 0:t.aspect)?s.rect.aspect*u:u,f=u;i=new m.RectAreaLight(l,m.Vector3.Zero(),c,f,r._loader.babylonScene);break;case"disk":var d=Math.sqrt(u*u*.25*Math.PI);i=new m.RectAreaLight(l,m.Vector3.Zero(),d,d,r._loader.babylonScene);break;default:throw r._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(o,": Invalid area light type (").concat(s.type,")"))}i._parentContainer=r._loader._assetContainer,r._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=i,i.falloffType=m.Light.FALLOFF_GLTF,i.diffuse=s.color?m.Color3.FromArray(s.color):m.Color3.White(),i.intensity=null==s.intensity?1:s.intensity;var p=new m.TransformNode("".concat(l,"_orientation"),r._loader.babylonScene);p.rotationQuaternion=m.Quaternion.RotationAxis(m.Vector3.Up(),Math.PI),p.parent=e,i.parent=p,r._loader._babylonLights.push(i),Ae.AddPointerMetadata(i,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();ge(De),ye(De,!0,(function(e){return new He(e)}));var Ue="KHR_materials_pbrSpecularGlossiness",je=function(){function e(e){this.name=Ue,this.order=200,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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialBasePropertiesAsync(e,t,n)),r.push(this._loadSpecularGlossinessPropertiesAsync(o,a,n)),this._loader.loadMaterialAlphaProperties(e,t,n),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSpecularGlossinessPropertiesAsync=function(e,t,n){if(!(n instanceof m.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=m.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=m.Color3.White(),n.reflectivityColor=t.specularFactor?m.Color3.FromArray(t.specularFactor):m.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}();ge(Ue),ye(Ue,!0,(function(e){return new je(e)}));var Ke="KHR_materials_unlit",We=function(){function e(e){this.name=Ke,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ke)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadUnlitPropertiesAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))},e.prototype._loadUnlitPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=t.pbrMetallicRoughness;return a&&(a.baseColorFactor&&(r.baseColor=m.Color3.FromArray(a.baseColorFactor),r.geometryOpacity=a.baseColorFactor[3]),a.baseColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),a.baseColorTexture,(function(e){e.name="".concat(n.name," (Base Color)"),r.baseColorTexture=e})))),r.isUnlit=!0,t.doubleSided&&(r.backFaceCulling=!1,r.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,n),Promise.all(o).then((function(){}))},e}();ge(Ke),ye(Ke,!0,(function(e){return new We(e)}));var ze="KHR_materials_clearcoat",Ze=function(){function e(e){this.name=ze,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ze)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadClearCoatPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadClearCoatPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;return r.configureCoat(),r.coatWeight=void 0!==t.clearcoatFactor?t.clearcoatFactor:0,r.coatRoughness=void 0!==t.clearcoatRoughnessFactor?t.clearcoatRoughnessFactor:0,t.clearcoatTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatTexture"),t.clearcoatTexture,(function(e){e.name="".concat(n.name," (ClearCoat)"),r.coatWeightTexture=e}))),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)"),r.coatRoughnessTexture=e})))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatNormalTexture"),t.clearcoatNormalTexture,(function(e){var o;e.name="".concat(n.name," (ClearCoat Normal)"),r.geometryCoatNormalTexture=e,null!=(null===(o=t.clearcoatNormalTexture)||void 0===o?void 0:o.scale)&&(r.geometryCoatNormalTextureScale=t.clearcoatNormalTexture.scale)}))),r.setNormalMapInversions(!n.getScene().useRightHandedSystem,n.getScene().useRightHandedSystem)),Promise.all(o).then((function(){}))},e}();ge(ze),ye(ze,!0,(function(e){return new Ze(e)}));var Ye="KHR_materials_coat",qe=function(){function e(e){this.name=Ye,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ye)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),t.extensions&&t.extensions.KHR_materials_openpbr&&(this.useOpenPBR=!0),r.push(this._loadCoatPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadCoatPropertiesAsync=function(e,t,n){var r,o,a=this._loader._getOrCreateMaterialAdapter(n),i=new Array;a.configureCoat(),a.coatWeight=void 0!==t.coatFactor?t.coatFactor:0,a.coatRoughness=void 0!==t.coatRoughnessFactor?t.coatRoughnessFactor:0,t.coatTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatTexture"),t.coatTexture,(function(e){e.name="".concat(n.name," (Coat)"),a.coatWeightTexture=e}))),t.coatRoughnessTexture&&(t.coatRoughnessTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatRoughnessTexture"),t.coatRoughnessTexture,(function(e){e.name="".concat(n.name," (Coat Roughness)"),a.coatRoughnessTexture=e})))),t.coatNormalTexture&&(t.coatNormalTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatNormalTexture"),t.coatNormalTexture,(function(e){var r;e.name="".concat(n.name," (Coat Normal)"),a.geometryCoatNormalTexture=e,null!=(null===(r=t.coatNormalTexture)||void 0===r?void 0:r.scale)&&(a.geometryCoatNormalTextureScale=t.coatNormalTexture.scale)}))),a.setNormalMapInversions(!n.getScene().useRightHandedSystem,n.getScene().useRightHandedSystem)),a.coatDarkening=void 0!==t.coatDarkeningFactor?t.coatDarkeningFactor:1,a.coatIor=void 0!==t.coatIor?t.coatIor:1.5;var s=m.Color3.White();void 0!==t.coatColorFactor&&s.fromArray(t.coatColorFactor),a.coatColor=s,t.coatColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatColorTexture"),t.coatColorTexture,(function(e){e.name="".concat(n.name," (Coat Color)"),a.coatColorTexture=e})));var l=null!==(r=t.coatAnisotropyStrength)&&void 0!==r?r:0,u=null!==(o=t.coatAnisotropyRotation)&&void 0!==o?o:0;return a.coatRoughnessAnisotropy=l,a.geometryCoatTangentAngle=u,this.useOpenPBR||a.configureGltfStyleAnisotropy(!0),t.coatAnisotropyTexture&&(t.coatAnisotropyTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatAnisotropyTexture"),t.coatAnisotropyTexture,(function(e){e.name="".concat(n.name," (Coat Anisotropy)"),a.geometryCoatTangentTexture=e})))),Promise.all(i).then((function(){}))},e}();ge(Ye),ye(Ye,!0,(function(e){return new qe(e)}));var Qe="KHR_materials_iridescence",Xe=function(){function e(e){this.name=Qe,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Qe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIridescencePropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadIridescencePropertiesAsync=function(e,t,n){var r,o,a,i,s,l=this._loader._getOrCreateMaterialAdapter(n),u=new Array;return l.thinFilmWeight=null!==(r=t.iridescenceFactor)&&void 0!==r?r:0,l.thinFilmIor=null!==(a=null!==(o=t.iridescenceIor)&&void 0!==o?o:t.iridescenceIOR)&&void 0!==a?a:1.3,l.thinFilmThicknessMinimum=null!==(i=t.iridescenceThicknessMinimum)&&void 0!==i?i:100,l.thinFilmThicknessMaximum=null!==(s=t.iridescenceThicknessMaximum)&&void 0!==s?s:400,t.iridescenceTexture&&u.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceTexture"),t.iridescenceTexture,(function(e){e.name="".concat(n.name," (Iridescence)"),l.thinFilmWeightTexture=e}))),t.iridescenceThicknessTexture&&u.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceThicknessTexture"),t.iridescenceThicknessTexture,(function(e){e.name="".concat(n.name," (Iridescence Thickness)"),l.thinFilmThicknessTexture=e}))),Promise.all(u).then((function(){}))},e}();ge(Qe),ye(Qe,!0,(function(e){return new Xe(e)}));var Je="KHR_materials_anisotropy",$e=function(){function e(e){this.name=Je,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Je)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadAnisotropyPropertiesAsync(o,a,n)),[4,Promise.all(r)];case 1:return i.sent(),[2]}}))}))}))},e.prototype._loadAnisotropyPropertiesAsync=function(e,t,n){return(0,h.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c;return(0,h.YH)(this,(function(f){switch(f.label){case 0:return r=this._loader._getOrCreateMaterialAdapter(n),o=new Array,a=null!==(l=t.anisotropyStrength)&&void 0!==l?l:0,i=null!==(u=t.anisotropyRotation)&&void 0!==u?u:0,r.specularRoughnessAnisotropy=a,r.geometryTangentAngle=i,(s=null!==(c=t.extensions)&&void 0!==c?c:{}).EXT_materials_anisotropy_openpbr&&s.EXT_materials_anisotropy_openpbr.openPbrAnisotropyEnabled||r.configureGltfStyleAnisotropy(!0),t.anisotropyTexture&&(t.anisotropyTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/anisotropyTexture"),t.anisotropyTexture,(function(e){e.name="".concat(n.name," (Anisotropy Intensity)"),r.geometryTangentTexture=e})))),[4,Promise.all(o)];case 1:return f.sent(),[2]}}))}))},e}();ge(Je),ye(Je,!0,(function(e){return new $e(e)}));var et="KHR_materials_emissive_strength",tt=function(){function e(e){this.name=et,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(et)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadMaterialPropertiesAsync(e,t,n)];case 1:return r.sent(),this._loadEmissiveProperties(o,a,n),[4,Promise.resolve()];case 2:return[2,r.sent()]}}))}))}))},e.prototype._loadEmissiveProperties=function(e,t,n){void 0!==t.emissiveStrength&&(this._loader._getOrCreateMaterialAdapter(n).emissionLuminance=t.emissiveStrength)},e}();ge(et),ye(et,!0,(function(e){return new tt(e)}));var nt="KHR_materials_sheen",rt=function(){function e(e){this.name=nt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSheenPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadSheenPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;r.configureFuzz();var a=void 0!==t.sheenColorFactor?m.Color3.FromArray(t.sheenColorFactor):m.Color3.Black(),i=void 0!==t.sheenRoughnessFactor?t.sheenRoughnessFactor:0;return r.fuzzWeight=1,r.fuzzColor=a,r.fuzzRoughness=i,t.sheenColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),t.sheenColorTexture,(function(e){e.name="".concat(n.name," (Sheen Color)"),r.fuzzColorTexture=e}))),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)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();ge(nt),ye(nt,!0,(function(e){return new rt(e)}));var ot="KHR_materials_fuzz",at=function(){function e(e){this.name=ot,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ot)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadFuzzPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadFuzzPropertiesAsync=function(e,t,n){var r=this._loader._getOrCreateMaterialAdapter(n),o=new Array;return r.configureFuzz(),r.fuzzWeight=void 0!==t.fuzzFactor?t.fuzzFactor:0,r.fuzzColor=void 0!==t.fuzzColorFactor?m.Color3.FromArray(t.fuzzColorFactor):m.Color3.White(),r.fuzzRoughness=void 0!==t.fuzzRoughnessFactor?t.fuzzRoughnessFactor:.5,t.fuzzTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzTexture"),t.fuzzTexture,(function(e){e.name="".concat(n.name," (Fuzz)"),r.fuzzWeightTexture=e}))),t.fuzzColorTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzColorTexture"),t.fuzzColorTexture,(function(e){e.name="".concat(n.name," (Fuzz Color)"),r.fuzzColorTexture=e}))),t.fuzzRoughnessTexture&&(t.fuzzRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzRoughnessTexture"),t.fuzzRoughnessTexture,(function(e){e.name="".concat(n.name," (Fuzz Roughness)"),r.fuzzRoughnessTexture=e})))),Promise.all(o).then((function(){}))},e}();ge(ot),ye(ot,!0,(function(e){return new at(e)}));var it="KHR_materials_specular",st=function(){function e(e){this.name=it,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(it)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadSpecularPropertiesAsync(o,a,n)),i=this._loader._getOrCreateMaterialAdapter(n),a.extensions&&a.extensions.EXT_materials_specular_edge_color&&a.extensions.EXT_materials_specular_edge_color.specularEdgeColorEnabled&&i.enableSpecularEdgeColor(!0),[4,Promise.all(r).then((function(){}))];case 1:return[2,s.sent()]}}))}))}))},e.prototype._loadSpecularPropertiesAsync=function(e,t,n){var r,o=this._loader._getOrCreateMaterialAdapter(n),a=new Array;return o.specularWeight=null!==(r=t.specularFactor)&&void 0!==r?r:1,o.specularColor=void 0!==t.specularColorFactor?m.Color3.FromArray(t.specularColorFactor):new m.Color3(1,1,1),t.specularTexture&&(t.specularTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),t.specularTexture,(function(e){e.name="".concat(n.name," (Specular)"),o.specularWeightTexture=e})))),t.specularColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),t.specularColorTexture,(function(e){e.name="".concat(n.name," (Specular Color)"),o.specularColorTexture=e}))),Promise.all(a).then((function(){}))},e}();ge(it),ye(it,!0,(function(e){return new st(e)}));var lt="KHR_materials_ior",ut=function(){function e(e){this.name=lt,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(lt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadIorPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadIorPropertiesAsync=function(t,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=void 0!==n.ior?n.ior:e._DEFAULT_IOR;return o.specularIor=a,Promise.resolve()},e._DEFAULT_IOR=1.5,e}();ge(lt),ye(lt,!0,(function(e){return new ut(e)}));var ct="KHR_materials_variants",ft=function(){function e(e){this.name=ct,this._loader=e,this.enabled=this._loader.isExtensionUsed(ct)&&!this._loader.parent.skipMaterials}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(ct," 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(ct," 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(ct," 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[ct])||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=this._loader.rootBabylonMesh;if(n){var r=this._loader.parent.extensionOptions[ct];(null==r?void 0:r.defaultVariant)&&e.SelectVariant(n,r.defaultVariant),null===(t=null==r?void 0:r.onLoaded)||void 0===t||t.call(r,{get variants(){return e.GetAvailableVariants(n)},get selectedVariant(){var t=e.GetLastSelectedVariant(n);return t?Array.isArray(t)?t[0]:t:e.GetAvailableVariants(n)[0]},set selectedVariant(t){e.SelectVariant(n,t)}})}},e.prototype._loadMeshPrimitiveAsync=function(t,n,r,o,a,i){var s=this;return Ae.LoadExtensionAsync(t,a,this.name,(function(l,u){return(0,h.sH)(s,void 0,void 0,(function(){var s,c=this;return(0,h.YH)(this,(function(f){switch(f.label){case 0:return(s=new Array).push(this._loader._loadMeshPrimitiveAsync(t,n,r,o,a,(function(n){if(i(n),n instanceof m.Mesh){var r=Ae._GetDrawMode(t,a.mode),o=c._loader.rootBabylonMesh,f=o?o._internalMetadata=o._internalMetadata||{}:{},d=f.gltf=f.gltf||{},p=d[ct]=d[ct]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:n,material:n.material});for(var h=function(t){var a=u.mappings[t],i=Te.Get("".concat(l,"/mappings/").concat(t,"/material"),c._loader.gltf.materials,a.material);s.push(c._loader._loadMaterialAsync("#/materials/".concat(a.material),i,n,r,(function(t){for(var r=function(r){var i=a.variants[r],s=Te.Get("/extensions/".concat(ct,"/variants/").concat(i),c._variants,i);p.variants[s.name]=p.variants[s.name]||[],p.variants[s.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 l in i._internalMetadata={},o._internalMetadata)i._internalMetadata[l]=o._internalMetadata[l];for(var l in i._internalMetadata.gltf=[],o._internalMetadata.gltf)i._internalMetadata.gltf[l]=o._internalMetadata.gltf[l];i._internalMetadata.gltf[ct]={lastSelected:null,original:[],variants:{}};for(var u=0,c=a.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[ct].original.push({mesh:f.mesh,material:f.material})}for(var l in a.variants)if(Object.prototype.hasOwnProperty.call(a.variants,l)){i._internalMetadata.gltf[ct].variants[l]=[];for(var d=0,p=a.variants[l];d<p.length;d++){var h=p[d];i._internalMetadata.gltf[ct].variants[l].push({mesh:h.mesh,material:h.material})}}a=i._internalMetadata.gltf[ct]}for(var m=0,_=a.original;m<_.length;m++)(b=_[m]).mesh===n&&(b.mesh=r);for(var y=0,g=a.variants[s.name];y<g.length;y++){var b;(b=g[y]).mesh===n&&(b.mesh=r)}}))},i=0;i<a.variants.length;++i)r(i)})))},_=0;_<u.mappings.length;++_)h(_)}}))),[4,Promise.all(s).then((function(e){return e[0]}))];case 1:return[2,f.sent()]}}))}))}))},e}();ge(ct),ye(ct,!0,(function(e){return new ft(e)}));var dt=function(){function e(t,n){var r=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,h.Cl)((0,h.Cl)({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this.onErrorObservable=new m.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:m.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=(0,h.Cl)((0,h.Cl)({},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){var t;return!!(null===(t=null==e?void 0:e.subSurface)||void 0===t?void 0:t.isRefractionEnabled)},e.prototype._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),m.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);if(this._shouldRenderAsTransmission(e.material)){if(e.material){var r=e.material.subSurface;r&&(r.refractionTexture=this._opaqueRenderTarget)}-1!==n?(this._opaqueMeshesCache.splice(n,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)}else-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=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new m.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.disableImageProcessing=!0,this._opaqueRenderTarget.onBeforeBindObservable.add((function(e){n=r._scene.environmentIntensity,r._scene.environmentIntensity=1,r._options.clearColor?e.clearColor.copyFrom(r._options.clearColor):r._scene.clearColor.toLinearSpaceToRef(e.clearColor,r._scene.getEngine().useExactSrgbConversions)})),this._opaqueRenderTarget.onAfterUnbindObservable.add((function(){r._scene.environmentIntensity=n}));for(var o=0,a=this._transparentMeshesCache;o<a.length;o++){var i=a[o];this._shouldRenderAsTransmission(i.material)&&(i.material.refractionTexture=this._opaqueRenderTarget)}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},e}(),pt="KHR_materials_transmission",ht=function(){function e(e){this.name=pt,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(pt),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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTransparentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadTransparentPropertiesAsync=function(e,t,n,r){var o,a,i=this._loader._getOrCreateMaterialAdapter(n),s=void 0!==r.transmissionFactor?r.transmissionFactor:0;if(0===s)return Promise.resolve();if(i.configureTransmission(),i.transmissionWeight=s,s>0&&!this._loader.parent.dontUseTransmissionHelper){var l=n.getScene();l._transmissionHelper?(null===(o=l._transmissionHelper)||void 0===o?void 0:o._isRenderTargetValid())||null===(a=l._transmissionHelper)||void 0===a||a._setupRenderTargets():new dt({},n.getScene())}var u=Promise.resolve(null);return r.transmissionTexture&&(r.transmissionTexture.nonColorData=!0,u=this._loader.loadTextureInfoAsync("".concat(e,"/transmissionTexture"),r.transmissionTexture,(function(e){e.name="".concat(n.name," (Transmission)"),i.transmissionWeightTexture=e}))),u.then((function(){}))},e}();ge(pt),ye(pt,!0,(function(e){return new ht(e)}));var mt="KHR_materials_diffuse_transmission",_t=function(){function e(e){this.name=mt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(mt),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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadTranslucentPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadTranslucentPropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);a.configureSubsurface(),a.subsurfaceWeight=null!==(o=r.diffuseTransmissionFactor)&&void 0!==o?o:0,a.subsurfaceColor=void 0!==r.diffuseTransmissionColorFactor?m.Color3.FromArray(r.diffuseTransmissionColorFactor):m.Color3.White();var i=new Array;return r.diffuseTransmissionTexture&&(r.diffuseTransmissionTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),r.diffuseTransmissionTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission)"),a.subsurfaceWeightTexture=e})))),r.diffuseTransmissionColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),r.diffuseTransmissionColorTexture).then((function(e){e.name="".concat(n.name," (Diffuse Transmission Color)"),a.subsurfaceColorTexture=e}))),Promise.all(i).then((function(){}))},e}();ge(mt),ye(mt,!0,(function(e){return new _t(e)}));var yt="KHR_materials_volume",gt=function(){function e(e){this.name=yt,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(yt),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 Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadVolumePropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadVolumePropertiesAsync=function(e,t,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(n);if(0===a.transmissionWeight&&0===a.subsurfaceWeight||!r.thicknessFactor)return Promise.resolve();a.transmissionDepth=void 0!==r.attenuationDistance?r.attenuationDistance:Number.MAX_VALUE,a.transmissionColor=void 0!==r.attenuationColor&&3==r.attenuationColor.length?m.Color3.FromArray(r.attenuationColor):m.Color3.White(),a.volumeThickness=null!==(o=r.thicknessFactor)&&void 0!==o?o:0;var i=new Array;return r.thicknessTexture&&(r.thicknessTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),r.thicknessTexture,(function(e){e.name="".concat(n.name," (Thickness)"),a.volumeThicknessTexture=e})))),Promise.all(i).then((function(){}))},e}();ge(yt),ye(yt,!0,(function(e){return new gt(e)}));var bt="KHR_materials_dispersion",vt=function(){function e(e){this.name=bt,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(bt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDispersionPropertiesAsync(o,t,n,a)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadDispersionPropertiesAsync=function(e,t,n,r){var o=this._loader._getOrCreateMaterialAdapter(n);return o.transmissionWeight>0||!r.dispersion||(o.transmissionDispersionAbbeNumber=20/r.dispersion),Promise.resolve()},e}();ge(bt),ye(bt,!0,(function(e){return new vt(e)}));var Tt="KHR_materials_diffuse_roughness",xt=function(){function e(e){this.name=Tt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Tt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return(r=new Array).push(this._loader.loadMaterialPropertiesAsync(e,t,n)),r.push(this._loadDiffuseRoughnessPropertiesAsync(o,a,n)),[4,Promise.all(r).then((function(){}))];case 1:return[2,i.sent()]}}))}))}))},e.prototype._loadDiffuseRoughnessPropertiesAsync=function(e,t,n){var r,o=this._loader._getOrCreateMaterialAdapter(n),a=new Array;return o.baseDiffuseRoughness=null!==(r=t.diffuseRoughnessFactor)&&void 0!==r?r:0,t.diffuseRoughnessTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseRoughnessTexture"),t.diffuseRoughnessTexture,(function(e){e.name="".concat(n.name," (Diffuse Roughness)"),o.baseDiffuseRoughnessTexture=e}))),Promise.all(a).then((function(){}))},e}();ge(Tt),ye(Tt,!0,(function(e){return new xt(e)}));var At="KHR_mesh_quantization",Ot=function(){function e(e){this.name=At,this.enabled=e.isExtensionUsed(At)}return e.prototype.dispose=function(){},e}();ge(At),ye(At,!0,(function(e){return new Ot(e)}));var wt="KHR_texture_basisu",Ct=function(){function e(e){this.name=wt,this._loader=e,this.enabled=e.isExtensionUsed(wt)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?Ae.DefaultSampler:Te.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=Te.Get("".concat(o,"/source"),this._loader.gltf.images,a.source),[4,this._loader._createTextureAsync(e,r,i,(function(e){n(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)];case 1:return[2,s.sent()]}}))}))}))},e}();ge(wt),ye(wt,!0,(function(e){return new Ct(e)}));var Et="KHR_texture_transform",Mt=function(){function e(e){this.name=Et,this._loader=e,this.enabled=this._loader.isExtensionUsed(Et)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof m.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)}))];case 1:return[2,r.sent()]}}))}))}))},e}();ge(Et),ye(Et,!0,(function(e){return new Mt(e)}));var Rt="KHR_xmp_json_ld",Lt=function(){function e(e){this.name=Rt,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Rt)}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}();ge(Rt),ye(Rt,!0,(function(e){return new Lt(e)}));var Pt=a(727);function Nt(e,t,n,r){return m.Color3.FromArray(t,n).scale(r)}function Ft(e,t,n,r){return t[n]*r}function It(e,t,n,r){return-t[n]*r}function St(e,t,n,r){return t[n+1]*r}function kt(e,t,n,r){return t[n]*r*2}function Bt(e){return{scale:[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Ft,(function(){return 2})),new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),St,(function(){return 2}))],offset:[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Ft,(function(){return 2})),new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),St,(function(){return 2}))],rotation:[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),It,(function(){return 1}))]}}var Gt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Pt.AnimationPropertyInfo),Vt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=[];for(var a in e._data)o.push({babylonAnimatable:e._data[a].babylonMaterial,babylonAnimation:this._buildAnimation(t,n,r)});return o},t}(Pt.AnimationPropertyInfo),Dt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Pt.AnimationPropertyInfo),Ht=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,h.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=this;return e._primitiveBabylonMeshes?e._primitiveBabylonMeshes.map((function(e){return{babylonAnimatable:e,babylonAnimation:o._buildAnimation(t,n,r)}})):[]},t}(Pt.AnimationPropertyInfo);(0,he.ZU)("/cameras/{}/orthographic/xmag",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",It,(function(){return 1})),new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",St,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/orthographic/ymag",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",It,(function(){return 1})),new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",St,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/orthographic/zfar",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/orthographic/znear",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"minZ",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/perspective/yfov",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"fov",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/perspective/zfar",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Ft,(function(){return 1}))]),(0,he.ZU)("/cameras/{}/perspective/znear",[new Gt(m.Animation.ANIMATIONTYPE_FLOAT,"minZ",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",Nt,(function(){return 4})),new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,r){return t[n+3]*r}),(function(){return 4}))]),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"metallic",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"roughness",Ft,(function(){return 1}))]);var Ut=Bt("albedoTexture");(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",Ut.scale),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",Ut.offset),(0,he.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",Ut.rotation);var jt=Bt("metallicTexture");(0,he.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",jt.scale),(0,he.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",jt.offset),(0,he.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",jt.rotation),(0,he.ZU)("/materials/{}/emissiveFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",Nt,(function(){return 3}))]);var Kt=Bt("bumpTexture");(0,he.ZU)("/materials/{}/normalTexture/scale",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",Kt.scale),(0,he.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",Kt.offset),(0,he.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",Kt.rotation),(0,he.ZU)("/materials/{}/occlusionTexture/strength",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Ft,(function(){return 1}))]);var Wt=Bt("ambientTexture");(0,he.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",Wt.scale),(0,he.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",Wt.offset),(0,he.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",Wt.rotation);var zt=Bt("emissiveTexture");(0,he.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",zt.scale),(0,he.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",zt.offset),(0,he.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",zt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Ft,(function(){return 1}))]);var Zt=Bt("anisotropy.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",Zt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",Zt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",Zt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Ft,(function(){return 1}))]);var Yt=Bt("clearCoat.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",Yt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",Yt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",Yt.rotation);var qt=Bt("clearCoat.bumpTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",qt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",qt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",qt.rotation);var Qt=Bt("clearCoat.textureRoughness");(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",Qt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",Qt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",Qt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_ior/ior",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Ft,(function(){return 1}))]);var Xt=Bt("iridescence.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",Xt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",Xt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",Xt.rotation);var Jt=Bt("iridescence.thicknessTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",Jt.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",Jt.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",Jt.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",Nt,(function(){return 3}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Ft,(function(){return 1}))]);var $t=Bt("sheen.texture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",$t.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",$t.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",$t.rotation);var en=Bt("sheen.textureRoughness");(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",en.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",en.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",en.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Nt,(function(){return 3}))]);var tn=Bt("metallicReflectanceTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",tn.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",tn.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",tn.rotation);var nn=Bt("reflectanceTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",nn.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",nn.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",nn.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Ft,(function(){return 1}))]);var rn=Bt("subSurface.refractionIntensityTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",rn.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",rn.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",rn.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Nt,(function(){return 3}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Ft,(function(){return 1}))]),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Ft,(function(){return 1}))]);var on=Bt("subSurface.thicknessTexture");(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",on.scale),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",on.offset),(0,he.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",on.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new Vt(m.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Ft,(function(){return 1}))]);var an=Bt("subSurface.translucencyIntensityTexture");(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",an.scale),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",an.offset),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",an.rotation),(0,he.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new Vt(m.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",Nt,(function(){return 3}))]);var sn=Bt("subSurface.translucencyColorTexture");(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",sn.scale),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",sn.offset),(0,he.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",sn.rotation),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/color",[new Dt(m.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Nt,(function(){return 3}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/range",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"range",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",kt,(function(){return 1}))]),(0,he.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"angle",kt,(function(){return 1}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/color",[new Dt(m.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Nt,(function(){return 3}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/intensity",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/size",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"radius",Ft,(function(){return 1}))]),(0,he.ZU)("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"radius",Ft,(function(){return 1}))]),(0,he.ZU)("/nodes/{}/extensions/EXT_lights_ies/color",[new Dt(m.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Nt,(function(){return 3}))]),(0,he.ZU)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new Dt(m.Animation.ANIMATIONTYPE_FLOAT,"intensity",Ft,(function(){return 1}))]),(0,he.ZU)("/nodes/{}/extensions/KHR_node_visibility/visible",[new Ht(m.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Ft,(function(){return 1}))]);var ln="KHR_animation_pointer",un=function(){function e(e){this.name=ln,this._loader=e,this._pathToObjectConverter=(0,he.Wt)(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(ln)},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&&m.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&&m.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 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,r,{object:u.object,info:u.info.interpolation},o)}catch(e){return m.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();ge(ln),ye(ln,!0,(function(e){return new un(e)}));var cn="MSFT_audio_emitter",fn=function(){function e(e){this.name=cn,this._loader=e,this.enabled=this._loader.isExtensionUsed(cn)}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,Te.Assign(this._clips),Te.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,h.YH)(this,(function(u){switch(u.label){case 0:for((n=new Array).push(this._loader.loadSceneAsync(e,t)),a=0,i=o.emitters;a<i.length;a++){if(s=i[a],null!=(l=Te.Get("".concat(r,"/emitters"),this._emitters,s)).refDistance||null!=l.maxDistance||null!=l.rolloffFactor||null!=l.distanceModel||null!=l.innerAngle||null!=l.outerAngle)throw new Error("".concat(r,": Direction or Distance properties are not allowed on emitters attached to a scene"));n.push(this._loadEmitterAsync("".concat(r,"/emitters/").concat(l.index),l))}return[4,Promise.all(n)];case 1:return u.sent(),[2]}}))}))}))},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,h.sH)(r,void 0,void 0,(function(){var r,a,i=this;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return r=new Array,[4,this._loader.loadNodeAsync(e,t,(function(t){for(var a=function(n){var o=Te.Get("".concat(e,"/emitters"),i._emitters,n);r.push(i._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(m.Vector3.Forward()),r.setDirectionalCone(2*m.Tools.ToDegrees(null==o.innerAngle?Math.PI:o.innerAngle),2*m.Tools.ToDegrees(null==o.outerAngle?Math.PI:o.outerAngle),0))}})))},s=0,l=o.emitters;s<l.length;s++)a(l[s]);n(t)}))];case 1:return a=s.sent(),[4,Promise.all(r)];case 2:return s.sent(),[2,a]}}))}))}))},e.prototype.loadAnimationAsync=function(e,t){var n=this;return Ae.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,h.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,h.YH)(this,(function(u){switch(u.label){case 0:return[4,this._loader.loadAnimationAsync(e,t)];case 1:for(n=u.sent(),a=new Array,Te.Assign(o.events),i=0,s=o.events;i<s.length;i++)l=s[i],a.push(this._loadAnimationEventAsync("".concat(r,"/events/").concat(l.index),e,t,l,n));return[4,Promise.all(a)];case 2:return u.sent(),[2,n]}}))}))}))},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=Te.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=Te.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 m.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 u=Promise.all(r).then((function(){var e=t.clips.map((function(e){return e.weight||1})),n=new m.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*m.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*m.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,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=Te.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 m.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}();ge(cn),ye(cn,!0,(function(e){return new fn(e)}));var dn="MSFT_lod",pn=function(){function e(e){var t,n;this.name=dn,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new m.Observable,this.onMaterialLODsLoadedObservable=new m.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[dn])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(dn)}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 Ae.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,h.sH)(r,void 0,void 0,(function(){var r,a,i,s,l,u=this;return(0,h.YH)(this,(function(c){switch(c.label){case 0:for(a=this._getLODs(e,t,this._loader.gltf.nodes,o.ids),this._loader.logOpen("".concat(e)),i=function(e){var t=a[e];0!==e&&(s._nodeIndexLOD=e,s._nodeSignalLODs[e]=s._nodeSignalLODs[e]||new m.Deferred);var o=s._loader.loadNodeAsync("/nodes/".concat(t.index),t,(function(e){n(e),e.setEnabled(!1)})).then((function(t){if(0!==e){var n=a[e-1];n._babylonTransformNode&&(u._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t}));s._nodePromiseLODs[e]=s._nodePromiseLODs[e]||[],0===e?r=o:(s._nodeIndexLOD=null,s._nodePromiseLODs[e].push(o))},s=this,l=0;l<a.length;l++)i(l);return this._loader.logClose(),[4,r];case 1:return[2,c.sent()]}}))}))}))},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var a=this;return this._nodeIndexLOD?null:Ae.LoadExtensionAsync(e,t,this.name,(function(e,i){return(0,h.sH)(a,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,h.YH)(this,(function(d){switch(d.label){case 0:for(s=this._getLODs(e,t,this._loader.gltf.materials,i.ids),this._loader.logOpen("".concat(e)),l=function(e){var t=s[e];0!==e&&(u._materialIndexLOD=e);var i=u._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=s[e-1]._data;n[r]&&(f._disposeMaterials([n[r].babylonMaterial]),delete n[r])}return t}));u._materialPromiseLODs[e]=u._materialPromiseLODs[e]||[],0===e?a=i:(u._materialIndexLOD=null,u._materialPromiseLODs[e].push(i))},u=this,c=0;c<s.length;c++)l(c);return this._loader.logClose(),[4,a];case 1:return[2,d.sent()]}}))}))}))},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 m.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))}return null!==this._materialIndexLOD?(this._loader.log("deferred"),o=this._materialIndexLOD-1,this._materialSignalLODs[o]=this._materialSignalLODs[o]||new m.Deferred,this._materialSignalLODs[o].promise.then((function(){return(0,h.sH)(r,void 0,void 0,(function(){return(0,h.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadUriAsync(e,t,n)];case 1:return[2,r.sent()]}}))}))}))):null},e.prototype.loadBufferAsync=function(e,t,n,r){var o=this;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 a=function(e,t){return(0,h.sH)(o,void 0,void 0,(function(){var o,a,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return a=(o=n)+r-1,(i=e[t])?(i.start=Math.min(i.start,o),i.end=Math.max(i.end,a)):(i={start:o,end:a,loaded:new m.Deferred},e[t]=i),[4,i.loaded.promise.then((function(e){return new Uint8Array(e.buffer,e.byteOffset+n-i.start,r)}))];case 1:return[2,s.sent()]}}))}))};return this._loader.log("deferred"),null!==this._nodeIndexLOD?a(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?a(this._materialBufferLODs,this._materialIndexLOD):a(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(Te.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=(c=r[n]).getActiveTextures();o<a.length;o++){var i=a[o];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}();ge(dn),ye(dn,!0,(function(e){return new pn(e)}));var hn="MSFT_minecraftMesh",mn=function(){function e(e){this.name=hn,this._loader=e,this.enabled=this._loader.isExtensionUsed(hn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r;return(0,h.YH)(this,(function(i){switch(i.label){case 0:if(!a)return[3,2];if(!this._loader._pbrMaterialImpl)throw new Error("".concat(o,": Material type not supported"));return r=this._loader.loadMaterialPropertiesAsync(e,t,n),n.needAlphaBlending()&&(n.forceDepthWrite=!0,n.separateCullingPass=!0),n.backFaceCulling=n.forceDepthWrite,n.twoSidedLighting=!0,[4,r];case 1:return[2,i.sent()];case 2:return[2]}}))}))}))},e}();ge(hn),ye(hn,!0,(function(e){return new mn(e)}));var _n="MSFT_sRGBFactors",yn=function(){function e(e){this.name=_n,this._loader=e,this.enabled=this._loader.isExtensionUsed(_n)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return Ae.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,h.sH)(r,void 0,void 0,(function(){var r,o,i;return(0,h.YH)(this,(function(s){switch(s.label){case 0:return a?(r=this._loader._getOrCreateMaterialAdapter(n),o=this._loader.loadMaterialPropertiesAsync(e,t,n),i=n.getScene().getEngine().useExactSrgbConversions,r.baseColorTexture||r.baseColor.toLinearSpaceToRef(r.baseColor,i),r.specularColorTexture||r.specularColor.toLinearSpaceToRef(r.specularColor,i),[4,o]):[3,2];case 1:return[2,s.sent()];case 2:return[2]}}))}))}))},e}();function gn(e){var t=e.split(":");return bn({op:t[0],extension:t[1]})}function bn(e,t){var n;void 0===t&&(t=!0);var r=e.extension?null===(n=Tn[e.extension])||void 0===n?void 0:n[e.op]:xn[e.op];if(!r&&(m.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),t)){var o={},a={flows:{}};if(e.inputValueSockets)for(var i in o.values={},e.inputValueSockets)o.values[i]={name:i};return e.outputValueSockets&&(a.values={},Object.keys(e.outputValueSockets).forEach((function(e){a.values[e]={name:e}}))),{blocks:[],inputs:o,outputs:a}}return r}function vn(e,t,n){Tn[t]||(Tn[t]={}),Tn[t][e]=n}ge(_n),ye(_n,!0,(function(e){return new yn(e)}));var Tn={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},xn={"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"],extraProcessor:function(e,t,n,r,o){var a;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 i=null===(a=e.configuration.event.value)||void 0===a?void 0:a[0];if("number"!=typeof i)throw new Error("Event id should be a number");var s=r.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=s.eventId,l.config.eventData=s.eventData,o}},"event/receive":{blocks:["FlowGraphReceiveCustomEventBlock"],outputs:{flows:{out:{name:"done"}}},validation:function(e,t){var n,r;if(!e.configuration)return m.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};var o=e.configuration.event;if(!o)return m.Logger.Error("Receive event should have a single configuration object, the event itself"),{valid:!1,error:"Receive event should have a single configuration object, the event itself"};var a=null===(n=o.value)||void 0===n?void 0:n[0];return"number"!=typeof a?(m.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):(null===(r=t.events)||void 0===r?void 0:r[a])?{valid:!0}:(m.Logger.Error("Event with id ".concat(a," not found")),{valid:!1,error:"Event with id ".concat(a," not found")})},extraProcessor:function(e,t,n,r,o){var a;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 i=null===(a=e.configuration.event.value)||void 0===a?void 0:a[0];if("number"!=typeof i)throw new Error("Event id should be a number");var s=r.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=s.eventId,l.config.eventData=s.eventData,o}},"math/E":An("FlowGraphEBlock"),"math/Pi":An("FlowGraphPIBlock"),"math/Inf":An("FlowGraphInfBlock"),"math/NaN":An("FlowGraphNaNBlock"),"math/abs":An("FlowGraphAbsBlock"),"math/sign":An("FlowGraphSignBlock"),"math/trunc":An("FlowGraphTruncBlock"),"math/floor":An("FlowGraphFloorBlock"),"math/ceil":An("FlowGraphCeilBlock"),"math/round":{blocks:["FlowGraphRoundBlock"],configuration:{},inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.roundHalfAwayFromZero=!0,o}},"math/fract":An("FlowGraphFractBlock"),"math/neg":An("FlowGraphNegationBlock"),"math/add":An("FlowGraphAddBlock",["a","b"],!0),"math/sub":An("FlowGraphSubtractBlock",["a","b"],!0),"math/mul":{blocks:["FlowGraphMultiplyBlock"],extraProcessor:function(e,t,n,r,o){var a;(a=o[0]).config||(a.config={}),o[0].config.useMatrixPerComponent=!0,o[0].config.preventIntegerFloatArithmetic=!0;var i=-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)&&(i=e.values[t].type,!0)})),-1!==i&&(o[0].config.type=r.arrays.types[i].flowGraphType),o},validation:function(e){return e.values?On(e):{valid:!0}}},"math/div":An("FlowGraphDivideBlock",["a","b"],!0),"math/rem":An("FlowGraphModuloBlock",["a","b"]),"math/min":An("FlowGraphMinBlock",["a","b"]),"math/max":An("FlowGraphMaxBlock",["a","b"]),"math/clamp":An("FlowGraphClampBlock",["a","b","c"]),"math/saturate":An("FlowGraphSaturateBlock"),"math/mix":An("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":An("FlowGraphEqualityBlock",["a","b"]),"math/lt":An("FlowGraphLessThanBlock",["a","b"]),"math/le":An("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":An("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":An("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":An("FlowGraphIsNaNBlock"),"math/isInf":An("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":An("FlowGraphSinBlock"),"math/cos":An("FlowGraphCosBlock"),"math/tan":An("FlowGraphTanBlock"),"math/asin":An("FlowGraphASinBlock"),"math/acos":An("FlowGraphACosBlock"),"math/atan":An("FlowGraphATanBlock"),"math/atan2":An("FlowGraphATan2Block",["a","b"]),"math/sinh":An("FlowGraphSinhBlock"),"math/cosh":An("FlowGraphCoshBlock"),"math/tanh":An("FlowGraphTanhBlock"),"math/asinh":An("FlowGraphASinhBlock"),"math/acosh":An("FlowGraphACoshBlock"),"math/atanh":An("FlowGraphATanhBlock"),"math/exp":An("FlowGraphExponentialBlock"),"math/log":An("FlowGraphLogBlock"),"math/log2":An("FlowGraphLog2Block"),"math/log10":An("FlowGraphLog10Block"),"math/sqrt":An("FlowGraphSquareRootBlock"),"math/cbrt":An("FlowGraphCubeRootBlock"),"math/pow":An("FlowGraphPowerBlock",["a","b"]),"math/length":An("FlowGraphLengthBlock"),"math/normalize":An("FlowGraphNormalizeBlock"),"math/dot":An("FlowGraphDotBlock",["a","b"]),"math/cross":An("FlowGraphCrossBlock",["a","b"]),"math/rotate2D":{blocks:["FlowGraphRotate2DBlock"],inputs:{values:{a:{name:"a"},angle:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/rotate3D":{blocks:["FlowGraphRotate3DBlock"],inputs:{values:{a:{name:"a"},rotation:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"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":An("FlowGraphTransposeBlock"),"math/determinant":An("FlowGraphDeterminantBlock"),"math/inverse":An("FlowGraphInvertMatrixBlock"),"math/matMul":An("FlowGraphMatrixMultiplicationBlock",["a","b"]),"math/matCompose":{blocks:["FlowGraphMatrixCompose"],inputs:{values:{translation:{name:"position",gltfType:"float3"},rotation:{name:"rotationQuaternion",gltfType:"float4"},scale:{name:"scaling",gltfType:"float3"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i=o[0].dataInputs.find((function(e){return"rotationQuaternion"===e.name}));if(!i)throw new Error("Rotation quaternion input not found");return a._connectionValues[i.uniqueId]&&(a._connectionValues[i.uniqueId].type="Quaternion"),o}},"math/matDecompose":{blocks:["FlowGraphMatrixDecompose"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{translation:{name:"position"},rotation:{name:"rotationQuaternion"},scale:{name:"scaling"}}}},"math/quatConjugate":An("FlowGraphConjugateBlock",["a"]),"math/quatMul":{blocks:["FlowGraphMultiplyBlock"],inputs:{values:{a:{name:"a",gltfType:"vector4"},b:{name:"b",gltfType:"vector4"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.type="Quaternion",o}},"math/quatAngleBetween":An("FlowGraphAngleBetweenBlock",["a","b"]),"math/quatFromAxisAngle":{blocks:["FlowGraphQuaternionFromAxisAngleBlock"],inputs:{values:{axis:{name:"a",gltfType:"float3"},angle:{name:"b",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/quatToAxisAngle":An("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":An("FlowGraphQuaternionFromDirectionsBlock",["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,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"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,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"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,r,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"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/not":{blocks:["FlowGraphBitwiseNotBlock"],inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l;(l=o[0]).config||(l.config={});var u=o[0].dataInputs[0];return o[0].config.valueType=null!==(s=null===(i=a._connectionValues[u.uniqueId])||void 0===i?void 0:i.type)&&void 0!==s?s:"FlowGraphInteger",o}},"math/and":{blocks:["FlowGraphBitwiseAndBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],d=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.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",o}},"math/or":{blocks:["FlowGraphBitwiseOrBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],d=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.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",o}},"math/xor":{blocks:["FlowGraphBitwiseXorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor:function(e,t,n,r,o,a){var i,s,l,u,c;(c=o[0]).config||(c.config={});var f=o[0].dataInputs[0],d=o[0].dataInputs[1];return o[0].config.valueType=null!==(u=null!==(s=null===(i=a._connectionValues[f.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",o}},"math/asr":An("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":An("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":An("FlowGraphLeadingZerosBlock"),"math/ctz":An("FlowGraphTrailingZerosBlock"),"math/popcnt":An("FlowGraphOneBitsCounterBlock"),"math/rad":An("FlowGraphDegToRadBlock"),"math/deg":An("FlowGraphRadToDegBlock"),"type/boolToInt":An("FlowGraphBooleanToInt"),"type/boolToFloat":An("FlowGraphBooleanToFloat"),"type/intToBool":An("FlowGraphIntToBoolean"),"type/intToFloat":An("FlowGraphIntToFloat"),"type/floatToInt":An("FlowGraphFloatToInt"),"type/floatToBool":An("FlowGraphFloatToBoolean"),"flow/sequence":{blocks:["FlowGraphSequenceBlock"],extraProcessor:function(e,t,n,r,o){var a=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows||[]).length,a.signalOutputs.forEach((function(e,t){e.name="out_"+t})),o}},"flow/branch":{blocks:["FlowGraphBranchBlock"],outputs:{flows:{true:{name:"onTrue"},false:{name:"onFalse"}}}},"flow/switch":{blocks:["FlowGraphSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"},default:{name:"default"}}},validation:function(e){var t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return m.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}return{valid:!0}},extraProcessor:function(e,t,n,r,o){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 o[0].signalOutputs.forEach((function(e){"default"!==e.name&&(e.name="out_"+e.name)})),o}},"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"}}},extraProcessor:function(e,t,n,r,o){var a=o[0];return a.config||(a.config={}),a.config.incrementIndexWhenLoopDone=!0,o}},"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,r,o){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=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows).length,a.signalOutputs.forEach((function(e,t){e.name="out_"+t})),o}},"flow/waitAll":{blocks:["FlowGraphWaitAllBlock"],configuration:{inputFlows:{name:"inputSignalCount",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{flows:{reset:{name:"reset"},"[segment]":{name:"in_$1"}}},validation:function(e){var t,n,r;return"number"!=typeof(null===(r=null===(n=null===(t=e.configuration)||void 0===t?void 0:t.inputFlows)||void 0===n?void 0:n.value)||void 0===r?void 0:r[0])&&(e.configuration=e.configuration||{inputFlows:{value:[0]}},e.configuration.inputFlows.value=[0]),{valid:!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)?{valid:!0}:(m.Logger.Error("Variable get block should have a variable configuration"),{valid:!1,error:"Variable get block should have a variable configuration"})},configuration:{variable:{name:"variable",gltfType:"number",flowGraphType:"string",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return t.getVariableName(e)}}}},"variable/set":{blocks:["FlowGraphSetVariableBlock"],configuration:{variables:{name:"variables",gltfType:"number",flowGraphType:"string",inOptions:!0,isArray:!0,dataTransformer:function(e,t){return e.map((function(e){return t.getVariableName(e)}))}}},extraProcessor:function(e,t,n,r,o){return o[0].dataInputs.forEach((function(e){e.name=r.getVariableName(+e.name)})),o}},"variable/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphContextBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing","FlowGraphGetVariableBlock"],configuration:{variable:{name:"propertyName",inOptions:!0,isVariable:!0,dataTransformer:function(e,t){return t.getVariableName(e)}},useSlerp:{name:"animationType",inOptions:!0,defaultValue:!1,dataTransformer:function(e){return!0===e?"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,r,o){var a,i,s,l,u,c,f=o[0],d=null===(i=null===(a=e.configuration)||void 0===a?void 0:a.variable.value)||void 0===i?void 0:i[0];if("number"!=typeof d)throw m.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var p=r.arrays.staticVariables[d];void 0===(null===(l=null===(s=f.config)||void 0===s?void 0:s.animationType)||void 0===l?void 0:l.value)&&(f.config||(f.config={}),(u=f.config).animationType||(u.animationType={}),f.config.animationType.value=(0,m.getAnimationTypeByFlowGraphType)(p.type));var h=o[4];return h.config||(h.config={}),(c=h.config).variable||(c.variable={}),h.config.variable.value=r.getVariableName(d),o}},"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,r,o){return o.forEach((function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)})),o}},"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,r,o){return o.forEach((function(e){"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)})),o}},"pointer/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphJsonPointerParserBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing"],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:"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:"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,r,o){return o.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 o,a=null===(o=e.values)||void 0===o?void 0:o[n];if("value"===n&&a){var i=a.type;void 0!==i&&(t.config.animationType=r.arrays.types[i].flowGraphType)}})))})),o}},"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._animationTargetFps]}},endTime:{name:"to",gltfType:"number",dataTransformer:function(e,t){return[e[0]*t._animationTargetFps]}}}},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,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"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,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"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._animationTargetFps]}}}},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,r,o,a,i){var s=o[o.length-1];return s.config||(s.config={}),s.config.glTF=i,o}},"math/switch":{blocks:["FlowGraphDataSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"}}},validation:function(e){var t,n=null===(t=e.configuration)||void 0===t?void 0:t.cases;if(n&&n.value){if(!n.value.every((function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())})))return m.Logger.Warn("Switch cases should be integers. Using empty array instead."),n.value=[],{valid:!0};var r=new Set(n.value);n.value=Array.from(r)}return{valid:!0}},extraProcessor:function(e,t,n,r,o){var a=o[0];return a.dataInputs.forEach((function(e){"default"!==e.name&&"case"!==e.name&&(e.name="in_"+e.name)})),a.config||(a.config={}),a.config.treatCasesAsIntegers=!0,o}},"debug/log":{blocks:["FlowGraphConsoleLogBlock"],configuration:{message:{name:"messageTemplate",inOptions:!0}}}};function An(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,r,o,a){var i;if(n){(i=a[0]).config||(i.config={}),a[0].config.preventIntegerFloatArithmetic=!0;var s=-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)&&(s=e.values[t].type,!0)})),-1!==s&&(a[0].config.type=o.arrays.types[s].flowGraphType)}return a},validation:function(e){return n?On(e):{valid:!0}}}}function On(e){if(e.values){var t=Object.keys(e.values).map((function(t){return e.values[t].type})).filter((function(e){return void 0!==e}));if(!t.every((function(e){return e===t[0]})))return{valid:!1,error:"All inputs must be of the same type"}}return{valid:!0}}function wn(){return Object.keys(xn)}var Cn={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"}},En=function(){function e(e,t,n){void 0===n&&(n=60),this._interactivityGraph=e,this._gltf=t,this._animationTargetFps=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(Cn[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],r=bn(n);if(!r)throw m.Logger.Error(["No mapping found for declaration",n]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:r,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],r=this._parseVariable(n);this._staticVariables.push(r)}},e.prototype._parseVariable=function(e,t){var n=this._types[e.type];if(!n)throw m.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==n.length)throw m.Logger.Error(["Invalid value length for variable",e,n]),new Error("Error parsing variables");var r=e.value||[];if(!r.length)switch(n.flowGraphType){case"boolean":r.push(!1);break;case"FlowGraphInteger":r.push(0);break;case"number":r.push(NaN);break;case"Vector2":r.push(NaN,NaN);break;case"Vector3":r.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":r.fill(NaN,0,4);break;case"Matrix":r.fill(NaN,0,16);break;case"Matrix3D":r.fill(NaN,0,9)}return"number"===n.elementType&&"string"==typeof r[0]&&(r[0]=parseFloat(r[0])),{type:n.flowGraphType,value:t?t(r,this):r}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var t=function(t){var r={eventId:t.id||"internalEvent_"+n._internalEventsCounter++};t.values&&(r.eventData=Object.keys(t.values).map((function(n){var r,o=null===(r=t.values)||void 0===r?void 0:r[n];if(!o)throw m.Logger.Error(["No value found for event key",n]),new Error("Error parsing events");var a=e._types[o.type];if(!a)throw m.Logger.Error(["No type found for event value",o]),new Error("Error parsing events");var i=void 0!==o.value?e._parseVariable(o):void 0;return{id:n,type:a.flowGraphType,eventData:!0,value:i}}))),n._events.push(r)},n=this,r=0,o=this._interactivityGraph.events;r<o.length;r++)t(o[r])},e.prototype._parseNodes=function(){var e;if(this._interactivityGraph.nodes)for(var t=0,n=this._interactivityGraph.nodes;t<n.length;t++){var r=n[t];if("number"!=typeof r.declaration)throw m.Logger.Error(["No declaration found for node",r]),new Error("Error parsing nodes");var o=this._mappings[r.declaration];if(!o)throw m.Logger.Error(["No mapping found for node",r]),new Error("Error parsing nodes");if(o.flowGraphMapping.validation){var a=o.flowGraphMapping.validation(r,this._interactivityGraph,this._gltf);if(!a.valid)throw new Error("Error validating interactivity node ".concat(null===(e=this._interactivityGraph.declarations)||void 0===e?void 0:e[r.declaration].op," - ").concat(a.error))}for(var i=[],s=0,l=o.flowGraphMapping.blocks;s<l.length;s++){var u=l[s],c=this._getEmptyBlock(u,o.fullOperationName);this._parseNodeConfiguration(r,c,o.flowGraphMapping,u),i.push(c)}this._nodes.push({blocks:i,fullOperationName:o.fullOperationName})}},e.prototype._getEmptyBlock=function(e,t){return{uniqueId:(0,m.RandomGUID)(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,t,n,r){var o,a=e.configuration;if(a)for(var i in a){var s=a[i];if(!s)throw new Error("Error parsing node configuration");var l=null===(o=n.configuration)||void 0===o?void 0:o[i];if(l&&l.toBlock?l.toBlock===r:0===n.blocks.indexOf(r)){var u=null==l?void 0:l.defaultValue;(null==s?void 0:s.value)&&(u=s.value),(null==l?void 0:l.isArray)||(1!==u.length&&m.Logger.Warn("Invalid non-array value length: ".concat(u.length)),u=u[0]),(null==l?void 0:l.dataTransformer)&&(u=l.dataTransformer(u,this)),void 0!==u&&(t.config[(null==l?void 0:l.name)||i]={value:u})}}},e.prototype._parseNodeConnections=function(e){for(var t,n,r,o,a,i,s,l,u,c,f,d,p,h,_,y,g,b,v,T=0;T<this._nodes.length;T++){var x=null===(t=this._interactivityGraph.nodes)||void 0===t?void 0:t[T];if(!x)throw m.Logger.Error(["No node found for interactivity node",this._nodes[T]]),new Error("Error parsing node connections");var A=this._nodes[T],O=this._mappings[x.declaration];if(!O)throw m.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var w=x.flows||{},C=Object.keys(w).sort(),E=function(e){var t=w[e],u=null===(r=null===(n=O.flowGraphMapping.outputs)||void 0===n?void 0:n.flows)||void 0===r?void 0:r[e],c=(null==u?void 0:u.name)||e,f=M._createNewSocketConnection(c,!0);(u&&u.toBlock&&A.blocks.find((function(e){return e.className===u.toBlock}))||A.blocks[0]).signalOutputs.push(f);var d=t.node,p=M._nodes[d];if(!p)throw m.Logger.Error(["No node found for input node id",d]),new Error("Error parsing node connections");var h=gn(p.fullOperationName);if(!h)throw m.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var _=null===(a=null===(o=h.inputs)||void 0===o?void 0:o.flows)||void 0===a?void 0:a[t.socket||"in"],y=!1;if(!_)for(var g in null===(i=h.inputs)||void 0===i?void 0:i.flows)g.startsWith("[")&&g.endsWith("]")&&(y=!0,_=null===(l=null===(s=h.inputs)||void 0===s?void 0:s.flows)||void 0===l?void 0:l[g]);var b=_?y?_.name.replace("$1",t.socket||""):_.name:t.socket||"in",v=_&&_.toBlock&&p.blocks.find((function(e){return e.className===_.toBlock}))||p.blocks[0],T=v.signalInputs.find((function(e){return e.name===b}));T||(T=M._createNewSocketConnection(b),v.signalInputs.push(T)),T.connectedPointIds.push(f.uniqueId),f.connectedPointIds.push(T.uniqueId)},M=this,R=0,L=C;R<L.length;R++)E(L[R]);for(var P=x.values||{},N=Object.keys(P),F=function(t){var n=P[t],r=null===(c=null===(u=O.flowGraphMapping.inputs)||void 0===u?void 0:u.values)||void 0===c?void 0:c[t],o=!1;if(!r)for(var a in null===(f=O.flowGraphMapping.inputs)||void 0===f?void 0:f.values)a.startsWith("[")&&a.endsWith("]")&&(o=!0,r=null===(p=null===(d=O.flowGraphMapping.inputs)||void 0===d?void 0:d.values)||void 0===p?void 0:p[a]);var i=r?o?r.name.replace("$1",t):r.name:t,s=I._createNewSocketConnection(i);if((r&&r.toBlock&&A.blocks.find((function(e){return e.className===r.toBlock}))||A.blocks[0]).dataInputs.push(s),void 0!==n.value){var l=I._parseVariable(n,r&&r.dataTransformer);e._connectionValues[s.uniqueId]=l}else{if(void 0===n.node)throw m.Logger.Error(["Invalid value for value connection",n]),new Error("Error parsing node connections");var v=n.node,T=n.socket||"value",x=I._nodes[v];if(!x)throw m.Logger.Error(["No node found for output socket reference",n]),new Error("Error parsing node connections");var w=gn(x.fullOperationName);if(!w)throw m.Logger.Error(["No mapping found for output socket reference",n]),new Error("Error parsing node connections");var C=null===(_=null===(h=w.outputs)||void 0===h?void 0:h.values)||void 0===_?void 0:_[T],E=!1;if(!C)for(var a in null===(y=w.outputs)||void 0===y?void 0:y.values)a.startsWith("[")&&a.endsWith("]")&&(E=!0,C=null===(b=null===(g=w.outputs)||void 0===g?void 0:g.values)||void 0===b?void 0:b[a]);var M=C?E?C.name.replace("$1",T):null==C?void 0:C.name:T,R=C&&C.toBlock&&x.blocks.find((function(e){return e.className===C.toBlock}))||x.blocks[0],L=R.dataOutputs.find((function(e){return e.name===M}));L||(L=I._createNewSocketConnection(M,!0),R.dataOutputs.push(L)),s.connectedPointIds.push(L.uniqueId),L.connectedPointIds.push(s.uniqueId)}},I=this,S=0,k=N;S<k.length;S++)F(k[S]);if(O.flowGraphMapping.interBlockConnectors)for(var B=0,G=O.flowGraphMapping.interBlockConnectors;B<G.length;B++){var V=G[B],D=V.input,H=V.output,U=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],U)}if(O.flowGraphMapping.extraProcessor){var j=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!j)throw m.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=O.flowGraphMapping.extraProcessor(x,j,O.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,t){return{uniqueId:(0,m.RandomGUID)(),name:e,_connectionType:t?1:0,connectedPointIds:[]}},e.prototype._connectFlowGraphNodes=function(e,t,n,r,o){var a=o?n.dataInputs:n.signalInputs,i=o?r.dataOutputs:r.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,m.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}(),Mn="KHR_interactivity",Rn=function(){function e(e){this._loader=e,this.name=Mn,this.enabled=this._loader.isExtensionUsed(Mn),this._pathConverter=(0,he.Wt)(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&Ln(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a=this;return(0,h.YH)(this,(function(i){switch(i.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(t=null===(o=this._loader.gltf.extensions)||void 0===o?void 0:o.KHR_interactivity)?((n=new m.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,r=t.graphs.map((function(e){return new En(e,a._loader.gltf,a._loader.parent.targetFps).serializeToFlowGraph()})),[4,Promise.all(r.map((function(e){return(0,h.sH)(a,void 0,void 0,(function(){return(0,h.YH)(this,(function(t){switch(t.label){case 0:return[4,(0,m.ParseFlowGraphAsync)(e,{coordinator:n,pathConverter:this._pathConverter})];case 1:return[2,t.sent()]}}))}))})))]):[2]):[2];case 1:return i.sent(),n.start(),[2]}}))}))},e}();function Ln(e){(0,he.oR)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new m.Quaternion(NaN,NaN,NaN,NaN);var t=m.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:function(){return e.activeCamera}}),(0,he.oR)("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new m.Vector3(NaN,NaN,NaN);var t=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(t.x*=-1),t},type:"Vector3",getTarget:function(){return e.activeCamera}}),(0,he.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,he.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,he.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,he.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,he.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,m.addToBlockFactory)(Mn,"FlowGraphGLTFDataProvider",(function(){return(0,h.sH)(void 0,void 0,void 0,(function(){return(0,h.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]}}))}))})),ge(Mn),ye(Mn,!0,(function(e){return new Rn(e)}));var Pn="KHR_node_visibility";(0,he.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,r;null===(n=t._primitiveBabylonMeshes)||void 0===n||n.forEach((function(e){e.inheritVisibility=!0})),t._babylonTransformNode&&(t._babylonTransformNode.isVisible=e),null===(r=t._primitiveBabylonMeshes)||void 0===r||r.forEach((function(t){t.isVisible=e}))},getTarget:function(e){return e._babylonTransformNode},getPropertyName:[function(){return"isVisible"}],type:"boolean"});var Nn=function(){function e(e){this.name=Pn,this._loader=e,this.enabled=e.isExtensionUsed(Pn)}return e.prototype.onReady=function(){if(this._loader){var e=this._loader.gltf.nodes;if(e)for(var t=0,n=e;t<n.length;t++){var r=n[t],o=r._babylonTransformNode;o&&(o.inheritVisibility=!0,r.extensions&&r.extensions.KHR_node_visibility&&!1===r.extensions.KHR_node_visibility.visible&&(o.isVisible=!1))}}},e.prototype.dispose=function(){delete this._loader},e}();ge(Pn),ye(Pn,!0,(function(e){return new Nn(e)}));var Fn="KHR_node_selectability";vn("event/onSelect",Fn,{blocks:["FlowGraphMeshPickEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return"pickedMesh_"+e}}},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,r,o,a,i){var s,l,u,c,f,d,p,h=o[o.length-1];h.config=h.config||{},h.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _="pickedMesh_"+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(p=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}}),(0,he.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 In=function(){function e(e){this.name=Fn,this._loader=e,this.enabled=e.isExtensionUsed(Fn)}return e.prototype.onReady=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e;return(0,h.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,r;(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===(r=e._babylonTransformNode)||void 0===r||r.getChildMeshes().forEach((function(e){e.isPickable=!1})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();ge(Fn),ye(Fn,!0,(function(e){return new In(e)}));var Sn="KHR_node_hoverability",kn="targetMeshPointerOver_";vn("event/onHoverIn",Sn,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return kn+e}}},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,r,o,a,i){var s,l,u,c,f,d,p,h=o[o.length-1];h.config=h.config||{},h.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _=kn+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(p=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}});var Bn="targetMeshPointerOut_";vn("event/onHoverOut",Sn,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return Bn+e}}},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,r,o,a,i){var s,l,u,c,f,d,p,h=o[o.length-1];h.config=h.config||{},h.config.glTF=i;var m=null===(u=null===(l=null===(s=e.configuration)||void 0===s?void 0:s.nodeIndex)||void 0===l?void 0:l.value)||void 0===u?void 0:u[0];if(void 0===m||"number"!=typeof m)throw new Error("nodeIndex not found in configuration");var _=Bn+m;return o[1].config.variable=_,a._userVariables[_]={className:"Mesh",id:null===(f=null===(c=null==i?void 0:i.nodes)||void 0===c?void 0:c[m]._babylonTransformNode)||void 0===f?void 0:f.id,uniqueId:null===(p=null===(d=null==i?void 0:i.nodes)||void 0===d?void 0:d[m]._babylonTransformNode)||void 0===p?void 0:p.uniqueId},o}}),(0,he.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 Gn=function(){function e(e){this.name=Sn,this._loader=e,this.enabled=e.isExtensionUsed(Sn)}return e.prototype.onReady=function(){return(0,h.sH)(this,void 0,void 0,(function(){var e;return(0,h.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,r;(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===(r=e._babylonTransformNode)||void 0===r||r.getChildMeshes().forEach((function(e){e.pointerOverDisableMeshTesting=!0})))})),[2]}))}))},e.prototype.dispose=function(){this._loader=null},e}();ge(Sn),ye(Sn,!0,(function(e){return new Gn(e)}));var Vn="ExtrasAsMetadata",Dn=function(){function e(e){this.name=Vn,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.prototype.loadAnimationAsync=function(e,t){var n=this;return this._loader.loadAnimationAsync(e,t).then((function(e){return n._assignExtras(e,t),e}))},e}();ge(Vn),ye(Vn,!1,(function(e){return new Dn(e)}));var Hn=a(274),Un=a(833),jn=a(561),Kn=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==Kn){Kn.BABYLON=Kn.BABYLON||{};var Wn=Kn.BABYLON;Wn.GLTF2=Wn.GLTF2||{},Wn.GLTF2.Loader=Wn.GLTF2.Loader||{},Wn.GLTF2.Loader.Extensions=Wn.GLTF2.Loader.Extensions||{};var zn=[];for(var Zn in c)Wn.GLTF2.Loader.Extensions[Zn]=c[Zn],zn.push(Zn);for(var Zn in f)Wn.GLTF2.Loader[Zn]=f[Zn],zn.push(Zn);for(var Zn in d)zn.indexOf(Zn)>-1||(Wn.GLTF2[Zn]=d[Zn])}const Yn=p;return i.default})()));
|
|
2
2
|
//# sourceMappingURL=babylon.glTFFileLoader.min.js.map
|