babylonjs-loaders 9.6.2 → 9.7.0
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.bvhFileLoader.js +2 -0
- package/babylon.bvhFileLoader.js.map +1 -0
- package/babylon.glTF1FileLoader.js +2 -0
- package/babylon.glTF1FileLoader.js.map +1 -0
- package/babylon.glTF2FileLoader.js +2 -0
- package/babylon.glTF2FileLoader.js.map +1 -0
- package/babylon.glTF2FileLoader.min.js +1 -1
- package/babylon.glTF2FileLoader.min.js.map +1 -1
- package/babylon.glTFFileLoader.js +2 -0
- package/babylon.glTFFileLoader.js.map +1 -0
- package/babylon.glTFFileLoader.min.js +1 -1
- package/babylon.glTFFileLoader.min.js.map +1 -1
- package/babylon.objFileLoader.js +2 -0
- package/babylon.objFileLoader.js.map +1 -0
- package/babylon.stlFileLoader.js +2 -0
- package/babylon.stlFileLoader.js.map +1 -0
- package/babylonjs.loaders.d.ts +69 -3
- package/babylonjs.loaders.js +1 -1
- package/babylonjs.loaders.js.map +1 -1
- package/babylonjs.loaders.min.js +1 -1
- package/babylonjs.loaders.min.js.map +1 -1
- package/babylonjs.loaders.module.d.ts +138 -6
- package/package.json +3 -3
package/babylonjs.loaders.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,t){"use strict";var n="Xposition",r="Yposition",o="Zposition",a="Xrotation",i="Yrotation",s="Zrotation",l=function(e){this.loopMode=t.Animation.ANIMATIONLOOPMODE_CYCLE,this.list=[],this.root=u(),this.numFrames=0,this.frameRate=0,this.skeleton=e};function u(){return{name:"",type:"",offset:new t.Vector3,channels:[],children:[],frames:[],parent:null}}function c(e,l,u){for(var f=function(e){var n=e.offset.x,r=e.offset.y,o=e.offset.z;return t.Matrix.Translation(n,r,o)}(e),h=new t.Bone(e.name,u.skeleton,l,f),d=function(e,l){if(0===e.frames.length)return[];for(var u=[],c=e.channels.some(function(e){return e===n||e===r||e===o}),f=e.channels.some(function(e){return e===a||e===i||e===s}),h=new t.Animation("".concat(e.name,"_pos"),"position",l.frameRate,t.Animation.ANIMATIONTYPE_VECTOR3,l.loopMode),d=new t.Animation("".concat(e.name,"_rot"),"rotationQuaternion",l.frameRate,t.Animation.ANIMATIONTYPE_QUATERNION,l.loopMode),p=[],m=[],_=0;_<e.frames.length;_++){var g=e.frames[_];c&&g.position&&p.push({frame:g.frame,value:g.position.clone()}),f&&m.push({frame:g.frame,value:g.rotation.clone()})}return p.length>0&&(h.setKeys(p),u.push(h)),m.length>0&&(d.setKeys(m),u.push(d)),u}(e,u),p=0,m=d;p<m.length;p++){var _=m[p];_.getKeys()&&_.getKeys().length>0&&h.animations.push(_)}for(var g=0,b=e.children;g<b.length;g++)c(b[g],h,u)}function f(e,l,u,c){if("ENDSITE"!==u.type){var h={frame:0,position:new t.Vector3,rotation:new t.Quaternion};h.frame=l,h.position=new t.Vector3,h.rotation=new t.Quaternion,u.frames.push(h);for(var d=t.Matrix.Identity(),p=0;p<u.channels.length;++p){var m=u.channels[p],_=e[c.i++];if(_){var g=parseFloat(_.trim());if(m.endsWith("position"))switch(m){case n:h.position.x=g;break;case r:h.position.y=g;break;case o:h.position.z=g}else if(m.endsWith("rotation")){var b=t.Tools.ToRadians(g),y=void 0;switch(m){case a:y=t.Matrix.RotationX(b);break;case i:y=t.Matrix.RotationY(b);break;case s:y=t.Matrix.RotationZ(b)}d=y.multiply(d)}}}t.Quaternion.FromRotationMatrixToRef(d,h.rotation);for(var v=0,T=u.children;v<T.length;v++)f(e,l,T[v],c)}}function h(e,n,r,o){var a,i,s,l,c=u();c.parent=r,o.list.push(c);var f=n.trim().split(/\s+/);if("END"===f[0].toUpperCase()&&"SITE"===f[1].toUpperCase()?(c.type="ENDSITE",c.name="ENDSITE"):(c.name=f[1],c.type=f[0].toUpperCase()),"{"!=(null===(a=e.shift())||void 0===a?void 0:a.trim()))throw new Error("Expected opening { after type & name");var d=null===(i=e.shift())||void 0===i?void 0:i.trim().split(/\s+/);if(!d)throw new Error("Unexpected end of file: missing OFFSET");if("OFFSET"!=(f=d)[0].toUpperCase())throw new Error("Expected OFFSET, but got: "+f[0]);if(4!=f.length)throw new Error("OFFSET: Invalid number of values");var p=new t.Vector3(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3]));if(isNaN(p.x)||isNaN(p.y)||isNaN(p.z))throw new Error("OFFSET: Invalid values");if(c.offset=p,"ENDSITE"!=c.type){if(!(f=null===(s=e.shift())||void 0===s?void 0:s.trim().split(/\s+/)))throw new Error("Unexpected end of file: missing CHANNELS");if("CHANNELS"!=f[0].toUpperCase())throw new Error("Expected CHANNELS definition");var m=parseInt(f[1]);c.channels=f.splice(2,m),c.children=[]}for(;e.length>0;){var _=null===(l=e.shift())||void 0===l?void 0:l.trim();if("}"===_)return c;_&&c.children.push(h(e,_,c,o))}throw new Error("Unexpected end of file: missing closing brace")}function d(e,n,r,o){var a=e.split("\n"),i=o.loopMode;n._blockEntityCollection=!!r;var s=new t.Skeleton("","",n);s._parentContainer=r,n._blockEntityCollection=!1;var u=new l(s);u.loopMode=i;var d=a.shift();if(!d||"HIERARCHY"!==d.trim().toUpperCase())throw new Error("HIERARCHY expected");var p=a.shift();if(!p)throw new Error("Unexpected end of file after HIERARCHY");var m=h(a,p.trim(),null,u),_=a.shift();if(!_||"MOTION"!==_.trim().toUpperCase())throw new Error("MOTION expected");var g=a.shift();if(!g)throw new Error("Unexpected end of file before frame count");var b=g.trim().split(/[\s]+/);if(b.length<2)throw new Error("Invalid frame count line");var y=parseInt(b[1]);if(isNaN(y))throw new Error("Failed to read number of frames.");u.numFrames=y;var v=a.shift();if(!v)throw new Error("Unexpected end of file before frame time");var T=v.trim().split(/[\s]+/);if(T.length<3)throw new Error("Invalid frame time line");var x=parseFloat(T[2]);if(isNaN(x))throw new Error("Failed to read frame time.");if(x<=0)throw new Error("Failed to read frame time. Invalid value "+x);u.frameRate=1/x;for(var A=0;A<y;++A){var w=a.shift();w&&f(w.trim().split(/[\s]+/)||[],A,m,{i:0})}return u.root=m,c(u.root,null,u),u.skeleton.returnToRest(),u.skeleton}var p=function(e,t){return p=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])},p(e,t)};function m(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}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var _=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function g(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 b(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])}}}function y(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var v={name:"bvh",extensions:{".bvh":{isBinary:!1}}},T=function(){function e(t){this.name=v.name,this.extensions=v.extensions,this._loadingOptions=_(_({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{loopMode:t.Animation.ANIMATIONLOOPMODE_CYCLE}},enumerable:!1,configurable:!0}),e.prototype.createPlugin=function(t){return new e(t[v.name])},e.prototype.canDirectLoad=function(e){return this.isBvhHeader(e)},e.prototype.isBvhHeader=function(e){return"HIERARCHY"==e.split("\n")[0]},e.prototype.isNotBvhHeader=function(e){return!this.isBvhHeader(e)},e.prototype.importMeshAsync=function(e,t,n){if("string"!=typeof n)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(n))return Promise.reject("BVH loader expects HIERARCHY header.");try{var r=d(n,t,null,this._loadingOptions);return Promise.resolve({meshes:[],particleSystems:[],skeletons:[r],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]})}catch(e){return Promise.reject(e)}},e.prototype.loadAsync=function(e,t){return"string"!=typeof t?Promise.reject("BVH loader expects string data."):this.isNotBvhHeader(t)?Promise.reject("BVH loader expects HIERARCHY header."):this.importMeshAsync(null,e,t).then(function(){})},e.prototype.loadAssetContainerAsync=function(e,n){if("string"!=typeof n)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(n))return Promise.reject("BVH loader expects HIERARCHY header.");var r=new t.AssetContainer(e);try{var o=d(n,e,r,this._loadingOptions);return r.skeletons.push(o),Promise.resolve(r)}catch(e){return Promise.reject(e)}},e}();t.RegisterSceneLoaderPlugin(new T);var x={__proto__:null,BVHFileLoader:T},A={__proto__:null,BVHFileLoader:T,ReadBvh:d};function w(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 O(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":w(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 C,M,E,R=function(){function e(){}return e.ValidateAsync=function(n,r,o,a){var i=this;return"function"==typeof Worker?new Promise(function(s,l){var u="".concat(w,"(").concat(O,")()"),c=URL.createObjectURL(new Blob([u],{type:"application/javascript"})),f=new Worker(c),h=function(e){f.removeEventListener("error",h),f.removeEventListener("message",d),l(e)},d=function(t){var n=t.data;switch(n.id){case"getExternalResource":a(n.uri).then(function(e){f.postMessage({id:"getExternalResource.resolve",index:n.index,value:e},[e.buffer])},function(e){f.postMessage({id:"getExternalResource.reject",index:n.index,reason:e})});break;case"validate.resolve":f.removeEventListener("error",h),f.removeEventListener("message",d),e._LastResults=n.value,s(n.value),f.terminate();break;case"validate.reject":f.removeEventListener("error",h),f.removeEventListener("message",d),l(n.reason),f.terminate()}};if(f.addEventListener("error",h),f.addEventListener("message",d),f.postMessage({id:"init",url:t.Tools.GetBabylonScriptURL(i.Configuration.url)}),ArrayBuffer.isView(n)){var p=n.slice();f.postMessage({id:"validate",data:p,rootUrl:r,fileName:o},[p.buffer])}else f.postMessage({id:"validate",data:n,rootUrl:r,fileName:o})}):(this._LoadScriptPromise||(this._LoadScriptPromise=t.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then(function(){return w(n,r,o,a)}))},e.Configuration={url:"".concat(t.Tools._DefaultCdnUrl,"/gltf_validator.js")},e._LastResults=null,e}(),F={__proto__:null,GLTFValidation:R},L="Z2xURg",P={name:"gltf",extensions:{".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}},canDirectLoad:function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+L)||e.startsWith("data:;base64,"+L)||e.startsWith("data:application/octet-stream;base64,"+L)||e.startsWith("data:model/gltf-binary;base64,"+L)}};function S(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}e.GLTFLoaderCoordinateSystemMode=void 0,(C=e.GLTFLoaderCoordinateSystemMode||(e.GLTFLoaderCoordinateSystemMode={}))[C.AUTO=0]="AUTO",C[C.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED",e.GLTFLoaderAnimationStartMode=void 0,(M=e.GLTFLoaderAnimationStartMode||(e.GLTFLoaderAnimationStartMode={}))[M.NONE=0]="NONE",M[M.FIRST=1]="FIRST",M[M.ALL=2]="ALL",e.GLTFLoaderState=void 0,(E=e.GLTFLoaderState||(e.GLTFLoaderState={}))[E.LOADING=0]="LOADING",E[E.READY=1]="READY",E[E.COMPLETE=2]="COMPLETE";var N=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=e.GLTFLoaderAnimationStartMode.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=e.GLTFLoaderCoordinateSystemMode.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},I=new N,B=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 m(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,b,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!==(h=e.loadNodeAnimations)&&void 0!==h?h:this.loadNodeAnimations,this.loadOnlyMaterials=null!==(d=e.loadOnlyMaterials)&&void 0!==d?d:this.loadOnlyMaterials,this.loadSkins=null!==(p=e.loadSkins)&&void 0!==p?p: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!==(g=e.skipMaterials)&&void 0!==g?g:this.skipMaterials,this.targetFps=null!==(b=e.targetFps)&&void 0!==b?b: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}(N),k=function(n){function r(e){var r=n.call(this)||this;return r.onParsedObservable=new t.Observable,r.onMeshLoadedObservable=new t.Observable,r.onSkinLoadedObservable=new t.Observable,r.onTextureLoadedObservable=new t.Observable,r.onMaterialLoadedObservable=new t.Observable,r.onCameraLoadedObservable=new t.Observable,r.onCompleteObservable=new t.Observable,r.onErrorObservable=new t.Observable,r.onDisposeObservable=new t.Observable,r.onExtensionLoadedObservable=new t.Observable,r.onValidatedObservable=new t.Observable,r._loader=null,r._state=null,r._requests=new Array,r.name=P.name,r.extensions=P.extensions,r.onLoaderStateChangedObservable=new t.Observable,r._logIndentLevel=0,r._loggingEnabled=!1,r._log=r._logDisabled,r._capturePerformanceCounters=!1,r._startPerformanceCounter=r._startPerformanceCounterDisabled,r._endPerformanceCounter=r._endPerformanceCounterDisabled,r.copyFrom(Object.assign(_({},I),e)),r}return m(r,n),Object.defineProperty(r.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(r.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(r.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(r.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(r.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(r.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(r.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.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(r.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(r.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),r.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()},r.prototype.loadFile=function(e,n,r,o,a,i,s,l){var u=this;if(ArrayBuffer.isView(n))return this._loadBinary(e,n,r,o,s,l),null;this._progressCallback=a;var c=n.name||t.Tools.GetFilename(n);if(i){if(this.useRangeRequests){this.validate&&t.Logger.Warn("glTF validation is not supported when range requests are enabled");var f={abort:function(){},onCompleteObservable:new t.Observable},h={readAsync:function(t,r){return new Promise(function(o,a){u._loadFile(e,n,function(e){o(new Uint8Array(e))},!0,function(e){a(e)},function(e){e.setRequestHeader("Range","bytes=".concat(t,"-").concat(t+r-1))})})},byteLength:0};return this._unpackBinaryAsync(new t.DataReader(h)).then(function(e){f.onCompleteObservable.notifyObservers(f),o(e)},s?function(e){return s(void 0,e)}:void 0),f}return this._loadFile(e,n,function(n){u._validate(e,new Uint8Array(n,0,n.byteLength),r,c),u._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){return S(n,e,t)},byteLength:n.byteLength})).then(function(e){o(e)},s?function(e){return s(void 0,e)}:void 0)},!0,s)}return this._loadFile(e,n,function(t){try{u._validate(e,t,r,c),o({json:u._parseJson(t)})}catch(e){s&&s()}},!1,s)},r.prototype._loadBinary=function(e,n,r,o,a,i){this._validate(e,new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r,i),this._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){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)}}(n,e,t)},byteLength:n.byteLength})).then(function(e){o(e)},a?function(e){return a(void 0,e)}:void 0)},r.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)})},r.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)})},r.prototype.loadAssetContainerAsync=function(e,n,r,o,a){var i=this;return Promise.resolve().then(function(){i.onParsedObservable.notifyObservers(n),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(n);var s=new t.AssetContainer(e),l=[];i.onMaterialLoadedObservable.add(function(e){l.push(e)});var u=[];i.onTextureLoadedObservable.add(function(e){u.push(e)});var c=[];i.onCameraLoadedObservable.add(function(e){c.push(e)});var f=[];return i.onMeshLoadedObservable.add(function(e){e.morphTargetManager&&f.push(e.morphTargetManager)}),i._loader.importMeshAsync(null,e,s,n,r,o,a).then(function(e){return Array.prototype.push.apply(s.geometries,e.geometries),Array.prototype.push.apply(s.meshes,e.meshes),Array.prototype.push.apply(s.particleSystems,e.particleSystems),Array.prototype.push.apply(s.skeletons,e.skeletons),Array.prototype.push.apply(s.animationGroups,e.animationGroups),Array.prototype.push.apply(s.materials,l),Array.prototype.push.apply(s.textures,u),Array.prototype.push.apply(s.lights,e.lights),Array.prototype.push.apply(s.transformNodes,e.transformNodes),Array.prototype.push.apply(s.cameras,c),Array.prototype.push.apply(s.morphTargetManagers,f),s})})},r.prototype.canDirectLoad=function(e){return P.canDirectLoad(e)},r.prototype.directLoad=function(e,n){if(n.startsWith("base64,"+L)||n.startsWith(";base64,"+L)||n.startsWith("application/octet-stream;base64,"+L)||n.startsWith("model/gltf-binary;base64,"+L)){var r=t.DecodeBase64UrlToBinary(n);return this._validate(e,new Uint8Array(r,0,r.byteLength)),this._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){return S(r,e,t)},byteLength:r.byteLength}))}return this._validate(e,n),Promise.resolve({json:this._parseJson(n)})},r.prototype.createPlugin=function(e){return new r(e[P.name])},Object.defineProperty(r.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),r.prototype.whenCompleteAsync=function(){var e=this;return new Promise(function(t,n){e.onCompleteObservable.addOnce(function(){t()}),e.onErrorObservable.addOnce(function(e){n(e)})})},r.prototype._setState=function(t){this._state!==t&&(this._state=t,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(e.GLTFLoaderState[this._state]))},r.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},r.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})}},r.prototype._validate=function(e,n,r,o){var a=this;void 0===r&&(r=""),void 0===o&&(o=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),R.ValidateAsync(n,r,o,function(t){return a.preprocessUrlAsync(r+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){a._endPerformanceCounter("Validate JSON"),a.onValidatedObservable.notifyObservers(e),a.onValidatedObservable.clear()},function(e){a._endPerformanceCounter("Validate JSON"),t.Tools.Warn("Failed to validate: ".concat(e.message)),a.onValidatedObservable.clear()}))},r.prototype._getLoader=function(e){var t=e.json.asset||{};this._log("Asset version: ".concat(t.version)),t.minVersion&&this._log("Asset minimum version: ".concat(t.minVersion)),t.generator&&this._log("Asset generator: ".concat(t.generator));var n=r._parseVersion(t.version);if(!n)throw new Error("Invalid version: "+t.version);if(void 0!==t.minVersion){var o=r._parseVersion(t.minVersion);if(!o)throw new Error("Invalid minimum version: "+t.minVersion);if(r._compareVersion(o,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+t.minVersion)}var a={1:r._CreateGLTF1Loader,2:r._CreateGLTF2Loader}[n.major];if(!a)throw new Error("Unsupported version: "+t.version);return a(this)},r.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},r.prototype._unpackBinaryAsync=function(e){var n=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then(function(){var r=e.readUint32();if(1179937895!==r)throw new t.RuntimeError("Unexpected magic: "+r,t.ErrorCodes.GLTFLoaderUnexpectedMagicError);var o=e.readUint32();n.loggingEnabled&&n._log("Binary version: ".concat(o));var a,i=e.readUint32();switch(n.useRangeRequests||i===e.buffer.byteLength||t.Logger.Warn("Length in header does not match actual data length: ".concat(i," != ").concat(e.buffer.byteLength)),o){case 1:a=n._unpackBinaryV1Async(e,i);break;case 2:a=n._unpackBinaryV2Async(e,i);break;default:throw new Error("Unsupported version: "+o)}return n._endPerformanceCounter("Unpack Binary"),a})},r.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)},r.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()})},r._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},r._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},r.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},r.prototype._logClose=function(){--this._logIndentLevel},r.prototype._logEnabled=function(e){var n=r._logSpaces.substring(0,2*this._logIndentLevel);t.Logger.Log("".concat(n).concat(e))},r.prototype._logDisabled=function(e){},r.prototype._startPerformanceCounterEnabled=function(e){t.Tools.StartPerformanceCounter(e)},r.prototype._startPerformanceCounterDisabled=function(e){},r.prototype._endPerformanceCounterEnabled=function(e){t.Tools.EndPerformanceCounter(e)},r.prototype._endPerformanceCounterDisabled=function(e){},r.IncrementalLoading=!0,r.HomogeneousCoordinates=!1,r._logSpaces=" ",r}(B);t.RegisterSceneLoaderPlugin(new k);var G,V,D,H,K,j,U,W,z={__proto__:null,GLTFFileLoader:k,get GLTFLoaderAnimationStartMode(){return e.GLTFLoaderAnimationStartMode},get GLTFLoaderCoordinateSystemMode(){return e.GLTFLoaderCoordinateSystemMode},GLTFLoaderDefaultOptions:I,get GLTFLoaderState(){return e.GLTFLoaderState}};!function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.FLOAT=5126]="FLOAT"}(G||(G={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(V||(V={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"}(D||(D={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(H||(H={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9728]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(K||(K={})),function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA"}(j||(j={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(U||(U={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"}(W||(W={}));var q,Y=function(){function e(){}return e.SetMatrix=function(e,n,r,o,a){var i=null;if("MODEL"===r.semantic?i=n.getWorldMatrix():"PROJECTION"===r.semantic?i=e.getProjectionMatrix():"VIEW"===r.semantic?i=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===r.semantic?i=t.Matrix.Transpose(n.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===r.semantic?i=n.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===r.semantic?i=n.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===r.semantic?i=n.getWorldMatrix().invert():"VIEWINVERSE"===r.semantic?i=e.getViewMatrix().invert():"PROJECTIONINVERSE"===r.semantic?i=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===r.semantic?i=n.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===r.semantic?i=n.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===r.semantic&&(i=t.Matrix.Transpose(n.getWorldMatrix().invert())),i)switch(r.type){case D.FLOAT_MAT2:a.setMatrix2x2(o,t.Matrix.GetAsMatrix2x2(i));break;case D.FLOAT_MAT3:a.setMatrix3x3(o,t.Matrix.GetAsMatrix3x3(i));break;case D.FLOAT_MAT4:a.setMatrix(o,i)}},e.SetUniform=function(e,n,r,o){switch(o){case D.FLOAT:return e.setFloat(n,r),!0;case D.FLOAT_VEC2:return e.setVector2(n,t.Vector2.FromArray(r)),!0;case D.FLOAT_VEC3:return e.setVector3(n,t.Vector3.FromArray(r)),!0;case D.FLOAT_VEC4:return e.setVector4(n,t.Vector4.FromArray(r)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case H.CLAMP_TO_EDGE:return t.Texture.CLAMP_ADDRESSMODE;case H.MIRRORED_REPEAT:return t.Texture.MIRROR_ADDRESSMODE;case H.REPEAT:default:return t.Texture.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case K.LINEAR:case K.LINEAR_MIPMAP_NEAREST:case K.LINEAR_MIPMAP_LINEAR:return t.Texture.TRILINEAR_SAMPLINGMODE;case K.NEAREST:case K.NEAREST_MIPMAP_NEAREST:return t.Texture.NEAREST_SAMPLINGMODE;default:return t.Texture.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,n,r,o){n=t.byteOffset+n;var a=e.loadedBufferViews[t.buffer];if(n+r>a.byteLength)throw new Error("Buffer access is out of range");var i=a.buffer;switch(n+=a.byteOffset,o){case G.BYTE:return new Int8Array(i,n,r);case G.UNSIGNED_BYTE:return new Uint8Array(i,n,r);case G.SHORT:return new Int16Array(i,n,r);case G.UNSIGNED_SHORT:return new Uint16Array(i,n,r);default:return new Float32Array(i,n,r)}},e.GetBufferFromAccessor=function(t,n){var r=t.bufferViews[n.bufferView],o=n.count*e.GetByteStrideFromType(n);return e.GetBufferFromBufferView(t,r,n.byteOffset,o,n.componentType)},e.DecodeBufferToText=function(e){for(var t="",n=e.byteLength,r=0;r<n;++r)t+=String.fromCharCode(e[r]);return t},e.GetDefaultMaterial=function(n){if(!e._DefaultMaterial){t.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{"," gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),t.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var r={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new t.ShaderMaterial("GLTFDefaultMaterial",n,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},r),e._DefaultMaterial.setColor4("u_emission",new t.Color4(.5,.5,.5,1))}return e._DefaultMaterial},e._DefaultMaterial=null,e}();!function(e){e[e.IDENTIFIER=1]="IDENTIFIER",e[e.UNKNOWN=2]="UNKNOWN",e[e.END_OF_INPUT=3]="END_OF_INPUT"}(q||(q={}));var X=function(){function e(e){this._pos=0,this.currentToken=q.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}return e.prototype.getNextToken=function(){if(this.isEnd())return q.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=q.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=q.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},e.prototype.peek=function(){return this._toParse[this._pos]},e.prototype.read=function(){return this._toParse[this._pos++]},e.prototype.forward=function(){this._pos++},e.prototype.isEnd=function(){return this._pos>=this._maxPos},e}(),J=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],Q=["world","view","projection","worldView","worldViewProjection","mBones"],Z=["translation","rotation","scale"],$=["position","rotationQuaternion","scaling"],ee=function(e,t,n){for(var r in e){var o=e[r];n[t][r]=o}},te=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},ne=function(e){if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){var t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},re=function(e){var n;if(e.translation||e.rotation||e.scale){var r=t.Vector3.FromArray(e.scale||[1,1,1]),o=t.Quaternion.FromArray(e.rotation||[0,0,0,1]),a=t.Vector3.FromArray(e.translation||[0,0,0]);n=t.Matrix.Compose(r,o,a)}else n=t.Matrix.FromArray(e.matrix);return n},oe=function(e,n,r,o){for(var a=0;a<o.bones.length;a++)if(o.bones[a].name===r)return o.bones[a];var i=e.nodes;for(var s in i){var l=i[s];if(l.jointName){var u=l.children;for(a=0;a<u.length;a++){var c=e.nodes[u[a]];if(c.jointName&&c.jointName===r){var f=re(l),h=new t.Bone(l.name||"",o,oe(e,n,l.jointName,o),f);return h.id=s,h}}}}return null},ae=function(e,t){for(var n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.node.children.length;o++)if(r.node.children[o]===t)return r.bone;return null},ie=function(e,t){var n=e.nodes,r=n[t];if(r)return{node:r,id:t};for(var o in n)if((r=n[o]).jointName===t)return{node:r,id:o};return null},se=function(e,t){for(var n=0;n<e.jointNames.length;n++)if(e.jointNames[n]===t)return!0;return!1},le=function(e,n,r,o,a){if(a||(e.scene._blockEntityCollection=!!e.assetContainer,(a=new t.Mesh(n.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,a.id=o),!n.babylonNode)return a;for(var i,s=[],l=null,u=[],c=[],f=[],h=[],d=0;d<r.length;d++){var p=r[d];if(R=e.meshes[p])for(var m=0;m<R.primitives.length;m++){var _=new t.VertexData,g=R.primitives[m];g.mode;var b=g.attributes,y=void 0,v=void 0;for(var T in b)if(y=e.accessors[b[T]],v=Y.GetBufferFromAccessor(e,y),"NORMAL"===T)_.normals=new Float32Array(v.length),_.normals.set(v);else if("POSITION"===T){if(k.HomogeneousCoordinates){_.positions=new Float32Array(v.length-v.length/4);for(var x=0;x<v.length;x+=4)_.positions[x]=v[x],_.positions[x+1]=v[x+1],_.positions[x+2]=v[x+2]}else _.positions=new Float32Array(v.length),_.positions.set(v);c.push(_.positions.length)}else if(-1!==T.indexOf("TEXCOORD_")){var A=Number(T.split("_")[1]),w=t.VertexBuffer.UVKind+(0===A?"":A+1),O=new Float32Array(v.length);O.set(v),te(O),_.set(O,w)}else"JOINT"===T?(_.matricesIndices=new Float32Array(v.length),_.matricesIndices.set(v)):"WEIGHT"===T?(_.matricesWeights=new Float32Array(v.length),_.matricesWeights.set(v)):"COLOR"===T&&(_.colors=new Float32Array(v.length),_.colors.set(v));if(y=e.accessors[g.indices])v=Y.GetBufferFromAccessor(e,y),_.indices=new Int32Array(v.length),_.indices.set(v),h.push(_.indices.length);else{var C=[];for(x=0;x<_.positions.length/3;x++)C.push(x);_.indices=new Int32Array(C),h.push(_.indices.length)}l?l.merge(_):l=_;var M=e.scene.getMaterialById(g.material);s.push(null===M?Y.GetDefaultMaterial(e.scene):M),u.push(0===u.length?0:u[u.length-1]+c[c.length-2]),f.push(0===f.length?0:f[f.length-1]+h[h.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,s.length>1?(i=new t.MultiMaterial("multimat"+o,e.scene)).subMaterials=s:i=new t.StandardMaterial("multimat"+o,e.scene),1===s.length&&(i=s[0]),i._parentContainer=e.assetContainer,a.material||(a.material=i),new t.Geometry(o,e.scene,l,!1,a),a.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,a.subMeshes=[];var E=0;for(d=0;d<r.length;d++){var R;if(p=r[d],R=e.meshes[p])for(m=0;m<R.primitives.length;m++)R.primitives[m].mode,t.SubMesh.AddToMesh(E,u[E],c[E],f[E],h[E],a,a,!0),E++}return a},ue=function(e,t,n,r){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=n),e.scaling&&(e.scaling=r)},ce=function(e,n,r){var o=null;if(e.importOnlyMeshes&&(n.skin||n.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(n.name||""))return null;if(n.skin){if(n.meshes){var a=e.skins[n.skin];(i=le(e,n,n.meshes,r,n.babylonNode)).skeleton=e.scene.getLastSkeletonById(n.skin),null===i.skeleton&&(i.skeleton=function(e,n,r,o){if(o||(o=new t.Skeleton(n.name||"","",e.scene)),!n.babylonSkeleton)return o;var a=[],i=[];!function(e,n,r,o){for(var a in e.nodes){var i=e.nodes[a],s=a;if(i.jointName&&!se(r,i.jointName)){var l=re(i),u=new t.Bone(i.name||"",n,null,l);u.id=s,o.push({bone:u,node:i,id:s})}}for(var c=0;c<o.length;c++)for(var f=o[c],h=f.node.children,d=0;d<h.length;d++){for(var p=null,m=0;m<o.length;m++)if(o[m].id===h[d]){p=o[m];break}p&&(p.bone._parent=f.bone,f.bone.children.push(p.bone))}}(e,o,n,a),o.bones=[];for(var s=0;s<n.jointNames.length;s++)if(v=ie(e,n.jointNames[s])){var l=v.node;if(l){var u=v.id,c=e.scene.getBoneById(u);if(c)o.bones.push(c);else{for(var f=void 0,h=null,d=0;d<s;d++){var p=ie(e,n.jointNames[d]);if(p){var m=p.node;if(m){var _=m.children;if(_){f=!1;for(var g=0;g<_.length;g++)if(_[g]===u){h=oe(e,n,n.jointNames[d],o),f=!0;break}if(f)break}}else t.Tools.Warn("Joint named "+n.jointNames[d]+" does not exist when looking for parent")}}var b=re(l);!h&&a.length>0&&(h=ae(a,u))&&-1===i.indexOf(h)&&i.push(h),new t.Bone(l.jointName||"",o,h,b).id=u}}else t.Tools.Warn("Joint named "+n.jointNames[s]+" does not exist")}var y=o.bones;for(o.bones=[],s=0;s<n.jointNames.length;s++){var v;if(v=ie(e,n.jointNames[s]))for(d=0;d<y.length;d++)if(y[d].id===v.id){o.bones.push(y[d]);break}}for(o.prepare(),s=0;s<i.length;s++)o.bones.push(i[s]);return o}(e,a,0,a.babylonSkeleton),a.babylonSkeleton||(a.babylonSkeleton=i.skeleton)),o=i}}else if(n.meshes){var i;o=i=le(e,n,n.mesh?[n.mesh]:n.meshes,r,n.babylonNode)}else if(!n.light||n.babylonNode||e.importOnlyMeshes){if(n.camera&&!n.babylonNode&&!e.importOnlyMeshes){var s=e.cameras[n.camera];if(s){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===s.type){var l=new t.FreeCamera(n.camera,t.Vector3.Zero(),e.scene,!1);l.name=n.name||"",l.mode=t.Camera.ORTHOGRAPHIC_CAMERA,l.attachControl(),o=l,l._parentContainer=e.assetContainer}else if("perspective"===s.type){var u=s[s.type],c=new t.FreeCamera(n.camera,t.Vector3.Zero(),e.scene,!1);c.name=n.name||"",c.attachControl(),u.aspectRatio||(u.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),u.znear&&u.zfar&&(c.maxZ=u.zfar,c.minZ=u.znear),o=c,c._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var f=e.lights[n.light];if(f)if("ambient"===f.type){var h=f[f.type],d=new t.HemisphericLight(n.light,t.Vector3.Zero(),e.scene);d.name=n.name||"",h.color&&(d.diffuse=t.Color3.FromArray(h.color)),o=d}else if("directional"===f.type){var p=f[f.type],m=new t.DirectionalLight(n.light,t.Vector3.Zero(),e.scene);m.name=n.name||"",p.color&&(m.diffuse=t.Color3.FromArray(p.color)),o=m}else if("point"===f.type){var _=f[f.type],g=new t.PointLight(n.light,t.Vector3.Zero(),e.scene);g.name=n.name||"",_.color&&(g.diffuse=t.Color3.FromArray(_.color)),o=g}else if("spot"===f.type){var b=f[f.type],y=new t.SpotLight(n.light,t.Vector3.Zero(),t.Vector3.Zero(),0,0,e.scene);y.name=n.name||"",b.color&&(y.diffuse=t.Color3.FromArray(b.color)),b.fallOfAngle&&(y.angle=b.fallOfAngle),b.fallOffExponent&&(y.exponent=b.fallOffExponent),o=y}}if(!n.jointName){if(n.babylonNode)return n.babylonNode;if(null===o){e.scene._blockEntityCollection=!!e.assetContainer;var v=new t.Mesh(n.name||"",e.scene);v._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,n.babylonNode=v,o=v}}if(null!==o){if(n.matrix&&o instanceof t.Mesh)!function(e,n){if(n.matrix){var r=new t.Vector3(0,0,0),o=new t.Quaternion,a=new t.Vector3(0,0,0);t.Matrix.FromArray(n.matrix).decompose(a,o,r),ue(e,r,o,a)}else n.translation&&n.rotation&&n.scale&&ue(e,t.Vector3.FromArray(n.translation),t.Quaternion.FromArray(n.rotation),t.Vector3.FromArray(n.scale));e.computeWorldMatrix(!0)}(o,n);else{var T=n.translation||[0,0,0],x=n.rotation||[0,0,0,1],A=n.scale||[1,1,1];ue(o,t.Vector3.FromArray(T),t.Quaternion.FromArray(x),t.Vector3.FromArray(A))}o.updateCache(!0),n.babylonNode=o}return o},fe=function(e,t,n,r){void 0===r&&(r=!1);var o=e.nodes[t],a=null;if(r=!(e.importOnlyMeshes&&!r&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&r&&null!==(a=ce(e,o,t))&&(a.id=t,a.parent=n),o.children)for(var i=0;i<o.children.length;i++)fe(e,o.children[i],a,r)},he=function(e){var n=e.currentScene;if(n)for(var r=0;r<n.nodes.length;r++)fe(e,n.nodes[r],null);else for(var o in e.scenes)for(n=e.scenes[o],r=0;r<n.nodes.length;r++)fe(e,n.nodes[r],null);for(function(e){for(var n in e.animations){var r=e.animations[n];if(r.channels&&r.samplers)for(var o=null,a=0;a<r.channels.length;a++){var i=r.channels[a],s=r.samplers[i.sampler];if(s){var l=void 0,u=void 0;r.parameters?(l=r.parameters[s.input],u=r.parameters[s.output]):(l=s.input,u=s.output);var c=Y.GetBufferFromAccessor(e,e.accessors[l]),f=Y.GetBufferFromAccessor(e,e.accessors[u]),h=i.target.id,d=e.scene.getNodeById(h);if(null===d&&(d=e.scene.getNodeByName(h)),null!==d){var p=d instanceof t.Bone,m=i.target.path,_=Z.indexOf(m);-1!==_&&(m=$[_]);var g=t.Animation.ANIMATIONTYPE_MATRIX;p||("rotationQuaternion"===m?(g=t.Animation.ANIMATIONTYPE_QUATERNION,d.rotationQuaternion=new t.Quaternion):g=t.Animation.ANIMATIONTYPE_VECTOR3);var b=null,y=[],v=0,T=!1;p&&o&&o.getKeys().length===c.length&&(b=o,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,b=new t.Animation(n,p?"_matrix":m,1,g,t.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var x=0;x<c.length;x++){var A=void 0;if("rotationQuaternion"===m?(A=t.Quaternion.FromArray([f[v],f[v+1],f[v+2],f[v+3]]),v+=4):(A=t.Vector3.FromArray([f[v],f[v+1],f[v+2]]),v+=3),p){var w=d,O=t.Vector3.Zero(),C=new t.Quaternion,M=t.Vector3.Zero(),E=w.getBaseMatrix();T&&o&&(E=o.getKeys()[x].value),E.decompose(M,C,O),"position"===m?O=A:"rotationQuaternion"===m?C=A:M=A,A=t.Matrix.Compose(M,C,O)}T?o&&(o.getKeys()[x].value=A):y.push({frame:c[x],value:A})}!T&&b&&(b.setKeys(y),d.animations.push(b)),o=b,e.scene.stopAnimation(d),e.scene.beginAnimation(d,0,c[c.length-1],!0,1)}else t.Tools.Warn("Creating animation named "+n+". But cannot find node named "+h+" to attach to")}}}}(e),r=0;r<e.scene.skeletons.length;r++){var a=e.scene.skeletons[r];e.scene.beginAnimation(a,0,Number.MAX_VALUE,!0,1)}},de=function(e,t,n){for(var r in t.uniforms){var o=t.uniforms[r],a=t.parameters[o];if(e.currentIdentifier===r&&a.semantic&&!a.source&&!a.node){var i=J.indexOf(a.semantic);if(-1!==i)return delete n[r],Q[i]}}return e.currentIdentifier},pe=function(e){for(var t in e.materials)ge.LoadMaterialAsync(e,t,function(){},function(){})},me=function(){function e(){}return e.CreateRuntime=function(e,t,n){var r={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:n,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&ee(e.extensions,"extensions",r),e.extensionsUsed&&ee(e.extensionsUsed,"extensionsUsed",r),e.buffers&&function(e,t){for(var n in e){var r=e[n];t.buffers[n]=r,t.buffersCount++}}(e.buffers,r),e.bufferViews&&ee(e.bufferViews,"bufferViews",r),e.accessors&&ee(e.accessors,"accessors",r),e.meshes&&ee(e.meshes,"meshes",r),e.lights&&ee(e.lights,"lights",r),e.cameras&&ee(e.cameras,"cameras",r),e.nodes&&ee(e.nodes,"nodes",r),e.images&&ee(e.images,"images",r),e.textures&&ee(e.textures,"textures",r),e.shaders&&function(e,t){for(var n in e){var r=e[n];t.shaders[n]=r,t.shaderscount++}}(e.shaders,r),e.programs&&ee(e.programs,"programs",r),e.samplers&&ee(e.samplers,"samplers",r),e.techniques&&ee(e.techniques,"techniques",r),e.materials&&ee(e.materials,"materials",r),e.animations&&ee(e.animations,"animations",r),e.skins&&ee(e.skins,"skins",r),e.scenes&&(r.scenes=e.scenes),e.scene&&e.scenes&&(r.currentScene=e.scenes[e.scene]),r},e.LoadBufferAsync=function(e,n,r,o,a){var i=e.buffers[n];t.Tools.IsBase64(i.uri)?setTimeout(function(){return r(new Uint8Array(t.Tools.DecodeBase64(i.uri)))}):t.Tools.LoadFile(e.rootUrl+i.uri,function(e){return r(new Uint8Array(e))},a,void 0,!0,function(e){e&&o(e.status+" "+e.statusText)})},e.LoadTextureBufferAsync=function(e,n,r,o){var a=e.textures[n];if(a&&a.source)if(a.babylonTexture)r(null);else{var i=e.images[a.source];t.Tools.IsBase64(i.uri)?setTimeout(function(){return r(new Uint8Array(t.Tools.DecodeBase64(i.uri)))}):t.Tools.LoadFile(e.rootUrl+i.uri,function(e){return r(new Uint8Array(e))},void 0,void 0,!0,function(e){e&&o(e.status+" "+e.statusText)})}else o("")},e.CreateTextureAsync=function(e,n,r,o){var a=e.textures[n];if(a.babylonTexture)o(a.babylonTexture);else{var i=e.samplers[a.sampler],s=i.minFilter===K.NEAREST_MIPMAP_NEAREST||i.minFilter===K.NEAREST_MIPMAP_LINEAR||i.minFilter===K.LINEAR_MIPMAP_NEAREST||i.minFilter===K.LINEAR_MIPMAP_LINEAR,l=t.Texture.BILINEAR_SAMPLINGMODE,u=null==r?new Blob:new Blob([t.GetBlobBufferSource(r)]),c=URL.createObjectURL(u),f=function(){return URL.revokeObjectURL(c)},h=new t.Texture(c,e.scene,!s,!0,l,f,f);void 0!==i.wrapS&&(h.wrapU=Y.GetWrapMode(i.wrapS)),void 0!==i.wrapT&&(h.wrapV=Y.GetWrapMode(i.wrapT)),h.name=n,a.babylonTexture=h,o(h)}},e.LoadShaderStringAsync=function(e,n,r,o){var a=e.shaders[n];if(t.Tools.IsBase64(a.uri)){var i=atob(a.uri.split(",")[1]);r&&r(i)}else t.Tools.LoadFile(e.rootUrl+a.uri,r,void 0,void 0,!1,function(e){e&&o&&o(e.status+" "+e.statusText)})},e.LoadMaterialAsync=function(e,n,r,o){var a=e.materials[n];if(a.technique){var i=e.techniques[a.technique];if(!i){e.scene._blockEntityCollection=!!e.assetContainer;var s=new t.StandardMaterial(n,e.scene);return s._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,s.diffuseColor=new t.Color3(.5,.5,.5),s.sideOrientation=t.Material.CounterClockWiseSideOrientation,void r(s)}var l=e.programs[i.program],u=i.states,c=t.Effect.ShadersStore[l.vertexShader+"VertexShader"],f=t.Effect.ShadersStore[l.fragmentShader+"PixelShader"],h="",d="",p=new X(c),m=new X(f),_={},g=[],b=[],y=[];for(var v in i.uniforms){var T=i.uniforms[v],x=i.parameters[T];if(_[v]=x,!x.semantic||x.node||x.source)x.type===D.SAMPLER_2D?y.push(v):g.push(v);else{var A=J.indexOf(x.semantic);-1!==A?(g.push(Q[A]),delete _[v]):g.push(v)}}for(var w in i.attributes){var O=i.attributes[w];if((E=i.parameters[O]).semantic){var C=ne(E);C&&b.push(C)}}for(;!p.isEnd()&&p.getNextToken();)if(p.currentToken===q.IDENTIFIER){var M=!1;for(var w in i.attributes){O=i.attributes[w];var E=i.parameters[O];if(p.currentIdentifier===w&&E.semantic){h+=ne(E),M=!0;break}}M||(h+=de(p,i,_))}else h+=p.currentString;for(;!m.isEnd()&&m.getNextToken();)m.currentToken===q.IDENTIFIER?d+=de(m,i,_):d+=m.currentString;var R={vertex:l.vertexShader+n,fragment:l.fragmentShader+n},F={attributes:b,uniforms:g,samplers:y,needAlphaBlending:u&&u.enable&&-1!==u.enable.indexOf(3042)};t.Effect.ShadersStore[l.vertexShader+n+"VertexShader"]=h,t.Effect.ShadersStore[l.fragmentShader+n+"PixelShader"]=d;var L=new t.ShaderMaterial(n,e.scene,R,F);if(L.onError=function(e,t,n){return function(r,o){t.dispose(!0),n("Cannot compile program named "+e.name+". Error: "+o+". Default material will be applied")}}(l,L,o),L.onCompiled=function(e,t,n,r,o,a){return function(i){!function(e,t,n,r,o){var a=r.values||n.parameters,i=n.uniforms,s=function(n){var s=o[n],l=s.type,u=a[i[n]];if(void 0===u&&(u=s.value),!u)return"continue";var c=function(e){return function(n){s.value&&e&&(t.setTexture(e,n),delete o[e])}};l===D.SAMPLER_2D?ge.LoadTextureAsync(e,r.values?u:s.value,c(n),function(){return c(null)}):s.value&&Y.SetUniform(t,n,r.values?u:s.value,l)&&delete o[n]};for(var l in o)s(l)}(e,t,n,r,o),t.onBind=function(i){!function(e,t,n,r,o,a,i){var s=a.values||o.parameters;for(var l in n){var u=n[l],c=u.type;if(c===D.FLOAT_MAT2||c===D.FLOAT_MAT3||c===D.FLOAT_MAT4)if(!u.semantic||u.source||u.node){if(u.semantic&&(u.source||u.node)){var f=t.scene.getNodeByName(u.source||u.node||"");if(null===f&&(f=t.scene.getNodeById(u.source||u.node||"")),null===f)continue;Y.SetMatrix(t.scene,f,u,l,r.getEffect())}}else Y.SetMatrix(t.scene,e,u,l,r.getEffect());else{var h=s[o.uniforms[l]];if(!h)continue;if(c===D.SAMPLER_2D){var d=t.textures[a.values?h:u.value].babylonTexture;if(null==d)continue;r.getEffect().setTexture(l,d)}else Y.SetUniform(r.getEffect(),l,h,c)}}i(r)}(i,e,o,t,n,r,a)}}}(e,L,i,a,_,r),L.sideOrientation=t.Material.CounterClockWiseSideOrientation,u&&u.functions){var P=u.functions;P.cullFace&&P.cullFace[0]!==U.BACK&&(L.backFaceCulling=!1);var S=P.blendFuncSeparate;S&&(S[0]===W.SRC_ALPHA&&S[1]===W.ONE_MINUS_SRC_ALPHA&&S[2]===W.ONE&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_COMBINE:S[0]===W.ONE&&S[1]===W.ONE&&S[2]===W.ZERO&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_ONEONE:S[0]===W.SRC_ALPHA&&S[1]===W.ONE&&S[2]===W.ZERO&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_ADD:S[0]===W.ZERO&&S[1]===W.ONE_MINUS_SRC_COLOR&&S[2]===W.ONE&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_SUBTRACT:S[0]===W.DST_COLOR&&S[1]===W.ZERO&&S[2]===W.ONE&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_MULTIPLY:S[0]===W.SRC_ALPHA&&S[1]===W.ONE_MINUS_SRC_COLOR&&S[2]===W.ONE&&S[3]===W.ONE&&(L.alphaMode=t.Constants.ALPHA_MAXIMIZED))}}else o&&o("No technique found.")},e}(),_e=function(){function e(){}return e.RegisterExtension=function(n){e.Extensions[n.name]?t.Tools.Error('Tool with the same name "'+n.name+'" already exists'):e.Extensions[n.name]=n},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,n,r,o,a,i,s,l){var u=this;return n.useRightHandedSystem=!0,ge.LoadRuntimeAsync(n,r,o,function(n){n.assetContainer=a,n.importOnlyMeshes=!0,""===e?n.importMeshesNames=[]:"string"==typeof e?n.importMeshesNames=[e]:!e||e instanceof Array?(n.importMeshesNames=[],t.Tools.Warn("Argument meshesNames must be of type string or string[]")):n.importMeshesNames=[e],u._createNodes(n);var r=[],o=[];for(var s in n.nodes){var l=n.nodes[s];l.babylonNode instanceof t.AbstractMesh&&r.push(l.babylonNode)}for(var c in n.skins){var f=n.skins[c];f.babylonSkeleton instanceof t.Skeleton&&o.push(f.babylonSkeleton)}u._loadBuffersAsync(n,function(){u._loadShadersAsync(n,function(){pe(n),he(n),!k.IncrementalLoading&&i&&i(r,o)})}),k.IncrementalLoading&&i&&i(r,o)},l),!0},e.prototype.importMeshAsync=function(e,t,n,r,o,a){var i=this;return new Promise(function(s,l){i._importMeshAsync(e,t,r,o,n,function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[],spriteManagers:[]})},a,function(e){l(new Error(e))})})},e.prototype._loadAsync=function(e,t,n,r,o,a){var i=this;e.useRightHandedSystem=!0,ge.LoadRuntimeAsync(e,t,n,function(e){ge.LoadRuntimeExtensionsAsync(e,function(){i._createNodes(e),i._loadBuffersAsync(e,function(){i._loadShadersAsync(e,function(){pe(e),he(e),k.IncrementalLoading||r()})}),k.IncrementalLoading&&r()},a)},a)},e.prototype.loadAsync=function(e,t,n,r){return g(this,void 0,void 0,function(){var o=this;return b(this,function(a){switch(a.label){case 0:return[4,new Promise(function(a,i){o._loadAsync(e,t,n,function(){a()},r,function(e){i(new Error(e))})})];case 1:return[2,a.sent()]}})})},e.prototype._loadShadersAsync=function(e,n){var r=!1,o=function(r,o){ge.LoadShaderStringAsync(e,r,function(a){a instanceof ArrayBuffer||(e.loadedShaderCount++,a&&(t.Effect.ShadersStore[r+(o.type===V.VERTEX?"VertexShader":"PixelShader")]=a),e.loadedShaderCount===e.shaderscount&&n())},function(){t.Tools.Error("Error when loading shader program named "+r+" located at "+o.uri)})};for(var a in e.shaders){r=!0;var i=e.shaders[a];i?o.bind(this,a,i)():t.Tools.Error("No shader named: "+a)}r||n()},e.prototype._loadBuffersAsync=function(e,n){var r=!1,o=function(r,o){ge.LoadBufferAsync(e,r,function(a){e.loadedBufferCount++,a&&(a.byteLength!=e.buffers[r].byteLength&&t.Tools.Error("Buffer named "+r+" is length "+a.byteLength+". Expected: "+o.byteLength),e.loadedBufferViews[r]=a),e.loadedBufferCount===e.buffersCount&&n()},function(){t.Tools.Error("Error when loading buffer named "+r+" located at "+o.uri)})};for(var a in e.buffers){r=!0;var i=e.buffers[a];i?o.bind(this,a,i)():t.Tools.Error("No buffer named: "+a)}r||n()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)fe(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)fe(e,t.nodes[n],null)},e.Extensions={},e}(),ge=function(){function e(e){this._name=e}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),e.prototype.loadRuntimeAsync=function(e,t,n,r,o){return!1},e.prototype.loadRuntimeExtensionsAsync=function(e,t,n){return!1},e.prototype.loadBufferAsync=function(e,t,n,r,o){return!1},e.prototype.loadTextureBufferAsync=function(e,t,n,r){return!1},e.prototype.createTextureAsync=function(e,t,n,r,o){return!1},e.prototype.loadShaderStringAsync=function(e,t,n,r){return!1},e.prototype.loadMaterialAsync=function(e,t,n,r){return!1},e.LoadRuntimeAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.loadRuntimeAsync(t,n,r,o,a)},function(){setTimeout(function(){o&&o(me.CreateRuntime(n.json,t,r))})})},e.LoadRuntimeExtensionsAsync=function(t,n,r){e._ApplyExtensions(function(e){return e.loadRuntimeExtensionsAsync(t,n,r)},function(){setTimeout(function(){n()})})},e.LoadBufferAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.loadBufferAsync(t,n,r,o,a)},function(){me.LoadBufferAsync(t,n,r,o,a)})},e.LoadTextureAsync=function(t,n,r,o){e._LoadTextureBufferAsync(t,n,function(a){a&&e._CreateTextureAsync(t,n,a,r,o)},o)},e.LoadShaderStringAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadShaderStringAsync(t,n,r,o)},function(){me.LoadShaderStringAsync(t,n,r,o)})},e.LoadMaterialAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadMaterialAsync(t,n,r,o)},function(){me.LoadMaterialAsync(t,n,r,o)})},e._LoadTextureBufferAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadTextureBufferAsync(t,n,r,o)},function(){me.LoadTextureBufferAsync(t,n,r,o)})},e._CreateTextureAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.createTextureAsync(t,n,r,o,a)},function(){me.CreateTextureAsync(t,n,r,o)})},e._ApplyExtensions=function(e,t){for(var n in _e.Extensions)if(e(_e.Extensions[n]))return;t()},e}();k._CreateGLTF1Loader=function(){return new _e};var be=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return m(t,e),t.prototype.loadRuntimeAsync=function(e,t,n,r){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,r(me.CreateRuntime(t.json,e,n)),0))},t.prototype.loadBufferAsync=function(e,t,n,r){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(n,function(e){return r(e.message)}),!0)},t.prototype.loadTextureBufferAsync=function(e,t,n){var r=e.textures[t],o=e.images[r.source];if(!o.extensions||!(this.name in o.extensions))return!1;var a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return n(Y.GetBufferFromBufferView(e,i,0,i.byteLength,G.UNSIGNED_BYTE)),!0},t.prototype.loadShaderStringAsync=function(e,t,n){var r=e.shaders[t];if(!r.extensions||!(this.name in r.extensions))return!1;var o=r.extensions[this.name],a=e.bufferViews[o.bufferView],i=Y.GetBufferFromBufferView(e,a,0,a.byteLength,G.UNSIGNED_BYTE);return setTimeout(function(){var e=Y.DecodeBufferToText(i);n(e)}),!0},t}(ge);_e.RegisterExtension(new be);var ye=function(e){function n(){return e.call(this,"KHR_materials_common")||this}return m(n,e),n.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var n=e.extensions[this.name];if(!n)return!1;var r=n.lights;if(r)for(var o in r){var a=r[o];switch(a.type){case"ambient":var i=new t.HemisphericLight(a.name,new t.Vector3(0,1,0),e.scene),s=a.ambient;s&&(i.diffuse=t.Color3.FromArray(s.color||[1,1,1]));break;case"point":var l=new t.PointLight(a.name,new t.Vector3(10,10,10),e.scene),u=a.point;u&&(l.diffuse=t.Color3.FromArray(u.color||[1,1,1]));break;case"directional":var c=new t.DirectionalLight(a.name,new t.Vector3(0,-1,0),e.scene),f=a.directional;f&&(c.diffuse=t.Color3.FromArray(f.color||[1,1,1]));break;case"spot":var h=a.spot;h&&(new t.SpotLight(a.name,new t.Vector3(0,10,0),new t.Vector3(0,-1,0),h.fallOffAngle||Math.PI,h.fallOffExponent||0,e.scene).diffuse=t.Color3.FromArray(h.color||[1,1,1]));break;default:t.Tools.Warn('GLTF Material Common extension: light type "'+a.type+"” not supported")}}return!1},n.prototype.loadMaterialAsync=function(e,n,r,o){var a=e.materials[n];if(!a||!a.extensions)return!1;var i=a.extensions[this.name];if(!i)return!1;var s=new t.StandardMaterial(n,e.scene);return s.sideOrientation=t.Material.CounterClockWiseSideOrientation,"CONSTANT"===i.technique&&(s.disableLighting=!0),s.backFaceCulling=void 0!==i.doubleSided&&!i.doubleSided,s.alpha=void 0===i.values.transparency?1:i.values.transparency,s.specularPower=void 0===i.values.shininess?0:i.values.shininess,"string"==typeof i.values.ambient?this._loadTexture(e,i.values.ambient,s,"ambientTexture",o):s.ambientColor=t.Color3.FromArray(i.values.ambient||[0,0,0]),"string"==typeof i.values.diffuse?this._loadTexture(e,i.values.diffuse,s,"diffuseTexture",o):s.diffuseColor=t.Color3.FromArray(i.values.diffuse||[0,0,0]),"string"==typeof i.values.emission?this._loadTexture(e,i.values.emission,s,"emissiveTexture",o):s.emissiveColor=t.Color3.FromArray(i.values.emission||[0,0,0]),"string"==typeof i.values.specular?this._loadTexture(e,i.values.specular,s,"specularTexture",o):s.specularColor=t.Color3.FromArray(i.values.specular||[0,0,0]),!0},n.prototype._loadTexture=function(e,t,n,r,o){me.LoadTextureBufferAsync(e,t,function(o){me.CreateTextureAsync(e,t,o,function(e){return n[r]=e})},o)},n}(ge);_e.RegisterExtension(new ye);var ve={__proto__:null,get EBlendingFunction(){return W},get EComponentType(){return G},get ECullingType(){return U},get EParameterType(){return D},get EShaderType(){return V},get ETextureFilterType(){return K},get ETextureFormat(){return j},get ETextureWrapMode(){return H},GLTFBinaryExtension:be,GLTFLoader:_e,GLTFLoaderBase:me,GLTFLoaderExtension:ge,GLTFMaterialsCommonExtension:ye,GLTFUtils:Y},Te=new Map,xe=Te;function Ae(e,n,r){we(e)&&t.Logger.Warn("Extension with the name '".concat(e,"' already exists")),Te.set(e,{isGLTFExtension:n,factory:r})}function we(e){return Te.delete(e)}var Oe=[{regex:new RegExp("^/nodes/\\d+/extensions/")}],Ce=function(){function e(e,t){this._gltf=e,this._infoTree=t}return e.prototype.convert=function(e){var t=this._gltf,n=this._infoTree,r=void 0;if(!e.startsWith("/"))throw new Error("Path must start with a /");var o=e.split("/");if(o.shift(),o[o.length-1].includes(".length")){var a=o[o.length-1].split(".");o.pop(),o.push.apply(o,a)}for(var i=!1,s=0,l=o;s<l.length;s++){var u=l[s],c="length"===u;if(c&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(i=!0),n.__array__&&!c)n=n.__array__;else if(!(n=n[u]))throw new Error("Path ".concat(e," is invalid"));if(!i)if(void 0===t){if(!Oe.find(function(t){return t.regex.test(e)}))throw new Error("Path ".concat(e," is invalid"))}else c||(t=null==t?void 0:t[u]);(n.__target__||c)&&(r=t)}return{object:r,info:n}},e}(),Me={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 n,r,o;return t.Matrix.Compose(null===(n=e._babylonTransformNode)||void 0===n?void 0:n.scaling,null===(r=e._babylonTransformNode)||void 0===r?void 0:r.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 n,r,o,a,i,s,l,u=t.Matrix.Identity(),c=e.parent;c&&c.parent;)c=c.parent;var f=(null===(n=e._babylonTransformNode)||void 0===n?void 0:n.position._isDirty)||(null===(o=null===(r=e._babylonTransformNode)||void 0===r?void 0:r.rotationQuaternion)||void 0===o?void 0:o._isDirty)||(null===(a=e._babylonTransformNode)||void 0===a?void 0:a.scaling._isDirty);if(c){var h=null===(i=c._babylonTransformNode)||void 0===i?void 0:i.computeWorldMatrix(!0).invert();h&&(null===(l=null===(s=e._babylonTransformNode)||void 0===s?void 0:s.computeWorldMatrix(f))||void 0===l||l.multiplyToRef(h,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 n,r;return null===(r=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0])||void 0===r?void 0:r.intensity},getTarget:function(e){var n;return null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0]},set:function(e,n){if(n._babylonTransformNode){var r=n._babylonTransformNode.getChildren(function(e){return e instanceof t.SpotLight},!0)[0];r&&(r.intensity=e)}}},color:{type:"Color3",get:function(e){var n,r;return null===(r=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0])||void 0===r?void 0:r.diffuse},getTarget:function(e){var n;return null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0]},set:function(e,n){if(n._babylonTransformNode){var r=n._babylonTransformNode.getChildren(function(e){return e instanceof t.SpotLight},!0)[0];r&&(r.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})}}}}}},Ee={__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var n,r,o,a;return new t.Vector2(null!==(r=null===(n=e._babylonCamera)||void 0===n?void 0:n.orthoLeft)&&void 0!==r?r: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 n,r,o,a;return new t.Vector2(null!==(r=null===(n=e._babylonCamera)||void 0===n?void 0:n.orthoBottom)&&void 0!==r?r: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"}]}}}},Re={__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).emissiveColor},set:function(e,t,n,r){return Pe(t,0,r).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:Se("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=Le(e,n,"bumpTexture"))||void 0===r?void 0:r.level},set:function(e,t,n,r){var o=Le(t,r,"bumpTexture");o&&(o.level=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:Se("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return Pe(e,0,n).ambientTextureStrength},set:function(e,t,n,r){var o=Pe(t,0,r);o&&(o.ambientTextureStrength=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:Se("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,n,r){var o=Pe(e,0,r);return t.Color4.FromColor3(o.albedoColor,o.alpha)},set:function(e,t,n,r){var o=Pe(t,0,r);o.albedoColor.set(e.r,e.g,e.b),o.alpha=e.a},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:Se("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).metallic},set:function(e,t,n,r){var o=Pe(t,0,r);o&&(o.metallic=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).roughness},set:function(e,t,n,r){var o=Pe(t,0,r);o&&(o.roughness=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:Se("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return Pe(e,0,n).anisotropy.intensity},set:function(e,t,n,r){Pe(t,0,r).anisotropy.intensity=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return Pe(e,0,n).anisotropy.angle},set:function(e,t,n,r){Pe(t,0,r).anisotropy.angle=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:Se("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).clearCoat.intensity},set:function(e,t,n,r){Pe(t,0,r).clearCoat.intensity=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).clearCoat.roughness},set:function(e,t,n,r){Pe(t,0,r).clearCoat.roughness=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:Se("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=Pe(e,0,n).clearCoat.bumpTexture)||void 0===r?void 0:r.level},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:Se("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:Se("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.dispersion},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return Pe(e,0,n).emissiveIntensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return Pe(e,0,n).indexOfRefraction},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.intensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.indexOfRefraction},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:Se("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.maximumThickness},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.minimumThickness},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:Se("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).sheen.color},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:Se("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).sheen.intensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:Se("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).metallicF0Factor},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).metallicReflectanceColor},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:Se("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:Se("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.refractionIntensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:Se("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.translucencyIntensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:Se("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).subSurface.translucencyColor},getTarget:Pe,set:function(e,t,n,r){var o;return e&&(null===(o=Pe(t,0,r).subSurface.translucencyColor)||void 0===o?void 0:o.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:Se("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).subSurface.tintColor},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.tintColorAtDistance},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.maximumThickness},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:Se("subSurface","thicknessTexture")}}}}}},Fe={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 n;return e._babylonTexture&&t.Quaternion.FromRotationMatrix(null===(n=e._babylonTexture)||void 0===n?void 0:n.getReflectionTextureMatrix())},set:function(e,n){var r;n._babylonTexture&&((null===(r=n._babylonTexture.getScene())||void 0===r?void 0:r.useRightHandedSystem)||(e=t.Quaternion.Inverse(e)),t.Matrix.FromQuaternionToRef(e,n._babylonTexture.getReflectionTextureMatrix()))},getTarget:function(e){return e._babylonTexture}}}}}};function Le(e,t,n,r){var o=Pe(e);return r?o[n][r]:o[n]}function Pe(e,n,r){var o,a,i;return null===(i=null===(o=e._data)||void 0===o?void 0:o[null!==(a=null==r?void 0:r.fillMode)&&void 0!==a?a:t.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function Se(e,n){return{offset:{componentsCount:2,type:"Vector2",get:function(r,o,a){var i=Le(r,0,e,n);return new t.Vector2(null==i?void 0:i.uOffset,null==i?void 0:i.vOffset)},getTarget:Pe,set:function(t,r,o,a){var i=Le(r,0,e,n);i.uOffset=t.x,i.vOffset=t.y},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".uOffset")},function(){return"".concat(e).concat(n?"."+n:"",".vOffset")}]},rotation:{type:"number",get:function(t,r,o){var a;return null===(a=Le(t,0,e,n))||void 0===a?void 0:a.wAng},getTarget:Pe,set:function(t,r,o,a){return Le(r,0,e,n).wAng=t},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(r,o,a){var i=Le(r,0,e,n);return new t.Vector2(null==i?void 0:i.uScale,null==i?void 0:i.vScale)},getTarget:Pe,set:function(t,r,o,a){var i=Le(r,0,e,n);i.uScale=t.x,i.vScale=t.y},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".uScale")},function(){return"".concat(e).concat(n?"."+n:"",".vScale")}]}}}var Ne={cameras:Ee,nodes:Me,materials:Re,extensions:Fe,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 Ie(e){return new Ce(e,Ne)}function Be(e){for(var t=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),n=Ne,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 ke(e,t){for(var n=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),r=Ne,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 Ge(e,t){for(var n=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),r=Ne,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)}var Ve=new t.Lazy(function(){return Promise.resolve(BABYLON)}),De=new t.Lazy(function(){return Promise.resolve().then(function(){return Qe})}),He=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 Ke(e){if(e.min&&e.max){var n=e.min,r=e.max,o=t.TmpVectors.Vector3[0].copyFromFloats(n[0],n[1],n[2]),a=t.TmpVectors.Vector3[1].copyFromFloats(r[0],r[1],r[2]);if(e.normalized&&5126!==e.componentType){var i=1;switch(e.componentType){case 5120:i=127;break;case 5121:i=255;break;case 5122:i=32767;break;case 5123:i=65535}var s=1/i;o.scaleInPlace(s),a.scaleInPlace(s)}return new t.BoundingInfo(o,a)}return null}var je=function(){function n(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._materialAdapters=new Set,this._pbrMaterialImpl=null,this._parent=e}return n.prototype.isMatchingMaterialType=function(e){return!(!e||!this._pbrMaterialImpl)&&e instanceof this._pbrMaterialImpl.materialClass},n.RegisterExtension=function(e,t){Ae(e,!1,t)},n.UnregisterExtension=function(e){return we(e)},Object.defineProperty(n.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rootUrl",{get:function(){return this._rootUrl},enumerable:!1,configurable:!0}),n.prototype._getOrCreateMaterialAdapter=function(e){var t=this._materialAdapterCache.get(e);if(!t){if(!this._pbrMaterialImpl)throw new Error("Appropriate material adapter class not found");var n=t=new this._pbrMaterialImpl.adapterClass(e);this._materialAdapterCache.set(e,n),this._materialAdapters.add(n)}return t},n.prototype.dispose=function(){var e;if(!this._disposed){this._disposed=!0,this._completePromises.length=0,this._extensions.forEach(function(e){return e.dispose&&e.dispose()}),this._extensions.length=0;for(var t=0,n=Array.from(this._materialAdapters);t<n.length;t++){var r=n[t];null===(e=r.finalize)||void 0===e||e.call(r)}this._materialAdapters.clear(),this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose()}},n.prototype.importMeshAsync=function(e,t,n,r,o,a){return g(this,arguments,void 0,function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),b(this,function(a){switch(a.label){case 0:return[4,Promise.resolve().then(function(){return g(s,void 0,void 0,function(){var a,s,l,u,c,f=this;return b(this,function(h){switch(h.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,h.sent()]}})})})];case 1:return[2,a.sent()]}})})},n.prototype.loadAsync=function(e,t,n,r){return g(this,arguments,void 0,function(e,t,n,r,o){return void 0===o&&(o=""),b(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()]}})})},n.prototype._loadAsync=function(n,r,o,a){return g(this,void 0,void 0,function(){var i=this;return b(this,function(s){switch(s.label){case 0:return[4,Promise.resolve().then(function(){return g(i,void 0,void 0,function(){var i,s,l,u,c,f,h,d,p,m,_,g,y,v,T=this;return b(this,function(b){switch(b.label){case 0:return this._rootUrl=n,this._uniqueRootUrl=!n.startsWith("file:")&&r?n:"".concat(n).concat(Date.now(),"/"),this._fileName=r,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:return b.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(i=this,y={},[4,Promise.resolve(BABYLON)]):[3,4];case 2:return y.materialClass=b.sent().OpenPBRMaterial,[4,Promise.resolve().then(function(){return $e})];case 3:return i._pbrMaterialImpl=(y.adapterClass=b.sent().OpenPBRMaterialLoadingAdapter,y),[3,7];case 4:return s=this,v={},[4,Promise.resolve(BABYLON)];case 5:return v.materialClass=b.sent().PBRMaterial,[4,Promise.resolve().then(function(){return tt})];case 6:s._pbrMaterialImpl=(v.adapterClass=b.sent().PBRMaterialLoadingAdapter,v),b.label=7;case 7:if(l="".concat(e.GLTFLoaderState[e.GLTFLoaderState.LOADING]," => ").concat(e.GLTFLoaderState[e.GLTFLoaderState.READY]),u="".concat(e.GLTFLoaderState[e.GLTFLoaderState.LOADING]," => ").concat(e.GLTFLoaderState[e.GLTFLoaderState.COMPLETE]),this._parent._startPerformanceCounter(l),this._parent._startPerformanceCounter(u),this._parent._setState(e.GLTFLoaderState.LOADING),this._extensionsOnLoading(),c=new Array,f=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(o?c.push(this.loadSceneAsync("/nodes",{nodes:o,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(h=He.Get("/scene",this._gltf.scenes,this._gltf.scene||0),c.push(this.loadSceneAsync("/scenes/".concat(h.index),h)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(d=0;d<this._gltf.materials.length;++d)p=this._gltf.materials[d],m="/materials/"+d,_=t.Material.TriangleFillMode,c.push(this._loadMaterialAsync(m,p,null,_,function(){}));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=f:this._babylonScene._forceBlockMaterialDirtyMechanism(f),this._parent.compileMaterials&&c.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&c.push(this._compileShadowGeneratorsAsync()),g=Promise.all(c).then(function(){T._rootBabylonMesh&&T._rootBabylonMesh!==T._parent.customRootNode&&T._rootBabylonMesh.setEnabled(!0);for(var t=0,n=T._babylonScene.materials;t<n.length;t++){var r=n[t];void 0!==r.maxSimultaneousLights&&(r.maxSimultaneousLights=Math.max(r.maxSimultaneousLights,T._babylonScene.lights.length))}return T._extensionsOnReady(),T._parent._setState(e.GLTFLoaderState.READY),T._skipStartAnimationStep||T._startAnimations(),a()}),[4,g.then(function(n){return T._parent._endPerformanceCounter(l),t.Tools.SetImmediate(function(){T._disposed||Promise.all(T._completePromises).then(function(){T._parent._endPerformanceCounter(u),T._parent._setState(e.GLTFLoaderState.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()})}),n})];case 8:return[2,b.sent()]}})})}).catch(function(e){throw i._disposed||(i._parent.onErrorObservable.notifyObservers(e),i._parent.onErrorObservable.clear(),i.dispose()),e})];case 1:return[2,s.sent()]}})})},n.prototype._loadData=function(e){if(this._gltf=e.json,this._setupData(),e.bin){var n=this._gltf.buffers;if(n&&n[0]&&!n[0].uri){var r=n[0];(r.byteLength<e.bin.byteLength-3||r.byteLength>e.bin.byteLength)&&t.Logger.Warn("Binary buffer length (".concat(r.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else t.Logger.Warn("Unexpected BIN chunk")}},n.prototype._setupData=function(){if(He.Assign(this._gltf.accessors),He.Assign(this._gltf.animations),He.Assign(this._gltf.buffers),He.Assign(this._gltf.bufferViews),He.Assign(this._gltf.cameras),He.Assign(this._gltf.images),He.Assign(this._gltf.materials),He.Assign(this._gltf.meshes),He.Assign(this._gltf.nodes),He.Assign(this._gltf.samplers),He.Assign(this._gltf.scenes),He.Assign(this._gltf.skins),He.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]}}},n.prototype._loadExtensionsAsync=function(){return g(this,void 0,void 0,function(){var e,n,r,o,a,i,s,l,u,c,f,h=this;return b(this,function(d){switch(d.label){case 0:return e=[],xe.forEach(function(n,r){var o;!1===(null===(o=h.parent.extensionOptions[r])||void 0===o?void 0:o.enabled)?n.isGLTFExtension&&h.isExtensionUsed(r)&&t.Logger.Warn("Extension ".concat(r," is used but has been explicitly disabled.")):n.isGLTFExtension&&!h.isExtensionUsed(r)||e.push(g(h,void 0,void 0,function(){var e;return b(this,function(o){switch(o.label){case 0:return[4,n.factory(this)];case 1:return(e=o.sent()).name!==r&&t.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(r)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}})}))}),r=(n=(c=this._extensions).push).apply,o=[c],[4,Promise.all(e)];case 1:if(r.apply(n,o.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(a=function(e){if(!i._extensions.some(function(t){return t.name===e&&t.enabled})){if(!1===(null===(f=i.parent.extensionOptions[e])||void 0===f?void 0:f.enabled))throw new Error("Required extension ".concat(e," is disabled"));throw new Error("Required extension ".concat(e," is not available"))}},i=this,s=0,l=this._gltf.extensionsRequired;s<l.length;s++)u=l[s],a(u);return[2]}})})},n.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 r=new t.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=r,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var o={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case e.GLTFLoaderCoordinateSystemMode.AUTO:this._babylonScene.useRightHandedSystem||(o.rotation=[0,1,0,0],o.scale=[1,1,-1],n._LoadTransform(o,this._rootBabylonMesh));break;case e.GLTFLoaderCoordinateSystemMode.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(r),o},n.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=He.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(){})},n.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var n=0,r=e._primitiveBabylonMeshes;n<r.length;n++)t(r[n])},n.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},n.prototype._getMeshes=function(){var e=[];this._rootBabylonMesh instanceof t.AbstractMesh&&e.push(this._rootBabylonMesh);var n=this._gltf.nodes;if(n)for(var r=0,o=n;r<o.length;r++){var a=o[r];this._forEachPrimitive(a,function(t){e.push(t)})}return e},n.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},n.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},n.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},n.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case e.GLTFLoaderAnimationStartMode.NONE:break;case e.GLTFLoaderAnimationStartMode.FIRST:0!==(n=this._getAnimationGroups()).length&&n[0].start(!0);break;case e.GLTFLoaderAnimationStartMode.ALL:for(var n,r=0,o=n=this._getAnimationGroups();r<o.length;r++)o[r].start(!0);break;default:return void t.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},n.prototype.loadNodeAsync=function(e,r,o){var a=this;void 0===o&&(o=function(){});var i=this._extensionsLoadNodeAsync(e,r,o);if(i)return i;if(r._babylonTransformNode)throw new Error("".concat(e,": Invalid recursive node hierarchy"));var s=new Array;this.logOpen("".concat(e," ").concat(r.name||""));var l=function(t){if(n.AddPointerMetadata(t,e),n._LoadTransform(r,t),null!=r.camera){var i=He.Get("".concat(e,"/camera"),a._gltf.cameras,r.camera);s.push(a.loadCameraAsync("/cameras/".concat(i.index),i,function(e){e.parent=t,a._babylonScene.useRightHandedSystem||(t.scaling.x=-1)}))}if(r.children)for(var l=0,u=r.children;l<u.length;l++){var c=u[l],f=He.Get("".concat(e,"/children/").concat(c),a._gltf.nodes,c);s.push(a.loadNodeAsync("/nodes/".concat(f.index),f,function(e){e.parent=t}))}o(t)},u=null!=r.mesh,c=this._parent.loadSkins&&null!=r.skin;if(!u||c){var f=r.name||"node".concat(r.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var h=new t.TransformNode(f,this._babylonScene);h._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==r.mesh?r._babylonTransformNode=h:r._babylonTransformNodeForSkin=h,l(h)}if(u)if(c){var d=He.Get("".concat(e,"/mesh"),this._gltf.meshes,r.mesh);s.push(this._loadMeshAsync("/meshes/".concat(d.index),r,d,function(n){var o=r._babylonTransformNodeForSkin;n.metadata=t.deepMerge(o.metadata,n.metadata||{});var i=He.Get("".concat(e,"/skin"),a._gltf.skins,r.skin);s.push(a._loadSkinAsync("/skins/".concat(i.index),r,i,function(e){a._forEachPrimitive(r,function(t){t.skeleton=e}),a._postSceneLoadActions.push(function(){if(null!=i.skeleton){var e=He.Get("/skins/".concat(i.index,"/skeleton"),a._gltf.nodes,i.skeleton).parent;r.index===e.index?n.parent=o.parent:n.parent=e._babylonTransformNode}else n.parent=a._rootBabylonMesh;a._parent.onSkinLoadedObservable.notifyObservers({node:o,skinnedNode:n})})}))}))}else d=He.Get("".concat(e,"/mesh"),this._gltf.meshes,r.mesh),s.push(this._loadMeshAsync("/meshes/".concat(d.index),r,d,l));return this.logClose(),Promise.all(s).then(function(){return a._forEachPrimitive(r,function(e){var t=e;!t.isAnInstance&&t.geometry&&t.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)}),r._babylonTransformNode})},n.prototype._loadMeshAsync=function(e,n,r,o){var a=r.primitives;if(!a||!a.length)throw new Error("".concat(e,": Primitives are missing"));null==a[0].index&&He.Assign(a);var i=new Array;this.logOpen("".concat(e," ").concat(r.name||""));var s=n.name||"node".concat(n.index);if(1===a.length){var l=r.primitives[0];i.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(l.index),s,n,r,l,function(e){n._babylonTransformNode=e,n._primitiveBabylonMeshes=[e]}))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,n._babylonTransformNode=new t.TransformNode(s,this._babylonScene),n._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._primitiveBabylonMeshes=[];for(var u=0,c=a;u<c.length;u++)l=c[u],i.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(l.index),"".concat(s,"_primitive").concat(l.index),n,r,l,function(e){e.parent=n._babylonTransformNode,n._primitiveBabylonMeshes.push(e)}))}return o(n._babylonTransformNode),this.logClose(),Promise.all(i).then(function(){return n._babylonTransformNode})},n.prototype._loadMeshPrimitiveAsync=function(e,r,o,a,i,s){var l=this,u=this._extensionsLoadMeshPrimitiveAsync(e,r,o,a,i,s);if(u)return u;this.logOpen("".concat(e));var c,f,h=0===this._disableInstancedMesh&&this._parent.createInstances&&null==o.skin&&!a.primitives[0].targets;if(h&&i._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(c=i._instanceData.babylonSourceMesh.createInstance(r))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,f=i._instanceData.promise;else{var d=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var p=new t.Mesh(r,this._babylonScene);if(p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,p.sideOrientation=this._babylonScene.useRightHandedSystem?t.Material.CounterClockWiseSideOrientation:t.Material.ClockWiseSideOrientation,this._createMorphTargets(e,o,a,i,p),d.push(this._loadVertexDataAsync(e,i,p).then(function(t){return g(l,void 0,void 0,function(){var n=this;return b(this,function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(e,i,p,t).then(function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,t.applyToMesh(p),t._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1)})];case 1:return[2,r.sent()]}})})})),!this.parent.skipMaterials){var m=n._GetDrawMode(e,i.mode);if(null==i.material){var _=this._defaultBabylonMaterialData[m];_||(_=this._createDefaultMaterial("__GLTFLoader._default",m),this._parent.onMaterialLoadedObservable.notifyObservers(_),this._defaultBabylonMaterialData[m]=_),p.material=_}else{var y=He.Get("".concat(e,"/material"),this._gltf.materials,i.material);d.push(this._loadMaterialAsync("/materials/".concat(y.index),y,p,m,function(e){p.material=e}))}}f=Promise.all(d),h&&(i._instanceData={babylonSourceMesh:p,promise:f}),c=p}return n.AddPointerMetadata(c,e),this._parent.onMeshLoadedObservable.notifyObservers(c),s(c),this.logClose(),f.then(function(){return c})},n.prototype._loadVertexDataAsync=function(e,n,r){var o=this,a=this._extensionsLoadVertexDataAsync(e,n,r);if(a)return a;var i=n.attributes;if(!i)throw new Error("".concat(e,": Attributes are missing"));var s=new Array,l=new t.Geometry(r.name,this._babylonScene);if(null==n.indices)r.isUnIndexed=!0;else{var u=He.Get("".concat(e,"/indices"),this._gltf.accessors,n.indices);s.push(this._loadIndicesAccessorAsync("/accessors/".concat(u.index),u).then(function(e){l.setIndices(e)}))}var c=function(n,a,u){if(null!=i[n]){r._delayInfo=r._delayInfo||[],-1===r._delayInfo.indexOf(a)&&r._delayInfo.push(a);var c=He.Get("".concat(e,"/attributes/").concat(n),o._gltf.accessors,i[n]);s.push(o._loadVertexAccessorAsync("/accessors/".concat(c.index),c,a).then(function(e){if(e.getKind()===t.VertexBuffer.PositionKind&&!o.parent.alwaysComputeBoundingBox&&!r.skeleton){var n=Ke(c);n&&(l._boundingInfo=n,l.useBoundingInfoFromGeometry=!0)}l.setVerticesBuffer(e,c.count)})),a==t.VertexBuffer.MatricesIndicesExtraKind&&(r.numBoneInfluencers=8),u&&u(c)}};return c("POSITION",t.VertexBuffer.PositionKind),c("NORMAL",t.VertexBuffer.NormalKind),c("TANGENT",t.VertexBuffer.TangentKind),c("TEXCOORD_0",t.VertexBuffer.UVKind),c("TEXCOORD_1",t.VertexBuffer.UV2Kind),c("TEXCOORD_2",t.VertexBuffer.UV3Kind),c("TEXCOORD_3",t.VertexBuffer.UV4Kind),c("TEXCOORD_4",t.VertexBuffer.UV5Kind),c("TEXCOORD_5",t.VertexBuffer.UV6Kind),c("JOINTS_0",t.VertexBuffer.MatricesIndicesKind),c("WEIGHTS_0",t.VertexBuffer.MatricesWeightsKind),c("JOINTS_1",t.VertexBuffer.MatricesIndicesExtraKind),c("WEIGHTS_1",t.VertexBuffer.MatricesWeightsExtraKind),c("COLOR_0",t.VertexBuffer.ColorKind,function(e){"VEC4"===e.type&&(r.hasVertexAlpha=!0)}),Promise.all(s).then(function(){return l})},n.prototype._createMorphTargets=function(e,n,r,o,a){if(o.targets&&this._parent.loadMorphTargets){if(null==n._numMorphTargets)n._numMorphTargets=o.targets.length;else if(o.targets.length!==n._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var i=r.extras?r.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,a.morphTargetManager=new t.MorphTargetManager(this._babylonScene),a.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,a.morphTargetManager.areUpdatesFrozen=!0;for(var s=0;s<o.targets.length;s++){var l=n.weights?n.weights[s]:r.weights?r.weights[s]:0,u=i?i[s]:"morphTarget".concat(s);a.morphTargetManager.addTarget(new t.MorphTarget(u,l,a.getScene()))}}},n.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})},n.prototype._loadMorphTargetVertexDataAsync=function(e,n,r,o){return g(this,void 0,void 0,function(){var a,i,s=this;return b(this,function(l){switch(l.label){case 0:return a=new Array,(i=function(t,o,i){if(null!=r[t]){var l=n.getVertexBuffer(o);if(l){var u=He.Get("".concat(e,"/").concat(t),s._gltf.accessors,r[t]);a.push(s._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then(function(e){i(l,e)}))}}})("POSITION",t.VertexBuffer.PositionKind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setPositions(n)}),i("NORMAL",t.VertexBuffer.NormalKind,function(e,t){var n=new Float32Array(t.length);e.forEach(n.length,function(e,r){n[r]=t[r]+e}),o.setNormals(n)}),i("TANGENT",t.VertexBuffer.TangentKind,function(e,t){var n=new Float32Array(t.length/3*4),r=0;e.forEach(t.length/3*4,function(e,o){(o+1)%4!=0&&(n[r]=t[r]+e,r++)}),o.setTangents(n)}),i("TEXCOORD_0",t.VertexBuffer.UVKind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setUVs(n)}),i("TEXCOORD_1",t.VertexBuffer.UV2Kind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setUV2s(n)}),i("COLOR_0",t.VertexBuffer.ColorKind,function(t,n){var r=null,a=t.getSize();if(3===a){r=new Float32Array(n.length/3*4),t.forEach(n.length,function(e,t){var o=Math.floor(t/3),a=t%3;r[4*o+a]=n[3*o+a]+e});for(var i=0;i<n.length/3;++i)r[4*i+3]=1}else{if(4!==a)throw new Error("".concat(e,": Invalid number of components (").concat(a,") for COLOR_0 attribute"));r=new Float32Array(n.length),t.forEach(n.length,function(e,t){r[t]=n[t]+e})}o.setColors(r)}),[4,Promise.all(a).then(function(){})];case 1:return[2,l.sent()]}})})},n._LoadTransform=function(e,n){if(null==e.skin){var r=t.Vector3.Zero(),o=t.Quaternion.Identity(),a=t.Vector3.One();e.matrix?t.Matrix.FromArray(e.matrix).decompose(a,o,r):(e.translation&&(r=t.Vector3.FromArray(e.translation)),e.rotation&&(o=t.Quaternion.FromArray(e.rotation)),e.scale&&(a=t.Vector3.FromArray(e.scale))),n.position=r,n.rotationQuaternion=o,n.scaling=a}},n.prototype._loadSkinAsync=function(e,n,r,o){var a=this;if(!this._parent.loadSkins)return Promise.resolve();var i=this._extensionsLoadSkinAsync(e,n,r);if(i)return i;if(r._data)return o(r._data.babylonSkeleton),r._data.promise;var s="skeleton".concat(r.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var l=new t.Skeleton(r.name||s,s,this._babylonScene);l._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,r,l);var u=this._loadSkinInverseBindMatricesDataAsync(e,r).then(function(e){a._updateBoneMatrices(l,e)});return r._data={babylonSkeleton:l,promise:u},o(l),u},n.prototype._loadBones=function(e,n,r){if(null==n.skeleton||this._parent.alwaysComputeSkeletonRootNode){var o=this._findSkeletonRootNode("".concat(e,"/joints"),n.joints);if(o)if(void 0===n.skeleton)n.skeleton=o.index;else{var a=He.Get("".concat(e,"/skeleton"),this._gltf.nodes,n.skeleton);a===o||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1}(a,o)||(t.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),n.skeleton=o.index)}else t.Logger.Warn("".concat(e,": Failed to find common root"))}for(var i={},s=0,l=n.joints;s<l.length;s++){var u=l[s],c=He.Get("".concat(e,"/joints/").concat(u),this._gltf.nodes,u);this._loadBone(c,n,r,i)}},n.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=He.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}},n.prototype._loadBone=function(e,n,r,o){e._isJoint=!0;var a=o[e.index];if(a)return a;var i=null;e.index!==n.skeleton&&(e.parent&&-1!==e.parent.index?i=this._loadBone(e.parent,n,r,o):void 0!==n.skeleton&&t.Logger.Warn("/skins/".concat(n.index,"/skeleton: Skeleton node is not a common root")));var s=n.joints.indexOf(e.index);return a=new t.Bone(e.name||"joint".concat(e.index),r,i,this._getNodeMatrix(e),null,null,s),o[e.index]=a,this._postSceneLoadActions.push(function(){a.linkTransformNode(e._babylonTransformNode)}),a},n.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);var n=He.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("/accessors/".concat(n.index),n)},n.prototype._updateBoneMatrices=function(e,n){for(var r=0,o=e.bones;r<o.length;r++){var a=o[r],i=t.Matrix.Identity(),s=a._index;n&&-1!==s&&(t.Matrix.FromArrayToRef(n,16*s,i),i.invertToRef(i));var l=a.getParent();l&&i.multiplyToRef(l.getAbsoluteInverseBindMatrix(),i),a.updateMatrix(i,!1,!1),a._updateAbsoluteBindMatrices(void 0,!1)}},n.prototype._getNodeMatrix=function(e){return e.matrix?t.Matrix.FromArray(e.matrix):t.Matrix.Compose(e.scale?t.Vector3.FromArray(e.scale):t.Vector3.One(),e.rotation?t.Quaternion.FromArray(e.rotation):t.Quaternion.Identity(),e.translation?t.Vector3.FromArray(e.translation):t.Vector3.Zero())},n.prototype.loadCameraAsync=function(e,r,o){void 0===o&&(o=function(){});var a=this._extensionsLoadCameraAsync(e,r,o);if(a)return a;var i=new Array;this.logOpen("".concat(e," ").concat(r.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var s=new t.FreeCamera(r.name||"camera".concat(r.index),t.Vector3.Zero(),this._babylonScene,!1);switch(s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,r._babylonCamera=s,s.setTarget(new t.Vector3(0,0,-1)),r.type){case"perspective":var l=r.perspective;if(!l)throw new Error("".concat(e,": Camera perspective properties are missing"));s.fov=l.yfov,s.minZ=l.znear,s.maxZ=l.zfar||0;break;case"orthographic":if(!r.orthographic)throw new Error("".concat(e,": Camera orthographic properties are missing"));s.mode=t.Camera.ORTHOGRAPHIC_CAMERA,s.orthoLeft=-r.orthographic.xmag,s.orthoRight=r.orthographic.xmag,s.orthoBottom=-r.orthographic.ymag,s.orthoTop=r.orthographic.ymag,s.minZ=r.orthographic.znear,s.maxZ=r.orthographic.zfar;break;default:throw new Error("".concat(e,": Invalid camera type (").concat(r.type,")"))}return n.AddPointerMetadata(s,e),this._parent.onCameraLoadedObservable.notifyObservers(s),o(s),this.logClose(),Promise.all(i).then(function(){return s})},n.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")})},n.prototype.loadAnimationAsync=function(e,t){var n=this;return this._parent._startPerformanceCounter("Load animation"),this._extensionsLoadAnimationAsync(e,t)||Ve.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;He.Assign(t.channels),He.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})})},n.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=He.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?De.value.then(function(){var i,u,c,f,h;switch(l){case"translation":h=null===(i=Be("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":h=null===(u=Be("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":h=null===(c=Be("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":h=null===(f=Be("/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(!h)throw new Error("".concat(e,"/target/path: Could not find interpolation properties for target path (").concat(r.target.path,")"));var d={object:s,info:h};return a._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,d,o)}):Promise.resolve()},n.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=He.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],h=f.getStride(l),d=e.input,p=e.output,m=new Array(d.length),_=0;switch(e.interpolation){case"STEP":for(var g=0;g<d.length;g++){var b=f.getValue(l,p,_,1);_+=h,m[g]={frame:d[g]*i,value:b,interpolation:1}}break;case"CUBICSPLINE":for(g=0;g<d.length;g++){var y=f.getValue(l,p,_,s);_+=h,b=f.getValue(l,p,_,1),_+=h;var v=f.getValue(l,p,_,s);_+=h,m[g]={frame:d[g]*i,inTangent:y,value:b,outTangent:v}}break;case"LINEAR":for(g=0;g<d.length;g++)b=f.getValue(l,p,_,1),_+=h,m[g]={frame:d[g]*i,value:b}}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)}}})},n.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=He.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=He.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},n.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),{cause:t})}})},n.prototype.loadBufferViewAsync=function(e,t){var n=this._extensionsLoadBufferViewAsync(e,t);if(n)return n;if(t._data)return t._data;var r=He.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},n.prototype._loadAccessorAsync=function(e,r,o){var a=this;if(r._data)return r._data;var i=n._GetNumComponents(e,r.type),s=i*t.VertexBuffer.GetTypeByteLength(r.componentType),l=i*r.count;if(null==r.bufferView)r._data=Promise.resolve(new o(l));else{var u=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,r.bufferView);r._data=this.loadBufferViewAsync("/bufferViews/".concat(u.index),u).then(function(a){if(5126!==r.componentType||r.normalized||u.byteStride&&u.byteStride!==s){var c=new o(l);return t.VertexBuffer.ForEach(a,r.byteOffset||0,u.byteStride||s,i,r.componentType,c.length,r.normalized||!1,function(e,t){c[t]=e}),c}return n._GetTypedArray(e,r.componentType,a,r.byteOffset,l)})}if(r.sparse){var c=r.sparse;r._data=r._data.then(function(l){var u=l,f=He.Get("".concat(e,"/sparse/indices/bufferView"),a._gltf.bufferViews,c.indices.bufferView),h=He.Get("".concat(e,"/sparse/values/bufferView"),a._gltf.bufferViews,c.values.bufferView);return Promise.all([a.loadBufferViewAsync("/bufferViews/".concat(f.index),f),a.loadBufferViewAsync("/bufferViews/".concat(h.index),h)]).then(function(a){var l,f=a[0],h=a[1],d=n._GetTypedArray("".concat(e,"/sparse/indices"),c.indices.componentType,f,c.indices.byteOffset,c.count),p=i*c.count;if(5126!==r.componentType||r.normalized){var m=n._GetTypedArray("".concat(e,"/sparse/values"),r.componentType,h,c.values.byteOffset,p);l=new o(p),t.VertexBuffer.ForEach(m,0,s,i,r.componentType,l.length,r.normalized||!1,function(e,t){l[t]=e})}else l=n._GetTypedArray("".concat(e,"/sparse/values"),r.componentType,h,c.values.byteOffset,p);for(var _=0,g=0;g<d.length;g++)for(var b=d[g]*i,y=0;y<i;y++)u[b++]=l[_++];return u})})}return r._data},n.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},n.prototype._loadIndicesAccessorAsync=function(e,t){if("SCALAR"!==t.type)throw new Error("".concat(e,"/type: Invalid value ").concat(t.type));if(5121!==t.componentType&&5123!==t.componentType&&5125!==t.componentType)throw new Error("".concat(e,"/componentType: Invalid value ").concat(t.componentType));if(t._data)return t._data;if(t.sparse){var r=n._GetTypedArrayConstructor("".concat(e,"/componentType"),t.componentType);t._data=this._loadAccessorAsync(e,t,r)}else{var o=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(o.index),o).then(function(r){return n._GetTypedArray(e,t.componentType,r,t.byteOffset,t.count)})}return t._data},n.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var n=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then(function(e){return new t.Buffer(n,e,!1)}),e._babylonBuffer},n.prototype._loadVertexAccessorAsync=function(e,r,o){var a;if(null===(a=r._babylonVertexBuffer)||void 0===a?void 0:a[o])return r._babylonVertexBuffer[o];r._babylonVertexBuffer||(r._babylonVertexBuffer={});var i=this._babylonScene.getEngine();if(r.sparse||null==r.bufferView)r._babylonVertexBuffer[o]=this._loadFloatAccessorAsync(e,r).then(function(e){return new t.VertexBuffer(i,e,o,!1)});else{var s=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,r.bufferView);r._babylonVertexBuffer[o]=this._loadVertexBufferViewAsync(s).then(function(a){var l=n._GetNumComponents(e,r.type);return new t.VertexBuffer(i,a,o,!1,void 0,s.byteStride,void 0,r.byteOffset,l,r.componentType,r.normalized,!0,void 0,!0)})}return r._babylonVertexBuffer[o]},n.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,n,r){var o=new Array,a=this._getOrCreateMaterialAdapter(r);return n&&(n.baseColorFactor?(a.baseColor=t.Color3.FromArray(n.baseColorFactor),a.geometryOpacity=n.baseColorFactor[3]):a.baseColor=t.Color3.White(),a.baseMetalness=null==n.metallicFactor?1:n.metallicFactor,a.specularRoughness=null==n.roughnessFactor?1:n.roughnessFactor,n.baseColorTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),n.baseColorTexture,function(e){e.name="".concat(r.name," (Base Color)"),a.baseColorTexture=e})),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),n.metallicRoughnessTexture,function(e){e.name="".concat(r.name," (Metallic Roughness)"),a.baseMetalnessTexture=e,a.specularRoughnessTexture=e})),a.useRoughnessFromMetallicTextureGreen=!0,a.useMetallicFromMetallicTextureBlue=!0)),Promise.all(o).then(function(){})},n.prototype._loadMaterialAsync=function(e,t,r,o,a){void 0===a&&(a=function(){});var i=this._extensionsLoadMaterialAsync(e,t,r,o,a);if(i)return i;t._data=t._data||{};var s=t._data[o];if(!s){this.logOpen("".concat(e," ").concat(t.name||""));var l=this.createMaterial(e,t,o);s={babylonMaterial:l,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(e,t,l)},t._data[o]=s,n.AddPointerMetadata(l,e),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})},n.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},n.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)},n.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(){})},n.prototype.loadMaterialBasePropertiesAsync=function(e,n,r){var o,a=new Array,i=this._getOrCreateMaterialAdapter(r);i.emissionColor=n.emissiveFactor?t.Color3.FromArray(n.emissiveFactor):new t.Color3(0,0,0),n.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),n.normalTexture&&(n.normalTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),n.normalTexture,function(e){var t;e.name="".concat(r.name," (Normal)"),i.geometryNormalTexture=e,null!=(null===(t=n.normalTexture)||void 0===t?void 0:t.scale)&&(e.level=n.normalTexture.scale)})),i.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));var s,l=1;return n.occlusionTexture&&(n.occlusionTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),n.occlusionTexture,function(e){e.name="".concat(r.name," (Occlusion)"),o=e})),null!=n.occlusionTexture.strength&&(l=n.occlusionTexture.strength)),n.emissiveTexture&&a.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),n.emissiveTexture,function(e){e.name="".concat(r.name," (Emissive)"),s=e})),Promise.all(a).then(function(){o&&(i.ambientOcclusionTexture=o,i.ambientOcclusionTextureStrength=l),s&&(i.emissionColorTexture=s)})},n.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,")"))}},n.prototype.loadTextureInfoAsync=function(e,t,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadTextureInfoAsync(e,t,r);if(a)return a;if(this.logOpen("".concat(e)),t.texCoord>=6)throw new Error("".concat(e,"/texCoord: Invalid value (").concat(t.texCoord,")"));var i=He.Get("".concat(e,"/index"),this._gltf.textures,t.index);i._textureInfo=t;var s=this._loadTextureAsync("/textures/".concat(t.index),i,function(a){a.coordinatesIndex=t.texCoord||0,n.AddPointerMetadata(a,e),o._parent.onTextureLoadedObservable.notifyObservers(a),r(a)});return this.logClose(),s},n.prototype._loadTextureAsync=function(e,t,r){void 0===r&&(r=function(){});var o=this._extensionsLoadTextureAsync(e,t,r);if(o)return o;this.logOpen("".concat(e," ").concat(t.name||""));var a=null==t.sampler?n.DefaultSampler:He.Get("".concat(e,"/sampler"),this._gltf.samplers,t.sampler),i=He.Get("".concat(e,"/source"),this._gltf.images,t.source),s=this._createTextureAsync(e,a,i,r,void 0,!t._textureInfo.nonColorData);return this.logClose(),s},n.prototype._createTextureAsync=function(e,n,r,o,a,i){var s,l,u=this;void 0===o&&(o=function(){});var c=this._loadSampler("/samplers/".concat(n.index),n),f=new Array,h=new t.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var d={noMipmap:c.noMipMaps,invertY:!1,samplingMode:c.samplingMode,onLoad:function(){u._disposed||h.resolve()},onError:function(t,n){u._disposed||h.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:null!==(s=r.mimeType)&&void 0!==s?s:t.GetMimeType(null!==(l=r.uri)&&void 0!==l?l:""),loaderOptions:a,useSRGBBuffer:!!i&&this._parent.useSRGBBuffers},p=new t.Texture(null,this._babylonScene,d);p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,f.push(h.promise);var m=r.uri&&!t.IsBase64DataUrl(r.uri)?r.uri:void 0,_=null!=m?m:"".concat(this._fileName,"#image").concat(r.index);if(f.push(this.loadImageAsync("/images/".concat(r.index),r).then(function(e){var t="data:".concat(u._uniqueRootUrl).concat(_);p.updateURL(t,e);var n=p.getInternalTexture();n&&(n.label=r.name)})),p.wrapU=c.wrapU,p.wrapV=c.wrapV,o(p),this._parent.useGltfTextureNames){var g=r.name||m||"image".concat(r.index);p.name=g}return Promise.all(f).then(function(){return p})},n.prototype._loadSampler=function(e,t){return t._data||(t._data={noMipMaps:9728===t.minFilter||9729===t.minFilter,samplingMode:n._GetTextureSamplingMode(e,t),wrapU:n._GetTextureWrapMode("".concat(e,"/wrapS"),t.wrapS),wrapV:n._GetTextureWrapMode("".concat(e,"/wrapT"),t.wrapT)}),t._data},n.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=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(n.index),n)}this.logClose()}return t._data},n.prototype.loadUriAsync=function(e,r,o){var a=this,i=this._extensionsLoadUriAsync(e,r,o);if(i)return i;if(!n._ValidateUri(o))throw new Error("".concat(e,": '").concat(o,"' is invalid"));if(t.IsBase64DataUrl(o)){var s=new Uint8Array(t.DecodeBase64UrlToBinary(o));return this.log("".concat(e,": Decoded ").concat(o.substring(0,64),"... (").concat(s.length," bytes)")),Promise.resolve(s)}return this.log("".concat(e,": Loading ").concat(o)),this._parent.preprocessUrlAsync(this._rootUrl+o).then(function(n){return new Promise(function(r,i){a._parent._loadFile(a._babylonScene,n,function(t){a._disposed||(a.log("".concat(e,": Loaded ").concat(o," (").concat(t.byteLength," bytes)")),r(new Uint8Array(t)))},!0,function(n){i(new t.LoadFileError("".concat(e,": Failed to load '").concat(o,"'").concat(n?": "+n.status+" "+n.statusText:""),n))})})})},n.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)},n._GetTextureWrapMode=function(e,n){switch(n=null==n?10497:n){case 33071:return t.Texture.CLAMP_ADDRESSMODE;case 33648:return t.Texture.MIRROR_ADDRESSMODE;case 10497:return t.Texture.WRAP_ADDRESSMODE;default:return t.Logger.Warn("".concat(e,": Invalid value (").concat(n,")")),t.Texture.WRAP_ADDRESSMODE}},n._GetTextureSamplingMode=function(e,n){var r=null==n.magFilter?9729:n.magFilter,o=null==n.minFilter?9987:n.minFilter;if(9729===r)switch(o){case 9728:return t.Texture.LINEAR_NEAREST;case 9729:return t.Texture.LINEAR_LINEAR;case 9984:return t.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return t.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return t.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return t.Texture.LINEAR_LINEAR_MIPLINEAR;default:return t.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),t.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==r&&t.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(r,")")),o){case 9728:return t.Texture.NEAREST_NEAREST;case 9729:return t.Texture.NEAREST_LINEAR;case 9984:return t.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return t.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return t.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return t.Texture.NEAREST_LINEAR_MIPLINEAR;default:return t.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),t.Texture.NEAREST_NEAREST_MIPNEAREST}},n._GetTypedArrayConstructor=function(e,n){try{return t.GetTypedArrayConstructor(n)}catch(t){throw new Error("".concat(e,": ").concat(t.message),{cause:t})}},n._GetTypedArray=function(e,r,o,a,i){var s=o.buffer;a=o.byteOffset+(a||0);var l=n._GetTypedArrayConstructor("".concat(e,"/componentType"),r),u=t.VertexBuffer.GetTypeByteLength(r);return a%u!==0?(t.Logger.Warn("".concat(e,": Copying buffer as byte offset (").concat(a,") is not a multiple of component type byte length (").concat(u,")")),new l(s.slice(a,a+i*u),0)):new l(s,a,i)},n._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,")"))},n._ValidateUri=function(e){return t.Tools.IsBase64(e)||-1===e.indexOf("..")},n._GetDrawMode=function(e,n){switch(null==n&&(n=4),n){case 0:return t.Material.PointListDrawMode;case 1:return t.Material.LineListDrawMode;case 2:return t.Material.LineLoopDrawMode;case 3:return t.Material.LineStripDrawMode;case 4:return t.Material.TriangleFillMode;case 5:return t.Material.TriangleStripDrawMode;case 6:return t.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(n,")"))},n.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")})},n.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")})},n.prototype._forEachExtensions=function(e){for(var t=0,n=this._extensions;t<n.length;t++){var r=n[t];r.enabled&&e(r)}},n.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},n.prototype._extensionsOnLoading=function(){this._forEachExtensions(function(e){return e.onLoading&&e.onLoading()})},n.prototype._extensionsOnReady=function(){this._forEachExtensions(function(e){return e.onReady&&e.onReady()})},n.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",function(n){return n.loadSceneAsync&&n.loadSceneAsync(e,t)})},n.prototype._extensionsLoadNodeAsync=function(e,t,n){return this._applyExtensions(t,"loadNode",function(r){return r.loadNodeAsync&&r.loadNodeAsync(e,t,n)})},n.prototype._extensionsLoadCameraAsync=function(e,t,n){return this._applyExtensions(t,"loadCamera",function(r){return r.loadCameraAsync&&r.loadCameraAsync(e,t,n)})},n.prototype._extensionsLoadVertexDataAsync=function(e,t,n){return this._applyExtensions(t,"loadVertexData",function(r){return r._loadVertexDataAsync&&r._loadVertexDataAsync(e,t,n)})},n.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)})},n.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)})},n.prototype._extensionsCreateMaterial=function(e,t,n){return this._applyExtensions(t,"createMaterial",function(r){return r.createMaterial&&r.createMaterial(e,t,n)})},n.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,n){return this._applyExtensions(t,"loadMaterialProperties",function(r){return r.loadMaterialPropertiesAsync&&r.loadMaterialPropertiesAsync(e,t,n)})},n.prototype._extensionsLoadTextureInfoAsync=function(e,t,n){return this._applyExtensions(t,"loadTextureInfo",function(r){return r.loadTextureInfoAsync&&r.loadTextureInfoAsync(e,t,n)})},n.prototype._extensionsLoadTextureAsync=function(e,t,n){return this._applyExtensions(t,"loadTexture",function(r){return r._loadTextureAsync&&r._loadTextureAsync(e,t,n)})},n.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",function(n){return n.loadAnimationAsync&&n.loadAnimationAsync(e,t)})},n.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)})},n.prototype._extensionsLoadSkinAsync=function(e,t,n){return this._applyExtensions(n,"loadSkin",function(r){return r._loadSkinAsync&&r._loadSkinAsync(e,t,n)})},n.prototype._extensionsLoadUriAsync=function(e,t,n){return this._applyExtensions(t,"loadUri",function(r){return r._loadUriAsync&&r._loadUriAsync(e,t,n)})},n.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",function(n){return n.loadBufferViewAsync&&n.loadBufferViewAsync(e,t)})},n.prototype._extensionsLoadBufferAsync=function(e,t,n,r){return this._applyExtensions(t,"loadBuffer",function(o){return o.loadBufferAsync&&o.loadBufferAsync(e,t,n,r)})},n.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},n.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},n.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},n.prototype.logOpen=function(e){this._parent._logOpen(e)},n.prototype.logClose=function(){this._parent._logClose()},n.prototype.log=function(e){this._parent._log(e)},n.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},n.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},n.DefaultSampler={index:-1},n}();k._CreateGLTF2Loader=function(e){return new je(e)};var Ue={__proto__:null,ArrayItem:He,GLTFFileLoader:k,GLTFLoader:je,LoadBoundingInfoFromPositionAccessor:Ke};function We(e,n,r,o){return t.Vector3.FromArray(n,r).scaleInPlace(o)}function ze(e,n,r,o){return t.Quaternion.FromArray(n,r).scaleInPlace(o)}function qe(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 Ye=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,n,r){var o=new t.Animation(e,this.name,n,this.type);return o.setKeys(r,!0),o},e}(),Xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(Ye),Je=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.buildAnimations=function(e,n,r,o){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new t.Animation("".concat(n,"_").concat(i),s.name,r,s.type);if(l.setKeys(o.map(function(e){return{frame:e.frame,inTangent:e.inTangent?e.inTangent[i]:void 0,value:e.value[i],outTangent:e.outTangent?e.outTangent[i]:void 0,interpolation:e.interpolation}}),!0),e._primitiveBabylonMeshes)for(var u=0,c=e._primitiveBabylonMeshes;u<c.length;u++){var f=c[u];if(f.morphTargetManager){var h=f.morphTargetManager.getTarget(i),d=l.clone();h.animations.push(d),a.push({babylonAnimatable:h,babylonAnimation:d})}}},s=this,l=0;l<e._numMorphTargets;l++)i(l);return a},n}(Ye);ke("/nodes/{}/translation",[new Xe(t.Animation.ANIMATIONTYPE_VECTOR3,"position",We,function(){return 3})]),ke("/nodes/{}/rotation",[new Xe(t.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",ze,function(){return 4})]),ke("/nodes/{}/scale",[new Xe(t.Animation.ANIMATIONTYPE_VECTOR3,"scaling",We,function(){return 3})]),ke("/nodes/{}/weights",[new Je(t.Animation.ANIMATIONTYPE_FLOAT,"influence",qe,function(e){return e._numMorphTargets})]);var Qe={__proto__:null,AnimationPropertyInfo:Ye,TransformNodeAnimationPropertyInfo:Xe,WeightAnimationPropertyInfo:Je,getQuaternion:ze,getVector3:We,getWeights:qe},Ze=function(){function e(e){this._diffuseTransmissionTint=t.Color3.White(),this._diffuseTransmissionTintTexture=null,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(){this._material.geometryThinWalled=1,this._material.transmissionDepth=0},Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.transmissionWeight},set:function(e){this._material.transmissionWeight=e},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(t.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}),e.prototype.configureVolume=function(){this._material.geometryThinWalled=0},Object.defineProperty(e.prototype,"geometryThinWalled",{get:function(){return!!this._material.geometryThinWalled},set:function(e){this._material.geometryThinWalled=e?1:0},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(){this._material.geometryThinWalled=1,this._material.subsurfaceScatterAnisotropy=1},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return this._material.subsurfaceWeight},set:function(e){this._material.subsurfaceWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{set:function(e){this._material.subsurfaceWeightTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){this._material.subsurfaceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){this._material.subsurfaceColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTint",{get:function(){return this._diffuseTransmissionTint},set:function(e){this._diffuseTransmissionTint=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTintTexture",{set:function(e){this._diffuseTransmissionTintTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadius",{get:function(){return this._material.subsurfaceRadius},set:function(e){this._material.subsurfaceRadius=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadiusScale",{get:function(){return this._material.subsurfaceRadiusScale},set:function(e){this._material.subsurfaceRadiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceScatterAnisotropy",{set:function(e){this._material.subsurfaceScatterAnisotropy=e},enumerable:!1,configurable:!0}),e.prototype.isTranslucent=function(){return this.transmissionWeight>0||this.subsurfaceWeight>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.prototype.finalize=function(){(this._diffuseTransmissionTint&&!this._diffuseTransmissionTint.equals(t.Color3.White())||this._diffuseTransmissionTintTexture)&&(this._material.geometryThinWalled?(this.subsurfaceColor=this._diffuseTransmissionTint,this.subsurfaceColorTexture=this._diffuseTransmissionTintTexture):0!=this._material.coatWeight||this.baseColor.equals(t.Color3.White())&&!this.baseColorTexture||(this._material.coatWeight=this.subsurfaceWeight,this._material.coatWeightTexture=this.subsurfaceWeightTexture,this._material.coatColor=this._diffuseTransmissionTint,this._material.coatColorTexture=this._diffuseTransmissionTintTexture,this._material.coatIor=this._material.specularIor,this._material.coatDarkening=0,this._material.coatRoughness=this._material.specularRoughness,this._material.coatRoughnessTexture=this._material.specularRoughnessTexture,this._material.specularRoughness=1,this._material.specularRoughnessTexture=null)),this.transmissionWeight>0&&(this._material.geometryThinWalled||0===this._material.transmissionDepth?(this._material.transmissionColor=this._material.baseColor,this._material.transmissionColorTexture=this._material.baseColorTexture):0!=this._material.coatWeight||this.baseColor.equals(t.Color3.White())&&null===this.baseColorTexture||(this._material.coatWeight=this.transmissionWeight,this._material.coatWeightTexture=this.transmissionWeightTexture,this._material.coatColor=this.baseColor,this._material.coatColorTexture=this.baseColorTexture,this._material.coatIor=this._material.specularIor,this._material.coatDarkening=0,this._material.coatRoughness=this._material.specularRoughness,this._material.coatRoughnessTexture=this._material.specularRoughnessTexture))},e}(),$e={__proto__:null,OpenPBRMaterialLoadingAdapter:Ze},et=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=t.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=t.Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=t.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!=t.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 t.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 t.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,"transmissionScatterTexture",{set:function(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},e.prototype.configureVolume=function(){},Object.defineProperty(e.prototype,"geometryThinWalled",{get:function(){return!0},set:function(e){},enumerable:!1,configurable:!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){var n=new t.Vector3(-Math.log(this.transmissionColor.r),-Math.log(this.transmissionColor.g),-Math.log(this.transmissionColor.b));n.scaleInPlace(1/Math.max(this.transmissionDepth,.001));var r=n,o=Math.max(r.x,Math.max(r.y,r.z)),a=o>0?1/o:1;this._material.subSurface.diffusionDistance=new t.Color3(Math.exp(-r.x*a),Math.exp(-r.y*a),Math.exp(-r.z*a))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTint",{get:function(){return this._material.subSurface.tintColor},set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTintTexture",{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:t.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.isTranslucent=function(){return this.transmissionWeight>0||this.subsurfaceWeight>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}(),tt={__proto__:null,PBRMaterialLoadingAdapter:et},nt="EXT_lights_image_based",rt=function(){function e(e){this.name=nt,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}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 je.LoadExtensionAsync(e,t,this.name,function(r,o){return g(n,void 0,void 0,function(){var n,a,i=this;return b(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=He.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,n){var r=this;if(!n._loaded){var o=new Array;this._loader.logOpen("".concat(e));for(var a=new Array(n.specularImages.length),i=function(t){var r=n.specularImages[t];a[t]=new Array(r.length);for(var i=function(n){var i="".concat(e,"/specularImages/").concat(t,"/").concat(n);s._loader.logOpen("".concat(i));var l=r[n],u=He.Get(i,s._loader.gltf.images,l);o.push(s._loader.loadImageAsync("/images/".concat(l),u).then(function(e){a[t][n]=e})),s._loader.logClose()},l=0;l<r.length;l++)i(l)},s=this,l=0;l<n.specularImages.length;l++)i(l);this._loader.logClose(),n._loaded=Promise.all(o).then(function(){return g(r,void 0,void 0,function(){var r,o,i,s,l;return b(this,function(u){switch(u.label){case 0:if((r=new t.RawCubeTexture(this._loader.babylonScene,null,n.specularImageSize)).name=n.name||"environment",n._babylonTexture=r,null!=n.intensity&&(r.level=n.intensity),n.rotation&&(o=t.Quaternion.FromArray(n.rotation),this._loader.babylonScene.useRightHandedSystem||(o=t.Quaternion.Inverse(o)),t.Matrix.FromQuaternionToRef(o,r.getReflectionTextureMatrix())),!n.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(i=t.SphericalHarmonics.FromArray(n.irradianceCoefficients)).scaleInPlace(n.intensity),i.convertIrradianceToLambertianRadiance(),s=t.SphericalPolynomial.FromHarmonics(i),l=(a.length-1)/Math.log2(n.specularImageSize),[4,r.updateRGBDAsync(a,s,l)];case 1:return[2,u.sent()]}})})})}return n._loaded.then(function(){return n._babylonTexture})},e}();we(nt),Ae(nt,!0,function(e){return new rt(e)});var ot={__proto__:null,EXT_lights_image_based:rt},at="EXT_mesh_gpu_instancing",it=function(){function e(e){this.name=at,this._loader=e,this.enabled=this._loader.isExtensionUsed(at)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(e,a){return g(o,void 0,void 0,function(){var o,i,s,l,u=this;return b(this,function(c){switch(c.label){case 0:return this._loader._disableInstancedMesh++,o=this._loader.loadNodeAsync("/nodes/".concat(n.index),n,r),this._loader._disableInstancedMesh--,n._primitiveBabylonMeshes?[3,2]:[4,o];case 1:case 3:return[2,c.sent()];case 2:return i=new Array,s=0,(l=function(t){if(null!=a.attributes[t]){var n=He.Get("".concat(e,"/attributes/").concat(t),u._loader.gltf.accessors,a.attributes[t]);if(i.push(u._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===s)s=n.count;else if(s!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else i.push(Promise.resolve(null))})("TRANSLATION"),l("ROTATION"),l("SCALE"),l("_COLOR_0"),[4,o.then(function(e){return g(u,void 0,void 0,function(){var r,o,a,l,u,c,f,h,d,p;return b(this,function(m){switch(m.label){case 0:return[4,Promise.all(i)];case 1:for(r=m.sent(),o=r[0],a=r[1],l=r[2],u=r[3],c=new Float32Array(16*s),t.TmpVectors.Vector3[0].copyFromFloats(0,0,0),t.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),t.TmpVectors.Vector3[1].copyFromFloats(1,1,1),f=0;f<s;++f)o&&t.Vector3.FromArrayToRef(o,3*f,t.TmpVectors.Vector3[0]),a&&t.Quaternion.FromArrayToRef(a,4*f,t.TmpVectors.Quaternion[0]),l&&t.Vector3.FromArrayToRef(l,3*f,t.TmpVectors.Vector3[1]),t.Matrix.ComposeToRef(t.TmpVectors.Vector3[1],t.TmpVectors.Quaternion[0],t.TmpVectors.Vector3[0],t.TmpVectors.Matrix[0]),t.TmpVectors.Matrix[0].copyToArray(c,16*f);for(h=0,d=n._primitiveBabylonMeshes;h<d.length;h++)(p=d[h]).thinInstanceSetBuffer("matrix",c,16,!0),u&&(u.length===3*s?p.thinInstanceSetBuffer("color",u,3,!0):u.length===4*s?p.thinInstanceSetBuffer("color",u,4,!0):t.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+p.name));return[2,e]}})})})]}})})})},e}();we(at),Ae(at,!0,function(e){return new it(e)});var st={__proto__:null,EXT_mesh_gpu_instancing:it},lt="EXT_meshopt_compression",ut=function(){function e(e){this.name=lt,this.enabled=e.isExtensionUsed(lt),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,n){var r=this;return je.LoadExtensionAsync(e,n,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,o,i=this;return b(this,function(s){switch(s.label){case 0:return(r=n)._meshOptData?[4,r._meshOptData]:[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=He.Get("".concat(e,"/buffer"),this._loader.gltf.buffers,a.buffer),r._meshOptData=this._loader.loadBufferAsync("/buffers/".concat(o.index),o,a.byteOffset||0,a.byteLength).then(function(e){return g(i,void 0,void 0,function(){return b(this,function(n){switch(n.label){case 0:return[4,t.MeshoptCompression.Default.decodeGltfBufferAsync(e,a.count,a.byteStride,a.mode,a.filter)];case 1:return[2,n.sent()]}})})}),[4,r._meshOptData]}})})})},e}();we(lt),Ae(lt,!0,function(e){return new ut(e)});var ct={__proto__:null,EXT_meshopt_compression:ut},ft="EXT_texture_webp",ht=function(){function e(e){this.name=ft,this._loader=e,this.enabled=e.isExtensionUsed(ft)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(this,function(s){switch(s.label){case 0:return r=null==t.sampler?je.DefaultSampler:He.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=He.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}();we(ft),Ae(ft,!0,function(e){return new ht(e)});var dt={__proto__:null,EXT_texture_webp:ht},pt="EXT_texture_avif",mt=function(){function e(e){this.name=pt,this._loader=e,this.enabled=e.isExtensionUsed(pt)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(this,function(s){switch(s.label){case 0:return r=null==t.sampler?je.DefaultSampler:He.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=He.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}();we(pt),Ae(pt,!0,function(e){return new mt(e)});var _t={__proto__:null,EXT_texture_avif:mt},gt="EXT_lights_ies",bt=function(){function e(e){this.name=gt,this._loader=e,this.enabled=this._loader.isExtensionUsed(gt)}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,He.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o,s,l,u,c,f=this;return b(this,function(h){switch(h.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n=(s=He.Get(a,f._lights,i.light)).name||e.name;f._loader.babylonScene._blockEntityCollection=!!f._loader._assetContainer,(o=new t.SpotLight(n,t.Vector3.Zero(),t.Vector3.Backward(),0,1,f._loader.babylonScene)).angle=Math.PI/2,o.innerAngle=0,o._parentContainer=f._loader._assetContainer,f._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=o,o.falloffType=t.Light.FALLOFF_GLTF,o.diffuse=i.color?t.Color3.FromArray(i.color):t.Color3.White(),o.intensity=i.multiplier||1,o.range=Number.MAX_VALUE,o.parent=e,f._loader._babylonLights.push(o),je.AddPointerMetadata(o,a),r(e)})];case 1:return l=h.sent(),s.uri?[4,this._loader.loadUriAsync(e,s,s.uri)]:[3,3];case 2:return u=h.sent(),[3,5];case 3:return c=He.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,s.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(c.index),c)];case 4:u=h.sent(),h.label=5;case 5:return o.iesProfileTexture=new t.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,u,!0,void 0,void 0,void 0,void 0,".ies"),[2,l]}})})})},e}();we(gt),Ae(gt,!0,function(e){return new bt(e)});var yt={__proto__:null,EXT_lights_ies:bt},vt="KHR_draco_mesh_compression",Tt=function(){function e(e){this.name=vt,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=t.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(vt)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o,s,l,u,c=this;return b(this,function(f){switch(f.label){case 0:if(null!=n.mode&&4!==n.mode&&5!==n.mode)throw new Error("".concat(e,": Unsupported mode ").concat(n.mode));return o={},s={},(l=function(e,t){var a=i.attributes[e];if(null!=a&&(r._delayInfo=r._delayInfo||[],-1===r._delayInfo.indexOf(t)&&r._delayInfo.push(t),o[t]=a,c.useNormalizedFlagFromAccessor)){var l=He.TryGet(c._loader.gltf.accessors,n.attributes[e]);l&&(s[t]=l.normalized||!1)}})("POSITION",t.VertexBuffer.PositionKind),l("NORMAL",t.VertexBuffer.NormalKind),l("TANGENT",t.VertexBuffer.TangentKind),l("TEXCOORD_0",t.VertexBuffer.UVKind),l("TEXCOORD_1",t.VertexBuffer.UV2Kind),l("TEXCOORD_2",t.VertexBuffer.UV3Kind),l("TEXCOORD_3",t.VertexBuffer.UV4Kind),l("TEXCOORD_4",t.VertexBuffer.UV5Kind),l("TEXCOORD_5",t.VertexBuffer.UV6Kind),l("JOINTS_0",t.VertexBuffer.MatricesIndicesKind),l("WEIGHTS_0",t.VertexBuffer.MatricesWeightsKind),l("COLOR_0",t.VertexBuffer.ColorKind),(u=He.Get(a,this._loader.gltf.bufferViews,i.bufferView))._dracoBabylonGeometry||(u._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u).then(function(a){return g(c,void 0,void 0,function(){var i,l,u;return b(this,function(c){switch(c.label){case 0:return i=this.dracoDecoder||t.DracoDecoder.Default,l=He.TryGet(this._loader.gltf.accessors,n.attributes.POSITION),u=this._loader.parent.alwaysComputeBoundingBox||r.skeleton||!l?null:Ke(l),[4,i._decodeMeshToGeometryForGltfAsync(r.name,this._loader.babylonScene,a,o,s,u).catch(function(t){throw new Error("".concat(e,": ").concat(t.message))})];case 1:return[2,c.sent()]}})})})),[4,u._dracoBabylonGeometry];case 1:return[2,f.sent()]}})})})},e}();we(vt),Ae(vt,!0,function(e){return new Tt(e)});var xt={__proto__:null,KHR_draco_mesh_compression:Tt},At="KHR_lights_punctual",wt=function(){function e(e){this.name=At,this._loader=e,this.enabled=this._loader.isExtensionUsed(At)}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,He.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o=this;return b(this,function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n,s=He.Get(a,o._lights,i.light),l=s.name||e.name;switch(o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer,s.type){case"directional":var u=new t.DirectionalLight(l,t.Vector3.Backward(),o._loader.babylonScene);u.position.setAll(0),n=u;break;case"point":n=new t.PointLight(l,t.Vector3.Zero(),o._loader.babylonScene);break;case"spot":var c=new t.SpotLight(l,t.Vector3.Zero(),t.Vector3.Backward(),0,1,o._loader.babylonScene);c.angle=2*(s.spot&&s.spot.outerConeAngle||Math.PI/4),c.innerAngle=2*(s.spot&&s.spot.innerConeAngle||0),n=c;break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(a,": Invalid light type (").concat(s.type,")"))}n._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=n,n.falloffType=t.Light.FALLOFF_GLTF,n.diffuse=s.color?t.Color3.FromArray(s.color):t.Color3.White(),n.intensity=null==s.intensity?1:s.intensity,n.range=null==s.range?Number.MAX_VALUE:s.range,n.parent=e,o._loader._babylonLights.push(n),je.AddPointerMetadata(n,a),r(e)})];case 1:return[2,s.sent()]}})})})},e}();we(At),Ae(At,!0,function(e){return new wt(e)});var Ot={__proto__:null,KHR_lights:wt},Ct="EXT_lights_area",Mt=function(){function e(e){this.name=Ct,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ct)}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,He.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o=this;return b(this,function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n,s,l=He.Get(a,o._lights,i.light),u=l.name||e.name;o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer;var c=void 0!==l.size?l.size:1;switch(l.type){case"rect":var f=void 0!==(null===(n=l.rect)||void 0===n?void 0:n.aspect)?l.rect.aspect*c:c,h=c;s=new t.RectAreaLight(u,t.Vector3.Zero(),f,h,o._loader.babylonScene);break;case"disk":var d=Math.sqrt(c*c*.25*Math.PI);s=new t.RectAreaLight(u,t.Vector3.Zero(),d,d,o._loader.babylonScene);break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(a,": Invalid area light type (").concat(l.type,")"))}s._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,l._babylonLight=s,s.falloffType=t.Light.FALLOFF_GLTF,s.diffuse=l.color?t.Color3.FromArray(l.color):t.Color3.White(),s.intensity=null==l.intensity?1:l.intensity;var p=new t.TransformNode("".concat(u,"_orientation"),o._loader.babylonScene);p.rotationQuaternion=t.Quaternion.RotationAxis(t.Vector3.Up(),Math.PI),p.parent=e,s.parent=p,o._loader._babylonLights.push(s),je.AddPointerMetadata(s,a),r(e)})];case 1:return[2,s.sent()]}})})})},e}();we(Ct),Ae(Ct,!0,function(e){return new Mt(e)});var Et={__proto__:null,EXT_lights_area:Mt},Rt="KHR_materials_pbrSpecularGlossiness",Ft=function(){function e(e){this.name=Rt,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(Rt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){if(!(r instanceof t.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return r.metallic=null,r.roughness=null,n.diffuseFactor?(r.albedoColor=t.Color3.FromArray(n.diffuseFactor),r.alpha=n.diffuseFactor[3]):r.albedoColor=t.Color3.White(),r.reflectivityColor=n.specularFactor?t.Color3.FromArray(n.specularFactor):t.Color3.White(),r.microSurface=null==n.glossinessFactor?1:n.glossinessFactor,n.diffuseTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),n.diffuseTexture,function(e){e.name="".concat(r.name," (Diffuse)"),r.albedoTexture=e})),n.specularGlossinessTexture&&(o.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),n.specularGlossinessTexture,function(e){e.name="".concat(r.name," (Specular Glossiness)"),r.reflectivityTexture=e,r.reflectivityTexture.hasAlpha=!0})),r.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(o).then(function(){})},e}();we(Rt),Ae(Rt,!0,function(e){return new Ft(e)});var Lt={__proto__:null,KHR_materials_pbrSpecularGlossiness:Ft},Pt="KHR_materials_unlit",St=function(){function e(e){this.name=Pt,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(){return g(r,void 0,void 0,function(){return b(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,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array,i=n.pbrMetallicRoughness;return i&&(i.baseColorFactor&&(o.baseColor=t.Color3.FromArray(i.baseColorFactor),o.geometryOpacity=i.baseColorFactor[3]),i.baseColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),i.baseColorTexture,function(e){e.name="".concat(r.name," (Base Color)"),o.baseColorTexture=e}))),o.isUnlit=!0,n.doubleSided&&(o.backFaceCulling=!1,o.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,n,r),Promise.all(a).then(function(){})},e}();we(Pt),Ae(Pt,!0,function(e){return new St(e)});var Nt={__proto__:null,KHR_materials_unlit:St},It="KHR_materials_clearcoat",Bt=function(){function e(e){this.name=It,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(It)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(It),Ae(It,!0,function(e){return new Bt(e)});var kt={__proto__:null,KHR_materials_clearcoat:Bt},Gt="KHR_materials_coat",Vt=function(){function e(e){this.name=Gt,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(Gt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){var o,a,i=this._loader._getOrCreateMaterialAdapter(r),s=new Array;i.configureCoat(),i.coatWeight=void 0!==n.coatFactor?n.coatFactor:0,i.coatRoughness=void 0!==n.coatRoughnessFactor?n.coatRoughnessFactor:0,n.coatTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatTexture"),n.coatTexture,function(e){e.name="".concat(r.name," (Coat)"),i.coatWeightTexture=e})),n.coatRoughnessTexture&&(n.coatRoughnessTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatRoughnessTexture"),n.coatRoughnessTexture,function(e){e.name="".concat(r.name," (Coat Roughness)"),i.coatRoughnessTexture=e}))),n.coatNormalTexture&&(n.coatNormalTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatNormalTexture"),n.coatNormalTexture,function(e){var t;e.name="".concat(r.name," (Coat Normal)"),i.geometryCoatNormalTexture=e,null!=(null===(t=n.coatNormalTexture)||void 0===t?void 0:t.scale)&&(i.geometryCoatNormalTextureScale=n.coatNormalTexture.scale)})),i.setNormalMapInversions(!r.getScene().useRightHandedSystem,r.getScene().useRightHandedSystem)),i.coatDarkening=void 0!==n.coatDarkeningFactor?n.coatDarkeningFactor:1,i.coatIor=void 0!==n.coatIor?n.coatIor:1.5;var l=t.Color3.White();void 0!==n.coatColorFactor&&l.fromArray(n.coatColorFactor),i.coatColor=l,n.coatColorTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatColorTexture"),n.coatColorTexture,function(e){e.name="".concat(r.name," (Coat Color)"),i.coatColorTexture=e}));var u=null!==(o=n.coatAnisotropyStrength)&&void 0!==o?o:0,c=null!==(a=n.coatAnisotropyRotation)&&void 0!==a?a:0;return i.coatRoughnessAnisotropy=u,i.geometryCoatTangentAngle=c,this.useOpenPBR||i.configureGltfStyleAnisotropy(!0),n.coatAnisotropyTexture&&(n.coatAnisotropyTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatAnisotropyTexture"),n.coatAnisotropyTexture,function(e){e.name="".concat(r.name," (Coat Anisotropy)"),i.geometryCoatTangentTexture=e}))),Promise.all(s).then(function(){})},e}();we(Gt),Ae(Gt,!0,function(e){return new Vt(e)});var Dt={__proto__:null,KHR_materials_coat:Vt},Ht="KHR_materials_iridescence",Kt=function(){function e(e){this.name=Ht,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ht)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(Ht),Ae(Ht,!0,function(e){return new Kt(e)});var jt={__proto__:null,KHR_materials_iridescence:Kt},Ut="KHR_materials_anisotropy",Wt=function(){function e(e){this.name=Ut,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ut)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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 g(this,void 0,void 0,function(){var r,o,a,i,s,l,u,c;return b(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}();we(Ut),Ae(Ut,!0,function(e){return new Wt(e)});var zt={__proto__:null,KHR_materials_anisotropy:Wt},qt="KHR_materials_emissive_strength",Yt=function(){function e(e){this.name=qt,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(qt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){return b(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}();we(qt),Ae(qt,!0,function(e){return new Yt(e)});var Xt={__proto__:null,KHR_materials_emissive_strength:Yt},Jt="KHR_materials_sheen",Qt=function(){function e(e){this.name=Jt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Jt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;o.configureFuzz();var i=void 0!==n.sheenColorFactor?t.Color3.FromArray(n.sheenColorFactor):t.Color3.Black(),s=void 0!==n.sheenRoughnessFactor?n.sheenRoughnessFactor:0;return o.fuzzWeight=1,o.fuzzColor=i,o.fuzzRoughness=s,n.sheenColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),n.sheenColorTexture,function(e){e.name="".concat(r.name," (Sheen Color)"),o.fuzzColorTexture=e})),n.sheenRoughnessTexture&&(n.sheenRoughnessTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),n.sheenRoughnessTexture,function(e){e.name="".concat(r.name," (Sheen Roughness)"),o.fuzzRoughnessTexture=e}))),Promise.all(a).then(function(){})},e}();we(Jt),Ae(Jt,!0,function(e){return new Qt(e)});var Zt={__proto__:null,KHR_materials_sheen:Qt},$t="KHR_materials_fuzz",en=function(){function e(e){this.name=$t,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed($t)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;return o.configureFuzz(),o.fuzzWeight=void 0!==n.fuzzFactor?n.fuzzFactor:0,o.fuzzColor=void 0!==n.fuzzColorFactor?t.Color3.FromArray(n.fuzzColorFactor):t.Color3.White(),o.fuzzRoughness=void 0!==n.fuzzRoughnessFactor?n.fuzzRoughnessFactor:.5,n.fuzzTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzTexture"),n.fuzzTexture,function(e){e.name="".concat(r.name," (Fuzz)"),o.fuzzWeightTexture=e})),n.fuzzColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzColorTexture"),n.fuzzColorTexture,function(e){e.name="".concat(r.name," (Fuzz Color)"),o.fuzzColorTexture=e})),n.fuzzRoughnessTexture&&(n.fuzzRoughnessTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzRoughnessTexture"),n.fuzzRoughnessTexture,function(e){e.name="".concat(r.name," (Fuzz Roughness)"),o.fuzzRoughnessTexture=e}))),Promise.all(a).then(function(){})},e}();we($t),Ae($t,!0,function(e){return new en(e)});var tn={__proto__:null,KHR_materials_fuzz:en},nn="KHR_materials_specular",rn=function(){function e(e){this.name=nn,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(nn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(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,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(r),i=new Array;return a.specularWeight=null!==(o=n.specularFactor)&&void 0!==o?o:1,a.specularColor=void 0!==n.specularColorFactor?t.Color3.FromArray(n.specularColorFactor):new t.Color3(1,1,1),n.specularTexture&&(n.specularTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),n.specularTexture,function(e){e.name="".concat(r.name," (Specular)"),a.specularWeightTexture=e}))),n.specularColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),n.specularColorTexture,function(e){e.name="".concat(r.name," (Specular Color)"),a.specularColorTexture=e})),Promise.all(i).then(function(){})},e}();we(nn),Ae(nn,!0,function(e){return new rn(e)});var on={__proto__:null,KHR_materials_specular:rn},an="KHR_materials_ior",sn=function(){function e(e){this.name=an,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(an)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(an),Ae(an,!0,function(e){return new sn(e)});var ln={__proto__:null,KHR_materials_ior:sn},un="KHR_materials_variants",cn=function(){function e(e){this.name=un,this._loader=e,this.enabled=this._loader.isExtensionUsed(un)&&!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(un," 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(un," 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(un," 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[un])||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[un];(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(n,r,o,a,i,s){var l=this;return je.LoadExtensionAsync(n,i,this.name,function(u,c){return g(l,void 0,void 0,function(){var l,f=this;return b(this,function(h){switch(h.label){case 0:return(l=new Array).push(this._loader._loadMeshPrimitiveAsync(n,r,o,a,i,function(r){if(s(r),r instanceof t.Mesh){var o=je._GetDrawMode(n,i.mode),a=f._loader.rootBabylonMesh,h=a?a._internalMetadata=a._internalMetadata||{}:{},d=h.gltf=h.gltf||{},p=d[un]=d[un]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:r,material:r.material});for(var m=function(t){var n=c.mappings[t],i=He.Get("".concat(u,"/mappings/").concat(t,"/material"),f._loader.gltf.materials,n.material);l.push(f._loader._loadMaterialAsync("#/materials/".concat(n.material),i,r,o,function(t){for(var o=function(o){var i=n.variants[o],s=He.Get("/extensions/".concat(un,"/variants/").concat(i),f._variants,i);p.variants[s.name]=p.variants[s.name]||[],p.variants[s.name].push({mesh:r,material:t}),r.onClonedObservable.add(function(t){var n,o=t,i=o;do{if(!(i=i.parent))return;n=e._GetExtensionMetadata(i)}while(null===n);if(a&&n===e._GetExtensionMetadata(a)){for(var l in i._internalMetadata={},a._internalMetadata)i._internalMetadata[l]=a._internalMetadata[l];for(var l in i._internalMetadata.gltf=[],a._internalMetadata.gltf)i._internalMetadata.gltf[l]=a._internalMetadata.gltf[l];i._internalMetadata.gltf[un]={lastSelected:null,original:[],variants:{}};for(var u=0,c=n.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[un].original.push({mesh:f.mesh,material:f.material})}for(var l in n.variants)if(Object.prototype.hasOwnProperty.call(n.variants,l)){i._internalMetadata.gltf[un].variants[l]=[];for(var h=0,d=n.variants[l];h<d.length;h++){var p=d[h];i._internalMetadata.gltf[un].variants[l].push({mesh:p.mesh,material:p.material})}}n=i._internalMetadata.gltf[un]}for(var m=0,_=n.original;m<_.length;m++)(y=_[m]).mesh===r&&(y.mesh=o);for(var g=0,b=n.variants[s.name];g<b.length;g++){var y;(y=b[g]).mesh===r&&(y.mesh=o)}})},i=0;i<n.variants.length;++i)o(i)}))},_=0;_<c.mappings.length;++_)m(_)}})),[4,Promise.all(l).then(function(e){return e[0]})];case 1:return[2,h.sent()]}})})})},e}();we(un),Ae(un,!0,function(e){return new cn(e)});var fn={__proto__:null,KHR_materials_variants:cn},hn=function(){function e(n,r,o){var a=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._translucentMaterialIndices=new Map,this._opaqueOnlySubMeshes=new Map,this._savedSubMeshes=new Map,this._options=_(_({},e._GetDefaultOptions()),n),this._scene=r,this._scene._transmissionHelper=this,this._loader=o,this.onErrorObservable=new t.Observable,this._scene.onDisposeObservable.addOnce(function(){a.dispose()}),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:t.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},e.prototype.updateOptions=function(e){var t=this,n=Object.keys(e).filter(function(n){return t._options[n]!==e[n]});if(n.length){var r=_(_({},this._options),e),o=this._options;this._options=r,r.renderSize===o.renderSize&&r.renderTargetTextureType===o.renderTargetTextureType&&r.generateMipmaps===o.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=r.samples,this._opaqueRenderTarget.lodGenerationScale=r.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=r.lodGenerationOffset):this._setupRenderTargets()}},e.prototype.getOpaqueTarget=function(){return this._opaqueRenderTarget},e.prototype._classifyMeshMaterials=function(e){var n=e.material;if(!n)return"opaque";if(!(n instanceof t.MultiMaterial))return this._loader.isMatchingMaterialType(n)&&(s=this._loader._getOrCreateMaterialAdapter(n)).isTranslucent()?(s.refractionBackgroundTexture=this._opaqueRenderTarget,"transparent"):"opaque";for(var r=!1,o=!1,a=new Set,i=0;i<n.subMaterials.length;i++){var s,l=n.subMaterials[i];l&&this._loader.isMatchingMaterialType(l)&&(s=this._loader._getOrCreateMaterialAdapter(l)).isTranslucent()?(s.refractionBackgroundTexture=this._opaqueRenderTarget,r=!0,a.add(i)):o=!0}return r&&o?(this._translucentMaterialIndices.set(e,a),this._rebuildOpaqueOnlySubMeshes(e,a),"mixed"):(this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e),r?"transparent":"opaque")},e.prototype._rebuildOpaqueOnlySubMeshes=function(e,t){e.subMeshes&&this._opaqueOnlySubMeshes.set(e,e.subMeshes.filter(function(e){return!t.has(e.materialIndex)}))},e.prototype._addMesh=function(e){var n=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),t.Tools.SetImmediate(function(){e.material&&("transparent"===n._classifyMeshMaterials(e)?-1===n._transparentMeshesCache.indexOf(e)&&n._transparentMeshesCache.push(e):-1===n._opaqueMeshesCache.indexOf(e)&&n._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),this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e)},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);"transparent"===this._classifyMeshMaterials(e)?-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,n,r,o=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new t.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!==(n=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==n?n:this._scene.clearColor.clone(),this._opaqueRenderTarget.clearColor.a=0,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){r=o._scene.environmentIntensity,o._scene.environmentIntensity=1,o._options.clearColor?e.clearColor.copyFrom(o._options.clearColor):o._scene.clearColor.toLinearSpaceToRef(e.clearColor,o._scene.getEngine().useExactSrgbConversions),e.clearColor.a=0;for(var t=o._opaqueOnlySubMeshes.entries(),n=t.next();!n.done;n=t.next()){var a=n.value[0],i=n.value[1];a.subMeshes&&(o._savedSubMeshes.set(a,a.subMeshes),a.subMeshes=i)}}),this._opaqueRenderTarget.onAfterUnbindObservable.add(function(){o._scene.environmentIntensity=r;for(var e=o._savedSubMeshes.entries(),t=e.next();!t.done;t=e.next())t.value[0].subMeshes=t.value[1];o._savedSubMeshes.clear()});for(var a=0,i=this._transparentMeshesCache;a<i.length;a++)(u=i[a]).material&&this._classifyMeshMaterials(u);for(var s=this._translucentMaterialIndices.entries(),l=s.next();!l.done;l=s.next()){var u;(u=l.value[0]).material&&this._classifyMeshMaterials(u)}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[],this._translucentMaterialIndices.clear(),this._opaqueOnlySubMeshes.clear(),this._savedSubMeshes.clear()},e}(),dn="KHR_materials_transmission",pn=function(){function e(e){this.name=dn,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(dn),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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 hn({},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}();we(dn),Ae(dn,!0,function(e){return new pn(e)});var mn={__proto__:null,KHR_materials_transmission:pn},_n="KHR_materials_diffuse_transmission",gn=function(){function e(e){this.name=_n,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(_n),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r,o){var a,i=this._loader._getOrCreateMaterialAdapter(r);i.configureSubsurface(),i.subsurfaceWeight=null!==(a=o.diffuseTransmissionFactor)&&void 0!==a?a:0,i.diffuseTransmissionTint=void 0!==o.diffuseTransmissionColorFactor?t.Color3.FromArray(o.diffuseTransmissionColorFactor):t.Color3.White();var s=new Array;return o.diffuseTransmissionTexture&&(o.diffuseTransmissionTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),o.diffuseTransmissionTexture).then(function(e){e.name="".concat(r.name," (Diffuse Transmission)"),i.subsurfaceWeightTexture=e}))),o.diffuseTransmissionColorTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),o.diffuseTransmissionColorTexture).then(function(e){e.name="".concat(r.name," (Diffuse Transmission Color)"),i.diffuseTransmissionTintTexture=e})),Promise.all(s).then(function(){})},e}();we(_n),Ae(_n,!0,function(e){return new gn(e)});var bn={__proto__:null,KHR_materials_diffuse_transmission:gn},yn="KHR_materials_volume",vn=function(){function e(e){this.name=yn,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(yn),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r,o){var a,i=this._loader._getOrCreateMaterialAdapter(r);if(0===i.transmissionWeight&&0===i.subsurfaceWeight||!o.thicknessFactor)return Promise.resolve();i.geometryThinWalled=!1;var s=void 0!==o.attenuationDistance?o.attenuationDistance:Number.MAX_VALUE,l=void 0!==o.attenuationColor&&3==o.attenuationColor.length?t.Color3.FromArray(o.attenuationColor):t.Color3.White();i.configureVolume(),i.transmissionColor=l,i.transmissionDepth=s,i.volumeThickness=null!==(a=o.thicknessFactor)&&void 0!==a?a:0;var u=new Array;return o.thicknessTexture&&(o.thicknessTexture.nonColorData=!0,u.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),o.thicknessTexture,function(e){e.name="".concat(r.name," (Thickness)"),i.volumeThicknessTexture=e}))),Promise.all(u).then(function(){})},e}();we(yn),Ae(yn,!0,function(e){return new vn(e)});var Tn={__proto__:null,KHR_materials_volume:vn},xn="KHR_materials_volume_scatter",An=function(){function e(e){this.name=xn,this.order=172,this._loader=e,this.enabled=this._loader.isExtensionUsed(xn),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r,o){var a=this._loader._getOrCreateMaterialAdapter(r);if(0===a.transmissionWeight&&0===a.subsurfaceWeight||a.geometryThinWalled)return Promise.resolve();var i=void 0!==o.multiscatterColorFactor&&3==o.multiscatterColorFactor.length?t.Color3.FromArray(o.multiscatterColorFactor):t.Color3.Black(),s=void 0!==o.scatterAnisotropy?o.scatterAnisotropy:0,l=Promise.resolve(null);o.multiscatterColorTexture&&(o.multiscatterColorTexture.nonColorData=!0,l=this._loader.loadTextureInfoAsync("".concat(e,"/multiscatterColorTexture"),o.multiscatterColorTexture,function(e){e.name="".concat(r.name," (Scatter Color)"),a.transmissionWeight>0&&(a.transmissionScatterTexture=e),a.subsurfaceWeight>0&&(a.subsurfaceColorTexture=e)}));var u=new t.Vector3(-Math.log(a.transmissionColor.r),-Math.log(a.transmissionColor.g),-Math.log(a.transmissionColor.b));if(u.scaleInPlace(1/Math.max(a.transmissionDepth,1e-6)),a.transmissionWeight>0){var c=function(e){var n=new t.Vector3(e.r,e.g,e.b),r=new t.Vector3(4.09712,4.09712,4.09712);r.addInPlace(new t.Vector3(4.20863,4.20863,4.20863).multiplyInPlace(n));var o=new t.Vector3(9.59217,9.59217,9.59217);return o.addInPlace(new t.Vector3(41.6808,41.6808,41.6808).multiplyInPlace(n)),o.addInPlace(new t.Vector3(17.7126,17.7126,17.7126).multiplyInPlace(n.multiply(n))),r.subtractInPlace(new t.Vector3(Math.sqrt(o.x),Math.sqrt(o.y),Math.sqrt(o.z))),new t.Vector3(1,1,1).subtract(r.multiply(r))}(i),f=u.multiply(c);f.scaleInPlace(a.transmissionDepth),a.transmissionScatter.set(f.x,f.y,f.z),a.transmissionScatterAnisotropy=s}if(a.subsurfaceWeight>0){a.subsurfaceScatterAnisotropy=s,a.subsurfaceColor=i;var h=new t.Vector3(0!==u.x?1/u.x:1,0!==u.y?1/u.y:1,0!==u.z?1/u.z:1);a.subsurfaceRadius=Math.max(h.x,h.y,h.z),a.subsurfaceRadiusScale=new t.Color3(h.x/a.subsurfaceRadius,h.y/a.subsurfaceRadius,h.z/a.subsurfaceRadius)}return l.then(function(){})},e}();we(xn),Ae(xn,!0,function(e){return new An(e)});var wn={__proto__:null,KHR_materials_volume_scatter:An},On="KHR_materials_dispersion",Cn=function(){function e(e){this.name=On,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(On)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(On),Ae(On,!0,function(e){return new Cn(e)});var Mn={__proto__:null,KHR_materials_dispersion:Cn},En="KHR_materials_diffuse_roughness",Rn=function(){function e(e){this.name=En,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(En)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(En),Ae(En,!0,function(e){return new Rn(e)});var Fn={__proto__:null,KHR_materials_diffuse_roughness:Rn},Ln="KHR_mesh_quantization",Pn=function(){function e(e){this.name=Ln,this.enabled=e.isExtensionUsed(Ln)}return e.prototype.dispose=function(){},e}();we(Ln),Ae(Ln,!0,function(e){return new Pn(e)});var Sn={__proto__:null,KHR_mesh_quantization:Pn},Nn="KHR_texture_basisu",In=function(){function e(e){this.name=Nn,this._loader=e,this.enabled=e.isExtensionUsed(Nn)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(this,function(s){switch(s.label){case 0:return r=null==t.sampler?je.DefaultSampler:He.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=He.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}();we(Nn),Ae(Nn,!0,function(e){return new In(e)});var Bn={__proto__:null,KHR_texture_basisu:In},kn="KHR_texture_transform",Gn=function(){function e(e){this.name=kn,this._loader=e,this.enabled=this._loader.isExtensionUsed(kn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){return b(this,function(o){switch(o.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,n,function(e){if(!(e instanceof t.Texture))throw new Error("".concat(a,": Texture type not supported"));i.offset&&(e.uOffset=i.offset[0],e.vOffset=i.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,i.rotation&&(e.wAng=-i.rotation),i.scale&&(e.uScale=i.scale[0],e.vScale=i.scale[1]),null!=i.texCoord&&(e.coordinatesIndex=i.texCoord),r(e)})];case 1:return[2,o.sent()]}})})})},e}();we(kn),Ae(kn,!0,function(e){return new Gn(e)});var Vn={__proto__:null,KHR_texture_transform:Gn},Dn="KHR_xmp_json_ld",Hn=function(){function e(e){this.name=Dn,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Dn)}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}();we(Dn),Ae(Dn,!0,function(e){return new Hn(e)});var Kn={__proto__:null,KHR_xmp_json_ld:Hn};function jn(e,n,r,o){return t.Color3.FromArray(n,r).scale(o)}function Un(e,t,n,r){return t[n]*r}function Wn(e,t,n,r){return-t[n]*r}function zn(e,t,n,r){return t[n+1]*r}function qn(e,t,n,r){return t[n]*r*2}function Yn(e){return{scale:[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Un,function(){return 2}),new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),zn,function(){return 2})],offset:[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Un,function(){return 2}),new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),zn,function(){return 2})],rotation:[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),Wn,function(){return 1})]}}var Xn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ye),Jn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(Ye),Qn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ye),Zn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(Ye);ke("/cameras/{}/orthographic/xmag",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",Wn,function(){return 1}),new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",zn,function(){return 1})]),ke("/cameras/{}/orthographic/ymag",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",Wn,function(){return 1}),new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",zn,function(){return 1})]),ke("/cameras/{}/orthographic/zfar",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Un,function(){return 1})]),ke("/cameras/{}/orthographic/znear",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"minZ",Un,function(){return 1})]),ke("/cameras/{}/perspective/yfov",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"fov",Un,function(){return 1})]),ke("/cameras/{}/perspective/zfar",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Un,function(){return 1})]),ke("/cameras/{}/perspective/znear",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"minZ",Un,function(){return 1})]),ke("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",jn,function(){return 4}),new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"alpha",function(e,t,n,r){return t[n+3]*r},function(){return 4})]),ke("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"metallic",Un,function(){return 1})]),ke("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"roughness",Un,function(){return 1})]);var $n=Yn("albedoTexture");ke("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",$n.scale),ke("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",$n.offset),ke("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",$n.rotation);var er=Yn("metallicTexture");ke("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",er.scale),ke("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",er.offset),ke("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",er.rotation),ke("/materials/{}/emissiveFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",jn,function(){return 3})]);var tr=Yn("bumpTexture");ke("/materials/{}/normalTexture/scale",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Un,function(){return 1})]),ke("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",tr.scale),ke("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",tr.offset),ke("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",tr.rotation),ke("/materials/{}/occlusionTexture/strength",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Un,function(){return 1})]);var nr=Yn("ambientTexture");ke("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",nr.scale),ke("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",nr.offset),ke("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",nr.rotation);var rr=Yn("emissiveTexture");ke("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",rr.scale),ke("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",rr.offset),ke("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",rr.rotation),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Un,function(){return 1})]);var or=Yn("anisotropy.texture");ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",or.scale),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",or.offset),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",or.rotation),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Un,function(){return 1})]);var ar=Yn("clearCoat.texture");ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",ar.scale),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",ar.offset),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",ar.rotation);var ir=Yn("clearCoat.bumpTexture");ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",ir.scale),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",ir.offset),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",ir.rotation);var sr=Yn("clearCoat.textureRoughness");ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",sr.scale),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",sr.offset),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",sr.rotation),ke("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_ior/ior",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Un,function(){return 1})]);var lr=Yn("iridescence.texture");ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",lr.scale),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",lr.offset),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",lr.rotation);var ur=Yn("iridescence.thicknessTexture");ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",ur.scale),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",ur.offset),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",ur.rotation),ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",jn,function(){return 3})]),ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Un,function(){return 1})]);var cr=Yn("sheen.texture");ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",cr.scale),ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",cr.offset),ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",cr.rotation);var fr=Yn("sheen.textureRoughness");ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",fr.scale),ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",fr.offset),ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",fr.rotation),ke("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",jn,function(){return 3})]);var hr=Yn("metallicReflectanceTexture");ke("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",hr.scale),ke("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",hr.offset),ke("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",hr.rotation);var dr=Yn("reflectanceTexture");ke("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",dr.scale),ke("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",dr.offset),ke("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",dr.rotation),ke("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Un,function(){return 1})]);var pr=Yn("subSurface.refractionIntensityTexture");ke("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",pr.scale),ke("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",pr.offset),ke("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",pr.rotation),ke("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",jn,function(){return 3})]),ke("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Un,function(){return 1})]);var mr=Yn("subSurface.thicknessTexture");ke("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",mr.scale),ke("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",mr.offset),ke("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",mr.rotation),ke("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Un,function(){return 1})]);var _r=Yn("subSurface.translucencyIntensityTexture");ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",_r.scale),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",_r.offset),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",_r.rotation),ke("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",jn,function(){return 3})]);var gr=Yn("subSurface.translucencyColorTexture");ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",gr.scale),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",gr.offset),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",gr.rotation),ke("/extensions/KHR_lights_punctual/lights/{}/color",[new Qn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",jn,function(){return 3})]),ke("/extensions/KHR_lights_punctual/lights/{}/intensity",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Un,function(){return 1})]),ke("/extensions/KHR_lights_punctual/lights/{}/range",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"range",Un,function(){return 1})]),ke("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",qn,function(){return 1})]),ke("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"angle",qn,function(){return 1})]),ke("/extensions/EXT_lights_area/lights/{}/color",[new Qn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",jn,function(){return 3})]),ke("/extensions/EXT_lights_area/lights/{}/intensity",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Un,function(){return 1})]),ke("/extensions/EXT_lights_area/lights/{}/size",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"radius",Un,function(){return 1})]),ke("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"radius",Un,function(){return 1})]),ke("/nodes/{}/extensions/EXT_lights_ies/color",[new Qn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",jn,function(){return 3})]),ke("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Un,function(){return 1})]),ke("/nodes/{}/extensions/KHR_node_visibility/visible",[new Zn(t.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Un,function(){return 1})]);var br="KHR_animation_pointer",yr=function(){function e(e){this.name=br,this._loader=e,this._pathToObjectConverter=Ie(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(br)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,n,r,o,a){var i,s=null===(i=o.target.extensions)||void 0===i?void 0:i.KHR_animation_pointer;if(!s||!this._pathToObjectConverter)return null;"pointer"!==o.target.path&&t.Logger.Warn("".concat(e,"/target/path: Value (").concat(o.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=o.target.node&&t.Logger.Warn("".concat(e,"/target/node: Value (").concat(o.target.node,") must not be present when using the ").concat(this.name," extension"));var l="".concat(e,"/extensions/").concat(this.name),u=s.pointer;if(!u)throw new Error("".concat(l,": Pointer is missing"));try{var c=this._pathToObjectConverter.convert(u);if(!c.info.interpolation)throw new Error("".concat(l,"/pointer: Interpolation is missing"));return this._loader._loadAnimationChannelFromTargetInfoAsync(e,n,r,o,{object:c.object,info:c.info.interpolation},a)}catch(e){return t.Logger.Warn("".concat(l,"/pointer: Invalid pointer (").concat(u,") skipped")),null}},e}();we(br),Ae(br,!0,function(e){return new yr(e)});var vr={__proto__:null,KHR_animation_pointer:yr},Tr="MSFT_audio_emitter",xr=function(){function e(e){this.name=Tr,this._loader=e,this.enabled=this._loader.isExtensionUsed(Tr)}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,He.Assign(this._clips),He.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return je.LoadExtensionAsync(e,t,this.name,function(r,o){return g(n,void 0,void 0,function(){var n,a,i,s,l;return b(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=He.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,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(e,a){return g(o,void 0,void 0,function(){var o,i,s=this;return b(this,function(l){switch(l.label){case 0:return o=new Array,[4,this._loader.loadNodeAsync(e,n,function(n){for(var i=function(r){var a=He.Get("".concat(e,"/emitters"),s._emitters,r);o.push(s._loadEmitterAsync("".concat(e,"/emitters/").concat(a.index),a).then(function(){for(var e=0,r=a._babylonSounds;e<r.length;e++){var o=r[e];o.attachToMesh(n),null==a.innerAngle&&null==a.outerAngle||(o.setLocalDirectionToMesh(t.Vector3.Forward()),o.setDirectionalCone(2*t.Tools.ToDegrees(null==a.innerAngle?Math.PI:a.innerAngle),2*t.Tools.ToDegrees(null==a.outerAngle?Math.PI:a.outerAngle),0))}}))},l=0,u=a.emitters;l<u.length;l++)i(u[l]);r(n)})];case 1:return i=l.sent(),[4,Promise.all(o)];case 2:return l.sent(),[2,i]}})})})},e.prototype.loadAnimationAsync=function(e,t){var n=this;return je.LoadExtensionAsync(e,t,this.name,function(r,o){return g(n,void 0,void 0,function(){var n,a,i,s,l;return b(this,function(u){switch(u.label){case 0:return[4,this._loader.loadAnimationAsync(e,t)];case 1:for(n=u.sent(),a=new Array,He.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,n){if(n._objectURL)return n._objectURL;var r;if(n.uri)r=this._loader.loadUriAsync(e,n,n.uri);else{var o=He.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,n.bufferView);r=this._loader.loadBufferViewAsync("/bufferViews/".concat(o.index),o)}return n._objectURL=r.then(function(e){var r=t.GetBlobBufferSource(e);return URL.createObjectURL(new Blob([r],{type:n.mimeType}))}),n._objectURL},e.prototype._loadEmitterAsync=function(e,n){var r=this;if(n._babylonSounds=n._babylonSounds||[],!n._babylonData){for(var o=new Array,a=n.name||"emitter".concat(n.index),i={loop:!1,autoplay:!1,volume:null==n.volume?1:n.volume},s=function(e){var s="/extensions/".concat(l.name,"/clips"),u=He.Get(s,l._clips,n.clips[e].clip);o.push(l._loadClipAsync("".concat(s,"/").concat(n.clips[e].clip),u).then(function(o){var s=n._babylonSounds[e]=new t.Sound(a,o,r._loader.babylonScene,null,i);s.refDistance=n.refDistance||1,s.maxDistance=n.maxDistance||256,s.rolloffFactor=n.rolloffFactor||1,s.distanceModel=n.distanceModel||"exponential"}))},l=this,u=0;u<n.clips.length;u++)s(u);var c=Promise.all(o).then(function(){var e=n.clips.map(function(e){return e.weight||1}),r=new t.WeightedSound(n.loop||!1,n._babylonSounds,e);n.innerAngle&&(r.directionalConeInnerAngle=2*t.Tools.ToDegrees(n.innerAngle)),n.outerAngle&&(r.directionalConeOuterAngle=2*t.Tools.ToDegrees(n.outerAngle)),n.volume&&(r.volume=n.volume),n._babylonData.sound=r});n._babylonData={loaded:c}}return n._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,n,r,o,a){var i=this;if(0==a.targetedAnimations.length)return Promise.resolve();var s=a.targetedAnimations[0],l=o.emitter,u=He.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,l);return this._loadEmitterAsync(e,u).then(function(){var n=u._babylonData.sound;if(n){var r=new t.AnimationEvent(o.time,i._getEventAction(e,n,o.action,o.time,o.startOffset));s.animation.addEvent(r),a.onAnimationGroupEndObservable.add(function(){n.stop()}),a.onAnimationGroupPauseObservable.add(function(){n.pause()})}})},e}();we(Tr),Ae(Tr,!0,function(e){return new xr(e)});var Ar={__proto__:null,MSFT_audio_emitter:xr},wr="MSFT_lod",Or=function(){function e(e){var n,r;this.name=wr,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new t.Observable,this.onMaterialLODsLoadedObservable=new t.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!==(r=null===(n=this._loader.parent.extensionOptions[wr])||void 0===n?void 0:n.maxLODsToLoad)&&void 0!==r?r:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(wr)}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,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(e,a){return g(o,void 0,void 0,function(){var o,i,s,l,u,c=this;return b(this,function(f){switch(f.label){case 0:for(i=this._getLODs(e,n,this._loader.gltf.nodes,a.ids),this._loader.logOpen("".concat(e)),s=function(e){var n=i[e];0!==e&&(l._nodeIndexLOD=e,l._nodeSignalLODs[e]=l._nodeSignalLODs[e]||new t.Deferred);var a=l._loader.loadNodeAsync("/nodes/".concat(n.index),n,function(e){r(e),e.setEnabled(!1)}).then(function(t){if(0!==e){var n=i[e-1];n._babylonTransformNode&&(c._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t});l._nodePromiseLODs[e]=l._nodePromiseLODs[e]||[],0===e?o=a:(l._nodeIndexLOD=null,l._nodePromiseLODs[e].push(a))},l=this,u=0;u<i.length;u++)s(u);return this._loader.logClose(),[4,o];case 1:return[2,f.sent()]}})})})},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var a=this;return this._nodeIndexLOD?null:je.LoadExtensionAsync(e,t,this.name,function(e,i){return g(a,void 0,void 0,function(){var a,s,l,u,c,f=this;return b(this,function(h){switch(h.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,h.sent()]}})})})},e.prototype._loadUriAsync=function(e,n,r){var o=this;if(null!==this._nodeIndexLOD){this._loader.log("deferred");var a=this._nodeIndexLOD-1;return this._nodeSignalLODs[a]=this._nodeSignalLODs[a]||new t.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then(function(){return g(o,void 0,void 0,function(){return b(this,function(t){switch(t.label){case 0:return[4,this._loader.loadUriAsync(e,n,r)];case 1:return[2,t.sent()]}})})})}return null!==this._materialIndexLOD?(this._loader.log("deferred"),a=this._materialIndexLOD-1,this._materialSignalLODs[a]=this._materialSignalLODs[a]||new t.Deferred,this._materialSignalLODs[a].promise.then(function(){return g(o,void 0,void 0,function(){return b(this,function(t){switch(t.label){case 0:return[4,this._loader.loadUriAsync(e,n,r)];case 1:return[2,t.sent()]}})})})):null},e.prototype.loadBufferAsync=function(e,n,r,o){var a=this;if(this._loader.parent.useRangeRequests&&!n.uri){if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));var i=function(e,n){return g(a,void 0,void 0,function(){var a,i,s;return b(this,function(l){switch(l.label){case 0:return i=(a=r)+o-1,(s=e[n])?(s.start=Math.min(s.start,a),s.end=Math.max(s.end,i)):(s={start:a,end:i,loaded:new t.Deferred},e[n]=s),[4,s.loaded.promise.then(function(e){return new Uint8Array(e.buffer,e.byteOffset+r-s.start,o)})];case 1:return[2,l.sent()]}})})};return this._loader.log("deferred"),null!==this._nodeIndexLOD?i(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?i(this._materialBufferLODs,this._materialIndexLOD):i(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(He.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}();we(wr),Ae(wr,!0,function(e){return new Or(e)});var Cr={__proto__:null,MSFT_lod:Or},Mr="MSFT_minecraftMesh",Er=function(){function e(e){this.name=Mr,this._loader=e,this.enabled=this._loader.isExtensionUsed(Mr)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtraAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(Mr),Ae(Mr,!0,function(e){return new Er(e)});var Rr={__proto__:null,MSFT_minecraftMesh:Er},Fr="MSFT_sRGBFactors",Lr=function(){function e(e){this.name=Fr,this._loader=e,this.enabled=this._loader.isExtensionUsed(Fr)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtraAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,o,i;return b(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}();we(Fr),Ae(Fr,!0,function(e){return new Lr(e)});var Pr={__proto__:null,MSFT_sRGBFactors:Lr};function Sr(e){var t=e.split(":");return Nr({op:t[0],extension:t[1]})}function Nr(e,n){var r;void 0===n&&(n=!0);var o=e.extension?null===(r=Br[e.extension])||void 0===r?void 0:r[e.op]:kr[e.op];if(!o&&(t.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),n)){var a={},i={flows:{}};if(e.inputValueSockets)for(var s in a.values={},e.inputValueSockets)a.values[s]={name:s};return e.outputValueSockets&&(i.values={},Object.keys(e.outputValueSockets).forEach(function(e){i.values[e]={name:e}})),{blocks:[],inputs:a,outputs:i}}return o}function Ir(e,t,n){Br[t]||(Br[t]={}),Br[t][e]=n}var Br={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},kr={"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,n){var r,o;if(!e.configuration)return t.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};var a=e.configuration.event;if(!a)return t.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 i=null===(r=a.value)||void 0===r?void 0:r[0];return"number"!=typeof i?(t.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):(null===(o=n.events)||void 0===o?void 0:o[i])?{valid:!0}:(t.Logger.Error("Event with id ".concat(i," not found")),{valid:!1,error:"Event with id ".concat(i," 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":Gr("FlowGraphEBlock"),"math/Pi":Gr("FlowGraphPIBlock"),"math/Inf":Gr("FlowGraphInfBlock"),"math/NaN":Gr("FlowGraphNaNBlock"),"math/abs":Gr("FlowGraphAbsBlock"),"math/sign":Gr("FlowGraphSignBlock"),"math/trunc":Gr("FlowGraphTruncBlock"),"math/floor":Gr("FlowGraphFloorBlock"),"math/ceil":Gr("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":Gr("FlowGraphFractBlock"),"math/neg":Gr("FlowGraphNegationBlock"),"math/add":Gr("FlowGraphAddBlock",["a","b"],!0),"math/sub":Gr("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?Vr(e):{valid:!0}}},"math/div":Gr("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Gr("FlowGraphModuloBlock",["a","b"]),"math/min":Gr("FlowGraphMinBlock",["a","b"]),"math/max":Gr("FlowGraphMaxBlock",["a","b"]),"math/clamp":Gr("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Gr("FlowGraphSaturateBlock"),"math/mix":Gr("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Gr("FlowGraphEqualityBlock",["a","b"]),"math/lt":Gr("FlowGraphLessThanBlock",["a","b"]),"math/le":Gr("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Gr("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Gr("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":Gr("FlowGraphIsNaNBlock"),"math/isInf":Gr("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":Gr("FlowGraphSinBlock"),"math/cos":Gr("FlowGraphCosBlock"),"math/tan":Gr("FlowGraphTanBlock"),"math/asin":Gr("FlowGraphASinBlock"),"math/acos":Gr("FlowGraphACosBlock"),"math/atan":Gr("FlowGraphATanBlock"),"math/atan2":Gr("FlowGraphATan2Block",["a","b"]),"math/sinh":Gr("FlowGraphSinhBlock"),"math/cosh":Gr("FlowGraphCoshBlock"),"math/tanh":Gr("FlowGraphTanhBlock"),"math/asinh":Gr("FlowGraphASinhBlock"),"math/acosh":Gr("FlowGraphACoshBlock"),"math/atanh":Gr("FlowGraphATanhBlock"),"math/exp":Gr("FlowGraphExponentialBlock"),"math/log":Gr("FlowGraphLogBlock"),"math/log2":Gr("FlowGraphLog2Block"),"math/log10":Gr("FlowGraphLog10Block"),"math/sqrt":Gr("FlowGraphSquareRootBlock"),"math/cbrt":Gr("FlowGraphCubeRootBlock"),"math/pow":Gr("FlowGraphPowerBlock",["a","b"]),"math/length":Gr("FlowGraphLengthBlock"),"math/normalize":Gr("FlowGraphNormalizeBlock"),"math/dot":Gr("FlowGraphDotBlock",["a","b"]),"math/cross":Gr("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":Gr("FlowGraphTransposeBlock"),"math/determinant":Gr("FlowGraphDeterminantBlock"),"math/inverse":Gr("FlowGraphInvertMatrixBlock"),"math/matMul":Gr("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":Gr("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":Gr("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":Gr("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":Gr("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],h=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[h.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],h=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[h.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],h=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[h.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",o}},"math/asr":Gr("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Gr("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Gr("FlowGraphLeadingZerosBlock"),"math/ctz":Gr("FlowGraphTrailingZerosBlock"),"math/popcnt":Gr("FlowGraphOneBitsCounterBlock"),"math/rad":Gr("FlowGraphDegToRadBlock"),"math/deg":Gr("FlowGraphRadToDegBlock"),"type/boolToInt":Gr("FlowGraphBooleanToInt"),"type/boolToFloat":Gr("FlowGraphBooleanToFloat"),"type/intToBool":Gr("FlowGraphIntToBoolean"),"type/intToFloat":Gr("FlowGraphIntToFloat"),"type/floatToInt":Gr("FlowGraphFloatToInt"),"type/floatToBool":Gr("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 n,r=null===(n=e.configuration)||void 0===n?void 0:n.cases;if(r&&r.value){if(!r.value.every(function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())}))return t.Logger.Warn("Switch cases should be integers. Using empty array instead."),r.value=[],{valid:!0};var o=new Set(r.value);r.value=Array.from(o)}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 n,r;return(null===(r=null===(n=e.configuration)||void 0===n?void 0:n.variable)||void 0===r?void 0:r.value)?{valid:!0}:(t.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,n,r,o,a){var i,s,l,u,c,f,h=a[0],d=null===(s=null===(i=e.configuration)||void 0===i?void 0:i.variable.value)||void 0===s?void 0:s[0];if("number"!=typeof d)throw t.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var p=o.arrays.staticVariables[d];void 0===(null===(u=null===(l=h.config)||void 0===l?void 0:l.animationType)||void 0===u?void 0:u.value)&&(h.config||(h.config={}),(c=h.config).animationType||(c.animationType={}),h.config.animationType.value=t.getAnimationTypeByFlowGraphType(p.type));var m=a[4];return m.config||(m.config={}),(f=m.config).variable||(f.variable={}),m.config.variable.value=o.getVariableName(d),a}},"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 n,r=null===(n=e.configuration)||void 0===n?void 0:n.cases;if(r&&r.value){if(!r.value.every(function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())}))return t.Logger.Warn("Switch cases should be integers. Using empty array instead."),r.value=[],{valid:!0};var o=new Set(r.value);r.value=Array.from(o)}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 Gr(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?Vr(e):{valid:!0}}}}function Vr(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 Dr(){return Object.keys(kr)}var Hr={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"}},Kr=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(Hr[n.signature])}},e.prototype._parseDeclarations=function(){if(this._interactivityGraph.declarations)for(var e=0,n=this._interactivityGraph.declarations;e<n.length;e++){var r=n[e],o=Nr(r);if(!o)throw t.Logger.Error(["No mapping found for declaration",r]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:o,fullOperationName:r.extension?r.op+":"+r.extension:r.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,n){var r=this._types[e.type];if(!r)throw t.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==r.length)throw t.Logger.Error(["Invalid value length for variable",e,r]),new Error("Error parsing variables");var o=e.value||[];if(!o.length)switch(r.flowGraphType){case"boolean":o.push(!1);break;case"FlowGraphInteger":o.push(0);break;case"number":o.push(NaN);break;case"Vector2":o.push(NaN,NaN);break;case"Vector3":o.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":o.fill(NaN,0,4);break;case"Matrix":o.fill(NaN,0,16);break;case"Matrix3D":o.fill(NaN,0,9)}return"number"===r.elementType&&"string"==typeof o[0]&&(o[0]=parseFloat(o[0])),{type:r.flowGraphType,value:n?n(o,this):o}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var n=function(n){var o={eventId:n.id||"internalEvent_"+r._internalEventsCounter++};n.values&&(o.eventData=Object.keys(n.values).map(function(r){var o,a=null===(o=n.values)||void 0===o?void 0:o[r];if(!a)throw t.Logger.Error(["No value found for event key",r]),new Error("Error parsing events");var i=e._types[a.type];if(!i)throw t.Logger.Error(["No type found for event value",a]),new Error("Error parsing events");var s=void 0!==a.value?e._parseVariable(a):void 0;return{id:r,type:i.flowGraphType,eventData:!0,value:s}})),r._events.push(o)},r=this,o=0,a=this._interactivityGraph.events;o<a.length;o++)n(a[o])},e.prototype._parseNodes=function(){var e;if(this._interactivityGraph.nodes)for(var n=0,r=this._interactivityGraph.nodes;n<r.length;n++){var o=r[n];if("number"!=typeof o.declaration)throw t.Logger.Error(["No declaration found for node",o]),new Error("Error parsing nodes");var a=this._mappings[o.declaration];if(!a)throw t.Logger.Error(["No mapping found for node",o]),new Error("Error parsing nodes");if(a.flowGraphMapping.validation){var i=a.flowGraphMapping.validation(o,this._interactivityGraph,this._gltf);if(!i.valid)throw new Error("Error validating interactivity node ".concat(null===(e=this._interactivityGraph.declarations)||void 0===e?void 0:e[o.declaration].op," - ").concat(i.error))}for(var s=[],l=0,u=a.flowGraphMapping.blocks;l<u.length;l++){var c=u[l],f=this._getEmptyBlock(c,a.fullOperationName);this._parseNodeConfiguration(o,f,a.flowGraphMapping,c),s.push(f)}this._nodes.push({blocks:s,fullOperationName:a.fullOperationName})}},e.prototype._getEmptyBlock=function(e,n){return{uniqueId:t.RandomGUID(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:n,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,n,r,o){var a,i=e.configuration;if(i)for(var s in i){var l=i[s];if(!l)throw new Error("Error parsing node configuration");var u=null===(a=r.configuration)||void 0===a?void 0:a[s];if(u&&u.toBlock?u.toBlock===o:0===r.blocks.indexOf(o)){var c=null==u?void 0:u.defaultValue;(null==l?void 0:l.value)&&(c=l.value),(null==u?void 0:u.isArray)||(1!==c.length&&t.Logger.Warn("Invalid non-array value length: ".concat(c.length)),c=c[0]),(null==u?void 0:u.dataTransformer)&&(c=u.dataTransformer(c,this)),void 0!==c&&(n.config[(null==u?void 0:u.name)||s]={value:c})}}},e.prototype._parseNodeConnections=function(e){for(var n,r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,b,y,v,T=0;T<this._nodes.length;T++){var x=null===(n=this._interactivityGraph.nodes)||void 0===n?void 0:n[T];if(!x)throw t.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 t.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var O=x.flows||{},C=Object.keys(O).sort(),M=function(e){var n=O[e],c=null===(o=null===(r=w.flowGraphMapping.outputs)||void 0===r?void 0:r.flows)||void 0===o?void 0:o[e],f=(null==c?void 0:c.name)||e,h=E._createNewSocketConnection(f,!0);(c&&c.toBlock&&A.blocks.find(function(e){return e.className===c.toBlock})||A.blocks[0]).signalOutputs.push(h);var d=n.node,p=E._nodes[d];if(!p)throw t.Logger.Error(["No node found for input node id",d]),new Error("Error parsing node connections");var m=Sr(p.fullOperationName);if(!m)throw t.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var _=null===(i=null===(a=m.inputs)||void 0===a?void 0:a.flows)||void 0===i?void 0:i[n.socket||"in"],g=!1;if(!_)for(var b in null===(s=m.inputs)||void 0===s?void 0:s.flows)b.startsWith("[")&&b.endsWith("]")&&(g=!0,_=null===(u=null===(l=m.inputs)||void 0===l?void 0:l.flows)||void 0===u?void 0:u[b]);var y=_?g?_.name.replace("$1",n.socket||""):_.name:n.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=E._createNewSocketConnection(y),v.signalInputs.push(T)),T.connectedPointIds.push(h.uniqueId),h.connectedPointIds.push(T.uniqueId)},E=this,R=0,F=C;R<F.length;R++)M(F[R]);for(var L=x.values||{},P=Object.keys(L),S=function(n){var r=L[n],o=null===(f=null===(c=w.flowGraphMapping.inputs)||void 0===c?void 0:c.values)||void 0===f?void 0:f[n],a=!1;if(!o)for(var i in null===(h=w.flowGraphMapping.inputs)||void 0===h?void 0:h.values)i.startsWith("[")&&i.endsWith("]")&&(a=!0,o=null===(p=null===(d=w.flowGraphMapping.inputs)||void 0===d?void 0:d.values)||void 0===p?void 0:p[i]);var s=o?a?o.name.replace("$1",n):o.name:n,l=N._createNewSocketConnection(s);if((o&&o.toBlock&&A.blocks.find(function(e){return e.className===o.toBlock})||A.blocks[0]).dataInputs.push(l),void 0!==r.value){var u=N._parseVariable(r,o&&o.dataTransformer);e._connectionValues[l.uniqueId]=u}else{if(void 0===r.node)throw t.Logger.Error(["Invalid value for value connection",r]),new Error("Error parsing node connections");var v=r.node,T=r.socket||"value",x=N._nodes[v];if(!x)throw t.Logger.Error(["No node found for output socket reference",r]),new Error("Error parsing node connections");var O=Sr(x.fullOperationName);if(!O)throw t.Logger.Error(["No mapping found for output socket reference",r]),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],M=!1;if(!C)for(var i in null===(g=O.outputs)||void 0===g?void 0:g.values)i.startsWith("[")&&i.endsWith("]")&&(M=!0,C=null===(y=null===(b=O.outputs)||void 0===b?void 0:b.values)||void 0===y?void 0:y[i]);var E=C?M?C.name.replace("$1",T):null==C?void 0:C.name:T,R=C&&C.toBlock&&x.blocks.find(function(e){return e.className===C.toBlock})||x.blocks[0],F=R.dataOutputs.find(function(e){return e.name===E});F||(F=N._createNewSocketConnection(E,!0),R.dataOutputs.push(F)),l.connectedPointIds.push(F.uniqueId),F.connectedPointIds.push(l.uniqueId)}},N=this,I=0,B=P;I<B.length;I++)S(B[I]);if(w.flowGraphMapping.interBlockConnectors)for(var k=0,G=w.flowGraphMapping.interBlockConnectors;k<G.length;k++){var V=G[k],D=V.input,H=V.output,K=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],K)}if(w.flowGraphMapping.extraProcessor){var j=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!j)throw t.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=w.flowGraphMapping.extraProcessor(x,j,w.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,n){return{uniqueId:t.RandomGUID(),name:e,_connectionType:n?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:t.RandomGUID(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var n=0;n<this._staticVariables.length;n++){var r=this._staticVariables[n];e._userVariables[this.getVariableName(n)]=r}return{rightHanded:!0,allBlocks:this._nodes.reduce(function(e,t){return e.concat(t.blocks)},[]),executionContexts:[e]}},e}(),jr="KHR_interactivity",Ur=function(){function e(e){this._loader=e,this.name=jr,this.enabled=this._loader.isExtensionUsed(jr),this._pathConverter=Ie(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&Wr(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return g(this,void 0,void 0,function(){var e,n,r,o,a,i=this;return b(this,function(s){switch(s.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(n=null===(a=this._loader.gltf.extensions)||void 0===a?void 0:a.KHR_interactivity)?((r=new t.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,o=n.graphs.map(function(e){return new Kr(e,i._loader.gltf,i._loader.parent.targetFps).serializeToFlowGraph()}),[4,Promise.all(o.map(function(e){return g(i,void 0,void 0,function(){return b(this,function(n){switch(n.label){case 0:return[4,t.ParseFlowGraphAsync(e,{coordinator:r,pathConverter:this._pathConverter})];case 1:return[2,n.sent()]}})})}))]):[2]):[2];case 1:return s.sent(),r.start(),[2]}})})},e}();function Wr(e){Ge("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new t.Quaternion(NaN,NaN,NaN,NaN);var n=t.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(n.w*=-1,n.x*=-1),n},type:"Quaternion",getTarget:function(){return e.activeCamera}}),Ge("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new t.Vector3(NaN,NaN,NaN);var n=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(n.x*=-1),n},type:"Vector3",getTarget:function(){return e.activeCamera}}),Ge("/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}}),Ge("/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}}),Ge("/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}}),Ge("/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}}),Ge("/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}})}t.addToBlockFactory(jr,"FlowGraphGLTFDataProvider",function(){return g(void 0,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return lo})];case 1:return[2,e.sent().FlowGraphGLTFDataProvider]}})})}),we(jr),Ae(jr,!0,function(e){return new Ur(e)});var zr={__proto__:null,KHR_interactivity:Ur,_AddInteractivityObjectModel:Wr},qr="KHR_node_visibility";Ge("/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 Yr=function(){function e(e){this.name=qr,this._loader=e,this.enabled=e.isExtensionUsed(qr)}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}();we(qr),Ae(qr,!0,function(e){return new Yr(e)});var Xr={__proto__:null,KHR_node_visibility:Yr},Jr="KHR_node_selectability";Ir("event/onSelect",Jr,{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,h,d,p=o[o.length-1];p.config=p.config||{},p.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===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),Ge("/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 Qr=function(){function e(e){this.name=Jr,this._loader=e,this.enabled=e.isExtensionUsed(Jr)}return e.prototype.onReady=function(){return g(this,void 0,void 0,function(){var e;return b(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}();we(Jr),Ae(Jr,!0,function(e){return new Qr(e)});var Zr={__proto__:null,KHR_node_selectability:Qr},$r="KHR_node_hoverability",eo="targetMeshPointerOver_";Ir("event/onHoverIn",$r,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return eo+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,h,d,p=o[o.length-1];p.config=p.config||{},p.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 _=eo+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===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}});var to="targetMeshPointerOut_";Ir("event/onHoverOut",$r,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return to+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,h,d,p=o[o.length-1];p.config=p.config||{},p.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 _=to+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===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),Ge("/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 no=function(){function e(e){this.name=$r,this._loader=e,this.enabled=e.isExtensionUsed($r)}return e.prototype.onReady=function(){return g(this,void 0,void 0,function(){var e;return b(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}();we($r),Ae($r,!0,function(e){return new no(e)});var ro={__proto__:null,KHR_node_hoverability:no},oo="ExtrasAsMetadata",ao=function(){function e(e){this.name=oo,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}();we(oo),Ae(oo,!1,function(e){return new ao(e)});var io={__proto__:null,ExtrasAsMetadata:ao},so=function(e){function n(n){var r,o,a=e.call(this,n)||this,i=n.glTF,s=(null===(r=null==i?void 0:i.animations)||void 0===r?void 0:r.map(function(e){return e._babylonAnimationGroup}))||[];a.animationGroups=a.registerDataOutput("animationGroups",t.RichTypeAny,s);var l=(null===(o=null==i?void 0:i.nodes)||void 0===o?void 0:o.map(function(e){return e._babylonTransformNode}))||[];return a.nodes=a.registerDataOutput("nodes",t.RichTypeAny,l),a}return m(n,e),n.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},n}(t.FlowGraphBlock),lo={__proto__:null,FlowGraphGLTFDataProvider:so},uo={__proto__:null,AddObjectAccessorToKey:Ge,EXT_lights_area:Mt,EXT_lights_ies:bt,EXT_lights_image_based:rt,EXT_mesh_gpu_instancing:it,EXT_meshopt_compression:ut,EXT_texture_avif:mt,EXT_texture_webp:ht,ExtrasAsMetadata:ao,FlowGraphGLTFDataProvider:so,GetMappingForKey:Be,GetPathToObjectConverter:Ie,InteractivityGraphToFlowGraphParser:Kr,KHR_animation_pointer:yr,KHR_draco_mesh_compression:Tt,KHR_interactivity:Ur,KHR_lights:wt,KHR_materials_anisotropy:Wt,KHR_materials_clearcoat:Bt,KHR_materials_coat:Vt,KHR_materials_diffuse_roughness:Rn,KHR_materials_diffuse_transmission:gn,KHR_materials_dispersion:Cn,KHR_materials_emissive_strength:Yt,KHR_materials_fuzz:en,KHR_materials_ior:sn,KHR_materials_iridescence:Kt,KHR_materials_pbrSpecularGlossiness:Ft,KHR_materials_sheen:Qt,KHR_materials_specular:rn,KHR_materials_transmission:pn,KHR_materials_unlit:St,KHR_materials_variants:cn,KHR_materials_volume:vn,KHR_materials_volume_scatter:An,KHR_mesh_quantization:Pn,KHR_node_hoverability:no,KHR_node_selectability:Qr,KHR_node_visibility:Yr,KHR_texture_basisu:In,KHR_texture_transform:Gn,KHR_xmp_json_ld:Hn,MSFT_audio_emitter:xr,MSFT_lod:Or,MSFT_minecraftMesh:Er,MSFT_sRGBFactors:Lr,SetInterpolationForKey:ke,_AddInteractivityObjectModel:Wr,addNewInteractivityFlowGraphMapping:Ir,getAllSupportedNativeNodeTypes:Dr,getMappingForDeclaration:Nr,getMappingForFullOperationName:Sr,gltfTypeToBabylonType:Hr},co={__proto__:null,AddObjectAccessorToKey:Ge,AnimationPropertyInfo:Ye,ArrayItem:He,EXT_lights_area:Mt,EXT_lights_ies:bt,EXT_lights_image_based:rt,EXT_mesh_gpu_instancing:it,EXT_meshopt_compression:ut,EXT_texture_avif:mt,EXT_texture_webp:ht,ExtrasAsMetadata:ao,FlowGraphGLTFDataProvider:so,GLTFFileLoader:k,GLTFLoader:je,GetMappingForKey:Be,GetPathToObjectConverter:Ie,InteractivityGraphToFlowGraphParser:Kr,KHR_animation_pointer:yr,KHR_draco_mesh_compression:Tt,KHR_interactivity:Ur,KHR_lights:wt,KHR_materials_anisotropy:Wt,KHR_materials_clearcoat:Bt,KHR_materials_coat:Vt,KHR_materials_diffuse_roughness:Rn,KHR_materials_diffuse_transmission:gn,KHR_materials_dispersion:Cn,KHR_materials_emissive_strength:Yt,KHR_materials_fuzz:en,KHR_materials_ior:sn,KHR_materials_iridescence:Kt,KHR_materials_pbrSpecularGlossiness:Ft,KHR_materials_sheen:Qt,KHR_materials_specular:rn,KHR_materials_transmission:pn,KHR_materials_unlit:St,KHR_materials_variants:cn,KHR_materials_volume:vn,KHR_materials_volume_scatter:An,KHR_mesh_quantization:Pn,KHR_node_hoverability:no,KHR_node_selectability:Qr,KHR_node_visibility:Yr,KHR_texture_basisu:In,KHR_texture_transform:Gn,KHR_xmp_json_ld:Hn,LoadBoundingInfoFromPositionAccessor:Ke,MSFT_audio_emitter:xr,MSFT_lod:Or,MSFT_minecraftMesh:Er,MSFT_sRGBFactors:Lr,OpenPBRMaterialLoadingAdapter:Ze,PBRMaterialLoadingAdapter:et,SetInterpolationForKey:ke,TransformNodeAnimationPropertyInfo:Xe,WeightAnimationPropertyInfo:Je,_AddInteractivityObjectModel:Wr,addNewInteractivityFlowGraphMapping:Ir,getAllSupportedNativeNodeTypes:Dr,getMappingForDeclaration:Nr,getMappingForFullOperationName:Sr,getQuaternion:ze,getVector3:We,getWeights:qe,gltfTypeToBabylonType:Hr,registerGLTFExtension:Ae,registeredGLTFExtensions:xe,unregisterGLTFExtension:we},fo=function(){function e(){this.materials=[]}return e.prototype.parseMTL=function(n,r,o,a){if(!(r instanceof ArrayBuffer)){for(var i,s=r.split("\n"),l=/\s+/,u=null,c=0;c<s.length;c++){var f=s[c].trim();if(0!==f.length&&"#"!==f.charAt(0)){var h=f.indexOf(" "),d=h>=0?f.substring(0,h):f;d=d.toLowerCase();var p=h>=0?f.substring(h+1).trim():"";if("newmtl"===d)u&&this.materials.push(u),n._blockEntityCollection=!!a,(u=new t.StandardMaterial(p,n))._parentContainer=a,n._blockEntityCollection=!1;else if("kd"===d&&u)i=p.split(l,3).map(parseFloat),u.diffuseColor=t.Color3.FromArray(i);else if("ka"===d&&u)i=p.split(l,3).map(parseFloat),u.ambientColor=t.Color3.FromArray(i);else if("ks"===d&&u)i=p.split(l,3).map(parseFloat),u.specularColor=t.Color3.FromArray(i);else if("ke"===d&&u)i=p.split(l,3).map(parseFloat),u.emissiveColor=t.Color3.FromArray(i);else if("ns"===d&&u)u.specularPower=parseFloat(p);else if("d"===d&&u)u.alpha=parseFloat(p);else if("map_ka"===d&&u)u.ambientTexture=e._GetTexture(o,p,n);else if("map_kd"===d&&u)u.diffuseTexture=e._GetTexture(o,p,n);else if("map_ks"===d&&u)u.specularTexture=e._GetTexture(o,p,n);else if("map_ns"===d);else if("map_bump"===d&&u){var m=p.split(l),_=m.indexOf("-bm"),g=null;_>=0&&(g=m[_+1],m.splice(_,2)),u.bumpTexture=e._GetTexture(o,m.join(" "),n),u.bumpTexture&&null!==g&&(u.bumpTexture.level=parseFloat(g))}else"map_d"===d&&u&&(u.opacityTexture=e._GetTexture(o,p,n))}}u&&this.materials.push(u)}},e._GetTexture=function(n,r,o){if(!r)return null;var a=n;if("file:"===n){var i=r.lastIndexOf("\\");-1===i&&(i=r.lastIndexOf("/")),a+=i>-1?r.substring(i+1):r}else a+=r;return new t.Texture(a,o,!1,e.INVERT_TEXTURE_Y)},e.INVERT_TEXTURE_Y=!0,e}(),ho=function(){function e(e,n,r){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._extColors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new t.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=e,this._babylonMeshesArray=n,this._loadingOptions=r}return e.prototype._isInArray=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[]});var n=e[t[0]].normals.indexOf(t[1]);return-1===n?-1:e[t[0]].idx[n]},e.prototype._isInArrayUV=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[],uv:[]});var n=e[t[0]].normals.indexOf(t[1]);return 1!=n&&t[2]===e[t[0]].uv[n]?e[t[0]].idx[n]:-1},e.prototype._setData=function(e){var t,n,r;null!==(t=e.indiceUvsFromObj)&&void 0!==t||(e.indiceUvsFromObj=-1),null!==(n=e.indiceNormalFromObj)&&void 0!==n||(e.indiceNormalFromObj=-1),-1===(r=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj,e.indiceUvsFromObj]):this._isInArray(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(e.positionVectorFromOBJ),void 0!==e.textureVectorFromOBJ&&this._wrappedUvsForBabylon.push(e.textureVectorFromOBJ),void 0!==e.normalsVectorFromOBJ&&this._wrappedNormalsForBabylon.push(e.normalsVectorFromOBJ),void 0!==e.positionColorsFromOBJ&&this._wrappedColorsForBabylon.push(e.positionColorsFromOBJ),this._tuplePosNorm[e.indicePositionFromObj].normals.push(e.indiceNormalFromObj),this._tuplePosNorm[e.indicePositionFromObj].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[e.indicePositionFromObj].uv.push(e.indiceUvsFromObj)):this._indicesForBabylon.push(r)},e.prototype._unwrapData=function(){try{for(var e=0;e<this._wrappedPositionForBabylon.length;e++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[e].x*this._handednessSign,this._wrappedPositionForBabylon[e].y,this._wrappedPositionForBabylon[e].z),this._wrappedNormalsForBabylon.length&&this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[e].x*this._handednessSign,this._wrappedNormalsForBabylon[e].y,this._wrappedNormalsForBabylon[e].z),this._wrappedUvsForBabylon.length&&this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[e].x,this._wrappedUvsForBabylon[e].y),this._wrappedColorsForBabylon.length&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[e].r,this._wrappedColorsForBabylon[e].g,this._wrappedColorsForBabylon[e].b,this._wrappedColorsForBabylon[e].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0}catch(e){throw new Error("Unable to unwrap data while parsing OBJ data.",{cause:e})}},e.prototype._getTriangles=function(e,t){for(var n=t;n<e.length-1;n++)this._pushTriangle(e,n)},e.prototype._getColor=function(e){var t;return this._loadingOptions.importVertexColors?null!==(t=this._extColors[e])&&void 0!==t?t:this._colors[e]:void 0},e.prototype._setDataForCurrentFaceWithPattern1=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=parseInt(this._triangles[n])-1;this._setData({indicePositionFromObj:r,positionVectorFromOBJ:this._positions[r],positionColorsFromOBJ:this._getColor(r)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern2=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern3=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1,i=parseInt(r[2])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i]})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern4=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("//"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceNormalFromObj:a,positionVectorFromOBJ:this._positions[o],normalsVectorFromOBJ:this._normals[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern5=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=this._positions.length+parseInt(r[0]),a=this._uvs.length+parseInt(r[1]),i=this._normals.length+parseInt(r[2]);this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice()),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon.slice()),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._handledMesh.hasLines=this._hasLineData,this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},e.prototype._optimizeNormals=function(e){var n=e.getVerticesData(t.VertexBuffer.PositionKind),r=e.getVerticesData(t.VertexBuffer.NormalKind),o={};if(n&&r){for(var a=0;a<n.length/3;a++)(l=o[s=n[3*a+0]+"_"+n[3*a+1]+"_"+n[3*a+2]])||(l=[],o[s]=l),l.push(a);var i=new t.Vector3;for(var s in o){var l;if(!((l=o[s]).length<2)){var u=l[0];for(a=1;a<l.length;++a){var c=l[a];r[3*u+0]+=r[3*c+0],r[3*u+1]+=r[3*c+1],r[3*u+2]+=r[3*c+2]}for(i.copyFromFloats(r[3*u+0],r[3*u+1],r[3*u+2]),i.normalize(),a=0;a<l.length;++a)r[3*(c=l[a])+0]=i.x,r[3*c+1]=i.y,r[3*c+2]=i.z}}e.setVerticesData(t.VertexBuffer.NormalKind,r)}},e._IsLineElement=function(e){return e.startsWith("l")},e._IsObjectElement=function(e){return e.startsWith("o")},e._IsGroupElement=function(e){return e.startsWith("g")},e._GetZbrushMRGB=function(e,n){if(!e.startsWith("mrgb"))return null;if(e=e.replace("mrgb","").trim(),n)return[];var r=e.match(/[a-z0-9]/g);if(!r||r.length%8!=0)return[];for(var o=[],a=0;a<r.length/8;a++){var i=r[8*a+2]+r[8*a+3],s=r[8*a+4]+r[8*a+5],l=r[8*a+6]+r[8*a+7];o.push(new t.Color4(parseInt(i,16)/255,parseInt(s,16)/255,parseInt(l,16)/255,1))}return o},e.prototype.parse=function(n,r,o,a,i){var s,l,u=this;r=(r=r.replace(/#MRGB/g,"mrgb")).replace(/#.*$/gm,"").trim(),this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(e,t){return u._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=1):o.useRightHandedSystem?(this._pushTriangle=function(e,t){return u._triangles.push(e[0],e[t+1],e[t])},this._handednessSign=1):(this._pushTriangle=function(e,t){return u._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=-1);var c=r.split("\n"),f=[],h=[];f.push(h);for(var d=0;d<c.length;d++)if(0!==(g=c[d].trim().replace(/\s\s/g," ")).length&&"#"!==g.charAt(0))if((e._IsGroupElement(g)||e._IsObjectElement(g))&&(h=[],f.push(h)),e._IsLineElement(g))for(var p=g.split(" "),m=1;m<p.length-1;m++)h.push("l ".concat(p[m]," ").concat(p[m+1]));else h.push(g);var _=f.flat();for(d=0;d<_.length;d++){var g,b=void 0;if(0!==(g=_[d].trim().replace(/\s\s/g," ")).length&&"#"!==g.charAt(0))if(e.VertexPattern.test(g)){if(b=g.match(/[^ ]+/g),this._positions.push(new t.Vector3(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3]))),this._loadingOptions.importVertexColors)if(b.length>=7){var y=parseFloat(b[4]),v=parseFloat(b[5]),T=parseFloat(b[6]);this._colors.push(new t.Color4(y>1?y/255:y,v>1?v/255:v,T>1?T/255:T,7===b.length||void 0===b[7]?1:parseFloat(b[7])))}else this._colors.push(this._grayColor)}else if(null!==(b=e.NormalPattern.exec(g)))this._normals.push(new t.Vector3(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3])));else if(null!==(b=e.UVPattern.exec(g)))this._uvs.push(new t.Vector2(parseFloat(b[1])*this._loadingOptions.UVScaling.x,parseFloat(b[2])*this._loadingOptions.UVScaling.y));else if(null!==(b=e.FacePattern3.exec(g)))this._setDataForCurrentFaceWithPattern3(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern4.exec(g)))this._setDataForCurrentFaceWithPattern4(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern5.exec(g)))this._setDataForCurrentFaceWithPattern5(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern2.exec(g)))this._setDataForCurrentFaceWithPattern2(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern1.exec(g)))this._setDataForCurrentFaceWithPattern1(b[1].trim().split(" "),1);else if(null!==(b=e.LinePattern1.exec(g)))this._setDataForCurrentFaceWithPattern1(b[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(b=e.LinePattern2.exec(g)))this._setDataForCurrentFaceWithPattern2(b[1].trim().split(" "),0),this._hasLineData=!0;else if(b=e._GetZbrushMRGB(g,!this._loadingOptions.importVertexColors))for(var x=0,A=b;x<A.length;x++){var w=A[x];this._extColors.push(w)}else if(null!==(b=e.LinePattern3.exec(g)))this._setDataForCurrentFaceWithPattern3(b[1].trim().split(" "),0),this._hasLineData=!0;else if(e.GroupDescriptor.test(g)||e.ObjectDescriptor.test(g)){var O={name:g.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:e.ObjectDescriptor.test(g)};this._addPreviousObjMesh(),this._meshesFromObj.push(O),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else e.UseMtlDescriptor.test(g)?(this._materialNameFromObj=g.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),O={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(O),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):e.MtlLibGroupDescriptor.test(g)?i(g.substring(7).trim()):e.SmoothDescriptor.test(g)||t.Logger.Log("Unhandled expression at line : "+g)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon),this._handledMesh.hasLines=this._hasLineData),!this._hasMeshes){var C=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var M=0,E=this._positions;M<E.length;M++){var R=E[M];this._unwrappedPositionsForBabylon.push(R.x,R.y,R.z)}if(this._normals.length)for(var F=0,L=this._normals;F<L.length;F++){var P=L[F];this._unwrappedNormalsForBabylon.push(P.x,P.y,P.z)}if(this._uvs.length)for(var S=0,N=this._uvs;S<N.length;S++){var I=N[S];this._unwrappedUVForBabylon.push(I.x,I.y)}if(this._extColors.length)for(var B=0,k=this._extColors;B<k.length;B++){var G=k[B];this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a)}else if(this._colors.length)for(var V=0,D=this._colors;V<D.length;V++)G=D[V],this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a);this._materialNameFromObj||((C=new t.StandardMaterial(t.Geometry.RandomId(),o)).pointsCloud=!0,this._materialNameFromObj=C.name,this._normals.length||(C.disableLighting=!0,C.emissiveColor=t.Color3.White()))}this._meshesFromObj.push({name:t.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:C,isObject:!0,hasLines:this._hasLineData})}for(var H=0;H<this._meshesFromObj.length;H++){if(n&&this._meshesFromObj[H].name)if(n instanceof Array){if(-1===n.indexOf(this._meshesFromObj[H].name))continue}else if(this._meshesFromObj[H].name!==n)continue;this._handledMesh=this._meshesFromObj[H],o._blockEntityCollection=!!a;var K=new t.Mesh(this._meshesFromObj[H].name,o);if(K._parentContainer=a,o._blockEntityCollection=!1,this._handledMesh._babylonMesh=K,!this._handledMesh.isObject)for(var j=H-1;j>=0;--j)if(this._meshesFromObj[j].isObject&&this._meshesFromObj[j]._babylonMesh){K.parent=this._meshesFromObj[j]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[H].materialName),this._handledMesh.hasLines&&(null!==(s=K._internalMetadata)&&void 0!==s||(K._internalMetadata={}),K._internalMetadata._isLine=!0),0!==(null===(l=this._handledMesh.positions)||void 0===l?void 0:l.length)){var U=new t.VertexData;if(U.indices=this._handledMesh.indices,U.positions=this._handledMesh.positions,this._loadingOptions.computeNormals||!this._handledMesh.normals){var W=new Array;t.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,W),U.normals=W}else U.normals=this._handledMesh.normals;this._handledMesh.uvs&&(U.uvs=this._handledMesh.uvs),this._handledMesh.colors&&(U.colors=this._handledMesh.colors),U.applyToMesh(K),this._loadingOptions.invertY&&(K.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(K),this._babylonMeshesArray.push(K),this._handledMesh.directMaterial&&(K.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(K)}},e.ObjectDescriptor=/^o/,e.GroupDescriptor=/^g/,e.MtlLibGroupDescriptor=/^mtllib /,e.UseMtlDescriptor=/^usemtl /,e.SmoothDescriptor=/^s /,e.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,e.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,e.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,e.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,e.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e}(),po={name:"obj",extensions:".obj"},mo=function(){function e(t){this.name=po.name,this.extensions=po.extensions,this._assetContainer=null,this._loadingOptions=_(_({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"INVERT_TEXTURE_Y",{get:function(){return fo.INVERT_TEXTURE_Y},set:function(e){fo.INVERT_TEXTURE_Y=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{computeNormals:e.COMPUTE_NORMALS,optimizeNormals:e.OPTIMIZE_NORMALS,importVertexColors:e.IMPORT_VERTEX_COLORS,invertY:e.INVERT_Y,invertTextureY:e.INVERT_TEXTURE_Y,UVScaling:e.UV_SCALING,materialLoadingFailsSilently:e.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:e.OPTIMIZE_WITH_UV,skipMaterials:e.SKIP_MATERIALS,useLegacyBehavior:e.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),e.prototype._loadMTL=function(e,n,r,o){var a=n+e;t.Tools.LoadFile(a,r,void 0,void 0,!1,function(e,t){o(a,t)})},e.prototype.createPlugin=function(t){return new e(t[po.name])},e.prototype.canDirectLoad=function(){return!1},e.prototype.importMeshAsync=function(e,t,n,r){return this._parseSolidAsync(e,t,n,r).then(function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}})},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then(function(){})},e.prototype.loadAssetContainerAsync=function(e,n,r){var o=this,a=new t.AssetContainer(e);return this._assetContainer=a,this.importMeshAsync(null,e,n,r).then(function(e){return e.meshes.forEach(function(e){return a.meshes.push(e)}),e.meshes.forEach(function(e){var t=e.material;t&&-1==a.materials.indexOf(t)&&(a.materials.push(t),t.getActiveTextures().forEach(function(e){-1==a.textures.indexOf(e)&&a.textures.push(e)}))}),o._assetContainer=null,a}).catch(function(e){throw o._assetContainer=null,e})},e.prototype._parseSolidAsync=function(e,n,r,o){var a=this,i="",s=new fo,l=[],u=[];r=r.replace(/#.*$/gm,"").trim(),new ho(l,u,this._loadingOptions).parse(e,r,n,this._assetContainer,function(e){i=e});var c=[];return""===i||this._loadingOptions.skipMaterials||c.push(new Promise(function(e,r){a._loadMTL(i,o,function(c){try{s.parseMTL(n,c,o,a._assetContainer);for(var f=0;f<s.materials.length;f++){for(var h=0,d=[],p=void 0;(p=l.indexOf(s.materials[f].name,h))>-1;)d.push(p),h=p+1;if(-1===p&&0===d.length)s.materials[f].dispose();else for(var m=0;m<d.length;m++){var _=u[d[m]],g=s.materials[f];_.material=g,_.getTotalIndices()||(g.pointsCloud=!0)}}e()}catch(n){t.Tools.Warn("Error processing MTL file: '".concat(i,"'")),a._loadingOptions.materialLoadingFailsSilently?e():r(n)}},function(n,o){t.Tools.Warn("Error downloading MTL file: '".concat(i,"'")),a._loadingOptions.materialLoadingFailsSilently?e():r(o)})})),Promise.all(c).then(function(){var e=function(e){var t,n;return Boolean(null!==(n=null===(t=e._internalMetadata)||void 0===t?void 0:t._isLine)&&void 0!==n&&n)};return u.forEach(function(r){var o,a;if(e(r)){var i=null!==(o=r.material)&&void 0!==o?o:new t.StandardMaterial(r.name+"_line",n);i.getBindedMeshes().filter(function(t){return!e(t)}).length>0&&(i=null!==(a=i.clone(i.name+"_line"))&&void 0!==a?a:i),i.wireframe=!0,r.material=i,r._internalMetadata&&(r._internalMetadata._isLine=void 0)}}),u})},e.OPTIMIZE_WITH_UV=!0,e.INVERT_Y=!1,e.IMPORT_VERTEX_COLORS=!1,e.COMPUTE_NORMALS=!1,e.OPTIMIZE_NORMALS=!1,e.UV_SCALING=new t.Vector2(1,1),e.SKIP_MATERIALS=!1,e.MATERIAL_LOADING_FAILS_SILENTLY=!0,e.USE_LEGACY_BEHAVIOR=!1,e}();t.RegisterSceneLoaderPlugin(new mo);var _o={__proto__:null,OBJFileLoader:mo},go={__proto__:null,MTLFileLoader:fo,OBJFileLoader:mo,SolidParser:ho},bo={name:"stl",extensions:{".stl":{isBinary:!0}}},yo=function(){function e(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name=bo.name,this.extensions=bo.extensions}return e.prototype.importMesh=function(e,n,r,o,a){var i;if("string"!=typeof r){if(this._isBinary(r)){var s=new t.Mesh("stlmesh",n);return this._parseBinary(s,r),a&&a.push(s),!0}r=(new TextDecoder).decode(new Uint8Array(r))}for(;i=this.solidPattern.exec(r);){var l=i[1],u=i[3];if(u&&l!=u)return t.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(e&&l)if(e instanceof Array){if(!e.indexOf(l))continue}else if(l!==e)continue;l=l||"stlmesh",s=new t.Mesh(l,n),this._parseASCII(s,i[2]),a&&a.push(s)}return!0},e.prototype.load=function(e,t,n){return this.importMesh(null,e,t,n,null)},e.prototype.loadAssetContainer=function(e,n,r){var o=new t.AssetContainer(e);return e._blockEntityCollection=!0,this.importMesh(null,e,n,r,o.meshes),e._blockEntityCollection=!1,o},e.prototype._isBinary=function(e){var t=new DataView(e);if(t.byteLength<=80)return!1;if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var n=[115,111,108,105,100],r=0;r<5;r++)if(t.getUint8(r)!==n[r])return!0;return!1},e.prototype._parseBinary=function(n,r){for(var o=new DataView(r),a=o.getUint32(80,!0),i=0,s=new Float32Array(3*a*3),l=new Float32Array(3*a*3),u=new Uint32Array(3*a),c=0,f=0;f<a;f++){for(var h=84+50*f,d=o.getFloat32(h,!0),p=o.getFloat32(h+4,!0),m=o.getFloat32(h+8,!0),_=1;_<=3;_++){var g=h+12*_;s[i]=o.getFloat32(g,!0),l[i]=d,e.DO_NOT_ALTER_FILE_COORDINATES?(s[i+1]=o.getFloat32(g+4,!0),s[i+2]=o.getFloat32(g+8,!0),l[i+1]=p,l[i+2]=m):(s[i+2]=o.getFloat32(g+4,!0),s[i+1]=o.getFloat32(g+8,!0),l[i+2]=p,l[i+1]=m),i+=3}e.DO_NOT_ALTER_FILE_COORDINATES?(u[c]=c,u[c+1]=c+2,u[c+2]=c+1,c+=3):(u[c]=c++,u[c]=c++,u[c]=c++)}n.setVerticesData(t.VertexBuffer.PositionKind,s),n.setVerticesData(t.VertexBuffer.NormalKind,l),n.setIndices(u),n.computeWorldMatrix(!0)},e.prototype._parseASCII=function(n,r){for(var o,a=[],i=[],s=[],l=0;o=this.facetsPattern.exec(r);){var u=o[1],c=this.normalPattern.exec(u);if(this.normalPattern.lastIndex=0,c){for(var f=[Number(c[1]),Number(c[5]),Number(c[3])],h=void 0;h=this.vertexPattern.exec(u);)e.DO_NOT_ALTER_FILE_COORDINATES?(a.push(Number(h[1]),Number(h[3]),Number(h[5])),i.push(f[0],f[2],f[1])):(a.push(Number(h[1]),Number(h[5]),Number(h[3])),i.push(f[0],f[1],f[2]));e.DO_NOT_ALTER_FILE_COORDINATES?(s.push(l,l+2,l+1),l+=3):s.push(l++,l++,l++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,n.setVerticesData(t.VertexBuffer.PositionKind,a),n.setVerticesData(t.VertexBuffer.NormalKind,i),n.setIndices(s),n.computeWorldMatrix(!0)},e.DO_NOT_ALTER_FILE_COORDINATES=!1,e}();t.RegisterSceneLoaderPlugin(new yo);var vo={__proto__:null,STLFileLoader:yo},To={__proto__:null,STLFileLoader:yo},xo={name:"splat",extensions:{".splat":{isBinary:!0},".ply":{isBinary:!0},".spz":{isBinary:!0},".json":{isBinary:!1},".sog":{isBinary:!0}}},Ao=.28209479177387814,wo=null,Oo=null;function Co(e,t,n){var r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,y,v,T,x,A,w,O,C,M,E,R,F,L,P,S,N,I,B,k,G,V,D,H,K,j,U,W,z,q,Y,X;return void 0===n&&(n=!1),b(this,function(b){switch(b.label){case 0:if(r=e.numPoints,o=new ArrayBuffer(32*r),a=new Float32Array(o),i=new Uint8Array(o),s=e.positions,l=e.scales,u=e.colors,c=e.alphas,f=e.rotations,h=null,d=e.shDegree,p=null,m=0,_=null,g=null,y=null,d>0&&e.sh.length>0){for(m=3*((d+1)*(d+1)-1),v=Math.ceil(m/16),T=t.getEngine(),x=T.getCaps().maxTextureSize,A=Math.ceil(r/x),h=[],G=0;G<v;G++)h.push(new Uint8Array(A*x*4*4));for(_=new Int32Array(v),g=new Int32Array(v),G=0;G<v;G++)_[G]=16*G,g[G]=Math.min(16*(G+1),m);y=h,p=e.sh}w=0,b.label=1;case 1:if(!(w<r))return[3,4];if(C=32*w,M=3*w,E=4*w,a[0+(O=8*w)]=s[M+0],a[O+1]=s[M+1],a[O+2]=s[M+2],a[O+3]=Math.exp(l[M+0]),a[O+4]=Math.exp(l[M+1]),a[O+5]=Math.exp(l[M+2]),R=255*(.5+Ao*u[M+0]),F=255*(.5+Ao*u[M+1]),L=255*(.5+Ao*u[M+2]),i[C+24]=R<=0?0:R>=255?255:R+.5|0,i[C+25]=F<=0?0:F>=255?255:F+.5|0,i[C+26]=L<=0?0:L>=255?255:L+.5|0,i[C+27]=1/(1+Math.exp(-c[w]))*255+.5|0,P=127.5*f[E+3]+127.5,S=127.5*f[E+0]+127.5,N=127.5*f[E+1]+127.5,I=127.5*f[E+2]+127.5,i[C+28]=P<=0?0:P>=255?255:P+.5|0,i[C+29]=S<=0?0:S>=255?255:S+.5|0,i[C+30]=N<=0?0:N>=255?255:N+.5|0,i[C+31]=I<=0?0:I>=255?255:I+.5|0,p&&y&&_&&g)for(B=w*m,k=16*w,G=0;G<y.length;G++)for(V=y[G],D=_[G],H=g[G],K=D;K<H;K++)j=128*p[B+K]+128,V[k+K-D]=j<=0?0:j>=255?255:j+.5|0;return w%32768==0&&n?[4]:[3,3];case 2:b.sent(),b.label=3;case 3:return w++,[3,1];case 4:if(e.extensions)for(z=0,q=e.extensions;z<q.length;z++)if(Y=q[z],void 0!==(X=Y).safeOrbitRadiusMin){U=X.safeOrbitRadiusMin,W=[X.safeOrbitElevationMin,X.safeOrbitElevationMax];break}return[2,{mode:0,data:o,hasVertexColors:!1,sh:null!==h?h:void 0,shDegree:d>0?d:void 0,trainedWithAntialiasing:!!e.antialiased,safeOrbitCameraRadiusMin:U,safeOrbitCameraElevationMinMax:W}]}})}var Mo=.28209479177387814;function Eo(e,t,n){return g(this,void 0,void 0,function(){return b(this,function(r){switch(r.label){case 0:return[4,new Promise(function(r,o){var a,i=n.createCanvasImage();if(!i)throw new Error("Failed to create ImageBitmap");if(i.onload=function(){try{var e=n.createCanvas(i.width,i.height);if(!e)throw new Error("Failed to create canvas");var t=e.getContext("2d");if(!t)throw new Error("Failed to get 2D context");t.drawImage(i,0,0);var a=t.getImageData(0,0,e.width,e.height);r({bits:new Uint8Array(a.data.buffer),width:a.width})}catch(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))}},i.onerror=function(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))},i.crossOrigin="anonymous","string"==typeof e){if(!t)throw new Error("filename is required when using a URL");i.src=e+t}else{var s=new Blob([e],{type:"image/webp"});a=URL.createObjectURL(s),i.src=a}})];case 1:return[2,r.sent()]}})})}function Ro(e,n,r){return g(this,void 0,void 0,function(){var o,a,i,s,l,u,c,f,h,d,p,m,_,g,y,v,T,x,A,w,O,C,M,E,R,F,L,P,S,N,I,B,k,G,V,D,H,K,j,U,W,z,q,Y,X,J,Q,Z,$,ee,te,ne,re,oe,ae,ie,se,le,ue,ce,fe,he,de,pe;return b(this,function(b){switch(b.label){case 0:if(o=e.count?e.count:e.means.shape[0],a=new ArrayBuffer(32*o),i=new Float32Array(a),s=new Float32Array(a),l=new Uint8ClampedArray(a),u=new Uint8ClampedArray(a),c=function(e){return Math.sign(e)*(Math.exp(Math.abs(e))-1)},f=n[0].bits,h=n[1].bits,!Array.isArray(e.means.mins)||!Array.isArray(e.means.maxs))throw new Error("Missing arrays in SOG data.");for(te=0;te<o;te++)for(O=4*te,se=0;se<3;se++)d=e.means.mins[se],p=e.means.maxs[se],m=h[O+se],_=f[O+se],K=m<<8|_,ne=t.Scalar.Lerp(d,p,K/65535),i[8*te+se]=c(ne);if(g=n[2].bits,2===e.version){if(!e.scales.codebook)throw new Error("Missing codebook in SOG version 2 scales data.");for(te=0;te<o;te++)for(O=4*te,se=0;se<3;se++)v=e.scales.codebook[g[O+se]],y=Math.exp(v),s[8*te+3+se]=y}else{if(!Array.isArray(e.scales.mins)||!Array.isArray(e.scales.maxs))throw new Error("Missing arrays in SOG scales data.");for(te=0;te<o;te++)for(O=4*te,se=0;se<3;se++)v=g[O+se],T=t.Scalar.Lerp(e.scales.mins[se],e.scales.maxs[se],v/255),x=Math.exp(T),s[8*te+3+se]=x}if(A=n[4].bits,2===e.version){if(!e.sh0.codebook)throw new Error("Missing codebook in SOG version 2 sh0 data.");for(te=0;te<o;te++){for(O=4*te,se=0;se<3;se++)w=.5+e.sh0.codebook[A[O+se]]*Mo,l[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*w)));l[32*te+24+3]=A[O+3]}}else{if(!Array.isArray(e.sh0.mins)||!Array.isArray(e.sh0.maxs))throw new Error("Missing arrays in SOG sh0 data.");for(te=0;te<o;te++)for(O=4*te,se=0;se<4;se++)C=e.sh0.mins[se],M=e.sh0.maxs[se],E=A[O+se],G=t.Scalar.Lerp(C,M,E/255),void 0,R=se<3?.5+G*Mo:1/(1+Math.exp(-G)),l[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*R)))}for(F=function(e){return 2*(e/255-.5)/Math.SQRT2},L=n[3].bits,te=0;te<o;te++){switch(P=L[4*te+0],S=L[4*te+1],N=L[4*te+2],I=L[4*te+3],B=F(P),k=F(S),G=F(N),V=I-252,D=B*B+k*k+G*G,H=Math.sqrt(Math.max(0,1-D)),K=void 0,V){case 0:K=[H,B,k,G];break;case 1:K=[B,H,k,G];break;case 2:K=[B,k,H,G];break;case 3:K=[B,k,G,H];break;default:throw new Error("Invalid quaternion mode")}u[32*te+28+0]=127.5*K[0]+127.5,u[32*te+28+1]=127.5*K[1]+127.5,u[32*te+28+2]=127.5*K[2]+127.5,u[32*te+28+3]=127.5*K[3]+127.5}if(!e.shN)return[3,2];for(j=e.shN.bands?Math.pow(e.shN.bands+1,2)-1:e.shN.shape[1]/3,U=void 0!==e.shN.bands&&null!==e.shN.bands?e.shN.bands:Math.round(Math.sqrt(j+1)-1),W=n[5].bits,z=n[6].bits,q=n[5].width,Y=3*j,X=Math.ceil(Y/16),J=[],Q=r.getEngine(),Z=Q.getCaps().maxTextureSize,$=Math.ceil(o/Z),ce=0;ce<X;ce++)ee=new Uint8Array($*Z*4*4),J.push(ee);if(2===e.version){if(!e.shN.codebook)throw new Error("Missing codebook in SOG version 2 shN data.");for(te=0;te<o;te++)for(ne=z[4*te+0]+(z[4*te+1]<<8),re=ne%64*j,oe=Math.floor(ne/64),le=0;le<j;le++)for(se=0;se<3;se++)ue=3*le+se,ce=Math.floor(ue/16),fe=J[ce],he=ue%16,de=16*te,pe=127.5*e.shN.codebook[W[4*(re+le)+se+oe*q*4]]+127.5,fe[he+de]=Math.max(0,Math.min(255,pe))}else for(te=0;te<o;te++)for(ne=z[4*te+0]+(z[4*te+1]<<8),re=ne%64*j,oe=Math.floor(ne/64),ae=e.shN.mins,ie=e.shN.maxs,se=0;se<3;se++)for(le=0;le<j/3;le++)ue=3*le+se,ce=Math.floor(ue/16),fe=J[ce],he=ue%16,de=16*te,pe=127.5*t.Scalar.Lerp(ae,ie,W[4*(re+le)+se+oe*q*4]/255)+127.5,fe[he+de]=Math.max(0,Math.min(255,pe));return[4,new Promise(function(e){e({mode:0,data:a,hasVertexColors:!1,sh:J,shDegree:U})})];case 1:case 3:return[2,b.sent()];case 2:return[4,new Promise(function(e){e({mode:0,data:a,hasVertexColors:!1})})]}})})}function Fo(e,t,n){return g(this,void 0,void 0,function(){var r,o,a,i,s,l=this;return b(this,function(u){switch(u.label){case 0:if(e instanceof Map){if(!(a=(o=e).get("meta.json")))throw new Error("meta.json not found in files Map");r=JSON.parse((new TextDecoder).decode(a))}else r=e;return i=y(y(y(y([],r.means.files,!0),r.scales.files,!0),r.quats.files,!0),r.sh0.files,!0),r.shN&&i.push.apply(i,r.shN.files),[4,Promise.all(i.map(function(e){return g(l,void 0,void 0,function(){return b(this,function(r){switch(r.label){case 0:return o&&o.has(e)?[4,Eo(o.get(e),e,n.getEngine())]:[3,2];case 1:case 3:return[2,r.sent()];case 2:return[4,Eo(t,e,n.getEngine())]}})})}))];case 1:return s=u.sent(),[4,Ro(r,s,n)];case 2:return[2,u.sent()]}})})}var Lo=function(){function e(t){void 0===t&&(t=e._DefaultLoadingOptions),this.name=xo.name,this._assetContainer=null,this.extensions=xo.extensions,this._loadingOptions=t}return e.prototype.createPlugin=function(t){return new e(t[xo.name])},e.prototype.importMeshAsync=function(e,t,n,r,o,a){return g(this,void 0,void 0,function(){return b(this,function(o){switch(o.label){case 0:return[4,this._parseAsync(e,t,n,r).then(function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}})];case 1:return[2,o.sent()]}})})},e._BuildPointCloud=function(e,n){if(!n.byteLength)return!1;var r=new Uint8Array(n),o=new Float32Array(n),a=r.length/32;return e.addPoints(a,function(e,n){var a=o[8*n+0],i=o[8*n+1],s=o[8*n+2];e.position=new t.Vector3(a,i,s);var l=r[32*n+24+0]/255,u=r[32*n+24+1]/255,c=r[32*n+24+2]/255;e.color=new t.Color4(l,u,c,1)}),!0},e._BuildMesh=function(e,n){for(var r=new t.Mesh("PLYMesh",e),o=new Uint8Array(n.data),a=new Float32Array(n.data),i=o.length/32,s=[],l=new t.VertexData,u=0;u<i;u++){var c=a[8*u+0],f=a[8*u+1],h=a[8*u+2];s.push(c,f,h)}if(n.hasVertexColors){var d=new Float32Array(4*i);for(u=0;u<i;u++){var p=o[32*u+24+0]/255,m=o[32*u+24+1]/255,_=o[32*u+24+2]/255;d[4*u+0]=p,d[4*u+1]=m,d[4*u+2]=_,d[4*u+3]=1}l.colors=d}return l.positions=s,l.indices=n.faces,l.applyToMesh(r),r},e.prototype._unzipWithFFlateAsync=function(e){return g(this,void 0,void 0,function(){var n,r,o,a,i,s,l,u,c,f;return b(this,function(h){switch(h.label){case 0:return(n=this._loadingOptions.fflate)?[3,3]:void 0!==window.fflate?[3,2]:[4,t.Tools.LoadScriptAsync(null!==(f=this._loadingOptions.deflateURL)&&void 0!==f?f:"https://unpkg.com/fflate/umd/index.js")];case 1:h.sent(),h.label=2;case 2:n=window.fflate,h.label=3;case 3:for(r=n.unzipSync,o=r(e),a=new Map,i=0,s=Object.entries(o);i<s.length;i++)l=s[i],u=l[0],c=l[1],a.set(u,c);return[2,a]}})})},e.prototype._parseAsync=function(n,r,o,a){var i=this,s=[],l=function(e){var n;r._blockEntityCollection=!!i._assetContainer;var o=null!==(n=i._loadingOptions.gaussianSplattingMesh)&&void 0!==n?n:new t.GaussianSplattingMesh("GaussianSplatting",null,r,i._loadingOptions.keepInRam,i._loadingOptions.needsRotationScaleTextures);o._parentContainer=i._assetContainer,s.push(o),o.updateData(e.data,e.sh,{flipY:!1},void 0,e.shDegree),o.scaling.y*=-1,o.computeWorldMatrix(!0),r._blockEntityCollection=!1};if("string"==typeof o){var u=JSON.parse(o);if(u&&u.means&&u.scales&&u.quats&&u.sh0)return new Promise(function(e){Fo(u,a,r).then(function(t){l(t),e(s)}).catch(function(){throw new Error("Failed to parse SOG data.")})})}var c=o instanceof ArrayBuffer?new Uint8Array(o):o;if(80===c[0]&&75===c[1])return new Promise(function(e){i._unzipWithFFlateAsync(c).then(function(t){Fo(t,a,r).then(function(t){l(t),e(s)}).catch(function(){throw new Error("Failed to parse SOG zip data.")})})});var f=function(n){e._ConvertPLYToSplat(o).then(function(o){return g(i,void 0,void 0,function(){var a,i,l;return b(this,function(u){switch(u.label){case 0:switch(r._blockEntityCollection=!!this._assetContainer,o.mode){case 0:return[3,1];case 1:return[3,2];case 2:return[3,6]}return[3,7];case 1:switch((a=null!==(l=this._loadingOptions.gaussianSplattingMesh)&&void 0!==l?l:new t.GaussianSplattingMesh("GaussianSplatting",null,r,this._loadingOptions.keepInRam,this._loadingOptions.needsRotationScaleTextures))._parentContainer=this._assetContainer,s.push(a),a.updateData(o.data,o.sh,{flipY:!1},void 0,o.shDegree),a.scaling.y*=-1,"RightHanded"===o.chirality&&(a.scaling.y*=-1),o.upAxis){case"X":a.rotation=new t.Vector3(0,0,Math.PI/2);break;case"Y":a.rotation=new t.Vector3(0,0,Math.PI);break;case"Z":a.rotation=new t.Vector3(-Math.PI/2,Math.PI,0)}return a.computeWorldMatrix(!0),[3,8];case 2:return i=new t.PointsCloudSystem("PointCloud",1,r),e._BuildPointCloud(i,o.data)?[4,i.buildMeshAsync().then(function(e){s.push(e)})]:[3,4];case 3:return u.sent(),[3,5];case 4:i.dispose(),u.label=5;case 5:return[3,8];case 6:if(!o.faces)throw new Error("PLY mesh doesn't contain face informations.");return s.push(e._BuildMesh(r,o)),[3,8];case 7:throw new Error("Unsupported Splat mode");case 8:return r._blockEntityCollection=!1,this.applyAutoCameraLimits(o,r),n(s),[2]}})})})};if(31!==c[0]||139!==c[1])return new Promise(function(e){f(e)});var h=function(e,n){var o;r._blockEntityCollection=!!i._assetContainer;var a=null!==(o=i._loadingOptions.gaussianSplattingMesh)&&void 0!==o?o:new t.GaussianSplattingMesh("GaussianSplatting",null,r,i._loadingOptions.keepInRam,i._loadingOptions.needsRotationScaleTextures);if(e.trainedWithAntialiasing){var l=a.material;l.kernelSize=.1,l.compensation=!0}a._parentContainer=i._assetContainer,s.push(a),a.updateData(e.data,e.sh,{flipY:!1},void 0,e.shDegree),i._loadingOptions.flipY||(a.scaling.y*=-1,a.computeWorldMatrix(!0)),r._blockEntityCollection=!1,i.applyAutoCameraLimits(e,r),n(s)};if(this._loadingOptions.spzLibraryUrl)return function(e){return g(this,void 0,void 0,function(){var n;return b(this,function(r){switch(r.label){case 0:return wo&&Oo===e?[4,wo]:[3,2];case 1:case 3:return[2,r.sent()];case 2:return n=t._LoadScriptModuleAsync("import createSpzModule from '".concat(e,"';\n const module = await createSpzModule();\n const returnedValue = module;")),Oo=e,wo=n,[4,n]}})})}(this._loadingOptions.spzLibraryUrl).then(function(e){return function(e,n){return g(this,void 0,void 0,function(){return b(this,function(r){switch(r.label){case 0:return[4,t.runCoroutineAsync(Co(e,n,!0),t.createYieldingScheduler())];case 1:return[2,r.sent()]}})})}(e.loadSpzFromBuffer(new Uint8Array(o),{to:e.CoordinateSystem.RUB}),r).then(function(e){return new Promise(function(t){h(e,t)})})});var d=new ReadableStream({start:function(e){e.enqueue(new Uint8Array(o)),e.close()}}),p=new DecompressionStream("gzip"),m=d.pipeThrough(p);return new Promise(function(e){new Response(m).arrayBuffer().then(function(n){(function(e,n){var r=new Uint8Array(e),o=new Uint32Array(e.slice(0,12)),a=o[2],i=r[12],s=r[13],l=r[14],u=r[15],c=o[1];if(u||1347635022!=o[0]||c<2||c>4)return new Promise(function(e){e({mode:3,data:new ArrayBuffer(0),hasVertexColors:!1})});for(var f=new ArrayBuffer(32*a),h=1/(1<<s),d=new Int32Array(1),p=new Uint8Array(d.buffer),m=function(e,t){return p[0]=e[t+0],p[1]=e[t+1],p[2]=e[t+2],p[3]=128&e[t+2]?255:0,d[0]*h},_=16,g=new Float32Array(f),b=new Float32Array(f),y=new Uint8ClampedArray(f),v=new Uint8ClampedArray(f),T=0;T<a;T++)g[8*T+0]=m(r,_+0),g[8*T+1]=m(r,_+3),g[8*T+2]=m(r,_+6),_+=9;for(T=0;T<a;T++){for(var x=0;x<3;x++){var A=(r[_+a+3*T+x]-127.5)/38.25;y[32*T+24+x]=t.Scalar.Clamp(255*(.5+Ao*A),0,255)}y[32*T+24+3]=r[_+T]}for(_+=4*a,T=0;T<a;T++)b[8*T+3+0]=Math.exp(r[_+0]/16-10),b[8*T+3+1]=Math.exp(r[_+1]/16-10),b[8*T+3+2]=Math.exp(r[_+2]/16-10),_+=3;if(c>=3){var w=Math.SQRT1_2;for(T=0;T<a;T++){for(var O=[r[_+0],r[_+1],r[_+2],r[_+3]],C=O[0]+(O[1]<<8)+(O[2]<<16)+(O[3]<<24),M=[],E=C>>>30,R=C,F=0,L=3;L>=0;--L)if(L!==E){var P=511&R,S=R>>>9&1;R>>>=10,M[L]=w*(P/511),1===S&&(M[L]=-M[L]),F+=M[L]*M[L]}var N=1-F;M[E]=Math.sqrt(Math.max(N,0));for(var I=[3,0,1,2],B=0;B<4;B++)v[32*T+28+B]=Math.round(127.5+127.5*M[I[B]]);_+=4}}else for(T=0;T<a;T++){var k=r[_+0],G=r[_+1],V=r[_+2],D=k/127.5-1,H=G/127.5-1,K=V/127.5-1;v[32*T+28+1]=k,v[32*T+28+2]=G,v[32*T+28+3]=V;var j=1-(D*D+H*H+K*K);v[32*T+28+0]=127.5+127.5*Math.sqrt(j<0?0:j),_+=3}if(i){for(var U=3*((i+1)*(i+1)-1),W=Math.ceil(U/16),z=_,q=[],Y=n.getEngine().getCaps().maxTextureSize,X=Math.ceil(a/Y),J=0;J<W;J++){var Q=new Uint8Array(X*Y*4*4);q.push(Q)}for(T=0;T<a;T++)for(var Z=0;Z<U;Z++){var $=r[z++];J=Math.floor(Z/16),q[J][Z%16+16*T]=$}return new Promise(function(e){e({mode:0,data:f,hasVertexColors:!1,sh:q,shDegree:i,trainedWithAntialiasing:!!l})})}return new Promise(function(e){e({mode:0,data:f,hasVertexColors:!1,trainedWithAntialiasing:!!l})})})(n,r,i._loadingOptions).then(function(t){h(t,e)})}).catch(function(){f(e)})})},e.prototype.applyAutoCameraLimits=function(e,t){var n;if(!this._loadingOptions.disableAutoCameraLimits&&(void 0!==e.safeOrbitCameraRadiusMin||void 0!==e.safeOrbitCameraElevationMinMax)&&"ArcRotateCamera"===(null===(n=t.activeCamera)||void 0===n?void 0:n.getClassName())){var r=t.activeCamera;e.safeOrbitCameraElevationMinMax&&(r.lowerBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[1],r.upperBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[0]),e.safeOrbitCameraRadiusMin&&(r.lowerRadiusLimit=e.safeOrbitCameraRadiusMin)}},e.prototype.loadAssetContainerAsync=function(e,n,r){var o=this,a=new t.AssetContainer(e);return this._assetContainer=a,this.importMeshAsync(null,e,n,r).then(function(e){for(var t=0,n=e.meshes;t<n.length;t++){var r=n[t];a.meshes.push(r)}return o._assetContainer=null,a}).catch(function(e){throw o._assetContainer=null,e})},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then(function(){})},e._ConvertPLYToSplat=function(e){var n=this,r=new Uint8Array(e),o=(new TextDecoder).decode(r.slice(0,10240)),a=o.indexOf("end_header\n");if(a<0||!o)return new Promise(function(t){t({mode:0,data:e,rawSplat:!0})});var i=parseInt(/element vertex (\d+)\n/.exec(o)[1]),s=/element face (\d+)\n/.exec(o),l=0;s&&(l=parseInt(s[1]));var u=/element chunk (\d+)\n/.exec(o),c=0;u&&(c=parseInt(u[1]));for(var f=0,h=0,d={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0},p=1,m=[],y=[],v=o.slice(0,a).split("\n"),T={},x=0,A=v;x<A.length;x++){var w=A[x];if(w.startsWith("property ")){var O=w.split(" "),C=O[1],M=O[2];if(1==p)y.push({name:M,type:C,offset:h}),h+=d[C];else if(0==p)m.push({name:M,type:C,offset:f}),f+=d[C];else if(2==p)m.push({name:M,type:C,offset:f});else if(3==p){var E=new DataView(e,h,2*d.float);T.safeOrbitCameraElevationMinMax=[E.getFloat32(0,!0),E.getFloat32(4,!0)]}else 4==p?(E=new DataView(e,h,d.float),T.safeOrbitCameraRadiusMin=E.getFloat32(0,!0)):5==p&&(E=new DataView(e,h,d.uchar),"up_axis"==M?T.upAxis=0==E.getUint8(0)?"X":1==E.getUint8(0)?"Y":"Z":"chirality"==M&&(T.chirality=0==E.getUint8(0)?"LeftHanded":"RightHanded"));d[C]||t.Logger.Warn("Unsupported property type: ".concat(C,"."))}else w.startsWith("element ")&&("chunk"==(C=w.split(" ")[1])?p=1:"vertex"==C?p=0:"sh"==C?p=2:"safe_orbit_camera_elevation_min_max_radians"==C?p=3:"safe_orbit_camera_radius_min"==C?p=4:"up_axis"!=C&&"chirality"!=C||(p=5))}var R=f,F=h;return t.GaussianSplattingMesh.ConvertPLYWithSHToSplatAsync(e).then(function(t){return g(n,void 0,void 0,function(){var n,r,o,s,u,f,h,d,p,g,y,v,x,A,w;return b(this,function(b){switch(b.label){case 0:if(n=new DataView(e,a+11),r=F*c+R*i,o=[],l)for(s=0;s<l;s++)if(3==(u=n.getUint8(r))){for(r+=1,f=0;f<u;f++)h=n.getUint32(r+4*(2-f),!0),o.push(h);r+=12}return c?[4,new Promise(function(e){e({mode:0,data:t.buffer,sh:t.sh,shDegree:t.shDegree,faces:o,hasVertexColors:!1,compressed:!0,rawSplat:!1})})]:[3,2];case 1:case 3:return[2,b.sent()];case 2:for(d=0,p=0,g=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],y=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"],v=0;v<m.length;v++)x=m[v],g.includes(x.name)&&d++,y.includes(x.name)&&p++;return A=d==g.length&&3==p,w=l?2:A?0:1,[4,new Promise(function(e){e(_(_({},T),{mode:w,data:t.buffer,sh:t.sh,shDegree:t.shDegree,faces:o,hasVertexColors:!!p,compressed:!1,rawSplat:!1}))})]}})})})},e._DefaultLoadingOptions={keepInRam:!1,flipY:!1,needsRotationScaleTextures:!1,spzLibraryUrl:"object"==typeof WebAssembly?"https://unpkg.com/@adobe/spz@0.2.0/dist/spz.js":void 0},e}();t.RegisterSceneLoaderPlugin(new Lo);var Po={__proto__:null,SPLATFileLoader:Lo};function So(){var e=this;t.RegisterSceneLoaderPlugin(_(_({},v),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return x})];case 1:return[2,new(0,e.sent().BVHFileLoader)(t[v.name])]}})})}})),t.RegisterSceneLoaderPlugin(_(_({},P),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Ue})];case 1:return[2,new(0,e.sent().GLTFFileLoader)(t[P.name])]}})})}})),function(){var e=this;we("EXT_lights_image_based"),Ae("EXT_lights_image_based",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ot})];case 1:return[2,new(0,e.sent().EXT_lights_image_based)(t)]}})})}),we("EXT_mesh_gpu_instancing"),Ae("EXT_mesh_gpu_instancing",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return st})];case 1:return[2,new(0,e.sent().EXT_mesh_gpu_instancing)(t)]}})})}),we("EXT_meshopt_compression"),Ae("EXT_meshopt_compression",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ct})];case 1:return[2,new(0,e.sent().EXT_meshopt_compression)(t)]}})})}),we("EXT_texture_avif"),Ae("EXT_texture_avif",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return _t})];case 1:return[2,new(0,e.sent().EXT_texture_avif)(t)]}})})}),we("EXT_texture_webp"),Ae("EXT_texture_webp",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return dt})];case 1:return[2,new(0,e.sent().EXT_texture_webp)(t)]}})})}),we("ExtrasAsMetadata"),Ae("ExtrasAsMetadata",!1,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return io})];case 1:return[2,new(0,e.sent().ExtrasAsMetadata)(t)]}})})}),we("KHR_animation_pointer"),Ae("KHR_animation_pointer",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return vr})];case 1:return[2,new(0,e.sent().KHR_animation_pointer)(t)]}})})}),we("KHR_draco_mesh_compression"),Ae("KHR_draco_mesh_compression",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return xt})];case 1:return[2,new(0,e.sent().KHR_draco_mesh_compression)(t)]}})})}),we("KHR_interactivity"),Ae("KHR_interactivity",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return zr})];case 1:return[2,new(0,e.sent().KHR_interactivity)(t)]}})})}),we("KHR_lights_punctual"),Ae("KHR_lights_punctual",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Ot})];case 1:return[2,new(0,e.sent().KHR_lights)(t)]}})})}),we("EXT_lights_area"),Ae("EXT_lights_area",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Et})];case 1:return[2,new(0,e.sent().EXT_lights_area)(t)]}})})}),we("EXT_lights_ies"),Ae("EXT_lights_ies",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return yt})];case 1:return[2,new(0,e.sent().EXT_lights_ies)(t)]}})})}),we("KHR_materials_anisotropy"),Ae("KHR_materials_anisotropy",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return zt})];case 1:return[2,new(0,e.sent().KHR_materials_anisotropy)(t)]}})})}),we("KHR_materials_clearcoat"),Ae("KHR_materials_clearcoat",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return kt})];case 1:return[2,new(0,e.sent().KHR_materials_clearcoat)(t)]}})})}),we("KHR_materials_diffuse_roughness"),Ae("KHR_materials_diffuse_roughness",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Fn})];case 1:return[2,new(0,e.sent().KHR_materials_diffuse_roughness)(t)]}})})}),we("KHR_materials_diffuse_transmission"),Ae("KHR_materials_diffuse_transmission",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return bn})];case 1:return[2,new(0,e.sent().KHR_materials_diffuse_transmission)(t)]}})})}),we("KHR_materials_dispersion"),Ae("KHR_materials_dispersion",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Mn})];case 1:return[2,new(0,e.sent().KHR_materials_dispersion)(t)]}})})}),we("KHR_materials_emissive_strength"),Ae("KHR_materials_emissive_strength",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Xt})];case 1:return[2,new(0,e.sent().KHR_materials_emissive_strength)(t)]}})})}),we("KHR_materials_ior"),Ae("KHR_materials_ior",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ln})];case 1:return[2,new(0,e.sent().KHR_materials_ior)(t)]}})})}),we("KHR_materials_iridescence"),Ae("KHR_materials_iridescence",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return jt})];case 1:return[2,new(0,e.sent().KHR_materials_iridescence)(t)]}})})}),we("KHR_materials_pbrSpecularGlossiness"),Ae("KHR_materials_pbrSpecularGlossiness",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Lt})];case 1:return[2,new(0,e.sent().KHR_materials_pbrSpecularGlossiness)(t)]}})})}),we("KHR_materials_sheen"),Ae("KHR_materials_sheen",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Zt})];case 1:return[2,new(0,e.sent().KHR_materials_sheen)(t)]}})})}),we("KHR_materials_specular"),Ae("KHR_materials_specular",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return on})];case 1:return[2,new(0,e.sent().KHR_materials_specular)(t)]}})})}),we("KHR_materials_transmission"),Ae("KHR_materials_transmission",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return mn})];case 1:return[2,new(0,e.sent().KHR_materials_transmission)(t)]}})})}),we("KHR_materials_unlit"),Ae("KHR_materials_unlit",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Nt})];case 1:return[2,new(0,e.sent().KHR_materials_unlit)(t)]}})})}),we("KHR_materials_variants"),Ae("KHR_materials_variants",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return fn})];case 1:return[2,new(0,e.sent().KHR_materials_variants)(t)]}})})}),we("KHR_materials_volume"),Ae("KHR_materials_volume",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Tn})];case 1:return[2,new(0,e.sent().KHR_materials_volume)(t)]}})})}),we("KHR_mesh_quantization"),Ae("KHR_mesh_quantization",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Sn})];case 1:return[2,new(0,e.sent().KHR_mesh_quantization)(t)]}})})}),we("KHR_texture_basisu"),Ae("KHR_texture_basisu",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Bn})];case 1:return[2,new(0,e.sent().KHR_texture_basisu)(t)]}})})}),we("KHR_texture_transform"),Ae("KHR_texture_transform",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Vn})];case 1:return[2,new(0,e.sent().KHR_texture_transform)(t)]}})})}),we("KHR_xmp_json_ld"),Ae("KHR_xmp_json_ld",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Kn})];case 1:return[2,new(0,e.sent().KHR_xmp_json_ld)(t)]}})})}),we("MSFT_audio_emitter"),Ae("MSFT_audio_emitter",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Ar})];case 1:return[2,new(0,e.sent().MSFT_audio_emitter)(t)]}})})}),we("MSFT_lod"),Ae("MSFT_lod",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Cr})];case 1:return[2,new(0,e.sent().MSFT_lod)(t)]}})})}),we("MSFT_minecraftMesh"),Ae("MSFT_minecraftMesh",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Rr})];case 1:return[2,new(0,e.sent().MSFT_minecraftMesh)(t)]}})})}),we("MSFT_sRGBFactors"),Ae("MSFT_sRGBFactors",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Pr})];case 1:return[2,new(0,e.sent().MSFT_sRGBFactors)(t)]}})})}),we("KHR_node_visibility"),Ae("KHR_node_visibility",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Xr})];case 1:return[2,new(0,e.sent().KHR_node_visibility)(t)]}})})}),we("KHR_node_hoverability"),Ae("KHR_node_hoverability",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ro})];case 1:return[2,new(0,e.sent().KHR_node_hoverability)(t)]}})})}),we("KHR_node_selectability"),Ae("KHR_node_selectability",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Zr})];case 1:return[2,new(0,e.sent().KHR_node_selectability)(t)]}})})}),we("KHR_materials_coat"),Ae("KHR_materials_coat",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Dt})];case 1:return[2,new(0,e.sent().KHR_materials_coat)(t)]}})})}),we("KHR_materials_fuzz"),Ae("KHR_materials_fuzz",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return tn})];case 1:return[2,new(0,e.sent().KHR_materials_fuzz)(t)]}})})}),we("KHR_materials_volume_scatter"),Ae("KHR_materials_volume_scatter",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return wn})];case 1:return[2,new(0,e.sent().KHR_materials_volume_scatter)(t)]}})})})}(),t.RegisterSceneLoaderPlugin(_(_({},po),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return _o})];case 1:return[2,new(0,e.sent().OBJFileLoader)(t[po.name])]}})})}})),t.RegisterSceneLoaderPlugin(_(_({},xo),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Po})];case 1:return[2,new(0,e.sent().SPLATFileLoader)(t[xo.name])]}})})}})),t.RegisterSceneLoaderPlugin(_(_({},bo),{createPlugin:function(){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return vo})];case 1:return[2,new(0,e.sent().STLFileLoader)]}})})}}))}var No={__proto__:null,registerBuiltInLoaders:So},Io="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Io)for(var Bo in A)Io.BABYLON[Bo]||(Io.BABYLON[Bo]=A[Bo]);var ko="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==ko)for(var Go in ko.BABYLON=ko.BABYLON||{},No)ko.BABYLON[Go]=No[Go];var Vo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Vo){for(var Do in Vo.BABYLON=Vo.BABYLON||{},z)Vo.BABYLON[Do]=z[Do];for(var Do in F)Vo.BABYLON[Do]=F[Do]}var Ho,Ko,jo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==jo)for(var Uo in jo.BABYLON=jo.BABYLON||{},jo.BABYLON.GLTF1=jo.BABYLON.GLTF1||{},ve)jo.BABYLON.GLTF1[Uo]=ve[Uo];var Wo=_({},uo),zo=_(_({},{__proto__:null}),((Ho={}).Extensions=Wo,Ho)),qo=_(_({},co),((Ko={}).Loader=zo,Ko)),Yo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Yo){Yo.BABYLON=Yo.BABYLON||{};var Xo=Yo.BABYLON;Xo.GLTF2=Xo.GLTF2||{},Xo.GLTF2.Loader=Xo.GLTF2.Loader||{},Xo.GLTF2.Loader.Extensions=Xo.GLTF2.Loader.Extensions||{};var Jo=["Loader"];for(var Qo in Wo)Xo.GLTF2.Loader.Extensions[Qo]=Wo[Qo],Jo.push(Qo);for(var Qo in zo)"Extensions"!==Qo&&(Xo.GLTF2.Loader[Qo]=zo[Qo],Jo.push(Qo));for(var Qo in qo)Jo.indexOf(Qo)>-1||(Xo.GLTF2[Qo]=qo[Qo])}var Zo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Zo)for(var $o in go)Zo.BABYLON[$o]||(Zo.BABYLON[$o]=go[$o]);var ea="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==ea)for(var ta in To)ea.BABYLON[ta]||(ea.BABYLON[ta]=To[ta]);e.BVHFileLoader=T,e.GLTF1=ve,e.GLTF2=qo,e.GLTFFileLoader=k,e.GLTFLoaderDefaultOptions=I,e.GLTFValidation=R,e.MTLFileLoader=fo,e.OBJFileLoader=mo,e.ReadBvh=d,e.SPLATFileLoader=Lo,e.STLFileLoader=yo,e.SolidParser=ho,e.registerBuiltInLoaders=So});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("babylonjs")):"function"==typeof define&&define.amd?define(["exports","babylonjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BABYLON=e.BABYLON||{},e.BABYLON)}(this,function(e,t){"use strict";var n="Xposition",r="Yposition",o="Zposition",a="Xrotation",i="Yrotation",s="Zrotation",l=function(e){this.loopMode=t.Animation.ANIMATIONLOOPMODE_CYCLE,this.list=[],this.root=u(),this.numFrames=0,this.frameRate=0,this.skeleton=e};function u(){return{name:"",type:"",offset:new t.Vector3,channels:[],children:[],frames:[],parent:null}}function c(e,l,u){for(var f=function(e){var n=e.offset.x,r=e.offset.y,o=e.offset.z;return t.Matrix.Translation(n,r,o)}(e),h=new t.Bone(e.name,u.skeleton,l,f),d=function(e,l){if(0===e.frames.length)return[];for(var u=[],c=e.channels.some(function(e){return e===n||e===r||e===o}),f=e.channels.some(function(e){return e===a||e===i||e===s}),h=new t.Animation("".concat(e.name,"_pos"),"position",l.frameRate,t.Animation.ANIMATIONTYPE_VECTOR3,l.loopMode),d=new t.Animation("".concat(e.name,"_rot"),"rotationQuaternion",l.frameRate,t.Animation.ANIMATIONTYPE_QUATERNION,l.loopMode),p=[],m=[],_=0;_<e.frames.length;_++){var g=e.frames[_];c&&g.position&&p.push({frame:g.frame,value:g.position.clone()}),f&&m.push({frame:g.frame,value:g.rotation.clone()})}return p.length>0&&(h.setKeys(p),u.push(h)),m.length>0&&(d.setKeys(m),u.push(d)),u}(e,u),p=0,m=d;p<m.length;p++){var _=m[p];_.getKeys()&&_.getKeys().length>0&&h.animations.push(_)}for(var g=0,b=e.children;g<b.length;g++)c(b[g],h,u)}function f(e,l,u,c){if("ENDSITE"!==u.type){var h={frame:0,position:new t.Vector3,rotation:new t.Quaternion};h.frame=l,h.position=new t.Vector3,h.rotation=new t.Quaternion,u.frames.push(h);for(var d=t.Matrix.Identity(),p=0;p<u.channels.length;++p){var m=u.channels[p],_=e[c.i++];if(_){var g=parseFloat(_.trim());if(m.endsWith("position"))switch(m){case n:h.position.x=g;break;case r:h.position.y=g;break;case o:h.position.z=g}else if(m.endsWith("rotation")){var b=t.Tools.ToRadians(g),y=void 0;switch(m){case a:y=t.Matrix.RotationX(b);break;case i:y=t.Matrix.RotationY(b);break;case s:y=t.Matrix.RotationZ(b)}d=y.multiply(d)}}}t.Quaternion.FromRotationMatrixToRef(d,h.rotation);for(var v=0,T=u.children;v<T.length;v++)f(e,l,T[v],c)}}function h(e,n,r,o){var a,i,s,l,c=u();c.parent=r,o.list.push(c);var f=n.trim().split(/\s+/);if("END"===f[0].toUpperCase()&&"SITE"===f[1].toUpperCase()?(c.type="ENDSITE",c.name="ENDSITE"):(c.name=f[1],c.type=f[0].toUpperCase()),"{"!=(null===(a=e.shift())||void 0===a?void 0:a.trim()))throw new Error("Expected opening { after type & name");var d=null===(i=e.shift())||void 0===i?void 0:i.trim().split(/\s+/);if(!d)throw new Error("Unexpected end of file: missing OFFSET");if("OFFSET"!=(f=d)[0].toUpperCase())throw new Error("Expected OFFSET, but got: "+f[0]);if(4!=f.length)throw new Error("OFFSET: Invalid number of values");var p=new t.Vector3(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3]));if(isNaN(p.x)||isNaN(p.y)||isNaN(p.z))throw new Error("OFFSET: Invalid values");if(c.offset=p,"ENDSITE"!=c.type){if(!(f=null===(s=e.shift())||void 0===s?void 0:s.trim().split(/\s+/)))throw new Error("Unexpected end of file: missing CHANNELS");if("CHANNELS"!=f[0].toUpperCase())throw new Error("Expected CHANNELS definition");var m=parseInt(f[1]);c.channels=f.splice(2,m),c.children=[]}for(;e.length>0;){var _=null===(l=e.shift())||void 0===l?void 0:l.trim();if("}"===_)return c;_&&c.children.push(h(e,_,c,o))}throw new Error("Unexpected end of file: missing closing brace")}function d(e,n,r,o){var a=e.split("\n"),i=o.loopMode;n._blockEntityCollection=!!r;var s=new t.Skeleton("","",n);s._parentContainer=r,n._blockEntityCollection=!1;var u=new l(s);u.loopMode=i;var d=a.shift();if(!d||"HIERARCHY"!==d.trim().toUpperCase())throw new Error("HIERARCHY expected");var p=a.shift();if(!p)throw new Error("Unexpected end of file after HIERARCHY");var m=h(a,p.trim(),null,u),_=a.shift();if(!_||"MOTION"!==_.trim().toUpperCase())throw new Error("MOTION expected");var g=a.shift();if(!g)throw new Error("Unexpected end of file before frame count");var b=g.trim().split(/[\s]+/);if(b.length<2)throw new Error("Invalid frame count line");var y=parseInt(b[1]);if(isNaN(y))throw new Error("Failed to read number of frames.");u.numFrames=y;var v=a.shift();if(!v)throw new Error("Unexpected end of file before frame time");var T=v.trim().split(/[\s]+/);if(T.length<3)throw new Error("Invalid frame time line");var x=parseFloat(T[2]);if(isNaN(x))throw new Error("Failed to read frame time.");if(x<=0)throw new Error("Failed to read frame time. Invalid value "+x);u.frameRate=1/x;for(var A=0;A<y;++A){var w=a.shift();w&&f(w.trim().split(/[\s]+/)||[],A,m,{i:0})}return u.root=m,c(u.root,null,u),u.skeleton.returnToRest(),u.skeleton}var p=function(e,t){return p=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])},p(e,t)};function m(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}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var _=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function g(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 b(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])}}}function y(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var v={name:"bvh",extensions:{".bvh":{isBinary:!1}}},T=function(){function e(t){this.name=v.name,this.extensions=v.extensions,this._loadingOptions=_(_({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{loopMode:t.Animation.ANIMATIONLOOPMODE_CYCLE}},enumerable:!1,configurable:!0}),e.prototype.createPlugin=function(t){return new e(t[v.name])},e.prototype.canDirectLoad=function(e){return this.isBvhHeader(e)},e.prototype.isBvhHeader=function(e){return"HIERARCHY"==e.split("\n")[0]},e.prototype.isNotBvhHeader=function(e){return!this.isBvhHeader(e)},e.prototype.importMeshAsync=function(e,t,n){if("string"!=typeof n)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(n))return Promise.reject("BVH loader expects HIERARCHY header.");try{var r=d(n,t,null,this._loadingOptions);return Promise.resolve({meshes:[],particleSystems:[],skeletons:[r],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]})}catch(e){return Promise.reject(e)}},e.prototype.loadAsync=function(e,t){return"string"!=typeof t?Promise.reject("BVH loader expects string data."):this.isNotBvhHeader(t)?Promise.reject("BVH loader expects HIERARCHY header."):this.importMeshAsync(null,e,t).then(function(){})},e.prototype.loadAssetContainerAsync=function(e,n){if("string"!=typeof n)return Promise.reject("BVH loader expects string data.");if(this.isNotBvhHeader(n))return Promise.reject("BVH loader expects HIERARCHY header.");var r=new t.AssetContainer(e);try{var o=d(n,e,r,this._loadingOptions);return r.skeletons.push(o),Promise.resolve(r)}catch(e){return Promise.reject(e)}},e}();t.RegisterSceneLoaderPlugin(new T);var x={__proto__:null,BVHFileLoader:T},A={__proto__:null,BVHFileLoader:T,ReadBvh:d};function w(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 C(){var e=[];onmessage=function(t){var n=t.data;switch(n.id){case"init":importScripts(n.url);break;case"validate":w(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 O,M,E,R=function(){function e(){}return e.ValidateAsync=function(n,r,o,a){var i=this;return"function"==typeof Worker?new Promise(function(s,l){var u="".concat(w,"(").concat(C,")()"),c=URL.createObjectURL(new Blob([u],{type:"application/javascript"})),f=new Worker(c),h=function(e){f.removeEventListener("error",h),f.removeEventListener("message",d),l(e)},d=function(t){var n=t.data;switch(n.id){case"getExternalResource":a(n.uri).then(function(e){f.postMessage({id:"getExternalResource.resolve",index:n.index,value:e},[e.buffer])},function(e){f.postMessage({id:"getExternalResource.reject",index:n.index,reason:e})});break;case"validate.resolve":f.removeEventListener("error",h),f.removeEventListener("message",d),e._LastResults=n.value,s(n.value),f.terminate();break;case"validate.reject":f.removeEventListener("error",h),f.removeEventListener("message",d),l(n.reason),f.terminate()}};if(f.addEventListener("error",h),f.addEventListener("message",d),f.postMessage({id:"init",url:t.Tools.GetBabylonScriptURL(i.Configuration.url)}),ArrayBuffer.isView(n)){var p=n.slice();f.postMessage({id:"validate",data:p,rootUrl:r,fileName:o},[p.buffer])}else f.postMessage({id:"validate",data:n,rootUrl:r,fileName:o})}):(this._LoadScriptPromise||(this._LoadScriptPromise=t.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then(function(){return w(n,r,o,a)}))},e.Configuration={url:"".concat(t.Tools._DefaultCdnUrl,"/gltf_validator.js")},e._LastResults=null,e}(),F={__proto__:null,GLTFValidation:R},L="Z2xURg",P={name:"gltf",extensions:{".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}},canDirectLoad:function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+L)||e.startsWith("data:;base64,"+L)||e.startsWith("data:application/octet-stream;base64,"+L)||e.startsWith("data:model/gltf-binary;base64,"+L)}};function S(e,t,n){try{return Promise.resolve(new Uint8Array(e,t,n))}catch(e){return Promise.reject(e)}}e.GLTFLoaderCoordinateSystemMode=void 0,(O=e.GLTFLoaderCoordinateSystemMode||(e.GLTFLoaderCoordinateSystemMode={}))[O.AUTO=0]="AUTO",O[O.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED",e.GLTFLoaderAnimationStartMode=void 0,(M=e.GLTFLoaderAnimationStartMode||(e.GLTFLoaderAnimationStartMode={}))[M.NONE=0]="NONE",M[M.FIRST=1]="FIRST",M[M.ALL=2]="ALL",e.GLTFLoaderState=void 0,(E=e.GLTFLoaderState||(e.GLTFLoaderState={}))[E.LOADING=0]="LOADING",E[E.READY=1]="READY",E[E.COMPLETE=2]="COMPLETE";var N=function(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=e.GLTFLoaderAnimationStartMode.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=e.GLTFLoaderCoordinateSystemMode.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},I=new N,B=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 m(t,e),t.prototype.copyFrom=function(e){var t,n,r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,b,y,v,T,x,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!==(h=e.loadNodeAnimations)&&void 0!==h?h:this.loadNodeAnimations,this.loadOnlyMaterials=null!==(d=e.loadOnlyMaterials)&&void 0!==d?d:this.loadOnlyMaterials,this.loadSkins=null!==(p=e.loadSkins)&&void 0!==p?p: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!==(g=e.skipMaterials)&&void 0!==g?g:this.skipMaterials,this.targetFps=null!==(b=e.targetFps)&&void 0!==b?b: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!==(C=e.validate)&&void 0!==C?C:this.validate,this.dontUseTransmissionHelper=null!==(O=e.dontUseTransmissionHelper)&&void 0!==O?O:this.dontUseTransmissionHelper)},t}(N),k=function(n){function r(e){var r=n.call(this)||this;return r.onParsedObservable=new t.Observable,r.onMeshLoadedObservable=new t.Observable,r.onSkinLoadedObservable=new t.Observable,r.onTextureLoadedObservable=new t.Observable,r.onMaterialLoadedObservable=new t.Observable,r.onCameraLoadedObservable=new t.Observable,r.onCompleteObservable=new t.Observable,r.onErrorObservable=new t.Observable,r.onDisposeObservable=new t.Observable,r.onExtensionLoadedObservable=new t.Observable,r.onValidatedObservable=new t.Observable,r._loader=null,r._state=null,r._requests=new Array,r.name=P.name,r.extensions=P.extensions,r.onLoaderStateChangedObservable=new t.Observable,r._logIndentLevel=0,r._loggingEnabled=!1,r._log=r._logDisabled,r._capturePerformanceCounters=!1,r._startPerformanceCounter=r._startPerformanceCounterDisabled,r._endPerformanceCounter=r._endPerformanceCounterDisabled,r.copyFrom(Object.assign(_({},I),e)),r}return m(r,n),Object.defineProperty(r.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(r.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(r.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(r.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(r.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(r.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(r.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.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(r.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(r.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),r.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()},r.prototype.loadFile=function(e,n,r,o,a,i,s,l){var u=this;if(ArrayBuffer.isView(n))return this._loadBinary(e,n,r,o,s,l),null;this._progressCallback=a;var c=n.name||t.Tools.GetFilename(n);if(i){if(this.useRangeRequests){this.validate&&t.Logger.Warn("glTF validation is not supported when range requests are enabled");var f={abort:function(){},onCompleteObservable:new t.Observable},h={readAsync:function(t,r){return new Promise(function(o,a){u._loadFile(e,n,function(e){o(new Uint8Array(e))},!0,function(e){a(e)},function(e){e.setRequestHeader("Range","bytes=".concat(t,"-").concat(t+r-1))})})},byteLength:0};return this._unpackBinaryAsync(new t.DataReader(h)).then(function(e){f.onCompleteObservable.notifyObservers(f),o(e)},s?function(e){return s(void 0,e)}:void 0),f}return this._loadFile(e,n,function(n){u._validate(e,new Uint8Array(n,0,n.byteLength),r,c),u._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){return S(n,e,t)},byteLength:n.byteLength})).then(function(e){o(e)},s?function(e){return s(void 0,e)}:void 0)},!0,s)}return this._loadFile(e,n,function(t){try{u._validate(e,t,r,c),o({json:u._parseJson(t)})}catch(e){s&&s()}},!1,s)},r.prototype._loadBinary=function(e,n,r,o,a,i){this._validate(e,new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r,i),this._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){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)}}(n,e,t)},byteLength:n.byteLength})).then(function(e){o(e)},a?function(e){return a(void 0,e)}:void 0)},r.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)})},r.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)})},r.prototype.loadAssetContainerAsync=function(e,n,r,o,a){var i=this;return Promise.resolve().then(function(){i.onParsedObservable.notifyObservers(n),i.onParsedObservable.clear(),i._log("Loading ".concat(a||"")),i._loader=i._getLoader(n);var s=new t.AssetContainer(e),l=[];i.onMaterialLoadedObservable.add(function(e){l.push(e)});var u=[];i.onTextureLoadedObservable.add(function(e){u.push(e)});var c=[];i.onCameraLoadedObservable.add(function(e){c.push(e)});var f=[];return i.onMeshLoadedObservable.add(function(e){e.morphTargetManager&&f.push(e.morphTargetManager)}),i._loader.importMeshAsync(null,e,s,n,r,o,a).then(function(e){return Array.prototype.push.apply(s.geometries,e.geometries),Array.prototype.push.apply(s.meshes,e.meshes),Array.prototype.push.apply(s.particleSystems,e.particleSystems),Array.prototype.push.apply(s.skeletons,e.skeletons),Array.prototype.push.apply(s.animationGroups,e.animationGroups),Array.prototype.push.apply(s.materials,l),Array.prototype.push.apply(s.textures,u),Array.prototype.push.apply(s.lights,e.lights),Array.prototype.push.apply(s.transformNodes,e.transformNodes),Array.prototype.push.apply(s.cameras,c),Array.prototype.push.apply(s.morphTargetManagers,f),s})})},r.prototype.canDirectLoad=function(e){return P.canDirectLoad(e)},r.prototype.directLoad=function(e,n){if(n.startsWith("base64,"+L)||n.startsWith(";base64,"+L)||n.startsWith("application/octet-stream;base64,"+L)||n.startsWith("model/gltf-binary;base64,"+L)){var r=t.DecodeBase64UrlToBinary(n);return this._validate(e,new Uint8Array(r,0,r.byteLength)),this._unpackBinaryAsync(new t.DataReader({readAsync:function(e,t){return S(r,e,t)},byteLength:r.byteLength}))}return this._validate(e,n),Promise.resolve({json:this._parseJson(n)})},r.prototype.createPlugin=function(e){return new r(e[P.name])},Object.defineProperty(r.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),r.prototype.whenCompleteAsync=function(){var e=this;return new Promise(function(t,n){e.onCompleteObservable.addOnce(function(){t()}),e.onErrorObservable.addOnce(function(e){n(e)})})},r.prototype._setState=function(t){this._state!==t&&(this._state=t,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(e.GLTFLoaderState[this._state]))},r.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},r.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})}},r.prototype._validate=function(e,n,r,o){var a=this;void 0===r&&(r=""),void 0===o&&(o=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),R.ValidateAsync(n,r,o,function(t){return a.preprocessUrlAsync(r+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){a._endPerformanceCounter("Validate JSON"),a.onValidatedObservable.notifyObservers(e),a.onValidatedObservable.clear()},function(e){a._endPerformanceCounter("Validate JSON"),t.Tools.Warn("Failed to validate: ".concat(e.message)),a.onValidatedObservable.clear()}))},r.prototype._getLoader=function(e){var t=e.json.asset||{};this._log("Asset version: ".concat(t.version)),t.minVersion&&this._log("Asset minimum version: ".concat(t.minVersion)),t.generator&&this._log("Asset generator: ".concat(t.generator));var n=r._parseVersion(t.version);if(!n)throw new Error("Invalid version: "+t.version);if(void 0!==t.minVersion){var o=r._parseVersion(t.minVersion);if(!o)throw new Error("Invalid minimum version: "+t.minVersion);if(r._compareVersion(o,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+t.minVersion)}var a={1:r._CreateGLTF1Loader,2:r._CreateGLTF2Loader}[n.major];if(!a)throw new Error("Unsupported version: "+t.version);return a(this)},r.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},r.prototype._unpackBinaryAsync=function(e){var n=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then(function(){var r=e.readUint32();if(1179937895!==r)throw new t.RuntimeError("Unexpected magic: "+r,t.ErrorCodes.GLTFLoaderUnexpectedMagicError);var o=e.readUint32();n.loggingEnabled&&n._log("Binary version: ".concat(o));var a,i=e.readUint32();switch(n.useRangeRequests||i===e.buffer.byteLength||t.Logger.Warn("Length in header does not match actual data length: ".concat(i," != ").concat(e.buffer.byteLength)),o){case 1:a=n._unpackBinaryV1Async(e,i);break;case 2:a=n._unpackBinaryV2Async(e,i);break;default:throw new Error("Unsupported version: "+o)}return n._endPerformanceCounter("Unpack Binary"),a})},r.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)},r.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()})},r._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},r._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},r.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},r.prototype._logClose=function(){--this._logIndentLevel},r.prototype._logEnabled=function(e){var n=r._logSpaces.substring(0,2*this._logIndentLevel);t.Logger.Log("".concat(n).concat(e))},r.prototype._logDisabled=function(e){},r.prototype._startPerformanceCounterEnabled=function(e){t.Tools.StartPerformanceCounter(e)},r.prototype._startPerformanceCounterDisabled=function(e){},r.prototype._endPerformanceCounterEnabled=function(e){t.Tools.EndPerformanceCounter(e)},r.prototype._endPerformanceCounterDisabled=function(e){},r.IncrementalLoading=!0,r.HomogeneousCoordinates=!1,r._logSpaces=" ",r}(B);t.RegisterSceneLoaderPlugin(new k);var G,V,D,H,K,j,U,W,z={__proto__:null,GLTFFileLoader:k,get GLTFLoaderAnimationStartMode(){return e.GLTFLoaderAnimationStartMode},get GLTFLoaderCoordinateSystemMode(){return e.GLTFLoaderCoordinateSystemMode},GLTFLoaderDefaultOptions:I,get GLTFLoaderState(){return e.GLTFLoaderState}};!function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.FLOAT=5126]="FLOAT"}(G||(G={})),function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"}(V||(V={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"}(D||(D={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"}(H||(H={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9728]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(K||(K={})),function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA"}(j||(j={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(U||(U={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"}(W||(W={}));var q,Y=function(){function e(){}return e.SetMatrix=function(e,n,r,o,a){var i=null;if("MODEL"===r.semantic?i=n.getWorldMatrix():"PROJECTION"===r.semantic?i=e.getProjectionMatrix():"VIEW"===r.semantic?i=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===r.semantic?i=t.Matrix.Transpose(n.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===r.semantic?i=n.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===r.semantic?i=n.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===r.semantic?i=n.getWorldMatrix().invert():"VIEWINVERSE"===r.semantic?i=e.getViewMatrix().invert():"PROJECTIONINVERSE"===r.semantic?i=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===r.semantic?i=n.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===r.semantic?i=n.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===r.semantic&&(i=t.Matrix.Transpose(n.getWorldMatrix().invert())),i)switch(r.type){case D.FLOAT_MAT2:a.setMatrix2x2(o,t.Matrix.GetAsMatrix2x2(i));break;case D.FLOAT_MAT3:a.setMatrix3x3(o,t.Matrix.GetAsMatrix3x3(i));break;case D.FLOAT_MAT4:a.setMatrix(o,i)}},e.SetUniform=function(e,n,r,o){switch(o){case D.FLOAT:return e.setFloat(n,r),!0;case D.FLOAT_VEC2:return e.setVector2(n,t.Vector2.FromArray(r)),!0;case D.FLOAT_VEC3:return e.setVector3(n,t.Vector3.FromArray(r)),!0;case D.FLOAT_VEC4:return e.setVector4(n,t.Vector4.FromArray(r)),!0;default:return!1}},e.GetWrapMode=function(e){switch(e){case H.CLAMP_TO_EDGE:return t.Texture.CLAMP_ADDRESSMODE;case H.MIRRORED_REPEAT:return t.Texture.MIRROR_ADDRESSMODE;case H.REPEAT:default:return t.Texture.WRAP_ADDRESSMODE}},e.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},e.GetTextureFilterMode=function(e){switch(e){case K.LINEAR:case K.LINEAR_MIPMAP_NEAREST:case K.LINEAR_MIPMAP_LINEAR:return t.Texture.TRILINEAR_SAMPLINGMODE;case K.NEAREST:case K.NEAREST_MIPMAP_NEAREST:return t.Texture.NEAREST_SAMPLINGMODE;default:return t.Texture.BILINEAR_SAMPLINGMODE}},e.GetBufferFromBufferView=function(e,t,n,r,o){n=t.byteOffset+n;var a=e.loadedBufferViews[t.buffer];if(n+r>a.byteLength)throw new Error("Buffer access is out of range");var i=a.buffer;switch(n+=a.byteOffset,o){case G.BYTE:return new Int8Array(i,n,r);case G.UNSIGNED_BYTE:return new Uint8Array(i,n,r);case G.SHORT:return new Int16Array(i,n,r);case G.UNSIGNED_SHORT:return new Uint16Array(i,n,r);default:return new Float32Array(i,n,r)}},e.GetBufferFromAccessor=function(t,n){var r=t.bufferViews[n.bufferView],o=n.count*e.GetByteStrideFromType(n);return e.GetBufferFromBufferView(t,r,n.byteOffset,o,n.componentType)},e.DecodeBufferToText=function(e){for(var t="",n=e.byteLength,r=0;r<n;++r)t+=String.fromCharCode(e[r]);return t},e.GetDefaultMaterial=function(n){if(!e._DefaultMaterial){t.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{"," gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),t.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var r={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};e._DefaultMaterial=new t.ShaderMaterial("GLTFDefaultMaterial",n,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},r),e._DefaultMaterial.setColor4("u_emission",new t.Color4(.5,.5,.5,1))}return e._DefaultMaterial},e._DefaultMaterial=null,e}();!function(e){e[e.IDENTIFIER=1]="IDENTIFIER",e[e.UNKNOWN=2]="UNKNOWN",e[e.END_OF_INPUT=3]="END_OF_INPUT"}(q||(q={}));var X=function(){function e(e){this._pos=0,this.currentToken=q.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}return e.prototype.getNextToken=function(){if(this.isEnd())return q.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=q.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=q.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},e.prototype.peek=function(){return this._toParse[this._pos]},e.prototype.read=function(){return this._toParse[this._pos++]},e.prototype.forward=function(){this._pos++},e.prototype.isEnd=function(){return this._pos>=this._maxPos},e}(),J=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],Q=["world","view","projection","worldView","worldViewProjection","mBones"],Z=["translation","rotation","scale"],$=["position","rotationQuaternion","scaling"],ee=function(e,t,n){for(var r in e){var o=e[r];n[t][r]=o}},te=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},ne=function(e){if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){var t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},re=function(e){var n;if(e.translation||e.rotation||e.scale){var r=t.Vector3.FromArray(e.scale||[1,1,1]),o=t.Quaternion.FromArray(e.rotation||[0,0,0,1]),a=t.Vector3.FromArray(e.translation||[0,0,0]);n=t.Matrix.Compose(r,o,a)}else n=t.Matrix.FromArray(e.matrix);return n},oe=function(e,n,r,o){for(var a=0;a<o.bones.length;a++)if(o.bones[a].name===r)return o.bones[a];var i=e.nodes;for(var s in i){var l=i[s];if(l.jointName){var u=l.children;for(a=0;a<u.length;a++){var c=e.nodes[u[a]];if(c.jointName&&c.jointName===r){var f=re(l),h=new t.Bone(l.name||"",o,oe(e,n,l.jointName,o),f);return h.id=s,h}}}}return null},ae=function(e,t){for(var n=0;n<e.length;n++)for(var r=e[n],o=0;o<r.node.children.length;o++)if(r.node.children[o]===t)return r.bone;return null},ie=function(e,t){var n=e.nodes,r=n[t];if(r)return{node:r,id:t};for(var o in n)if((r=n[o]).jointName===t)return{node:r,id:o};return null},se=function(e,t){for(var n=0;n<e.jointNames.length;n++)if(e.jointNames[n]===t)return!0;return!1},le=function(e,n,r,o,a){if(a||(e.scene._blockEntityCollection=!!e.assetContainer,(a=new t.Mesh(n.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,a.id=o),!n.babylonNode)return a;for(var i,s=[],l=null,u=[],c=[],f=[],h=[],d=0;d<r.length;d++){var p=r[d];if(R=e.meshes[p])for(var m=0;m<R.primitives.length;m++){var _=new t.VertexData,g=R.primitives[m];g.mode;var b=g.attributes,y=void 0,v=void 0;for(var T in b)if(y=e.accessors[b[T]],v=Y.GetBufferFromAccessor(e,y),"NORMAL"===T)_.normals=new Float32Array(v.length),_.normals.set(v);else if("POSITION"===T){if(k.HomogeneousCoordinates){_.positions=new Float32Array(v.length-v.length/4);for(var x=0;x<v.length;x+=4)_.positions[x]=v[x],_.positions[x+1]=v[x+1],_.positions[x+2]=v[x+2]}else _.positions=new Float32Array(v.length),_.positions.set(v);c.push(_.positions.length)}else if(-1!==T.indexOf("TEXCOORD_")){var A=Number(T.split("_")[1]),w=t.VertexBuffer.UVKind+(0===A?"":A+1),C=new Float32Array(v.length);C.set(v),te(C),_.set(C,w)}else"JOINT"===T?(_.matricesIndices=new Float32Array(v.length),_.matricesIndices.set(v)):"WEIGHT"===T?(_.matricesWeights=new Float32Array(v.length),_.matricesWeights.set(v)):"COLOR"===T&&(_.colors=new Float32Array(v.length),_.colors.set(v));if(y=e.accessors[g.indices])v=Y.GetBufferFromAccessor(e,y),_.indices=new Int32Array(v.length),_.indices.set(v),h.push(_.indices.length);else{var O=[];for(x=0;x<_.positions.length/3;x++)O.push(x);_.indices=new Int32Array(O),h.push(_.indices.length)}l?l.merge(_):l=_;var M=e.scene.getMaterialById(g.material);s.push(null===M?Y.GetDefaultMaterial(e.scene):M),u.push(0===u.length?0:u[u.length-1]+c[c.length-2]),f.push(0===f.length?0:f[f.length-1]+h[h.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,s.length>1?(i=new t.MultiMaterial("multimat"+o,e.scene)).subMaterials=s:i=new t.StandardMaterial("multimat"+o,e.scene),1===s.length&&(i=s[0]),i._parentContainer=e.assetContainer,a.material||(a.material=i),new t.Geometry(o,e.scene,l,!1,a),a.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,a.subMeshes=[];var E=0;for(d=0;d<r.length;d++){var R;if(p=r[d],R=e.meshes[p])for(m=0;m<R.primitives.length;m++)R.primitives[m].mode,t.SubMesh.AddToMesh(E,u[E],c[E],f[E],h[E],a,a,!0),E++}return a},ue=function(e,t,n,r){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=n),e.scaling&&(e.scaling=r)},ce=function(e,n,r){var o=null;if(e.importOnlyMeshes&&(n.skin||n.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(n.name||""))return null;if(n.skin){if(n.meshes){var a=e.skins[n.skin];(i=le(e,n,n.meshes,r,n.babylonNode)).skeleton=e.scene.getLastSkeletonById(n.skin),null===i.skeleton&&(i.skeleton=function(e,n,r,o){if(o||(o=new t.Skeleton(n.name||"","",e.scene)),!n.babylonSkeleton)return o;var a=[],i=[];!function(e,n,r,o){for(var a in e.nodes){var i=e.nodes[a],s=a;if(i.jointName&&!se(r,i.jointName)){var l=re(i),u=new t.Bone(i.name||"",n,null,l);u.id=s,o.push({bone:u,node:i,id:s})}}for(var c=0;c<o.length;c++)for(var f=o[c],h=f.node.children,d=0;d<h.length;d++){for(var p=null,m=0;m<o.length;m++)if(o[m].id===h[d]){p=o[m];break}p&&(p.bone._parent=f.bone,f.bone.children.push(p.bone))}}(e,o,n,a),o.bones=[];for(var s=0;s<n.jointNames.length;s++)if(v=ie(e,n.jointNames[s])){var l=v.node;if(l){var u=v.id,c=e.scene.getBoneById(u);if(c)o.bones.push(c);else{for(var f=void 0,h=null,d=0;d<s;d++){var p=ie(e,n.jointNames[d]);if(p){var m=p.node;if(m){var _=m.children;if(_){f=!1;for(var g=0;g<_.length;g++)if(_[g]===u){h=oe(e,n,n.jointNames[d],o),f=!0;break}if(f)break}}else t.Tools.Warn("Joint named "+n.jointNames[d]+" does not exist when looking for parent")}}var b=re(l);!h&&a.length>0&&(h=ae(a,u))&&-1===i.indexOf(h)&&i.push(h),new t.Bone(l.jointName||"",o,h,b).id=u}}else t.Tools.Warn("Joint named "+n.jointNames[s]+" does not exist")}var y=o.bones;for(o.bones=[],s=0;s<n.jointNames.length;s++){var v;if(v=ie(e,n.jointNames[s]))for(d=0;d<y.length;d++)if(y[d].id===v.id){o.bones.push(y[d]);break}}for(o.prepare(),s=0;s<i.length;s++)o.bones.push(i[s]);return o}(e,a,0,a.babylonSkeleton),a.babylonSkeleton||(a.babylonSkeleton=i.skeleton)),o=i}}else if(n.meshes){var i;o=i=le(e,n,n.mesh?[n.mesh]:n.meshes,r,n.babylonNode)}else if(!n.light||n.babylonNode||e.importOnlyMeshes){if(n.camera&&!n.babylonNode&&!e.importOnlyMeshes){var s=e.cameras[n.camera];if(s){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===s.type){var l=new t.FreeCamera(n.camera,t.Vector3.Zero(),e.scene,!1);l.name=n.name||"",l.mode=t.Camera.ORTHOGRAPHIC_CAMERA,l.attachControl(),o=l,l._parentContainer=e.assetContainer}else if("perspective"===s.type){var u=s[s.type],c=new t.FreeCamera(n.camera,t.Vector3.Zero(),e.scene,!1);c.name=n.name||"",c.attachControl(),u.aspectRatio||(u.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),u.znear&&u.zfar&&(c.maxZ=u.zfar,c.minZ=u.znear),o=c,c._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{var f=e.lights[n.light];if(f)if("ambient"===f.type){var h=f[f.type],d=new t.HemisphericLight(n.light,t.Vector3.Zero(),e.scene);d.name=n.name||"",h.color&&(d.diffuse=t.Color3.FromArray(h.color)),o=d}else if("directional"===f.type){var p=f[f.type],m=new t.DirectionalLight(n.light,t.Vector3.Zero(),e.scene);m.name=n.name||"",p.color&&(m.diffuse=t.Color3.FromArray(p.color)),o=m}else if("point"===f.type){var _=f[f.type],g=new t.PointLight(n.light,t.Vector3.Zero(),e.scene);g.name=n.name||"",_.color&&(g.diffuse=t.Color3.FromArray(_.color)),o=g}else if("spot"===f.type){var b=f[f.type],y=new t.SpotLight(n.light,t.Vector3.Zero(),t.Vector3.Zero(),0,0,e.scene);y.name=n.name||"",b.color&&(y.diffuse=t.Color3.FromArray(b.color)),b.fallOfAngle&&(y.angle=b.fallOfAngle),b.fallOffExponent&&(y.exponent=b.fallOffExponent),o=y}}if(!n.jointName){if(n.babylonNode)return n.babylonNode;if(null===o){e.scene._blockEntityCollection=!!e.assetContainer;var v=new t.Mesh(n.name||"",e.scene);v._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,n.babylonNode=v,o=v}}if(null!==o){if(n.matrix&&o instanceof t.Mesh)!function(e,n){if(n.matrix){var r=new t.Vector3(0,0,0),o=new t.Quaternion,a=new t.Vector3(0,0,0);t.Matrix.FromArray(n.matrix).decompose(a,o,r),ue(e,r,o,a)}else n.translation&&n.rotation&&n.scale&&ue(e,t.Vector3.FromArray(n.translation),t.Quaternion.FromArray(n.rotation),t.Vector3.FromArray(n.scale));e.computeWorldMatrix(!0)}(o,n);else{var T=n.translation||[0,0,0],x=n.rotation||[0,0,0,1],A=n.scale||[1,1,1];ue(o,t.Vector3.FromArray(T),t.Quaternion.FromArray(x),t.Vector3.FromArray(A))}o.updateCache(!0),n.babylonNode=o}return o},fe=function(e,t,n,r){void 0===r&&(r=!1);var o=e.nodes[t],a=null;if(r=!(e.importOnlyMeshes&&!r&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&r&&null!==(a=ce(e,o,t))&&(a.id=t,a.parent=n),o.children)for(var i=0;i<o.children.length;i++)fe(e,o.children[i],a,r)},he=function(e){var n=e.currentScene;if(n)for(var r=0;r<n.nodes.length;r++)fe(e,n.nodes[r],null);else for(var o in e.scenes)for(n=e.scenes[o],r=0;r<n.nodes.length;r++)fe(e,n.nodes[r],null);for(function(e){for(var n in e.animations){var r=e.animations[n];if(r.channels&&r.samplers)for(var o=null,a=0;a<r.channels.length;a++){var i=r.channels[a],s=r.samplers[i.sampler];if(s){var l=void 0,u=void 0;r.parameters?(l=r.parameters[s.input],u=r.parameters[s.output]):(l=s.input,u=s.output);var c=Y.GetBufferFromAccessor(e,e.accessors[l]),f=Y.GetBufferFromAccessor(e,e.accessors[u]),h=i.target.id,d=e.scene.getNodeById(h);if(null===d&&(d=e.scene.getNodeByName(h)),null!==d){var p=d instanceof t.Bone,m=i.target.path,_=Z.indexOf(m);-1!==_&&(m=$[_]);var g=t.Animation.ANIMATIONTYPE_MATRIX;p||("rotationQuaternion"===m?(g=t.Animation.ANIMATIONTYPE_QUATERNION,d.rotationQuaternion=new t.Quaternion):g=t.Animation.ANIMATIONTYPE_VECTOR3);var b=null,y=[],v=0,T=!1;p&&o&&o.getKeys().length===c.length&&(b=o,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,b=new t.Animation(n,p?"_matrix":m,1,g,t.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var x=0;x<c.length;x++){var A=void 0;if("rotationQuaternion"===m?(A=t.Quaternion.FromArray([f[v],f[v+1],f[v+2],f[v+3]]),v+=4):(A=t.Vector3.FromArray([f[v],f[v+1],f[v+2]]),v+=3),p){var w=d,C=t.Vector3.Zero(),O=new t.Quaternion,M=t.Vector3.Zero(),E=w.getBaseMatrix();T&&o&&(E=o.getKeys()[x].value),E.decompose(M,O,C),"position"===m?C=A:"rotationQuaternion"===m?O=A:M=A,A=t.Matrix.Compose(M,O,C)}T?o&&(o.getKeys()[x].value=A):y.push({frame:c[x],value:A})}!T&&b&&(b.setKeys(y),d.animations.push(b)),o=b,e.scene.stopAnimation(d),e.scene.beginAnimation(d,0,c[c.length-1],!0,1)}else t.Tools.Warn("Creating animation named "+n+". But cannot find node named "+h+" to attach to")}}}}(e),r=0;r<e.scene.skeletons.length;r++){var a=e.scene.skeletons[r];e.scene.beginAnimation(a,0,Number.MAX_VALUE,!0,1)}},de=function(e,t,n){for(var r in t.uniforms){var o=t.uniforms[r],a=t.parameters[o];if(e.currentIdentifier===r&&a.semantic&&!a.source&&!a.node){var i=J.indexOf(a.semantic);if(-1!==i)return delete n[r],Q[i]}}return e.currentIdentifier},pe=function(e){for(var t in e.materials)ge.LoadMaterialAsync(e,t,function(){},function(){})},me=function(){function e(){}return e.CreateRuntime=function(e,t,n){var r={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:n,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&ee(e.extensions,"extensions",r),e.extensionsUsed&&ee(e.extensionsUsed,"extensionsUsed",r),e.buffers&&function(e,t){for(var n in e){var r=e[n];t.buffers[n]=r,t.buffersCount++}}(e.buffers,r),e.bufferViews&&ee(e.bufferViews,"bufferViews",r),e.accessors&&ee(e.accessors,"accessors",r),e.meshes&&ee(e.meshes,"meshes",r),e.lights&&ee(e.lights,"lights",r),e.cameras&&ee(e.cameras,"cameras",r),e.nodes&&ee(e.nodes,"nodes",r),e.images&&ee(e.images,"images",r),e.textures&&ee(e.textures,"textures",r),e.shaders&&function(e,t){for(var n in e){var r=e[n];t.shaders[n]=r,t.shaderscount++}}(e.shaders,r),e.programs&&ee(e.programs,"programs",r),e.samplers&&ee(e.samplers,"samplers",r),e.techniques&&ee(e.techniques,"techniques",r),e.materials&&ee(e.materials,"materials",r),e.animations&&ee(e.animations,"animations",r),e.skins&&ee(e.skins,"skins",r),e.scenes&&(r.scenes=e.scenes),e.scene&&e.scenes&&(r.currentScene=e.scenes[e.scene]),r},e.LoadBufferAsync=function(e,n,r,o,a){var i=e.buffers[n];t.Tools.IsBase64(i.uri)?setTimeout(function(){return r(new Uint8Array(t.Tools.DecodeBase64(i.uri)))}):t.Tools.LoadFile(e.rootUrl+i.uri,function(e){return r(new Uint8Array(e))},a,void 0,!0,function(e){e&&o(e.status+" "+e.statusText)})},e.LoadTextureBufferAsync=function(e,n,r,o){var a=e.textures[n];if(a&&a.source)if(a.babylonTexture)r(null);else{var i=e.images[a.source];t.Tools.IsBase64(i.uri)?setTimeout(function(){return r(new Uint8Array(t.Tools.DecodeBase64(i.uri)))}):t.Tools.LoadFile(e.rootUrl+i.uri,function(e){return r(new Uint8Array(e))},void 0,void 0,!0,function(e){e&&o(e.status+" "+e.statusText)})}else o("")},e.CreateTextureAsync=function(e,n,r,o){var a=e.textures[n];if(a.babylonTexture)o(a.babylonTexture);else{var i=e.samplers[a.sampler],s=i.minFilter===K.NEAREST_MIPMAP_NEAREST||i.minFilter===K.NEAREST_MIPMAP_LINEAR||i.minFilter===K.LINEAR_MIPMAP_NEAREST||i.minFilter===K.LINEAR_MIPMAP_LINEAR,l=t.Texture.BILINEAR_SAMPLINGMODE,u=null==r?new Blob:new Blob([t.GetBlobBufferSource(r)]),c=URL.createObjectURL(u),f=function(){return URL.revokeObjectURL(c)},h=new t.Texture(c,e.scene,!s,!0,l,f,f);void 0!==i.wrapS&&(h.wrapU=Y.GetWrapMode(i.wrapS)),void 0!==i.wrapT&&(h.wrapV=Y.GetWrapMode(i.wrapT)),h.name=n,a.babylonTexture=h,o(h)}},e.LoadShaderStringAsync=function(e,n,r,o){var a=e.shaders[n];if(t.Tools.IsBase64(a.uri)){var i=atob(a.uri.split(",")[1]);r&&r(i)}else t.Tools.LoadFile(e.rootUrl+a.uri,r,void 0,void 0,!1,function(e){e&&o&&o(e.status+" "+e.statusText)})},e.LoadMaterialAsync=function(e,n,r,o){var a=e.materials[n];if(a.technique){var i=e.techniques[a.technique];if(!i){e.scene._blockEntityCollection=!!e.assetContainer;var s=new t.StandardMaterial(n,e.scene);return s._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,s.diffuseColor=new t.Color3(.5,.5,.5),s.sideOrientation=t.Material.CounterClockWiseSideOrientation,void r(s)}var l=e.programs[i.program],u=i.states,c=t.Effect.ShadersStore[l.vertexShader+"VertexShader"],f=t.Effect.ShadersStore[l.fragmentShader+"PixelShader"],h="",d="",p=new X(c),m=new X(f),_={},g=[],b=[],y=[];for(var v in i.uniforms){var T=i.uniforms[v],x=i.parameters[T];if(_[v]=x,!x.semantic||x.node||x.source)x.type===D.SAMPLER_2D?y.push(v):g.push(v);else{var A=J.indexOf(x.semantic);-1!==A?(g.push(Q[A]),delete _[v]):g.push(v)}}for(var w in i.attributes){var C=i.attributes[w];if((E=i.parameters[C]).semantic){var O=ne(E);O&&b.push(O)}}for(;!p.isEnd()&&p.getNextToken();)if(p.currentToken===q.IDENTIFIER){var M=!1;for(var w in i.attributes){C=i.attributes[w];var E=i.parameters[C];if(p.currentIdentifier===w&&E.semantic){h+=ne(E),M=!0;break}}M||(h+=de(p,i,_))}else h+=p.currentString;for(;!m.isEnd()&&m.getNextToken();)m.currentToken===q.IDENTIFIER?d+=de(m,i,_):d+=m.currentString;var R={vertex:l.vertexShader+n,fragment:l.fragmentShader+n},F={attributes:b,uniforms:g,samplers:y,needAlphaBlending:u&&u.enable&&-1!==u.enable.indexOf(3042)};t.Effect.ShadersStore[l.vertexShader+n+"VertexShader"]=h,t.Effect.ShadersStore[l.fragmentShader+n+"PixelShader"]=d;var L=new t.ShaderMaterial(n,e.scene,R,F);if(L.onError=function(e,t,n){return function(r,o){t.dispose(!0),n("Cannot compile program named "+e.name+". Error: "+o+". Default material will be applied")}}(l,L,o),L.onCompiled=function(e,t,n,r,o,a){return function(i){!function(e,t,n,r,o){var a=r.values||n.parameters,i=n.uniforms,s=function(n){var s=o[n],l=s.type,u=a[i[n]];if(void 0===u&&(u=s.value),!u)return"continue";var c=function(e){return function(n){s.value&&e&&(t.setTexture(e,n),delete o[e])}};l===D.SAMPLER_2D?ge.LoadTextureAsync(e,r.values?u:s.value,c(n),function(){return c(null)}):s.value&&Y.SetUniform(t,n,r.values?u:s.value,l)&&delete o[n]};for(var l in o)s(l)}(e,t,n,r,o),t.onBind=function(i){!function(e,t,n,r,o,a,i){var s=a.values||o.parameters;for(var l in n){var u=n[l],c=u.type;if(c===D.FLOAT_MAT2||c===D.FLOAT_MAT3||c===D.FLOAT_MAT4)if(!u.semantic||u.source||u.node){if(u.semantic&&(u.source||u.node)){var f=t.scene.getNodeByName(u.source||u.node||"");if(null===f&&(f=t.scene.getNodeById(u.source||u.node||"")),null===f)continue;Y.SetMatrix(t.scene,f,u,l,r.getEffect())}}else Y.SetMatrix(t.scene,e,u,l,r.getEffect());else{var h=s[o.uniforms[l]];if(!h)continue;if(c===D.SAMPLER_2D){var d=t.textures[a.values?h:u.value].babylonTexture;if(null==d)continue;r.getEffect().setTexture(l,d)}else Y.SetUniform(r.getEffect(),l,h,c)}}i(r)}(i,e,o,t,n,r,a)}}}(e,L,i,a,_,r),L.sideOrientation=t.Material.CounterClockWiseSideOrientation,u&&u.functions){var P=u.functions;P.cullFace&&P.cullFace[0]!==U.BACK&&(L.backFaceCulling=!1);var S=P.blendFuncSeparate;S&&(S[0]===W.SRC_ALPHA&&S[1]===W.ONE_MINUS_SRC_ALPHA&&S[2]===W.ONE&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_COMBINE:S[0]===W.ONE&&S[1]===W.ONE&&S[2]===W.ZERO&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_ONEONE:S[0]===W.SRC_ALPHA&&S[1]===W.ONE&&S[2]===W.ZERO&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_ADD:S[0]===W.ZERO&&S[1]===W.ONE_MINUS_SRC_COLOR&&S[2]===W.ONE&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_SUBTRACT:S[0]===W.DST_COLOR&&S[1]===W.ZERO&&S[2]===W.ONE&&S[3]===W.ONE?L.alphaMode=t.Constants.ALPHA_MULTIPLY:S[0]===W.SRC_ALPHA&&S[1]===W.ONE_MINUS_SRC_COLOR&&S[2]===W.ONE&&S[3]===W.ONE&&(L.alphaMode=t.Constants.ALPHA_MAXIMIZED))}}else o&&o("No technique found.")},e}(),_e=function(){function e(){}return e.RegisterExtension=function(n){e.Extensions[n.name]?t.Tools.Error('Tool with the same name "'+n.name+'" already exists'):e.Extensions[n.name]=n},e.prototype.dispose=function(){},e.prototype._importMeshAsync=function(e,n,r,o,a,i,s,l){var u=this;return n.useRightHandedSystem=!0,ge.LoadRuntimeAsync(n,r,o,function(n){n.assetContainer=a,n.importOnlyMeshes=!0,""===e?n.importMeshesNames=[]:"string"==typeof e?n.importMeshesNames=[e]:!e||e instanceof Array?(n.importMeshesNames=[],t.Tools.Warn("Argument meshesNames must be of type string or string[]")):n.importMeshesNames=[e],u._createNodes(n);var r=[],o=[];for(var s in n.nodes){var l=n.nodes[s];l.babylonNode instanceof t.AbstractMesh&&r.push(l.babylonNode)}for(var c in n.skins){var f=n.skins[c];f.babylonSkeleton instanceof t.Skeleton&&o.push(f.babylonSkeleton)}u._loadBuffersAsync(n,function(){u._loadShadersAsync(n,function(){pe(n),he(n),!k.IncrementalLoading&&i&&i(r,o)})}),k.IncrementalLoading&&i&&i(r,o)},l),!0},e.prototype.importMeshAsync=function(e,t,n,r,o,a){var i=this;return new Promise(function(s,l){i._importMeshAsync(e,t,r,o,n,function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[],spriteManagers:[]})},a,function(e){l(new Error(e))})})},e.prototype._loadAsync=function(e,t,n,r,o,a){var i=this;e.useRightHandedSystem=!0,ge.LoadRuntimeAsync(e,t,n,function(e){ge.LoadRuntimeExtensionsAsync(e,function(){i._createNodes(e),i._loadBuffersAsync(e,function(){i._loadShadersAsync(e,function(){pe(e),he(e),k.IncrementalLoading||r()})}),k.IncrementalLoading&&r()},a)},a)},e.prototype.loadAsync=function(e,t,n,r){return g(this,void 0,void 0,function(){var o=this;return b(this,function(a){switch(a.label){case 0:return[4,new Promise(function(a,i){o._loadAsync(e,t,n,function(){a()},r,function(e){i(new Error(e))})})];case 1:return[2,a.sent()]}})})},e.prototype._loadShadersAsync=function(e,n){var r=!1,o=function(r,o){ge.LoadShaderStringAsync(e,r,function(a){a instanceof ArrayBuffer||(e.loadedShaderCount++,a&&(t.Effect.ShadersStore[r+(o.type===V.VERTEX?"VertexShader":"PixelShader")]=a),e.loadedShaderCount===e.shaderscount&&n())},function(){t.Tools.Error("Error when loading shader program named "+r+" located at "+o.uri)})};for(var a in e.shaders){r=!0;var i=e.shaders[a];i?o.bind(this,a,i)():t.Tools.Error("No shader named: "+a)}r||n()},e.prototype._loadBuffersAsync=function(e,n){var r=!1,o=function(r,o){ge.LoadBufferAsync(e,r,function(a){e.loadedBufferCount++,a&&(a.byteLength!=e.buffers[r].byteLength&&t.Tools.Error("Buffer named "+r+" is length "+a.byteLength+". Expected: "+o.byteLength),e.loadedBufferViews[r]=a),e.loadedBufferCount===e.buffersCount&&n()},function(){t.Tools.Error("Error when loading buffer named "+r+" located at "+o.uri)})};for(var a in e.buffers){r=!0;var i=e.buffers[a];i?o.bind(this,a,i)():t.Tools.Error("No buffer named: "+a)}r||n()},e.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var n=0;n<t.nodes.length;n++)fe(e,t.nodes[n],null);else for(var r in e.scenes)for(t=e.scenes[r],n=0;n<t.nodes.length;n++)fe(e,t.nodes[n],null)},e.Extensions={},e}(),ge=function(){function e(e){this._name=e}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),e.prototype.loadRuntimeAsync=function(e,t,n,r,o){return!1},e.prototype.loadRuntimeExtensionsAsync=function(e,t,n){return!1},e.prototype.loadBufferAsync=function(e,t,n,r,o){return!1},e.prototype.loadTextureBufferAsync=function(e,t,n,r){return!1},e.prototype.createTextureAsync=function(e,t,n,r,o){return!1},e.prototype.loadShaderStringAsync=function(e,t,n,r){return!1},e.prototype.loadMaterialAsync=function(e,t,n,r){return!1},e.LoadRuntimeAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.loadRuntimeAsync(t,n,r,o,a)},function(){setTimeout(function(){o&&o(me.CreateRuntime(n.json,t,r))})})},e.LoadRuntimeExtensionsAsync=function(t,n,r){e._ApplyExtensions(function(e){return e.loadRuntimeExtensionsAsync(t,n,r)},function(){setTimeout(function(){n()})})},e.LoadBufferAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.loadBufferAsync(t,n,r,o,a)},function(){me.LoadBufferAsync(t,n,r,o,a)})},e.LoadTextureAsync=function(t,n,r,o){e._LoadTextureBufferAsync(t,n,function(a){a&&e._CreateTextureAsync(t,n,a,r,o)},o)},e.LoadShaderStringAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadShaderStringAsync(t,n,r,o)},function(){me.LoadShaderStringAsync(t,n,r,o)})},e.LoadMaterialAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadMaterialAsync(t,n,r,o)},function(){me.LoadMaterialAsync(t,n,r,o)})},e._LoadTextureBufferAsync=function(t,n,r,o){e._ApplyExtensions(function(e){return e.loadTextureBufferAsync(t,n,r,o)},function(){me.LoadTextureBufferAsync(t,n,r,o)})},e._CreateTextureAsync=function(t,n,r,o,a){e._ApplyExtensions(function(e){return e.createTextureAsync(t,n,r,o,a)},function(){me.CreateTextureAsync(t,n,r,o)})},e._ApplyExtensions=function(e,t){for(var n in _e.Extensions)if(e(_e.Extensions[n]))return;t()},e}();k._CreateGLTF1Loader=function(){return new _e};var be=function(e){function t(){return e.call(this,"KHR_binary_glTF")||this}return m(t,e),t.prototype.loadRuntimeAsync=function(e,t,n,r){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,r(me.CreateRuntime(t.json,e,n)),0))},t.prototype.loadBufferAsync=function(e,t,n,r){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(n,function(e){return r(e.message)}),!0)},t.prototype.loadTextureBufferAsync=function(e,t,n){var r=e.textures[t],o=e.images[r.source];if(!o.extensions||!(this.name in o.extensions))return!1;var a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return n(Y.GetBufferFromBufferView(e,i,0,i.byteLength,G.UNSIGNED_BYTE)),!0},t.prototype.loadShaderStringAsync=function(e,t,n){var r=e.shaders[t];if(!r.extensions||!(this.name in r.extensions))return!1;var o=r.extensions[this.name],a=e.bufferViews[o.bufferView],i=Y.GetBufferFromBufferView(e,a,0,a.byteLength,G.UNSIGNED_BYTE);return setTimeout(function(){var e=Y.DecodeBufferToText(i);n(e)}),!0},t}(ge);_e.RegisterExtension(new be);var ye=function(e){function n(){return e.call(this,"KHR_materials_common")||this}return m(n,e),n.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var n=e.extensions[this.name];if(!n)return!1;var r=n.lights;if(r)for(var o in r){var a=r[o];switch(a.type){case"ambient":var i=new t.HemisphericLight(a.name,new t.Vector3(0,1,0),e.scene),s=a.ambient;s&&(i.diffuse=t.Color3.FromArray(s.color||[1,1,1]));break;case"point":var l=new t.PointLight(a.name,new t.Vector3(10,10,10),e.scene),u=a.point;u&&(l.diffuse=t.Color3.FromArray(u.color||[1,1,1]));break;case"directional":var c=new t.DirectionalLight(a.name,new t.Vector3(0,-1,0),e.scene),f=a.directional;f&&(c.diffuse=t.Color3.FromArray(f.color||[1,1,1]));break;case"spot":var h=a.spot;h&&(new t.SpotLight(a.name,new t.Vector3(0,10,0),new t.Vector3(0,-1,0),h.fallOffAngle||Math.PI,h.fallOffExponent||0,e.scene).diffuse=t.Color3.FromArray(h.color||[1,1,1]));break;default:t.Tools.Warn('GLTF Material Common extension: light type "'+a.type+"” not supported")}}return!1},n.prototype.loadMaterialAsync=function(e,n,r,o){var a=e.materials[n];if(!a||!a.extensions)return!1;var i=a.extensions[this.name];if(!i)return!1;var s=new t.StandardMaterial(n,e.scene);return s.sideOrientation=t.Material.CounterClockWiseSideOrientation,"CONSTANT"===i.technique&&(s.disableLighting=!0),s.backFaceCulling=void 0!==i.doubleSided&&!i.doubleSided,s.alpha=void 0===i.values.transparency?1:i.values.transparency,s.specularPower=void 0===i.values.shininess?0:i.values.shininess,"string"==typeof i.values.ambient?this._loadTexture(e,i.values.ambient,s,"ambientTexture",o):s.ambientColor=t.Color3.FromArray(i.values.ambient||[0,0,0]),"string"==typeof i.values.diffuse?this._loadTexture(e,i.values.diffuse,s,"diffuseTexture",o):s.diffuseColor=t.Color3.FromArray(i.values.diffuse||[0,0,0]),"string"==typeof i.values.emission?this._loadTexture(e,i.values.emission,s,"emissiveTexture",o):s.emissiveColor=t.Color3.FromArray(i.values.emission||[0,0,0]),"string"==typeof i.values.specular?this._loadTexture(e,i.values.specular,s,"specularTexture",o):s.specularColor=t.Color3.FromArray(i.values.specular||[0,0,0]),!0},n.prototype._loadTexture=function(e,t,n,r,o){me.LoadTextureBufferAsync(e,t,function(o){me.CreateTextureAsync(e,t,o,function(e){return n[r]=e})},o)},n}(ge);_e.RegisterExtension(new ye);var ve={__proto__:null,get EBlendingFunction(){return W},get EComponentType(){return G},get ECullingType(){return U},get EParameterType(){return D},get EShaderType(){return V},get ETextureFilterType(){return K},get ETextureFormat(){return j},get ETextureWrapMode(){return H},GLTFBinaryExtension:be,GLTFLoader:_e,GLTFLoaderBase:me,GLTFLoaderExtension:ge,GLTFMaterialsCommonExtension:ye,GLTFUtils:Y},Te=new Map,xe=Te;function Ae(e,n,r){we(e)&&t.Logger.Warn("Extension with the name '".concat(e,"' already exists")),Te.set(e,{isGLTFExtension:n,factory:r})}function we(e){return Te.delete(e)}var Ce=[{regex:new RegExp("^/nodes/\\d+/extensions/")}],Oe=function(){function e(e,t){this._gltf=e,this._infoTree=t}return e.prototype.convert=function(e){var t=this._gltf,n=this._infoTree,r=void 0;if(!e.startsWith("/"))throw new Error("Path must start with a /");var o=e.split("/");if(o.shift(),o[o.length-1].includes(".length")){var a=o[o.length-1].split(".");o.pop(),o.push.apply(o,a)}for(var i=!1,s=0,l=o;s<l.length;s++){var u=l[s],c="length"===u;if(c&&!n.__array__)throw new Error("Path ".concat(e," is invalid"));if(n.__ignoreObjectTree__&&(i=!0),n.__array__&&!c)n=n.__array__;else if(!(n=n[u]))throw new Error("Path ".concat(e," is invalid"));if(!i)if(void 0===t){if(!Ce.find(function(t){return t.regex.test(e)}))throw new Error("Path ".concat(e," is invalid"))}else c||(t=null==t?void 0:t[u]);(n.__target__||c)&&(r=t)}return{object:r,info:n}},e}(),Me={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 n,r,o;return t.Matrix.Compose(null===(n=e._babylonTransformNode)||void 0===n?void 0:n.scaling,null===(r=e._babylonTransformNode)||void 0===r?void 0:r.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 n,r,o,a,i,s,l,u=t.Matrix.Identity(),c=e.parent;c&&c.parent;)c=c.parent;var f=(null===(n=e._babylonTransformNode)||void 0===n?void 0:n.position._isDirty)||(null===(o=null===(r=e._babylonTransformNode)||void 0===r?void 0:r.rotationQuaternion)||void 0===o?void 0:o._isDirty)||(null===(a=e._babylonTransformNode)||void 0===a?void 0:a.scaling._isDirty);if(c){var h=null===(i=c._babylonTransformNode)||void 0===i?void 0:i.computeWorldMatrix(!0).invert();h&&(null===(l=null===(s=e._babylonTransformNode)||void 0===s?void 0:s.computeWorldMatrix(f))||void 0===l||l.multiplyToRef(h,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 n,r;return null===(r=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0])||void 0===r?void 0:r.intensity},getTarget:function(e){var n;return null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0]},set:function(e,n){if(n._babylonTransformNode){var r=n._babylonTransformNode.getChildren(function(e){return e instanceof t.SpotLight},!0)[0];r&&(r.intensity=e)}}},color:{type:"Color3",get:function(e){var n,r;return null===(r=null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0])||void 0===r?void 0:r.diffuse},getTarget:function(e){var n;return null===(n=e._babylonTransformNode)||void 0===n?void 0:n.getChildren(function(e){return e instanceof t.SpotLight},!0)[0]},set:function(e,n){if(n._babylonTransformNode){var r=n._babylonTransformNode.getChildren(function(e){return e instanceof t.SpotLight},!0)[0];r&&(r.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})}}}}}},Ee={__array__:{__target__:!0,orthographic:{xmag:{componentsCount:2,type:"Vector2",get:function(e){var n,r,o,a;return new t.Vector2(null!==(r=null===(n=e._babylonCamera)||void 0===n?void 0:n.orthoLeft)&&void 0!==r?r: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 n,r,o,a;return new t.Vector2(null!==(r=null===(n=e._babylonCamera)||void 0===n?void 0:n.orthoBottom)&&void 0!==r?r: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"}]}}}},Re={__array__:{__target__:!0,emissiveFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).emissiveColor},set:function(e,t,n,r){return Pe(t,0,r).emissiveColor.copyFrom(e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"emissiveColor"}]},emissiveTexture:{extensions:{KHR_texture_transform:Se("emissiveTexture")}},normalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=Le(e,n,"bumpTexture"))||void 0===r?void 0:r.level},set:function(e,t,n,r){var o=Le(t,r,"bumpTexture");o&&(o.level=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"level"}]},extensions:{KHR_texture_transform:Se("bumpTexture")}},occlusionTexture:{strength:{type:"number",get:function(e,t,n){return Pe(e,0,n).ambientTextureStrength},set:function(e,t,n,r){var o=Pe(t,0,r);o&&(o.ambientTextureStrength=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"ambientTextureStrength"}]},extensions:{KHR_texture_transform:Se("ambientTexture")}},pbrMetallicRoughness:{baseColorFactor:{type:"Color4",get:function(e,n,r){var o=Pe(e,0,r);return t.Color4.FromColor3(o.albedoColor,o.alpha)},set:function(e,t,n,r){var o=Pe(t,0,r);o.albedoColor.set(e.r,e.g,e.b),o.alpha=e.a},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"albedoColor"},function(){return"alpha"}]},baseColorTexture:{extensions:{KHR_texture_transform:Se("albedoTexture")}},metallicFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).metallic},set:function(e,t,n,r){var o=Pe(t,0,r);o&&(o.metallic=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"metallic"}]},roughnessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).roughness},set:function(e,t,n,r){var o=Pe(t,0,r);o&&(o.roughness=e)},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"roughness"}]},metallicRoughnessTexture:{extensions:{KHR_texture_transform:Se("metallicTexture")}}},extensions:{KHR_materials_anisotropy:{anisotropyStrength:{type:"number",get:function(e,t,n){return Pe(e,0,n).anisotropy.intensity},set:function(e,t,n,r){Pe(t,0,r).anisotropy.intensity=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"anisotropy.intensity"}]},anisotropyRotation:{type:"number",get:function(e,t,n){return Pe(e,0,n).anisotropy.angle},set:function(e,t,n,r){Pe(t,0,r).anisotropy.angle=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"anisotropy.angle"}]},anisotropyTexture:{extensions:{KHR_texture_transform:Se("anisotropy","texture")}}},KHR_materials_clearcoat:{clearcoatFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).clearCoat.intensity},set:function(e,t,n,r){Pe(t,0,r).clearCoat.intensity=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"clearCoat.intensity"}]},clearcoatRoughnessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).clearCoat.roughness},set:function(e,t,n,r){Pe(t,0,r).clearCoat.roughness=e},getTarget:function(e,t,n){return Pe(e,0,n)},getPropertyName:[function(){return"clearCoat.roughness"}]},clearcoatTexture:{extensions:{KHR_texture_transform:Se("clearCoat","texture")}},clearcoatNormalTexture:{scale:{type:"number",get:function(e,t,n){var r;return null===(r=Pe(e,0,n).clearCoat.bumpTexture)||void 0===r?void 0:r.level},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).clearCoat.bumpTexture.level=e}},extensions:{KHR_texture_transform:Se("clearCoat","bumpTexture")}},clearcoatRoughnessTexture:{extensions:{KHR_texture_transform:Se("clearCoat","textureRoughness")}}},KHR_materials_dispersion:{dispersion:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.dispersion},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.dispersion=e}}},KHR_materials_emissive_strength:{emissiveStrength:{type:"number",get:function(e,t,n){return Pe(e,0,n).emissiveIntensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).emissiveIntensity=e}}},KHR_materials_ior:{ior:{type:"number",get:function(e,t,n){return Pe(e,0,n).indexOfRefraction},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).indexOfRefraction=e}}},KHR_materials_iridescence:{iridescenceFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.intensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.intensity=e}},iridescenceIor:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.indexOfRefraction},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.indexOfRefraction=e}},iridescenceTexture:{extensions:{KHR_texture_transform:Se("iridescence","texture")}},iridescenceThicknessMaximum:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.maximumThickness},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.maximumThickness=e}},iridescenceThicknessMinimum:{type:"number",get:function(e,t,n){return Pe(e,0,n).iridescence.minimumThickness},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).iridescence.minimumThickness=e}},iridescenceThicknessTexture:{extensions:{KHR_texture_transform:Se("iridescence","thicknessTexture")}}},KHR_materials_sheen:{sheenColorFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).sheen.color},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).sheen.color.copyFrom(e)}},sheenColorTexture:{extensions:{KHR_texture_transform:Se("sheen","texture")}},sheenRoughnessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).sheen.intensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).sheen.intensity=e}},sheenRoughnessTexture:{extensions:{KHR_texture_transform:Se("sheen","thicknessTexture")}}},KHR_materials_specular:{specularFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).metallicF0Factor},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).metallicF0Factor=e},getPropertyName:[function(){return"metallicF0Factor"}]},specularColorFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).metallicReflectanceColor},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).metallicReflectanceColor.copyFrom(e)},getPropertyName:[function(){return"metallicReflectanceColor"}]},specularTexture:{extensions:{KHR_texture_transform:Se("metallicReflectanceTexture")}},specularColorTexture:{extensions:{KHR_texture_transform:Se("reflectanceTexture")}}},KHR_materials_transmission:{transmissionFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.refractionIntensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.refractionIntensity=e},getPropertyName:[function(){return"subSurface.refractionIntensity"}]},transmissionTexture:{extensions:{KHR_texture_transform:Se("subSurface","refractionIntensityTexture")}}},KHR_materials_diffuse_transmission:{diffuseTransmissionFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.translucencyIntensity},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.translucencyIntensity=e}},diffuseTransmissionTexture:{extensions:{KHR_texture_transform:Se("subSurface","translucencyIntensityTexture")}},diffuseTransmissionColorFactor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).subSurface.translucencyColor},getTarget:Pe,set:function(e,t,n,r){var o;return e&&(null===(o=Pe(t,0,r).subSurface.translucencyColor)||void 0===o?void 0:o.copyFrom(e))}},diffuseTransmissionColorTexture:{extensions:{KHR_texture_transform:Se("subSurface","translucencyColorTexture")}}},KHR_materials_volume:{attenuationColor:{type:"Color3",get:function(e,t,n){return Pe(e,0,n).subSurface.tintColor},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.tintColor.copyFrom(e)}},attenuationDistance:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.tintColorAtDistance},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.tintColorAtDistance=e}},thicknessFactor:{type:"number",get:function(e,t,n){return Pe(e,0,n).subSurface.maximumThickness},getTarget:Pe,set:function(e,t,n,r){return Pe(t,0,r).subSurface.maximumThickness=e}},thicknessTexture:{extensions:{KHR_texture_transform:Se("subSurface","thicknessTexture")}}}}}},Fe={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 n;return e._babylonTexture&&t.Quaternion.FromRotationMatrix(null===(n=e._babylonTexture)||void 0===n?void 0:n.getReflectionTextureMatrix())},set:function(e,n){var r;n._babylonTexture&&((null===(r=n._babylonTexture.getScene())||void 0===r?void 0:r.useRightHandedSystem)||(e=t.Quaternion.Inverse(e)),t.Matrix.FromQuaternionToRef(e,n._babylonTexture.getReflectionTextureMatrix()))},getTarget:function(e){return e._babylonTexture}}}}}};function Le(e,t,n,r){var o=Pe(e);return r?o[n][r]:o[n]}function Pe(e,n,r){var o,a,i;return null===(i=null===(o=e._data)||void 0===o?void 0:o[null!==(a=null==r?void 0:r.fillMode)&&void 0!==a?a:t.Constants.MATERIAL_TriangleFillMode])||void 0===i?void 0:i.babylonMaterial}function Se(e,n){return{offset:{componentsCount:2,type:"Vector2",get:function(r,o,a){var i=Le(r,0,e,n);return new t.Vector2(null==i?void 0:i.uOffset,null==i?void 0:i.vOffset)},getTarget:Pe,set:function(t,r,o,a){var i=Le(r,0,e,n);i.uOffset=t.x,i.vOffset=t.y},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".uOffset")},function(){return"".concat(e).concat(n?"."+n:"",".vOffset")}]},rotation:{type:"number",get:function(t,r,o){var a;return null===(a=Le(t,0,e,n))||void 0===a?void 0:a.wAng},getTarget:Pe,set:function(t,r,o,a){return Le(r,0,e,n).wAng=t},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".wAng")}]},scale:{componentsCount:2,type:"Vector2",get:function(r,o,a){var i=Le(r,0,e,n);return new t.Vector2(null==i?void 0:i.uScale,null==i?void 0:i.vScale)},getTarget:Pe,set:function(t,r,o,a){var i=Le(r,0,e,n);i.uScale=t.x,i.vScale=t.y},getPropertyName:[function(){return"".concat(e).concat(n?"."+n:"",".uScale")},function(){return"".concat(e).concat(n?"."+n:"",".vScale")}]}}}var Ne={cameras:Ee,nodes:Me,materials:Re,extensions:Fe,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 Ie(e){return new Oe(e,Ne)}function Be(e){for(var t=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),n=Ne,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 ke(e,t){for(var n=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),r=Ne,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 Ge(e,t){for(var n=e.split("/").map(function(e){return e.replace(/{}/g,"__array__")}),r=Ne,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)}var Ve=new t.Lazy(function(){return Promise.resolve(BABYLON)}),De=new t.Lazy(function(){return Promise.resolve().then(function(){return Qe})}),He=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 Ke(e){if(e.min&&e.max){var n=e.min,r=e.max,o=t.TmpVectors.Vector3[0].copyFromFloats(n[0],n[1],n[2]),a=t.TmpVectors.Vector3[1].copyFromFloats(r[0],r[1],r[2]);if(e.normalized&&5126!==e.componentType){var i=1;switch(e.componentType){case 5120:i=127;break;case 5121:i=255;break;case 5122:i=32767;break;case 5123:i=65535}var s=1/i;o.scaleInPlace(s),a.scaleInPlace(s)}return new t.BoundingInfo(o,a)}return null}var je=function(){function n(e){this._completePromises=new Array,this._finalizeController=null,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._materialAdapters=new Set,this._pbrMaterialImpl=null,this._parent=e}return n.prototype.isMatchingMaterialType=function(e){return!(!e||!this._pbrMaterialImpl)&&e instanceof this._pbrMaterialImpl.materialClass},n.RegisterExtension=function(e,t){Ae(e,!1,t)},n.UnregisterExtension=function(e){return we(e)},Object.defineProperty(n.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"rootUrl",{get:function(){return this._rootUrl},enumerable:!1,configurable:!0}),n.prototype._getOrCreateMaterialAdapter=function(e){var t=this._materialAdapterCache.get(e);if(!t){if(!this._pbrMaterialImpl)throw new Error("Appropriate material adapter class not found");var n=t=new this._pbrMaterialImpl.adapterClass(e);this._materialAdapterCache.set(e,n),this._materialAdapters.add(n)}return t},n.prototype.dispose=function(){var e;this._disposed||(this._disposed=!0,null===(e=this._finalizeController)||void 0===e||e.abort(),this._finalizeController=null,this._completePromises.length=0,this._extensions.forEach(function(e){return e.dispose&&e.dispose()}),this._extensions.length=0,this._materialAdapters.clear(),this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())},n.prototype.importMeshAsync=function(e,t,n,r,o,a){return g(this,arguments,void 0,function(e,t,n,r,o,a,i){var s=this;return void 0===i&&(i=""),b(this,function(a){switch(a.label){case 0:return[4,Promise.resolve().then(function(){return g(s,void 0,void 0,function(){var a,s,l,u,c,f=this;return b(this,function(h){switch(h.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,h.sent()]}})})})];case 1:return[2,a.sent()]}})})},n.prototype.loadAsync=function(e,t,n,r){return g(this,arguments,void 0,function(e,t,n,r,o){return void 0===o&&(o=""),b(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()]}})})},n.prototype._loadAsync=function(n,r,o,a){return g(this,void 0,void 0,function(){var i=this;return b(this,function(s){switch(s.label){case 0:return[4,Promise.resolve().then(function(){return g(i,void 0,void 0,function(){var i,s,l,u,c,f,h,d,p,m,_,g,y,v,T=this;return b(this,function(b){switch(b.label){case 0:return this._rootUrl=n,this._uniqueRootUrl=!n.startsWith("file:")&&r?n:"".concat(n).concat(Date.now(),"/"),this._fileName=r,this._allMaterialsDirtyRequired=!1,[4,this._loadExtensionsAsync()];case 1:return b.sent(),this.parent.skipMaterials||null!=this._pbrMaterialImpl?[3,7]:this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr")?(i=this,y={},[4,Promise.resolve(BABYLON)]):[3,4];case 2:return y.materialClass=b.sent().OpenPBRMaterial,[4,Promise.resolve().then(function(){return $e})];case 3:return i._pbrMaterialImpl=(y.adapterClass=b.sent().OpenPBRMaterialLoadingAdapter,y),[3,7];case 4:return s=this,v={},[4,Promise.resolve(BABYLON)];case 5:return v.materialClass=b.sent().PBRMaterial,[4,Promise.resolve().then(function(){return tt})];case 6:s._pbrMaterialImpl=(v.adapterClass=b.sent().PBRMaterialLoadingAdapter,v),b.label=7;case 7:if(l="".concat(e.GLTFLoaderState[e.GLTFLoaderState.LOADING]," => ").concat(e.GLTFLoaderState[e.GLTFLoaderState.READY]),u="".concat(e.GLTFLoaderState[e.GLTFLoaderState.LOADING]," => ").concat(e.GLTFLoaderState[e.GLTFLoaderState.COMPLETE]),this._parent._startPerformanceCounter(l),this._parent._startPerformanceCounter(u),this._parent._setState(e.GLTFLoaderState.LOADING),this._extensionsOnLoading(),c=new Array,f=this._babylonScene.blockMaterialDirtyMechanism,this._babylonScene.blockMaterialDirtyMechanism=!0,this.parent.loadOnlyMaterials||(o?c.push(this.loadSceneAsync("/nodes",{nodes:o,index:-1})):(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0])&&(h=He.Get("/scene",this._gltf.scenes,this._gltf.scene||0),c.push(this.loadSceneAsync("/scenes/".concat(h.index),h)))),!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(d=0;d<this._gltf.materials.length;++d)p=this._gltf.materials[d],m="/materials/"+d,_=t.Material.TriangleFillMode,c.push(this._loadMaterialAsync(m,p,null,_,function(){}));return this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=f:this._babylonScene._forceBlockMaterialDirtyMechanism(f),this._parent.compileMaterials&&c.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&c.push(this._compileShadowGeneratorsAsync()),g=Promise.all(c).then(function(){T._rootBabylonMesh&&T._rootBabylonMesh!==T._parent.customRootNode&&T._rootBabylonMesh.setEnabled(!0);for(var n=0,r=T._babylonScene.materials;n<r.length;n++){var o=r[n];void 0!==o.maxSimultaneousLights&&(o.maxSimultaneousLights=Math.max(o.maxSimultaneousLights,T._babylonScene.lights.length))}T._finalizeController=new AbortController;for(var i=T._finalizeController.signal,s=0,l=Array.from(T._materialAdapters);s<l.length;s++){var u=l[s];if(u.finalizeAsync){var c=u.finalizeAsync(i);c&&T._completePromises.push(c)}else u.finalize&&(t.Logger.Warn("GLTFLoader: IMaterialLoadingAdapter.finalize() is deprecated. Implement finalizeAsync() instead."),u.finalize())}return T._extensionsOnReady(),T._parent._setState(e.GLTFLoaderState.READY),T._skipStartAnimationStep||T._startAnimations(),a()}),[4,g.then(function(n){return T._parent._endPerformanceCounter(l),t.Tools.SetImmediate(function(){T._disposed||Promise.all(T._completePromises).then(function(){T._parent._endPerformanceCounter(u),T._parent._setState(e.GLTFLoaderState.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()})}),n})];case 8:return[2,b.sent()]}})})}).catch(function(e){throw i._disposed||(i._parent.onErrorObservable.notifyObservers(e),i._parent.onErrorObservable.clear(),i.dispose()),e})];case 1:return[2,s.sent()]}})})},n.prototype._loadData=function(e){if(this._gltf=e.json,this._setupData(),e.bin){var n=this._gltf.buffers;if(n&&n[0]&&!n[0].uri){var r=n[0];(r.byteLength<e.bin.byteLength-3||r.byteLength>e.bin.byteLength)&&t.Logger.Warn("Binary buffer length (".concat(r.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin}else t.Logger.Warn("Unexpected BIN chunk")}},n.prototype._setupData=function(){if(He.Assign(this._gltf.accessors),He.Assign(this._gltf.animations),He.Assign(this._gltf.buffers),He.Assign(this._gltf.bufferViews),He.Assign(this._gltf.cameras),He.Assign(this._gltf.images),He.Assign(this._gltf.materials),He.Assign(this._gltf.meshes),He.Assign(this._gltf.nodes),He.Assign(this._gltf.samplers),He.Assign(this._gltf.scenes),He.Assign(this._gltf.skins),He.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]}}},n.prototype._loadExtensionsAsync=function(){return g(this,void 0,void 0,function(){var e,n,r,o,a,i,s,l,u,c,f,h=this;return b(this,function(d){switch(d.label){case 0:return e=[],xe.forEach(function(n,r){var o;!1===(null===(o=h.parent.extensionOptions[r])||void 0===o?void 0:o.enabled)?n.isGLTFExtension&&h.isExtensionUsed(r)&&t.Logger.Warn("Extension ".concat(r," is used but has been explicitly disabled.")):n.isGLTFExtension&&!h.isExtensionUsed(r)||e.push(g(h,void 0,void 0,function(){var e;return b(this,function(o){switch(o.label){case 0:return[4,n.factory(this)];case 1:return(e=o.sent()).name!==r&&t.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(e.name," !== ").concat(r)),this._parent.onExtensionLoadedObservable.notifyObservers(e),[2,e]}})}))}),r=(n=(c=this._extensions).push).apply,o=[c],[4,Promise.all(e)];case 1:if(r.apply(n,o.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(a=function(e){if(!i._extensions.some(function(t){return t.name===e&&t.enabled})){if(!1===(null===(f=i.parent.extensionOptions[e])||void 0===f?void 0:f.enabled))throw new Error("Required extension ".concat(e," is disabled"));throw new Error("Required extension ".concat(e," is not available"))}},i=this,s=0,l=this._gltf.extensionsRequired;s<l.length;s++)u=l[s],a(u);return[2]}})})},n.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 r=new t.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=r,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var o={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case e.GLTFLoaderCoordinateSystemMode.AUTO:this._babylonScene.useRightHandedSystem||(o.rotation=[0,1,0,0],o.scale=[1,1,-1],n._LoadTransform(o,this._rootBabylonMesh));break;case e.GLTFLoaderCoordinateSystemMode.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(r),o},n.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=He.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(){})},n.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var n=0,r=e._primitiveBabylonMeshes;n<r.length;n++)t(r[n])},n.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},n.prototype._getMeshes=function(){var e=[];this._rootBabylonMesh instanceof t.AbstractMesh&&e.push(this._rootBabylonMesh);var n=this._gltf.nodes;if(n)for(var r=0,o=n;r<o.length;r++){var a=o[r];this._forEachPrimitive(a,function(t){e.push(t)})}return e},n.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},n.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},n.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},n.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case e.GLTFLoaderAnimationStartMode.NONE:break;case e.GLTFLoaderAnimationStartMode.FIRST:0!==(n=this._getAnimationGroups()).length&&n[0].start(!0);break;case e.GLTFLoaderAnimationStartMode.ALL:for(var n,r=0,o=n=this._getAnimationGroups();r<o.length;r++)o[r].start(!0);break;default:return void t.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},n.prototype.loadNodeAsync=function(e,r,o){var a=this;void 0===o&&(o=function(){});var i=this._extensionsLoadNodeAsync(e,r,o);if(i)return i;if(r._babylonTransformNode)throw new Error("".concat(e,": Invalid recursive node hierarchy"));var s=new Array;this.logOpen("".concat(e," ").concat(r.name||""));var l=function(t){if(n.AddPointerMetadata(t,e),n._LoadTransform(r,t),null!=r.camera){var i=He.Get("".concat(e,"/camera"),a._gltf.cameras,r.camera);s.push(a.loadCameraAsync("/cameras/".concat(i.index),i,function(e){e.parent=t,a._babylonScene.useRightHandedSystem||(t.scaling.x=-1)}))}if(r.children)for(var l=0,u=r.children;l<u.length;l++){var c=u[l],f=He.Get("".concat(e,"/children/").concat(c),a._gltf.nodes,c);s.push(a.loadNodeAsync("/nodes/".concat(f.index),f,function(e){e.parent=t}))}o(t)},u=null!=r.mesh,c=this._parent.loadSkins&&null!=r.skin;if(!u||c){var f=r.name||"node".concat(r.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var h=new t.TransformNode(f,this._babylonScene);h._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==r.mesh?r._babylonTransformNode=h:r._babylonTransformNodeForSkin=h,l(h)}if(u)if(c){var d=He.Get("".concat(e,"/mesh"),this._gltf.meshes,r.mesh);s.push(this._loadMeshAsync("/meshes/".concat(d.index),r,d,function(n){var o=r._babylonTransformNodeForSkin;n.metadata=t.deepMerge(o.metadata,n.metadata||{});var i=He.Get("".concat(e,"/skin"),a._gltf.skins,r.skin);s.push(a._loadSkinAsync("/skins/".concat(i.index),r,i,function(e){a._forEachPrimitive(r,function(t){t.skeleton=e}),a._postSceneLoadActions.push(function(){if(null!=i.skeleton){var e=He.Get("/skins/".concat(i.index,"/skeleton"),a._gltf.nodes,i.skeleton).parent;r.index===e.index?n.parent=o.parent:n.parent=e._babylonTransformNode}else n.parent=a._rootBabylonMesh;a._parent.onSkinLoadedObservable.notifyObservers({node:o,skinnedNode:n})})}))}))}else d=He.Get("".concat(e,"/mesh"),this._gltf.meshes,r.mesh),s.push(this._loadMeshAsync("/meshes/".concat(d.index),r,d,l));return this.logClose(),Promise.all(s).then(function(){return a._forEachPrimitive(r,function(e){var t=e;!t.isAnInstance&&t.geometry&&t.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)}),r._babylonTransformNode})},n.prototype._loadMeshAsync=function(e,n,r,o){var a=r.primitives;if(!a||!a.length)throw new Error("".concat(e,": Primitives are missing"));null==a[0].index&&He.Assign(a);var i=new Array;this.logOpen("".concat(e," ").concat(r.name||""));var s=n.name||"node".concat(n.index);if(1===a.length){var l=r.primitives[0];i.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(l.index),s,n,r,l,function(e){n._babylonTransformNode=e,n._primitiveBabylonMeshes=[e]}))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,n._babylonTransformNode=new t.TransformNode(s,this._babylonScene),n._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n._primitiveBabylonMeshes=[];for(var u=0,c=a;u<c.length;u++)l=c[u],i.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(l.index),"".concat(s,"_primitive").concat(l.index),n,r,l,function(e){e.parent=n._babylonTransformNode,n._primitiveBabylonMeshes.push(e)}))}return o(n._babylonTransformNode),this.logClose(),Promise.all(i).then(function(){return n._babylonTransformNode})},n.prototype._loadMeshPrimitiveAsync=function(e,r,o,a,i,s){var l=this,u=this._extensionsLoadMeshPrimitiveAsync(e,r,o,a,i,s);if(u)return u;this.logOpen("".concat(e));var c,f,h=0===this._disableInstancedMesh&&this._parent.createInstances&&null==o.skin&&!a.primitives[0].targets;if(h&&i._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(c=i._instanceData.babylonSourceMesh.createInstance(r))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,f=i._instanceData.promise;else{var d=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;var p=new t.Mesh(r,this._babylonScene);if(p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,p.sideOrientation=this._babylonScene.useRightHandedSystem?t.Material.CounterClockWiseSideOrientation:t.Material.ClockWiseSideOrientation,this._createMorphTargets(e,o,a,i,p),d.push(this._loadVertexDataAsync(e,i,p).then(function(t){return g(l,void 0,void 0,function(){var n=this;return b(this,function(r){switch(r.label){case 0:return[4,this._loadMorphTargetsAsync(e,i,p,t).then(function(){n._disposed||(n._babylonScene._blockEntityCollection=!!n._assetContainer,t.applyToMesh(p),t._parentContainer=n._assetContainer,n._babylonScene._blockEntityCollection=!1)})];case 1:return[2,r.sent()]}})})})),!this.parent.skipMaterials){var m=n._GetDrawMode(e,i.mode);if(null==i.material){var _=this._defaultBabylonMaterialData[m];_||(_=this._createDefaultMaterial("__GLTFLoader._default",m),this._parent.onMaterialLoadedObservable.notifyObservers(_),this._defaultBabylonMaterialData[m]=_),p.material=_}else{var y=He.Get("".concat(e,"/material"),this._gltf.materials,i.material);d.push(this._loadMaterialAsync("/materials/".concat(y.index),y,p,m,function(e){p.material=e}))}}f=Promise.all(d),h&&(i._instanceData={babylonSourceMesh:p,promise:f}),c=p}return n.AddPointerMetadata(c,e),this._parent.onMeshLoadedObservable.notifyObservers(c),s(c),this.logClose(),f.then(function(){return c})},n.prototype._loadVertexDataAsync=function(e,n,r){var o=this,a=this._extensionsLoadVertexDataAsync(e,n,r);if(a)return a;var i=n.attributes;if(!i)throw new Error("".concat(e,": Attributes are missing"));var s=new Array,l=new t.Geometry(r.name,this._babylonScene);if(null==n.indices)r.isUnIndexed=!0;else{var u=He.Get("".concat(e,"/indices"),this._gltf.accessors,n.indices);s.push(this._loadIndicesAccessorAsync("/accessors/".concat(u.index),u).then(function(e){l.setIndices(e)}))}var c=function(n,a,u){if(null!=i[n]){r._delayInfo=r._delayInfo||[],-1===r._delayInfo.indexOf(a)&&r._delayInfo.push(a);var c=He.Get("".concat(e,"/attributes/").concat(n),o._gltf.accessors,i[n]);s.push(o._loadVertexAccessorAsync("/accessors/".concat(c.index),c,a).then(function(e){if(e.getKind()===t.VertexBuffer.PositionKind&&!o.parent.alwaysComputeBoundingBox&&!r.skeleton){var n=Ke(c);n&&(l._boundingInfo=n,l.useBoundingInfoFromGeometry=!0)}l.setVerticesBuffer(e,c.count)})),a==t.VertexBuffer.MatricesIndicesExtraKind&&(r.numBoneInfluencers=8),u&&u(c)}};return c("POSITION",t.VertexBuffer.PositionKind),c("NORMAL",t.VertexBuffer.NormalKind),c("TANGENT",t.VertexBuffer.TangentKind),c("TEXCOORD_0",t.VertexBuffer.UVKind),c("TEXCOORD_1",t.VertexBuffer.UV2Kind),c("TEXCOORD_2",t.VertexBuffer.UV3Kind),c("TEXCOORD_3",t.VertexBuffer.UV4Kind),c("TEXCOORD_4",t.VertexBuffer.UV5Kind),c("TEXCOORD_5",t.VertexBuffer.UV6Kind),c("JOINTS_0",t.VertexBuffer.MatricesIndicesKind),c("WEIGHTS_0",t.VertexBuffer.MatricesWeightsKind),c("JOINTS_1",t.VertexBuffer.MatricesIndicesExtraKind),c("WEIGHTS_1",t.VertexBuffer.MatricesWeightsExtraKind),c("COLOR_0",t.VertexBuffer.ColorKind,function(e){"VEC4"===e.type&&(r.hasVertexAlpha=!0)}),Promise.all(s).then(function(){return l})},n.prototype._createMorphTargets=function(e,n,r,o,a){if(o.targets&&this._parent.loadMorphTargets){if(null==n._numMorphTargets)n._numMorphTargets=o.targets.length;else if(o.targets.length!==n._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var i=r.extras?r.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,a.morphTargetManager=new t.MorphTargetManager(this._babylonScene),a.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,a.morphTargetManager.areUpdatesFrozen=!0;for(var s=0;s<o.targets.length;s++){var l=n.weights?n.weights[s]:r.weights?r.weights[s]:0,u=i?i[s]:"morphTarget".concat(s);a.morphTargetManager.addTarget(new t.MorphTarget(u,l,a.getScene()))}}},n.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})},n.prototype._loadMorphTargetVertexDataAsync=function(e,n,r,o){return g(this,void 0,void 0,function(){var a,i,s=this;return b(this,function(l){switch(l.label){case 0:return a=new Array,(i=function(t,o,i){if(null!=r[t]){var l=n.getVertexBuffer(o);if(l){var u=He.Get("".concat(e,"/").concat(t),s._gltf.accessors,r[t]);a.push(s._loadFloatAccessorAsync("/accessors/".concat(u.index),u).then(function(e){i(l,e)}))}}})("POSITION",t.VertexBuffer.PositionKind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setPositions(n)}),i("NORMAL",t.VertexBuffer.NormalKind,function(e,t){var n=new Float32Array(t.length);e.forEach(n.length,function(e,r){n[r]=t[r]+e}),o.setNormals(n)}),i("TANGENT",t.VertexBuffer.TangentKind,function(e,t){var n=new Float32Array(t.length/3*4),r=0;e.forEach(t.length/3*4,function(e,o){(o+1)%4!=0&&(n[r]=t[r]+e,r++)}),o.setTangents(n)}),i("TEXCOORD_0",t.VertexBuffer.UVKind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setUVs(n)}),i("TEXCOORD_1",t.VertexBuffer.UV2Kind,function(e,t){var n=new Float32Array(t.length);e.forEach(t.length,function(e,r){n[r]=t[r]+e}),o.setUV2s(n)}),i("COLOR_0",t.VertexBuffer.ColorKind,function(t,n){var r=null,a=t.getSize();if(3===a){r=new Float32Array(n.length/3*4),t.forEach(n.length,function(e,t){var o=Math.floor(t/3),a=t%3;r[4*o+a]=n[3*o+a]+e});for(var i=0;i<n.length/3;++i)r[4*i+3]=1}else{if(4!==a)throw new Error("".concat(e,": Invalid number of components (").concat(a,") for COLOR_0 attribute"));r=new Float32Array(n.length),t.forEach(n.length,function(e,t){r[t]=n[t]+e})}o.setColors(r)}),[4,Promise.all(a).then(function(){})];case 1:return[2,l.sent()]}})})},n._LoadTransform=function(e,n){if(null==e.skin){var r=t.Vector3.Zero(),o=t.Quaternion.Identity(),a=t.Vector3.One();e.matrix?t.Matrix.FromArray(e.matrix).decompose(a,o,r):(e.translation&&(r=t.Vector3.FromArray(e.translation)),e.rotation&&(o=t.Quaternion.FromArray(e.rotation)),e.scale&&(a=t.Vector3.FromArray(e.scale))),n.position=r,n.rotationQuaternion=o,n.scaling=a}},n.prototype._loadSkinAsync=function(e,n,r,o){var a=this;if(!this._parent.loadSkins)return Promise.resolve();var i=this._extensionsLoadSkinAsync(e,n,r);if(i)return i;if(r._data)return o(r._data.babylonSkeleton),r._data.promise;var s="skeleton".concat(r.index);this._babylonScene._blockEntityCollection=!!this._assetContainer;var l=new t.Skeleton(r.name||s,s,this._babylonScene);l._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,r,l);var u=this._loadSkinInverseBindMatricesDataAsync(e,r).then(function(e){a._updateBoneMatrices(l,e)});return r._data={babylonSkeleton:l,promise:u},o(l),u},n.prototype._loadBones=function(e,n,r){if(null==n.skeleton||this._parent.alwaysComputeSkeletonRootNode){var o=this._findSkeletonRootNode("".concat(e,"/joints"),n.joints);if(o)if(void 0===n.skeleton)n.skeleton=o.index;else{var a=He.Get("".concat(e,"/skeleton"),this._gltf.nodes,n.skeleton);a===o||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1}(a,o)||(t.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),n.skeleton=o.index)}else t.Logger.Warn("".concat(e,": Failed to find common root"))}for(var i={},s=0,l=n.joints;s<l.length;s++){var u=l[s],c=He.Get("".concat(e,"/joints/").concat(u),this._gltf.nodes,u);this._loadBone(c,n,r,i)}},n.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=He.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}},n.prototype._loadBone=function(e,n,r,o){e._isJoint=!0;var a=o[e.index];if(a)return a;var i=null;e.index!==n.skeleton&&(e.parent&&-1!==e.parent.index?i=this._loadBone(e.parent,n,r,o):void 0!==n.skeleton&&t.Logger.Warn("/skins/".concat(n.index,"/skeleton: Skeleton node is not a common root")));var s=n.joints.indexOf(e.index);return a=new t.Bone(e.name||"joint".concat(e.index),r,i,this._getNodeMatrix(e),null,null,s),o[e.index]=a,this._postSceneLoadActions.push(function(){a.linkTransformNode(e._babylonTransformNode)}),a},n.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);var n=He.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("/accessors/".concat(n.index),n)},n.prototype._updateBoneMatrices=function(e,n){for(var r=0,o=e.bones;r<o.length;r++){var a=o[r],i=t.Matrix.Identity(),s=a._index;n&&-1!==s&&(t.Matrix.FromArrayToRef(n,16*s,i),i.invertToRef(i));var l=a.getParent();l&&i.multiplyToRef(l.getAbsoluteInverseBindMatrix(),i),a.updateMatrix(i,!1,!1),a._updateAbsoluteBindMatrices(void 0,!1)}},n.prototype._getNodeMatrix=function(e){return e.matrix?t.Matrix.FromArray(e.matrix):t.Matrix.Compose(e.scale?t.Vector3.FromArray(e.scale):t.Vector3.One(),e.rotation?t.Quaternion.FromArray(e.rotation):t.Quaternion.Identity(),e.translation?t.Vector3.FromArray(e.translation):t.Vector3.Zero())},n.prototype.loadCameraAsync=function(e,r,o){void 0===o&&(o=function(){});var a=this._extensionsLoadCameraAsync(e,r,o);if(a)return a;var i=new Array;this.logOpen("".concat(e," ").concat(r.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var s=new t.FreeCamera(r.name||"camera".concat(r.index),t.Vector3.Zero(),this._babylonScene,!1);switch(s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,r._babylonCamera=s,s.setTarget(new t.Vector3(0,0,-1)),r.type){case"perspective":var l=r.perspective;if(!l)throw new Error("".concat(e,": Camera perspective properties are missing"));s.fov=l.yfov,s.minZ=l.znear,s.maxZ=l.zfar||0;break;case"orthographic":if(!r.orthographic)throw new Error("".concat(e,": Camera orthographic properties are missing"));s.mode=t.Camera.ORTHOGRAPHIC_CAMERA,s.orthoLeft=-r.orthographic.xmag,s.orthoRight=r.orthographic.xmag,s.orthoBottom=-r.orthographic.ymag,s.orthoTop=r.orthographic.ymag,s.minZ=r.orthographic.znear,s.maxZ=r.orthographic.zfar;break;default:throw new Error("".concat(e,": Invalid camera type (").concat(r.type,")"))}return n.AddPointerMetadata(s,e),this._parent.onCameraLoadedObservable.notifyObservers(s),o(s),this.logClose(),Promise.all(i).then(function(){return s})},n.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")})},n.prototype.loadAnimationAsync=function(e,t){var n=this;return this._parent._startPerformanceCounter("Load animation"),this._extensionsLoadAnimationAsync(e,t)||Ve.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;He.Assign(t.channels),He.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})})},n.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=He.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?De.value.then(function(){var i,u,c,f,h;switch(l){case"translation":h=null===(i=Be("/nodes/{}/translation"))||void 0===i?void 0:i.interpolation;break;case"rotation":h=null===(u=Be("/nodes/{}/rotation"))||void 0===u?void 0:u.interpolation;break;case"scale":h=null===(c=Be("/nodes/{}/scale"))||void 0===c?void 0:c.interpolation;break;case"weights":h=null===(f=Be("/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(!h)throw new Error("".concat(e,"/target/path: Could not find interpolation properties for target path (").concat(r.target.path,")"));var d={object:s,info:h};return a._loadAnimationChannelFromTargetInfoAsync(e,t,n,r,d,o)}):Promise.resolve()},n.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,n,r,o,a){var i=this.parent.targetFps,s=1/i,l=He.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],h=f.getStride(l),d=e.input,p=e.output,m=new Array(d.length),_=0;switch(e.interpolation){case"STEP":for(var g=0;g<d.length;g++){var b=f.getValue(l,p,_,1);_+=h,m[g]={frame:d[g]*i,value:b,interpolation:1}}break;case"CUBICSPLINE":for(g=0;g<d.length;g++){var y=f.getValue(l,p,_,s);_+=h,b=f.getValue(l,p,_,1),_+=h;var v=f.getValue(l,p,_,s);_+=h,m[g]={frame:d[g]*i,inTangent:y,value:b,outTangent:v}}break;case"LINEAR":for(g=0;g<d.length;g++)b=f.getValue(l,p,_,1),_+=h,m[g]={frame:d[g]*i,value:b}}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)}}})},n.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=He.Get("".concat(e,"/input"),this._gltf.accessors,t.input),o=He.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},n.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),{cause:t})}})},n.prototype.loadBufferViewAsync=function(e,t){var n=this._extensionsLoadBufferViewAsync(e,t);if(n)return n;if(t._data)return t._data;var r=He.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},n.prototype._loadAccessorAsync=function(e,r,o){var a=this;if(r._data)return r._data;var i=n._GetNumComponents(e,r.type),s=i*t.VertexBuffer.GetTypeByteLength(r.componentType),l=i*r.count;if(null==r.bufferView)r._data=Promise.resolve(new o(l));else{var u=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,r.bufferView);r._data=this.loadBufferViewAsync("/bufferViews/".concat(u.index),u).then(function(a){if(5126!==r.componentType||r.normalized||u.byteStride&&u.byteStride!==s){var c=new o(l);return t.VertexBuffer.ForEach(a,r.byteOffset||0,u.byteStride||s,i,r.componentType,c.length,r.normalized||!1,function(e,t){c[t]=e}),c}return n._GetTypedArray(e,r.componentType,a,r.byteOffset,l)})}if(r.sparse){var c=r.sparse;r._data=r._data.then(function(l){var u=l,f=He.Get("".concat(e,"/sparse/indices/bufferView"),a._gltf.bufferViews,c.indices.bufferView),h=He.Get("".concat(e,"/sparse/values/bufferView"),a._gltf.bufferViews,c.values.bufferView);return Promise.all([a.loadBufferViewAsync("/bufferViews/".concat(f.index),f),a.loadBufferViewAsync("/bufferViews/".concat(h.index),h)]).then(function(a){var l,f=a[0],h=a[1],d=n._GetTypedArray("".concat(e,"/sparse/indices"),c.indices.componentType,f,c.indices.byteOffset,c.count),p=i*c.count;if(5126!==r.componentType||r.normalized){var m=n._GetTypedArray("".concat(e,"/sparse/values"),r.componentType,h,c.values.byteOffset,p);l=new o(p),t.VertexBuffer.ForEach(m,0,s,i,r.componentType,l.length,r.normalized||!1,function(e,t){l[t]=e})}else l=n._GetTypedArray("".concat(e,"/sparse/values"),r.componentType,h,c.values.byteOffset,p);for(var _=0,g=0;g<d.length;g++)for(var b=d[g]*i,y=0;y<i;y++)u[b++]=l[_++];return u})})}return r._data},n.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},n.prototype._loadIndicesAccessorAsync=function(e,t){if("SCALAR"!==t.type)throw new Error("".concat(e,"/type: Invalid value ").concat(t.type));if(5121!==t.componentType&&5123!==t.componentType&&5125!==t.componentType)throw new Error("".concat(e,"/componentType: Invalid value ").concat(t.componentType));if(t._data)return t._data;if(t.sparse){var r=n._GetTypedArrayConstructor("".concat(e,"/componentType"),t.componentType);t._data=this._loadAccessorAsync(e,t,r)}else{var o=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(o.index),o).then(function(r){return n._GetTypedArray(e,t.componentType,r,t.byteOffset,t.count)})}return t._data},n.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var n=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then(function(e){return new t.Buffer(n,e,!1)}),e._babylonBuffer},n.prototype._loadVertexAccessorAsync=function(e,r,o){var a;if(null===(a=r._babylonVertexBuffer)||void 0===a?void 0:a[o])return r._babylonVertexBuffer[o];r._babylonVertexBuffer||(r._babylonVertexBuffer={});var i=this._babylonScene.getEngine();if(r.sparse||null==r.bufferView)r._babylonVertexBuffer[o]=this._loadFloatAccessorAsync(e,r).then(function(e){return new t.VertexBuffer(i,e,o,!1)});else{var s=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,r.bufferView);r._babylonVertexBuffer[o]=this._loadVertexBufferViewAsync(s).then(function(a){var l=n._GetNumComponents(e,r.type);return new t.VertexBuffer(i,a,o,!1,void 0,s.byteStride,void 0,r.byteOffset,l,r.componentType,r.normalized,!0,void 0,!0)})}return r._babylonVertexBuffer[o]},n.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,n,r){var o=new Array,a=this._getOrCreateMaterialAdapter(r);return n&&(n.baseColorFactor?(a.baseColor=t.Color3.FromArray(n.baseColorFactor),a.geometryOpacity=n.baseColorFactor[3]):a.baseColor=t.Color3.White(),a.baseMetalness=null==n.metallicFactor?1:n.metallicFactor,a.specularRoughness=null==n.roughnessFactor?1:n.roughnessFactor,n.baseColorTexture&&o.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),n.baseColorTexture,function(e){e.name="".concat(r.name," (Base Color)"),a.baseColorTexture=e})),n.metallicRoughnessTexture&&(n.metallicRoughnessTexture.nonColorData=!0,o.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),n.metallicRoughnessTexture,function(e){e.name="".concat(r.name," (Metallic Roughness)"),a.baseMetalnessTexture=e,a.specularRoughnessTexture=e})),a.useRoughnessFromMetallicTextureGreen=!0,a.useMetallicFromMetallicTextureBlue=!0)),Promise.all(o).then(function(){})},n.prototype._loadMaterialAsync=function(e,t,r,o,a){void 0===a&&(a=function(){});var i=this._extensionsLoadMaterialAsync(e,t,r,o,a);if(i)return i;t._data=t._data||{};var s=t._data[o];if(!s){this.logOpen("".concat(e," ").concat(t.name||""));var l=this.createMaterial(e,t,o);s={babylonMaterial:l,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(e,t,l)},t._data[o]=s,n.AddPointerMetadata(l,e),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})},n.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},n.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)},n.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(){})},n.prototype.loadMaterialBasePropertiesAsync=function(e,n,r){var o,a=new Array,i=this._getOrCreateMaterialAdapter(r);i.emissionColor=n.emissiveFactor?t.Color3.FromArray(n.emissiveFactor):new t.Color3(0,0,0),n.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),n.normalTexture&&(n.normalTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),n.normalTexture,function(e){var t;e.name="".concat(r.name," (Normal)"),i.geometryNormalTexture=e,null!=(null===(t=n.normalTexture)||void 0===t?void 0:t.scale)&&(e.level=n.normalTexture.scale)})),i.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));var s,l=1;return n.occlusionTexture&&(n.occlusionTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),n.occlusionTexture,function(e){e.name="".concat(r.name," (Occlusion)"),o=e})),null!=n.occlusionTexture.strength&&(l=n.occlusionTexture.strength)),n.emissiveTexture&&a.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),n.emissiveTexture,function(e){e.name="".concat(r.name," (Emissive)"),s=e})),Promise.all(a).then(function(){o&&(i.ambientOcclusionTexture=o,i.ambientOcclusionTextureStrength=l),s&&(i.emissionColorTexture=s)})},n.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,")"))}},n.prototype.loadTextureInfoAsync=function(e,t,r){var o=this;void 0===r&&(r=function(){});var a=this._extensionsLoadTextureInfoAsync(e,t,r);if(a)return a;if(this.logOpen("".concat(e)),t.texCoord>=6)throw new Error("".concat(e,"/texCoord: Invalid value (").concat(t.texCoord,")"));var i=He.Get("".concat(e,"/index"),this._gltf.textures,t.index);i._textureInfo=t;var s=this._loadTextureAsync("/textures/".concat(t.index),i,function(a){a.coordinatesIndex=t.texCoord||0,n.AddPointerMetadata(a,e),o._parent.onTextureLoadedObservable.notifyObservers(a),r(a)});return this.logClose(),s},n.prototype._loadTextureAsync=function(e,t,r){void 0===r&&(r=function(){});var o=this._extensionsLoadTextureAsync(e,t,r);if(o)return o;this.logOpen("".concat(e," ").concat(t.name||""));var a=null==t.sampler?n.DefaultSampler:He.Get("".concat(e,"/sampler"),this._gltf.samplers,t.sampler),i=He.Get("".concat(e,"/source"),this._gltf.images,t.source),s=this._createTextureAsync(e,a,i,r,void 0,!t._textureInfo.nonColorData);return this.logClose(),s},n.prototype._createTextureAsync=function(e,n,r,o,a,i){var s,l,u=this;void 0===o&&(o=function(){});var c=this._loadSampler("/samplers/".concat(n.index),n),f=new Array,h=new t.Deferred;this._babylonScene._blockEntityCollection=!!this._assetContainer;var d={noMipmap:c.noMipMaps,invertY:!1,samplingMode:c.samplingMode,onLoad:function(){u._disposed||h.resolve()},onError:function(t,n){u._disposed||h.reject(new Error("".concat(e,": ").concat(n&&n.message?n.message:t||"Failed to load texture")))},mimeType:null!==(s=r.mimeType)&&void 0!==s?s:t.GetMimeType(null!==(l=r.uri)&&void 0!==l?l:""),loaderOptions:a,useSRGBBuffer:!!i&&this._parent.useSRGBBuffers},p=new t.Texture(null,this._babylonScene,d);p._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,f.push(h.promise);var m=r.uri&&!t.IsBase64DataUrl(r.uri)?r.uri:void 0,_=null!=m?m:"".concat(this._fileName,"#image").concat(r.index);if(f.push(this.loadImageAsync("/images/".concat(r.index),r).then(function(e){var t="data:".concat(u._uniqueRootUrl).concat(_);p.updateURL(t,e);var n=p.getInternalTexture();n&&(n.label=r.name)})),p.wrapU=c.wrapU,p.wrapV=c.wrapV,o(p),this._parent.useGltfTextureNames){var g=r.name||m||"image".concat(r.index);p.name=g}return Promise.all(f).then(function(){return p})},n.prototype._loadSampler=function(e,t){return t._data||(t._data={noMipMaps:9728===t.minFilter||9729===t.minFilter,samplingMode:n._GetTextureSamplingMode(e,t),wrapU:n._GetTextureWrapMode("".concat(e,"/wrapS"),t.wrapS),wrapV:n._GetTextureWrapMode("".concat(e,"/wrapT"),t.wrapT)}),t._data},n.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=He.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync("/bufferViews/".concat(n.index),n)}this.logClose()}return t._data},n.prototype.loadUriAsync=function(e,r,o){var a=this,i=this._extensionsLoadUriAsync(e,r,o);if(i)return i;if(!n._ValidateUri(o))throw new Error("".concat(e,": '").concat(o,"' is invalid"));if(t.IsBase64DataUrl(o)){var s=new Uint8Array(t.DecodeBase64UrlToBinary(o));return this.log("".concat(e,": Decoded ").concat(o.substring(0,64),"... (").concat(s.length," bytes)")),Promise.resolve(s)}return this.log("".concat(e,": Loading ").concat(o)),this._parent.preprocessUrlAsync(this._rootUrl+o).then(function(n){return new Promise(function(r,i){a._parent._loadFile(a._babylonScene,n,function(t){a._disposed||(a.log("".concat(e,": Loaded ").concat(o," (").concat(t.byteLength," bytes)")),r(new Uint8Array(t)))},!0,function(n){i(new t.LoadFileError("".concat(e,": Failed to load '").concat(o,"'").concat(n?": "+n.status+" "+n.statusText:""),n))})})})},n.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)},n._GetTextureWrapMode=function(e,n){switch(n=null==n?10497:n){case 33071:return t.Texture.CLAMP_ADDRESSMODE;case 33648:return t.Texture.MIRROR_ADDRESSMODE;case 10497:return t.Texture.WRAP_ADDRESSMODE;default:return t.Logger.Warn("".concat(e,": Invalid value (").concat(n,")")),t.Texture.WRAP_ADDRESSMODE}},n._GetTextureSamplingMode=function(e,n){var r=null==n.magFilter?9729:n.magFilter,o=null==n.minFilter?9987:n.minFilter;if(9729===r)switch(o){case 9728:return t.Texture.LINEAR_NEAREST;case 9729:return t.Texture.LINEAR_LINEAR;case 9984:return t.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return t.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return t.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return t.Texture.LINEAR_LINEAR_MIPLINEAR;default:return t.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),t.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==r&&t.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(r,")")),o){case 9728:return t.Texture.NEAREST_NEAREST;case 9729:return t.Texture.NEAREST_LINEAR;case 9984:return t.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return t.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return t.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return t.Texture.NEAREST_LINEAR_MIPLINEAR;default:return t.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(o,")")),t.Texture.NEAREST_NEAREST_MIPNEAREST}},n._GetTypedArrayConstructor=function(e,n){try{return t.GetTypedArrayConstructor(n)}catch(t){throw new Error("".concat(e,": ").concat(t.message),{cause:t})}},n._GetTypedArray=function(e,r,o,a,i){var s=o.buffer;a=o.byteOffset+(a||0);var l=n._GetTypedArrayConstructor("".concat(e,"/componentType"),r),u=t.VertexBuffer.GetTypeByteLength(r);return a%u!==0?(t.Logger.Warn("".concat(e,": Copying buffer as byte offset (").concat(a,") is not a multiple of component type byte length (").concat(u,")")),new l(s.slice(a,a+i*u),0)):new l(s,a,i)},n._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,")"))},n._ValidateUri=function(e){return t.Tools.IsBase64(e)||-1===e.indexOf("..")},n._GetDrawMode=function(e,n){switch(null==n&&(n=4),n){case 0:return t.Material.PointListDrawMode;case 1:return t.Material.LineListDrawMode;case 2:return t.Material.LineLoopDrawMode;case 3:return t.Material.LineStripDrawMode;case 4:return t.Material.TriangleFillMode;case 5:return t.Material.TriangleStripDrawMode;case 6:return t.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(n,")"))},n.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")})},n.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")})},n.prototype._forEachExtensions=function(e){for(var t=0,n=this._extensions;t<n.length;t++){var r=n[t];r.enabled&&e(r)}},n.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},n.prototype._extensionsOnLoading=function(){this._forEachExtensions(function(e){return e.onLoading&&e.onLoading()})},n.prototype._extensionsOnReady=function(){this._forEachExtensions(function(e){return e.onReady&&e.onReady()})},n.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",function(n){return n.loadSceneAsync&&n.loadSceneAsync(e,t)})},n.prototype._extensionsLoadNodeAsync=function(e,t,n){return this._applyExtensions(t,"loadNode",function(r){return r.loadNodeAsync&&r.loadNodeAsync(e,t,n)})},n.prototype._extensionsLoadCameraAsync=function(e,t,n){return this._applyExtensions(t,"loadCamera",function(r){return r.loadCameraAsync&&r.loadCameraAsync(e,t,n)})},n.prototype._extensionsLoadVertexDataAsync=function(e,t,n){return this._applyExtensions(t,"loadVertexData",function(r){return r._loadVertexDataAsync&&r._loadVertexDataAsync(e,t,n)})},n.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)})},n.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)})},n.prototype._extensionsCreateMaterial=function(e,t,n){return this._applyExtensions(t,"createMaterial",function(r){return r.createMaterial&&r.createMaterial(e,t,n)})},n.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,n){return this._applyExtensions(t,"loadMaterialProperties",function(r){return r.loadMaterialPropertiesAsync&&r.loadMaterialPropertiesAsync(e,t,n)})},n.prototype._extensionsLoadTextureInfoAsync=function(e,t,n){return this._applyExtensions(t,"loadTextureInfo",function(r){return r.loadTextureInfoAsync&&r.loadTextureInfoAsync(e,t,n)})},n.prototype._extensionsLoadTextureAsync=function(e,t,n){return this._applyExtensions(t,"loadTexture",function(r){return r._loadTextureAsync&&r._loadTextureAsync(e,t,n)})},n.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",function(n){return n.loadAnimationAsync&&n.loadAnimationAsync(e,t)})},n.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)})},n.prototype._extensionsLoadSkinAsync=function(e,t,n){return this._applyExtensions(n,"loadSkin",function(r){return r._loadSkinAsync&&r._loadSkinAsync(e,t,n)})},n.prototype._extensionsLoadUriAsync=function(e,t,n){return this._applyExtensions(t,"loadUri",function(r){return r._loadUriAsync&&r._loadUriAsync(e,t,n)})},n.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",function(n){return n.loadBufferViewAsync&&n.loadBufferViewAsync(e,t)})},n.prototype._extensionsLoadBufferAsync=function(e,t,n,r){return this._applyExtensions(t,"loadBuffer",function(o){return o.loadBufferAsync&&o.loadBufferAsync(e,t,n,r)})},n.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},n.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},n.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},n.prototype.logOpen=function(e){this._parent._logOpen(e)},n.prototype.logClose=function(){this._parent._logClose()},n.prototype.log=function(e){this._parent._log(e)},n.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},n.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},n.DefaultSampler={index:-1},n}();k._CreateGLTF2Loader=function(e){return new je(e)};var Ue={__proto__:null,ArrayItem:He,GLTFFileLoader:k,GLTFLoader:je,LoadBoundingInfoFromPositionAccessor:Ke};function We(e,n,r,o){return t.Vector3.FromArray(n,r).scaleInPlace(o)}function ze(e,n,r,o){return t.Quaternion.FromArray(n,r).scaleInPlace(o)}function qe(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 Ye=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,n,r){var o=new t.Animation(e,this.name,n,this.type);return o.setKeys(r,!0),o},e}(),Xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(Ye),Je=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return m(n,e),n.prototype.buildAnimations=function(e,n,r,o){var a=[];if(e._numMorphTargets)for(var i=function(i){var l=new t.Animation("".concat(n,"_").concat(i),s.name,r,s.type);if(l.setKeys(o.map(function(e){return{frame:e.frame,inTangent:e.inTangent?e.inTangent[i]:void 0,value:e.value[i],outTangent:e.outTangent?e.outTangent[i]:void 0,interpolation:e.interpolation}}),!0),e._primitiveBabylonMeshes)for(var u=0,c=e._primitiveBabylonMeshes;u<c.length;u++){var f=c[u];if(f.morphTargetManager){var h=f.morphTargetManager.getTarget(i),d=l.clone();h.animations.push(d),a.push({babylonAnimatable:h,babylonAnimation:d})}}},s=this,l=0;l<e._numMorphTargets;l++)i(l);return a},n}(Ye);ke("/nodes/{}/translation",[new Xe(t.Animation.ANIMATIONTYPE_VECTOR3,"position",We,function(){return 3})]),ke("/nodes/{}/rotation",[new Xe(t.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",ze,function(){return 4})]),ke("/nodes/{}/scale",[new Xe(t.Animation.ANIMATIONTYPE_VECTOR3,"scaling",We,function(){return 3})]),ke("/nodes/{}/weights",[new Je(t.Animation.ANIMATIONTYPE_FLOAT,"influence",qe,function(e){return e._numMorphTargets})]);var Qe={__proto__:null,AnimationPropertyInfo:Ye,TransformNodeAnimationPropertyInfo:Xe,WeightAnimationPropertyInfo:Je,getQuaternion:ze,getVector3:We,getWeights:qe},Ze=function(){function e(e){this._specWorkflow=!1,this._diffuseTransmissionTint=t.Color3.White(),this._diffuseTransmissionTintTexture=null,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)},e.prototype.configureSpecularGlossiness=function(){this._specWorkflow=!0},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,"glossiness",{get:function(){return 1-this._material.specularRoughness},set:function(e){this._material.specularRoughness=Math.max(1-e,0)},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",{get:function(){return this._material.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",{get:function(){return this._material.coatIor},set:function(e){this._material.coatIor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coatDarkening",{get:function(){return this._material.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(){this._material.geometryThinWalled=1,this._material.transmissionDepth=0},Object.defineProperty(e.prototype,"transmissionWeight",{get:function(){return this._material.transmissionWeight},set:function(e){this._material.transmissionWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transmissionWeightTexture",{get:function(){return this._material.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(t.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}),e.prototype.configureVolume=function(){this._material.geometryThinWalled=0},Object.defineProperty(e.prototype,"geometryThinWalled",{get:function(){return!!this._material.geometryThinWalled},set:function(e){this._material.geometryThinWalled=e?1:0},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(){this._material.geometryThinWalled=1,this._material.subsurfaceScatterAnisotropy=1},Object.defineProperty(e.prototype,"subsurfaceWeight",{get:function(){return this._material.subsurfaceWeight},set:function(e){this._material.subsurfaceWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceWeightTexture",{get:function(){return this._material.subsurfaceWeightTexture},set:function(e){this._material.subsurfaceWeightTexture=e,this._material._useSubsurfaceWeightFromTextureAlpha=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColor",{set:function(e){this._material.subsurfaceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){this._material.subsurfaceColorTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTint",{get:function(){return this._diffuseTransmissionTint},set:function(e){this._diffuseTransmissionTint=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTintTexture",{set:function(e){this._diffuseTransmissionTintTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadius",{get:function(){return this._material.subsurfaceRadius},set:function(e){this._material.subsurfaceRadius=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceRadiusScale",{get:function(){return this._material.subsurfaceRadiusScale},set:function(e){this._material.subsurfaceRadiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceScatterAnisotropy",{set:function(e){this._material.subsurfaceScatterAnisotropy=e},enumerable:!1,configurable:!0}),e.prototype.isTranslucent=function(){return this.transmissionWeight>0||this.subsurfaceWeight>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.prototype.finalizeAsync=function(e){return g(this,void 0,void 0,function(){var n,r,o,a,i,s,l,u,c,f;return b(this,function(h){switch(h.label){case 0:return this._diffuseTransmissionTint&&!this._diffuseTransmissionTint.equals(t.Color3.White())||this._diffuseTransmissionTintTexture?this._material.geometryThinWalled?(this.subsurfaceColor=this._diffuseTransmissionTint,this.subsurfaceColorTexture=this._diffuseTransmissionTintTexture,[3,3]):[3,1]:[3,3];case 1:return[4,this.copySurfaceToCoatAsync(this.subsurfaceWeight,this.subsurfaceWeightTexture,t.TextureChannel.A,this._diffuseTransmissionTint,this._diffuseTransmissionTintTexture,!0,e)];case 2:if(h.sent(),e.aborted)return[2];h.label=3;case 3:return this.transmissionWeight>0?this._material.geometryThinWalled||0===this._material.transmissionDepth?(this._material.transmissionColor=this._material.baseColor,this._material.transmissionColorTexture=this._material.baseColorTexture,[3,6]):[3,4]:[3,6];case 4:return this.baseColor.equals(t.Color3.White())&&null===this.baseColorTexture?[3,6]:[4,this.copySurfaceToCoatAsync(this.transmissionWeight,this.transmissionWeightTexture,t.TextureChannel.R,this.baseColor,this.baseColorTexture,!1,e)];case 5:if(h.sent(),e.aborted)return[2];h.label=6;case 6:return this._specWorkflow?(r=t.InvertTextureAsync,o=["newRoughnessTexture ("+this._material.name+")"],[4,t.ExtractChannelAsync("glossiness ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularColorTexture,new t.Color4(this.specularColor.r,this.specularColor.g,this.specularColor.b,this.glossiness),t.TextureChannel.A,t.TextureColorSpace.Linear),t.TextureChannel.A,this._material.getScene(),t.TextureColorSpace.Linear,t.ChannelMask.R)]):[3,11];case 7:return[4,r.apply(void 0,o.concat([h.sent(),this._material.getScene(),t.ChannelMask.R,t.TextureColorSpace.Linear,t.ChannelMask.R]))];case 8:return n=h.sent(),e.aborted?(null===(u=n.texture)||void 0===u||u.dispose(),[2]):(this.specularRoughnessTexture=n.texture,this.specularRoughness=n.factor?n.factor.r:1,[4,t.ExtractMaxChannelAsync("metallicTexture ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularColorTexture,this.specularColor.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.Linear),this._material.getScene(),!1,t.TextureColorSpace.SRGB,t.ChannelMask.RGB)]);case 9:return a=h.sent(),e.aborted?(null===(c=a.texture)||void 0===c||c.dispose(),[2]):(this.baseMetalnessTexture=a.texture,this.baseMetalness=a.factor?a.factor.r:1,[4,t.LerpTexturesAsync("newBaseColor ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.baseColorTexture,this.baseColor.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.Linear),t.CreateTextureWithFactorOperand(this.specularColorTexture,this.specularColor.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.Linear),_(_({},a),{dispose:void 0,colorSpace:t.TextureColorSpace.Linear}),this._material.getScene(),t.TextureColorSpace.SRGB,t.ChannelMask.RGB)]);case 10:if(i=h.sent(),e.aborted)return null===(f=i.texture)||void 0===f||f.dispose(),[2];null==(s=this.baseColorTexture)||s.dispose(),this.baseColorTexture=i.texture,this.baseColor=i.factor?new t.Color3(i.factor.r,i.factor.g,i.factor.b):t.Color3.White(),null==(l=this.specularColorTexture)||l.dispose(),this.specularColorTexture=null,h.label=11;case 11:return[2]}})})},e.prototype.copySurfaceToCoatAsync=function(e,n,r,o,a){return g(this,arguments,void 0,function(e,n,r,o,a,i,s){var l,u,c,f,h,d,p,m,_,g,y,v,T,x,A,w,C,O,M,E,R,F,L,P,S,N,I,B,k,G;return void 0===i&&(i=!1),void 0===s&&(s=(new AbortController).signal),b(this,function(b){switch(b.label){case 0:return l=this._material.coatWeight,u=this._material.coatWeightTexture,c=this._material.coatColor.clone(),f=this._material.coatColorTexture,h=this._material.geometryCoatNormalTexture,d=new t.Color4(l,l,l,l),p=new t.Color4(e,e,e,e),this.coatWeightTexture=null,this.coatWeight=1,[4,Promise.allSettled([t.LerpTexturesAsync("lerpExistingCoat",t.CreateTextureWithFactorOperand(null,new t.Color4(1,1,1,1)),t.CreateTextureWithFactorOperand(f,c.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.SRGB),t.CreateTextureWithFactorOperand(u,d,t.TextureChannel.R),this._material.getScene(),t.TextureColorSpace.SRGB),t.LerpTexturesAsync("lerpSurfaceColor",t.CreateTextureWithFactorOperand(null,new t.Color4(1,1,1,1)),t.CreateTextureWithFactorOperand(a,o.toColor4(),t.TextureChannel.RGBA,t.TextureColorSpace.SRGB),t.CreateTextureWithFactorOperand(n,p,r),this._material.getScene(),t.TextureColorSpace.SRGB)])];case 1:if(m=b.sent(),_=m.find(function(e){return"rejected"===e.status}),_){for(g=0,y=m;g<y.length;g++)"fulfilled"===(v=y[g]).status&&(null===(F=v.value.texture)||void 0===F||F.dispose());throw _.reason}return T=m.map(function(e){return e.value}),x=T[0],A=T[1],s.aborted?(null===(L=x.texture)||void 0===L||L.dispose(),null===(P=A.texture)||void 0===P||P.dispose(),[2]):[4,t.MultiplyTexturesAsync("newCoatColor ("+this._material.name+")",x,A,this._material.getScene(),t.TextureColorSpace.SRGB)];case 2:return w=b.sent(),s.aborted?(null===(S=w.texture)||void 0===S||S.dispose(),[2]):(w.texture?(this.coatColorTexture=w.texture,this.coatColor=t.Color3.White()):w.factor&&(this.coatColorTexture=null,this.coatColor.fromArray([w.factor.r,w.factor.g,w.factor.b])),[4,t.LerpTexturesAsync("newCoatIor ("+this._material.name+")",t.CreateTextureWithFactorOperand(null,new t.Color4(this._material.specularIor,this._material.specularIor,this._material.specularIor,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(null,new t.Color4(this.coatIor,this.coatIor,this.coatIor,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(u,d,t.TextureChannel.R),this._material.getScene())]);case 3:return C=b.sent(),s.aborted?(null===(N=C.texture)||void 0===N||N.dispose(),[2]):(this.coatIor=C.factor?C.factor.r:this.coatIor,[4,t.LerpTexturesAsync("newCoatRoughness ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularRoughnessTexture,new t.Color4(this.specularRoughness,this.specularRoughness,this.specularRoughness,1),t.TextureChannel.G),t.CreateTextureWithFactorOperand(this.coatRoughnessTexture,new t.Color4(this.coatRoughness,this.coatRoughness,this.coatRoughness,1),t.TextureChannel.G),t.CreateTextureWithFactorOperand(u,d,t.TextureChannel.R),this._material.getScene())]);case 4:return O=b.sent(),s.aborted?(null===(I=O.texture)||void 0===I||I.dispose(),[2]):(this.coatRoughness=O.factor?O.factor.r:1,this.coatRoughnessTexture=O.texture,[4,t.LerpTexturesAsync("newCoatDarkening ("+this._material.name+")",t.CreateTextureWithFactorOperand(null,new t.Color4(0,0,0,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(null,new t.Color4(this.coatDarkening,this.coatDarkening,this.coatDarkening,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(u,d,t.TextureChannel.R),this._material.getScene())]);case 5:return M=b.sent(),s.aborted?(null===(B=M.texture)||void 0===B||B.dispose(),[2]):(this.coatDarkening=M.factor?M.factor.r:this.coatDarkening,i?[4,t.LerpTexturesAsync("newSpecularRoughness ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.specularRoughnessTexture,new t.Color4(this._material.specularRoughness,this._material.specularRoughness,this._material.specularRoughness,1),t.TextureChannel.G),t.CreateTextureWithFactorOperand(null,new t.Color4(1,1,1,1),t.TextureChannel.R),t.CreateTextureWithFactorOperand(n,p,r),this._material.getScene())]:[3,7]);case 6:if(E=b.sent(),s.aborted)return null===(k=E.texture)||void 0===k||k.dispose(),[2];this.specularRoughness=E.factor?E.factor.r:1,this.specularRoughnessTexture=E.texture,b.label=7;case 7:return h||this.geometryNormalTexture?[4,t.LerpTexturesAsync("newCoatNormal ("+this._material.name+")",t.CreateTextureWithFactorOperand(this.geometryNormalTexture,this.geometryNormalTexture?new t.Color4(1,1,1,1):new t.Color4(.5,.5,1,1),t.TextureChannel.RGBA),t.CreateTextureWithFactorOperand(h,h?new t.Color4(1,1,1,1):new t.Color4(.5,.5,1,1),t.TextureChannel.RGBA),t.CreateTextureWithFactorOperand(u,d,t.TextureChannel.R),this._material.getScene())]:[3,9];case 8:if(R=b.sent(),s.aborted)return null===(G=R.texture)||void 0===G||G.dispose(),[2];R.texture&&(this.geometryCoatNormalTexture=R.texture),b.label=9;case 9:return[2]}})})},e}(),$e={__proto__:null,OpenPBRMaterialLoadingAdapter:Ze},et=function(){function e(e){this._specWorkflow=!1,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=t.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=t.Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_OPENPBR,this._material.brdf.conductorSpecularModel=t.Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_OPENPBR)},e.prototype.configureSpecularGlossiness=function(){this._specWorkflow=!0,this._material.metallic=null,this._material.roughness=null,this._material.useMicroSurfaceFromReflectivityMapAlpha=!0},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._specWorkflow?this._material.reflectivityColor:this._material.metallicReflectanceColor},set:function(e){this._specWorkflow?this._material.reflectivityColor=e:this._material.metallicReflectanceColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"specularColorTexture",{get:function(){return this._specWorkflow?this._material.reflectivityTexture:this._material.reflectanceTexture},set:function(e){this._specWorkflow?(this._material.reflectivityTexture=e,this._material.reflectivityTexture&&(this._material.reflectivityTexture.hasAlpha=!0)):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,"glossiness",{get:function(){var e;return null!==(e=this._material.microSurface)&&void 0!==e?e:1},set:function(e){this._material.microSurface=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!=t.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 t.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 t.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,"transmissionScatterTexture",{set:function(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},e.prototype.configureVolume=function(){},Object.defineProperty(e.prototype,"geometryThinWalled",{get:function(){return 0===this._material.subSurface.maximumThickness},set:function(e){},enumerable:!1,configurable:!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){var n=new t.Vector3(-Math.log(this.transmissionColor.r),-Math.log(this.transmissionColor.g),-Math.log(this.transmissionColor.b));n.scaleInPlace(1/Math.max(this.transmissionDepth,.001));var r=n,o=Math.max(r.x,Math.max(r.y,r.z)),a=o>0?1/o:1;this._material.subSurface.diffusionDistance=new t.Color3(Math.exp(-r.x*a),Math.exp(-r.y*a),Math.exp(-r.z*a))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subsurfaceColorTexture",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTint",{get:function(){return this._material.subSurface.tintColor},set:function(e){this._material.subSurface.tintColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"diffuseTransmissionTintTexture",{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:t.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.isTranslucent=function(){return this.transmissionWeight>0||this.subsurfaceWeight>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}(),tt={__proto__:null,PBRMaterialLoadingAdapter:et},nt="EXT_lights_image_based",rt=function(){function e(e){this.name=nt,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}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 je.LoadExtensionAsync(e,t,this.name,function(r,o){return g(n,void 0,void 0,function(){var n,a,i=this;return b(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=He.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,n){var r=this;if(!n._loaded){var o=new Array;this._loader.logOpen("".concat(e));for(var a=new Array(n.specularImages.length),i=function(t){var r=n.specularImages[t];a[t]=new Array(r.length);for(var i=function(n){var i="".concat(e,"/specularImages/").concat(t,"/").concat(n);s._loader.logOpen("".concat(i));var l=r[n],u=He.Get(i,s._loader.gltf.images,l);o.push(s._loader.loadImageAsync("/images/".concat(l),u).then(function(e){a[t][n]=e})),s._loader.logClose()},l=0;l<r.length;l++)i(l)},s=this,l=0;l<n.specularImages.length;l++)i(l);this._loader.logClose(),n._loaded=Promise.all(o).then(function(){return g(r,void 0,void 0,function(){var r,o,i,s,l;return b(this,function(u){switch(u.label){case 0:if((r=new t.RawCubeTexture(this._loader.babylonScene,null,n.specularImageSize)).name=n.name||"environment",n._babylonTexture=r,null!=n.intensity&&(r.level=n.intensity),n.rotation&&(o=t.Quaternion.FromArray(n.rotation),this._loader.babylonScene.useRightHandedSystem||(o=t.Quaternion.Inverse(o)),t.Matrix.FromQuaternionToRef(o,r.getReflectionTextureMatrix())),!n.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));return(i=t.SphericalHarmonics.FromArray(n.irradianceCoefficients)).scaleInPlace(n.intensity),i.convertIrradianceToLambertianRadiance(),s=t.SphericalPolynomial.FromHarmonics(i),l=(a.length-1)/Math.log2(n.specularImageSize),[4,r.updateRGBDAsync(a,s,l)];case 1:return[2,u.sent()]}})})})}return n._loaded.then(function(){return n._babylonTexture})},e}();we(nt),Ae(nt,!0,function(e){return new rt(e)});var ot={__proto__:null,EXT_lights_image_based:rt},at="EXT_mesh_gpu_instancing",it=function(){function e(e){this.name=at,this._loader=e,this.enabled=this._loader.isExtensionUsed(at)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(e,a){return g(o,void 0,void 0,function(){var o,i,s,l,u=this;return b(this,function(c){switch(c.label){case 0:return this._loader._disableInstancedMesh++,o=this._loader.loadNodeAsync("/nodes/".concat(n.index),n,r),this._loader._disableInstancedMesh--,n._primitiveBabylonMeshes?[3,2]:[4,o];case 1:case 3:return[2,c.sent()];case 2:return i=new Array,s=0,(l=function(t){if(null!=a.attributes[t]){var n=He.Get("".concat(e,"/attributes/").concat(t),u._loader.gltf.accessors,a.attributes[t]);if(i.push(u._loader._loadFloatAccessorAsync("/accessors/".concat(n.bufferView),n)),0===s)s=n.count;else if(s!==n.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else i.push(Promise.resolve(null))})("TRANSLATION"),l("ROTATION"),l("SCALE"),l("_COLOR_0"),[4,o.then(function(e){return g(u,void 0,void 0,function(){var r,o,a,l,u,c,f,h,d,p;return b(this,function(m){switch(m.label){case 0:return[4,Promise.all(i)];case 1:for(r=m.sent(),o=r[0],a=r[1],l=r[2],u=r[3],c=new Float32Array(16*s),t.TmpVectors.Vector3[0].copyFromFloats(0,0,0),t.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),t.TmpVectors.Vector3[1].copyFromFloats(1,1,1),f=0;f<s;++f)o&&t.Vector3.FromArrayToRef(o,3*f,t.TmpVectors.Vector3[0]),a&&t.Quaternion.FromArrayToRef(a,4*f,t.TmpVectors.Quaternion[0]),l&&t.Vector3.FromArrayToRef(l,3*f,t.TmpVectors.Vector3[1]),t.Matrix.ComposeToRef(t.TmpVectors.Vector3[1],t.TmpVectors.Quaternion[0],t.TmpVectors.Vector3[0],t.TmpVectors.Matrix[0]),t.TmpVectors.Matrix[0].copyToArray(c,16*f);for(h=0,d=n._primitiveBabylonMeshes;h<d.length;h++)(p=d[h]).thinInstanceSetBuffer("matrix",c,16,!0),u&&(u.length===3*s?p.thinInstanceSetBuffer("color",u,3,!0):u.length===4*s?p.thinInstanceSetBuffer("color",u,4,!0):t.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+p.name));return[2,e]}})})})]}})})})},e}();we(at),Ae(at,!0,function(e){return new it(e)});var st={__proto__:null,EXT_mesh_gpu_instancing:it},lt="EXT_meshopt_compression",ut=function(){function e(e){this.name=lt,this.enabled=e.isExtensionUsed(lt),this._loader=e}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadBufferViewAsync=function(e,n){var r=this;return je.LoadExtensionAsync(e,n,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,o,i=this;return b(this,function(s){switch(s.label){case 0:return(r=n)._meshOptData?[4,r._meshOptData]:[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=He.Get("".concat(e,"/buffer"),this._loader.gltf.buffers,a.buffer),r._meshOptData=this._loader.loadBufferAsync("/buffers/".concat(o.index),o,a.byteOffset||0,a.byteLength).then(function(e){return g(i,void 0,void 0,function(){return b(this,function(n){switch(n.label){case 0:return[4,t.MeshoptCompression.Default.decodeGltfBufferAsync(e,a.count,a.byteStride,a.mode,a.filter)];case 1:return[2,n.sent()]}})})}),[4,r._meshOptData]}})})})},e}();we(lt),Ae(lt,!0,function(e){return new ut(e)});var ct={__proto__:null,EXT_meshopt_compression:ut},ft="EXT_texture_webp",ht=function(){function e(e){this.name=ft,this._loader=e,this.enabled=e.isExtensionUsed(ft)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(this,function(s){switch(s.label){case 0:return r=null==t.sampler?je.DefaultSampler:He.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=He.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}();we(ft),Ae(ft,!0,function(e){return new ht(e)});var dt={__proto__:null,EXT_texture_webp:ht},pt="EXT_texture_avif",mt=function(){function e(e){this.name=pt,this._loader=e,this.enabled=e.isExtensionUsed(pt)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(this,function(s){switch(s.label){case 0:return r=null==t.sampler?je.DefaultSampler:He.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=He.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}();we(pt),Ae(pt,!0,function(e){return new mt(e)});var _t={__proto__:null,EXT_texture_avif:mt},gt="EXT_lights_ies",bt=function(){function e(e){this.name=gt,this._loader=e,this.enabled=this._loader.isExtensionUsed(gt)}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,He.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o,s,l,u,c,f=this;return b(this,function(h){switch(h.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n=(s=He.Get(a,f._lights,i.light)).name||e.name;f._loader.babylonScene._blockEntityCollection=!!f._loader._assetContainer,(o=new t.SpotLight(n,t.Vector3.Zero(),t.Vector3.Backward(),0,1,f._loader.babylonScene)).angle=Math.PI/2,o.innerAngle=0,o._parentContainer=f._loader._assetContainer,f._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=o,o.falloffType=t.Light.FALLOFF_GLTF,o.diffuse=i.color?t.Color3.FromArray(i.color):t.Color3.White(),o.intensity=i.multiplier||1,o.range=Number.MAX_VALUE,o.parent=e,f._loader._babylonLights.push(o),je.AddPointerMetadata(o,a),r(e)})];case 1:return l=h.sent(),s.uri?[4,this._loader.loadUriAsync(e,s,s.uri)]:[3,3];case 2:return u=h.sent(),[3,5];case 3:return c=He.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,s.bufferView),[4,this._loader.loadBufferViewAsync("/bufferViews/".concat(c.index),c)];case 4:u=h.sent(),h.label=5;case 5:return o.iesProfileTexture=new t.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,u,!0,void 0,void 0,void 0,void 0,".ies"),[2,l]}})})})},e}();we(gt),Ae(gt,!0,function(e){return new bt(e)});var yt={__proto__:null,EXT_lights_ies:bt},vt="KHR_draco_mesh_compression",Tt=function(){function e(e){this.name=vt,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=t.DracoDecoder.DefaultAvailable&&this._loader.isExtensionUsed(vt)}return e.prototype.dispose=function(){delete this.dracoDecoder,this._loader=null},e.prototype._loadVertexDataAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o,s,l,u,c=this;return b(this,function(f){switch(f.label){case 0:if(null!=n.mode&&4!==n.mode&&5!==n.mode)throw new Error("".concat(e,": Unsupported mode ").concat(n.mode));return o={},s={},(l=function(e,t){var a=i.attributes[e];if(null!=a&&(r._delayInfo=r._delayInfo||[],-1===r._delayInfo.indexOf(t)&&r._delayInfo.push(t),o[t]=a,c.useNormalizedFlagFromAccessor)){var l=He.TryGet(c._loader.gltf.accessors,n.attributes[e]);l&&(s[t]=l.normalized||!1)}})("POSITION",t.VertexBuffer.PositionKind),l("NORMAL",t.VertexBuffer.NormalKind),l("TANGENT",t.VertexBuffer.TangentKind),l("TEXCOORD_0",t.VertexBuffer.UVKind),l("TEXCOORD_1",t.VertexBuffer.UV2Kind),l("TEXCOORD_2",t.VertexBuffer.UV3Kind),l("TEXCOORD_3",t.VertexBuffer.UV4Kind),l("TEXCOORD_4",t.VertexBuffer.UV5Kind),l("TEXCOORD_5",t.VertexBuffer.UV6Kind),l("JOINTS_0",t.VertexBuffer.MatricesIndicesKind),l("WEIGHTS_0",t.VertexBuffer.MatricesWeightsKind),l("COLOR_0",t.VertexBuffer.ColorKind),(u=He.Get(a,this._loader.gltf.bufferViews,i.bufferView))._dracoBabylonGeometry||(u._dracoBabylonGeometry=this._loader.loadBufferViewAsync("/bufferViews/".concat(u.index),u).then(function(a){return g(c,void 0,void 0,function(){var i,l,u;return b(this,function(c){switch(c.label){case 0:return i=this.dracoDecoder||t.DracoDecoder.Default,l=He.TryGet(this._loader.gltf.accessors,n.attributes.POSITION),u=this._loader.parent.alwaysComputeBoundingBox||r.skeleton||!l?null:Ke(l),[4,i._decodeMeshToGeometryForGltfAsync(r.name,this._loader.babylonScene,a,o,s,u).catch(function(t){throw new Error("".concat(e,": ").concat(t.message))})];case 1:return[2,c.sent()]}})})})),[4,u._dracoBabylonGeometry];case 1:return[2,f.sent()]}})})})},e}();we(vt),Ae(vt,!0,function(e){return new Tt(e)});var xt={__proto__:null,KHR_draco_mesh_compression:Tt},At="KHR_lights_punctual",wt=function(){function e(e){this.name=At,this._loader=e,this.enabled=this._loader.isExtensionUsed(At)}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,He.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o=this;return b(this,function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n,s=He.Get(a,o._lights,i.light),l=s.name||e.name;switch(o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer,s.type){case"directional":var u=new t.DirectionalLight(l,t.Vector3.Backward(),o._loader.babylonScene);u.position.setAll(0),n=u;break;case"point":n=new t.PointLight(l,t.Vector3.Zero(),o._loader.babylonScene);break;case"spot":var c=new t.SpotLight(l,t.Vector3.Zero(),t.Vector3.Backward(),0,1,o._loader.babylonScene);c.angle=2*(s.spot&&s.spot.outerConeAngle||Math.PI/4),c.innerAngle=2*(s.spot&&s.spot.innerConeAngle||0),n=c;break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(a,": Invalid light type (").concat(s.type,")"))}n._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=n,n.falloffType=t.Light.FALLOFF_GLTF,n.diffuse=s.color?t.Color3.FromArray(s.color):t.Color3.White(),n.intensity=null==s.intensity?1:s.intensity,n.range=null==s.range?Number.MAX_VALUE:s.range,n.parent=e,o._loader._babylonLights.push(n),je.AddPointerMetadata(n,a),r(e)})];case 1:return[2,s.sent()]}})})})},e}();we(At),Ae(At,!0,function(e){return new wt(e)});var Ct={__proto__:null,KHR_lights:wt},Ot="EXT_lights_area",Mt=function(){function e(e){this.name=Ot,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ot)}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,He.Assign(this._lights)}},e.prototype.loadNodeAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){var o=this;return b(this,function(s){switch(s.label){case 0:return this._loader._allMaterialsDirtyRequired=!0,[4,this._loader.loadNodeAsync(e,n,function(e){var n,s,l=He.Get(a,o._lights,i.light),u=l.name||e.name;o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer;var c=void 0!==l.size?l.size:1;switch(l.type){case"rect":var f=void 0!==(null===(n=l.rect)||void 0===n?void 0:n.aspect)?l.rect.aspect*c:c,h=c;s=new t.RectAreaLight(u,t.Vector3.Zero(),f,h,o._loader.babylonScene);break;case"disk":var d=Math.sqrt(c*c*.25*Math.PI);s=new t.RectAreaLight(u,t.Vector3.Zero(),d,d,o._loader.babylonScene);break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(a,": Invalid area light type (").concat(l.type,")"))}s._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,l._babylonLight=s,s.falloffType=t.Light.FALLOFF_GLTF,s.diffuse=l.color?t.Color3.FromArray(l.color):t.Color3.White(),s.intensity=null==l.intensity?1:l.intensity;var p=new t.TransformNode("".concat(u,"_orientation"),o._loader.babylonScene);p.rotationQuaternion=t.Quaternion.RotationAxis(t.Vector3.Up(),Math.PI),p.parent=e,s.parent=p,o._loader._babylonLights.push(s),je.AddPointerMetadata(s,a),r(e)})];case 1:return[2,s.sent()]}})})})},e}();we(Ot),Ae(Ot,!0,function(e){return new Mt(e)});var Et={__proto__:null,EXT_lights_area:Mt},Rt="KHR_materials_pbrSpecularGlossiness",Ft=function(){function e(e){this.name=Rt,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(Rt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;return o.configureSpecularGlossiness(),n.diffuseFactor?(o.baseColor=t.Color3.FromArray(n.diffuseFactor),r.alpha=n.diffuseFactor[3]):o.baseColor=t.Color3.White(),o.specularColor=n.specularFactor?t.Color3.FromArray(n.specularFactor):t.Color3.White(),o.glossiness=null==n.glossinessFactor?1:n.glossinessFactor,n.diffuseTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),n.diffuseTexture,function(e){e.name="".concat(r.name," (Diffuse)"),o.baseColorTexture=e})),n.specularGlossinessTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),n.specularGlossinessTexture,function(e){e.name="".concat(r.name," (Specular Glossiness)"),o.specularColorTexture=e})),Promise.all(a).then(function(){})},e}();we(Rt),Ae(Rt,!0,function(e){return new Ft(e)});var Lt={__proto__:null,KHR_materials_pbrSpecularGlossiness:Ft},Pt="KHR_materials_unlit",St=function(){function e(e){this.name=Pt,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(Pt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(){return g(r,void 0,void 0,function(){return b(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,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array,i=n.pbrMetallicRoughness;return i&&(i.baseColorFactor&&(o.baseColor=t.Color3.FromArray(i.baseColorFactor),o.geometryOpacity=i.baseColorFactor[3]),i.baseColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),i.baseColorTexture,function(e){e.name="".concat(r.name," (Base Color)"),o.baseColorTexture=e}))),o.isUnlit=!0,n.doubleSided&&(o.backFaceCulling=!1,o.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,n,r),Promise.all(a).then(function(){})},e}();we(Pt),Ae(Pt,!0,function(e){return new St(e)});var Nt={__proto__:null,KHR_materials_unlit:St},It="KHR_materials_clearcoat",Bt=function(){function e(e){this.name=It,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(It)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(It),Ae(It,!0,function(e){return new Bt(e)});var kt={__proto__:null,KHR_materials_clearcoat:Bt},Gt="KHR_materials_coat",Vt=function(){function e(e){this.name=Gt,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(Gt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){var o,a,i=this._loader._getOrCreateMaterialAdapter(r),s=new Array;i.configureCoat(),i.coatWeight=void 0!==n.coatFactor?n.coatFactor:0,i.coatRoughness=void 0!==n.coatRoughnessFactor?n.coatRoughnessFactor:0,n.coatTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatTexture"),n.coatTexture,function(e){e.name="".concat(r.name," (Coat)"),i.coatWeightTexture=e})),n.coatRoughnessTexture&&(n.coatRoughnessTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatRoughnessTexture"),n.coatRoughnessTexture,function(e){e.name="".concat(r.name," (Coat Roughness)"),i.coatRoughnessTexture=e}))),n.coatNormalTexture&&(n.coatNormalTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatNormalTexture"),n.coatNormalTexture,function(e){var t;e.name="".concat(r.name," (Coat Normal)"),i.geometryCoatNormalTexture=e,null!=(null===(t=n.coatNormalTexture)||void 0===t?void 0:t.scale)&&(i.geometryCoatNormalTextureScale=n.coatNormalTexture.scale)})),i.setNormalMapInversions(!r.getScene().useRightHandedSystem,r.getScene().useRightHandedSystem)),i.coatDarkening=void 0!==n.coatDarkeningFactor?n.coatDarkeningFactor:1,i.coatIor=void 0!==n.coatIor?n.coatIor:1.5;var l=t.Color3.White();void 0!==n.coatColorFactor&&l.fromArray(n.coatColorFactor),i.coatColor=l,n.coatColorTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatColorTexture"),n.coatColorTexture,function(e){e.name="".concat(r.name," (Coat Color)"),i.coatColorTexture=e}));var u=null!==(o=n.coatAnisotropyStrength)&&void 0!==o?o:0,c=null!==(a=n.coatAnisotropyRotation)&&void 0!==a?a:0;return i.coatRoughnessAnisotropy=u,i.geometryCoatTangentAngle=c,this.useOpenPBR||i.configureGltfStyleAnisotropy(!0),n.coatAnisotropyTexture&&(n.coatAnisotropyTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/coatAnisotropyTexture"),n.coatAnisotropyTexture,function(e){e.name="".concat(r.name," (Coat Anisotropy)"),i.geometryCoatTangentTexture=e}))),Promise.all(s).then(function(){})},e}();we(Gt),Ae(Gt,!0,function(e){return new Vt(e)});var Dt={__proto__:null,KHR_materials_coat:Vt},Ht="KHR_materials_iridescence",Kt=function(){function e(e){this.name=Ht,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ht)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(Ht),Ae(Ht,!0,function(e){return new Kt(e)});var jt={__proto__:null,KHR_materials_iridescence:Kt},Ut="KHR_materials_anisotropy",Wt=function(){function e(e){this.name=Ut,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ut)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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 g(this,void 0,void 0,function(){var r,o,a,i,s,l,u,c;return b(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}();we(Ut),Ae(Ut,!0,function(e){return new Wt(e)});var zt={__proto__:null,KHR_materials_anisotropy:Wt},qt="KHR_materials_emissive_strength",Yt=function(){function e(e){this.name=qt,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(qt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){return b(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}();we(qt),Ae(qt,!0,function(e){return new Yt(e)});var Xt={__proto__:null,KHR_materials_emissive_strength:Yt},Jt="KHR_materials_sheen",Qt=function(){function e(e){this.name=Jt,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(Jt)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;o.configureFuzz();var i=void 0!==n.sheenColorFactor?t.Color3.FromArray(n.sheenColorFactor):t.Color3.Black(),s=void 0!==n.sheenRoughnessFactor?n.sheenRoughnessFactor:0;return o.fuzzWeight=1,o.fuzzColor=i,o.fuzzRoughness=s,n.sheenColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),n.sheenColorTexture,function(e){e.name="".concat(r.name," (Sheen Color)"),o.fuzzColorTexture=e})),n.sheenRoughnessTexture&&(n.sheenRoughnessTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),n.sheenRoughnessTexture,function(e){e.name="".concat(r.name," (Sheen Roughness)"),o.fuzzRoughnessTexture=e}))),Promise.all(a).then(function(){})},e}();we(Jt),Ae(Jt,!0,function(e){return new Qt(e)});var Zt={__proto__:null,KHR_materials_sheen:Qt},$t="KHR_materials_fuzz",en=function(){function e(e){this.name=$t,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed($t)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r){var o=this._loader._getOrCreateMaterialAdapter(r),a=new Array;return o.configureFuzz(),o.fuzzWeight=void 0!==n.fuzzFactor?n.fuzzFactor:0,o.fuzzColor=void 0!==n.fuzzColorFactor?t.Color3.FromArray(n.fuzzColorFactor):t.Color3.White(),o.fuzzRoughness=void 0!==n.fuzzRoughnessFactor?n.fuzzRoughnessFactor:.5,n.fuzzTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzTexture"),n.fuzzTexture,function(e){e.name="".concat(r.name," (Fuzz)"),o.fuzzWeightTexture=e})),n.fuzzColorTexture&&a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzColorTexture"),n.fuzzColorTexture,function(e){e.name="".concat(r.name," (Fuzz Color)"),o.fuzzColorTexture=e})),n.fuzzRoughnessTexture&&(n.fuzzRoughnessTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync("".concat(e,"/fuzzRoughnessTexture"),n.fuzzRoughnessTexture,function(e){e.name="".concat(r.name," (Fuzz Roughness)"),o.fuzzRoughnessTexture=e}))),Promise.all(a).then(function(){})},e}();we($t),Ae($t,!0,function(e){return new en(e)});var tn={__proto__:null,KHR_materials_fuzz:en},nn="KHR_materials_specular",rn=function(){function e(e){this.name=nn,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(nn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(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,n,r){var o,a=this._loader._getOrCreateMaterialAdapter(r),i=new Array;return a.specularWeight=null!==(o=n.specularFactor)&&void 0!==o?o:1,a.specularColor=void 0!==n.specularColorFactor?t.Color3.FromArray(n.specularColorFactor):new t.Color3(1,1,1),n.specularTexture&&(n.specularTexture.nonColorData=!0,i.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),n.specularTexture,function(e){e.name="".concat(r.name," (Specular)"),a.specularWeightTexture=e}))),n.specularColorTexture&&i.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),n.specularColorTexture,function(e){e.name="".concat(r.name," (Specular Color)"),a.specularColorTexture=e})),Promise.all(i).then(function(){})},e}();we(nn),Ae(nn,!0,function(e){return new rn(e)});var on={__proto__:null,KHR_materials_specular:rn},an="KHR_materials_ior",sn=function(){function e(e){this.name=an,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(an)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(an),Ae(an,!0,function(e){return new sn(e)});var ln={__proto__:null,KHR_materials_ior:sn},un="KHR_materials_variants",cn=function(){function e(e){this.name=un,this._loader=e,this.enabled=this._loader.isExtensionUsed(un)&&!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(un," 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(un," 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(un," 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[un])||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[un];(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(n,r,o,a,i,s){var l=this;return je.LoadExtensionAsync(n,i,this.name,function(u,c){return g(l,void 0,void 0,function(){var l,f=this;return b(this,function(h){switch(h.label){case 0:return(l=new Array).push(this._loader._loadMeshPrimitiveAsync(n,r,o,a,i,function(r){if(s(r),r instanceof t.Mesh){var o=je._GetDrawMode(n,i.mode),a=f._loader.rootBabylonMesh,h=a?a._internalMetadata=a._internalMetadata||{}:{},d=h.gltf=h.gltf||{},p=d[un]=d[un]||{lastSelected:null,original:[],variants:{}};p.original.push({mesh:r,material:r.material});for(var m=function(t){var n=c.mappings[t],i=He.Get("".concat(u,"/mappings/").concat(t,"/material"),f._loader.gltf.materials,n.material);l.push(f._loader._loadMaterialAsync("#/materials/".concat(n.material),i,r,o,function(t){for(var o=function(o){var i=n.variants[o],s=He.Get("/extensions/".concat(un,"/variants/").concat(i),f._variants,i);p.variants[s.name]=p.variants[s.name]||[],p.variants[s.name].push({mesh:r,material:t}),r.onClonedObservable.add(function(t){var n,o=t,i=o;do{if(!(i=i.parent))return;n=e._GetExtensionMetadata(i)}while(null===n);if(a&&n===e._GetExtensionMetadata(a)){for(var l in i._internalMetadata={},a._internalMetadata)i._internalMetadata[l]=a._internalMetadata[l];for(var l in i._internalMetadata.gltf=[],a._internalMetadata.gltf)i._internalMetadata.gltf[l]=a._internalMetadata.gltf[l];i._internalMetadata.gltf[un]={lastSelected:null,original:[],variants:{}};for(var u=0,c=n.original;u<c.length;u++){var f=c[u];i._internalMetadata.gltf[un].original.push({mesh:f.mesh,material:f.material})}for(var l in n.variants)if(Object.prototype.hasOwnProperty.call(n.variants,l)){i._internalMetadata.gltf[un].variants[l]=[];for(var h=0,d=n.variants[l];h<d.length;h++){var p=d[h];i._internalMetadata.gltf[un].variants[l].push({mesh:p.mesh,material:p.material})}}n=i._internalMetadata.gltf[un]}for(var m=0,_=n.original;m<_.length;m++)(y=_[m]).mesh===r&&(y.mesh=o);for(var g=0,b=n.variants[s.name];g<b.length;g++){var y;(y=b[g]).mesh===r&&(y.mesh=o)}})},i=0;i<n.variants.length;++i)o(i)}))},_=0;_<c.mappings.length;++_)m(_)}})),[4,Promise.all(l).then(function(e){return e[0]})];case 1:return[2,h.sent()]}})})})},e}();we(un),Ae(un,!0,function(e){return new cn(e)});var fn={__proto__:null,KHR_materials_variants:cn},hn=function(){function e(n,r,o){var a=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._translucentMaterialIndices=new Map,this._opaqueOnlySubMeshes=new Map,this._savedSubMeshes=new Map,this._options=_(_({},e._GetDefaultOptions()),n),this._scene=r,this._scene._transmissionHelper=this,this._loader=o,this.onErrorObservable=new t.Observable,this._scene.onDisposeObservable.addOnce(function(){a.dispose()}),this._parseScene(),this._setupRenderTargets()}return e._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:t.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},e.prototype.updateOptions=function(e){var t=this,n=Object.keys(e).filter(function(n){return t._options[n]!==e[n]});if(n.length){var r=_(_({},this._options),e),o=this._options;this._options=r,r.renderSize===o.renderSize&&r.renderTargetTextureType===o.renderTargetTextureType&&r.generateMipmaps===o.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=r.samples,this._opaqueRenderTarget.lodGenerationScale=r.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=r.lodGenerationOffset):this._setupRenderTargets()}},e.prototype.getOpaqueTarget=function(){return this._opaqueRenderTarget},e.prototype._classifyMeshMaterials=function(e){var n=e.material;if(!n)return"opaque";if(!(n instanceof t.MultiMaterial))return this._loader.isMatchingMaterialType(n)&&(s=this._loader._getOrCreateMaterialAdapter(n)).isTranslucent()?(s.refractionBackgroundTexture=this._opaqueRenderTarget,"transparent"):"opaque";for(var r=!1,o=!1,a=new Set,i=0;i<n.subMaterials.length;i++){var s,l=n.subMaterials[i];l&&this._loader.isMatchingMaterialType(l)&&(s=this._loader._getOrCreateMaterialAdapter(l)).isTranslucent()?(s.refractionBackgroundTexture=this._opaqueRenderTarget,r=!0,a.add(i)):o=!0}return r&&o?(this._translucentMaterialIndices.set(e,a),this._rebuildOpaqueOnlySubMeshes(e,a),"mixed"):(this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e),r?"transparent":"opaque")},e.prototype._rebuildOpaqueOnlySubMeshes=function(e,t){e.subMeshes&&this._opaqueOnlySubMeshes.set(e,e.subMeshes.filter(function(e){return!t.has(e.materialIndex)}))},e.prototype._addMesh=function(e){var n=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),t.Tools.SetImmediate(function(){e.material&&("transparent"===n._classifyMeshMaterials(e)?-1===n._transparentMeshesCache.indexOf(e)&&n._transparentMeshesCache.push(e):-1===n._opaqueMeshesCache.indexOf(e)&&n._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),this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e)},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);"transparent"===this._classifyMeshMaterials(e)?-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,n,r,o=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new t.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!==(n=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==n?n:this._scene.clearColor.clone(),this._opaqueRenderTarget.clearColor.a=0,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){r=o._scene.environmentIntensity,o._scene.environmentIntensity=1,o._options.clearColor?e.clearColor.copyFrom(o._options.clearColor):o._scene.clearColor.toLinearSpaceToRef(e.clearColor,o._scene.getEngine().useExactSrgbConversions),e.clearColor.a=0;for(var t=o._opaqueOnlySubMeshes.entries(),n=t.next();!n.done;n=t.next()){var a=n.value[0],i=n.value[1];a.subMeshes&&(o._savedSubMeshes.set(a,a.subMeshes),a.subMeshes=i)}}),this._opaqueRenderTarget.onAfterUnbindObservable.add(function(){o._scene.environmentIntensity=r;for(var e=o._savedSubMeshes.entries(),t=e.next();!t.done;t=e.next())t.value[0].subMeshes=t.value[1];o._savedSubMeshes.clear()});for(var a=0,i=this._transparentMeshesCache;a<i.length;a++)(u=i[a]).material&&this._classifyMeshMaterials(u);for(var s=this._translucentMaterialIndices.entries(),l=s.next();!l.done;l=s.next()){var u;(u=l.value[0]).material&&this._classifyMeshMaterials(u)}},e.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[],this._translucentMaterialIndices.clear(),this._opaqueOnlySubMeshes.clear(),this._savedSubMeshes.clear()},e}(),dn="KHR_materials_transmission",pn=function(){function e(e){this.name=dn,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(dn),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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 hn({},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}();we(dn),Ae(dn,!0,function(e){return new pn(e)});var mn={__proto__:null,KHR_materials_transmission:pn},_n="KHR_materials_diffuse_transmission",gn=function(){function e(e){this.name=_n,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(_n),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r,o){var a,i=this._loader._getOrCreateMaterialAdapter(r);i.configureSubsurface(),i.subsurfaceWeight=null!==(a=o.diffuseTransmissionFactor)&&void 0!==a?a:0,i.diffuseTransmissionTint=void 0!==o.diffuseTransmissionColorFactor?t.Color3.FromArray(o.diffuseTransmissionColorFactor):t.Color3.White();var s=new Array;return o.diffuseTransmissionTexture&&(o.diffuseTransmissionTexture.nonColorData=!0,s.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionTexture"),o.diffuseTransmissionTexture).then(function(e){e.name="".concat(r.name," (Diffuse Transmission)"),i.subsurfaceWeightTexture=e}))),o.diffuseTransmissionColorTexture&&s.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTransmissionColorTexture"),o.diffuseTransmissionColorTexture).then(function(e){e.name="".concat(r.name," (Diffuse Transmission Color)"),i.diffuseTransmissionTintTexture=e})),Promise.all(s).then(function(){})},e}();we(_n),Ae(_n,!0,function(e){return new gn(e)});var bn={__proto__:null,KHR_materials_diffuse_transmission:gn},yn="KHR_materials_volume",vn=function(){function e(e){this.name=yn,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(yn),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r,o){var a,i=this._loader._getOrCreateMaterialAdapter(r);if(0===i.transmissionWeight&&0===i.subsurfaceWeight||!o.thicknessFactor)return Promise.resolve();i.geometryThinWalled=!1;var s=void 0!==o.attenuationDistance?o.attenuationDistance:Number.MAX_VALUE,l=void 0!==o.attenuationColor&&3==o.attenuationColor.length?t.Color3.FromArray(o.attenuationColor):t.Color3.White();i.configureVolume(),i.transmissionColor=l,i.transmissionDepth=s,i.volumeThickness=null!==(a=o.thicknessFactor)&&void 0!==a?a:0;var u=new Array;return o.thicknessTexture&&(o.thicknessTexture.nonColorData=!0,u.push(this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),o.thicknessTexture,function(e){e.name="".concat(r.name," (Thickness)"),i.volumeThicknessTexture=e}))),Promise.all(u).then(function(){})},e}();we(yn),Ae(yn,!0,function(e){return new vn(e)});var Tn={__proto__:null,KHR_materials_volume:vn},xn="KHR_materials_volume_scatter",An=function(){function e(e){this.name=xn,this.order=172,this._loader=e,this.enabled=this._loader.isExtensionUsed(xn),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 je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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,n,r,o){var a=this._loader._getOrCreateMaterialAdapter(r);if(0===a.transmissionWeight&&0===a.subsurfaceWeight||a.geometryThinWalled)return Promise.resolve();var i=void 0!==o.multiscatterColorFactor&&3==o.multiscatterColorFactor.length?t.Color3.FromArray(o.multiscatterColorFactor):t.Color3.Black(),s=void 0!==o.scatterAnisotropy?o.scatterAnisotropy:0,l=Promise.resolve(null);o.multiscatterColorTexture&&(o.multiscatterColorTexture.nonColorData=!0,l=this._loader.loadTextureInfoAsync("".concat(e,"/multiscatterColorTexture"),o.multiscatterColorTexture,function(e){e.name="".concat(r.name," (Scatter Color)"),a.transmissionWeight>0&&(a.transmissionScatterTexture=e),a.subsurfaceWeight>0&&(a.subsurfaceColorTexture=e)}));var u=new t.Vector3(-Math.log(a.transmissionColor.r),-Math.log(a.transmissionColor.g),-Math.log(a.transmissionColor.b));if(u.scaleInPlace(1/Math.max(a.transmissionDepth,1e-6)),a.transmissionWeight>0){var c=function(e){var n=new t.Vector3(e.r,e.g,e.b),r=new t.Vector3(4.09712,4.09712,4.09712);r.addInPlace(new t.Vector3(4.20863,4.20863,4.20863).multiplyInPlace(n));var o=new t.Vector3(9.59217,9.59217,9.59217);return o.addInPlace(new t.Vector3(41.6808,41.6808,41.6808).multiplyInPlace(n)),o.addInPlace(new t.Vector3(17.7126,17.7126,17.7126).multiplyInPlace(n.multiply(n))),r.subtractInPlace(new t.Vector3(Math.sqrt(o.x),Math.sqrt(o.y),Math.sqrt(o.z))),new t.Vector3(1,1,1).subtract(r.multiply(r))}(i),f=u.multiply(c);f.scaleInPlace(a.transmissionDepth),a.transmissionScatter.set(f.x,f.y,f.z),a.transmissionScatterAnisotropy=s}if(a.subsurfaceWeight>0){a.subsurfaceScatterAnisotropy=s,a.subsurfaceColor=i;var h=new t.Vector3(0!==u.x?1/u.x:1,0!==u.y?1/u.y:1,0!==u.z?1/u.z:1);a.subsurfaceRadius=Math.max(h.x,h.y,h.z),a.subsurfaceRadiusScale=new t.Color3(h.x/a.subsurfaceRadius,h.y/a.subsurfaceRadius,h.z/a.subsurfaceRadius)}return l.then(function(){})},e}();we(xn),Ae(xn,!0,function(e){return new An(e)});var wn={__proto__:null,KHR_materials_volume_scatter:An},Cn="KHR_materials_dispersion",On=function(){function e(e){this.name=Cn,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(Cn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(Cn),Ae(Cn,!0,function(e){return new On(e)});var Mn={__proto__:null,KHR_materials_dispersion:On},En="KHR_materials_diffuse_roughness",Rn=function(){function e(e){this.name=En,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(En)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(En),Ae(En,!0,function(e){return new Rn(e)});var Fn={__proto__:null,KHR_materials_diffuse_roughness:Rn},Ln="KHR_mesh_quantization",Pn=function(){function e(e){this.name=Ln,this.enabled=e.isExtensionUsed(Ln)}return e.prototype.dispose=function(){},e}();we(Ln),Ae(Ln,!0,function(e){return new Pn(e)});var Sn={__proto__:null,KHR_mesh_quantization:Pn},Nn="KHR_texture_basisu",In=function(){function e(e){this.name=Nn,this._loader=e,this.enabled=e.isExtensionUsed(Nn)}return e.prototype.dispose=function(){this._loader=null},e.prototype._loadTextureAsync=function(e,t,n){var r=this;return je.LoadExtensionAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,i;return b(this,function(s){switch(s.label){case 0:return r=null==t.sampler?je.DefaultSampler:He.Get("".concat(e,"/sampler"),this._loader.gltf.samplers,t.sampler),i=He.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}();we(Nn),Ae(Nn,!0,function(e){return new In(e)});var Bn={__proto__:null,KHR_texture_basisu:In},kn="KHR_texture_transform",Gn=function(){function e(e){this.name=kn,this._loader=e,this.enabled=this._loader.isExtensionUsed(kn)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadTextureInfoAsync=function(e,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(a,i){return g(o,void 0,void 0,function(){return b(this,function(o){switch(o.label){case 0:return[4,this._loader.loadTextureInfoAsync(e,n,function(e){if(!(e instanceof t.Texture))throw new Error("".concat(a,": Texture type not supported"));i.offset&&(e.uOffset=i.offset[0],e.vOffset=i.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,i.rotation&&(e.wAng=-i.rotation),i.scale&&(e.uScale=i.scale[0],e.vScale=i.scale[1]),null!=i.texCoord&&(e.coordinatesIndex=i.texCoord),r(e)})];case 1:return[2,o.sent()]}})})})},e}();we(kn),Ae(kn,!0,function(e){return new Gn(e)});var Vn={__proto__:null,KHR_texture_transform:Gn},Dn="KHR_xmp_json_ld",Hn=function(){function e(e){this.name=Dn,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(Dn)}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}();we(Dn),Ae(Dn,!0,function(e){return new Hn(e)});var Kn={__proto__:null,KHR_xmp_json_ld:Hn};function jn(e,n,r,o){return t.Color3.FromArray(n,r).scale(o)}function Un(e,t,n,r){return t[n]*r}function Wn(e,t,n,r){return-t[n]*r}function zn(e,t,n,r){return t[n+1]*r}function qn(e,t,n,r){return t[n]*r*2}function Yn(e){return{scale:[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),Un,function(){return 2}),new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),zn,function(){return 2})],offset:[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),Un,function(){return 2}),new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),zn,function(){return 2})],rotation:[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),Wn,function(){return 1})]}}var Xn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ye),Jn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(Ye),Qn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(t,e),t.prototype.buildAnimations=function(e,t,n,r){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,n,r)}]},t}(Ye),Zn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m(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}(Ye);ke("/cameras/{}/orthographic/xmag",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",Wn,function(){return 1}),new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",zn,function(){return 1})]),ke("/cameras/{}/orthographic/ymag",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",Wn,function(){return 1}),new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",zn,function(){return 1})]),ke("/cameras/{}/orthographic/zfar",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Un,function(){return 1})]),ke("/cameras/{}/orthographic/znear",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"minZ",Un,function(){return 1})]),ke("/cameras/{}/perspective/yfov",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"fov",Un,function(){return 1})]),ke("/cameras/{}/perspective/zfar",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"maxZ",Un,function(){return 1})]),ke("/cameras/{}/perspective/znear",[new Xn(t.Animation.ANIMATIONTYPE_FLOAT,"minZ",Un,function(){return 1})]),ke("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",jn,function(){return 4}),new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"alpha",function(e,t,n,r){return t[n+3]*r},function(){return 4})]),ke("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"metallic",Un,function(){return 1})]),ke("/materials/{}/pbrMetallicRoughness/metallicFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"roughness",Un,function(){return 1})]);var $n=Yn("albedoTexture");ke("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",$n.scale),ke("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",$n.offset),ke("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",$n.rotation);var er=Yn("metallicTexture");ke("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",er.scale),ke("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",er.offset),ke("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",er.rotation),ke("/materials/{}/emissiveFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",jn,function(){return 3})]);var tr=Yn("bumpTexture");ke("/materials/{}/normalTexture/scale",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Un,function(){return 1})]),ke("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",tr.scale),ke("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",tr.offset),ke("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",tr.rotation),ke("/materials/{}/occlusionTexture/strength",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Un,function(){return 1})]);var nr=Yn("ambientTexture");ke("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",nr.scale),ke("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",nr.offset),ke("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",nr.rotation);var rr=Yn("emissiveTexture");ke("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",rr.scale),ke("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",rr.offset),ke("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",rr.rotation),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",Un,function(){return 1})]);var or=Yn("anisotropy.texture");ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",or.scale),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",or.offset),ke("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",or.rotation),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Un,function(){return 1})]);var ar=Yn("clearCoat.texture");ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",ar.scale),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",ar.offset),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",ar.rotation);var ir=Yn("clearCoat.bumpTexture");ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",ir.scale),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",ir.offset),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",ir.rotation);var sr=Yn("clearCoat.textureRoughness");ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",sr.scale),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",sr.offset),ke("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",sr.rotation),ke("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_ior/ior",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Un,function(){return 1})]);var lr=Yn("iridescence.texture");ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",lr.scale),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",lr.offset),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",lr.rotation);var ur=Yn("iridescence.thicknessTexture");ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",ur.scale),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",ur.offset),ke("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",ur.rotation),ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",jn,function(){return 3})]),ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",Un,function(){return 1})]);var cr=Yn("sheen.texture");ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",cr.scale),ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",cr.offset),ke("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",cr.rotation);var fr=Yn("sheen.textureRoughness");ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",fr.scale),ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",fr.offset),ke("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",fr.rotation),ke("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",jn,function(){return 3})]);var hr=Yn("metallicReflectanceTexture");ke("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",hr.scale),ke("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",hr.offset),ke("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",hr.rotation);var dr=Yn("reflectanceTexture");ke("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",dr.scale),ke("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",dr.offset),ke("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",dr.rotation),ke("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Un,function(){return 1})]);var pr=Yn("subSurface.refractionIntensityTexture");ke("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",pr.scale),ke("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",pr.offset),ke("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",pr.rotation),ke("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",jn,function(){return 3})]),ke("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Un,function(){return 1})]),ke("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Un,function(){return 1})]);var mr=Yn("subSurface.thicknessTexture");ke("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",mr.scale),ke("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",mr.offset),ke("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",mr.rotation),ke("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new Jn(t.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",Un,function(){return 1})]);var _r=Yn("subSurface.translucencyIntensityTexture");ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",_r.scale),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",_r.offset),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",_r.rotation),ke("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new Jn(t.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",jn,function(){return 3})]);var gr=Yn("subSurface.translucencyColorTexture");ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",gr.scale),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",gr.offset),ke("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",gr.rotation),ke("/extensions/KHR_lights_punctual/lights/{}/color",[new Qn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",jn,function(){return 3})]),ke("/extensions/KHR_lights_punctual/lights/{}/intensity",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Un,function(){return 1})]),ke("/extensions/KHR_lights_punctual/lights/{}/range",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"range",Un,function(){return 1})]),ke("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",qn,function(){return 1})]),ke("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"angle",qn,function(){return 1})]),ke("/extensions/EXT_lights_area/lights/{}/color",[new Qn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",jn,function(){return 3})]),ke("/extensions/EXT_lights_area/lights/{}/intensity",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Un,function(){return 1})]),ke("/extensions/EXT_lights_area/lights/{}/size",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"radius",Un,function(){return 1})]),ke("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"radius",Un,function(){return 1})]),ke("/nodes/{}/extensions/EXT_lights_ies/color",[new Qn(t.Animation.ANIMATIONTYPE_COLOR3,"diffuse",jn,function(){return 3})]),ke("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new Qn(t.Animation.ANIMATIONTYPE_FLOAT,"intensity",Un,function(){return 1})]),ke("/nodes/{}/extensions/KHR_node_visibility/visible",[new Zn(t.Animation.ANIMATIONTYPE_FLOAT,"isVisible",Un,function(){return 1})]);var br="KHR_animation_pointer",yr=function(){function e(e){this.name=br,this._loader=e,this._pathToObjectConverter=Ie(this._loader.gltf)}return Object.defineProperty(e.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(br)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._loader=null,delete this._pathToObjectConverter},e.prototype._loadAnimationChannelAsync=function(e,n,r,o,a){var i,s=null===(i=o.target.extensions)||void 0===i?void 0:i.KHR_animation_pointer;if(!s||!this._pathToObjectConverter)return null;"pointer"!==o.target.path&&t.Logger.Warn("".concat(e,"/target/path: Value (").concat(o.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=o.target.node&&t.Logger.Warn("".concat(e,"/target/node: Value (").concat(o.target.node,") must not be present when using the ").concat(this.name," extension"));var l="".concat(e,"/extensions/").concat(this.name),u=s.pointer;if(!u)throw new Error("".concat(l,": Pointer is missing"));try{var c=this._pathToObjectConverter.convert(u);if(!c.info.interpolation)throw new Error("".concat(l,"/pointer: Interpolation is missing"));return this._loader._loadAnimationChannelFromTargetInfoAsync(e,n,r,o,{object:c.object,info:c.info.interpolation},a)}catch(e){return t.Logger.Warn("".concat(l,"/pointer: Invalid pointer (").concat(u,") skipped")),null}},e}();we(br),Ae(br,!0,function(e){return new yr(e)});var vr={__proto__:null,KHR_animation_pointer:yr},Tr="MSFT_audio_emitter",xr=function(){function e(e){this.name=Tr,this._loader=e,this.enabled=this._loader.isExtensionUsed(Tr)}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,He.Assign(this._clips),He.Assign(this._emitters)}},e.prototype.loadSceneAsync=function(e,t){var n=this;return je.LoadExtensionAsync(e,t,this.name,function(r,o){return g(n,void 0,void 0,function(){var n,a,i,s,l;return b(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=He.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,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(e,a){return g(o,void 0,void 0,function(){var o,i,s=this;return b(this,function(l){switch(l.label){case 0:return o=new Array,[4,this._loader.loadNodeAsync(e,n,function(n){for(var i=function(r){var a=He.Get("".concat(e,"/emitters"),s._emitters,r);o.push(s._loadEmitterAsync("".concat(e,"/emitters/").concat(a.index),a).then(function(){for(var e=0,r=a._babylonSounds;e<r.length;e++){var o=r[e];o.attachToMesh(n),null==a.innerAngle&&null==a.outerAngle||(o.setLocalDirectionToMesh(t.Vector3.Forward()),o.setDirectionalCone(2*t.Tools.ToDegrees(null==a.innerAngle?Math.PI:a.innerAngle),2*t.Tools.ToDegrees(null==a.outerAngle?Math.PI:a.outerAngle),0))}}))},l=0,u=a.emitters;l<u.length;l++)i(u[l]);r(n)})];case 1:return i=l.sent(),[4,Promise.all(o)];case 2:return l.sent(),[2,i]}})})})},e.prototype.loadAnimationAsync=function(e,t){var n=this;return je.LoadExtensionAsync(e,t,this.name,function(r,o){return g(n,void 0,void 0,function(){var n,a,i,s,l;return b(this,function(u){switch(u.label){case 0:return[4,this._loader.loadAnimationAsync(e,t)];case 1:for(n=u.sent(),a=new Array,He.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,n){if(n._objectURL)return n._objectURL;var r;if(n.uri)r=this._loader.loadUriAsync(e,n,n.uri);else{var o=He.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,n.bufferView);r=this._loader.loadBufferViewAsync("/bufferViews/".concat(o.index),o)}return n._objectURL=r.then(function(e){var r=t.GetBlobBufferSource(e);return URL.createObjectURL(new Blob([r],{type:n.mimeType}))}),n._objectURL},e.prototype._loadEmitterAsync=function(e,n){var r=this;if(n._babylonSounds=n._babylonSounds||[],!n._babylonData){for(var o=new Array,a=n.name||"emitter".concat(n.index),i={loop:!1,autoplay:!1,volume:null==n.volume?1:n.volume},s=function(e){var s="/extensions/".concat(l.name,"/clips"),u=He.Get(s,l._clips,n.clips[e].clip);o.push(l._loadClipAsync("".concat(s,"/").concat(n.clips[e].clip),u).then(function(o){var s=n._babylonSounds[e]=new t.Sound(a,o,r._loader.babylonScene,null,i);s.refDistance=n.refDistance||1,s.maxDistance=n.maxDistance||256,s.rolloffFactor=n.rolloffFactor||1,s.distanceModel=n.distanceModel||"exponential"}))},l=this,u=0;u<n.clips.length;u++)s(u);var c=Promise.all(o).then(function(){var e=n.clips.map(function(e){return e.weight||1}),r=new t.WeightedSound(n.loop||!1,n._babylonSounds,e);n.innerAngle&&(r.directionalConeInnerAngle=2*t.Tools.ToDegrees(n.innerAngle)),n.outerAngle&&(r.directionalConeOuterAngle=2*t.Tools.ToDegrees(n.outerAngle)),n.volume&&(r.volume=n.volume),n._babylonData.sound=r});n._babylonData={loaded:c}}return n._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,n,r,o,a){var i=this;if(0==a.targetedAnimations.length)return Promise.resolve();var s=a.targetedAnimations[0],l=o.emitter,u=He.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,l);return this._loadEmitterAsync(e,u).then(function(){var n=u._babylonData.sound;if(n){var r=new t.AnimationEvent(o.time,i._getEventAction(e,n,o.action,o.time,o.startOffset));s.animation.addEvent(r),a.onAnimationGroupEndObservable.add(function(){n.stop()}),a.onAnimationGroupPauseObservable.add(function(){n.pause()})}})},e}();we(Tr),Ae(Tr,!0,function(e){return new xr(e)});var Ar={__proto__:null,MSFT_audio_emitter:xr},wr="MSFT_lod",Cr=function(){function e(e){var n,r;this.name=wr,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new t.Observable,this.onMaterialLODsLoadedObservable=new t.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!==(r=null===(n=this._loader.parent.extensionOptions[wr])||void 0===n?void 0:n.maxLODsToLoad)&&void 0!==r?r:this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(wr)}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,n,r){var o=this;return je.LoadExtensionAsync(e,n,this.name,function(e,a){return g(o,void 0,void 0,function(){var o,i,s,l,u,c=this;return b(this,function(f){switch(f.label){case 0:for(i=this._getLODs(e,n,this._loader.gltf.nodes,a.ids),this._loader.logOpen("".concat(e)),s=function(e){var n=i[e];0!==e&&(l._nodeIndexLOD=e,l._nodeSignalLODs[e]=l._nodeSignalLODs[e]||new t.Deferred);var a=l._loader.loadNodeAsync("/nodes/".concat(n.index),n,function(e){r(e),e.setEnabled(!1)}).then(function(t){if(0!==e){var n=i[e-1];n._babylonTransformNode&&(c._disposeTransformNode(n._babylonTransformNode),delete n._babylonTransformNode)}return t.setEnabled(!0),t});l._nodePromiseLODs[e]=l._nodePromiseLODs[e]||[],0===e?o=a:(l._nodeIndexLOD=null,l._nodePromiseLODs[e].push(a))},l=this,u=0;u<i.length;u++)s(u);return this._loader.logClose(),[4,o];case 1:return[2,f.sent()]}})})})},e.prototype._loadMaterialAsync=function(e,t,n,r,o){var a=this;return this._nodeIndexLOD?null:je.LoadExtensionAsync(e,t,this.name,function(e,i){return g(a,void 0,void 0,function(){var a,s,l,u,c,f=this;return b(this,function(h){switch(h.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,h.sent()]}})})})},e.prototype._loadUriAsync=function(e,n,r){var o=this;if(null!==this._nodeIndexLOD){this._loader.log("deferred");var a=this._nodeIndexLOD-1;return this._nodeSignalLODs[a]=this._nodeSignalLODs[a]||new t.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then(function(){return g(o,void 0,void 0,function(){return b(this,function(t){switch(t.label){case 0:return[4,this._loader.loadUriAsync(e,n,r)];case 1:return[2,t.sent()]}})})})}return null!==this._materialIndexLOD?(this._loader.log("deferred"),a=this._materialIndexLOD-1,this._materialSignalLODs[a]=this._materialSignalLODs[a]||new t.Deferred,this._materialSignalLODs[a].promise.then(function(){return g(o,void 0,void 0,function(){return b(this,function(t){switch(t.label){case 0:return[4,this._loader.loadUriAsync(e,n,r)];case 1:return[2,t.sent()]}})})})):null},e.prototype.loadBufferAsync=function(e,n,r,o){var a=this;if(this._loader.parent.useRangeRequests&&!n.uri){if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));var i=function(e,n){return g(a,void 0,void 0,function(){var a,i,s;return b(this,function(l){switch(l.label){case 0:return i=(a=r)+o-1,(s=e[n])?(s.start=Math.min(s.start,a),s.end=Math.max(s.end,i)):(s={start:a,end:i,loaded:new t.Deferred},e[n]=s),[4,s.loaded.promise.then(function(e){return new Uint8Array(e.buffer,e.byteOffset+r-s.start,o)})];case 1:return[2,l.sent()]}})})};return this._loader.log("deferred"),null!==this._nodeIndexLOD?i(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?i(this._materialBufferLODs,this._materialIndexLOD):i(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(He.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}();we(wr),Ae(wr,!0,function(e){return new Cr(e)});var Or={__proto__:null,MSFT_lod:Cr},Mr="MSFT_minecraftMesh",Er=function(){function e(e){this.name=Mr,this._loader=e,this.enabled=this._loader.isExtensionUsed(Mr)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtraAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r;return b(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}();we(Mr),Ae(Mr,!0,function(e){return new Er(e)});var Rr={__proto__:null,MSFT_minecraftMesh:Er},Fr="MSFT_sRGBFactors",Lr=function(){function e(e){this.name=Fr,this._loader=e,this.enabled=this._loader.isExtensionUsed(Fr)}return e.prototype.dispose=function(){this._loader=null},e.prototype.loadMaterialPropertiesAsync=function(e,t,n){var r=this;return je.LoadExtraAsync(e,t,this.name,function(o,a){return g(r,void 0,void 0,function(){var r,o,i;return b(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}();we(Fr),Ae(Fr,!0,function(e){return new Lr(e)});var Pr={__proto__:null,MSFT_sRGBFactors:Lr};function Sr(e){var t=e.split(":");return Nr({op:t[0],extension:t[1]})}function Nr(e,n){var r;void 0===n&&(n=!0);var o=e.extension?null===(r=Br[e.extension])||void 0===r?void 0:r[e.op]:kr[e.op];if(!o&&(t.Logger.Warn("No mapping found for operation ".concat(e.op," and extension ").concat(e.extension||"KHR_interactivity")),n)){var a={},i={flows:{}};if(e.inputValueSockets)for(var s in a.values={},e.inputValueSockets)a.values[s]={name:s};return e.outputValueSockets&&(i.values={},Object.keys(e.outputValueSockets).forEach(function(e){i.values[e]={name:e}})),{blocks:[],inputs:a,outputs:i}}return o}function Ir(e,t,n){Br[t]||(Br[t]={}),Br[t][e]=n}var Br={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},kr={"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,n){var r,o;if(!e.configuration)return t.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};var a=e.configuration.event;if(!a)return t.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 i=null===(r=a.value)||void 0===r?void 0:r[0];return"number"!=typeof i?(t.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):(null===(o=n.events)||void 0===o?void 0:o[i])?{valid:!0}:(t.Logger.Error("Event with id ".concat(i," not found")),{valid:!1,error:"Event with id ".concat(i," 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":Gr("FlowGraphEBlock"),"math/Pi":Gr("FlowGraphPIBlock"),"math/Inf":Gr("FlowGraphInfBlock"),"math/NaN":Gr("FlowGraphNaNBlock"),"math/abs":Gr("FlowGraphAbsBlock"),"math/sign":Gr("FlowGraphSignBlock"),"math/trunc":Gr("FlowGraphTruncBlock"),"math/floor":Gr("FlowGraphFloorBlock"),"math/ceil":Gr("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":Gr("FlowGraphFractBlock"),"math/neg":Gr("FlowGraphNegationBlock"),"math/add":Gr("FlowGraphAddBlock",["a","b"],!0),"math/sub":Gr("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?Vr(e):{valid:!0}}},"math/div":Gr("FlowGraphDivideBlock",["a","b"],!0),"math/rem":Gr("FlowGraphModuloBlock",["a","b"]),"math/min":Gr("FlowGraphMinBlock",["a","b"]),"math/max":Gr("FlowGraphMaxBlock",["a","b"]),"math/clamp":Gr("FlowGraphClampBlock",["a","b","c"]),"math/saturate":Gr("FlowGraphSaturateBlock"),"math/mix":Gr("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":Gr("FlowGraphEqualityBlock",["a","b"]),"math/lt":Gr("FlowGraphLessThanBlock",["a","b"]),"math/le":Gr("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":Gr("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":Gr("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":Gr("FlowGraphIsNaNBlock"),"math/isInf":Gr("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":Gr("FlowGraphSinBlock"),"math/cos":Gr("FlowGraphCosBlock"),"math/tan":Gr("FlowGraphTanBlock"),"math/asin":Gr("FlowGraphASinBlock"),"math/acos":Gr("FlowGraphACosBlock"),"math/atan":Gr("FlowGraphATanBlock"),"math/atan2":Gr("FlowGraphATan2Block",["a","b"]),"math/sinh":Gr("FlowGraphSinhBlock"),"math/cosh":Gr("FlowGraphCoshBlock"),"math/tanh":Gr("FlowGraphTanhBlock"),"math/asinh":Gr("FlowGraphASinhBlock"),"math/acosh":Gr("FlowGraphACoshBlock"),"math/atanh":Gr("FlowGraphATanhBlock"),"math/exp":Gr("FlowGraphExponentialBlock"),"math/log":Gr("FlowGraphLogBlock"),"math/log2":Gr("FlowGraphLog2Block"),"math/log10":Gr("FlowGraphLog10Block"),"math/sqrt":Gr("FlowGraphSquareRootBlock"),"math/cbrt":Gr("FlowGraphCubeRootBlock"),"math/pow":Gr("FlowGraphPowerBlock",["a","b"]),"math/length":Gr("FlowGraphLengthBlock"),"math/normalize":Gr("FlowGraphNormalizeBlock"),"math/dot":Gr("FlowGraphDotBlock",["a","b"]),"math/cross":Gr("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":Gr("FlowGraphTransposeBlock"),"math/determinant":Gr("FlowGraphDeterminantBlock"),"math/inverse":Gr("FlowGraphInvertMatrixBlock"),"math/matMul":Gr("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":Gr("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":Gr("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":Gr("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":Gr("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],h=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[h.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],h=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[h.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],h=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[h.uniqueId])||void 0===l?void 0:l.type)&&void 0!==u?u:"FlowGraphInteger",o}},"math/asr":Gr("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":Gr("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":Gr("FlowGraphLeadingZerosBlock"),"math/ctz":Gr("FlowGraphTrailingZerosBlock"),"math/popcnt":Gr("FlowGraphOneBitsCounterBlock"),"math/rad":Gr("FlowGraphDegToRadBlock"),"math/deg":Gr("FlowGraphRadToDegBlock"),"type/boolToInt":Gr("FlowGraphBooleanToInt"),"type/boolToFloat":Gr("FlowGraphBooleanToFloat"),"type/intToBool":Gr("FlowGraphIntToBoolean"),"type/intToFloat":Gr("FlowGraphIntToFloat"),"type/floatToInt":Gr("FlowGraphFloatToInt"),"type/floatToBool":Gr("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 n,r=null===(n=e.configuration)||void 0===n?void 0:n.cases;if(r&&r.value){if(!r.value.every(function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())}))return t.Logger.Warn("Switch cases should be integers. Using empty array instead."),r.value=[],{valid:!0};var o=new Set(r.value);r.value=Array.from(o)}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 n,r;return(null===(r=null===(n=e.configuration)||void 0===n?void 0:n.variable)||void 0===r?void 0:r.value)?{valid:!0}:(t.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,n,r,o,a){var i,s,l,u,c,f,h=a[0],d=null===(s=null===(i=e.configuration)||void 0===i?void 0:i.variable.value)||void 0===s?void 0:s[0];if("number"!=typeof d)throw t.Logger.Error("Variable index is not defined for variable interpolation block"),new Error("Variable index is not defined for variable interpolation block");var p=o.arrays.staticVariables[d];void 0===(null===(u=null===(l=h.config)||void 0===l?void 0:l.animationType)||void 0===u?void 0:u.value)&&(h.config||(h.config={}),(c=h.config).animationType||(c.animationType={}),h.config.animationType.value=t.getAnimationTypeByFlowGraphType(p.type));var m=a[4];return m.config||(m.config={}),(f=m.config).variable||(f.variable={}),m.config.variable.value=o.getVariableName(d),a}},"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 n,r=null===(n=e.configuration)||void 0===n?void 0:n.cases;if(r&&r.value){if(!r.value.every(function(e){return"number"==typeof e&&/^-?\d+$/.test(e.toString())}))return t.Logger.Warn("Switch cases should be integers. Using empty array instead."),r.value=[],{valid:!0};var o=new Set(r.value);r.value=Array.from(o)}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 Gr(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?Vr(e):{valid:!0}}}}function Vr(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 Dr(){return Object.keys(kr)}var Hr={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"}},Kr=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(Hr[n.signature])}},e.prototype._parseDeclarations=function(){if(this._interactivityGraph.declarations)for(var e=0,n=this._interactivityGraph.declarations;e<n.length;e++){var r=n[e],o=Nr(r);if(!o)throw t.Logger.Error(["No mapping found for declaration",r]),new Error("Error parsing declarations");this._mappings.push({flowGraphMapping:o,fullOperationName:r.extension?r.op+":"+r.extension:r.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,n){var r=this._types[e.type];if(!r)throw t.Logger.Error(["No type found for variable",e]),new Error("Error parsing variables");if(e.value&&e.value.length!==r.length)throw t.Logger.Error(["Invalid value length for variable",e,r]),new Error("Error parsing variables");var o=e.value||[];if(!o.length)switch(r.flowGraphType){case"boolean":o.push(!1);break;case"FlowGraphInteger":o.push(0);break;case"number":o.push(NaN);break;case"Vector2":o.push(NaN,NaN);break;case"Vector3":o.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":o.fill(NaN,0,4);break;case"Matrix":o.fill(NaN,0,16);break;case"Matrix3D":o.fill(NaN,0,9)}return"number"===r.elementType&&"string"==typeof o[0]&&(o[0]=parseFloat(o[0])),{type:r.flowGraphType,value:n?n(o,this):o}},e.prototype._parseEvents=function(){var e=this;if(this._interactivityGraph.events)for(var n=function(n){var o={eventId:n.id||"internalEvent_"+r._internalEventsCounter++};n.values&&(o.eventData=Object.keys(n.values).map(function(r){var o,a=null===(o=n.values)||void 0===o?void 0:o[r];if(!a)throw t.Logger.Error(["No value found for event key",r]),new Error("Error parsing events");var i=e._types[a.type];if(!i)throw t.Logger.Error(["No type found for event value",a]),new Error("Error parsing events");var s=void 0!==a.value?e._parseVariable(a):void 0;return{id:r,type:i.flowGraphType,eventData:!0,value:s}})),r._events.push(o)},r=this,o=0,a=this._interactivityGraph.events;o<a.length;o++)n(a[o])},e.prototype._parseNodes=function(){var e;if(this._interactivityGraph.nodes)for(var n=0,r=this._interactivityGraph.nodes;n<r.length;n++){var o=r[n];if("number"!=typeof o.declaration)throw t.Logger.Error(["No declaration found for node",o]),new Error("Error parsing nodes");var a=this._mappings[o.declaration];if(!a)throw t.Logger.Error(["No mapping found for node",o]),new Error("Error parsing nodes");if(a.flowGraphMapping.validation){var i=a.flowGraphMapping.validation(o,this._interactivityGraph,this._gltf);if(!i.valid)throw new Error("Error validating interactivity node ".concat(null===(e=this._interactivityGraph.declarations)||void 0===e?void 0:e[o.declaration].op," - ").concat(i.error))}for(var s=[],l=0,u=a.flowGraphMapping.blocks;l<u.length;l++){var c=u[l],f=this._getEmptyBlock(c,a.fullOperationName);this._parseNodeConfiguration(o,f,a.flowGraphMapping,c),s.push(f)}this._nodes.push({blocks:s,fullOperationName:a.fullOperationName})}},e.prototype._getEmptyBlock=function(e,n){return{uniqueId:t.RandomGUID(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:n,metadata:{}}},e.prototype._parseNodeConfiguration=function(e,n,r,o){var a,i=e.configuration;if(i)for(var s in i){var l=i[s];if(!l)throw new Error("Error parsing node configuration");var u=null===(a=r.configuration)||void 0===a?void 0:a[s];if(u&&u.toBlock?u.toBlock===o:0===r.blocks.indexOf(o)){var c=null==u?void 0:u.defaultValue;(null==l?void 0:l.value)&&(c=l.value),(null==u?void 0:u.isArray)||(1!==c.length&&t.Logger.Warn("Invalid non-array value length: ".concat(c.length)),c=c[0]),(null==u?void 0:u.dataTransformer)&&(c=u.dataTransformer(c,this)),void 0!==c&&(n.config[(null==u?void 0:u.name)||s]={value:c})}}},e.prototype._parseNodeConnections=function(e){for(var n,r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,b,y,v,T=0;T<this._nodes.length;T++){var x=null===(n=this._interactivityGraph.nodes)||void 0===n?void 0:n[T];if(!x)throw t.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 t.Logger.Error(["No mapping found for node",x]),new Error("Error parsing node connections");for(var C=x.flows||{},O=Object.keys(C).sort(),M=function(e){var n=C[e],c=null===(o=null===(r=w.flowGraphMapping.outputs)||void 0===r?void 0:r.flows)||void 0===o?void 0:o[e],f=(null==c?void 0:c.name)||e,h=E._createNewSocketConnection(f,!0);(c&&c.toBlock&&A.blocks.find(function(e){return e.className===c.toBlock})||A.blocks[0]).signalOutputs.push(h);var d=n.node,p=E._nodes[d];if(!p)throw t.Logger.Error(["No node found for input node id",d]),new Error("Error parsing node connections");var m=Sr(p.fullOperationName);if(!m)throw t.Logger.Error(["No mapping found for input node",p]),new Error("Error parsing node connections");var _=null===(i=null===(a=m.inputs)||void 0===a?void 0:a.flows)||void 0===i?void 0:i[n.socket||"in"],g=!1;if(!_)for(var b in null===(s=m.inputs)||void 0===s?void 0:s.flows)b.startsWith("[")&&b.endsWith("]")&&(g=!0,_=null===(u=null===(l=m.inputs)||void 0===l?void 0:l.flows)||void 0===u?void 0:u[b]);var y=_?g?_.name.replace("$1",n.socket||""):_.name:n.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=E._createNewSocketConnection(y),v.signalInputs.push(T)),T.connectedPointIds.push(h.uniqueId),h.connectedPointIds.push(T.uniqueId)},E=this,R=0,F=O;R<F.length;R++)M(F[R]);for(var L=x.values||{},P=Object.keys(L),S=function(n){var r=L[n],o=null===(f=null===(c=w.flowGraphMapping.inputs)||void 0===c?void 0:c.values)||void 0===f?void 0:f[n],a=!1;if(!o)for(var i in null===(h=w.flowGraphMapping.inputs)||void 0===h?void 0:h.values)i.startsWith("[")&&i.endsWith("]")&&(a=!0,o=null===(p=null===(d=w.flowGraphMapping.inputs)||void 0===d?void 0:d.values)||void 0===p?void 0:p[i]);var s=o?a?o.name.replace("$1",n):o.name:n,l=N._createNewSocketConnection(s);if((o&&o.toBlock&&A.blocks.find(function(e){return e.className===o.toBlock})||A.blocks[0]).dataInputs.push(l),void 0!==r.value){var u=N._parseVariable(r,o&&o.dataTransformer);e._connectionValues[l.uniqueId]=u}else{if(void 0===r.node)throw t.Logger.Error(["Invalid value for value connection",r]),new Error("Error parsing node connections");var v=r.node,T=r.socket||"value",x=N._nodes[v];if(!x)throw t.Logger.Error(["No node found for output socket reference",r]),new Error("Error parsing node connections");var C=Sr(x.fullOperationName);if(!C)throw t.Logger.Error(["No mapping found for output socket reference",r]),new Error("Error parsing node connections");var O=null===(_=null===(m=C.outputs)||void 0===m?void 0:m.values)||void 0===_?void 0:_[T],M=!1;if(!O)for(var i in null===(g=C.outputs)||void 0===g?void 0:g.values)i.startsWith("[")&&i.endsWith("]")&&(M=!0,O=null===(y=null===(b=C.outputs)||void 0===b?void 0:b.values)||void 0===y?void 0:y[i]);var E=O?M?O.name.replace("$1",T):null==O?void 0:O.name:T,R=O&&O.toBlock&&x.blocks.find(function(e){return e.className===O.toBlock})||x.blocks[0],F=R.dataOutputs.find(function(e){return e.name===E});F||(F=N._createNewSocketConnection(E,!0),R.dataOutputs.push(F)),l.connectedPointIds.push(F.uniqueId),F.connectedPointIds.push(l.uniqueId)}},N=this,I=0,B=P;I<B.length;I++)S(B[I]);if(w.flowGraphMapping.interBlockConnectors)for(var k=0,G=w.flowGraphMapping.interBlockConnectors;k<G.length;k++){var V=G[k],D=V.input,H=V.output,K=V.isVariable;this._connectFlowGraphNodes(D,H,A.blocks[V.inputBlockIndex],A.blocks[V.outputBlockIndex],K)}if(w.flowGraphMapping.extraProcessor){var j=null===(v=this._interactivityGraph.declarations)||void 0===v?void 0:v[x.declaration];if(!j)throw t.Logger.Error(["No declaration found for extra processor",x]),new Error("Error parsing node connections");A.blocks=w.flowGraphMapping.extraProcessor(x,j,w.flowGraphMapping,this,A.blocks,e,this._gltf)}}},e.prototype._createNewSocketConnection=function(e,n){return{uniqueId:t.RandomGUID(),name:e,_connectionType:n?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:t.RandomGUID(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(var n=0;n<this._staticVariables.length;n++){var r=this._staticVariables[n];e._userVariables[this.getVariableName(n)]=r}return{rightHanded:!0,allBlocks:this._nodes.reduce(function(e,t){return e.concat(t.blocks)},[]),executionContexts:[e]}},e}(),jr="KHR_interactivity",Ur=function(){function e(e){this._loader=e,this.name=jr,this.enabled=this._loader.isExtensionUsed(jr),this._pathConverter=Ie(this._loader.gltf),e._skipStartAnimationStep=!0;var t=e.babylonScene;t&&Wr(t)}return e.prototype.dispose=function(){this._loader=null,delete this._pathConverter},e.prototype.onReady=function(){return g(this,void 0,void 0,function(){var e,n,r,o,a,i=this;return b(this,function(s){switch(s.label){case 0:return this._loader.babylonScene&&this._pathConverter?(e=this._loader.babylonScene,(n=null===(a=this._loader.gltf.extensions)||void 0===a?void 0:a.KHR_interactivity)?((r=new t.FlowGraphCoordinator({scene:e})).dispatchEventsSynchronously=!1,o=n.graphs.map(function(e){return new Kr(e,i._loader.gltf,i._loader.parent.targetFps).serializeToFlowGraph()}),[4,Promise.all(o.map(function(e){return g(i,void 0,void 0,function(){return b(this,function(n){switch(n.label){case 0:return[4,t.ParseFlowGraphAsync(e,{coordinator:r,pathConverter:this._pathConverter})];case 1:return[2,n.sent()]}})})}))]):[2]):[2];case 1:return s.sent(),r.start(),[2]}})})},e}();function Wr(e){Ge("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:function(){if(!e.activeCamera)return new t.Quaternion(NaN,NaN,NaN,NaN);var n=t.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(n.w*=-1,n.x*=-1),n},type:"Quaternion",getTarget:function(){return e.activeCamera}}),Ge("/extensions/KHR_interactivity/?/activeCamera/position",{get:function(){if(!e.activeCamera)return new t.Vector3(NaN,NaN,NaN);var n=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(n.x*=-1),n},type:"Vector3",getTarget:function(){return e.activeCamera}}),Ge("/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}}),Ge("/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}}),Ge("/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}}),Ge("/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}}),Ge("/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}})}t.addToBlockFactory(jr,"FlowGraphGLTFDataProvider",function(){return g(void 0,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return lo})];case 1:return[2,e.sent().FlowGraphGLTFDataProvider]}})})}),we(jr),Ae(jr,!0,function(e){return new Ur(e)});var zr={__proto__:null,KHR_interactivity:Ur,_AddInteractivityObjectModel:Wr},qr="KHR_node_visibility";Ge("/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 Yr=function(){function e(e){this.name=qr,this._loader=e,this.enabled=e.isExtensionUsed(qr)}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}();we(qr),Ae(qr,!0,function(e){return new Yr(e)});var Xr={__proto__:null,KHR_node_visibility:Yr},Jr="KHR_node_selectability";Ir("event/onSelect",Jr,{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,h,d,p=o[o.length-1];p.config=p.config||{},p.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===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),Ge("/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 Qr=function(){function e(e){this.name=Jr,this._loader=e,this.enabled=e.isExtensionUsed(Jr)}return e.prototype.onReady=function(){return g(this,void 0,void 0,function(){var e;return b(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}();we(Jr),Ae(Jr,!0,function(e){return new Qr(e)});var Zr={__proto__:null,KHR_node_selectability:Qr},$r="KHR_node_hoverability",eo="targetMeshPointerOver_";Ir("event/onHoverIn",$r,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return eo+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,h,d,p=o[o.length-1];p.config=p.config||{},p.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 _=eo+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===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}});var to="targetMeshPointerOut_";Ir("event/onHoverOut",$r,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:function(e){return to+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,h,d,p=o[o.length-1];p.config=p.config||{},p.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 _=to+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===(h=null==i?void 0:i.nodes)||void 0===h?void 0:h[m]._babylonTransformNode)||void 0===d?void 0:d.uniqueId},o}}),Ge("/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 no=function(){function e(e){this.name=$r,this._loader=e,this.enabled=e.isExtensionUsed($r)}return e.prototype.onReady=function(){return g(this,void 0,void 0,function(){var e;return b(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}();we($r),Ae($r,!0,function(e){return new no(e)});var ro={__proto__:null,KHR_node_hoverability:no},oo="ExtrasAsMetadata",ao=function(){function e(e){this.name=oo,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}();we(oo),Ae(oo,!1,function(e){return new ao(e)});var io={__proto__:null,ExtrasAsMetadata:ao},so=function(e){function n(n){var r,o,a=e.call(this,n)||this,i=n.glTF,s=(null===(r=null==i?void 0:i.animations)||void 0===r?void 0:r.map(function(e){return e._babylonAnimationGroup}))||[];a.animationGroups=a.registerDataOutput("animationGroups",t.RichTypeAny,s);var l=(null===(o=null==i?void 0:i.nodes)||void 0===o?void 0:o.map(function(e){return e._babylonTransformNode}))||[];return a.nodes=a.registerDataOutput("nodes",t.RichTypeAny,l),a}return m(n,e),n.prototype.getClassName=function(){return"FlowGraphGLTFDataProvider"},n}(t.FlowGraphBlock),lo={__proto__:null,FlowGraphGLTFDataProvider:so},uo={__proto__:null,AddObjectAccessorToKey:Ge,EXT_lights_area:Mt,EXT_lights_ies:bt,EXT_lights_image_based:rt,EXT_mesh_gpu_instancing:it,EXT_meshopt_compression:ut,EXT_texture_avif:mt,EXT_texture_webp:ht,ExtrasAsMetadata:ao,FlowGraphGLTFDataProvider:so,GetMappingForKey:Be,GetPathToObjectConverter:Ie,InteractivityGraphToFlowGraphParser:Kr,KHR_animation_pointer:yr,KHR_draco_mesh_compression:Tt,KHR_interactivity:Ur,KHR_lights:wt,KHR_materials_anisotropy:Wt,KHR_materials_clearcoat:Bt,KHR_materials_coat:Vt,KHR_materials_diffuse_roughness:Rn,KHR_materials_diffuse_transmission:gn,KHR_materials_dispersion:On,KHR_materials_emissive_strength:Yt,KHR_materials_fuzz:en,KHR_materials_ior:sn,KHR_materials_iridescence:Kt,KHR_materials_pbrSpecularGlossiness:Ft,KHR_materials_sheen:Qt,KHR_materials_specular:rn,KHR_materials_transmission:pn,KHR_materials_unlit:St,KHR_materials_variants:cn,KHR_materials_volume:vn,KHR_materials_volume_scatter:An,KHR_mesh_quantization:Pn,KHR_node_hoverability:no,KHR_node_selectability:Qr,KHR_node_visibility:Yr,KHR_texture_basisu:In,KHR_texture_transform:Gn,KHR_xmp_json_ld:Hn,MSFT_audio_emitter:xr,MSFT_lod:Cr,MSFT_minecraftMesh:Er,MSFT_sRGBFactors:Lr,SetInterpolationForKey:ke,_AddInteractivityObjectModel:Wr,addNewInteractivityFlowGraphMapping:Ir,getAllSupportedNativeNodeTypes:Dr,getMappingForDeclaration:Nr,getMappingForFullOperationName:Sr,gltfTypeToBabylonType:Hr},co={__proto__:null,AddObjectAccessorToKey:Ge,AnimationPropertyInfo:Ye,ArrayItem:He,EXT_lights_area:Mt,EXT_lights_ies:bt,EXT_lights_image_based:rt,EXT_mesh_gpu_instancing:it,EXT_meshopt_compression:ut,EXT_texture_avif:mt,EXT_texture_webp:ht,ExtrasAsMetadata:ao,FlowGraphGLTFDataProvider:so,GLTFFileLoader:k,GLTFLoader:je,GetMappingForKey:Be,GetPathToObjectConverter:Ie,InteractivityGraphToFlowGraphParser:Kr,KHR_animation_pointer:yr,KHR_draco_mesh_compression:Tt,KHR_interactivity:Ur,KHR_lights:wt,KHR_materials_anisotropy:Wt,KHR_materials_clearcoat:Bt,KHR_materials_coat:Vt,KHR_materials_diffuse_roughness:Rn,KHR_materials_diffuse_transmission:gn,KHR_materials_dispersion:On,KHR_materials_emissive_strength:Yt,KHR_materials_fuzz:en,KHR_materials_ior:sn,KHR_materials_iridescence:Kt,KHR_materials_pbrSpecularGlossiness:Ft,KHR_materials_sheen:Qt,KHR_materials_specular:rn,KHR_materials_transmission:pn,KHR_materials_unlit:St,KHR_materials_variants:cn,KHR_materials_volume:vn,KHR_materials_volume_scatter:An,KHR_mesh_quantization:Pn,KHR_node_hoverability:no,KHR_node_selectability:Qr,KHR_node_visibility:Yr,KHR_texture_basisu:In,KHR_texture_transform:Gn,KHR_xmp_json_ld:Hn,LoadBoundingInfoFromPositionAccessor:Ke,MSFT_audio_emitter:xr,MSFT_lod:Cr,MSFT_minecraftMesh:Er,MSFT_sRGBFactors:Lr,OpenPBRMaterialLoadingAdapter:Ze,PBRMaterialLoadingAdapter:et,SetInterpolationForKey:ke,TransformNodeAnimationPropertyInfo:Xe,WeightAnimationPropertyInfo:Je,_AddInteractivityObjectModel:Wr,addNewInteractivityFlowGraphMapping:Ir,getAllSupportedNativeNodeTypes:Dr,getMappingForDeclaration:Nr,getMappingForFullOperationName:Sr,getQuaternion:ze,getVector3:We,getWeights:qe,gltfTypeToBabylonType:Hr,registerGLTFExtension:Ae,registeredGLTFExtensions:xe,unregisterGLTFExtension:we},fo=function(){function e(){this.materials=[]}return e.prototype.parseMTL=function(n,r,o,a){if(!(r instanceof ArrayBuffer)){for(var i,s=r.split("\n"),l=/\s+/,u=null,c=0;c<s.length;c++){var f=s[c].trim();if(0!==f.length&&"#"!==f.charAt(0)){var h=f.indexOf(" "),d=h>=0?f.substring(0,h):f;d=d.toLowerCase();var p=h>=0?f.substring(h+1).trim():"";if("newmtl"===d)u&&this.materials.push(u),n._blockEntityCollection=!!a,(u=new t.StandardMaterial(p,n))._parentContainer=a,n._blockEntityCollection=!1;else if("kd"===d&&u)i=p.split(l,3).map(parseFloat),u.diffuseColor=t.Color3.FromArray(i);else if("ka"===d&&u)i=p.split(l,3).map(parseFloat),u.ambientColor=t.Color3.FromArray(i);else if("ks"===d&&u)i=p.split(l,3).map(parseFloat),u.specularColor=t.Color3.FromArray(i);else if("ke"===d&&u)i=p.split(l,3).map(parseFloat),u.emissiveColor=t.Color3.FromArray(i);else if("ns"===d&&u)u.specularPower=parseFloat(p);else if("d"===d&&u)u.alpha=parseFloat(p);else if("map_ka"===d&&u)u.ambientTexture=e._GetTexture(o,p,n);else if("map_kd"===d&&u)u.diffuseTexture=e._GetTexture(o,p,n);else if("map_ks"===d&&u)u.specularTexture=e._GetTexture(o,p,n);else if("map_ns"===d);else if("map_bump"===d&&u){var m=p.split(l),_=m.indexOf("-bm"),g=null;_>=0&&(g=m[_+1],m.splice(_,2)),u.bumpTexture=e._GetTexture(o,m.join(" "),n),u.bumpTexture&&null!==g&&(u.bumpTexture.level=parseFloat(g))}else"map_d"===d&&u&&(u.opacityTexture=e._GetTexture(o,p,n))}}u&&this.materials.push(u)}},e._GetTexture=function(n,r,o){if(!r)return null;var a=n;if("file:"===n){var i=r.lastIndexOf("\\");-1===i&&(i=r.lastIndexOf("/")),a+=i>-1?r.substring(i+1):r}else a+=r;return new t.Texture(a,o,!1,e.INVERT_TEXTURE_Y)},e.INVERT_TEXTURE_Y=!0,e}(),ho=function(){function e(e,n,r){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._extColors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new t.Color4(.5,.5,.5,1),this._hasLineData=!1,this._materialToUse=e,this._babylonMeshesArray=n,this._loadingOptions=r}return e.prototype._isInArray=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[]});var n=e[t[0]].normals.indexOf(t[1]);return-1===n?-1:e[t[0]].idx[n]},e.prototype._isInArrayUV=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[],uv:[]});var n=e[t[0]].normals.indexOf(t[1]);return 1!=n&&t[2]===e[t[0]].uv[n]?e[t[0]].idx[n]:-1},e.prototype._setData=function(e){var t,n,r;null!==(t=e.indiceUvsFromObj)&&void 0!==t||(e.indiceUvsFromObj=-1),null!==(n=e.indiceNormalFromObj)&&void 0!==n||(e.indiceNormalFromObj=-1),-1===(r=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj,e.indiceUvsFromObj]):this._isInArray(this._tuplePosNorm,[e.indicePositionFromObj,e.indiceNormalFromObj]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(e.positionVectorFromOBJ),void 0!==e.textureVectorFromOBJ&&this._wrappedUvsForBabylon.push(e.textureVectorFromOBJ),void 0!==e.normalsVectorFromOBJ&&this._wrappedNormalsForBabylon.push(e.normalsVectorFromOBJ),void 0!==e.positionColorsFromOBJ&&this._wrappedColorsForBabylon.push(e.positionColorsFromOBJ),this._tuplePosNorm[e.indicePositionFromObj].normals.push(e.indiceNormalFromObj),this._tuplePosNorm[e.indicePositionFromObj].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[e.indicePositionFromObj].uv.push(e.indiceUvsFromObj)):this._indicesForBabylon.push(r)},e.prototype._unwrapData=function(){try{for(var e=0;e<this._wrappedPositionForBabylon.length;e++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[e].x*this._handednessSign,this._wrappedPositionForBabylon[e].y,this._wrappedPositionForBabylon[e].z),this._wrappedNormalsForBabylon.length&&this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[e].x*this._handednessSign,this._wrappedNormalsForBabylon[e].y,this._wrappedNormalsForBabylon[e].z),this._wrappedUvsForBabylon.length&&this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[e].x,this._wrappedUvsForBabylon[e].y),this._wrappedColorsForBabylon.length&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[e].r,this._wrappedColorsForBabylon[e].g,this._wrappedColorsForBabylon[e].b,this._wrappedColorsForBabylon[e].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0}catch(e){throw new Error("Unable to unwrap data while parsing OBJ data.",{cause:e})}},e.prototype._getTriangles=function(e,t){for(var n=t;n<e.length-1;n++)this._pushTriangle(e,n)},e.prototype._getColor=function(e){var t;return this._loadingOptions.importVertexColors?null!==(t=this._extColors[e])&&void 0!==t?t:this._colors[e]:void 0},e.prototype._setDataForCurrentFaceWithPattern1=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=parseInt(this._triangles[n])-1;this._setData({indicePositionFromObj:r,positionVectorFromOBJ:this._positions[r],positionColorsFromOBJ:this._getColor(r)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern2=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern3=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=parseInt(r[0])-1,a=parseInt(r[1])-1,i=parseInt(r[2])-1;this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i]})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern4=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("//"),o=parseInt(r[0])-1,a=parseInt(r[1])-1;this._setData({indicePositionFromObj:o,indiceNormalFromObj:a,positionVectorFromOBJ:this._positions[o],normalsVectorFromOBJ:this._normals[a],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._setDataForCurrentFaceWithPattern5=function(e,t){this._getTriangles(e,t);for(var n=0;n<this._triangles.length;n++){var r=this._triangles[n].split("/"),o=this._positions.length+parseInt(r[0]),a=this._uvs.length+parseInt(r[1]),i=this._normals.length+parseInt(r[2]);this._setData({indicePositionFromObj:o,indiceUvsFromObj:a,indiceNormalFromObj:i,positionVectorFromOBJ:this._positions[o],textureVectorFromOBJ:this._uvs[a],normalsVectorFromOBJ:this._normals[i],positionColorsFromOBJ:this._getColor(o)})}this._triangles.length=0},e.prototype._addPreviousObjMesh=function(){this._meshesFromObj.length>0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice()),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon.slice()),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._handledMesh.hasLines=this._hasLineData,this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0,this._hasLineData=!1)},e.prototype._optimizeNormals=function(e){var n=e.getVerticesData(t.VertexBuffer.PositionKind),r=e.getVerticesData(t.VertexBuffer.NormalKind),o={};if(n&&r){for(var a=0;a<n.length/3;a++)(l=o[s=n[3*a+0]+"_"+n[3*a+1]+"_"+n[3*a+2]])||(l=[],o[s]=l),l.push(a);var i=new t.Vector3;for(var s in o){var l;if(!((l=o[s]).length<2)){var u=l[0];for(a=1;a<l.length;++a){var c=l[a];r[3*u+0]+=r[3*c+0],r[3*u+1]+=r[3*c+1],r[3*u+2]+=r[3*c+2]}for(i.copyFromFloats(r[3*u+0],r[3*u+1],r[3*u+2]),i.normalize(),a=0;a<l.length;++a)r[3*(c=l[a])+0]=i.x,r[3*c+1]=i.y,r[3*c+2]=i.z}}e.setVerticesData(t.VertexBuffer.NormalKind,r)}},e._IsLineElement=function(e){return e.startsWith("l")},e._IsObjectElement=function(e){return e.startsWith("o")},e._IsGroupElement=function(e){return e.startsWith("g")},e._GetZbrushMRGB=function(e,n){if(!e.startsWith("mrgb"))return null;if(e=e.replace("mrgb","").trim(),n)return[];var r=e.match(/[a-z0-9]/g);if(!r||r.length%8!=0)return[];for(var o=[],a=0;a<r.length/8;a++){var i=r[8*a+2]+r[8*a+3],s=r[8*a+4]+r[8*a+5],l=r[8*a+6]+r[8*a+7];o.push(new t.Color4(parseInt(i,16)/255,parseInt(s,16)/255,parseInt(l,16)/255,1))}return o},e.prototype.parse=function(n,r,o,a,i){var s,l,u=this;r=(r=r.replace(/#MRGB/g,"mrgb")).replace(/#.*$/gm,"").trim(),this._loadingOptions.useLegacyBehavior?(this._pushTriangle=function(e,t){return u._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=1):o.useRightHandedSystem?(this._pushTriangle=function(e,t){return u._triangles.push(e[0],e[t+1],e[t])},this._handednessSign=1):(this._pushTriangle=function(e,t){return u._triangles.push(e[0],e[t],e[t+1])},this._handednessSign=-1);var c=r.split("\n"),f=[],h=[];f.push(h);for(var d=0;d<c.length;d++)if(0!==(g=c[d].trim().replace(/\s\s/g," ")).length&&"#"!==g.charAt(0))if((e._IsGroupElement(g)||e._IsObjectElement(g))&&(h=[],f.push(h)),e._IsLineElement(g))for(var p=g.split(" "),m=1;m<p.length-1;m++)h.push("l ".concat(p[m]," ").concat(p[m+1]));else h.push(g);var _=f.flat();for(d=0;d<_.length;d++){var g,b=void 0;if(0!==(g=_[d].trim().replace(/\s\s/g," ")).length&&"#"!==g.charAt(0))if(e.VertexPattern.test(g)){if(b=g.match(/[^ ]+/g),this._positions.push(new t.Vector3(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3]))),this._loadingOptions.importVertexColors)if(b.length>=7){var y=parseFloat(b[4]),v=parseFloat(b[5]),T=parseFloat(b[6]);this._colors.push(new t.Color4(y>1?y/255:y,v>1?v/255:v,T>1?T/255:T,7===b.length||void 0===b[7]?1:parseFloat(b[7])))}else this._colors.push(this._grayColor)}else if(null!==(b=e.NormalPattern.exec(g)))this._normals.push(new t.Vector3(parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3])));else if(null!==(b=e.UVPattern.exec(g)))this._uvs.push(new t.Vector2(parseFloat(b[1])*this._loadingOptions.UVScaling.x,parseFloat(b[2])*this._loadingOptions.UVScaling.y));else if(null!==(b=e.FacePattern3.exec(g)))this._setDataForCurrentFaceWithPattern3(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern4.exec(g)))this._setDataForCurrentFaceWithPattern4(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern5.exec(g)))this._setDataForCurrentFaceWithPattern5(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern2.exec(g)))this._setDataForCurrentFaceWithPattern2(b[1].trim().split(" "),1);else if(null!==(b=e.FacePattern1.exec(g)))this._setDataForCurrentFaceWithPattern1(b[1].trim().split(" "),1);else if(null!==(b=e.LinePattern1.exec(g)))this._setDataForCurrentFaceWithPattern1(b[1].trim().split(" "),0),this._hasLineData=!0;else if(null!==(b=e.LinePattern2.exec(g)))this._setDataForCurrentFaceWithPattern2(b[1].trim().split(" "),0),this._hasLineData=!0;else if(b=e._GetZbrushMRGB(g,!this._loadingOptions.importVertexColors))for(var x=0,A=b;x<A.length;x++){var w=A[x];this._extColors.push(w)}else if(null!==(b=e.LinePattern3.exec(g)))this._setDataForCurrentFaceWithPattern3(b[1].trim().split(" "),0),this._hasLineData=!0;else if(e.GroupDescriptor.test(g)||e.ObjectDescriptor.test(g)){var C={name:g.substring(2).trim(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:e.ObjectDescriptor.test(g)};this._addPreviousObjMesh(),this._meshesFromObj.push(C),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else e.UseMtlDescriptor.test(g)?(this._materialNameFromObj=g.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),C={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:null,positions:null,normals:null,uvs:null,colors:null,materialName:this._materialNameFromObj,isObject:!1},this._increment++,this._meshesFromObj.push(C),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):e.MtlLibGroupDescriptor.test(g)?i(g.substring(7).trim()):e.SmoothDescriptor.test(g)||t.Logger.Log("Unhandled expression at line : "+g)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._unwrappedNormalsForBabylon.length&&(this._handledMesh.normals=this._unwrappedNormalsForBabylon),this._unwrappedUVForBabylon.length&&(this._handledMesh.uvs=this._unwrappedUVForBabylon),this._unwrappedColorsForBabylon.length&&(this._handledMesh.colors=this._unwrappedColorsForBabylon),this._handledMesh.hasLines=this._hasLineData),!this._hasMeshes){var O=null;if(this._indicesForBabylon.length)this._loadingOptions.useLegacyBehavior&&this._indicesForBabylon.reverse(),this._unwrapData();else{for(var M=0,E=this._positions;M<E.length;M++){var R=E[M];this._unwrappedPositionsForBabylon.push(R.x,R.y,R.z)}if(this._normals.length)for(var F=0,L=this._normals;F<L.length;F++){var P=L[F];this._unwrappedNormalsForBabylon.push(P.x,P.y,P.z)}if(this._uvs.length)for(var S=0,N=this._uvs;S<N.length;S++){var I=N[S];this._unwrappedUVForBabylon.push(I.x,I.y)}if(this._extColors.length)for(var B=0,k=this._extColors;B<k.length;B++){var G=k[B];this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a)}else if(this._colors.length)for(var V=0,D=this._colors;V<D.length;V++)G=D[V],this._unwrappedColorsForBabylon.push(G.r,G.g,G.b,G.a);this._materialNameFromObj||((O=new t.StandardMaterial(t.Geometry.RandomId(),o)).pointsCloud=!0,this._materialNameFromObj=O.name,this._normals.length||(O.disableLighting=!0,O.emissiveColor=t.Color3.White()))}this._meshesFromObj.push({name:t.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:O,isObject:!0,hasLines:this._hasLineData})}for(var H=0;H<this._meshesFromObj.length;H++){if(n&&this._meshesFromObj[H].name)if(n instanceof Array){if(-1===n.indexOf(this._meshesFromObj[H].name))continue}else if(this._meshesFromObj[H].name!==n)continue;this._handledMesh=this._meshesFromObj[H],o._blockEntityCollection=!!a;var K=new t.Mesh(this._meshesFromObj[H].name,o);if(K._parentContainer=a,o._blockEntityCollection=!1,this._handledMesh._babylonMesh=K,!this._handledMesh.isObject)for(var j=H-1;j>=0;--j)if(this._meshesFromObj[j].isObject&&this._meshesFromObj[j]._babylonMesh){K.parent=this._meshesFromObj[j]._babylonMesh;break}if(this._materialToUse.push(this._meshesFromObj[H].materialName),this._handledMesh.hasLines&&(null!==(s=K._internalMetadata)&&void 0!==s||(K._internalMetadata={}),K._internalMetadata._isLine=!0),0!==(null===(l=this._handledMesh.positions)||void 0===l?void 0:l.length)){var U=new t.VertexData;if(U.indices=this._handledMesh.indices,U.positions=this._handledMesh.positions,this._loadingOptions.computeNormals||!this._handledMesh.normals){var W=new Array;t.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,W),U.normals=W}else U.normals=this._handledMesh.normals;this._handledMesh.uvs&&(U.uvs=this._handledMesh.uvs),this._handledMesh.colors&&(U.colors=this._handledMesh.colors),U.applyToMesh(K),this._loadingOptions.invertY&&(K.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(K),this._babylonMeshesArray.push(K),this._handledMesh.directMaterial&&(K.material=this._handledMesh.directMaterial)}else this._babylonMeshesArray.push(K)}},e.ObjectDescriptor=/^o/,e.GroupDescriptor=/^g/,e.MtlLibGroupDescriptor=/^mtllib /,e.UseMtlDescriptor=/^usemtl /,e.SmoothDescriptor=/^s /,e.VertexPattern=/^v(\s+[\d|.|+|\-|e|E]+){3,7}/,e.NormalPattern=/^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.UVPattern=/^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,e.FacePattern1=/^f\s+(([\d]{1,}[\s]?){3,})+/,e.FacePattern2=/^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern3=/^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern4=/^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,e.FacePattern5=/^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,e.LinePattern1=/^l\s+(([\d]{1,}[\s]?){2,})+/,e.LinePattern2=/^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e.LinePattern3=/^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/,e}(),po={name:"obj",extensions:".obj"},mo=function(){function e(t){this.name=po.name,this.extensions=po.extensions,this._assetContainer=null,this._loadingOptions=_(_({},e._DefaultLoadingOptions),null!=t?t:{})}return Object.defineProperty(e,"INVERT_TEXTURE_Y",{get:function(){return fo.INVERT_TEXTURE_Y},set:function(e){fo.INVERT_TEXTURE_Y=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"_DefaultLoadingOptions",{get:function(){return{computeNormals:e.COMPUTE_NORMALS,optimizeNormals:e.OPTIMIZE_NORMALS,importVertexColors:e.IMPORT_VERTEX_COLORS,invertY:e.INVERT_Y,invertTextureY:e.INVERT_TEXTURE_Y,UVScaling:e.UV_SCALING,materialLoadingFailsSilently:e.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:e.OPTIMIZE_WITH_UV,skipMaterials:e.SKIP_MATERIALS,useLegacyBehavior:e.USE_LEGACY_BEHAVIOR}},enumerable:!1,configurable:!0}),e.prototype._loadMTL=function(e,n,r,o){var a=n+e;t.Tools.LoadFile(a,r,void 0,void 0,!1,function(e,t){o(a,t)})},e.prototype.createPlugin=function(t){return new e(t[po.name])},e.prototype.canDirectLoad=function(){return!1},e.prototype.importMeshAsync=function(e,t,n,r){return this._parseSolidAsync(e,t,n,r).then(function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}})},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then(function(){})},e.prototype.loadAssetContainerAsync=function(e,n,r){var o=this,a=new t.AssetContainer(e);return this._assetContainer=a,this.importMeshAsync(null,e,n,r).then(function(e){return e.meshes.forEach(function(e){return a.meshes.push(e)}),e.meshes.forEach(function(e){var t=e.material;t&&-1==a.materials.indexOf(t)&&(a.materials.push(t),t.getActiveTextures().forEach(function(e){-1==a.textures.indexOf(e)&&a.textures.push(e)}))}),o._assetContainer=null,a}).catch(function(e){throw o._assetContainer=null,e})},e.prototype._parseSolidAsync=function(e,n,r,o){var a=this,i="",s=new fo,l=[],u=[];r=r.replace(/#.*$/gm,"").trim(),new ho(l,u,this._loadingOptions).parse(e,r,n,this._assetContainer,function(e){i=e});var c=[];return""===i||this._loadingOptions.skipMaterials||c.push(new Promise(function(e,r){a._loadMTL(i,o,function(c){try{s.parseMTL(n,c,o,a._assetContainer);for(var f=0;f<s.materials.length;f++){for(var h=0,d=[],p=void 0;(p=l.indexOf(s.materials[f].name,h))>-1;)d.push(p),h=p+1;if(-1===p&&0===d.length)s.materials[f].dispose();else for(var m=0;m<d.length;m++){var _=u[d[m]],g=s.materials[f];_.material=g,_.getTotalIndices()||(g.pointsCloud=!0)}}e()}catch(n){t.Tools.Warn("Error processing MTL file: '".concat(i,"'")),a._loadingOptions.materialLoadingFailsSilently?e():r(n)}},function(n,o){t.Tools.Warn("Error downloading MTL file: '".concat(i,"'")),a._loadingOptions.materialLoadingFailsSilently?e():r(o)})})),Promise.all(c).then(function(){var e=function(e){var t,n;return Boolean(null!==(n=null===(t=e._internalMetadata)||void 0===t?void 0:t._isLine)&&void 0!==n&&n)};return u.forEach(function(r){var o,a;if(e(r)){var i=null!==(o=r.material)&&void 0!==o?o:new t.StandardMaterial(r.name+"_line",n);i.getBindedMeshes().filter(function(t){return!e(t)}).length>0&&(i=null!==(a=i.clone(i.name+"_line"))&&void 0!==a?a:i),i.wireframe=!0,r.material=i,r._internalMetadata&&(r._internalMetadata._isLine=void 0)}}),u})},e.OPTIMIZE_WITH_UV=!0,e.INVERT_Y=!1,e.IMPORT_VERTEX_COLORS=!1,e.COMPUTE_NORMALS=!1,e.OPTIMIZE_NORMALS=!1,e.UV_SCALING=new t.Vector2(1,1),e.SKIP_MATERIALS=!1,e.MATERIAL_LOADING_FAILS_SILENTLY=!0,e.USE_LEGACY_BEHAVIOR=!1,e}();t.RegisterSceneLoaderPlugin(new mo);var _o={__proto__:null,OBJFileLoader:mo},go={__proto__:null,MTLFileLoader:fo,OBJFileLoader:mo,SolidParser:ho},bo={name:"stl",extensions:{".stl":{isBinary:!0}}},yo=function(){function e(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name=bo.name,this.extensions=bo.extensions}return e.prototype.importMesh=function(e,n,r,o,a){var i;if("string"!=typeof r){if(this._isBinary(r)){var s=new t.Mesh("stlmesh",n);return this._parseBinary(s,r),a&&a.push(s),!0}r=(new TextDecoder).decode(new Uint8Array(r))}for(;i=this.solidPattern.exec(r);){var l=i[1],u=i[3];if(u&&l!=u)return t.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(e&&l)if(e instanceof Array){if(!e.indexOf(l))continue}else if(l!==e)continue;l=l||"stlmesh",s=new t.Mesh(l,n),this._parseASCII(s,i[2]),a&&a.push(s)}return!0},e.prototype.load=function(e,t,n){return this.importMesh(null,e,t,n,null)},e.prototype.loadAssetContainer=function(e,n,r){var o=new t.AssetContainer(e);return e._blockEntityCollection=!0,this.importMesh(null,e,n,r,o.meshes),e._blockEntityCollection=!1,o},e.prototype._isBinary=function(e){var t=new DataView(e);if(t.byteLength<=80)return!1;if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var n=[115,111,108,105,100],r=0;r<5;r++)if(t.getUint8(r)!==n[r])return!0;return!1},e.prototype._parseBinary=function(n,r){for(var o=new DataView(r),a=o.getUint32(80,!0),i=0,s=new Float32Array(3*a*3),l=new Float32Array(3*a*3),u=new Uint32Array(3*a),c=0,f=0;f<a;f++){for(var h=84+50*f,d=o.getFloat32(h,!0),p=o.getFloat32(h+4,!0),m=o.getFloat32(h+8,!0),_=1;_<=3;_++){var g=h+12*_;s[i]=o.getFloat32(g,!0),l[i]=d,e.DO_NOT_ALTER_FILE_COORDINATES?(s[i+1]=o.getFloat32(g+4,!0),s[i+2]=o.getFloat32(g+8,!0),l[i+1]=p,l[i+2]=m):(s[i+2]=o.getFloat32(g+4,!0),s[i+1]=o.getFloat32(g+8,!0),l[i+2]=p,l[i+1]=m),i+=3}e.DO_NOT_ALTER_FILE_COORDINATES?(u[c]=c,u[c+1]=c+2,u[c+2]=c+1,c+=3):(u[c]=c++,u[c]=c++,u[c]=c++)}n.setVerticesData(t.VertexBuffer.PositionKind,s),n.setVerticesData(t.VertexBuffer.NormalKind,l),n.setIndices(u),n.computeWorldMatrix(!0)},e.prototype._parseASCII=function(n,r){for(var o,a=[],i=[],s=[],l=0;o=this.facetsPattern.exec(r);){var u=o[1],c=this.normalPattern.exec(u);if(this.normalPattern.lastIndex=0,c){for(var f=[Number(c[1]),Number(c[5]),Number(c[3])],h=void 0;h=this.vertexPattern.exec(u);)e.DO_NOT_ALTER_FILE_COORDINATES?(a.push(Number(h[1]),Number(h[3]),Number(h[5])),i.push(f[0],f[2],f[1])):(a.push(Number(h[1]),Number(h[5]),Number(h[3])),i.push(f[0],f[1],f[2]));e.DO_NOT_ALTER_FILE_COORDINATES?(s.push(l,l+2,l+1),l+=3):s.push(l++,l++,l++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,n.setVerticesData(t.VertexBuffer.PositionKind,a),n.setVerticesData(t.VertexBuffer.NormalKind,i),n.setIndices(s),n.computeWorldMatrix(!0)},e.DO_NOT_ALTER_FILE_COORDINATES=!1,e}();t.RegisterSceneLoaderPlugin(new yo);var vo={__proto__:null,STLFileLoader:yo},To={__proto__:null,STLFileLoader:yo},xo={name:"splat",extensions:{".splat":{isBinary:!0},".ply":{isBinary:!0},".spz":{isBinary:!0},".json":{isBinary:!1},".sog":{isBinary:!0}}},Ao=.28209479177387814,wo=null,Co=null;function Oo(e,t,n){var r,o,a,i,s,l,u,c,f,h,d,p,m,_,g,y,v,T,x,A,w,C,O,M,E,R,F,L,P,S,N,I,B,k,G,V,D,H,K,j,U,W,z,q,Y,X;return void 0===n&&(n=!1),b(this,function(b){switch(b.label){case 0:if(r=e.numPoints,o=new ArrayBuffer(32*r),a=new Float32Array(o),i=new Uint8Array(o),s=e.positions,l=e.scales,u=e.colors,c=e.alphas,f=e.rotations,h=null,d=e.shDegree,p=null,m=0,_=null,g=null,y=null,d>0&&e.sh.length>0){for(m=3*((d+1)*(d+1)-1),v=Math.ceil(m/16),T=t.getEngine(),x=T.getCaps().maxTextureSize,A=Math.ceil(r/x),h=[],G=0;G<v;G++)h.push(new Uint8Array(A*x*4*4));for(_=new Int32Array(v),g=new Int32Array(v),G=0;G<v;G++)_[G]=16*G,g[G]=Math.min(16*(G+1),m);y=h,p=e.sh}w=0,b.label=1;case 1:if(!(w<r))return[3,4];if(O=32*w,M=3*w,E=4*w,a[0+(C=8*w)]=s[M+0],a[C+1]=s[M+1],a[C+2]=s[M+2],a[C+3]=Math.exp(l[M+0]),a[C+4]=Math.exp(l[M+1]),a[C+5]=Math.exp(l[M+2]),R=255*(.5+Ao*u[M+0]),F=255*(.5+Ao*u[M+1]),L=255*(.5+Ao*u[M+2]),i[O+24]=R<=0?0:R>=255?255:R+.5|0,i[O+25]=F<=0?0:F>=255?255:F+.5|0,i[O+26]=L<=0?0:L>=255?255:L+.5|0,i[O+27]=1/(1+Math.exp(-c[w]))*255+.5|0,P=127.5*f[E+3]+127.5,S=127.5*f[E+0]+127.5,N=127.5*f[E+1]+127.5,I=127.5*f[E+2]+127.5,i[O+28]=P<=0?0:P>=255?255:P+.5|0,i[O+29]=S<=0?0:S>=255?255:S+.5|0,i[O+30]=N<=0?0:N>=255?255:N+.5|0,i[O+31]=I<=0?0:I>=255?255:I+.5|0,p&&y&&_&&g)for(B=w*m,k=16*w,G=0;G<y.length;G++)for(V=y[G],D=_[G],H=g[G],K=D;K<H;K++)j=128*p[B+K]+128,V[k+K-D]=j<=0?0:j>=255?255:j+.5|0;return w%32768==0&&n?[4]:[3,3];case 2:b.sent(),b.label=3;case 3:return w++,[3,1];case 4:if(e.extensions)for(z=0,q=e.extensions;z<q.length;z++)if(Y=q[z],void 0!==(X=Y).safeOrbitRadiusMin){U=X.safeOrbitRadiusMin,W=[X.safeOrbitElevationMin,X.safeOrbitElevationMax];break}return[2,{mode:0,data:o,hasVertexColors:!1,sh:null!==h?h:void 0,shDegree:d>0?d:void 0,trainedWithAntialiasing:!!e.antialiased,safeOrbitCameraRadiusMin:U,safeOrbitCameraElevationMinMax:W}]}})}var Mo=.28209479177387814;function Eo(e,t,n){return g(this,void 0,void 0,function(){return b(this,function(r){switch(r.label){case 0:return[4,new Promise(function(r,o){var a,i=n.createCanvasImage();if(!i)throw new Error("Failed to create ImageBitmap");if(i.onload=function(){try{var e=n.createCanvas(i.width,i.height);if(!e)throw new Error("Failed to create canvas");var t=e.getContext("2d");if(!t)throw new Error("Failed to get 2D context");t.drawImage(i,0,0);var a=t.getImageData(0,0,e.width,e.height);r({bits:new Uint8Array(a.data.buffer),width:a.width})}catch(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))}},i.onerror=function(e){o("Error loading image ".concat(i.src," with exception: ").concat(e))},i.crossOrigin="anonymous","string"==typeof e){if(!t)throw new Error("filename is required when using a URL");i.src=e+t}else{var s=new Blob([e],{type:"image/webp"});a=URL.createObjectURL(s),i.src=a}})];case 1:return[2,r.sent()]}})})}function Ro(e,n,r){return g(this,void 0,void 0,function(){var o,a,i,s,l,u,c,f,h,d,p,m,_,g,y,v,T,x,A,w,C,O,M,E,R,F,L,P,S,N,I,B,k,G,V,D,H,K,j,U,W,z,q,Y,X,J,Q,Z,$,ee,te,ne,re,oe,ae,ie,se,le,ue,ce,fe,he,de,pe;return b(this,function(b){switch(b.label){case 0:if(o=e.count?e.count:e.means.shape[0],a=new ArrayBuffer(32*o),i=new Float32Array(a),s=new Float32Array(a),l=new Uint8ClampedArray(a),u=new Uint8ClampedArray(a),c=function(e){return Math.sign(e)*(Math.exp(Math.abs(e))-1)},f=n[0].bits,h=n[1].bits,!Array.isArray(e.means.mins)||!Array.isArray(e.means.maxs))throw new Error("Missing arrays in SOG data.");for(te=0;te<o;te++)for(C=4*te,se=0;se<3;se++)d=e.means.mins[se],p=e.means.maxs[se],m=h[C+se],_=f[C+se],K=m<<8|_,ne=t.Scalar.Lerp(d,p,K/65535),i[8*te+se]=c(ne);if(g=n[2].bits,2===e.version){if(!e.scales.codebook)throw new Error("Missing codebook in SOG version 2 scales data.");for(te=0;te<o;te++)for(C=4*te,se=0;se<3;se++)v=e.scales.codebook[g[C+se]],y=Math.exp(v),s[8*te+3+se]=y}else{if(!Array.isArray(e.scales.mins)||!Array.isArray(e.scales.maxs))throw new Error("Missing arrays in SOG scales data.");for(te=0;te<o;te++)for(C=4*te,se=0;se<3;se++)v=g[C+se],T=t.Scalar.Lerp(e.scales.mins[se],e.scales.maxs[se],v/255),x=Math.exp(T),s[8*te+3+se]=x}if(A=n[4].bits,2===e.version){if(!e.sh0.codebook)throw new Error("Missing codebook in SOG version 2 sh0 data.");for(te=0;te<o;te++){for(C=4*te,se=0;se<3;se++)w=.5+e.sh0.codebook[A[C+se]]*Mo,l[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*w)));l[32*te+24+3]=A[C+3]}}else{if(!Array.isArray(e.sh0.mins)||!Array.isArray(e.sh0.maxs))throw new Error("Missing arrays in SOG sh0 data.");for(te=0;te<o;te++)for(C=4*te,se=0;se<4;se++)O=e.sh0.mins[se],M=e.sh0.maxs[se],E=A[C+se],G=t.Scalar.Lerp(O,M,E/255),void 0,R=se<3?.5+G*Mo:1/(1+Math.exp(-G)),l[32*te+24+se]=Math.max(0,Math.min(255,Math.round(255*R)))}for(F=function(e){return 2*(e/255-.5)/Math.SQRT2},L=n[3].bits,te=0;te<o;te++){switch(P=L[4*te+0],S=L[4*te+1],N=L[4*te+2],I=L[4*te+3],B=F(P),k=F(S),G=F(N),V=I-252,D=B*B+k*k+G*G,H=Math.sqrt(Math.max(0,1-D)),K=void 0,V){case 0:K=[H,B,k,G];break;case 1:K=[B,H,k,G];break;case 2:K=[B,k,H,G];break;case 3:K=[B,k,G,H];break;default:throw new Error("Invalid quaternion mode")}u[32*te+28+0]=127.5*K[0]+127.5,u[32*te+28+1]=127.5*K[1]+127.5,u[32*te+28+2]=127.5*K[2]+127.5,u[32*te+28+3]=127.5*K[3]+127.5}if(!e.shN)return[3,2];for(j=e.shN.bands?Math.pow(e.shN.bands+1,2)-1:e.shN.shape[1]/3,U=void 0!==e.shN.bands&&null!==e.shN.bands?e.shN.bands:Math.round(Math.sqrt(j+1)-1),W=n[5].bits,z=n[6].bits,q=n[5].width,Y=3*j,X=Math.ceil(Y/16),J=[],Q=r.getEngine(),Z=Q.getCaps().maxTextureSize,$=Math.ceil(o/Z),ce=0;ce<X;ce++)ee=new Uint8Array($*Z*4*4),J.push(ee);if(2===e.version){if(!e.shN.codebook)throw new Error("Missing codebook in SOG version 2 shN data.");for(te=0;te<o;te++)for(ne=z[4*te+0]+(z[4*te+1]<<8),re=ne%64*j,oe=Math.floor(ne/64),le=0;le<j;le++)for(se=0;se<3;se++)ue=3*le+se,ce=Math.floor(ue/16),fe=J[ce],he=ue%16,de=16*te,pe=127.5*e.shN.codebook[W[4*(re+le)+se+oe*q*4]]+127.5,fe[he+de]=Math.max(0,Math.min(255,pe))}else for(te=0;te<o;te++)for(ne=z[4*te+0]+(z[4*te+1]<<8),re=ne%64*j,oe=Math.floor(ne/64),ae=e.shN.mins,ie=e.shN.maxs,se=0;se<3;se++)for(le=0;le<j/3;le++)ue=3*le+se,ce=Math.floor(ue/16),fe=J[ce],he=ue%16,de=16*te,pe=127.5*t.Scalar.Lerp(ae,ie,W[4*(re+le)+se+oe*q*4]/255)+127.5,fe[he+de]=Math.max(0,Math.min(255,pe));return[4,new Promise(function(e){e({mode:0,data:a,hasVertexColors:!1,sh:J,shDegree:U})})];case 1:case 3:return[2,b.sent()];case 2:return[4,new Promise(function(e){e({mode:0,data:a,hasVertexColors:!1})})]}})})}function Fo(e,t,n){return g(this,void 0,void 0,function(){var r,o,a,i,s,l=this;return b(this,function(u){switch(u.label){case 0:if(e instanceof Map){if(!(a=(o=e).get("meta.json")))throw new Error("meta.json not found in files Map");r=JSON.parse((new TextDecoder).decode(a))}else r=e;return i=y(y(y(y([],r.means.files,!0),r.scales.files,!0),r.quats.files,!0),r.sh0.files,!0),r.shN&&i.push.apply(i,r.shN.files),[4,Promise.all(i.map(function(e){return g(l,void 0,void 0,function(){return b(this,function(r){switch(r.label){case 0:return o&&o.has(e)?[4,Eo(o.get(e),e,n.getEngine())]:[3,2];case 1:case 3:return[2,r.sent()];case 2:return[4,Eo(t,e,n.getEngine())]}})})}))];case 1:return s=u.sent(),[4,Ro(r,s,n)];case 2:return[2,u.sent()]}})})}var Lo=function(){function e(t){void 0===t&&(t={}),this.name=xo.name,this._assetContainer=null,this.extensions=xo.extensions,this._loadingOptions=_(_({},e._DefaultLoadingOptions),t)}return e.prototype.createPlugin=function(t){return new e(t[xo.name])},e.prototype.importMeshAsync=function(e,t,n,r,o,a){return g(this,void 0,void 0,function(){return b(this,function(o){switch(o.label){case 0:return[4,this._parseAsync(e,t,n,r).then(function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[],spriteManagers:[]}})];case 1:return[2,o.sent()]}})})},e._BuildPointCloud=function(e,n){if(!n.byteLength)return!1;var r=new Uint8Array(n),o=new Float32Array(n),a=r.length/32;return e.addPoints(a,function(e,n){var a=o[8*n+0],i=o[8*n+1],s=o[8*n+2];e.position=new t.Vector3(a,i,s);var l=r[32*n+24+0]/255,u=r[32*n+24+1]/255,c=r[32*n+24+2]/255;e.color=new t.Color4(l,u,c,1)}),!0},e._BuildMesh=function(e,n){for(var r=new t.Mesh("PLYMesh",e),o=new Uint8Array(n.data),a=new Float32Array(n.data),i=o.length/32,s=[],l=new t.VertexData,u=0;u<i;u++){var c=a[8*u+0],f=a[8*u+1],h=a[8*u+2];s.push(c,f,h)}if(n.hasVertexColors){var d=new Float32Array(4*i);for(u=0;u<i;u++){var p=o[32*u+24+0]/255,m=o[32*u+24+1]/255,_=o[32*u+24+2]/255;d[4*u+0]=p,d[4*u+1]=m,d[4*u+2]=_,d[4*u+3]=1}l.colors=d}return l.positions=s,l.indices=n.faces,l.applyToMesh(r),r},e.prototype._unzipWithFFlateAsync=function(e){return g(this,void 0,void 0,function(){var n,r,o,a,i,s,l,u,c,f;return b(this,function(h){switch(h.label){case 0:return(n=this._loadingOptions.fflate)?[3,3]:void 0!==window.fflate?[3,2]:[4,t.Tools.LoadScriptAsync(null!==(f=this._loadingOptions.deflateURL)&&void 0!==f?f:"https://unpkg.com/fflate/umd/index.js")];case 1:h.sent(),h.label=2;case 2:n=window.fflate,h.label=3;case 3:for(r=n.unzipSync,o=r(e),a=new Map,i=0,s=Object.entries(o);i<s.length;i++)l=s[i],u=l[0],c=l[1],a.set(u,c);return[2,a]}})})},e.prototype._parseAsync=function(n,r,o,a){var i=this,s=[],l=function(e){var n;r._blockEntityCollection=!!i._assetContainer;var o=null!==(n=i._loadingOptions.gaussianSplattingMesh)&&void 0!==n?n:new t.GaussianSplattingMesh("GaussianSplatting",null,r,i._loadingOptions.keepInRam,i._loadingOptions.needsRotationScaleTextures);o._parentContainer=i._assetContainer,s.push(o),o.updateData(e.data,e.sh,{flipY:!1},void 0,e.shDegree),o.scaling.y*=-1,o.computeWorldMatrix(!0),r._blockEntityCollection=!1};if("string"==typeof o){var u=JSON.parse(o);if(u&&u.means&&u.scales&&u.quats&&u.sh0)return new Promise(function(e){Fo(u,a,r).then(function(t){l(t),e(s)}).catch(function(){throw new Error("Failed to parse SOG data.")})})}var c=o instanceof ArrayBuffer?new Uint8Array(o):o;if(80===c[0]&&75===c[1])return new Promise(function(e){i._unzipWithFFlateAsync(c).then(function(t){Fo(t,a,r).then(function(t){l(t),e(s)}).catch(function(){throw new Error("Failed to parse SOG zip data.")})})});var f=function(n){e._ConvertPLYToSplat(o).then(function(o){return g(i,void 0,void 0,function(){var a,i,l;return b(this,function(u){switch(u.label){case 0:switch(r._blockEntityCollection=!!this._assetContainer,o.mode){case 0:return[3,1];case 1:return[3,2];case 2:return[3,6]}return[3,7];case 1:switch((a=null!==(l=this._loadingOptions.gaussianSplattingMesh)&&void 0!==l?l:new t.GaussianSplattingMesh("GaussianSplatting",null,r,this._loadingOptions.keepInRam,this._loadingOptions.needsRotationScaleTextures))._parentContainer=this._assetContainer,s.push(a),a.updateData(o.data,o.sh,{flipY:!1},void 0,o.shDegree),a.scaling.y*=-1,"RightHanded"===o.chirality&&(a.scaling.y*=-1),o.upAxis){case"X":a.rotation=new t.Vector3(0,0,Math.PI/2);break;case"Y":a.rotation=new t.Vector3(0,0,Math.PI);break;case"Z":a.rotation=new t.Vector3(-Math.PI/2,Math.PI,0)}return a.computeWorldMatrix(!0),[3,8];case 2:return i=new t.PointsCloudSystem("PointCloud",1,r),e._BuildPointCloud(i,o.data)?[4,i.buildMeshAsync().then(function(e){s.push(e)})]:[3,4];case 3:return u.sent(),[3,5];case 4:i.dispose(),u.label=5;case 5:return[3,8];case 6:if(!o.faces)throw new Error("PLY mesh doesn't contain face informations.");return s.push(e._BuildMesh(r,o)),[3,8];case 7:throw new Error("Unsupported Splat mode");case 8:return r._blockEntityCollection=!1,this.applyAutoCameraLimits(o,r),n(s),[2]}})})})};if(31!==c[0]||139!==c[1])return new Promise(function(e){f(e)});var h=function(e,n){var o;r._blockEntityCollection=!!i._assetContainer;var a=null!==(o=i._loadingOptions.gaussianSplattingMesh)&&void 0!==o?o:new t.GaussianSplattingMesh("GaussianSplatting",null,r,i._loadingOptions.keepInRam,i._loadingOptions.needsRotationScaleTextures);if(e.trainedWithAntialiasing){var l=a.material;l.kernelSize=.1,l.compensation=!0}a._parentContainer=i._assetContainer,s.push(a),a.updateData(e.data,e.sh,{flipY:!1},void 0,e.shDegree),i._loadingOptions.flipY||(a.scaling.y*=-1,a.computeWorldMatrix(!0)),r._blockEntityCollection=!1,i.applyAutoCameraLimits(e,r),n(s)};if(this._loadingOptions.spzLibraryUrl)return function(e){return g(this,void 0,void 0,function(){var n;return b(this,function(r){switch(r.label){case 0:return wo&&Co===e?[4,wo]:[3,2];case 1:case 3:return[2,r.sent()];case 2:return n=t._LoadScriptModuleAsync("import createSpzModule from '".concat(e,"';\n const module = await createSpzModule();\n const returnedValue = module;")),Co=e,wo=n,[4,n]}})})}(this._loadingOptions.spzLibraryUrl).then(function(e){return function(e,n){return g(this,void 0,void 0,function(){return b(this,function(r){switch(r.label){case 0:return[4,t.runCoroutineAsync(Oo(e,n,!0),t.createYieldingScheduler())];case 1:return[2,r.sent()]}})})}(e.loadSpzFromBuffer(new Uint8Array(o),{to:e.CoordinateSystem.RUB}),r).then(function(e){return new Promise(function(t){h(e,t)})})});var d=new ReadableStream({start:function(e){e.enqueue(new Uint8Array(o)),e.close()}}),p=new DecompressionStream("gzip"),m=d.pipeThrough(p);return new Promise(function(e){new Response(m).arrayBuffer().then(function(n){(function(e,n){var r=new Uint8Array(e),o=new Uint32Array(e.slice(0,12)),a=o[2],i=r[12],s=r[13],l=r[14],u=r[15],c=o[1];if(u||1347635022!=o[0]||c<2||c>4)return new Promise(function(e){e({mode:3,data:new ArrayBuffer(0),hasVertexColors:!1})});for(var f=new ArrayBuffer(32*a),h=1/(1<<s),d=new Int32Array(1),p=new Uint8Array(d.buffer),m=function(e,t){return p[0]=e[t+0],p[1]=e[t+1],p[2]=e[t+2],p[3]=128&e[t+2]?255:0,d[0]*h},_=16,g=new Float32Array(f),b=new Float32Array(f),y=new Uint8ClampedArray(f),v=new Uint8ClampedArray(f),T=0;T<a;T++)g[8*T+0]=m(r,_+0),g[8*T+1]=m(r,_+3),g[8*T+2]=m(r,_+6),_+=9;for(T=0;T<a;T++){for(var x=0;x<3;x++){var A=(r[_+a+3*T+x]-127.5)/38.25;y[32*T+24+x]=t.Scalar.Clamp(255*(.5+Ao*A),0,255)}y[32*T+24+3]=r[_+T]}for(_+=4*a,T=0;T<a;T++)b[8*T+3+0]=Math.exp(r[_+0]/16-10),b[8*T+3+1]=Math.exp(r[_+1]/16-10),b[8*T+3+2]=Math.exp(r[_+2]/16-10),_+=3;if(c>=3){var w=Math.SQRT1_2;for(T=0;T<a;T++){for(var C=[r[_+0],r[_+1],r[_+2],r[_+3]],O=C[0]+(C[1]<<8)+(C[2]<<16)+(C[3]<<24),M=[],E=O>>>30,R=O,F=0,L=3;L>=0;--L)if(L!==E){var P=511&R,S=R>>>9&1;R>>>=10,M[L]=w*(P/511),1===S&&(M[L]=-M[L]),F+=M[L]*M[L]}var N=1-F;M[E]=Math.sqrt(Math.max(N,0));for(var I=[3,0,1,2],B=0;B<4;B++)v[32*T+28+B]=Math.round(127.5+127.5*M[I[B]]);_+=4}}else for(T=0;T<a;T++){var k=r[_+0],G=r[_+1],V=r[_+2],D=k/127.5-1,H=G/127.5-1,K=V/127.5-1;v[32*T+28+1]=k,v[32*T+28+2]=G,v[32*T+28+3]=V;var j=1-(D*D+H*H+K*K);v[32*T+28+0]=127.5+127.5*Math.sqrt(j<0?0:j),_+=3}if(i){for(var U=3*((i+1)*(i+1)-1),W=Math.ceil(U/16),z=_,q=[],Y=n.getEngine().getCaps().maxTextureSize,X=Math.ceil(a/Y),J=0;J<W;J++){var Q=new Uint8Array(X*Y*4*4);q.push(Q)}for(T=0;T<a;T++)for(var Z=0;Z<U;Z++){var $=r[z++];J=Math.floor(Z/16),q[J][Z%16+16*T]=$}return new Promise(function(e){e({mode:0,data:f,hasVertexColors:!1,sh:q,shDegree:i,trainedWithAntialiasing:!!l})})}return new Promise(function(e){e({mode:0,data:f,hasVertexColors:!1,trainedWithAntialiasing:!!l})})})(n,r,i._loadingOptions).then(function(t){h(t,e)})}).catch(function(){f(e)})})},e.prototype.applyAutoCameraLimits=function(e,t){var n;if(!this._loadingOptions.disableAutoCameraLimits&&(void 0!==e.safeOrbitCameraRadiusMin||void 0!==e.safeOrbitCameraElevationMinMax)&&"ArcRotateCamera"===(null===(n=t.activeCamera)||void 0===n?void 0:n.getClassName())){var r=t.activeCamera;e.safeOrbitCameraElevationMinMax&&(r.lowerBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[1],r.upperBetaLimit=.5*Math.PI-e.safeOrbitCameraElevationMinMax[0]),e.safeOrbitCameraRadiusMin&&(r.lowerRadiusLimit=e.safeOrbitCameraRadiusMin)}},e.prototype.loadAssetContainerAsync=function(e,n,r){var o=this,a=new t.AssetContainer(e);return this._assetContainer=a,this.importMeshAsync(null,e,n,r).then(function(e){for(var t=0,n=e.meshes;t<n.length;t++){var r=n[t];a.meshes.push(r)}return o._assetContainer=null,a}).catch(function(e){throw o._assetContainer=null,e})},e.prototype.loadAsync=function(e,t,n){return this.importMeshAsync(null,e,t,n).then(function(){})},e._ConvertPLYToSplat=function(e){var n=this,r=new Uint8Array(e),o=(new TextDecoder).decode(r.slice(0,10240)),a=o.indexOf("end_header\n");if(a<0||!o)return new Promise(function(t){t({mode:0,data:e,rawSplat:!0})});var i=parseInt(/element vertex (\d+)\n/.exec(o)[1]),s=/element face (\d+)\n/.exec(o),l=0;s&&(l=parseInt(s[1]));var u=/element chunk (\d+)\n/.exec(o),c=0;u&&(c=parseInt(u[1]));for(var f=0,h=0,d={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0},p=1,m=[],y=[],v=o.slice(0,a).split("\n"),T={},x=0,A=v;x<A.length;x++){var w=A[x];if(w.startsWith("property ")){var C=w.split(" "),O=C[1],M=C[2];if(1==p)y.push({name:M,type:O,offset:h}),h+=d[O];else if(0==p)m.push({name:M,type:O,offset:f}),f+=d[O];else if(2==p)m.push({name:M,type:O,offset:f});else if(3==p){var E=new DataView(e,h,2*d.float);T.safeOrbitCameraElevationMinMax=[E.getFloat32(0,!0),E.getFloat32(4,!0)]}else 4==p?(E=new DataView(e,h,d.float),T.safeOrbitCameraRadiusMin=E.getFloat32(0,!0)):5==p&&(E=new DataView(e,h,d.uchar),"up_axis"==M?T.upAxis=0==E.getUint8(0)?"X":1==E.getUint8(0)?"Y":"Z":"chirality"==M&&(T.chirality=0==E.getUint8(0)?"LeftHanded":"RightHanded"));d[O]||t.Logger.Warn("Unsupported property type: ".concat(O,"."))}else w.startsWith("element ")&&("chunk"==(O=w.split(" ")[1])?p=1:"vertex"==O?p=0:"sh"==O?p=2:"safe_orbit_camera_elevation_min_max_radians"==O?p=3:"safe_orbit_camera_radius_min"==O?p=4:"up_axis"!=O&&"chirality"!=O||(p=5))}var R=f,F=h;return t.GaussianSplattingMesh.ConvertPLYWithSHToSplatAsync(e).then(function(t){return g(n,void 0,void 0,function(){var n,r,o,s,u,f,h,d,p,g,y,v,x,A,w;return b(this,function(b){switch(b.label){case 0:if(n=new DataView(e,a+11),r=F*c+R*i,o=[],l)for(s=0;s<l;s++)if(3==(u=n.getUint8(r))){for(r+=1,f=0;f<u;f++)h=n.getUint32(r+4*(2-f),!0),o.push(h);r+=12}return c?[4,new Promise(function(e){e({mode:0,data:t.buffer,sh:t.sh,shDegree:t.shDegree,faces:o,hasVertexColors:!1,compressed:!0,rawSplat:!1})})]:[3,2];case 1:case 3:return[2,b.sent()];case 2:for(d=0,p=0,g=["x","y","z","scale_0","scale_1","scale_2","opacity","rot_0","rot_1","rot_2","rot_3"],y=["red","green","blue","f_dc_0","f_dc_1","f_dc_2"],v=0;v<m.length;v++)x=m[v],g.includes(x.name)&&d++,y.includes(x.name)&&p++;return A=d==g.length&&3==p,w=l?2:A?0:1,[4,new Promise(function(e){e(_(_({},T),{mode:w,data:t.buffer,sh:t.sh,shDegree:t.shDegree,faces:o,hasVertexColors:!!p,compressed:!1,rawSplat:!1}))})]}})})})},e._DefaultLoadingOptions={keepInRam:!1,flipY:!1,needsRotationScaleTextures:!1,spzLibraryUrl:"object"==typeof WebAssembly?"https://unpkg.com/@adobe/spz@0.2.0/dist/spz.js":void 0},e}();t.RegisterSceneLoaderPlugin(new Lo);var Po={__proto__:null,SPLATFileLoader:Lo};function So(){var e=this;t.RegisterSceneLoaderPlugin(_(_({},v),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return x})];case 1:return[2,new(0,e.sent().BVHFileLoader)(t[v.name])]}})})}})),t.RegisterSceneLoaderPlugin(_(_({},P),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Ue})];case 1:return[2,new(0,e.sent().GLTFFileLoader)(t[P.name])]}})})}})),function(){var e=this;we("EXT_lights_image_based"),Ae("EXT_lights_image_based",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ot})];case 1:return[2,new(0,e.sent().EXT_lights_image_based)(t)]}})})}),we("EXT_mesh_gpu_instancing"),Ae("EXT_mesh_gpu_instancing",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return st})];case 1:return[2,new(0,e.sent().EXT_mesh_gpu_instancing)(t)]}})})}),we("EXT_meshopt_compression"),Ae("EXT_meshopt_compression",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ct})];case 1:return[2,new(0,e.sent().EXT_meshopt_compression)(t)]}})})}),we("EXT_texture_avif"),Ae("EXT_texture_avif",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return _t})];case 1:return[2,new(0,e.sent().EXT_texture_avif)(t)]}})})}),we("EXT_texture_webp"),Ae("EXT_texture_webp",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return dt})];case 1:return[2,new(0,e.sent().EXT_texture_webp)(t)]}})})}),we("ExtrasAsMetadata"),Ae("ExtrasAsMetadata",!1,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return io})];case 1:return[2,new(0,e.sent().ExtrasAsMetadata)(t)]}})})}),we("KHR_animation_pointer"),Ae("KHR_animation_pointer",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return vr})];case 1:return[2,new(0,e.sent().KHR_animation_pointer)(t)]}})})}),we("KHR_draco_mesh_compression"),Ae("KHR_draco_mesh_compression",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return xt})];case 1:return[2,new(0,e.sent().KHR_draco_mesh_compression)(t)]}})})}),we("KHR_interactivity"),Ae("KHR_interactivity",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return zr})];case 1:return[2,new(0,e.sent().KHR_interactivity)(t)]}})})}),we("KHR_lights_punctual"),Ae("KHR_lights_punctual",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Ct})];case 1:return[2,new(0,e.sent().KHR_lights)(t)]}})})}),we("EXT_lights_area"),Ae("EXT_lights_area",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Et})];case 1:return[2,new(0,e.sent().EXT_lights_area)(t)]}})})}),we("EXT_lights_ies"),Ae("EXT_lights_ies",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return yt})];case 1:return[2,new(0,e.sent().EXT_lights_ies)(t)]}})})}),we("KHR_materials_anisotropy"),Ae("KHR_materials_anisotropy",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return zt})];case 1:return[2,new(0,e.sent().KHR_materials_anisotropy)(t)]}})})}),we("KHR_materials_clearcoat"),Ae("KHR_materials_clearcoat",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return kt})];case 1:return[2,new(0,e.sent().KHR_materials_clearcoat)(t)]}})})}),we("KHR_materials_diffuse_roughness"),Ae("KHR_materials_diffuse_roughness",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Fn})];case 1:return[2,new(0,e.sent().KHR_materials_diffuse_roughness)(t)]}})})}),we("KHR_materials_diffuse_transmission"),Ae("KHR_materials_diffuse_transmission",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return bn})];case 1:return[2,new(0,e.sent().KHR_materials_diffuse_transmission)(t)]}})})}),we("KHR_materials_dispersion"),Ae("KHR_materials_dispersion",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Mn})];case 1:return[2,new(0,e.sent().KHR_materials_dispersion)(t)]}})})}),we("KHR_materials_emissive_strength"),Ae("KHR_materials_emissive_strength",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Xt})];case 1:return[2,new(0,e.sent().KHR_materials_emissive_strength)(t)]}})})}),we("KHR_materials_ior"),Ae("KHR_materials_ior",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ln})];case 1:return[2,new(0,e.sent().KHR_materials_ior)(t)]}})})}),we("KHR_materials_iridescence"),Ae("KHR_materials_iridescence",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return jt})];case 1:return[2,new(0,e.sent().KHR_materials_iridescence)(t)]}})})}),we("KHR_materials_pbrSpecularGlossiness"),Ae("KHR_materials_pbrSpecularGlossiness",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Lt})];case 1:return[2,new(0,e.sent().KHR_materials_pbrSpecularGlossiness)(t)]}})})}),we("KHR_materials_sheen"),Ae("KHR_materials_sheen",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Zt})];case 1:return[2,new(0,e.sent().KHR_materials_sheen)(t)]}})})}),we("KHR_materials_specular"),Ae("KHR_materials_specular",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return on})];case 1:return[2,new(0,e.sent().KHR_materials_specular)(t)]}})})}),we("KHR_materials_transmission"),Ae("KHR_materials_transmission",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return mn})];case 1:return[2,new(0,e.sent().KHR_materials_transmission)(t)]}})})}),we("KHR_materials_unlit"),Ae("KHR_materials_unlit",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Nt})];case 1:return[2,new(0,e.sent().KHR_materials_unlit)(t)]}})})}),we("KHR_materials_variants"),Ae("KHR_materials_variants",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return fn})];case 1:return[2,new(0,e.sent().KHR_materials_variants)(t)]}})})}),we("KHR_materials_volume"),Ae("KHR_materials_volume",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Tn})];case 1:return[2,new(0,e.sent().KHR_materials_volume)(t)]}})})}),we("KHR_mesh_quantization"),Ae("KHR_mesh_quantization",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Sn})];case 1:return[2,new(0,e.sent().KHR_mesh_quantization)(t)]}})})}),we("KHR_texture_basisu"),Ae("KHR_texture_basisu",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Bn})];case 1:return[2,new(0,e.sent().KHR_texture_basisu)(t)]}})})}),we("KHR_texture_transform"),Ae("KHR_texture_transform",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Vn})];case 1:return[2,new(0,e.sent().KHR_texture_transform)(t)]}})})}),we("KHR_xmp_json_ld"),Ae("KHR_xmp_json_ld",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Kn})];case 1:return[2,new(0,e.sent().KHR_xmp_json_ld)(t)]}})})}),we("MSFT_audio_emitter"),Ae("MSFT_audio_emitter",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Ar})];case 1:return[2,new(0,e.sent().MSFT_audio_emitter)(t)]}})})}),we("MSFT_lod"),Ae("MSFT_lod",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Or})];case 1:return[2,new(0,e.sent().MSFT_lod)(t)]}})})}),we("MSFT_minecraftMesh"),Ae("MSFT_minecraftMesh",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Rr})];case 1:return[2,new(0,e.sent().MSFT_minecraftMesh)(t)]}})})}),we("MSFT_sRGBFactors"),Ae("MSFT_sRGBFactors",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Pr})];case 1:return[2,new(0,e.sent().MSFT_sRGBFactors)(t)]}})})}),we("KHR_node_visibility"),Ae("KHR_node_visibility",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Xr})];case 1:return[2,new(0,e.sent().KHR_node_visibility)(t)]}})})}),we("KHR_node_hoverability"),Ae("KHR_node_hoverability",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return ro})];case 1:return[2,new(0,e.sent().KHR_node_hoverability)(t)]}})})}),we("KHR_node_selectability"),Ae("KHR_node_selectability",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Zr})];case 1:return[2,new(0,e.sent().KHR_node_selectability)(t)]}})})}),we("KHR_materials_coat"),Ae("KHR_materials_coat",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Dt})];case 1:return[2,new(0,e.sent().KHR_materials_coat)(t)]}})})}),we("KHR_materials_fuzz"),Ae("KHR_materials_fuzz",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return tn})];case 1:return[2,new(0,e.sent().KHR_materials_fuzz)(t)]}})})}),we("KHR_materials_volume_scatter"),Ae("KHR_materials_volume_scatter",!0,function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return wn})];case 1:return[2,new(0,e.sent().KHR_materials_volume_scatter)(t)]}})})})}(),t.RegisterSceneLoaderPlugin(_(_({},po),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return _o})];case 1:return[2,new(0,e.sent().OBJFileLoader)(t[po.name])]}})})}})),t.RegisterSceneLoaderPlugin(_(_({},xo),{createPlugin:function(t){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return Po})];case 1:return[2,new(0,e.sent().SPLATFileLoader)(t[xo.name])]}})})}})),t.RegisterSceneLoaderPlugin(_(_({},bo),{createPlugin:function(){return g(e,void 0,void 0,function(){return b(this,function(e){switch(e.label){case 0:return[4,Promise.resolve().then(function(){return vo})];case 1:return[2,new(0,e.sent().STLFileLoader)]}})})}}))}var No={__proto__:null,registerBuiltInLoaders:So},Io="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Io)for(var Bo in A)Io.BABYLON[Bo]||(Io.BABYLON[Bo]=A[Bo]);var ko="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==ko)for(var Go in ko.BABYLON=ko.BABYLON||{},No)ko.BABYLON[Go]=No[Go];var Vo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Vo){for(var Do in Vo.BABYLON=Vo.BABYLON||{},z)Vo.BABYLON[Do]=z[Do];for(var Do in F)Vo.BABYLON[Do]=F[Do]}var Ho,Ko,jo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==jo)for(var Uo in jo.BABYLON=jo.BABYLON||{},jo.BABYLON.GLTF1=jo.BABYLON.GLTF1||{},ve)jo.BABYLON.GLTF1[Uo]=ve[Uo];var Wo=_({},uo),zo=_(_({},{__proto__:null}),((Ho={}).Extensions=Wo,Ho)),qo=_(_({},co),((Ko={}).Loader=zo,Ko)),Yo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Yo){Yo.BABYLON=Yo.BABYLON||{};var Xo=Yo.BABYLON;Xo.GLTF2=Xo.GLTF2||{},Xo.GLTF2.Loader=Xo.GLTF2.Loader||{},Xo.GLTF2.Loader.Extensions=Xo.GLTF2.Loader.Extensions||{};var Jo=["Loader"];for(var Qo in Wo)Xo.GLTF2.Loader.Extensions[Qo]=Wo[Qo],Jo.push(Qo);for(var Qo in zo)"Extensions"!==Qo&&(Xo.GLTF2.Loader[Qo]=zo[Qo],Jo.push(Qo));for(var Qo in qo)Jo.indexOf(Qo)>-1||(Xo.GLTF2[Qo]=qo[Qo])}var Zo="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==Zo)for(var $o in go)Zo.BABYLON[$o]||(Zo.BABYLON[$o]=go[$o]);var ea="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==ea)for(var ta in To)ea.BABYLON[ta]||(ea.BABYLON[ta]=To[ta]);e.BVHFileLoader=T,e.GLTF1=ve,e.GLTF2=qo,e.GLTFFileLoader=k,e.GLTFLoaderDefaultOptions=I,e.GLTFValidation=R,e.MTLFileLoader=fo,e.OBJFileLoader=mo,e.ReadBvh=d,e.SPLATFileLoader=Lo,e.STLFileLoader=yo,e.SolidParser=ho,e.registerBuiltInLoaders=So});
|
|
2
2
|
//# sourceMappingURL=babylonjs.loaders.min.js.map
|