@crystaldesign/products-component 24.13.0-beta.1 → 24.13.0-beta.11
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.
|
@@ -405,4 +405,4 @@ canvas {
|
|
|
405
405
|
</div>
|
|
406
406
|
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
407
407
|
<span id="status" role="status"></span>
|
|
408
|
-
</div>`;var na=r(5108);const ra=new WeakMap;function DRACOWorker(){let e,t;function decodeAttribute(e,t,r,s,o,l){const c=l.num_components(),h=r.num_points()*c,d=h*o.BYTES_PER_ELEMENT,p=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),A=e._malloc(d);t.GetAttributeDataArrayForAllPoints(r,l,p,d,A);const m=new o(e.HEAPF32.buffer,A,h).slice();return e._free(A),{name:s,array:m,itemSize:c}}onmessage=function(r){const s=r.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const r=s.buffer,o=s.taskConfig;t.then((e=>{const t=e.draco,l=new t.Decoder;try{const e=function decodeGeometry(e,t,r,s){const o=s.attributeIDs,l=s.attributeTypes;let c,h;const d=t.GetEncodedGeometryType(r);if(d===e.TRIANGULAR_MESH)c=new e.Mesh,h=t.DecodeArrayToMesh(r,r.byteLength,c);else{if(d!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");c=new e.PointCloud,h=t.DecodeArrayToPointCloud(r,r.byteLength,c)}if(!h.ok()||0===c.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const p={index:null,attributes:[]};for(const r in o){const h=self[l[r]];let d,A;if(s.useUniqueIDs)A=o[r],d=t.GetAttributeByUniqueId(c,A);else{if(A=t.GetAttributeId(c,e[o[r]]),-1===A)continue;d=t.GetAttribute(c,A)}const m=decodeAttribute(e,t,c,r,h,d);"color"===r&&(m.vertexColorSpace=s.vertexColorSpace),p.attributes.push(m)}d===e.TRIANGULAR_MESH&&(p.index=function decodeIndex(e,t,r){const s=r.num_faces(),o=3*s,l=4*o,c=e._malloc(l);t.GetTrianglesUInt32Array(r,l,c);const h=new Uint32Array(e.HEAPF32.buffer,c,o).slice();return e._free(c),{array:h,itemSize:1}}(e,t,c));return e.destroy(c),p}(t,l,new Int8Array(r),o),c=e.attributes.map((e=>e.array.buffer));e.index&&c.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},c)}catch(e){na.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(l)}}))}}}var sa=r(5108);function toTrianglesDrawMode(e,t){if(0===t)return sa.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return sa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const s=r.count-2,o=[];if(2===t)for(let e=1;e<=s;e++)o.push(r.getX(0)),o.push(r.getX(e)),o.push(r.getX(e+1));else for(let e=0;e<s;e++)e%2==0?(o.push(r.getX(e)),o.push(r.getX(e+1)),o.push(r.getX(e+2))):(o.push(r.getX(e+2)),o.push(r.getX(e+1)),o.push(r.getX(e)));o.length/3!==s&&sa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(o),l.clearGroups(),l}return sa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var aa=r(5108);class GLTFLoader extends Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,r,s){const o=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=LoaderUtils.extractUrlBase(e);l=LoaderUtils.resolveURL(t,this.path)}else l=LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){s?s(t):aa.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},c=new three_module_FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,(function(r){try{o.parse(r,l,(function(r){t(r),o.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),r,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let o;const l={},c={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===la){try{l[oa.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(s&&s(e))}o=JSON.parse(l[oa.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const d=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](d);t.name||aa.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[t.name]=t,l[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],r=o.extensionsRequired||[];switch(t){case oa.KHR_MATERIALS_UNLIT:l[t]=new GLTFMaterialsUnlitExtension;break;case oa.KHR_DRACO_MESH_COMPRESSION:l[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case oa.KHR_TEXTURE_TRANSFORM:l[t]=new GLTFTextureTransformExtension;break;case oa.KHR_MESH_QUANTIZATION:l[t]=new GLTFMeshQuantizationExtension;break;default:r.indexOf(t)>=0&&void 0===c[t]&&aa.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}d.setExtensions(l),d.setPlugins(c),d.parse(r,s)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,t,s,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const oa={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=oa.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let s=t.cache.get(r);if(s)return s;const o=t.json,l=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let c;const h=new Color(16777215);void 0!==l.color&&h.setRGB(l.color[0],l.color[1],l.color[2],ke);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":c=new DirectionalLight(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new PointLight(h),c.distance=d;break;case"spot":c=new SpotLight(h),c.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,assignExtrasToUserData(c,l),void 0!==l.intensity&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),s=Promise.resolve(c),t.cache.add(r,s),s}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return r._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=oa.KHR_MATERIALS_UNLIT}getMaterialType(){return MeshBasicMaterial}extendParams(e,t,r){const s=[];e.color=new Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const t=o.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],ke),e.opacity=t[3]}void 0!==o.baseColorTexture&&s.push(r.assignTexture(e,"map",o.baseColorTexture,Oe))}return Promise.all(s)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return void 0!==s&&(t.emissiveIntensity=s),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&o.push(r.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&o.push(r.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(o.push(r.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Vector2(e,e)}return Promise.all(o)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.iridescenceFactor&&(t.iridescence=l.iridescenceFactor),void 0!==l.iridescenceTexture&&o.push(r.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),void 0!==l.iridescenceIor&&(t.iridescenceIOR=l.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==l.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),void 0!==l.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),void 0!==l.iridescenceThicknessTexture&&o.push(r.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=s.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],ke)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&o.push(r.assignTexture(t,"sheenColorMap",l.sheenColorTexture,Oe)),void 0!==l.sheenRoughnessTexture&&o.push(r.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(o)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.transmissionFactor&&(t.transmission=l.transmissionFactor),void 0!==l.transmissionTexture&&o.push(r.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&o.push(r.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return t.attenuationColor=(new Color).setRGB(c[0],c[1],c[2],ke),Promise.all(o)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=void 0!==s.ior?s.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&o.push(r.assignTexture(t,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return t.specularColor=(new Color).setRGB(c[0],c[1],c[2],ke),void 0!==l.specularColorTexture&&o.push(r.assignTexture(t,"specularColorMap",l.specularColorTexture,Oe)),Promise.all(o)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=oa.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return t.bumpScale=void 0!==l.bumpFactor?l.bumpFactor:1,void 0!==l.bumpTexture&&o.push(r.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.anisotropyStrength&&(t.anisotropy=l.anisotropyStrength),void 0!==l.anisotropyRotation&&(t.anisotropyRotation=l.anisotropyRotation),void 0!==l.anisotropyTexture&&o.push(r.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=oa.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const o=s.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=oa.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=oa.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=oa.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then((function(t){const r=e.byteOffset||0,s=e.byteLength||0,l=e.count,c=e.byteStride,h=new Uint8Array(t,r,s);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(l,c,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(l*c);return o.decodeGltfBuffer(new Uint8Array(t),l,c,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=oa.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const s=t.meshes[r.mesh];for(const e of s.primitives)if(e.mode!==da.TRIANGLES&&e.mode!==da.TRIANGLE_STRIP&&e.mode!==da.TRIANGLE_FAN&&void 0!==e.mode)return null;const o=r.extensions[this.name].attributes,l=[],c={};for(const e in o)l.push(this.parser.getDependency("accessor",o[e]).then((t=>(c[e]=t,c[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),r=t.isGroup?t.children:[t],s=e[0].count,o=[];for(const e of r){const t=new three_module_Matrix4,r=new three_module_Vector3,l=new three_module_Quaternion,h=new three_module_Vector3(1,1,1),d=new InstancedMesh(e.geometry,e.material,s);for(let e=0;e<s;e++)c.TRANSLATION&&r.fromBufferAttribute(c.TRANSLATION,e),c.ROTATION&&l.fromBufferAttribute(c.ROTATION,e),c.SCALE&&h.fromBufferAttribute(c.SCALE,e),d.setMatrixAt(e,t.compose(r,l,h));for(const t in c)if("_COLOR_0"===t){const e=c[t];d.instanceColor=new three_module_InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,c[t]);Object3D.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),o.push(d)}return t.isGroup?(t.clear(),t.add(...o),t):o[0]})))}}const la="glTF",ca=1313821514,ha=5130562;class GLTFBinaryExtension{constructor(e){this.name=oa.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==la)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,o=new DataView(e,12);let l=0;for(;l<s;){const t=o.getUint32(l,!0);l+=4;const s=o.getUint32(l,!0);if(l+=4,s===ca){const s=new Uint8Array(e,12+l,t);this.content=r.decode(s)}else if(s===ha){const r=12+l;this.body=e.slice(r,r+t)}l+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=oa.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,s=this.dracoLoader,o=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,c={},h={},d={};for(const e in l){const t=fa[e]||e.toLowerCase();c[t]=l[e]}for(const t in e.attributes){const s=fa[t]||t.toLowerCase();if(void 0!==l[t]){const o=r.accessors[e.attributes[t]],l=pa[o.componentType];d[s]=l.name,h[s]=!0===o.normalized}}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t,r){s.decodeDracoFile(e,(function(e){for(const t in e.attributes){const r=e.attributes[t],s=h[t];void 0!==s&&(r.normalized=s)}t(e)}),c,d,ke,r)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=oa.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=oa.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,o=e*s*3+s;for(let e=0;e!==s;e++)t[e]=r[o+e];return t}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=2*c,d=3*c,p=s-t,A=(r-t)/p,m=A*A,g=m*A,f=e*d,_=f-d,y=-2*g+3*m,E=g-m,x=1-y,C=E-m+A;for(let e=0;e!==c;e++){const t=l[_+e+c],r=l[_+e+h]*p,s=l[f+e+c],d=l[f+e]*p;o[e]=x*t+C*r+y*s+E*d}return o}}const ua=new three_module_Quaternion;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,r,s){const o=super.interpolate_(e,t,r,s);return ua.fromArray(o).normalize().toArray(o),o}}const da={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},pa={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Aa={9728:ee,9729:ne,9984:te,9985:re,9986:ie,9987:se},ma={33071:J,33648:$,10497:K},ga={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fa={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},_a={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},va={CUBICSPLINE:void 0,LINEAR:Le,STEP:Re},ya="OPAQUE",Ea="MASK",xa="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,r){for(const s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):aa.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){const r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,s=r.length;t<s;t++)e.morphTargetDictionary[r[t]]=t}else aa.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const r=e.extensions&&e.extensions[oa.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+createAttributesKey(r.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,s=e.targets.length;r<s;r++)t+=":"+createAttributesKey(e.targets[r]);return t}function createAttributesKey(e){let t="";const r=Object.keys(e).sort();for(let s=0,o=r.length;s<o;s++)t+=r[s]+":"+e[r[s]]+";";return t}function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Ma=new three_module_Matrix4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,s=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=navigator.userAgent.indexOf("Firefox")>-1,o=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||s&&o<98?this.textureLoader=new TextureLoader(this.options.manager):this.textureLoader=new ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new three_module_FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,s=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const l={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};return addUnknownExtensionsToUserData(o,l,s),assignExtrasToUserData(l,s),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(l)}))).then((function(){for(const e of l.scenes)e.updateMatrixWorld();e(l)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r].joints;for(let t=0,r=s.length;t<r;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(r[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const s=r.clone(),updateMappings=(e,t)=>{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,s]of e.children.entries())updateMappings(s,t.children[r])};return updateMappings(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const s=e(t[r]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let s=0;s<t.length;s++){const o=e(t[s]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":s=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":s=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})),!s)throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map((function(t,s){return r.getDependency(e,s)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[oa.KHR_BINARY_GLTF].body);const s=this.options;return new Promise((function(e,o){r.load(LoaderUtils.resolveURL(t.uri,s.path),e,void 0,(function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)}))}loadAccessor(e){const t=this,r=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse){const e=ga[s.type],t=pa[s.componentType],r=!0===s.normalized,o=new t(s.count*e);return Promise.resolve(new three_module_BufferAttribute(o,e,r))}const o=[];return void 0!==s.bufferView?o.push(this.getDependency("bufferView",s.bufferView)):o.push(null),void 0!==s.sparse&&(o.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(o).then((function(e){const o=e[0],l=ga[s.type],c=pa[s.componentType],h=c.BYTES_PER_ELEMENT,d=h*l,p=s.byteOffset||0,A=void 0!==s.bufferView?r.bufferViews[s.bufferView].byteStride:void 0,m=!0===s.normalized;let g,f;if(A&&A!==d){const e=Math.floor(p/A),r="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+e+":"+s.count;let d=t.cache.get(r);d||(g=new c(o,e*A,s.count*A/h),d=new three_module_InterleavedBuffer(g,A/h),t.cache.add(r,d)),f=new three_module_InterleavedBufferAttribute(d,l,p%A/h,m)}else g=null===o?new c(s.count*l):new c(o,p,s.count*l),f=new three_module_BufferAttribute(g,l,m);if(void 0!==s.sparse){const t=ga.SCALAR,r=pa[s.sparse.indices.componentType],h=s.sparse.indices.byteOffset||0,d=s.sparse.values.byteOffset||0,p=new r(e[1],h,s.sparse.count*t),A=new c(e[2],d,s.sparse.count*l);null!==o&&(f=new three_module_BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=p.length;e<t;e++){const t=p[e];if(f.setX(t,A[e*l]),l>=2&&f.setY(t,A[e*l+1]),l>=3&&f.setZ(t,A[e*l+2]),l>=4&&f.setW(t,A[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f}))}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let l=this.textureLoader;if(o.uri){const e=r.manager.getHandler(o.uri);null!==e&&(l=e)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,r){const s=this,o=this.json,l=o.textures[e],c=o.images[t],h=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[h])return this.textureCache[h];const d=this.loadImageSource(t,r).then((function(t){t.flipY=!1,t.name=l.name||c.name||"",""===t.name&&"string"==typeof c.uri&&!1===c.uri.startsWith("data:image/")&&(t.name=c.uri);const r=(o.samplers||{})[l.sampler]||{};return t.magFilter=Aa[r.magFilter]||ne,t.minFilter=Aa[r.minFilter]||se,t.wrapS=ma[r.wrapS]||K,t.wrapT=ma[r.wrapT]||K,s.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[h]=d,d}loadImageSource(e,t){const r=this,s=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=s.images[e],c=self.URL||self.webkitURL;let h=l.uri||"",d=!1;if(void 0!==l.bufferView)h=r.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return h=c.createObjectURL(t),h}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(h).then((function(e){return new Promise((function(r,s){let l=r;!0===t.isImageBitmapLoader&&(l=function(e){const t=new Texture(e);t.needsUpdate=!0,r(t)}),t.load(LoaderUtils.resolveURL(e,o.path),l,void 0,s)}))})).then((function(e){return!0===d&&c.revokeObjectURL(h),e.userData.mimeType=l.mimeType||function getImageURIMimeType(e){return e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"}(l.uri),e})).catch((function(e){throw aa.error("THREE.GLTFLoader: Couldn't load texture",h),e}));return this.sourceCache[e]=p,p}assignTexture(e,t,r,s){const o=this;return this.getDependency("texture",r.index).then((function(l){if(!l)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((l=l.clone()).channel=r.texCoord),o.extensions[oa.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[oa.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(l);l=o.extensions[oa.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),o.associations.set(l,t)}}return void 0!==s&&(l.colorSpace=s),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=void 0===t.attributes.tangent,o=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new PointsMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new LineBasicMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(s||o||l){let e="ClonedMaterial:"+r.uuid+":";s&&(e+="derivative-tangents:"),o&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),o&&(t.vertexColors=!0),l&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,s=this.extensions,o=r.materials[e];let l;const c={},h=[];if((o.extensions||{})[oa.KHR_MATERIALS_UNLIT]){const e=s[oa.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),h.push(e.extendParams(c,o,t))}else{const r=o.pbrMetallicRoughness||{};if(c.color=new Color(1,1,1),c.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;c.color.setRGB(e[0],e[1],e[2],ke),c.opacity=e[3]}void 0!==r.baseColorTexture&&h.push(t.assignTexture(c,"map",r.baseColorTexture,Oe)),c.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,c.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(h.push(t.assignTexture(c,"metalnessMap",r.metallicRoughnessTexture)),h.push(t.assignTexture(c,"roughnessMap",r.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),h.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,c)}))))}!0===o.doubleSided&&(c.side=2);const d=o.alphaMode||ya;if(d===xa?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,d===Ea&&(c.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"normalMap",o.normalTexture)),c.normalScale=new Vector2(1,1),void 0!==o.normalTexture.scale)){const e=o.normalTexture.scale;c.normalScale.set(e,e)}if(void 0!==o.occlusionTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(c.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&l!==MeshBasicMaterial){const e=o.emissiveFactor;c.emissive=(new Color).setRGB(e[0],e[1],e[2],ke)}return void 0!==o.emissiveTexture&&l!==MeshBasicMaterial&&h.push(t.assignTexture(c,"emissiveMap",o.emissiveTexture,Oe)),Promise.all(h).then((function(){const r=new l(c);return o.name&&(r.name=o.name),assignExtrasToUserData(r,o),t.associations.set(r,{materials:e}),o.extensions&&addUnknownExtensionsToUserData(s,r,o),r}))}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function createDracoPrimitive(e){return r[oa.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return addPrimitiveAttributes(r,e,t)}))}const o=[];for(let r=0,l=e.length;r<l;r++){const l=e[r],c=createPrimitiveKey(l),h=s[c];if(h)o.push(h.promise);else{let e;e=l.extensions&&l.extensions[oa.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new three_module_BufferGeometry,l,t),s[c]={primitive:l,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const t=this,r=this.json,s=this.extensions,o=r.meshes[e],l=o.primitives,c=[];for(let e=0,t=l.length;e<t;e++){const t=void 0===l[e].material?createDefaultMaterial(this.cache):this.getDependency("material",l[e].material);c.push(t)}return c.push(t.loadGeometries(l)),Promise.all(c).then((function(r){const c=r.slice(0,r.length-1),h=r[r.length-1],d=[];for(let r=0,p=h.length;r<p;r++){const p=h[r],A=l[r];let m;const g=c[r];if(A.mode===da.TRIANGLES||A.mode===da.TRIANGLE_STRIP||A.mode===da.TRIANGLE_FAN||void 0===A.mode)m=!0===o.isSkinnedMesh?new SkinnedMesh(p,g):new three_module_Mesh(p,g),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),A.mode===da.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,1):A.mode===da.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,2));else if(A.mode===da.LINES)m=new LineSegments(p,g);else if(A.mode===da.LINE_STRIP)m=new Line(p,g);else if(A.mode===da.LINE_LOOP)m=new LineLoop(p,g);else{if(A.mode!==da.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);m=new Points(p,g)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),assignExtrasToUserData(m,o),A.extensions&&addUnknownExtensionsToUserData(s,m,A),t.assignFinalMaterial(m),d.push(m)}for(let r=0,s=d.length;r<s;r++)t.associations.set(d[r],{meshes:e,primitives:r});if(1===d.length)return o.extensions&&addUnknownExtensionsToUserData(s,d[0],o),d[0];const p=new three_module_Group;o.extensions&&addUnknownExtensionsToUserData(s,p,o),t.associations.set(p,{meshes:e});for(let e=0,t=d.length;e<t;e++)p.add(d[e]);return p}))}loadCamera(e){let t;const r=this.json.cameras[e],s=r[r.type];if(s)return"perspective"===r.type?t=new PerspectiveCamera(ht.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===r.type&&(t=new OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),assignExtrasToUserData(t,r),Promise.resolve(t);aa.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],r=[];for(let e=0,s=t.joints.length;e<s;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){const r=e.pop(),s=e,o=[],l=[];for(let e=0,c=s.length;e<c;e++){const c=s[e];if(c){o.push(c);const t=new three_module_Matrix4;null!==r&&t.fromArray(r.array,16*e),l.push(t)}else aa.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Skeleton(o,l)}))}loadAnimation(e){const t=this.json,r=this,s=t.animations[e],o=s.name?s.name:"animation_"+e,l=[],c=[],h=[],d=[],p=[];for(let e=0,t=s.channels.length;e<t;e++){const t=s.channels[e],r=s.samplers[t.sampler],o=t.target,A=o.node,m=void 0!==s.parameters?s.parameters[r.input]:r.input,g=void 0!==s.parameters?s.parameters[r.output]:r.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),c.push(this.getDependency("accessor",m)),h.push(this.getDependency("accessor",g)),d.push(r),p.push(o))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h),Promise.all(d),Promise.all(p)]).then((function(e){const t=e[0],s=e[1],l=e[2],c=e[3],h=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],p=s[e],A=l[e],m=c[e],g=h[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=r._createAnimationTracks(o,p,A,m,g);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new three_module_AnimationClip(o,void 0,d)}))}createNodeMesh(e){const t=this.json,r=this,s=t.nodes[e];return void 0===s.mesh?null:r.getDependency("mesh",s.mesh).then((function(e){const t=r._getNodeRef(r.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,r=s.weights.length;t<r;t++)e.morphTargetInfluences[t]=s.weights[t]})),t}))}loadNode(e){const t=this,r=this.json.nodes[e],s=t._loadNodeShallow(e),o=[],l=r.children||[];for(let e=0,r=l.length;e<r;e++)o.push(t.getDependency("node",l[e]));const c=void 0===r.skin?Promise.resolve(null):t.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),c]).then((function(e){const t=e[0],r=e[1],s=e[2];null!==s&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(s,Ma)}));for(let e=0,s=r.length;e<s;e++)t.add(r[e]);return t}))}_loadNodeShallow(e){const t=this.json,r=this.extensions,s=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const o=t.nodes[e],l=o.name?s.createUniqueName(o.name):"",c=[],h=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return h&&c.push(h),void 0!==o.camera&&c.push(s.getDependency("camera",o.camera).then((function(e){return s._getNodeRef(s.cameraCache,o.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){c.push(e)})),this.nodeCache[e]=Promise.all(c).then((function(t){let c;if(c=!0===o.isBone?new Bone:t.length>1?new three_module_Group:1===t.length?t[0]:new Object3D,c!==t[0])for(let e=0,r=t.length;e<r;e++)c.add(t[e]);if(o.name&&(c.userData.name=o.name,c.name=l),assignExtrasToUserData(c,o),o.extensions&&addUnknownExtensionsToUserData(r,c,o),void 0!==o.matrix){const e=new three_module_Matrix4;e.fromArray(o.matrix),c.applyMatrix4(e)}else void 0!==o.translation&&c.position.fromArray(o.translation),void 0!==o.rotation&&c.quaternion.fromArray(o.rotation),void 0!==o.scale&&c.scale.fromArray(o.scale);return s.associations.has(c)||s.associations.set(c,{}),s.associations.get(c).nodes=e,c})),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],s=this,o=new three_module_Group;r.name&&(o.name=s.createUniqueName(r.name)),assignExtrasToUserData(o,r),r.extensions&&addUnknownExtensionsToUserData(t,o,r);const l=r.nodes||[],c=[];for(let e=0,t=l.length;e<t;e++)c.push(s.getDependency("node",l[e]));return Promise.all(c).then((function(e){for(let t=0,r=e.length;t<r;t++)o.add(e[t]);return s.associations=(e=>{const t=new Map;for(const[e,r]of s.associations)(e instanceof Material||e instanceof Texture)&&t.set(e,r);return e.traverse((e=>{const r=s.associations.get(e);null!=r&&t.set(e,r)})),t})(o),o}))}_createAnimationTracks(e,t,r,s,o){const l=[],c=e.name?e.name:e.uuid,h=[];let d;switch(_a[o.path]===_a.weights?e.traverse((function(e){e.morphTargetInfluences&&h.push(e.name?e.name:e.uuid)})):h.push(c),_a[o.path]){case _a.weights:d=NumberKeyframeTrack;break;case _a.rotation:d=three_module_QuaternionKeyframeTrack;break;case _a.position:case _a.scale:d=three_module_VectorKeyframeTrack;break;default:if(1===r.itemSize)d=NumberKeyframeTrack;else d=three_module_VectorKeyframeTrack}const p=void 0!==s.interpolation?va[s.interpolation]:Le,A=this._getArrayFromAccessor(r);for(let e=0,r=h.length;e<r;e++){const r=new d(h[e]+"."+_a[o.path],t.array,A,p);"CUBICSPLINE"===s.interpolation&&this._createCubicSplineTrackInterpolant(r),l.push(r)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof three_module_QuaternionKeyframeTrack?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,r){const s=t.attributes,o=[];function assignAttributeAccessor(t,s){return r.getDependency("accessor",t).then((function(t){e.setAttribute(s,t)}))}for(const t in s){const r=fa[t]||t.toLowerCase();r in e.attributes||o.push(assignAttributeAccessor(s[t],r))}if(void 0!==t.indices&&!e.index){const s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));o.push(s)}return ft.workingColorSpace!==ke&&"COLOR_0"in s&&aa.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ft.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,r){const s=t.attributes,o=new Box3;if(void 0===s.POSITION)return;{const e=r.json.accessors[s.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void aa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(o.set(new three_module_Vector3(t[0],t[1],t[2]),new three_module_Vector3(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(pa[e.componentType]);o.min.multiplyScalar(t),o.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new three_module_Vector3,t=new three_module_Vector3;for(let s=0,o=l.length;s<o;s++){const o=l[s];if(void 0!==o.POSITION){const s=r.json.accessors[o.POSITION],l=s.min,c=s.max;if(void 0!==l&&void 0!==c){if(t.setX(Math.max(Math.abs(l[0]),Math.abs(c[0]))),t.setY(Math.max(Math.abs(l[1]),Math.abs(c[1]))),t.setZ(Math.max(Math.abs(l[2]),Math.abs(c[2]))),s.normalized){const e=getNormalizedComponentScale(pa[s.componentType]);t.multiplyScalar(e)}e.max(t)}else aa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(e)}e.boundingBox=o;const c=new Sphere;o.getCenter(c.center),c.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=c}(e,t,r),Promise.all(o).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,r){let s=!1,o=!1,l=!1;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(void 0!==r.POSITION&&(s=!0),void 0!==r.NORMAL&&(o=!0),void 0!==r.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(e);const c=[],h=[],d=[];for(let p=0,A=t.length;p<A;p++){const A=t[p];if(s){const t=void 0!==A.POSITION?r.getDependency("accessor",A.POSITION):e.attributes.position;c.push(t)}if(o){const t=void 0!==A.NORMAL?r.getDependency("accessor",A.NORMAL):e.attributes.normal;h.push(t)}if(l){const t=void 0!==A.COLOR_0?r.getDependency("accessor",A.COLOR_0):e.attributes.color;d.push(t)}}return Promise.all([Promise.all(c),Promise.all(h),Promise.all(d)]).then((function(t){const r=t[0],c=t[1],h=t[2];return s&&(e.morphAttributes.position=r),o&&(e.morphAttributes.normal=c),l&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,r):e}))}class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:t,msg:r,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((r=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=r,this.workers[s].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}var Ca=r(8764).Buffer;const Sa=9,Ia=15,ba=16,wa=22,Ta=37,Ba=43,Ra=76,La=83,Da=97,Ua=100,Pa=103,Fa=109,Na=165,Qa=166;class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ii{constructor(e,t,r,s){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}new Uint8Array([0]);const Oa=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Ca.from(e).toString("utf8")}var ka=r(8764).Buffer;let Ga,Va,Ha;const za={env:{emscripten_notify_memory_growth:function(e){Ha=new Uint8Array(Va.exports.memory.buffer)}}};class zstddec_module_Q{init(){return Ga||(Ga="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Wa).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,za))).then(this._init):WebAssembly.instantiate(ka.from(Wa,"base64"),za).then(this._init),Ga)}_init(e){Va=e.instance,za.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Va)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,s=Va.exports.malloc(r);Ha.set(e,s),t=t||Number(Va.exports.ZSTD_findDecompressedSize(s,r));const o=Va.exports.malloc(t),l=Va.exports.ZSTD_decompress(o,t,s,r),c=Ha.slice(o,o+l);return Va.exports.free(s),Va.exports.free(o),c}}const Wa="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQE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DTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAH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CyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohB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aiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAd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RAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwB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lAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";var qa=r(5108);const ja=new WeakMap;let Xa,Ya=0;class KTX2Loader extends Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&qa.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const e=new three_module_FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),r=new three_module_FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then((([e,t])=>{const r=KTX2Loader.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),Ya>0&&qa.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Ya++}return this.transcoderPending}load(e,t,r,s){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const o=new three_module_FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{if(ja.has(e)){return ja.get(e).promise.then(t).catch(s)}this._createTexture(e).then((e=>t?t(e):null)).catch(s)}),r,s)}_createTextureFrom(e,t){const{faces:r,width:s,height:o,format:l,type:c,error:h,dfdFlags:d}=e;if("error"===c)return Promise.reject(h);let p;if(6===t.faceCount)p=new CompressedCubeTexture(r,l,ae);else{const e=r[0].mipmaps;p=t.layerCount>1?new CompressedArrayTexture(e,s,o,t.layerCount,l,ae):new CompressedTexture(e,s,o,l,ae)}return p.minFilter=1===r[0].mipmaps.length?ne:se,p.magFilter=ne,p.generateMipmaps=!1,p.needsUpdate=!0,p.colorSpace=parseColorSpace(t),p.premultiplyAlpha=!!(1&d),p}async _createTexture(e,t={}){const r=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,Oa.length);if(t[0]!==Oa[0]||t[1]!==Oa[1]||t[2]!==Oa[2]||t[3]!==Oa[3]||t[4]!==Oa[4]||t[5]!==Oa[5]||t[6]!==Oa[6]||t[7]!==Oa[7]||t[8]!==Oa[8]||t[9]!==Oa[9]||t[10]!==Oa[10]||t[11]!==Oa[11])throw new Error("Missing KTX 2.0 identifier.");const r=new Si,s=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,Oa.length,s,!0);r.vkFormat=o._nextUint32(),r.typeSize=o._nextUint32(),r.pixelWidth=o._nextUint32(),r.pixelHeight=o._nextUint32(),r.pixelDepth=o._nextUint32(),r.layerCount=o._nextUint32(),r.faceCount=o._nextUint32();const l=o._nextUint32();r.supercompressionScheme=o._nextUint32();const c=o._nextUint32(),h=o._nextUint32(),d=o._nextUint32(),p=o._nextUint32(),A=o._nextUint64(),m=o._nextUint64(),g=new Ii(e,Oa.length+s,3*l*8,!0);for(let t=0;t<l;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+g._nextUint64(),g._nextUint64()),uncompressedByteLength:g._nextUint64()});const f=new Ii(e,c,h,!0),_={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},y=(_.descriptorBlockSize/4-6)/4;for(let e=0;e<y;e++){const t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),_.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const E=new Ii(e,d,p,!0);for(;E._offset<p;){const e=E._nextUint32(),t=E._scan(e),s=Ei(t),o=E._scan(e-t.byteLength);r.keyValue[s]=s.match(/^ktx/i)?Ei(o):o,E._offset%4&&E._skip(4-E._offset%4)}if(m<=0)return r;const x=new Ii(e,A,m,!0),C=x._nextUint16(),S=x._nextUint16(),I=x._nextUint32(),b=x._nextUint32(),T=x._nextUint32(),B=x._nextUint32(),U=[];for(let e=0;e<l;e++)U.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});const F=A+x._offset,Q=F+I,O=Q+b,G=O+T,W=new Uint8Array(e.buffer,e.byteOffset+F,I),q=new Uint8Array(e.buffer,e.byteOffset+Q,b),j=new Uint8Array(e.buffer,e.byteOffset+O,T),X=new Uint8Array(e.buffer,e.byteOffset+G,B);return r.globalData={endpointCount:C,selectorCount:S,imageDescs:U,endpointsData:W,selectorsData:q,tablesData:j,extendedData:X},r}(new Uint8Array(e));if(0!==r.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===Ja[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let r;2===e.supercompressionScheme&&(Xa||(Xa=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),r=await Xa);const s=[];for(let o=0;o<e.levels.length;o++){const l=Math.max(1,e.pixelWidth>>o),c=Math.max(1,e.pixelHeight>>o),h=e.pixelDepth?Math.max(1,e.pixelDepth>>o):0,d=e.levels[o];let p,A;if(0===e.supercompressionScheme)p=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");p=r.decode(d.levelData,d.uncompressedByteLength)}A=$a[t]===ce?new Float32Array(p.buffer,p.byteOffset,p.byteLength/Float32Array.BYTES_PER_ELEMENT):$a[t]===he?new Uint16Array(p.buffer,p.byteOffset,p.byteLength/Uint16Array.BYTES_PER_ELEMENT):p,s.push({data:A,width:l,height:c,depth:h})}let o;if(Ka.has(Ja[t]))o=0===e.pixelDepth?new DataTexture(s[0].data,e.pixelWidth,e.pixelHeight):new Data3DTexture(s[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");o=new CompressedTexture(s,e.pixelWidth,e.pixelHeight)}return o.mipmaps=s,o.type=$a[t],o.format=Ja[t],o.colorSpace=parseColorSpace(e),o.needsUpdate=!0,Promise.resolve(o)}(r);const s=t,o=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:s},[e]))).then((e=>this._createTextureFrom(e.data,r)));return ja.set(e,{promise:o}),o}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Ya--,this}}KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},KTX2Loader.EngineFormat={RGBAFormat:de,RGBA_ASTC_4x4_Format:Ie,RGBA_BPTC_Format:we,RGBA_ETC2_EAC_Format:Se,RGBA_PVRTC_4BPPV1_Format:xe,RGBA_S3TC_DXT5_Format:ye,RGB_ETC1_Format:Me,RGB_ETC2_Format:Ce,RGB_PVRTC_4BPPV1_Format:Ee,RGB_S3TC_DXT1_Format:fe},KTX2Loader.BasisWorker=function(){let e,t,r;const s=_EngineFormat,o=_TranscoderFormat,l=_BasisFormat;self.addEventListener("message",(function(c){const p=c.data;switch(p.type){case"init":e=p.config,function init(e){t=new Promise((t=>{r={wasmBinary:e,onRuntimeInitialized:t},BASIS(r)})).then((()=>{r.initializeBasis(),void 0===r.KTX2File&&qa.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(p.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:c,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_}=function transcode(t){const c=new r.KTX2File(new Uint8Array(t));function cleanup(){c.close(),c.delete()}if(!c.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const p=c.isUASTC()?l.UASTC_4x4:l.ETC1S,A=c.getWidth(),m=c.getHeight(),g=c.getLayers()||1,f=c.getLevels(),_=c.getFaces(),y=c.getHasAlpha(),E=c.getDFDFlags(),{transcoderFormat:x,engineFormat:C}=function getTranscoderFormat(t,r,c,p){let A,m;const g=t===l.ETC1S?h:d;for(let s=0;s<g.length;s++){const o=g[s];if(e[o.if]&&(o.basisFormat.includes(t)&&!(p&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(r)&&isPowerOfTwo(c))))return A=o.transcoderFormat[p?1:0],m=o.engineFormat[p?1:0],{transcoderFormat:A,engineFormat:m}}return qa.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=o.RGBA32,m=s.RGBAFormat,{transcoderFormat:A,engineFormat:m}}(p,A,m,y);if(!A||!m||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!c.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const S=[],I=[];for(let e=0;e<_;e++){const t=[];for(let r=0;r<f;r++){const s=[];let o,l;for(let t=0;t<g;t++){const h=c.getImageLevelInfo(r,t,e);0!==e||0!==r||0!==t||h.origWidth%4==0&&h.origHeight%4==0||qa.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,l=h.origHeight):(o=h.width,l=h.height);const d=new Uint8Array(c.getImageTranscodedSizeInBytes(r,t,0,x));if(!c.transcodeImage(d,r,t,e,x,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");s.push(d)}const h=concat(s);t.push({data:h,width:o,height:l}),I.push(h.buffer)}S.push({mipmaps:t,width:A,height:m,format:C})}return cleanup(),{faces:S,buffers:I,width:A,height:m,hasAlpha:y,format:C,dfdFlags:E}}(p.buffer);self.postMessage({type:"transcode",id:p.id,faces:t,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_},c)}catch(e){qa.error(e),self.postMessage({type:"error",id:p.id,error:e.message})}}))}}));const c=[{if:"astcSupported",basisFormat:[l.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[s.RGB_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[s.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=c.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),d=c.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function isPowerOfTwo(e){return e<=2||!(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const r=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const o=e[t];r.set(o,s),s+=o.byteLength}return r}};const Ka=new Set([de,ge,me]),Ja={[Fa]:de,[Da]:de,[Ta]:de,[Ba]:de,[Pa]:ge,[La]:ge,[ba]:ge,[wa]:ge,[Ua]:me,[Ra]:me,[Ia]:me,[Sa]:me,[Qa]:be,[Na]:be},$a={[Fa]:ce,[Da]:he,[Ta]:ae,[Ba]:ae,[Pa]:ce,[La]:he,[ba]:ae,[wa]:ae,[Ua]:ce,[Ra]:he,[Ia]:ae,[Sa]:ae,[Qa]:ae,[Na]:ae};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?Oe:ke:10===t.colorPrimaries?2===t.transferFunction?Ge:Ve:(0===t.colorPrimaries||qa.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),Qe)}var Za,eo;const to=Symbol("retainerCount"),io=Symbol("recentlyUsed"),no=Symbol("evict"),ro=Symbol("evictionThreshold"),so=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[Za]=new Map,this[eo]=[],this[so]=e,this[ro]=t}set evictionThreshold(e){this[ro]=e,this[no]()}get evictionThreshold(){return this[ro]}get cache(){return this[so]}retainerCount(e){return this[to].get(e)||0}reset(){this[to].clear(),this[io]=[]}retain(e){this[to].has(e)||this[to].set(e,0),this[to].set(e,this[to].get(e)+1);const t=this[io].indexOf(e);-1!==t&&this[io].splice(t,1),this[io].unshift(e),this[no]()}release(e){this[to].has(e)&&this[to].set(e,Math.max(this[to].get(e)-1,0)),this[no]()}[(Za=to,eo=io,no)](){if(!(this[io].length<this[ro]))for(let e=this[io].length-1;e>=this[ro];--e){const t=this[io][e];0===this[to].get(t)&&(this[so].delete(t),this[io].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const r of e.mappings)for(const e of r.variants)t.set(e,{material:null,gltfMaterialIndex:r.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,r=t.json;if(void 0===r.extensions||void 0===r.extensions[this.name])return null;const s=(e=>{const t=[],r=new Set;for(const s of e){let e=s,o=0;for(;r.has(e);)e=s+"."+ ++o;r.add(e),t.push(e)}return t})((r.extensions[this.name].variants||[]).map((e=>e.name)));for(const s of e.scenes)s.traverse((e=>{const s=e;if(!s.material)return;const o=t.associations.get(s);if(null==o||null==o.meshes||null==o.primitives)return;const l=r.meshes[o.meshes].primitives[o.primitives].extensions;l&&l[this.name]&&(s.userData.variantMaterials=mappingsArrayToTable(l[this.name]))}));return e.userData.variants=s,Promise.resolve()}}var ao,oo,lo=r(5108);Texture.DEFAULT_ANISOTROPY=4;const co=new Map,ho=new Map;let uo;const po=new class DRACOLoader extends Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,s){const o=new three_module_FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{this.parse(e,t,s)}),r,s)}parse(e,t,r=()=>{}){this.decodeDracoFile(e,t,null,null,Oe).catch(r)}decodeDracoFile(e,t,r,s,o=ke,l=()=>{}){const c={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:o};return this.decodeGeometry(e,c).then(t).catch(l)}decodeGeometry(e,t){const r=JSON.stringify(t);if(ra.has(e)){const t=ra.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const o=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(o,l).then((r=>(s=r,new Promise(((r,l)=>{s._callbacks[o]={resolve:r,reject:l},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{s&&o&&this._releaseTask(s,o)})),ra.set(e,{key:r,promise:c}),c}_createGeometry(e){const t=new three_module_BufferGeometry;e.index&&t.setIndex(new three_module_BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r],o=s.name,l=s.array,c=s.itemSize,h=new three_module_BufferAttribute(l,c);"color"===o&&(this._assignVertexColorSpace(h,s.vertexColorSpace),h.normalized=l instanceof Float32Array==!1),t.setAttribute(o,h)}return t}_assignVertexColorSpace(e,t){if(t!==Oe)return;const r=new Color;for(let t=0,s=e.count;t<s;t++)r.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new three_module_FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise(((t,s)=>{r.load(e,t,void 0,s)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=DRACOWorker.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:na.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){na.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};let Ao;const mo=new KTX2Loader;let go,fo;const _o=Symbol("loader"),vo=Symbol("evictionPolicy"),yo=Symbol("GLTFInstance");class CachingGLTFLoader extends EventDispatcher{constructor(e){super(),this[oo]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[yo]=e,this[_o].setDRACOLoader(po),this[_o].setKTX2Loader(mo)}static setDRACODecoderLocation(e){uo=e,po.setDecoderPath(e)}static getDRACODecoderLocation(){return uo}static setKTX2TranscoderLocation(e){Ao=e,mo.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Ao}static setMeshoptDecoderLocation(e){var t;go!==e&&(go=e,fo=(t=e,new Promise(((e,r)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=r,s.async=!0,s.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return go}static initializeKTX2Loader(e){mo.detectSupport(e)}static get cache(){return co}static clearCache(){co.forEach(((e,t)=>{this.delete(t)})),this[vo].reset()}static has(e){return co.has(e)}static async delete(e){if(!this.has(e))return;const t=co.get(e);ho.delete(e),co.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!ho.get(e)}get[(ao=vo,oo=_o,vo)](){return this.constructor[vo]}async preload(e,t,r=()=>{}){if(this[_o].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!co.has(e)){null!=fo&&this[_o].setMeshoptDecoder(await fo);const t=((e,t,r=()=>{})=>{const onProgress=e=>{const t=e.loaded/e.total;r(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((r,s)=>{t.load(e,r,onProgress,s)}))})(e,this[_o],(e=>{r(.8*e)})),s=this[yo],o=t.then((e=>s.prepare(e))).then((e=>(r(.9),new s(e)))).catch((e=>(lo.error(e),new s)));co.set(e,o)}await co.get(e),ho.set(e,!0),r&&r(1)}async load(e,t,r=()=>{}){await this.preload(e,t,r);const s=await co.get(e),o=await s.clone();return this[vo].retain(e),o.dispose=()=>{this[vo].release(e)},o}}CachingGLTFLoader[ao]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Vector2(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const Eo=new three_module_Vector3,xo=new three_module_Matrix4,Mo=new three_module_Matrix4,Co=new three_module_Vector3,So=new three_module_Vector3;class CSS2DRenderer{constructor(e={}){const t=this;let r,s,o,l;const c={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,r,s){if(e.isCSS2DObject){Eo.setFromMatrixPosition(e.matrixWorld),Eo.applyMatrix4(Mo);const d=!0===e.visible&&Eo.z>=-1&&Eo.z<=1&&!0===e.layers.test(s.layers);if(e.element.style.display=!0===d?"":"none",!0===d){e.onBeforeRender(t,r,s);const c=e.element;c.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Eo.x*o+o)+"px,"+(-Eo.y*l+l)+"px)",c.parentNode!==h&&h.appendChild(c),e.onAfterRender(t,r,s)}const p={distanceToCameraSquared:getDistanceToSquared(s,e)};c.objects.set(e,p)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],r,s)}function getDistanceToSquared(e,t){return Co.setFromMatrixPosition(e.matrixWorld),So.setFromMatrixPosition(t.matrixWorld),Co.distanceToSquared(So)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:r,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),xo.copy(t.matrixWorldInverse),Mo.multiplyMatrices(t.projectionMatrix,xo),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return c.objects.get(e).distanceToCameraSquared-c.objects.get(t).distanceToCameraSquared})),r=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,t){r=e,s=t,o=r/2,l=s/2,h.style.width=e+"px",h.style.height=t+"px"}}}r(5108);function reduceVertices(e,t,r){let s=r;const o=new three_module_Vector3;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:r}=e;if(void 0!==r){const{position:l}=r.attributes;if(void 0!==l)for(let r=0,c=l.count;r<c;r++)e.isMesh?e.getVertexPosition(r,o):o.fromBufferAttribute(l,r),e.isSkinnedMesh||o.applyMatrix4(e.matrixWorld),s=t(s,o)}})),s}let Io,bo,wo,To;function decompress(e,t=1/0,r=null){bo||(bo=new PlaneGeometry(2,2,1,1)),wo||(wo=new ShaderMaterial({uniforms:{blitTexture:new Uniform(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),wo.uniforms.blitTexture.value=e,wo.defines.IS_SRGB=e.colorSpace==Oe,wo.needsUpdate=!0,To||(To=new three_module_Mesh(bo,wo),To.frustumCulled=!1);const s=new PerspectiveCamera,o=new Scene;o.add(To),null===r&&(r=Io=new WebGLRenderer({antialias:!1}));const l=Math.min(e.image.width,t),c=Math.min(e.image.height,t);r.setSize(l,c),r.clear(),r.render(o,s);const h=document.createElement("canvas"),d=h.getContext("2d");h.width=l,h.height=c,d.drawImage(r.domElement,0,0,l,c);const p=new CanvasTexture(h);return p.minFilter=e.minFilter,p.magFilter=e.magFilter,p.wrapS=e.wrapS,p.wrapT=e.wrapT,p.name=e.name,Io&&(Io.forceContextLoss(),Io.dispose(),Io=null),p}var Bo=r(5108);const Ro={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){const o=new GLTFWriter,l=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)l.push(this.pluginCallbacks[e](o));o.setPlugins(l),o.write(e,t,s).catch(r)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,s,o,t)}))}}const Lo=0,Do=1,Uo=2,Po=3,Fo=4,No=5120,Qo=5121,Oo=5122,ko=5123,Go=5124,Vo=5125,Ho=5126,zo=34962,Wo=34963,qo=9728,jo=9729,Xo=9984,Yo=9985,Ko=9986,Jo=9987,$o=33071,Zo=33648,el=10497,tl="KHR_mesh_quantization",il={};il[ee]=qo,il[1004]=Xo,il[1005]=Ko,il[1006]=jo,il[1007]=Yo,il[1008]=Jo,il[1001]=$o,il[1e3]=el,il[1002]=Zo;const nl={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},rl=new Color;function equalArray(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const r=getPaddedBufferSize(e.byteLength);if(r!==e.byteLength){const s=new Uint8Array(r);if(s.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<r;o++)s[o]=t;return s.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((r=>e.toBlob(r,t)));let r;return"image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r})}class GLTFWriter{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,o=s.buffers,l=s.json;r=s.options;const c=s.extensionsUsed,h=s.extensionsRequired,d=new Blob(o,{type:"application/octet-stream"}),p=Object.keys(c),A=Object.keys(h);if(p.length>0&&(l.extensionsUsed=p),A.length>0&&(l.extensionsRequired=A),l.buffers&&l.buffers.length>0&&(l.buffers[0].byteLength=d.size),!0===r.binary){const e=new FileReader;e.readAsArrayBuffer(d),e.onloadend=function(){const r=getPaddedArrayBuffer(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,r.byteLength,!0),s.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(l)),32),c=new DataView(new ArrayBuffer(8));c.setUint32(0,o.byteLength,!0),c.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),d=new DataView(h);d.setUint32(0,1179937895,!0),d.setUint32(4,2,!0);const p=12+c.byteLength+o.byteLength+s.byteLength+r.byteLength;d.setUint32(8,p,!0);const A=new Blob([h,c,o,s,r],{type:"application/octet-stream"}),m=new FileReader;m.readAsArrayBuffer(A),m.onloadend=function(){t(m.result)}}}else if(l.buffers&&l.buffers.length>0){const e=new FileReader;e.readAsDataURL(d),e.onloadend=function(){const r=e.result;l.buffers[0].uri=r,t(l)}}else t(l)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,s=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],s[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){Bo.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new three_module_Vector3;for(let r=0,s=e.count;r<s;r++)if(Math.abs(t.fromBufferAttribute(e,r).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),s=new three_module_Vector3;for(let e=0,t=r.count;e<t;e++)s.fromBufferAttribute(r,e),0===s.x&&0===s.y&&0===s.z?s.setX(1):s.normalize(),r.setXYZ(e,s.x,s.y,s.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(s.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===Oe?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}Bo.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof CompressedTexture&&(e=decompress(e)),t instanceof CompressedTexture&&(t=decompress(t));const r=e?e.image:null,s=t?t.image:null,o=Math.max(r?r.width:0,s?s.width:0),l=Math.max(r?r.height:0,s?s.height:0),c=getCanvas();c.width=o,c.height=l;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,o,l);const d=h.getImageData(0,0,o,l);if(r){h.drawImage(r,0,0,o,l);const t=getEncodingConversion(e),s=h.getImageData(0,0,o,l).data;for(let e=2;e<s.length;e+=4)d.data[e]=256*t(s[e]/256)}if(s){h.drawImage(s,0,0,o,l);const e=getEncodingConversion(t),r=h.getImageData(0,0,o,l).data;for(let t=1;t<r.length;t+=4)d.data[t]=256*e(r[t]/256)}h.putImageData(d,0,0);const p=(e||t).clone();return p.source=new Source(c),p.colorSpace=Qe,p.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&Bo.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),p}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,s,o){const l=this.json;let c;switch(l.bufferViews||(l.bufferViews=[]),t){case No:case Qo:c=1;break;case Oo:case ko:c=2;break;default:c=4}let h=e.itemSize*c;o===zo&&(h=4*Math.ceil(h/4));const d=getPaddedBufferSize(s*h),p=new DataView(new ArrayBuffer(d));let A=0;for(let o=r;o<r+s;o++){for(let r=0;r<e.itemSize;r++){let s;e.itemSize>4?s=e.array[o*e.itemSize+r]:(0===r?s=e.getX(o):1===r?s=e.getY(o):2===r?s=e.getZ(o):3===r&&(s=e.getW(o)),!0===e.normalized&&(s=ht.normalize(s,e.array))),t===Ho?p.setFloat32(A,s,!0):t===Go?p.setInt32(A,s,!0):t===Vo?p.setUint32(A,s,!0):t===Oo?p.setInt16(A,s,!0):t===ko?p.setUint16(A,s,!0):t===No?p.setInt8(A,s):t===Qo&&p.setUint8(A,s),A+=c}A%h!=0&&(A+=h-A%h)}const m={buffer:this.processBuffer(p.buffer),byteOffset:this.byteOffset,byteLength:d};void 0!==o&&(m.target=o),o===zo&&(m.byteStride=h),this.byteOffset+=d,l.bufferViews.push(m);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(s){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),l={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(r.bufferViews.push(l)-1)}}))}processAccessor(e,t,r,s){const o=this.json;let l;if(e.array.constructor===Float32Array)l=Ho;else if(e.array.constructor===Int32Array)l=Go;else if(e.array.constructor===Uint32Array)l=Vo;else if(e.array.constructor===Int16Array)l=Oo;else if(e.array.constructor===Uint16Array)l=ko;else if(e.array.constructor===Int8Array)l=No;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=Qo}if(void 0===r&&(r=0),void 0!==s&&s!==1/0||(s=e.count),0===s)return null;const c=function getMinMax(e,t,r){const s={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let o=t;o<t+r;o++)for(let t=0;t<e.itemSize;t++){let r;e.itemSize>4?r=e.array[o*e.itemSize+t]:(0===t?r=e.getX(o):1===t?r=e.getY(o):2===t?r=e.getZ(o):3===t&&(r=e.getW(o)),!0===e.normalized&&(r=ht.normalize(r,e.array))),s.min[t]=Math.min(s.min[t],r),s.max[t]=Math.max(s.max[t],r)}return s}(e,r,s);let h;void 0!==t&&(h=e===t.index?Wo:zo);const d=this.processBufferView(e,l,r,s,h),p={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:s,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(p.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(p)-1}processImage(e,t,r,s="image/png"){if(null!==e){const o=this,l=o.cache,c=o.json,h=o.options,d=o.pending;l.images.has(e)||l.images.set(e,{});const p=l.images.get(e),A=s+":flipY/"+r.toString();if(void 0!==p[A])return p[A];c.images||(c.images=[]);const m={mimeType:s},g=getCanvas();g.width=Math.min(e.width,h.maxTextureSize),g.height=Math.min(e.height,h.maxTextureSize);const f=g.getContext("2d");if(!0===r&&(f.translate(0,g.height),f.scale(1,-1)),void 0!==e.data){t!==de&&Bo.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>h.maxTextureSize||e.height>h.maxTextureSize)&&Bo.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const r=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<r.length;t+=4)r[t+0]=e.data[t+0],r[t+1]=e.data[t+1],r[t+2]=e.data[t+2],r[t+3]=e.data[t+3];f.putImageData(new ImageData(r,e.width,e.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");f.drawImage(e,0,0,g.width,g.height)}!0===h.binary?d.push(getToBlobPromise(g,s).then((e=>o.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==g.toDataURL?m.uri=g.toDataURL(s):d.push(getToBlobPromise(g,s).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const _=c.images.push(m)-1;return p[A]=_,_}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:il[e.magFilter],minFilter:il[e.minFilter],wrapS:il[e.wrapS],wrapT:il[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof CompressedTexture&&(e=decompress(e,t.maxTextureSize));let o=e.userData.mimeType;"image/webp"===o&&(o="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const c=s.textures.push(l)-1;return r.textures.set(e,c),c}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return Bo.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const s={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&Bo.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(equalArray(o,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),r={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(r,t),s.pbrMetallicRoughness.metallicRoughnessTexture=r}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),s.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),s.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),s.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),s.occlusionTexture=t}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),2===e.side&&(s.doubleSided=!0),""!==e.name&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,s)}));const l=r.materials.push(s)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,r=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const o=s.join(":");if(t.meshes.has(o))return t.meshes.get(o);const l=e.geometry;let c;c=e.isLineSegments?Do:e.isLineLoop?Uo:e.isLine?Po:e.isPoints?Lo:e.material.wireframe?Do:Fo;const h={},d={},p=[],A=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=l.getAttribute("normal");void 0===g||this.isNormalizedNormalAttribute(g)||(Bo.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(g)));let f=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const r=l.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(r))){d[e]=t.attributes.get(this.getUID(r));continue}f=null;const s=r.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array||(Bo.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new three_module_BufferAttribute(new Uint16Array(s),r.itemSize,r.normalized));const o=this.processAccessor(f||r,l);null!==o&&(e.startsWith("_")||this.detectMeshQuantization(e,r),d[e]=o,t.attributes.set(this.getUID(r),o))}if(void 0!==g&&l.setAttribute("normal",g),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const r=[],s=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let c=0;c<e.morphTargetInfluences.length;++c){const h={};let d=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){d||(Bo.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),d=!0);continue}const r=l.morphAttributes[e][c],s=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(r,!0))){h[s]=t.attributes.get(this.getUID(r,!0));continue}const p=r.clone();if(!l.morphTargetsRelative)for(let e=0,t=r.count;e<t;e++)for(let t=0;t<r.itemSize;t++)0===t&&p.setX(e,r.getX(e)-o.getX(e)),1===t&&p.setY(e,r.getY(e)-o.getY(e)),2===t&&p.setZ(e,r.getZ(e)-o.getZ(e)),3===t&&p.setW(e,r.getW(e)-o.getW(e));h[s]=this.processAccessor(p,l),t.attributes.set(this.getUID(o,!0),h[s])}A.push(h),r.push(e.morphTargetInfluences[c]),void 0!==e.morphTargetDictionary&&s.push(o[c])}h.weights=r,s.length>0&&(h.extras={},h.extras.targetNames=s)}const _=Array.isArray(e.material);if(_&&0===l.groups.length)return null;let y=!1;if(_&&null===l.index){const e=[];for(let t=0,r=l.attributes.position.count;t<r;t++)e[t]=t;l.setIndex(e),y=!0}const E=_?e.material:[e.material],x=_?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=x.length;e<r;e++){const r={mode:c,attributes:d};if(this.serializeUserData(l,r),A.length>0&&(r.targets=A),null!==l.index){let s=this.getUID(l.index);void 0===x[e].start&&void 0===x[e].count||(s+=":"+x[e].start+":"+x[e].count),t.attributes.has(s)?r.indices=t.attributes.get(s):(r.indices=this.processAccessor(l.index,l,x[e].start,x[e].count),t.attributes.set(s,r.indices)),null===r.indices&&delete r.indices}const s=this.processMaterial(E[x[e].materialIndex]);null!==s&&(r.material=s),p.push(r)}!0===y&&l.setIndex(null),h.primitives=p,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,h)}));const C=r.meshes.push(h)-1;return t.meshes.set(o,C),C}detectMeshQuantization(e,t){if(this.extensionsUsed[tl])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const s=e.split("_",1)[0];Ro[s]&&Ro[s].includes(r)&&(this.extensionsUsed[tl]=!0,this.extensionsRequired[tl]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,s={type:r?"orthographic":"perspective"};return r?s.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:ht.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const r=this.json,s=this.nodeMap;r.animations||(r.animations=[]);const o=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],c=[];for(let e=0;e<o.length;++e){const r=o[e],h=PropertyBinding.parseTrackName(r.name);let d=PropertyBinding.findNode(t,h.nodeName);const p=nl[h.propertyName];if("bones"===h.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(h.objectIndex):void 0),!d||!p)return Bo.warn('THREE.GLTFExporter: Could not export animation track "%s".',r.name),null;const A=1;let m,g=r.values.length/r.times.length;p===nl.morphTargetInfluences&&(g/=d.morphTargetInfluences.length),!0===r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",g/=3):m=r.getInterpolation()===Re?"STEP":"LINEAR",c.push({input:this.processAccessor(new three_module_BufferAttribute(r.times,A)),output:this.processAccessor(new three_module_BufferAttribute(r.values,g)),interpolation:m}),l.push({sampler:c.length-1,target:{node:s.get(d),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:c,channels:l}),r.animations.length-1}processSkin(e){const t=this.json,r=this.nodeMap,s=t.nodes[r.get(e)],o=e.skeleton;if(void 0===o)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const c=[],h=new Float32Array(16*o.bones.length),d=new three_module_Matrix4;for(let t=0;t<o.bones.length;++t)c.push(r.get(o.bones[t])),d.copy(o.boneInverses[t]),d.multiply(e.bindMatrix).toArray(h,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new three_module_BufferAttribute(h,16)),joints:c,skeleton:r.get(l)});return s.skin=t.skins.length-1}processNode(e){const t=this.json,r=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(r.trs){const t=e.quaternion.toArray(),r=e.position.toArray(),s=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(r,[0,0,0])||(o.translation=r),equalArray(s,[1,1,1])||(o.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=this.processMesh(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let s=0,o=e.children.length;s<o;s++){const o=e.children[s];if(o.visible||!1===r.onlyVisible){const e=this.processNode(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));const l=t.nodes.push(o)-1;return s.set(e,l),l}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const o=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===r.onlyVisible){const e=this.processNode(s);null!==e&&o.push(e)}}o.length>0&&(s.nodes=o),this.serializeUserData(e,s)}processObjects(e){const t=new Scene;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));const r=[];for(let t=0;t<e.length;t++)e[t]instanceof Scene?this.processScene(e[t]):r.push(e[t]);r.length>0&&this.processObjects(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let r=0;r<t.animations.length;++r)this.processAnimation(t.animations[r],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void Bo.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const r=this.writer,s=r.json,o=r.extensionsUsed,l={};e.name&&(l.name=e.name),l.color=e.color.toArray(),l.intensity=e.intensity,e.isDirectionalLight?l.type="directional":e.isPointLight?(l.type="point",e.distance>0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(1-e.penumbra)*e.angle,l.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&Bo.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||Bo.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},o[this.name]=!0);const c=s.extensions[this.name].lights;c.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:c.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};r.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(rl)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.anisotropyMap){const t={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.bumpMap){const t={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,s=e,o=new Float32Array(3*s.count),l=new Float32Array(4*s.count),c=new Float32Array(3*s.count),h=new three_module_Matrix4,d=new three_module_Vector3,p=new three_module_Quaternion,A=new three_module_Vector3;for(let e=0;e<s.count;e++)s.getMatrixAt(e,h),h.decompose(d,p,A),d.toArray(o,3*e),p.toArray(l,4*e),A.toArray(c,3*e);const m={TRANSLATION:r.processAccessor(new three_module_BufferAttribute(o,3)),ROTATION:r.processAccessor(new three_module_BufferAttribute(l,4)),SCALE:r.processAccessor(new three_module_BufferAttribute(c,3))};s.instanceColor&&(m._COLOR_0=r.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const r=.001,s=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),l=new e.ValueBufferType(e.values.length+s),c=e.createInterpolant(new e.ValueBufferType(s));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<s;e++)l[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<r)return 0;o[0]=t,o.set(e.times,1),l.set(c.evaluate(t),0),l.set(e.values,s),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<r)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),l.set(e.values,0),l.set(c.evaluate(t),e.values.length),h=o.length-1}else for(let d=0;d<e.times.length;d++){if(Math.abs(e.times[d]-t)<r)return d;if(e.times[d]<t&&e.times[d+1]>t){o.set(e.times.slice(0,d+1),0),o[d+1]=t,o.set(e.times.slice(d+1),d+2),l.set(e.values.slice(0,(d+1)*s),0),l.set(c.evaluate(t),(d+1)*s),l.set(e.values.slice((d+1)*s),(d+2)*s),h=d+1;break}}return e.times=o,e.values=l,h},mergeMorphTargetTracks:function(e,t){const r=[],s={},o=e.tracks;for(let e=0;e<o.length;++e){let l=o[e];const c=PropertyBinding.parseTrackName(l.name),h=PropertyBinding.findNode(t,c.nodeName);if("morphTargetInfluences"!==c.propertyName||void 0===c.propertyIndex){r.push(l);continue}if(l.createInterpolant!==l.InterpolantFactoryMethodDiscrete&&l.createInterpolant!==l.InterpolantFactoryMethodLinear){if(l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");Bo.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(Le)}const d=h.morphTargetInfluences.length,p=h.morphTargetDictionary[c.propertyIndex];if(void 0===p)throw new Error("THREE.GLTFExporter: Morph target name not found: "+c.propertyIndex);let A;if(void 0===s[h.uuid]){A=l.clone();const e=new A.ValueBufferType(d*A.times.length);for(let t=0;t<A.times.length;t++)e[t*d+p]=A.values[t];A.name=(c.nodeName||"")+".morphTargetInfluences",A.values=e,s[h.uuid]=A,r.push(A);continue}const m=l.createInterpolant(new l.ValueBufferType(1));A=s[h.uuid];for(let e=0;e<A.times.length;e++)A.values[e*d+p]=m.evaluate(A.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(A,l.times[e]);A.values[t*d+p]=l.values[e]}}return e.tracks=r,e}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const r of e)r.traverse((e=>{if(!compatibleObject(e))return;const r=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,o]of s){const s=r.get(o.index);s&&compatibleMaterial(s.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const r=e.userData,s=r.variantMaterials,o=r.variantData,l=new Map,c=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())c.set(t.index,e);for(const e of o.values()){const t=s.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const r=this.writer.processMaterial(t.material);l.has(r)||l.set(r,{material:r,variants:[]}),l.get(r).variants.push(c.get(e.index))}const d=Array.from(l.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===d.length)return;const p=compatibleMaterial(r.originalMaterial)?this.writer.processMaterial(r.originalMaterial):-1;for(const e of t.primitives)p>=0&&(e.material=p),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:d}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class SessionLightProbe{constructor(e,t,r,s,o){this.xrLight=e,this.renderer=t,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const r=new WebGLCubeRenderTarget(16);e.environment=r.texture;const s=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":s.getExtension("EXT_sRGB");break;case"rgba16f":s.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,s),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}l.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/e,r.primaryLightIntensity.y/e,r.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends three_module_Group{constructor(e,t=!0){super(),this.lightProbe=new LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,s=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{r=new SessionLightProbe(this,e,o,t,(()=>{s=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{r&&(r.dispose(),r=null),s&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,r,s){const o=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(r<0)return e;const l=e-t,c=this.velocity+this.naturalFrequency*l,h=l+r*c,d=Math.exp(-this.naturalFrequency*r),p=(c-this.naturalFrequency*h)*d,A=-this.naturalFrequency*(p+c*d);return Math.abs(p)<o*Math.abs(s)&&A*l>=0?(this.velocity=0,t):(this.velocity=p,t+h*d)}}const sl=.2,al=Math.PI/24,ol=new Vector2,addCorner=(e,t,r)=>{let s=t>0?r>0?0:-Math.PI/2:r>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(s),r+.17*Math.sin(s),0,t+sl*Math.cos(s),r+sl*Math.sin(s),0),s+=al};class PlacementBox extends three_module_Mesh{constructor(e,t){const r=new three_module_BufferGeometry,s=[],o=[],{size:l,boundingBox:c}=e,h=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(o,h,d),addCorner(o,-h,d),addCorner(o,-h,-d),addCorner(o,h,-d);const p=o.length/3;for(let e=0;e<p-2;e+=2)s.push(e,e+1,e+3,e,e+3,e+2);const A=p-2;s.push(A,A+1,1,A,1,0),r.setAttribute("position",new three_module_Float32BufferAttribute(o,3)),r.setIndex(s),super(r),this.side=t;const m=this.material;switch(m.side=2,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new three_module_Mesh(new PlaneGeometry(2*(h+sl),2*(d+sl))),this.hitPlane.visible=!1,this.hitPlane.material.side=2,this.add(this.hitPlane),c.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=c.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=c.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,r){ol.set(t,-r),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(ol,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,r){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,r);return this.hitPlane.scale.set(1,1,1),s}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:r}=this.hitPlane;t.dispose(),r.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),ll=(()=>{const e={};return t=>{const r=t;if(r in e)return e[r];const s=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=cl(t),r=e.nodes[0];if(null==r||0===r.terms.length)break;s.push(r),t=e.remainingInput}return e[r]=s}})(),cl=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,r=/^[\),]/;return s=>{const o=[];for(;s.length&&(s=s.trim(),!r.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(s);s=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=hl(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:r}=parseFunctionArguments(s);o.push({type:"function",name:t,arguments:e}),s=r}else o.push(t)}else if(t.test(s))o.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?dl(s):ul(s);if(0===e.length)break;o.push(e[0]),s=t}return{nodes:[{type:"expression",terms:o}],remainingInput:s}}})(),hl=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const r=t.match(e);return{nodes:[{type:"ident",value:null==r?t:t.substr(0,r.index)}],remainingInput:null==r?"":t.substr(r.index)}}})(),ul=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,r=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const o=s.match(e),l=null==o?"0":o[0],c=(s=null==l?s:s.slice(l.length)).match(t);let h=null!=c&&""!==c[0]?c[0]:null;const d=null==c?s:s.slice(h.length);return null==h||r.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(l)||0,unit:h}],remainingInput:d}}})(),dl=(()=>{const e=/^[a-f0-9]*/i;return t=>{const r=(t=t.slice(1).trim()).match(e);return{nodes:null==r?[]:[{type:"hex",value:r[0]}],remainingInput:null==r?t:t.slice(r[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const r=cl(e);if(t.push(r.nodes[0]),","===(e=r.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},pl=Symbol("visitedTypes");class ASTWalker{constructor(e){this[pl]=e}walk(e,t){const r=e.slice();for(;r.length;){const e=r.shift();switch(this[pl].indexOf(e.type)>-1&&t(e),e.type){case"expression":r.unshift(...e.terms);break;case"function":r.unshift(e.name,...e.arguments)}}}}const Al=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:r,unit:s}=e;if(isFinite(r)){if("rad"===e.unit||null==e.unit)return e}else r=t,s="rad";return{type:"number",number:("deg"===s&&null!=r?r:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let r,{number:s,unit:o}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,o="m";switch(o){default:r=1;break;case"cm":r=.01;break;case"mm":r=.001}return{type:"number",number:r*s,unit:"m"}},ml=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,r=Al)=>{isFinite(t.number)||(t.number=r.number,t.unit=r.unit);const{unit:s}=t;if(null==s)return t;const o=e[s];return null==o?r:o(t)}})();var gl,fl,_l;const vl=Symbol("evaluate"),yl=Symbol("lastValue");class Evaluator{constructor(){this[gl]=null}static evaluatableFor(e,t=Al){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return Al}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:r,keywords:s}=t,{auto:o}=s;return r.map(((t,r)=>{const l=null==o[r]?t:o[r];let c=e[r]?e[r]:l;if("ident"===c.type){const e=c.value;e in s&&(c=s[e][r])}return null!=c&&"ident"!==c.type||(c=l),"%"===c.unit?numberNode(c.number/100*t.number,t.unit):(c=ml(c,t),c.unit!==t.unit?t:c)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[yl]||(this[yl]=this[vl]()),this[yl]}}gl=yl;const El=Symbol("percentage"),xl=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[El]=e,this[xl]=t}get isConstant(){return!0}[vl](){return numberNode(this[El].number/100*this[xl].number,this[xl].unit)}}const Ml=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[fl]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[Ml]=t)}get isConstant(){return!1}[(fl=Ml,vl)](){if(null!=this[Ml]&&"window-scroll-y"===this[Ml].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Al}}const Cl=/[\*\/]/,Sl=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Al){if(super(),this[_l]=null,1!==e.arguments.length)return;const r=e.arguments[0].terms.slice(),s=[];for(;r.length;){const e=r.shift();if(s.length>0){const r=s[s.length-1];if("operator"===r.type&&Cl.test(r.value)){const r=s.pop(),o=s.pop();if(null==o)return;s.push(new OperatorEvaluator(r,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;s.length>2;){const[e,r,o]=s.splice(0,3);if("operator"!==r.type)return;s.unshift(new OperatorEvaluator(r,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===s.length&&(this[Sl]=s[0])}get isConstant(){return null==this[Sl]||Evaluator.isConstant(this[Sl])}[(_l=Sl,vl)](){return null!=this[Sl]?Evaluator.evaluate(this[Sl]):Al}}const Il=Symbol("operator"),bl=Symbol("left"),wl=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,r){super(),this[Il]=e,this[bl]=t,this[wl]=r}get isConstant(){return Evaluator.isConstant(this[bl])&&Evaluator.isConstant(this[wl])}[vl](){const e=ml(Evaluator.evaluate(this[bl])),t=ml(Evaluator.evaluate(this[wl])),{number:r,unit:s}=e,{number:o,unit:l}=t;if(null!=l&&null!=s&&l!=s)return Al;const c=s||l;let h;switch(this[Il].value){case"+":h=r+o;break;case"-":h=r-o;break;case"/":h=r/o;break;case"*":h=r*o;break;default:return Al}return{type:"number",number:h,unit:c}}}const Tl=Symbol("evaluatables"),Bl=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[Bl]=t;const r=e[0],s=null!=r?r.terms:[];this[Tl]=t.basis.map(((e,t)=>{const r=s[t];return null==r?{type:"ident",value:"auto"}:"ident"===r.type?r:Evaluator.evaluatableFor(r,e)}))}get isConstant(){for(const e of this[Tl])if(!Evaluator.isConstant(e))return!1;return!0}[vl](){const e=this[Tl].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[Bl]).map((e=>e.number))}}var Rl,Ll,Dl,Ul;const Pl=Symbol("instances"),Fl=Symbol("activateListener"),Nl=Symbol("deactivateListener"),Ql=Symbol("notifyInstances"),Ol=Symbol("notify"),kl=Symbol("callback");class ScrollObserver{constructor(e){this[kl]=e}static[Ql](){for(const e of ScrollObserver[Pl])e[Ol]()}static[(Rl=Pl,Fl)](){window.addEventListener("scroll",this[Ql],{passive:!0})}static[Nl](){window.removeEventListener("scroll",this[Ql])}observe(){0===ScrollObserver[Pl].size&&ScrollObserver[Fl](),ScrollObserver[Pl].add(this)}disconnect(){ScrollObserver[Pl].delete(this),0===ScrollObserver[Pl].size&&ScrollObserver[Nl]()}[Ol](){this[kl]()}}ScrollObserver[Rl]=new Set;const Gl=Symbol("computeStyleCallback"),Vl=Symbol("astWalker"),Hl=Symbol("dependencies"),zl=Symbol("onScroll");class StyleEffector{constructor(e){this[Ll]={},this[Dl]=new ASTWalker(["function"]),this[Ul]=()=>{this[Gl]({relatedState:"window-scroll"})},this[Gl]=e}observeEffectsFor(e){const t={},r=this[Hl];this[Vl].walk(e,(e=>{const{name:s}=e,o=e.arguments[0].terms[0];if("env"===s.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in r?r["window-scroll"]:new ScrollObserver(this[zl]);e.observe(),delete r["window-scroll"],t["window-scroll"]=e}}));for(const e in r){r[e].disconnect()}this[Hl]=t}dispose(){for(const e in this[Hl]){this[Hl][e].disconnect()}}}Ll=Hl,Dl=Vl,Ul=zl;const style=e=>{const t=e.observeEffects||!1,r=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,o)=>{const l=s.updated,c=s.connectedCallback,h=s.disconnectedCallback,d=Symbol(`${o}StyleEffector`),p=Symbol(`${o}StyleEvaluator`),A=Symbol(`${o}UpdateEvaluator`),m=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(s,{[d]:{value:null,writable:!0},[p]:{value:null,writable:!0},[A]:{value:function(){const e=ll(this[o]);this[p]=new StyleEvaluator(e,r(this)),null==this[d]&&t&&(this[d]=new StyleEffector((()=>this[m]()))),null!=this[d]&&this[d].observeEffectsFor(e)}},[m]:{value:function(){if(null==this[p])return;const t=this[p].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[A](),this[m]()),l.call(this,e)}},connectedCallback:{value:function(){c.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[d]&&(this[d].dispose(),this[d]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,r=easeInOutQuad)=>s=>e+(t-e)*r(s),timeline=e=>{const t=[],r=[];let s=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const l=e.keyframes[o],{value:c,frames:h}=l,d=l.ease||easeInOutQuad,p=interpolate(s,c,d);t.push(p),r.push(h),s=c}return((e,t)=>{const r=t.map((s=0,e=>s+=e));var s;return t=>{t=utilities_clamp(t,0,1),t*=r[r.length-1];const s=r.findIndex((e=>e>=t)),o=s<1?0:r[s-1],l=r[s];return e[s]((t-o)/(l-o))}})(t,r)};var Wl=r(5108),controls_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const ql=timeline({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),jl=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),Xl="0deg 75deg 105%",Yl=["front","right","back","left"],Kl=["upper-","","lower-"],Jl="auto",$l="basic",Zl="wiggle",ec="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),tc=(()=>{const e=ll(Xl)[0].terms,t=ml(e[0]),r=ml(e[1]);return e=>{const s=e[Kd].idealCameraDistance();return{basis:[t,r,numberNode(s,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[Kd].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=tc(e),r=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(r,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[Kd].boundingBox.getCenter(new three_module_Vector3);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},ic=Math.PI/2,nc=Math.PI/3,rc=ic/2,sc=2*Math.PI,ac=Symbol("controls"),oc=Symbol("panElement"),cc=Symbol("promptElement"),hc=Symbol("promptAnimatedContainer"),uc=Symbol("fingerAnimatedContainers"),dc=Symbol("deferInteractionPrompt"),pc=Symbol("updateAria"),Ac=Symbol("a11y"),mc=Symbol("updateA11y"),gc=Symbol("updateCameraForRadius"),fc=Symbol("cancelPrompts"),_c=Symbol("onChange"),vc=Symbol("onPointerChange"),yc=Symbol("waitingToPromptUser"),Ec=Symbol("userHasInteracted"),xc=Symbol("promptElementVisibleTime"),Mc=Symbol("lastPromptOffset"),Cc=Symbol("cancellationSource"),Sc=Symbol("lastSpherical"),Ic=Symbol("jumpCamera"),bc=Symbol("initialized"),wc=Symbol("maintainThetaPhi"),Tc=Symbol("syncCameraOrbit"),Bc=Symbol("syncFieldOfView"),Rc=Symbol("syncCameraTarget"),Lc=Symbol("syncMinCameraOrbit"),Dc=Symbol("syncMaxCameraOrbit"),Uc=Symbol("syncMinFieldOfView"),Pc=Symbol("syncMaxFieldOfView"),Fc=new Vector2,Nc=new three_module_Vector3,Qc=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Oc=Math.PI/8,kc=.04,Gc={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends EventDispatcher{constructor(e,t,r){super(),this.camera=e,this.element=t,this.scene=r,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Gc.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Matrix3,this.panPerPixel=0,this.spherical=new Spherical,this.goalSpherical=new Spherical,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(Qc.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=kc*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:r}=this._options;if(!this.touchDecided&&"none"!==r){this.touchDecided=!0;const s=Math.abs(e),o=Math.abs(t);if(this.changeSource===Gc.USER_INTERACTION&&("pan-y"===r&&o>s||"pan-x"===r&&s>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?Gc.AUTOMATIC:Gc.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=Gc.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===Gc.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const r=this.pointers.length,s=(e.clientX-t.clientX)/r,o=(e.clientY-t.clientY)/r;0===s&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?Gc.AUTOMATIC:Gc.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,o)):(this.changeSource=Gc.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,o):this.handleSinglePointerMove(s,o)))},this.onPointerUp=e=>{const{element:t}=this,r=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==r&&this.pointers.splice(r,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[oc].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=Gc.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*kc*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=Gc.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},Qc),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",(()=>{}),{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new Spherical){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,r=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:o,minimumPolarAngle:l,maximumPolarAngle:c,minimumRadius:h,maximumRadius:d}=this._options,{theta:p,phi:A,radius:m}=this.goalSpherical,g=utilities_clamp(e,s,o);isFinite(s)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-g)+g);const f=utilities_clamp(t,l,c),_=utilities_clamp(r,h,d);return(g!==p||f!==A||_!==m)&&(!!(isFinite(g)&&isFinite(f)&&isFinite(_))&&(this.goalSpherical.theta=g,this.goalSpherical.phi=f,this.goalSpherical.radius=_,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:r}=this._options;e=utilities_clamp(e,t,r),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,r){const{theta:s,phi:o,radius:l}=this.goalSpherical,{minimumRadius:c,maximumRadius:h,minimumFieldOfView:d,maximumFieldOfView:p}=this._options,A=this.spherical.theta-s,m=Math.PI-.001,g=s-utilities_clamp(e,-m-A,m-A),f=o-t,_=0===r?0:((r>0?h:c)-l)/(Math.log(r>0?p:d)-this.goalLogFov),y=l+r*(isFinite(_)?_:2*(h-c));if(this.setOrbit(g,f,y),0!==r){const e=this.goalLogFov+r;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:r,maximumRadius:s}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,r),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Euler(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,r){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,r*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:r,clientY:s}=e,{clientX:o,clientY:l}=t,c=o-r,h=l-s;return Math.sqrt(c*c+h*h)}handleSinglePointerMove(e,t){const r=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(r,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,r=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(r),-Math.cos(t)*Math.sin(r),0,0,Math.sin(t),0,Math.sin(r),-Math.cos(t)*Math.cos(r),0)}movePan(e,t){const{scene:r}=this,s=Nc.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(o);const l=r.getTarget();l.add(s.applyMatrix3(this.panProjection)),r.boundingSphere.clampPoint(l,l),r.setTarget(l.x,l.y,l.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,r=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==r){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(r.position),t.setTarget(r.position.x,r.position.y,r.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(Fc.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const r=e.getTarget(),{theta:s,phi:o}=this.spherical,l=s-e.yaw,c=Nc.set(Math.sin(o)*Math.sin(l),Math.cos(o),Math.sin(o)*Math.cos(l)),h=c.dot(t.position.sub(r));r.add(c.multiplyScalar(h)),e.setTarget(r.x,r.y,r.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[oc].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[oc].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,kc*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Oc,0);break;case"ArrowDown":this.userAdjustOrbit(0,Oc,0);break;case"ArrowLeft":this.userAdjustOrbit(-Oc,0,0);break;case"ArrowRight":this.userAdjustOrbit(Oc,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}var Vc=r(5108);const Hc=1/1.3,zc="not-presenting",Wc="session-started",qc="object-placed",jc="failed",Xc="tracking",Yc="not-tracking",Kc=new three_module_Vector3,Jc=new three_module_Matrix4,$c=new three_module_Vector3,Zc=new PerspectiveCamera(45,1,.1,100);class ARRenderer extends EventDispatcher{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new three_module_Vector3,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new three_module_Vector3,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new three_module_Vector3,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const r=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=this.placementBox;if(1===r.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,r=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=r?(this.isTranslating=!0,this.lastDragPosition.copy(r)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===r.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/s.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return Vc.warn("Request to present in WebXR denied:"),Vc.warn(e),Vc.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&Vc.warn("Cannot present while a model is already presenting");let r=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await r,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const s=await this.resolveARSession();s.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const l=await s.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const c=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(c),z:-Math.cos(c)});s.requestHitTestSource({space:l,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=s,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Wc})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){Vc.warn("Error while trying to end WebXR AR session"),Vc.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const r=this.turntableRotation;null!=r&&(t.yaw=r);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[$s],e[Zs]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[ep](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Gc.NONE}}))}))}this.renderer.height=0;const r=this.exitWebXRButtonContainer;null!=r&&(r.classList.remove("enabled"),r.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:zc})}updateView(e){const t=this.presentedScene,r=this.threeRenderer.xr;r.updateCamera(Zc),t.xrCamera=r.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=r.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):r.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:r}=e,s=e.getCamera(),{width:o,height:l}=this.overlay.getBoundingClientRect();e.setSize(o,l),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c,radius:h}=r.getCameraOrbit(),d=s.getWorldDirection(Kc);e.yaw=Math.atan2(-d.x,-d.z)-c,this.goalYaw=e.yaw,t.copy(s.position).add(d.multiplyScalar(h)),this.updateTarget();const p=e.getTarget();t.add(p).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:A}=this.frame;A.addEventListener("selectstart",this.onSelectStart),A.addEventListener("selectend",this.onSelectEnd),A.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(Kc.copy(t).sub(this.presentedScene.getCamera().position),Kc.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),r=e.getPose(t);if(null==r)return null;const s=Jc.fromArray(r.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?$c.setFromMatrixPosition(s):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const r=e.getHitTestResults(t);if(0==r.length)return;const s=r[0],o=this.getHitPoint(s);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:qc}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,r=e[1].inputSource.gamepad.axes,s=r[0]-t[0],o=r[1]-t[1],l=Math.atan2(o,s);let c=this.lastAngle-l;return c>Math.PI?c-=2*Math.PI:c<-Math.PI&&(c+=2*Math.PI),this.lastAngle=l,{separation:Math.sqrt(s*s+o*o),deltaYaw:c}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const r=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=s.scale.x;if(this.isTwoFingering)if(r.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(r);if(!1===this.placeOnWall&&(this.goalYaw+=t),s.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>Hc?1:t}}else if(2!==r.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&r.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const r=Kc.copy(s.getCamera().position),l=-e/(r.y-t.y);r.multiplyScalar(l),t.multiplyScalar(1-l).add(r)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:r,yaw:s}=t,o=t.boundingSphere.radius,l=this.goalPosition,c=t.scale.x,h=this.placementBox;let d=Gc.NONE;if(!l.equals(r)||this.goalScale!==c){d=Gc.USER_INTERACTION;let{x:s,y:p,z:A}=r;s=this.xDamper.update(s,l.x,e,o),p=this.yDamper.update(p,l.y,e,o),A=this.zDamper.update(A,l.z,e,o),r.set(s,p,A);const m=this.scaleDamper.update(c,this.goalScale,e,1);if(t.scale.set(m,m,m),!this.isTranslating){const e=l.y-p;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/m,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,h.show=!1,t.setShadowIntensity(.8))}}h.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(s,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const r=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(r);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Yc}));const o=this.presentedScene;if(null==s||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Xc}));let l=!0;for(const r of s.views){if(this.updateView(r),l){this.moveToFloor(t),this.processInput(t);const r=e-this.lastTick;this.moveScene(r),this.renderer.preRender(o,e,r),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),l=!1}}}function clone(e){const t=new Map,r=new Map,s=e.clone();return parallelTraverse(e,s,(function(e,s){t.set(s,e),r.set(e,s)})),s.traverse((function(e){if(!e.isSkinnedMesh)return;const s=e,o=t.get(e),l=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=l.map((function(e){return r.get(e)})),s.bind(s.skeleton,s.bindMatrix)})),s}function parallelTraverse(e,t,r){r(e,t);for(let s=0;s<e.children.length;s++)parallelTraverse(e.children[s],t.children[s],r)}const eh=Symbol("prepared"),th=Symbol("prepare"),ih=Symbol("preparedGLTF"),nh=Symbol("clone");class GLTFInstance{constructor(e){this[ih]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[eh])return e;const t=this[th](e);return t[eh]=!0,t}static[th](e){const{scene:t}=e,r=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:r})}get parser(){return this[ih].parser}get animations(){return this[ih].animations}get scene(){return this[ih].scene}get scenes(){return this[ih].scenes}get cameras(){return this[ih].cameras}get asset(){return this[ih].asset}get userData(){return this[ih].userData}clone(){return new(0,this.constructor)(this[nh]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const r=e[t];if(r instanceof Texture){const e=r.source.data;null!=e.close&&e.close(),r.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[nh](){const e=this[ih],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const r=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:r,userData:s})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,r)=>{r(e,t);for(let s=0;s<e.children.length;s++)traversePair(e.children[s],t.children[s],r)},rh=Symbol("threeGLTF"),sh=Symbol("gltf"),ah=Symbol("gltfElementMap"),oh=Symbol("threeObjectMap"),lh=Symbol("parallelTraverseThreeScene"),ch=Symbol("correlateOriginalThreeGLTF"),hh=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,r,s){this[rh]=e,this[sh]=t,this[ah]=s,this[oh]=r}static from(e,t){return null!=t?this[hh](e,t):this[ch](e)}static[ch](e){const t=e.parser.json,r=e.parser.associations,s=new Map,o={name:"Default"},l={type:"materials",index:-1};for(const e of r.keys())e instanceof Material&&null==r.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(o)),e.name=o.name,r.set(e,{materials:l.index}));for(const[e,o]of r){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const r in o)if(null!=r&&"primitives"!==r){const l=r,c=(t[l]||[])[o[l]];if(null==c)continue;let h=s.get(c);null==h&&(h=new Set,s.set(c,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,r,s)}static[hh](e,t){const r=t.threeGLTF,s=t.gltf,o=JSON.parse(JSON.stringify(s)),l=new Map,c=new Map;for(let s=0;s<r.scenes.length;s++)this[lh](r.scenes[s],e.scenes[s],((e,r)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,h=s[t],d=o[t][h],p=l.get(r)||{};p[t]=h,l.set(r,p);const A=c.get(d)||new Set;A.add(r),c.set(d,A)}}));return new CorrelatedSceneGraph(e,o,l,c)}static[lh](e,t,r){const traverse=(e,t)=>{if(r(e,t),e.isObject3D){const s=e,o=t;if(s.material)if(Array.isArray(s.material))for(let e=0;e<s.material.length;++e)r(s.material[e],o.material[e]);else r(s.material,o.material);for(let r=0;r<e.children.length;++r)traverse(e.children[r],t.children[r])}};traverse(e,t)}get threeGLTF(){return this[rh]}get gltf(){return this[sh]}get gltfElementMap(){return this[ah]}get threeObjectMap(){return this[oh]}}const uh=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[th](e){const t=super[th](e);null==t[uh]&&(t[uh]=CorrelatedSceneGraph.from(t));const{scene:r}=t,s=new Sphere(void 0,1/0);return r.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const r=e;if(r.material){const{geometry:e}=r;r.castShadow=!0,r.isSkinnedMesh&&(e.boundingSphere=s,e.boundingBox=null);const o=r.material;if(!0===o.isMeshBasicMaterial&&(o.toneMapped=!1),o.shadowSide=0,o.aoMap){const{gltf:r,threeObjectMap:s}=t[uh],l=s.get(o);if(null!=r.materials&&null!=l&&null!=l.materials){const t=r.materials[l.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[ih][uh]}[nh](){const e=super[nh](),t=new Map;return e.scene.traverse((e=>{const r=e;if(r.material){const e=r.material;if(null!=e){if(t.has(e.uuid))return void(r.material=t.get(e.uuid));r.material=e.clone(),t.set(e.uuid,r.material)}}const s=e;void 0!==s.target&&s.add(s.target)})),e[uh]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var dh=r(5108);const getBufferForType=(e,t,r)=>{let s;switch(e){case ae:s=new Uint8ClampedArray(t*r*4);break;case he:s=new Uint16Array(t*r*4);break;case le:s=new Uint32Array(t*r*4);break;case 1010:s=new Int8Array(t*r*4);break;case 1011:s=new Int16Array(t*r*4);break;case oe:s=new Int32Array(t*r*4);break;case ce:s=new Float32Array(t*r*4);break;default:throw new Error("Unsupported data type")}return s};let ph;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,r,s,o,l,c,h,d,p,A,m,g,f,_,y,E;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const x={format:de,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(r=e.renderTargetOptions)||void 0===r?void 0:r.anisotropy:1,generateMipmaps:void 0!==(null===(s=e.renderTargetOptions)||void 0===s?void 0:s.generateMipmaps)&&(null===(o=e.renderTargetOptions)||void 0===o?void 0:o.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(c=e.renderTargetOptions)||void 0===c?void 0:c.magFilter:ne,minFilter:void 0!==(null===(h=e.renderTargetOptions)||void 0===h?void 0:h.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:ne,samples:void 0!==(null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples)?null===(A=e.renderTargetOptions)||void 0===A?void 0:A.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(g=e.renderTargetOptions)||void 0===g?void 0:g.wrapS:J,wrapT:void 0!==(null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapT)?null===(_=e.renderTargetOptions)||void 0===_?void 0:_.wrapT:J};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Scene,this._camera=new OrthographicCamera,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,r,s)=>{if(void 0!==ph)return ph;const o=new WebGLRenderTarget(1,1,s);t.setRenderTarget(o);const l=new three_module_Mesh(new PlaneGeometry,new MeshBasicMaterial({color:16777215}));t.render(l,r),t.setRenderTarget(null);const c=getBufferForType(e,o.width,o.height);return t.readRenderTargetPixels(o,0,0,o.width,o.height,c),o.dispose(),l.geometry.dispose(),l.material.dispose(),ph=0!==c[0],ph})(this._type,this._renderer,this._camera,x)){let e;if(this._type===he)e=this._renderer.extensions.has("EXT_color_buffer_float")?ce:void 0;void 0!==e?(dh.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=e):(this._supportsReadPixels=!1,dh.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new three_module_Mesh(new PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new WebGLRenderTarget(this.width,this.height,x),this._renderTarget.texture.mapping=void 0!==(null===(y=e.renderTargetOptions)||void 0===y?void 0:y.mapping)?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.mapping:G}static instantiateRenderer(){const e=new WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new DataTexture(this.toArray(),this.width,this.height,de,this._type,(null==e?void 0:e.mapping)||G,(null==e?void 0:e.wrapS)||J,(null==e?void 0:e.wrapT)||J,(null==e?void 0:e.magFilter)||ne,(null==e?void 0:e.minFilter)||ne,(null==e?void 0:e.anisotropy)||1,ke);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof ShaderMaterial&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof Texture&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof Texture&&e.dispose()})),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var Ah=r(5108);class GainMapDecoderMaterial extends ShaderMaterial{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:s,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:c,hdrCapacityMax:h,sdr:d,gainMap:p}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:p},gamma:{value:new three_module_Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new three_module_Vector3).fromArray(t)},offsetSdr:{value:(new three_module_Vector3).fromArray(r)},gainMapMin:{value:(new three_module_Vector3).fromArray(s)},gainMapMax:{value:(new three_module_Vector3).fromArray(o)},weightFactor:{value:(Math.log2(l)-c)/(h-c)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=c,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,r)=>{var s;let o;const l=null===(s=e.attributes.getNamedItem(t))||void 0===s?void 0:s.nodeValue;if(l)o=l;else{const s=e.getElementsByTagName(t)[0];if(!s){if(r)return r;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=s.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,r)=>{const s=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void r(new Error("Not a valid jpeg"));const l=o.byteLength;let c,h=2,d=0;for(;h<l;){if(++d>250)return void r(new Error(`Found no marker after ${d} loops 😵`));if(255!==o.getUint8(h))return void r(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(c=o.getUint8(h+1),s&&Ah.log(`Marker: ${c.toString(16)}`),226===c){s&&Ah.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const s=e+4;let l;if(18761===o.getUint16(s))l=!1;else{if(19789!==o.getUint16(s))return void r(new Error("No valid endianness marker found in TIFF header"));l=!0}if(42!==o.getUint16(s+2,!l))return void r(new Error("Not valid TIFF data! (no 0x002A marker)"));const c=o.getUint32(s+4,!l);if(c<8)return void r(new Error("Not valid TIFF data! (First offset less than 8)"));const h=s+c,d=o.getUint16(h,!l),p=h+2;let A=0;for(let e=p;e<p+12*d;e+=12)45057===o.getUint16(e,!l)&&(A=o.getUint32(e+8,!l));const m=h+2+12*d+4,g=[];for(let e=m;e<m+16*A;e+=16){const t={MPType:o.getUint32(e,!l),size:o.getUint32(e+4,!l),dataOffset:o.getUint32(e+8,!l),dependantImages:o.getUint32(e+12,!l),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,g.push(t)}if(this.options.extractNonFII&&g.length){const e=new Blob([o]),r=[];for(const t of g){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");r.push(s)}t(r)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,r;let s;s="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=s.indexOf("<x:xmpmeta");const l=new DOMParser;for(;-1!==o;){const e=s.indexOf("x:xmpmeta>",o);s.slice(o,e+10);const c=s.slice(o,e+10);try{const e=l.parseFromString(c,"text/xml").getElementsByTagName("rdf:Description")[0],s=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),d=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),p=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let A=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;A||(A="0");const m=null===(r=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===r?void 0:r.nodeValue;if(!m)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(s)?s.map((e=>parseFloat(e))):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetSdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetHdr:Array.isArray(p)?p.map((e=>parseFloat(e))):[parseFloat(p),parseFloat(p),parseFloat(p)],hdrCapacityMin:parseFloat(A),hdrCapacityMax:parseFloat(m)}}catch(e){}o=s.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const r=new MPFExtractor({extractFII:!0,extractNonFII:!0}),s=await r.extract(e);if(2!==s.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,r)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{r(e)},s.src=URL.createObjectURL(e)}));class LoaderBase extends Loader{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new LoadingManager}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Texture,sdr:new Texture});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:he,colorSpace:ke,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,s){const o=s?new Blob([s],{type:"image/jpeg"}):void 0,l=new Blob([r],{type:"image/jpeg"});let c,h,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([o?getHTMLImageFromBlob(o):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);h=e[0],c=e[1],d=!0}else{const e=await Promise.all([o?createImageBitmap(o,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);h=e[0],c=e[1]}const p=new Texture(h||new ImageData(2,2),G,J,J,ne,1008,de,ae,1,ke);p.flipY=d,p.needsUpdate=!0;const A=new Texture(c,G,J,J,ne,1008,de,ae,1,Oe);A.flipY=d,A.needsUpdate=!0,e.width=c.width,e.height=c.height,e.material.gainMap=p,e.material.sdr=A,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class HDRJPGLoader extends LoaderBase{load(e,t,r,s){const o=this.prepareQuadRenderer(),l=new three_module_FileLoader(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,(async r=>{if("string"==typeof r)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(r);let c,h,d;try{const e=await extractGainmapFromJPEG(l);c=e.sdr,h=e.gainMap,d=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Ah.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=l}try{await this.render(o,d,c,h)}catch(t){return this.manager.itemError(e),"function"==typeof s&&s(t),void o.disposeOnDemandRenderer()}"function"==typeof t&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()}),r,(t=>{this.manager.itemError(e),"function"==typeof s&&s(t)})),o}}class RGBELoader extends DataTextureLoader{constructor(e){super(e),this.type=he}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,r){t=t||1024;let s=e.pos,o=-1,l=0,c="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(o=h.indexOf("\n"))&&l<t&&s<e.byteLength;)c+=h,l+=h.length,s+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<o&&(!1!==r&&(e.pos+=l+o+1),c+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=e[t+0]*l,r[s+1]=e[t+1]*l,r[s+2]=e[t+2]*l,r[s+3]=1},RGBEByteToRGBHalf=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=Fi.toHalfFloat(Math.min(e[t+0]*l,65504)),r[s+1]=Fi.toHalfFloat(Math.min(e[t+1]*l,65504)),r[s+2]=Fi.toHalfFloat(Math.min(e[t+2]*l,65504)),r[s+3]=Fi.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const r=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,h;for((e.pos>=e.byteLength||!(c=fgets(e)))&&rgbe_error(1,"no header found"),(h=c.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),l.valid|=1,l.programtype=h[1],l.string+=c+"\n";c=fgets(e),!1!==c;)if(l.string+=c+"\n","#"!==c.charAt(0)){if((h=c.match(t))&&(l.gamma=parseFloat(h[1])),(h=c.match(r))&&(l.exposure=parseFloat(h[1])),(h=c.match(s))&&(l.valid|=2,l.format=h[1]),(h=c.match(o))&&(l.valid|=4,l.height=parseInt(h[1],10),l.width=parseInt(h[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=c+"\n";return 2&l.valid||rgbe_error(3,"missing format specifier"),4&l.valid||rgbe_error(3,"missing image size specifier"),l}(t),s=r.width,o=r.height,l=function(e,t,r){const s=t;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*r);o.length||rgbe_error(4,"unable to allocate buffer space");let l=0,c=0;const h=4*s,d=new Uint8Array(4),p=new Uint8Array(h);let A=r;for(;A>0&&c<e.byteLength;){c+4>e.byteLength&&rgbe_error(1),d[0]=e[c++],d[1]=e[c++],d[2]=e[c++],d[3]=e[c++],2==d[0]&&2==d[1]&&(d[2]<<8|d[3])==s||rgbe_error(3,"bad rgbe scanline format");let t,r=0;for(;r<h&&c<e.byteLength;){t=e[c++];const s=t>128;if(s&&(t-=128),(0===t||r+t>h)&&rgbe_error(3,"bad scanline data"),s){const s=e[c++];for(let e=0;e<t;e++)p[r++]=s}else p.set(e.subarray(c,c+t),r),r+=t,c+=t}const m=s;for(let e=0;e<m;e++){let t=0;o[l]=p[e+t],t+=s,o[l+1]=p[e+t],t+=s,o[l+2]=p[e+t],t+=s,o[l+3]=p[e+t],l+=4}A--}return o}(t.subarray(t.pos),s,o);let c,h,d;switch(this.type){case ce:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);c=e,h=ce;break;case he:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);c=t,h=he;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:o,data:c,header:r.string,gamma:r.gamma,exposure:r.exposure,type:h}}setDataType(e){return this.type=e,this}load(e,t,r,s){return super.load(e,(function onLoadCallback(e,r){switch(e.type){case ce:case he:e.colorSpace=ke,e.minFilter=ne,e.magFilter=ne,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}const mh={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},gh={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class EnvironmentScene extends Scene{constructor(e){super(),this.position.y=-3.5;const t=new BoxGeometry;t.deleteAttribute("uv");const r=new MeshStandardMaterial({metalness:0,side:1}),s=new MeshStandardMaterial({metalness:0}),o="legacy"==e?mh:gh,l=new PointLight(16777215,o.topLight.intensity,28,2);l.position.set(...o.topLight.position),this.add(l);const c=new three_module_Mesh(t,r);c.position.set(...o.room.position),c.scale.set(...o.room.scale),this.add(c);for(const e of o.boxes){const r=new three_module_Mesh(t,s);r.position.set(...e.position),r.rotation.set(0,e.rotation,0),r.scale.set(...e.scale),this.add(r)}for(const e of o.lights){const r=new three_module_Mesh(t,this.createAreaLightMaterial(e.intensity));r.position.set(...e.position),r.scale.set(...e.scale),this.add(r)}}createAreaLightMaterial(e){const t=new MeshBasicMaterial;return t.color.setScalar(e),t}}var fh=r(5108);const _h=20,vh=/\.hdr(\.js)?$/;class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new TextureLoader),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(he)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise(((t,r)=>this.ldrLoader.load(e,t,(()=>{}),r)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const r=await this.getLottieLoader();r.setQuality(t);const s=await new Promise(((t,s)=>r.load(e,t,(()=>{}),s)));return s.name=e,s}async loadEquirect(e,t=()=>{}){try{const r=vh.test(e),s=r?this.hdrLoader:this.imageLoader,o=await new Promise(((r,o)=>s.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:s}=t;e.dispose(!1),r(s)}else r(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),o.name=e,o.mapping=j,r||(o.colorSpace=Oe),o}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,r=()=>{}){const s="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,l=Promise.resolve(null);e&&(l=this.loadEquirectFromUrl(e,r)),o=t?this.loadEquirectFromUrl(t,r):e?this.loadEquirectFromUrl(e,r):s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,h]=await Promise.all([o,l]);if(null==c)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const r=this.loadEquirect(e,t);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const r=this.threeRenderer,s=new WebGLCubeRenderTarget(256,{generateMipmaps:!1,type:he,format:de,colorSpace:ke,depthBuffer:!0}),o=new CubeCamera(.1,100,s),l=o.renderTarget.texture;l.name=t;const c=r.outputColorSpace,h=r.toneMapping;return r.toneMapping=0,r.outputColorSpace=ke,o.update(r,e),this.blurCubemap(s,.04),r.toneMapping=h,r.outputColorSpace=c,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(_h);const e=new BoxGeometry,t=new three_module_Mesh(e,this.blurMaterial);this.blurScene=new Scene,this.blurScene.add(t)}const r=e.clone();this.halfblur(e,r,t,"latitudinal"),this.halfblur(r,e,t,"longitudinal")}halfblur(e,t,r,s){const o=e.width,l=isFinite(r)?Math.PI/(2*o):2*Math.PI/39,c=r/l,h=isFinite(r)?1+Math.floor(3*c):_h;h>_h&&fh.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${h} samples when the maximum is set to 20`);const d=[];let p=0;for(let e=0;e<_h;++e){const t=e/c,r=Math.exp(-t*t/2);d.push(r),0==e?p+=r:e<h&&(p+=2*r)}for(let e=0;e<d.length;e++)d[e]=d[e]/p;const A=this.blurMaterial.uniforms;A.envMap.value=e.texture,A.samples.value=h,A.weights.value=d,A.latitudinal.value="latitudinal"===s,A.dTheta.value=l;new CubeCamera(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),r=new three_module_Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:r}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:0,depthTest:!1,depthWrite:!1,side:1})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}var yh=r(5108);const Eh=[1,.79,.62,.5,.4,.31,.25],xh="high-performance";class Renderer extends EventDispatcher{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[ea]()},this.dpr=Ks(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new WebGLRenderer({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=4}catch(e){yh.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton||(this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||xh,debug:Js()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||xh,debug:Js()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return Eh[this.scaleStep]}set minScale(e){let t=1;for(;t<Eh.length&&!(Eh[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new Vector2;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[Yd]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,r=null;for(const s of this.scenes){const{element:o}=s;o.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(r=s)}const s=t>1;if(null!=r){const t=s&&!this.multipleScenesVisible,o=!r.element.modelIsVisible;if(t||o){const{width:t,height:s}=this.sceneSize(r);this.copyPixels(r,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=Ks();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Fd](t.getBoundingClientRect())}let r=0,s=0;for(const e of this.scenes)r=Math.max(r,e.width),s=Math.max(s,e.height);if(r!==this.width||s!==this.height||t!==this.dpr){this.width=r,this.height=s,this.dpr=t,r=Math.ceil(r*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(r,s,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=r,o.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(r,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=utilities_clamp(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=Eh[e.scaleStep],r=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${r}px`,o.height=`${s}px`,this.canvas3D.style.width=`${r}px`,this.canvas3D.style.height=`${s}px`;const l=this.dpr*t,c=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:l,minimumDpr:this.dpr*Eh[this.lastStep],pixelWidth:Math.ceil(e.width*l),pixelHeight:Math.ceil(e.height*l),reason:c}}))}sceneSize(e){const{dpr:t}=this,r=Eh[e.scaleStep];return{width:Math.min(Math.ceil(e.width*r*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*r*t),this.canvas3D.height)}}copyPixels(e,t,r){const s=e.context;null!=s?(s.clearRect(0,0,t,r),s.drawImage(this.canvas3D,0,0,t,r,0,0,t,r),e.canvas.classList.add("show")):yh.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const r of this.scenes)r.element.modelIsVisible===t&&e.push(r);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,r){const{element:s,exposure:o,toneMapping:l}=e;s[$d](t,r);const c="number"==typeof o&&!Number.isNaN(o),h=s.environmentImage,d=s.skyboxImage,p=7===l&&("neutral"===h||"legacy"===h||!h&&!d);this.threeRenderer.toneMappingExposure=(c?o:1)*(p?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const r=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(r),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,r),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:r,projectionMatrix:s}=e,o=r.elements.slice(),l=t.getTarget();o[12]+=l.x,o[13]+=l.y,o[14]+=l.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:s.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:l,height:c}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,l,c),null!=t.effectRenderer?t.effectRenderer.render(r):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,l,c):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}const Mh=Symbol("correlatedObjects"),Ch=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[Ch]=e,this[Mh]=t}}const Sh=new MeshBasicMaterial,Ih=new PlaneGeometry(2,2);let bh=0;const wh=Symbol("threeTexture"),Th=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[wh](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get[Th](){return this[Mh]}constructor(e,t){super(e,new Set(t?[t]:[])),this[wh].image.src||(this[wh].image.src=t.name?t.name:"adhoc_image"+bh++),this[wh].image.name||(this[wh].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[wh].image.name||""}get uri(){return this[wh].image.src}get bufferView(){return this[wh].image.bufferView}get element(){const e=this[wh];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[wh];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[Th])t.image.name=e}update(){const e=this[wh];e&&e.isCanvasTexture&&!e.animation&&(this[wh].needsUpdate=!0,this[Ch]())}async createThumbnail(e,t){const r=new Scene;Sh.map=this[wh];const s=new three_module_Mesh(Ih,Sh);r.add(s);const o=new OrthographicCamera(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,c=new WebGLRenderTarget(e,t);l.setRenderTarget(c),l.render(r,o),l.setRenderTarget(null);const h=new Uint8Array(e*t*4);l.readRenderTargetPixels(c,0,0,e,t,h),Id.width=e,Id.height=t;const d=Id.getContext("2d"),p=d.createImageData(e,t);return p.data.set(h),d.putImageData(p,0,0),new Promise((async(e,t)=>{Id.toBlob((r=>{if(!r)return t("Failed to capture thumbnail.");e(URL.createObjectURL(r))}),"image/png")}))}}var Bh,Rh;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(Bh||(Bh={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(Rh||(Rh={}));const Lh=new Map([[Rh.Repeat,K],[Rh.ClampToEdge,J],[Rh.MirroredRepeat,$]]),Dh=new Map([[K,Rh.Repeat],[J,Rh.ClampToEdge],[$,Rh.MirroredRepeat]]),Uh=new Map([[Bh.Nearest,ee],[Bh.Linear,ne],[Bh.NearestMipmapNearest,te],[Bh.LinearMipmapNearest,re],[Bh.NearestMipmapLinear,ie],[Bh.LinearMipmapLinear,se]]),Ph=new Map([[ee,Bh.Nearest],[ne,Bh.Linear],[te,Bh.NearestMipmapNearest],[re,Bh.LinearMipmapNearest],[ie,Bh.NearestMipmapLinear],[se,Bh.LinearMipmapLinear]]),Fh=new Map([[Bh.Nearest,ee],[Bh.Linear,ne]]),Nh=new Map([[ee,Bh.Nearest],[ne,Bh.Linear]]),isMinFilter=e=>Ph.has(e),isMagFilter=e=>Nh.has(e),isWrapping=e=>Dh.has(e),Qh=Symbol("threeTexture"),Oh=Symbol("threeTextures"),kh=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[Qh](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get[Oh](){return this[Mh]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Qh].name||""}get minFilter(){return Ph.get(this[Qh].minFilter)}get magFilter(){return Nh.get(this[Qh].magFilter)}get wrapS(){return Dh.get(this[Qh].wrapS)}get wrapT(){return Dh.get(this[Qh].wrapT)}get rotation(){return this[Qh].rotation}get scale(){return toVector2D(this[Qh].repeat)}get offset(){return toVector2D(this[Qh].offset)}setMinFilter(e){this[kh]("minFilter",Uh.get(e))}setMagFilter(e){this[kh]("magFilter",Fh.get(e))}setWrapS(e){this[kh]("wrapS",Lh.get(e))}setWrapT(e){this[kh]("wrapT",Lh.get(e))}setRotation(e){null==e&&(e=0),this[kh]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[kh]("repeat",new Vector2(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[kh]("offset",new Vector2(e.u,e.v))}[kh](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const r of this[Oh])r[e]=t,r.needsUpdate=!0;this[Ch]()}}const Gh=Symbol("image"),Vh=Symbol("sampler"),Hh=Symbol("threeTexture");class texture_Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[Vh]=new Sampler(e,t),this[Gh]=new image_Image(e,t)}get[Hh](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get name(){return this[Hh].name||""}set name(e){for(const t of this[Mh])t.name=e}get sampler(){return this[Vh]}get source(){return this[Gh]}}var zh,Wh,qh;const jh=Symbol("texture"),Xh=Symbol("transform"),Yh=Symbol("materials"),Kh=Symbol("usage"),Jh=Symbol("onUpdate"),$h=Symbol("activeVideo");var Zh;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(Zh||(Zh={}));class TextureInfo{constructor(e,t,r,s){this[zh]=null,this[Wh]={rotation:0,scale:new Vector2(1,1),offset:new Vector2(0,0)},this[qh]=!1,r&&(this[Xh].rotation=r.rotation,this[Xh].scale.copy(r.repeat),this[Xh].offset.copy(r.offset),this[jh]=new texture_Texture(e,r)),this[Jh]=e,this[Yh]=s,this[Kh]=t}get texture(){return this[jh]}setTexture(e){var t,r;const s=null!=e?e.source[wh]:null,o=null===(t=this[jh])||void 0===t?void 0:t.source[wh];if(null!=o&&o.isVideoTexture?this[$h]=!1:(null===(r=this[jh])||void 0===r?void 0:r.source.animation)&&this[jh].source.animation.removeEventListener("enterFrame",this[Jh]),this[jh]=e,null!=s&&s.isVideoTexture){const e=s.image;if(this[$h]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[$h]&&(this[Jh](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[$h]&&(this[Jh](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[Jh]);let l=Oe;if(this[Yh])for(const e of this[Yh]){switch(this[Kh]){case Zh.Base:e.map=s;break;case Zh.MetallicRoughness:l=ke,e.metalnessMap=s,e.roughnessMap=s;break;case Zh.Normal:l=ke,e.normalMap=s;break;case Zh.Occlusion:l=ke,e.aoMap=s;break;case Zh.Emissive:e.emissiveMap=s;break;case Zh.Clearcoat:e.clearcoatMap=s;break;case Zh.ClearcoatRoughness:e.clearcoatRoughnessMap=s;break;case Zh.ClearcoatNormal:e.clearcoatNormalMap=s;break;case Zh.SheenColor:e.sheenColorMap=s;break;case Zh.SheenRoughness:e.sheenRoughnessMap=s;break;case Zh.Transmission:e.transmissionMap=s;break;case Zh.Thickness:e.thicknessMap=s;break;case Zh.Specular:e.specularIntensityMap=s;break;case Zh.SpecularColor:e.specularColorMap=s;break;case Zh.Iridescence:e.iridescenceMap=s;break;case Zh.IridescenceThickness:e.iridescenceThicknessMap=s;break;case Zh.Anisotropy:e.anisotropyMap=s}e.needsUpdate=!0}s&&(s.colorSpace=l,s.rotation=this[Xh].rotation,s.repeat=this[Xh].scale,s.offset=this[Xh].offset),this[Jh]()}}zh=jh,Wh=Xh,qh=$h;const eu=Symbol("threeMaterial"),tu=Symbol("threeMaterials"),iu=Symbol("baseColorTexture"),nu=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:r,metalnessMap:s}=t.values().next().value;this[iu]=new TextureInfo(e,Zh.Base,r,t),this[nu]=new TextureInfo(e,Zh.MetallicRoughness,s,t)}get[tu](){return this[Mh]}get[eu](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[eu].opacity];return this[eu].color.toArray(e),e}get metallicFactor(){return this[eu].metalness}get roughnessFactor(){return this[eu].roughness}get baseColorTexture(){return this[iu]}get metallicRoughnessTexture(){return this[nu]}setBaseColorFactor(e){const t=new Color;e instanceof Array?t.fromArray(e):t.set(e);for(const r of this[tu])r.color.set(t),e instanceof Array&&e.length>3?r.opacity=e[3]:(e=[0,0,0,r.opacity],t.toArray(e));this[Ch]()}setMetallicFactor(e){for(const t of this[tu])t.metalness=e;this[Ch]()}setRoughnessFactor(e){for(const t of this[tu])t.roughness=e;this[Ch]()}}var ru,su;const au=Symbol("pbrMetallicRoughness"),ou=Symbol("normalTexture"),lu=Symbol("occlusionTexture"),cu=Symbol("emissiveTexture"),hu=Symbol("backingThreeMaterial"),uu=Symbol("applyAlphaCutoff"),du=Symbol("getAlphaMode"),pu=Symbol("lazyLoadGLTFInfo"),Au=Symbol("initialize"),mu=Symbol("getLoadedMaterial"),gu=Symbol("ensureMaterialIsLoaded"),fu=Symbol("gltfIndex"),_u=Symbol("setActive"),vu=Symbol("variantIndices"),yu=Symbol("isActive"),Eu=Symbol("variantSet"),xu=Symbol("modelVariants"),Mu=Symbol("name"),Cu=Symbol("pbrTextures");class material_Material extends ThreeDOMElement{constructor(e,t,r,s,o,l,c=void 0){super(e,o),this[ru]=new Set,this[su]=new Map,this[fu]=t,this[yu]=r,this[xu]=s,this[Mu]=l,null==c?this[Au]():this[pu]=c}get[(ru=Eu,su=Cu,hu)](){return this[Mh].values().next().value}[Au](){const e=this[Ch],t=this[Mh];this[au]=new PBRMetallicRoughness(e,t);const{normalMap:r,aoMap:s,emissiveMap:o}=t.values().next().value;this[ou]=new TextureInfo(e,Zh.Normal,r,t),this[lu]=new TextureInfo(e,Zh.Occlusion,s,t),this[cu]=new TextureInfo(e,Zh.Emissive,o,t);const createTextureInfo=r=>{this[Cu].set(r,new TextureInfo(e,r,null,t))};createTextureInfo(Zh.Clearcoat),createTextureInfo(Zh.ClearcoatRoughness),createTextureInfo(Zh.ClearcoatNormal),createTextureInfo(Zh.SheenColor),createTextureInfo(Zh.SheenRoughness),createTextureInfo(Zh.Transmission),createTextureInfo(Zh.Thickness),createTextureInfo(Zh.Specular),createTextureInfo(Zh.SpecularColor),createTextureInfo(Zh.Iridescence),createTextureInfo(Zh.IridescenceThickness),createTextureInfo(Zh.Anisotropy)}async[mu](){if(null!=this[pu]){const{set:e,material:t}=await this[pu].doLazyLoad();return this[Mh]=e,this[Au](),this[pu]=void 0,this.ensureLoaded=async()=>{},t}return this[Mh].values().next().value}colorFromRgb(e){const t=new Color;return e instanceof Array?t.fromArray(e):t.set(e),t}[gu](){if(null!=this[pu])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[mu]()}get isLoaded(){return null==this[pu]}get isActive(){return this[yu]}[_u](e){this[yu]=e}get name(){return this[Mu]||""}set name(e){if(this[Mu]=e,null!=this[Mh])for(const t of this[Mh])t.name=e}get pbrMetallicRoughness(){return this[gu](),this[au]}get normalTexture(){return this[gu](),this[ou]}get occlusionTexture(){return this[gu](),this[lu]}get emissiveTexture(){return this[gu](),this[cu]}get emissiveFactor(){return this[gu](),this[hu].emissive.toArray()}get index(){return this[fu]}[vu](){return this[Eu]}hasVariant(e){const t=this[xu].get(e);return null!=t&&this[Eu].has(t.index)}setEmissiveFactor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.emissive.set(t);this[Ch]()}[du](){return this[hu].transparent?"BLEND":this[hu].alphaTest>0?"MASK":"OPAQUE"}[uu](){this[gu]();for(const e of this[Mh])"MASK"===this[du]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[gu]();for(const t of this[Mh])t.alphaTest=e,t.needsUpdate=!0;this[uu](),this[Ch]()}getAlphaCutoff(){return this[gu](),this[hu].alphaTest}setDoubleSided(e){this[gu]();for(const t of this[Mh])t.side=e?2:0,t.needsUpdate=!0;this[Ch]()}getDoubleSided(){return this[gu](),2==this[hu].side}setAlphaMode(e){this[gu]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[Mh])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[Ch]()}getAlphaMode(){return this[gu](),this[du]()}get emissiveStrength(){return this[gu](),this[hu].emissiveIntensity}setEmissiveStrength(e){this[gu]();for(const t of this[Mh])t.emissiveIntensity=e;this[Ch]()}get clearcoatFactor(){return this[gu](),this[hu].clearcoat}get clearcoatRoughnessFactor(){return this[gu](),this[hu].clearcoatRoughness}get clearcoatTexture(){return this[gu](),this[Cu].get(Zh.Clearcoat)}get clearcoatRoughnessTexture(){return this[gu](),this[Cu].get(Zh.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[gu](),this[Cu].get(Zh.ClearcoatNormal)}get clearcoatNormalScale(){return this[gu](),this[hu].clearcoatNormalScale.x}setClearcoatFactor(e){this[gu]();for(const t of this[Mh])t.clearcoat=e;this[Ch]()}setClearcoatRoughnessFactor(e){this[gu]();for(const t of this[Mh])t.clearcoatRoughness=e;this[Ch]()}setClearcoatNormalScale(e){this[gu]();for(const t of this[Mh])t.clearcoatNormalScale=new Vector2(e,e);this[Ch]()}get ior(){return this[gu](),this[hu].ior}setIor(e){this[gu]();for(const t of this[Mh])t.ior=e;this[Ch]()}get sheenColorFactor(){return this[gu](),this[hu].sheenColor.toArray()}get sheenColorTexture(){return this[gu](),this[Cu].get(Zh.SheenColor)}get sheenRoughnessFactor(){return this[gu](),this[hu].sheenRoughness}get sheenRoughnessTexture(){return this[gu](),this[Cu].get(Zh.SheenRoughness)}setSheenColorFactor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.sheenColor.set(t),e.sheen=1;this[Ch]()}setSheenRoughnessFactor(e){this[gu]();for(const t of this[Mh])t.sheenRoughness=e,t.sheen=1;this[Ch]()}get transmissionFactor(){return this[gu](),this[hu].transmission}get transmissionTexture(){return this[gu](),this[Cu].get(Zh.Transmission)}setTransmissionFactor(e){this[gu]();for(const t of this[Mh])t.transmission=e;this[Ch]()}get thicknessFactor(){return this[gu](),this[hu].thickness}get thicknessTexture(){return this[gu](),this[Cu].get(Zh.Thickness)}get attenuationDistance(){return this[gu](),this[hu].attenuationDistance}get attenuationColor(){return this[gu](),this[hu].attenuationColor.toArray()}setThicknessFactor(e){this[gu]();for(const t of this[Mh])t.thickness=e;this[Ch]()}setAttenuationDistance(e){this[gu]();for(const t of this[Mh])t.attenuationDistance=e;this[Ch]()}setAttenuationColor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.attenuationColor.set(t);this[Ch]()}get specularFactor(){return this[gu](),this[hu].specularIntensity}get specularTexture(){return this[gu](),this[Cu].get(Zh.Specular)}get specularColorFactor(){return this[gu](),this[hu].specularColor.toArray()}get specularColorTexture(){return this[gu](),this[Cu].get(Zh.SheenColor)}setSpecularFactor(e){this[gu]();for(const t of this[Mh])t.specularIntensity=e;this[Ch]()}setSpecularColorFactor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.specularColor.set(t);this[Ch]()}get iridescenceFactor(){return this[gu](),this[hu].iridescence}get iridescenceTexture(){return this[gu](),this[Cu].get(Zh.Iridescence)}get iridescenceIor(){return this[gu](),this[hu].iridescenceIOR}get iridescenceThicknessMinimum(){return this[gu](),this[hu].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[gu](),this[hu].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[gu](),this[Cu].get(Zh.IridescenceThickness)}setIridescenceFactor(e){this[gu]();for(const t of this[Mh])t.iridescence=e;this[Ch]()}setIridescenceIor(e){this[gu]();for(const t of this[Mh])t.iridescenceIOR=e;this[Ch]()}setIridescenceThicknessMinimum(e){this[gu]();for(const t of this[Mh])t.iridescenceThicknessRange[0]=e;this[Ch]()}setIridescenceThicknessMaximum(e){this[gu]();for(const t of this[Mh])t.iridescenceThicknessRange[1]=e;this[Ch]()}get anisotropyStrength(){return this[gu](),this[hu].anisotropy}get anisotropyRotation(){return this[gu](),this[hu].anisotropyRotation}get anisotropyTexture(){return this[gu](),this[Cu].get(Zh.Anisotropy)}setAnisotropyStrength(e){this[gu]();for(const t of this[Mh])t.anisotropy=e;this[Ch]()}setAnisotropyRotation(e){this[gu]();for(const t of this[Mh])t.anisotropyRotation=e;this[Ch]()}}var Su=r(5108);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,r,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:l,threeObjectMap:c}=s;this.parser=l.parser,this.modelVariants=r,this.mesh.userData.variantData=r;const h=c.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:Su.error(`Primitive (${e.name}) missing initial material reference.`);const d=e.userData.associations||{};if(null==d.meshes)return void Su.error("Mesh is missing primitive index association");const p=((o.meshes||[])[d.meshes].primitives||[])[d.primitives];if(null!=p){if(null!=p.material)this.materials.set(p.material,t[p.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):Su.warn("gltfPrimitive has no material!")}if(p.extensions&&p.extensions.KHR_materials_variants){const e=p.extensions.KHR_materials_variants,s=l.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=s[t];this.variantToMaterialMap.set(t,e),e[vu]().add(t),r.has(o)||r.set(o,{name:o,index:t})}}}}else Su.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[mu]();const{normalScale:r}=this.mesh.material;null!=r&&r.y*r.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const r=await this.enableVariantHelper(e);null!=r&&(t.material=r)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const r=this.modelVariants.get(t).index;return e[vu]().add(r),this.variantToMaterialMap.set(r,e),this.materials.set(e.index,e),this.updateVariantUserData(r,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[vu]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(e,{material:t[Mh].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(Su.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var Iu,bu,wu,Tu,Bu,Ru,Lu=r(5108);const Du=Symbol("materials"),Uu=Symbol("hierarchy"),Pu=Symbol("roots"),Fu=Symbol("primitives"),Nu=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),Qu=Symbol("switchVariant"),Ou=Symbol("materialFromPoint"),ku=Symbol("nodeFromPoint"),Gu=Symbol("nodeFromIndex"),Vu=Symbol("variantData"),Hu=Symbol("availableVariants"),zu=Symbol("modelOnUpdate"),Wu=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,r,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=r,this.doLazyLoad=s}}class Model{constructor(e,t=()=>{}){this[Iu]=new Array,this[bu]=new Array,this[wu]=new Array,this[Tu]=new Array,this[Bu]=()=>{},this[Ru]=new Map,this[zu]=t;const{gltf:r,threeGLTF:s,gltfElementMap:o}=e;for(const[e,l]of r.materials.entries()){const c=o.get(l);if(null!=c)this[Du].push(new material_Material(t,e,!0,this[Vu],c,l.name));else{const h=(r.materials||[])[e],d=e,materialLoadCallback=async()=>{const e=await s.parser.getDependency("material",d),t=new Set;return o.set(h,t),t.add(e),{set:t,material:e}};this[Du].push(new material_Material(t,e,!1,this[Vu],c,l.name,new LazyLoader(r,o,h,materialLoadCallback)))}}const l=new Map,c=new Array;for(const e of s.scene.children)c.push(e);for(;c.length>0;){const t=c.pop();let r=null;t instanceof three_module_Mesh?(r=new PrimitiveNode(t,this.materials,this[Vu],e),this[Fu].push(r)):r=new primitive_node_Node(t.name);const s=l.get(t);null!=s?s.children.push(r):this[Pu].push(r),this[Uu].push(r);for(const e of t.children)c.push(e),l.set(t,r)}}get materials(){return this[Du]}[(Iu=Du,bu=Uu,wu=Pu,Tu=Fu,Bu=zu,Ru=Vu,Hu)](){const e=Array.from(this[Vu].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[Du].filter((t=>t.name===e));return t.length>0?t[0]:null}[Gu](e,t){const r=this[Uu].find((r=>{if(r instanceof PrimitiveNode){const{meshes:s,primitives:o}=r.mesh.userData.associations;if(s==e&&o==t)return!0}return!1}));return null==r?null:r}[ku](e){return this[Uu].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[Ou](e){return this[ku](e).getActiveMaterial()}async[Qu](e){for(const t of this[Fu])await t.enableVariant(e);for(const e of this.materials)e[_u](!1);for(const e of this[Fu])this.materials[e.getActiveMaterial().index][_u](!0)}async[Nu](){const e=new Array;for(const t of this[Fu])e.push(t.instantiateVariants());await Promise.all(e)}[Wu](e,t){const r=this.materials[e];r.isLoaded||Lu.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const s=r[Mh],o=new Set;for(const[e,r]of s.entries()){const l=r.clone();l.name=t+(s.size>1?"_inst"+e:""),o.add(l)}const l=new material_Material(this[zu],this[Du].length,!1,this[Vu],o,t);return this[Du].push(l),l}createMaterialInstanceForVariant(e,t,r,s=!0){let o=null;for(const s of this[Fu]){const l=this[Vu].get(r);null!=l&&s.variantInfo.has(l.index)||null!=s.getMaterial(e)&&(this.hasVariant(r)||this.createVariant(r),null==o&&(o=this[Wu](e,t)),s.addVariant(o,r))}if(s&&null!=o){o[_u](!0),this.materials[e][_u](!1);for(const e of this[Fu])e.enableVariant(r)}return o}createVariant(e){this[Vu].has(e)?Lu.warn(`Variant '${e}'' already exists`):this[Vu].set(e,{name:e,index:this[Vu].size})}hasVariant(e){return this[Vu].has(e)}setMaterialToVariant(e,t){if(null!=this[Hu]().find((e=>e===t)))if(e<0||e>=this.materials.length)Lu.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const r of this[Fu]){const s=r.getMaterial(e);null!=s&&r.addVariant(s,t)}else Lu.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const r=this[Vu].get(e);null!=r&&(r.name=t,this[Vu].set(t,r),this[Vu].delete(e))}deleteVariant(e){const t=this[Vu].get(e);if(null!=t){for(const r of this.materials)r.hasVariant(e)&&r[Eu].delete(t.index);for(const e of this[Fu])e.deleteVariant(t.index);this[Vu].delete(e)}}}var scene_graph_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const qu=Symbol("currentGLTF"),ju=Symbol("originalGltfJson"),Xu=Symbol("model"),Yu=Symbol("getOnUpdateMethod"),Ku=Symbol("buildTexture");class GroundedSkybox extends three_module_Mesh{constructor(){super(void 0,new MeshBasicMaterial({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,r=128){e==this.height&&t==this.radius&&r==this.resolution||(this.height=e,this.radius=t,this.resolution=r,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,r){const s=new SphereGeometry(t,2*r,r);s.scale(1,1,-1);const o=s.getAttribute("position"),l=new three_module_Vector3;for(let t=0;t<o.count;++t)if(l.fromBufferAttribute(o,t),l.y<0){const r=3*-e/2,s=l.y<r?-e/l.y:1-l.y*l.y/(3*r*r);l.multiplyScalar(s),l.toArray(o.array,3*t)}return o.needsUpdate=!0,s}(e,t,r)))}}const Ju=new three_module_Vector3,$u=new three_module_Vector3,Zu=new three_module_Vector3,ed=new Matrix3,td=new Triangle,id=new three_module_Quaternion;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new three_module_Vector3(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=ll(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,ml(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=ll(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:r,bary:s}=this;if(null==t||null==r||null==s)return;t.getVertexPosition(r.x,Ju),t.getVertexPosition(r.y,$u),t.getVertexPosition(r.z,Zu),Ju.toArray(ed.elements,0),$u.toArray(ed.elements,3),Zu.toArray(ed.elements,6),this.position.copy(s).applyMatrix3(ed);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),td.set(Ju,$u,Zu),td.getNormal(this.normal).transformDirection(t.matrixWorld);const l=o.parent;id.setFromAxisAngle(Ju.set(0,1,0),-l.yaw),this.normal.applyQuaternion(id)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach((t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const r=t,s=r.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;r.toggleAttribute(t,e)}r.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const nd={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},rd={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};r(5108);Math.PI,Math.PI;function MathUtils_lerp(e,t,r){return(1-r)*e+r*t}class Shadow extends Object3D{constructor(e,t,r){super(),this.camera=new OrthographicCamera,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new MeshDepthMaterial,this.horizontalBlurMaterial=new ShaderMaterial(nd),this.verticalBlurMaterial=new ShaderMaterial(rd),this.intensity=0,this.softness=1,this.boundingBox=new Box3,this.size=new three_module_Vector3,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:s}=this;s.rotation.x=Math.PI/2,s.left=-.5,s.right=.5,s.bottom=-.5,s.top=.5,this.add(s);const o=new PlaneGeometry,l=new MeshBasicMaterial({opacity:1,transparent:!0,side:1});this.floor=new three_module_Mesh(o,l),this.floor.userData.noHit=!0,s.add(this.floor),this.blurPlane=new three_module_Mesh(o),this.blurPlane.visible=!1,s.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,r)}setScene(e,t,r){const{boundingBox:s,size:o,rotation:l,position:c}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(c),"back"===r){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],l.x=Math.PI/2,l.y=Math.PI}else l.x=0,l.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;o.y=this.maxDimension,s.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===r?c.y=s.min.y:c.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:r}=this,s=this.isAnimated?2:1,o=s*Math.pow(2,9-3*e);this.setMapSize(o);const l=t.y/2,c=t.y*s;r.near=0,r.far=MathUtils_lerp(c,l,e),this.depthMaterial.opacity=1/e,r.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const r=Math.floor(t.x>t.z?e:e*t.x/t.z),s=Math.floor(t.x>t.z?e*t.z/t.x:e),o=10+r,l=10+s;if(null==this.renderTarget||this.renderTarget.width===o&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:de};this.renderTarget=new WebGLRenderTarget(o,l,e),this.renderTargetBlur=new WebGLRenderTarget(o,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/r),t.z*(1+10/s),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*MathUtils_lerp(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const r=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const s=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=s,e.setRenderTarget(o),e.setClearAlpha(r)}blurShadow(e){const{camera:t,horizontalBlurMaterial:r,verticalBlurMaterial:s,renderTarget:o,renderTargetBlur:l,blurPlane:c}=this;c.visible=!0,c.material=r,r.uniforms.h.value=1/this.renderTarget.width,r.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(l),e.render(c,t),c.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(c,t),c.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}var sd=r(5108);const ad=new three_module_Vector3,od=new three_module_Vector3,ld=new three_module_Vector3,cd=new class Raycaster{constructor(e,t,r=0,s=1/0){this.ray=new Ray(e,t),this.near=r,this.far=s,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):o.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Yr.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Yr),this}intersectObject(e,t=!0,r=[]){return intersect(e,this,r,t),r.sort(ascSort),r}intersectObjects(e,t=!0,r=[]){for(let s=0,o=e.length;s<o;s++)intersect(e[s],this,r,t);return r.sort(ascSort),r}},hd=new three_module_Vector3,ud=new Vector2;class ModelScene extends Scene{constructor({canvas:e,element:t,width:r,height:s}){super(),this.annotationRenderer=new CSS2DRenderer,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new PerspectiveCamera(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new Object3D,this.animationNames=[],this.boundingBox=new Box3,this.boundingSphere=new Sphere,this.size=new three_module_Vector3,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=4,this.canScale=!0,this.isDirty=!1,this.goalTarget=new three_module_Vector3,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new PerspectiveCamera(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(r,s),this.target.name="Target",this.mixer=new three_module_AnimationMixer(this.target);const{domElement:o}=this.annotationRenderer,{style:l}=o;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(o),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let r;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{r=await new Promise((async(r,s)=>{this.cancelPendingSourceChange=()=>s();try{r(await this.element[tp].loader.load(e,this.element,t))}catch(e){s(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=r,null!=r&&(this._model=r.scene,this.target.add(r.scene));const{animations:s}=r,o=new Map,l=[];for(const e of s)o.set(e.name,e),l.push(e.name);this.animations=s,this.animationsByName=o,this.animationNames=l,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[qu]=null,this.element[ju]=null,this.element[Xu]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const r=Ks();this.externalRenderer.resize(e*r,t*r)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new Box3;e.traverse((e=>{const r=e;if(!r.material)return;if(!r.material.transparent)return;t.setFromObject(r);const s=t.getSize(hd),o=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*o||this.markBakedShadow(r)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,r=new Box3;this.boundingBox.getSize(this.size);for(const s of this.bakedShadows)r.setFromObject(s),r.min.y<e.y+this.size.y/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.z<=e.z&&r.max.z>=t.z||r.min.z<e.z+this.size.z/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.y<=e.y&&r.max.y>=t.y||this.unmarkBakedShadow(s)}applyTransform(){const{model:e}=this;if(null==e)return;const t=ll(this.element.orientation)[0].terms,r=ml(t[0]).number,s=ml(t[1]).number,o=ml(t[2]).number;e.quaternion.setFromEuler(new Euler(s,o,r,"YXZ"));const l=ll(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new Box3),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new Box3)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,r)=>Math.max(e,t.distanceToSquared(r))),0));this.idealAspect=reduceVertices(e,((e,r)=>{r.sub(t);const s=Math.sqrt(r.x*r.x+r.z*r.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(r.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)ud.set(e/window.screen.width,t/window.screen.height);else{const r=this.element.getBoundingClientRect();ud.set((e-r.x)/this.width,(t-r.y)/this.height)}return ud.multiplyScalar(2).subScalar(1),ud.y*=-1,ud}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[tp].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=ll(this.element.skyboxHeight)[0].terms[0],t=ml(e).number,r=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,r),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,r){this.goalTarget.set(-e,-t,-r)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,r=this.target.position;if(t.equals(r))return!1;{const s=this.boundingSphere.radius/10;let{x:o,y:l,z:c}=r;return o=this.targetDamperX.update(o,t.x,e,s),l=this.targetDamperY.update(l,t.y,e,s),c=this.targetDamperZ.update(c,t.z,e,s),this.groundedSkybox.position.x=-o,this.groundedSkybox.position.z=-c,this.target.position.set(o,l,c),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:r,z:s}=this.position;this.yaw=Math.atan2(e-r,t-s)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop!==Be||1&~e?this.currentAnimationAction.time:this.duration-this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,r=2201,s=1/0){if(null==this._currentGLTF)return;const{animations:o}=this;if(null==o||0===o.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<o.length&&(l=o[t])}null==l&&(l=o[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(l,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(r,s),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){sd.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){cd.setFromCamera(e,this.getCamera());return cd.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var r;const s=this.hitFromPoint(e,t);if(null==s)return null;return{position:s.point,normal:null!=s.face?s.face.normal.clone().applyNormalMatrix((new Matrix3).getNormalMatrix(s.object.matrixWorld)):cd.ray.direction.clone().multiplyScalar(-1),uv:null!==(r=s.uv)&&void 0!==r?r:null}}surfaceFromPoint(e,t=this){const r=this.element.model;if(null==r)return null;const s=this.hitFromPoint(e,t);if(null==s||null==s.face)return null;const o=r[ku](s),{meshes:l,primitives:c}=o.mesh.userData.associations,h=new three_module_Vector3,d=new three_module_Vector3,p=new three_module_Vector3,{a:A,b:m,c:g}=s.face,f=s.object;f.getVertexPosition(A,h),f.getVertexPosition(m,d),f.getVertexPosition(g,p);const _=new Triangle(h,d,p),y=new three_module_Vector3;return _.getBarycoord(f.worldToLocal(s.point),y),`${l} ${c} ${A} ${m} ${g} ${y.x.toFixed(3)} ${y.y.toFixed(3)} ${y.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let r=0,s=t.length;r<s;r++){const s=t[r];s instanceof Hotspot&&e(s)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=ll(e.surface)[0].terms;if(8!=t.length)return void sd.warn(e.surface+" does not have exactly 8 numbers.");const r=this.element.model[Gu](t[0].number,t[1].number),s=new three_module_Vector3(t[2].number,t[3].number,t[4].number);if(null==r)return void sd.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const o=r.mesh.geometry.attributes.position.count;if(s.x>=o||s.y>=o||s.z>=o)return void sd.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new three_module_Vector3(t[5].number,t[6].number,t[7].number);e.mesh=r.mesh,e.tri=s,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{ad.copy(e),od.setFromMatrixPosition(t.matrixWorld),ad.sub(od),ld.copy(t.normal).transformDirection(this.target.matrixWorld),ad.dot(ld)<0?t.hide():t.show()}))}orientHotspots(e){this.forHotspots((t=>{t.orient(e)}))}setHotspotsVisibility(e){this.forHotspots((t=>{t.visible=e}))}updateSchema(e){var t;const{schemaElement:r,element:s}=this,{alt:o,poster:l,iosSrc:c}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];c&&s.push({"@type":"MediaObject",contentUrl:c,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=l?l:void 0,name:null!=o?o:void 0,encoding:s};r.textContent=JSON.stringify(h),document.head.appendChild(r)}else null!=r.parentElement&&r.parentElement.removeChild(r)}}class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),r=>{let s;return s=Math.max(utilities_clamp(r,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,r){let s=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&o++}const l=e.progress;e.progress=t,this.totalProgress+=(t-l)*(1-this.totalProgress)/s;const c=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:c,reason:r}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var dd,pd,Ad,md,gd,fd,_d,vd,yd,Ed,xd,Md,Cd,Sd=r(5108),model_viewer_base_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Id=document.createElement("canvas"),bd=Symbol("fallbackResizeHandler"),wd=Symbol("defaultAriaLabel"),Td=Symbol("resizeObserver"),Bd=Symbol("clearModelTimeout"),Rd=Symbol("onContextLost"),Ld=Symbol("loaded"),Dd=Symbol("status"),Ud=Symbol("onFocus"),Pd=Symbol("onBlur"),Fd=Symbol("updateSize"),Nd=Symbol("intersectionObserver"),Qd=Symbol("isElementInViewport"),Od=Symbol("announceModelVisibility"),kd=Symbol("ariaLabel"),Gd=Symbol("altDefaulted"),Vd=Symbol("statusElement"),Hd=Symbol("updateStatus"),zd=Symbol("loadedTime"),Wd=Symbol("updateSource"),qd=Symbol("markLoaded"),jd=Symbol("container"),Xd=Symbol("input"),Yd=Symbol("canvas"),Kd=Symbol("scene"),Jd=Symbol("needsRender"),$d=Symbol("tick"),Zd=Symbol("onModelLoad"),ep=Symbol("onResize"),tp=Symbol("renderer"),ip=Symbol("progressTracker"),np=Symbol("getLoaded"),rp=Symbol("getModelIsVisible"),sp=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends u{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[dd]=!1,this[pd]=!1,this[Ad]=0,this[md]="",this[gd]=null,this[fd]=debounce((()=>{const e=this.getBoundingClientRect();this[Fd](e)}),50),this[_d]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[vd]=null,this[yd]=null,this[Ed]=new ProgressTracker,this[xd]=()=>{this[Vd].textContent=this[Dd]},this[Md]=()=>{this[Vd].textContent=""},this[Cd]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,r;if((e=>{D(ia,e)})(e),this[jd]=e.querySelector(".container"),this[Xd]=e.querySelector(".userInput"),this[Yd]=e.querySelector("canvas"),this[Vd]=e.querySelector("#status"),this[wd]=this[Xd].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,r=e.height}else t=300,r=150;this[Kd]=new ModelScene({canvas:this[Yd],element:this,width:t,height:r}),Promise.resolve().then((()=>{this[Fd](this.getBoundingClientRect())})),Os&&(this[Td]=new ResizeObserver((e=>{if(!this[tp].isPresenting)for(let t of e)t.target===this&&this[Fd](t.contentRect)}))),ks?this[Nd]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[Qd]=t.isIntersecting,this[Od](e),this[Qd]&&!this.loaded&&this[Wd]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[Qd]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[vo].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[vo].evictionThreshold}static set minimumRenderScale(e){e>1&&Sd.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&Sd.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[np]()}get[(dd=Qd,pd=Ld,Ad=zd,md=Dd,gd=Bd,fd=bd,_d=Od,vd=Td,yd=Nd,Ed=ip,tp)](){return Renderer.singleton}get modelIsVisible(){return this[rp]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Os?this[Td].observe(this):self.addEventListener("resize",this[bd]),ks&&this[Nd].observe(this),this.addEventListener("focus",this[Ud]),this.addEventListener("blur",this[Pd]);const e=this[tp];e.addEventListener("contextlost",this[Rd]),e.registerScene(this[Kd]),null!=this[Bd]&&(self.clearTimeout(this[Bd]),this[Bd]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Os?this[Td].unobserve(this):self.removeEventListener("resize",this[bd]),ks&&this[Nd].unobserve(this),this.removeEventListener("focus",this[Ud]),this.removeEventListener("blur",this[Pd]);const e=this[tp];e.removeEventListener("contextlost",this[Rd]),e.unregisterScene(this[Kd]),this[Bd]=self.setTimeout((()=>{this[Kd].dispose(),this[Bd]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Ld]=!1,this[zd]=0,this[Kd].reset()):this.src!==this[Kd].url&&(this[Ld]=!1,this[zd]=0,this[Wd]())),e.has("alt")&&this[Xd].setAttribute("aria-label",this[kd]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[tp].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[Kd].updateSchema(this.src):this[Kd].updateSchema(null))}toDataURL(e,t){return this[tp].displayCanvas(this[Kd]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,r=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:o,height:l,idealAspect:c,aspect:h}=this[Kd],{dpr:d,scaleFactor:p}=this[tp];let A=o*p*d,m=l*p*d,g=0,f=0;if(!0===s)if(c>h){const e=m;m=Math.round(A/c),f=(e-m)/2}else{const e=A;A=Math.round(m*c),g=(e-A)/2}Id.width=A,Id.height=m;try{return new Promise((async(e,s)=>{Id.getContext("2d").drawImage(this[tp].displayCanvas(this[Kd]),g,f,A,m,0,0,A,m),Id.toBlob((t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)}),t,r)}))}finally{this[Fd]({width:o,height:l})}}registerEffectComposer(e){e.setRenderer(this[tp].threeRenderer),e.setMainCamera(this[Kd].getCamera()),e.setMainScene(this[Kd]),this[Kd].effectRenderer=e}unregisterEffectComposer(){this[Kd].effectRenderer=null}registerRenderer(e){this[Kd].externalRenderer=e}unregisterRenderer(){this[Kd].externalRenderer=null}get[kd](){return this[Gd]}get[Gd](){return null==this.alt||"null"===this.alt?this[wd]:this.alt}[np](){return this[Ld]}[rp](){return this.loaded&&this[Qd]}[sp](){return!!this.src&&this[Qd]}[Fd]({width:e,height:t}){0!==e&&0!==t&&(this[jd].style.width=`${e}px`,this[jd].style.height=`${t}px`,this[ep]({width:e,height:t}))}[$d](e,t){var r;null===(r=this[Kd].effectRenderer)||void 0===r||r.beforeRender(e,t)}[qd](){this[Ld]||(this[Ld]=!0,this[zd]=performance.now())}[Jd](){this[Kd].queueRender()}[Zd](){}[Hd](e){this[Dd]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Vd].textContent!=e&&(this[Vd].textContent=e)}[(xd=Ud,Md=Pd,ep)](e){this[Kd].setSize(e.width,e.height)}async[(Cd=Rd,Wd)](){const e=this[Kd];if(this.loaded||!this[sp]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[Hd]("Loading"),e.stopAnimation();const t=this[ip].beginActivity("model-load"),r=this.src;try{const s=e.setSource(r,(e=>t(.95*utilities_clamp(e,0,1)))),o=this[ea]();await Promise.all([s,o]),this[qd](),this[Zd](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:r}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const ap=Symbol("changeAnimation"),op=Symbol("paused"),lp={repetitions:1/0,pingpong:!1},cp=Symbol("hotspotMap"),hp=Symbol("mutationCallback"),up=Symbol("observer"),dp=Symbol("addHotspot"),pp=Symbol("removeHotspot"),Ap=new three_module_Matrix4;var mp=Uint8Array,gp=Uint16Array,fp=Int32Array,_p=new mp([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),vp=new mp([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yp=new mp([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var r=new gp(31),s=0;s<31;++s)r[s]=t+=1<<e[s-1];var o=new fp(r[30]);for(s=1;s<30;++s)for(var l=r[s];l<r[s+1];++l)o[l]=l-r[s]<<5|s;return{b:r,r:o}},Ep=freb(_p,2),xp=Ep.b,Mp=Ep.r;xp[28]=258,Mp[258]=28;for(var Cp=freb(vp,0),Sp=(Cp.b,Cp.r),Ip=new gp(32768),bp=0;bp<32768;++bp){var wp=(43690&bp)>>1|(21845&bp)<<1;wp=(61680&(wp=(52428&wp)>>2|(13107&wp)<<2))>>4|(3855&wp)<<4,Ip[bp]=((65280&wp)>>8|(255&wp)<<8)>>1}var hMap=function(e,t,r){for(var s=e.length,o=0,l=new gp(t);o<s;++o)e[o]&&++l[e[o]-1];var c,h=new gp(t);for(o=1;o<t;++o)h[o]=h[o-1]+l[o-1]<<1;if(r){c=new gp(1<<t);var d=15-t;for(o=0;o<s;++o)if(e[o])for(var p=o<<4|e[o],A=t-e[o],m=h[e[o]-1]++<<A,g=m|(1<<A)-1;m<=g;++m)c[Ip[m]>>d]=p}else for(c=new gp(s),o=0;o<s;++o)e[o]&&(c[o]=Ip[h[e[o]-1]++]>>15-e[o]);return c},Tp=new mp(288);for(bp=0;bp<144;++bp)Tp[bp]=8;for(bp=144;bp<256;++bp)Tp[bp]=9;for(bp=256;bp<280;++bp)Tp[bp]=7;for(bp=280;bp<288;++bp)Tp[bp]=8;var Bp=new mp(32);for(bp=0;bp<32;++bp)Bp[bp]=5;var Rp=hMap(Tp,9,0),Lp=hMap(Bp,5,0),shft=function(e){return(e+7)/8|0},slc=function(e,t,r){return(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length),new mp(e.subarray(t,r))},Dp=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],err=function(e,t,r){var s=new Error(t||Dp[e]);if(s.code=e,Error.captureStackTrace&&Error.captureStackTrace(s,err),!r)throw s;return s},wbits=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8},wbits16=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8,e[s+2]|=r>>16},hTree=function(e,t){for(var r=[],s=0;s<e.length;++s)e[s]&&r.push({s,f:e[s]});var o=r.length,l=r.slice();if(!o)return{t:Pp,l:0};if(1==o){var c=new mp(r[0].s+1);return c[r[0].s]=1,{t:c,l:1}}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var h=r[0],d=r[1],p=0,A=1,m=2;for(r[0]={s:-1,f:h.f+d.f,l:h,r:d};A!=o-1;)h=r[r[p].f<r[m].f?p++:m++],d=r[p!=A&&r[p].f<r[m].f?p++:m++],r[A++]={s:-1,f:h.f+d.f,l:h,r:d};var g=l[0].s;for(s=1;s<o;++s)l[s].s>g&&(g=l[s].s);var f=new gp(g+1),_=fflate_module_ln(r[A-1],f,0);if(_>t){s=0;var y=0,E=_-t,x=1<<E;for(l.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));s<o;++s){var C=l[s].s;if(!(f[C]>t))break;y+=x-(1<<_-f[C]),f[C]=t}for(y>>=E;y>0;){var S=l[s].s;f[S]<t?y-=1<<t-f[S]++-1:++s}for(;s>=0&&y;--s){var I=l[s].s;f[I]==t&&(--f[I],++y)}_=t}return{t:new mp(f),l:_}},fflate_module_ln=function(e,t,r){return-1==e.s?Math.max(fflate_module_ln(e.l,t,r+1),fflate_module_ln(e.r,t,r+1)):t[e.s]=r},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new gp(++t),s=0,o=e[0],l=1,w=function(e){r[s++]=e},c=1;c<=t;++c)if(e[c]==o&&c!=t)++l;else{if(!o&&l>2){for(;l>138;l-=138)w(32754);l>2&&(w(l>10?l-11<<5|28690:l-3<<5|12305),l=0)}else if(l>3){for(w(o),--l;l>6;l-=6)w(8304);l>2&&(w(l-3<<5|8208),l=0)}for(;l--;)w(o);l=1,o=e[c]}return{c:r.subarray(0,s),n:t}},clen=function(e,t){for(var r=0,s=0;s<t.length;++s)r+=e[s]*t[s];return r},wfblk=function(e,t,r){var s=r.length,o=shft(t+2);e[o]=255&s,e[o+1]=s>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var l=0;l<s;++l)e[o+l+4]=r[l];return 8*(o+4+s)},wblk=function(e,t,r,s,o,l,c,h,d,p,A){wbits(t,A++,r),++o[256];for(var m=hTree(o,15),g=m.t,f=m.l,_=hTree(l,15),y=_.t,E=_.l,x=lc(g),C=x.c,S=x.n,I=lc(y),b=I.c,T=I.n,B=new gp(19),U=0;U<C.length;++U)++B[31&C[U]];for(U=0;U<b.length;++U)++B[31&b[U]];for(var F=hTree(B,7),Q=F.t,O=F.l,G=19;G>4&&!Q[yp[G-1]];--G);var W,q,j,X,Y=p+5<<3,K=clen(o,Tp)+clen(l,Bp)+c,J=clen(o,g)+clen(l,y)+c+14+3*G+clen(B,Q)+2*B[16]+3*B[17]+7*B[18];if(d>=0&&Y<=K&&Y<=J)return wfblk(t,A,e.subarray(d,d+p));if(wbits(t,A,1+(J<K)),A+=2,J<K){W=hMap(g,f,0),q=g,j=hMap(y,E,0),X=y;var $=hMap(Q,O,0);wbits(t,A,S-257),wbits(t,A+5,T-1),wbits(t,A+10,G-4),A+=14;for(U=0;U<G;++U)wbits(t,A+3*U,Q[yp[U]]);A+=3*G;for(var ee=[C,b],te=0;te<2;++te){var ie=ee[te];for(U=0;U<ie.length;++U){var ne=31&ie[U];wbits(t,A,$[ne]),A+=Q[ne],ne>15&&(wbits(t,A,ie[U]>>5&127),A+=ie[U]>>12)}}}else W=Rp,q=Tp,j=Lp,X=Bp;for(U=0;U<h;++U){var re=s[U];if(re>255){wbits16(t,A,W[(ne=re>>18&31)+257]),A+=q[ne+257],ne>7&&(wbits(t,A,re>>23&31),A+=_p[ne]);var se=31&re;wbits16(t,A,j[se]),A+=X[se],se>3&&(wbits16(t,A,re>>5&8191),A+=vp[se])}else wbits16(t,A,W[re]),A+=q[re]}return wbits16(t,A,W[256]),A+q[256]},Up=new fp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pp=new mp(0),dflt=function(e,t,r,s,o,l){var c=l.z||e.length,h=new mp(s+c+5*(1+Math.ceil(c/7e3))+o),d=h.subarray(s,h.length-o),p=l.l,A=7&(l.r||0);if(t){A&&(d[0]=l.r>>3);for(var m=Up[t-1],g=m>>13,f=8191&m,_=(1<<r)-1,y=l.p||new gp(32768),E=l.h||new gp(_+1),x=Math.ceil(r/3),C=2*x,hsh=function(t){return(e[t]^e[t+1]<<x^e[t+2]<<C)&_},S=new fp(25e3),I=new gp(288),b=new gp(32),T=0,B=0,U=l.i||0,F=0,Q=l.w||0,O=0;U+2<c;++U){var G=hsh(U),W=32767&U,q=E[G];if(y[W]=q,E[G]=W,Q<=U){var j=c-U;if((T>7e3||F>24576)&&(j>423||!p)){A=wblk(e,d,0,S,I,b,B,F,O,U-O,A),F=T=B=0,O=U;for(var X=0;X<286;++X)I[X]=0;for(X=0;X<30;++X)b[X]=0}var Y=2,K=0,J=f,$=W-q&32767;if(j>2&&G==hsh(U-$))for(var ee=Math.min(g,j)-1,te=Math.min(32767,U),ie=Math.min(258,j);$<=te&&--J&&W!=q;){if(e[U+Y]==e[U+Y-$]){for(var ne=0;ne<ie&&e[U+ne]==e[U+ne-$];++ne);if(ne>Y){if(Y=ne,K=$,ne>ee)break;var re=Math.min($,ne-2),se=0;for(X=0;X<re;++X){var ae=U-$+X&32767,oe=ae-y[ae]&32767;oe>se&&(se=oe,q=ae)}}}$+=(W=q)-(q=y[W])&32767}if(K){S[F++]=268435456|Mp[Y]<<18|Sp[K];var le=31&Mp[Y],ce=31&Sp[K];B+=_p[le]+vp[ce],++I[257+le],++b[ce],Q=U+Y,++T}else S[F++]=e[U],++I[e[U]]}}for(U=Math.max(U,Q);U<c;++U)S[F++]=e[U],++I[e[U]];A=wblk(e,d,p,S,I,b,B,F,O,U-O,A),p||(l.r=7&A|d[A/8|0]<<3,A-=7,l.h=E,l.p=y,l.i=U,l.w=Q)}else{for(U=l.w||0;U<c+p;U+=65535){var he=U+65535;he>=c&&(d[A/8|0]=p,he=c),A=wfblk(d,A+1,e.subarray(U,he))}l.i=c}return slc(h,0,s+shft(A)+o)},Fp=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,s=9;--s;)r=(1&r&&-306674912)^r>>>1;e[t]=r}return e}(),crc=function(){var e=-1;return{p:function(t){for(var r=e,s=0;s<t.length;++s)r=Fp[255&r^t[s]]^r>>>8;e=r},d:function(){return~e}}},dopt=function(e,t,r,s,o){if(!o&&(o={l:1},t.dictionary)){var l=t.dictionary.subarray(-32768),c=new mp(l.length+e.length);c.set(l),c.set(e,l.length),e=c,o.w=l.length}return dflt(e,null==t.level?6:t.level,null==t.mem?o.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,r,s,o)},mrg=function(e,t){var r={};for(var s in e)r[s]=e[s];for(var s in t)r[s]=t[s];return r},wbytes=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,r,s){for(var o in e){var l=e[o],c=t+o,h=s;Array.isArray(l)&&(h=mrg(s,l[1]),l=l[0]),l instanceof mp?r[c]=[l,h]:(r[c+="/"]=[new mp(0),h],fltn(l,c,r,s))}},Np="undefined"!=typeof TextEncoder&&new TextEncoder,Qp="undefined"!=typeof TextDecoder&&new TextDecoder;try{Qp.decode(Pp,{stream:!0}),1}catch(e){}function strToU8(e,t){if(t){for(var r=new mp(e.length),s=0;s<e.length;++s)r[s]=e.charCodeAt(s);return r}if(Np)return Np.encode(e);var o=e.length,l=new mp(e.length+(e.length>>1)),c=0,w=function(e){l[c++]=e};for(s=0;s<o;++s){if(c+5>l.length){var h=new mp(c+8+(o-s<<1));h.set(l),l=h}var d=e.charCodeAt(s);d<128||t?w(d):d<2048?(w(192|d>>6),w(128|63&d)):d>55295&&d<57344?(w(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++s))>>18),w(128|d>>12&63),w(128|d>>6&63),w(128|63&d)):(w(224|d>>12),w(128|d>>6&63),w(128|63&d))}return slc(l,0,c)}var exfl=function(e){var t=0;if(e)for(var r in e){var s=e[r].length;s>65535&&err(9),t+=s+4}return t},wzh=function(e,t,r,s,o,l,c,h){var d=s.length,p=r.extra,A=h&&h.length,m=exfl(p);wbytes(e,t,null!=c?33639248:67324752),t+=4,null!=c&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(l<0&&8),e[t++]=o&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var g=new Date(null==r.mtime?Date.now():r.mtime),f=g.getFullYear()-1980;if((f<0||f>119)&&err(10),wbytes(e,t,f<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>1),t+=4,-1!=l&&(wbytes(e,t,r.crc),wbytes(e,t+4,l<0?-l-2:l),wbytes(e,t+8,r.size)),wbytes(e,t+12,d),wbytes(e,t+14,m),t+=16,null!=c&&(wbytes(e,t,A),wbytes(e,t+6,r.attrs),wbytes(e,t+10,c),t+=14),e.set(s,t),t+=d,m)for(var _ in p){var y=p[_],E=y.length;wbytes(e,t,+_),wbytes(e,t+2,E),e.set(y,t+4),t+=4+E}return A&&(e.set(h,t),t+=A),t},wzf=function(e,t,r,s,o){wbytes(e,t,101010256),wbytes(e,t+8,r),wbytes(e,t+10,r),wbytes(e,t+12,s),wbytes(e,t+16,o)};"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var Op=r(5108);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1,maxTextureSize:1024},t);const r={},s="model.usda";r[s]=null;let o=buildHeader();o+=function buildSceneStart(e){return`def Xform "Root"\n{\n\tdef Scope "Scenes" (\n\t\tkind = "sceneLibrary"\n\t)\n\t{\n\t\tdef Xform "Scene" (\n\t\t\tcustomData = {\n\t\t\t\tbool preliminary_collidesWithEnvironment = 0\n\t\t\t\tstring sceneName = "Scene"\n\t\t\t}\n\t\t\tsceneName = "Scene"\n\t\t)\n\t\t{\n\t\ttoken preliminary:anchoring:type = "${e.ar.anchoring.type}"\n\t\ttoken preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"\n\n`}(t);const l={},c={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,s=e.material;if(s.isMeshStandardMaterial){const c="geometries/Geometry_"+t.id+".usda";if(!(c in r)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",r=e.attributes,s=r.position.count;return`\n\tdef Mesh "${t}"\n\t{\n\t\tint[] faceVertexCounts = [${function buildMeshVertexCount(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]\n\t\tint[] faceVertexIndices = [${function buildMeshVertexIndices(e){const t=e.index,r=[];if(null!==t)for(let e=0;e<t.count;e++)r.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)r.push(e)}return r.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(r.normal,s)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(r.position,s)}]\n${function buildPrimvars(e){let t="";for(let r=0;r<4;r++){const s=r>0?r:"",o=e["uv"+s];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${s} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}const r=e.color;if(void 0!==r){t+=`\n\tcolor3f[] primvars:displayColor = [${buildVector3Array(r,r.count)}] (\n\t\tinterpolation = "vertex"\n\t\t)`}return t}(r)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);r[c]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}s.uuid in l||(l[s.uuid]=s),o+=function buildXform(e,t,r){const s="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&Op.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${s}" (\n\tprepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>\n\tprepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n\tmatrix4d xformOp:transform = ${o}\n\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\trel material:binding = </Materials/Material_${r.id}>\n}\n\n`}(e,t,s)}else Op.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(o+=function buildCamera(e){const t=e.name?e.name:"Camera_"+e.id,r=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&Op.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return e.isOrthographicCamera?`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(kp)}, ${e.far.toPrecision(kp)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(kp)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(kp)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(kp)}, ${e.far.toPrecision(kp)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(kp)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(kp)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(kp)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(kp)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,r=!1){const s=[];for(const o in e){const l=e[o];s.push(buildMaterial(l,t,r))}return`def "Materials"\n{\n${s.join("")}\n}\n\n`}(l,c,t.quickLookCompatible),r[s]=strToU8(o),o=null;for(const e in c){let s=c[e];!0===s.isCompressedTexture&&(s=decompress(s));const o=imageToCanvas(s.image,s.flipY,t.maxTextureSize),l=await new Promise((e=>o.toBlob(e,"image/png",1)));r[`textures/Texture_${e}.png`]=new Uint8Array(await l.arrayBuffer())}let h=0;for(const e in r){const t=r[e];h+=34+e.length;const s=63&h;if(4!==s){const o=new Uint8Array(64-s);r[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var r={},s=[];fltn(e,"",r,t);var o=0,l=0;for(var c in r){var h=r[c],d=h[0],p=h[1],A=0==p.level?0:8,m=(B=strToU8(c)).length,g=p.comment,f=g&&strToU8(g),_=f&&f.length,y=exfl(p.extra);m>65535&&err(11);var E=A?deflateSync(d,p):d,x=E.length,C=crc();C.p(d),s.push(mrg(p,{size:d.length,crc:C.d(),c:E,f:B,m:f,u:m!=c.length||f&&g.length!=_,o,compression:A})),o+=30+m+y+x,l+=76+2*(m+y)+(_||0)+x}for(var S=new mp(l+22),I=o,b=l-o,T=0;T<s.length;++T){var B=s[T];wzh(S,B.o,B,B.f,B.u,B.c.length);var U=30+B.f.length+exfl(B.extra);S.set(B.c,B.o+U),wzh(S,o,B,B.f,B.u,B.c.length,B.o,B.m),o+=16+U+(B.m?B.m.length:0)}return wzf(S,o,s.length,b,I),S}(r,{level:0})}}function imageToCanvas(e,t,r){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const s=r/Math.max(e.width,e.height),o=document.createElement("canvas");o.width=e.width*Math.min(1,s),o.height=e.height*Math.min(1,s);const l=o.getContext("2d");return!0===t&&(l.translate(0,o.height),l.scale(1,-1)),l.drawImage(e,0,0,o.width,o.height),o}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const kp=7;function buildHeader(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function buildMatrix(e){const t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return Op.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const r=[];for(let t=0;t<e.count;t++){const s=e.getX(t),o=e.getY(t),l=e.getZ(t);r.push(`(${s.toPrecision(kp)}, ${o.toPrecision(kp)}, ${l.toPrecision(kp)})`)}return r.join(", ")}function buildVector2Array(e){const t=[];for(let r=0;r<e.count;r++){const s=e.getX(r),o=e.getY(r);t.push(`(${s.toPrecision(kp)}, ${1-o.toPrecision(kp)})`)}return t.join(", ")}function buildMaterial(e,t,r=!1){const s="\t\t\t",o=[],l=[];function buildTexture(s,o,l){const c=s.source.id+"_"+s.flipY;t[c]=s;const h=s.channel>0?"st"+s.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},p=s.repeat.clone(),A=s.offset.clone(),m=s.rotation,g=Math.sin(m),f=Math.cos(m);return A.y=1-A.y-p.y,r?(A.x=A.x/p.x,A.y=A.y/p.y,A.x+=g/p.x,A.y+=f-1):(A.x+=g*p.x,A.y+=(1-f)*p.y),`\n\t\tdef Shader "PrimvarReader_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${h}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${o}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(kp)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(p)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(A)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${s.id}_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${c}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${o}.outputs:result>\n\t\t\t${void 0!==l?"float4 inputs:scale = "+function buildColor4(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(l):""}\n\t\t\ttoken inputs:sourceColorSpace = "${s.colorSpace===Qe?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[s.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[s.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${e.transparent||e.alphaTest>0?"float outputs:a":""}\n\t\t}`}return 2===e.side&&Op.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(o.push(`${s}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),o.push(`${s}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):o.push(`${s}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(o.push(`${s}color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),l.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&o.push(`${s}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(o.push(`${s}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(o.push(`${s}float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),l.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(o.push(`${s}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):o.push(`${s}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(o.push(`${s}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):o.push(`${s}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),o.push(`${s}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):o.push(`${s}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(o.push(`${s}float inputs:clearcoat = ${e.clearcoat}`),o.push(`${s}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),o.push(`${s}float inputs:ior = ${e.ior}`)),`\n\tdef Material "Material_${e.id}"\n\t{\n\t\tdef Shader "PreviewSurface"\n\t\t{\n\t\t\tuniform token info:id = "UsdPreviewSurface"\n${o.join("\n")}\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>\n\n${l.join("\n")}\n\n\t}\n`}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}var Gp=r(5108),ar_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};let Vp=!1,Hp=!1;const zp="#model-viewer-no-ar-fallback",Wp=(qp=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=ll(e),r=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>qp.indexOf(e)>-1));return new Set(r)}catch(e){}return new Set});var qp;const jp="quick-look",Xp="scene-viewer",Yp="webxr",Kp="none",Jp=Symbol("arButtonContainer"),$p=Symbol("enterARWithWebXR"),Zp=Symbol("openSceneViewer"),eA=Symbol("openIOSARQuickLook"),tA=Symbol("canActivateAR"),iA=Symbol("arMode"),nA=Symbol("arModes"),rA=Symbol("arAnchor"),sA=Symbol("preload"),aA=Symbol("onARButtonContainerClick"),oA=Symbol("onARStatus"),lA=Symbol("onARTracking"),cA=Symbol("onARTap"),hA=Symbol("selectARMode"),uA=Symbol("triggerLoad");var loading_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const dA="auto",pA="auto",AA="eager",mA=Symbol("defaultProgressBarElement"),gA=Symbol("posterContainerElement"),fA=Symbol("defaultPosterElement"),_A=Symbol("shouldDismissPoster"),vA=Symbol("hidePoster"),yA=Symbol("modelIsRevealed"),EA=Symbol("updateProgressBar"),xA=Symbol("ariaLabelCallToAction"),MA=Symbol("onProgress");var staging_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const CA=Math.PI/32,SA={basis:[degreesToRadians(numberNode(CA,"rad"))],keywords:{auto:[null]}},IA=Symbol("autoRotateStartTime"),bA=Symbol("radiansPerSecond"),wA=Symbol("syncRotationRate"),TA=Symbol("onCameraChange"),BA=(e=>{var t,r,s;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[r]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[dp](e)})),e.removedNodes.forEach((e=>{this[pp](e)})),this[Jd]())}))},this[s]=new MutationObserver(this[hp])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[dp](this.children[e]);const{ShadyDOM:e}=self;null==e?this[up].observe(this,{childList:!0}):this[up]=e.observeChildren(this,this[hp])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[up].disconnect():e.unobserveChildren(this[up])}[(t=cp,r=hp,s=up,$d)](e,t){super[$d](e,t);const r=this[Kd],{annotationRenderer:s}=r,o=r.getCamera();r.shouldRender()&&(r.updateSurfaceHotspots(),r.updateHotspotsVisibility(o.position),s.domElement.style.display="",s.render(r,o))}updateHotspot(e){const t=this[cp].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[Jd]())}queryHotspot(e){const t=this[cp].get(e);if(null==t)return null;const r=toVector3D(t.position),s=toVector3D(t.normal),o=t.facingCamera,l=this[Kd],c=l.getCamera(),h=new three_module_Vector3;h.setFromMatrixPosition(t.matrixWorld),h.project(c);const d=l.width/2,p=l.height/2;h.x=h.x*d+d,h.y=-h.y*p+p;const A=toVector3D(new three_module_Vector3(h.x,h.y,h.z));return Number.isFinite(A.x)&&Number.isFinite(A.y)?{position:r,normal:s,canvasPosition:A,facingCamera:o}:null}positionAndNormalFromPoint(e,t){const r=this[Kd],s=r.getNDC(e,t),o=r.positionAndNormalFromPoint(s);if(null==o)return null;Ap.copy(r.target.matrixWorld).invert();const l=toVector3D(o.position.applyMatrix4(Ap)),c=toVector3D(o.normal.transformDirection(Ap));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:l,normal:c,uv:h}}surfaceFromPoint(e,t){const r=this[Kd],s=r.getNDC(e,t);return r.surfaceFromPoint(s)}[dp](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[cp].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[cp].set(e.slot,t),this[Kd].addHotspot(t)),this[Kd].queueRender()}[pp](e){if(!(e instanceof HTMLElement))return;const t=this[cp].get(e.slot);t&&(t.decrement()&&(this[Kd].removeHotspot(t),this[cp].delete(e.slot)),this[Kd].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,r,s;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[r]=null,this[s]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[Xu]}get availableVariants(){return this.model?this.model[Hu]():[]}get originalGltfJson(){return this[ju]}[(t=Xu,r=qu,s=ju,Yu)](){return()=>{this[Jd]()}}[Ku](e){return e.colorSpace=Oe,e.wrapS=K,e.wrapT=K,new texture_Texture(this[Yu](),e)}async createTexture(e,t="image/png"){const{textureUtils:r}=this[tp],s=await r.loadImage(e);return s.userData.mimeType=t,this[Ku](s)}async createLottieTexture(e,t=1){const{textureUtils:r}=this[tp],s=await r.loadLottie(e,t);return this[Ku](s)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const r=new VideoTexture(t);return this[Ku](r)}createCanvasTexture(){const e=document.createElement("canvas"),t=new CanvasTexture(e);return this[Ku](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[ip].beginActivity("variant-update");e(.1);const t=this[Xu],{variantName:r}=this;null!=t&&(await t[Qu](r),this[Jd](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[Kd];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[tp].arRenderer.onUpdateScene(),this[Jd]()}}[Zd](){super[Zd]();const{currentGLTF:e}=this[Kd];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[qu]&&(this[Xu]=new Model(t,this[Yu]()),this[ju]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[qu]=e}async exportScene(e){const t=this[Kd];return new Promise((async(r,s)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const l=t.shadow;let c=!1;null!=l&&(c=l.visible,l.visible=!1),await this[Xu][Nu]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>r(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>s("glTF export failed")),o),null!=l&&(l.visible=c)}))}materialFromPoint(e,t){const r=this[Xu];if(null==r)return null;const s=this[Kd],o=s.getNDC(e,t),l=s.hitFromPoint(o);return null==l||null==l.face?null:r[Ou](l)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,r,s;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[r]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[IA]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[TA]),this[IA]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[TA]),this[IA]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[IA]=performance.now())}[(t=IA,r=bA,wA)](e){this[bA]=e[0]}[$d](e,t){if(super[$d](e,t),!this.autoRotate||!this[rp]()||this[tp].isPresenting)return;const r=Math.min(t,e-this[IA]-this.autoRotateDelay);r>0&&(this[Kd].yaw=this.turntableRotation+this[bA]*r*.001)}get turntableRotation(){return this[Kd].yaw}resetTurntableRotation(e=0){this[Kd].yaw=e}}return s=TA,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:SA,updateHandler:wA}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,r,s;class EnvironmentModelViewerElement extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[r]=null,this[s]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[Kd].setShadowIntensity(.5*this.shadowIntensity),this[Jd]()),e.has("shadowSoftness")&&(this[Kd].setShadowSoftness(this.shadowSoftness),this[Jd]()),e.has("exposure")&&(this[Kd].exposure=this.exposure,this[Jd]()),e.has("toneMapping")&&(this[Kd].toneMapping="commerce"===this.toneMapping||"neutral"===this.toneMapping?7:"agx"===this.toneMapping?6:4,this[Jd]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[sp]()&&this[ea](),e.has("skyboxHeight")&&(this[Kd].setGroundedSkybox(),this[Jd]())}hasBakedShadow(){return this[Kd].bakedShadows.size>0}async[(t=$s,r=Zs,s=ta,ea)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[ta]&&(this[ta](),this[ta]=null);const{textureUtils:r}=this[tp];if(null==r)return;const s=this[ip].beginActivity("environment-update");try{const{environmentMap:o,skybox:l}=await r.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>s(utilities_clamp(e,0,1))));this[$s]!==o&&(this[$s]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[Zs]=null!=l?l.name===o.name?o:l:null,this[Kd].setEnvironmentAndSkybox(this[$s],this[Zs])}catch(e){if(e instanceof Error)throw this[Kd].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A,m,g,f,_,y,E,x,C;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=Xl,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=Jl,this.interactionPromptStyle=Zl,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=ec,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[r]=this.shadowRoot.querySelector("#prompt"),this[s]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[o]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[c]=1/0,this[h]=!1,this[d]=!1,this[p]=Gc.AUTOMATIC,this[A]=new SmoothControls(this[Kd].camera,this[Xd],this[Kd]),this[m]=new Spherical,this[g]=!1,this[f]=!1,this[_]=!1,this[y]={},this[E]=()=>{const e=this[ac].changeSource;this[Cc]=e,e===Gc.USER_INTERACTION&&(this[Ec]=!0,this[dc]())},this[x]=()=>{this[pc](),this[Jd]();const e=this[ac].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[C]=e=>{this[jd].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[ac].inputSensitivity}set inputSensitivity(e){this[ac].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:r}=this[Sc];return{theta:e,phi:t,radius:r,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[tp].isPresenting?this[tp].arRenderer.target:this[Kd].getTarget())}getFieldOfView(){return this[ac].getFieldOfView()}getMinimumFieldOfView(){return this[ac].options.minimumFieldOfView}getMaximumFieldOfView(){return this[ac].options.maximumFieldOfView}getIdealAspect(){return this[Kd].idealAspect}jumpCameraToGoal(){this[Ic]=!0,this.requestUpdate(Ic,!1)}resetInteractionPrompt(){this[Mc]=0,this[xc]=1/0,this[Ec]=!1,this[yc]=this.interactionPrompt===Jl&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Xd].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[ac].addEventListener("user-interaction",this[fc]),this[ac].addEventListener("pointer-change-start",this[vc]),this[ac].addEventListener("pointer-change-end",this[vc])}disconnectedCallback(){super.disconnectedCallback(),this[ac].removeEventListener("user-interaction",this[fc]),this[ac].removeEventListener("pointer-change-start",this[vc]),this[ac].removeEventListener("pointer-change-end",this[vc])}updated(e){super.updated(e);const t=this[ac],r=this[Kd];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===Jl&&(this[yc]=!0)):(t.disableInteraction(),this[dc]()),this[Xd].setAttribute("aria-label",this[kd])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===Jl&&this.cameraControls&&!this[Ec]?this[yc]=!0:this[dc]()),e.has("interactionPromptStyle")&&(this[hc].style.opacity=this.interactionPromptStyle==$l?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),r.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[mc](),!0===this[Ic]&&Promise.resolve().then((()=>{t.jumpToGoal(),r.jumpToGoal(),this[_c](),this[Ic]=!1}))}async updateFraming(){const e=this[Kd],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const r=e.adjustedFoV(e.framedFoVDeg),s=this[ac].getFieldOfView()/t;this[ac].setFieldOfView(r*s),this[wc]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,r){const s=this[Xd],o=this[uc];if("1"===o[0].style.opacity)return void Wl.warn("interact() failed because an existing interaction is running.");const l=new Array;l.push({x:timeline(t.x),y:timeline(t.y)});const c=[{x:l[0].x(0),y:l[0].y(0)}];null!=r&&(l.push({x:timeline(r.x),y:timeline(r.y)}),c.push({x:l[1].x(0),y:l[1].y(0)}));let h=performance.now();const{width:d,height:p}=this[Kd],A=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,r]of c.entries()){const{style:l}=o[t];l.transform=`translateX(${d*r.x}px) translateY(${p*r.y}px)`,"pointerdown"===e?l.opacity="1":"pointerup"===e&&(l.opacity="0");const c={pointerId:t-5678,pointerType:"touch",target:s,clientX:d*r.x+A.x,clientY:p*r.y+A.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,c))}},moveTouches=()=>{const t=this[Cc];if(t!==Gc.AUTOMATIC||!s.isConnected){for(const e of this[uc])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const r=Math.min(1,(performance.now()-h)/e);for(const[e,t]of c.entries())t.x=l[e].x(r),t.y=l[e].y(r);dispatchTouches("pointermove"),r<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Gc.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-h:h=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[Cc]=Gc.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=cc,r=hc,s=uc,o=oc,l=Mc,c=xc,h=Ec,d=yc,p=Cc,A=ac,m=Sc,g=Ic,f=bc,_=wc,y=Ac,Bc)](e){const t=this[ac],r=this[Kd];r.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=Gc.NONE,t.setFieldOfView(r.adjustedFoV(r.framedFoVDeg)),this[fc]()}[Tc](e){const t=this[ac];if(this[wc]){const{theta:t,phi:r}=this.getCameraOrbit();e[0]=t,e[1]=r,this[wc]=!1}t.changeSource=Gc.NONE,t.setOrbit(e[0],e[1],e[2]),this[fc]()}[Lc](e){this[ac].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[Dc](e){this[ac].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[gc](e[2]),this.jumpCameraToGoal()}[Uc](e){this[ac].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[Pc](e){const t=this[Kd].adjustedFoV(180*e[0]/Math.PI);this[ac].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[Rc](e){const[t,r,s]=e;this[tp].arRenderer.isPresenting||this[Kd].setTarget(t,r,s),this[ac].changeSource=Gc.NONE,this[tp].arRenderer.updateTarget(),this[fc]()}[$d](e,t){if(super[$d](e,t),this[tp].isPresenting||!this[rp]())return;const r=this[ac],s=this[Kd],o=performance.now();if(this[yc]&&this.loaded&&o>this[zd]+this.interactionPromptThreshold&&(this[yc]=!1,this[xc]=o,this[cc].classList.add("visible")),isFinite(this[xc])&&this.interactionPromptStyle===Zl){const e=(o-this[xc])/5e3%1,t=ql(e),l=jl(e);if(this[hc].style.opacity=`${l}`,t!==this[Mc]){const e=t*s.width*.05,o=(t-this[Mc])*Math.PI/16;this[hc].style.transform=`translateX(${e}px)`,r.changeSource=Gc.AUTOMATIC,r.adjustOrbit(o,0,0),this[Mc]=t}}const l=r.update(e,t),c=s.updateTarget(t);(l||c)&&this[_c]()}[dc](){this[yc]=!1,this[cc].classList.remove("visible"),this[xc]=1/0}[gc](e){const t=Math.max(this[Kd].farRadius(),e),r=Math.abs(2*t);this[ac].updateNearFar(0,r)}[pc](){const{theta:e,phi:t}=this[ac].getCameraSpherical(this[Sc]),r=(4+Math.floor((e%sc+rc)/ic))%4,s=Math.floor(t/nc),o=`${Kl[s]}${Yl[r]}`,l=o;l in this[Ac]?this[Hd](this[Ac][l]):this[Hd](`View from stage ${o}`)}get[kd](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[Ac]&&(e=`. ${this[Ac]["interaction-prompt"]}`),super[kd].replace(/\.$/,"")+(this.cameraControls?e:"")}async[ep](e){const t=this[ac],r=this[Kd],s=r.adjustedFoV(r.framedFoVDeg);super[ep](e);const o=r.adjustedFoV(r.framedFoVDeg)/s,l=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[Kd].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[ac].setFieldOfView(l),this.jumpCameraToGoal()}[Zd](){super[Zd](),this[bc]?this[wc]=!0:this[bc]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(E=fc,x=_c,C=vc,mc)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[Ac]=JSON.parse(this.a11y)}catch(e){Wl.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?Wl.warn("Error not supported format, should be a JSON string:",this.a11y):this[Ac]={};else"object"==typeof this.a11y&&null!=this.a11y?this[Ac]=Object.assign({},this.a11y):this[Ac]={};this[Xd].setAttribute("aria-label",this[kd])}}return controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:tc,observeEffects:!0,updateHandler:Tc}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:Rc}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:Bc}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:Lc}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:Dc}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:Uc}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:Pc}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),controls_decorate([n()],ControlsModelViewerElement.prototype,"a11y",void 0),ControlsModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[r]=this.shadowRoot.querySelector(".ar-button"),this[s]=document.createElement("a"),this[o]=new Set,this[l]=Kp,this[c]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[d]=({status:e})=>{e!==zc&&this[tp].arRenderer.presentedScene!==this[Kd]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===zc?this.removeAttribute("ar-tracking"):e===Wc&&this.setAttribute("ar-tracking",Xc))},this[p]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[A]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[iA]!==Kp}connectedCallback(){super.connectedCallback(),this[tp].arRenderer.addEventListener("status",this[oA]),this.setAttribute("ar-status",zc),this[tp].arRenderer.addEventListener("tracking",this[lA]),this[rA].addEventListener("message",this[cA])}disconnectedCallback(){super.disconnectedCallback(),this[tp].arRenderer.removeEventListener("status",this[oA]),this[tp].arRenderer.removeEventListener("tracking",this[lA]),this[rA].removeEventListener("message",this[cA])}update(e){super.update(e),e.has("arScale")&&(this[Kd].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[Kd].updateShadow(),this[Jd]()),e.has("arModes")&&(this[nA]=Wp(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[hA]()}async activateAR(){switch(this[iA]){case jp:await this[eA]();break;case Yp:await this[$p]();break;case Xp:this[Zp]();break;default:Gp.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=tA,r=Jp,s=rA,o=nA,l=iA,c=sA,h=aA,d=oA,p=lA,A=cA,hA)](){var e;let t=Kp;if(this.ar){if(null!=this.src)for(const r of this[nA]){if("webxr"===r&&Gs&&!Vp&&await this[tp].arRenderer.supportsPresentation()){t=Yp;break}if("scene-viewer"===r&&!Hp&&(qs||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=Xp;break}if("quick-look"===r&&Xs){t=jp;break}}t===Kp&&null!=this.iosSrc&&Xs&&(t=jp)}if(t!==Kp)this[Jp].classList.add("enabled"),this[Jp].addEventListener("click",this[aA]);else if(this[Jp].classList.contains("enabled")){this[Jp].removeEventListener("click",this[aA]),this[Jp].classList.remove("enabled");const e=jc;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[iA]=t}async[$p](){Gp.log("Attempting to present in AR with WebXR..."),await this[uA]();try{this[Jp].removeEventListener("click",this[aA]);const{arRenderer:e}=this[tp];e.placeOnWall="wall"===this.arPlacement,await e.present(this[Kd],this.xrEnvironment)}catch(e){Gp.warn("Error while trying to present in AR with WebXR"),Gp.error(e),await this[tp].arRenderer.stopPresenting(),Vp=!0,Gp.warn("Falling back to next ar-mode"),await this[hA](),this.activateAR()}finally{this[hA]()}}async[uA](){this.loaded||(this[sA]=!0,this[Wd](),await((e,t,r=null)=>new Promise((s=>{e.addEventListener(t,(function handler(o){r&&!r(o)||(s(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[sA]=!1)}[sp](){return super[sp]()||this[sA]}[Zp](){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,e);r.hash&&(r.hash="");const s=new URLSearchParams(r.search);if(t.hash=zp,s.set("mode","ar_preferred"),s.has("disable_occlusion")||s.set("disable_occlusion","true"),"fixed"===this.arScale&&s.set("resizable","false"),"wall"===this.arPlacement&&s.set("enable_vertical_placement","true"),s.has("sound")){const t=new URL(s.get("sound"),e);s.set("sound",t.toString())}if(s.has("link")){const t=new URL(s.get("link"),e);s.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.2?${s.toString()+"&file="+encodeURIComponent(r.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===zp&&(Hp=!0,self.history.back(),Gp.warn("Error while trying to present in AR with Scene Viewer"),Gp.warn("Falling back to next ar-mode"),this[hA]())}),{once:!0}),this[rA].setAttribute("href",o),Gp.log("Attempting to present in AR with Scene Viewer..."),this[rA].click()}async[eA](){const e=!this.iosSrc;this[Jp].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,r=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,t);s.hash&&(r.hash=s.hash)}"fixed"===this.arScale&&(r.hash&&(r.hash+="&"),r.hash+="allowsContentScaling=0");const s=this[rA];s.setAttribute("rel","ar");const o=document.createElement("img");s.appendChild(o),s.setAttribute("href",r.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),Gp.log("Attempting to present in AR with Quick Look..."),s.click(),s.removeChild(o),e&&URL.revokeObjectURL(t),this[Jp].classList.add("enabled")}async prepareUSDZ(){const e=this[ip].beginActivity("usdz-conversion");await this[uA]();const{model:t,shadow:r,target:s}=this[Kd];if(null==t)return"";let o=!1;null!=r&&(o=r.visible,r.visible=!1),e(.2);const l=new USDZExporter;s.remove(t),t.position.copy(s.position),t.updateWorldMatrix(!1,!0);const c=await l.parse(t);t.position.set(0,0,0),s.add(t);const h=new Blob([c],{type:"model/vnd.usdz+zip"}),d=URL.createObjectURL(h);return e(1),null!=r&&(r.visible=o),d}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,r,s,o,l,c,h,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=dA,this.loading=pA,this[t]=!1,this[r]=!1,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[o]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[c]=this[fA].getAttribute("aria-label"),this[h]=((e,t)=>{let r=null;const throttled=(...s)=>{null==r&&(e(...s),r=self.setTimeout((()=>r=null),t))};return throttled.flush=()=>{null!=r&&(self.clearTimeout(r),r=null)},throttled})((e=>{const t=this[mA].parentNode;requestAnimationFrame((()=>{this[mA].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[mA]),t.appendChild(this[mA])),this[mA].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress,r=e.detail.reason;1===t&&(this[EA].flush(),this.loaded&&(this[_A]||this.reveal===dA)&&this[vA]()),this[EA](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:r}}))};const p=self.ModelViewerElement||{},A=p.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(A);const m=p.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(m),p.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(p.meshoptDecoderLocation);const g=p.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=g}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[_o].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[vA]():(this[_A]=!0,this[Wd]())}showPoster(){const e=this[gA];if(e.classList.contains("show"))return;e.classList.add("show"),this[Xd].classList.remove("show");const t=this[fA];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const r=this.modelIsVisible;this[yA]=!1,this[Od](r)}getDimensions(){return toVector3D(this[Kd].size)}getBoundingBoxCenter(){return toVector3D(this[Kd].boundingBox.getCenter(new three_module_Vector3))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[ip].addEventListener("progress",this[MA])}disconnectedCallback(){super.disconnectedCallback(),this[ip].removeEventListener("progress",this[MA])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[fA].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[fA].setAttribute("aria-label",this[Gd]),(e.has("reveal")||e.has("loading"))&&this[Wd]()}[(t=yA,r=_A,s=gA,o=fA,l=mA,c=xA,h=EA,d=MA,sp)](){return!!this.src&&(this[_A]||this.loading===AA||this.reveal===dA&&this[Qd])}[vA](){this[_A]=!1;const e=this[gA];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Xd].classList.add("show");const t=this.modelIsVisible;this[yA]=!0,this[Od](t);const r=this.getRootNode();r&&r.activeElement===this&&this[Xd].focus();const s=this[fA];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[rp](){return super[rp]()&&this[yA]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[Kd].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[Kd].subscribeMixerEvent("finished",(()=>{this[op]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[Kd].animationNames:[]}get duration(){return this[Kd].duration}get paused(){return this[op]}get currentTime(){return this[Kd].animationTime}set currentTime(e){this[Kd].animationTime=e,this[Jd]()}get timeScale(){return this[Kd].animationTimeScale}set timeScale(e){this[Kd].animationTimeScale=e}pause(){this[op]||(this[op]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[op]=!1,this[ap](e),this.dispatchEvent(new CustomEvent("play")))}[(t=op,Zd)](){super[Zd](),this[op]=!0,null!=this.animationName&&this[ap](),this.autoplay&&this.play()}[$d](e,t){super[$d](e,t),this[op]||!this[rp]()&&!this[tp].isPresenting||(this[Kd].updateAnimation(t/1e3),this[Jd]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[ap]()}[ap](e=lp){var t;const r=null!==(t=e.repetitions)&&void 0!==t?t:1/0,s=e.pingpong?Be:1===r?2200:Te;this[Kd].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,s,r),this[op]&&(this[Kd].updateAnimation(0),this[Jd]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",BA)}}]);
|
|
408
|
+
</div>`;var na=r(5108);const ra=new WeakMap;function DRACOWorker(){let e,t;function decodeAttribute(e,t,r,s,o,l){const c=l.num_components(),h=r.num_points()*c,d=h*o.BYTES_PER_ELEMENT,p=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),A=e._malloc(d);t.GetAttributeDataArrayForAllPoints(r,l,p,d,A);const m=new o(e.HEAPF32.buffer,A,h).slice();return e._free(A),{name:s,array:m,itemSize:c}}onmessage=function(r){const s=r.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const r=s.buffer,o=s.taskConfig;t.then((e=>{const t=e.draco,l=new t.Decoder;try{const e=function decodeGeometry(e,t,r,s){const o=s.attributeIDs,l=s.attributeTypes;let c,h;const d=t.GetEncodedGeometryType(r);if(d===e.TRIANGULAR_MESH)c=new e.Mesh,h=t.DecodeArrayToMesh(r,r.byteLength,c);else{if(d!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");c=new e.PointCloud,h=t.DecodeArrayToPointCloud(r,r.byteLength,c)}if(!h.ok()||0===c.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const p={index:null,attributes:[]};for(const r in o){const h=self[l[r]];let d,A;if(s.useUniqueIDs)A=o[r],d=t.GetAttributeByUniqueId(c,A);else{if(A=t.GetAttributeId(c,e[o[r]]),-1===A)continue;d=t.GetAttribute(c,A)}const m=decodeAttribute(e,t,c,r,h,d);"color"===r&&(m.vertexColorSpace=s.vertexColorSpace),p.attributes.push(m)}d===e.TRIANGULAR_MESH&&(p.index=function decodeIndex(e,t,r){const s=r.num_faces(),o=3*s,l=4*o,c=e._malloc(l);t.GetTrianglesUInt32Array(r,l,c);const h=new Uint32Array(e.HEAPF32.buffer,c,o).slice();return e._free(c),{array:h,itemSize:1}}(e,t,c));return e.destroy(c),p}(t,l,new Int8Array(r),o),c=e.attributes.map((e=>e.array.buffer));e.index&&c.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},c)}catch(e){na.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(l)}}))}}}var sa=r(5108);function toTrianglesDrawMode(e,t){if(0===t)return sa.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return sa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const s=r.count-2,o=[];if(2===t)for(let e=1;e<=s;e++)o.push(r.getX(0)),o.push(r.getX(e)),o.push(r.getX(e+1));else for(let e=0;e<s;e++)e%2==0?(o.push(r.getX(e)),o.push(r.getX(e+1)),o.push(r.getX(e+2))):(o.push(r.getX(e+2)),o.push(r.getX(e+1)),o.push(r.getX(e)));o.length/3!==s&&sa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(o),l.clearGroups(),l}return sa.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var aa=r(5108);class GLTFLoader extends Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,r,s){const o=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=LoaderUtils.extractUrlBase(e);l=LoaderUtils.resolveURL(t,this.path)}else l=LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){s?s(t):aa.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},c=new three_module_FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,(function(r){try{o.parse(r,l,(function(r){t(r),o.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),r,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let o;const l={},c={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===la){try{l[oa.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(s&&s(e))}o=JSON.parse(l[oa.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const d=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](d);t.name||aa.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[t.name]=t,l[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],r=o.extensionsRequired||[];switch(t){case oa.KHR_MATERIALS_UNLIT:l[t]=new GLTFMaterialsUnlitExtension;break;case oa.KHR_DRACO_MESH_COMPRESSION:l[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case oa.KHR_TEXTURE_TRANSFORM:l[t]=new GLTFTextureTransformExtension;break;case oa.KHR_MESH_QUANTIZATION:l[t]=new GLTFMeshQuantizationExtension;break;default:r.indexOf(t)>=0&&void 0===c[t]&&aa.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}d.setExtensions(l),d.setPlugins(c),d.parse(r,s)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,t,s,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const oa={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=oa.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let s=t.cache.get(r);if(s)return s;const o=t.json,l=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let c;const h=new Color(16777215);void 0!==l.color&&h.setRGB(l.color[0],l.color[1],l.color[2],ke);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":c=new DirectionalLight(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new PointLight(h),c.distance=d;break;case"spot":c=new SpotLight(h),c.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,assignExtrasToUserData(c,l),void 0!==l.intensity&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),s=Promise.resolve(c),t.cache.add(r,s),s}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return r._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=oa.KHR_MATERIALS_UNLIT}getMaterialType(){return MeshBasicMaterial}extendParams(e,t,r){const s=[];e.color=new Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const t=o.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],ke),e.opacity=t[3]}void 0!==o.baseColorTexture&&s.push(r.assignTexture(e,"map",o.baseColorTexture,Oe))}return Promise.all(s)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return void 0!==s&&(t.emissiveIntensity=s),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&o.push(r.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&o.push(r.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(o.push(r.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Vector2(e,e)}return Promise.all(o)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.iridescenceFactor&&(t.iridescence=l.iridescenceFactor),void 0!==l.iridescenceTexture&&o.push(r.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),void 0!==l.iridescenceIor&&(t.iridescenceIOR=l.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==l.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),void 0!==l.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),void 0!==l.iridescenceThicknessTexture&&o.push(r.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=s.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],ke)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&o.push(r.assignTexture(t,"sheenColorMap",l.sheenColorTexture,Oe)),void 0!==l.sheenRoughnessTexture&&o.push(r.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(o)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.transmissionFactor&&(t.transmission=l.transmissionFactor),void 0!==l.transmissionTexture&&o.push(r.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&o.push(r.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const c=l.attenuationColor||[1,1,1];return t.attenuationColor=(new Color).setRGB(c[0],c[1],c[2],ke),Promise.all(o)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=void 0!==s.ior?s.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&o.push(r.assignTexture(t,"specularIntensityMap",l.specularTexture));const c=l.specularColorFactor||[1,1,1];return t.specularColor=(new Color).setRGB(c[0],c[1],c[2],ke),void 0!==l.specularColorTexture&&o.push(r.assignTexture(t,"specularColorMap",l.specularColorTexture,Oe)),Promise.all(o)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=oa.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return t.bumpScale=void 0!==l.bumpFactor?l.bumpFactor:1,void 0!==l.bumpTexture&&o.push(r.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=oa.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?MeshPhysicalMaterial:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.anisotropyStrength&&(t.anisotropy=l.anisotropyStrength),void 0!==l.anisotropyRotation&&(t.anisotropyRotation=l.anisotropyRotation),void 0!==l.anisotropyTexture&&o.push(r.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=oa.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const o=s.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=oa.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=oa.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let h=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return r.loadTextureImage(e,l.source,h);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=oa.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then((function(t){const r=e.byteOffset||0,s=e.byteLength||0,l=e.count,c=e.byteStride,h=new Uint8Array(t,r,s);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(l,c,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(l*c);return o.decodeGltfBuffer(new Uint8Array(t),l,c,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=oa.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const s=t.meshes[r.mesh];for(const e of s.primitives)if(e.mode!==da.TRIANGLES&&e.mode!==da.TRIANGLE_STRIP&&e.mode!==da.TRIANGLE_FAN&&void 0!==e.mode)return null;const o=r.extensions[this.name].attributes,l=[],c={};for(const e in o)l.push(this.parser.getDependency("accessor",o[e]).then((t=>(c[e]=t,c[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),r=t.isGroup?t.children:[t],s=e[0].count,o=[];for(const e of r){const t=new three_module_Matrix4,r=new three_module_Vector3,l=new three_module_Quaternion,h=new three_module_Vector3(1,1,1),d=new InstancedMesh(e.geometry,e.material,s);for(let e=0;e<s;e++)c.TRANSLATION&&r.fromBufferAttribute(c.TRANSLATION,e),c.ROTATION&&l.fromBufferAttribute(c.ROTATION,e),c.SCALE&&h.fromBufferAttribute(c.SCALE,e),d.setMatrixAt(e,t.compose(r,l,h));for(const t in c)if("_COLOR_0"===t){const e=c[t];d.instanceColor=new three_module_InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,c[t]);Object3D.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),o.push(d)}return t.isGroup?(t.clear(),t.add(...o),t):o[0]})))}}const la="glTF",ca=1313821514,ha=5130562;class GLTFBinaryExtension{constructor(e){this.name=oa.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==la)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,o=new DataView(e,12);let l=0;for(;l<s;){const t=o.getUint32(l,!0);l+=4;const s=o.getUint32(l,!0);if(l+=4,s===ca){const s=new Uint8Array(e,12+l,t);this.content=r.decode(s)}else if(s===ha){const r=12+l;this.body=e.slice(r,r+t)}l+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=oa.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,s=this.dracoLoader,o=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,c={},h={},d={};for(const e in l){const t=fa[e]||e.toLowerCase();c[t]=l[e]}for(const t in e.attributes){const s=fa[t]||t.toLowerCase();if(void 0!==l[t]){const o=r.accessors[e.attributes[t]],l=pa[o.componentType];d[s]=l.name,h[s]=!0===o.normalized}}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t,r){s.decodeDracoFile(e,(function(e){for(const t in e.attributes){const r=e.attributes[t],s=h[t];void 0!==s&&(r.normalized=s)}t(e)}),c,d,ke,r)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=oa.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=oa.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends Interpolant{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,o=e*s*3+s;for(let e=0;e!==s;e++)t[e]=r[o+e];return t}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=2*c,d=3*c,p=s-t,A=(r-t)/p,m=A*A,g=m*A,f=e*d,_=f-d,y=-2*g+3*m,E=g-m,x=1-y,C=E-m+A;for(let e=0;e!==c;e++){const t=l[_+e+c],r=l[_+e+h]*p,s=l[f+e+c],d=l[f+e]*p;o[e]=x*t+C*r+y*s+E*d}return o}}const ua=new three_module_Quaternion;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,r,s){const o=super.interpolate_(e,t,r,s);return ua.fromArray(o).normalize().toArray(o),o}}const da={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},pa={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Aa={9728:ee,9729:ne,9984:te,9985:re,9986:ie,9987:se},ma={33071:J,33648:$,10497:K},ga={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fa={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},_a={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},va={CUBICSPLINE:void 0,LINEAR:Le,STEP:Re},ya="OPAQUE",Ea="MASK",xa="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,r){for(const s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):aa.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){const r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,s=r.length;t<s;t++)e.morphTargetDictionary[r[t]]=t}else aa.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const r=e.extensions&&e.extensions[oa.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+createAttributesKey(r.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,s=e.targets.length;r<s;r++)t+=":"+createAttributesKey(e.targets[r]);return t}function createAttributesKey(e){let t="";const r=Object.keys(e).sort();for(let s=0,o=r.length;s<o;s++)t+=r[s]+":"+e[r[s]]+";";return t}function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Ma=new three_module_Matrix4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,s=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=navigator.userAgent.indexOf("Firefox")>-1,o=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||s&&o<98?this.textureLoader=new TextureLoader(this.options.manager):this.textureLoader=new ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new three_module_FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,s=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const l={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};return addUnknownExtensionsToUserData(o,l,s),assignExtrasToUserData(l,s),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(l)}))).then((function(){for(const e of l.scenes)e.updateMatrixWorld();e(l)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r].joints;for(let t=0,r=s.length;t<r;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(r[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const s=r.clone(),updateMappings=(e,t)=>{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,s]of e.children.entries())updateMappings(s,t.children[r])};return updateMappings(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const s=e(t[r]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let s=0;s<t.length;s++){const o=e(t[s]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":s=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":s=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})),!s)throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map((function(t,s){return r.getDependency(e,s)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[oa.KHR_BINARY_GLTF].body);const s=this.options;return new Promise((function(e,o){r.load(LoaderUtils.resolveURL(t.uri,s.path),e,void 0,(function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)}))}loadAccessor(e){const t=this,r=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse){const e=ga[s.type],t=pa[s.componentType],r=!0===s.normalized,o=new t(s.count*e);return Promise.resolve(new three_module_BufferAttribute(o,e,r))}const o=[];return void 0!==s.bufferView?o.push(this.getDependency("bufferView",s.bufferView)):o.push(null),void 0!==s.sparse&&(o.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(o).then((function(e){const o=e[0],l=ga[s.type],c=pa[s.componentType],h=c.BYTES_PER_ELEMENT,d=h*l,p=s.byteOffset||0,A=void 0!==s.bufferView?r.bufferViews[s.bufferView].byteStride:void 0,m=!0===s.normalized;let g,f;if(A&&A!==d){const e=Math.floor(p/A),r="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+e+":"+s.count;let d=t.cache.get(r);d||(g=new c(o,e*A,s.count*A/h),d=new three_module_InterleavedBuffer(g,A/h),t.cache.add(r,d)),f=new three_module_InterleavedBufferAttribute(d,l,p%A/h,m)}else g=null===o?new c(s.count*l):new c(o,p,s.count*l),f=new three_module_BufferAttribute(g,l,m);if(void 0!==s.sparse){const t=ga.SCALAR,r=pa[s.sparse.indices.componentType],h=s.sparse.indices.byteOffset||0,d=s.sparse.values.byteOffset||0,p=new r(e[1],h,s.sparse.count*t),A=new c(e[2],d,s.sparse.count*l);null!==o&&(f=new three_module_BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(let e=0,t=p.length;e<t;e++){const t=p[e];if(f.setX(t,A[e*l]),l>=2&&f.setY(t,A[e*l+1]),l>=3&&f.setZ(t,A[e*l+2]),l>=4&&f.setW(t,A[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f}))}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let l=this.textureLoader;if(o.uri){const e=r.manager.getHandler(o.uri);null!==e&&(l=e)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,r){const s=this,o=this.json,l=o.textures[e],c=o.images[t],h=(c.uri||c.bufferView)+":"+l.sampler;if(this.textureCache[h])return this.textureCache[h];const d=this.loadImageSource(t,r).then((function(t){t.flipY=!1,t.name=l.name||c.name||"",""===t.name&&"string"==typeof c.uri&&!1===c.uri.startsWith("data:image/")&&(t.name=c.uri);const r=(o.samplers||{})[l.sampler]||{};return t.magFilter=Aa[r.magFilter]||ne,t.minFilter=Aa[r.minFilter]||se,t.wrapS=ma[r.wrapS]||K,t.wrapT=ma[r.wrapT]||K,s.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[h]=d,d}loadImageSource(e,t){const r=this,s=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=s.images[e],c=self.URL||self.webkitURL;let h=l.uri||"",d=!1;if(void 0!==l.bufferView)h=r.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return h=c.createObjectURL(t),h}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(h).then((function(e){return new Promise((function(r,s){let l=r;!0===t.isImageBitmapLoader&&(l=function(e){const t=new Texture(e);t.needsUpdate=!0,r(t)}),t.load(LoaderUtils.resolveURL(e,o.path),l,void 0,s)}))})).then((function(e){return!0===d&&c.revokeObjectURL(h),e.userData.mimeType=l.mimeType||function getImageURIMimeType(e){return e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"}(l.uri),e})).catch((function(e){throw aa.error("THREE.GLTFLoader: Couldn't load texture",h),e}));return this.sourceCache[e]=p,p}assignTexture(e,t,r,s){const o=this;return this.getDependency("texture",r.index).then((function(l){if(!l)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((l=l.clone()).channel=r.texCoord),o.extensions[oa.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[oa.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(l);l=o.extensions[oa.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),o.associations.set(l,t)}}return void 0!==s&&(l.colorSpace=s),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=void 0===t.attributes.tangent,o=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new PointsMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new LineBasicMaterial,Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(s||o||l){let e="ClonedMaterial:"+r.uuid+":";s&&(e+="derivative-tangents:"),o&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),o&&(t.vertexColors=!0),l&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,s=this.extensions,o=r.materials[e];let l;const c={},h=[];if((o.extensions||{})[oa.KHR_MATERIALS_UNLIT]){const e=s[oa.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),h.push(e.extendParams(c,o,t))}else{const r=o.pbrMetallicRoughness||{};if(c.color=new Color(1,1,1),c.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;c.color.setRGB(e[0],e[1],e[2],ke),c.opacity=e[3]}void 0!==r.baseColorTexture&&h.push(t.assignTexture(c,"map",r.baseColorTexture,Oe)),c.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,c.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(h.push(t.assignTexture(c,"metalnessMap",r.metallicRoughnessTexture)),h.push(t.assignTexture(c,"roughnessMap",r.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),h.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,c)}))))}!0===o.doubleSided&&(c.side=2);const d=o.alphaMode||ya;if(d===xa?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,d===Ea&&(c.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"normalMap",o.normalTexture)),c.normalScale=new Vector2(1,1),void 0!==o.normalTexture.scale)){const e=o.normalTexture.scale;c.normalScale.set(e,e)}if(void 0!==o.occlusionTexture&&l!==MeshBasicMaterial&&(h.push(t.assignTexture(c,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(c.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&l!==MeshBasicMaterial){const e=o.emissiveFactor;c.emissive=(new Color).setRGB(e[0],e[1],e[2],ke)}return void 0!==o.emissiveTexture&&l!==MeshBasicMaterial&&h.push(t.assignTexture(c,"emissiveMap",o.emissiveTexture,Oe)),Promise.all(h).then((function(){const r=new l(c);return o.name&&(r.name=o.name),assignExtrasToUserData(r,o),t.associations.set(r,{materials:e}),o.extensions&&addUnknownExtensionsToUserData(s,r,o),r}))}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function createDracoPrimitive(e){return r[oa.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return addPrimitiveAttributes(r,e,t)}))}const o=[];for(let r=0,l=e.length;r<l;r++){const l=e[r],c=createPrimitiveKey(l),h=s[c];if(h)o.push(h.promise);else{let e;e=l.extensions&&l.extensions[oa.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new three_module_BufferGeometry,l,t),s[c]={primitive:l,promise:e},o.push(e)}}return Promise.all(o)}loadMesh(e){const t=this,r=this.json,s=this.extensions,o=r.meshes[e],l=o.primitives,c=[];for(let e=0,t=l.length;e<t;e++){const t=void 0===l[e].material?createDefaultMaterial(this.cache):this.getDependency("material",l[e].material);c.push(t)}return c.push(t.loadGeometries(l)),Promise.all(c).then((function(r){const c=r.slice(0,r.length-1),h=r[r.length-1],d=[];for(let r=0,p=h.length;r<p;r++){const p=h[r],A=l[r];let m;const g=c[r];if(A.mode===da.TRIANGLES||A.mode===da.TRIANGLE_STRIP||A.mode===da.TRIANGLE_FAN||void 0===A.mode)m=!0===o.isSkinnedMesh?new SkinnedMesh(p,g):new three_module_Mesh(p,g),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),A.mode===da.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,1):A.mode===da.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,2));else if(A.mode===da.LINES)m=new LineSegments(p,g);else if(A.mode===da.LINE_STRIP)m=new Line(p,g);else if(A.mode===da.LINE_LOOP)m=new LineLoop(p,g);else{if(A.mode!==da.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);m=new Points(p,g)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),assignExtrasToUserData(m,o),A.extensions&&addUnknownExtensionsToUserData(s,m,A),t.assignFinalMaterial(m),d.push(m)}for(let r=0,s=d.length;r<s;r++)t.associations.set(d[r],{meshes:e,primitives:r});if(1===d.length)return o.extensions&&addUnknownExtensionsToUserData(s,d[0],o),d[0];const p=new three_module_Group;o.extensions&&addUnknownExtensionsToUserData(s,p,o),t.associations.set(p,{meshes:e});for(let e=0,t=d.length;e<t;e++)p.add(d[e]);return p}))}loadCamera(e){let t;const r=this.json.cameras[e],s=r[r.type];if(s)return"perspective"===r.type?t=new PerspectiveCamera(ht.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===r.type&&(t=new OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),assignExtrasToUserData(t,r),Promise.resolve(t);aa.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],r=[];for(let e=0,s=t.joints.length;e<s;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){const r=e.pop(),s=e,o=[],l=[];for(let e=0,c=s.length;e<c;e++){const c=s[e];if(c){o.push(c);const t=new three_module_Matrix4;null!==r&&t.fromArray(r.array,16*e),l.push(t)}else aa.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Skeleton(o,l)}))}loadAnimation(e){const t=this.json,r=this,s=t.animations[e],o=s.name?s.name:"animation_"+e,l=[],c=[],h=[],d=[],p=[];for(let e=0,t=s.channels.length;e<t;e++){const t=s.channels[e],r=s.samplers[t.sampler],o=t.target,A=o.node,m=void 0!==s.parameters?s.parameters[r.input]:r.input,g=void 0!==s.parameters?s.parameters[r.output]:r.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),c.push(this.getDependency("accessor",m)),h.push(this.getDependency("accessor",g)),d.push(r),p.push(o))}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h),Promise.all(d),Promise.all(p)]).then((function(e){const t=e[0],s=e[1],l=e[2],c=e[3],h=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],p=s[e],A=l[e],m=c[e],g=h[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=r._createAnimationTracks(o,p,A,m,g);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new three_module_AnimationClip(o,void 0,d)}))}createNodeMesh(e){const t=this.json,r=this,s=t.nodes[e];return void 0===s.mesh?null:r.getDependency("mesh",s.mesh).then((function(e){const t=r._getNodeRef(r.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,r=s.weights.length;t<r;t++)e.morphTargetInfluences[t]=s.weights[t]})),t}))}loadNode(e){const t=this,r=this.json.nodes[e],s=t._loadNodeShallow(e),o=[],l=r.children||[];for(let e=0,r=l.length;e<r;e++)o.push(t.getDependency("node",l[e]));const c=void 0===r.skin?Promise.resolve(null):t.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),c]).then((function(e){const t=e[0],r=e[1],s=e[2];null!==s&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(s,Ma)}));for(let e=0,s=r.length;e<s;e++)t.add(r[e]);return t}))}_loadNodeShallow(e){const t=this.json,r=this.extensions,s=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const o=t.nodes[e],l=o.name?s.createUniqueName(o.name):"",c=[],h=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return h&&c.push(h),void 0!==o.camera&&c.push(s.getDependency("camera",o.camera).then((function(e){return s._getNodeRef(s.cameraCache,o.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){c.push(e)})),this.nodeCache[e]=Promise.all(c).then((function(t){let c;if(c=!0===o.isBone?new Bone:t.length>1?new three_module_Group:1===t.length?t[0]:new Object3D,c!==t[0])for(let e=0,r=t.length;e<r;e++)c.add(t[e]);if(o.name&&(c.userData.name=o.name,c.name=l),assignExtrasToUserData(c,o),o.extensions&&addUnknownExtensionsToUserData(r,c,o),void 0!==o.matrix){const e=new three_module_Matrix4;e.fromArray(o.matrix),c.applyMatrix4(e)}else void 0!==o.translation&&c.position.fromArray(o.translation),void 0!==o.rotation&&c.quaternion.fromArray(o.rotation),void 0!==o.scale&&c.scale.fromArray(o.scale);return s.associations.has(c)||s.associations.set(c,{}),s.associations.get(c).nodes=e,c})),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],s=this,o=new three_module_Group;r.name&&(o.name=s.createUniqueName(r.name)),assignExtrasToUserData(o,r),r.extensions&&addUnknownExtensionsToUserData(t,o,r);const l=r.nodes||[],c=[];for(let e=0,t=l.length;e<t;e++)c.push(s.getDependency("node",l[e]));return Promise.all(c).then((function(e){for(let t=0,r=e.length;t<r;t++)o.add(e[t]);return s.associations=(e=>{const t=new Map;for(const[e,r]of s.associations)(e instanceof Material||e instanceof Texture)&&t.set(e,r);return e.traverse((e=>{const r=s.associations.get(e);null!=r&&t.set(e,r)})),t})(o),o}))}_createAnimationTracks(e,t,r,s,o){const l=[],c=e.name?e.name:e.uuid,h=[];let d;switch(_a[o.path]===_a.weights?e.traverse((function(e){e.morphTargetInfluences&&h.push(e.name?e.name:e.uuid)})):h.push(c),_a[o.path]){case _a.weights:d=NumberKeyframeTrack;break;case _a.rotation:d=three_module_QuaternionKeyframeTrack;break;case _a.position:case _a.scale:d=three_module_VectorKeyframeTrack;break;default:if(1===r.itemSize)d=NumberKeyframeTrack;else d=three_module_VectorKeyframeTrack}const p=void 0!==s.interpolation?va[s.interpolation]:Le,A=this._getArrayFromAccessor(r);for(let e=0,r=h.length;e<r;e++){const r=new d(h[e]+"."+_a[o.path],t.array,A,p);"CUBICSPLINE"===s.interpolation&&this._createCubicSplineTrackInterpolant(r),l.push(r)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof three_module_QuaternionKeyframeTrack?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,r){const s=t.attributes,o=[];function assignAttributeAccessor(t,s){return r.getDependency("accessor",t).then((function(t){e.setAttribute(s,t)}))}for(const t in s){const r=fa[t]||t.toLowerCase();r in e.attributes||o.push(assignAttributeAccessor(s[t],r))}if(void 0!==t.indices&&!e.index){const s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));o.push(s)}return ft.workingColorSpace!==ke&&"COLOR_0"in s&&aa.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ft.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,r){const s=t.attributes,o=new Box3;if(void 0===s.POSITION)return;{const e=r.json.accessors[s.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void aa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(o.set(new three_module_Vector3(t[0],t[1],t[2]),new three_module_Vector3(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(pa[e.componentType]);o.min.multiplyScalar(t),o.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new three_module_Vector3,t=new three_module_Vector3;for(let s=0,o=l.length;s<o;s++){const o=l[s];if(void 0!==o.POSITION){const s=r.json.accessors[o.POSITION],l=s.min,c=s.max;if(void 0!==l&&void 0!==c){if(t.setX(Math.max(Math.abs(l[0]),Math.abs(c[0]))),t.setY(Math.max(Math.abs(l[1]),Math.abs(c[1]))),t.setZ(Math.max(Math.abs(l[2]),Math.abs(c[2]))),s.normalized){const e=getNormalizedComponentScale(pa[s.componentType]);t.multiplyScalar(e)}e.max(t)}else aa.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(e)}e.boundingBox=o;const c=new Sphere;o.getCenter(c.center),c.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=c}(e,t,r),Promise.all(o).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,r){let s=!1,o=!1,l=!1;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(void 0!==r.POSITION&&(s=!0),void 0!==r.NORMAL&&(o=!0),void 0!==r.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(e);const c=[],h=[],d=[];for(let p=0,A=t.length;p<A;p++){const A=t[p];if(s){const t=void 0!==A.POSITION?r.getDependency("accessor",A.POSITION):e.attributes.position;c.push(t)}if(o){const t=void 0!==A.NORMAL?r.getDependency("accessor",A.NORMAL):e.attributes.normal;h.push(t)}if(l){const t=void 0!==A.COLOR_0?r.getDependency("accessor",A.COLOR_0):e.attributes.color;d.push(t)}}return Promise.all([Promise.all(c),Promise.all(h),Promise.all(d)]).then((function(t){const r=t[0],c=t[1],h=t[2];return s&&(e.morphAttributes.position=r),o&&(e.morphAttributes.normal=c),l&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,r):e}))}class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:t,msg:r,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((r=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=r,this.workers[s].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}var Ca=r(8764).Buffer;const Sa=9,Ia=15,ba=16,wa=22,Ta=37,Ba=43,Ra=76,La=83,Da=97,Ua=100,Pa=103,Fa=109,Na=165,Qa=166;class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ii{constructor(e,t,r,s){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}new Uint8Array([0]);const Oa=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Ca.from(e).toString("utf8")}var ka=r(8764).Buffer;let Ga,Va,Ha;const za={env:{emscripten_notify_memory_growth:function(e){Ha=new Uint8Array(Va.exports.memory.buffer)}}};class zstddec_module_Q{init(){return Ga||(Ga="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Wa).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,za))).then(this._init):WebAssembly.instantiate(ka.from(Wa,"base64"),za).then(this._init),Ga)}_init(e){Va=e.instance,za.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Va)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,s=Va.exports.malloc(r);Ha.set(e,s),t=t||Number(Va.exports.ZSTD_findDecompressedSize(s,r));const o=Va.exports.malloc(t),l=Va.exports.ZSTD_decompress(o,t,s,r),c=Ha.slice(o,o+l);return Va.exports.free(s),Va.exports.free(o),c}}const Wa="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHB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RqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigA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ACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAEL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CyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgC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oAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADR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AwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";var qa=r(5108);const ja=new WeakMap;let Xa,Ya=0;class KTX2Loader extends Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&qa.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const e=new three_module_FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),r=new three_module_FileLoader(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then((([e,t])=>{const r=KTX2Loader.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),Ya>0&&qa.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Ya++}return this.transcoderPending}load(e,t,r,s){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const o=new three_module_FileLoader(this.manager);o.setResponseType("arraybuffer"),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{if(ja.has(e)){return ja.get(e).promise.then(t).catch(s)}this._createTexture(e).then((e=>t?t(e):null)).catch(s)}),r,s)}_createTextureFrom(e,t){const{faces:r,width:s,height:o,format:l,type:c,error:h,dfdFlags:d}=e;if("error"===c)return Promise.reject(h);let p;if(6===t.faceCount)p=new CompressedCubeTexture(r,l,ae);else{const e=r[0].mipmaps;p=t.layerCount>1?new CompressedArrayTexture(e,s,o,t.layerCount,l,ae):new CompressedTexture(e,s,o,l,ae)}return p.minFilter=1===r[0].mipmaps.length?ne:se,p.magFilter=ne,p.generateMipmaps=!1,p.needsUpdate=!0,p.colorSpace=parseColorSpace(t),p.premultiplyAlpha=!!(1&d),p}async _createTexture(e,t={}){const r=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,Oa.length);if(t[0]!==Oa[0]||t[1]!==Oa[1]||t[2]!==Oa[2]||t[3]!==Oa[3]||t[4]!==Oa[4]||t[5]!==Oa[5]||t[6]!==Oa[6]||t[7]!==Oa[7]||t[8]!==Oa[8]||t[9]!==Oa[9]||t[10]!==Oa[10]||t[11]!==Oa[11])throw new Error("Missing KTX 2.0 identifier.");const r=new Si,s=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,Oa.length,s,!0);r.vkFormat=o._nextUint32(),r.typeSize=o._nextUint32(),r.pixelWidth=o._nextUint32(),r.pixelHeight=o._nextUint32(),r.pixelDepth=o._nextUint32(),r.layerCount=o._nextUint32(),r.faceCount=o._nextUint32();const l=o._nextUint32();r.supercompressionScheme=o._nextUint32();const c=o._nextUint32(),h=o._nextUint32(),d=o._nextUint32(),p=o._nextUint32(),A=o._nextUint64(),m=o._nextUint64(),g=new Ii(e,Oa.length+s,3*l*8,!0);for(let t=0;t<l;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+g._nextUint64(),g._nextUint64()),uncompressedByteLength:g._nextUint64()});const f=new Ii(e,c,h,!0),_={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},y=(_.descriptorBlockSize/4-6)/4;for(let e=0;e<y;e++){const t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),_.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const E=new Ii(e,d,p,!0);for(;E._offset<p;){const e=E._nextUint32(),t=E._scan(e),s=Ei(t),o=E._scan(e-t.byteLength);r.keyValue[s]=s.match(/^ktx/i)?Ei(o):o,E._offset%4&&E._skip(4-E._offset%4)}if(m<=0)return r;const x=new Ii(e,A,m,!0),C=x._nextUint16(),S=x._nextUint16(),I=x._nextUint32(),b=x._nextUint32(),T=x._nextUint32(),B=x._nextUint32(),U=[];for(let e=0;e<l;e++)U.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});const F=A+x._offset,Q=F+I,O=Q+b,G=O+T,W=new Uint8Array(e.buffer,e.byteOffset+F,I),q=new Uint8Array(e.buffer,e.byteOffset+Q,b),j=new Uint8Array(e.buffer,e.byteOffset+O,T),X=new Uint8Array(e.buffer,e.byteOffset+G,B);return r.globalData={endpointCount:C,selectorCount:S,imageDescs:U,endpointsData:W,selectorsData:q,tablesData:j,extendedData:X},r}(new Uint8Array(e));if(0!==r.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===Ja[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let r;2===e.supercompressionScheme&&(Xa||(Xa=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),r=await Xa);const s=[];for(let o=0;o<e.levels.length;o++){const l=Math.max(1,e.pixelWidth>>o),c=Math.max(1,e.pixelHeight>>o),h=e.pixelDepth?Math.max(1,e.pixelDepth>>o):0,d=e.levels[o];let p,A;if(0===e.supercompressionScheme)p=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");p=r.decode(d.levelData,d.uncompressedByteLength)}A=$a[t]===ce?new Float32Array(p.buffer,p.byteOffset,p.byteLength/Float32Array.BYTES_PER_ELEMENT):$a[t]===he?new Uint16Array(p.buffer,p.byteOffset,p.byteLength/Uint16Array.BYTES_PER_ELEMENT):p,s.push({data:A,width:l,height:c,depth:h})}let o;if(Ka.has(Ja[t]))o=0===e.pixelDepth?new DataTexture(s[0].data,e.pixelWidth,e.pixelHeight):new Data3DTexture(s[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");o=new CompressedTexture(s,e.pixelWidth,e.pixelHeight)}return o.mipmaps=s,o.type=$a[t],o.format=Ja[t],o.colorSpace=parseColorSpace(e),o.needsUpdate=!0,Promise.resolve(o)}(r);const s=t,o=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:s},[e]))).then((e=>this._createTextureFrom(e.data,r)));return ja.set(e,{promise:o}),o}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Ya--,this}}KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},KTX2Loader.EngineFormat={RGBAFormat:de,RGBA_ASTC_4x4_Format:Ie,RGBA_BPTC_Format:we,RGBA_ETC2_EAC_Format:Se,RGBA_PVRTC_4BPPV1_Format:xe,RGBA_S3TC_DXT5_Format:ye,RGB_ETC1_Format:Me,RGB_ETC2_Format:Ce,RGB_PVRTC_4BPPV1_Format:Ee,RGB_S3TC_DXT1_Format:fe},KTX2Loader.BasisWorker=function(){let e,t,r;const s=_EngineFormat,o=_TranscoderFormat,l=_BasisFormat;self.addEventListener("message",(function(c){const p=c.data;switch(p.type){case"init":e=p.config,function init(e){t=new Promise((t=>{r={wasmBinary:e,onRuntimeInitialized:t},BASIS(r)})).then((()=>{r.initializeBasis(),void 0===r.KTX2File&&qa.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(p.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:c,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_}=function transcode(t){const c=new r.KTX2File(new Uint8Array(t));function cleanup(){c.close(),c.delete()}if(!c.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const p=c.isUASTC()?l.UASTC_4x4:l.ETC1S,A=c.getWidth(),m=c.getHeight(),g=c.getLayers()||1,f=c.getLevels(),_=c.getFaces(),y=c.getHasAlpha(),E=c.getDFDFlags(),{transcoderFormat:x,engineFormat:C}=function getTranscoderFormat(t,r,c,p){let A,m;const g=t===l.ETC1S?h:d;for(let s=0;s<g.length;s++){const o=g[s];if(e[o.if]&&(o.basisFormat.includes(t)&&!(p&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(r)&&isPowerOfTwo(c))))return A=o.transcoderFormat[p?1:0],m=o.engineFormat[p?1:0],{transcoderFormat:A,engineFormat:m}}return qa.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=o.RGBA32,m=s.RGBAFormat,{transcoderFormat:A,engineFormat:m}}(p,A,m,y);if(!A||!m||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!c.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const S=[],I=[];for(let e=0;e<_;e++){const t=[];for(let r=0;r<f;r++){const s=[];let o,l;for(let t=0;t<g;t++){const h=c.getImageLevelInfo(r,t,e);0!==e||0!==r||0!==t||h.origWidth%4==0&&h.origHeight%4==0||qa.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,l=h.origHeight):(o=h.width,l=h.height);const d=new Uint8Array(c.getImageTranscodedSizeInBytes(r,t,0,x));if(!c.transcodeImage(d,r,t,e,x,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");s.push(d)}const h=concat(s);t.push({data:h,width:o,height:l}),I.push(h.buffer)}S.push({mipmaps:t,width:A,height:m,format:C})}return cleanup(),{faces:S,buffers:I,width:A,height:m,hasAlpha:y,format:C,dfdFlags:E}}(p.buffer);self.postMessage({type:"transcode",id:p.id,faces:t,width:A,height:m,hasAlpha:g,format:f,dfdFlags:_},c)}catch(e){qa.error(e),self.postMessage({type:"error",id:p.id,error:e.message})}}))}}));const c=[{if:"astcSupported",basisFormat:[l.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[s.RGB_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[s.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=c.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),d=c.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function isPowerOfTwo(e){return e<=2||!(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const r=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const o=e[t];r.set(o,s),s+=o.byteLength}return r}};const Ka=new Set([de,ge,me]),Ja={[Fa]:de,[Da]:de,[Ta]:de,[Ba]:de,[Pa]:ge,[La]:ge,[ba]:ge,[wa]:ge,[Ua]:me,[Ra]:me,[Ia]:me,[Sa]:me,[Qa]:be,[Na]:be},$a={[Fa]:ce,[Da]:he,[Ta]:ae,[Ba]:ae,[Pa]:ce,[La]:he,[ba]:ae,[wa]:ae,[Ua]:ce,[Ra]:he,[Ia]:ae,[Sa]:ae,[Qa]:ae,[Na]:ae};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?Oe:ke:10===t.colorPrimaries?2===t.transferFunction?Ge:Ve:(0===t.colorPrimaries||qa.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),Qe)}var Za,eo;const to=Symbol("retainerCount"),io=Symbol("recentlyUsed"),no=Symbol("evict"),ro=Symbol("evictionThreshold"),so=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[Za]=new Map,this[eo]=[],this[so]=e,this[ro]=t}set evictionThreshold(e){this[ro]=e,this[no]()}get evictionThreshold(){return this[ro]}get cache(){return this[so]}retainerCount(e){return this[to].get(e)||0}reset(){this[to].clear(),this[io]=[]}retain(e){this[to].has(e)||this[to].set(e,0),this[to].set(e,this[to].get(e)+1);const t=this[io].indexOf(e);-1!==t&&this[io].splice(t,1),this[io].unshift(e),this[no]()}release(e){this[to].has(e)&&this[to].set(e,Math.max(this[to].get(e)-1,0)),this[no]()}[(Za=to,eo=io,no)](){if(!(this[io].length<this[ro]))for(let e=this[io].length-1;e>=this[ro];--e){const t=this[io][e];0===this[to].get(t)&&(this[so].delete(t),this[io].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const r of e.mappings)for(const e of r.variants)t.set(e,{material:null,gltfMaterialIndex:r.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,r=t.json;if(void 0===r.extensions||void 0===r.extensions[this.name])return null;const s=(e=>{const t=[],r=new Set;for(const s of e){let e=s,o=0;for(;r.has(e);)e=s+"."+ ++o;r.add(e),t.push(e)}return t})((r.extensions[this.name].variants||[]).map((e=>e.name)));for(const s of e.scenes)s.traverse((e=>{const s=e;if(!s.material)return;const o=t.associations.get(s);if(null==o||null==o.meshes||null==o.primitives)return;const l=r.meshes[o.meshes].primitives[o.primitives].extensions;l&&l[this.name]&&(s.userData.variantMaterials=mappingsArrayToTable(l[this.name]))}));return e.userData.variants=s,Promise.resolve()}}var ao,oo,lo=r(5108);Texture.DEFAULT_ANISOTROPY=4;const co=new Map,ho=new Map;let uo;const po=new class DRACOLoader extends Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,s){const o=new three_module_FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(e=>{this.parse(e,t,s)}),r,s)}parse(e,t,r=()=>{}){this.decodeDracoFile(e,t,null,null,Oe).catch(r)}decodeDracoFile(e,t,r,s,o=ke,l=()=>{}){const c={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:o};return this.decodeGeometry(e,c).then(t).catch(l)}decodeGeometry(e,t){const r=JSON.stringify(t);if(ra.has(e)){const t=ra.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const o=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(o,l).then((r=>(s=r,new Promise(((r,l)=>{s._callbacks[o]={resolve:r,reject:l},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{s&&o&&this._releaseTask(s,o)})),ra.set(e,{key:r,promise:c}),c}_createGeometry(e){const t=new three_module_BufferGeometry;e.index&&t.setIndex(new three_module_BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r],o=s.name,l=s.array,c=s.itemSize,h=new three_module_BufferAttribute(l,c);"color"===o&&(this._assignVertexColorSpace(h,s.vertexColorSpace),h.normalized=l instanceof Float32Array==!1),t.setAttribute(o,h)}return t}_assignVertexColorSpace(e,t){if(t!==Oe)return;const r=new Color;for(let t=0,s=e.count;t<s;t++)r.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new three_module_FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise(((t,s)=>{r.load(e,t,void 0,s)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=DRACOWorker.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:na.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){na.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};let Ao;const mo=new KTX2Loader;let go,fo;const _o=Symbol("loader"),vo=Symbol("evictionPolicy"),yo=Symbol("GLTFInstance");class CachingGLTFLoader extends EventDispatcher{constructor(e){super(),this[oo]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[yo]=e,this[_o].setDRACOLoader(po),this[_o].setKTX2Loader(mo)}static setDRACODecoderLocation(e){uo=e,po.setDecoderPath(e)}static getDRACODecoderLocation(){return uo}static setKTX2TranscoderLocation(e){Ao=e,mo.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Ao}static setMeshoptDecoderLocation(e){var t;go!==e&&(go=e,fo=(t=e,new Promise(((e,r)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=r,s.async=!0,s.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return go}static initializeKTX2Loader(e){mo.detectSupport(e)}static get cache(){return co}static clearCache(){co.forEach(((e,t)=>{this.delete(t)})),this[vo].reset()}static has(e){return co.has(e)}static async delete(e){if(!this.has(e))return;const t=co.get(e);ho.delete(e),co.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!ho.get(e)}get[(ao=vo,oo=_o,vo)](){return this.constructor[vo]}async preload(e,t,r=()=>{}){if(this[_o].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!co.has(e)){null!=fo&&this[_o].setMeshoptDecoder(await fo);const t=((e,t,r=()=>{})=>{const onProgress=e=>{const t=e.loaded/e.total;r(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((r,s)=>{t.load(e,r,onProgress,s)}))})(e,this[_o],(e=>{r(.8*e)})),s=this[yo],o=t.then((e=>s.prepare(e))).then((e=>(r(.9),new s(e)))).catch((e=>(lo.error(e),new s)));co.set(e,o)}await co.get(e),ho.set(e,!0),r&&r(1)}async load(e,t,r=()=>{}){await this.preload(e,t,r);const s=await co.get(e),o=await s.clone();return this[vo].retain(e),o.dispose=()=>{this[vo].release(e)},o}}CachingGLTFLoader[ao]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Vector2(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const Eo=new three_module_Vector3,xo=new three_module_Matrix4,Mo=new three_module_Matrix4,Co=new three_module_Vector3,So=new three_module_Vector3;class CSS2DRenderer{constructor(e={}){const t=this;let r,s,o,l;const c={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,r,s){if(e.isCSS2DObject){Eo.setFromMatrixPosition(e.matrixWorld),Eo.applyMatrix4(Mo);const d=!0===e.visible&&Eo.z>=-1&&Eo.z<=1&&!0===e.layers.test(s.layers);if(e.element.style.display=!0===d?"":"none",!0===d){e.onBeforeRender(t,r,s);const c=e.element;c.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Eo.x*o+o)+"px,"+(-Eo.y*l+l)+"px)",c.parentNode!==h&&h.appendChild(c),e.onAfterRender(t,r,s)}const p={distanceToCameraSquared:getDistanceToSquared(s,e)};c.objects.set(e,p)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],r,s)}function getDistanceToSquared(e,t){return Co.setFromMatrixPosition(e.matrixWorld),So.setFromMatrixPosition(t.matrixWorld),Co.distanceToSquared(So)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:r,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),xo.copy(t.matrixWorldInverse),Mo.multiplyMatrices(t.projectionMatrix,xo),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return c.objects.get(e).distanceToCameraSquared-c.objects.get(t).distanceToCameraSquared})),r=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,t){r=e,s=t,o=r/2,l=s/2,h.style.width=e+"px",h.style.height=t+"px"}}}r(5108);function reduceVertices(e,t,r){let s=r;const o=new three_module_Vector3;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:r}=e;if(void 0!==r){const{position:l}=r.attributes;if(void 0!==l)for(let r=0,c=l.count;r<c;r++)e.isMesh?e.getVertexPosition(r,o):o.fromBufferAttribute(l,r),e.isSkinnedMesh||o.applyMatrix4(e.matrixWorld),s=t(s,o)}})),s}let Io,bo,wo,To;function decompress(e,t=1/0,r=null){bo||(bo=new PlaneGeometry(2,2,1,1)),wo||(wo=new ShaderMaterial({uniforms:{blitTexture:new Uniform(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),wo.uniforms.blitTexture.value=e,wo.defines.IS_SRGB=e.colorSpace==Oe,wo.needsUpdate=!0,To||(To=new three_module_Mesh(bo,wo),To.frustumCulled=!1);const s=new PerspectiveCamera,o=new Scene;o.add(To),null===r&&(r=Io=new WebGLRenderer({antialias:!1}));const l=Math.min(e.image.width,t),c=Math.min(e.image.height,t);r.setSize(l,c),r.clear(),r.render(o,s);const h=document.createElement("canvas"),d=h.getContext("2d");h.width=l,h.height=c,d.drawImage(r.domElement,0,0,l,c);const p=new CanvasTexture(h);return p.minFilter=e.minFilter,p.magFilter=e.magFilter,p.wrapS=e.wrapS,p.wrapT=e.wrapT,p.name=e.name,Io&&(Io.forceContextLoss(),Io.dispose(),Io=null),p}var Bo=r(5108);const Ro={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){const o=new GLTFWriter,l=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)l.push(this.pluginCallbacks[e](o));o.setPlugins(l),o.write(e,t,s).catch(r)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,s,o,t)}))}}const Lo=0,Do=1,Uo=2,Po=3,Fo=4,No=5120,Qo=5121,Oo=5122,ko=5123,Go=5124,Vo=5125,Ho=5126,zo=34962,Wo=34963,qo=9728,jo=9729,Xo=9984,Yo=9985,Ko=9986,Jo=9987,$o=33071,Zo=33648,el=10497,tl="KHR_mesh_quantization",il={};il[ee]=qo,il[1004]=Xo,il[1005]=Ko,il[1006]=jo,il[1007]=Yo,il[1008]=Jo,il[1001]=$o,il[1e3]=el,il[1002]=Zo;const nl={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},rl=new Color;function equalArray(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const r=getPaddedBufferSize(e.byteLength);if(r!==e.byteLength){const s=new Uint8Array(r);if(s.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<r;o++)s[o]=t;return s.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((r=>e.toBlob(r,t)));let r;return"image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r})}class GLTFWriter{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,o=s.buffers,l=s.json;r=s.options;const c=s.extensionsUsed,h=s.extensionsRequired,d=new Blob(o,{type:"application/octet-stream"}),p=Object.keys(c),A=Object.keys(h);if(p.length>0&&(l.extensionsUsed=p),A.length>0&&(l.extensionsRequired=A),l.buffers&&l.buffers.length>0&&(l.buffers[0].byteLength=d.size),!0===r.binary){const e=new FileReader;e.readAsArrayBuffer(d),e.onloadend=function(){const r=getPaddedArrayBuffer(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,r.byteLength,!0),s.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(l)),32),c=new DataView(new ArrayBuffer(8));c.setUint32(0,o.byteLength,!0),c.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),d=new DataView(h);d.setUint32(0,1179937895,!0),d.setUint32(4,2,!0);const p=12+c.byteLength+o.byteLength+s.byteLength+r.byteLength;d.setUint32(8,p,!0);const A=new Blob([h,c,o,s,r],{type:"application/octet-stream"}),m=new FileReader;m.readAsArrayBuffer(A),m.onloadend=function(){t(m.result)}}}else if(l.buffers&&l.buffers.length>0){const e=new FileReader;e.readAsDataURL(d),e.onloadend=function(){const r=e.result;l.buffers[0].uri=r,t(l)}}else t(l)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,s=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],s[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){Bo.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new three_module_Vector3;for(let r=0,s=e.count;r<s;r++)if(Math.abs(t.fromBufferAttribute(e,r).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),s=new three_module_Vector3;for(let e=0,t=r.count;e<t;e++)s.fromBufferAttribute(r,e),0===s.x&&0===s.y&&0===s.z?s.setX(1):s.normalize(),r.setXYZ(e,s.x,s.y,s.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(s.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===Oe?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}Bo.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof CompressedTexture&&(e=decompress(e)),t instanceof CompressedTexture&&(t=decompress(t));const r=e?e.image:null,s=t?t.image:null,o=Math.max(r?r.width:0,s?s.width:0),l=Math.max(r?r.height:0,s?s.height:0),c=getCanvas();c.width=o,c.height=l;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,o,l);const d=h.getImageData(0,0,o,l);if(r){h.drawImage(r,0,0,o,l);const t=getEncodingConversion(e),s=h.getImageData(0,0,o,l).data;for(let e=2;e<s.length;e+=4)d.data[e]=256*t(s[e]/256)}if(s){h.drawImage(s,0,0,o,l);const e=getEncodingConversion(t),r=h.getImageData(0,0,o,l).data;for(let t=1;t<r.length;t+=4)d.data[t]=256*e(r[t]/256)}h.putImageData(d,0,0);const p=(e||t).clone();return p.source=new Source(c),p.colorSpace=Qe,p.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&Bo.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),p}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,s,o){const l=this.json;let c;switch(l.bufferViews||(l.bufferViews=[]),t){case No:case Qo:c=1;break;case Oo:case ko:c=2;break;default:c=4}let h=e.itemSize*c;o===zo&&(h=4*Math.ceil(h/4));const d=getPaddedBufferSize(s*h),p=new DataView(new ArrayBuffer(d));let A=0;for(let o=r;o<r+s;o++){for(let r=0;r<e.itemSize;r++){let s;e.itemSize>4?s=e.array[o*e.itemSize+r]:(0===r?s=e.getX(o):1===r?s=e.getY(o):2===r?s=e.getZ(o):3===r&&(s=e.getW(o)),!0===e.normalized&&(s=ht.normalize(s,e.array))),t===Ho?p.setFloat32(A,s,!0):t===Go?p.setInt32(A,s,!0):t===Vo?p.setUint32(A,s,!0):t===Oo?p.setInt16(A,s,!0):t===ko?p.setUint16(A,s,!0):t===No?p.setInt8(A,s):t===Qo&&p.setUint8(A,s),A+=c}A%h!=0&&(A+=h-A%h)}const m={buffer:this.processBuffer(p.buffer),byteOffset:this.byteOffset,byteLength:d};void 0!==o&&(m.target=o),o===zo&&(m.byteStride=h),this.byteOffset+=d,l.bufferViews.push(m);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(s){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),l={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(r.bufferViews.push(l)-1)}}))}processAccessor(e,t,r,s){const o=this.json;let l;if(e.array.constructor===Float32Array)l=Ho;else if(e.array.constructor===Int32Array)l=Go;else if(e.array.constructor===Uint32Array)l=Vo;else if(e.array.constructor===Int16Array)l=Oo;else if(e.array.constructor===Uint16Array)l=ko;else if(e.array.constructor===Int8Array)l=No;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=Qo}if(void 0===r&&(r=0),void 0!==s&&s!==1/0||(s=e.count),0===s)return null;const c=function getMinMax(e,t,r){const s={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let o=t;o<t+r;o++)for(let t=0;t<e.itemSize;t++){let r;e.itemSize>4?r=e.array[o*e.itemSize+t]:(0===t?r=e.getX(o):1===t?r=e.getY(o):2===t?r=e.getZ(o):3===t&&(r=e.getW(o)),!0===e.normalized&&(r=ht.normalize(r,e.array))),s.min[t]=Math.min(s.min[t],r),s.max[t]=Math.max(s.max[t],r)}return s}(e,r,s);let h;void 0!==t&&(h=e===t.index?Wo:zo);const d=this.processBufferView(e,l,r,s,h),p={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:s,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(p.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(p)-1}processImage(e,t,r,s="image/png"){if(null!==e){const o=this,l=o.cache,c=o.json,h=o.options,d=o.pending;l.images.has(e)||l.images.set(e,{});const p=l.images.get(e),A=s+":flipY/"+r.toString();if(void 0!==p[A])return p[A];c.images||(c.images=[]);const m={mimeType:s},g=getCanvas();g.width=Math.min(e.width,h.maxTextureSize),g.height=Math.min(e.height,h.maxTextureSize);const f=g.getContext("2d");if(!0===r&&(f.translate(0,g.height),f.scale(1,-1)),void 0!==e.data){t!==de&&Bo.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>h.maxTextureSize||e.height>h.maxTextureSize)&&Bo.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const r=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<r.length;t+=4)r[t+0]=e.data[t+0],r[t+1]=e.data[t+1],r[t+2]=e.data[t+2],r[t+3]=e.data[t+3];f.putImageData(new ImageData(r,e.width,e.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");f.drawImage(e,0,0,g.width,g.height)}!0===h.binary?d.push(getToBlobPromise(g,s).then((e=>o.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==g.toDataURL?m.uri=g.toDataURL(s):d.push(getToBlobPromise(g,s).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const _=c.images.push(m)-1;return p[A]=_,_}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:il[e.magFilter],minFilter:il[e.minFilter],wrapS:il[e.wrapS],wrapT:il[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof CompressedTexture&&(e=decompress(e,t.maxTextureSize));let o=e.userData.mimeType;"image/webp"===o&&(o="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const c=s.textures.push(l)-1;return r.textures.set(e,c),c}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return Bo.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const s={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&Bo.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(equalArray(o,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),r={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(r,t),s.pbrMetallicRoughness.metallicRoughnessTexture=r}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),s.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),s.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),s.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),s.occlusionTexture=t}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),2===e.side&&(s.doubleSided=!0),""!==e.name&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,s)}));const l=r.materials.push(s)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,r=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const o=s.join(":");if(t.meshes.has(o))return t.meshes.get(o);const l=e.geometry;let c;c=e.isLineSegments?Do:e.isLineLoop?Uo:e.isLine?Po:e.isPoints?Lo:e.material.wireframe?Do:Fo;const h={},d={},p=[],A=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},g=l.getAttribute("normal");void 0===g||this.isNormalizedNormalAttribute(g)||(Bo.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(g)));let f=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const r=l.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(r))){d[e]=t.attributes.get(this.getUID(r));continue}f=null;const s=r.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array||(Bo.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new three_module_BufferAttribute(new Uint16Array(s),r.itemSize,r.normalized));const o=this.processAccessor(f||r,l);null!==o&&(e.startsWith("_")||this.detectMeshQuantization(e,r),d[e]=o,t.attributes.set(this.getUID(r),o))}if(void 0!==g&&l.setAttribute("normal",g),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const r=[],s=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let c=0;c<e.morphTargetInfluences.length;++c){const h={};let d=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){d||(Bo.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),d=!0);continue}const r=l.morphAttributes[e][c],s=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(r,!0))){h[s]=t.attributes.get(this.getUID(r,!0));continue}const p=r.clone();if(!l.morphTargetsRelative)for(let e=0,t=r.count;e<t;e++)for(let t=0;t<r.itemSize;t++)0===t&&p.setX(e,r.getX(e)-o.getX(e)),1===t&&p.setY(e,r.getY(e)-o.getY(e)),2===t&&p.setZ(e,r.getZ(e)-o.getZ(e)),3===t&&p.setW(e,r.getW(e)-o.getW(e));h[s]=this.processAccessor(p,l),t.attributes.set(this.getUID(o,!0),h[s])}A.push(h),r.push(e.morphTargetInfluences[c]),void 0!==e.morphTargetDictionary&&s.push(o[c])}h.weights=r,s.length>0&&(h.extras={},h.extras.targetNames=s)}const _=Array.isArray(e.material);if(_&&0===l.groups.length)return null;let y=!1;if(_&&null===l.index){const e=[];for(let t=0,r=l.attributes.position.count;t<r;t++)e[t]=t;l.setIndex(e),y=!0}const E=_?e.material:[e.material],x=_?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=x.length;e<r;e++){const r={mode:c,attributes:d};if(this.serializeUserData(l,r),A.length>0&&(r.targets=A),null!==l.index){let s=this.getUID(l.index);void 0===x[e].start&&void 0===x[e].count||(s+=":"+x[e].start+":"+x[e].count),t.attributes.has(s)?r.indices=t.attributes.get(s):(r.indices=this.processAccessor(l.index,l,x[e].start,x[e].count),t.attributes.set(s,r.indices)),null===r.indices&&delete r.indices}const s=this.processMaterial(E[x[e].materialIndex]);null!==s&&(r.material=s),p.push(r)}!0===y&&l.setIndex(null),h.primitives=p,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,h)}));const C=r.meshes.push(h)-1;return t.meshes.set(o,C),C}detectMeshQuantization(e,t){if(this.extensionsUsed[tl])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const s=e.split("_",1)[0];Ro[s]&&Ro[s].includes(r)&&(this.extensionsUsed[tl]=!0,this.extensionsRequired[tl]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,s={type:r?"orthographic":"perspective"};return r?s.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:ht.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const r=this.json,s=this.nodeMap;r.animations||(r.animations=[]);const o=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],c=[];for(let e=0;e<o.length;++e){const r=o[e],h=PropertyBinding.parseTrackName(r.name);let d=PropertyBinding.findNode(t,h.nodeName);const p=nl[h.propertyName];if("bones"===h.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(h.objectIndex):void 0),!d||!p)return Bo.warn('THREE.GLTFExporter: Could not export animation track "%s".',r.name),null;const A=1;let m,g=r.values.length/r.times.length;p===nl.morphTargetInfluences&&(g/=d.morphTargetInfluences.length),!0===r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",g/=3):m=r.getInterpolation()===Re?"STEP":"LINEAR",c.push({input:this.processAccessor(new three_module_BufferAttribute(r.times,A)),output:this.processAccessor(new three_module_BufferAttribute(r.values,g)),interpolation:m}),l.push({sampler:c.length-1,target:{node:s.get(d),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:c,channels:l}),r.animations.length-1}processSkin(e){const t=this.json,r=this.nodeMap,s=t.nodes[r.get(e)],o=e.skeleton;if(void 0===o)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const c=[],h=new Float32Array(16*o.bones.length),d=new three_module_Matrix4;for(let t=0;t<o.bones.length;++t)c.push(r.get(o.bones[t])),d.copy(o.boneInverses[t]),d.multiply(e.bindMatrix).toArray(h,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new three_module_BufferAttribute(h,16)),joints:c,skeleton:r.get(l)});return s.skin=t.skins.length-1}processNode(e){const t=this.json,r=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(r.trs){const t=e.quaternion.toArray(),r=e.position.toArray(),s=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(r,[0,0,0])||(o.translation=r),equalArray(s,[1,1,1])||(o.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=this.processMesh(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let s=0,o=e.children.length;s<o;s++){const o=e.children[s];if(o.visible||!1===r.onlyVisible){const e=this.processNode(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));const l=t.nodes.push(o)-1;return s.set(e,l),l}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const o=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===r.onlyVisible){const e=this.processNode(s);null!==e&&o.push(e)}}o.length>0&&(s.nodes=o),this.serializeUserData(e,s)}processObjects(e){const t=new Scene;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));const r=[];for(let t=0;t<e.length;t++)e[t]instanceof Scene?this.processScene(e[t]):r.push(e[t]);r.length>0&&this.processObjects(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let r=0;r<t.animations.length;++r)this.processAnimation(t.animations[r],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void Bo.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const r=this.writer,s=r.json,o=r.extensionsUsed,l={};e.name&&(l.name=e.name),l.color=e.color.toArray(),l.intensity=e.intensity,e.isDirectionalLight?l.type="directional":e.isPointLight?(l.type="point",e.distance>0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(1-e.penumbra)*e.angle,l.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&Bo.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||Bo.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},o[this.name]=!0);const c=s.extensions[this.name].lights;c.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:c.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};r.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(rl)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.anisotropyMap){const t={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.bumpMap){const t={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,s=e,o=new Float32Array(3*s.count),l=new Float32Array(4*s.count),c=new Float32Array(3*s.count),h=new three_module_Matrix4,d=new three_module_Vector3,p=new three_module_Quaternion,A=new three_module_Vector3;for(let e=0;e<s.count;e++)s.getMatrixAt(e,h),h.decompose(d,p,A),d.toArray(o,3*e),p.toArray(l,4*e),A.toArray(c,3*e);const m={TRANSLATION:r.processAccessor(new three_module_BufferAttribute(o,3)),ROTATION:r.processAccessor(new three_module_BufferAttribute(l,4)),SCALE:r.processAccessor(new three_module_BufferAttribute(c,3))};s.instanceColor&&(m._COLOR_0=r.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const r=.001,s=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),l=new e.ValueBufferType(e.values.length+s),c=e.createInterpolant(new e.ValueBufferType(s));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<s;e++)l[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<r)return 0;o[0]=t,o.set(e.times,1),l.set(c.evaluate(t),0),l.set(e.values,s),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<r)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),l.set(e.values,0),l.set(c.evaluate(t),e.values.length),h=o.length-1}else for(let d=0;d<e.times.length;d++){if(Math.abs(e.times[d]-t)<r)return d;if(e.times[d]<t&&e.times[d+1]>t){o.set(e.times.slice(0,d+1),0),o[d+1]=t,o.set(e.times.slice(d+1),d+2),l.set(e.values.slice(0,(d+1)*s),0),l.set(c.evaluate(t),(d+1)*s),l.set(e.values.slice((d+1)*s),(d+2)*s),h=d+1;break}}return e.times=o,e.values=l,h},mergeMorphTargetTracks:function(e,t){const r=[],s={},o=e.tracks;for(let e=0;e<o.length;++e){let l=o[e];const c=PropertyBinding.parseTrackName(l.name),h=PropertyBinding.findNode(t,c.nodeName);if("morphTargetInfluences"!==c.propertyName||void 0===c.propertyIndex){r.push(l);continue}if(l.createInterpolant!==l.InterpolantFactoryMethodDiscrete&&l.createInterpolant!==l.InterpolantFactoryMethodLinear){if(l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");Bo.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(Le)}const d=h.morphTargetInfluences.length,p=h.morphTargetDictionary[c.propertyIndex];if(void 0===p)throw new Error("THREE.GLTFExporter: Morph target name not found: "+c.propertyIndex);let A;if(void 0===s[h.uuid]){A=l.clone();const e=new A.ValueBufferType(d*A.times.length);for(let t=0;t<A.times.length;t++)e[t*d+p]=A.values[t];A.name=(c.nodeName||"")+".morphTargetInfluences",A.values=e,s[h.uuid]=A,r.push(A);continue}const m=l.createInterpolant(new l.ValueBufferType(1));A=s[h.uuid];for(let e=0;e<A.times.length;e++)A.values[e*d+p]=m.evaluate(A.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(A,l.times[e]);A.values[t*d+p]=l.values[e]}}return e.tracks=r,e}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const r of e)r.traverse((e=>{if(!compatibleObject(e))return;const r=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,o]of s){const s=r.get(o.index);s&&compatibleMaterial(s.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const r=e.userData,s=r.variantMaterials,o=r.variantData,l=new Map,c=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())c.set(t.index,e);for(const e of o.values()){const t=s.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const r=this.writer.processMaterial(t.material);l.has(r)||l.set(r,{material:r,variants:[]}),l.get(r).variants.push(c.get(e.index))}const d=Array.from(l.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===d.length)return;const p=compatibleMaterial(r.originalMaterial)?this.writer.processMaterial(r.originalMaterial):-1;for(const e of t.primitives)p>=0&&(e.material=p),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:d}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class SessionLightProbe{constructor(e,t,r,s,o){this.xrLight=e,this.renderer=t,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const r=new WebGLCubeRenderTarget(16);e.environment=r.texture;const s=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":s.getExtension("EXT_sRGB");break;case"rgba16f":s.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,s),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}l.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/e,r.primaryLightIntensity.y/e,r.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends three_module_Group{constructor(e,t=!0){super(),this.lightProbe=new LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,s=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{r=new SessionLightProbe(this,e,o,t,(()=>{s=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{r&&(r.dispose(),r=null),s&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,r,s){const o=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(r<0)return e;const l=e-t,c=this.velocity+this.naturalFrequency*l,h=l+r*c,d=Math.exp(-this.naturalFrequency*r),p=(c-this.naturalFrequency*h)*d,A=-this.naturalFrequency*(p+c*d);return Math.abs(p)<o*Math.abs(s)&&A*l>=0?(this.velocity=0,t):(this.velocity=p,t+h*d)}}const sl=.2,al=Math.PI/24,ol=new Vector2,addCorner=(e,t,r)=>{let s=t>0?r>0?0:-Math.PI/2:r>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(s),r+.17*Math.sin(s),0,t+sl*Math.cos(s),r+sl*Math.sin(s),0),s+=al};class PlacementBox extends three_module_Mesh{constructor(e,t){const r=new three_module_BufferGeometry,s=[],o=[],{size:l,boundingBox:c}=e,h=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(o,h,d),addCorner(o,-h,d),addCorner(o,-h,-d),addCorner(o,h,-d);const p=o.length/3;for(let e=0;e<p-2;e+=2)s.push(e,e+1,e+3,e,e+3,e+2);const A=p-2;s.push(A,A+1,1,A,1,0),r.setAttribute("position",new three_module_Float32BufferAttribute(o,3)),r.setIndex(s),super(r),this.side=t;const m=this.material;switch(m.side=2,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new three_module_Mesh(new PlaneGeometry(2*(h+sl),2*(d+sl))),this.hitPlane.visible=!1,this.hitPlane.material.side=2,this.add(this.hitPlane),c.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=c.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=c.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,r){ol.set(t,-r),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(ol,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,r){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,r);return this.hitPlane.scale.set(1,1,1),s}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:r}=this.hitPlane;t.dispose(),r.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),ll=(()=>{const e={};return t=>{const r=t;if(r in e)return e[r];const s=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=cl(t),r=e.nodes[0];if(null==r||0===r.terms.length)break;s.push(r),t=e.remainingInput}return e[r]=s}})(),cl=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,r=/^[\),]/;return s=>{const o=[];for(;s.length&&(s=s.trim(),!r.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(s);s=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=hl(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:r}=parseFunctionArguments(s);o.push({type:"function",name:t,arguments:e}),s=r}else o.push(t)}else if(t.test(s))o.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?dl(s):ul(s);if(0===e.length)break;o.push(e[0]),s=t}return{nodes:[{type:"expression",terms:o}],remainingInput:s}}})(),hl=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const r=t.match(e);return{nodes:[{type:"ident",value:null==r?t:t.substr(0,r.index)}],remainingInput:null==r?"":t.substr(r.index)}}})(),ul=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,r=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const o=s.match(e),l=null==o?"0":o[0],c=(s=null==l?s:s.slice(l.length)).match(t);let h=null!=c&&""!==c[0]?c[0]:null;const d=null==c?s:s.slice(h.length);return null==h||r.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(l)||0,unit:h}],remainingInput:d}}})(),dl=(()=>{const e=/^[a-f0-9]*/i;return t=>{const r=(t=t.slice(1).trim()).match(e);return{nodes:null==r?[]:[{type:"hex",value:r[0]}],remainingInput:null==r?t:t.slice(r[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const r=cl(e);if(t.push(r.nodes[0]),","===(e=r.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},pl=Symbol("visitedTypes");class ASTWalker{constructor(e){this[pl]=e}walk(e,t){const r=e.slice();for(;r.length;){const e=r.shift();switch(this[pl].indexOf(e.type)>-1&&t(e),e.type){case"expression":r.unshift(...e.terms);break;case"function":r.unshift(e.name,...e.arguments)}}}}const Al=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:r,unit:s}=e;if(isFinite(r)){if("rad"===e.unit||null==e.unit)return e}else r=t,s="rad";return{type:"number",number:("deg"===s&&null!=r?r:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let r,{number:s,unit:o}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,o="m";switch(o){default:r=1;break;case"cm":r=.01;break;case"mm":r=.001}return{type:"number",number:r*s,unit:"m"}},ml=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,r=Al)=>{isFinite(t.number)||(t.number=r.number,t.unit=r.unit);const{unit:s}=t;if(null==s)return t;const o=e[s];return null==o?r:o(t)}})();var gl,fl,_l;const vl=Symbol("evaluate"),yl=Symbol("lastValue");class Evaluator{constructor(){this[gl]=null}static evaluatableFor(e,t=Al){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return Al}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:r,keywords:s}=t,{auto:o}=s;return r.map(((t,r)=>{const l=null==o[r]?t:o[r];let c=e[r]?e[r]:l;if("ident"===c.type){const e=c.value;e in s&&(c=s[e][r])}return null!=c&&"ident"!==c.type||(c=l),"%"===c.unit?numberNode(c.number/100*t.number,t.unit):(c=ml(c,t),c.unit!==t.unit?t:c)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[yl]||(this[yl]=this[vl]()),this[yl]}}gl=yl;const El=Symbol("percentage"),xl=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[El]=e,this[xl]=t}get isConstant(){return!0}[vl](){return numberNode(this[El].number/100*this[xl].number,this[xl].unit)}}const Ml=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[fl]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[Ml]=t)}get isConstant(){return!1}[(fl=Ml,vl)](){if(null!=this[Ml]&&"window-scroll-y"===this[Ml].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Al}}const Cl=/[\*\/]/,Sl=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Al){if(super(),this[_l]=null,1!==e.arguments.length)return;const r=e.arguments[0].terms.slice(),s=[];for(;r.length;){const e=r.shift();if(s.length>0){const r=s[s.length-1];if("operator"===r.type&&Cl.test(r.value)){const r=s.pop(),o=s.pop();if(null==o)return;s.push(new OperatorEvaluator(r,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;s.length>2;){const[e,r,o]=s.splice(0,3);if("operator"!==r.type)return;s.unshift(new OperatorEvaluator(r,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===s.length&&(this[Sl]=s[0])}get isConstant(){return null==this[Sl]||Evaluator.isConstant(this[Sl])}[(_l=Sl,vl)](){return null!=this[Sl]?Evaluator.evaluate(this[Sl]):Al}}const Il=Symbol("operator"),bl=Symbol("left"),wl=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,r){super(),this[Il]=e,this[bl]=t,this[wl]=r}get isConstant(){return Evaluator.isConstant(this[bl])&&Evaluator.isConstant(this[wl])}[vl](){const e=ml(Evaluator.evaluate(this[bl])),t=ml(Evaluator.evaluate(this[wl])),{number:r,unit:s}=e,{number:o,unit:l}=t;if(null!=l&&null!=s&&l!=s)return Al;const c=s||l;let h;switch(this[Il].value){case"+":h=r+o;break;case"-":h=r-o;break;case"/":h=r/o;break;case"*":h=r*o;break;default:return Al}return{type:"number",number:h,unit:c}}}const Tl=Symbol("evaluatables"),Bl=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[Bl]=t;const r=e[0],s=null!=r?r.terms:[];this[Tl]=t.basis.map(((e,t)=>{const r=s[t];return null==r?{type:"ident",value:"auto"}:"ident"===r.type?r:Evaluator.evaluatableFor(r,e)}))}get isConstant(){for(const e of this[Tl])if(!Evaluator.isConstant(e))return!1;return!0}[vl](){const e=this[Tl].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[Bl]).map((e=>e.number))}}var Rl,Ll,Dl,Ul;const Pl=Symbol("instances"),Fl=Symbol("activateListener"),Nl=Symbol("deactivateListener"),Ql=Symbol("notifyInstances"),Ol=Symbol("notify"),kl=Symbol("callback");class ScrollObserver{constructor(e){this[kl]=e}static[Ql](){for(const e of ScrollObserver[Pl])e[Ol]()}static[(Rl=Pl,Fl)](){window.addEventListener("scroll",this[Ql],{passive:!0})}static[Nl](){window.removeEventListener("scroll",this[Ql])}observe(){0===ScrollObserver[Pl].size&&ScrollObserver[Fl](),ScrollObserver[Pl].add(this)}disconnect(){ScrollObserver[Pl].delete(this),0===ScrollObserver[Pl].size&&ScrollObserver[Nl]()}[Ol](){this[kl]()}}ScrollObserver[Rl]=new Set;const Gl=Symbol("computeStyleCallback"),Vl=Symbol("astWalker"),Hl=Symbol("dependencies"),zl=Symbol("onScroll");class StyleEffector{constructor(e){this[Ll]={},this[Dl]=new ASTWalker(["function"]),this[Ul]=()=>{this[Gl]({relatedState:"window-scroll"})},this[Gl]=e}observeEffectsFor(e){const t={},r=this[Hl];this[Vl].walk(e,(e=>{const{name:s}=e,o=e.arguments[0].terms[0];if("env"===s.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in r?r["window-scroll"]:new ScrollObserver(this[zl]);e.observe(),delete r["window-scroll"],t["window-scroll"]=e}}));for(const e in r){r[e].disconnect()}this[Hl]=t}dispose(){for(const e in this[Hl]){this[Hl][e].disconnect()}}}Ll=Hl,Dl=Vl,Ul=zl;const style=e=>{const t=e.observeEffects||!1,r=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,o)=>{const l=s.updated,c=s.connectedCallback,h=s.disconnectedCallback,d=Symbol(`${o}StyleEffector`),p=Symbol(`${o}StyleEvaluator`),A=Symbol(`${o}UpdateEvaluator`),m=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(s,{[d]:{value:null,writable:!0},[p]:{value:null,writable:!0},[A]:{value:function(){const e=ll(this[o]);this[p]=new StyleEvaluator(e,r(this)),null==this[d]&&t&&(this[d]=new StyleEffector((()=>this[m]()))),null!=this[d]&&this[d].observeEffectsFor(e)}},[m]:{value:function(){if(null==this[p])return;const t=this[p].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[A](),this[m]()),l.call(this,e)}},connectedCallback:{value:function(){c.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[d]&&(this[d].dispose(),this[d]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,r=easeInOutQuad)=>s=>e+(t-e)*r(s),timeline=e=>{const t=[],r=[];let s=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const l=e.keyframes[o],{value:c,frames:h}=l,d=l.ease||easeInOutQuad,p=interpolate(s,c,d);t.push(p),r.push(h),s=c}return((e,t)=>{const r=t.map((s=0,e=>s+=e));var s;return t=>{t=utilities_clamp(t,0,1),t*=r[r.length-1];const s=r.findIndex((e=>e>=t)),o=s<1?0:r[s-1],l=r[s];return e[s]((t-o)/(l-o))}})(t,r)};var Wl=r(5108),controls_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const ql=timeline({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),jl=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),Xl="0deg 75deg 105%",Yl=["front","right","back","left"],Kl=["upper-","","lower-"],Jl="auto",$l="basic",Zl="wiggle",ec="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),tc=(()=>{const e=ll(Xl)[0].terms,t=ml(e[0]),r=ml(e[1]);return e=>{const s=e[Kd].idealCameraDistance();return{basis:[t,r,numberNode(s,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[Kd].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=tc(e),r=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(r,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[Kd].boundingBox.getCenter(new three_module_Vector3);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},ic=Math.PI/2,nc=Math.PI/3,rc=ic/2,sc=2*Math.PI,ac=Symbol("controls"),oc=Symbol("panElement"),cc=Symbol("promptElement"),hc=Symbol("promptAnimatedContainer"),uc=Symbol("fingerAnimatedContainers"),dc=Symbol("deferInteractionPrompt"),pc=Symbol("updateAria"),Ac=Symbol("a11y"),mc=Symbol("updateA11y"),gc=Symbol("updateCameraForRadius"),fc=Symbol("cancelPrompts"),_c=Symbol("onChange"),vc=Symbol("onPointerChange"),yc=Symbol("waitingToPromptUser"),Ec=Symbol("userHasInteracted"),xc=Symbol("promptElementVisibleTime"),Mc=Symbol("lastPromptOffset"),Cc=Symbol("cancellationSource"),Sc=Symbol("lastSpherical"),Ic=Symbol("jumpCamera"),bc=Symbol("initialized"),wc=Symbol("maintainThetaPhi"),Tc=Symbol("syncCameraOrbit"),Bc=Symbol("syncFieldOfView"),Rc=Symbol("syncCameraTarget"),Lc=Symbol("syncMinCameraOrbit"),Dc=Symbol("syncMaxCameraOrbit"),Uc=Symbol("syncMinFieldOfView"),Pc=Symbol("syncMaxFieldOfView"),Fc=new Vector2,Nc=new three_module_Vector3,Qc=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Oc=Math.PI/8,kc=.04,Gc={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends EventDispatcher{constructor(e,t,r){super(),this.camera=e,this.element=t,this.scene=r,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Gc.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Matrix3,this.panPerPixel=0,this.spherical=new Spherical,this.goalSpherical=new Spherical,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(Qc.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=kc*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:r}=this._options;if(!this.touchDecided&&"none"!==r){this.touchDecided=!0;const s=Math.abs(e),o=Math.abs(t);if(this.changeSource===Gc.USER_INTERACTION&&("pan-y"===r&&o>s||"pan-x"===r&&s>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?Gc.AUTOMATIC:Gc.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=Gc.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===Gc.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const r=this.pointers.length,s=(e.clientX-t.clientX)/r,o=(e.clientY-t.clientY)/r;0===s&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?Gc.AUTOMATIC:Gc.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,o)):(this.changeSource=Gc.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,o):this.handleSinglePointerMove(s,o)))},this.onPointerUp=e=>{const{element:t}=this,r=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==r&&this.pointers.splice(r,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[oc].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=Gc.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*kc*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=Gc.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},Qc),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",(()=>{}),{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new Spherical){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,r=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:o,minimumPolarAngle:l,maximumPolarAngle:c,minimumRadius:h,maximumRadius:d}=this._options,{theta:p,phi:A,radius:m}=this.goalSpherical,g=utilities_clamp(e,s,o);isFinite(s)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-g)+g);const f=utilities_clamp(t,l,c),_=utilities_clamp(r,h,d);return(g!==p||f!==A||_!==m)&&(!!(isFinite(g)&&isFinite(f)&&isFinite(_))&&(this.goalSpherical.theta=g,this.goalSpherical.phi=f,this.goalSpherical.radius=_,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:r}=this._options;e=utilities_clamp(e,t,r),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,r){const{theta:s,phi:o,radius:l}=this.goalSpherical,{minimumRadius:c,maximumRadius:h,minimumFieldOfView:d,maximumFieldOfView:p}=this._options,A=this.spherical.theta-s,m=Math.PI-.001,g=s-utilities_clamp(e,-m-A,m-A),f=o-t,_=0===r?0:((r>0?h:c)-l)/(Math.log(r>0?p:d)-this.goalLogFov),y=l+r*(isFinite(_)?_:2*(h-c));if(this.setOrbit(g,f,y),0!==r){const e=this.goalLogFov+r;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:r,maximumRadius:s}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,r),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Euler(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,r){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,r*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:r,clientY:s}=e,{clientX:o,clientY:l}=t,c=o-r,h=l-s;return Math.sqrt(c*c+h*h)}handleSinglePointerMove(e,t){const r=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(r,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,r=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(r),-Math.cos(t)*Math.sin(r),0,0,Math.sin(t),0,Math.sin(r),-Math.cos(t)*Math.cos(r),0)}movePan(e,t){const{scene:r}=this,s=Nc.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(o);const l=r.getTarget();l.add(s.applyMatrix3(this.panProjection)),r.boundingSphere.clampPoint(l,l),r.setTarget(l.x,l.y,l.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,r=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==r){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(r.position),t.setTarget(r.position.x,r.position.y,r.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(Fc.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const r=e.getTarget(),{theta:s,phi:o}=this.spherical,l=s-e.yaw,c=Nc.set(Math.sin(o)*Math.sin(l),Math.cos(o),Math.sin(o)*Math.cos(l)),h=c.dot(t.position.sub(r));r.add(c.multiplyScalar(h)),e.setTarget(r.x,r.y,r.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[oc].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[oc].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,kc*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Oc,0);break;case"ArrowDown":this.userAdjustOrbit(0,Oc,0);break;case"ArrowLeft":this.userAdjustOrbit(-Oc,0,0);break;case"ArrowRight":this.userAdjustOrbit(Oc,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}var Vc=r(5108);const Hc=1/1.3,zc="not-presenting",Wc="session-started",qc="object-placed",jc="failed",Xc="tracking",Yc="not-tracking",Kc=new three_module_Vector3,Jc=new three_module_Matrix4,$c=new three_module_Vector3,Zc=new PerspectiveCamera(45,1,.1,100);class ARRenderer extends EventDispatcher{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new three_module_Vector3,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new three_module_Vector3,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new three_module_Vector3,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const r=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=this.placementBox;if(1===r.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,r=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=r?(this.isTranslating=!0,this.lastDragPosition.copy(r)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===r.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/s.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return Vc.warn("Request to present in WebXR denied:"),Vc.warn(e),Vc.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&Vc.warn("Cannot present while a model is already presenting");let r=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await r,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const s=await this.resolveARSession();s.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const l=await s.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const c=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(c),z:-Math.cos(c)});s.requestHitTestSource({space:l,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=s,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Wc})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){Vc.warn("Error while trying to end WebXR AR session"),Vc.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const r=this.turntableRotation;null!=r&&(t.yaw=r);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[$s],e[Zs]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[ep](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Gc.NONE}}))}))}this.renderer.height=0;const r=this.exitWebXRButtonContainer;null!=r&&(r.classList.remove("enabled"),r.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:zc})}updateView(e){const t=this.presentedScene,r=this.threeRenderer.xr;r.updateCamera(Zc),t.xrCamera=r.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=r.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):r.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:r}=e,s=e.getCamera(),{width:o,height:l}=this.overlay.getBoundingClientRect();e.setSize(o,l),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c,radius:h}=r.getCameraOrbit(),d=s.getWorldDirection(Kc);e.yaw=Math.atan2(-d.x,-d.z)-c,this.goalYaw=e.yaw,t.copy(s.position).add(d.multiplyScalar(h)),this.updateTarget();const p=e.getTarget();t.add(p).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:A}=this.frame;A.addEventListener("selectstart",this.onSelectStart),A.addEventListener("selectend",this.onSelectEnd),A.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(Kc.copy(t).sub(this.presentedScene.getCamera().position),Kc.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),r=e.getPose(t);if(null==r)return null;const s=Jc.fromArray(r.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?$c.setFromMatrixPosition(s):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const r=e.getHitTestResults(t);if(0==r.length)return;const s=r[0],o=this.getHitPoint(s);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:qc}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,r=e[1].inputSource.gamepad.axes,s=r[0]-t[0],o=r[1]-t[1],l=Math.atan2(o,s);let c=this.lastAngle-l;return c>Math.PI?c-=2*Math.PI:c<-Math.PI&&(c+=2*Math.PI),this.lastAngle=l,{separation:Math.sqrt(s*s+o*o),deltaYaw:c}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const r=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=s.scale.x;if(this.isTwoFingering)if(r.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(r);if(!1===this.placeOnWall&&(this.goalYaw+=t),s.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>Hc?1:t}}else if(2!==r.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&r.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const r=Kc.copy(s.getCamera().position),l=-e/(r.y-t.y);r.multiplyScalar(l),t.multiplyScalar(1-l).add(r)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:r,yaw:s}=t,o=t.boundingSphere.radius,l=this.goalPosition,c=t.scale.x,h=this.placementBox;let d=Gc.NONE;if(!l.equals(r)||this.goalScale!==c){d=Gc.USER_INTERACTION;let{x:s,y:p,z:A}=r;s=this.xDamper.update(s,l.x,e,o),p=this.yDamper.update(p,l.y,e,o),A=this.zDamper.update(A,l.z,e,o),r.set(s,p,A);const m=this.scaleDamper.update(c,this.goalScale,e,1);if(t.scale.set(m,m,m),!this.isTranslating){const e=l.y-p;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/m,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,h.show=!1,t.setShadowIntensity(.8))}}h.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(s,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const r=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(r);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Yc}));const o=this.presentedScene;if(null==s||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Xc}));let l=!0;for(const r of s.views){if(this.updateView(r),l){this.moveToFloor(t),this.processInput(t);const r=e-this.lastTick;this.moveScene(r),this.renderer.preRender(o,e,r),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),l=!1}}}function clone(e){const t=new Map,r=new Map,s=e.clone();return parallelTraverse(e,s,(function(e,s){t.set(s,e),r.set(e,s)})),s.traverse((function(e){if(!e.isSkinnedMesh)return;const s=e,o=t.get(e),l=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=l.map((function(e){return r.get(e)})),s.bind(s.skeleton,s.bindMatrix)})),s}function parallelTraverse(e,t,r){r(e,t);for(let s=0;s<e.children.length;s++)parallelTraverse(e.children[s],t.children[s],r)}const eh=Symbol("prepared"),th=Symbol("prepare"),ih=Symbol("preparedGLTF"),nh=Symbol("clone");class GLTFInstance{constructor(e){this[ih]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[eh])return e;const t=this[th](e);return t[eh]=!0,t}static[th](e){const{scene:t}=e,r=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:r})}get parser(){return this[ih].parser}get animations(){return this[ih].animations}get scene(){return this[ih].scene}get scenes(){return this[ih].scenes}get cameras(){return this[ih].cameras}get asset(){return this[ih].asset}get userData(){return this[ih].userData}clone(){return new(0,this.constructor)(this[nh]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const r=e[t];if(r instanceof Texture){const e=r.source.data;null!=e.close&&e.close(),r.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[nh](){const e=this[ih],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const r=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:r,userData:s})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,r)=>{r(e,t);for(let s=0;s<e.children.length;s++)traversePair(e.children[s],t.children[s],r)},rh=Symbol("threeGLTF"),sh=Symbol("gltf"),ah=Symbol("gltfElementMap"),oh=Symbol("threeObjectMap"),lh=Symbol("parallelTraverseThreeScene"),ch=Symbol("correlateOriginalThreeGLTF"),hh=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,r,s){this[rh]=e,this[sh]=t,this[ah]=s,this[oh]=r}static from(e,t){return null!=t?this[hh](e,t):this[ch](e)}static[ch](e){const t=e.parser.json,r=e.parser.associations,s=new Map,o={name:"Default"},l={type:"materials",index:-1};for(const e of r.keys())e instanceof Material&&null==r.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(o)),e.name=o.name,r.set(e,{materials:l.index}));for(const[e,o]of r){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const r in o)if(null!=r&&"primitives"!==r){const l=r,c=(t[l]||[])[o[l]];if(null==c)continue;let h=s.get(c);null==h&&(h=new Set,s.set(c,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,r,s)}static[hh](e,t){const r=t.threeGLTF,s=t.gltf,o=JSON.parse(JSON.stringify(s)),l=new Map,c=new Map;for(let s=0;s<r.scenes.length;s++)this[lh](r.scenes[s],e.scenes[s],((e,r)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,h=s[t],d=o[t][h],p=l.get(r)||{};p[t]=h,l.set(r,p);const A=c.get(d)||new Set;A.add(r),c.set(d,A)}}));return new CorrelatedSceneGraph(e,o,l,c)}static[lh](e,t,r){const traverse=(e,t)=>{if(r(e,t),e.isObject3D){const s=e,o=t;if(s.material)if(Array.isArray(s.material))for(let e=0;e<s.material.length;++e)r(s.material[e],o.material[e]);else r(s.material,o.material);for(let r=0;r<e.children.length;++r)traverse(e.children[r],t.children[r])}};traverse(e,t)}get threeGLTF(){return this[rh]}get gltf(){return this[sh]}get gltfElementMap(){return this[ah]}get threeObjectMap(){return this[oh]}}const uh=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[th](e){const t=super[th](e);null==t[uh]&&(t[uh]=CorrelatedSceneGraph.from(t));const{scene:r}=t,s=new Sphere(void 0,1/0);return r.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const r=e;if(r.material){const{geometry:e}=r;r.castShadow=!0,r.isSkinnedMesh&&(e.boundingSphere=s,e.boundingBox=null);const o=r.material;if(!0===o.isMeshBasicMaterial&&(o.toneMapped=!1),o.shadowSide=0,o.aoMap){const{gltf:r,threeObjectMap:s}=t[uh],l=s.get(o);if(null!=r.materials&&null!=l&&null!=l.materials){const t=r.materials[l.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[ih][uh]}[nh](){const e=super[nh](),t=new Map;return e.scene.traverse((e=>{const r=e;if(r.material){const e=r.material;if(null!=e){if(t.has(e.uuid))return void(r.material=t.get(e.uuid));r.material=e.clone(),t.set(e.uuid,r.material)}}const s=e;void 0!==s.target&&s.add(s.target)})),e[uh]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var dh=r(5108);const getBufferForType=(e,t,r)=>{let s;switch(e){case ae:s=new Uint8ClampedArray(t*r*4);break;case he:s=new Uint16Array(t*r*4);break;case le:s=new Uint32Array(t*r*4);break;case 1010:s=new Int8Array(t*r*4);break;case 1011:s=new Int16Array(t*r*4);break;case oe:s=new Int32Array(t*r*4);break;case ce:s=new Float32Array(t*r*4);break;default:throw new Error("Unsupported data type")}return s};let ph;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,r,s,o,l,c,h,d,p,A,m,g,f,_,y,E;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const x={format:de,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(r=e.renderTargetOptions)||void 0===r?void 0:r.anisotropy:1,generateMipmaps:void 0!==(null===(s=e.renderTargetOptions)||void 0===s?void 0:s.generateMipmaps)&&(null===(o=e.renderTargetOptions)||void 0===o?void 0:o.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(c=e.renderTargetOptions)||void 0===c?void 0:c.magFilter:ne,minFilter:void 0!==(null===(h=e.renderTargetOptions)||void 0===h?void 0:h.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:ne,samples:void 0!==(null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples)?null===(A=e.renderTargetOptions)||void 0===A?void 0:A.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(g=e.renderTargetOptions)||void 0===g?void 0:g.wrapS:J,wrapT:void 0!==(null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapT)?null===(_=e.renderTargetOptions)||void 0===_?void 0:_.wrapT:J};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Scene,this._camera=new OrthographicCamera,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,r,s)=>{if(void 0!==ph)return ph;const o=new WebGLRenderTarget(1,1,s);t.setRenderTarget(o);const l=new three_module_Mesh(new PlaneGeometry,new MeshBasicMaterial({color:16777215}));t.render(l,r),t.setRenderTarget(null);const c=getBufferForType(e,o.width,o.height);return t.readRenderTargetPixels(o,0,0,o.width,o.height,c),o.dispose(),l.geometry.dispose(),l.material.dispose(),ph=0!==c[0],ph})(this._type,this._renderer,this._camera,x)){let e;if(this._type===he)e=this._renderer.extensions.has("EXT_color_buffer_float")?ce:void 0;void 0!==e?(dh.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=e):(this._supportsReadPixels=!1,dh.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new three_module_Mesh(new PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new WebGLRenderTarget(this.width,this.height,x),this._renderTarget.texture.mapping=void 0!==(null===(y=e.renderTargetOptions)||void 0===y?void 0:y.mapping)?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.mapping:G}static instantiateRenderer(){const e=new WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new DataTexture(this.toArray(),this.width,this.height,de,this._type,(null==e?void 0:e.mapping)||G,(null==e?void 0:e.wrapS)||J,(null==e?void 0:e.wrapT)||J,(null==e?void 0:e.magFilter)||ne,(null==e?void 0:e.minFilter)||ne,(null==e?void 0:e.anisotropy)||1,ke);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof ShaderMaterial&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof Texture&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof Texture&&e.dispose()})),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var Ah=r(5108);class GainMapDecoderMaterial extends ShaderMaterial{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:s,gainMapMax:o,maxDisplayBoost:l,hdrCapacityMin:c,hdrCapacityMax:h,sdr:d,gainMap:p}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:p},gamma:{value:new three_module_Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new three_module_Vector3).fromArray(t)},offsetSdr:{value:(new three_module_Vector3).fromArray(r)},gainMapMin:{value:(new three_module_Vector3).fromArray(s)},gainMapMax:{value:(new three_module_Vector3).fromArray(o)},weightFactor:{value:(Math.log2(l)-c)/(h-c)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=c,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,r)=>{var s;let o;const l=null===(s=e.attributes.getNamedItem(t))||void 0===s?void 0:s.nodeValue;if(l)o=l;else{const s=e.getElementsByTagName(t)[0];if(!s){if(r)return r;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=s.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,r)=>{const s=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void r(new Error("Not a valid jpeg"));const l=o.byteLength;let c,h=2,d=0;for(;h<l;){if(++d>250)return void r(new Error(`Found no marker after ${d} loops 😵`));if(255!==o.getUint8(h))return void r(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(c=o.getUint8(h+1),s&&Ah.log(`Marker: ${c.toString(16)}`),226===c){s&&Ah.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const s=e+4;let l;if(18761===o.getUint16(s))l=!1;else{if(19789!==o.getUint16(s))return void r(new Error("No valid endianness marker found in TIFF header"));l=!0}if(42!==o.getUint16(s+2,!l))return void r(new Error("Not valid TIFF data! (no 0x002A marker)"));const c=o.getUint32(s+4,!l);if(c<8)return void r(new Error("Not valid TIFF data! (First offset less than 8)"));const h=s+c,d=o.getUint16(h,!l),p=h+2;let A=0;for(let e=p;e<p+12*d;e+=12)45057===o.getUint16(e,!l)&&(A=o.getUint32(e+8,!l));const m=h+2+12*d+4,g=[];for(let e=m;e<m+16*A;e+=16){const t={MPType:o.getUint32(e,!l),size:o.getUint32(e+4,!l),dataOffset:o.getUint32(e+8,!l),dependantImages:o.getUint32(e+12,!l),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,g.push(t)}if(this.options.extractNonFII&&g.length){const e=new Blob([o]),r=[];for(const t of g){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");r.push(s)}t(r)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,r;let s;s="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=s.indexOf("<x:xmpmeta");const l=new DOMParser;for(;-1!==o;){const e=s.indexOf("x:xmpmeta>",o);s.slice(o,e+10);const c=s.slice(o,e+10);try{const e=l.parseFromString(c,"text/xml").getElementsByTagName("rdf:Description")[0],s=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),d=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),p=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let A=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;A||(A="0");const m=null===(r=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===r?void 0:r.nodeValue;if(!m)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(s)?s.map((e=>parseFloat(e))):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetSdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetHdr:Array.isArray(p)?p.map((e=>parseFloat(e))):[parseFloat(p),parseFloat(p),parseFloat(p)],hdrCapacityMin:parseFloat(A),hdrCapacityMax:parseFloat(m)}}catch(e){}o=s.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const r=new MPFExtractor({extractFII:!0,extractNonFII:!0}),s=await r.extract(e);if(2!==s.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,r)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{r(e)},s.src=URL.createObjectURL(e)}));class LoaderBase extends Loader{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new LoadingManager}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Texture,sdr:new Texture});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:he,colorSpace:ke,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,s){const o=s?new Blob([s],{type:"image/jpeg"}):void 0,l=new Blob([r],{type:"image/jpeg"});let c,h,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([o?getHTMLImageFromBlob(o):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);h=e[0],c=e[1],d=!0}else{const e=await Promise.all([o?createImageBitmap(o,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);h=e[0],c=e[1]}const p=new Texture(h||new ImageData(2,2),G,J,J,ne,1008,de,ae,1,ke);p.flipY=d,p.needsUpdate=!0;const A=new Texture(c,G,J,J,ne,1008,de,ae,1,Oe);A.flipY=d,A.needsUpdate=!0,e.width=c.width,e.height=c.height,e.material.gainMap=p,e.material.sdr=A,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class HDRJPGLoader extends LoaderBase{load(e,t,r,s){const o=this.prepareQuadRenderer(),l=new three_module_FileLoader(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,(async r=>{if("string"==typeof r)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(r);let c,h,d;try{const e=await extractGainmapFromJPEG(l);c=e.sdr,h=e.gainMap,d=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Ah.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=l}try{await this.render(o,d,c,h)}catch(t){return this.manager.itemError(e),"function"==typeof s&&s(t),void o.disposeOnDemandRenderer()}"function"==typeof t&&t(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()}),r,(t=>{this.manager.itemError(e),"function"==typeof s&&s(t)})),o}}class RGBELoader extends DataTextureLoader{constructor(e){super(e),this.type=he}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,r){t=t||1024;let s=e.pos,o=-1,l=0,c="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(o=h.indexOf("\n"))&&l<t&&s<e.byteLength;)c+=h,l+=h.length,s+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<o&&(!1!==r&&(e.pos+=l+o+1),c+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=e[t+0]*l,r[s+1]=e[t+1]*l,r[s+2]=e[t+2]*l,r[s+3]=1},RGBEByteToRGBHalf=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=Fi.toHalfFloat(Math.min(e[t+0]*l,65504)),r[s+1]=Fi.toHalfFloat(Math.min(e[t+1]*l,65504)),r[s+2]=Fi.toHalfFloat(Math.min(e[t+2]*l,65504)),r[s+3]=Fi.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const r=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,h;for((e.pos>=e.byteLength||!(c=fgets(e)))&&rgbe_error(1,"no header found"),(h=c.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),l.valid|=1,l.programtype=h[1],l.string+=c+"\n";c=fgets(e),!1!==c;)if(l.string+=c+"\n","#"!==c.charAt(0)){if((h=c.match(t))&&(l.gamma=parseFloat(h[1])),(h=c.match(r))&&(l.exposure=parseFloat(h[1])),(h=c.match(s))&&(l.valid|=2,l.format=h[1]),(h=c.match(o))&&(l.valid|=4,l.height=parseInt(h[1],10),l.width=parseInt(h[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=c+"\n";return 2&l.valid||rgbe_error(3,"missing format specifier"),4&l.valid||rgbe_error(3,"missing image size specifier"),l}(t),s=r.width,o=r.height,l=function(e,t,r){const s=t;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*r);o.length||rgbe_error(4,"unable to allocate buffer space");let l=0,c=0;const h=4*s,d=new Uint8Array(4),p=new Uint8Array(h);let A=r;for(;A>0&&c<e.byteLength;){c+4>e.byteLength&&rgbe_error(1),d[0]=e[c++],d[1]=e[c++],d[2]=e[c++],d[3]=e[c++],2==d[0]&&2==d[1]&&(d[2]<<8|d[3])==s||rgbe_error(3,"bad rgbe scanline format");let t,r=0;for(;r<h&&c<e.byteLength;){t=e[c++];const s=t>128;if(s&&(t-=128),(0===t||r+t>h)&&rgbe_error(3,"bad scanline data"),s){const s=e[c++];for(let e=0;e<t;e++)p[r++]=s}else p.set(e.subarray(c,c+t),r),r+=t,c+=t}const m=s;for(let e=0;e<m;e++){let t=0;o[l]=p[e+t],t+=s,o[l+1]=p[e+t],t+=s,o[l+2]=p[e+t],t+=s,o[l+3]=p[e+t],l+=4}A--}return o}(t.subarray(t.pos),s,o);let c,h,d;switch(this.type){case ce:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);c=e,h=ce;break;case he:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);c=t,h=he;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:o,data:c,header:r.string,gamma:r.gamma,exposure:r.exposure,type:h}}setDataType(e){return this.type=e,this}load(e,t,r,s){return super.load(e,(function onLoadCallback(e,r){switch(e.type){case ce:case he:e.colorSpace=ke,e.minFilter=ne,e.magFilter=ne,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}const mh={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},gh={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class EnvironmentScene extends Scene{constructor(e){super(),this.position.y=-3.5;const t=new BoxGeometry;t.deleteAttribute("uv");const r=new MeshStandardMaterial({metalness:0,side:1}),s=new MeshStandardMaterial({metalness:0}),o="legacy"==e?mh:gh,l=new PointLight(16777215,o.topLight.intensity,28,2);l.position.set(...o.topLight.position),this.add(l);const c=new three_module_Mesh(t,r);c.position.set(...o.room.position),c.scale.set(...o.room.scale),this.add(c);for(const e of o.boxes){const r=new three_module_Mesh(t,s);r.position.set(...e.position),r.rotation.set(0,e.rotation,0),r.scale.set(...e.scale),this.add(r)}for(const e of o.lights){const r=new three_module_Mesh(t,this.createAreaLightMaterial(e.intensity));r.position.set(...e.position),r.scale.set(...e.scale),this.add(r)}}createAreaLightMaterial(e){const t=new MeshBasicMaterial;return t.color.setScalar(e),t}}var fh=r(5108);const _h=20,vh=/\.hdr(\.js)?$/;class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new TextureLoader),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(he)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise(((t,r)=>this.ldrLoader.load(e,t,(()=>{}),r)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const r=await this.getLottieLoader();r.setQuality(t);const s=await new Promise(((t,s)=>r.load(e,t,(()=>{}),s)));return s.name=e,s}async loadEquirect(e,t=()=>{}){try{const r=vh.test(e),s=r?this.hdrLoader:this.imageLoader,o=await new Promise(((r,o)=>s.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:s}=t;e.dispose(!1),r(s)}else r(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),o.name=e,o.mapping=j,r||(o.colorSpace=Oe),o}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,r=()=>{}){const s="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,l=Promise.resolve(null);e&&(l=this.loadEquirectFromUrl(e,r)),o=t?this.loadEquirectFromUrl(t,r):e?this.loadEquirectFromUrl(e,r):s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,h]=await Promise.all([o,l]);if(null==c)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const r=this.loadEquirect(e,t);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const r=this.threeRenderer,s=new WebGLCubeRenderTarget(256,{generateMipmaps:!1,type:he,format:de,colorSpace:ke,depthBuffer:!0}),o=new CubeCamera(.1,100,s),l=o.renderTarget.texture;l.name=t;const c=r.outputColorSpace,h=r.toneMapping;return r.toneMapping=0,r.outputColorSpace=ke,o.update(r,e),this.blurCubemap(s,.04),r.toneMapping=h,r.outputColorSpace=c,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(_h);const e=new BoxGeometry,t=new three_module_Mesh(e,this.blurMaterial);this.blurScene=new Scene,this.blurScene.add(t)}const r=e.clone();this.halfblur(e,r,t,"latitudinal"),this.halfblur(r,e,t,"longitudinal")}halfblur(e,t,r,s){const o=e.width,l=isFinite(r)?Math.PI/(2*o):2*Math.PI/39,c=r/l,h=isFinite(r)?1+Math.floor(3*c):_h;h>_h&&fh.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${h} samples when the maximum is set to 20`);const d=[];let p=0;for(let e=0;e<_h;++e){const t=e/c,r=Math.exp(-t*t/2);d.push(r),0==e?p+=r:e<h&&(p+=2*r)}for(let e=0;e<d.length;e++)d[e]=d[e]/p;const A=this.blurMaterial.uniforms;A.envMap.value=e.texture,A.samples.value=h,A.weights.value=d,A.latitudinal.value="latitudinal"===s,A.dTheta.value=l;new CubeCamera(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),r=new three_module_Vector3(0,1,0);return new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:r}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:0,depthTest:!1,depthWrite:!1,side:1})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}var yh=r(5108);const Eh=[1,.79,.62,.5,.4,.31,.25],xh="high-performance";class Renderer extends EventDispatcher{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[ea]()},this.dpr=Ks(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new WebGLRenderer({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=4}catch(e){yh.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton||(this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||xh,debug:Js()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||xh,debug:Js()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return Eh[this.scaleStep]}set minScale(e){let t=1;for(;t<Eh.length&&!(Eh[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new Vector2;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[Yd]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,r=null;for(const s of this.scenes){const{element:o}=s;o.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(r=s)}const s=t>1;if(null!=r){const t=s&&!this.multipleScenesVisible,o=!r.element.modelIsVisible;if(t||o){const{width:t,height:s}=this.sceneSize(r);this.copyPixels(r,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=Ks();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Fd](t.getBoundingClientRect())}let r=0,s=0;for(const e of this.scenes)r=Math.max(r,e.width),s=Math.max(s,e.height);if(r!==this.width||s!==this.height||t!==this.dpr){this.width=r,this.height=s,this.dpr=t,r=Math.ceil(r*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(r,s,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=r,o.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(r,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=utilities_clamp(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=Eh[e.scaleStep],r=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${r}px`,o.height=`${s}px`,this.canvas3D.style.width=`${r}px`,this.canvas3D.style.height=`${s}px`;const l=this.dpr*t,c=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:l,minimumDpr:this.dpr*Eh[this.lastStep],pixelWidth:Math.ceil(e.width*l),pixelHeight:Math.ceil(e.height*l),reason:c}}))}sceneSize(e){const{dpr:t}=this,r=Eh[e.scaleStep];return{width:Math.min(Math.ceil(e.width*r*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*r*t),this.canvas3D.height)}}copyPixels(e,t,r){const s=e.context;null!=s?(s.clearRect(0,0,t,r),s.drawImage(this.canvas3D,0,0,t,r,0,0,t,r),e.canvas.classList.add("show")):yh.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const r of this.scenes)r.element.modelIsVisible===t&&e.push(r);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,r){const{element:s,exposure:o,toneMapping:l}=e;s[$d](t,r);const c="number"==typeof o&&!Number.isNaN(o),h=s.environmentImage,d=s.skyboxImage,p=7===l&&("neutral"===h||"legacy"===h||!h&&!d);this.threeRenderer.toneMappingExposure=(c?o:1)*(p?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const r=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(r),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,r),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:r,projectionMatrix:s}=e,o=r.elements.slice(),l=t.getTarget();o[12]+=l.x,o[13]+=l.y,o[14]+=l.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:s.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:l,height:c}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,l,c),null!=t.effectRenderer?t.effectRenderer.render(r):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,l,c):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}const Mh=Symbol("correlatedObjects"),Ch=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[Ch]=e,this[Mh]=t}}const Sh=new MeshBasicMaterial,Ih=new PlaneGeometry(2,2);let bh=0;const wh=Symbol("threeTexture"),Th=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[wh](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get[Th](){return this[Mh]}constructor(e,t){super(e,new Set(t?[t]:[])),this[wh].image.src||(this[wh].image.src=t.name?t.name:"adhoc_image"+bh++),this[wh].image.name||(this[wh].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[wh].image.name||""}get uri(){return this[wh].image.src}get bufferView(){return this[wh].image.bufferView}get element(){const e=this[wh];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[wh];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[Th])t.image.name=e}update(){const e=this[wh];e&&e.isCanvasTexture&&!e.animation&&(this[wh].needsUpdate=!0,this[Ch]())}async createThumbnail(e,t){const r=new Scene;Sh.map=this[wh];const s=new three_module_Mesh(Ih,Sh);r.add(s);const o=new OrthographicCamera(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,c=new WebGLRenderTarget(e,t);l.setRenderTarget(c),l.render(r,o),l.setRenderTarget(null);const h=new Uint8Array(e*t*4);l.readRenderTargetPixels(c,0,0,e,t,h),Id.width=e,Id.height=t;const d=Id.getContext("2d"),p=d.createImageData(e,t);return p.data.set(h),d.putImageData(p,0,0),new Promise((async(e,t)=>{Id.toBlob((r=>{if(!r)return t("Failed to capture thumbnail.");e(URL.createObjectURL(r))}),"image/png")}))}}var Bh,Rh;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(Bh||(Bh={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(Rh||(Rh={}));const Lh=new Map([[Rh.Repeat,K],[Rh.ClampToEdge,J],[Rh.MirroredRepeat,$]]),Dh=new Map([[K,Rh.Repeat],[J,Rh.ClampToEdge],[$,Rh.MirroredRepeat]]),Uh=new Map([[Bh.Nearest,ee],[Bh.Linear,ne],[Bh.NearestMipmapNearest,te],[Bh.LinearMipmapNearest,re],[Bh.NearestMipmapLinear,ie],[Bh.LinearMipmapLinear,se]]),Ph=new Map([[ee,Bh.Nearest],[ne,Bh.Linear],[te,Bh.NearestMipmapNearest],[re,Bh.LinearMipmapNearest],[ie,Bh.NearestMipmapLinear],[se,Bh.LinearMipmapLinear]]),Fh=new Map([[Bh.Nearest,ee],[Bh.Linear,ne]]),Nh=new Map([[ee,Bh.Nearest],[ne,Bh.Linear]]),isMinFilter=e=>Ph.has(e),isMagFilter=e=>Nh.has(e),isWrapping=e=>Dh.has(e),Qh=Symbol("threeTexture"),Oh=Symbol("threeTextures"),kh=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[Qh](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get[Oh](){return this[Mh]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Qh].name||""}get minFilter(){return Ph.get(this[Qh].minFilter)}get magFilter(){return Nh.get(this[Qh].magFilter)}get wrapS(){return Dh.get(this[Qh].wrapS)}get wrapT(){return Dh.get(this[Qh].wrapT)}get rotation(){return this[Qh].rotation}get scale(){return toVector2D(this[Qh].repeat)}get offset(){return toVector2D(this[Qh].offset)}setMinFilter(e){this[kh]("minFilter",Uh.get(e))}setMagFilter(e){this[kh]("magFilter",Fh.get(e))}setWrapS(e){this[kh]("wrapS",Lh.get(e))}setWrapT(e){this[kh]("wrapT",Lh.get(e))}setRotation(e){null==e&&(e=0),this[kh]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[kh]("repeat",new Vector2(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[kh]("offset",new Vector2(e.u,e.v))}[kh](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const r of this[Oh])r[e]=t,r.needsUpdate=!0;this[Ch]()}}const Gh=Symbol("image"),Vh=Symbol("sampler"),Hh=Symbol("threeTexture");class texture_Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[Vh]=new Sampler(e,t),this[Gh]=new image_Image(e,t)}get[Hh](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get name(){return this[Hh].name||""}set name(e){for(const t of this[Mh])t.name=e}get sampler(){return this[Vh]}get source(){return this[Gh]}}var zh,Wh,qh;const jh=Symbol("texture"),Xh=Symbol("transform"),Yh=Symbol("materials"),Kh=Symbol("usage"),Jh=Symbol("onUpdate"),$h=Symbol("activeVideo");var Zh;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(Zh||(Zh={}));class TextureInfo{constructor(e,t,r,s){this[zh]=null,this[Wh]={rotation:0,scale:new Vector2(1,1),offset:new Vector2(0,0)},this[qh]=!1,r&&(this[Xh].rotation=r.rotation,this[Xh].scale.copy(r.repeat),this[Xh].offset.copy(r.offset),this[jh]=new texture_Texture(e,r)),this[Jh]=e,this[Yh]=s,this[Kh]=t}get texture(){return this[jh]}setTexture(e){var t,r;const s=null!=e?e.source[wh]:null,o=null===(t=this[jh])||void 0===t?void 0:t.source[wh];if(null!=o&&o.isVideoTexture?this[$h]=!1:(null===(r=this[jh])||void 0===r?void 0:r.source.animation)&&this[jh].source.animation.removeEventListener("enterFrame",this[Jh]),this[jh]=e,null!=s&&s.isVideoTexture){const e=s.image;if(this[$h]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[$h]&&(this[Jh](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[$h]&&(this[Jh](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[Jh]);let l=Oe;if(this[Yh])for(const e of this[Yh]){switch(this[Kh]){case Zh.Base:e.map=s;break;case Zh.MetallicRoughness:l=ke,e.metalnessMap=s,e.roughnessMap=s;break;case Zh.Normal:l=ke,e.normalMap=s;break;case Zh.Occlusion:l=ke,e.aoMap=s;break;case Zh.Emissive:e.emissiveMap=s;break;case Zh.Clearcoat:e.clearcoatMap=s;break;case Zh.ClearcoatRoughness:e.clearcoatRoughnessMap=s;break;case Zh.ClearcoatNormal:e.clearcoatNormalMap=s;break;case Zh.SheenColor:e.sheenColorMap=s;break;case Zh.SheenRoughness:e.sheenRoughnessMap=s;break;case Zh.Transmission:e.transmissionMap=s;break;case Zh.Thickness:e.thicknessMap=s;break;case Zh.Specular:e.specularIntensityMap=s;break;case Zh.SpecularColor:e.specularColorMap=s;break;case Zh.Iridescence:e.iridescenceMap=s;break;case Zh.IridescenceThickness:e.iridescenceThicknessMap=s;break;case Zh.Anisotropy:e.anisotropyMap=s}e.needsUpdate=!0}s&&(s.colorSpace=l,s.rotation=this[Xh].rotation,s.repeat=this[Xh].scale,s.offset=this[Xh].offset),this[Jh]()}}zh=jh,Wh=Xh,qh=$h;const eu=Symbol("threeMaterial"),tu=Symbol("threeMaterials"),iu=Symbol("baseColorTexture"),nu=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:r,metalnessMap:s}=t.values().next().value;this[iu]=new TextureInfo(e,Zh.Base,r,t),this[nu]=new TextureInfo(e,Zh.MetallicRoughness,s,t)}get[tu](){return this[Mh]}get[eu](){var e;return null===(e=this[Mh])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[eu].opacity];return this[eu].color.toArray(e),e}get metallicFactor(){return this[eu].metalness}get roughnessFactor(){return this[eu].roughness}get baseColorTexture(){return this[iu]}get metallicRoughnessTexture(){return this[nu]}setBaseColorFactor(e){const t=new Color;e instanceof Array?t.fromArray(e):t.set(e);for(const r of this[tu])r.color.set(t),e instanceof Array&&e.length>3?r.opacity=e[3]:(e=[0,0,0,r.opacity],t.toArray(e));this[Ch]()}setMetallicFactor(e){for(const t of this[tu])t.metalness=e;this[Ch]()}setRoughnessFactor(e){for(const t of this[tu])t.roughness=e;this[Ch]()}}var ru,su;const au=Symbol("pbrMetallicRoughness"),ou=Symbol("normalTexture"),lu=Symbol("occlusionTexture"),cu=Symbol("emissiveTexture"),hu=Symbol("backingThreeMaterial"),uu=Symbol("applyAlphaCutoff"),du=Symbol("getAlphaMode"),pu=Symbol("lazyLoadGLTFInfo"),Au=Symbol("initialize"),mu=Symbol("getLoadedMaterial"),gu=Symbol("ensureMaterialIsLoaded"),fu=Symbol("gltfIndex"),_u=Symbol("setActive"),vu=Symbol("variantIndices"),yu=Symbol("isActive"),Eu=Symbol("variantSet"),xu=Symbol("modelVariants"),Mu=Symbol("name"),Cu=Symbol("pbrTextures");class material_Material extends ThreeDOMElement{constructor(e,t,r,s,o,l,c=void 0){super(e,o),this[ru]=new Set,this[su]=new Map,this[fu]=t,this[yu]=r,this[xu]=s,this[Mu]=l,null==c?this[Au]():this[pu]=c}get[(ru=Eu,su=Cu,hu)](){return this[Mh].values().next().value}[Au](){const e=this[Ch],t=this[Mh];this[au]=new PBRMetallicRoughness(e,t);const{normalMap:r,aoMap:s,emissiveMap:o}=t.values().next().value;this[ou]=new TextureInfo(e,Zh.Normal,r,t),this[lu]=new TextureInfo(e,Zh.Occlusion,s,t),this[cu]=new TextureInfo(e,Zh.Emissive,o,t);const createTextureInfo=r=>{this[Cu].set(r,new TextureInfo(e,r,null,t))};createTextureInfo(Zh.Clearcoat),createTextureInfo(Zh.ClearcoatRoughness),createTextureInfo(Zh.ClearcoatNormal),createTextureInfo(Zh.SheenColor),createTextureInfo(Zh.SheenRoughness),createTextureInfo(Zh.Transmission),createTextureInfo(Zh.Thickness),createTextureInfo(Zh.Specular),createTextureInfo(Zh.SpecularColor),createTextureInfo(Zh.Iridescence),createTextureInfo(Zh.IridescenceThickness),createTextureInfo(Zh.Anisotropy)}async[mu](){if(null!=this[pu]){const{set:e,material:t}=await this[pu].doLazyLoad();return this[Mh]=e,this[Au](),this[pu]=void 0,this.ensureLoaded=async()=>{},t}return this[Mh].values().next().value}colorFromRgb(e){const t=new Color;return e instanceof Array?t.fromArray(e):t.set(e),t}[gu](){if(null!=this[pu])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[mu]()}get isLoaded(){return null==this[pu]}get isActive(){return this[yu]}[_u](e){this[yu]=e}get name(){return this[Mu]||""}set name(e){if(this[Mu]=e,null!=this[Mh])for(const t of this[Mh])t.name=e}get pbrMetallicRoughness(){return this[gu](),this[au]}get normalTexture(){return this[gu](),this[ou]}get occlusionTexture(){return this[gu](),this[lu]}get emissiveTexture(){return this[gu](),this[cu]}get emissiveFactor(){return this[gu](),this[hu].emissive.toArray()}get index(){return this[fu]}[vu](){return this[Eu]}hasVariant(e){const t=this[xu].get(e);return null!=t&&this[Eu].has(t.index)}setEmissiveFactor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.emissive.set(t);this[Ch]()}[du](){return this[hu].transparent?"BLEND":this[hu].alphaTest>0?"MASK":"OPAQUE"}[uu](){this[gu]();for(const e of this[Mh])"MASK"===this[du]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[gu]();for(const t of this[Mh])t.alphaTest=e,t.needsUpdate=!0;this[uu](),this[Ch]()}getAlphaCutoff(){return this[gu](),this[hu].alphaTest}setDoubleSided(e){this[gu]();for(const t of this[Mh])t.side=e?2:0,t.needsUpdate=!0;this[Ch]()}getDoubleSided(){return this[gu](),2==this[hu].side}setAlphaMode(e){this[gu]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[Mh])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[Ch]()}getAlphaMode(){return this[gu](),this[du]()}get emissiveStrength(){return this[gu](),this[hu].emissiveIntensity}setEmissiveStrength(e){this[gu]();for(const t of this[Mh])t.emissiveIntensity=e;this[Ch]()}get clearcoatFactor(){return this[gu](),this[hu].clearcoat}get clearcoatRoughnessFactor(){return this[gu](),this[hu].clearcoatRoughness}get clearcoatTexture(){return this[gu](),this[Cu].get(Zh.Clearcoat)}get clearcoatRoughnessTexture(){return this[gu](),this[Cu].get(Zh.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[gu](),this[Cu].get(Zh.ClearcoatNormal)}get clearcoatNormalScale(){return this[gu](),this[hu].clearcoatNormalScale.x}setClearcoatFactor(e){this[gu]();for(const t of this[Mh])t.clearcoat=e;this[Ch]()}setClearcoatRoughnessFactor(e){this[gu]();for(const t of this[Mh])t.clearcoatRoughness=e;this[Ch]()}setClearcoatNormalScale(e){this[gu]();for(const t of this[Mh])t.clearcoatNormalScale=new Vector2(e,e);this[Ch]()}get ior(){return this[gu](),this[hu].ior}setIor(e){this[gu]();for(const t of this[Mh])t.ior=e;this[Ch]()}get sheenColorFactor(){return this[gu](),this[hu].sheenColor.toArray()}get sheenColorTexture(){return this[gu](),this[Cu].get(Zh.SheenColor)}get sheenRoughnessFactor(){return this[gu](),this[hu].sheenRoughness}get sheenRoughnessTexture(){return this[gu](),this[Cu].get(Zh.SheenRoughness)}setSheenColorFactor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.sheenColor.set(t),e.sheen=1;this[Ch]()}setSheenRoughnessFactor(e){this[gu]();for(const t of this[Mh])t.sheenRoughness=e,t.sheen=1;this[Ch]()}get transmissionFactor(){return this[gu](),this[hu].transmission}get transmissionTexture(){return this[gu](),this[Cu].get(Zh.Transmission)}setTransmissionFactor(e){this[gu]();for(const t of this[Mh])t.transmission=e;this[Ch]()}get thicknessFactor(){return this[gu](),this[hu].thickness}get thicknessTexture(){return this[gu](),this[Cu].get(Zh.Thickness)}get attenuationDistance(){return this[gu](),this[hu].attenuationDistance}get attenuationColor(){return this[gu](),this[hu].attenuationColor.toArray()}setThicknessFactor(e){this[gu]();for(const t of this[Mh])t.thickness=e;this[Ch]()}setAttenuationDistance(e){this[gu]();for(const t of this[Mh])t.attenuationDistance=e;this[Ch]()}setAttenuationColor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.attenuationColor.set(t);this[Ch]()}get specularFactor(){return this[gu](),this[hu].specularIntensity}get specularTexture(){return this[gu](),this[Cu].get(Zh.Specular)}get specularColorFactor(){return this[gu](),this[hu].specularColor.toArray()}get specularColorTexture(){return this[gu](),this[Cu].get(Zh.SheenColor)}setSpecularFactor(e){this[gu]();for(const t of this[Mh])t.specularIntensity=e;this[Ch]()}setSpecularColorFactor(e){this[gu]();const t=this.colorFromRgb(e);for(const e of this[Mh])e.specularColor.set(t);this[Ch]()}get iridescenceFactor(){return this[gu](),this[hu].iridescence}get iridescenceTexture(){return this[gu](),this[Cu].get(Zh.Iridescence)}get iridescenceIor(){return this[gu](),this[hu].iridescenceIOR}get iridescenceThicknessMinimum(){return this[gu](),this[hu].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[gu](),this[hu].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[gu](),this[Cu].get(Zh.IridescenceThickness)}setIridescenceFactor(e){this[gu]();for(const t of this[Mh])t.iridescence=e;this[Ch]()}setIridescenceIor(e){this[gu]();for(const t of this[Mh])t.iridescenceIOR=e;this[Ch]()}setIridescenceThicknessMinimum(e){this[gu]();for(const t of this[Mh])t.iridescenceThicknessRange[0]=e;this[Ch]()}setIridescenceThicknessMaximum(e){this[gu]();for(const t of this[Mh])t.iridescenceThicknessRange[1]=e;this[Ch]()}get anisotropyStrength(){return this[gu](),this[hu].anisotropy}get anisotropyRotation(){return this[gu](),this[hu].anisotropyRotation}get anisotropyTexture(){return this[gu](),this[Cu].get(Zh.Anisotropy)}setAnisotropyStrength(e){this[gu]();for(const t of this[Mh])t.anisotropy=e;this[Ch]()}setAnisotropyRotation(e){this[gu]();for(const t of this[Mh])t.anisotropyRotation=e;this[Ch]()}}var Su=r(5108);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,r,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:l,threeObjectMap:c}=s;this.parser=l.parser,this.modelVariants=r,this.mesh.userData.variantData=r;const h=c.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:Su.error(`Primitive (${e.name}) missing initial material reference.`);const d=e.userData.associations||{};if(null==d.meshes)return void Su.error("Mesh is missing primitive index association");const p=((o.meshes||[])[d.meshes].primitives||[])[d.primitives];if(null!=p){if(null!=p.material)this.materials.set(p.material,t[p.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):Su.warn("gltfPrimitive has no material!")}if(p.extensions&&p.extensions.KHR_materials_variants){const e=p.extensions.KHR_materials_variants,s=l.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=s[t];this.variantToMaterialMap.set(t,e),e[vu]().add(t),r.has(o)||r.set(o,{name:o,index:t})}}}}else Su.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[mu]();const{normalScale:r}=this.mesh.material;null!=r&&r.y*r.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const r=await this.enableVariantHelper(e);null!=r&&(t.material=r)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const r=this.modelVariants.get(t).index;return e[vu]().add(r),this.variantToMaterialMap.set(r,e),this.materials.set(e.index,e),this.updateVariantUserData(r,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[vu]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(e,{material:t[Mh].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(Su.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var Iu,bu,wu,Tu,Bu,Ru,Lu=r(5108);const Du=Symbol("materials"),Uu=Symbol("hierarchy"),Pu=Symbol("roots"),Fu=Symbol("primitives"),Nu=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),Qu=Symbol("switchVariant"),Ou=Symbol("materialFromPoint"),ku=Symbol("nodeFromPoint"),Gu=Symbol("nodeFromIndex"),Vu=Symbol("variantData"),Hu=Symbol("availableVariants"),zu=Symbol("modelOnUpdate"),Wu=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,r,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=r,this.doLazyLoad=s}}class Model{constructor(e,t=()=>{}){this[Iu]=new Array,this[bu]=new Array,this[wu]=new Array,this[Tu]=new Array,this[Bu]=()=>{},this[Ru]=new Map,this[zu]=t;const{gltf:r,threeGLTF:s,gltfElementMap:o}=e;for(const[e,l]of r.materials.entries()){const c=o.get(l);if(null!=c)this[Du].push(new material_Material(t,e,!0,this[Vu],c,l.name));else{const h=(r.materials||[])[e],d=e,materialLoadCallback=async()=>{const e=await s.parser.getDependency("material",d),t=new Set;return o.set(h,t),t.add(e),{set:t,material:e}};this[Du].push(new material_Material(t,e,!1,this[Vu],c,l.name,new LazyLoader(r,o,h,materialLoadCallback)))}}const l=new Map,c=new Array;for(const e of s.scene.children)c.push(e);for(;c.length>0;){const t=c.pop();let r=null;t instanceof three_module_Mesh?(r=new PrimitiveNode(t,this.materials,this[Vu],e),this[Fu].push(r)):r=new primitive_node_Node(t.name);const s=l.get(t);null!=s?s.children.push(r):this[Pu].push(r),this[Uu].push(r);for(const e of t.children)c.push(e),l.set(t,r)}}get materials(){return this[Du]}[(Iu=Du,bu=Uu,wu=Pu,Tu=Fu,Bu=zu,Ru=Vu,Hu)](){const e=Array.from(this[Vu].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[Du].filter((t=>t.name===e));return t.length>0?t[0]:null}[Gu](e,t){const r=this[Uu].find((r=>{if(r instanceof PrimitiveNode){const{meshes:s,primitives:o}=r.mesh.userData.associations;if(s==e&&o==t)return!0}return!1}));return null==r?null:r}[ku](e){return this[Uu].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[Ou](e){return this[ku](e).getActiveMaterial()}async[Qu](e){for(const t of this[Fu])await t.enableVariant(e);for(const e of this.materials)e[_u](!1);for(const e of this[Fu])this.materials[e.getActiveMaterial().index][_u](!0)}async[Nu](){const e=new Array;for(const t of this[Fu])e.push(t.instantiateVariants());await Promise.all(e)}[Wu](e,t){const r=this.materials[e];r.isLoaded||Lu.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const s=r[Mh],o=new Set;for(const[e,r]of s.entries()){const l=r.clone();l.name=t+(s.size>1?"_inst"+e:""),o.add(l)}const l=new material_Material(this[zu],this[Du].length,!1,this[Vu],o,t);return this[Du].push(l),l}createMaterialInstanceForVariant(e,t,r,s=!0){let o=null;for(const s of this[Fu]){const l=this[Vu].get(r);null!=l&&s.variantInfo.has(l.index)||null!=s.getMaterial(e)&&(this.hasVariant(r)||this.createVariant(r),null==o&&(o=this[Wu](e,t)),s.addVariant(o,r))}if(s&&null!=o){o[_u](!0),this.materials[e][_u](!1);for(const e of this[Fu])e.enableVariant(r)}return o}createVariant(e){this[Vu].has(e)?Lu.warn(`Variant '${e}'' already exists`):this[Vu].set(e,{name:e,index:this[Vu].size})}hasVariant(e){return this[Vu].has(e)}setMaterialToVariant(e,t){if(null!=this[Hu]().find((e=>e===t)))if(e<0||e>=this.materials.length)Lu.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const r of this[Fu]){const s=r.getMaterial(e);null!=s&&r.addVariant(s,t)}else Lu.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const r=this[Vu].get(e);null!=r&&(r.name=t,this[Vu].set(t,r),this[Vu].delete(e))}deleteVariant(e){const t=this[Vu].get(e);if(null!=t){for(const r of this.materials)r.hasVariant(e)&&r[Eu].delete(t.index);for(const e of this[Fu])e.deleteVariant(t.index);this[Vu].delete(e)}}}var scene_graph_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const qu=Symbol("currentGLTF"),ju=Symbol("originalGltfJson"),Xu=Symbol("model"),Yu=Symbol("getOnUpdateMethod"),Ku=Symbol("buildTexture");class GroundedSkybox extends three_module_Mesh{constructor(){super(void 0,new MeshBasicMaterial({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,r=128){e==this.height&&t==this.radius&&r==this.resolution||(this.height=e,this.radius=t,this.resolution=r,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,r){const s=new SphereGeometry(t,2*r,r);s.scale(1,1,-1);const o=s.getAttribute("position"),l=new three_module_Vector3;for(let t=0;t<o.count;++t)if(l.fromBufferAttribute(o,t),l.y<0){const r=3*-e/2,s=l.y<r?-e/l.y:1-l.y*l.y/(3*r*r);l.multiplyScalar(s),l.toArray(o.array,3*t)}return o.needsUpdate=!0,s}(e,t,r)))}}const Ju=new three_module_Vector3,$u=new three_module_Vector3,Zu=new three_module_Vector3,ed=new Matrix3,td=new Triangle,id=new three_module_Quaternion;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new three_module_Vector3(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=ll(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,ml(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=ll(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:r,bary:s}=this;if(null==t||null==r||null==s)return;t.getVertexPosition(r.x,Ju),t.getVertexPosition(r.y,$u),t.getVertexPosition(r.z,Zu),Ju.toArray(ed.elements,0),$u.toArray(ed.elements,3),Zu.toArray(ed.elements,6),this.position.copy(s).applyMatrix3(ed);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),td.set(Ju,$u,Zu),td.getNormal(this.normal).transformDirection(t.matrixWorld);const l=o.parent;id.setFromAxisAngle(Ju.set(0,1,0),-l.yaw),this.normal.applyQuaternion(id)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach((t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const r=t,s=r.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;r.toggleAttribute(t,e)}r.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const nd={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},rd={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};r(5108);Math.PI,Math.PI;function MathUtils_lerp(e,t,r){return(1-r)*e+r*t}class Shadow extends Object3D{constructor(e,t,r){super(),this.camera=new OrthographicCamera,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new MeshDepthMaterial,this.horizontalBlurMaterial=new ShaderMaterial(nd),this.verticalBlurMaterial=new ShaderMaterial(rd),this.intensity=0,this.softness=1,this.boundingBox=new Box3,this.size=new three_module_Vector3,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:s}=this;s.rotation.x=Math.PI/2,s.left=-.5,s.right=.5,s.bottom=-.5,s.top=.5,this.add(s);const o=new PlaneGeometry,l=new MeshBasicMaterial({opacity:1,transparent:!0,side:1});this.floor=new three_module_Mesh(o,l),this.floor.userData.noHit=!0,s.add(this.floor),this.blurPlane=new three_module_Mesh(o),this.blurPlane.visible=!1,s.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,r)}setScene(e,t,r){const{boundingBox:s,size:o,rotation:l,position:c}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(c),"back"===r){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],l.x=Math.PI/2,l.y=Math.PI}else l.x=0,l.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;o.y=this.maxDimension,s.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===r?c.y=s.min.y:c.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:r}=this,s=this.isAnimated?2:1,o=s*Math.pow(2,9-3*e);this.setMapSize(o);const l=t.y/2,c=t.y*s;r.near=0,r.far=MathUtils_lerp(c,l,e),this.depthMaterial.opacity=1/e,r.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const r=Math.floor(t.x>t.z?e:e*t.x/t.z),s=Math.floor(t.x>t.z?e*t.z/t.x:e),o=10+r,l=10+s;if(null==this.renderTarget||this.renderTarget.width===o&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:de};this.renderTarget=new WebGLRenderTarget(o,l,e),this.renderTargetBlur=new WebGLRenderTarget(o,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/r),t.z*(1+10/s),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*MathUtils_lerp(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const r=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const s=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=s,e.setRenderTarget(o),e.setClearAlpha(r)}blurShadow(e){const{camera:t,horizontalBlurMaterial:r,verticalBlurMaterial:s,renderTarget:o,renderTargetBlur:l,blurPlane:c}=this;c.visible=!0,c.material=r,r.uniforms.h.value=1/this.renderTarget.width,r.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(l),e.render(c,t),c.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(c,t),c.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}var sd=r(5108);const ad=new three_module_Vector3,od=new three_module_Vector3,ld=new three_module_Vector3,cd=new class Raycaster{constructor(e,t,r=0,s=1/0){this.ray=new Ray(e,t),this.near=r,this.far=s,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):o.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Yr.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Yr),this}intersectObject(e,t=!0,r=[]){return intersect(e,this,r,t),r.sort(ascSort),r}intersectObjects(e,t=!0,r=[]){for(let s=0,o=e.length;s<o;s++)intersect(e[s],this,r,t);return r.sort(ascSort),r}},hd=new three_module_Vector3,ud=new Vector2;class ModelScene extends Scene{constructor({canvas:e,element:t,width:r,height:s}){super(),this.annotationRenderer=new CSS2DRenderer,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new PerspectiveCamera(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new Object3D,this.animationNames=[],this.boundingBox=new Box3,this.boundingSphere=new Sphere,this.size=new three_module_Vector3,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=4,this.canScale=!0,this.isDirty=!1,this.goalTarget=new three_module_Vector3,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new PerspectiveCamera(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(r,s),this.target.name="Target",this.mixer=new three_module_AnimationMixer(this.target);const{domElement:o}=this.annotationRenderer,{style:l}=o;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(o),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let r;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{r=await new Promise((async(r,s)=>{this.cancelPendingSourceChange=()=>s();try{r(await this.element[tp].loader.load(e,this.element,t))}catch(e){s(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=r,null!=r&&(this._model=r.scene,this.target.add(r.scene));const{animations:s}=r,o=new Map,l=[];for(const e of s)o.set(e.name,e),l.push(e.name);this.animations=s,this.animationsByName=o,this.animationNames=l,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[qu]=null,this.element[ju]=null,this.element[Xu]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const r=Ks();this.externalRenderer.resize(e*r,t*r)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new Box3;e.traverse((e=>{const r=e;if(!r.material)return;if(!r.material.transparent)return;t.setFromObject(r);const s=t.getSize(hd),o=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*o||this.markBakedShadow(r)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,r=new Box3;this.boundingBox.getSize(this.size);for(const s of this.bakedShadows)r.setFromObject(s),r.min.y<e.y+this.size.y/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.z<=e.z&&r.max.z>=t.z||r.min.z<e.z+this.size.z/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.y<=e.y&&r.max.y>=t.y||this.unmarkBakedShadow(s)}applyTransform(){const{model:e}=this;if(null==e)return;const t=ll(this.element.orientation)[0].terms,r=ml(t[0]).number,s=ml(t[1]).number,o=ml(t[2]).number;e.quaternion.setFromEuler(new Euler(s,o,r,"YXZ"));const l=ll(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new Box3),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new Box3)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,r)=>Math.max(e,t.distanceToSquared(r))),0));this.idealAspect=reduceVertices(e,((e,r)=>{r.sub(t);const s=Math.sqrt(r.x*r.x+r.z*r.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(r.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)ud.set(e/window.screen.width,t/window.screen.height);else{const r=this.element.getBoundingClientRect();ud.set((e-r.x)/this.width,(t-r.y)/this.height)}return ud.multiplyScalar(2).subScalar(1),ud.y*=-1,ud}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[tp].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=ll(this.element.skyboxHeight)[0].terms[0],t=ml(e).number,r=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,r),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,r){this.goalTarget.set(-e,-t,-r)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,r=this.target.position;if(t.equals(r))return!1;{const s=this.boundingSphere.radius/10;let{x:o,y:l,z:c}=r;return o=this.targetDamperX.update(o,t.x,e,s),l=this.targetDamperY.update(l,t.y,e,s),c=this.targetDamperZ.update(c,t.z,e,s),this.groundedSkybox.position.x=-o,this.groundedSkybox.position.z=-c,this.target.position.set(o,l,c),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:r,z:s}=this.position;this.yaw=Math.atan2(e-r,t-s)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop!==Be||1&~e?this.currentAnimationAction.time:this.duration-this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,r=2201,s=1/0){if(null==this._currentGLTF)return;const{animations:o}=this;if(null==o||0===o.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<o.length&&(l=o[t])}null==l&&(l=o[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(l,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(r,s),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){sd.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){cd.setFromCamera(e,this.getCamera());return cd.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var r;const s=this.hitFromPoint(e,t);if(null==s)return null;return{position:s.point,normal:null!=s.face?s.face.normal.clone().applyNormalMatrix((new Matrix3).getNormalMatrix(s.object.matrixWorld)):cd.ray.direction.clone().multiplyScalar(-1),uv:null!==(r=s.uv)&&void 0!==r?r:null}}surfaceFromPoint(e,t=this){const r=this.element.model;if(null==r)return null;const s=this.hitFromPoint(e,t);if(null==s||null==s.face)return null;const o=r[ku](s),{meshes:l,primitives:c}=o.mesh.userData.associations,h=new three_module_Vector3,d=new three_module_Vector3,p=new three_module_Vector3,{a:A,b:m,c:g}=s.face,f=s.object;f.getVertexPosition(A,h),f.getVertexPosition(m,d),f.getVertexPosition(g,p);const _=new Triangle(h,d,p),y=new three_module_Vector3;return _.getBarycoord(f.worldToLocal(s.point),y),`${l} ${c} ${A} ${m} ${g} ${y.x.toFixed(3)} ${y.y.toFixed(3)} ${y.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let r=0,s=t.length;r<s;r++){const s=t[r];s instanceof Hotspot&&e(s)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=ll(e.surface)[0].terms;if(8!=t.length)return void sd.warn(e.surface+" does not have exactly 8 numbers.");const r=this.element.model[Gu](t[0].number,t[1].number),s=new three_module_Vector3(t[2].number,t[3].number,t[4].number);if(null==r)return void sd.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const o=r.mesh.geometry.attributes.position.count;if(s.x>=o||s.y>=o||s.z>=o)return void sd.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new three_module_Vector3(t[5].number,t[6].number,t[7].number);e.mesh=r.mesh,e.tri=s,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{ad.copy(e),od.setFromMatrixPosition(t.matrixWorld),ad.sub(od),ld.copy(t.normal).transformDirection(this.target.matrixWorld),ad.dot(ld)<0?t.hide():t.show()}))}orientHotspots(e){this.forHotspots((t=>{t.orient(e)}))}setHotspotsVisibility(e){this.forHotspots((t=>{t.visible=e}))}updateSchema(e){var t;const{schemaElement:r,element:s}=this,{alt:o,poster:l,iosSrc:c}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];c&&s.push({"@type":"MediaObject",contentUrl:c,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=l?l:void 0,name:null!=o?o:void 0,encoding:s};r.textContent=JSON.stringify(h),document.head.appendChild(r)}else null!=r.parentElement&&r.parentElement.removeChild(r)}}class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),r=>{let s;return s=Math.max(utilities_clamp(r,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,r){let s=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&o++}const l=e.progress;e.progress=t,this.totalProgress+=(t-l)*(1-this.totalProgress)/s;const c=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:c,reason:r}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var dd,pd,Ad,md,gd,fd,_d,vd,yd,Ed,xd,Md,Cd,Sd=r(5108),model_viewer_base_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Id=document.createElement("canvas"),bd=Symbol("fallbackResizeHandler"),wd=Symbol("defaultAriaLabel"),Td=Symbol("resizeObserver"),Bd=Symbol("clearModelTimeout"),Rd=Symbol("onContextLost"),Ld=Symbol("loaded"),Dd=Symbol("status"),Ud=Symbol("onFocus"),Pd=Symbol("onBlur"),Fd=Symbol("updateSize"),Nd=Symbol("intersectionObserver"),Qd=Symbol("isElementInViewport"),Od=Symbol("announceModelVisibility"),kd=Symbol("ariaLabel"),Gd=Symbol("altDefaulted"),Vd=Symbol("statusElement"),Hd=Symbol("updateStatus"),zd=Symbol("loadedTime"),Wd=Symbol("updateSource"),qd=Symbol("markLoaded"),jd=Symbol("container"),Xd=Symbol("input"),Yd=Symbol("canvas"),Kd=Symbol("scene"),Jd=Symbol("needsRender"),$d=Symbol("tick"),Zd=Symbol("onModelLoad"),ep=Symbol("onResize"),tp=Symbol("renderer"),ip=Symbol("progressTracker"),np=Symbol("getLoaded"),rp=Symbol("getModelIsVisible"),sp=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends u{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[dd]=!1,this[pd]=!1,this[Ad]=0,this[md]="",this[gd]=null,this[fd]=debounce((()=>{const e=this.getBoundingClientRect();this[Fd](e)}),50),this[_d]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[vd]=null,this[yd]=null,this[Ed]=new ProgressTracker,this[xd]=()=>{this[Vd].textContent=this[Dd]},this[Md]=()=>{this[Vd].textContent=""},this[Cd]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,r;if((e=>{D(ia,e)})(e),this[jd]=e.querySelector(".container"),this[Xd]=e.querySelector(".userInput"),this[Yd]=e.querySelector("canvas"),this[Vd]=e.querySelector("#status"),this[wd]=this[Xd].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,r=e.height}else t=300,r=150;this[Kd]=new ModelScene({canvas:this[Yd],element:this,width:t,height:r}),Promise.resolve().then((()=>{this[Fd](this.getBoundingClientRect())})),Os&&(this[Td]=new ResizeObserver((e=>{if(!this[tp].isPresenting)for(let t of e)t.target===this&&this[Fd](t.contentRect)}))),ks?this[Nd]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[Qd]=t.isIntersecting,this[Od](e),this[Qd]&&!this.loaded&&this[Wd]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[Qd]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[vo].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[vo].evictionThreshold}static set minimumRenderScale(e){e>1&&Sd.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&Sd.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[np]()}get[(dd=Qd,pd=Ld,Ad=zd,md=Dd,gd=Bd,fd=bd,_d=Od,vd=Td,yd=Nd,Ed=ip,tp)](){return Renderer.singleton}get modelIsVisible(){return this[rp]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Os?this[Td].observe(this):self.addEventListener("resize",this[bd]),ks&&this[Nd].observe(this),this.addEventListener("focus",this[Ud]),this.addEventListener("blur",this[Pd]);const e=this[tp];e.addEventListener("contextlost",this[Rd]),e.registerScene(this[Kd]),null!=this[Bd]&&(self.clearTimeout(this[Bd]),this[Bd]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Os?this[Td].unobserve(this):self.removeEventListener("resize",this[bd]),ks&&this[Nd].unobserve(this),this.removeEventListener("focus",this[Ud]),this.removeEventListener("blur",this[Pd]);const e=this[tp];e.removeEventListener("contextlost",this[Rd]),e.unregisterScene(this[Kd]),this[Bd]=self.setTimeout((()=>{this[Kd].dispose(),this[Bd]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Ld]=!1,this[zd]=0,this[Kd].reset()):this.src!==this[Kd].url&&(this[Ld]=!1,this[zd]=0,this[Wd]())),e.has("alt")&&this[Xd].setAttribute("aria-label",this[kd]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[tp].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[Kd].updateSchema(this.src):this[Kd].updateSchema(null))}toDataURL(e,t){return this[tp].displayCanvas(this[Kd]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,r=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:o,height:l,idealAspect:c,aspect:h}=this[Kd],{dpr:d,scaleFactor:p}=this[tp];let A=o*p*d,m=l*p*d,g=0,f=0;if(!0===s)if(c>h){const e=m;m=Math.round(A/c),f=(e-m)/2}else{const e=A;A=Math.round(m*c),g=(e-A)/2}Id.width=A,Id.height=m;try{return new Promise((async(e,s)=>{Id.getContext("2d").drawImage(this[tp].displayCanvas(this[Kd]),g,f,A,m,0,0,A,m),Id.toBlob((t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)}),t,r)}))}finally{this[Fd]({width:o,height:l})}}registerEffectComposer(e){e.setRenderer(this[tp].threeRenderer),e.setMainCamera(this[Kd].getCamera()),e.setMainScene(this[Kd]),this[Kd].effectRenderer=e}unregisterEffectComposer(){this[Kd].effectRenderer=null}registerRenderer(e){this[Kd].externalRenderer=e}unregisterRenderer(){this[Kd].externalRenderer=null}get[kd](){return this[Gd]}get[Gd](){return null==this.alt||"null"===this.alt?this[wd]:this.alt}[np](){return this[Ld]}[rp](){return this.loaded&&this[Qd]}[sp](){return!!this.src&&this[Qd]}[Fd]({width:e,height:t}){0!==e&&0!==t&&(this[jd].style.width=`${e}px`,this[jd].style.height=`${t}px`,this[ep]({width:e,height:t}))}[$d](e,t){var r;null===(r=this[Kd].effectRenderer)||void 0===r||r.beforeRender(e,t)}[qd](){this[Ld]||(this[Ld]=!0,this[zd]=performance.now())}[Jd](){this[Kd].queueRender()}[Zd](){}[Hd](e){this[Dd]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Vd].textContent!=e&&(this[Vd].textContent=e)}[(xd=Ud,Md=Pd,ep)](e){this[Kd].setSize(e.width,e.height)}async[(Cd=Rd,Wd)](){const e=this[Kd];if(this.loaded||!this[sp]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[Hd]("Loading"),e.stopAnimation();const t=this[ip].beginActivity("model-load"),r=this.src;try{const s=e.setSource(r,(e=>t(.95*utilities_clamp(e,0,1)))),o=this[ea]();await Promise.all([s,o]),this[qd](),this[Zd](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:r}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const ap=Symbol("changeAnimation"),op=Symbol("paused"),lp={repetitions:1/0,pingpong:!1},cp=Symbol("hotspotMap"),hp=Symbol("mutationCallback"),up=Symbol("observer"),dp=Symbol("addHotspot"),pp=Symbol("removeHotspot"),Ap=new three_module_Matrix4;var mp=Uint8Array,gp=Uint16Array,fp=Int32Array,_p=new mp([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),vp=new mp([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yp=new mp([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var r=new gp(31),s=0;s<31;++s)r[s]=t+=1<<e[s-1];var o=new fp(r[30]);for(s=1;s<30;++s)for(var l=r[s];l<r[s+1];++l)o[l]=l-r[s]<<5|s;return{b:r,r:o}},Ep=freb(_p,2),xp=Ep.b,Mp=Ep.r;xp[28]=258,Mp[258]=28;for(var Cp=freb(vp,0),Sp=(Cp.b,Cp.r),Ip=new gp(32768),bp=0;bp<32768;++bp){var wp=(43690&bp)>>1|(21845&bp)<<1;wp=(61680&(wp=(52428&wp)>>2|(13107&wp)<<2))>>4|(3855&wp)<<4,Ip[bp]=((65280&wp)>>8|(255&wp)<<8)>>1}var hMap=function(e,t,r){for(var s=e.length,o=0,l=new gp(t);o<s;++o)e[o]&&++l[e[o]-1];var c,h=new gp(t);for(o=1;o<t;++o)h[o]=h[o-1]+l[o-1]<<1;if(r){c=new gp(1<<t);var d=15-t;for(o=0;o<s;++o)if(e[o])for(var p=o<<4|e[o],A=t-e[o],m=h[e[o]-1]++<<A,g=m|(1<<A)-1;m<=g;++m)c[Ip[m]>>d]=p}else for(c=new gp(s),o=0;o<s;++o)e[o]&&(c[o]=Ip[h[e[o]-1]++]>>15-e[o]);return c},Tp=new mp(288);for(bp=0;bp<144;++bp)Tp[bp]=8;for(bp=144;bp<256;++bp)Tp[bp]=9;for(bp=256;bp<280;++bp)Tp[bp]=7;for(bp=280;bp<288;++bp)Tp[bp]=8;var Bp=new mp(32);for(bp=0;bp<32;++bp)Bp[bp]=5;var Rp=hMap(Tp,9,0),Lp=hMap(Bp,5,0),shft=function(e){return(e+7)/8|0},slc=function(e,t,r){return(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length),new mp(e.subarray(t,r))},Dp=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],err=function(e,t,r){var s=new Error(t||Dp[e]);if(s.code=e,Error.captureStackTrace&&Error.captureStackTrace(s,err),!r)throw s;return s},wbits=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8},wbits16=function(e,t,r){r<<=7&t;var s=t/8|0;e[s]|=r,e[s+1]|=r>>8,e[s+2]|=r>>16},hTree=function(e,t){for(var r=[],s=0;s<e.length;++s)e[s]&&r.push({s,f:e[s]});var o=r.length,l=r.slice();if(!o)return{t:Pp,l:0};if(1==o){var c=new mp(r[0].s+1);return c[r[0].s]=1,{t:c,l:1}}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var h=r[0],d=r[1],p=0,A=1,m=2;for(r[0]={s:-1,f:h.f+d.f,l:h,r:d};A!=o-1;)h=r[r[p].f<r[m].f?p++:m++],d=r[p!=A&&r[p].f<r[m].f?p++:m++],r[A++]={s:-1,f:h.f+d.f,l:h,r:d};var g=l[0].s;for(s=1;s<o;++s)l[s].s>g&&(g=l[s].s);var f=new gp(g+1),_=fflate_module_ln(r[A-1],f,0);if(_>t){s=0;var y=0,E=_-t,x=1<<E;for(l.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));s<o;++s){var C=l[s].s;if(!(f[C]>t))break;y+=x-(1<<_-f[C]),f[C]=t}for(y>>=E;y>0;){var S=l[s].s;f[S]<t?y-=1<<t-f[S]++-1:++s}for(;s>=0&&y;--s){var I=l[s].s;f[I]==t&&(--f[I],++y)}_=t}return{t:new mp(f),l:_}},fflate_module_ln=function(e,t,r){return-1==e.s?Math.max(fflate_module_ln(e.l,t,r+1),fflate_module_ln(e.r,t,r+1)):t[e.s]=r},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new gp(++t),s=0,o=e[0],l=1,w=function(e){r[s++]=e},c=1;c<=t;++c)if(e[c]==o&&c!=t)++l;else{if(!o&&l>2){for(;l>138;l-=138)w(32754);l>2&&(w(l>10?l-11<<5|28690:l-3<<5|12305),l=0)}else if(l>3){for(w(o),--l;l>6;l-=6)w(8304);l>2&&(w(l-3<<5|8208),l=0)}for(;l--;)w(o);l=1,o=e[c]}return{c:r.subarray(0,s),n:t}},clen=function(e,t){for(var r=0,s=0;s<t.length;++s)r+=e[s]*t[s];return r},wfblk=function(e,t,r){var s=r.length,o=shft(t+2);e[o]=255&s,e[o+1]=s>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var l=0;l<s;++l)e[o+l+4]=r[l];return 8*(o+4+s)},wblk=function(e,t,r,s,o,l,c,h,d,p,A){wbits(t,A++,r),++o[256];for(var m=hTree(o,15),g=m.t,f=m.l,_=hTree(l,15),y=_.t,E=_.l,x=lc(g),C=x.c,S=x.n,I=lc(y),b=I.c,T=I.n,B=new gp(19),U=0;U<C.length;++U)++B[31&C[U]];for(U=0;U<b.length;++U)++B[31&b[U]];for(var F=hTree(B,7),Q=F.t,O=F.l,G=19;G>4&&!Q[yp[G-1]];--G);var W,q,j,X,Y=p+5<<3,K=clen(o,Tp)+clen(l,Bp)+c,J=clen(o,g)+clen(l,y)+c+14+3*G+clen(B,Q)+2*B[16]+3*B[17]+7*B[18];if(d>=0&&Y<=K&&Y<=J)return wfblk(t,A,e.subarray(d,d+p));if(wbits(t,A,1+(J<K)),A+=2,J<K){W=hMap(g,f,0),q=g,j=hMap(y,E,0),X=y;var $=hMap(Q,O,0);wbits(t,A,S-257),wbits(t,A+5,T-1),wbits(t,A+10,G-4),A+=14;for(U=0;U<G;++U)wbits(t,A+3*U,Q[yp[U]]);A+=3*G;for(var ee=[C,b],te=0;te<2;++te){var ie=ee[te];for(U=0;U<ie.length;++U){var ne=31&ie[U];wbits(t,A,$[ne]),A+=Q[ne],ne>15&&(wbits(t,A,ie[U]>>5&127),A+=ie[U]>>12)}}}else W=Rp,q=Tp,j=Lp,X=Bp;for(U=0;U<h;++U){var re=s[U];if(re>255){wbits16(t,A,W[(ne=re>>18&31)+257]),A+=q[ne+257],ne>7&&(wbits(t,A,re>>23&31),A+=_p[ne]);var se=31&re;wbits16(t,A,j[se]),A+=X[se],se>3&&(wbits16(t,A,re>>5&8191),A+=vp[se])}else wbits16(t,A,W[re]),A+=q[re]}return wbits16(t,A,W[256]),A+q[256]},Up=new fp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pp=new mp(0),dflt=function(e,t,r,s,o,l){var c=l.z||e.length,h=new mp(s+c+5*(1+Math.ceil(c/7e3))+o),d=h.subarray(s,h.length-o),p=l.l,A=7&(l.r||0);if(t){A&&(d[0]=l.r>>3);for(var m=Up[t-1],g=m>>13,f=8191&m,_=(1<<r)-1,y=l.p||new gp(32768),E=l.h||new gp(_+1),x=Math.ceil(r/3),C=2*x,hsh=function(t){return(e[t]^e[t+1]<<x^e[t+2]<<C)&_},S=new fp(25e3),I=new gp(288),b=new gp(32),T=0,B=0,U=l.i||0,F=0,Q=l.w||0,O=0;U+2<c;++U){var G=hsh(U),W=32767&U,q=E[G];if(y[W]=q,E[G]=W,Q<=U){var j=c-U;if((T>7e3||F>24576)&&(j>423||!p)){A=wblk(e,d,0,S,I,b,B,F,O,U-O,A),F=T=B=0,O=U;for(var X=0;X<286;++X)I[X]=0;for(X=0;X<30;++X)b[X]=0}var Y=2,K=0,J=f,$=W-q&32767;if(j>2&&G==hsh(U-$))for(var ee=Math.min(g,j)-1,te=Math.min(32767,U),ie=Math.min(258,j);$<=te&&--J&&W!=q;){if(e[U+Y]==e[U+Y-$]){for(var ne=0;ne<ie&&e[U+ne]==e[U+ne-$];++ne);if(ne>Y){if(Y=ne,K=$,ne>ee)break;var re=Math.min($,ne-2),se=0;for(X=0;X<re;++X){var ae=U-$+X&32767,oe=ae-y[ae]&32767;oe>se&&(se=oe,q=ae)}}}$+=(W=q)-(q=y[W])&32767}if(K){S[F++]=268435456|Mp[Y]<<18|Sp[K];var le=31&Mp[Y],ce=31&Sp[K];B+=_p[le]+vp[ce],++I[257+le],++b[ce],Q=U+Y,++T}else S[F++]=e[U],++I[e[U]]}}for(U=Math.max(U,Q);U<c;++U)S[F++]=e[U],++I[e[U]];A=wblk(e,d,p,S,I,b,B,F,O,U-O,A),p||(l.r=7&A|d[A/8|0]<<3,A-=7,l.h=E,l.p=y,l.i=U,l.w=Q)}else{for(U=l.w||0;U<c+p;U+=65535){var he=U+65535;he>=c&&(d[A/8|0]=p,he=c),A=wfblk(d,A+1,e.subarray(U,he))}l.i=c}return slc(h,0,s+shft(A)+o)},Fp=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,s=9;--s;)r=(1&r&&-306674912)^r>>>1;e[t]=r}return e}(),crc=function(){var e=-1;return{p:function(t){for(var r=e,s=0;s<t.length;++s)r=Fp[255&r^t[s]]^r>>>8;e=r},d:function(){return~e}}},dopt=function(e,t,r,s,o){if(!o&&(o={l:1},t.dictionary)){var l=t.dictionary.subarray(-32768),c=new mp(l.length+e.length);c.set(l),c.set(e,l.length),e=c,o.w=l.length}return dflt(e,null==t.level?6:t.level,null==t.mem?o.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,r,s,o)},mrg=function(e,t){var r={};for(var s in e)r[s]=e[s];for(var s in t)r[s]=t[s];return r},wbytes=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,r,s){for(var o in e){var l=e[o],c=t+o,h=s;Array.isArray(l)&&(h=mrg(s,l[1]),l=l[0]),l instanceof mp?r[c]=[l,h]:(r[c+="/"]=[new mp(0),h],fltn(l,c,r,s))}},Np="undefined"!=typeof TextEncoder&&new TextEncoder,Qp="undefined"!=typeof TextDecoder&&new TextDecoder;try{Qp.decode(Pp,{stream:!0})}catch(e){}function strToU8(e,t){if(t){for(var r=new mp(e.length),s=0;s<e.length;++s)r[s]=e.charCodeAt(s);return r}if(Np)return Np.encode(e);var o=e.length,l=new mp(e.length+(e.length>>1)),c=0,w=function(e){l[c++]=e};for(s=0;s<o;++s){if(c+5>l.length){var h=new mp(c+8+(o-s<<1));h.set(l),l=h}var d=e.charCodeAt(s);d<128||t?w(d):d<2048?(w(192|d>>6),w(128|63&d)):d>55295&&d<57344?(w(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++s))>>18),w(128|d>>12&63),w(128|d>>6&63),w(128|63&d)):(w(224|d>>12),w(128|d>>6&63),w(128|63&d))}return slc(l,0,c)}var exfl=function(e){var t=0;if(e)for(var r in e){var s=e[r].length;s>65535&&err(9),t+=s+4}return t},wzh=function(e,t,r,s,o,l,c,h){var d=s.length,p=r.extra,A=h&&h.length,m=exfl(p);wbytes(e,t,null!=c?33639248:67324752),t+=4,null!=c&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(l<0&&8),e[t++]=o&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var g=new Date(null==r.mtime?Date.now():r.mtime),f=g.getFullYear()-1980;if((f<0||f>119)&&err(10),wbytes(e,t,f<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>1),t+=4,-1!=l&&(wbytes(e,t,r.crc),wbytes(e,t+4,l<0?-l-2:l),wbytes(e,t+8,r.size)),wbytes(e,t+12,d),wbytes(e,t+14,m),t+=16,null!=c&&(wbytes(e,t,A),wbytes(e,t+6,r.attrs),wbytes(e,t+10,c),t+=14),e.set(s,t),t+=d,m)for(var _ in p){var y=p[_],E=y.length;wbytes(e,t,+_),wbytes(e,t+2,E),e.set(y,t+4),t+=4+E}return A&&(e.set(h,t),t+=A),t},wzf=function(e,t,r,s,o){wbytes(e,t,101010256),wbytes(e,t+8,r),wbytes(e,t+10,r),wbytes(e,t+12,s),wbytes(e,t+16,o)};"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var Op=r(5108);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1,maxTextureSize:1024},t);const r={},s="model.usda";r[s]=null;let o=buildHeader();o+=function buildSceneStart(e){return`def Xform "Root"\n{\n\tdef Scope "Scenes" (\n\t\tkind = "sceneLibrary"\n\t)\n\t{\n\t\tdef Xform "Scene" (\n\t\t\tcustomData = {\n\t\t\t\tbool preliminary_collidesWithEnvironment = 0\n\t\t\t\tstring sceneName = "Scene"\n\t\t\t}\n\t\t\tsceneName = "Scene"\n\t\t)\n\t\t{\n\t\ttoken preliminary:anchoring:type = "${e.ar.anchoring.type}"\n\t\ttoken preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"\n\n`}(t);const l={},c={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,s=e.material;if(s.isMeshStandardMaterial){const c="geometries/Geometry_"+t.id+".usda";if(!(c in r)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",r=e.attributes,s=r.position.count;return`\n\tdef Mesh "${t}"\n\t{\n\t\tint[] faceVertexCounts = [${function buildMeshVertexCount(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]\n\t\tint[] faceVertexIndices = [${function buildMeshVertexIndices(e){const t=e.index,r=[];if(null!==t)for(let e=0;e<t.count;e++)r.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)r.push(e)}return r.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(r.normal,s)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(r.position,s)}]\n${function buildPrimvars(e){let t="";for(let r=0;r<4;r++){const s=r>0?r:"",o=e["uv"+s];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${s} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}const r=e.color;if(void 0!==r){t+=`\n\tcolor3f[] primvars:displayColor = [${buildVector3Array(r,r.count)}] (\n\t\tinterpolation = "vertex"\n\t\t)`}return t}(r)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);r[c]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}s.uuid in l||(l[s.uuid]=s),o+=function buildXform(e,t,r){const s="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&Op.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${s}" (\n\tprepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>\n\tprepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n\tmatrix4d xformOp:transform = ${o}\n\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\trel material:binding = </Materials/Material_${r.id}>\n}\n\n`}(e,t,s)}else Op.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(o+=function buildCamera(e){const t=e.name?e.name:"Camera_"+e.id,r=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&Op.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return e.isOrthographicCamera?`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(kp)}, ${e.far.toPrecision(kp)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(kp)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(kp)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${r}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(kp)}, ${e.far.toPrecision(kp)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(kp)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(kp)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(kp)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(kp)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,r=!1){const s=[];for(const o in e){const l=e[o];s.push(buildMaterial(l,t,r))}return`def "Materials"\n{\n${s.join("")}\n}\n\n`}(l,c,t.quickLookCompatible),r[s]=strToU8(o),o=null;for(const e in c){let s=c[e];!0===s.isCompressedTexture&&(s=decompress(s));const o=imageToCanvas(s.image,s.flipY,t.maxTextureSize),l=await new Promise((e=>o.toBlob(e,"image/png",1)));r[`textures/Texture_${e}.png`]=new Uint8Array(await l.arrayBuffer())}let h=0;for(const e in r){const t=r[e];h+=34+e.length;const s=63&h;if(4!==s){const o=new Uint8Array(64-s);r[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var r={},s=[];fltn(e,"",r,t);var o=0,l=0;for(var c in r){var h=r[c],d=h[0],p=h[1],A=0==p.level?0:8,m=(B=strToU8(c)).length,g=p.comment,f=g&&strToU8(g),_=f&&f.length,y=exfl(p.extra);m>65535&&err(11);var E=A?deflateSync(d,p):d,x=E.length,C=crc();C.p(d),s.push(mrg(p,{size:d.length,crc:C.d(),c:E,f:B,m:f,u:m!=c.length||f&&g.length!=_,o,compression:A})),o+=30+m+y+x,l+=76+2*(m+y)+(_||0)+x}for(var S=new mp(l+22),I=o,b=l-o,T=0;T<s.length;++T){var B=s[T];wzh(S,B.o,B,B.f,B.u,B.c.length);var U=30+B.f.length+exfl(B.extra);S.set(B.c,B.o+U),wzh(S,o,B,B.f,B.u,B.c.length,B.o,B.m),o+=16+U+(B.m?B.m.length:0)}return wzf(S,o,s.length,b,I),S}(r,{level:0})}}function imageToCanvas(e,t,r){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const s=r/Math.max(e.width,e.height),o=document.createElement("canvas");o.width=e.width*Math.min(1,s),o.height=e.height*Math.min(1,s);const l=o.getContext("2d");return!0===t&&(l.translate(0,o.height),l.scale(1,-1)),l.drawImage(e,0,0,o.width,o.height),o}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const kp=7;function buildHeader(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function buildMatrix(e){const t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return Op.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const r=[];for(let t=0;t<e.count;t++){const s=e.getX(t),o=e.getY(t),l=e.getZ(t);r.push(`(${s.toPrecision(kp)}, ${o.toPrecision(kp)}, ${l.toPrecision(kp)})`)}return r.join(", ")}function buildVector2Array(e){const t=[];for(let r=0;r<e.count;r++){const s=e.getX(r),o=e.getY(r);t.push(`(${s.toPrecision(kp)}, ${1-o.toPrecision(kp)})`)}return t.join(", ")}function buildMaterial(e,t,r=!1){const s="\t\t\t",o=[],l=[];function buildTexture(s,o,l){const c=s.source.id+"_"+s.flipY;t[c]=s;const h=s.channel>0?"st"+s.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},p=s.repeat.clone(),A=s.offset.clone(),m=s.rotation,g=Math.sin(m),f=Math.cos(m);return A.y=1-A.y-p.y,r?(A.x=A.x/p.x,A.y=A.y/p.y,A.x+=g/p.x,A.y+=f-1):(A.x+=g*p.x,A.y+=(1-f)*p.y),`\n\t\tdef Shader "PrimvarReader_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${h}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${o}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(kp)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(p)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(A)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${s.id}_${o}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${c}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${o}.outputs:result>\n\t\t\t${void 0!==l?"float4 inputs:scale = "+function buildColor4(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(l):""}\n\t\t\ttoken inputs:sourceColorSpace = "${s.colorSpace===Qe?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[s.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[s.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${e.transparent||e.alphaTest>0?"float outputs:a":""}\n\t\t}`}return 2===e.side&&Op.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(o.push(`${s}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),o.push(`${s}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):o.push(`${s}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(o.push(`${s}color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),l.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&o.push(`${s}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(o.push(`${s}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(o.push(`${s}float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),l.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(o.push(`${s}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):o.push(`${s}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(o.push(`${s}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):o.push(`${s}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(o.push(`${s}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),o.push(`${s}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):o.push(`${s}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(o.push(`${s}float inputs:clearcoat = ${e.clearcoat}`),o.push(`${s}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),o.push(`${s}float inputs:ior = ${e.ior}`)),`\n\tdef Material "Material_${e.id}"\n\t{\n\t\tdef Shader "PreviewSurface"\n\t\t{\n\t\t\tuniform token info:id = "UsdPreviewSurface"\n${o.join("\n")}\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>\n\n${l.join("\n")}\n\n\t}\n`}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}var Gp=r(5108),ar_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};let Vp=!1,Hp=!1;const zp="#model-viewer-no-ar-fallback",Wp=(qp=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=ll(e),r=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>qp.indexOf(e)>-1));return new Set(r)}catch(e){}return new Set});var qp;const jp="quick-look",Xp="scene-viewer",Yp="webxr",Kp="none",Jp=Symbol("arButtonContainer"),$p=Symbol("enterARWithWebXR"),Zp=Symbol("openSceneViewer"),eA=Symbol("openIOSARQuickLook"),tA=Symbol("canActivateAR"),iA=Symbol("arMode"),nA=Symbol("arModes"),rA=Symbol("arAnchor"),sA=Symbol("preload"),aA=Symbol("onARButtonContainerClick"),oA=Symbol("onARStatus"),lA=Symbol("onARTracking"),cA=Symbol("onARTap"),hA=Symbol("selectARMode"),uA=Symbol("triggerLoad");var loading_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const dA="auto",pA="auto",AA="eager",mA=Symbol("defaultProgressBarElement"),gA=Symbol("posterContainerElement"),fA=Symbol("defaultPosterElement"),_A=Symbol("shouldDismissPoster"),vA=Symbol("hidePoster"),yA=Symbol("modelIsRevealed"),EA=Symbol("updateProgressBar"),xA=Symbol("ariaLabelCallToAction"),MA=Symbol("onProgress");var staging_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const CA=Math.PI/32,SA={basis:[degreesToRadians(numberNode(CA,"rad"))],keywords:{auto:[null]}},IA=Symbol("autoRotateStartTime"),bA=Symbol("radiansPerSecond"),wA=Symbol("syncRotationRate"),TA=Symbol("onCameraChange"),BA=(e=>{var t,r,s;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[r]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[dp](e)})),e.removedNodes.forEach((e=>{this[pp](e)})),this[Jd]())}))},this[s]=new MutationObserver(this[hp])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[dp](this.children[e]);const{ShadyDOM:e}=self;null==e?this[up].observe(this,{childList:!0}):this[up]=e.observeChildren(this,this[hp])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[up].disconnect():e.unobserveChildren(this[up])}[(t=cp,r=hp,s=up,$d)](e,t){super[$d](e,t);const r=this[Kd],{annotationRenderer:s}=r,o=r.getCamera();r.shouldRender()&&(r.updateSurfaceHotspots(),r.updateHotspotsVisibility(o.position),s.domElement.style.display="",s.render(r,o))}updateHotspot(e){const t=this[cp].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[Jd]())}queryHotspot(e){const t=this[cp].get(e);if(null==t)return null;const r=toVector3D(t.position),s=toVector3D(t.normal),o=t.facingCamera,l=this[Kd],c=l.getCamera(),h=new three_module_Vector3;h.setFromMatrixPosition(t.matrixWorld),h.project(c);const d=l.width/2,p=l.height/2;h.x=h.x*d+d,h.y=-h.y*p+p;const A=toVector3D(new three_module_Vector3(h.x,h.y,h.z));return Number.isFinite(A.x)&&Number.isFinite(A.y)?{position:r,normal:s,canvasPosition:A,facingCamera:o}:null}positionAndNormalFromPoint(e,t){const r=this[Kd],s=r.getNDC(e,t),o=r.positionAndNormalFromPoint(s);if(null==o)return null;Ap.copy(r.target.matrixWorld).invert();const l=toVector3D(o.position.applyMatrix4(Ap)),c=toVector3D(o.normal.transformDirection(Ap));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:l,normal:c,uv:h}}surfaceFromPoint(e,t){const r=this[Kd],s=r.getNDC(e,t);return r.surfaceFromPoint(s)}[dp](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[cp].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[cp].set(e.slot,t),this[Kd].addHotspot(t)),this[Kd].queueRender()}[pp](e){if(!(e instanceof HTMLElement))return;const t=this[cp].get(e.slot);t&&(t.decrement()&&(this[Kd].removeHotspot(t),this[cp].delete(e.slot)),this[Kd].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,r,s;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[r]=null,this[s]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[Xu]}get availableVariants(){return this.model?this.model[Hu]():[]}get originalGltfJson(){return this[ju]}[(t=Xu,r=qu,s=ju,Yu)](){return()=>{this[Jd]()}}[Ku](e){return e.colorSpace=Oe,e.wrapS=K,e.wrapT=K,new texture_Texture(this[Yu](),e)}async createTexture(e,t="image/png"){const{textureUtils:r}=this[tp],s=await r.loadImage(e);return s.userData.mimeType=t,this[Ku](s)}async createLottieTexture(e,t=1){const{textureUtils:r}=this[tp],s=await r.loadLottie(e,t);return this[Ku](s)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const r=new VideoTexture(t);return this[Ku](r)}createCanvasTexture(){const e=document.createElement("canvas"),t=new CanvasTexture(e);return this[Ku](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[ip].beginActivity("variant-update");e(.1);const t=this[Xu],{variantName:r}=this;null!=t&&(await t[Qu](r),this[Jd](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[Kd];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[tp].arRenderer.onUpdateScene(),this[Jd]()}}[Zd](){super[Zd]();const{currentGLTF:e}=this[Kd];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[qu]&&(this[Xu]=new Model(t,this[Yu]()),this[ju]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[qu]=e}async exportScene(e){const t=this[Kd];return new Promise((async(r,s)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const l=t.shadow;let c=!1;null!=l&&(c=l.visible,l.visible=!1),await this[Xu][Nu]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>r(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>s("glTF export failed")),o),null!=l&&(l.visible=c)}))}materialFromPoint(e,t){const r=this[Xu];if(null==r)return null;const s=this[Kd],o=s.getNDC(e,t),l=s.hitFromPoint(o);return null==l||null==l.face?null:r[Ou](l)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,r,s;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[r]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[IA]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[TA]),this[IA]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[TA]),this[IA]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[IA]=performance.now())}[(t=IA,r=bA,wA)](e){this[bA]=e[0]}[$d](e,t){if(super[$d](e,t),!this.autoRotate||!this[rp]()||this[tp].isPresenting)return;const r=Math.min(t,e-this[IA]-this.autoRotateDelay);r>0&&(this[Kd].yaw=this.turntableRotation+this[bA]*r*.001)}get turntableRotation(){return this[Kd].yaw}resetTurntableRotation(e=0){this[Kd].yaw=e}}return s=TA,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:SA,updateHandler:wA}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,r,s;class EnvironmentModelViewerElement extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[r]=null,this[s]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[Kd].setShadowIntensity(.5*this.shadowIntensity),this[Jd]()),e.has("shadowSoftness")&&(this[Kd].setShadowSoftness(this.shadowSoftness),this[Jd]()),e.has("exposure")&&(this[Kd].exposure=this.exposure,this[Jd]()),e.has("toneMapping")&&(this[Kd].toneMapping="commerce"===this.toneMapping||"neutral"===this.toneMapping?7:"agx"===this.toneMapping?6:4,this[Jd]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[sp]()&&this[ea](),e.has("skyboxHeight")&&(this[Kd].setGroundedSkybox(),this[Jd]())}hasBakedShadow(){return this[Kd].bakedShadows.size>0}async[(t=$s,r=Zs,s=ta,ea)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[ta]&&(this[ta](),this[ta]=null);const{textureUtils:r}=this[tp];if(null==r)return;const s=this[ip].beginActivity("environment-update");try{const{environmentMap:o,skybox:l}=await r.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>s(utilities_clamp(e,0,1))));this[$s]!==o&&(this[$s]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[Zs]=null!=l?l.name===o.name?o:l:null,this[Kd].setEnvironmentAndSkybox(this[$s],this[Zs])}catch(e){if(e instanceof Error)throw this[Kd].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A,m,g,f,_,y,E,x,C;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=Xl,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=Jl,this.interactionPromptStyle=Zl,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=ec,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[r]=this.shadowRoot.querySelector("#prompt"),this[s]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[o]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[c]=1/0,this[h]=!1,this[d]=!1,this[p]=Gc.AUTOMATIC,this[A]=new SmoothControls(this[Kd].camera,this[Xd],this[Kd]),this[m]=new Spherical,this[g]=!1,this[f]=!1,this[_]=!1,this[y]={},this[E]=()=>{const e=this[ac].changeSource;this[Cc]=e,e===Gc.USER_INTERACTION&&(this[Ec]=!0,this[dc]())},this[x]=()=>{this[pc](),this[Jd]();const e=this[ac].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[C]=e=>{this[jd].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[ac].inputSensitivity}set inputSensitivity(e){this[ac].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:r}=this[Sc];return{theta:e,phi:t,radius:r,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[tp].isPresenting?this[tp].arRenderer.target:this[Kd].getTarget())}getFieldOfView(){return this[ac].getFieldOfView()}getMinimumFieldOfView(){return this[ac].options.minimumFieldOfView}getMaximumFieldOfView(){return this[ac].options.maximumFieldOfView}getIdealAspect(){return this[Kd].idealAspect}jumpCameraToGoal(){this[Ic]=!0,this.requestUpdate(Ic,!1)}resetInteractionPrompt(){this[Mc]=0,this[xc]=1/0,this[Ec]=!1,this[yc]=this.interactionPrompt===Jl&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Xd].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[ac].addEventListener("user-interaction",this[fc]),this[ac].addEventListener("pointer-change-start",this[vc]),this[ac].addEventListener("pointer-change-end",this[vc])}disconnectedCallback(){super.disconnectedCallback(),this[ac].removeEventListener("user-interaction",this[fc]),this[ac].removeEventListener("pointer-change-start",this[vc]),this[ac].removeEventListener("pointer-change-end",this[vc])}updated(e){super.updated(e);const t=this[ac],r=this[Kd];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===Jl&&(this[yc]=!0)):(t.disableInteraction(),this[dc]()),this[Xd].setAttribute("aria-label",this[kd])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===Jl&&this.cameraControls&&!this[Ec]?this[yc]=!0:this[dc]()),e.has("interactionPromptStyle")&&(this[hc].style.opacity=this.interactionPromptStyle==$l?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),r.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[mc](),!0===this[Ic]&&Promise.resolve().then((()=>{t.jumpToGoal(),r.jumpToGoal(),this[_c](),this[Ic]=!1}))}async updateFraming(){const e=this[Kd],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const r=e.adjustedFoV(e.framedFoVDeg),s=this[ac].getFieldOfView()/t;this[ac].setFieldOfView(r*s),this[wc]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,r){const s=this[Xd],o=this[uc];if("1"===o[0].style.opacity)return void Wl.warn("interact() failed because an existing interaction is running.");const l=new Array;l.push({x:timeline(t.x),y:timeline(t.y)});const c=[{x:l[0].x(0),y:l[0].y(0)}];null!=r&&(l.push({x:timeline(r.x),y:timeline(r.y)}),c.push({x:l[1].x(0),y:l[1].y(0)}));let h=performance.now();const{width:d,height:p}=this[Kd],A=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,r]of c.entries()){const{style:l}=o[t];l.transform=`translateX(${d*r.x}px) translateY(${p*r.y}px)`,"pointerdown"===e?l.opacity="1":"pointerup"===e&&(l.opacity="0");const c={pointerId:t-5678,pointerType:"touch",target:s,clientX:d*r.x+A.x,clientY:p*r.y+A.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,c))}},moveTouches=()=>{const t=this[Cc];if(t!==Gc.AUTOMATIC||!s.isConnected){for(const e of this[uc])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const r=Math.min(1,(performance.now()-h)/e);for(const[e,t]of c.entries())t.x=l[e].x(r),t.y=l[e].y(r);dispatchTouches("pointermove"),r<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Gc.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-h:h=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[Cc]=Gc.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=cc,r=hc,s=uc,o=oc,l=Mc,c=xc,h=Ec,d=yc,p=Cc,A=ac,m=Sc,g=Ic,f=bc,_=wc,y=Ac,Bc)](e){const t=this[ac],r=this[Kd];r.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=Gc.NONE,t.setFieldOfView(r.adjustedFoV(r.framedFoVDeg)),this[fc]()}[Tc](e){const t=this[ac];if(this[wc]){const{theta:t,phi:r}=this.getCameraOrbit();e[0]=t,e[1]=r,this[wc]=!1}t.changeSource=Gc.NONE,t.setOrbit(e[0],e[1],e[2]),this[fc]()}[Lc](e){this[ac].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[Dc](e){this[ac].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[gc](e[2]),this.jumpCameraToGoal()}[Uc](e){this[ac].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[Pc](e){const t=this[Kd].adjustedFoV(180*e[0]/Math.PI);this[ac].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[Rc](e){const[t,r,s]=e;this[tp].arRenderer.isPresenting||this[Kd].setTarget(t,r,s),this[ac].changeSource=Gc.NONE,this[tp].arRenderer.updateTarget(),this[fc]()}[$d](e,t){if(super[$d](e,t),this[tp].isPresenting||!this[rp]())return;const r=this[ac],s=this[Kd],o=performance.now();if(this[yc]&&this.loaded&&o>this[zd]+this.interactionPromptThreshold&&(this[yc]=!1,this[xc]=o,this[cc].classList.add("visible")),isFinite(this[xc])&&this.interactionPromptStyle===Zl){const e=(o-this[xc])/5e3%1,t=ql(e),l=jl(e);if(this[hc].style.opacity=`${l}`,t!==this[Mc]){const e=t*s.width*.05,o=(t-this[Mc])*Math.PI/16;this[hc].style.transform=`translateX(${e}px)`,r.changeSource=Gc.AUTOMATIC,r.adjustOrbit(o,0,0),this[Mc]=t}}const l=r.update(e,t),c=s.updateTarget(t);(l||c)&&this[_c]()}[dc](){this[yc]=!1,this[cc].classList.remove("visible"),this[xc]=1/0}[gc](e){const t=Math.max(this[Kd].farRadius(),e),r=Math.abs(2*t);this[ac].updateNearFar(0,r)}[pc](){const{theta:e,phi:t}=this[ac].getCameraSpherical(this[Sc]),r=(4+Math.floor((e%sc+rc)/ic))%4,s=Math.floor(t/nc),o=`${Kl[s]}${Yl[r]}`,l=o;l in this[Ac]?this[Hd](this[Ac][l]):this[Hd](`View from stage ${o}`)}get[kd](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[Ac]&&(e=`. ${this[Ac]["interaction-prompt"]}`),super[kd].replace(/\.$/,"")+(this.cameraControls?e:"")}async[ep](e){const t=this[ac],r=this[Kd],s=r.adjustedFoV(r.framedFoVDeg);super[ep](e);const o=r.adjustedFoV(r.framedFoVDeg)/s,l=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[Kd].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[ac].setFieldOfView(l),this.jumpCameraToGoal()}[Zd](){super[Zd](),this[bc]?this[wc]=!0:this[bc]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(E=fc,x=_c,C=vc,mc)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[Ac]=JSON.parse(this.a11y)}catch(e){Wl.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?Wl.warn("Error not supported format, should be a JSON string:",this.a11y):this[Ac]={};else"object"==typeof this.a11y&&null!=this.a11y?this[Ac]=Object.assign({},this.a11y):this[Ac]={};this[Xd].setAttribute("aria-label",this[kd])}}return controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:tc,observeEffects:!0,updateHandler:Tc}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:Rc}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:Bc}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:Lc}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:Dc}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:Uc}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:Pc}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),controls_decorate([n()],ControlsModelViewerElement.prototype,"a11y",void 0),ControlsModelViewerElement})((e=>{var t,r,s,o,l,c,h,d,p,A;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[r]=this.shadowRoot.querySelector(".ar-button"),this[s]=document.createElement("a"),this[o]=new Set,this[l]=Kp,this[c]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[d]=({status:e})=>{e!==zc&&this[tp].arRenderer.presentedScene!==this[Kd]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===zc?this.removeAttribute("ar-tracking"):e===Wc&&this.setAttribute("ar-tracking",Xc))},this[p]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[A]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[iA]!==Kp}connectedCallback(){super.connectedCallback(),this[tp].arRenderer.addEventListener("status",this[oA]),this.setAttribute("ar-status",zc),this[tp].arRenderer.addEventListener("tracking",this[lA]),this[rA].addEventListener("message",this[cA])}disconnectedCallback(){super.disconnectedCallback(),this[tp].arRenderer.removeEventListener("status",this[oA]),this[tp].arRenderer.removeEventListener("tracking",this[lA]),this[rA].removeEventListener("message",this[cA])}update(e){super.update(e),e.has("arScale")&&(this[Kd].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[Kd].updateShadow(),this[Jd]()),e.has("arModes")&&(this[nA]=Wp(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[hA]()}async activateAR(){switch(this[iA]){case jp:await this[eA]();break;case Yp:await this[$p]();break;case Xp:this[Zp]();break;default:Gp.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=tA,r=Jp,s=rA,o=nA,l=iA,c=sA,h=aA,d=oA,p=lA,A=cA,hA)](){var e;let t=Kp;if(this.ar){if(null!=this.src)for(const r of this[nA]){if("webxr"===r&&Gs&&!Vp&&await this[tp].arRenderer.supportsPresentation()){t=Yp;break}if("scene-viewer"===r&&!Hp&&(qs||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=Xp;break}if("quick-look"===r&&Xs){t=jp;break}}t===Kp&&null!=this.iosSrc&&Xs&&(t=jp)}if(t!==Kp)this[Jp].classList.add("enabled"),this[Jp].addEventListener("click",this[aA]);else if(this[Jp].classList.contains("enabled")){this[Jp].removeEventListener("click",this[aA]),this[Jp].classList.remove("enabled");const e=jc;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[iA]=t}async[$p](){Gp.log("Attempting to present in AR with WebXR..."),await this[uA]();try{this[Jp].removeEventListener("click",this[aA]);const{arRenderer:e}=this[tp];e.placeOnWall="wall"===this.arPlacement,await e.present(this[Kd],this.xrEnvironment)}catch(e){Gp.warn("Error while trying to present in AR with WebXR"),Gp.error(e),await this[tp].arRenderer.stopPresenting(),Vp=!0,Gp.warn("Falling back to next ar-mode"),await this[hA](),this.activateAR()}finally{this[hA]()}}async[uA](){this.loaded||(this[sA]=!0,this[Wd](),await((e,t,r=null)=>new Promise((s=>{e.addEventListener(t,(function handler(o){r&&!r(o)||(s(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[sA]=!1)}[sp](){return super[sp]()||this[sA]}[Zp](){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,e);r.hash&&(r.hash="");const s=new URLSearchParams(r.search);if(t.hash=zp,s.set("mode","ar_preferred"),s.has("disable_occlusion")||s.set("disable_occlusion","true"),"fixed"===this.arScale&&s.set("resizable","false"),"wall"===this.arPlacement&&s.set("enable_vertical_placement","true"),s.has("sound")){const t=new URL(s.get("sound"),e);s.set("sound",t.toString())}if(s.has("link")){const t=new URL(s.get("link"),e);s.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.2?${s.toString()+"&file="+encodeURIComponent(r.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===zp&&(Hp=!0,self.history.back(),Gp.warn("Error while trying to present in AR with Scene Viewer"),Gp.warn("Falling back to next ar-mode"),this[hA]())}),{once:!0}),this[rA].setAttribute("href",o),Gp.log("Attempting to present in AR with Scene Viewer..."),this[rA].click()}async[eA](){const e=!this.iosSrc;this[Jp].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,r=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,t);s.hash&&(r.hash=s.hash)}"fixed"===this.arScale&&(r.hash&&(r.hash+="&"),r.hash+="allowsContentScaling=0");const s=this[rA];s.setAttribute("rel","ar");const o=document.createElement("img");s.appendChild(o),s.setAttribute("href",r.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),Gp.log("Attempting to present in AR with Quick Look..."),s.click(),s.removeChild(o),e&&URL.revokeObjectURL(t),this[Jp].classList.add("enabled")}async prepareUSDZ(){const e=this[ip].beginActivity("usdz-conversion");await this[uA]();const{model:t,shadow:r,target:s}=this[Kd];if(null==t)return"";let o=!1;null!=r&&(o=r.visible,r.visible=!1),e(.2);const l=new USDZExporter;s.remove(t),t.position.copy(s.position),t.updateWorldMatrix(!1,!0);const c=await l.parse(t);t.position.set(0,0,0),s.add(t);const h=new Blob([c],{type:"model/vnd.usdz+zip"}),d=URL.createObjectURL(h);return e(1),null!=r&&(r.visible=o),d}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,r,s,o,l,c,h,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=dA,this.loading=pA,this[t]=!1,this[r]=!1,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[o]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[c]=this[fA].getAttribute("aria-label"),this[h]=((e,t)=>{let r=null;const throttled=(...s)=>{null==r&&(e(...s),r=self.setTimeout((()=>r=null),t))};return throttled.flush=()=>{null!=r&&(self.clearTimeout(r),r=null)},throttled})((e=>{const t=this[mA].parentNode;requestAnimationFrame((()=>{this[mA].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[mA]),t.appendChild(this[mA])),this[mA].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress,r=e.detail.reason;1===t&&(this[EA].flush(),this.loaded&&(this[_A]||this.reveal===dA)&&this[vA]()),this[EA](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:r}}))};const p=self.ModelViewerElement||{},A=p.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(A);const m=p.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(m),p.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(p.meshoptDecoderLocation);const g=p.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=g}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[_o].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[vA]():(this[_A]=!0,this[Wd]())}showPoster(){const e=this[gA];if(e.classList.contains("show"))return;e.classList.add("show"),this[Xd].classList.remove("show");const t=this[fA];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const r=this.modelIsVisible;this[yA]=!1,this[Od](r)}getDimensions(){return toVector3D(this[Kd].size)}getBoundingBoxCenter(){return toVector3D(this[Kd].boundingBox.getCenter(new three_module_Vector3))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[ip].addEventListener("progress",this[MA])}disconnectedCallback(){super.disconnectedCallback(),this[ip].removeEventListener("progress",this[MA])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[fA].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[fA].setAttribute("aria-label",this[Gd]),(e.has("reveal")||e.has("loading"))&&this[Wd]()}[(t=yA,r=_A,s=gA,o=fA,l=mA,c=xA,h=EA,d=MA,sp)](){return!!this.src&&(this[_A]||this.loading===AA||this.reveal===dA&&this[Qd])}[vA](){this[_A]=!1;const e=this[gA];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Xd].classList.add("show");const t=this.modelIsVisible;this[yA]=!0,this[Od](t);const r=this.getRootNode();r&&r.activeElement===this&&this[Xd].focus();const s=this[fA];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[rp](){return super[rp]()&&this[yA]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[Kd].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[Kd].subscribeMixerEvent("finished",(()=>{this[op]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[Kd].animationNames:[]}get duration(){return this[Kd].duration}get paused(){return this[op]}get currentTime(){return this[Kd].animationTime}set currentTime(e){this[Kd].animationTime=e,this[Jd]()}get timeScale(){return this[Kd].animationTimeScale}set timeScale(e){this[Kd].animationTimeScale=e}pause(){this[op]||(this[op]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[op]=!1,this[ap](e),this.dispatchEvent(new CustomEvent("play")))}[(t=op,Zd)](){super[Zd](),this[op]=!0,null!=this.animationName&&this[ap](),this.autoplay&&this.play()}[$d](e,t){super[$d](e,t),this[op]||!this[rp]()&&!this[tp].isPresenting||(this[Kd].updateAnimation(t/1e3),this[Jd]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[ap]()}[ap](e=lp){var t;const r=null!==(t=e.repetitions)&&void 0!==t?t:1/0,s=e.pingpong?Be:1===r?2200:Te;this[Kd].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,s,r),this[op]&&(this[Kd].updateAnimation(0),this[Jd]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",BA)}}]);
|