babylonjs-loaders 8.47.0 → 8.47.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 +290 -28
- 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 +587 -56
- package/package.json +4 -4
|
@@ -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:()=>cn});var s={};a.r(s),a.d(s,{GLTFValidation:()=>v});var l={};a.r(l),a.d(l,{GLTFFileLoader:()=>P,GLTFLoaderAnimationStartMode:()=>g,GLTFLoaderCoordinateSystemMode:()=>b,GLTFLoaderDefaultOptions:()=>C,GLTFLoaderState:()=>y});var u={};a.r(u),a.d(u,{AddObjectAccessorToKey:()=>E.oR,EXT_lights_area:()=>re,EXT_lights_ies:()=>Q,EXT_lights_image_based:()=>D,EXT_mesh_gpu_instancing:()=>U,EXT_meshopt_compression:()=>z,EXT_texture_avif:()=>q,EXT_texture_webp:()=>Z,ExtrasAsMetadata:()=>tn,FlowGraphGLTFDataProvider:()=>nn.FlowGraphGLTFDataProvider,GetMappingForKey:()=>E.tQ,GetPathToObjectConverter:()=>E.Wt,InteractivityGraphToFlowGraphParser:()=>Kt,KHR_animation_pointer:()=>wt,KHR_draco_mesh_compression:()=>$,KHR_interactivity:()=>jt,KHR_lights:()=>te,KHR_materials_anisotropy:()=>me,KHR_materials_clearcoat:()=>ue,KHR_materials_coat:()=>fe,KHR_materials_diffuse_roughness:()=>Ge,KHR_materials_diffuse_transmission:()=>Fe,KHR_materials_dispersion:()=>Be,KHR_materials_emissive_strength:()=>be,KHR_materials_fuzz:()=>Te,KHR_materials_ior:()=>Oe,KHR_materials_iridescence:()=>pe,KHR_materials_pbrSpecularGlossiness:()=>ae,KHR_materials_sheen:()=>ye,KHR_materials_specular:()=>Ae,KHR_materials_transmission:()=>Ee,KHR_materials_unlit:()=>se,KHR_materials_variants:()=>Pe,KHR_materials_volume:()=>Ie,KHR_mesh_quantization:()=>Ve,KHR_node_hoverability:()=>$t,KHR_node_selectability:()=>qt,KHR_node_visibility:()=>Zt,KHR_texture_basisu:()=>Ke,KHR_texture_transform:()=>je,KHR_xmp_json_ld:()=>We,MSFT_audio_emitter:()=>Ct,MSFT_lod:()=>Rt,MSFT_minecraftMesh:()=>Et,MSFT_sRGBFactors:()=>Ft,SetInterpolationForKey:()=>E.ZU,_AddInteractivityObjectModel:()=>zt,addNewInteractivityFlowGraphMapping:()=>St,getAllSupportedNativeNodeTypes:()=>Vt,getMappingForDeclaration:()=>It,getMappingForFullOperationName:()=>kt,gltfTypeToBabylonType:()=>Dt});var c={};a.r(c);var f={};a.r(f),a.d(f,{AddObjectAccessorToKey:()=>E.oR,AnimationPropertyInfo:()=>Ze.AnimationPropertyInfo,ArrayItem:()=>N,EXT_lights_area:()=>re,EXT_lights_ies:()=>Q,EXT_lights_image_based:()=>D,EXT_mesh_gpu_instancing:()=>U,EXT_meshopt_compression:()=>z,EXT_texture_avif:()=>q,EXT_texture_webp:()=>Z,ExtrasAsMetadata:()=>tn,FlowGraphGLTFDataProvider:()=>nn.FlowGraphGLTFDataProvider,GLTFFileLoader:()=>P,GLTFLoader:()=>H,GetMappingForKey:()=>E.tQ,GetPathToObjectConverter:()=>E.Wt,InteractivityGraphToFlowGraphParser:()=>Kt,KHR_animation_pointer:()=>wt,KHR_draco_mesh_compression:()=>$,KHR_interactivity:()=>jt,KHR_lights:()=>te,KHR_materials_anisotropy:()=>me,KHR_materials_clearcoat:()=>ue,KHR_materials_coat:()=>fe,KHR_materials_diffuse_roughness:()=>Ge,KHR_materials_diffuse_transmission:()=>Fe,KHR_materials_dispersion:()=>Be,KHR_materials_emissive_strength:()=>be,KHR_materials_fuzz:()=>Te,KHR_materials_ior:()=>Oe,KHR_materials_iridescence:()=>pe,KHR_materials_pbrSpecularGlossiness:()=>ae,KHR_materials_sheen:()=>ye,KHR_materials_specular:()=>Ae,KHR_materials_transmission:()=>Ee,KHR_materials_unlit:()=>se,KHR_materials_variants:()=>Pe,KHR_materials_volume:()=>Ie,KHR_mesh_quantization:()=>Ve,KHR_node_hoverability:()=>$t,KHR_node_selectability:()=>qt,KHR_node_visibility:()=>Zt,KHR_texture_basisu:()=>Ke,KHR_texture_transform:()=>je,KHR_xmp_json_ld:()=>We,LoadBoundingInfoFromPositionAccessor:()=>G,MSFT_audio_emitter:()=>Ct,MSFT_lod:()=>Rt,MSFT_minecraftMesh:()=>Et,MSFT_sRGBFactors:()=>Ft,OpenPBRMaterialLoadingAdapter:()=>rn.OpenPBRMaterialLoadingAdapter,PBRMaterialLoadingAdapter:()=>on.PBRMaterialLoadingAdapter,SetInterpolationForKey:()=>E.ZU,TransformNodeAnimationPropertyInfo:()=>Ze.TransformNodeAnimationPropertyInfo,WeightAnimationPropertyInfo:()=>Ze.WeightAnimationPropertyInfo,_AddInteractivityObjectModel:()=>zt,addNewInteractivityFlowGraphMapping:()=>St,getAllSupportedNativeNodeTypes:()=>Vt,getMappingForDeclaration:()=>It,getMappingForFullOperationName:()=>kt,getQuaternion:()=>Ze.getQuaternion,getVector3:()=>Ze.getVector3,getWeights:()=>Ze.getWeights,gltfTypeToBabylonType:()=>Dt,registerGLTFExtension:()=>k,registeredGLTFExtensions:()=>F,unregisterGLTFExtension:()=>I});var d={};a.r(d),a.d(d,{GLTF2:()=>f,GLTFFileLoader:()=>P,GLTFLoaderAnimationStartMode:()=>g,GLTFLoaderCoordinateSystemMode:()=>b,GLTFLoaderDefaultOptions:()=>C,GLTFLoaderState:()=>y,GLTFValidation:()=>v});var p=a(322),h=a(597);function m(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 _(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":m(n.data,n.rootUrl,n.fileName,(function(t){return new Promise((function(n,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 b,g,y,v=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(m,"(").concat(_,")()"),l=URL.createObjectURL(new Blob([s],{type:"application/javascript"})),u=new Worker(l),c=function(e){u.removeEventListener("error",c),u.removeEventListener("message",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:h.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=h.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return m(e,t,n,r)})))},e.Configuration={url:"".concat(h.Tools._DefaultCdnUrl,"/gltf_validator.js")},e}(),T="Z2xURg",x="gltf",A={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};function w(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(b||(b={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(g||(g={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(y||(y={}));var O=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=g.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=b.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},C=new O,P=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new h.Observable,n.onMeshLoadedObservable=new h.Observable,n.onSkinLoadedObservable=new h.Observable,n.onTextureLoadedObservable=new h.Observable,n.onMaterialLoadedObservable=new h.Observable,n.onCameraLoadedObservable=new h.Observable,n.onCompleteObservable=new h.Observable,n.onErrorObservable=new h.Observable,n.onDisposeObservable=new h.Observable,n.onExtensionLoadedObservable=new h.Observable,n.onValidatedObservable=new h.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=x,n.extensions=A,n.onLoaderStateChangedObservable=new h.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(Object.assign((0,p.Cl)({},C),t)),n}return(0,p.C6)(t,e),Object.defineProperty(t.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),e&&(this._onParsedObserver=this.onParsedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),e&&(this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSkinLoaded",{set:function(e){this._onSkinLoadedObserver&&this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver),e&&(this._onSkinLoadedObserver=this.onSkinLoadedObservable.add((function(t){return e(t.node,t.skinnedNode)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),e&&(this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),e&&(this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),e&&(this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loggingEnabled",{get:function(){return this._loggingEnabled},set:function(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"capturePerformanceCounters",{get:function(){return this._capturePerformanceCounters},set:function(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},t.prototype.loadFile=function(e,t,n,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||h.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&h.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new h.Observable},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 h.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 h.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 h.DataReader({readAsync:function(e,n){return function(e,t,n){try{if(t<0||t>=e.byteLength)throw new RangeError("Offset is out of range.");if(t+n>e.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,n))}catch(e){return Promise.reject(e)}}(t,e,n)},byteLength:t.byteLength})).then((function(e){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 h.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var u=[];a.onCameraLoadedObservable.add((function(e){u.push(e)}));var c=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&c.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,n,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,"+T)||e.startsWith("data:;base64,"+T)||e.startsWith("data:application/octet-stream;base64,"+T)||e.startsWith("data:model/gltf-binary;base64,"+T)}(e)},t.prototype.directLoad=function(e,t){if(t.startsWith("base64,"+T)||t.startsWith(";base64,"+T)||t.startsWith("application/octet-stream;base64,"+T)||t.startsWith("model/gltf-binary;base64,"+T)){var n=(0,h.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new h.DataReader({readAsync:function(e,t){return w(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})},t.prototype.createPlugin=function(e){return new t(e[x])},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(y[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"),v.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"),h.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 h.RuntimeError("Unexpected magic: "+n,h.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||h.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);h.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){h.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){h.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(function(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,p.C6)(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,d,p,h,m,_,b,g,y,v,T,x,A,w,O,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!==(b=e.skipMaterials)&&void 0!==b?b:this.skipMaterials,this.targetFps=null!==(g=e.targetFps)&&void 0!==g?g:this.targetFps,this.transparencyAsCoverage=null!==(y=e.transparencyAsCoverage)&&void 0!==y?y: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!==(w=e.useSRGBBuffers)&&void 0!==w?w:this.useSRGBBuffers,this.validate=null!==(O=e.validate)&&void 0!==O?O:this.validate,this.dontUseTransmissionHelper=null!==(C=e.dontUseTransmissionHelper)&&void 0!==C?C:this.dontUseTransmissionHelper)},t}(O));(0,h.RegisterSceneLoaderPlugin)(new P);var R=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==R){for(var M in R.BABYLON=R.BABYLON||{},l)R.BABYLON[M]=l[M];for(var M in s)R.BABYLON[M]=s[M]}var E=a(698),L=new Map,F=L;function k(e,t,n){I(e)&&h.Logger.Warn("Extension with the name '".concat(e,"' already exists")),L.set(e,{isGLTFExtension:t,factory:n})}function I(e){return L.delete(e)}var S=new h.Lazy((function(){return Promise.resolve().then(a.t.bind(a,597,23))})),B=new h.Lazy((function(){return Promise.resolve().then(a.bind(a,727))})),N=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 G(e){if(e.min&&e.max){var t=e.min,n=e.max,r=h.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=h.TmpVectors.Vector3[1].copyFromFloats(n[0],n[1],n[2]);if(e.normalized&&5126!==e.componentType){var a=1;switch(e.componentType){case 5120:a=127;break;case 5121:a=255;break;case 5122:a=32767;break;case 5123:a=65535}var i=1/a;r.scaleInPlace(i),o.scaleInPlace(i)}return new h.BoundingInfo(r,o)}return null}var H=function(){function e(e){this._completePromises=new Array,this._assetContainer=null,this._babylonLights=[],this._disableInstancedMesh=0,this._allMaterialsDirtyRequired=!1,this._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){k(e,!1,t)},e.UnregisterExtension=function(e){return I(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,p.sH)(this,arguments,void 0,(function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),(0,p.YH)(this,(function(a){switch(a.label){case 0:return[4,Promise.resolve().then((function(){return(0,p.sH)(s,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,p.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,p.sH)(this,arguments,void 0,(function(e,t,n,r,o){return void 0===o&&(o=""),(0,p.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,p.sH)(this,void 0,void 0,(function(){var o=this;return(0,p.YH)(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return(0,p.sH)(o,void 0,void 0,(function(){var o,i,s,l,u,c,f,d,m,_,b,g,v,T,x=this;return(0,p.YH)(this,(function(p){switch(p.label){case 0:return this._rootUrl=e,this._uniqueRootUrl=!e.startsWith("file:")&&t?e:"".concat(e).concat(Date.now(),"/"),this._fileName=t,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:return p.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(o=this,v={},[4,Promise.resolve().then(a.t.bind(a,597,23))]):[3,4];case 2:return v.materialClass=p.sent().OpenPBRMaterial,[4,Promise.resolve().then(a.bind(a,833))];case 3:return o._pbrMaterialImpl=(v.adapterClass=p.sent().OpenPBRMaterialLoadingAdapter,v),[3,7];case 4:return i=this,T={},[4,Promise.resolve().then(a.t.bind(a,597,23))];case 5:return T.materialClass=p.sent().PBRMaterial,[4,Promise.resolve().then(a.bind(a,561))];case 6:i._pbrMaterialImpl=(T.adapterClass=p.sent().PBRMaterialLoadingAdapter,T),p.label=7;case 7:if(s="".concat(y[y.LOADING]," => ").concat(y[y.READY]),l="".concat(y[y.LOADING]," => ").concat(y[y.COMPLETE]),this._parent._startPerformanceCounter(s),this._parent._startPerformanceCounter(l),this._parent._setState(y.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=N.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)m=this._gltf.materials[d],_="/materials/"+d,b=h.Material.TriangleFillMode,u.push(this._loadMaterialAsync(_,m,null,b,(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(y.READY),x._skipStartAnimationStep||x._startAnimations(),r()})),[4,g.then((function(e){return x._parent._endPerformanceCounter(s),h.Tools.SetImmediate((function(){x._disposed||Promise.all(x._completePromises).then((function(){x._parent._endPerformanceCounter(l),x._parent._setState(y.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,p.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)&&h.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else h.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(N.Assign(this._gltf.accessors),N.Assign(this._gltf.animations),N.Assign(this._gltf.buffers),N.Assign(this._gltf.bufferViews),N.Assign(this._gltf.cameras),N.Assign(this._gltf.images),N.Assign(this._gltf.materials),N.Assign(this._gltf.meshes),N.Assign(this._gltf.nodes),N.Assign(this._gltf.samplers),N.Assign(this._gltf.scenes),N.Assign(this._gltf.skins),N.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,p.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a,i,s,l,u,c,f=this;return(0,p.YH)(this,(function(d){switch(d.label){case 0:return e=[],F.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)&&h.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!f.isExtensionUsed(n)||e.push((0,p.sH)(f,void 0,void 0,(function(){var e;return(0,p.YH)(this,(function(r){switch(r.label){case 0:return[4,t.factory(this)];case 1:return(e=r.sent()).name!==n&&h.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(n)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}}))})))})),n=(t=(u=this._extensions).push).apply,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 h.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=t,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var n={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case b.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case b.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=N.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 h.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 g.NONE:break;case g.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case g.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void h.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},e.prototype.loadNodeAsync=function(t,n,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=N.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=N.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 h.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=N.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,h.deepMerge)(r.metadata,e.metadata||{});var a=N.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=N.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=N.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&&N.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 h.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 m=new h.Mesh(n,this._babylonScene);if(m._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,m.sideOrientation=this._babylonScene.useRightHandedSystem?h.Material.CounterClockWiseSideOrientation:h.Material.ClockWiseSideOrientation,this._createMorphTargets(t,r,o,a,m),d.push(this._loadVertexDataAsync(t,a,m).then((function(e){return(0,p.sH)(s,void 0,void 0,(function(){var n=this;return(0,p.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(t,a,m,e).then((function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,e.applyToMesh(m),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 b=this._defaultBabylonMaterialData[_];b||(b=this._createDefaultMaterial("__GLTFLoader._default",_),this._parent.onMaterialLoadedObservable.notifyObservers(b),this._defaultBabylonMaterialData[_]=b),m.material=b}else{var g=N.Get("".concat(t,"/material"),this._gltf.materials,a.material);d.push(this._loadMaterialAsync("/materials/".concat(g.index),g,m,_,(function(e){m.material=e})))}}c=Promise.all(d),f&&(a._instanceData={babylonSourceMesh:m,promise:c}),u=m}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 h.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=N.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=N.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()===h.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=G(u);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,u.count)}))),o==h.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(u)}};return u("POSITION",h.VertexBuffer.PositionKind),u("NORMAL",h.VertexBuffer.NormalKind),u("TANGENT",h.VertexBuffer.TangentKind),u("TEXCOORD_0",h.VertexBuffer.UVKind),u("TEXCOORD_1",h.VertexBuffer.UV2Kind),u("TEXCOORD_2",h.VertexBuffer.UV3Kind),u("TEXCOORD_3",h.VertexBuffer.UV4Kind),u("TEXCOORD_4",h.VertexBuffer.UV5Kind),u("TEXCOORD_5",h.VertexBuffer.UV6Kind),u("JOINTS_0",h.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",h.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",h.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",h.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",h.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(n.hasVertexAlpha=!0)})),Promise.all(i).then((function(){return s}))},e.prototype._createMorphTargets=function(e,t,n,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 h.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 h.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,p.sH)(this,void 0,void 0,(function(){var o,a,i=this;return(0,p.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=N.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",h.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",h.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",h.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",h.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",h.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",h.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=h.Vector3.Zero(),r=h.Quaternion.Identity(),o=h.Vector3.One();e.matrix?h.Matrix.FromArray(e.matrix).decompose(o,r,n):(e.translation&&(n=h.Vector3.FromArray(e.translation)),e.rotation&&(r=h.Quaternion.FromArray(e.rotation)),e.scale&&(o=h.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 h.Skeleton(n.name||i,i,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,n,s);var l=this._loadSkinInverseBindMatricesDataAsync(e,n).then((function(e){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=N.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)||(h.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index)}else h.Logger.Warn("".concat(e,": Failed to find common root"))}for(var a={},i=0,s=t.joints;i<s.length;i++){var l=s[i],u=N.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=N.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&&h.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return o=new h.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=N.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=h.Matrix.Identity(),i=o._index;t&&-1!==i&&(h.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?h.Matrix.FromArray(e.matrix):h.Matrix.Compose(e.scale?h.Vector3.FromArray(e.scale):h.Vector3.One(),e.rotation?h.Quaternion.FromArray(e.rotation):h.Quaternion.Identity(),e.translation?h.Vector3.FromArray(e.translation):h.Vector3.Zero())},e.prototype.loadCameraAsync=function(t,n,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 h.FreeCamera(n.name||"camera".concat(n.index),h.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._babylonCamera=i,i.setTarget(new h.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=h.Camera.ORTHOGRAPHIC_CAMERA,i.orthoLeft=-n.orthographic.xmag,i.orthoRight=n.orthographic.xmag,i.orthoBottom=-n.orthographic.ymag,i.orthoTop=n.orthographic.ymag,i.minZ=n.orthographic.znear,i.maxZ=n.orthographic.zfar;break;default:throw new Error("".concat(t,": Invalid camera type (").concat(n.type,")"))}return e.AddPointerMetadata(i,t),this._parent.onCameraLoadedObservable.notifyObservers(i),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)||S.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;N.Assign(t.channels),N.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=N.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?B.value.then((function(){var i,u,c,f,d;switch(l){case"translation":d=null===(i=(0,E.tQ)("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":d=null===(u=(0,E.tQ)("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":d=null===(c=(0,E.tQ)("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":d=null===(f=(0,E.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=N.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 b=0;b<p.length;b++){var g=f.getValue(l,h,_,1);_+=d,m[b]={frame:p[b]*i,value:g,interpolation:1}}break;case"CUBICSPLINE":for(b=0;b<p.length;b++){var y=f.getValue(l,h,_,s);_+=d,g=f.getValue(l,h,_,1),_+=d;var v=f.getValue(l,h,_,s);_+=d,m[b]={frame:p[b]*i,inTangent:y,value:g,outTangent:v}}break;case"LINEAR":for(b=0;b<p.length;b++)g=f.getValue(l,h,_,1),_+=d,m[b]={frame:p[b]*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 w=A[x];t++,a(w.babylonAnimatable,w.babylonAnimation)}}}))},e.prototype._loadAnimationSamplerAsync=function(e,t){if(t._data)return t._data;var n=t.interpolation||"LINEAR";switch(n){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error("".concat(e,"/interpolation: Invalid value (").concat(t.interpolation,")"))}var r=N.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=N.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=N.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*h.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new r(s));else{var l=N.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 h.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=N.Get("".concat(t,"/sparse/indices/bufferView"),o._gltf.bufferViews,u.indices.bufferView),f=N.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 m=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,p);s=new r(p),h.VertexBuffer.ForEach(m,0,i,a,n.componentType,s.length,n.normalized||!1,(function(e,t){s[t]=e}))}else s=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,p);for(var _=0,b=0;b<d.length;b++)for(var g=d[b]*a,y=0;y<a;y++)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=N.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 h.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 h.VertexBuffer(a,e,r,!1)}));else{var i=N.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 h.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=h.Color3.FromArray(t.baseColorFactor),o.geometryOpacity=t.baseColorFactor[3]):o.baseColor=h.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?h.Color3.FromArray(t.emissiveFactor):new h.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=N.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:N.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=N.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 h.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,h.GetMimeType)(null!==(s=n.uri)&&void 0!==s?s:""),loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},p=new h.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=N.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,h.IsBase64DataUrl)(r)){var i=new Uint8Array((0,h.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 h.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 h.Texture.CLAMP_ADDRESSMODE;case 33648:return h.Texture.MIRROR_ADDRESSMODE;case 10497:return h.Texture.WRAP_ADDRESSMODE;default:return h.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),h.Texture.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var n=null==t.magFilter?9729:t.magFilter,r=null==t.minFilter?9987:t.minFilter;if(9729===n)switch(r){case 9728:return h.Texture.LINEAR_NEAREST;case 9729:return h.Texture.LINEAR_LINEAR;case 9984:return h.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return h.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return h.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return h.Texture.LINEAR_LINEAR_MIPLINEAR;default:return h.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),h.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&h.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),r){case 9728:return h.Texture.NEAREST_NEAREST;case 9729:return h.Texture.NEAREST_LINEAR;case 9984:return h.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return h.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return h.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return h.Texture.NEAREST_LINEAR_MIPLINEAR;default:return h.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),h.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,h.GetTypedArrayConstructor)(t)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}},e._GetTypedArray=function(t,n,r,o,a){var i=r.buffer;o=r.byteOffset+(o||0);var s=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n),l=h.VertexBuffer.GetTypeByteLength(n);return o%l!==0?(h.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 h.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return h.Material.PointListDrawMode;case 1:return h.Material.LineListDrawMode;case 2:return h.Material.LineLoopDrawMode;case 3:return h.Material.LineStripDrawMode;case 4:return h.Material.TriangleFillMode;case 5:return h.Material.TriangleStripDrawMode;case 6:return h.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(t,")"))},e.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var n=0,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}();P._CreateGLTF2Loader=function(e){return new H(e)};var V="EXT_lights_image_based",D=function(){function e(e){this.name=V,this._loader=e,this.enabled=this._loader.isExtensionUsed(V)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights}},e.prototype.loadSceneAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,p.sH)(n,void 0,void 0,(function(){var n,a,i=this;return(0,p.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=N.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=N.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,p.sH)(n,void 0,void 0,(function(){var n,r,a,i,s;return(0,p.YH)(this,(function(l){switch(l.label){case 0:if((n=new h.RawCubeTexture(this._loader.babylonScene,null,t.specularImageSize)).name=t.name||"environment",t._babylonTexture=n,null!=t.intensity&&(n.level=t.intensity),t.rotation&&(r=h.Quaternion.FromArray(t.rotation),this._loader.babylonScene.useRightHandedSystem||(r=h.Quaternion.Inverse(r)),h.Matrix.FromQuaternionToRef(r,n.getReflectionTextureMatrix())),!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(a=h.SphericalHarmonics.FromArray(t.irradianceCoefficients)).scaleInPlace(t.intensity),a.convertIrradianceToLambertianRadiance(),i=h.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}();I(V),k(V,!0,(function(e){return new D(e)}));var K="EXT_mesh_gpu_instancing",U=function(){function e(e){this.name=K,this._loader=e,this.enabled=this._loader.isExtensionUsed(K)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,p.sH)(r,void 0,void 0,(function(){var r,a,i,s,l=this;return(0,p.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=N.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,p.sH)(l,void 0,void 0,(function(){var n,r,o,s,l,u,c,f,d,m;return(0,p.YH)(this,(function(p){switch(p.label){case 0:return[4,Promise.all(a)];case 1:for(n=p.sent(),r=n[0],o=n[1],s=n[2],l=n[3],u=new Float32Array(16*i),h.TmpVectors.Vector3[0].copyFromFloats(0,0,0),h.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),h.TmpVectors.Vector3[1].copyFromFloats(1,1,1),c=0;c<i;++c)r&&h.Vector3.FromArrayToRef(r,3*c,h.TmpVectors.Vector3[0]),o&&h.Quaternion.FromArrayToRef(o,4*c,h.TmpVectors.Quaternion[0]),s&&h.Vector3.FromArrayToRef(s,3*c,h.TmpVectors.Vector3[1]),h.Matrix.ComposeToRef(h.TmpVectors.Vector3[1],h.TmpVectors.Quaternion[0],h.TmpVectors.Vector3[0],h.TmpVectors.Matrix[0]),h.TmpVectors.Matrix[0].copyToArray(u,16*c);for(f=0,d=t._primitiveBabylonMeshes;f<d.length;f++)(m=d[f]).thinInstanceSetBuffer("matrix",u,16,!0),l&&(l.length===3*i?m.thinInstanceSetBuffer("color",l,3,!0):l.length===4*i?m.thinInstanceSetBuffer("color",l,4,!0):h.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+m.name));return[2,e]}}))}))}))]}}))}))}))},e}();I(K),k(K,!0,(function(e){return new U(e)}));var j="EXT_meshopt_compression",z=function(){function e(e){this.name=j,this.enabled=e.isExtensionUsed(j),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,p.sH)(n,void 0,void 0,(function(){var n,r,a=this;return(0,p.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=N.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,p.sH)(a,void 0,void 0,(function(){return(0,p.YH)(this,(function(t){switch(t.label){case 0:return[4,h.MeshoptCompression.Default.decodeGltfBufferAsync(e,o.count,o.byteStride,o.mode,o.filter)];case 1:return[2,t.sent()]}}))}))})),[4,n._meshOptData]}}))}))}))},e}();I(j),k(j,!0,(function(e){return new z(e)}));var W="EXT_texture_webp",Z=function(){function e(e){this.name=W,this._loader=e,this.enabled=e.isExtensionUsed(W)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r,i;return(0,p.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?H.DefaultSampler:N.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=N.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}();I(W),k(W,!0,(function(e){return new Z(e)}));var Y="EXT_texture_avif",q=function(){function e(e){this.name=Y,this._loader=e,this.enabled=e.isExtensionUsed(Y)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r,i;return(0,p.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?H.DefaultSampler:N.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=N.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}();I(Y),k(Y,!0,(function(e){return new q(e)}));var X="EXT_lights_ies",Q=function(){function e(e){this.name=X,this._loader=e,this.enabled=this._loader.isExtensionUsed(X)}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,N.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r,i,s,l,u,c=this;return(0,p.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=N.Get(o,c._lights,a.light)).name||e.name;c._loader.babylonScene._blockEntityCollection=!!c._loader._assetContainer,(r=new h.SpotLight(t,h.Vector3.Zero(),h.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=h.Light.FALLOFF_GLTF,r.diffuse=a.color?h.Color3.FromArray(a.color):h.Color3.White(),r.intensity=a.multiplier||1,r.range=Number.MAX_VALUE,r.parent=e,c._loader._babylonLights.push(r),H.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=N.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 h.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,l,!0,void 0,void 0,void 0,void 0,".ies"),[2,s]}}))}))}))},e}();I(X),k(X,!0,(function(e){return new Q(e)}));var J="KHR_draco_mesh_compression",$=function(){function e(e){this.name=J,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=h.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(J)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r,i,s,l,u=this;return(0,p.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=N.TryGet(u._loader.gltf.accessors,t.attributes[e]);l&&(i[o]=l.normalized||!1)}})("POSITION",h.VertexBuffer.PositionKind),s("NORMAL",h.VertexBuffer.NormalKind),s("TANGENT",h.VertexBuffer.TangentKind),s("TEXCOORD_0",h.VertexBuffer.UVKind),s("TEXCOORD_1",h.VertexBuffer.UV2Kind),s("TEXCOORD_2",h.VertexBuffer.UV3Kind),s("TEXCOORD_3",h.VertexBuffer.UV4Kind),s("TEXCOORD_4",h.VertexBuffer.UV5Kind),s("TEXCOORD_5",h.VertexBuffer.UV6Kind),s("JOINTS_0",h.VertexBuffer.MatricesIndicesKind),s("WEIGHTS_0",h.VertexBuffer.MatricesWeightsKind),s("COLOR_0",h.VertexBuffer.ColorKind),(l=N.Get(o,this._loader.gltf.bufferViews,a.bufferView))._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){return(0,p.sH)(u,void 0,void 0,(function(){var a,s,l;return(0,p.YH)(this,(function(u){switch(u.label){case 0:return a=this.dracoDecoder||h.DracoDecoder.Default,s=N.TryGet(this._loader.gltf.accessors,t.attributes.POSITION),l=this._loader.parent.alwaysComputeBoundingBox||n.skeleton||!s?null:G(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}();I(J),k(J,!0,(function(e){return new $(e)}));var ee="KHR_lights_punctual",te=function(){function e(e){this.name=ee,this._loader=e,this.enabled=this._loader.isExtensionUsed(ee)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,N.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r=this;return(0,p.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=N.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 h.DirectionalLight(s,h.Vector3.Backward(),r._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new h.PointLight(s,h.Vector3.Zero(),r._loader.babylonScene);break;case"spot":var u=new h.SpotLight(s,h.Vector3.Zero(),h.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=h.Light.FALLOFF_GLTF,t.diffuse=i.color?h.Color3.FromArray(i.color):h.Color3.White(),t.intensity=null==i.intensity?1:i.intensity,t.range=null==i.range?Number.MAX_VALUE:i.range,t.parent=e,r._loader._babylonLights.push(t),H.AddPointerMetadata(t,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();I(ee),k(ee,!0,(function(e){return new te(e)}));var ne="EXT_lights_area",re=function(){function e(e){this.name=ne,this._loader=e,this.enabled=this._loader.isExtensionUsed(ne)}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,N.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r=this;return(0,p.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=N.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 h.RectAreaLight(l,h.Vector3.Zero(),c,f,r._loader.babylonScene);break;case"disk":var d=Math.sqrt(u*u*.25*Math.PI);i=new h.RectAreaLight(l,h.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=h.Light.FALLOFF_GLTF,i.diffuse=s.color?h.Color3.FromArray(s.color):h.Color3.White(),i.intensity=null==s.intensity?1:s.intensity;var p=new h.TransformNode("".concat(l,"_orientation"),r._loader.babylonScene);p.rotationQuaternion=h.Quaternion.RotationAxis(h.Vector3.Up(),Math.PI),p.parent=e,i.parent=p,r._loader._babylonLights.push(i),H.AddPointerMetadata(i,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();I(ne),k(ne,!0,(function(e){return new re(e)}));var oe="KHR_materials_pbrSpecularGlossiness",ae=function(){function e(e){this.name=oe,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(oe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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 h.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=h.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=h.Color3.White(),n.reflectivityColor=t.specularFactor?h.Color3.FromArray(t.specularFactor):h.Color3.White(),n.microSurface=null==t.glossinessFactor?1:t.glossinessFactor,t.diffuseTexture&&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}();I(oe),k(oe,!0,(function(e){return new ae(e)}));var ie="KHR_materials_unlit",se=function(){function e(e){this.name=ie,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(ie)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(){return(0,p.sH)(r,void 0,void 0,(function(){return(0,p.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=h.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}();I(ie),k(ie,!0,(function(e){return new se(e)}));var le="KHR_materials_clearcoat",ue=function(){function e(e){this.name=le,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(le)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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}();I(le),k(le,!0,(function(e){return new ue(e)}));var ce="KHR_materials_coat",fe=function(){function e(e){this.name=ce,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(ce)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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=h.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}();I(ce),k(ce,!0,(function(e){return new fe(e)}));var de="KHR_materials_iridescence",pe=function(){function e(e){this.name=de,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(de)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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}();I(de),k(de,!0,(function(e){return new pe(e)}));var he="KHR_materials_anisotropy",me=function(){function e(e){this.name=he,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(he)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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,p.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c;return(0,p.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}();I(he),k(he,!0,(function(e){return new me(e)}));var _e="KHR_materials_emissive_strength",be=function(){function e(e){this.name=_e,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(_e)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){return(0,p.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}();I(_e),k(_e,!0,(function(e){return new be(e)}));var ge="KHR_materials_sheen",ye=function(){function e(e){this.name=ge,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ge)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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?h.Color3.FromArray(t.sheenColorFactor):h.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}();I(ge),k(ge,!0,(function(e){return new ye(e)}));var ve="KHR_materials_fuzz",Te=function(){function e(e){this.name=ve,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ve)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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?h.Color3.FromArray(t.fuzzColorFactor):h.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}();I(ve),k(ve,!0,(function(e){return new Te(e)}));var xe="KHR_materials_specular",Ae=function(){function e(e){this.name=xe,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(xe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r,i;return(0,p.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?h.Color3.FromArray(t.specularColorFactor):new h.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}();I(xe),k(xe,!0,(function(e){return new Ae(e)}));var we="KHR_materials_ior",Oe=function(){function e(e){this.name=we,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(we)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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}();I(we),k(we,!0,(function(e){return new Oe(e)}));var Ce="KHR_materials_variants",Pe=function(){function e(e){this.name=Ce,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ce)&&!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(Ce," 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(Ce," 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(Ce," 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[Ce])||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[Ce];(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 H.LoadExtensionAsync(t,a,this.name,(function(l,u){return(0,p.sH)(s,void 0,void 0,(function(){var s,c=this;return(0,p.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 h.Mesh){var r=H._GetDrawMode(t,a.mode),o=c._loader.rootBabylonMesh,f=o?o._internalMetadata=o._internalMetadata||{}:{},d=f.gltf=f.gltf||{},p=d[Ce]=d[Ce]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:n,material:n.material});for(var m=function(t){var a=u.mappings[t],i=N.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=N.Get("/extensions/".concat(Ce,"/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[Ce]={lastSelected:null,original:[],variants:{}};for(var u=0,c=a.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[Ce].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[Ce].variants[l]=[];for(var d=0,p=a.variants[l];d<p.length;d++){var h=p[d];i._internalMetadata.gltf[Ce].variants[l].push({mesh:h.mesh,material:h.material})}}a=i._internalMetadata.gltf[Ce]}for(var m=0,_=a.original;m<_.length;m++)(y=_[m]).mesh===n&&(y.mesh=r);for(var b=0,g=a.variants[s.name];b<g.length;b++){var y;(y=g[b]).mesh===n&&(y.mesh=r)}}))},i=0;i<a.variants.length;++i)r(i)})))},_=0;_<u.mappings.length;++_)m(_)}}))),[4,Promise.all(s).then((function(e){return e[0]}))];case 1:return[2,f.sent()]}}))}))}))},e}();I(Ce),k(Ce,!0,(function(e){return new Pe(e)}));var Re=function(){function e(t,n){var r=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,p.Cl)((0,p.Cl)({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this.onErrorObservable=new h.Observable,this._scene.onDisposeObservable.addOnce((function(){r.dispose()})),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:h.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},e.prototype.updateOptions=function(e){var t=this,n=Object.keys(e).filter((function(n){return t._options[n]!==e[n]}));if(n.length){var r=(0,p.Cl)((0,p.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)),h.Tools.SetImmediate((function(){t._shouldRenderAsTransmission(e.material)?(e.material.refractionTexture=t._opaqueRenderTarget,-1===t._transparentMeshesCache.indexOf(e)&&t._transparentMeshesCache.push(e)):-1===t._opaqueMeshesCache.indexOf(e)&&t._opaqueMeshesCache.push(e)}))},e.prototype._removeMesh=function(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];var t=this._transparentMeshesCache.indexOf(e);-1!==t&&this._transparentMeshesCache.splice(t,1),-1!==(t=this._opaqueMeshesCache.indexOf(e))&&this._opaqueMeshesCache.splice(t,1)},e.prototype._parseScene=function(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))},e.prototype._onMeshMaterialChanged=function(e){var t=this._transparentMeshesCache.indexOf(e),n=this._opaqueMeshesCache.indexOf(e);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 h.RenderTargetTexture("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=null!==(t=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==t?t:this._scene.clearColor.clone(),this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.renderSprites=!0,this._opaqueRenderTarget.renderParticles=!0,this._opaqueRenderTarget.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}(),Me="KHR_materials_transmission",Ee=function(){function e(e){this.name=Me,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(Me),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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 Re({},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}();I(Me),k(Me,!0,(function(e){return new Ee(e)}));var Le="KHR_materials_diffuse_transmission",Fe=function(){function e(e){this.name=Le,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Le),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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?h.Color3.FromArray(r.diffuseTransmissionColorFactor):h.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}();I(Le),k(Le,!0,(function(e){return new Fe(e)}));var ke="KHR_materials_volume",Ie=function(){function e(e){this.name=ke,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(ke),this.enabled&&this._loader._disableInstancedMesh++}return e.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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?h.Color3.FromArray(r.attenuationColor):h.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}();I(ke),k(ke,!0,(function(e){return new Ie(e)}));var Se="KHR_materials_dispersion",Be=function(){function e(e){this.name=Se,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Se)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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}();I(Se),k(Se,!0,(function(e){return new Be(e)}));var Ne="KHR_materials_diffuse_roughness",Ge=function(){function e(e){this.name=Ne,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ne)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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}();I(Ne),k(Ne,!0,(function(e){return new Ge(e)}));var He="KHR_mesh_quantization",Ve=function(){function e(e){this.name=He,this.enabled=e.isExtensionUsed(He)}return e.prototype.dispose=function(){},e}();I(He),k(He,!0,(function(e){return new Ve(e)}));var De="KHR_texture_basisu",Ke=function(){function e(e){this.name=De,this._loader=e,this.enabled=e.isExtensionUsed(De)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r,i;return(0,p.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?H.DefaultSampler:N.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=N.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}();I(De),k(De,!0,(function(e){return new Ke(e)}));var Ue="KHR_texture_transform",je=function(){function e(e){this.name=Ue,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ue)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){return(0,p.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof h.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}();I(Ue),k(Ue,!0,(function(e){return new je(e)}));var ze="KHR_xmp_json_ld",We=function(){function e(e){this.name=ze,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(ze)}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}();I(ze),k(ze,!0,(function(e){return new We(e)}));var Ze=a(727);function Ye(e,t,n,r){return h.Color3.FromArray(t,n).scale(r)}function qe(e,t,n,r){return t[n]*r}function Xe(e,t,n,r){return-t[n]*r}function Qe(e,t,n,r){return t[n+1]*r}function Je(e,t,n,r){return t[n]*r*2}function $e(e){return{scale:[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),qe,(function(){return 2})),new tt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),Qe,(function(){return 2}))],offset:[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),qe,(function(){return 2})),new tt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),Qe,(function(){return 2}))],rotation:[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),Xe,(function(){return 1}))]}}var et=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,p.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ze.AnimationPropertyInfo),tt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,p.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,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}(Ze.AnimationPropertyInfo),nt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,p.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ze.AnimationPropertyInfo),rt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,p.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){var o=this;return e._primitiveBabylonMeshes?e._primitiveBabylonMeshes.map((function(e){return{babylonAnimatable:e,babylonAnimation:o._buildAnimation(t,n,r)}})):[]},t}(Ze.AnimationPropertyInfo);(0,E.ZU)("/cameras/{}/orthographic/xmag",[new et(h.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",Xe,(function(){return 1})),new et(h.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",Qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/orthographic/ymag",[new et(h.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",Xe,(function(){return 1})),new et(h.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",Qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/orthographic/zfar",[new et(h.Animation.ANIMATIONTYPE_FLOAT,"maxZ",qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/orthographic/znear",[new et(h.Animation.ANIMATIONTYPE_FLOAT,"minZ",qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/perspective/yfov",[new et(h.Animation.ANIMATIONTYPE_FLOAT,"fov",qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/perspective/zfar",[new et(h.Animation.ANIMATIONTYPE_FLOAT,"maxZ",qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/perspective/znear",[new et(h.Animation.ANIMATIONTYPE_FLOAT,"minZ",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new tt(h.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",Ye,(function(){return 4})),new tt(h.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,r){return t[n+3]*r}),(function(){return 4}))]),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"metallic",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"roughness",qe,(function(){return 1}))]);var ot=$e("albedoTexture");(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",ot.scale),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",ot.offset),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",ot.rotation);var at=$e("metallicTexture");(0,E.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",at.scale),(0,E.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",at.offset),(0,E.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",at.rotation),(0,E.ZU)("/materials/{}/emissiveFactor",[new tt(h.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",Ye,(function(){return 3}))]);var it=$e("bumpTexture");(0,E.ZU)("/materials/{}/normalTexture/scale",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",it.scale),(0,E.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",it.offset),(0,E.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",it.rotation),(0,E.ZU)("/materials/{}/occlusionTexture/strength",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",qe,(function(){return 1}))]);var st=$e("ambientTexture");(0,E.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",st.scale),(0,E.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",st.offset),(0,E.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",st.rotation);var lt=$e("emissiveTexture");(0,E.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",lt.scale),(0,E.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",lt.offset),(0,E.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",lt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",qe,(function(){return 1}))]);var ut=$e("anisotropy.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",ut.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",ut.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",ut.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",qe,(function(){return 1}))]);var ct=$e("clearCoat.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",ct.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",ct.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",ct.rotation);var ft=$e("clearCoat.bumpTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",ft.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",ft.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",ft.rotation);var dt=$e("clearCoat.textureRoughness");(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",dt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",dt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",dt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_ior/ior",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",qe,(function(){return 1}))]);var pt=$e("iridescence.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",pt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",pt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",pt.rotation);var ht=$e("iridescence.thicknessTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",ht.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",ht.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",ht.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new tt(h.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",Ye,(function(){return 3}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",qe,(function(){return 1}))]);var mt=$e("sheen.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",mt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",mt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",mt.rotation);var _t=$e("sheen.textureRoughness");(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",_t.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",_t.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",_t.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new tt(h.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Ye,(function(){return 3}))]);var bt=$e("metallicReflectanceTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",bt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",bt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",bt.rotation);var gt=$e("reflectanceTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",gt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",gt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",gt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",qe,(function(){return 1}))]);var yt=$e("subSurface.refractionIntensityTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",yt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",yt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",yt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new tt(h.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Ye,(function(){return 3}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",qe,(function(){return 1}))]);var vt=$e("subSurface.thicknessTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",vt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",vt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",vt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new tt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",qe,(function(){return 1}))]);var Tt=$e("subSurface.translucencyIntensityTexture");(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",Tt.scale),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",Tt.offset),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",Tt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new tt(h.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",Ye,(function(){return 3}))]);var xt=$e("subSurface.translucencyColorTexture");(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",xt.scale),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",xt.offset),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",xt.rotation),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/color",[new nt(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Ye,(function(){return 3}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",qe,(function(){return 1}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/range",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"range",qe,(function(){return 1}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",Je,(function(){return 1}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"angle",Je,(function(){return 1}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/color",[new nt(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Ye,(function(){return 3}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/intensity",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",qe,(function(){return 1}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/size",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"radius",qe,(function(){return 1}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"radius",qe,(function(){return 1}))]),(0,E.ZU)("/nodes/{}/extensions/EXT_lights_ies/color",[new nt(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Ye,(function(){return 3}))]),(0,E.ZU)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",qe,(function(){return 1}))]),(0,E.ZU)("/nodes/{}/extensions/KHR_node_visibility/visible",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"isVisible",qe,(function(){return 1}))]);var At="KHR_animation_pointer",wt=function(){function e(e){this.name=At,this._loader=e,this._pathToObjectConverter=(0,E.Wt)(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(At)},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&&h.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&&h.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 h.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();I(At),k(At,!0,(function(e){return new wt(e)}));var Ot="MSFT_audio_emitter",Ct=function(){function e(e){this.name=Ot,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ot)}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,N.Assign(this._clips),N.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,p.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,p.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=N.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 H.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,p.sH)(r,void 0,void 0,(function(){var r,a,i=this;return(0,p.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=N.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(h.Vector3.Forward()),r.setDirectionalCone(2*h.Tools.ToDegrees(null==o.innerAngle?Math.PI:o.innerAngle),2*h.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 H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,p.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,p.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,N.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=N.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=N.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 h.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 h.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*h.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*h.Tools.ToDegrees(t.outerAngle)),t.volume&&(n.volume=t.volume),t._babylonData.sound=n}));t._babylonData={loaded:u}}return t._babylonData.loaded},e.prototype._getEventAction=function(e,t,n,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=N.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,s);return this._loadEmitterAsync(e,l).then((function(){var t=l._babylonData.sound;if(t){var n=new h.AnimationEvent(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}();I(Ot),k(Ot,!0,(function(e){return new Ct(e)}));var Pt="MSFT_lod",Rt=function(){function e(e){var t,n;this.name=Pt,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new h.Observable,this.onMaterialLODsLoadedObservable=new h.Observable,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.maxLODsToLoad=null!==(n=null===(t=this._loader.parent.extensionOptions[Pt])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(Pt)}return e.prototype.dispose=function(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()},e.prototype.onReady=function(){for(var e=this,t=function(t){var r=Promise.all(n._nodePromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Node LOD ".concat(t)),e._loader.log("Loaded node LOD ".concat(t))),e.onNodeLODsLoadedObservable.notifyObservers(t),t!==e._nodePromiseLODs.length-1&&(e._loader.startPerformanceCounter("Node LOD ".concat(t+1)),e._loadBufferLOD(e._nodeBufferLODs,t+1),e._nodeSignalLODs[t]&&e._nodeSignalLODs[t].resolve())}));n._loader._completePromises.push(r)},n=this,r=0;r<this._nodePromiseLODs.length;r++)t(r);var o=function(t){var n=Promise.all(a._materialPromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Material LOD ".concat(t)),e._loader.log("Loaded material LOD ".concat(t))),e.onMaterialLODsLoadedObservable.notifyObservers(t),t!==e._materialPromiseLODs.length-1&&(e._loader.startPerformanceCounter("Material LOD ".concat(t+1)),e._loadBufferLOD(e._materialBufferLODs,t+1),e._materialSignalLODs[t]&&e._materialSignalLODs[t].resolve())}));a._loader._completePromises.push(n)},a=this;for(r=0;r<this._materialPromiseLODs.length;r++)o(r)},e.prototype.loadSceneAsync=function(e,t){var n=this._loader.loadSceneAsync(e,t);return this._loadBufferLOD(this._bufferLODs,0),n},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,p.sH)(r,void 0,void 0,(function(){var r,a,i,s,l,u=this;return(0,p.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 h.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:H.LoadExtensionAsync(e,t,this.name,(function(e,i){return(0,p.sH)(a,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,p.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 h.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return(0,p.sH)(r,void 0,void 0,(function(){return(0,p.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 h.Deferred,this._materialSignalLODs[o].promise.then((function(){return(0,p.sH)(r,void 0,void 0,(function(){return(0,p.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,p.sH)(o,void 0,void 0,(function(){var o,a,i;return(0,p.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 h.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(N.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}();I(Pt),k(Pt,!0,(function(e){return new Rt(e)}));var Mt="MSFT_minecraftMesh",Et=function(){function e(e){this.name=Mt,this._loader=e,this.enabled=this._loader.isExtensionUsed(Mt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r;return(0,p.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}();I(Mt),k(Mt,!0,(function(e){return new Et(e)}));var Lt="MSFT_sRGBFactors",Ft=function(){function e(e){this.name=Lt,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 H.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,p.sH)(r,void 0,void 0,(function(){var r,o,i;return(0,p.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 kt(e){var t=e.split(":");return It({op:t[0],extension:t[1]})}function It(e,t){var n;void 0===t&&(t=!0);var r=e.extension?null===(n=Bt[e.extension])||void 0===n?void 0:n[e.op]:Nt[e.op];if(!r&&(h.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 St(e,t,n){Bt[t]||(Bt[t]={}),Bt[t][e]=n}I(Lt),k(Lt,!0,(function(e){return new Ft(e)}));var Bt={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},Nt={"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 h.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 h.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?(h.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}:(h.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":Gt("FlowGraphEBlock"),"math/Pi":Gt("FlowGraphPIBlock"),"math/Inf":Gt("FlowGraphInfBlock"),"math/NaN":Gt("FlowGraphNaNBlock"),"math/abs":Gt("FlowGraphAbsBlock"),"math/sign":Gt("FlowGraphSignBlock"),"math/trunc":Gt("FlowGraphTruncBlock"),"math/floor":Gt("FlowGraphFloorBlock"),"math/ceil":Gt("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":Gt("FlowGraphFractBlock"),"math/neg":Gt("FlowGraphNegationBlock"),"math/add":Gt("FlowGraphAddBlock",["a","b"],!0),"math/sub":Gt("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?Ht(e):{valid:!0}}},"math/div":Gt("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Gt("FlowGraphModuloBlock",["a","b"]),"math/min":Gt("FlowGraphMinBlock",["a","b"]),"math/max":Gt("FlowGraphMaxBlock",["a","b"]),"math/clamp":Gt("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Gt("FlowGraphSaturateBlock"),"math/mix":Gt("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Gt("FlowGraphEqualityBlock",["a","b"]),"math/lt":Gt("FlowGraphLessThanBlock",["a","b"]),"math/le":Gt("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Gt("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Gt("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":Gt("FlowGraphIsNaNBlock"),"math/isInf":Gt("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":Gt("FlowGraphSinBlock"),"math/cos":Gt("FlowGraphCosBlock"),"math/tan":Gt("FlowGraphTanBlock"),"math/asin":Gt("FlowGraphASinBlock"),"math/acos":Gt("FlowGraphACosBlock"),"math/atan":Gt("FlowGraphATanBlock"),"math/atan2":Gt("FlowGraphATan2Block",["a","b"]),"math/sinh":Gt("FlowGraphSinhBlock"),"math/cosh":Gt("FlowGraphCoshBlock"),"math/tanh":Gt("FlowGraphTanhBlock"),"math/asinh":Gt("FlowGraphASinhBlock"),"math/acosh":Gt("FlowGraphACoshBlock"),"math/atanh":Gt("FlowGraphATanhBlock"),"math/exp":Gt("FlowGraphExponentialBlock"),"math/log":Gt("FlowGraphLogBlock"),"math/log2":Gt("FlowGraphLog2Block"),"math/log10":Gt("FlowGraphLog10Block"),"math/sqrt":Gt("FlowGraphSquareRootBlock"),"math/cbrt":Gt("FlowGraphCubeRootBlock"),"math/pow":Gt("FlowGraphPowerBlock",["a","b"]),"math/length":Gt("FlowGraphLengthBlock"),"math/normalize":Gt("FlowGraphNormalizeBlock"),"math/dot":Gt("FlowGraphDotBlock",["a","b"]),"math/cross":Gt("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":Gt("FlowGraphTransposeBlock"),"math/determinant":Gt("FlowGraphDeterminantBlock"),"math/inverse":Gt("FlowGraphInvertMatrixBlock"),"math/matMul":Gt("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":Gt("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":Gt("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":Gt("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":Gt("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":Gt("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Gt("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Gt("FlowGraphLeadingZerosBlock"),"math/ctz":Gt("FlowGraphTrailingZerosBlock"),"math/popcnt":Gt("FlowGraphOneBitsCounterBlock"),"math/rad":Gt("FlowGraphDegToRadBlock"),"math/deg":Gt("FlowGraphRadToDegBlock"),"type/boolToInt":Gt("FlowGraphBooleanToInt"),"type/boolToFloat":Gt("FlowGraphBooleanToFloat"),"type/intToBool":Gt("FlowGraphIntToBoolean"),"type/intToFloat":Gt("FlowGraphIntToFloat"),"type/floatToInt":Gt("FlowGraphFloatToInt"),"type/floatToBool":Gt("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 h.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}:(h.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 h.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,h.getAnimationTypeByFlowGraphType)(p.type));var m=o[4];return m.config||(m.config={}),(c=m.config).variable||(c.variable={}),m.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 h.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 Gt(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?Ht(e):{valid:!0}}}}function Ht(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 Vt(){return Object.keys(Nt)}var Dt={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"}},Kt=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(Dt[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=It(n);if(!r)throw h.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 h.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==n.length)throw h.Logger.Error(["Invalid value length for variable",e,n]),new Error("Error parsing variables");var 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 h.Logger.Error(["No value found for event key",n]),new Error("Error parsing events");var a=e._types[o.type];if(!a)throw h.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 h.Logger.Error(["No declaration found for node",r]),new Error("Error parsing nodes");var o=this._mappings[r.declaration];if(!o)throw h.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,h.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&&h.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,m,_,b,g,y,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 h.Logger.Error(["No node found for interactivity node",this._nodes[T]]),new Error("Error parsing node connections");var A=this._nodes[T],w=this._mappings[x.declaration];if(!w)throw h.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var O=x.flows||{},C=Object.keys(O).sort(),P=function(e){var t=O[e],u=null===(r=null===(n=w.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=R._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=R._nodes[d];if(!p)throw h.Logger.Error(["No node found for input node id",d]),new Error("Error parsing node connections");var m=kt(p.fullOperationName);if(!m)throw h.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var _=null===(a=null===(o=m.inputs)||void 0===o?void 0:o.flows)||void 0===a?void 0:a[t.socket||"in"],b=!1;if(!_)for(var g in null===(i=m.inputs)||void 0===i?void 0:i.flows)g.startsWith("[")&&g.endsWith("]")&&(b=!0,_=null===(l=null===(s=m.inputs)||void 0===s?void 0:s.flows)||void 0===l?void 0:l[g]);var y=_?b?_.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===y}));T||(T=R._createNewSocketConnection(y),v.signalInputs.push(T)),T.connectedPointIds.push(f.uniqueId),f.connectedPointIds.push(T.uniqueId)},R=this,M=0,E=C;M<E.length;M++)P(E[M]);for(var L=x.values||{},F=Object.keys(L),k=function(t){var n=L[t],r=null===(c=null===(u=w.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=w.flowGraphMapping.inputs)||void 0===f?void 0:f.values)a.startsWith("[")&&a.endsWith("]")&&(o=!0,r=null===(p=null===(d=w.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 h.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 h.Logger.Error(["No node found for output socket reference",n]),new Error("Error parsing node connections");var O=kt(x.fullOperationName);if(!O)throw h.Logger.Error(["No mapping found for output socket reference",n]),new Error("Error parsing node connections");var C=null===(_=null===(m=O.outputs)||void 0===m?void 0:m.values)||void 0===_?void 0:_[T],P=!1;if(!C)for(var a in null===(b=O.outputs)||void 0===b?void 0:b.values)a.startsWith("[")&&a.endsWith("]")&&(P=!0,C=null===(y=null===(g=O.outputs)||void 0===g?void 0:g.values)||void 0===y?void 0:y[a]);var R=C?P?C.name.replace("$1",T):null==C?void 0:C.name:T,M=C&&C.toBlock&&x.blocks.find((function(e){return e.className===C.toBlock}))||x.blocks[0],E=M.dataOutputs.find((function(e){return e.name===R}));E||(E=I._createNewSocketConnection(R,!0),M.dataOutputs.push(E)),s.connectedPointIds.push(E.uniqueId),E.connectedPointIds.push(s.uniqueId)}},I=this,S=0,B=F;S<B.length;S++)k(B[S]);if(w.flowGraphMapping.interBlockConnectors)for(var N=0,G=w.flowGraphMapping.interBlockConnectors;N<G.length;N++){var H=G[N],V=H.input,D=H.output,K=H.isVariable;this._connectFlowGraphNodes(V,D,A.blocks[H.inputBlockIndex],A.blocks[H.outputBlockIndex],K)}if(w.flowGraphMapping.extraProcessor){var U=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!U)throw h.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=w.flowGraphMapping.extraProcessor(x,U,w.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,t){return{uniqueId:(0,h.RandomGUID)(),name:e,_connectionType:t?1:0,connectedPointIds:[]}},e.prototype._connectFlowGraphNodes=function(e,t,n,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,h.RandomGUID)(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var t=0;t<this._staticVariables.length;t++){var n=this._staticVariables[t];e._userVariables[this.getVariableName(t)]=n}return{rightHanded:!0,allBlocks:this._nodes.reduce((function(e,t){return e.concat(t.blocks)}),[]),executionContexts:[e]}},e}(),Ut="KHR_interactivity",jt=function(){function e(e){this._loader=e,this.name=Ut,this.enabled=this._loader.isExtensionUsed(Ut),this._pathConverter=(0,E.Wt)(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&zt(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a=this;return(0,p.YH)(this,(function(i){switch(i.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(t=null===(o=this._loader.gltf.extensions)||void 0===o?void 0:o.KHR_interactivity)?((n=new h.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,r=t.graphs.map((function(e){return new Kt(e,a._loader.gltf,a._loader.parent.targetFps).serializeToFlowGraph()})),[4,Promise.all(r.map((function(e){return(0,p.sH)(a,void 0,void 0,(function(){return(0,p.YH)(this,(function(t){switch(t.label){case 0:return[4,(0,h.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 zt(e){(0,E.oR)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new h.Quaternion(NaN,NaN,NaN,NaN);var t=h.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:function(){return e.activeCamera}}),(0,E.oR)("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new h.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,E.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,E.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,E.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,E.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,E.oR)("/animations/{}/extensions/KHR_interactivity/virtualPlayhead",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.getCurrentFrame())&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}})}(0,h.addToBlockFactory)(Ut,"FlowGraphGLTFDataProvider",(function(){return(0,p.sH)(void 0,void 0,void 0,(function(){return(0,p.YH)(this,(function(e){switch(e.label){case 0:return[4,Promise.resolve().then(a.bind(a,274))];case 1:return[2,e.sent().FlowGraphGLTFDataProvider]}}))}))})),I(Ut),k(Ut,!0,(function(e){return new jt(e)}));var Wt="KHR_node_visibility";(0,E.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 Zt=function(){function e(e){this.name=Wt,this._loader=e,this.enabled=e.isExtensionUsed(Wt)}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}();I(Wt),k(Wt,!0,(function(e){return new Zt(e)}));var Yt="KHR_node_selectability";St("event/onSelect",Yt,{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,E.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 qt=function(){function e(e){this.name=Yt,this._loader=e,this.enabled=e.isExtensionUsed(Yt)}return e.prototype.onReady=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e;return(0,p.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,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}();I(Yt),k(Yt,!0,(function(e){return new qt(e)}));var Xt="KHR_node_hoverability",Qt="targetMeshPointerOver_";St("event/onHoverIn",Xt,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return Qt+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 _=Qt+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 Jt="targetMeshPointerOut_";St("event/onHoverOut",Xt,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return Jt+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 _=Jt+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,E.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 $t=function(){function e(e){this.name=Xt,this._loader=e,this.enabled=e.isExtensionUsed(Xt)}return e.prototype.onReady=function(){return(0,p.sH)(this,void 0,void 0,(function(){var e;return(0,p.YH)(this,(function(t){return null===(e=this._loader.gltf.nodes)||void 0===e||e.forEach((function(e){var t,n,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}();I(Xt),k(Xt,!0,(function(e){return new $t(e)}));var en="ExtrasAsMetadata",tn=function(){function e(e){this.name=en,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}();I(en),k(en,!1,(function(e){return new tn(e)}));var nn=a(274),rn=a(833),on=a(561),an=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==an){an.BABYLON=an.BABYLON||{};var sn=an.BABYLON;sn.GLTF2=sn.GLTF2||{},sn.GLTF2.Loader=sn.GLTF2.Loader||{},sn.GLTF2.Loader.Extensions=sn.GLTF2.Loader.Extensions||{};var ln=[];for(var un in u)sn.GLTF2.Loader.Extensions[un]=u[un],ln.push(un);for(var un in c)sn.GLTF2.Loader[un]=c[un],ln.push(un);for(var un in f)ln.indexOf(un)>-1||(sn.GLTF2[un]=f[un])}const cn=d;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._extinctionCoefficient=r.Vector3.Zero(),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.isRefractionEnabled?this._material.subSurface.refractionIntensity:0},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",{get:function(){return this.transmissionWeight>0?this._material.subSurface.tintColorAtDistance:0},set:function(e){this.transmissionWeight>0?this._material.subSurface.tintColorAtDistance=e:this.subsurfaceWeight>0&&this._material.subSurface.diffusionDistance.multiplyInPlace(new r.Color3(e,e,e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{get:function(){return this.transmissionWeight>0?this._material.subSurface.tintColor:this.subsurfaceWeight>0?this._material.subSurface.diffusionDistance:new r.Color3(0,0,0)},set:function(e){this.transmissionWeight>0?this._material.subSurface.tintColor=e:this.subsurfaceWeight>0&&this._material.subSurface.diffusionDistance.multiplyInPlace(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatter",{get:function(){return this._material.subSurface.diffusionDistance},set:function(e){this._material.subSurface.diffusionDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatterAnisotropy",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionScale",{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}),Object.defineProperty(e.prototype,"refractionBackgroundTexture",{get:function(){return this._material.subSurface.refractionTexture},set:function(e){this._material.subSurface.refractionTexture=e},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,"extinctionCoefficient",{get:function(){return this._extinctionCoefficient},set:function(e){this._extinctionCoefficient=e},enumerable:!1,configurable:!0}),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){var t=this.extinctionCoefficient,n=Math.max(t.x,Math.max(t.y,t.z)),o=n>0?1/n:1;this._material.subSurface.diffusionDistance=new r.Color3(Math.exp(-t.x*o),Math.exp(-t.y*o),Math.exp(-t.z*o))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceConstantTint",{get:function(){return this._material.subSurface.tintColor},set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceConstantTintTexture",{set:function(e){this._material.subSurface.translucencyColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadius",{get:function(){return 1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadiusScale",{get:function(){var e;return null!==(e=this._material.subSurface.scatteringDiffusionProfile)&&void 0!==e?e:r.Color3.White()},set:function(e){this._material.subSurface.scatteringDiffusionProfile=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceScatterAnisotropy",{set:function(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,"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:()=>d,tQ:()=>f,Wt:()=>c,ZU:()=>p});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 p=null===(i=c._babylonTransformNode)||void 0===i?void 0:i.computeWorldMatrix(!0).invert();p&&(null===(l=null===(s=e._babylonTransformNode)||void 0===s?void 0:s.computeWorldMatrix(f))||void 0===l||l.multiplyToRef(p,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 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];i&&(r=r[i])}r&&r.type&&r.get&&(r.interpolation=t)}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];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 p=f.morphTargetManager.getTarget(i),d=l.clone();p.animations.push(d),a.push({babylonAnimatable:p,babylonAnimation:d})}}},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:()=>o});var r=n(597),o=function(){function e(e){this._extinctionCoefficient=r.Vector3.Zero(),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}),e.prototype.configureTransmission=function(){},Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.transmissionWeight},set:function(e){this._material.transmissionWeight=e,this._material.transmissionColor=this._material.baseColor,this._material.transmissionColorTexture=this._material.baseColorTexture,this._material.transmissionDepth=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{set:function(e){this._material.transmissionWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatter",{get:function(){return this._material.transmissionScatter},set:function(e){this._material.transmissionScatter=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatterTexture",{get:function(){return this._material.transmissionScatterTexture},set:function(e){this._material.transmissionScatterTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionScatterAnisotropy",{set:function(e){this._material.transmissionScatterAnisotropy=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionAbbeNumber",{set:function(e){this._material.transmissionDispersionAbbeNumber=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDispersionScale",{set:function(e){this._material.transmissionDispersionScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionDepth",{get:function(){return this._material.transmissionDepth},set:function(e){e!==Number.MAX_VALUE||0!==this._material.transmissionDepth?this._material.transmissionDepth=e:this._material.transmissionDepth=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionColor",{get:function(){return this._material.transmissionColor},set:function(e){e.equals(r.Color3.White())||(this._material.transmissionColor=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"refractionBackgroundTexture",{get:function(){return this._material.backgroundRefractionTexture},set:function(e){this._material.backgroundRefractionTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThicknessTexture",{set:function(e){this._material.geometryThicknessTexture=e,this._material._useGeometryThicknessFromGreenChannel=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volumeThickness",{set:function(e){this._material.geometryThickness=e},enumerable:!1,configurable:!0}),e.prototype.configureSubsurface=function(){},Object.defineProperty(e.prototype,"extinctionCoefficient",{get:function(){return this._extinctionCoefficient},set:function(e){this._extinctionCoefficient=e},enumerable:!1,configurable:!0}),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}),Object.defineProperty(e.prototype,"subsurfaceConstantTint",{get:function(){return r.Color3.White()},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceConstantTintTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadius",{get:function(){return 0},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadiusScale",{get:function(){return r.Color3.White()},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceScatterAnisotropy",{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:()=>pn});var s={};a.r(s),a.d(s,{GLTFValidation:()=>v});var l={};a.r(l),a.d(l,{GLTFFileLoader:()=>P,GLTFLoaderAnimationStartMode:()=>g,GLTFLoaderCoordinateSystemMode:()=>b,GLTFLoaderDefaultOptions:()=>O,GLTFLoaderState:()=>y});var u={};a.r(u),a.d(u,{AddObjectAccessorToKey:()=>E.oR,EXT_lights_area:()=>re,EXT_lights_ies:()=>Q,EXT_lights_image_based:()=>V,EXT_mesh_gpu_instancing:()=>K,EXT_meshopt_compression:()=>z,EXT_texture_avif:()=>q,EXT_texture_webp:()=>Z,ExtrasAsMetadata:()=>rn,FlowGraphGLTFDataProvider:()=>on.FlowGraphGLTFDataProvider,GetMappingForKey:()=>E.tQ,GetPathToObjectConverter:()=>E.Wt,InteractivityGraphToFlowGraphParser:()=>Ut,KHR_animation_pointer:()=>Ot,KHR_draco_mesh_compression:()=>$,KHR_interactivity:()=>Wt,KHR_lights:()=>te,KHR_materials_anisotropy:()=>me,KHR_materials_clearcoat:()=>ue,KHR_materials_coat:()=>fe,KHR_materials_diffuse_roughness:()=>De,KHR_materials_diffuse_transmission:()=>Fe,KHR_materials_dispersion:()=>Ge,KHR_materials_emissive_strength:()=>be,KHR_materials_fuzz:()=>xe,KHR_materials_ior:()=>Ce,KHR_materials_iridescence:()=>de,KHR_materials_pbrSpecularGlossiness:()=>ae,KHR_materials_sheen:()=>ye,KHR_materials_specular:()=>Ae,KHR_materials_transmission:()=>Ee,KHR_materials_unlit:()=>se,KHR_materials_variants:()=>Pe,KHR_materials_volume:()=>Ie,KHR_materials_volume_scatter:()=>Be,KHR_mesh_quantization:()=>je,KHR_node_hoverability:()=>tn,KHR_node_selectability:()=>Qt,KHR_node_visibility:()=>qt,KHR_texture_basisu:()=>Ue,KHR_texture_transform:()=>We,KHR_xmp_json_ld:()=>Ye,MSFT_audio_emitter:()=>Mt,MSFT_lod:()=>Et,MSFT_minecraftMesh:()=>Ft,MSFT_sRGBFactors:()=>It,SetInterpolationForKey:()=>E.ZU,_AddInteractivityObjectModel:()=>Zt,addNewInteractivityFlowGraphMapping:()=>Nt,getAllSupportedNativeNodeTypes:()=>jt,getMappingForDeclaration:()=>Bt,getMappingForFullOperationName:()=>St,gltfTypeToBabylonType:()=>Kt});var c={};a.r(c);var f={};a.r(f),a.d(f,{AddObjectAccessorToKey:()=>E.oR,AnimationPropertyInfo:()=>qe.AnimationPropertyInfo,ArrayItem:()=>N,EXT_lights_area:()=>re,EXT_lights_ies:()=>Q,EXT_lights_image_based:()=>V,EXT_mesh_gpu_instancing:()=>K,EXT_meshopt_compression:()=>z,EXT_texture_avif:()=>q,EXT_texture_webp:()=>Z,ExtrasAsMetadata:()=>rn,FlowGraphGLTFDataProvider:()=>on.FlowGraphGLTFDataProvider,GLTFFileLoader:()=>P,GLTFLoader:()=>H,GetMappingForKey:()=>E.tQ,GetPathToObjectConverter:()=>E.Wt,InteractivityGraphToFlowGraphParser:()=>Ut,KHR_animation_pointer:()=>Ot,KHR_draco_mesh_compression:()=>$,KHR_interactivity:()=>Wt,KHR_lights:()=>te,KHR_materials_anisotropy:()=>me,KHR_materials_clearcoat:()=>ue,KHR_materials_coat:()=>fe,KHR_materials_diffuse_roughness:()=>De,KHR_materials_diffuse_transmission:()=>Fe,KHR_materials_dispersion:()=>Ge,KHR_materials_emissive_strength:()=>be,KHR_materials_fuzz:()=>xe,KHR_materials_ior:()=>Ce,KHR_materials_iridescence:()=>de,KHR_materials_pbrSpecularGlossiness:()=>ae,KHR_materials_sheen:()=>ye,KHR_materials_specular:()=>Ae,KHR_materials_transmission:()=>Ee,KHR_materials_unlit:()=>se,KHR_materials_variants:()=>Pe,KHR_materials_volume:()=>Ie,KHR_materials_volume_scatter:()=>Be,KHR_mesh_quantization:()=>je,KHR_node_hoverability:()=>tn,KHR_node_selectability:()=>Qt,KHR_node_visibility:()=>qt,KHR_texture_basisu:()=>Ue,KHR_texture_transform:()=>We,KHR_xmp_json_ld:()=>Ye,LoadBoundingInfoFromPositionAccessor:()=>G,MSFT_audio_emitter:()=>Mt,MSFT_lod:()=>Et,MSFT_minecraftMesh:()=>Ft,MSFT_sRGBFactors:()=>It,OpenPBRMaterialLoadingAdapter:()=>an.OpenPBRMaterialLoadingAdapter,PBRMaterialLoadingAdapter:()=>sn.PBRMaterialLoadingAdapter,SetInterpolationForKey:()=>E.ZU,TransformNodeAnimationPropertyInfo:()=>qe.TransformNodeAnimationPropertyInfo,WeightAnimationPropertyInfo:()=>qe.WeightAnimationPropertyInfo,_AddInteractivityObjectModel:()=>Zt,addNewInteractivityFlowGraphMapping:()=>Nt,getAllSupportedNativeNodeTypes:()=>jt,getMappingForDeclaration:()=>Bt,getMappingForFullOperationName:()=>St,getQuaternion:()=>qe.getQuaternion,getVector3:()=>qe.getVector3,getWeights:()=>qe.getWeights,gltfTypeToBabylonType:()=>Kt,registerGLTFExtension:()=>k,registeredGLTFExtensions:()=>F,unregisterGLTFExtension:()=>I});var p={};a.r(p),a.d(p,{GLTF2:()=>f,GLTFFileLoader:()=>P,GLTFLoaderAnimationStartMode:()=>g,GLTFLoaderCoordinateSystemMode:()=>b,GLTFLoaderDefaultOptions:()=>O,GLTFLoaderState:()=>y,GLTFValidation:()=>v});var d=a(322),h=a(597);function m(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 _(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":m(n.data,n.rootUrl,n.fileName,(function(t){return new Promise((function(n,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 b,g,y,v=function(){function e(){}return e.ValidateAsync=function(t,n,r,o){var a=this;return"function"==typeof Worker?new Promise((function(i,s){var l="".concat(m,"(").concat(_,")()"),u=URL.createObjectURL(new Blob([l],{type:"application/javascript"})),c=new Worker(u),f=function(e){c.removeEventListener("error",f),c.removeEventListener("message",p),s(e)},p=function(t){var n=t.data;switch(n.id){case"getExternalResource":o(n.uri).then((function(e){c.postMessage({id:"getExternalResource.resolve",index:n.index,value:e},[e.buffer])}),(function(e){c.postMessage({id:"getExternalResource.reject",index:n.index,reason:e})}));break;case"validate.resolve":c.removeEventListener("error",f),c.removeEventListener("message",p),e._LastResults=n.value,i(n.value),c.terminate();break;case"validate.reject":c.removeEventListener("error",f),c.removeEventListener("message",p),s(n.reason),c.terminate()}};if(c.addEventListener("error",f),c.addEventListener("message",p),c.postMessage({id:"init",url:h.Tools.GetBabylonScriptURL(a.Configuration.url)}),ArrayBuffer.isView(t)){var d=t.slice();c.postMessage({id:"validate",data:d,rootUrl:n,fileName:r},[d.buffer])}else c.postMessage({id:"validate",data:t,rootUrl:n,fileName:r})})):(this._LoadScriptPromise||(this._LoadScriptPromise=h.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return m(t,n,r,o)})))},e.Configuration={url:"".concat(h.Tools._DefaultCdnUrl,"/gltf_validator.js")},e._LastResults=null,e}(),x="Z2xURg",T="gltf",A={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};function w(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(b||(b={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(g||(g={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(y||(y={}));var C=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=g.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=b.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},O=new C,P=function(e){function t(t){var n=e.call(this)||this;return n.onParsedObservable=new h.Observable,n.onMeshLoadedObservable=new h.Observable,n.onSkinLoadedObservable=new h.Observable,n.onTextureLoadedObservable=new h.Observable,n.onMaterialLoadedObservable=new h.Observable,n.onCameraLoadedObservable=new h.Observable,n.onCompleteObservable=new h.Observable,n.onErrorObservable=new h.Observable,n.onDisposeObservable=new h.Observable,n.onExtensionLoadedObservable=new h.Observable,n.onValidatedObservable=new h.Observable,n._loader=null,n._state=null,n._requests=new Array,n.name=T,n.extensions=A,n.onLoaderStateChangedObservable=new h.Observable,n._logIndentLevel=0,n._loggingEnabled=!1,n._log=n._logDisabled,n._capturePerformanceCounters=!1,n._startPerformanceCounter=n._startPerformanceCounterDisabled,n._endPerformanceCounter=n._endPerformanceCounterDisabled,n.copyFrom(Object.assign((0,d.Cl)({},O),t)),n}return(0,d.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||h.Tools.GetFilename(t);if(a){if(this.useRangeRequests){this.validate&&h.Logger.Warn("glTF validation is not supported when range requests are enabled");var c={abort:function(){},onCompleteObservable:new h.Observable},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 h.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 h.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 h.DataReader({readAsync:function(e,n){return function(e,t,n){try{if(t<0||t>=e.byteLength)throw new RangeError("Offset is out of range.");if(t+n>e.byteLength)throw new RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,n))}catch(e){return Promise.reject(e)}}(t,e,n)},byteLength:t.byteLength})).then((function(e){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 h.AssetContainer(e),s=[];a.onMaterialLoadedObservable.add((function(e){s.push(e)}));var l=[];a.onTextureLoadedObservable.add((function(e){l.push(e)}));var u=[];a.onCameraLoadedObservable.add((function(e){u.push(e)}));var c=[];return a.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&c.push(e.morphTargetManager)})),a._loader.importMeshAsync(null,e,i,t,n,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,h.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(n,0,n.byteLength)),this._unpackBinaryAsync(new h.DataReader({readAsync:function(e,t){return w(n,e,t)},byteLength:n.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})},t.prototype.createPlugin=function(e){return new t(e[T])},Object.defineProperty(t.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),t.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,n){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){n(e)}))}))},t.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(y[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"),v.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"),h.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 h.RuntimeError("Unexpected magic: "+n,h.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||h.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);h.Logger.Log("".concat(n).concat(e))},t.prototype._logDisabled=function(e){},t.prototype._startPerformanceCounterEnabled=function(e){h.Tools.StartPerformanceCounter(e)},t.prototype._startPerformanceCounterDisabled=function(e){},t.prototype._endPerformanceCounterEnabled=function(e){h.Tools.EndPerformanceCounter(e)},t.prototype._endPerformanceCounterDisabled=function(e){},t.IncrementalLoading=!0,t.HomogeneousCoordinates=!1,t._logSpaces=" ",t}(function(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,d.C6)(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,p,d,h,m,_,b,g,y,v,x,T,A,w,C,O;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!==(p=e.loadNodeAnimations)&&void 0!==p?p:this.loadNodeAnimations,this.loadOnlyMaterials=null!==(d=e.loadOnlyMaterials)&&void 0!==d?d: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!==(b=e.skipMaterials)&&void 0!==b?b:this.skipMaterials,this.targetFps=null!==(g=e.targetFps)&&void 0!==g?g:this.targetFps,this.transparencyAsCoverage=null!==(y=e.transparencyAsCoverage)&&void 0!==y?y:this.transparencyAsCoverage,this.useClipPlane=null!==(v=e.useClipPlane)&&void 0!==v?v:this.useClipPlane,this.useGltfTextureNames=null!==(x=e.useGltfTextureNames)&&void 0!==x?x:this.useGltfTextureNames,this.useOpenPBR=null!==(T=e.useOpenPBR)&&void 0!==T?T:this.useOpenPBR,this.useRangeRequests=null!==(A=e.useRangeRequests)&&void 0!==A?A:this.useRangeRequests,this.useSRGBBuffers=null!==(w=e.useSRGBBuffers)&&void 0!==w?w:this.useSRGBBuffers,this.validate=null!==(C=e.validate)&&void 0!==C?C:this.validate,this.dontUseTransmissionHelper=null!==(O=e.dontUseTransmissionHelper)&&void 0!==O?O:this.dontUseTransmissionHelper)},t}(C));(0,h.RegisterSceneLoaderPlugin)(new P);var M=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==M){for(var R in M.BABYLON=M.BABYLON||{},l)M.BABYLON[R]=l[R];for(var R in s)M.BABYLON[R]=s[R]}var E=a(698),L=new Map,F=L;function k(e,t,n){I(e)&&h.Logger.Warn("Extension with the name '".concat(e,"' already exists")),L.set(e,{isGLTFExtension:t,factory:n})}function I(e){return L.delete(e)}var S=new h.Lazy((function(){return Promise.resolve().then(a.t.bind(a,597,23))})),B=new h.Lazy((function(){return Promise.resolve().then(a.bind(a,727))})),N=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 G(e){if(e.min&&e.max){var t=e.min,n=e.max,r=h.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=h.TmpVectors.Vector3[1].copyFromFloats(n[0],n[1],n[2]);if(e.normalized&&5126!==e.componentType){var a=1;switch(e.componentType){case 5120:a=127;break;case 5121:a=255;break;case 5122:a=32767;break;case 5123:a=65535}var i=1/a;r.scaleInPlace(i),o.scaleInPlace(i)}return new h.BoundingInfo(r,o)}return null}var H=function(){function e(e){this._completePromises=new Array,this._assetContainer=null,this._babylonLights=[],this._disableInstancedMesh=0,this._allMaterialsDirtyRequired=!1,this._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){k(e,!1,t)},e.UnregisterExtension=function(e){return I(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,d.sH)(this,arguments,void 0,(function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),(0,d.YH)(this,(function(a){switch(a.label){case 0:return[4,Promise.resolve().then((function(){return(0,d.sH)(s,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,d.YH)(this,(function(p){switch(p.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,p.sent()]}}))}))}))];case 1:return[2,a.sent()]}}))}))},e.prototype.loadAsync=function(e,t,n,r){return(0,d.sH)(this,arguments,void 0,(function(e,t,n,r,o){return void 0===o&&(o=""),(0,d.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,d.sH)(this,void 0,void 0,(function(){var o=this;return(0,d.YH)(this,(function(i){switch(i.label){case 0:return[4,Promise.resolve().then((function(){return(0,d.sH)(o,void 0,void 0,(function(){var o,i,s,l,u,c,f,p,m,_,b,g,v,x,T=this;return(0,d.YH)(this,(function(d){switch(d.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 d.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(o=this,v={},[4,Promise.resolve().then(a.t.bind(a,597,23))]):[3,4];case 2:return v.materialClass=d.sent().OpenPBRMaterial,[4,Promise.resolve().then(a.bind(a,833))];case 3:return o._pbrMaterialImpl=(v.adapterClass=d.sent().OpenPBRMaterialLoadingAdapter,v),[3,7];case 4:return i=this,x={},[4,Promise.resolve().then(a.t.bind(a,597,23))];case 5:return x.materialClass=d.sent().PBRMaterial,[4,Promise.resolve().then(a.bind(a,561))];case 6:i._pbrMaterialImpl=(x.adapterClass=d.sent().PBRMaterialLoadingAdapter,x),d.label=7;case 7:if(s="".concat(y[y.LOADING]," => ").concat(y[y.READY]),l="".concat(y[y.LOADING]," => ").concat(y[y.COMPLETE]),this._parent._startPerformanceCounter(s),this._parent._startPerformanceCounter(l),this._parent._setState(y.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=N.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(p=0;p<this._gltf.materials.length;++p)m=this._gltf.materials[p],_="/materials/"+p,b=h.Material.TriangleFillMode,u.push(this._loadMaterialAsync(_,m,null,b,(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(){T._rootBabylonMesh&&T._rootBabylonMesh!==T._parent.customRootNode&&T._rootBabylonMesh.setEnabled(!0);for(var e=0,t=T._babylonScene.materials;e<t.length;e++){var n=t[e];void 0!==n.maxSimultaneousLights&&(n.maxSimultaneousLights=Math.max(n.maxSimultaneousLights,T._babylonScene.lights.length))}return T._extensionsOnReady(),T._parent._setState(y.READY),T._skipStartAnimationStep||T._startAnimations(),r()})),[4,g.then((function(e){return T._parent._endPerformanceCounter(s),h.Tools.SetImmediate((function(){T._disposed||Promise.all(T._completePromises).then((function(){T._parent._endPerformanceCounter(l),T._parent._setState(y.COMPLETE),T._parent.onCompleteObservable.notifyObservers(void 0),T._parent.onCompleteObservable.clear(),T.dispose()}),(function(e){T._parent.onErrorObservable.notifyObservers(e),T._parent.onErrorObservable.clear(),T.dispose()}))})),e}))];case 8:return[2,d.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)&&h.Logger.Warn("Binary buffer length (".concat(n.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else h.Logger.Warn("Unexpected BIN chunk")}},e.prototype._setupData=function(){if(N.Assign(this._gltf.accessors),N.Assign(this._gltf.animations),N.Assign(this._gltf.buffers),N.Assign(this._gltf.bufferViews),N.Assign(this._gltf.cameras),N.Assign(this._gltf.images),N.Assign(this._gltf.materials),N.Assign(this._gltf.meshes),N.Assign(this._gltf.nodes),N.Assign(this._gltf.samplers),N.Assign(this._gltf.scenes),N.Assign(this._gltf.skins),N.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,d.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a,i,s,l,u,c,f=this;return(0,d.YH)(this,(function(p){switch(p.label){case 0:return e=[],F.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)&&h.Logger.Warn("Extension ".concat(n," is used but has been explicitly disabled.")):t.isGLTFExtension&&!f.isExtensionUsed(n)||e.push((0,d.sH)(f,void 0,void 0,(function(){var e;return(0,d.YH)(this,(function(r){switch(r.label){case 0:return[4,t.factory(this)];case 1:return(e=r.sent()).name!==n&&h.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(n)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}}))})))})),n=(t=(u=this._extensions).push).apply,r=[u],[4,Promise.all(e)];case 1:if(n.apply(t,r.concat([p.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 h.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=t,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var n={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case b.AUTO:this._babylonScene.useRightHandedSystem||(n.rotation=[0,1,0,0],n.scale=[1,1,-1],e._LoadTransform(n,this._rootBabylonMesh));break;case b.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=N.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 h.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 g.NONE:break;case g.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case g.ALL:for(var e,t=0,n=e=this._getAnimationGroups();t<n.length;t++)n[t].start(!0);break;default:return void h.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},e.prototype.loadNodeAsync=function(t,n,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=N.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=N.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 h.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 p=N.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh);i.push(this._loadMeshAsync("/meshes/".concat(p.index),n,p,(function(e){var r=n._babylonTransformNodeForSkin;e.metadata=(0,h.deepMerge)(r.metadata,e.metadata||{});var a=N.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=N.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 p=N.Get("".concat(t,"/mesh"),this._gltf.meshes,n.mesh),i.push(this._loadMeshAsync("/meshes/".concat(p.index),n,p,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&&N.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 h.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 p=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var m=new h.Mesh(n,this._babylonScene);if(m._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,m.sideOrientation=this._babylonScene.useRightHandedSystem?h.Material.CounterClockWiseSideOrientation:h.Material.ClockWiseSideOrientation,this._createMorphTargets(t,r,o,a,m),p.push(this._loadVertexDataAsync(t,a,m).then((function(e){return(0,d.sH)(s,void 0,void 0,(function(){var n=this;return(0,d.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(t,a,m,e).then((function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,e.applyToMesh(m),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 b=this._defaultBabylonMaterialData[_];b||(b=this._createDefaultMaterial("__GLTFLoader._default",_),this._parent.onMaterialLoadedObservable.notifyObservers(b),this._defaultBabylonMaterialData[_]=b),m.material=b}else{var g=N.Get("".concat(t,"/material"),this._gltf.materials,a.material);p.push(this._loadMaterialAsync("/materials/".concat(g.index),g,m,_,(function(e){m.material=e})))}}c=Promise.all(p),f&&(a._instanceData={babylonSourceMesh:m,promise:c}),u=m}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 h.Geometry(n.name,this._babylonScene);if(null==t.indices)n.isUnIndexed=!0;else{var l=N.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=N.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()===h.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!n.skeleton){var t=G(u);t&&(s._boundingInfo=t,s.useBoundingInfoFromGeometry=!0)}s.setVerticesBuffer(e,u.count)}))),o==h.VertexBuffer.MatricesIndicesExtraKind&&(n.numBoneInfluencers=8),l&&l(u)}};return u("POSITION",h.VertexBuffer.PositionKind),u("NORMAL",h.VertexBuffer.NormalKind),u("TANGENT",h.VertexBuffer.TangentKind),u("TEXCOORD_0",h.VertexBuffer.UVKind),u("TEXCOORD_1",h.VertexBuffer.UV2Kind),u("TEXCOORD_2",h.VertexBuffer.UV3Kind),u("TEXCOORD_3",h.VertexBuffer.UV4Kind),u("TEXCOORD_4",h.VertexBuffer.UV5Kind),u("TEXCOORD_5",h.VertexBuffer.UV6Kind),u("JOINTS_0",h.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",h.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",h.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",h.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",h.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(n.hasVertexAlpha=!0)})),Promise.all(i).then((function(){return s}))},e.prototype._createMorphTargets=function(e,t,n,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 h.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 h.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,d.sH)(this,void 0,void 0,(function(){var o,a,i=this;return(0,d.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=N.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",h.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",h.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",h.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",h.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",h.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",h.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=h.Vector3.Zero(),r=h.Quaternion.Identity(),o=h.Vector3.One();e.matrix?h.Matrix.FromArray(e.matrix).decompose(o,r,n):(e.translation&&(n=h.Vector3.FromArray(e.translation)),e.rotation&&(r=h.Quaternion.FromArray(e.rotation)),e.scale&&(o=h.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 h.Skeleton(n.name||i,i,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,n,s);var l=this._loadSkinInverseBindMatricesDataAsync(e,n).then((function(e){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=N.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)||(h.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index)}else h.Logger.Warn("".concat(e,": Failed to find common root"))}for(var a={},i=0,s=t.joints;i<s.length;i++){var l=s[i],u=N.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=N.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&&h.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));var i=t.joints.indexOf(e.index);return o=new h.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=N.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=h.Matrix.Identity(),i=o._index;t&&-1!==i&&(h.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?h.Matrix.FromArray(e.matrix):h.Matrix.Compose(e.scale?h.Vector3.FromArray(e.scale):h.Vector3.One(),e.rotation?h.Quaternion.FromArray(e.rotation):h.Quaternion.Identity(),e.translation?h.Vector3.FromArray(e.translation):h.Vector3.Zero())},e.prototype.loadCameraAsync=function(t,n,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 h.FreeCamera(n.name||"camera".concat(n.index),h.Vector3.Zero(),this._babylonScene,!1);switch(i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._babylonCamera=i,i.setTarget(new h.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=h.Camera.ORTHOGRAPHIC_CAMERA,i.orthoLeft=-n.orthographic.xmag,i.orthoRight=n.orthographic.xmag,i.orthoBottom=-n.orthographic.ymag,i.orthoTop=n.orthographic.ymag,i.minZ=n.orthographic.znear,i.maxZ=n.orthographic.zfar;break;default:throw new Error("".concat(t,": Invalid camera type (").concat(n.type,")"))}return e.AddPointerMetadata(i,t),this._parent.onCameraLoadedObservable.notifyObservers(i),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)||S.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;N.Assign(t.channels),N.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=N.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?B.value.then((function(){var i,u,c,f,p;switch(l){case"translation":p=null===(i=(0,E.tQ)("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":p=null===(u=(0,E.tQ)("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":p=null===(c=(0,E.tQ)("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":p=null===(f=(0,E.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(!p)throw new Error("".concat(e,"/target/path: Could not find interpolation properties for target path (").concat(r.target.path,")"));var d={object:s,info:p};return a._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,d,o)})):Promise.resolve()},e.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=N.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],p=f.getStride(l),d=e.input,h=e.output,m=new Array(d.length),_=0;switch(e.interpolation){case"STEP":for(var b=0;b<d.length;b++){var g=f.getValue(l,h,_,1);_+=p,m[b]={frame:d[b]*i,value:g,interpolation:1}}break;case"CUBICSPLINE":for(b=0;b<d.length;b++){var y=f.getValue(l,h,_,s);_+=p,g=f.getValue(l,h,_,1),_+=p;var v=f.getValue(l,h,_,s);_+=p,m[b]={frame:d[b]*i,inTangent:y,value:g,outTangent:v}}break;case"LINEAR":for(b=0;b<d.length;b++)g=f.getValue(l,h,_,1),_+=p,m[b]={frame:d[b]*i,value:g}}if(_>0)for(var x="".concat(n.name||"animation".concat(n.index),"_channel").concat(r.index,"_").concat(t),T=0,A=f.buildAnimations(l,x,i,m);T<A.length;T++){var w=A[T];t++,a(w.babylonAnimatable,w.babylonAnimation)}}}))},e.prototype._loadAnimationSamplerAsync=function(e,t){if(t._data)return t._data;var n=t.interpolation||"LINEAR";switch(n){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error("".concat(e,"/interpolation: Invalid value (").concat(t.interpolation,")"))}var r=N.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=N.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=N.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*h.VertexBuffer.GetTypeByteLength(n.componentType),s=a*n.count;if(null==n.bufferView)n._data=Promise.resolve(new r(s));else{var l=N.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 h.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=N.Get("".concat(t,"/sparse/indices/bufferView"),o._gltf.bufferViews,u.indices.bufferView),f=N.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],p=e._GetTypedArray("".concat(t,"/sparse/indices"),u.indices.componentType,c,u.indices.byteOffset,u.count),d=a*u.count;if(5126!==n.componentType||n.normalized){var m=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,d);s=new r(d),h.VertexBuffer.ForEach(m,0,i,a,n.componentType,s.length,n.normalized||!1,(function(e,t){s[t]=e}))}else s=e._GetTypedArray("".concat(t,"/sparse/values"),n.componentType,f,u.values.byteOffset,d);for(var _=0,b=0;b<p.length;b++)for(var g=p[b]*a,y=0;y<a;y++)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=N.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 h.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 h.VertexBuffer(a,e,r,!1)}));else{var i=N.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 h.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=h.Color3.FromArray(t.baseColorFactor),o.geometryOpacity=t.baseColorFactor[3]):o.baseColor=h.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?h.Color3.FromArray(t.emissiveFactor):new h.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=N.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:N.Get("".concat(t,"/sampler"),this._gltf.samplers,n.sampler),i=N.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 h.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var p={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,h.GetMimeType)(null!==(s=n.uri)&&void 0!==s?s:""),loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},d=new h.Texture(null,this._babylonScene,p);return d._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);d.updateURL(r,e);var o=d.getInternalTexture();o&&(o.label=n.name)}))),d.wrapU=u.wrapU,d.wrapV=u.wrapV,r(d),this._parent.useGltfTextureNames&&(d.name=n.name||n.uri||"image".concat(n.index)),Promise.all(c).then((function(){return d}))},e.prototype._loadSampler=function(t,n){return n._data||(n._data={noMipMaps:9728===n.minFilter||9729===n.minFilter,samplingMode:e._GetTextureSamplingMode(t,n),wrapU:e._GetTextureWrapMode("".concat(t,"/wrapS"),n.wrapS),wrapV:e._GetTextureWrapMode("".concat(t,"/wrapT"),n.wrapT)}),n._data},e.prototype.loadImageAsync=function(e,t){if(!t._data){if(this.logOpen("".concat(e," ").concat(t.name||"")),t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{var n=N.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,h.IsBase64DataUrl)(r)){var i=new Uint8Array((0,h.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 h.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 h.Texture.CLAMP_ADDRESSMODE;case 33648:return h.Texture.MIRROR_ADDRESSMODE;case 10497:return h.Texture.WRAP_ADDRESSMODE;default:return h.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),h.Texture.WRAP_ADDRESSMODE}},e._GetTextureSamplingMode=function(e,t){var n=null==t.magFilter?9729:t.magFilter,r=null==t.minFilter?9987:t.minFilter;if(9729===n)switch(r){case 9728:return h.Texture.LINEAR_NEAREST;case 9729:return h.Texture.LINEAR_LINEAR;case 9984:return h.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return h.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return h.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return h.Texture.LINEAR_LINEAR_MIPLINEAR;default:return h.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),h.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==n&&h.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(n,")")),r){case 9728:return h.Texture.NEAREST_NEAREST;case 9729:return h.Texture.NEAREST_LINEAR;case 9984:return h.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return h.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return h.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return h.Texture.NEAREST_LINEAR_MIPLINEAR;default:return h.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),h.Texture.NEAREST_NEAREST_MIPNEAREST}},e._GetTypedArrayConstructor=function(e,t){try{return(0,h.GetTypedArrayConstructor)(t)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}},e._GetTypedArray=function(t,n,r,o,a){var i=r.buffer;o=r.byteOffset+(o||0);var s=e._GetTypedArrayConstructor("".concat(t,"/componentType"),n),l=h.VertexBuffer.GetTypeByteLength(n);return o%l!==0?(h.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 h.Tools.IsBase64(e)||-1===e.indexOf("..")},e._GetDrawMode=function(e,t){switch(null==t&&(t=4),t){case 0:return h.Material.PointListDrawMode;case 1:return h.Material.LineListDrawMode;case 2:return h.Material.LineLoopDrawMode;case 3:return h.Material.LineStripDrawMode;case 4:return h.Material.TriangleFillMode;case 5:return h.Material.TriangleStripDrawMode;case 6:return h.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(t,")"))},e.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var n=0,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}();P._CreateGLTF2Loader=function(e){return new H(e)};var D="EXT_lights_image_based",V=function(){function e(e){this.name=D,this._loader=e,this.enabled=this._loader.isExtensionUsed(D)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights}},e.prototype.loadSceneAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,d.sH)(n,void 0,void 0,(function(){var n,a,i=this;return(0,d.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=N.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=N.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,d.sH)(n,void 0,void 0,(function(){var n,r,a,i,s;return(0,d.YH)(this,(function(l){switch(l.label){case 0:if((n=new h.RawCubeTexture(this._loader.babylonScene,null,t.specularImageSize)).name=t.name||"environment",t._babylonTexture=n,null!=t.intensity&&(n.level=t.intensity),t.rotation&&(r=h.Quaternion.FromArray(t.rotation),this._loader.babylonScene.useRightHandedSystem||(r=h.Quaternion.Inverse(r)),h.Matrix.FromQuaternionToRef(r,n.getReflectionTextureMatrix())),!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(a=h.SphericalHarmonics.FromArray(t.irradianceCoefficients)).scaleInPlace(t.intensity),a.convertIrradianceToLambertianRadiance(),i=h.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}();I(D),k(D,!0,(function(e){return new V(e)}));var j="EXT_mesh_gpu_instancing",K=function(){function e(e){this.name=j,this._loader=e,this.enabled=this._loader.isExtensionUsed(j)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,d.sH)(r,void 0,void 0,(function(){var r,a,i,s,l=this;return(0,d.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=N.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,d.sH)(l,void 0,void 0,(function(){var n,r,o,s,l,u,c,f,p,m;return(0,d.YH)(this,(function(d){switch(d.label){case 0:return[4,Promise.all(a)];case 1:for(n=d.sent(),r=n[0],o=n[1],s=n[2],l=n[3],u=new Float32Array(16*i),h.TmpVectors.Vector3[0].copyFromFloats(0,0,0),h.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),h.TmpVectors.Vector3[1].copyFromFloats(1,1,1),c=0;c<i;++c)r&&h.Vector3.FromArrayToRef(r,3*c,h.TmpVectors.Vector3[0]),o&&h.Quaternion.FromArrayToRef(o,4*c,h.TmpVectors.Quaternion[0]),s&&h.Vector3.FromArrayToRef(s,3*c,h.TmpVectors.Vector3[1]),h.Matrix.ComposeToRef(h.TmpVectors.Vector3[1],h.TmpVectors.Quaternion[0],h.TmpVectors.Vector3[0],h.TmpVectors.Matrix[0]),h.TmpVectors.Matrix[0].copyToArray(u,16*c);for(f=0,p=t._primitiveBabylonMeshes;f<p.length;f++)(m=p[f]).thinInstanceSetBuffer("matrix",u,16,!0),l&&(l.length===3*i?m.thinInstanceSetBuffer("color",l,3,!0):l.length===4*i?m.thinInstanceSetBuffer("color",l,4,!0):h.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+m.name));return[2,e]}}))}))}))]}}))}))}))},e}();I(j),k(j,!0,(function(e){return new K(e)}));var U="EXT_meshopt_compression",z=function(){function e(e){this.name=U,this.enabled=e.isExtensionUsed(U),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,d.sH)(n,void 0,void 0,(function(){var n,r,a=this;return(0,d.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=N.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,d.sH)(a,void 0,void 0,(function(){return(0,d.YH)(this,(function(t){switch(t.label){case 0:return[4,h.MeshoptCompression.Default.decodeGltfBufferAsync(e,o.count,o.byteStride,o.mode,o.filter)];case 1:return[2,t.sent()]}}))}))})),[4,n._meshOptData]}}))}))}))},e}();I(U),k(U,!0,(function(e){return new z(e)}));var W="EXT_texture_webp",Z=function(){function e(e){this.name=W,this._loader=e,this.enabled=e.isExtensionUsed(W)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r,i;return(0,d.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?H.DefaultSampler:N.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=N.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}();I(W),k(W,!0,(function(e){return new Z(e)}));var Y="EXT_texture_avif",q=function(){function e(e){this.name=Y,this._loader=e,this.enabled=e.isExtensionUsed(Y)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r,i;return(0,d.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?H.DefaultSampler:N.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=N.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}();I(Y),k(Y,!0,(function(e){return new q(e)}));var X="EXT_lights_ies",Q=function(){function e(e){this.name=X,this._loader=e,this.enabled=this._loader.isExtensionUsed(X)}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,N.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r,i,s,l,u,c=this;return(0,d.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=N.Get(o,c._lights,a.light)).name||e.name;c._loader.babylonScene._blockEntityCollection=!!c._loader._assetContainer,(r=new h.SpotLight(t,h.Vector3.Zero(),h.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=h.Light.FALLOFF_GLTF,r.diffuse=a.color?h.Color3.FromArray(a.color):h.Color3.White(),r.intensity=a.multiplier||1,r.range=Number.MAX_VALUE,r.parent=e,c._loader._babylonLights.push(r),H.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=N.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 h.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,l,!0,void 0,void 0,void 0,void 0,".ies"),[2,s]}}))}))}))},e}();I(X),k(X,!0,(function(e){return new Q(e)}));var J="KHR_draco_mesh_compression",$=function(){function e(e){this.name=J,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=h.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(J)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r,i,s,l,u=this;return(0,d.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=N.TryGet(u._loader.gltf.accessors,t.attributes[e]);l&&(i[o]=l.normalized||!1)}})("POSITION",h.VertexBuffer.PositionKind),s("NORMAL",h.VertexBuffer.NormalKind),s("TANGENT",h.VertexBuffer.TangentKind),s("TEXCOORD_0",h.VertexBuffer.UVKind),s("TEXCOORD_1",h.VertexBuffer.UV2Kind),s("TEXCOORD_2",h.VertexBuffer.UV3Kind),s("TEXCOORD_3",h.VertexBuffer.UV4Kind),s("TEXCOORD_4",h.VertexBuffer.UV5Kind),s("TEXCOORD_5",h.VertexBuffer.UV6Kind),s("JOINTS_0",h.VertexBuffer.MatricesIndicesKind),s("WEIGHTS_0",h.VertexBuffer.MatricesWeightsKind),s("COLOR_0",h.VertexBuffer.ColorKind),(l=N.Get(o,this._loader.gltf.bufferViews,a.bufferView))._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(l.index),l).then((function(o){return(0,d.sH)(u,void 0,void 0,(function(){var a,s,l;return(0,d.YH)(this,(function(u){switch(u.label){case 0:return a=this.dracoDecoder||h.DracoDecoder.Default,s=N.TryGet(this._loader.gltf.accessors,t.attributes.POSITION),l=this._loader.parent.alwaysComputeBoundingBox||n.skeleton||!s?null:G(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}();I(J),k(J,!0,(function(e){return new $(e)}));var ee="KHR_lights_punctual",te=function(){function e(e){this.name=ee,this._loader=e,this.enabled=this._loader.isExtensionUsed(ee)}return e.prototype.dispose=function(){this._loader=null,delete this._lights},e.prototype.onLoading=function(){var e=this._loader.gltf.extensions;if(e&&e[this.name]){var t=e[this.name];this._lights=t.lights,N.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r=this;return(0,d.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=N.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 h.DirectionalLight(s,h.Vector3.Backward(),r._loader.babylonScene);l.position.setAll(0),t=l;break;case"point":t=new h.PointLight(s,h.Vector3.Zero(),r._loader.babylonScene);break;case"spot":var u=new h.SpotLight(s,h.Vector3.Zero(),h.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=h.Light.FALLOFF_GLTF,t.diffuse=i.color?h.Color3.FromArray(i.color):h.Color3.White(),t.intensity=null==i.intensity?1:i.intensity,t.range=null==i.range?Number.MAX_VALUE:i.range,t.parent=e,r._loader._babylonLights.push(t),H.AddPointerMetadata(t,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();I(ee),k(ee,!0,(function(e){return new te(e)}));var ne="EXT_lights_area",re=function(){function e(e){this.name=ne,this._loader=e,this.enabled=this._loader.isExtensionUsed(ne)}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,N.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r=this;return(0,d.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=N.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 h.RectAreaLight(l,h.Vector3.Zero(),c,f,r._loader.babylonScene);break;case"disk":var p=Math.sqrt(u*u*.25*Math.PI);i=new h.RectAreaLight(l,h.Vector3.Zero(),p,p,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=h.Light.FALLOFF_GLTF,i.diffuse=s.color?h.Color3.FromArray(s.color):h.Color3.White(),i.intensity=null==s.intensity?1:s.intensity;var d=new h.TransformNode("".concat(l,"_orientation"),r._loader.babylonScene);d.rotationQuaternion=h.Quaternion.RotationAxis(h.Vector3.Up(),Math.PI),d.parent=e,i.parent=d,r._loader._babylonLights.push(i),H.AddPointerMetadata(i,o),n(e)}))];case 1:return[2,i.sent()]}}))}))}))},e}();I(ne),k(ne,!0,(function(e){return new re(e)}));var oe="KHR_materials_pbrSpecularGlossiness",ae=function(){function e(e){this.name=oe,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(oe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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 h.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=h.Color3.FromArray(t.diffuseFactor),n.alpha=t.diffuseFactor[3]):n.albedoColor=h.Color3.White(),n.reflectivityColor=t.specularFactor?h.Color3.FromArray(t.specularFactor):h.Color3.White(),n.microSurface=null==t.glossinessFactor?1:t.glossinessFactor,t.diffuseTexture&&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}();I(oe),k(oe,!0,(function(e){return new ae(e)}));var ie="KHR_materials_unlit",se=function(){function e(e){this.name=ie,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(ie)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(){return(0,d.sH)(r,void 0,void 0,(function(){return(0,d.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=h.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}();I(ie),k(ie,!0,(function(e){return new se(e)}));var le="KHR_materials_clearcoat",ue=function(){function e(e){this.name=le,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(le)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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}();I(le),k(le,!0,(function(e){return new ue(e)}));var ce="KHR_materials_coat",fe=function(){function e(e){this.name=ce,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(ce)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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=h.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}();I(ce),k(ce,!0,(function(e){return new fe(e)}));var pe="KHR_materials_iridescence",de=function(){function e(e){this.name=pe,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(pe)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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}();I(pe),k(pe,!0,(function(e){return new de(e)}));var he="KHR_materials_anisotropy",me=function(){function e(e){this.name=he,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(he)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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,d.sH)(this,void 0,void 0,(function(){var r,o,a,i,s,l,u,c;return(0,d.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}();I(he),k(he,!0,(function(e){return new me(e)}));var _e="KHR_materials_emissive_strength",be=function(){function e(e){this.name=_e,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(_e)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){return(0,d.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}();I(_e),k(_e,!0,(function(e){return new be(e)}));var ge="KHR_materials_sheen",ye=function(){function e(e){this.name=ge,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ge)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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?h.Color3.FromArray(t.sheenColorFactor):h.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}();I(ge),k(ge,!0,(function(e){return new ye(e)}));var ve="KHR_materials_fuzz",xe=function(){function e(e){this.name=ve,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ve)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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?h.Color3.FromArray(t.fuzzColorFactor):h.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}();I(ve),k(ve,!0,(function(e){return new xe(e)}));var Te="KHR_materials_specular",Ae=function(){function e(e){this.name=Te,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Te)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r,i;return(0,d.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?h.Color3.FromArray(t.specularColorFactor):new h.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}();I(Te),k(Te,!0,(function(e){return new Ae(e)}));var we="KHR_materials_ior",Ce=function(){function e(e){this.name=we,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(we)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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}();I(we),k(we,!0,(function(e){return new Ce(e)}));var Oe="KHR_materials_variants",Pe=function(){function e(e){this.name=Oe,this._loader=e,this.enabled=this._loader.isExtensionUsed(Oe)&&!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(Oe," 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(Oe," 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(Oe," 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[Oe])||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[Oe];(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 H.LoadExtensionAsync(t,a,this.name,(function(l,u){return(0,d.sH)(s,void 0,void 0,(function(){var s,c=this;return(0,d.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 h.Mesh){var r=H._GetDrawMode(t,a.mode),o=c._loader.rootBabylonMesh,f=o?o._internalMetadata=o._internalMetadata||{}:{},p=f.gltf=f.gltf||{},d=p[Oe]=p[Oe]||{lastSelected:null,original:[],variants:{}};d.original.push({mesh:n,material:n.material});for(var m=function(t){var a=u.mappings[t],i=N.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=N.Get("/extensions/".concat(Oe,"/variants/").concat(i),c._variants,i);d.variants[s.name]=d.variants[s.name]||[],d.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[Oe]={lastSelected:null,original:[],variants:{}};for(var u=0,c=a.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[Oe].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[Oe].variants[l]=[];for(var p=0,d=a.variants[l];p<d.length;p++){var h=d[p];i._internalMetadata.gltf[Oe].variants[l].push({mesh:h.mesh,material:h.material})}}a=i._internalMetadata.gltf[Oe]}for(var m=0,_=a.original;m<_.length;m++)(y=_[m]).mesh===n&&(y.mesh=r);for(var b=0,g=a.variants[s.name];b<g.length;b++){var y;(y=g[b]).mesh===n&&(y.mesh=r)}}))},i=0;i<a.variants.length;++i)r(i)})))},_=0;_<u.mappings.length;++_)m(_)}}))),[4,Promise.all(s).then((function(e){return e[0]}))];case 1:return[2,f.sent()]}}))}))}))},e}();I(Oe),k(Oe,!0,(function(e){return new Pe(e)}));var Me=function(){function e(t,n,r){var o=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,d.Cl)((0,d.Cl)({},e._GetDefaultOptions()),t),this._scene=n,this._scene._transmissionHelper=this,this._loader=r,this.onErrorObservable=new h.Observable,this._scene.onDisposeObservable.addOnce((function(){o.dispose()})),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:h.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},e.prototype.updateOptions=function(e){var t=this,n=Object.keys(e).filter((function(n){return t._options[n]!==e[n]}));if(n.length){var r=(0,d.Cl)((0,d.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._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),h.Tools.SetImmediate((function(){if(e.material){var n=t._loader._getOrCreateMaterialAdapter(e.material);n.transmissionWeight>0?(n.refractionBackgroundTexture=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),r=e.material?this._loader._getOrCreateMaterialAdapter(e.material):null;r&&r.transmissionWeight>0?(r&&(r.refractionBackgroundTexture=this._opaqueRenderTarget),-1!==n?(this._opaqueMeshesCache.splice(n,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)):-1!==t?(this._transparentMeshesCache.splice(t,1),this._opaqueMeshesCache.push(e)):-1===n&&this._opaqueMeshesCache.push(e)},e.prototype._isRenderTargetValid=function(){var e;return null!==(null===(e=this._opaqueRenderTarget)||void 0===e?void 0:e.getInternalTexture())},e.prototype._setupRenderTargets=function(){var e,t,n,r=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new h.RenderTargetTexture("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=null!==(t=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==t?t:this._scene.clearColor.clone(),this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.renderSprites=!0,this._opaqueRenderTarget.renderParticles=!0,this._opaqueRenderTarget.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];if(i.material){var s=this._loader._getOrCreateMaterialAdapter(i.material);s.transmissionWeight>0&&(s.refractionBackgroundTexture=this._opaqueRenderTarget)}}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},e}(),Re="KHR_materials_transmission",Ee=function(){function e(e){this.name=Re,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(Re),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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||!i)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 Me({},n.getScene(),this._loader)}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}();I(Re),k(Re,!0,(function(e){return new Ee(e)}));var Le="KHR_materials_diffuse_transmission",Fe=function(){function e(e){this.name=Le,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Le),this.enabled&&(e.parent.transparencyAsCoverage=!0)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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.subsurfaceConstantTint=void 0!==r.diffuseTransmissionColorFactor?h.Color3.FromArray(r.diffuseTransmissionColorFactor):h.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.subsurfaceConstantTintTexture=e}))),Promise.all(i).then((function(){}))},e}();I(Le),k(Le,!0,(function(e){return new Fe(e)}));var ke="KHR_materials_volume",Ie=function(){function e(e){this.name=ke,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(ke),this.enabled&&this._loader._disableInstancedMesh++}return e.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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();var i=void 0!==r.attenuationDistance?r.attenuationDistance:Number.MAX_VALUE,s=void 0!==r.attenuationColor&&3==r.attenuationColor.length?h.Color3.FromArray(r.attenuationColor):h.Color3.White(),l=new h.Vector3(-Math.log(s.r),-Math.log(s.g),-Math.log(s.b));l.scaleInPlace(1/Math.max(i,.001)),a.extinctionCoefficient=l,a.transmissionDepth=i,a.transmissionColor=s,a.volumeThickness=null!==(o=r.thicknessFactor)&&void 0!==o?o:0;var u=new Array;return r.thicknessTexture&&(r.thicknessTexture.nonColorData=!0,u.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),r.thicknessTexture,(function(e){e.name="".concat(n.name," (Thickness)"),a.volumeThicknessTexture=e})))),Promise.all(u).then((function(){}))},e}();I(ke),k(ke,!0,(function(e){return new Ie(e)}));var Se="KHR_materials_volume_scatter",Be=function(){function e(e){this.name=Se,this.order=172,this._loader=e,this.enabled=this._loader.isExtensionUsed(Se),this.enabled&&this._loader._disableInstancedMesh++}return e.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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=this._loader._getOrCreateMaterialAdapter(n);if(0===o.transmissionWeight&&0===o.subsurfaceWeight)return Promise.resolve();var a=void 0!==r.multiscatterColor&&3==r.multiscatterColor.length?h.Color3.FromArray(r.multiscatterColor):h.Color3.Black(),i=void 0!==r.scatterAnisotropy?r.scatterAnisotropy:0;if(o.transmissionWeight>0){var s=function(e){var t=new h.Vector3(e.r,e.g,e.b),n=new h.Vector3(4.09712,4.09712,4.09712);n.multiplyInPlace(t),n.addInPlace(new h.Vector3(4.20863,4.20863,4.20863));var r=new h.Vector3(9.59217,9.59217,9.59217);return r.addInPlace(new h.Vector3(41.6808,41.6808,41.6808).multiplyInPlace(t)),r.addInPlace(new h.Vector3(17.7126,17.7126,17.7126).multiplyInPlace(t.multiply(t))),n.subtractInPlace(new h.Vector3(Math.sqrt(r.x),Math.sqrt(r.y),Math.sqrt(r.z))),new h.Vector3(1,1,1).subtract(n.multiply(n))}(a),l=new h.Vector3(-Math.log(o.transmissionColor.r),-Math.log(o.transmissionColor.g),-Math.log(o.transmissionColor.b));l.scaleInPlace(1/Math.max(o.transmissionDepth,.001));var u=l.multiply(s);u.scaleInPlace(o.transmissionDepth),o.transmissionScatter.set(u.x,u.y,u.z);var c=Promise.resolve(null);return r.multiscatterColorTexture&&(r.multiscatterColorTexture.nonColorData=!0,c=this._loader.loadTextureInfoAsync("".concat(e,"/multiscatterColorTexture"),r.multiscatterColorTexture,(function(e){e.name="".concat(n.name," (Transmission)"),o.transmissionWeightTexture=e}))),o.transmissionScatterAnisotropy=i,c.then((function(){}))}if(o.subsurfaceWeight>0){o.subsurfaceScatterAnisotropy=i,o.subsurfaceColor=a;var f=new h.Vector3(0!==o.extinctionCoefficient.x?1/o.extinctionCoefficient.x:1,0!==o.extinctionCoefficient.y?1/o.extinctionCoefficient.y:1,0!==o.extinctionCoefficient.z?1/o.extinctionCoefficient.z:1);o.subsurfaceRadius=Math.max(f.x,f.y,f.z),o.subsurfaceRadiusScale=new h.Color3(f.x/o.subsurfaceRadius,f.y/o.subsurfaceRadius,f.z/o.subsurfaceRadius)}return Promise.resolve()},e}();I(Se),k(Se,!0,(function(e){return new Be(e)}));var Ne="KHR_materials_dispersion",Ge=function(){function e(e){this.name=Ne,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ne)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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 0!=o.transmissionWeight&&r.dispersion?(o.transmissionDispersionAbbeNumber=20,o.transmissionDispersionScale=r.dispersion,Promise.resolve()):Promise.resolve()},e}();I(Ne),k(Ne,!0,(function(e){return new Ge(e)}));var He="KHR_materials_diffuse_roughness",De=function(){function e(e){this.name=He,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(He)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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}();I(He),k(He,!0,(function(e){return new De(e)}));var Ve="KHR_mesh_quantization",je=function(){function e(e){this.name=Ve,this.enabled=e.isExtensionUsed(Ve)}return e.prototype.dispose=function(){},e}();I(Ve),k(Ve,!0,(function(e){return new je(e)}));var Ke="KHR_texture_basisu",Ue=function(){function e(e){this.name=Ke,this._loader=e,this.enabled=e.isExtensionUsed(Ke)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r,i;return(0,d.YH)(this,(function(s){switch(s.label){case 0:return r=null==t.sampler?H.DefaultSampler:N.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=N.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}();I(Ke),k(Ke,!0,(function(e){return new Ue(e)}));var ze="KHR_texture_transform",We=function(){function e(e){this.name=ze,this._loader=e,this.enabled=this._loader.isExtensionUsed(ze)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){return(0,d.YH)(this,(function(r){switch(r.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof h.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}();I(ze),k(ze,!0,(function(e){return new We(e)}));var Ze="KHR_xmp_json_ld",Ye=function(){function e(e){this.name=Ze,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ze)}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}();I(Ze),k(Ze,!0,(function(e){return new Ye(e)}));var qe=a(727);function Xe(e,t,n,r){return h.Color3.FromArray(t,n).scale(r)}function Qe(e,t,n,r){return t[n]*r}function Je(e,t,n,r){return-t[n]*r}function $e(e,t,n,r){return t[n+1]*r}function et(e,t,n,r){return t[n]*r*2}function tt(e){return{scale:[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Qe,(function(){return 2})),new rt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),$e,(function(){return 2}))],offset:[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Qe,(function(){return 2})),new rt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),$e,(function(){return 2}))],rotation:[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),Je,(function(){return 1}))]}}var nt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,d.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(qe.AnimationPropertyInfo),rt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,d.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}(qe.AnimationPropertyInfo),ot=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,d.C6)(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(qe.AnimationPropertyInfo),at=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,d.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}(qe.AnimationPropertyInfo);(0,E.ZU)("/cameras/{}/orthographic/xmag",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",Je,(function(){return 1})),new nt(h.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",$e,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/orthographic/ymag",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",Je,(function(){return 1})),new nt(h.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",$e,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/orthographic/zfar",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/orthographic/znear",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"minZ",Qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/perspective/yfov",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"fov",Qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/perspective/zfar",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Qe,(function(){return 1}))]),(0,E.ZU)("/cameras/{}/perspective/znear",[new nt(h.Animation.ANIMATIONTYPE_FLOAT,"minZ",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new rt(h.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",Xe,(function(){return 4})),new rt(h.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,n,r){return t[n+3]*r}),(function(){return 4}))]),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"metallic",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"roughness",Qe,(function(){return 1}))]);var it=tt("albedoTexture");(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",it.scale),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",it.offset),(0,E.ZU)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",it.rotation);var st=tt("metallicTexture");(0,E.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",st.scale),(0,E.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",st.offset),(0,E.ZU)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",st.rotation),(0,E.ZU)("/materials/{}/emissiveFactor",[new rt(h.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",Xe,(function(){return 3}))]);var lt=tt("bumpTexture");(0,E.ZU)("/materials/{}/normalTexture/scale",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",lt.scale),(0,E.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",lt.offset),(0,E.ZU)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",lt.rotation),(0,E.ZU)("/materials/{}/occlusionTexture/strength",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Qe,(function(){return 1}))]);var ut=tt("ambientTexture");(0,E.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",ut.scale),(0,E.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",ut.offset),(0,E.ZU)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",ut.rotation);var ct=tt("emissiveTexture");(0,E.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",ct.scale),(0,E.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",ct.offset),(0,E.ZU)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",ct.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Qe,(function(){return 1}))]);var ft=tt("anisotropy.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",ft.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",ft.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",ft.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Qe,(function(){return 1}))]);var pt=tt("clearCoat.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",pt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",pt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",pt.rotation);var dt=tt("clearCoat.bumpTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",dt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",dt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",dt.rotation);var ht=tt("clearCoat.textureRoughness");(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",ht.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",ht.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",ht.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_ior/ior",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Qe,(function(){return 1}))]);var mt=tt("iridescence.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",mt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",mt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",mt.rotation);var _t=tt("iridescence.thicknessTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",_t.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",_t.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",_t.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new rt(h.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",Xe,(function(){return 3}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Qe,(function(){return 1}))]);var bt=tt("sheen.texture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",bt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",bt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",bt.rotation);var gt=tt("sheen.textureRoughness");(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",gt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",gt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",gt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new rt(h.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Xe,(function(){return 3}))]);var yt=tt("metallicReflectanceTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",yt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",yt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",yt.rotation);var vt=tt("reflectanceTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",vt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",vt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",vt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Qe,(function(){return 1}))]);var xt=tt("subSurface.refractionIntensityTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",xt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",xt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",xt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new rt(h.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Xe,(function(){return 3}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Qe,(function(){return 1}))]),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Qe,(function(){return 1}))]);var Tt=tt("subSurface.thicknessTexture");(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",Tt.scale),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",Tt.offset),(0,E.ZU)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",Tt.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new rt(h.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Qe,(function(){return 1}))]);var At=tt("subSurface.translucencyIntensityTexture");(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",At.scale),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",At.offset),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",At.rotation),(0,E.ZU)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new rt(h.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",Xe,(function(){return 3}))]);var wt=tt("subSurface.translucencyColorTexture");(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",wt.scale),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",wt.offset),(0,E.ZU)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",wt.rotation),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/color",[new ot(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Xe,(function(){return 3}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",Qe,(function(){return 1}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/range",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"range",Qe,(function(){return 1}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",et,(function(){return 1}))]),(0,E.ZU)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"angle",et,(function(){return 1}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/color",[new ot(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Xe,(function(){return 3}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/intensity",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",Qe,(function(){return 1}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/size",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"radius",Qe,(function(){return 1}))]),(0,E.ZU)("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"radius",Qe,(function(){return 1}))]),(0,E.ZU)("/nodes/{}/extensions/EXT_lights_ies/color",[new ot(h.Animation.ANIMATIONTYPE_COLOR3,"diffuse",Xe,(function(){return 3}))]),(0,E.ZU)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new ot(h.Animation.ANIMATIONTYPE_FLOAT,"intensity",Qe,(function(){return 1}))]),(0,E.ZU)("/nodes/{}/extensions/KHR_node_visibility/visible",[new at(h.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Qe,(function(){return 1}))]);var Ct="KHR_animation_pointer",Ot=function(){function e(e){this.name=Ct,this._loader=e,this._pathToObjectConverter=(0,E.Wt)(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(Ct)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,t,n,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&&h.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&&h.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 h.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null}},e}();I(Ct),k(Ct,!0,(function(e){return new Ot(e)}));var Pt="MSFT_audio_emitter",Mt=function(){function e(e){this.name=Pt,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pt)}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,N.Assign(this._clips),N.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,d.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,d.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=N.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 H.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,d.sH)(r,void 0,void 0,(function(){var r,a,i=this;return(0,d.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=N.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(h.Vector3.Forward()),r.setDirectionalCone(2*h.Tools.ToDegrees(null==o.innerAngle?Math.PI:o.innerAngle),2*h.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 H.LoadExtensionAsync(e,t,this.name,(function(r,o){return(0,d.sH)(n,void 0,void 0,(function(){var n,a,i,s,l;return(0,d.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,N.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=N.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=N.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 h.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 h.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(n.directionalConeInnerAngle=2*h.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(n.directionalConeOuterAngle=2*h.Tools.ToDegrees(t.outerAngle)),t.volume&&(n.volume=t.volume),t._babylonData.sound=n}));t._babylonData={loaded:u}}return t._babylonData.loaded},e.prototype._getEventAction=function(e,t,n,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=N.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,s);return this._loadEmitterAsync(e,l).then((function(){var t=l._babylonData.sound;if(t){var n=new h.AnimationEvent(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}();I(Pt),k(Pt,!0,(function(e){return new Mt(e)}));var Rt="MSFT_lod",Et=function(){function e(e){var t,n;this.name=Rt,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new h.Observable,this.onMaterialLODsLoadedObservable=new h.Observable,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.maxLODsToLoad=null!==(n=null===(t=this._loader.parent.extensionOptions[Rt])||void 0===t?void 0:t.maxLODsToLoad)&&void 0!==n?n:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(Rt)}return e.prototype.dispose=function(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()},e.prototype.onReady=function(){for(var e=this,t=function(t){var r=Promise.all(n._nodePromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Node LOD ".concat(t)),e._loader.log("Loaded node LOD ".concat(t))),e.onNodeLODsLoadedObservable.notifyObservers(t),t!==e._nodePromiseLODs.length-1&&(e._loader.startPerformanceCounter("Node LOD ".concat(t+1)),e._loadBufferLOD(e._nodeBufferLODs,t+1),e._nodeSignalLODs[t]&&e._nodeSignalLODs[t].resolve())}));n._loader._completePromises.push(r)},n=this,r=0;r<this._nodePromiseLODs.length;r++)t(r);var o=function(t){var n=Promise.all(a._materialPromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Material LOD ".concat(t)),e._loader.log("Loaded material LOD ".concat(t))),e.onMaterialLODsLoadedObservable.notifyObservers(t),t!==e._materialPromiseLODs.length-1&&(e._loader.startPerformanceCounter("Material LOD ".concat(t+1)),e._loadBufferLOD(e._materialBufferLODs,t+1),e._materialSignalLODs[t]&&e._materialSignalLODs[t].resolve())}));a._loader._completePromises.push(n)},a=this;for(r=0;r<this._materialPromiseLODs.length;r++)o(r)},e.prototype.loadSceneAsync=function(e,t){var n=this._loader.loadSceneAsync(e,t);return this._loadBufferLOD(this._bufferLODs,0),n},e.prototype.loadNodeAsync=function(e,t,n){var r=this;return H.LoadExtensionAsync(e,t,this.name,(function(e,o){return(0,d.sH)(r,void 0,void 0,(function(){var r,a,i,s,l,u=this;return(0,d.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 h.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:H.LoadExtensionAsync(e,t,this.name,(function(e,i){return(0,d.sH)(a,void 0,void 0,(function(){var a,s,l,u,c,f=this;return(0,d.YH)(this,(function(p){switch(p.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,p.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 h.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return(0,d.sH)(r,void 0,void 0,(function(){return(0,d.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 h.Deferred,this._materialSignalLODs[o].promise.then((function(){return(0,d.sH)(r,void 0,void 0,(function(){return(0,d.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,d.sH)(o,void 0,void 0,(function(){var o,a,i;return(0,d.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 h.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(N.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}();I(Rt),k(Rt,!0,(function(e){return new Et(e)}));var Lt="MSFT_minecraftMesh",Ft=function(){function e(e){this.name=Lt,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 H.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r;return(0,d.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}();I(Lt),k(Lt,!0,(function(e){return new Ft(e)}));var kt="MSFT_sRGBFactors",It=function(){function e(e){this.name=kt,this._loader=e,this.enabled=this._loader.isExtensionUsed(kt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return H.LoadExtraAsync(e,t,this.name,(function(o,a){return(0,d.sH)(r,void 0,void 0,(function(){var r,o,i;return(0,d.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 St(e){var t=e.split(":");return Bt({op:t[0],extension:t[1]})}function Bt(e,t){var n;void 0===t&&(t=!0);var r=e.extension?null===(n=Gt[e.extension])||void 0===n?void 0:n[e.op]:Ht[e.op];if(!r&&(h.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 Nt(e,t,n){Gt[t]||(Gt[t]={}),Gt[t][e]=n}I(kt),k(kt,!0,(function(e){return new It(e)}));var Gt={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},Ht={"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 h.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 h.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?(h.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}:(h.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":Dt("FlowGraphEBlock"),"math/Pi":Dt("FlowGraphPIBlock"),"math/Inf":Dt("FlowGraphInfBlock"),"math/NaN":Dt("FlowGraphNaNBlock"),"math/abs":Dt("FlowGraphAbsBlock"),"math/sign":Dt("FlowGraphSignBlock"),"math/trunc":Dt("FlowGraphTruncBlock"),"math/floor":Dt("FlowGraphFloorBlock"),"math/ceil":Dt("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":Dt("FlowGraphFractBlock"),"math/neg":Dt("FlowGraphNegationBlock"),"math/add":Dt("FlowGraphAddBlock",["a","b"],!0),"math/sub":Dt("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?Vt(e):{valid:!0}}},"math/div":Dt("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Dt("FlowGraphModuloBlock",["a","b"]),"math/min":Dt("FlowGraphMinBlock",["a","b"]),"math/max":Dt("FlowGraphMaxBlock",["a","b"]),"math/clamp":Dt("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Dt("FlowGraphSaturateBlock"),"math/mix":Dt("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Dt("FlowGraphEqualityBlock",["a","b"]),"math/lt":Dt("FlowGraphLessThanBlock",["a","b"]),"math/le":Dt("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Dt("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Dt("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":Dt("FlowGraphIsNaNBlock"),"math/isInf":Dt("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":Dt("FlowGraphSinBlock"),"math/cos":Dt("FlowGraphCosBlock"),"math/tan":Dt("FlowGraphTanBlock"),"math/asin":Dt("FlowGraphASinBlock"),"math/acos":Dt("FlowGraphACosBlock"),"math/atan":Dt("FlowGraphATanBlock"),"math/atan2":Dt("FlowGraphATan2Block",["a","b"]),"math/sinh":Dt("FlowGraphSinhBlock"),"math/cosh":Dt("FlowGraphCoshBlock"),"math/tanh":Dt("FlowGraphTanhBlock"),"math/asinh":Dt("FlowGraphASinhBlock"),"math/acosh":Dt("FlowGraphACoshBlock"),"math/atanh":Dt("FlowGraphATanhBlock"),"math/exp":Dt("FlowGraphExponentialBlock"),"math/log":Dt("FlowGraphLogBlock"),"math/log2":Dt("FlowGraphLog2Block"),"math/log10":Dt("FlowGraphLog10Block"),"math/sqrt":Dt("FlowGraphSquareRootBlock"),"math/cbrt":Dt("FlowGraphCubeRootBlock"),"math/pow":Dt("FlowGraphPowerBlock",["a","b"]),"math/length":Dt("FlowGraphLengthBlock"),"math/normalize":Dt("FlowGraphNormalizeBlock"),"math/dot":Dt("FlowGraphDotBlock",["a","b"]),"math/cross":Dt("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":Dt("FlowGraphTransposeBlock"),"math/determinant":Dt("FlowGraphDeterminantBlock"),"math/inverse":Dt("FlowGraphInvertMatrixBlock"),"math/matMul":Dt("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":Dt("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":Dt("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":Dt("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":Dt("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],p=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[p.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],p=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[p.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],p=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[p.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",o}},"math/asr":Dt("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Dt("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Dt("FlowGraphLeadingZerosBlock"),"math/ctz":Dt("FlowGraphTrailingZerosBlock"),"math/popcnt":Dt("FlowGraphOneBitsCounterBlock"),"math/rad":Dt("FlowGraphDegToRadBlock"),"math/deg":Dt("FlowGraphRadToDegBlock"),"type/boolToInt":Dt("FlowGraphBooleanToInt"),"type/boolToFloat":Dt("FlowGraphBooleanToFloat"),"type/intToBool":Dt("FlowGraphIntToBoolean"),"type/intToFloat":Dt("FlowGraphIntToFloat"),"type/floatToInt":Dt("FlowGraphFloatToInt"),"type/floatToBool":Dt("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 h.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}:(h.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],p=null===(i=null===(a=e.configuration)||void 0===a?void 0:a.variable.value)||void 0===i?void 0:i[0];if("number"!=typeof p)throw h.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var d=r.arrays.staticVariables[p];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,h.getAnimationTypeByFlowGraphType)(d.type));var m=o[4];return m.config||(m.config={}),(c=m.config).variable||(c.variable={}),m.config.variable.value=r.getVariableName(p),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 h.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 Dt(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?Vt(e):{valid:!0}}}}function Vt(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 jt(){return Object.keys(Ht)}var Kt={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"}},Ut=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(Kt[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=Bt(n);if(!r)throw h.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 h.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==n.length)throw h.Logger.Error(["Invalid value length for variable",e,n]),new Error("Error parsing variables");var 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 h.Logger.Error(["No value found for event key",n]),new Error("Error parsing events");var a=e._types[o.type];if(!a)throw h.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 h.Logger.Error(["No declaration found for node",r]),new Error("Error parsing nodes");var o=this._mappings[r.declaration];if(!o)throw h.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,h.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&&h.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,p,d,m,_,b,g,y,v,x=0;x<this._nodes.length;x++){var T=null===(t=this._interactivityGraph.nodes)||void 0===t?void 0:t[x];if(!T)throw h.Logger.Error(["No node found for interactivity node",this._nodes[x]]),new Error("Error parsing node connections");var A=this._nodes[x],w=this._mappings[T.declaration];if(!w)throw h.Logger.Error(["No mapping found for node",T]),new Error("Error parsing node connections");for(var C=T.flows||{},O=Object.keys(C).sort(),P=function(e){var t=C[e],u=null===(r=null===(n=w.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 p=t.node,d=M._nodes[p];if(!d)throw h.Logger.Error(["No node found for input node id",p]),new Error("Error parsing node connections");var m=St(d.fullOperationName);if(!m)throw h.Logger.Error(["No mapping found for input node",d]),new Error("Error parsing node connections");var _=null===(a=null===(o=m.inputs)||void 0===o?void 0:o.flows)||void 0===a?void 0:a[t.socket||"in"],b=!1;if(!_)for(var g in null===(i=m.inputs)||void 0===i?void 0:i.flows)g.startsWith("[")&&g.endsWith("]")&&(b=!0,_=null===(l=null===(s=m.inputs)||void 0===s?void 0:s.flows)||void 0===l?void 0:l[g]);var y=_?b?_.name.replace("$1",t.socket||""):_.name:t.socket||"in",v=_&&_.toBlock&&d.blocks.find((function(e){return e.className===_.toBlock}))||d.blocks[0],x=v.signalInputs.find((function(e){return e.name===y}));x||(x=M._createNewSocketConnection(y),v.signalInputs.push(x)),x.connectedPointIds.push(f.uniqueId),f.connectedPointIds.push(x.uniqueId)},M=this,R=0,E=O;R<E.length;R++)P(E[R]);for(var L=T.values||{},F=Object.keys(L),k=function(t){var n=L[t],r=null===(c=null===(u=w.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=w.flowGraphMapping.inputs)||void 0===f?void 0:f.values)a.startsWith("[")&&a.endsWith("]")&&(o=!0,r=null===(d=null===(p=w.flowGraphMapping.inputs)||void 0===p?void 0:p.values)||void 0===d?void 0:d[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 h.Logger.Error(["Invalid value for value connection",n]),new Error("Error parsing node connections");var v=n.node,x=n.socket||"value",T=I._nodes[v];if(!T)throw h.Logger.Error(["No node found for output socket reference",n]),new Error("Error parsing node connections");var C=St(T.fullOperationName);if(!C)throw h.Logger.Error(["No mapping found for output socket reference",n]),new Error("Error parsing node connections");var O=null===(_=null===(m=C.outputs)||void 0===m?void 0:m.values)||void 0===_?void 0:_[x],P=!1;if(!O)for(var a in null===(b=C.outputs)||void 0===b?void 0:b.values)a.startsWith("[")&&a.endsWith("]")&&(P=!0,O=null===(y=null===(g=C.outputs)||void 0===g?void 0:g.values)||void 0===y?void 0:y[a]);var M=O?P?O.name.replace("$1",x):null==O?void 0:O.name:x,R=O&&O.toBlock&&T.blocks.find((function(e){return e.className===O.toBlock}))||T.blocks[0],E=R.dataOutputs.find((function(e){return e.name===M}));E||(E=I._createNewSocketConnection(M,!0),R.dataOutputs.push(E)),s.connectedPointIds.push(E.uniqueId),E.connectedPointIds.push(s.uniqueId)}},I=this,S=0,B=F;S<B.length;S++)k(B[S]);if(w.flowGraphMapping.interBlockConnectors)for(var N=0,G=w.flowGraphMapping.interBlockConnectors;N<G.length;N++){var H=G[N],D=H.input,V=H.output,j=H.isVariable;this._connectFlowGraphNodes(D,V,A.blocks[H.inputBlockIndex],A.blocks[H.outputBlockIndex],j)}if(w.flowGraphMapping.extraProcessor){var K=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[T.declaration];if(!K)throw h.Logger.Error(["No declaration found for extra processor",T]),new Error("Error parsing node connections");A.blocks=w.flowGraphMapping.extraProcessor(T,K,w.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,t){return{uniqueId:(0,h.RandomGUID)(),name:e,_connectionType:t?1:0,connectedPointIds:[]}},e.prototype._connectFlowGraphNodes=function(e,t,n,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,h.RandomGUID)(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var t=0;t<this._staticVariables.length;t++){var n=this._staticVariables[t];e._userVariables[this.getVariableName(t)]=n}return{rightHanded:!0,allBlocks:this._nodes.reduce((function(e,t){return e.concat(t.blocks)}),[]),executionContexts:[e]}},e}(),zt="KHR_interactivity",Wt=function(){function e(e){this._loader=e,this.name=zt,this.enabled=this._loader.isExtensionUsed(zt),this._pathConverter=(0,E.Wt)(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&Zt(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return(0,d.sH)(this,void 0,void 0,(function(){var e,t,n,r,o,a=this;return(0,d.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 h.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,r=t.graphs.map((function(e){return new Ut(e,a._loader.gltf,a._loader.parent.targetFps).serializeToFlowGraph()})),[4,Promise.all(r.map((function(e){return(0,d.sH)(a,void 0,void 0,(function(){return(0,d.YH)(this,(function(t){switch(t.label){case 0:return[4,(0,h.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 Zt(e){(0,E.oR)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new h.Quaternion(NaN,NaN,NaN,NaN);var t=h.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:function(){return e.activeCamera}}),(0,E.oR)("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new h.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,E.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,E.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,E.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,E.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,E.oR)("/animations/{}/extensions/KHR_interactivity/virtualPlayhead",{get:function(e){var t,n;return(null!==(n=null===(t=e._babylonAnimationGroup)||void 0===t?void 0:t.getCurrentFrame())&&void 0!==n?n:0)/60},type:"number",getTarget:function(e){return e._babylonAnimationGroup}})}(0,h.addToBlockFactory)(zt,"FlowGraphGLTFDataProvider",(function(){return(0,d.sH)(void 0,void 0,void 0,(function(){return(0,d.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]}}))}))})),I(zt),k(zt,!0,(function(e){return new Wt(e)}));var Yt="KHR_node_visibility";(0,E.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 qt=function(){function e(e){this.name=Yt,this._loader=e,this.enabled=e.isExtensionUsed(Yt)}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}();I(Yt),k(Yt,!0,(function(e){return new qt(e)}));var Xt="KHR_node_selectability";Nt("event/onSelect",Xt,{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,p,d,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===(d=null===(p=null==i?void 0:i.nodes)||void 0===p?void 0:p[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),(0,E.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 Qt=function(){function e(e){this.name=Xt,this._loader=e,this.enabled=e.isExtensionUsed(Xt)}return e.prototype.onReady=function(){return(0,d.sH)(this,void 0,void 0,(function(){var e;return(0,d.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}();I(Xt),k(Xt,!0,(function(e){return new Qt(e)}));var Jt="KHR_node_hoverability",$t="targetMeshPointerOver_";Nt("event/onHoverIn",Jt,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return $t+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,p,d,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 _=$t+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===(d=null===(p=null==i?void 0:i.nodes)||void 0===p?void 0:p[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}});var en="targetMeshPointerOut_";Nt("event/onHoverOut",Jt,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return en+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,p,d,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 _=en+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===(d=null===(p=null==i?void 0:i.nodes)||void 0===p?void 0:p[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),(0,E.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 tn=function(){function e(e){this.name=Jt,this._loader=e,this.enabled=e.isExtensionUsed(Jt)}return e.prototype.onReady=function(){return(0,d.sH)(this,void 0,void 0,(function(){var e;return(0,d.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}();I(Jt),k(Jt,!0,(function(e){return new tn(e)}));var nn="ExtrasAsMetadata",rn=function(){function e(e){this.name=nn,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}();I(nn),k(nn,!1,(function(e){return new rn(e)}));var on=a(274),an=a(833),sn=a(561),ln=void 0!==a.g?a.g:"undefined"!=typeof window?window:void 0;if(void 0!==ln){ln.BABYLON=ln.BABYLON||{};var un=ln.BABYLON;un.GLTF2=un.GLTF2||{},un.GLTF2.Loader=un.GLTF2.Loader||{},un.GLTF2.Loader.Extensions=un.GLTF2.Loader.Extensions||{};var cn=[];for(var fn in u)un.GLTF2.Loader.Extensions[fn]=u[fn],cn.push(fn);for(var fn in c)un.GLTF2.Loader[fn]=c[fn],cn.push(fn);for(var fn in f)cn.indexOf(fn)>-1||(un.GLTF2[fn]=f[fn])}const pn=p;return i.default})()));
|
|
2
2
|
//# sourceMappingURL=babylon.glTF2FileLoader.min.js.map
|