@crystaldesign/diva-web-planner-react 24.13.0-beta.1 → 24.13.0-beta.3
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 Me=s(25108);const Te=new WeakMap;class DRACOLoader extends o.aNw{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,s,r){const A=new o.hH6(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{this.parse(e,t,r)}),s,r)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,o.KI_).catch(s)}decodeDracoFile(e,t,s,r,A=o.GUF,l=()=>{}){const h={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:A};return this.decodeGeometry(e,h).then(t).catch(l)}decodeGeometry(e,t){const s=JSON.stringify(t);if(Te.has(e)){const t=Te.get(e);if(t.key===s)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 r;const o=this.workerNextTaskID++,A=e.byteLength,l=this._getWorker(o,A).then((s=>(r=s,new Promise(((s,A)=>{r._callbacks[o]={resolve:s,reject:A},r.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return l.catch((()=>!0)).then((()=>{r&&o&&this._releaseTask(r,o)})),Te.set(e,{key:s,promise:l}),l}_createGeometry(e){const t=new o.u9r;e.index&&t.setIndex(new o.TlE(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s],A=r.name,l=r.array,h=r.itemSize,c=new o.TlE(l,h);"color"===A&&(this._assignVertexColorSpace(c,r.vertexColorSpace),c.normalized=l instanceof Float32Array==!1),t.setAttribute(A,c)}return t}_assignVertexColorSpace(e,t){if(t!==o.KI_)return;const s=new o.Ilk;for(let t=0,r=e.count;t<r;t++)s.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new o.hH6(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise(((t,r)=>{s.load(e,t,void 0,r)}))}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 s=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const r=DRACOWorker.toString(),o=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.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 s=t.data;switch(s.type){case"decode":e._callbacks[s.id].resolve(s);break;case"error":e._callbacks[s.id].reject(s);break;default:Me.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){Me.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}}function DRACOWorker(){let e,t;function decodeAttribute(e,t,s,r,o,A){const l=A.num_components(),h=s.num_points()*l,c=h*o.BYTES_PER_ELEMENT,d=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),g=e._malloc(c);t.GetAttributeDataArrayForAllPoints(s,A,d,c,g);const p=new o(e.HEAPF32.buffer,g,h).slice();return e._free(g),{name:r,array:p,itemSize:l}}onmessage=function(s){const r=s.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const s=r.buffer,o=r.taskConfig;t.then((e=>{const t=e.draco,A=new t.Decoder;try{const e=function decodeGeometry(e,t,s,r){const o=r.attributeIDs,A=r.attributeTypes;let l,h;const c=t.GetEncodedGeometryType(s);if(c===e.TRIANGULAR_MESH)l=new e.Mesh,h=t.DecodeArrayToMesh(s,s.byteLength,l);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");l=new e.PointCloud,h=t.DecodeArrayToPointCloud(s,s.byteLength,l)}if(!h.ok()||0===l.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const d={index:null,attributes:[]};for(const s in o){const h=self[A[s]];let c,g;if(r.useUniqueIDs)g=o[s],c=t.GetAttributeByUniqueId(l,g);else{if(g=t.GetAttributeId(l,e[o[s]]),-1===g)continue;c=t.GetAttribute(l,g)}const p=decodeAttribute(e,t,l,s,h,c);"color"===s&&(p.vertexColorSpace=r.vertexColorSpace),d.attributes.push(p)}c===e.TRIANGULAR_MESH&&(d.index=function decodeIndex(e,t,s){const r=s.num_faces(),o=3*r,A=4*o,l=e._malloc(A);t.GetTrianglesUInt32Array(s,A,l);const h=new Uint32Array(e.HEAPF32.buffer,l,o).slice();return e._free(l),{array:h,itemSize:1}}(e,t,l));return e.destroy(l),d}(t,A,new Int8Array(s),o),l=e.attributes.map((e=>e.array.buffer));e.index&&l.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},l)}catch(e){Me.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(A)}}))}}}var Re=s(25108);function toTrianglesDrawMode(e,t){if(t===o.WwZ)return Re.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===o.z$h||t===o.UlW){let s=e.getIndex();if(null===s){const t=[],r=e.getAttribute("position");if(void 0===r)return Re.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),s=e.getIndex()}const r=s.count-2,A=[];if(t===o.z$h)for(let e=1;e<=r;e++)A.push(s.getX(0)),A.push(s.getX(e)),A.push(s.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(A.push(s.getX(e)),A.push(s.getX(e+1)),A.push(s.getX(e+2))):(A.push(s.getX(e+2)),A.push(s.getX(e+1)),A.push(s.getX(e)));A.length/3!==r&&Re.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(A),l.clearGroups(),l}return Re.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var De=s(25108);class GLTFLoader extends o.aNw{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,s,r){const A=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=o.Zp0.extractUrlBase(e);l=o.Zp0.resolveURL(t,this.path)}else l=o.Zp0.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){r?r(t):De.error(t),A.manager.itemError(e),A.manager.itemEnd(e)},h=new o.hH6(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,(function(s){try{A.parse(s,l,(function(s){t(s),A.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),s,_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,s,r){let o;const A={},l={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===Fe){try{A[Le.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(r&&r(e))}o=JSON.parse(A[Le.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(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](c);t.name||De.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[t.name]=t,A[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],s=o.extensionsRequired||[];switch(t){case Le.KHR_MATERIALS_UNLIT:A[t]=new GLTFMaterialsUnlitExtension;break;case Le.KHR_DRACO_MESH_COMPRESSION:A[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case Le.KHR_TEXTURE_TRANSFORM:A[t]=new GLTFTextureTransformExtension;break;case Le.KHR_MESH_QUANTIZATION:A[t]=new GLTFMeshQuantizationExtension;break;default:s.indexOf(t)>=0&&void 0===l[t]&&De.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(A),c.setPlugins(l),c.parse(s,r)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,t,r,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const Le={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=Le.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let r=t.cache.get(s);if(r)return r;const A=t.json,l=((A.extensions&&A.extensions[this.name]||{}).lights||[])[e];let h;const c=new o.Ilk(16777215);void 0!==l.color&&c.setRGB(l.color[0],l.color[1],l.color[2],o.GUF);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":h=new o.Ox3(c),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new o.cek(c),h.distance=d;break;case"spot":h=new o.PMe(c),h.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,h.angle=l.spot.outerConeAngle,h.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return h.position.set(0,0,0),h.decay=2,assignExtrasToUserData(h,l),void 0!==l.intensity&&(h.intensity=l.intensity),h.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(h),t.cache.add(s,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,r=s.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return s._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=Le.KHR_MATERIALS_UNLIT}getMaterialType(){return o.vBJ}extendParams(e,t,s){const r=[];e.color=new o.Ilk(1,1,1),e.opacity=1;const A=t.pbrMetallicRoughness;if(A){if(Array.isArray(A.baseColorFactor)){const t=A.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],o.GUF),e.opacity=t[3]}void 0!==A.baseColorTexture&&r.push(s.assignTexture(e,"map",A.baseColorTexture,o.KI_))}return Promise.all(r)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&A.push(s.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&A.push(s.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(A.push(s.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new o.FM8(e,e)}return Promise.all(A)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.iridescenceFactor&&(t.iridescence=A.iridescenceFactor),void 0!==A.iridescenceTexture&&o.push(s.assignTexture(t,"iridescenceMap",A.iridescenceTexture)),void 0!==A.iridescenceIor&&(t.iridescenceIOR=A.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==A.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=A.iridescenceThicknessMinimum),void 0!==A.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=A.iridescenceThicknessMaximum),void 0!==A.iridescenceThicknessTexture&&o.push(s.assignTexture(t,"iridescenceThicknessMap",A.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[];t.sheenColor=new o.Ilk(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=r.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],o.GUF)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&A.push(s.assignTexture(t,"sheenColorMap",l.sheenColorTexture,o.KI_)),void 0!==l.sheenRoughnessTexture&&A.push(s.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(A)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.transmissionFactor&&(t.transmission=A.transmissionFactor),void 0!==A.transmissionTexture&&o.push(s.assignTexture(t,"transmissionMap",A.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&A.push(s.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const h=l.attenuationColor||[1,1,1];return t.attenuationColor=(new o.Ilk).setRGB(h[0],h[1],h[2],o.GUF),Promise.all(A)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&A.push(s.assignTexture(t,"specularIntensityMap",l.specularTexture));const h=l.specularColorFactor||[1,1,1];return t.specularColor=(new o.Ilk).setRGB(h[0],h[1],h[2],o.GUF),void 0!==l.specularColorTexture&&A.push(s.assignTexture(t,"specularColorMap",l.specularColorTexture,o.KI_)),Promise.all(A)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=Le.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return t.bumpScale=void 0!==A.bumpFactor?A.bumpFactor:1,void 0!==A.bumpTexture&&o.push(s.assignTexture(t,"bumpMap",A.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.anisotropyStrength&&(t.anisotropy=A.anisotropyStrength),void 0!==A.anisotropyRotation&&(t.anisotropyRotation=A.anisotropyRotation),void 0!==A.anisotropyTexture&&o.push(s.assignTexture(t,"anisotropyMap",A.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=Le.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,r=s.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const o=r.extensions[this.name],A=t.options.ktx2Loader;if(!A){if(s.extensionsRequired&&s.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,A)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=Le.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.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=Le.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.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=Le.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],r=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 r.then((function(t){const s=e.byteOffset||0,r=e.byteLength||0,A=e.count,l=e.byteStride,h=new Uint8Array(t,s,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,l,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(A*l);return o.decodeGltfBuffer(new Uint8Array(t),A,l,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=Le.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;const r=t.meshes[s.mesh];for(const e of r.primitives)if(e.mode!==Ge.TRIANGLES&&e.mode!==Ge.TRIANGLE_STRIP&&e.mode!==Ge.TRIANGLE_FAN&&void 0!==e.mode)return null;const A=s.extensions[this.name].attributes,l=[],h={};for(const e in A)l.push(this.parser.getDependency("accessor",A[e]).then((t=>(h[e]=t,h[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),s=t.isGroup?t.children:[t],r=e[0].count,A=[];for(const e of s){const t=new o.yGw,s=new o.Pa4,l=new o._fP,c=new o.Pa4(1,1,1),d=new o.SPe(e.geometry,e.material,r);for(let e=0;e<r;e++)h.TRANSLATION&&s.fromBufferAttribute(h.TRANSLATION,e),h.ROTATION&&l.fromBufferAttribute(h.ROTATION,e),h.SCALE&&c.fromBufferAttribute(h.SCALE,e),d.setMatrixAt(e,t.compose(s,l,c));for(const t in h)if("_COLOR_0"===t){const e=h[t];d.instanceColor=new o.lb7(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,h[t]);o.Tme.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),A.push(d)}return t.isGroup?(t.clear(),t.add(...A),t):A[0]})))}}const Fe="glTF",ke=1313821514,_e=5130562;class GLTFBinaryExtension{constructor(e){this.name=Le.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Fe)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,o=new DataView(e,12);let A=0;for(;A<r;){const t=o.getUint32(A,!0);A+=4;const r=o.getUint32(A,!0);if(A+=4,r===ke){const r=new Uint8Array(e,12+A,t);this.content=s.decode(r)}else if(r===_e){const s=12+A;this.body=e.slice(s,s+t)}A+=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=Le.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,r=this.dracoLoader,A=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,h={},c={},d={};for(const e in l){const t=Ve[e]||e.toLowerCase();h[t]=l[e]}for(const t in e.attributes){const r=Ve[t]||t.toLowerCase();if(void 0!==l[t]){const o=s.accessors[e.attributes[t]],A=Ne[o.componentType];d[r]=A.name,c[r]=!0===o.normalized}}return t.getDependency("bufferView",A).then((function(e){return new Promise((function(t,s){r.decodeDracoFile(e,(function(e){for(const t in e.attributes){const s=e.attributes[t],r=c[t];void 0!==r&&(s.normalized=r)}t(e)}),h,d,o.GUF,s)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=Le.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=Le.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends o._C8{constructor(e,t,s,r){super(e,t,s,r)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,r=this.valueSize,o=e*r*3+r;for(let e=0;e!==r;e++)t[e]=s[o+e];return t}interpolate_(e,t,s,r){const o=this.resultBuffer,A=this.sampleValues,l=this.valueSize,h=2*l,c=3*l,d=r-t,g=(s-t)/d,p=g*g,m=p*g,f=e*c,I=f-c,E=-2*m+3*p,C=m-p,B=1-E,y=C-p+g;for(let e=0;e!==l;e++){const t=A[I+e+l],s=A[I+e+h]*d,r=A[f+e+l],c=A[f+e]*d;o[e]=B*t+y*s+E*r+C*c}return o}}const Ue=new o._fP;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,s,r){const o=super.interpolate_(e,t,s,r);return Ue.fromArray(o).normalize().toArray(o),o}}const Ge={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},Ne={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Pe={9728:o.TyD,9729:o.wem,9984:o.YLQ,9985:o.qyh,9986:o.aH4,9987:o.D1R},Oe={33071:o.uWy,33648:o.OoA,10497:o.rpg},He={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ve={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"},qe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ke={CUBICSPLINE:void 0,LINEAR:o.NMF,STEP:o.Syv},Je="OPAQUE",ze="MASK",Ye="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new o.Wid({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:o.Wl3})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,s){for(const r in s.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=s.extensions[r])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):De.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,r=t.weights.length;s<r;s++)e.morphTargetInfluences[s]=t.weights[s];if(t.extras&&Array.isArray(t.extras.targetNames)){const s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(let t=0,r=s.length;t<r;t++)e.morphTargetDictionary[s[t]]=t}else De.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const s=e.extensions&&e.extensions[Le.KHR_DRACO_MESH_COMPRESSION];if(t=s?"draco:"+s.bufferView+":"+s.indices+":"+createAttributesKey(s.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let s=0,r=e.targets.length;s<r;s++)t+=":"+createAttributesKey(e.targets[s]);return t}function createAttributesKey(e){let t="";const s=Object.keys(e).sort();for(let r=0,o=s.length;r<o;r++)t+=s[r]+":"+e[s[r]]+";";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 je=new o.yGw;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 s=!1,r=!1,A=-1;"undefined"!=typeof navigator&&(s=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=navigator.userAgent.indexOf("Firefox")>-1,A=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||s||r&&A<98?this.textureLoader=new o.dpR(this.options.manager):this.textureLoader=new o.QRU(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new o.hH6(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 s=this,r=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([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])})).then((function(t){const A={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:s,userData:{}};return addUnknownExtensionsToUserData(o,A,r),assignExtrasToUserData(A,r),Promise.all(s._invokeAll((function(e){return e.afterRoot&&e.afterRoot(A)}))).then((function(){for(const e of A.scenes)e.updateMatrixWorld();e(A)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s].joints;for(let t=0,s=r.length;t<s;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){const r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(s[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.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,s){if(e.refs[t]<=1)return s;const r=s.clone(),updateMappings=(e,t)=>{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,r]of e.children.entries())updateMappings(r,t.children[s])};return updateMappings(s,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const r=e(t[s]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let r=0;r<t.length;r++){const o=e(t[r]);o&&s.push(o)}return s}getDependency(e,t){const s=e+":"+t;let r=this.cache.get(s);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne((function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)})),!r)throw new Error("Unknown type: "+e)}this.cache.add(s,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return s.getDependency(e,r)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=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[Le.KHR_BINARY_GLTF].body);const r=this.options;return new Promise((function(e,A){s.load(o.Zp0.resolveURL(t.uri,r.path),e,void 0,(function(){A(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 s=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+s)}))}loadAccessor(e){const t=this,s=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){const e=He[r.type],t=Ne[r.componentType],s=!0===r.normalized,A=new t(r.count*e);return Promise.resolve(new o.TlE(A,e,s))}const A=[];return void 0!==r.bufferView?A.push(this.getDependency("bufferView",r.bufferView)):A.push(null),void 0!==r.sparse&&(A.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),A.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(A).then((function(e){const A=e[0],l=He[r.type],h=Ne[r.componentType],c=h.BYTES_PER_ELEMENT,d=c*l,g=r.byteOffset||0,p=void 0!==r.bufferView?s.bufferViews[r.bufferView].byteStride:void 0,m=!0===r.normalized;let f,I;if(p&&p!==d){const e=Math.floor(g/p),s="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count;let d=t.cache.get(s);d||(f=new h(A,e*p,r.count*p/c),d=new o.vpT(f,p/c),t.cache.add(s,d)),I=new o.kB5(d,l,g%p/c,m)}else f=null===A?new h(r.count*l):new h(A,g,r.count*l),I=new o.TlE(f,l,m);if(void 0!==r.sparse){const t=He.SCALAR,s=Ne[r.sparse.indices.componentType],c=r.sparse.indices.byteOffset||0,d=r.sparse.values.byteOffset||0,g=new s(e[1],c,r.sparse.count*t),p=new h(e[2],d,r.sparse.count*l);null!==A&&(I=new o.TlE(I.array.slice(),I.itemSize,I.normalized));for(let e=0,t=g.length;e<t;e++){const t=g[e];if(I.setX(t,p[e*l]),l>=2&&I.setY(t,p[e*l+1]),l>=3&&I.setZ(t,p[e*l+2]),l>=4&&I.setW(t,p[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return I}))}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,o=t.images[r];let A=this.textureLoader;if(o.uri){const e=s.manager.getHandler(o.uri);null!==e&&(A=e)}return this.loadTextureImage(e,r,A)}loadTextureImage(e,t,s){const r=this,A=this.json,l=A.textures[e],h=A.images[t],c=(h.uri||h.bufferView)+":"+l.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,s).then((function(t){t.flipY=!1,t.name=l.name||h.name||"",""===t.name&&"string"==typeof h.uri&&!1===h.uri.startsWith("data:image/")&&(t.name=h.uri);const s=(A.samplers||{})[l.sampler]||{};return t.magFilter=Pe[s.magFilter]||o.wem,t.minFilter=Pe[s.minFilter]||o.D1R,t.wrapS=Oe[s.wrapS]||o.rpg,t.wrapT=Oe[s.wrapT]||o.rpg,r.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[c]=d,d}loadImageSource(e,t){const s=this,r=this.json,A=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=r.images[e],h=self.URL||self.webkitURL;let c=l.uri||"",d=!1;if(void 0!==l.bufferView)c=s.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return c=h.createObjectURL(t),c}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const g=Promise.resolve(c).then((function(e){return new Promise((function(s,r){let l=s;!0===t.isImageBitmapLoader&&(l=function(e){const t=new o.xEZ(e);t.needsUpdate=!0,s(t)}),t.load(o.Zp0.resolveURL(e,A.path),l,void 0,r)}))})).then((function(e){return!0===d&&h.revokeObjectURL(c),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 De.error("THREE.GLTFLoader: Couldn't load texture",c),e}));return this.sourceCache[e]=g,g}assignTexture(e,t,s,r){const o=this;return this.getDependency("texture",s.index).then((function(A){if(!A)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((A=A.clone()).channel=s.texCoord),o.extensions[Le.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[Le.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(A);A=o.extensions[Le.KHR_TEXTURE_TRANSFORM].extendTexture(A,e),o.associations.set(A,t)}}return void 0!==r&&(A.colorSpace=r),e[t]=A,A}))}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const r=void 0===t.attributes.tangent,A=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.UY4,o.F5T.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){const e="LineBasicMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.nls,o.F5T.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,this.cache.add(e,t)),s=t}if(r||A||l){let e="ClonedMaterial:"+s.uuid+":";r&&(e+="derivative-tangents:"),A&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),A&&(t.vertexColors=!0),l&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}e.material=s}getMaterialType(){return o.Wid}loadMaterial(e){const t=this,s=this.json,r=this.extensions,A=s.materials[e];let l;const h={},c=[];if((A.extensions||{})[Le.KHR_MATERIALS_UNLIT]){const e=r[Le.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),c.push(e.extendParams(h,A,t))}else{const s=A.pbrMetallicRoughness||{};if(h.color=new o.Ilk(1,1,1),h.opacity=1,Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;h.color.setRGB(e[0],e[1],e[2],o.GUF),h.opacity=e[3]}void 0!==s.baseColorTexture&&c.push(t.assignTexture(h,"map",s.baseColorTexture,o.KI_)),h.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,h.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(c.push(t.assignTexture(h,"metalnessMap",s.metallicRoughnessTexture)),c.push(t.assignTexture(h,"roughnessMap",s.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,h)}))))}!0===A.doubleSided&&(h.side=o.ehD);const d=A.alphaMode||Je;if(d===Ye?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,d===ze&&(h.alphaTest=void 0!==A.alphaCutoff?A.alphaCutoff:.5)),void 0!==A.normalTexture&&l!==o.vBJ&&(c.push(t.assignTexture(h,"normalMap",A.normalTexture)),h.normalScale=new o.FM8(1,1),void 0!==A.normalTexture.scale)){const e=A.normalTexture.scale;h.normalScale.set(e,e)}if(void 0!==A.occlusionTexture&&l!==o.vBJ&&(c.push(t.assignTexture(h,"aoMap",A.occlusionTexture)),void 0!==A.occlusionTexture.strength&&(h.aoMapIntensity=A.occlusionTexture.strength)),void 0!==A.emissiveFactor&&l!==o.vBJ){const e=A.emissiveFactor;h.emissive=(new o.Ilk).setRGB(e[0],e[1],e[2],o.GUF)}return void 0!==A.emissiveTexture&&l!==o.vBJ&&c.push(t.assignTexture(h,"emissiveMap",A.emissiveTexture,o.KI_)),Promise.all(c).then((function(){const s=new l(h);return A.name&&(s.name=A.name),assignExtrasToUserData(s,A),t.associations.set(s,{materials:e}),A.extensions&&addUnknownExtensionsToUserData(r,s,A),s}))}createUniqueName(e){const t=o.iUV.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,r=this.primitiveCache;function createDracoPrimitive(e){return s[Le.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(s){return addPrimitiveAttributes(s,e,t)}))}const A=[];for(let s=0,l=e.length;s<l;s++){const l=e[s],h=createPrimitiveKey(l),c=r[h];if(c)A.push(c.promise);else{let e;e=l.extensions&&l.extensions[Le.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new o.u9r,l,t),r[h]={primitive:l,promise:e},A.push(e)}}return Promise.all(A)}loadMesh(e){const t=this,s=this.json,r=this.extensions,A=s.meshes[e],l=A.primitives,h=[];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);h.push(t)}return h.push(t.loadGeometries(l)),Promise.all(h).then((function(s){const h=s.slice(0,s.length-1),c=s[s.length-1],d=[];for(let s=0,g=c.length;s<g;s++){const g=c[s],p=l[s];let m;const f=h[s];if(p.mode===Ge.TRIANGLES||p.mode===Ge.TRIANGLE_STRIP||p.mode===Ge.TRIANGLE_FAN||void 0===p.mode)m=!0===A.isSkinnedMesh?new o.TUv(g,f):new o.Kj0(g,f),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),p.mode===Ge.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,o.UlW):p.mode===Ge.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,o.z$h));else if(p.mode===Ge.LINES)m=new o.ejS(g,f);else if(p.mode===Ge.LINE_STRIP)m=new o.x12(g,f);else if(p.mode===Ge.LINE_LOOP)m=new o.blk(g,f);else{if(p.mode!==Ge.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);m=new o.woe(g,f)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,A),m.name=t.createUniqueName(A.name||"mesh_"+e),assignExtrasToUserData(m,A),p.extensions&&addUnknownExtensionsToUserData(r,m,p),t.assignFinalMaterial(m),d.push(m)}for(let s=0,r=d.length;s<r;s++)t.associations.set(d[s],{meshes:e,primitives:s});if(1===d.length)return A.extensions&&addUnknownExtensionsToUserData(r,d[0],A),d[0];const g=new o.ZAu;A.extensions&&addUnknownExtensionsToUserData(r,g,A),t.associations.set(g,{meshes:e});for(let e=0,t=d.length;e<t;e++)g.add(d[e]);return g}))}loadCamera(e){let t;const s=this.json.cameras[e],r=s[s.type];if(r)return"perspective"===s.type?t=new o.cPb(o.M8C.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===s.type&&(t=new o.iKG(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),assignExtrasToUserData(t,s),Promise.resolve(t);De.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],s=[];for(let e=0,r=t.joints.length;e<r;e++)s.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then((function(e){const s=e.pop(),r=e,A=[],l=[];for(let e=0,h=r.length;e<h;e++){const h=r[e];if(h){A.push(h);const t=new o.yGw;null!==s&&t.fromArray(s.array,16*e),l.push(t)}else De.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new o.OdW(A,l)}))}loadAnimation(e){const t=this.json,s=this,r=t.animations[e],A=r.name?r.name:"animation_"+e,l=[],h=[],c=[],d=[],g=[];for(let e=0,t=r.channels.length;e<t;e++){const t=r.channels[e],s=r.samplers[t.sampler],o=t.target,A=o.node,p=void 0!==r.parameters?r.parameters[s.input]:s.input,m=void 0!==r.parameters?r.parameters[s.output]:s.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),h.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",m)),d.push(s),g.push(o))}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c),Promise.all(d),Promise.all(g)]).then((function(e){const t=e[0],r=e[1],l=e[2],h=e[3],c=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],A=r[e],g=l[e],p=h[e],m=c[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=s._createAnimationTracks(o,A,g,p,m);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new o.m7l(A,void 0,d)}))}createNodeMesh(e){const t=this.json,s=this,r=t.nodes[e];return void 0===r.mesh?null:s.getDependency("mesh",r.mesh).then((function(e){const t=s._getNodeRef(s.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,s=r.weights.length;t<s;t++)e.morphTargetInfluences[t]=r.weights[t]})),t}))}loadNode(e){const t=this,s=this.json.nodes[e],r=t._loadNodeShallow(e),o=[],A=s.children||[];for(let e=0,s=A.length;e<s;e++)o.push(t.getDependency("node",A[e]));const l=void 0===s.skin?Promise.resolve(null):t.getDependency("skin",s.skin);return Promise.all([r,Promise.all(o),l]).then((function(e){const t=e[0],s=e[1],r=e[2];null!==r&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(r,je)}));for(let e=0,r=s.length;e<r;e++)t.add(s[e]);return t}))}_loadNodeShallow(e){const t=this.json,s=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const A=t.nodes[e],l=A.name?r.createUniqueName(A.name):"",h=[],c=r._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return c&&h.push(c),void 0!==A.camera&&h.push(r.getDependency("camera",A.camera).then((function(e){return r._getNodeRef(r.cameraCache,A.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){h.push(e)})),this.nodeCache[e]=Promise.all(h).then((function(t){let h;if(h=!0===A.isBone?new o.N$j:t.length>1?new o.ZAu:1===t.length?t[0]:new o.Tme,h!==t[0])for(let e=0,s=t.length;e<s;e++)h.add(t[e]);if(A.name&&(h.userData.name=A.name,h.name=l),assignExtrasToUserData(h,A),A.extensions&&addUnknownExtensionsToUserData(s,h,A),void 0!==A.matrix){const e=new o.yGw;e.fromArray(A.matrix),h.applyMatrix4(e)}else void 0!==A.translation&&h.position.fromArray(A.translation),void 0!==A.rotation&&h.quaternion.fromArray(A.rotation),void 0!==A.scale&&h.scale.fromArray(A.scale);return r.associations.has(h)||r.associations.set(h,{}),r.associations.get(h).nodes=e,h})),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],r=this,A=new o.ZAu;s.name&&(A.name=r.createUniqueName(s.name)),assignExtrasToUserData(A,s),s.extensions&&addUnknownExtensionsToUserData(t,A,s);const l=s.nodes||[],h=[];for(let e=0,t=l.length;e<t;e++)h.push(r.getDependency("node",l[e]));return Promise.all(h).then((function(e){for(let t=0,s=e.length;t<s;t++)A.add(e[t]);return r.associations=(e=>{const t=new Map;for(const[e,s]of r.associations)(e instanceof o.F5T||e instanceof o.xEZ)&&t.set(e,s);return e.traverse((e=>{const s=r.associations.get(e);null!=s&&t.set(e,s)})),t})(A),A}))}_createAnimationTracks(e,t,s,r,A){const l=[],h=e.name?e.name:e.uuid,c=[];let d;switch(qe[A.path]===qe.weights?e.traverse((function(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)})):c.push(h),qe[A.path]){case qe.weights:d=o.dUE;break;case qe.rotation:d=o.iLg;break;case qe.position:case qe.scale:d=o.yC1;break;default:if(1===s.itemSize)d=o.dUE;else d=o.yC1}const g=void 0!==r.interpolation?Ke[r.interpolation]:o.NMF,p=this._getArrayFromAccessor(s);for(let e=0,s=c.length;e<s;e++){const s=new d(c[e]+"."+qe[A.path],t.array,p,g);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(s),l.push(s)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r<o;r++)s[r]=t[r]*e;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof o.iLg?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,s){const r=t.attributes,A=[];function assignAttributeAccessor(t,r){return s.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(const t in r){const s=Ve[t]||t.toLowerCase();s in e.attributes||A.push(assignAttributeAccessor(r[t],s))}if(void 0!==t.indices&&!e.index){const r=s.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));A.push(r)}return o.epp.workingColorSpace!==o.GUF&&"COLOR_0"in r&&De.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${o.epp.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,s){const r=t.attributes,A=new o.ZzF;if(void 0===r.POSITION)return;{const e=s.json.accessors[r.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void De.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(A.set(new o.Pa4(t[0],t[1],t[2]),new o.Pa4(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(Ne[e.componentType]);A.min.multiplyScalar(t),A.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new o.Pa4,t=new o.Pa4;for(let r=0,o=l.length;r<o;r++){const o=l[r];if(void 0!==o.POSITION){const r=s.json.accessors[o.POSITION],A=r.min,l=r.max;if(void 0!==A&&void 0!==l){if(t.setX(Math.max(Math.abs(A[0]),Math.abs(l[0]))),t.setY(Math.max(Math.abs(A[1]),Math.abs(l[1]))),t.setZ(Math.max(Math.abs(A[2]),Math.abs(l[2]))),r.normalized){const e=getNormalizedComponentScale(Ne[r.componentType]);t.multiplyScalar(e)}e.max(t)}else De.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}A.expandByVector(e)}e.boundingBox=A;const h=new o.aLr;A.getCenter(h.center),h.radius=A.min.distanceTo(A.max)/2,e.boundingSphere=h}(e,t,s),Promise.all(A).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,s){let r=!1,o=!1,A=!1;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(o=!0),void 0!==s.COLOR_0&&(A=!0),r&&o&&A)break}if(!r&&!o&&!A)return Promise.resolve(e);const l=[],h=[],c=[];for(let d=0,g=t.length;d<g;d++){const g=t[d];if(r){const t=void 0!==g.POSITION?s.getDependency("accessor",g.POSITION):e.attributes.position;l.push(t)}if(o){const t=void 0!==g.NORMAL?s.getDependency("accessor",g.NORMAL):e.attributes.normal;h.push(t)}if(A){const t=void 0!==g.COLOR_0?s.getDependency("accessor",g.COLOR_0):e.attributes.color;c.push(t)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(t){const s=t[0],l=t[1],h=t[2];return r&&(e.morphAttributes.position=s),o&&(e.morphAttributes.normal=l),A&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,s):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 s=this.workersResolve[e];if(s&&s(t),this.queue.length){const{resolve:t,msg:s,transfer:r}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(s,r)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((s=>{const r=this._getIdleWorker();-1!==r?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=s,this.workers[r].postMessage(e,t)):this.queue.push({resolve:s,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 $e=s(48764).Buffer;const We=9,Xe=15,Ze=16,et=22,tt=37,it=43,st=76,nt=83,rt=97,at=100,ot=103,At=109,lt=165,ht=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,s,r){this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=r,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 s=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,r)}}new Uint8Array([0]);const ct=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):$e.from(e).toString("utf8")}var ut=s(48764).Buffer;let dt,gt,pt;const mt={env:{emscripten_notify_memory_growth:function(e){pt=new Uint8Array(gt.exports.memory.buffer)}}};class zstddec_module_Q{init(){return dt||(dt="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+ft).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,mt))).then(this._init):WebAssembly.instantiate(ut.from(ft,"base64"),mt).then(this._init),dt)}_init(e){gt=e.instance,mt.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!gt)throw new Error("ZSTDDecoder: Await .init() before decoding.");const s=e.byteLength,r=gt.exports.malloc(s);pt.set(e,r),t=t||Number(gt.exports.ZSTD_findDecompressedSize(r,s));const o=gt.exports.malloc(t),A=gt.exports.ZSTD_decompress(o,t,r,s),l=pt.slice(o,o+A);return gt.exports.free(r),gt.exports.free(o),l}}const ft="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/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAA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gsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0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0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECI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AkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DA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AAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/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 It=s(25108);const Et=new WeakMap;let Ct,Bt=0;class KTX2Loader extends o.aNw{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&&It.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 o.hH6(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),s=new o.hH6(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const r=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then((([e,t])=>{const s=KTX2Loader.BasisWorker.toString(),r=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r])),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}))})),Bt>0&&It.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Bt++}return this.transcoderPending}load(e,t,s,r){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const A=new o.hH6(this.manager);A.setResponseType("arraybuffer"),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{if(Et.has(e)){return Et.get(e).promise.then(t).catch(r)}this._createTexture(e).then((e=>t?t(e):null)).catch(r)}),s,r)}_createTextureFrom(e,t){const{faces:s,width:r,height:A,format:l,type:h,error:c,dfdFlags:d}=e;if("error"===h)return Promise.reject(c);let g;if(6===t.faceCount)g=new o.qVC(s,l,o.ywz);else{const e=s[0].mipmaps;g=t.layerCount>1?new o.Z_g(e,r,A,t.layerCount,l,o.ywz):new o.EB7(e,r,A,l,o.ywz)}return g.minFilter=1===s[0].mipmaps.length?o.wem:o.D1R,g.magFilter=o.wem,g.generateMipmaps=!1,g.needsUpdate=!0,g.colorSpace=parseColorSpace(t),g.premultiplyAlpha=!!(1&d),g}async _createTexture(e,t={}){const s=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,ct.length);if(t[0]!==ct[0]||t[1]!==ct[1]||t[2]!==ct[2]||t[3]!==ct[3]||t[4]!==ct[4]||t[5]!==ct[5]||t[6]!==ct[6]||t[7]!==ct[7]||t[8]!==ct[8]||t[9]!==ct[9]||t[10]!==ct[10]||t[11]!==ct[11])throw new Error("Missing KTX 2.0 identifier.");const s=new Si,r=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,ct.length,r,!0);s.vkFormat=o._nextUint32(),s.typeSize=o._nextUint32(),s.pixelWidth=o._nextUint32(),s.pixelHeight=o._nextUint32(),s.pixelDepth=o._nextUint32(),s.layerCount=o._nextUint32(),s.faceCount=o._nextUint32();const A=o._nextUint32();s.supercompressionScheme=o._nextUint32();const l=o._nextUint32(),h=o._nextUint32(),c=o._nextUint32(),d=o._nextUint32(),g=o._nextUint64(),p=o._nextUint64(),m=new Ii(e,ct.length+r,3*A*8,!0);for(let t=0;t<A;t++)s.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+m._nextUint64(),m._nextUint64()),uncompressedByteLength:m._nextUint64()});const f=new Ii(e,l,h,!0),I={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:[]},E=(I.descriptorBlockSize/4-6)/4;for(let e=0;e<E;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()),I.samples[e]=t}s.dataFormatDescriptor.length=0,s.dataFormatDescriptor.push(I);const C=new Ii(e,c,d,!0);for(;C._offset<d;){const e=C._nextUint32(),t=C._scan(e),r=Ei(t),o=C._scan(e-t.byteLength);s.keyValue[r]=r.match(/^ktx/i)?Ei(o):o,C._offset%4&&C._skip(4-C._offset%4)}if(p<=0)return s;const B=new Ii(e,g,p,!0),y=B._nextUint16(),Q=B._nextUint16(),x=B._nextUint32(),b=B._nextUint32(),S=B._nextUint32(),T=B._nextUint32(),F=[];for(let e=0;e<A;e++)F.push({imageFlags:B._nextUint32(),rgbSliceByteOffset:B._nextUint32(),rgbSliceByteLength:B._nextUint32(),alphaSliceByteOffset:B._nextUint32(),alphaSliceByteLength:B._nextUint32()});const _=g+B._offset,U=_+x,G=U+b,O=G+S,q=new Uint8Array(e.buffer,e.byteOffset+_,x),K=new Uint8Array(e.buffer,e.byteOffset+U,b),J=new Uint8Array(e.buffer,e.byteOffset+G,S),Y=new Uint8Array(e.buffer,e.byteOffset+O,T);return s.globalData={endpointCount:y,selectorCount:Q,imageDescs:F,endpointsData:q,selectorsData:K,tablesData:J,extendedData:Y},s}(new Uint8Array(e));if(0!==s.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===wt[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let s;2===e.supercompressionScheme&&(Ct||(Ct=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),s=await Ct);const r=[];for(let A=0;A<e.levels.length;A++){const l=Math.max(1,e.pixelWidth>>A),h=Math.max(1,e.pixelHeight>>A),c=e.pixelDepth?Math.max(1,e.pixelDepth>>A):0,d=e.levels[A];let g,p;if(0===e.supercompressionScheme)g=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");g=s.decode(d.levelData,d.uncompressedByteLength)}p=vt[t]===o.VzW?new Float32Array(g.buffer,g.byteOffset,g.byteLength/Float32Array.BYTES_PER_ELEMENT):vt[t]===o.cLu?new Uint16Array(g.buffer,g.byteOffset,g.byteLength/Uint16Array.BYTES_PER_ELEMENT):g,r.push({data:p,width:l,height:h,depth:c})}let A;if(yt.has(wt[t]))A=0===e.pixelDepth?new o.IEO(r[0].data,e.pixelWidth,e.pixelHeight):new o.JUT(r[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");A=new o.EB7(r,e.pixelWidth,e.pixelHeight)}return A.mipmaps=r,A.type=vt[t],A.format=wt[t],A.colorSpace=parseColorSpace(e),A.needsUpdate=!0,Promise.resolve(A)}(s);const r=t,A=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e]))).then((e=>this._createTextureFrom(e.data,s)));return Et.set(e,{promise:A}),A}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Bt--,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:o.wk1,RGBA_ASTC_4x4_Format:o.ptH,RGBA_BPTC_Format:o.bsb,RGBA_ETC2_EAC_Format:o.ekQ,RGBA_PVRTC_4BPPV1_Format:o.eaV,RGBA_S3TC_DXT5_Format:o.ILR,RGB_ETC1_Format:o.fto,RGB_ETC2_Format:o.l0P,RGB_PVRTC_4BPPV1_Format:o._AM,RGB_S3TC_DXT1_Format:o.wuA},KTX2Loader.BasisWorker=function(){let e,t,s;const r=_EngineFormat,o=_TranscoderFormat,A=_BasisFormat;self.addEventListener("message",(function(l){const d=l.data;switch(d.type){case"init":e=d.config,function init(e){t=new Promise((t=>{s={wasmBinary:e,onRuntimeInitialized:t},BASIS(s)})).then((()=>{s.initializeBasis(),void 0===s.KTX2File&&It.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(d.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:l,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I}=function transcode(t){const l=new s.KTX2File(new Uint8Array(t));function cleanup(){l.close(),l.delete()}if(!l.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const d=l.isUASTC()?A.UASTC_4x4:A.ETC1S,g=l.getWidth(),p=l.getHeight(),m=l.getLayers()||1,f=l.getLevels(),I=l.getFaces(),E=l.getHasAlpha(),C=l.getDFDFlags(),{transcoderFormat:B,engineFormat:y}=function getTranscoderFormat(t,s,l,d){let g,p;const m=t===A.ETC1S?h:c;for(let r=0;r<m.length;r++){const o=m[r];if(e[o.if]&&(o.basisFormat.includes(t)&&!(d&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(s)&&isPowerOfTwo(l))))return g=o.transcoderFormat[d?1:0],p=o.engineFormat[d?1:0],{transcoderFormat:g,engineFormat:p}}return It.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),g=o.RGBA32,p=r.RGBAFormat,{transcoderFormat:g,engineFormat:p}}(d,g,p,E);if(!g||!p||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!l.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const Q=[],x=[];for(let e=0;e<I;e++){const t=[];for(let s=0;s<f;s++){const r=[];let o,A;for(let t=0;t<m;t++){const h=l.getImageLevelInfo(s,t,e);0!==e||0!==s||0!==t||h.origWidth%4==0&&h.origHeight%4==0||It.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,A=h.origHeight):(o=h.width,A=h.height);const c=new Uint8Array(l.getImageTranscodedSizeInBytes(s,t,0,B));if(!l.transcodeImage(c,s,t,e,B,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");r.push(c)}const h=concat(r);t.push({data:h,width:o,height:A}),x.push(h.buffer)}Q.push({mipmaps:t,width:g,height:p,format:y})}return cleanup(),{faces:Q,buffers:x,width:g,height:p,hasAlpha:E,format:y,dfdFlags:C}}(d.buffer);self.postMessage({type:"transcode",id:d.id,faces:t,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I},l)}catch(e){It.error(e),self.postMessage({type:"error",id:d.id,error:e.message})}}))}}));const l=[{if:"astcSupported",basisFormat:[A.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[r.RGB_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[r.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=l.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),c=l.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 s=0;s<e.length;s++){t+=e[s].byteLength}const s=new Uint8Array(t);let r=0;for(let t=0;t<e.length;t++){const o=e[t];s.set(o,r),r+=o.byteLength}return s}};const yt=new Set([o.wk1,o.av9,o.hEm]),wt={[At]:o.wk1,[rt]:o.wk1,[tt]:o.wk1,[it]:o.wk1,[ot]:o.av9,[nt]:o.av9,[Ze]:o.av9,[et]:o.av9,[at]:o.hEm,[st]:o.hEm,[Xe]:o.hEm,[We]:o.hEm,[ht]:o.Djp,[lt]:o.Djp},vt={[At]:o.VzW,[rt]:o.cLu,[tt]:o.ywz,[it]:o.ywz,[ot]:o.VzW,[nt]:o.cLu,[Ze]:o.ywz,[et]:o.ywz,[at]:o.VzW,[st]:o.cLu,[Xe]:o.ywz,[We]:o.ywz,[ht]:o.ywz,[lt]:o.ywz};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?o.KI_:o.GUF:10===t.colorPrimaries?2===t.transferFunction?o.ntt:o.AmZ:(0===t.colorPrimaries||It.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),o.aCh)}var Qt,xt;const bt=Symbol("retainerCount"),St=Symbol("recentlyUsed"),Mt=Symbol("evict"),Tt=Symbol("evictionThreshold"),Rt=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[Qt]=new Map,this[xt]=[],this[Rt]=e,this[Tt]=t}set evictionThreshold(e){this[Tt]=e,this[Mt]()}get evictionThreshold(){return this[Tt]}get cache(){return this[Rt]}retainerCount(e){return this[bt].get(e)||0}reset(){this[bt].clear(),this[St]=[]}retain(e){this[bt].has(e)||this[bt].set(e,0),this[bt].set(e,this[bt].get(e)+1);const t=this[St].indexOf(e);-1!==t&&this[St].splice(t,1),this[St].unshift(e),this[Mt]()}release(e){this[bt].has(e)&&this[bt].set(e,Math.max(this[bt].get(e)-1,0)),this[Mt]()}[(Qt=bt,xt=St,Mt)](){if(!(this[St].length<this[Tt]))for(let e=this[St].length-1;e>=this[Tt];--e){const t=this[St][e];0===this[bt].get(t)&&(this[Rt].delete(t),this[St].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const s of e.mappings)for(const e of s.variants)t.set(e,{material:null,gltfMaterialIndex:s.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,s=t.json;if(void 0===s.extensions||void 0===s.extensions[this.name])return null;const r=(e=>{const t=[],s=new Set;for(const r of e){let e=r,o=0;for(;s.has(e);)e=r+"."+ ++o;s.add(e),t.push(e)}return t})((s.extensions[this.name].variants||[]).map((e=>e.name)));for(const r of e.scenes)r.traverse((e=>{const r=e;if(!r.material)return;const o=t.associations.get(r);if(null==o||null==o.meshes||null==o.primitives)return;const A=s.meshes[o.meshes].primitives[o.primitives].extensions;A&&A[this.name]&&(r.userData.variantMaterials=mappingsArrayToTable(A[this.name]))}));return e.userData.variants=r,Promise.resolve()}}var Dt,Lt,Ft=s(25108);o.xEZ.DEFAULT_ANISOTROPY=4;const kt=new Map,_t=new Map;let Ut;const Gt=new DRACOLoader;let Nt;const Pt=new KTX2Loader;let Ot,Ht;const Vt=Symbol("loader"),qt=Symbol("evictionPolicy"),Kt=Symbol("GLTFInstance");class CachingGLTFLoader extends o.pBf{constructor(e){super(),this[Lt]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[Kt]=e,this[Vt].setDRACOLoader(Gt),this[Vt].setKTX2Loader(Pt)}static setDRACODecoderLocation(e){Ut=e,Gt.setDecoderPath(e)}static getDRACODecoderLocation(){return Ut}static setKTX2TranscoderLocation(e){Nt=e,Pt.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Nt}static setMeshoptDecoderLocation(e){var t;Ot!==e&&(Ot=e,Ht=(t=e,new Promise(((e,s)=>{const r=document.createElement("script");document.body.appendChild(r),r.onload=e,r.onerror=s,r.async=!0,r.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return Ot}static initializeKTX2Loader(e){Pt.detectSupport(e)}static get cache(){return kt}static clearCache(){kt.forEach(((e,t)=>{this.delete(t)})),this[qt].reset()}static has(e){return kt.has(e)}static async delete(e){if(!this.has(e))return;const t=kt.get(e);_t.delete(e),kt.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!_t.get(e)}get[(Dt=qt,Lt=Vt,qt)](){return this.constructor[qt]}async preload(e,t,s=()=>{}){if(this[Vt].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!kt.has(e)){null!=Ht&&this[Vt].setMeshoptDecoder(await Ht);const t=((e,t,s=()=>{})=>{const onProgress=e=>{const t=e.loaded/e.total;s(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((s,r)=>{t.load(e,s,onProgress,r)}))})(e,this[Vt],(e=>{s(.8*e)})),r=this[Kt],o=t.then((e=>r.prepare(e))).then((e=>(s(.9),new r(e)))).catch((e=>(Ft.error(e),new r)));kt.set(e,o)}await kt.get(e),_t.set(e,!0),s&&s(1)}async load(e,t,s=()=>{}){await this.preload(e,t,s);const r=await kt.get(e),o=await r.clone();return this[qt].retain(e),o.dispose=()=>{this[qt].release(e)},o}}CachingGLTFLoader[Dt]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends o.Tme{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 o.FM8(.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 Jt=new o.Pa4,zt=new o.yGw,Yt=new o.yGw,jt=new o.Pa4,$t=new o.Pa4;class CSS2DRenderer{constructor(e={}){const t=this;let s,r,o,A;const l={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,s,r){if(e.isCSS2DObject){Jt.setFromMatrixPosition(e.matrixWorld),Jt.applyMatrix4(Yt);const c=!0===e.visible&&Jt.z>=-1&&Jt.z<=1&&!0===e.layers.test(r.layers);if(e.element.style.display=!0===c?"":"none",!0===c){e.onBeforeRender(t,s,r);const l=e.element;l.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Jt.x*o+o)+"px,"+(-Jt.y*A+A)+"px)",l.parentNode!==h&&h.appendChild(l),e.onAfterRender(t,s,r)}const d={distanceToCameraSquared:getDistanceToSquared(r,e)};l.objects.set(e,d)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],s,r)}function getDistanceToSquared(e,t){return jt.setFromMatrixPosition(e.matrixWorld),$t.setFromMatrixPosition(t.matrixWorld),jt.distanceToSquared($t)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:s,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),zt.copy(t.matrixWorldInverse),Yt.multiplyMatrices(t.projectionMatrix,zt),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 l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),s=t.length;for(let e=0,r=t.length;e<r;e++)t[e].element.style.zIndex=s-e}(e)},this.setSize=function(e,t){s=e,r=t,o=s/2,A=r/2,h.style.width=e+"px",h.style.height=t+"px"}}}s(25108);function reduceVertices(e,t,s){let r=s;const A=new o.Pa4;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:s}=e;if(void 0!==s){const{position:o}=s.attributes;if(void 0!==o)for(let s=0,l=o.count;s<l;s++)e.isMesh?e.getVertexPosition(s,A):A.fromBufferAttribute(o,s),e.isSkinnedMesh||A.applyMatrix4(e.matrixWorld),r=t(r,A)}})),r}let Wt,Xt,Zt,ei;function decompress(e,t=1/0,s=null){Xt||(Xt=new o._12(2,2,1,1)),Zt||(Zt=new o.jyz({uniforms:{blitTexture:new o.xWb(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}"})),Zt.uniforms.blitTexture.value=e,Zt.defines.IS_SRGB=e.colorSpace==o.KI_,Zt.needsUpdate=!0,ei||(ei=new o.Kj0(Xt,Zt),ei.frustumCulled=!1);const r=new o.cPb,A=new o.xsS;A.add(ei),null===s&&(s=Wt=new o.CP7({antialias:!1}));const l=Math.min(e.image.width,t),h=Math.min(e.image.height,t);s.setSize(l,h),s.clear(),s.render(A,r);const c=document.createElement("canvas"),d=c.getContext("2d");c.width=l,c.height=h,d.drawImage(s.domElement,0,0,l,h);const g=new o.ROQ(c);return g.minFilter=e.minFilter,g.magFilter=e.magFilter,g.wrapS=e.wrapS,g.wrapT=e.wrapT,g.name=e.name,Wt&&(Wt.forceContextLoss(),Wt.dispose(),Wt=null),g}var ti=s(25108);const ii={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,s,r){const o=new GLTFWriter,A=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)A.push(this.pluginCallbacks[e](o));o.setPlugins(A),o.write(e,t,r).catch(s)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,r,o,t)}))}}const si=0,ni=1,ri=2,ai=3,oi=4,Ai=5120,li=5121,hi=5122,ci=5123,ui=5124,di=5125,gi=5126,pi=34962,mi=34963,fi=9728,Ci=9729,Bi=9984,yi=9985,wi=9986,vi=9987,Qi=33071,xi=33648,bi=10497,Mi="KHR_mesh_quantization",Ti={};Ti[o.TyD]=fi,Ti[o.YLQ]=Bi,Ti[o.aH4]=wi,Ti[o.wem]=Ci,Ti[o.qyh]=yi,Ti[o.D1R]=vi,Ti[o.uWy]=Qi,Ti[o.rpg]=bi,Ti[o.OoA]=xi;const Ri={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Di=new o.Ilk;function equalArray(e,t){return e.length===t.length&&e.every((function(e,s){return e===t[s]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const s=getPaddedBufferSize(e.byteLength);if(s!==e.byteLength){const r=new Uint8Array(s);if(r.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<s;o++)r[o]=t;return r.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((s=>e.toBlob(s,t)));let s;return"image/jpeg"===t?s=.92:"image/webp"===t&&(s=.8),e.convertToBlob({type:t,quality:s})}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,s={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const r=this,o=r.buffers,A=r.json;s=r.options;const l=r.extensionsUsed,h=r.extensionsRequired,c=new Blob(o,{type:"application/octet-stream"}),d=Object.keys(l),g=Object.keys(h);if(d.length>0&&(A.extensionsUsed=d),g.length>0&&(A.extensionsRequired=g),A.buffers&&A.buffers.length>0&&(A.buffers[0].byteLength=c.size),!0===s.binary){const e=new FileReader;e.readAsArrayBuffer(c),e.onloadend=function(){const s=getPaddedArrayBuffer(e.result),r=new DataView(new ArrayBuffer(8));r.setUint32(0,s.byteLength,!0),r.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(A)),32),l=new DataView(new ArrayBuffer(8));l.setUint32(0,o.byteLength,!0),l.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),c=new DataView(h);c.setUint32(0,1179937895,!0),c.setUint32(4,2,!0);const d=12+l.byteLength+o.byteLength+r.byteLength+s.byteLength;c.setUint32(8,d,!0);const g=new Blob([h,l,o,r,s],{type:"application/octet-stream"}),p=new FileReader;p.readAsArrayBuffer(g),p.onloadend=function(){t(p.result)}}}else if(A.buffers&&A.buffers.length>0){const e=new FileReader;e.readAsDataURL(c),e.onloadend=function(){const s=e.result;A.buffers[0].uri=s,t(A)}}else t(A)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const s=this.options,r=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],r[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){ti.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 o.Pa4;for(let s=0,r=e.count;s<r;s++)if(Math.abs(t.fromBufferAttribute(e,s).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 s=e.clone(),r=new o.Pa4;for(let e=0,t=s.count;e<t;e++)r.fromBufferAttribute(s,e),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),s.setXYZ(e,r.x,r.y,r.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1;const r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),s=!0),0!==t.rotation&&(r.rotation=t.rotation,s=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===o.KI_?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}ti.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof o.EB7&&(e=decompress(e)),t instanceof o.EB7&&(t=decompress(t));const s=e?e.image:null,r=t?t.image:null,A=Math.max(s?s.width:0,r?r.width:0),l=Math.max(s?s.height:0,r?r.height:0),h=getCanvas();h.width=A,h.height=l;const c=h.getContext("2d");c.fillStyle="#00ffff",c.fillRect(0,0,A,l);const d=c.getImageData(0,0,A,l);if(s){c.drawImage(s,0,0,A,l);const t=getEncodingConversion(e),r=c.getImageData(0,0,A,l).data;for(let e=2;e<r.length;e+=4)d.data[e]=256*t(r[e]/256)}if(r){c.drawImage(r,0,0,A,l);const e=getEncodingConversion(t),s=c.getImageData(0,0,A,l).data;for(let t=1;t<s.length;t+=4)d.data[t]=256*e(s[t]/256)}c.putImageData(d,0,0);const g=(e||t).clone();return g.source=new o.Hw6(h),g.colorSpace=o.aCh,g.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&ti.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),g}processBuffer(e){const t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,r,A){const l=this.json;let h;switch(l.bufferViews||(l.bufferViews=[]),t){case Ai:case li:h=1;break;case hi:case ci:h=2;break;default:h=4}let c=e.itemSize*h;A===pi&&(c=4*Math.ceil(c/4));const d=getPaddedBufferSize(r*c),g=new DataView(new ArrayBuffer(d));let p=0;for(let A=s;A<s+r;A++){for(let s=0;s<e.itemSize;s++){let r;e.itemSize>4?r=e.array[A*e.itemSize+s]:(0===s?r=e.getX(A):1===s?r=e.getY(A):2===s?r=e.getZ(A):3===s&&(r=e.getW(A)),!0===e.normalized&&(r=o.M8C.normalize(r,e.array))),t===gi?g.setFloat32(p,r,!0):t===ui?g.setInt32(p,r,!0):t===di?g.setUint32(p,r,!0):t===hi?g.setInt16(p,r,!0):t===ci?g.setUint16(p,r,!0):t===Ai?g.setInt8(p,r):t===li&&g.setUint8(p,r),p+=h}p%c!=0&&(p+=c-p%c)}const m={buffer:this.processBuffer(g.buffer),byteOffset:this.byteOffset,byteLength:d};void 0!==A&&(m.target=A),A===pi&&(m.byteStride=c),this.byteOffset+=d,l.bufferViews.push(m);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise((function(r){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),A={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(s.bufferViews.push(A)-1)}}))}processAccessor(e,t,s,r){const A=this.json;let l;if(e.array.constructor===Float32Array)l=gi;else if(e.array.constructor===Int32Array)l=ui;else if(e.array.constructor===Uint32Array)l=di;else if(e.array.constructor===Int16Array)l=hi;else if(e.array.constructor===Uint16Array)l=ci;else if(e.array.constructor===Int8Array)l=Ai;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=li}if(void 0===s&&(s=0),void 0!==r&&r!==1/0||(r=e.count),0===r)return null;const h=function getMinMax(e,t,s){const r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let A=t;A<t+s;A++)for(let t=0;t<e.itemSize;t++){let s;e.itemSize>4?s=e.array[A*e.itemSize+t]:(0===t?s=e.getX(A):1===t?s=e.getY(A):2===t?s=e.getZ(A):3===t&&(s=e.getW(A)),!0===e.normalized&&(s=o.M8C.normalize(s,e.array))),r.min[t]=Math.min(r.min[t],s),r.max[t]=Math.max(r.max[t],s)}return r}(e,s,r);let c;void 0!==t&&(c=e===t.index?mi:pi);const d=this.processBufferView(e,l,s,r,c),g={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:r,max:h.max,min:h.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(g.normalized=!0),A.accessors||(A.accessors=[]),A.accessors.push(g)-1}processImage(e,t,s,r="image/png"){if(null!==e){const A=this,l=A.cache,h=A.json,c=A.options,d=A.pending;l.images.has(e)||l.images.set(e,{});const g=l.images.get(e),p=r+":flipY/"+s.toString();if(void 0!==g[p])return g[p];h.images||(h.images=[]);const m={mimeType:r},f=getCanvas();f.width=Math.min(e.width,c.maxTextureSize),f.height=Math.min(e.height,c.maxTextureSize);const I=f.getContext("2d");if(!0===s&&(I.translate(0,f.height),I.scale(1,-1)),void 0!==e.data){t!==o.wk1&&ti.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&ti.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const s=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<s.length;t+=4)s[t+0]=e.data[t+0],s[t+1]=e.data[t+1],s[t+2]=e.data[t+2],s[t+3]=e.data[t+3];I.putImageData(new ImageData(s,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.");I.drawImage(e,0,0,f.width,f.height)}!0===c.binary?d.push(getToBlobPromise(f,r).then((e=>A.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==f.toDataURL?m.uri=f.toDataURL(r):d.push(getToBlobPromise(f,r).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const E=h.images.push(m)-1;return g[p]=E,E}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 s={magFilter:Ti[e.magFilter],minFilter:Ti[e.minFilter],wrapS:Ti[e.wrapS],wrapT:Ti[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){const t=this.options,s=this.cache,r=this.json;if(s.textures.has(e))return s.textures.get(e);r.textures||(r.textures=[]),e instanceof o.EB7&&(e=decompress(e,t.maxTextureSize));let A=e.userData.mimeType;"image/webp"===A&&(A="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,A)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const h=r.textures.push(l)-1;return s.textures.set(e,h),h}processMaterial(e){const t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return ti.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const r={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&ti.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const A=e.color.toArray().concat([e.opacity]);if(equalArray(A,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=A),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=.5,r.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),s={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(s,t),r.pbrMetallicRoughness.metallicRoughnessTexture=s}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),r.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),r.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),r.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),r.occlusionTexture=t}e.transparent?r.alphaMode="BLEND":e.alphaTest>0&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),e.side===o.ehD&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,r)}));const l=s.materials.push(r)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,s=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,s=e.material.length;t<s;t++)r.push(e.material[t].uuid);else r.push(e.material.uuid);const A=r.join(":");if(t.meshes.has(A))return t.meshes.get(A);const l=e.geometry;let h;h=e.isLineSegments?ni:e.isLineLoop?ri:e.isLine?ai:e.isPoints?si:e.material.wireframe?ni:oi;const c={},d={},g=[],p=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=l.getAttribute("normal");void 0===f||this.isNormalizedNormalAttribute(f)||(ti.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let I=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const s=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(s))){d[e]=t.attributes.get(this.getUID(s));continue}I=null;const r=s.array;"JOINTS_0"!==e||r instanceof Uint16Array||r instanceof Uint8Array||(ti.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),I=new o.TlE(new Uint16Array(r),s.itemSize,s.normalized));const A=this.processAccessor(I||s,l);null!==A&&(e.startsWith("_")||this.detectMeshQuantization(e,s),d[e]=A,t.attributes.set(this.getUID(s),A))}if(void 0!==f&&l.setAttribute("normal",f),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const s=[],r=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let A=0;A<e.morphTargetInfluences.length;++A){const h={};let c=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){c||(ti.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),c=!0);continue}const s=l.morphAttributes[e][A],r=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(s,!0))){h[r]=t.attributes.get(this.getUID(s,!0));continue}const d=s.clone();if(!l.morphTargetsRelative)for(let e=0,t=s.count;e<t;e++)for(let t=0;t<s.itemSize;t++)0===t&&d.setX(e,s.getX(e)-o.getX(e)),1===t&&d.setY(e,s.getY(e)-o.getY(e)),2===t&&d.setZ(e,s.getZ(e)-o.getZ(e)),3===t&&d.setW(e,s.getW(e)-o.getW(e));h[r]=this.processAccessor(d,l),t.attributes.set(this.getUID(o,!0),h[r])}p.push(h),s.push(e.morphTargetInfluences[A]),void 0!==e.morphTargetDictionary&&r.push(o[A])}c.weights=s,r.length>0&&(c.extras={},c.extras.targetNames=r)}const E=Array.isArray(e.material);if(E&&0===l.groups.length)return null;let C=!1;if(E&&null===l.index){const e=[];for(let t=0,s=l.attributes.position.count;t<s;t++)e[t]=t;l.setIndex(e),C=!0}const B=E?e.material:[e.material],y=E?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,s=y.length;e<s;e++){const s={mode:h,attributes:d};if(this.serializeUserData(l,s),p.length>0&&(s.targets=p),null!==l.index){let r=this.getUID(l.index);void 0===y[e].start&&void 0===y[e].count||(r+=":"+y[e].start+":"+y[e].count),t.attributes.has(r)?s.indices=t.attributes.get(r):(s.indices=this.processAccessor(l.index,l,y[e].start,y[e].count),t.attributes.set(r,s.indices)),null===s.indices&&delete s.indices}const r=this.processMaterial(B[y[e].materialIndex]);null!==r&&(s.material=r),g.push(s)}!0===C&&l.setIndex(null),c.primitives=g,s.meshes||(s.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,c)}));const Q=s.meshes.push(c)-1;return t.meshes.set(A,Q),Q}detectMeshQuantization(e,t){if(this.extensionsUsed[Mi])return;let s;switch(t.array.constructor){case Int8Array:s="byte";break;case Uint8Array:s="unsigned byte";break;case Int16Array:s="short";break;case Uint16Array:s="unsigned short";break;default:return}t.normalized&&(s+=" normalized");const r=e.split("_",1)[0];ii[r]&&ii[r].includes(s)&&(this.extensionsUsed[Mi]=!0,this.extensionsRequired[Mi]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const s=e.isOrthographicCamera,r={type:s?"orthographic":"perspective"};return s?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:o.M8C.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){const s=this.json,r=this.nodeMap;s.animations||(s.animations=[]);const A=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],h=[];for(let e=0;e<A.length;++e){const s=A[e],c=o.iUV.parseTrackName(s.name);let d=o.iUV.findNode(t,c.nodeName);const g=Ri[c.propertyName];if("bones"===c.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(c.objectIndex):void 0),!d||!g)return ti.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name),null;const p=1;let m,f=s.values.length/s.times.length;g===Ri.morphTargetInfluences&&(f/=d.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",f/=3):m=s.getInterpolation()===o.Syv?"STEP":"LINEAR",h.push({input:this.processAccessor(new o.TlE(s.times,p)),output:this.processAccessor(new o.TlE(s.values,f)),interpolation:m}),l.push({sampler:h.length-1,target:{node:r.get(d),path:g}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:h,channels:l}),s.animations.length-1}processSkin(e){const t=this.json,s=this.nodeMap,r=t.nodes[s.get(e)],A=e.skeleton;if(void 0===A)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const h=[],c=new Float32Array(16*A.bones.length),d=new o.yGw;for(let t=0;t<A.bones.length;++t)h.push(s.get(A.bones[t])),d.copy(A.boneInverses[t]),d.multiply(e.bindMatrix).toArray(c,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new o.TlE(c,16)),joints:h,skeleton:s.get(l)});return r.skin=t.skins.length-1}processNode(e){const t=this.json,s=this.options,r=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(s.trs){const t=e.quaternion.toArray(),s=e.position.toArray(),r=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(s,[0,0,0])||(o.translation=s),equalArray(r,[1,1,1])||(o.scale=r)}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 r=0,o=e.children.length;r<o;r++){const o=e.children[r];if(o.visible||!1===s.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 A=t.nodes.push(o)-1;return r.set(e,A),A}processScene(e){const t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);const r={};""!==e.name&&(r.name=e.name),t.scenes.push(r);const o=[];for(let t=0,r=e.children.length;t<r;t++){const r=e.children[t];if(r.visible||!1===s.onlyVisible){const e=this.processNode(r);null!==e&&o.push(e)}}o.length>0&&(r.nodes=o),this.serializeUserData(e,r)}processObjects(e){const t=new o.xsS;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);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 s=[];for(let t=0;t<e.length;t++)e[t]instanceof o.xsS?this.processScene(e[t]):s.push(e[t]);s.length>0&&this.processObjects(s);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;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 ti.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const s=this.writer,r=s.json,o=s.extensionsUsed,A={};e.name&&(A.name=e.name),A.color=e.color.toArray(),A.intensity=e.intensity,e.isDirectionalLight?A.type="directional":e.isPointLight?(A.type="point",e.distance>0&&(A.range=e.distance)):e.isSpotLight&&(A.type="spot",e.distance>0&&(A.range=e.distance),A.spot={},A.spot.innerConeAngle=(1-e.penumbra)*e.angle,A.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&ti.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||ti.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]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},o[this.name]=!0);const l=r.extensions[this.name].lights;l.push(A),t.extensions=t.extensions||{},t.extensions[this.name]={light:l.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const s=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},s[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 s=this.writer,r=s.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:s.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};s.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:s.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};s.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:s.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};s.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=s.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:s.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};s.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:s.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};s.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=s.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:s.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};s.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=s.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:s.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};s.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,r[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 s=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[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(Di)&&!e.specularIntensityMap&&!e.specularColorMap)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:s.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};s.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:s.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};s.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,r[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 s=this.writer,r=s.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:s.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};s.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:s.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};s.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,r[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 s=this.writer,r=s.extensionsUsed,o={};if(e.anisotropyMap){const t={index:s.processTexture(e.anisotropyMap)};s.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[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 s=this.writer,r=s.extensionsUsed,o={};if(e.bumpMap){const t={index:s.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};s.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=e,A=new Float32Array(3*r.count),l=new Float32Array(4*r.count),h=new Float32Array(3*r.count),c=new o.yGw,d=new o.Pa4,g=new o._fP,p=new o.Pa4;for(let e=0;e<r.count;e++)r.getMatrixAt(e,c),c.decompose(d,g,p),d.toArray(A,3*e),g.toArray(l,4*e),p.toArray(h,3*e);const m={TRANSLATION:s.processAccessor(new o.TlE(A,3)),ROTATION:s.processAccessor(new o.TlE(l,4)),SCALE:s.processAccessor(new o.TlE(h,3))};r.instanceColor&&(m._COLOR_0=s.processAccessor(r.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},s.extensionsUsed[this.name]=!0,s.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const s=.001,r=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),A=new e.ValueBufferType(e.values.length+r),l=e.createInterpolant(new e.ValueBufferType(r));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<r;e++)A[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<s)return 0;o[0]=t,o.set(e.times,1),A.set(l.evaluate(t),0),A.set(e.values,r),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<s)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),A.set(e.values,0),A.set(l.evaluate(t),e.values.length),h=o.length-1}else for(let c=0;c<e.times.length;c++){if(Math.abs(e.times[c]-t)<s)return c;if(e.times[c]<t&&e.times[c+1]>t){o.set(e.times.slice(0,c+1),0),o[c+1]=t,o.set(e.times.slice(c+1),c+2),A.set(e.values.slice(0,(c+1)*r),0),A.set(l.evaluate(t),(c+1)*r),A.set(e.values.slice((c+1)*r),(c+2)*r),h=c+1;break}}return e.times=o,e.values=A,h},mergeMorphTargetTracks:function(e,t){const s=[],r={},A=e.tracks;for(let e=0;e<A.length;++e){let l=A[e];const h=o.iUV.parseTrackName(l.name),c=o.iUV.findNode(t,h.nodeName);if("morphTargetInfluences"!==h.propertyName||void 0===h.propertyIndex){s.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.");ti.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(o.NMF)}const d=c.morphTargetInfluences.length,g=c.morphTargetDictionary[h.propertyIndex];if(void 0===g)throw new Error("THREE.GLTFExporter: Morph target name not found: "+h.propertyIndex);let p;if(void 0===r[c.uuid]){p=l.clone();const e=new p.ValueBufferType(d*p.times.length);for(let t=0;t<p.times.length;t++)e[t*d+g]=p.values[t];p.name=(h.nodeName||"")+".morphTargetInfluences",p.values=e,r[c.uuid]=p,s.push(p);continue}const m=l.createInterpolant(new l.ValueBufferType(1));p=r[c.uuid];for(let e=0;e<p.times.length;e++)p.values[e*d+g]=m.evaluate(p.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(p,l.times[e]);p.values[t*d+g]=l.values[e]}}return e.tracks=s,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 s of e)s.traverse((e=>{if(!compatibleObject(e))return;const s=e.userData.variantMaterials,r=e.userData.variantData;for(const[e,o]of r){const r=s.get(o.index);r&&compatibleMaterial(r.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const s=e.userData,r=s.variantMaterials,o=s.variantData,A=new Map,l=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())l.set(t.index,e);for(const e of o.values()){const t=r.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const s=this.writer.processMaterial(t.material);A.has(s)||A.set(s,{material:s,variants:[]}),A.get(s).variants.push(l.get(e.index))}const c=Array.from(A.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===c.length)return;const d=compatibleMaterial(s.originalMaterial)?this.writer.processMaterial(s.originalMaterial):-1;for(const e of t.primitives)d>=0&&(e.material=d),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:c}}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,s,r,A){this.xrLight=e,this.renderer=t,this.lightProbe=s,this.xrWebGLBinding=null,this.estimationStartCallback=A,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(r&&"XRWebGLBinding"in window){const s=new o.oAp(16);e.environment=s.texture;const r=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":r.getExtension("EXT_sRGB");break;case"rgba16f":r.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,r),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 s=t.getLightEstimate(this.lightProbe);if(s){this.xrLight.lightProbe.sh.fromArray(s.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(s.primaryLightIntensity.x,Math.max(s.primaryLightIntensity.y,s.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(s.primaryLightIntensity.x/e,s.primaryLightIntensity.y/e,s.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(s.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends o.ZAu{constructor(e,t=!0){super(),this.lightProbe=new o.lk7,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new o.Ox3,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let s=null,r=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{s=new SessionLightProbe(this,e,o,t,(()=>{r=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{s&&(s.dispose(),s=null),r&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{s&&(s.dispose(),s=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,s,r){const o=2e-4*this.naturalFrequency;if(null==e||0===r)return t;if(e===t&&0===this.velocity)return t;if(s<0)return e;const A=e-t,l=this.velocity+this.naturalFrequency*A,h=A+s*l,c=Math.exp(-this.naturalFrequency*s),d=(l-this.naturalFrequency*h)*c,g=-this.naturalFrequency*(d+l*c);return Math.abs(d)<o*Math.abs(r)&&g*A>=0?(this.velocity=0,t):(this.velocity=d,t+h*c)}}const Li=.2,Fi=Math.PI/24,ki=new o.FM8,addCorner=(e,t,s)=>{let r=t>0?s>0?0:-Math.PI/2:s>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(r),s+.17*Math.sin(r),0,t+Li*Math.cos(r),s+Li*Math.sin(r),0),r+=Fi};class PlacementBox extends o.Kj0{constructor(e,t){const s=new o.u9r,r=[],A=[],{size:l,boundingBox:h}=e,c=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(A,c,d),addCorner(A,-c,d),addCorner(A,-c,-d),addCorner(A,c,-d);const g=A.length/3;for(let e=0;e<g-2;e+=2)r.push(e,e+1,e+3,e,e+3,e+2);const p=g-2;r.push(p,p+1,1,p,1,0),s.setAttribute("position",new o.a$l(A,3)),s.setIndex(r),super(s),this.side=t;const m=this.material;switch(m.side=o.ehD,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new o.Kj0(new o._12(2*(c+Li),2*(d+Li))),this.hitPlane.visible=!1,this.hitPlane.material.side=o.ehD,this.add(this.hitPlane),h.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=h.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=h.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,s){ki.set(t,-s),this.hitPlane.visible=!0;const r=e.positionAndNormalFromPoint(ki,this.hitPlane);return this.hitPlane.visible=!1,null==r?null:r.position}getExpandedHit(e,t,s){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const r=this.getHit(e,t,s);return this.hitPlane.scale.set(1,1,1),r}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:s}=this.hitPlane;t.dispose(),s.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}),_i=(()=>{const e={};return t=>{const s=t;if(s in e)return e[s];const r=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=Ui(t),s=e.nodes[0];if(null==s||0===s.terms.length)break;r.push(s),t=e.remainingInput}return e[s]=r}})(),Ui=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,s=/^[\),]/;return r=>{const o=[];for(;r.length&&(r=r.trim(),!s.test(r));)if("("===r[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(r);r=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(r)){const e=Gi(r),t=e.nodes[0];if("("===(r=e.remainingInput)[0]){const{nodes:e,remainingInput:s}=parseFunctionArguments(r);o.push({type:"function",name:t,arguments:e}),r=s}else o.push(t)}else if(t.test(r))o.push({type:"operator",value:r[0]}),r=r.slice(1);else{const{nodes:e,remainingInput:t}="#"===r[0]?Oi(r):Ni(r);if(0===e.length)break;o.push(e[0]),r=t}return{nodes:[{type:"expression",terms:o}],remainingInput:r}}})(),Gi=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const s=t.match(e);return{nodes:[{type:"ident",value:null==s?t:t.substr(0,s.index)}],remainingInput:null==s?"":t.substr(s.index)}}})(),Ni=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,s=/^(m|mm|cm|rad|deg|[%])$/;return r=>{const o=r.match(e),A=null==o?"0":o[0],l=(r=null==A?r:r.slice(A.length)).match(t);let h=null!=l&&""!==l[0]?l[0]:null;const c=null==l?r:r.slice(h.length);return null==h||s.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(A)||0,unit:h}],remainingInput:c}}})(),Oi=(()=>{const e=/^[a-f0-9]*/i;return t=>{const s=(t=t.slice(1).trim()).match(e);return{nodes:null==s?[]:[{type:"hex",value:s[0]}],remainingInput:null==s?t:t.slice(s[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const s=Ui(e);if(t.push(s.nodes[0]),","===(e=s.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Hi=Symbol("visitedTypes");class ASTWalker{constructor(e){this[Hi]=e}walk(e,t){const s=e.slice();for(;s.length;){const e=s.shift();switch(this[Hi].indexOf(e.type)>-1&&t(e),e.type){case"expression":s.unshift(...e.terms);break;case"function":s.unshift(e.name,...e.arguments)}}}}const Vi=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:s,unit:r}=e;if(isFinite(s)){if("rad"===e.unit||null==e.unit)return e}else s=t,r="rad";return{type:"number",number:("deg"===r&&null!=s?s:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let s,{number:r,unit:o}=e;if(isFinite(r)){if("m"===e.unit)return e}else r=t,o="m";switch(o){default:s=1;break;case"cm":s=.01;break;case"mm":s=.001}return{type:"number",number:s*r,unit:"m"}},qi=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,s=Vi)=>{isFinite(t.number)||(t.number=s.number,t.unit=s.unit);const{unit:r}=t;if(null==r)return t;const o=e[r];return null==o?s:o(t)}})();var Ki,Ji,zi;const Yi=Symbol("evaluate"),ji=Symbol("lastValue");class Evaluator{constructor(){this[Ki]=null}static evaluatableFor(e,t=Vi){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 Vi}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:s,keywords:r}=t,{auto:o}=r;return s.map(((t,s)=>{const A=null==o[s]?t:o[s];let l=e[s]?e[s]:A;if("ident"===l.type){const e=l.value;e in r&&(l=r[e][s])}return null!=l&&"ident"!==l.type||(l=A),"%"===l.unit?numberNode(l.number/100*t.number,t.unit):(l=qi(l,t),l.unit!==t.unit?t:l)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[ji]||(this[ji]=this[Yi]()),this[ji]}}Ki=ji;const $i=Symbol("percentage"),Wi=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[$i]=e,this[Wi]=t}get isConstant(){return!0}[Yi](){return numberNode(this[$i].number/100*this[Wi].number,this[Wi].unit)}}const Xi=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[Ji]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[Xi]=t)}get isConstant(){return!1}[(Ji=Xi,Yi)](){if(null!=this[Xi]&&"window-scroll-y"===this[Xi].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 Vi}}const Zi=/[\*\/]/,es=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Vi){if(super(),this[zi]=null,1!==e.arguments.length)return;const s=e.arguments[0].terms.slice(),r=[];for(;s.length;){const e=s.shift();if(r.length>0){const s=r[r.length-1];if("operator"===s.type&&Zi.test(s.value)){const s=r.pop(),o=r.pop();if(null==o)return;r.push(new OperatorEvaluator(s,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}r.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;r.length>2;){const[e,s,o]=r.splice(0,3);if("operator"!==s.type)return;r.unshift(new OperatorEvaluator(s,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===r.length&&(this[es]=r[0])}get isConstant(){return null==this[es]||Evaluator.isConstant(this[es])}[(zi=es,Yi)](){return null!=this[es]?Evaluator.evaluate(this[es]):Vi}}const ts=Symbol("operator"),is=Symbol("left"),ss=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,s){super(),this[ts]=e,this[is]=t,this[ss]=s}get isConstant(){return Evaluator.isConstant(this[is])&&Evaluator.isConstant(this[ss])}[Yi](){const e=qi(Evaluator.evaluate(this[is])),t=qi(Evaluator.evaluate(this[ss])),{number:s,unit:r}=e,{number:o,unit:A}=t;if(null!=A&&null!=r&&A!=r)return Vi;const l=r||A;let h;switch(this[ts].value){case"+":h=s+o;break;case"-":h=s-o;break;case"/":h=s/o;break;case"*":h=s*o;break;default:return Vi}return{type:"number",number:h,unit:l}}}const ns=Symbol("evaluatables"),rs=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[rs]=t;const s=e[0],r=null!=s?s.terms:[];this[ns]=t.basis.map(((e,t)=>{const s=r[t];return null==s?{type:"ident",value:"auto"}:"ident"===s.type?s:Evaluator.evaluatableFor(s,e)}))}get isConstant(){for(const e of this[ns])if(!Evaluator.isConstant(e))return!1;return!0}[Yi](){const e=this[ns].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[rs]).map((e=>e.number))}}var as,os,As,ls;const hs=Symbol("instances"),cs=Symbol("activateListener"),us=Symbol("deactivateListener"),ds=Symbol("notifyInstances"),gs=Symbol("notify"),ps=Symbol("callback");class ScrollObserver{constructor(e){this[ps]=e}static[ds](){for(const e of ScrollObserver[hs])e[gs]()}static[(as=hs,cs)](){window.addEventListener("scroll",this[ds],{passive:!0})}static[us](){window.removeEventListener("scroll",this[ds])}observe(){0===ScrollObserver[hs].size&&ScrollObserver[cs](),ScrollObserver[hs].add(this)}disconnect(){ScrollObserver[hs].delete(this),0===ScrollObserver[hs].size&&ScrollObserver[us]()}[gs](){this[ps]()}}ScrollObserver[as]=new Set;const ms=Symbol("computeStyleCallback"),fs=Symbol("astWalker"),Is=Symbol("dependencies"),Es=Symbol("onScroll");class StyleEffector{constructor(e){this[os]={},this[As]=new ASTWalker(["function"]),this[ls]=()=>{this[ms]({relatedState:"window-scroll"})},this[ms]=e}observeEffectsFor(e){const t={},s=this[Is];this[fs].walk(e,(e=>{const{name:r}=e,o=e.arguments[0].terms[0];if("env"===r.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in s?s["window-scroll"]:new ScrollObserver(this[Es]);e.observe(),delete s["window-scroll"],t["window-scroll"]=e}}));for(const e in s){s[e].disconnect()}this[Is]=t}dispose(){for(const e in this[Is]){this[Is][e].disconnect()}}}os=Is,As=fs,ls=Es;const style=e=>{const t=e.observeEffects||!1,s=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(r,o)=>{const A=r.updated,l=r.connectedCallback,h=r.disconnectedCallback,c=Symbol(`${o}StyleEffector`),d=Symbol(`${o}StyleEvaluator`),g=Symbol(`${o}UpdateEvaluator`),p=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(r,{[c]:{value:null,writable:!0},[d]:{value:null,writable:!0},[g]:{value:function(){const e=_i(this[o]);this[d]=new StyleEvaluator(e,s(this)),null==this[c]&&t&&(this[c]=new StyleEffector((()=>this[p]()))),null!=this[c]&&this[c].observeEffectsFor(e)}},[p]:{value:function(){if(null==this[d])return;const t=this[d].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[g](),this[p]()),A.call(this,e)}},connectedCallback:{value:function(){l.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[c]&&(this[c].dispose(),this[c]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,s=easeInOutQuad)=>r=>e+(t-e)*s(r),timeline=e=>{const t=[],s=[];let r=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const A=e.keyframes[o],{value:l,frames:h}=A,c=A.ease||easeInOutQuad,d=interpolate(r,l,c);t.push(d),s.push(h),r=l}return((e,t)=>{const s=t.map((r=0,e=>r+=e));var r;return t=>{t=clamp(t,0,1),t*=s[s.length-1];const r=s.findIndex((e=>e>=t)),o=r<1?0:s[r-1],A=s[r];return e[r]((t-o)/(A-o))}})(t,s)};var Cs=s(25108),controls_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Bs=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}]}),ys=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),ws="0deg 75deg 105%",vs=["front","right","back","left"],Qs=["upper-","","lower-"],xs="auto",bs="basic",Ss="wiggle",Ms="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),Ts=(()=>{const e=_i(ws)[0].terms,t=qi(e[0]),s=qi(e[1]);return e=>{const r=e[bo].idealCameraDistance();return{basis:[t,s,numberNode(r,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[bo].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=Ts(e),s=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(s,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[bo].boundingBox.getCenter(new o.Pa4);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},Rs=Math.PI/2,Ds=Math.PI/3,Ls=Rs/2,Fs=2*Math.PI,ks=Symbol("controls"),_s=Symbol("panElement"),Us=Symbol("promptElement"),Gs=Symbol("promptAnimatedContainer"),Ns=Symbol("fingerAnimatedContainers"),Ps=Symbol("deferInteractionPrompt"),Os=Symbol("updateAria"),Hs=Symbol("a11y"),Vs=Symbol("updateA11y"),qs=Symbol("updateCameraForRadius"),Ks=Symbol("cancelPrompts"),Js=Symbol("onChange"),zs=Symbol("onPointerChange"),Ys=Symbol("waitingToPromptUser"),js=Symbol("userHasInteracted"),$s=Symbol("promptElementVisibleTime"),Ws=Symbol("lastPromptOffset"),Xs=Symbol("cancellationSource"),Zs=Symbol("lastSpherical"),en=Symbol("jumpCamera"),tn=Symbol("initialized"),sn=Symbol("maintainThetaPhi"),nn=Symbol("syncCameraOrbit"),rn=Symbol("syncFieldOfView"),an=Symbol("syncCameraTarget"),on=Symbol("syncMinCameraOrbit"),An=Symbol("syncMaxCameraOrbit"),ln=Symbol("syncMinFieldOfView"),hn=Symbol("syncMaxFieldOfView"),cn=new o.FM8,un=new o.Pa4,dn=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"}),gn=Math.PI/8,pn=.04,mn={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends o.pBf{constructor(e,t,s){super(),this.camera=e,this.element=t,this.scene=s,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=mn.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new o.Vkp,this.panPerPixel=0,this.spherical=new o.$V,this.goalSpherical=new o.$V,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(dn.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=pn*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:s}=this._options;if(!this.touchDecided&&"none"!==s){this.touchDecided=!0;const r=Math.abs(e),o=Math.abs(t);if(this.changeSource===mn.USER_INTERACTION&&("pan-y"===s&&o>r||"pan-x"===s&&r>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?mn.AUTOMATIC:mn.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=mn.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===mn.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 s=this.pointers.length,r=(e.clientX-t.clientX)/s,o=(e.clientY-t.clientY)/s;0===r&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?mn.AUTOMATIC:mn.USER_INTERACTION,null!==this.touchMode&&this.touchMode(r,o)):(this.changeSource=mn.USER_INTERACTION,this.panPerPixel>0?this.movePan(r,o):this.handleSinglePointerMove(r,o)))},this.onPointerUp=e=>{const{element:t}=this,s=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==s&&this.pointers.splice(s,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[_s].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=mn.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*pn*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=mn.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({},dn),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 o.$V){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,s=this.goalSpherical.radius){const{minimumAzimuthalAngle:r,maximumAzimuthalAngle:o,minimumPolarAngle:A,maximumPolarAngle:l,minimumRadius:h,maximumRadius:c}=this._options,{theta:d,phi:g,radius:p}=this.goalSpherical,m=clamp(e,r,o);isFinite(r)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-m)+m);const f=clamp(t,A,l),I=clamp(s,h,c);return(m!==d||f!==g||I!==p)&&(!!(isFinite(m)&&isFinite(f)&&isFinite(I))&&(this.goalSpherical.theta=m,this.goalSpherical.phi=f,this.goalSpherical.radius=I,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:s}=this._options;e=clamp(e,t,s),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,s){const{theta:r,phi:o,radius:A}=this.goalSpherical,{minimumRadius:l,maximumRadius:h,minimumFieldOfView:c,maximumFieldOfView:d}=this._options,g=this.spherical.theta-r,p=Math.PI-.001,m=r-clamp(e,-p-g,p-g),f=o-t,I=0===s?0:((s>0?h:l)-A)/(Math.log(s>0?d:c)-this.goalLogFov),E=A+s*(isFinite(I)?I:2*(h-l));if(this.setOrbit(m,f,E),0!==s){const e=this.goalLogFov+s;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:s,maximumRadius:r}=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,s),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,r),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 o.USm(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,s){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,s*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:s,clientY:r}=e,{clientX:o,clientY:A}=t,l=o-s,h=A-r;return Math.sqrt(l*l+h*h)}handleSinglePointerMove(e,t){const s=this.pixelLengthToSphericalAngle(e),r=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(s,r,0)}initializePan(){const{theta:e,phi:t}=this.spherical,s=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(s),-Math.cos(t)*Math.sin(s),0,0,Math.sin(t),0,Math.sin(s),-Math.cos(t)*Math.cos(s),0)}movePan(e,t){const{scene:s}=this,r=un.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;r.multiplyScalar(o);const A=s.getTarget();A.add(r.applyMatrix3(this.panProjection)),s.boundingSphere.clampPoint(A,A),s.setTarget(A.x,A.y,A.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,s=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==s){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(s.position),t.setTarget(s.position.x,s.position.y,s.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(cn.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const s=e.getTarget(),{theta:r,phi:o}=this.spherical,A=r-e.yaw,l=un.set(Math.sin(o)*Math.sin(A),Math.cos(o),Math.sin(o)*Math.cos(A)),h=l.dot(t.position.sub(s));s.add(l.multiplyScalar(h)),e.setTarget(s.x,s.y,s.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[_s].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[_s].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,pn*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-gn,0);break;case"ArrowDown":this.userAdjustOrbit(0,gn,0);break;case"ArrowLeft":this.userAdjustOrbit(-gn,0,0);break;case"ArrowRight":this.userAdjustOrbit(gn,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 fn=s(25108);const In=1/1.3,En="not-presenting",Cn="session-started",Bn="object-placed",yn="failed",wn="tracking",vn="not-tracking",Qn=new o.Pa4,xn=new o.yGw,bn=new o.Pa4,Sn=new o.cPb(45,1,.1,100);class ARRenderer extends o.pBf{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 o.Pa4,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new o.Pa4,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new o.Pa4,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 s=this.frame.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=this.placementBox;if(1===s.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,s=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=s?(this.isTranslating=!0,this.lastDragPosition.copy(s)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===s.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/r.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 fn.warn("Request to present in WebXR denied:"),fn.warn(e),fn.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&fn.warn("Cannot present while a model is already presenting");let s=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await s,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 r=await this.resolveARSession();r.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 A=await r.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 l=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(l),z:-Math.cos(l)});r.requestHitTestSource({space:A,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=r,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Cn})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){fn.warn("Error while trying to end WebXR AR session"),fn.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 s=this.turntableRotation;null!=s&&(t.yaw=s);const r=this.oldShadowIntensity;null!=r&&t.setShadowIntensity(r),t.setEnvironmentAndSkybox(e[ve],e[Qe]);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[Ro](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:mn.NONE}}))}))}this.renderer.height=0;const s=this.exitWebXRButtonContainer;null!=s&&(s.classList.remove("enabled"),s.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const r=this.transientHitTestSource;null!=r&&(r.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:En})}updateView(e){const t=this.presentedScene,s=this.threeRenderer.xr;s.updateCamera(Sn),t.xrCamera=s.getCamera();const{elements:r}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(r[1],r[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=s.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):s.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:s}=e,r=e.getCamera(),{width:o,height:A}=this.overlay.getBoundingClientRect();e.setSize(o,A),r.projectionMatrixInverse.copy(r.projectionMatrix).invert();const{theta:l,radius:h}=s.getCameraOrbit(),c=r.getWorldDirection(Qn);e.yaw=Math.atan2(-c.x,-c.z)-l,this.goalYaw=e.yaw,t.copy(r.position).add(c.multiplyScalar(h)),this.updateTarget();const d=e.getTarget();t.add(d).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:g}=this.frame;g.addEventListener("selectstart",this.onSelectStart),g.addEventListener("selectend",this.onSelectEnd),g.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&&(Qn.copy(t).sub(this.presentedScene.getCamera().position),Qn.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),s=e.getPose(t);if(null==s)return null;const r=xn.fromArray(s.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(r.elements[4],r.elements[6])),r.elements[5]>.75!==this.placeOnWall?bn.setFromMatrixPosition(r):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const s=e.getHitTestResults(t);if(0==s.length)return;const r=s[0],o=this.getHitPoint(r);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:Bn}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,s=e[1].inputSource.gamepad.axes,r=s[0]-t[0],o=s[1]-t[1],A=Math.atan2(o,r);let l=this.lastAngle-A;return l>Math.PI?l-=2*Math.PI:l<-Math.PI&&(l+=2*Math.PI),this.lastAngle=A,{separation:Math.sqrt(r*r+o*o),deltaYaw:l}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const s=e.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=r.scale.x;if(this.isTwoFingering)if(s.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(s);if(!1===this.placeOnWall&&(this.goalYaw+=t),r.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>In?1:t}}else if(2!==s.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&s.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 s=Qn.copy(r.getCamera().position),A=-e/(s.y-t.y);s.multiplyScalar(A),t.multiplyScalar(1-A).add(s)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:s,yaw:r}=t,o=t.boundingSphere.radius,A=this.goalPosition,l=t.scale.x,h=this.placementBox;let c=mn.NONE;if(!A.equals(s)||this.goalScale!==l){c=mn.USER_INTERACTION;let{x:r,y:d,z:g}=s;r=this.xDamper.update(r,A.x,e,o),d=this.yDamper.update(d,A.y,e,o),g=this.zDamper.update(g,A.z,e,o),s.set(r,d,g);const p=this.scaleDamper.update(l,this.goalScale,e,1);if(t.scale.set(p,p,p),!this.isTranslating){const e=A.y-d;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/p,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(r,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:c}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const s=this.threeRenderer.xr.getReferenceSpace(),r=t.getViewerPose(s);null==r&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:vn}));const o=this.presentedScene;if(null==r||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:wn}));let A=!0;for(const s of r.views){if(this.updateView(s),A){this.moveToFloor(t),this.processInput(t);const s=e-this.lastTick;this.moveScene(s),this.renderer.preRender(o,e,s),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),A=!1}}}function clone(e){const t=new Map,s=new Map,r=e.clone();return parallelTraverse(e,r,(function(e,r){t.set(r,e),s.set(e,r)})),r.traverse((function(e){if(!e.isSkinnedMesh)return;const r=e,o=t.get(e),A=o.skeleton.bones;r.skeleton=o.skeleton.clone(),r.bindMatrix.copy(o.bindMatrix),r.skeleton.bones=A.map((function(e){return s.get(e)})),r.bind(r.skeleton,r.bindMatrix)})),r}function parallelTraverse(e,t,s){s(e,t);for(let r=0;r<e.children.length;r++)parallelTraverse(e.children[r],t.children[r],s)}const Mn=Symbol("prepared"),Tn=Symbol("prepare"),Rn=Symbol("preparedGLTF"),Dn=Symbol("clone");class GLTFInstance{constructor(e){this[Rn]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[Mn])return e;const t=this[Tn](e);return t[Mn]=!0,t}static[Tn](e){const{scene:t}=e,s=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:s})}get parser(){return this[Rn].parser}get animations(){return this[Rn].animations}get scene(){return this[Rn].scene}get scenes(){return this[Rn].scenes}get cameras(){return this[Rn].cameras}get asset(){return this[Rn].asset}get userData(){return this[Rn].userData}clone(){return new(0,this.constructor)(this[Dn]())}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 s=e[t];if(s instanceof o.xEZ){const e=s.source.data;null!=e.close&&e.close(),s.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[Dn](){const e=this[Rn],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const s=[t],r=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:s,userData:r})}}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,s)=>{s(e,t);for(let r=0;r<e.children.length;r++)traversePair(e.children[r],t.children[r],s)},Ln=Symbol("threeGLTF"),Fn=Symbol("gltf"),kn=Symbol("gltfElementMap"),_n=Symbol("threeObjectMap"),Un=Symbol("parallelTraverseThreeScene"),Gn=Symbol("correlateOriginalThreeGLTF"),Nn=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,s,r){this[Ln]=e,this[Fn]=t,this[kn]=r,this[_n]=s}static from(e,t){return null!=t?this[Nn](e,t):this[Gn](e)}static[Gn](e){const t=e.parser.json,s=e.parser.associations,r=new Map,A={name:"Default"},l={type:"materials",index:-1};for(const e of s.keys())e instanceof o.F5T&&null==s.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(A)),e.name=A.name,s.set(e,{materials:l.index}));for(const[e,o]of s){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const s in o)if(null!=s&&"primitives"!==s){const A=s,l=(t[A]||[])[o[A]];if(null==l)continue;let h=r.get(l);null==h&&(h=new Set,r.set(l,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,s,r)}static[Nn](e,t){const s=t.threeGLTF,r=t.gltf,o=JSON.parse(JSON.stringify(r)),A=new Map,l=new Map;for(let r=0;r<s.scenes.length;r++)this[Un](s.scenes[r],e.scenes[r],((e,s)=>{const r=t.threeObjectMap.get(e);if(null!=r)for(const e in r)if(null!=e&&"primitives"!==e){const t=e,h=r[t],c=o[t][h],d=A.get(s)||{};d[t]=h,A.set(s,d);const g=l.get(c)||new Set;g.add(s),l.set(c,g)}}));return new CorrelatedSceneGraph(e,o,A,l)}static[Un](e,t,s){const traverse=(e,t)=>{if(s(e,t),e.isObject3D){const r=e,o=t;if(r.material)if(Array.isArray(r.material))for(let e=0;e<r.material.length;++e)s(r.material[e],o.material[e]);else s(r.material,o.material);for(let s=0;s<e.children.length;++s)traverse(e.children[s],t.children[s])}};traverse(e,t)}get threeGLTF(){return this[Ln]}get gltf(){return this[Fn]}get gltfElementMap(){return this[kn]}get threeObjectMap(){return this[_n]}}const Pn=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[Tn](e){const t=super[Tn](e);null==t[Pn]&&(t[Pn]=CorrelatedSceneGraph.from(t));const{scene:s}=t,r=new o.aLr(void 0,1/0);return s.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const s=e;if(s.material){const{geometry:e}=s;s.castShadow=!0,s.isSkinnedMesh&&(e.boundingSphere=r,e.boundingBox=null);const A=s.material;if(!0===A.isMeshBasicMaterial&&(A.toneMapped=!1),A.shadowSide=o.Wl3,A.aoMap){const{gltf:s,threeObjectMap:r}=t[Pn],o=r.get(A);if(null!=s.materials&&null!=o&&null!=o.materials){const t=s.materials[o.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[Rn][Pn]}[Dn](){const e=super[Dn](),t=new Map;return e.scene.traverse((e=>{const s=e;if(s.material){const e=s.material;if(null!=e){if(t.has(e.uuid))return void(s.material=t.get(e.uuid));s.material=e.clone(),t.set(e.uuid,s.material)}}const r=e;void 0!==r.target&&r.add(r.target)})),e[Pn]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var On=s(25108);const getBufferForType=(e,t,s)=>{let r;switch(e){case o.ywz:r=new Uint8ClampedArray(t*s*4);break;case o.cLu:r=new Uint16Array(t*s*4);break;case o.JQ4:r=new Uint32Array(t*s*4);break;case o.T95:r=new Int8Array(t*s*4);break;case o.iAb:r=new Int16Array(t*s*4);break;case o.Kz5:r=new Int32Array(t*s*4);break;case o.VzW:r=new Float32Array(t*s*4);break;default:throw new Error("Unsupported data type")}return r};let Hn;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B;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 y={format:o.wk1,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===(s=e.renderTargetOptions)||void 0===s?void 0:s.anisotropy:1,generateMipmaps:void 0!==(null===(r=e.renderTargetOptions)||void 0===r?void 0:r.generateMipmaps)&&(null===(A=e.renderTargetOptions)||void 0===A?void 0:A.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(h=e.renderTargetOptions)||void 0===h?void 0:h.magFilter:o.wem,minFilter:void 0!==(null===(c=e.renderTargetOptions)||void 0===c?void 0:c.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:o.wem,samples:void 0!==(null===(g=e.renderTargetOptions)||void 0===g?void 0:g.samples)?null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapS:o.uWy,wrapT:void 0!==(null===(I=e.renderTargetOptions)||void 0===I?void 0:I.wrapT)?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.wrapT:o.uWy};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new o.xsS,this._camera=new o.iKG,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,s,r)=>{if(void 0!==Hn)return Hn;const A=new o.dd2(1,1,r);t.setRenderTarget(A);const l=new o.Kj0(new o._12,new o.vBJ({color:16777215}));t.render(l,s),t.setRenderTarget(null);const h=getBufferForType(e,A.width,A.height);return t.readRenderTargetPixels(A,0,0,A.width,A.height,h),A.dispose(),l.geometry.dispose(),l.material.dispose(),Hn=0!==h[0],Hn})(this._type,this._renderer,this._camera,y)){let e;if(this._type===o.cLu)e=this._renderer.extensions.has("EXT_color_buffer_float")?o.VzW:void 0;void 0!==e?(On.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${o.VzW}`),this._type=e):(this._supportsReadPixels=!1,On.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new o.Kj0(new o._12,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new o.dd2(this.width,this.height,y),this._renderTarget.texture.mapping=void 0!==(null===(C=e.renderTargetOptions)||void 0===C?void 0:C.mapping)?null===(B=e.renderTargetOptions)||void 0===B?void 0:B.mapping:o.xfE}static instantiateRenderer(){const e=new o.CP7;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 o.IEO(this.toArray(),this.width,this.height,o.wk1,this._type,(null==e?void 0:e.mapping)||o.xfE,(null==e?void 0:e.wrapS)||o.uWy,(null==e?void 0:e.wrapT)||o.uWy,(null==e?void 0:e.magFilter)||o.wem,(null==e?void 0:e.minFilter)||o.wem,(null==e?void 0:e.anisotropy)||1,o.GUF);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 o.jyz&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof o.xEZ&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof o.xEZ&&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 Vn=s(25108);class GainMapDecoderMaterial extends o.jyz{constructor({gamma:e,offsetHdr:t,offsetSdr:s,gainMapMin:r,gainMapMax:A,maxDisplayBoost:l,hdrCapacityMin:h,hdrCapacityMax:c,sdr:d,gainMap:g}){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:g},gamma:{value:new o.Pa4(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new o.Pa4).fromArray(t)},offsetSdr:{value:(new o.Pa4).fromArray(s)},gainMapMin:{value:(new o.Pa4).fromArray(r)},gainMapMax:{value:(new o.Pa4).fromArray(A)},weightFactor:{value:(Math.log2(l)-h)/(c-h)}},blending:o.jFi,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=h,this._hdrCapacityMax=c,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,s)=>{var r;let o;const A=null===(r=e.attributes.getNamedItem(t))||void 0===r?void 0:r.nodeValue;if(A)o=A;else{const r=e.getElementsByTagName(t)[0];if(!r){if(s)return s;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=r.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,s)=>{const r=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void s(new Error("Not a valid jpeg"));const A=o.byteLength;let l,h=2,c=0;for(;h<A;){if(++c>250)return void s(new Error(`Found no marker after ${c} loops 😵`));if(255!==o.getUint8(h))return void s(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(l=o.getUint8(h+1),r&&Vn.log(`Marker: ${l.toString(16)}`),226===l){r&&Vn.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const r=e+4;let A;if(18761===o.getUint16(r))A=!1;else{if(19789!==o.getUint16(r))return void s(new Error("No valid endianness marker found in TIFF header"));A=!0}if(42!==o.getUint16(r+2,!A))return void s(new Error("Not valid TIFF data! (no 0x002A marker)"));const l=o.getUint32(r+4,!A);if(l<8)return void s(new Error("Not valid TIFF data! (First offset less than 8)"));const h=r+l,c=o.getUint16(h,!A),d=h+2;let g=0;for(let e=d;e<d+12*c;e+=12)45057===o.getUint16(e,!A)&&(g=o.getUint32(e+8,!A));const p=h+2+12*c+4,m=[];for(let e=p;e<p+16*g;e+=16){const t={MPType:o.getUint32(e,!A),size:o.getUint32(e+4,!A),dataOffset:o.getUint32(e+8,!A),dependantImages:o.getUint32(e+12,!A),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=r+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,m.push(t)}if(this.options.extractNonFII&&m.length){const e=new Blob([o]),s=[];for(const t of m){if(t.isFII&&!this.options.extractFII)continue;const r=e.slice(t.start,t.end+1,"image/jpeg");s.push(r)}t(s)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,s;let r;r="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=r.indexOf("<x:xmpmeta");const A=new DOMParser;for(;-1!==o;){const e=r.indexOf("x:xmpmeta>",o);r.slice(o,e+10);const l=r.slice(o,e+10);try{const e=A.parseFromString(l,"text/xml").getElementsByTagName("rdf:Description")[0],r=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),c=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),d=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let g=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;g||(g="0");const p=null===(s=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===s?void 0:s.nodeValue;if(!p)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(r)?r.map((e=>parseFloat(e))):[parseFloat(r),parseFloat(r),parseFloat(r)],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(c)?c.map((e=>parseFloat(e))):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetHdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],hdrCapacityMin:parseFloat(g),hdrCapacityMax:parseFloat(p)}}catch(e){}o=r.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const s=new MPFExtractor({extractFII:!0,extractNonFII:!0}),r=await s.extract(e);if(2!==r.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await r[0].arrayBuffer()),gainMap:new Uint8Array(await r[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,s)=>{const r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=e=>{s(e)},r.src=URL.createObjectURL(e)}));class LoaderBase extends o.aNw{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new o.lLk}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 o.xEZ,sdr:new o.xEZ});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:o.cLu,colorSpace:o.GUF,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,s,r){const A=r?new Blob([r],{type:"image/jpeg"}):void 0,l=new Blob([s],{type:"image/jpeg"});let h,c,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([A?getHTMLImageFromBlob(A):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);c=e[0],h=e[1],d=!0}else{const e=await Promise.all([A?createImageBitmap(A,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);c=e[0],h=e[1]}const g=new o.xEZ(c||new ImageData(2,2),o.xfE,o.uWy,o.uWy,o.wem,o.FDw,o.wk1,o.ywz,1,o.GUF);g.flipY=d,g.needsUpdate=!0;const p=new o.xEZ(h,o.xfE,o.uWy,o.uWy,o.wem,o.FDw,o.wk1,o.ywz,1,o.KI_);p.flipY=d,p.needsUpdate=!0,e.width=h.width,e.height=h.height,e.material.gainMap=g,e.material.sdr=p,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,s,r){const A=this.prepareQuadRenderer(),l=new o.hH6(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 s=>{if("string"==typeof s)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const o=new Uint8Array(s);let l,h,c;try{const e=await extractGainmapFromJPEG(o);l=e.sdr,h=e.gainMap,c=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Vn.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),c={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},l=o}try{await this.render(A,c,l,h)}catch(t){return this.manager.itemError(e),"function"==typeof r&&r(t),void A.disposeOnDemandRenderer()}"function"==typeof t&&t(A),this.manager.itemEnd(e),A.disposeOnDemandRenderer()}),s,(t=>{this.manager.itemError(e),"function"==typeof r&&r(t)})),A}}class RGBELoader extends o.yxD{constructor(e){super(e),this.type=o.cLu}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,s){t=t||1024;let r=e.pos,o=-1,A=0,l="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(o=h.indexOf("\n"))&&A<t&&r<e.byteLength;)l+=h,A+=h.length,r+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<o&&(!1!==s&&(e.pos+=A+o+1),l+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,s,r){const o=e[t+3],A=Math.pow(2,o-128)/255;s[r+0]=e[t+0]*A,s[r+1]=e[t+1]*A,s[r+2]=e[t+2]*A,s[r+3]=1},RGBEByteToRGBHalf=function(e,t,s,r){const A=e[t+3],l=Math.pow(2,A-128)/255;s[r+0]=o.A5E.toHalfFloat(Math.min(e[t+0]*l,65504)),s[r+1]=o.A5E.toHalfFloat(Math.min(e[t+1]*l,65504)),s[r+2]=o.A5E.toHalfFloat(Math.min(e[t+2]*l,65504)),s[r+3]=o.A5E.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const s=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,A={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,h;for((e.pos>=e.byteLength||!(l=fgets(e)))&&rgbe_error(1,"no header found"),(h=l.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),A.valid|=1,A.programtype=h[1],A.string+=l+"\n";l=fgets(e),!1!==l;)if(A.string+=l+"\n","#"!==l.charAt(0)){if((h=l.match(t))&&(A.gamma=parseFloat(h[1])),(h=l.match(s))&&(A.exposure=parseFloat(h[1])),(h=l.match(r))&&(A.valid|=2,A.format=h[1]),(h=l.match(o))&&(A.valid|=4,A.height=parseInt(h[1],10),A.width=parseInt(h[2],10)),2&A.valid&&4&A.valid)break}else A.comments+=l+"\n";return 2&A.valid||rgbe_error(3,"missing format specifier"),4&A.valid||rgbe_error(3,"missing image size specifier"),A}(t),r=s.width,A=s.height,l=function(e,t,s){const r=t;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*s);o.length||rgbe_error(4,"unable to allocate buffer space");let A=0,l=0;const h=4*r,c=new Uint8Array(4),d=new Uint8Array(h);let g=s;for(;g>0&&l<e.byteLength;){l+4>e.byteLength&&rgbe_error(1),c[0]=e[l++],c[1]=e[l++],c[2]=e[l++],c[3]=e[l++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||rgbe_error(3,"bad rgbe scanline format");let t,s=0;for(;s<h&&l<e.byteLength;){t=e[l++];const r=t>128;if(r&&(t-=128),(0===t||s+t>h)&&rgbe_error(3,"bad scanline data"),r){const r=e[l++];for(let e=0;e<t;e++)d[s++]=r}else d.set(e.subarray(l,l+t),s),s+=t,l+=t}const p=r;for(let e=0;e<p;e++){let t=0;o[A]=d[e+t],t+=r,o[A+1]=d[e+t],t+=r,o[A+2]=d[e+t],t+=r,o[A+3]=d[e+t],A+=4}g--}return o}(t.subarray(t.pos),r,A);let h,c,d;switch(this.type){case o.VzW:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);h=e,c=o.VzW;break;case o.cLu:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);h=t,c=o.cLu;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:r,height:A,data:h,header:s.string,gamma:s.gamma,exposure:s.exposure,type:c}}setDataType(e){return this.type=e,this}load(e,t,s,r){return super.load(e,(function onLoadCallback(e,s){switch(e.type){case o.VzW:case o.cLu:e.colorSpace=o.GUF,e.minFilter=o.wem,e.magFilter=o.wem,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,s)}),s,r)}}const qn={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]}]},Kn={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 o.xsS{constructor(e){super(),this.position.y=-3.5;const t=new o.DvJ;t.deleteAttribute("uv");const s=new o.Wid({metalness:0,side:o._Li}),r=new o.Wid({metalness:0}),A="legacy"==e?qn:Kn,l=new o.cek(16777215,A.topLight.intensity,28,2);l.position.set(...A.topLight.position),this.add(l);const h=new o.Kj0(t,s);h.position.set(...A.room.position),h.scale.set(...A.room.scale),this.add(h);for(const e of A.boxes){const s=new o.Kj0(t,r);s.position.set(...e.position),s.rotation.set(0,e.rotation,0),s.scale.set(...e.scale),this.add(s)}for(const e of A.lights){const s=new o.Kj0(t,this.createAreaLightMaterial(e.intensity));s.position.set(...e.position),s.scale.set(...e.scale),this.add(s)}}createAreaLightMaterial(e){const t=new o.vBJ;return t.color.setScalar(e),t}}var Jn=s(25108);const zn=20,Yn=/\.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 o.dpR),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(o.cLu)),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,s)=>this.ldrLoader.load(e,t,(()=>{}),s)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const s=await this.getLottieLoader();s.setQuality(t);const r=await new Promise(((t,r)=>s.load(e,t,(()=>{}),r)));return r.name=e,r}async loadEquirect(e,t=()=>{}){try{const s=Yn.test(e),r=s?this.hdrLoader:this.imageLoader,A=await new Promise(((s,o)=>r.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:r}=t;e.dispose(!1),s(r)}else s(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),A.name=e,A.mapping=o.dSO,s||(A.colorSpace=o.KI_),A}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,s=()=>{}){const r="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,A=Promise.resolve(null);e&&(A=this.loadEquirectFromUrl(e,s)),o=t?this.loadEquirectFromUrl(t,s):e?this.loadEquirectFromUrl(e,s):r?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[l,h]=await Promise.all([o,A]);if(null==l)throw new Error("Failed to load environment map.");return{environmentMap:l,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const s=this.loadEquirect(e,t);this.skyboxCache.set(e,s)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const s=this.threeRenderer,r=new o.oAp(256,{generateMipmaps:!1,type:o.cLu,format:o.wk1,colorSpace:o.GUF,depthBuffer:!0}),A=new o._am(.1,100,r),l=A.renderTarget.texture;l.name=t;const h=s.outputColorSpace,c=s.toneMapping;return s.toneMapping=o.uL9,s.outputColorSpace=o.GUF,A.update(s,e),this.blurCubemap(r,.04),s.toneMapping=c,s.outputColorSpace=h,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(zn);const e=new o.DvJ,t=new o.Kj0(e,this.blurMaterial);this.blurScene=new o.xsS,this.blurScene.add(t)}const s=e.clone();this.halfblur(e,s,t,"latitudinal"),this.halfblur(s,e,t,"longitudinal")}halfblur(e,t,s,r){const A=e.width,l=isFinite(s)?Math.PI/(2*A):2*Math.PI/39,h=s/l,c=isFinite(s)?1+Math.floor(3*h):zn;c>zn&&Jn.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${c} samples when the maximum is set to 20`);const d=[];let g=0;for(let e=0;e<zn;++e){const t=e/h,s=Math.exp(-t*t/2);d.push(s),0==e?g+=s:e<c&&(g+=2*s)}for(let e=0;e<d.length;e++)d[e]=d[e]/g;const p=this.blurMaterial.uniforms;p.envMap.value=e.texture,p.samples.value=c,p.weights.value=d,p.latitudinal.value="latitudinal"===r,p.dTheta.value=l;new o._am(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),s=new o.Pa4(0,1,0);return new o.jyz({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:s}},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:o.jFi,depthTest:!1,depthWrite:!1,side:o._Li})}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 jn=s(25108);const $n=[1,.79,.62,.5,.4,.31,.25],Wn="high-performance";class Renderer extends o.pBf{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[xe]()},this.dpr=ye(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new o.CP7({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=o.LY2}catch(e){jn.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||Wn,debug:we()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||Wn,debug:we()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return $n[this.scaleStep]}set minScale(e){let t=1;for(;t<$n.length&&!($n[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new o.FM8;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[xo]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,s=null;for(const r of this.scenes){const{element:o}=r;o.modelIsVisible&&null==r.externalRenderer&&++t,e.parentElement===r.canvas.parentElement&&(s=r)}const r=t>1;if(null!=s){const t=r&&!this.multipleScenesVisible,o=!s.element.modelIsVisible;if(t||o){const{width:t,height:r}=this.sceneSize(s);this.copyPixels(s,t,r),e.parentElement.removeChild(e)}}this.multipleScenesVisible=r}updateRendererSize(){var e;const t=ye();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[uo](t.getBoundingClientRect())}let s=0,r=0;for(const e of this.scenes)s=Math.max(s,e.width),r=Math.max(r,e.height);if(s!==this.width||r!==this.height||t!==this.dpr){this.width=s,this.height=r,this.dpr=t,s=Math.ceil(s*t),r=Math.ceil(r*t),this.canRender&&this.threeRenderer.setSize(s,r,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=s,o.height=r,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(s,r)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=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=$n[e.scaleStep],s=Math.ceil(this.width/t),r=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${s}px`,o.height=`${r}px`,this.canvas3D.style.width=`${s}px`,this.canvas3D.style.height=`${r}px`;const A=this.dpr*t,l=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:A,minimumDpr:this.dpr*$n[this.lastStep],pixelWidth:Math.ceil(e.width*A),pixelHeight:Math.ceil(e.height*A),reason:l}}))}sceneSize(e){const{dpr:t}=this,s=$n[e.scaleStep];return{width:Math.min(Math.ceil(e.width*s*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*s*t),this.canvas3D.height)}}copyPixels(e,t,s){const r=e.context;null!=r?(r.clearRect(0,0,t,s),r.drawImage(this.canvas3D,0,0,t,s,0,0,t,s),e.canvas.classList.add("show")):jn.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const s of this.scenes)s.element.modelIsVisible===t&&e.push(s);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,s){const{element:r,exposure:A,toneMapping:l}=e;r[Mo](t,s);const h="number"==typeof A&&!Number.isNaN(A),c=r.environmentImage,d=r.skyboxImage,g=l===o.ORg&&("neutral"===c||"legacy"===c||!c&&!d);this.threeRenderer.toneMappingExposure=(h?A:1)*(g?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const s=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(s),this.renderedLastFrame=!1);const{canvas3D:r}=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,s),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:s,projectionMatrix:r}=e,o=s.elements.slice(),A=t.getTarget();o[12]+=A.x,o[13]+=A.y,o[14]+=A.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:r.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:A,height:l}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-l,A,l),null!=t.effectRenderer?t.effectRenderer.render(s):(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,A,l):r.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(r),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 Xn=Symbol("correlatedObjects"),Zn=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[Zn]=e,this[Xn]=t}}const er=new o.vBJ,tr=new o._12(2,2);let ir=0;const sr=Symbol("threeTexture"),nr=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[sr](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get[nr](){return this[Xn]}constructor(e,t){super(e,new Set(t?[t]:[])),this[sr].image.src||(this[sr].image.src=t.name?t.name:"adhoc_image"+ir++),this[sr].image.name||(this[sr].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[sr].image.name||""}get uri(){return this[sr].image.src}get bufferView(){return this[sr].image.bufferView}get element(){const e=this[sr];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[sr];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[nr])t.image.name=e}update(){const e=this[sr];e&&e.isCanvasTexture&&!e.animation&&(this[sr].needsUpdate=!0,this[Zn]())}async createThumbnail(e,t){const s=new o.xsS;er.map=this[sr];const r=new o.Kj0(tr,er);s.add(r);const A=new o.iKG(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,h=new o.dd2(e,t);l.setRenderTarget(h),l.render(s,A),l.setRenderTarget(null);const c=new Uint8Array(e*t*4);l.readRenderTargetPixels(h,0,0,e,t,c),io.width=e,io.height=t;const d=io.getContext("2d"),g=d.createImageData(e,t);return g.data.set(c),d.putImageData(g,0,0),new Promise((async(e,t)=>{io.toBlob((s=>{if(!s)return t("Failed to capture thumbnail.");e(URL.createObjectURL(s))}),"image/png")}))}}var rr,ar;!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"}(rr||(rr={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(ar||(ar={}));const or=new Map([[ar.Repeat,o.rpg],[ar.ClampToEdge,o.uWy],[ar.MirroredRepeat,o.OoA]]),Ar=new Map([[o.rpg,ar.Repeat],[o.uWy,ar.ClampToEdge],[o.OoA,ar.MirroredRepeat]]),lr=new Map([[rr.Nearest,o.TyD],[rr.Linear,o.wem],[rr.NearestMipmapNearest,o.YLQ],[rr.LinearMipmapNearest,o.qyh],[rr.NearestMipmapLinear,o.aH4],[rr.LinearMipmapLinear,o.D1R]]),hr=new Map([[o.TyD,rr.Nearest],[o.wem,rr.Linear],[o.YLQ,rr.NearestMipmapNearest],[o.qyh,rr.LinearMipmapNearest],[o.aH4,rr.NearestMipmapLinear],[o.D1R,rr.LinearMipmapLinear]]),cr=new Map([[rr.Nearest,o.TyD],[rr.Linear,o.wem]]),ur=new Map([[o.TyD,rr.Nearest],[o.wem,rr.Linear]]),isMinFilter=e=>hr.has(e),isMagFilter=e=>ur.has(e),isWrapping=e=>Ar.has(e),dr=Symbol("threeTexture"),gr=Symbol("threeTextures"),pr=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[dr](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get[gr](){return this[Xn]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[dr].name||""}get minFilter(){return hr.get(this[dr].minFilter)}get magFilter(){return ur.get(this[dr].magFilter)}get wrapS(){return Ar.get(this[dr].wrapS)}get wrapT(){return Ar.get(this[dr].wrapT)}get rotation(){return this[dr].rotation}get scale(){return toVector2D(this[dr].repeat)}get offset(){return toVector2D(this[dr].offset)}setMinFilter(e){this[pr]("minFilter",lr.get(e))}setMagFilter(e){this[pr]("magFilter",cr.get(e))}setWrapS(e){this[pr]("wrapS",or.get(e))}setWrapT(e){this[pr]("wrapT",or.get(e))}setRotation(e){null==e&&(e=0),this[pr]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[pr]("repeat",new o.FM8(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[pr]("offset",new o.FM8(e.u,e.v))}[pr](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 s of this[gr])s[e]=t,s.needsUpdate=!0;this[Zn]()}}const mr=Symbol("image"),fr=Symbol("sampler"),Ir=Symbol("threeTexture");class Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[fr]=new Sampler(e,t),this[mr]=new image_Image(e,t)}get[Ir](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get name(){return this[Ir].name||""}set name(e){for(const t of this[Xn])t.name=e}get sampler(){return this[fr]}get source(){return this[mr]}}var Er,Cr,Br;const yr=Symbol("texture"),wr=Symbol("transform"),vr=Symbol("materials"),Qr=Symbol("usage"),xr=Symbol("onUpdate"),br=Symbol("activeVideo");var Sr;!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"}(Sr||(Sr={}));class TextureInfo{constructor(e,t,s,r){this[Er]=null,this[Cr]={rotation:0,scale:new o.FM8(1,1),offset:new o.FM8(0,0)},this[Br]=!1,s&&(this[wr].rotation=s.rotation,this[wr].scale.copy(s.repeat),this[wr].offset.copy(s.offset),this[yr]=new Texture(e,s)),this[xr]=e,this[vr]=r,this[Qr]=t}get texture(){return this[yr]}setTexture(e){var t,s;const r=null!=e?e.source[sr]:null,A=null===(t=this[yr])||void 0===t?void 0:t.source[sr];if(null!=A&&A.isVideoTexture?this[br]=!1:(null===(s=this[yr])||void 0===s?void 0:s.source.animation)&&this[yr].source.animation.removeEventListener("enterFrame",this[xr]),this[yr]=e,null!=r&&r.isVideoTexture){const e=r.image;if(this[br]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[br]&&(this[xr](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[br]&&(this[xr](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[xr]);let l=o.KI_;if(this[vr])for(const e of this[vr]){switch(this[Qr]){case Sr.Base:e.map=r;break;case Sr.MetallicRoughness:l=o.GUF,e.metalnessMap=r,e.roughnessMap=r;break;case Sr.Normal:l=o.GUF,e.normalMap=r;break;case Sr.Occlusion:l=o.GUF,e.aoMap=r;break;case Sr.Emissive:e.emissiveMap=r;break;case Sr.Clearcoat:e.clearcoatMap=r;break;case Sr.ClearcoatRoughness:e.clearcoatRoughnessMap=r;break;case Sr.ClearcoatNormal:e.clearcoatNormalMap=r;break;case Sr.SheenColor:e.sheenColorMap=r;break;case Sr.SheenRoughness:e.sheenRoughnessMap=r;break;case Sr.Transmission:e.transmissionMap=r;break;case Sr.Thickness:e.thicknessMap=r;break;case Sr.Specular:e.specularIntensityMap=r;break;case Sr.SpecularColor:e.specularColorMap=r;break;case Sr.Iridescence:e.iridescenceMap=r;break;case Sr.IridescenceThickness:e.iridescenceThicknessMap=r;break;case Sr.Anisotropy:e.anisotropyMap=r}e.needsUpdate=!0}r&&(r.colorSpace=l,r.rotation=this[wr].rotation,r.repeat=this[wr].scale,r.offset=this[wr].offset),this[xr]()}}Er=yr,Cr=wr,Br=br;const Mr=Symbol("threeMaterial"),Tr=Symbol("threeMaterials"),Rr=Symbol("baseColorTexture"),Dr=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:s,metalnessMap:r}=t.values().next().value;this[Rr]=new TextureInfo(e,Sr.Base,s,t),this[Dr]=new TextureInfo(e,Sr.MetallicRoughness,r,t)}get[Tr](){return this[Xn]}get[Mr](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[Mr].opacity];return this[Mr].color.toArray(e),e}get metallicFactor(){return this[Mr].metalness}get roughnessFactor(){return this[Mr].roughness}get baseColorTexture(){return this[Rr]}get metallicRoughnessTexture(){return this[Dr]}setBaseColorFactor(e){const t=new o.Ilk;e instanceof Array?t.fromArray(e):t.set(e);for(const s of this[Tr])s.color.set(t),e instanceof Array&&e.length>3?s.opacity=e[3]:(e=[0,0,0,s.opacity],t.toArray(e));this[Zn]()}setMetallicFactor(e){for(const t of this[Tr])t.metalness=e;this[Zn]()}setRoughnessFactor(e){for(const t of this[Tr])t.roughness=e;this[Zn]()}}var Lr,Fr;const kr=Symbol("pbrMetallicRoughness"),_r=Symbol("normalTexture"),Ur=Symbol("occlusionTexture"),Gr=Symbol("emissiveTexture"),Nr=Symbol("backingThreeMaterial"),Pr=Symbol("applyAlphaCutoff"),Or=Symbol("getAlphaMode"),Hr=Symbol("lazyLoadGLTFInfo"),Vr=Symbol("initialize"),qr=Symbol("getLoadedMaterial"),Kr=Symbol("ensureMaterialIsLoaded"),Jr=Symbol("gltfIndex"),zr=Symbol("setActive"),Yr=Symbol("variantIndices"),jr=Symbol("isActive"),$r=Symbol("variantSet"),Wr=Symbol("modelVariants"),Xr=Symbol("name"),Zr=Symbol("pbrTextures");class Material extends ThreeDOMElement{constructor(e,t,s,r,o,A,l=void 0){super(e,o),this[Lr]=new Set,this[Fr]=new Map,this[Jr]=t,this[jr]=s,this[Wr]=r,this[Xr]=A,null==l?this[Vr]():this[Hr]=l}get[(Lr=$r,Fr=Zr,Nr)](){return this[Xn].values().next().value}[Vr](){const e=this[Zn],t=this[Xn];this[kr]=new PBRMetallicRoughness(e,t);const{normalMap:s,aoMap:r,emissiveMap:o}=t.values().next().value;this[_r]=new TextureInfo(e,Sr.Normal,s,t),this[Ur]=new TextureInfo(e,Sr.Occlusion,r,t),this[Gr]=new TextureInfo(e,Sr.Emissive,o,t);const createTextureInfo=s=>{this[Zr].set(s,new TextureInfo(e,s,null,t))};createTextureInfo(Sr.Clearcoat),createTextureInfo(Sr.ClearcoatRoughness),createTextureInfo(Sr.ClearcoatNormal),createTextureInfo(Sr.SheenColor),createTextureInfo(Sr.SheenRoughness),createTextureInfo(Sr.Transmission),createTextureInfo(Sr.Thickness),createTextureInfo(Sr.Specular),createTextureInfo(Sr.SpecularColor),createTextureInfo(Sr.Iridescence),createTextureInfo(Sr.IridescenceThickness),createTextureInfo(Sr.Anisotropy)}async[qr](){if(null!=this[Hr]){const{set:e,material:t}=await this[Hr].doLazyLoad();return this[Xn]=e,this[Vr](),this[Hr]=void 0,this.ensureLoaded=async()=>{},t}return this[Xn].values().next().value}colorFromRgb(e){const t=new o.Ilk;return e instanceof Array?t.fromArray(e):t.set(e),t}[Kr](){if(null!=this[Hr])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[qr]()}get isLoaded(){return null==this[Hr]}get isActive(){return this[jr]}[zr](e){this[jr]=e}get name(){return this[Xr]||""}set name(e){if(this[Xr]=e,null!=this[Xn])for(const t of this[Xn])t.name=e}get pbrMetallicRoughness(){return this[Kr](),this[kr]}get normalTexture(){return this[Kr](),this[_r]}get occlusionTexture(){return this[Kr](),this[Ur]}get emissiveTexture(){return this[Kr](),this[Gr]}get emissiveFactor(){return this[Kr](),this[Nr].emissive.toArray()}get index(){return this[Jr]}[Yr](){return this[$r]}hasVariant(e){const t=this[Wr].get(e);return null!=t&&this[$r].has(t.index)}setEmissiveFactor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.emissive.set(t);this[Zn]()}[Or](){return this[Nr].transparent?"BLEND":this[Nr].alphaTest>0?"MASK":"OPAQUE"}[Pr](){this[Kr]();for(const e of this[Xn])"MASK"===this[Or]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[Kr]();for(const t of this[Xn])t.alphaTest=e,t.needsUpdate=!0;this[Pr](),this[Zn]()}getAlphaCutoff(){return this[Kr](),this[Nr].alphaTest}setDoubleSided(e){this[Kr]();for(const t of this[Xn])t.side=e?o.ehD:o.Wl3,t.needsUpdate=!0;this[Zn]()}getDoubleSided(){return this[Kr](),this[Nr].side==o.ehD}setAlphaMode(e){this[Kr]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[Xn])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[Zn]()}getAlphaMode(){return this[Kr](),this[Or]()}get emissiveStrength(){return this[Kr](),this[Nr].emissiveIntensity}setEmissiveStrength(e){this[Kr]();for(const t of this[Xn])t.emissiveIntensity=e;this[Zn]()}get clearcoatFactor(){return this[Kr](),this[Nr].clearcoat}get clearcoatRoughnessFactor(){return this[Kr](),this[Nr].clearcoatRoughness}get clearcoatTexture(){return this[Kr](),this[Zr].get(Sr.Clearcoat)}get clearcoatRoughnessTexture(){return this[Kr](),this[Zr].get(Sr.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Kr](),this[Zr].get(Sr.ClearcoatNormal)}get clearcoatNormalScale(){return this[Kr](),this[Nr].clearcoatNormalScale.x}setClearcoatFactor(e){this[Kr]();for(const t of this[Xn])t.clearcoat=e;this[Zn]()}setClearcoatRoughnessFactor(e){this[Kr]();for(const t of this[Xn])t.clearcoatRoughness=e;this[Zn]()}setClearcoatNormalScale(e){this[Kr]();for(const t of this[Xn])t.clearcoatNormalScale=new o.FM8(e,e);this[Zn]()}get ior(){return this[Kr](),this[Nr].ior}setIor(e){this[Kr]();for(const t of this[Xn])t.ior=e;this[Zn]()}get sheenColorFactor(){return this[Kr](),this[Nr].sheenColor.toArray()}get sheenColorTexture(){return this[Kr](),this[Zr].get(Sr.SheenColor)}get sheenRoughnessFactor(){return this[Kr](),this[Nr].sheenRoughness}get sheenRoughnessTexture(){return this[Kr](),this[Zr].get(Sr.SheenRoughness)}setSheenColorFactor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.sheenColor.set(t),e.sheen=1;this[Zn]()}setSheenRoughnessFactor(e){this[Kr]();for(const t of this[Xn])t.sheenRoughness=e,t.sheen=1;this[Zn]()}get transmissionFactor(){return this[Kr](),this[Nr].transmission}get transmissionTexture(){return this[Kr](),this[Zr].get(Sr.Transmission)}setTransmissionFactor(e){this[Kr]();for(const t of this[Xn])t.transmission=e;this[Zn]()}get thicknessFactor(){return this[Kr](),this[Nr].thickness}get thicknessTexture(){return this[Kr](),this[Zr].get(Sr.Thickness)}get attenuationDistance(){return this[Kr](),this[Nr].attenuationDistance}get attenuationColor(){return this[Kr](),this[Nr].attenuationColor.toArray()}setThicknessFactor(e){this[Kr]();for(const t of this[Xn])t.thickness=e;this[Zn]()}setAttenuationDistance(e){this[Kr]();for(const t of this[Xn])t.attenuationDistance=e;this[Zn]()}setAttenuationColor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.attenuationColor.set(t);this[Zn]()}get specularFactor(){return this[Kr](),this[Nr].specularIntensity}get specularTexture(){return this[Kr](),this[Zr].get(Sr.Specular)}get specularColorFactor(){return this[Kr](),this[Nr].specularColor.toArray()}get specularColorTexture(){return this[Kr](),this[Zr].get(Sr.SheenColor)}setSpecularFactor(e){this[Kr]();for(const t of this[Xn])t.specularIntensity=e;this[Zn]()}setSpecularColorFactor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.specularColor.set(t);this[Zn]()}get iridescenceFactor(){return this[Kr](),this[Nr].iridescence}get iridescenceTexture(){return this[Kr](),this[Zr].get(Sr.Iridescence)}get iridescenceIor(){return this[Kr](),this[Nr].iridescenceIOR}get iridescenceThicknessMinimum(){return this[Kr](),this[Nr].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[Kr](),this[Nr].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[Kr](),this[Zr].get(Sr.IridescenceThickness)}setIridescenceFactor(e){this[Kr]();for(const t of this[Xn])t.iridescence=e;this[Zn]()}setIridescenceIor(e){this[Kr]();for(const t of this[Xn])t.iridescenceIOR=e;this[Zn]()}setIridescenceThicknessMinimum(e){this[Kr]();for(const t of this[Xn])t.iridescenceThicknessRange[0]=e;this[Zn]()}setIridescenceThicknessMaximum(e){this[Kr]();for(const t of this[Xn])t.iridescenceThicknessRange[1]=e;this[Zn]()}get anisotropyStrength(){return this[Kr](),this[Nr].anisotropy}get anisotropyRotation(){return this[Kr](),this[Nr].anisotropyRotation}get anisotropyTexture(){return this[Kr](),this[Zr].get(Sr.Anisotropy)}setAnisotropyStrength(e){this[Kr]();for(const t of this[Xn])t.anisotropy=e;this[Zn]()}setAnisotropyRotation(e){this[Kr]();for(const t of this[Xn])t.anisotropyRotation=e;this[Zn]()}}var ea=s(25108);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,s,r){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:A,threeObjectMap:l}=r;this.parser=A.parser,this.modelVariants=s,this.mesh.userData.variantData=s;const h=l.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:ea.error(`Primitive (${e.name}) missing initial material reference.`);const c=e.userData.associations||{};if(null==c.meshes)return void ea.error("Mesh is missing primitive index association");const d=((o.meshes||[])[c.meshes].primitives||[])[c.primitives];if(null!=d){if(null!=d.material)this.materials.set(d.material,t[d.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):ea.warn("gltfPrimitive has no material!")}if(d.extensions&&d.extensions.KHR_materials_variants){const e=d.extensions.KHR_materials_variants,r=A.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}=r[t];this.variantToMaterialMap.set(t,e),e[Yr]().add(t),s.has(o)||s.set(o,{name:o,index:t})}}}}else ea.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[qr]();const{normalScale:s}=this.mesh.material;null!=s&&s.y*s.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 s=await this.enableVariantHelper(e);null!=s&&(t.material=s)}}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 s=this.modelVariants.get(t).index;return e[Yr]().add(s),this.variantToMaterialMap.set(s,e),this.materials.set(e.index,e),this.updateVariantUserData(s,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[Yr]().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[Xn].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(ea.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var ta,ia,sa,na,ra,aa,oa=s(25108);const Aa=Symbol("materials"),la=Symbol("hierarchy"),ha=Symbol("roots"),ca=Symbol("primitives"),ua=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),da=Symbol("switchVariant"),ga=Symbol("materialFromPoint"),pa=Symbol("nodeFromPoint"),ma=Symbol("nodeFromIndex"),fa=Symbol("variantData"),Ia=Symbol("availableVariants"),Ea=Symbol("modelOnUpdate"),Ca=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,s,r){this.gltf=e,this.gltfElementMap=t,this.mapKey=s,this.doLazyLoad=r}}class Model{constructor(e,t=()=>{}){this[ta]=new Array,this[ia]=new Array,this[sa]=new Array,this[na]=new Array,this[ra]=()=>{},this[aa]=new Map,this[Ea]=t;const{gltf:s,threeGLTF:r,gltfElementMap:A}=e;for(const[e,o]of s.materials.entries()){const l=A.get(o);if(null!=l)this[Aa].push(new Material(t,e,!0,this[fa],l,o.name));else{const h=(s.materials||[])[e],c=e,materialLoadCallback=async()=>{const e=await r.parser.getDependency("material",c),t=new Set;return A.set(h,t),t.add(e),{set:t,material:e}};this[Aa].push(new Material(t,e,!1,this[fa],l,o.name,new LazyLoader(s,A,h,materialLoadCallback)))}}const l=new Map,h=new Array;for(const e of r.scene.children)h.push(e);for(;h.length>0;){const t=h.pop();let s=null;t instanceof o.Kj0?(s=new PrimitiveNode(t,this.materials,this[fa],e),this[ca].push(s)):s=new primitive_node_Node(t.name);const r=l.get(t);null!=r?r.children.push(s):this[ha].push(s),this[la].push(s);for(const e of t.children)h.push(e),l.set(t,s)}}get materials(){return this[Aa]}[(ta=Aa,ia=la,sa=ha,na=ca,ra=Ea,aa=fa,Ia)](){const e=Array.from(this[fa].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[Aa].filter((t=>t.name===e));return t.length>0?t[0]:null}[ma](e,t){const s=this[la].find((s=>{if(s instanceof PrimitiveNode){const{meshes:r,primitives:o}=s.mesh.userData.associations;if(r==e&&o==t)return!0}return!1}));return null==s?null:s}[pa](e){return this[la].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[ga](e){return this[pa](e).getActiveMaterial()}async[da](e){for(const t of this[ca])await t.enableVariant(e);for(const e of this.materials)e[zr](!1);for(const e of this[ca])this.materials[e.getActiveMaterial().index][zr](!0)}async[ua](){const e=new Array;for(const t of this[ca])e.push(t.instantiateVariants());await Promise.all(e)}[Ca](e,t){const s=this.materials[e];s.isLoaded||oa.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const r=s[Xn],o=new Set;for(const[e,s]of r.entries()){const A=s.clone();A.name=t+(r.size>1?"_inst"+e:""),o.add(A)}const A=new Material(this[Ea],this[Aa].length,!1,this[fa],o,t);return this[Aa].push(A),A}createMaterialInstanceForVariant(e,t,s,r=!0){let o=null;for(const r of this[ca]){const A=this[fa].get(s);null!=A&&r.variantInfo.has(A.index)||null!=r.getMaterial(e)&&(this.hasVariant(s)||this.createVariant(s),null==o&&(o=this[Ca](e,t)),r.addVariant(o,s))}if(r&&null!=o){o[zr](!0),this.materials[e][zr](!1);for(const e of this[ca])e.enableVariant(s)}return o}createVariant(e){this[fa].has(e)?oa.warn(`Variant '${e}'' already exists`):this[fa].set(e,{name:e,index:this[fa].size})}hasVariant(e){return this[fa].has(e)}setMaterialToVariant(e,t){if(null!=this[Ia]().find((e=>e===t)))if(e<0||e>=this.materials.length)oa.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const s of this[ca]){const r=s.getMaterial(e);null!=r&&s.addVariant(r,t)}else oa.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const s=this[fa].get(e);null!=s&&(s.name=t,this[fa].set(t,s),this[fa].delete(e))}deleteVariant(e){const t=this[fa].get(e);if(null!=t){for(const s of this.materials)s.hasVariant(e)&&s[$r].delete(t.index);for(const e of this[ca])e.deleteVariant(t.index);this[fa].delete(e)}}}var scene_graph_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Ba=Symbol("currentGLTF"),ya=Symbol("originalGltfJson"),wa=Symbol("model"),va=Symbol("getOnUpdateMethod"),Qa=Symbol("buildTexture");class GroundedSkybox extends o.Kj0{constructor(){super(void 0,new o.vBJ({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,s=128){e==this.height&&t==this.radius&&s==this.resolution||(this.height=e,this.radius=t,this.resolution=s,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,s){const r=new o.xo$(t,2*s,s);r.scale(1,1,-1);const A=r.getAttribute("position"),l=new o.Pa4;for(let t=0;t<A.count;++t)if(l.fromBufferAttribute(A,t),l.y<0){const s=3*-e/2,r=l.y<s?-e/l.y:1-l.y*l.y/(3*s*s);l.multiplyScalar(r),l.toArray(A.array,3*t)}return A.needsUpdate=!0,r}(e,t,s)))}}const xa=new o.Pa4,ba=new o.Pa4,Sa=new o.Pa4,Ma=new o.Vkp,Ta=new o.CJI,Ra=new o._fP;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new o.Pa4(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=_i(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,qi(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=_i(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:s,bary:r}=this;if(null==t||null==s||null==r)return;t.getVertexPosition(s.x,xa),t.getVertexPosition(s.y,ba),t.getVertexPosition(s.z,Sa),xa.toArray(Ma.elements,0),ba.toArray(Ma.elements,3),Sa.toArray(Ma.elements,6),this.position.copy(r).applyMatrix3(Ma);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),Ta.set(xa,ba,Sa),Ta.getNormal(this.normal).transformDirection(t.matrixWorld);const A=o.parent;Ra.setFromAxisAngle(xa.set(0,1,0),-A.yaw),this.normal.applyQuaternion(Ra)}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 s=t,r=s.dataset.visibilityAttribute;if(null!=r){const t=`data-${r}`;s.toggleAttribute(t,e)}s.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const Da={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}"},La={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}"};var Fa=s(64426);class Shadow extends o.Tme{constructor(e,t,s){super(),this.camera=new o.iKG,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new o.lRF,this.horizontalBlurMaterial=new o.jyz(Da),this.verticalBlurMaterial=new o.jyz(La),this.intensity=0,this.softness=1,this.boundingBox=new o.ZzF,this.size=new o.Pa4,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:r}=this;r.rotation.x=Math.PI/2,r.left=-.5,r.right=.5,r.bottom=-.5,r.top=.5,this.add(r);const A=new o._12,l=new o.vBJ({opacity:1,transparent:!0,side:o._Li});this.floor=new o.Kj0(A,l),this.floor.userData.noHit=!0,r.add(this.floor),this.blurPlane=new o.Kj0(A),this.blurPlane.visible=!1,r.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,s)}setScene(e,t,s){const{boundingBox:r,size:o,rotation:A,position:l}=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(l),"back"===s){const{min:e,max:t}=r;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],A.x=Math.PI/2,A.y=Math.PI}else A.x=0,A.y=0;if(this.isAnimated){const e=r.min.y,t=r.max.y;o.y=this.maxDimension,r.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),r.min.y=e,r.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===s?l.y=r.min.y:l.z=r.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:s}=this,r=this.isAnimated?2:1,o=r*Math.pow(2,9-3*e);this.setMapSize(o);const A=t.y/2,l=t.y*r;s.near=0,s.far=(0,Fa.t7)(l,A,e),this.depthMaterial.opacity=1/e,s.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const s=Math.floor(t.x>t.z?e:e*t.x/t.z),r=Math.floor(t.x>t.z?e*t.z/t.x:e),A=10+s,l=10+r;if(null==this.renderTarget||this.renderTarget.width===A&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:o.wk1};this.renderTarget=new o.dd2(A,l,e),this.renderTargetBlur=new o.dd2(A,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/s),t.z*(1+10/r),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*(0,Fa.t7)(.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 s=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const r=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=r,e.setRenderTarget(o),e.setClearAlpha(s)}blurShadow(e){const{camera:t,horizontalBlurMaterial:s,verticalBlurMaterial:r,renderTarget:o,renderTargetBlur:A,blurPlane:l}=this;l.visible=!0,l.material=s,s.uniforms.h.value=1/this.renderTarget.width,s.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(A),e.render(l,t),l.material=r,r.uniforms.v.value=1/this.renderTarget.height,r.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(l,t),l.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 ka=s(25108);const _a=new o.Pa4,Ua=new o.Pa4,Ga=new o.Pa4,Na=new o.iMs,Pa=new o.Pa4,Oa=new o.FM8;class ModelScene extends o.xsS{constructor({canvas:e,element:t,width:s,height:r}){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 o.cPb(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new o.Tme,this.animationNames=[],this.boundingBox=new o.ZzF,this.boundingSphere=new o.aLr,this.size=new o.Pa4,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=o.LY2,this.canScale=!0,this.isDirty=!1,this.goalTarget=new o.Pa4,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 o.cPb(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(s,r),this.target.name="Target",this.mixer=new o.Xcj(this.target);const{domElement:A}=this.annotationRenderer,{style:l}=A;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(A),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 s;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{s=await new Promise((async(s,r)=>{this.cancelPendingSourceChange=()=>r();try{s(await this.element[Do].loader.load(e,this.element,t))}catch(e){r(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=s,null!=s&&(this._model=s.scene,this.target.add(s.scene));const{animations:r}=s,o=new Map,A=[];for(const e of r)o.set(e.name,e),A.push(e.name);this.animations=r,this.animationsByName=o,this.animationNames=A,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[Ba]=null,this.element[ya]=null,this.element[wa]=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 s=ye();this.externalRenderer.resize(e*s,t*s)}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 o.ZzF;e.traverse((e=>{const s=e;if(!s.material)return;if(!s.material.transparent)return;t.setFromObject(s);const r=t.getSize(Pa),o=Math.min(r.x,r.y,r.z);Math.max(r.x,r.y,r.z)<100*o||this.markBakedShadow(s)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,s=new o.ZzF;this.boundingBox.getSize(this.size);for(const r of this.bakedShadows)s.setFromObject(r),s.min.y<e.y+this.size.y/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.z<=e.z&&s.max.z>=t.z||s.min.z<e.z+this.size.z/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.y<=e.y&&s.max.y>=t.y||this.unmarkBakedShadow(r)}applyTransform(){const{model:e}=this;if(null==e)return;const t=_i(this.element.orientation)[0].terms,s=qi(t[0]).number,r=qi(t[1]).number,A=qi(t[2]).number;e.quaternion.setFromEuler(new o.USm(r,A,s,"YXZ"));const l=_i(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 o.ZzF),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new o.ZzF)),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,s)=>Math.max(e,t.distanceToSquared(s))),0));this.idealAspect=reduceVertices(e,((e,s)=>{s.sub(t);const r=Math.sqrt(s.x*s.x+s.z*s.z);return Math.max(e,r/(this.idealCameraDistance()-Math.abs(s.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)Oa.set(e/window.screen.width,t/window.screen.height);else{const s=this.element.getBoundingClientRect();Oa.set((e-s.x)/this.width,(t-s.y)/this.height)}return Oa.multiplyScalar(2).subScalar(1),Oa.y*=-1,Oa}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[Do].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=_i(this.element.skyboxHeight)[0].terms[0],t=qi(e).number,s=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,s),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,s){this.goalTarget.set(-e,-t,-s)}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,s=this.target.position;if(t.equals(s))return!1;{const r=this.boundingSphere.radius/10;let{x:o,y:A,z:l}=s;return o=this.targetDamperX.update(o,t.x,e,r),A=this.targetDamperY.update(A,t.y,e,r),l=this.targetDamperZ.update(l,t.z,e,r),this.groundedSkybox.position.x=-o,this.groundedSkybox.position.z=-l,this.target.position.set(o,A,l),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:s,z:r}=this.position;this.yaw=Math.atan2(e-s,t-r)}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!==o.uEv||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,s=o.YKA,r=1/0){if(null==this._currentGLTF)return;const{animations:A}=this;if(null==A||0===A.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<A.length&&(l=A[t])}null==l&&(l=A[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(s,r),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){ka.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){Na.setFromCamera(e,this.getCamera());return Na.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var s;const r=this.hitFromPoint(e,t);if(null==r)return null;return{position:r.point,normal:null!=r.face?r.face.normal.clone().applyNormalMatrix((new o.Vkp).getNormalMatrix(r.object.matrixWorld)):Na.ray.direction.clone().multiplyScalar(-1),uv:null!==(s=r.uv)&&void 0!==s?s:null}}surfaceFromPoint(e,t=this){const s=this.element.model;if(null==s)return null;const r=this.hitFromPoint(e,t);if(null==r||null==r.face)return null;const A=s[pa](r),{meshes:l,primitives:h}=A.mesh.userData.associations,c=new o.Pa4,d=new o.Pa4,g=new o.Pa4,{a:p,b:m,c:f}=r.face,I=r.object;I.getVertexPosition(p,c),I.getVertexPosition(m,d),I.getVertexPosition(f,g);const E=new o.CJI(c,d,g),C=new o.Pa4;return E.getBarycoord(I.worldToLocal(r.point),C),`${l} ${h} ${p} ${m} ${f} ${C.x.toFixed(3)} ${C.y.toFixed(3)} ${C.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 s=0,r=t.length;s<r;s++){const r=t[s];r instanceof Hotspot&&e(r)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=_i(e.surface)[0].terms;if(8!=t.length)return void ka.warn(e.surface+" does not have exactly 8 numbers.");const s=this.element.model[ma](t[0].number,t[1].number),r=new o.Pa4(t[2].number,t[3].number,t[4].number);if(null==s)return void ka.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const A=s.mesh.geometry.attributes.position.count;if(r.x>=A||r.y>=A||r.z>=A)return void ka.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new o.Pa4(t[5].number,t[6].number,t[7].number);e.mesh=s.mesh,e.tri=r,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{_a.copy(e),Ua.setFromMatrixPosition(t.matrixWorld),_a.sub(Ua),Ga.copy(t.normal).transformDirection(this.target.matrixWorld),_a.dot(Ga)<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:s,element:r}=this,{alt:o,poster:A,iosSrc:l}=r;if(null!=e){const r=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];l&&r.push({"@type":"MediaObject",contentUrl:l,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=A?A:void 0,name:null!=o?o:void 0,encoding:r};s.textContent=JSON.stringify(h),document.head.appendChild(s)}else null!=s.parentElement&&s.parentElement.removeChild(s)}}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),s=>{let r;return r=Math.max(clamp(s,0,1),t.progress),r!==t.progress&&this.announceTotalProgress(t,r,e),t.progress}}announceTotalProgress(e,t,s){let r=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;r+=1-t,e.completed&&o++}const A=e.progress;e.progress=t,this.totalProgress+=(t-A)*(1-this.totalProgress)/r;const l=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:l,reason:s}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var Ha,Va,qa,Ka,Ja,za,Ya,ja,$a,Wa,Xa,Za,eo,to=s(25108),model_viewer_base_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const io=document.createElement("canvas"),so=Symbol("fallbackResizeHandler"),no=Symbol("defaultAriaLabel"),ro=Symbol("resizeObserver"),ao=Symbol("clearModelTimeout"),oo=Symbol("onContextLost"),Ao=Symbol("loaded"),lo=Symbol("status"),ho=Symbol("onFocus"),co=Symbol("onBlur"),uo=Symbol("updateSize"),go=Symbol("intersectionObserver"),po=Symbol("isElementInViewport"),mo=Symbol("announceModelVisibility"),fo=Symbol("ariaLabel"),Io=Symbol("altDefaulted"),Eo=Symbol("statusElement"),Co=Symbol("updateStatus"),Bo=Symbol("loadedTime"),yo=Symbol("updateSource"),wo=Symbol("markLoaded"),vo=Symbol("container"),Qo=Symbol("input"),xo=Symbol("canvas"),bo=Symbol("scene"),So=Symbol("needsRender"),Mo=Symbol("tick"),To=Symbol("onModelLoad"),Ro=Symbol("onResize"),Do=Symbol("renderer"),Lo=Symbol("progressTracker"),Fo=Symbol("getLoaded"),ko=Symbol("getModelIsVisible"),_o=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[Ha]=!1,this[Va]=!1,this[qa]=0,this[Ka]="",this[Ja]=null,this[za]=debounce((()=>{const e=this.getBoundingClientRect();this[uo](e)}),50),this[Ya]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[ja]=null,this[$a]=null,this[Wa]=new ProgressTracker,this[Xa]=()=>{this[Eo].textContent=this[lo]},this[Za]=()=>{this[Eo].textContent=""},this[eo]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,s;if((e=>{D(Se,e)})(e),this[vo]=e.querySelector(".container"),this[Qo]=e.querySelector(".userInput"),this[xo]=e.querySelector("canvas"),this[Eo]=e.querySelector("#status"),this[no]=this[Qo].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,s=e.height}else t=300,s=150;this[bo]=new ModelScene({canvas:this[xo],element:this,width:t,height:s}),Promise.resolve().then((()=>{this[uo](this.getBoundingClientRect())})),ce&&(this[ro]=new ResizeObserver((e=>{if(!this[Do].isPresenting)for(let t of e)t.target===this&&this[uo](t.contentRect)}))),ue?this[go]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[po]=t.isIntersecting,this[mo](e),this[po]&&!this.loaded&&this[yo]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[po]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[qt].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[qt].evictionThreshold}static set minimumRenderScale(e){e>1&&to.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&to.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[Fo]()}get[(Ha=po,Va=Ao,qa=Bo,Ka=lo,Ja=ao,za=so,Ya=mo,ja=ro,$a=go,Wa=Lo,Do)](){return Renderer.singleton}get modelIsVisible(){return this[ko]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),ce?this[ro].observe(this):self.addEventListener("resize",this[so]),ue&&this[go].observe(this),this.addEventListener("focus",this[ho]),this.addEventListener("blur",this[co]);const e=this[Do];e.addEventListener("contextlost",this[oo]),e.registerScene(this[bo]),null!=this[ao]&&(self.clearTimeout(this[ao]),this[ao]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),ce?this[ro].unobserve(this):self.removeEventListener("resize",this[so]),ue&&this[go].unobserve(this),this.removeEventListener("focus",this[ho]),this.removeEventListener("blur",this[co]);const e=this[Do];e.removeEventListener("contextlost",this[oo]),e.unregisterScene(this[bo]),this[ao]=self.setTimeout((()=>{this[bo].dispose(),this[ao]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Ao]=!1,this[Bo]=0,this[bo].reset()):this.src!==this[bo].url&&(this[Ao]=!1,this[Bo]=0,this[yo]())),e.has("alt")&&this[Qo].setAttribute("aria-label",this[fo]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[Do].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[bo].updateSchema(this.src):this[bo].updateSchema(null))}toDataURL(e,t){return this[Do].displayCanvas(this[bo]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,s=e?e.qualityArgument:void 0,r=e?e.idealAspect:void 0,{width:o,height:A,idealAspect:l,aspect:h}=this[bo],{dpr:c,scaleFactor:d}=this[Do];let g=o*d*c,p=A*d*c,m=0,f=0;if(!0===r)if(l>h){const e=p;p=Math.round(g/l),f=(e-p)/2}else{const e=g;g=Math.round(p*l),m=(e-g)/2}io.width=g,io.height=p;try{return new Promise((async(e,r)=>{io.getContext("2d").drawImage(this[Do].displayCanvas(this[bo]),m,f,g,p,0,0,g,p),io.toBlob((t=>{if(!t)return r(new Error("Unable to retrieve canvas blob"));e(t)}),t,s)}))}finally{this[uo]({width:o,height:A})}}registerEffectComposer(e){e.setRenderer(this[Do].threeRenderer),e.setMainCamera(this[bo].getCamera()),e.setMainScene(this[bo]),this[bo].effectRenderer=e}unregisterEffectComposer(){this[bo].effectRenderer=null}registerRenderer(e){this[bo].externalRenderer=e}unregisterRenderer(){this[bo].externalRenderer=null}get[fo](){return this[Io]}get[Io](){return null==this.alt||"null"===this.alt?this[no]:this.alt}[Fo](){return this[Ao]}[ko](){return this.loaded&&this[po]}[_o](){return!!this.src&&this[po]}[uo]({width:e,height:t}){0!==e&&0!==t&&(this[vo].style.width=`${e}px`,this[vo].style.height=`${t}px`,this[Ro]({width:e,height:t}))}[Mo](e,t){var s;null===(s=this[bo].effectRenderer)||void 0===s||s.beforeRender(e,t)}[wo](){this[Ao]||(this[Ao]=!0,this[Bo]=performance.now())}[So](){this[bo].queueRender()}[To](){}[Co](e){this[lo]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Eo].textContent!=e&&(this[Eo].textContent=e)}[(Xa=ho,Za=co,Ro)](e){this[bo].setSize(e.width,e.height)}async[(eo=oo,yo)](){const e=this[bo];if(this.loaded||!this[_o]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[Co]("Loading"),e.stopAnimation();const t=this[Lo].beginActivity("model-load"),s=this.src;try{const r=e.setSource(s,(e=>t(.95*clamp(e,0,1)))),o=this[xe]();await Promise.all([r,o]),this[wo](),this[To](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:s}})),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,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Uo=Symbol("changeAnimation"),Go=Symbol("paused"),No={repetitions:1/0,pingpong:!1},Po=Symbol("hotspotMap"),Oo=Symbol("mutationCallback"),Ho=Symbol("observer"),Vo=Symbol("addHotspot"),qo=Symbol("removeHotspot"),Ko=new o.yGw;var Jo=Uint8Array,zo=Uint16Array,Yo=Int32Array,jo=new Jo([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]),$o=new Jo([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]),Wo=new Jo([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 s=new zo(31),r=0;r<31;++r)s[r]=t+=1<<e[r-1];var o=new Yo(s[30]);for(r=1;r<30;++r)for(var A=s[r];A<s[r+1];++A)o[A]=A-s[r]<<5|r;return{b:s,r:o}},Xo=freb(jo,2),Zo=Xo.b,eA=Xo.r;Zo[28]=258,eA[258]=28;for(var tA=freb($o,0),iA=(tA.b,tA.r),sA=new zo(32768),nA=0;nA<32768;++nA){var rA=(43690&nA)>>1|(21845&nA)<<1;rA=(61680&(rA=(52428&rA)>>2|(13107&rA)<<2))>>4|(3855&rA)<<4,sA[nA]=((65280&rA)>>8|(255&rA)<<8)>>1}var hMap=function(e,t,s){for(var r=e.length,o=0,A=new zo(t);o<r;++o)e[o]&&++A[e[o]-1];var l,h=new zo(t);for(o=1;o<t;++o)h[o]=h[o-1]+A[o-1]<<1;if(s){l=new zo(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var d=o<<4|e[o],g=t-e[o],p=h[e[o]-1]++<<g,m=p|(1<<g)-1;p<=m;++p)l[sA[p]>>c]=d}else for(l=new zo(r),o=0;o<r;++o)e[o]&&(l[o]=sA[h[e[o]-1]++]>>15-e[o]);return l},aA=new Jo(288);for(nA=0;nA<144;++nA)aA[nA]=8;for(nA=144;nA<256;++nA)aA[nA]=9;for(nA=256;nA<280;++nA)aA[nA]=7;for(nA=280;nA<288;++nA)aA[nA]=8;var oA=new Jo(32);for(nA=0;nA<32;++nA)oA[nA]=5;var AA=hMap(aA,9,0),lA=hMap(oA,5,0),shft=function(e){return(e+7)/8|0},slc=function(e,t,s){return(null==t||t<0)&&(t=0),(null==s||s>e.length)&&(s=e.length),new Jo(e.subarray(t,s))},hA=["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,s){var r=new Error(t||hA[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,err),!s)throw r;return r},wbits=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>8},wbits16=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>8,e[r+2]|=s>>16},hTree=function(e,t){for(var s=[],r=0;r<e.length;++r)e[r]&&s.push({s:r,f:e[r]});var o=s.length,A=s.slice();if(!o)return{t:uA,l:0};if(1==o){var l=new Jo(s[0].s+1);return l[s[0].s]=1,{t:l,l:1}}s.sort((function(e,t){return e.f-t.f})),s.push({s:-1,f:25001});var h=s[0],c=s[1],d=0,g=1,p=2;for(s[0]={s:-1,f:h.f+c.f,l:h,r:c};g!=o-1;)h=s[s[d].f<s[p].f?d++:p++],c=s[d!=g&&s[d].f<s[p].f?d++:p++],s[g++]={s:-1,f:h.f+c.f,l:h,r:c};var m=A[0].s;for(r=1;r<o;++r)A[r].s>m&&(m=A[r].s);var f=new zo(m+1),I=fflate_module_ln(s[g-1],f,0);if(I>t){r=0;var E=0,C=I-t,B=1<<C;for(A.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));r<o;++r){var y=A[r].s;if(!(f[y]>t))break;E+=B-(1<<I-f[y]),f[y]=t}for(E>>=C;E>0;){var Q=A[r].s;f[Q]<t?E-=1<<t-f[Q]++-1:++r}for(;r>=0&&E;--r){var x=A[r].s;f[x]==t&&(--f[x],++E)}I=t}return{t:new Jo(f),l:I}},fflate_module_ln=function(e,t,s){return-1==e.s?Math.max(fflate_module_ln(e.l,t,s+1),fflate_module_ln(e.r,t,s+1)):t[e.s]=s},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new zo(++t),r=0,o=e[0],A=1,w=function(e){s[r++]=e},l=1;l<=t;++l)if(e[l]==o&&l!=t)++A;else{if(!o&&A>2){for(;A>138;A-=138)w(32754);A>2&&(w(A>10?A-11<<5|28690:A-3<<5|12305),A=0)}else if(A>3){for(w(o),--A;A>6;A-=6)w(8304);A>2&&(w(A-3<<5|8208),A=0)}for(;A--;)w(o);A=1,o=e[l]}return{c:s.subarray(0,r),n:t}},clen=function(e,t){for(var s=0,r=0;r<t.length;++r)s+=e[r]*t[r];return s},wfblk=function(e,t,s){var r=s.length,o=shft(t+2);e[o]=255&r,e[o+1]=r>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var A=0;A<r;++A)e[o+A+4]=s[A];return 8*(o+4+r)},wblk=function(e,t,s,r,o,A,l,h,c,d,g){wbits(t,g++,s),++o[256];for(var p=hTree(o,15),m=p.t,f=p.l,I=hTree(A,15),E=I.t,C=I.l,B=lc(m),y=B.c,Q=B.n,x=lc(E),b=x.c,S=x.n,T=new zo(19),F=0;F<y.length;++F)++T[31&y[F]];for(F=0;F<b.length;++F)++T[31&b[F]];for(var _=hTree(T,7),U=_.t,G=_.l,O=19;O>4&&!U[Wo[O-1]];--O);var q,K,J,Y,j=d+5<<3,$=clen(o,aA)+clen(A,oA)+l,W=clen(o,m)+clen(A,E)+l+14+3*O+clen(T,U)+2*T[16]+3*T[17]+7*T[18];if(c>=0&&j<=$&&j<=W)return wfblk(t,g,e.subarray(c,c+d));if(wbits(t,g,1+(W<$)),g+=2,W<$){q=hMap(m,f,0),K=m,J=hMap(E,C,0),Y=E;var X=hMap(U,G,0);wbits(t,g,Q-257),wbits(t,g+5,S-1),wbits(t,g+10,O-4),g+=14;for(F=0;F<O;++F)wbits(t,g+3*F,U[Wo[F]]);g+=3*O;for(var ee=[y,b],te=0;te<2;++te){var ie=ee[te];for(F=0;F<ie.length;++F){var se=31&ie[F];wbits(t,g,X[se]),g+=U[se],se>15&&(wbits(t,g,ie[F]>>5&127),g+=ie[F]>>12)}}}else q=AA,K=aA,J=lA,Y=oA;for(F=0;F<h;++F){var ne=r[F];if(ne>255){wbits16(t,g,q[(se=ne>>18&31)+257]),g+=K[se+257],se>7&&(wbits(t,g,ne>>23&31),g+=jo[se]);var re=31≠wbits16(t,g,J[re]),g+=Y[re],re>3&&(wbits16(t,g,ne>>5&8191),g+=$o[re])}else wbits16(t,g,q[ne]),g+=K[ne]}return wbits16(t,g,q[256]),g+K[256]},cA=new Yo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uA=new Jo(0),dflt=function(e,t,s,r,o,A){var l=A.z||e.length,h=new Jo(r+l+5*(1+Math.ceil(l/7e3))+o),c=h.subarray(r,h.length-o),d=A.l,g=7&(A.r||0);if(t){g&&(c[0]=A.r>>3);for(var p=cA[t-1],m=p>>13,f=8191&p,I=(1<<s)-1,E=A.p||new zo(32768),C=A.h||new zo(I+1),B=Math.ceil(s/3),y=2*B,hsh=function(t){return(e[t]^e[t+1]<<B^e[t+2]<<y)&I},Q=new Yo(25e3),x=new zo(288),b=new zo(32),S=0,T=0,F=A.i||0,_=0,U=A.w||0,G=0;F+2<l;++F){var O=hsh(F),q=32767&F,K=C[O];if(E[q]=K,C[O]=q,U<=F){var J=l-F;if((S>7e3||_>24576)&&(J>423||!d)){g=wblk(e,c,0,Q,x,b,T,_,G,F-G,g),_=S=T=0,G=F;for(var Y=0;Y<286;++Y)x[Y]=0;for(Y=0;Y<30;++Y)b[Y]=0}var j=2,$=0,W=f,X=q-K&32767;if(J>2&&O==hsh(F-X))for(var ee=Math.min(m,J)-1,te=Math.min(32767,F),ie=Math.min(258,J);X<=te&&--W&&q!=K;){if(e[F+j]==e[F+j-X]){for(var se=0;se<ie&&e[F+se]==e[F+se-X];++se);if(se>j){if(j=se,$=X,se>ee)break;var ne=Math.min(X,se-2),re=0;for(Y=0;Y<ne;++Y){var ae=F-X+Y&32767,oe=ae-E[ae]&32767;oe>re&&(re=oe,K=ae)}}}X+=(q=K)-(K=E[q])&32767}if($){Q[_++]=268435456|eA[j]<<18|iA[$];var Ae=31&eA[j],le=31&iA[$];T+=jo[Ae]+$o[le],++x[257+Ae],++b[le],U=F+j,++S}else Q[_++]=e[F],++x[e[F]]}}for(F=Math.max(F,U);F<l;++F)Q[_++]=e[F],++x[e[F]];g=wblk(e,c,d,Q,x,b,T,_,G,F-G,g),d||(A.r=7&g|c[g/8|0]<<3,g-=7,A.h=C,A.p=E,A.i=F,A.w=U)}else{for(F=A.w||0;F<l+d;F+=65535){var he=F+65535;he>=l&&(c[g/8|0]=d,he=l),g=wfblk(c,g+1,e.subarray(F,he))}A.i=l}return slc(h,0,r+shft(g)+o)},dA=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var s=t,r=9;--r;)s=(1&s&&-306674912)^s>>>1;e[t]=s}return e}(),crc=function(){var e=-1;return{p:function(t){for(var s=e,r=0;r<t.length;++r)s=dA[255&s^t[r]]^s>>>8;e=s},d:function(){return~e}}},dopt=function(e,t,s,r,o){if(!o&&(o={l:1},t.dictionary)){var A=t.dictionary.subarray(-32768),l=new Jo(A.length+e.length);l.set(A),l.set(e,A.length),e=l,o.w=A.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,s,r,o)},mrg=function(e,t){var s={};for(var r in e)s[r]=e[r];for(var r in t)s[r]=t[r];return s},wbytes=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,s,r){for(var o in e){var A=e[o],l=t+o,h=r;Array.isArray(A)&&(h=mrg(r,A[1]),A=A[0]),A instanceof Jo?s[l]=[A,h]:(s[l+="/"]=[new Jo(0),h],fltn(A,l,s,r))}},gA="undefined"!=typeof TextEncoder&&new TextEncoder,pA="undefined"!=typeof TextDecoder&&new TextDecoder;try{pA.decode(uA,{stream:!0}),1}catch(e){}function strToU8(e,t){if(t){for(var s=new Jo(e.length),r=0;r<e.length;++r)s[r]=e.charCodeAt(r);return s}if(gA)return gA.encode(e);var o=e.length,A=new Jo(e.length+(e.length>>1)),l=0,w=function(e){A[l++]=e};for(r=0;r<o;++r){if(l+5>A.length){var h=new Jo(l+8+(o-r<<1));h.set(A),A=h}var c=e.charCodeAt(r);c<128||t?w(c):c<2048?(w(192|c>>6),w(128|63&c)):c>55295&&c<57344?(w(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++r))>>18),w(128|c>>12&63),w(128|c>>6&63),w(128|63&c)):(w(224|c>>12),w(128|c>>6&63),w(128|63&c))}return slc(A,0,l)}var exfl=function(e){var t=0;if(e)for(var s in e){var r=e[s].length;r>65535&&err(9),t+=r+4}return t},wzh=function(e,t,s,r,o,A,l,h){var c=r.length,d=s.extra,g=h&&h.length,p=exfl(d);wbytes(e,t,null!=l?33639248:67324752),t+=4,null!=l&&(e[t++]=20,e[t++]=s.os),e[t]=20,t+=2,e[t++]=s.flag<<1|(A<0&&8),e[t++]=o&&8,e[t++]=255&s.compression,e[t++]=s.compression>>8;var m=new Date(null==s.mtime?Date.now():s.mtime),f=m.getFullYear()-1980;if((f<0||f>119)&&err(10),wbytes(e,t,f<<25|m.getMonth()+1<<21|m.getDate()<<16|m.getHours()<<11|m.getMinutes()<<5|m.getSeconds()>>1),t+=4,-1!=A&&(wbytes(e,t,s.crc),wbytes(e,t+4,A<0?-A-2:A),wbytes(e,t+8,s.size)),wbytes(e,t+12,c),wbytes(e,t+14,p),t+=16,null!=l&&(wbytes(e,t,g),wbytes(e,t+6,s.attrs),wbytes(e,t+10,l),t+=14),e.set(r,t),t+=c,p)for(var I in d){var E=d[I],C=E.length;wbytes(e,t,+I),wbytes(e,t+2,C),e.set(E,t+4),t+=4+C}return g&&(e.set(h,t),t+=g),t},wzf=function(e,t,s,r,o){wbytes(e,t,101010256),wbytes(e,t+8,s),wbytes(e,t+10,s),wbytes(e,t+12,r),wbytes(e,t+16,o)};"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var mA=s(25108);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1,maxTextureSize:1024},t);const s={},r="model.usda";s[r]=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 A={},l={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,r=e.material;if(r.isMeshStandardMaterial){const l="geometries/Geometry_"+t.id+".usda";if(!(l in s)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",s=e.attributes,r=s.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,s=[];if(null!==t)for(let e=0;e<t.count;e++)s.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)s.push(e)}return s.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(s.normal,r)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(s.position,r)}]\n${function buildPrimvars(e){let t="";for(let s=0;s<4;s++){const r=s>0?s:"",o=e["uv"+r];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${r} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}const s=e.color;if(void 0!==s){t+=`\n\tcolor3f[] primvars:displayColor = [${buildVector3Array(s,s.count)}] (\n\t\tinterpolation = "vertex"\n\t\t)`}return t}(s)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);s[l]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}r.uuid in A||(A[r.uuid]=r),o+=function buildXform(e,t,s){const r="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&mA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${r}" (\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_${s.id}>\n}\n\n`}(e,t,r)}else mA.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,s=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&mA.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 = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(fA)}, ${e.far.toPrecision(fA)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(fA)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(fA)}\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 = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(fA)}, ${e.far.toPrecision(fA)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(fA)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(fA)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(fA)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(fA)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,s=!1){const r=[];for(const o in e){const A=e[o];r.push(buildMaterial(A,t,s))}return`def "Materials"\n{\n${r.join("")}\n}\n\n`}(A,l,t.quickLookCompatible),s[r]=strToU8(o),o=null;for(const e in l){let r=l[e];!0===r.isCompressedTexture&&(r=decompress(r));const o=imageToCanvas(r.image,r.flipY,t.maxTextureSize),A=await new Promise((e=>o.toBlob(e,"image/png",1)));s[`textures/Texture_${e}.png`]=new Uint8Array(await A.arrayBuffer())}let h=0;for(const e in s){const t=s[e];h+=34+e.length;const r=63&h;if(4!==r){const o=new Uint8Array(64-r);s[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var s={},r=[];fltn(e,"",s,t);var o=0,A=0;for(var l in s){var h=s[l],c=h[0],d=h[1],g=0==d.level?0:8,p=(T=strToU8(l)).length,m=d.comment,f=m&&strToU8(m),I=f&&f.length,E=exfl(d.extra);p>65535&&err(11);var C=g?deflateSync(c,d):c,B=C.length,y=crc();y.p(c),r.push(mrg(d,{size:c.length,crc:y.d(),c:C,f:T,m:f,u:p!=l.length||f&&m.length!=I,o,compression:g})),o+=30+p+E+B,A+=76+2*(p+E)+(I||0)+B}for(var Q=new Jo(A+22),x=o,b=A-o,S=0;S<r.length;++S){var T=r[S];wzh(Q,T.o,T,T.f,T.u,T.c.length);var F=30+T.f.length+exfl(T.extra);Q.set(T.c,T.o+F),wzh(Q,o,T,T.f,T.u,T.c.length,T.o,T.m),o+=16+F+(T.m?T.m.length:0)}return wzf(Q,o,r.length,b,x),Q}(s,{level:0})}}function imageToCanvas(e,t,s){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 r=s/Math.max(e.width,e.height),o=document.createElement("canvas");o.width=e.width*Math.min(1,r),o.height=e.height*Math.min(1,r);const A=o.getContext("2d");return!0===t&&(A.translate(0,o.height),A.scale(1,-1)),A.drawImage(e,0,0,o.width,o.height),o}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const fA=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 mA.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const s=[];for(let t=0;t<e.count;t++){const r=e.getX(t),o=e.getY(t),A=e.getZ(t);s.push(`(${r.toPrecision(fA)}, ${o.toPrecision(fA)}, ${A.toPrecision(fA)})`)}return s.join(", ")}function buildVector2Array(e){const t=[];for(let s=0;s<e.count;s++){const r=e.getX(s),o=e.getY(s);t.push(`(${r.toPrecision(fA)}, ${1-o.toPrecision(fA)})`)}return t.join(", ")}function buildMaterial(e,t,s=!1){const r="\t\t\t",A=[],l=[];function buildTexture(r,A,l){const h=r.source.id+"_"+r.flipY;t[h]=r;const c=r.channel>0?"st"+r.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},g=r.repeat.clone(),p=r.offset.clone(),m=r.rotation,f=Math.sin(m),I=Math.cos(m);return p.y=1-p.y-g.y,s?(p.x=p.x/g.x,p.y=p.y/g.y,p.x+=f/g.x,p.y+=I-1):(p.x+=f*g.x,p.y+=(1-I)*g.y),`\n\t\tdef Shader "PrimvarReader_${A}"\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 = "${c}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${A}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(fA)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(g)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(p)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${r.id}_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${h}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${A}.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 = "${r.colorSpace===o.aCh?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[r.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[r.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 e.side===o.ehD&&mA.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(A.push(`${r}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),A.push(`${r}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):A.push(`${r}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(A.push(`${r}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&&A.push(`${r}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(A.push(`${r}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(A.push(`${r}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?(A.push(`${r}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):A.push(`${r}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(A.push(`${r}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):A.push(`${r}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),A.push(`${r}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):A.push(`${r}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(A.push(`${r}float inputs:clearcoat = ${e.clearcoat}`),A.push(`${r}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),A.push(`${r}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${A.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 IA=s(25108),ar_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};let EA=!1,CA=!1;const BA="#model-viewer-no-ar-fallback",yA=(wA=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=_i(e),s=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>wA.indexOf(e)>-1));return new Set(s)}catch(e){}return new Set});var wA;const vA="quick-look",QA="scene-viewer",xA="webxr",bA="none",SA=Symbol("arButtonContainer"),MA=Symbol("enterARWithWebXR"),TA=Symbol("openSceneViewer"),RA=Symbol("openIOSARQuickLook"),DA=Symbol("canActivateAR"),LA=Symbol("arMode"),FA=Symbol("arModes"),kA=Symbol("arAnchor"),_A=Symbol("preload"),UA=Symbol("onARButtonContainerClick"),GA=Symbol("onARStatus"),NA=Symbol("onARTracking"),PA=Symbol("onARTap"),OA=Symbol("selectARMode"),HA=Symbol("triggerLoad");var loading_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const VA="auto",qA="auto",KA="eager",JA=Symbol("defaultProgressBarElement"),zA=Symbol("posterContainerElement"),YA=Symbol("defaultPosterElement"),jA=Symbol("shouldDismissPoster"),$A=Symbol("hidePoster"),WA=Symbol("modelIsRevealed"),XA=Symbol("updateProgressBar"),ZA=Symbol("ariaLabelCallToAction"),el=Symbol("onProgress");var staging_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const tl=Math.PI/32,il={basis:[degreesToRadians(numberNode(tl,"rad"))],keywords:{auto:[null]}},sl=Symbol("autoRotateStartTime"),nl=Symbol("radiansPerSecond"),rl=Symbol("syncRotationRate"),al=Symbol("onCameraChange"),ol=(e=>{var t,s,r;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[s]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[Vo](e)})),e.removedNodes.forEach((e=>{this[qo](e)})),this[So]())}))},this[r]=new MutationObserver(this[Oo])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[Vo](this.children[e]);const{ShadyDOM:e}=self;null==e?this[Ho].observe(this,{childList:!0}):this[Ho]=e.observeChildren(this,this[Oo])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[Ho].disconnect():e.unobserveChildren(this[Ho])}[(t=Po,s=Oo,r=Ho,Mo)](e,t){super[Mo](e,t);const s=this[bo],{annotationRenderer:r}=s,o=s.getCamera();s.shouldRender()&&(s.updateSurfaceHotspots(),s.updateHotspotsVisibility(o.position),r.domElement.style.display="",r.render(s,o))}updateHotspot(e){const t=this[Po].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[So]())}queryHotspot(e){const t=this[Po].get(e);if(null==t)return null;const s=toVector3D(t.position),r=toVector3D(t.normal),A=t.facingCamera,l=this[bo],h=l.getCamera(),c=new o.Pa4;c.setFromMatrixPosition(t.matrixWorld),c.project(h);const d=l.width/2,g=l.height/2;c.x=c.x*d+d,c.y=-c.y*g+g;const p=toVector3D(new o.Pa4(c.x,c.y,c.z));return Number.isFinite(p.x)&&Number.isFinite(p.y)?{position:s,normal:r,canvasPosition:p,facingCamera:A}:null}positionAndNormalFromPoint(e,t){const s=this[bo],r=s.getNDC(e,t),o=s.positionAndNormalFromPoint(r);if(null==o)return null;Ko.copy(s.target.matrixWorld).invert();const A=toVector3D(o.position.applyMatrix4(Ko)),l=toVector3D(o.normal.transformDirection(Ko));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:A,normal:l,uv:h}}surfaceFromPoint(e,t){const s=this[bo],r=s.getNDC(e,t);return s.surfaceFromPoint(r)}[Vo](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[Po].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[Po].set(e.slot,t),this[bo].addHotspot(t)),this[bo].queueRender()}[qo](e){if(!(e instanceof HTMLElement))return;const t=this[Po].get(e.slot);t&&(t.decrement()&&(this[bo].removeHotspot(t),this[Po].delete(e.slot)),this[bo].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,s,r;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[s]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[wa]}get availableVariants(){return this.model?this.model[Ia]():[]}get originalGltfJson(){return this[ya]}[(t=wa,s=Ba,r=ya,va)](){return()=>{this[So]()}}[Qa](e){return e.colorSpace=o.KI_,e.wrapS=o.rpg,e.wrapT=o.rpg,new Texture(this[va](),e)}async createTexture(e,t="image/png"){const{textureUtils:s}=this[Do],r=await s.loadImage(e);return r.userData.mimeType=t,this[Qa](r)}async createLottieTexture(e,t=1){const{textureUtils:s}=this[Do],r=await s.loadLottie(e,t);return this[Qa](r)}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 s=new o.fO1(t);return this[Qa](s)}createCanvasTexture(){const e=document.createElement("canvas"),t=new o.ROQ(e);return this[Qa](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[Lo].beginActivity("variant-update");e(.1);const t=this[wa],{variantName:s}=this;null!=t&&(await t[da](s),this[So](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[bo];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[Do].arRenderer.onUpdateScene(),this[So]()}}[To](){super[To]();const{currentGLTF:e}=this[bo];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[Ba]&&(this[wa]=new Model(t,this[va]()),this[ya]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[Ba]=e}async exportScene(e){const t=this[bo];return new Promise((async(s,r)=>{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 A=t.shadow;let l=!1;null!=A&&(l=A.visible,A.visible=!1),await this[wa][ua]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>s(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>r("glTF export failed")),o),null!=A&&(A.visible=l)}))}materialFromPoint(e,t){const s=this[wa];if(null==s)return null;const r=this[bo],o=r.getNDC(e,t),A=r.hitFromPoint(o);return null==A||null==A.face?null:s[ga](A)}}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,s,r;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[s]=0,this[r]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[sl]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[al]),this[sl]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[al]),this[sl]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[sl]=performance.now())}[(t=sl,s=nl,rl)](e){this[nl]=e[0]}[Mo](e,t){if(super[Mo](e,t),!this.autoRotate||!this[ko]()||this[Do].isPresenting)return;const s=Math.min(t,e-this[sl]-this.autoRotateDelay);s>0&&(this[bo].yaw=this.turntableRotation+this[nl]*s*.001)}get turntableRotation(){return this[bo].yaw}resetTurntableRotation(e=0){this[bo].yaw=e}}return r=al,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:il,updateHandler:rl}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,s,r;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[s]=null,this[r]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[bo].setShadowIntensity(.5*this.shadowIntensity),this[So]()),e.has("shadowSoftness")&&(this[bo].setShadowSoftness(this.shadowSoftness),this[So]()),e.has("exposure")&&(this[bo].exposure=this.exposure,this[So]()),e.has("toneMapping")&&(this[bo].toneMapping="commerce"===this.toneMapping||"neutral"===this.toneMapping?o.ORg:"agx"===this.toneMapping?o.Bgp:o.LY2,this[So]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[_o]()&&this[xe](),e.has("skyboxHeight")&&(this[bo].setGroundedSkybox(),this[So]())}hasBakedShadow(){return this[bo].bakedShadows.size>0}async[(t=ve,s=Qe,r=be,xe)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[be]&&(this[be](),this[be]=null);const{textureUtils:s}=this[Do];if(null==s)return;const r=this[Lo].beginActivity("environment-update");try{const{environmentMap:o,skybox:A}=await s.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>r(clamp(e,0,1))));this[ve]!==o&&(this[ve]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[Qe]=null!=A?A.name===o.name?o:A:null,this[bo].setEnvironmentAndSkybox(this[ve],this[Qe])}catch(e){if(e instanceof Error)throw this[bo].setEnvironmentAndSkybox(null,null),e}finally{r(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,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B,y,Q;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=ws,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=xs,this.interactionPromptStyle=Ss,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=Ms,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[s]=this.shadowRoot.querySelector("#prompt"),this[r]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[A]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[h]=1/0,this[c]=!1,this[d]=!1,this[g]=mn.AUTOMATIC,this[p]=new SmoothControls(this[bo].camera,this[Qo],this[bo]),this[m]=new o.$V,this[f]=!1,this[I]=!1,this[E]=!1,this[C]={},this[B]=()=>{const e=this[ks].changeSource;this[Xs]=e,e===mn.USER_INTERACTION&&(this[js]=!0,this[Ps]())},this[y]=()=>{this[Os](),this[So]();const e=this[ks].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[Q]=e=>{this[vo].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[ks].inputSensitivity}set inputSensitivity(e){this[ks].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:s}=this[Zs];return{theta:e,phi:t,radius:s,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[Do].isPresenting?this[Do].arRenderer.target:this[bo].getTarget())}getFieldOfView(){return this[ks].getFieldOfView()}getMinimumFieldOfView(){return this[ks].options.minimumFieldOfView}getMaximumFieldOfView(){return this[ks].options.maximumFieldOfView}getIdealAspect(){return this[bo].idealAspect}jumpCameraToGoal(){this[en]=!0,this.requestUpdate(en,!1)}resetInteractionPrompt(){this[Ws]=0,this[$s]=1/0,this[js]=!1,this[Ys]=this.interactionPrompt===xs&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Qo].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[ks].addEventListener("user-interaction",this[Ks]),this[ks].addEventListener("pointer-change-start",this[zs]),this[ks].addEventListener("pointer-change-end",this[zs])}disconnectedCallback(){super.disconnectedCallback(),this[ks].removeEventListener("user-interaction",this[Ks]),this[ks].removeEventListener("pointer-change-start",this[zs]),this[ks].removeEventListener("pointer-change-end",this[zs])}updated(e){super.updated(e);const t=this[ks],s=this[bo];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===xs&&(this[Ys]=!0)):(t.disableInteraction(),this[Ps]()),this[Qo].setAttribute("aria-label",this[fo])),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===xs&&this.cameraControls&&!this[js]?this[Ys]=!0:this[Ps]()),e.has("interactionPromptStyle")&&(this[Gs].style.opacity=this.interactionPromptStyle==bs?"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),s.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[Vs](),!0===this[en]&&Promise.resolve().then((()=>{t.jumpToGoal(),s.jumpToGoal(),this[Js](),this[en]=!1}))}async updateFraming(){const e=this[bo],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const s=e.adjustedFoV(e.framedFoVDeg),r=this[ks].getFieldOfView()/t;this[ks].setFieldOfView(s*r),this[sn]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,s){const r=this[Qo],o=this[Ns];if("1"===o[0].style.opacity)return void Cs.warn("interact() failed because an existing interaction is running.");const A=new Array;A.push({x:timeline(t.x),y:timeline(t.y)});const l=[{x:A[0].x(0),y:A[0].y(0)}];null!=s&&(A.push({x:timeline(s.x),y:timeline(s.y)}),l.push({x:A[1].x(0),y:A[1].y(0)}));let h=performance.now();const{width:c,height:d}=this[bo],g=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,s]of l.entries()){const{style:A}=o[t];A.transform=`translateX(${c*s.x}px) translateY(${d*s.y}px)`,"pointerdown"===e?A.opacity="1":"pointerup"===e&&(A.opacity="0");const l={pointerId:t-5678,pointerType:"touch",target:r,clientX:c*s.x+g.x,clientY:d*s.y+g.y,altKey:!0};r.dispatchEvent(new PointerEvent(e,l))}},moveTouches=()=>{const t=this[Xs];if(t!==mn.AUTOMATIC||!r.isConnected){for(const e of this[Ns])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const s=Math.min(1,(performance.now()-h)/e);for(const[e,t]of l.entries())t.x=A[e].x(s),t.y=A[e].y(s);dispatchTouches("pointermove"),s<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:mn.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[Xs]=mn.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=Us,s=Gs,r=Ns,A=_s,l=Ws,h=$s,c=js,d=Ys,g=Xs,p=ks,m=Zs,f=en,I=tn,E=sn,C=Hs,rn)](e){const t=this[ks],s=this[bo];s.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=mn.NONE,t.setFieldOfView(s.adjustedFoV(s.framedFoVDeg)),this[Ks]()}[nn](e){const t=this[ks];if(this[sn]){const{theta:t,phi:s}=this.getCameraOrbit();e[0]=t,e[1]=s,this[sn]=!1}t.changeSource=mn.NONE,t.setOrbit(e[0],e[1],e[2]),this[Ks]()}[on](e){this[ks].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[An](e){this[ks].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[qs](e[2]),this.jumpCameraToGoal()}[ln](e){this[ks].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[hn](e){const t=this[bo].adjustedFoV(180*e[0]/Math.PI);this[ks].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[an](e){const[t,s,r]=e;this[Do].arRenderer.isPresenting||this[bo].setTarget(t,s,r),this[ks].changeSource=mn.NONE,this[Do].arRenderer.updateTarget(),this[Ks]()}[Mo](e,t){if(super[Mo](e,t),this[Do].isPresenting||!this[ko]())return;const s=this[ks],r=this[bo],o=performance.now();if(this[Ys]&&this.loaded&&o>this[Bo]+this.interactionPromptThreshold&&(this[Ys]=!1,this[$s]=o,this[Us].classList.add("visible")),isFinite(this[$s])&&this.interactionPromptStyle===Ss){const e=(o-this[$s])/5e3%1,t=Bs(e),A=ys(e);if(this[Gs].style.opacity=`${A}`,t!==this[Ws]){const e=t*r.width*.05,o=(t-this[Ws])*Math.PI/16;this[Gs].style.transform=`translateX(${e}px)`,s.changeSource=mn.AUTOMATIC,s.adjustOrbit(o,0,0),this[Ws]=t}}const A=s.update(e,t),l=r.updateTarget(t);(A||l)&&this[Js]()}[Ps](){this[Ys]=!1,this[Us].classList.remove("visible"),this[$s]=1/0}[qs](e){const t=Math.max(this[bo].farRadius(),e),s=Math.abs(2*t);this[ks].updateNearFar(0,s)}[Os](){const{theta:e,phi:t}=this[ks].getCameraSpherical(this[Zs]),s=(4+Math.floor((e%Fs+Ls)/Rs))%4,r=Math.floor(t/Ds),o=`${Qs[r]}${vs[s]}`,A=o;A in this[Hs]?this[Co](this[Hs][A]):this[Co](`View from stage ${o}`)}get[fo](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[Hs]&&(e=`. ${this[Hs]["interaction-prompt"]}`),super[fo].replace(/\.$/,"")+(this.cameraControls?e:"")}async[Ro](e){const t=this[ks],s=this[bo],r=s.adjustedFoV(s.framedFoVDeg);super[Ro](e);const o=s.adjustedFoV(s.framedFoVDeg)/r,A=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[bo].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[ks].setFieldOfView(A),this.jumpCameraToGoal()}[To](){super[To](),this[tn]?this[sn]=!0:this[tn]=!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()}[(B=Ks,y=Js,Q=zs,Vs)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[Hs]=JSON.parse(this.a11y)}catch(e){Cs.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?Cs.warn("Error not supported format, should be a JSON string:",this.a11y):this[Hs]={};else"object"==typeof this.a11y&&null!=this.a11y?this[Hs]=Object.assign({},this.a11y):this[Hs]={};this[Qo].setAttribute("aria-label",this[fo])}}return controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:Ts,observeEffects:!0,updateHandler:nn}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:an}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:rn}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:on}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:An}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:ln}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:hn}),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,s,r,o,A,l,h,c,d,g;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[s]=this.shadowRoot.querySelector(".ar-button"),this[r]=document.createElement("a"),this[o]=new Set,this[A]=bA,this[l]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[c]=({status:e})=>{e!==En&&this[Do].arRenderer.presentedScene!==this[bo]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===En?this.removeAttribute("ar-tracking"):e===Cn&&this.setAttribute("ar-tracking",wn))},this[d]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[g]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[LA]!==bA}connectedCallback(){super.connectedCallback(),this[Do].arRenderer.addEventListener("status",this[GA]),this.setAttribute("ar-status",En),this[Do].arRenderer.addEventListener("tracking",this[NA]),this[kA].addEventListener("message",this[PA])}disconnectedCallback(){super.disconnectedCallback(),this[Do].arRenderer.removeEventListener("status",this[GA]),this[Do].arRenderer.removeEventListener("tracking",this[NA]),this[kA].removeEventListener("message",this[PA])}update(e){super.update(e),e.has("arScale")&&(this[bo].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[bo].updateShadow(),this[So]()),e.has("arModes")&&(this[FA]=yA(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[OA]()}async activateAR(){switch(this[LA]){case vA:await this[RA]();break;case xA:await this[MA]();break;case QA:this[TA]();break;default:IA.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=DA,s=SA,r=kA,o=FA,A=LA,l=_A,h=UA,c=GA,d=NA,g=PA,OA)](){var e;let t=bA;if(this.ar){if(null!=this.src)for(const s of this[FA]){if("webxr"===s&&de&&!EA&&await this[Do].arRenderer.supportsPresentation()){t=xA;break}if("scene-viewer"===s&&!CA&&(Ie||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=QA;break}if("quick-look"===s&&Ce){t=vA;break}}t===bA&&null!=this.iosSrc&&Ce&&(t=vA)}if(t!==bA)this[SA].classList.add("enabled"),this[SA].addEventListener("click",this[UA]);else if(this[SA].classList.contains("enabled")){this[SA].removeEventListener("click",this[UA]),this[SA].classList.remove("enabled");const e=yn;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[LA]=t}async[MA](){IA.log("Attempting to present in AR with WebXR..."),await this[HA]();try{this[SA].removeEventListener("click",this[UA]);const{arRenderer:e}=this[Do];e.placeOnWall="wall"===this.arPlacement,await e.present(this[bo],this.xrEnvironment)}catch(e){IA.warn("Error while trying to present in AR with WebXR"),IA.error(e),await this[Do].arRenderer.stopPresenting(),EA=!0,IA.warn("Falling back to next ar-mode"),await this[OA](),this.activateAR()}finally{this[OA]()}}async[HA](){this.loaded||(this[_A]=!0,this[yo](),await((e,t,s=null)=>new Promise((r=>{e.addEventListener(t,(function handler(o){s&&!s(o)||(r(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[_A]=!1)}[_o](){return super[_o]()||this[_A]}[TA](){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,e);s.hash&&(s.hash="");const r=new URLSearchParams(s.search);if(t.hash=BA,r.set("mode","ar_preferred"),r.has("disable_occlusion")||r.set("disable_occlusion","true"),"fixed"===this.arScale&&r.set("resizable","false"),"wall"===this.arPlacement&&r.set("enable_vertical_placement","true"),r.has("sound")){const t=new URL(r.get("sound"),e);r.set("sound",t.toString())}if(r.has("link")){const t=new URL(r.get("link"),e);r.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.2?${r.toString()+"&file="+encodeURIComponent(s.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===BA&&(CA=!0,self.history.back(),IA.warn("Error while trying to present in AR with Scene Viewer"),IA.warn("Falling back to next ar-mode"),this[OA]())}),{once:!0}),this[kA].setAttribute("href",o),IA.log("Attempting to present in AR with Scene Viewer..."),this[kA].click()}async[RA](){const e=!this.iosSrc;this[SA].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,s=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,t);r.hash&&(s.hash=r.hash)}"fixed"===this.arScale&&(s.hash&&(s.hash+="&"),s.hash+="allowsContentScaling=0");const r=this[kA];r.setAttribute("rel","ar");const o=document.createElement("img");r.appendChild(o),r.setAttribute("href",s.toString()),e&&r.setAttribute("download","model.usdz"),r.style.display="none",r.isConnected||this.shadowRoot.appendChild(r),IA.log("Attempting to present in AR with Quick Look..."),r.click(),r.removeChild(o),e&&URL.revokeObjectURL(t),this[SA].classList.add("enabled")}async prepareUSDZ(){const e=this[Lo].beginActivity("usdz-conversion");await this[HA]();const{model:t,shadow:s,target:r}=this[bo];if(null==t)return"";let o=!1;null!=s&&(o=s.visible,s.visible=!1),e(.2);const A=new USDZExporter;r.remove(t),t.position.copy(r.position),t.updateWorldMatrix(!1,!0);const l=await A.parse(t);t.position.set(0,0,0),r.add(t);const h=new Blob([l],{type:"model/vnd.usdz+zip"}),c=URL.createObjectURL(h);return e(1),null!=s&&(s.visible=o),c}}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,s,r,A,l,h,c,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=VA,this.loading=qA,this[t]=!1,this[s]=!1,this[r]=this.shadowRoot.querySelector(".slot.poster"),this[A]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[h]=this[YA].getAttribute("aria-label"),this[c]=((e,t)=>{let s=null;const throttled=(...r)=>{null==s&&(e(...r),s=self.setTimeout((()=>s=null),t))};return throttled.flush=()=>{null!=s&&(self.clearTimeout(s),s=null)},throttled})((e=>{const t=this[JA].parentNode;requestAnimationFrame((()=>{this[JA].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[JA]),t.appendChild(this[JA])),this[JA].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress,s=e.detail.reason;1===t&&(this[XA].flush(),this.loaded&&(this[jA]||this.reveal===VA)&&this[$A]()),this[XA](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:s}}))};const o=self.ModelViewerElement||{},g=o.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(g);const p=o.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(p),o.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(o.meshoptDecoderLocation);const m=o.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=m}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[Vt].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[$A]():(this[jA]=!0,this[yo]())}showPoster(){const e=this[zA];if(e.classList.contains("show"))return;e.classList.add("show"),this[Qo].classList.remove("show");const t=this[YA];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const s=this.modelIsVisible;this[WA]=!1,this[mo](s)}getDimensions(){return toVector3D(this[bo].size)}getBoundingBoxCenter(){return toVector3D(this[bo].boundingBox.getCenter(new o.Pa4))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[Lo].addEventListener("progress",this[el])}disconnectedCallback(){super.disconnectedCallback(),this[Lo].removeEventListener("progress",this[el])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[YA].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[YA].setAttribute("aria-label",this[Io]),(e.has("reveal")||e.has("loading"))&&this[yo]()}[(t=WA,s=jA,r=zA,A=YA,l=JA,h=ZA,c=XA,d=el,_o)](){return!!this.src&&(this[jA]||this.loading===KA||this.reveal===VA&&this[po])}[$A](){this[jA]=!1;const e=this[zA];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Qo].classList.add("show");const t=this.modelIsVisible;this[WA]=!0,this[mo](t);const s=this.getRootNode();s&&s.activeElement===this&&this[Qo].focus();const r=this[YA];r.setAttribute("aria-hidden","true"),r.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[ko](){return super[ko]()&&this[WA]}}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[bo].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[bo].subscribeMixerEvent("finished",(()=>{this[Go]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[bo].animationNames:[]}get duration(){return this[bo].duration}get paused(){return this[Go]}get currentTime(){return this[bo].animationTime}set currentTime(e){this[bo].animationTime=e,this[So]()}get timeScale(){return this[bo].animationTimeScale}set timeScale(e){this[bo].animationTimeScale=e}pause(){this[Go]||(this[Go]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[Go]=!1,this[Uo](e),this.dispatchEvent(new CustomEvent("play")))}[(t=Go,To)](){super[To](),this[Go]=!0,null!=this.animationName&&this[Uo](),this.autoplay&&this.play()}[Mo](e,t){super[Mo](e,t),this[Go]||!this[ko]()&&!this[Do].isPresenting||(this[bo].updateAnimation(t/1e3),this[So]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[Uo]()}[Uo](e=No){var t;const s=null!==(t=e.repetitions)&&void 0!==t?t:1/0,r=e.pingpong?o.uEv:1===s?o.jAl:o.YKA;this[bo].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,r,s),this[Go]&&(this[bo].updateAnimation(0),this[So]())}}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",ol)}}]);
|
|
408
|
+
</div>`;var Me=s(25108);const Te=new WeakMap;class DRACOLoader extends o.aNw{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,s,r){const A=new o.hH6(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{this.parse(e,t,r)}),s,r)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,o.KI_).catch(s)}decodeDracoFile(e,t,s,r,A=o.GUF,l=()=>{}){const h={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:A};return this.decodeGeometry(e,h).then(t).catch(l)}decodeGeometry(e,t){const s=JSON.stringify(t);if(Te.has(e)){const t=Te.get(e);if(t.key===s)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 r;const o=this.workerNextTaskID++,A=e.byteLength,l=this._getWorker(o,A).then((s=>(r=s,new Promise(((s,A)=>{r._callbacks[o]={resolve:s,reject:A},r.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return l.catch((()=>!0)).then((()=>{r&&o&&this._releaseTask(r,o)})),Te.set(e,{key:s,promise:l}),l}_createGeometry(e){const t=new o.u9r;e.index&&t.setIndex(new o.TlE(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s],A=r.name,l=r.array,h=r.itemSize,c=new o.TlE(l,h);"color"===A&&(this._assignVertexColorSpace(c,r.vertexColorSpace),c.normalized=l instanceof Float32Array==!1),t.setAttribute(A,c)}return t}_assignVertexColorSpace(e,t){if(t!==o.KI_)return;const s=new o.Ilk;for(let t=0,r=e.count;t<r;t++)s.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new o.hH6(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise(((t,r)=>{s.load(e,t,void 0,r)}))}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 s=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const r=DRACOWorker.toString(),o=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.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 s=t.data;switch(s.type){case"decode":e._callbacks[s.id].resolve(s);break;case"error":e._callbacks[s.id].reject(s);break;default:Me.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){Me.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}}function DRACOWorker(){let e,t;function decodeAttribute(e,t,s,r,o,A){const l=A.num_components(),h=s.num_points()*l,c=h*o.BYTES_PER_ELEMENT,d=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),g=e._malloc(c);t.GetAttributeDataArrayForAllPoints(s,A,d,c,g);const p=new o(e.HEAPF32.buffer,g,h).slice();return e._free(g),{name:r,array:p,itemSize:l}}onmessage=function(s){const r=s.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const s=r.buffer,o=r.taskConfig;t.then((e=>{const t=e.draco,A=new t.Decoder;try{const e=function decodeGeometry(e,t,s,r){const o=r.attributeIDs,A=r.attributeTypes;let l,h;const c=t.GetEncodedGeometryType(s);if(c===e.TRIANGULAR_MESH)l=new e.Mesh,h=t.DecodeArrayToMesh(s,s.byteLength,l);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");l=new e.PointCloud,h=t.DecodeArrayToPointCloud(s,s.byteLength,l)}if(!h.ok()||0===l.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const d={index:null,attributes:[]};for(const s in o){const h=self[A[s]];let c,g;if(r.useUniqueIDs)g=o[s],c=t.GetAttributeByUniqueId(l,g);else{if(g=t.GetAttributeId(l,e[o[s]]),-1===g)continue;c=t.GetAttribute(l,g)}const p=decodeAttribute(e,t,l,s,h,c);"color"===s&&(p.vertexColorSpace=r.vertexColorSpace),d.attributes.push(p)}c===e.TRIANGULAR_MESH&&(d.index=function decodeIndex(e,t,s){const r=s.num_faces(),o=3*r,A=4*o,l=e._malloc(A);t.GetTrianglesUInt32Array(s,A,l);const h=new Uint32Array(e.HEAPF32.buffer,l,o).slice();return e._free(l),{array:h,itemSize:1}}(e,t,l));return e.destroy(l),d}(t,A,new Int8Array(s),o),l=e.attributes.map((e=>e.array.buffer));e.index&&l.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},l)}catch(e){Me.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(A)}}))}}}var Re=s(25108);function toTrianglesDrawMode(e,t){if(t===o.WwZ)return Re.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===o.z$h||t===o.UlW){let s=e.getIndex();if(null===s){const t=[],r=e.getAttribute("position");if(void 0===r)return Re.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),s=e.getIndex()}const r=s.count-2,A=[];if(t===o.z$h)for(let e=1;e<=r;e++)A.push(s.getX(0)),A.push(s.getX(e)),A.push(s.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(A.push(s.getX(e)),A.push(s.getX(e+1)),A.push(s.getX(e+2))):(A.push(s.getX(e+2)),A.push(s.getX(e+1)),A.push(s.getX(e)));A.length/3!==r&&Re.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(A),l.clearGroups(),l}return Re.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var De=s(25108);class GLTFLoader extends o.aNw{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,s,r){const A=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=o.Zp0.extractUrlBase(e);l=o.Zp0.resolveURL(t,this.path)}else l=o.Zp0.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){r?r(t):De.error(t),A.manager.itemError(e),A.manager.itemEnd(e)},h=new o.hH6(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,(function(s){try{A.parse(s,l,(function(s){t(s),A.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),s,_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,s,r){let o;const A={},l={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===Fe){try{A[Le.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(r&&r(e))}o=JSON.parse(A[Le.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(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](c);t.name||De.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[t.name]=t,A[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],s=o.extensionsRequired||[];switch(t){case Le.KHR_MATERIALS_UNLIT:A[t]=new GLTFMaterialsUnlitExtension;break;case Le.KHR_DRACO_MESH_COMPRESSION:A[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case Le.KHR_TEXTURE_TRANSFORM:A[t]=new GLTFTextureTransformExtension;break;case Le.KHR_MESH_QUANTIZATION:A[t]=new GLTFMeshQuantizationExtension;break;default:s.indexOf(t)>=0&&void 0===l[t]&&De.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(A),c.setPlugins(l),c.parse(s,r)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,t,r,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const Le={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=Le.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let r=t.cache.get(s);if(r)return r;const A=t.json,l=((A.extensions&&A.extensions[this.name]||{}).lights||[])[e];let h;const c=new o.Ilk(16777215);void 0!==l.color&&c.setRGB(l.color[0],l.color[1],l.color[2],o.GUF);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":h=new o.Ox3(c),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new o.cek(c),h.distance=d;break;case"spot":h=new o.PMe(c),h.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,h.angle=l.spot.outerConeAngle,h.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return h.position.set(0,0,0),h.decay=2,assignExtrasToUserData(h,l),void 0!==l.intensity&&(h.intensity=l.intensity),h.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(h),t.cache.add(s,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,r=s.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return s._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=Le.KHR_MATERIALS_UNLIT}getMaterialType(){return o.vBJ}extendParams(e,t,s){const r=[];e.color=new o.Ilk(1,1,1),e.opacity=1;const A=t.pbrMetallicRoughness;if(A){if(Array.isArray(A.baseColorFactor)){const t=A.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],o.GUF),e.opacity=t[3]}void 0!==A.baseColorTexture&&r.push(s.assignTexture(e,"map",A.baseColorTexture,o.KI_))}return Promise.all(r)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&A.push(s.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&A.push(s.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(A.push(s.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new o.FM8(e,e)}return Promise.all(A)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.iridescenceFactor&&(t.iridescence=A.iridescenceFactor),void 0!==A.iridescenceTexture&&o.push(s.assignTexture(t,"iridescenceMap",A.iridescenceTexture)),void 0!==A.iridescenceIor&&(t.iridescenceIOR=A.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==A.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=A.iridescenceThicknessMinimum),void 0!==A.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=A.iridescenceThicknessMaximum),void 0!==A.iridescenceThicknessTexture&&o.push(s.assignTexture(t,"iridescenceThicknessMap",A.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[];t.sheenColor=new o.Ilk(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=r.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],o.GUF)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&A.push(s.assignTexture(t,"sheenColorMap",l.sheenColorTexture,o.KI_)),void 0!==l.sheenRoughnessTexture&&A.push(s.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(A)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.transmissionFactor&&(t.transmission=A.transmissionFactor),void 0!==A.transmissionTexture&&o.push(s.assignTexture(t,"transmissionMap",A.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&A.push(s.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const h=l.attenuationColor||[1,1,1];return t.attenuationColor=(new o.Ilk).setRGB(h[0],h[1],h[2],o.GUF),Promise.all(A)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&A.push(s.assignTexture(t,"specularIntensityMap",l.specularTexture));const h=l.specularColorFactor||[1,1,1];return t.specularColor=(new o.Ilk).setRGB(h[0],h[1],h[2],o.GUF),void 0!==l.specularColorTexture&&A.push(s.assignTexture(t,"specularColorMap",l.specularColorTexture,o.KI_)),Promise.all(A)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=Le.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return t.bumpScale=void 0!==A.bumpFactor?A.bumpFactor:1,void 0!==A.bumpTexture&&o.push(s.assignTexture(t,"bumpMap",A.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.anisotropyStrength&&(t.anisotropy=A.anisotropyStrength),void 0!==A.anisotropyRotation&&(t.anisotropyRotation=A.anisotropyRotation),void 0!==A.anisotropyTexture&&o.push(s.assignTexture(t,"anisotropyMap",A.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=Le.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,r=s.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const o=r.extensions[this.name],A=t.options.ktx2Loader;if(!A){if(s.extensionsRequired&&s.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,A)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=Le.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.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=Le.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.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=Le.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],r=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 r.then((function(t){const s=e.byteOffset||0,r=e.byteLength||0,A=e.count,l=e.byteStride,h=new Uint8Array(t,s,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,l,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(A*l);return o.decodeGltfBuffer(new Uint8Array(t),A,l,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=Le.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;const r=t.meshes[s.mesh];for(const e of r.primitives)if(e.mode!==Ge.TRIANGLES&&e.mode!==Ge.TRIANGLE_STRIP&&e.mode!==Ge.TRIANGLE_FAN&&void 0!==e.mode)return null;const A=s.extensions[this.name].attributes,l=[],h={};for(const e in A)l.push(this.parser.getDependency("accessor",A[e]).then((t=>(h[e]=t,h[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),s=t.isGroup?t.children:[t],r=e[0].count,A=[];for(const e of s){const t=new o.yGw,s=new o.Pa4,l=new o._fP,c=new o.Pa4(1,1,1),d=new o.SPe(e.geometry,e.material,r);for(let e=0;e<r;e++)h.TRANSLATION&&s.fromBufferAttribute(h.TRANSLATION,e),h.ROTATION&&l.fromBufferAttribute(h.ROTATION,e),h.SCALE&&c.fromBufferAttribute(h.SCALE,e),d.setMatrixAt(e,t.compose(s,l,c));for(const t in h)if("_COLOR_0"===t){const e=h[t];d.instanceColor=new o.lb7(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,h[t]);o.Tme.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),A.push(d)}return t.isGroup?(t.clear(),t.add(...A),t):A[0]})))}}const Fe="glTF",ke=1313821514,_e=5130562;class GLTFBinaryExtension{constructor(e){this.name=Le.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Fe)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,o=new DataView(e,12);let A=0;for(;A<r;){const t=o.getUint32(A,!0);A+=4;const r=o.getUint32(A,!0);if(A+=4,r===ke){const r=new Uint8Array(e,12+A,t);this.content=s.decode(r)}else if(r===_e){const s=12+A;this.body=e.slice(s,s+t)}A+=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=Le.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,r=this.dracoLoader,A=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,h={},c={},d={};for(const e in l){const t=Ve[e]||e.toLowerCase();h[t]=l[e]}for(const t in e.attributes){const r=Ve[t]||t.toLowerCase();if(void 0!==l[t]){const o=s.accessors[e.attributes[t]],A=Ne[o.componentType];d[r]=A.name,c[r]=!0===o.normalized}}return t.getDependency("bufferView",A).then((function(e){return new Promise((function(t,s){r.decodeDracoFile(e,(function(e){for(const t in e.attributes){const s=e.attributes[t],r=c[t];void 0!==r&&(s.normalized=r)}t(e)}),h,d,o.GUF,s)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=Le.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=Le.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends o._C8{constructor(e,t,s,r){super(e,t,s,r)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,r=this.valueSize,o=e*r*3+r;for(let e=0;e!==r;e++)t[e]=s[o+e];return t}interpolate_(e,t,s,r){const o=this.resultBuffer,A=this.sampleValues,l=this.valueSize,h=2*l,c=3*l,d=r-t,g=(s-t)/d,p=g*g,m=p*g,f=e*c,I=f-c,E=-2*m+3*p,C=m-p,B=1-E,y=C-p+g;for(let e=0;e!==l;e++){const t=A[I+e+l],s=A[I+e+h]*d,r=A[f+e+l],c=A[f+e]*d;o[e]=B*t+y*s+E*r+C*c}return o}}const Ue=new o._fP;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,s,r){const o=super.interpolate_(e,t,s,r);return Ue.fromArray(o).normalize().toArray(o),o}}const Ge={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},Ne={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Pe={9728:o.TyD,9729:o.wem,9984:o.YLQ,9985:o.qyh,9986:o.aH4,9987:o.D1R},Oe={33071:o.uWy,33648:o.OoA,10497:o.rpg},He={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ve={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"},qe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ke={CUBICSPLINE:void 0,LINEAR:o.NMF,STEP:o.Syv},Je="OPAQUE",ze="MASK",Ye="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new o.Wid({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:o.Wl3})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,s){for(const r in s.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=s.extensions[r])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):De.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,r=t.weights.length;s<r;s++)e.morphTargetInfluences[s]=t.weights[s];if(t.extras&&Array.isArray(t.extras.targetNames)){const s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(let t=0,r=s.length;t<r;t++)e.morphTargetDictionary[s[t]]=t}else De.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const s=e.extensions&&e.extensions[Le.KHR_DRACO_MESH_COMPRESSION];if(t=s?"draco:"+s.bufferView+":"+s.indices+":"+createAttributesKey(s.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let s=0,r=e.targets.length;s<r;s++)t+=":"+createAttributesKey(e.targets[s]);return t}function createAttributesKey(e){let t="";const s=Object.keys(e).sort();for(let r=0,o=s.length;r<o;r++)t+=s[r]+":"+e[s[r]]+";";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 je=new o.yGw;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 s=!1,r=!1,A=-1;"undefined"!=typeof navigator&&(s=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=navigator.userAgent.indexOf("Firefox")>-1,A=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||s||r&&A<98?this.textureLoader=new o.dpR(this.options.manager):this.textureLoader=new o.QRU(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new o.hH6(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 s=this,r=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([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])})).then((function(t){const A={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:s,userData:{}};return addUnknownExtensionsToUserData(o,A,r),assignExtrasToUserData(A,r),Promise.all(s._invokeAll((function(e){return e.afterRoot&&e.afterRoot(A)}))).then((function(){for(const e of A.scenes)e.updateMatrixWorld();e(A)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s].joints;for(let t=0,s=r.length;t<s;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){const r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(s[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.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,s){if(e.refs[t]<=1)return s;const r=s.clone(),updateMappings=(e,t)=>{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,r]of e.children.entries())updateMappings(r,t.children[s])};return updateMappings(s,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const r=e(t[s]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let r=0;r<t.length;r++){const o=e(t[r]);o&&s.push(o)}return s}getDependency(e,t){const s=e+":"+t;let r=this.cache.get(s);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne((function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)})),!r)throw new Error("Unknown type: "+e)}this.cache.add(s,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return s.getDependency(e,r)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=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[Le.KHR_BINARY_GLTF].body);const r=this.options;return new Promise((function(e,A){s.load(o.Zp0.resolveURL(t.uri,r.path),e,void 0,(function(){A(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 s=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+s)}))}loadAccessor(e){const t=this,s=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){const e=He[r.type],t=Ne[r.componentType],s=!0===r.normalized,A=new t(r.count*e);return Promise.resolve(new o.TlE(A,e,s))}const A=[];return void 0!==r.bufferView?A.push(this.getDependency("bufferView",r.bufferView)):A.push(null),void 0!==r.sparse&&(A.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),A.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(A).then((function(e){const A=e[0],l=He[r.type],h=Ne[r.componentType],c=h.BYTES_PER_ELEMENT,d=c*l,g=r.byteOffset||0,p=void 0!==r.bufferView?s.bufferViews[r.bufferView].byteStride:void 0,m=!0===r.normalized;let f,I;if(p&&p!==d){const e=Math.floor(g/p),s="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count;let d=t.cache.get(s);d||(f=new h(A,e*p,r.count*p/c),d=new o.vpT(f,p/c),t.cache.add(s,d)),I=new o.kB5(d,l,g%p/c,m)}else f=null===A?new h(r.count*l):new h(A,g,r.count*l),I=new o.TlE(f,l,m);if(void 0!==r.sparse){const t=He.SCALAR,s=Ne[r.sparse.indices.componentType],c=r.sparse.indices.byteOffset||0,d=r.sparse.values.byteOffset||0,g=new s(e[1],c,r.sparse.count*t),p=new h(e[2],d,r.sparse.count*l);null!==A&&(I=new o.TlE(I.array.slice(),I.itemSize,I.normalized));for(let e=0,t=g.length;e<t;e++){const t=g[e];if(I.setX(t,p[e*l]),l>=2&&I.setY(t,p[e*l+1]),l>=3&&I.setZ(t,p[e*l+2]),l>=4&&I.setW(t,p[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return I}))}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,o=t.images[r];let A=this.textureLoader;if(o.uri){const e=s.manager.getHandler(o.uri);null!==e&&(A=e)}return this.loadTextureImage(e,r,A)}loadTextureImage(e,t,s){const r=this,A=this.json,l=A.textures[e],h=A.images[t],c=(h.uri||h.bufferView)+":"+l.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,s).then((function(t){t.flipY=!1,t.name=l.name||h.name||"",""===t.name&&"string"==typeof h.uri&&!1===h.uri.startsWith("data:image/")&&(t.name=h.uri);const s=(A.samplers||{})[l.sampler]||{};return t.magFilter=Pe[s.magFilter]||o.wem,t.minFilter=Pe[s.minFilter]||o.D1R,t.wrapS=Oe[s.wrapS]||o.rpg,t.wrapT=Oe[s.wrapT]||o.rpg,r.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[c]=d,d}loadImageSource(e,t){const s=this,r=this.json,A=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=r.images[e],h=self.URL||self.webkitURL;let c=l.uri||"",d=!1;if(void 0!==l.bufferView)c=s.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return c=h.createObjectURL(t),c}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const g=Promise.resolve(c).then((function(e){return new Promise((function(s,r){let l=s;!0===t.isImageBitmapLoader&&(l=function(e){const t=new o.xEZ(e);t.needsUpdate=!0,s(t)}),t.load(o.Zp0.resolveURL(e,A.path),l,void 0,r)}))})).then((function(e){return!0===d&&h.revokeObjectURL(c),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 De.error("THREE.GLTFLoader: Couldn't load texture",c),e}));return this.sourceCache[e]=g,g}assignTexture(e,t,s,r){const o=this;return this.getDependency("texture",s.index).then((function(A){if(!A)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((A=A.clone()).channel=s.texCoord),o.extensions[Le.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[Le.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(A);A=o.extensions[Le.KHR_TEXTURE_TRANSFORM].extendTexture(A,e),o.associations.set(A,t)}}return void 0!==r&&(A.colorSpace=r),e[t]=A,A}))}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const r=void 0===t.attributes.tangent,A=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.UY4,o.F5T.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){const e="LineBasicMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.nls,o.F5T.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,this.cache.add(e,t)),s=t}if(r||A||l){let e="ClonedMaterial:"+s.uuid+":";r&&(e+="derivative-tangents:"),A&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),A&&(t.vertexColors=!0),l&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}e.material=s}getMaterialType(){return o.Wid}loadMaterial(e){const t=this,s=this.json,r=this.extensions,A=s.materials[e];let l;const h={},c=[];if((A.extensions||{})[Le.KHR_MATERIALS_UNLIT]){const e=r[Le.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),c.push(e.extendParams(h,A,t))}else{const s=A.pbrMetallicRoughness||{};if(h.color=new o.Ilk(1,1,1),h.opacity=1,Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;h.color.setRGB(e[0],e[1],e[2],o.GUF),h.opacity=e[3]}void 0!==s.baseColorTexture&&c.push(t.assignTexture(h,"map",s.baseColorTexture,o.KI_)),h.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,h.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(c.push(t.assignTexture(h,"metalnessMap",s.metallicRoughnessTexture)),c.push(t.assignTexture(h,"roughnessMap",s.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,h)}))))}!0===A.doubleSided&&(h.side=o.ehD);const d=A.alphaMode||Je;if(d===Ye?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,d===ze&&(h.alphaTest=void 0!==A.alphaCutoff?A.alphaCutoff:.5)),void 0!==A.normalTexture&&l!==o.vBJ&&(c.push(t.assignTexture(h,"normalMap",A.normalTexture)),h.normalScale=new o.FM8(1,1),void 0!==A.normalTexture.scale)){const e=A.normalTexture.scale;h.normalScale.set(e,e)}if(void 0!==A.occlusionTexture&&l!==o.vBJ&&(c.push(t.assignTexture(h,"aoMap",A.occlusionTexture)),void 0!==A.occlusionTexture.strength&&(h.aoMapIntensity=A.occlusionTexture.strength)),void 0!==A.emissiveFactor&&l!==o.vBJ){const e=A.emissiveFactor;h.emissive=(new o.Ilk).setRGB(e[0],e[1],e[2],o.GUF)}return void 0!==A.emissiveTexture&&l!==o.vBJ&&c.push(t.assignTexture(h,"emissiveMap",A.emissiveTexture,o.KI_)),Promise.all(c).then((function(){const s=new l(h);return A.name&&(s.name=A.name),assignExtrasToUserData(s,A),t.associations.set(s,{materials:e}),A.extensions&&addUnknownExtensionsToUserData(r,s,A),s}))}createUniqueName(e){const t=o.iUV.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,r=this.primitiveCache;function createDracoPrimitive(e){return s[Le.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(s){return addPrimitiveAttributes(s,e,t)}))}const A=[];for(let s=0,l=e.length;s<l;s++){const l=e[s],h=createPrimitiveKey(l),c=r[h];if(c)A.push(c.promise);else{let e;e=l.extensions&&l.extensions[Le.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new o.u9r,l,t),r[h]={primitive:l,promise:e},A.push(e)}}return Promise.all(A)}loadMesh(e){const t=this,s=this.json,r=this.extensions,A=s.meshes[e],l=A.primitives,h=[];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);h.push(t)}return h.push(t.loadGeometries(l)),Promise.all(h).then((function(s){const h=s.slice(0,s.length-1),c=s[s.length-1],d=[];for(let s=0,g=c.length;s<g;s++){const g=c[s],p=l[s];let m;const f=h[s];if(p.mode===Ge.TRIANGLES||p.mode===Ge.TRIANGLE_STRIP||p.mode===Ge.TRIANGLE_FAN||void 0===p.mode)m=!0===A.isSkinnedMesh?new o.TUv(g,f):new o.Kj0(g,f),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),p.mode===Ge.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,o.UlW):p.mode===Ge.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,o.z$h));else if(p.mode===Ge.LINES)m=new o.ejS(g,f);else if(p.mode===Ge.LINE_STRIP)m=new o.x12(g,f);else if(p.mode===Ge.LINE_LOOP)m=new o.blk(g,f);else{if(p.mode!==Ge.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);m=new o.woe(g,f)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,A),m.name=t.createUniqueName(A.name||"mesh_"+e),assignExtrasToUserData(m,A),p.extensions&&addUnknownExtensionsToUserData(r,m,p),t.assignFinalMaterial(m),d.push(m)}for(let s=0,r=d.length;s<r;s++)t.associations.set(d[s],{meshes:e,primitives:s});if(1===d.length)return A.extensions&&addUnknownExtensionsToUserData(r,d[0],A),d[0];const g=new o.ZAu;A.extensions&&addUnknownExtensionsToUserData(r,g,A),t.associations.set(g,{meshes:e});for(let e=0,t=d.length;e<t;e++)g.add(d[e]);return g}))}loadCamera(e){let t;const s=this.json.cameras[e],r=s[s.type];if(r)return"perspective"===s.type?t=new o.cPb(o.M8C.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===s.type&&(t=new o.iKG(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),assignExtrasToUserData(t,s),Promise.resolve(t);De.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],s=[];for(let e=0,r=t.joints.length;e<r;e++)s.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then((function(e){const s=e.pop(),r=e,A=[],l=[];for(let e=0,h=r.length;e<h;e++){const h=r[e];if(h){A.push(h);const t=new o.yGw;null!==s&&t.fromArray(s.array,16*e),l.push(t)}else De.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new o.OdW(A,l)}))}loadAnimation(e){const t=this.json,s=this,r=t.animations[e],A=r.name?r.name:"animation_"+e,l=[],h=[],c=[],d=[],g=[];for(let e=0,t=r.channels.length;e<t;e++){const t=r.channels[e],s=r.samplers[t.sampler],o=t.target,A=o.node,p=void 0!==r.parameters?r.parameters[s.input]:s.input,m=void 0!==r.parameters?r.parameters[s.output]:s.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),h.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",m)),d.push(s),g.push(o))}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c),Promise.all(d),Promise.all(g)]).then((function(e){const t=e[0],r=e[1],l=e[2],h=e[3],c=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],A=r[e],g=l[e],p=h[e],m=c[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=s._createAnimationTracks(o,A,g,p,m);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new o.m7l(A,void 0,d)}))}createNodeMesh(e){const t=this.json,s=this,r=t.nodes[e];return void 0===r.mesh?null:s.getDependency("mesh",r.mesh).then((function(e){const t=s._getNodeRef(s.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,s=r.weights.length;t<s;t++)e.morphTargetInfluences[t]=r.weights[t]})),t}))}loadNode(e){const t=this,s=this.json.nodes[e],r=t._loadNodeShallow(e),o=[],A=s.children||[];for(let e=0,s=A.length;e<s;e++)o.push(t.getDependency("node",A[e]));const l=void 0===s.skin?Promise.resolve(null):t.getDependency("skin",s.skin);return Promise.all([r,Promise.all(o),l]).then((function(e){const t=e[0],s=e[1],r=e[2];null!==r&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(r,je)}));for(let e=0,r=s.length;e<r;e++)t.add(s[e]);return t}))}_loadNodeShallow(e){const t=this.json,s=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const A=t.nodes[e],l=A.name?r.createUniqueName(A.name):"",h=[],c=r._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return c&&h.push(c),void 0!==A.camera&&h.push(r.getDependency("camera",A.camera).then((function(e){return r._getNodeRef(r.cameraCache,A.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){h.push(e)})),this.nodeCache[e]=Promise.all(h).then((function(t){let h;if(h=!0===A.isBone?new o.N$j:t.length>1?new o.ZAu:1===t.length?t[0]:new o.Tme,h!==t[0])for(let e=0,s=t.length;e<s;e++)h.add(t[e]);if(A.name&&(h.userData.name=A.name,h.name=l),assignExtrasToUserData(h,A),A.extensions&&addUnknownExtensionsToUserData(s,h,A),void 0!==A.matrix){const e=new o.yGw;e.fromArray(A.matrix),h.applyMatrix4(e)}else void 0!==A.translation&&h.position.fromArray(A.translation),void 0!==A.rotation&&h.quaternion.fromArray(A.rotation),void 0!==A.scale&&h.scale.fromArray(A.scale);return r.associations.has(h)||r.associations.set(h,{}),r.associations.get(h).nodes=e,h})),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],r=this,A=new o.ZAu;s.name&&(A.name=r.createUniqueName(s.name)),assignExtrasToUserData(A,s),s.extensions&&addUnknownExtensionsToUserData(t,A,s);const l=s.nodes||[],h=[];for(let e=0,t=l.length;e<t;e++)h.push(r.getDependency("node",l[e]));return Promise.all(h).then((function(e){for(let t=0,s=e.length;t<s;t++)A.add(e[t]);return r.associations=(e=>{const t=new Map;for(const[e,s]of r.associations)(e instanceof o.F5T||e instanceof o.xEZ)&&t.set(e,s);return e.traverse((e=>{const s=r.associations.get(e);null!=s&&t.set(e,s)})),t})(A),A}))}_createAnimationTracks(e,t,s,r,A){const l=[],h=e.name?e.name:e.uuid,c=[];let d;switch(qe[A.path]===qe.weights?e.traverse((function(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)})):c.push(h),qe[A.path]){case qe.weights:d=o.dUE;break;case qe.rotation:d=o.iLg;break;case qe.position:case qe.scale:d=o.yC1;break;default:if(1===s.itemSize)d=o.dUE;else d=o.yC1}const g=void 0!==r.interpolation?Ke[r.interpolation]:o.NMF,p=this._getArrayFromAccessor(s);for(let e=0,s=c.length;e<s;e++){const s=new d(c[e]+"."+qe[A.path],t.array,p,g);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(s),l.push(s)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r<o;r++)s[r]=t[r]*e;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof o.iLg?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,s){const r=t.attributes,A=[];function assignAttributeAccessor(t,r){return s.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(const t in r){const s=Ve[t]||t.toLowerCase();s in e.attributes||A.push(assignAttributeAccessor(r[t],s))}if(void 0!==t.indices&&!e.index){const r=s.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));A.push(r)}return o.epp.workingColorSpace!==o.GUF&&"COLOR_0"in r&&De.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${o.epp.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,s){const r=t.attributes,A=new o.ZzF;if(void 0===r.POSITION)return;{const e=s.json.accessors[r.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void De.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(A.set(new o.Pa4(t[0],t[1],t[2]),new o.Pa4(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(Ne[e.componentType]);A.min.multiplyScalar(t),A.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new o.Pa4,t=new o.Pa4;for(let r=0,o=l.length;r<o;r++){const o=l[r];if(void 0!==o.POSITION){const r=s.json.accessors[o.POSITION],A=r.min,l=r.max;if(void 0!==A&&void 0!==l){if(t.setX(Math.max(Math.abs(A[0]),Math.abs(l[0]))),t.setY(Math.max(Math.abs(A[1]),Math.abs(l[1]))),t.setZ(Math.max(Math.abs(A[2]),Math.abs(l[2]))),r.normalized){const e=getNormalizedComponentScale(Ne[r.componentType]);t.multiplyScalar(e)}e.max(t)}else De.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}A.expandByVector(e)}e.boundingBox=A;const h=new o.aLr;A.getCenter(h.center),h.radius=A.min.distanceTo(A.max)/2,e.boundingSphere=h}(e,t,s),Promise.all(A).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,s){let r=!1,o=!1,A=!1;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(o=!0),void 0!==s.COLOR_0&&(A=!0),r&&o&&A)break}if(!r&&!o&&!A)return Promise.resolve(e);const l=[],h=[],c=[];for(let d=0,g=t.length;d<g;d++){const g=t[d];if(r){const t=void 0!==g.POSITION?s.getDependency("accessor",g.POSITION):e.attributes.position;l.push(t)}if(o){const t=void 0!==g.NORMAL?s.getDependency("accessor",g.NORMAL):e.attributes.normal;h.push(t)}if(A){const t=void 0!==g.COLOR_0?s.getDependency("accessor",g.COLOR_0):e.attributes.color;c.push(t)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(t){const s=t[0],l=t[1],h=t[2];return r&&(e.morphAttributes.position=s),o&&(e.morphAttributes.normal=l),A&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,s):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 s=this.workersResolve[e];if(s&&s(t),this.queue.length){const{resolve:t,msg:s,transfer:r}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(s,r)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((s=>{const r=this._getIdleWorker();-1!==r?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=s,this.workers[r].postMessage(e,t)):this.queue.push({resolve:s,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 $e=s(48764).Buffer;const We=9,Xe=15,Ze=16,et=22,tt=37,it=43,st=76,nt=83,rt=97,at=100,ot=103,At=109,lt=165,ht=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,s,r){this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=r,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 s=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,r)}}new Uint8Array([0]);const ct=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):$e.from(e).toString("utf8")}var ut=s(48764).Buffer;let dt,gt,pt;const mt={env:{emscripten_notify_memory_growth:function(e){pt=new Uint8Array(gt.exports.memory.buffer)}}};class zstddec_module_Q{init(){return dt||(dt="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+ft).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,mt))).then(this._init):WebAssembly.instantiate(ut.from(ft,"base64"),mt).then(this._init),dt)}_init(e){gt=e.instance,mt.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!gt)throw new Error("ZSTDDecoder: Await .init() before decoding.");const s=e.byteLength,r=gt.exports.malloc(s);pt.set(e,r),t=t||Number(gt.exports.ZSTD_findDecompressedSize(r,s));const o=gt.exports.malloc(t),A=gt.exports.ZSTD_decompress(o,t,r,s),l=pt.slice(o,o+A);return gt.exports.free(r),gt.exports.free(o),l}}const ft="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/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRA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ABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKA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sgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8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IA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogH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ICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQ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IAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";var It=s(25108);const Et=new WeakMap;let Ct,Bt=0;class KTX2Loader extends o.aNw{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&&It.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 o.hH6(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),s=new o.hH6(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const r=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then((([e,t])=>{const s=KTX2Loader.BasisWorker.toString(),r=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r])),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}))})),Bt>0&&It.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Bt++}return this.transcoderPending}load(e,t,s,r){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const A=new o.hH6(this.manager);A.setResponseType("arraybuffer"),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{if(Et.has(e)){return Et.get(e).promise.then(t).catch(r)}this._createTexture(e).then((e=>t?t(e):null)).catch(r)}),s,r)}_createTextureFrom(e,t){const{faces:s,width:r,height:A,format:l,type:h,error:c,dfdFlags:d}=e;if("error"===h)return Promise.reject(c);let g;if(6===t.faceCount)g=new o.qVC(s,l,o.ywz);else{const e=s[0].mipmaps;g=t.layerCount>1?new o.Z_g(e,r,A,t.layerCount,l,o.ywz):new o.EB7(e,r,A,l,o.ywz)}return g.minFilter=1===s[0].mipmaps.length?o.wem:o.D1R,g.magFilter=o.wem,g.generateMipmaps=!1,g.needsUpdate=!0,g.colorSpace=parseColorSpace(t),g.premultiplyAlpha=!!(1&d),g}async _createTexture(e,t={}){const s=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,ct.length);if(t[0]!==ct[0]||t[1]!==ct[1]||t[2]!==ct[2]||t[3]!==ct[3]||t[4]!==ct[4]||t[5]!==ct[5]||t[6]!==ct[6]||t[7]!==ct[7]||t[8]!==ct[8]||t[9]!==ct[9]||t[10]!==ct[10]||t[11]!==ct[11])throw new Error("Missing KTX 2.0 identifier.");const s=new Si,r=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,ct.length,r,!0);s.vkFormat=o._nextUint32(),s.typeSize=o._nextUint32(),s.pixelWidth=o._nextUint32(),s.pixelHeight=o._nextUint32(),s.pixelDepth=o._nextUint32(),s.layerCount=o._nextUint32(),s.faceCount=o._nextUint32();const A=o._nextUint32();s.supercompressionScheme=o._nextUint32();const l=o._nextUint32(),h=o._nextUint32(),c=o._nextUint32(),d=o._nextUint32(),g=o._nextUint64(),p=o._nextUint64(),m=new Ii(e,ct.length+r,3*A*8,!0);for(let t=0;t<A;t++)s.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+m._nextUint64(),m._nextUint64()),uncompressedByteLength:m._nextUint64()});const f=new Ii(e,l,h,!0),I={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:[]},E=(I.descriptorBlockSize/4-6)/4;for(let e=0;e<E;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()),I.samples[e]=t}s.dataFormatDescriptor.length=0,s.dataFormatDescriptor.push(I);const C=new Ii(e,c,d,!0);for(;C._offset<d;){const e=C._nextUint32(),t=C._scan(e),r=Ei(t),o=C._scan(e-t.byteLength);s.keyValue[r]=r.match(/^ktx/i)?Ei(o):o,C._offset%4&&C._skip(4-C._offset%4)}if(p<=0)return s;const B=new Ii(e,g,p,!0),y=B._nextUint16(),Q=B._nextUint16(),x=B._nextUint32(),b=B._nextUint32(),S=B._nextUint32(),T=B._nextUint32(),F=[];for(let e=0;e<A;e++)F.push({imageFlags:B._nextUint32(),rgbSliceByteOffset:B._nextUint32(),rgbSliceByteLength:B._nextUint32(),alphaSliceByteOffset:B._nextUint32(),alphaSliceByteLength:B._nextUint32()});const _=g+B._offset,U=_+x,G=U+b,O=G+S,q=new Uint8Array(e.buffer,e.byteOffset+_,x),K=new Uint8Array(e.buffer,e.byteOffset+U,b),J=new Uint8Array(e.buffer,e.byteOffset+G,S),Y=new Uint8Array(e.buffer,e.byteOffset+O,T);return s.globalData={endpointCount:y,selectorCount:Q,imageDescs:F,endpointsData:q,selectorsData:K,tablesData:J,extendedData:Y},s}(new Uint8Array(e));if(0!==s.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===wt[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let s;2===e.supercompressionScheme&&(Ct||(Ct=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),s=await Ct);const r=[];for(let A=0;A<e.levels.length;A++){const l=Math.max(1,e.pixelWidth>>A),h=Math.max(1,e.pixelHeight>>A),c=e.pixelDepth?Math.max(1,e.pixelDepth>>A):0,d=e.levels[A];let g,p;if(0===e.supercompressionScheme)g=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");g=s.decode(d.levelData,d.uncompressedByteLength)}p=vt[t]===o.VzW?new Float32Array(g.buffer,g.byteOffset,g.byteLength/Float32Array.BYTES_PER_ELEMENT):vt[t]===o.cLu?new Uint16Array(g.buffer,g.byteOffset,g.byteLength/Uint16Array.BYTES_PER_ELEMENT):g,r.push({data:p,width:l,height:h,depth:c})}let A;if(yt.has(wt[t]))A=0===e.pixelDepth?new o.IEO(r[0].data,e.pixelWidth,e.pixelHeight):new o.JUT(r[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");A=new o.EB7(r,e.pixelWidth,e.pixelHeight)}return A.mipmaps=r,A.type=vt[t],A.format=wt[t],A.colorSpace=parseColorSpace(e),A.needsUpdate=!0,Promise.resolve(A)}(s);const r=t,A=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e]))).then((e=>this._createTextureFrom(e.data,s)));return Et.set(e,{promise:A}),A}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Bt--,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:o.wk1,RGBA_ASTC_4x4_Format:o.ptH,RGBA_BPTC_Format:o.bsb,RGBA_ETC2_EAC_Format:o.ekQ,RGBA_PVRTC_4BPPV1_Format:o.eaV,RGBA_S3TC_DXT5_Format:o.ILR,RGB_ETC1_Format:o.fto,RGB_ETC2_Format:o.l0P,RGB_PVRTC_4BPPV1_Format:o._AM,RGB_S3TC_DXT1_Format:o.wuA},KTX2Loader.BasisWorker=function(){let e,t,s;const r=_EngineFormat,o=_TranscoderFormat,A=_BasisFormat;self.addEventListener("message",(function(l){const d=l.data;switch(d.type){case"init":e=d.config,function init(e){t=new Promise((t=>{s={wasmBinary:e,onRuntimeInitialized:t},BASIS(s)})).then((()=>{s.initializeBasis(),void 0===s.KTX2File&&It.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(d.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:l,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I}=function transcode(t){const l=new s.KTX2File(new Uint8Array(t));function cleanup(){l.close(),l.delete()}if(!l.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const d=l.isUASTC()?A.UASTC_4x4:A.ETC1S,g=l.getWidth(),p=l.getHeight(),m=l.getLayers()||1,f=l.getLevels(),I=l.getFaces(),E=l.getHasAlpha(),C=l.getDFDFlags(),{transcoderFormat:B,engineFormat:y}=function getTranscoderFormat(t,s,l,d){let g,p;const m=t===A.ETC1S?h:c;for(let r=0;r<m.length;r++){const o=m[r];if(e[o.if]&&(o.basisFormat.includes(t)&&!(d&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(s)&&isPowerOfTwo(l))))return g=o.transcoderFormat[d?1:0],p=o.engineFormat[d?1:0],{transcoderFormat:g,engineFormat:p}}return It.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),g=o.RGBA32,p=r.RGBAFormat,{transcoderFormat:g,engineFormat:p}}(d,g,p,E);if(!g||!p||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!l.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const Q=[],x=[];for(let e=0;e<I;e++){const t=[];for(let s=0;s<f;s++){const r=[];let o,A;for(let t=0;t<m;t++){const h=l.getImageLevelInfo(s,t,e);0!==e||0!==s||0!==t||h.origWidth%4==0&&h.origHeight%4==0||It.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,A=h.origHeight):(o=h.width,A=h.height);const c=new Uint8Array(l.getImageTranscodedSizeInBytes(s,t,0,B));if(!l.transcodeImage(c,s,t,e,B,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");r.push(c)}const h=concat(r);t.push({data:h,width:o,height:A}),x.push(h.buffer)}Q.push({mipmaps:t,width:g,height:p,format:y})}return cleanup(),{faces:Q,buffers:x,width:g,height:p,hasAlpha:E,format:y,dfdFlags:C}}(d.buffer);self.postMessage({type:"transcode",id:d.id,faces:t,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I},l)}catch(e){It.error(e),self.postMessage({type:"error",id:d.id,error:e.message})}}))}}));const l=[{if:"astcSupported",basisFormat:[A.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[r.RGB_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[r.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=l.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),c=l.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 s=0;s<e.length;s++){t+=e[s].byteLength}const s=new Uint8Array(t);let r=0;for(let t=0;t<e.length;t++){const o=e[t];s.set(o,r),r+=o.byteLength}return s}};const yt=new Set([o.wk1,o.av9,o.hEm]),wt={[At]:o.wk1,[rt]:o.wk1,[tt]:o.wk1,[it]:o.wk1,[ot]:o.av9,[nt]:o.av9,[Ze]:o.av9,[et]:o.av9,[at]:o.hEm,[st]:o.hEm,[Xe]:o.hEm,[We]:o.hEm,[ht]:o.Djp,[lt]:o.Djp},vt={[At]:o.VzW,[rt]:o.cLu,[tt]:o.ywz,[it]:o.ywz,[ot]:o.VzW,[nt]:o.cLu,[Ze]:o.ywz,[et]:o.ywz,[at]:o.VzW,[st]:o.cLu,[Xe]:o.ywz,[We]:o.ywz,[ht]:o.ywz,[lt]:o.ywz};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?o.KI_:o.GUF:10===t.colorPrimaries?2===t.transferFunction?o.ntt:o.AmZ:(0===t.colorPrimaries||It.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),o.aCh)}var Qt,xt;const bt=Symbol("retainerCount"),St=Symbol("recentlyUsed"),Mt=Symbol("evict"),Tt=Symbol("evictionThreshold"),Rt=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[Qt]=new Map,this[xt]=[],this[Rt]=e,this[Tt]=t}set evictionThreshold(e){this[Tt]=e,this[Mt]()}get evictionThreshold(){return this[Tt]}get cache(){return this[Rt]}retainerCount(e){return this[bt].get(e)||0}reset(){this[bt].clear(),this[St]=[]}retain(e){this[bt].has(e)||this[bt].set(e,0),this[bt].set(e,this[bt].get(e)+1);const t=this[St].indexOf(e);-1!==t&&this[St].splice(t,1),this[St].unshift(e),this[Mt]()}release(e){this[bt].has(e)&&this[bt].set(e,Math.max(this[bt].get(e)-1,0)),this[Mt]()}[(Qt=bt,xt=St,Mt)](){if(!(this[St].length<this[Tt]))for(let e=this[St].length-1;e>=this[Tt];--e){const t=this[St][e];0===this[bt].get(t)&&(this[Rt].delete(t),this[St].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const s of e.mappings)for(const e of s.variants)t.set(e,{material:null,gltfMaterialIndex:s.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,s=t.json;if(void 0===s.extensions||void 0===s.extensions[this.name])return null;const r=(e=>{const t=[],s=new Set;for(const r of e){let e=r,o=0;for(;s.has(e);)e=r+"."+ ++o;s.add(e),t.push(e)}return t})((s.extensions[this.name].variants||[]).map((e=>e.name)));for(const r of e.scenes)r.traverse((e=>{const r=e;if(!r.material)return;const o=t.associations.get(r);if(null==o||null==o.meshes||null==o.primitives)return;const A=s.meshes[o.meshes].primitives[o.primitives].extensions;A&&A[this.name]&&(r.userData.variantMaterials=mappingsArrayToTable(A[this.name]))}));return e.userData.variants=r,Promise.resolve()}}var Dt,Lt,Ft=s(25108);o.xEZ.DEFAULT_ANISOTROPY=4;const kt=new Map,_t=new Map;let Ut;const Gt=new DRACOLoader;let Nt;const Pt=new KTX2Loader;let Ot,Ht;const Vt=Symbol("loader"),qt=Symbol("evictionPolicy"),Kt=Symbol("GLTFInstance");class CachingGLTFLoader extends o.pBf{constructor(e){super(),this[Lt]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[Kt]=e,this[Vt].setDRACOLoader(Gt),this[Vt].setKTX2Loader(Pt)}static setDRACODecoderLocation(e){Ut=e,Gt.setDecoderPath(e)}static getDRACODecoderLocation(){return Ut}static setKTX2TranscoderLocation(e){Nt=e,Pt.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Nt}static setMeshoptDecoderLocation(e){var t;Ot!==e&&(Ot=e,Ht=(t=e,new Promise(((e,s)=>{const r=document.createElement("script");document.body.appendChild(r),r.onload=e,r.onerror=s,r.async=!0,r.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return Ot}static initializeKTX2Loader(e){Pt.detectSupport(e)}static get cache(){return kt}static clearCache(){kt.forEach(((e,t)=>{this.delete(t)})),this[qt].reset()}static has(e){return kt.has(e)}static async delete(e){if(!this.has(e))return;const t=kt.get(e);_t.delete(e),kt.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!_t.get(e)}get[(Dt=qt,Lt=Vt,qt)](){return this.constructor[qt]}async preload(e,t,s=()=>{}){if(this[Vt].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!kt.has(e)){null!=Ht&&this[Vt].setMeshoptDecoder(await Ht);const t=((e,t,s=()=>{})=>{const onProgress=e=>{const t=e.loaded/e.total;s(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((s,r)=>{t.load(e,s,onProgress,r)}))})(e,this[Vt],(e=>{s(.8*e)})),r=this[Kt],o=t.then((e=>r.prepare(e))).then((e=>(s(.9),new r(e)))).catch((e=>(Ft.error(e),new r)));kt.set(e,o)}await kt.get(e),_t.set(e,!0),s&&s(1)}async load(e,t,s=()=>{}){await this.preload(e,t,s);const r=await kt.get(e),o=await r.clone();return this[qt].retain(e),o.dispose=()=>{this[qt].release(e)},o}}CachingGLTFLoader[Dt]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends o.Tme{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 o.FM8(.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 Jt=new o.Pa4,zt=new o.yGw,Yt=new o.yGw,jt=new o.Pa4,$t=new o.Pa4;class CSS2DRenderer{constructor(e={}){const t=this;let s,r,o,A;const l={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,s,r){if(e.isCSS2DObject){Jt.setFromMatrixPosition(e.matrixWorld),Jt.applyMatrix4(Yt);const c=!0===e.visible&&Jt.z>=-1&&Jt.z<=1&&!0===e.layers.test(r.layers);if(e.element.style.display=!0===c?"":"none",!0===c){e.onBeforeRender(t,s,r);const l=e.element;l.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Jt.x*o+o)+"px,"+(-Jt.y*A+A)+"px)",l.parentNode!==h&&h.appendChild(l),e.onAfterRender(t,s,r)}const d={distanceToCameraSquared:getDistanceToSquared(r,e)};l.objects.set(e,d)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],s,r)}function getDistanceToSquared(e,t){return jt.setFromMatrixPosition(e.matrixWorld),$t.setFromMatrixPosition(t.matrixWorld),jt.distanceToSquared($t)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:s,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),zt.copy(t.matrixWorldInverse),Yt.multiplyMatrices(t.projectionMatrix,zt),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 l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),s=t.length;for(let e=0,r=t.length;e<r;e++)t[e].element.style.zIndex=s-e}(e)},this.setSize=function(e,t){s=e,r=t,o=s/2,A=r/2,h.style.width=e+"px",h.style.height=t+"px"}}}s(25108);function reduceVertices(e,t,s){let r=s;const A=new o.Pa4;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:s}=e;if(void 0!==s){const{position:o}=s.attributes;if(void 0!==o)for(let s=0,l=o.count;s<l;s++)e.isMesh?e.getVertexPosition(s,A):A.fromBufferAttribute(o,s),e.isSkinnedMesh||A.applyMatrix4(e.matrixWorld),r=t(r,A)}})),r}let Wt,Xt,Zt,ei;function decompress(e,t=1/0,s=null){Xt||(Xt=new o._12(2,2,1,1)),Zt||(Zt=new o.jyz({uniforms:{blitTexture:new o.xWb(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}"})),Zt.uniforms.blitTexture.value=e,Zt.defines.IS_SRGB=e.colorSpace==o.KI_,Zt.needsUpdate=!0,ei||(ei=new o.Kj0(Xt,Zt),ei.frustumCulled=!1);const r=new o.cPb,A=new o.xsS;A.add(ei),null===s&&(s=Wt=new o.CP7({antialias:!1}));const l=Math.min(e.image.width,t),h=Math.min(e.image.height,t);s.setSize(l,h),s.clear(),s.render(A,r);const c=document.createElement("canvas"),d=c.getContext("2d");c.width=l,c.height=h,d.drawImage(s.domElement,0,0,l,h);const g=new o.ROQ(c);return g.minFilter=e.minFilter,g.magFilter=e.magFilter,g.wrapS=e.wrapS,g.wrapT=e.wrapT,g.name=e.name,Wt&&(Wt.forceContextLoss(),Wt.dispose(),Wt=null),g}var ti=s(25108);const ii={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,s,r){const o=new GLTFWriter,A=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)A.push(this.pluginCallbacks[e](o));o.setPlugins(A),o.write(e,t,r).catch(s)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,r,o,t)}))}}const si=0,ni=1,ri=2,ai=3,oi=4,Ai=5120,li=5121,hi=5122,ci=5123,ui=5124,di=5125,gi=5126,pi=34962,mi=34963,fi=9728,Ci=9729,Bi=9984,yi=9985,wi=9986,vi=9987,Qi=33071,xi=33648,bi=10497,Mi="KHR_mesh_quantization",Ti={};Ti[o.TyD]=fi,Ti[o.YLQ]=Bi,Ti[o.aH4]=wi,Ti[o.wem]=Ci,Ti[o.qyh]=yi,Ti[o.D1R]=vi,Ti[o.uWy]=Qi,Ti[o.rpg]=bi,Ti[o.OoA]=xi;const Ri={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Di=new o.Ilk;function equalArray(e,t){return e.length===t.length&&e.every((function(e,s){return e===t[s]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const s=getPaddedBufferSize(e.byteLength);if(s!==e.byteLength){const r=new Uint8Array(s);if(r.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<s;o++)r[o]=t;return r.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((s=>e.toBlob(s,t)));let s;return"image/jpeg"===t?s=.92:"image/webp"===t&&(s=.8),e.convertToBlob({type:t,quality:s})}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,s={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const r=this,o=r.buffers,A=r.json;s=r.options;const l=r.extensionsUsed,h=r.extensionsRequired,c=new Blob(o,{type:"application/octet-stream"}),d=Object.keys(l),g=Object.keys(h);if(d.length>0&&(A.extensionsUsed=d),g.length>0&&(A.extensionsRequired=g),A.buffers&&A.buffers.length>0&&(A.buffers[0].byteLength=c.size),!0===s.binary){const e=new FileReader;e.readAsArrayBuffer(c),e.onloadend=function(){const s=getPaddedArrayBuffer(e.result),r=new DataView(new ArrayBuffer(8));r.setUint32(0,s.byteLength,!0),r.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(A)),32),l=new DataView(new ArrayBuffer(8));l.setUint32(0,o.byteLength,!0),l.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),c=new DataView(h);c.setUint32(0,1179937895,!0),c.setUint32(4,2,!0);const d=12+l.byteLength+o.byteLength+r.byteLength+s.byteLength;c.setUint32(8,d,!0);const g=new Blob([h,l,o,r,s],{type:"application/octet-stream"}),p=new FileReader;p.readAsArrayBuffer(g),p.onloadend=function(){t(p.result)}}}else if(A.buffers&&A.buffers.length>0){const e=new FileReader;e.readAsDataURL(c),e.onloadend=function(){const s=e.result;A.buffers[0].uri=s,t(A)}}else t(A)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const s=this.options,r=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],r[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){ti.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 o.Pa4;for(let s=0,r=e.count;s<r;s++)if(Math.abs(t.fromBufferAttribute(e,s).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 s=e.clone(),r=new o.Pa4;for(let e=0,t=s.count;e<t;e++)r.fromBufferAttribute(s,e),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),s.setXYZ(e,r.x,r.y,r.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1;const r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),s=!0),0!==t.rotation&&(r.rotation=t.rotation,s=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===o.KI_?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}ti.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof o.EB7&&(e=decompress(e)),t instanceof o.EB7&&(t=decompress(t));const s=e?e.image:null,r=t?t.image:null,A=Math.max(s?s.width:0,r?r.width:0),l=Math.max(s?s.height:0,r?r.height:0),h=getCanvas();h.width=A,h.height=l;const c=h.getContext("2d");c.fillStyle="#00ffff",c.fillRect(0,0,A,l);const d=c.getImageData(0,0,A,l);if(s){c.drawImage(s,0,0,A,l);const t=getEncodingConversion(e),r=c.getImageData(0,0,A,l).data;for(let e=2;e<r.length;e+=4)d.data[e]=256*t(r[e]/256)}if(r){c.drawImage(r,0,0,A,l);const e=getEncodingConversion(t),s=c.getImageData(0,0,A,l).data;for(let t=1;t<s.length;t+=4)d.data[t]=256*e(s[t]/256)}c.putImageData(d,0,0);const g=(e||t).clone();return g.source=new o.Hw6(h),g.colorSpace=o.aCh,g.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&ti.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),g}processBuffer(e){const t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,r,A){const l=this.json;let h;switch(l.bufferViews||(l.bufferViews=[]),t){case Ai:case li:h=1;break;case hi:case ci:h=2;break;default:h=4}let c=e.itemSize*h;A===pi&&(c=4*Math.ceil(c/4));const d=getPaddedBufferSize(r*c),g=new DataView(new ArrayBuffer(d));let p=0;for(let A=s;A<s+r;A++){for(let s=0;s<e.itemSize;s++){let r;e.itemSize>4?r=e.array[A*e.itemSize+s]:(0===s?r=e.getX(A):1===s?r=e.getY(A):2===s?r=e.getZ(A):3===s&&(r=e.getW(A)),!0===e.normalized&&(r=o.M8C.normalize(r,e.array))),t===gi?g.setFloat32(p,r,!0):t===ui?g.setInt32(p,r,!0):t===di?g.setUint32(p,r,!0):t===hi?g.setInt16(p,r,!0):t===ci?g.setUint16(p,r,!0):t===Ai?g.setInt8(p,r):t===li&&g.setUint8(p,r),p+=h}p%c!=0&&(p+=c-p%c)}const m={buffer:this.processBuffer(g.buffer),byteOffset:this.byteOffset,byteLength:d};void 0!==A&&(m.target=A),A===pi&&(m.byteStride=c),this.byteOffset+=d,l.bufferViews.push(m);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise((function(r){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),A={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(s.bufferViews.push(A)-1)}}))}processAccessor(e,t,s,r){const A=this.json;let l;if(e.array.constructor===Float32Array)l=gi;else if(e.array.constructor===Int32Array)l=ui;else if(e.array.constructor===Uint32Array)l=di;else if(e.array.constructor===Int16Array)l=hi;else if(e.array.constructor===Uint16Array)l=ci;else if(e.array.constructor===Int8Array)l=Ai;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=li}if(void 0===s&&(s=0),void 0!==r&&r!==1/0||(r=e.count),0===r)return null;const h=function getMinMax(e,t,s){const r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let A=t;A<t+s;A++)for(let t=0;t<e.itemSize;t++){let s;e.itemSize>4?s=e.array[A*e.itemSize+t]:(0===t?s=e.getX(A):1===t?s=e.getY(A):2===t?s=e.getZ(A):3===t&&(s=e.getW(A)),!0===e.normalized&&(s=o.M8C.normalize(s,e.array))),r.min[t]=Math.min(r.min[t],s),r.max[t]=Math.max(r.max[t],s)}return r}(e,s,r);let c;void 0!==t&&(c=e===t.index?mi:pi);const d=this.processBufferView(e,l,s,r,c),g={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:r,max:h.max,min:h.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(g.normalized=!0),A.accessors||(A.accessors=[]),A.accessors.push(g)-1}processImage(e,t,s,r="image/png"){if(null!==e){const A=this,l=A.cache,h=A.json,c=A.options,d=A.pending;l.images.has(e)||l.images.set(e,{});const g=l.images.get(e),p=r+":flipY/"+s.toString();if(void 0!==g[p])return g[p];h.images||(h.images=[]);const m={mimeType:r},f=getCanvas();f.width=Math.min(e.width,c.maxTextureSize),f.height=Math.min(e.height,c.maxTextureSize);const I=f.getContext("2d");if(!0===s&&(I.translate(0,f.height),I.scale(1,-1)),void 0!==e.data){t!==o.wk1&&ti.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&ti.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const s=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<s.length;t+=4)s[t+0]=e.data[t+0],s[t+1]=e.data[t+1],s[t+2]=e.data[t+2],s[t+3]=e.data[t+3];I.putImageData(new ImageData(s,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.");I.drawImage(e,0,0,f.width,f.height)}!0===c.binary?d.push(getToBlobPromise(f,r).then((e=>A.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==f.toDataURL?m.uri=f.toDataURL(r):d.push(getToBlobPromise(f,r).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const E=h.images.push(m)-1;return g[p]=E,E}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 s={magFilter:Ti[e.magFilter],minFilter:Ti[e.minFilter],wrapS:Ti[e.wrapS],wrapT:Ti[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){const t=this.options,s=this.cache,r=this.json;if(s.textures.has(e))return s.textures.get(e);r.textures||(r.textures=[]),e instanceof o.EB7&&(e=decompress(e,t.maxTextureSize));let A=e.userData.mimeType;"image/webp"===A&&(A="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,A)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const h=r.textures.push(l)-1;return s.textures.set(e,h),h}processMaterial(e){const t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return ti.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const r={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&ti.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const A=e.color.toArray().concat([e.opacity]);if(equalArray(A,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=A),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=.5,r.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),s={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(s,t),r.pbrMetallicRoughness.metallicRoughnessTexture=s}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),r.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),r.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),r.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),r.occlusionTexture=t}e.transparent?r.alphaMode="BLEND":e.alphaTest>0&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),e.side===o.ehD&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,r)}));const l=s.materials.push(r)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,s=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,s=e.material.length;t<s;t++)r.push(e.material[t].uuid);else r.push(e.material.uuid);const A=r.join(":");if(t.meshes.has(A))return t.meshes.get(A);const l=e.geometry;let h;h=e.isLineSegments?ni:e.isLineLoop?ri:e.isLine?ai:e.isPoints?si:e.material.wireframe?ni:oi;const c={},d={},g=[],p=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=l.getAttribute("normal");void 0===f||this.isNormalizedNormalAttribute(f)||(ti.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let I=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const s=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(s))){d[e]=t.attributes.get(this.getUID(s));continue}I=null;const r=s.array;"JOINTS_0"!==e||r instanceof Uint16Array||r instanceof Uint8Array||(ti.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),I=new o.TlE(new Uint16Array(r),s.itemSize,s.normalized));const A=this.processAccessor(I||s,l);null!==A&&(e.startsWith("_")||this.detectMeshQuantization(e,s),d[e]=A,t.attributes.set(this.getUID(s),A))}if(void 0!==f&&l.setAttribute("normal",f),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const s=[],r=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let A=0;A<e.morphTargetInfluences.length;++A){const h={};let c=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){c||(ti.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),c=!0);continue}const s=l.morphAttributes[e][A],r=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(s,!0))){h[r]=t.attributes.get(this.getUID(s,!0));continue}const d=s.clone();if(!l.morphTargetsRelative)for(let e=0,t=s.count;e<t;e++)for(let t=0;t<s.itemSize;t++)0===t&&d.setX(e,s.getX(e)-o.getX(e)),1===t&&d.setY(e,s.getY(e)-o.getY(e)),2===t&&d.setZ(e,s.getZ(e)-o.getZ(e)),3===t&&d.setW(e,s.getW(e)-o.getW(e));h[r]=this.processAccessor(d,l),t.attributes.set(this.getUID(o,!0),h[r])}p.push(h),s.push(e.morphTargetInfluences[A]),void 0!==e.morphTargetDictionary&&r.push(o[A])}c.weights=s,r.length>0&&(c.extras={},c.extras.targetNames=r)}const E=Array.isArray(e.material);if(E&&0===l.groups.length)return null;let C=!1;if(E&&null===l.index){const e=[];for(let t=0,s=l.attributes.position.count;t<s;t++)e[t]=t;l.setIndex(e),C=!0}const B=E?e.material:[e.material],y=E?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,s=y.length;e<s;e++){const s={mode:h,attributes:d};if(this.serializeUserData(l,s),p.length>0&&(s.targets=p),null!==l.index){let r=this.getUID(l.index);void 0===y[e].start&&void 0===y[e].count||(r+=":"+y[e].start+":"+y[e].count),t.attributes.has(r)?s.indices=t.attributes.get(r):(s.indices=this.processAccessor(l.index,l,y[e].start,y[e].count),t.attributes.set(r,s.indices)),null===s.indices&&delete s.indices}const r=this.processMaterial(B[y[e].materialIndex]);null!==r&&(s.material=r),g.push(s)}!0===C&&l.setIndex(null),c.primitives=g,s.meshes||(s.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,c)}));const Q=s.meshes.push(c)-1;return t.meshes.set(A,Q),Q}detectMeshQuantization(e,t){if(this.extensionsUsed[Mi])return;let s;switch(t.array.constructor){case Int8Array:s="byte";break;case Uint8Array:s="unsigned byte";break;case Int16Array:s="short";break;case Uint16Array:s="unsigned short";break;default:return}t.normalized&&(s+=" normalized");const r=e.split("_",1)[0];ii[r]&&ii[r].includes(s)&&(this.extensionsUsed[Mi]=!0,this.extensionsRequired[Mi]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const s=e.isOrthographicCamera,r={type:s?"orthographic":"perspective"};return s?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:o.M8C.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){const s=this.json,r=this.nodeMap;s.animations||(s.animations=[]);const A=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],h=[];for(let e=0;e<A.length;++e){const s=A[e],c=o.iUV.parseTrackName(s.name);let d=o.iUV.findNode(t,c.nodeName);const g=Ri[c.propertyName];if("bones"===c.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(c.objectIndex):void 0),!d||!g)return ti.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name),null;const p=1;let m,f=s.values.length/s.times.length;g===Ri.morphTargetInfluences&&(f/=d.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",f/=3):m=s.getInterpolation()===o.Syv?"STEP":"LINEAR",h.push({input:this.processAccessor(new o.TlE(s.times,p)),output:this.processAccessor(new o.TlE(s.values,f)),interpolation:m}),l.push({sampler:h.length-1,target:{node:r.get(d),path:g}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:h,channels:l}),s.animations.length-1}processSkin(e){const t=this.json,s=this.nodeMap,r=t.nodes[s.get(e)],A=e.skeleton;if(void 0===A)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const h=[],c=new Float32Array(16*A.bones.length),d=new o.yGw;for(let t=0;t<A.bones.length;++t)h.push(s.get(A.bones[t])),d.copy(A.boneInverses[t]),d.multiply(e.bindMatrix).toArray(c,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new o.TlE(c,16)),joints:h,skeleton:s.get(l)});return r.skin=t.skins.length-1}processNode(e){const t=this.json,s=this.options,r=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(s.trs){const t=e.quaternion.toArray(),s=e.position.toArray(),r=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(s,[0,0,0])||(o.translation=s),equalArray(r,[1,1,1])||(o.scale=r)}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 r=0,o=e.children.length;r<o;r++){const o=e.children[r];if(o.visible||!1===s.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 A=t.nodes.push(o)-1;return r.set(e,A),A}processScene(e){const t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);const r={};""!==e.name&&(r.name=e.name),t.scenes.push(r);const o=[];for(let t=0,r=e.children.length;t<r;t++){const r=e.children[t];if(r.visible||!1===s.onlyVisible){const e=this.processNode(r);null!==e&&o.push(e)}}o.length>0&&(r.nodes=o),this.serializeUserData(e,r)}processObjects(e){const t=new o.xsS;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);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 s=[];for(let t=0;t<e.length;t++)e[t]instanceof o.xsS?this.processScene(e[t]):s.push(e[t]);s.length>0&&this.processObjects(s);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;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 ti.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const s=this.writer,r=s.json,o=s.extensionsUsed,A={};e.name&&(A.name=e.name),A.color=e.color.toArray(),A.intensity=e.intensity,e.isDirectionalLight?A.type="directional":e.isPointLight?(A.type="point",e.distance>0&&(A.range=e.distance)):e.isSpotLight&&(A.type="spot",e.distance>0&&(A.range=e.distance),A.spot={},A.spot.innerConeAngle=(1-e.penumbra)*e.angle,A.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&ti.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||ti.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]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},o[this.name]=!0);const l=r.extensions[this.name].lights;l.push(A),t.extensions=t.extensions||{},t.extensions[this.name]={light:l.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const s=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},s[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 s=this.writer,r=s.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:s.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};s.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:s.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};s.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:s.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};s.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=s.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:s.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};s.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:s.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};s.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=s.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:s.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};s.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=s.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:s.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};s.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,r[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 s=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[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(Di)&&!e.specularIntensityMap&&!e.specularColorMap)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:s.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};s.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:s.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};s.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,r[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 s=this.writer,r=s.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:s.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};s.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:s.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};s.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,r[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 s=this.writer,r=s.extensionsUsed,o={};if(e.anisotropyMap){const t={index:s.processTexture(e.anisotropyMap)};s.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[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 s=this.writer,r=s.extensionsUsed,o={};if(e.bumpMap){const t={index:s.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};s.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[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 s=this.writer,r=e,A=new Float32Array(3*r.count),l=new Float32Array(4*r.count),h=new Float32Array(3*r.count),c=new o.yGw,d=new o.Pa4,g=new o._fP,p=new o.Pa4;for(let e=0;e<r.count;e++)r.getMatrixAt(e,c),c.decompose(d,g,p),d.toArray(A,3*e),g.toArray(l,4*e),p.toArray(h,3*e);const m={TRANSLATION:s.processAccessor(new o.TlE(A,3)),ROTATION:s.processAccessor(new o.TlE(l,4)),SCALE:s.processAccessor(new o.TlE(h,3))};r.instanceColor&&(m._COLOR_0=s.processAccessor(r.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},s.extensionsUsed[this.name]=!0,s.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const s=.001,r=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),A=new e.ValueBufferType(e.values.length+r),l=e.createInterpolant(new e.ValueBufferType(r));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<r;e++)A[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<s)return 0;o[0]=t,o.set(e.times,1),A.set(l.evaluate(t),0),A.set(e.values,r),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<s)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),A.set(e.values,0),A.set(l.evaluate(t),e.values.length),h=o.length-1}else for(let c=0;c<e.times.length;c++){if(Math.abs(e.times[c]-t)<s)return c;if(e.times[c]<t&&e.times[c+1]>t){o.set(e.times.slice(0,c+1),0),o[c+1]=t,o.set(e.times.slice(c+1),c+2),A.set(e.values.slice(0,(c+1)*r),0),A.set(l.evaluate(t),(c+1)*r),A.set(e.values.slice((c+1)*r),(c+2)*r),h=c+1;break}}return e.times=o,e.values=A,h},mergeMorphTargetTracks:function(e,t){const s=[],r={},A=e.tracks;for(let e=0;e<A.length;++e){let l=A[e];const h=o.iUV.parseTrackName(l.name),c=o.iUV.findNode(t,h.nodeName);if("morphTargetInfluences"!==h.propertyName||void 0===h.propertyIndex){s.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.");ti.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(o.NMF)}const d=c.morphTargetInfluences.length,g=c.morphTargetDictionary[h.propertyIndex];if(void 0===g)throw new Error("THREE.GLTFExporter: Morph target name not found: "+h.propertyIndex);let p;if(void 0===r[c.uuid]){p=l.clone();const e=new p.ValueBufferType(d*p.times.length);for(let t=0;t<p.times.length;t++)e[t*d+g]=p.values[t];p.name=(h.nodeName||"")+".morphTargetInfluences",p.values=e,r[c.uuid]=p,s.push(p);continue}const m=l.createInterpolant(new l.ValueBufferType(1));p=r[c.uuid];for(let e=0;e<p.times.length;e++)p.values[e*d+g]=m.evaluate(p.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(p,l.times[e]);p.values[t*d+g]=l.values[e]}}return e.tracks=s,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 s of e)s.traverse((e=>{if(!compatibleObject(e))return;const s=e.userData.variantMaterials,r=e.userData.variantData;for(const[e,o]of r){const r=s.get(o.index);r&&compatibleMaterial(r.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const s=e.userData,r=s.variantMaterials,o=s.variantData,A=new Map,l=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())l.set(t.index,e);for(const e of o.values()){const t=r.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const s=this.writer.processMaterial(t.material);A.has(s)||A.set(s,{material:s,variants:[]}),A.get(s).variants.push(l.get(e.index))}const c=Array.from(A.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===c.length)return;const d=compatibleMaterial(s.originalMaterial)?this.writer.processMaterial(s.originalMaterial):-1;for(const e of t.primitives)d>=0&&(e.material=d),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:c}}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,s,r,A){this.xrLight=e,this.renderer=t,this.lightProbe=s,this.xrWebGLBinding=null,this.estimationStartCallback=A,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(r&&"XRWebGLBinding"in window){const s=new o.oAp(16);e.environment=s.texture;const r=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":r.getExtension("EXT_sRGB");break;case"rgba16f":r.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,r),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 s=t.getLightEstimate(this.lightProbe);if(s){this.xrLight.lightProbe.sh.fromArray(s.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(s.primaryLightIntensity.x,Math.max(s.primaryLightIntensity.y,s.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(s.primaryLightIntensity.x/e,s.primaryLightIntensity.y/e,s.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(s.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends o.ZAu{constructor(e,t=!0){super(),this.lightProbe=new o.lk7,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new o.Ox3,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let s=null,r=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{s=new SessionLightProbe(this,e,o,t,(()=>{r=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{s&&(s.dispose(),s=null),r&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{s&&(s.dispose(),s=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,s,r){const o=2e-4*this.naturalFrequency;if(null==e||0===r)return t;if(e===t&&0===this.velocity)return t;if(s<0)return e;const A=e-t,l=this.velocity+this.naturalFrequency*A,h=A+s*l,c=Math.exp(-this.naturalFrequency*s),d=(l-this.naturalFrequency*h)*c,g=-this.naturalFrequency*(d+l*c);return Math.abs(d)<o*Math.abs(r)&&g*A>=0?(this.velocity=0,t):(this.velocity=d,t+h*c)}}const Li=.2,Fi=Math.PI/24,ki=new o.FM8,addCorner=(e,t,s)=>{let r=t>0?s>0?0:-Math.PI/2:s>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(r),s+.17*Math.sin(r),0,t+Li*Math.cos(r),s+Li*Math.sin(r),0),r+=Fi};class PlacementBox extends o.Kj0{constructor(e,t){const s=new o.u9r,r=[],A=[],{size:l,boundingBox:h}=e,c=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(A,c,d),addCorner(A,-c,d),addCorner(A,-c,-d),addCorner(A,c,-d);const g=A.length/3;for(let e=0;e<g-2;e+=2)r.push(e,e+1,e+3,e,e+3,e+2);const p=g-2;r.push(p,p+1,1,p,1,0),s.setAttribute("position",new o.a$l(A,3)),s.setIndex(r),super(s),this.side=t;const m=this.material;switch(m.side=o.ehD,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new o.Kj0(new o._12(2*(c+Li),2*(d+Li))),this.hitPlane.visible=!1,this.hitPlane.material.side=o.ehD,this.add(this.hitPlane),h.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=h.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=h.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,s){ki.set(t,-s),this.hitPlane.visible=!0;const r=e.positionAndNormalFromPoint(ki,this.hitPlane);return this.hitPlane.visible=!1,null==r?null:r.position}getExpandedHit(e,t,s){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const r=this.getHit(e,t,s);return this.hitPlane.scale.set(1,1,1),r}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:s}=this.hitPlane;t.dispose(),s.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}),_i=(()=>{const e={};return t=>{const s=t;if(s in e)return e[s];const r=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=Ui(t),s=e.nodes[0];if(null==s||0===s.terms.length)break;r.push(s),t=e.remainingInput}return e[s]=r}})(),Ui=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,s=/^[\),]/;return r=>{const o=[];for(;r.length&&(r=r.trim(),!s.test(r));)if("("===r[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(r);r=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(r)){const e=Gi(r),t=e.nodes[0];if("("===(r=e.remainingInput)[0]){const{nodes:e,remainingInput:s}=parseFunctionArguments(r);o.push({type:"function",name:t,arguments:e}),r=s}else o.push(t)}else if(t.test(r))o.push({type:"operator",value:r[0]}),r=r.slice(1);else{const{nodes:e,remainingInput:t}="#"===r[0]?Oi(r):Ni(r);if(0===e.length)break;o.push(e[0]),r=t}return{nodes:[{type:"expression",terms:o}],remainingInput:r}}})(),Gi=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const s=t.match(e);return{nodes:[{type:"ident",value:null==s?t:t.substr(0,s.index)}],remainingInput:null==s?"":t.substr(s.index)}}})(),Ni=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,s=/^(m|mm|cm|rad|deg|[%])$/;return r=>{const o=r.match(e),A=null==o?"0":o[0],l=(r=null==A?r:r.slice(A.length)).match(t);let h=null!=l&&""!==l[0]?l[0]:null;const c=null==l?r:r.slice(h.length);return null==h||s.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(A)||0,unit:h}],remainingInput:c}}})(),Oi=(()=>{const e=/^[a-f0-9]*/i;return t=>{const s=(t=t.slice(1).trim()).match(e);return{nodes:null==s?[]:[{type:"hex",value:s[0]}],remainingInput:null==s?t:t.slice(s[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const s=Ui(e);if(t.push(s.nodes[0]),","===(e=s.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Hi=Symbol("visitedTypes");class ASTWalker{constructor(e){this[Hi]=e}walk(e,t){const s=e.slice();for(;s.length;){const e=s.shift();switch(this[Hi].indexOf(e.type)>-1&&t(e),e.type){case"expression":s.unshift(...e.terms);break;case"function":s.unshift(e.name,...e.arguments)}}}}const Vi=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:s,unit:r}=e;if(isFinite(s)){if("rad"===e.unit||null==e.unit)return e}else s=t,r="rad";return{type:"number",number:("deg"===r&&null!=s?s:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let s,{number:r,unit:o}=e;if(isFinite(r)){if("m"===e.unit)return e}else r=t,o="m";switch(o){default:s=1;break;case"cm":s=.01;break;case"mm":s=.001}return{type:"number",number:s*r,unit:"m"}},qi=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,s=Vi)=>{isFinite(t.number)||(t.number=s.number,t.unit=s.unit);const{unit:r}=t;if(null==r)return t;const o=e[r];return null==o?s:o(t)}})();var Ki,Ji,zi;const Yi=Symbol("evaluate"),ji=Symbol("lastValue");class Evaluator{constructor(){this[Ki]=null}static evaluatableFor(e,t=Vi){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 Vi}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:s,keywords:r}=t,{auto:o}=r;return s.map(((t,s)=>{const A=null==o[s]?t:o[s];let l=e[s]?e[s]:A;if("ident"===l.type){const e=l.value;e in r&&(l=r[e][s])}return null!=l&&"ident"!==l.type||(l=A),"%"===l.unit?numberNode(l.number/100*t.number,t.unit):(l=qi(l,t),l.unit!==t.unit?t:l)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[ji]||(this[ji]=this[Yi]()),this[ji]}}Ki=ji;const $i=Symbol("percentage"),Wi=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[$i]=e,this[Wi]=t}get isConstant(){return!0}[Yi](){return numberNode(this[$i].number/100*this[Wi].number,this[Wi].unit)}}const Xi=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[Ji]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[Xi]=t)}get isConstant(){return!1}[(Ji=Xi,Yi)](){if(null!=this[Xi]&&"window-scroll-y"===this[Xi].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 Vi}}const Zi=/[\*\/]/,es=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Vi){if(super(),this[zi]=null,1!==e.arguments.length)return;const s=e.arguments[0].terms.slice(),r=[];for(;s.length;){const e=s.shift();if(r.length>0){const s=r[r.length-1];if("operator"===s.type&&Zi.test(s.value)){const s=r.pop(),o=r.pop();if(null==o)return;r.push(new OperatorEvaluator(s,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}r.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;r.length>2;){const[e,s,o]=r.splice(0,3);if("operator"!==s.type)return;r.unshift(new OperatorEvaluator(s,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===r.length&&(this[es]=r[0])}get isConstant(){return null==this[es]||Evaluator.isConstant(this[es])}[(zi=es,Yi)](){return null!=this[es]?Evaluator.evaluate(this[es]):Vi}}const ts=Symbol("operator"),is=Symbol("left"),ss=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,s){super(),this[ts]=e,this[is]=t,this[ss]=s}get isConstant(){return Evaluator.isConstant(this[is])&&Evaluator.isConstant(this[ss])}[Yi](){const e=qi(Evaluator.evaluate(this[is])),t=qi(Evaluator.evaluate(this[ss])),{number:s,unit:r}=e,{number:o,unit:A}=t;if(null!=A&&null!=r&&A!=r)return Vi;const l=r||A;let h;switch(this[ts].value){case"+":h=s+o;break;case"-":h=s-o;break;case"/":h=s/o;break;case"*":h=s*o;break;default:return Vi}return{type:"number",number:h,unit:l}}}const ns=Symbol("evaluatables"),rs=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[rs]=t;const s=e[0],r=null!=s?s.terms:[];this[ns]=t.basis.map(((e,t)=>{const s=r[t];return null==s?{type:"ident",value:"auto"}:"ident"===s.type?s:Evaluator.evaluatableFor(s,e)}))}get isConstant(){for(const e of this[ns])if(!Evaluator.isConstant(e))return!1;return!0}[Yi](){const e=this[ns].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[rs]).map((e=>e.number))}}var as,os,As,ls;const hs=Symbol("instances"),cs=Symbol("activateListener"),us=Symbol("deactivateListener"),ds=Symbol("notifyInstances"),gs=Symbol("notify"),ps=Symbol("callback");class ScrollObserver{constructor(e){this[ps]=e}static[ds](){for(const e of ScrollObserver[hs])e[gs]()}static[(as=hs,cs)](){window.addEventListener("scroll",this[ds],{passive:!0})}static[us](){window.removeEventListener("scroll",this[ds])}observe(){0===ScrollObserver[hs].size&&ScrollObserver[cs](),ScrollObserver[hs].add(this)}disconnect(){ScrollObserver[hs].delete(this),0===ScrollObserver[hs].size&&ScrollObserver[us]()}[gs](){this[ps]()}}ScrollObserver[as]=new Set;const ms=Symbol("computeStyleCallback"),fs=Symbol("astWalker"),Is=Symbol("dependencies"),Es=Symbol("onScroll");class StyleEffector{constructor(e){this[os]={},this[As]=new ASTWalker(["function"]),this[ls]=()=>{this[ms]({relatedState:"window-scroll"})},this[ms]=e}observeEffectsFor(e){const t={},s=this[Is];this[fs].walk(e,(e=>{const{name:r}=e,o=e.arguments[0].terms[0];if("env"===r.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in s?s["window-scroll"]:new ScrollObserver(this[Es]);e.observe(),delete s["window-scroll"],t["window-scroll"]=e}}));for(const e in s){s[e].disconnect()}this[Is]=t}dispose(){for(const e in this[Is]){this[Is][e].disconnect()}}}os=Is,As=fs,ls=Es;const style=e=>{const t=e.observeEffects||!1,s=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(r,o)=>{const A=r.updated,l=r.connectedCallback,h=r.disconnectedCallback,c=Symbol(`${o}StyleEffector`),d=Symbol(`${o}StyleEvaluator`),g=Symbol(`${o}UpdateEvaluator`),p=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(r,{[c]:{value:null,writable:!0},[d]:{value:null,writable:!0},[g]:{value:function(){const e=_i(this[o]);this[d]=new StyleEvaluator(e,s(this)),null==this[c]&&t&&(this[c]=new StyleEffector((()=>this[p]()))),null!=this[c]&&this[c].observeEffectsFor(e)}},[p]:{value:function(){if(null==this[d])return;const t=this[d].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[g](),this[p]()),A.call(this,e)}},connectedCallback:{value:function(){l.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[c]&&(this[c].dispose(),this[c]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,s=easeInOutQuad)=>r=>e+(t-e)*s(r),timeline=e=>{const t=[],s=[];let r=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const A=e.keyframes[o],{value:l,frames:h}=A,c=A.ease||easeInOutQuad,d=interpolate(r,l,c);t.push(d),s.push(h),r=l}return((e,t)=>{const s=t.map((r=0,e=>r+=e));var r;return t=>{t=clamp(t,0,1),t*=s[s.length-1];const r=s.findIndex((e=>e>=t)),o=r<1?0:s[r-1],A=s[r];return e[r]((t-o)/(A-o))}})(t,s)};var Cs=s(25108),controls_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Bs=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}]}),ys=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),ws="0deg 75deg 105%",vs=["front","right","back","left"],Qs=["upper-","","lower-"],xs="auto",bs="basic",Ss="wiggle",Ms="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),Ts=(()=>{const e=_i(ws)[0].terms,t=qi(e[0]),s=qi(e[1]);return e=>{const r=e[bo].idealCameraDistance();return{basis:[t,s,numberNode(r,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[bo].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=Ts(e),s=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(s,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[bo].boundingBox.getCenter(new o.Pa4);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},Rs=Math.PI/2,Ds=Math.PI/3,Ls=Rs/2,Fs=2*Math.PI,ks=Symbol("controls"),_s=Symbol("panElement"),Us=Symbol("promptElement"),Gs=Symbol("promptAnimatedContainer"),Ns=Symbol("fingerAnimatedContainers"),Ps=Symbol("deferInteractionPrompt"),Os=Symbol("updateAria"),Hs=Symbol("a11y"),Vs=Symbol("updateA11y"),qs=Symbol("updateCameraForRadius"),Ks=Symbol("cancelPrompts"),Js=Symbol("onChange"),zs=Symbol("onPointerChange"),Ys=Symbol("waitingToPromptUser"),js=Symbol("userHasInteracted"),$s=Symbol("promptElementVisibleTime"),Ws=Symbol("lastPromptOffset"),Xs=Symbol("cancellationSource"),Zs=Symbol("lastSpherical"),en=Symbol("jumpCamera"),tn=Symbol("initialized"),sn=Symbol("maintainThetaPhi"),nn=Symbol("syncCameraOrbit"),rn=Symbol("syncFieldOfView"),an=Symbol("syncCameraTarget"),on=Symbol("syncMinCameraOrbit"),An=Symbol("syncMaxCameraOrbit"),ln=Symbol("syncMinFieldOfView"),hn=Symbol("syncMaxFieldOfView"),cn=new o.FM8,un=new o.Pa4,dn=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"}),gn=Math.PI/8,pn=.04,mn={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends o.pBf{constructor(e,t,s){super(),this.camera=e,this.element=t,this.scene=s,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=mn.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new o.Vkp,this.panPerPixel=0,this.spherical=new o.$V,this.goalSpherical=new o.$V,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(dn.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=pn*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:s}=this._options;if(!this.touchDecided&&"none"!==s){this.touchDecided=!0;const r=Math.abs(e),o=Math.abs(t);if(this.changeSource===mn.USER_INTERACTION&&("pan-y"===s&&o>r||"pan-x"===s&&r>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?mn.AUTOMATIC:mn.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=mn.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===mn.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 s=this.pointers.length,r=(e.clientX-t.clientX)/s,o=(e.clientY-t.clientY)/s;0===r&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?mn.AUTOMATIC:mn.USER_INTERACTION,null!==this.touchMode&&this.touchMode(r,o)):(this.changeSource=mn.USER_INTERACTION,this.panPerPixel>0?this.movePan(r,o):this.handleSinglePointerMove(r,o)))},this.onPointerUp=e=>{const{element:t}=this,s=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==s&&this.pointers.splice(s,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[_s].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=mn.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*pn*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=mn.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({},dn),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 o.$V){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,s=this.goalSpherical.radius){const{minimumAzimuthalAngle:r,maximumAzimuthalAngle:o,minimumPolarAngle:A,maximumPolarAngle:l,minimumRadius:h,maximumRadius:c}=this._options,{theta:d,phi:g,radius:p}=this.goalSpherical,m=clamp(e,r,o);isFinite(r)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-m)+m);const f=clamp(t,A,l),I=clamp(s,h,c);return(m!==d||f!==g||I!==p)&&(!!(isFinite(m)&&isFinite(f)&&isFinite(I))&&(this.goalSpherical.theta=m,this.goalSpherical.phi=f,this.goalSpherical.radius=I,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:s}=this._options;e=clamp(e,t,s),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,s){const{theta:r,phi:o,radius:A}=this.goalSpherical,{minimumRadius:l,maximumRadius:h,minimumFieldOfView:c,maximumFieldOfView:d}=this._options,g=this.spherical.theta-r,p=Math.PI-.001,m=r-clamp(e,-p-g,p-g),f=o-t,I=0===s?0:((s>0?h:l)-A)/(Math.log(s>0?d:c)-this.goalLogFov),E=A+s*(isFinite(I)?I:2*(h-l));if(this.setOrbit(m,f,E),0!==s){const e=this.goalLogFov+s;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:s,maximumRadius:r}=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,s),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,r),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 o.USm(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,s){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,s*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:s,clientY:r}=e,{clientX:o,clientY:A}=t,l=o-s,h=A-r;return Math.sqrt(l*l+h*h)}handleSinglePointerMove(e,t){const s=this.pixelLengthToSphericalAngle(e),r=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(s,r,0)}initializePan(){const{theta:e,phi:t}=this.spherical,s=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(s),-Math.cos(t)*Math.sin(s),0,0,Math.sin(t),0,Math.sin(s),-Math.cos(t)*Math.cos(s),0)}movePan(e,t){const{scene:s}=this,r=un.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;r.multiplyScalar(o);const A=s.getTarget();A.add(r.applyMatrix3(this.panProjection)),s.boundingSphere.clampPoint(A,A),s.setTarget(A.x,A.y,A.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,s=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==s){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(s.position),t.setTarget(s.position.x,s.position.y,s.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(cn.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const s=e.getTarget(),{theta:r,phi:o}=this.spherical,A=r-e.yaw,l=un.set(Math.sin(o)*Math.sin(A),Math.cos(o),Math.sin(o)*Math.cos(A)),h=l.dot(t.position.sub(s));s.add(l.multiplyScalar(h)),e.setTarget(s.x,s.y,s.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[_s].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[_s].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,pn*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-gn,0);break;case"ArrowDown":this.userAdjustOrbit(0,gn,0);break;case"ArrowLeft":this.userAdjustOrbit(-gn,0,0);break;case"ArrowRight":this.userAdjustOrbit(gn,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 fn=s(25108);const In=1/1.3,En="not-presenting",Cn="session-started",Bn="object-placed",yn="failed",wn="tracking",vn="not-tracking",Qn=new o.Pa4,xn=new o.yGw,bn=new o.Pa4,Sn=new o.cPb(45,1,.1,100);class ARRenderer extends o.pBf{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 o.Pa4,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new o.Pa4,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new o.Pa4,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 s=this.frame.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=this.placementBox;if(1===s.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,s=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=s?(this.isTranslating=!0,this.lastDragPosition.copy(s)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===s.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/r.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 fn.warn("Request to present in WebXR denied:"),fn.warn(e),fn.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&fn.warn("Cannot present while a model is already presenting");let s=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await s,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 r=await this.resolveARSession();r.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 A=await r.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 l=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(l),z:-Math.cos(l)});r.requestHitTestSource({space:A,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=r,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Cn})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){fn.warn("Error while trying to end WebXR AR session"),fn.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 s=this.turntableRotation;null!=s&&(t.yaw=s);const r=this.oldShadowIntensity;null!=r&&t.setShadowIntensity(r),t.setEnvironmentAndSkybox(e[ve],e[Qe]);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[Ro](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:mn.NONE}}))}))}this.renderer.height=0;const s=this.exitWebXRButtonContainer;null!=s&&(s.classList.remove("enabled"),s.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const r=this.transientHitTestSource;null!=r&&(r.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:En})}updateView(e){const t=this.presentedScene,s=this.threeRenderer.xr;s.updateCamera(Sn),t.xrCamera=s.getCamera();const{elements:r}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(r[1],r[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=s.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):s.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:s}=e,r=e.getCamera(),{width:o,height:A}=this.overlay.getBoundingClientRect();e.setSize(o,A),r.projectionMatrixInverse.copy(r.projectionMatrix).invert();const{theta:l,radius:h}=s.getCameraOrbit(),c=r.getWorldDirection(Qn);e.yaw=Math.atan2(-c.x,-c.z)-l,this.goalYaw=e.yaw,t.copy(r.position).add(c.multiplyScalar(h)),this.updateTarget();const d=e.getTarget();t.add(d).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:g}=this.frame;g.addEventListener("selectstart",this.onSelectStart),g.addEventListener("selectend",this.onSelectEnd),g.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&&(Qn.copy(t).sub(this.presentedScene.getCamera().position),Qn.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),s=e.getPose(t);if(null==s)return null;const r=xn.fromArray(s.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(r.elements[4],r.elements[6])),r.elements[5]>.75!==this.placeOnWall?bn.setFromMatrixPosition(r):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const s=e.getHitTestResults(t);if(0==s.length)return;const r=s[0],o=this.getHitPoint(r);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:Bn}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,s=e[1].inputSource.gamepad.axes,r=s[0]-t[0],o=s[1]-t[1],A=Math.atan2(o,r);let l=this.lastAngle-A;return l>Math.PI?l-=2*Math.PI:l<-Math.PI&&(l+=2*Math.PI),this.lastAngle=A,{separation:Math.sqrt(r*r+o*o),deltaYaw:l}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const s=e.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=r.scale.x;if(this.isTwoFingering)if(s.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(s);if(!1===this.placeOnWall&&(this.goalYaw+=t),r.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>In?1:t}}else if(2!==s.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&s.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 s=Qn.copy(r.getCamera().position),A=-e/(s.y-t.y);s.multiplyScalar(A),t.multiplyScalar(1-A).add(s)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:s,yaw:r}=t,o=t.boundingSphere.radius,A=this.goalPosition,l=t.scale.x,h=this.placementBox;let c=mn.NONE;if(!A.equals(s)||this.goalScale!==l){c=mn.USER_INTERACTION;let{x:r,y:d,z:g}=s;r=this.xDamper.update(r,A.x,e,o),d=this.yDamper.update(d,A.y,e,o),g=this.zDamper.update(g,A.z,e,o),s.set(r,d,g);const p=this.scaleDamper.update(l,this.goalScale,e,1);if(t.scale.set(p,p,p),!this.isTranslating){const e=A.y-d;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/p,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(r,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:c}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const s=this.threeRenderer.xr.getReferenceSpace(),r=t.getViewerPose(s);null==r&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:vn}));const o=this.presentedScene;if(null==r||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:wn}));let A=!0;for(const s of r.views){if(this.updateView(s),A){this.moveToFloor(t),this.processInput(t);const s=e-this.lastTick;this.moveScene(s),this.renderer.preRender(o,e,s),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),A=!1}}}function clone(e){const t=new Map,s=new Map,r=e.clone();return parallelTraverse(e,r,(function(e,r){t.set(r,e),s.set(e,r)})),r.traverse((function(e){if(!e.isSkinnedMesh)return;const r=e,o=t.get(e),A=o.skeleton.bones;r.skeleton=o.skeleton.clone(),r.bindMatrix.copy(o.bindMatrix),r.skeleton.bones=A.map((function(e){return s.get(e)})),r.bind(r.skeleton,r.bindMatrix)})),r}function parallelTraverse(e,t,s){s(e,t);for(let r=0;r<e.children.length;r++)parallelTraverse(e.children[r],t.children[r],s)}const Mn=Symbol("prepared"),Tn=Symbol("prepare"),Rn=Symbol("preparedGLTF"),Dn=Symbol("clone");class GLTFInstance{constructor(e){this[Rn]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[Mn])return e;const t=this[Tn](e);return t[Mn]=!0,t}static[Tn](e){const{scene:t}=e,s=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:s})}get parser(){return this[Rn].parser}get animations(){return this[Rn].animations}get scene(){return this[Rn].scene}get scenes(){return this[Rn].scenes}get cameras(){return this[Rn].cameras}get asset(){return this[Rn].asset}get userData(){return this[Rn].userData}clone(){return new(0,this.constructor)(this[Dn]())}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 s=e[t];if(s instanceof o.xEZ){const e=s.source.data;null!=e.close&&e.close(),s.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[Dn](){const e=this[Rn],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const s=[t],r=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:s,userData:r})}}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,s)=>{s(e,t);for(let r=0;r<e.children.length;r++)traversePair(e.children[r],t.children[r],s)},Ln=Symbol("threeGLTF"),Fn=Symbol("gltf"),kn=Symbol("gltfElementMap"),_n=Symbol("threeObjectMap"),Un=Symbol("parallelTraverseThreeScene"),Gn=Symbol("correlateOriginalThreeGLTF"),Nn=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,s,r){this[Ln]=e,this[Fn]=t,this[kn]=r,this[_n]=s}static from(e,t){return null!=t?this[Nn](e,t):this[Gn](e)}static[Gn](e){const t=e.parser.json,s=e.parser.associations,r=new Map,A={name:"Default"},l={type:"materials",index:-1};for(const e of s.keys())e instanceof o.F5T&&null==s.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(A)),e.name=A.name,s.set(e,{materials:l.index}));for(const[e,o]of s){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const s in o)if(null!=s&&"primitives"!==s){const A=s,l=(t[A]||[])[o[A]];if(null==l)continue;let h=r.get(l);null==h&&(h=new Set,r.set(l,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,s,r)}static[Nn](e,t){const s=t.threeGLTF,r=t.gltf,o=JSON.parse(JSON.stringify(r)),A=new Map,l=new Map;for(let r=0;r<s.scenes.length;r++)this[Un](s.scenes[r],e.scenes[r],((e,s)=>{const r=t.threeObjectMap.get(e);if(null!=r)for(const e in r)if(null!=e&&"primitives"!==e){const t=e,h=r[t],c=o[t][h],d=A.get(s)||{};d[t]=h,A.set(s,d);const g=l.get(c)||new Set;g.add(s),l.set(c,g)}}));return new CorrelatedSceneGraph(e,o,A,l)}static[Un](e,t,s){const traverse=(e,t)=>{if(s(e,t),e.isObject3D){const r=e,o=t;if(r.material)if(Array.isArray(r.material))for(let e=0;e<r.material.length;++e)s(r.material[e],o.material[e]);else s(r.material,o.material);for(let s=0;s<e.children.length;++s)traverse(e.children[s],t.children[s])}};traverse(e,t)}get threeGLTF(){return this[Ln]}get gltf(){return this[Fn]}get gltfElementMap(){return this[kn]}get threeObjectMap(){return this[_n]}}const Pn=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[Tn](e){const t=super[Tn](e);null==t[Pn]&&(t[Pn]=CorrelatedSceneGraph.from(t));const{scene:s}=t,r=new o.aLr(void 0,1/0);return s.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const s=e;if(s.material){const{geometry:e}=s;s.castShadow=!0,s.isSkinnedMesh&&(e.boundingSphere=r,e.boundingBox=null);const A=s.material;if(!0===A.isMeshBasicMaterial&&(A.toneMapped=!1),A.shadowSide=o.Wl3,A.aoMap){const{gltf:s,threeObjectMap:r}=t[Pn],o=r.get(A);if(null!=s.materials&&null!=o&&null!=o.materials){const t=s.materials[o.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[Rn][Pn]}[Dn](){const e=super[Dn](),t=new Map;return e.scene.traverse((e=>{const s=e;if(s.material){const e=s.material;if(null!=e){if(t.has(e.uuid))return void(s.material=t.get(e.uuid));s.material=e.clone(),t.set(e.uuid,s.material)}}const r=e;void 0!==r.target&&r.add(r.target)})),e[Pn]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var On=s(25108);const getBufferForType=(e,t,s)=>{let r;switch(e){case o.ywz:r=new Uint8ClampedArray(t*s*4);break;case o.cLu:r=new Uint16Array(t*s*4);break;case o.JQ4:r=new Uint32Array(t*s*4);break;case o.T95:r=new Int8Array(t*s*4);break;case o.iAb:r=new Int16Array(t*s*4);break;case o.Kz5:r=new Int32Array(t*s*4);break;case o.VzW:r=new Float32Array(t*s*4);break;default:throw new Error("Unsupported data type")}return r};let Hn;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B;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 y={format:o.wk1,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===(s=e.renderTargetOptions)||void 0===s?void 0:s.anisotropy:1,generateMipmaps:void 0!==(null===(r=e.renderTargetOptions)||void 0===r?void 0:r.generateMipmaps)&&(null===(A=e.renderTargetOptions)||void 0===A?void 0:A.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(h=e.renderTargetOptions)||void 0===h?void 0:h.magFilter:o.wem,minFilter:void 0!==(null===(c=e.renderTargetOptions)||void 0===c?void 0:c.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:o.wem,samples:void 0!==(null===(g=e.renderTargetOptions)||void 0===g?void 0:g.samples)?null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapS:o.uWy,wrapT:void 0!==(null===(I=e.renderTargetOptions)||void 0===I?void 0:I.wrapT)?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.wrapT:o.uWy};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new o.xsS,this._camera=new o.iKG,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,s,r)=>{if(void 0!==Hn)return Hn;const A=new o.dd2(1,1,r);t.setRenderTarget(A);const l=new o.Kj0(new o._12,new o.vBJ({color:16777215}));t.render(l,s),t.setRenderTarget(null);const h=getBufferForType(e,A.width,A.height);return t.readRenderTargetPixels(A,0,0,A.width,A.height,h),A.dispose(),l.geometry.dispose(),l.material.dispose(),Hn=0!==h[0],Hn})(this._type,this._renderer,this._camera,y)){let e;if(this._type===o.cLu)e=this._renderer.extensions.has("EXT_color_buffer_float")?o.VzW:void 0;void 0!==e?(On.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${o.VzW}`),this._type=e):(this._supportsReadPixels=!1,On.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new o.Kj0(new o._12,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new o.dd2(this.width,this.height,y),this._renderTarget.texture.mapping=void 0!==(null===(C=e.renderTargetOptions)||void 0===C?void 0:C.mapping)?null===(B=e.renderTargetOptions)||void 0===B?void 0:B.mapping:o.xfE}static instantiateRenderer(){const e=new o.CP7;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 o.IEO(this.toArray(),this.width,this.height,o.wk1,this._type,(null==e?void 0:e.mapping)||o.xfE,(null==e?void 0:e.wrapS)||o.uWy,(null==e?void 0:e.wrapT)||o.uWy,(null==e?void 0:e.magFilter)||o.wem,(null==e?void 0:e.minFilter)||o.wem,(null==e?void 0:e.anisotropy)||1,o.GUF);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 o.jyz&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof o.xEZ&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof o.xEZ&&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 Vn=s(25108);class GainMapDecoderMaterial extends o.jyz{constructor({gamma:e,offsetHdr:t,offsetSdr:s,gainMapMin:r,gainMapMax:A,maxDisplayBoost:l,hdrCapacityMin:h,hdrCapacityMax:c,sdr:d,gainMap:g}){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:g},gamma:{value:new o.Pa4(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new o.Pa4).fromArray(t)},offsetSdr:{value:(new o.Pa4).fromArray(s)},gainMapMin:{value:(new o.Pa4).fromArray(r)},gainMapMax:{value:(new o.Pa4).fromArray(A)},weightFactor:{value:(Math.log2(l)-h)/(c-h)}},blending:o.jFi,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=h,this._hdrCapacityMax=c,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,s)=>{var r;let o;const A=null===(r=e.attributes.getNamedItem(t))||void 0===r?void 0:r.nodeValue;if(A)o=A;else{const r=e.getElementsByTagName(t)[0];if(!r){if(s)return s;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=r.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,s)=>{const r=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void s(new Error("Not a valid jpeg"));const A=o.byteLength;let l,h=2,c=0;for(;h<A;){if(++c>250)return void s(new Error(`Found no marker after ${c} loops 😵`));if(255!==o.getUint8(h))return void s(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(l=o.getUint8(h+1),r&&Vn.log(`Marker: ${l.toString(16)}`),226===l){r&&Vn.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const r=e+4;let A;if(18761===o.getUint16(r))A=!1;else{if(19789!==o.getUint16(r))return void s(new Error("No valid endianness marker found in TIFF header"));A=!0}if(42!==o.getUint16(r+2,!A))return void s(new Error("Not valid TIFF data! (no 0x002A marker)"));const l=o.getUint32(r+4,!A);if(l<8)return void s(new Error("Not valid TIFF data! (First offset less than 8)"));const h=r+l,c=o.getUint16(h,!A),d=h+2;let g=0;for(let e=d;e<d+12*c;e+=12)45057===o.getUint16(e,!A)&&(g=o.getUint32(e+8,!A));const p=h+2+12*c+4,m=[];for(let e=p;e<p+16*g;e+=16){const t={MPType:o.getUint32(e,!A),size:o.getUint32(e+4,!A),dataOffset:o.getUint32(e+8,!A),dependantImages:o.getUint32(e+12,!A),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=r+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,m.push(t)}if(this.options.extractNonFII&&m.length){const e=new Blob([o]),s=[];for(const t of m){if(t.isFII&&!this.options.extractFII)continue;const r=e.slice(t.start,t.end+1,"image/jpeg");s.push(r)}t(s)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,s;let r;r="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=r.indexOf("<x:xmpmeta");const A=new DOMParser;for(;-1!==o;){const e=r.indexOf("x:xmpmeta>",o);r.slice(o,e+10);const l=r.slice(o,e+10);try{const e=A.parseFromString(l,"text/xml").getElementsByTagName("rdf:Description")[0],r=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),c=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),d=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let g=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;g||(g="0");const p=null===(s=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===s?void 0:s.nodeValue;if(!p)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(r)?r.map((e=>parseFloat(e))):[parseFloat(r),parseFloat(r),parseFloat(r)],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(c)?c.map((e=>parseFloat(e))):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetHdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],hdrCapacityMin:parseFloat(g),hdrCapacityMax:parseFloat(p)}}catch(e){}o=r.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const s=new MPFExtractor({extractFII:!0,extractNonFII:!0}),r=await s.extract(e);if(2!==r.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await r[0].arrayBuffer()),gainMap:new Uint8Array(await r[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,s)=>{const r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=e=>{s(e)},r.src=URL.createObjectURL(e)}));class LoaderBase extends o.aNw{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new o.lLk}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 o.xEZ,sdr:new o.xEZ});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:o.cLu,colorSpace:o.GUF,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,s,r){const A=r?new Blob([r],{type:"image/jpeg"}):void 0,l=new Blob([s],{type:"image/jpeg"});let h,c,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([A?getHTMLImageFromBlob(A):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);c=e[0],h=e[1],d=!0}else{const e=await Promise.all([A?createImageBitmap(A,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);c=e[0],h=e[1]}const g=new o.xEZ(c||new ImageData(2,2),o.xfE,o.uWy,o.uWy,o.wem,o.FDw,o.wk1,o.ywz,1,o.GUF);g.flipY=d,g.needsUpdate=!0;const p=new o.xEZ(h,o.xfE,o.uWy,o.uWy,o.wem,o.FDw,o.wk1,o.ywz,1,o.KI_);p.flipY=d,p.needsUpdate=!0,e.width=h.width,e.height=h.height,e.material.gainMap=g,e.material.sdr=p,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,s,r){const A=this.prepareQuadRenderer(),l=new o.hH6(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 s=>{if("string"==typeof s)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const o=new Uint8Array(s);let l,h,c;try{const e=await extractGainmapFromJPEG(o);l=e.sdr,h=e.gainMap,c=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Vn.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),c={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},l=o}try{await this.render(A,c,l,h)}catch(t){return this.manager.itemError(e),"function"==typeof r&&r(t),void A.disposeOnDemandRenderer()}"function"==typeof t&&t(A),this.manager.itemEnd(e),A.disposeOnDemandRenderer()}),s,(t=>{this.manager.itemError(e),"function"==typeof r&&r(t)})),A}}class RGBELoader extends o.yxD{constructor(e){super(e),this.type=o.cLu}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,s){t=t||1024;let r=e.pos,o=-1,A=0,l="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(o=h.indexOf("\n"))&&A<t&&r<e.byteLength;)l+=h,A+=h.length,r+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<o&&(!1!==s&&(e.pos+=A+o+1),l+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,s,r){const o=e[t+3],A=Math.pow(2,o-128)/255;s[r+0]=e[t+0]*A,s[r+1]=e[t+1]*A,s[r+2]=e[t+2]*A,s[r+3]=1},RGBEByteToRGBHalf=function(e,t,s,r){const A=e[t+3],l=Math.pow(2,A-128)/255;s[r+0]=o.A5E.toHalfFloat(Math.min(e[t+0]*l,65504)),s[r+1]=o.A5E.toHalfFloat(Math.min(e[t+1]*l,65504)),s[r+2]=o.A5E.toHalfFloat(Math.min(e[t+2]*l,65504)),s[r+3]=o.A5E.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const s=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,A={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,h;for((e.pos>=e.byteLength||!(l=fgets(e)))&&rgbe_error(1,"no header found"),(h=l.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),A.valid|=1,A.programtype=h[1],A.string+=l+"\n";l=fgets(e),!1!==l;)if(A.string+=l+"\n","#"!==l.charAt(0)){if((h=l.match(t))&&(A.gamma=parseFloat(h[1])),(h=l.match(s))&&(A.exposure=parseFloat(h[1])),(h=l.match(r))&&(A.valid|=2,A.format=h[1]),(h=l.match(o))&&(A.valid|=4,A.height=parseInt(h[1],10),A.width=parseInt(h[2],10)),2&A.valid&&4&A.valid)break}else A.comments+=l+"\n";return 2&A.valid||rgbe_error(3,"missing format specifier"),4&A.valid||rgbe_error(3,"missing image size specifier"),A}(t),r=s.width,A=s.height,l=function(e,t,s){const r=t;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*s);o.length||rgbe_error(4,"unable to allocate buffer space");let A=0,l=0;const h=4*r,c=new Uint8Array(4),d=new Uint8Array(h);let g=s;for(;g>0&&l<e.byteLength;){l+4>e.byteLength&&rgbe_error(1),c[0]=e[l++],c[1]=e[l++],c[2]=e[l++],c[3]=e[l++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||rgbe_error(3,"bad rgbe scanline format");let t,s=0;for(;s<h&&l<e.byteLength;){t=e[l++];const r=t>128;if(r&&(t-=128),(0===t||s+t>h)&&rgbe_error(3,"bad scanline data"),r){const r=e[l++];for(let e=0;e<t;e++)d[s++]=r}else d.set(e.subarray(l,l+t),s),s+=t,l+=t}const p=r;for(let e=0;e<p;e++){let t=0;o[A]=d[e+t],t+=r,o[A+1]=d[e+t],t+=r,o[A+2]=d[e+t],t+=r,o[A+3]=d[e+t],A+=4}g--}return o}(t.subarray(t.pos),r,A);let h,c,d;switch(this.type){case o.VzW:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);h=e,c=o.VzW;break;case o.cLu:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);h=t,c=o.cLu;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:r,height:A,data:h,header:s.string,gamma:s.gamma,exposure:s.exposure,type:c}}setDataType(e){return this.type=e,this}load(e,t,s,r){return super.load(e,(function onLoadCallback(e,s){switch(e.type){case o.VzW:case o.cLu:e.colorSpace=o.GUF,e.minFilter=o.wem,e.magFilter=o.wem,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,s)}),s,r)}}const qn={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]}]},Kn={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 o.xsS{constructor(e){super(),this.position.y=-3.5;const t=new o.DvJ;t.deleteAttribute("uv");const s=new o.Wid({metalness:0,side:o._Li}),r=new o.Wid({metalness:0}),A="legacy"==e?qn:Kn,l=new o.cek(16777215,A.topLight.intensity,28,2);l.position.set(...A.topLight.position),this.add(l);const h=new o.Kj0(t,s);h.position.set(...A.room.position),h.scale.set(...A.room.scale),this.add(h);for(const e of A.boxes){const s=new o.Kj0(t,r);s.position.set(...e.position),s.rotation.set(0,e.rotation,0),s.scale.set(...e.scale),this.add(s)}for(const e of A.lights){const s=new o.Kj0(t,this.createAreaLightMaterial(e.intensity));s.position.set(...e.position),s.scale.set(...e.scale),this.add(s)}}createAreaLightMaterial(e){const t=new o.vBJ;return t.color.setScalar(e),t}}var Jn=s(25108);const zn=20,Yn=/\.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 o.dpR),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(o.cLu)),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,s)=>this.ldrLoader.load(e,t,(()=>{}),s)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const s=await this.getLottieLoader();s.setQuality(t);const r=await new Promise(((t,r)=>s.load(e,t,(()=>{}),r)));return r.name=e,r}async loadEquirect(e,t=()=>{}){try{const s=Yn.test(e),r=s?this.hdrLoader:this.imageLoader,A=await new Promise(((s,o)=>r.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:r}=t;e.dispose(!1),s(r)}else s(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),A.name=e,A.mapping=o.dSO,s||(A.colorSpace=o.KI_),A}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,s=()=>{}){const r="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,A=Promise.resolve(null);e&&(A=this.loadEquirectFromUrl(e,s)),o=t?this.loadEquirectFromUrl(t,s):e?this.loadEquirectFromUrl(e,s):r?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[l,h]=await Promise.all([o,A]);if(null==l)throw new Error("Failed to load environment map.");return{environmentMap:l,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const s=this.loadEquirect(e,t);this.skyboxCache.set(e,s)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const s=this.threeRenderer,r=new o.oAp(256,{generateMipmaps:!1,type:o.cLu,format:o.wk1,colorSpace:o.GUF,depthBuffer:!0}),A=new o._am(.1,100,r),l=A.renderTarget.texture;l.name=t;const h=s.outputColorSpace,c=s.toneMapping;return s.toneMapping=o.uL9,s.outputColorSpace=o.GUF,A.update(s,e),this.blurCubemap(r,.04),s.toneMapping=c,s.outputColorSpace=h,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(zn);const e=new o.DvJ,t=new o.Kj0(e,this.blurMaterial);this.blurScene=new o.xsS,this.blurScene.add(t)}const s=e.clone();this.halfblur(e,s,t,"latitudinal"),this.halfblur(s,e,t,"longitudinal")}halfblur(e,t,s,r){const A=e.width,l=isFinite(s)?Math.PI/(2*A):2*Math.PI/39,h=s/l,c=isFinite(s)?1+Math.floor(3*h):zn;c>zn&&Jn.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${c} samples when the maximum is set to 20`);const d=[];let g=0;for(let e=0;e<zn;++e){const t=e/h,s=Math.exp(-t*t/2);d.push(s),0==e?g+=s:e<c&&(g+=2*s)}for(let e=0;e<d.length;e++)d[e]=d[e]/g;const p=this.blurMaterial.uniforms;p.envMap.value=e.texture,p.samples.value=c,p.weights.value=d,p.latitudinal.value="latitudinal"===r,p.dTheta.value=l;new o._am(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),s=new o.Pa4(0,1,0);return new o.jyz({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:s}},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:o.jFi,depthTest:!1,depthWrite:!1,side:o._Li})}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 jn=s(25108);const $n=[1,.79,.62,.5,.4,.31,.25],Wn="high-performance";class Renderer extends o.pBf{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[xe]()},this.dpr=ye(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new o.CP7({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=o.LY2}catch(e){jn.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||Wn,debug:we()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||Wn,debug:we()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return $n[this.scaleStep]}set minScale(e){let t=1;for(;t<$n.length&&!($n[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new o.FM8;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[xo]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,s=null;for(const r of this.scenes){const{element:o}=r;o.modelIsVisible&&null==r.externalRenderer&&++t,e.parentElement===r.canvas.parentElement&&(s=r)}const r=t>1;if(null!=s){const t=r&&!this.multipleScenesVisible,o=!s.element.modelIsVisible;if(t||o){const{width:t,height:r}=this.sceneSize(s);this.copyPixels(s,t,r),e.parentElement.removeChild(e)}}this.multipleScenesVisible=r}updateRendererSize(){var e;const t=ye();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[uo](t.getBoundingClientRect())}let s=0,r=0;for(const e of this.scenes)s=Math.max(s,e.width),r=Math.max(r,e.height);if(s!==this.width||r!==this.height||t!==this.dpr){this.width=s,this.height=r,this.dpr=t,s=Math.ceil(s*t),r=Math.ceil(r*t),this.canRender&&this.threeRenderer.setSize(s,r,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=s,o.height=r,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(s,r)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=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=$n[e.scaleStep],s=Math.ceil(this.width/t),r=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${s}px`,o.height=`${r}px`,this.canvas3D.style.width=`${s}px`,this.canvas3D.style.height=`${r}px`;const A=this.dpr*t,l=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:A,minimumDpr:this.dpr*$n[this.lastStep],pixelWidth:Math.ceil(e.width*A),pixelHeight:Math.ceil(e.height*A),reason:l}}))}sceneSize(e){const{dpr:t}=this,s=$n[e.scaleStep];return{width:Math.min(Math.ceil(e.width*s*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*s*t),this.canvas3D.height)}}copyPixels(e,t,s){const r=e.context;null!=r?(r.clearRect(0,0,t,s),r.drawImage(this.canvas3D,0,0,t,s,0,0,t,s),e.canvas.classList.add("show")):jn.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const s of this.scenes)s.element.modelIsVisible===t&&e.push(s);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,s){const{element:r,exposure:A,toneMapping:l}=e;r[Mo](t,s);const h="number"==typeof A&&!Number.isNaN(A),c=r.environmentImage,d=r.skyboxImage,g=l===o.ORg&&("neutral"===c||"legacy"===c||!c&&!d);this.threeRenderer.toneMappingExposure=(h?A:1)*(g?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const s=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(s),this.renderedLastFrame=!1);const{canvas3D:r}=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,s),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:s,projectionMatrix:r}=e,o=s.elements.slice(),A=t.getTarget();o[12]+=A.x,o[13]+=A.y,o[14]+=A.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:r.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:A,height:l}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-l,A,l),null!=t.effectRenderer?t.effectRenderer.render(s):(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,A,l):r.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(r),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 Xn=Symbol("correlatedObjects"),Zn=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[Zn]=e,this[Xn]=t}}const er=new o.vBJ,tr=new o._12(2,2);let ir=0;const sr=Symbol("threeTexture"),nr=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[sr](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get[nr](){return this[Xn]}constructor(e,t){super(e,new Set(t?[t]:[])),this[sr].image.src||(this[sr].image.src=t.name?t.name:"adhoc_image"+ir++),this[sr].image.name||(this[sr].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[sr].image.name||""}get uri(){return this[sr].image.src}get bufferView(){return this[sr].image.bufferView}get element(){const e=this[sr];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[sr];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[nr])t.image.name=e}update(){const e=this[sr];e&&e.isCanvasTexture&&!e.animation&&(this[sr].needsUpdate=!0,this[Zn]())}async createThumbnail(e,t){const s=new o.xsS;er.map=this[sr];const r=new o.Kj0(tr,er);s.add(r);const A=new o.iKG(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,h=new o.dd2(e,t);l.setRenderTarget(h),l.render(s,A),l.setRenderTarget(null);const c=new Uint8Array(e*t*4);l.readRenderTargetPixels(h,0,0,e,t,c),io.width=e,io.height=t;const d=io.getContext("2d"),g=d.createImageData(e,t);return g.data.set(c),d.putImageData(g,0,0),new Promise((async(e,t)=>{io.toBlob((s=>{if(!s)return t("Failed to capture thumbnail.");e(URL.createObjectURL(s))}),"image/png")}))}}var rr,ar;!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"}(rr||(rr={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(ar||(ar={}));const or=new Map([[ar.Repeat,o.rpg],[ar.ClampToEdge,o.uWy],[ar.MirroredRepeat,o.OoA]]),Ar=new Map([[o.rpg,ar.Repeat],[o.uWy,ar.ClampToEdge],[o.OoA,ar.MirroredRepeat]]),lr=new Map([[rr.Nearest,o.TyD],[rr.Linear,o.wem],[rr.NearestMipmapNearest,o.YLQ],[rr.LinearMipmapNearest,o.qyh],[rr.NearestMipmapLinear,o.aH4],[rr.LinearMipmapLinear,o.D1R]]),hr=new Map([[o.TyD,rr.Nearest],[o.wem,rr.Linear],[o.YLQ,rr.NearestMipmapNearest],[o.qyh,rr.LinearMipmapNearest],[o.aH4,rr.NearestMipmapLinear],[o.D1R,rr.LinearMipmapLinear]]),cr=new Map([[rr.Nearest,o.TyD],[rr.Linear,o.wem]]),ur=new Map([[o.TyD,rr.Nearest],[o.wem,rr.Linear]]),isMinFilter=e=>hr.has(e),isMagFilter=e=>ur.has(e),isWrapping=e=>Ar.has(e),dr=Symbol("threeTexture"),gr=Symbol("threeTextures"),pr=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[dr](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get[gr](){return this[Xn]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[dr].name||""}get minFilter(){return hr.get(this[dr].minFilter)}get magFilter(){return ur.get(this[dr].magFilter)}get wrapS(){return Ar.get(this[dr].wrapS)}get wrapT(){return Ar.get(this[dr].wrapT)}get rotation(){return this[dr].rotation}get scale(){return toVector2D(this[dr].repeat)}get offset(){return toVector2D(this[dr].offset)}setMinFilter(e){this[pr]("minFilter",lr.get(e))}setMagFilter(e){this[pr]("magFilter",cr.get(e))}setWrapS(e){this[pr]("wrapS",or.get(e))}setWrapT(e){this[pr]("wrapT",or.get(e))}setRotation(e){null==e&&(e=0),this[pr]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[pr]("repeat",new o.FM8(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[pr]("offset",new o.FM8(e.u,e.v))}[pr](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 s of this[gr])s[e]=t,s.needsUpdate=!0;this[Zn]()}}const mr=Symbol("image"),fr=Symbol("sampler"),Ir=Symbol("threeTexture");class Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[fr]=new Sampler(e,t),this[mr]=new image_Image(e,t)}get[Ir](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get name(){return this[Ir].name||""}set name(e){for(const t of this[Xn])t.name=e}get sampler(){return this[fr]}get source(){return this[mr]}}var Er,Cr,Br;const yr=Symbol("texture"),wr=Symbol("transform"),vr=Symbol("materials"),Qr=Symbol("usage"),xr=Symbol("onUpdate"),br=Symbol("activeVideo");var Sr;!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"}(Sr||(Sr={}));class TextureInfo{constructor(e,t,s,r){this[Er]=null,this[Cr]={rotation:0,scale:new o.FM8(1,1),offset:new o.FM8(0,0)},this[Br]=!1,s&&(this[wr].rotation=s.rotation,this[wr].scale.copy(s.repeat),this[wr].offset.copy(s.offset),this[yr]=new Texture(e,s)),this[xr]=e,this[vr]=r,this[Qr]=t}get texture(){return this[yr]}setTexture(e){var t,s;const r=null!=e?e.source[sr]:null,A=null===(t=this[yr])||void 0===t?void 0:t.source[sr];if(null!=A&&A.isVideoTexture?this[br]=!1:(null===(s=this[yr])||void 0===s?void 0:s.source.animation)&&this[yr].source.animation.removeEventListener("enterFrame",this[xr]),this[yr]=e,null!=r&&r.isVideoTexture){const e=r.image;if(this[br]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[br]&&(this[xr](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[br]&&(this[xr](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[xr]);let l=o.KI_;if(this[vr])for(const e of this[vr]){switch(this[Qr]){case Sr.Base:e.map=r;break;case Sr.MetallicRoughness:l=o.GUF,e.metalnessMap=r,e.roughnessMap=r;break;case Sr.Normal:l=o.GUF,e.normalMap=r;break;case Sr.Occlusion:l=o.GUF,e.aoMap=r;break;case Sr.Emissive:e.emissiveMap=r;break;case Sr.Clearcoat:e.clearcoatMap=r;break;case Sr.ClearcoatRoughness:e.clearcoatRoughnessMap=r;break;case Sr.ClearcoatNormal:e.clearcoatNormalMap=r;break;case Sr.SheenColor:e.sheenColorMap=r;break;case Sr.SheenRoughness:e.sheenRoughnessMap=r;break;case Sr.Transmission:e.transmissionMap=r;break;case Sr.Thickness:e.thicknessMap=r;break;case Sr.Specular:e.specularIntensityMap=r;break;case Sr.SpecularColor:e.specularColorMap=r;break;case Sr.Iridescence:e.iridescenceMap=r;break;case Sr.IridescenceThickness:e.iridescenceThicknessMap=r;break;case Sr.Anisotropy:e.anisotropyMap=r}e.needsUpdate=!0}r&&(r.colorSpace=l,r.rotation=this[wr].rotation,r.repeat=this[wr].scale,r.offset=this[wr].offset),this[xr]()}}Er=yr,Cr=wr,Br=br;const Mr=Symbol("threeMaterial"),Tr=Symbol("threeMaterials"),Rr=Symbol("baseColorTexture"),Dr=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:s,metalnessMap:r}=t.values().next().value;this[Rr]=new TextureInfo(e,Sr.Base,s,t),this[Dr]=new TextureInfo(e,Sr.MetallicRoughness,r,t)}get[Tr](){return this[Xn]}get[Mr](){var e;return null===(e=this[Xn])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[Mr].opacity];return this[Mr].color.toArray(e),e}get metallicFactor(){return this[Mr].metalness}get roughnessFactor(){return this[Mr].roughness}get baseColorTexture(){return this[Rr]}get metallicRoughnessTexture(){return this[Dr]}setBaseColorFactor(e){const t=new o.Ilk;e instanceof Array?t.fromArray(e):t.set(e);for(const s of this[Tr])s.color.set(t),e instanceof Array&&e.length>3?s.opacity=e[3]:(e=[0,0,0,s.opacity],t.toArray(e));this[Zn]()}setMetallicFactor(e){for(const t of this[Tr])t.metalness=e;this[Zn]()}setRoughnessFactor(e){for(const t of this[Tr])t.roughness=e;this[Zn]()}}var Lr,Fr;const kr=Symbol("pbrMetallicRoughness"),_r=Symbol("normalTexture"),Ur=Symbol("occlusionTexture"),Gr=Symbol("emissiveTexture"),Nr=Symbol("backingThreeMaterial"),Pr=Symbol("applyAlphaCutoff"),Or=Symbol("getAlphaMode"),Hr=Symbol("lazyLoadGLTFInfo"),Vr=Symbol("initialize"),qr=Symbol("getLoadedMaterial"),Kr=Symbol("ensureMaterialIsLoaded"),Jr=Symbol("gltfIndex"),zr=Symbol("setActive"),Yr=Symbol("variantIndices"),jr=Symbol("isActive"),$r=Symbol("variantSet"),Wr=Symbol("modelVariants"),Xr=Symbol("name"),Zr=Symbol("pbrTextures");class Material extends ThreeDOMElement{constructor(e,t,s,r,o,A,l=void 0){super(e,o),this[Lr]=new Set,this[Fr]=new Map,this[Jr]=t,this[jr]=s,this[Wr]=r,this[Xr]=A,null==l?this[Vr]():this[Hr]=l}get[(Lr=$r,Fr=Zr,Nr)](){return this[Xn].values().next().value}[Vr](){const e=this[Zn],t=this[Xn];this[kr]=new PBRMetallicRoughness(e,t);const{normalMap:s,aoMap:r,emissiveMap:o}=t.values().next().value;this[_r]=new TextureInfo(e,Sr.Normal,s,t),this[Ur]=new TextureInfo(e,Sr.Occlusion,r,t),this[Gr]=new TextureInfo(e,Sr.Emissive,o,t);const createTextureInfo=s=>{this[Zr].set(s,new TextureInfo(e,s,null,t))};createTextureInfo(Sr.Clearcoat),createTextureInfo(Sr.ClearcoatRoughness),createTextureInfo(Sr.ClearcoatNormal),createTextureInfo(Sr.SheenColor),createTextureInfo(Sr.SheenRoughness),createTextureInfo(Sr.Transmission),createTextureInfo(Sr.Thickness),createTextureInfo(Sr.Specular),createTextureInfo(Sr.SpecularColor),createTextureInfo(Sr.Iridescence),createTextureInfo(Sr.IridescenceThickness),createTextureInfo(Sr.Anisotropy)}async[qr](){if(null!=this[Hr]){const{set:e,material:t}=await this[Hr].doLazyLoad();return this[Xn]=e,this[Vr](),this[Hr]=void 0,this.ensureLoaded=async()=>{},t}return this[Xn].values().next().value}colorFromRgb(e){const t=new o.Ilk;return e instanceof Array?t.fromArray(e):t.set(e),t}[Kr](){if(null!=this[Hr])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[qr]()}get isLoaded(){return null==this[Hr]}get isActive(){return this[jr]}[zr](e){this[jr]=e}get name(){return this[Xr]||""}set name(e){if(this[Xr]=e,null!=this[Xn])for(const t of this[Xn])t.name=e}get pbrMetallicRoughness(){return this[Kr](),this[kr]}get normalTexture(){return this[Kr](),this[_r]}get occlusionTexture(){return this[Kr](),this[Ur]}get emissiveTexture(){return this[Kr](),this[Gr]}get emissiveFactor(){return this[Kr](),this[Nr].emissive.toArray()}get index(){return this[Jr]}[Yr](){return this[$r]}hasVariant(e){const t=this[Wr].get(e);return null!=t&&this[$r].has(t.index)}setEmissiveFactor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.emissive.set(t);this[Zn]()}[Or](){return this[Nr].transparent?"BLEND":this[Nr].alphaTest>0?"MASK":"OPAQUE"}[Pr](){this[Kr]();for(const e of this[Xn])"MASK"===this[Or]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[Kr]();for(const t of this[Xn])t.alphaTest=e,t.needsUpdate=!0;this[Pr](),this[Zn]()}getAlphaCutoff(){return this[Kr](),this[Nr].alphaTest}setDoubleSided(e){this[Kr]();for(const t of this[Xn])t.side=e?o.ehD:o.Wl3,t.needsUpdate=!0;this[Zn]()}getDoubleSided(){return this[Kr](),this[Nr].side==o.ehD}setAlphaMode(e){this[Kr]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[Xn])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[Zn]()}getAlphaMode(){return this[Kr](),this[Or]()}get emissiveStrength(){return this[Kr](),this[Nr].emissiveIntensity}setEmissiveStrength(e){this[Kr]();for(const t of this[Xn])t.emissiveIntensity=e;this[Zn]()}get clearcoatFactor(){return this[Kr](),this[Nr].clearcoat}get clearcoatRoughnessFactor(){return this[Kr](),this[Nr].clearcoatRoughness}get clearcoatTexture(){return this[Kr](),this[Zr].get(Sr.Clearcoat)}get clearcoatRoughnessTexture(){return this[Kr](),this[Zr].get(Sr.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Kr](),this[Zr].get(Sr.ClearcoatNormal)}get clearcoatNormalScale(){return this[Kr](),this[Nr].clearcoatNormalScale.x}setClearcoatFactor(e){this[Kr]();for(const t of this[Xn])t.clearcoat=e;this[Zn]()}setClearcoatRoughnessFactor(e){this[Kr]();for(const t of this[Xn])t.clearcoatRoughness=e;this[Zn]()}setClearcoatNormalScale(e){this[Kr]();for(const t of this[Xn])t.clearcoatNormalScale=new o.FM8(e,e);this[Zn]()}get ior(){return this[Kr](),this[Nr].ior}setIor(e){this[Kr]();for(const t of this[Xn])t.ior=e;this[Zn]()}get sheenColorFactor(){return this[Kr](),this[Nr].sheenColor.toArray()}get sheenColorTexture(){return this[Kr](),this[Zr].get(Sr.SheenColor)}get sheenRoughnessFactor(){return this[Kr](),this[Nr].sheenRoughness}get sheenRoughnessTexture(){return this[Kr](),this[Zr].get(Sr.SheenRoughness)}setSheenColorFactor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.sheenColor.set(t),e.sheen=1;this[Zn]()}setSheenRoughnessFactor(e){this[Kr]();for(const t of this[Xn])t.sheenRoughness=e,t.sheen=1;this[Zn]()}get transmissionFactor(){return this[Kr](),this[Nr].transmission}get transmissionTexture(){return this[Kr](),this[Zr].get(Sr.Transmission)}setTransmissionFactor(e){this[Kr]();for(const t of this[Xn])t.transmission=e;this[Zn]()}get thicknessFactor(){return this[Kr](),this[Nr].thickness}get thicknessTexture(){return this[Kr](),this[Zr].get(Sr.Thickness)}get attenuationDistance(){return this[Kr](),this[Nr].attenuationDistance}get attenuationColor(){return this[Kr](),this[Nr].attenuationColor.toArray()}setThicknessFactor(e){this[Kr]();for(const t of this[Xn])t.thickness=e;this[Zn]()}setAttenuationDistance(e){this[Kr]();for(const t of this[Xn])t.attenuationDistance=e;this[Zn]()}setAttenuationColor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.attenuationColor.set(t);this[Zn]()}get specularFactor(){return this[Kr](),this[Nr].specularIntensity}get specularTexture(){return this[Kr](),this[Zr].get(Sr.Specular)}get specularColorFactor(){return this[Kr](),this[Nr].specularColor.toArray()}get specularColorTexture(){return this[Kr](),this[Zr].get(Sr.SheenColor)}setSpecularFactor(e){this[Kr]();for(const t of this[Xn])t.specularIntensity=e;this[Zn]()}setSpecularColorFactor(e){this[Kr]();const t=this.colorFromRgb(e);for(const e of this[Xn])e.specularColor.set(t);this[Zn]()}get iridescenceFactor(){return this[Kr](),this[Nr].iridescence}get iridescenceTexture(){return this[Kr](),this[Zr].get(Sr.Iridescence)}get iridescenceIor(){return this[Kr](),this[Nr].iridescenceIOR}get iridescenceThicknessMinimum(){return this[Kr](),this[Nr].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[Kr](),this[Nr].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[Kr](),this[Zr].get(Sr.IridescenceThickness)}setIridescenceFactor(e){this[Kr]();for(const t of this[Xn])t.iridescence=e;this[Zn]()}setIridescenceIor(e){this[Kr]();for(const t of this[Xn])t.iridescenceIOR=e;this[Zn]()}setIridescenceThicknessMinimum(e){this[Kr]();for(const t of this[Xn])t.iridescenceThicknessRange[0]=e;this[Zn]()}setIridescenceThicknessMaximum(e){this[Kr]();for(const t of this[Xn])t.iridescenceThicknessRange[1]=e;this[Zn]()}get anisotropyStrength(){return this[Kr](),this[Nr].anisotropy}get anisotropyRotation(){return this[Kr](),this[Nr].anisotropyRotation}get anisotropyTexture(){return this[Kr](),this[Zr].get(Sr.Anisotropy)}setAnisotropyStrength(e){this[Kr]();for(const t of this[Xn])t.anisotropy=e;this[Zn]()}setAnisotropyRotation(e){this[Kr]();for(const t of this[Xn])t.anisotropyRotation=e;this[Zn]()}}var ea=s(25108);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,s,r){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:A,threeObjectMap:l}=r;this.parser=A.parser,this.modelVariants=s,this.mesh.userData.variantData=s;const h=l.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:ea.error(`Primitive (${e.name}) missing initial material reference.`);const c=e.userData.associations||{};if(null==c.meshes)return void ea.error("Mesh is missing primitive index association");const d=((o.meshes||[])[c.meshes].primitives||[])[c.primitives];if(null!=d){if(null!=d.material)this.materials.set(d.material,t[d.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):ea.warn("gltfPrimitive has no material!")}if(d.extensions&&d.extensions.KHR_materials_variants){const e=d.extensions.KHR_materials_variants,r=A.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}=r[t];this.variantToMaterialMap.set(t,e),e[Yr]().add(t),s.has(o)||s.set(o,{name:o,index:t})}}}}else ea.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[qr]();const{normalScale:s}=this.mesh.material;null!=s&&s.y*s.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 s=await this.enableVariantHelper(e);null!=s&&(t.material=s)}}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 s=this.modelVariants.get(t).index;return e[Yr]().add(s),this.variantToMaterialMap.set(s,e),this.materials.set(e.index,e),this.updateVariantUserData(s,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[Yr]().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[Xn].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(ea.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var ta,ia,sa,na,ra,aa,oa=s(25108);const Aa=Symbol("materials"),la=Symbol("hierarchy"),ha=Symbol("roots"),ca=Symbol("primitives"),ua=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),da=Symbol("switchVariant"),ga=Symbol("materialFromPoint"),pa=Symbol("nodeFromPoint"),ma=Symbol("nodeFromIndex"),fa=Symbol("variantData"),Ia=Symbol("availableVariants"),Ea=Symbol("modelOnUpdate"),Ca=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,s,r){this.gltf=e,this.gltfElementMap=t,this.mapKey=s,this.doLazyLoad=r}}class Model{constructor(e,t=()=>{}){this[ta]=new Array,this[ia]=new Array,this[sa]=new Array,this[na]=new Array,this[ra]=()=>{},this[aa]=new Map,this[Ea]=t;const{gltf:s,threeGLTF:r,gltfElementMap:A}=e;for(const[e,o]of s.materials.entries()){const l=A.get(o);if(null!=l)this[Aa].push(new Material(t,e,!0,this[fa],l,o.name));else{const h=(s.materials||[])[e],c=e,materialLoadCallback=async()=>{const e=await r.parser.getDependency("material",c),t=new Set;return A.set(h,t),t.add(e),{set:t,material:e}};this[Aa].push(new Material(t,e,!1,this[fa],l,o.name,new LazyLoader(s,A,h,materialLoadCallback)))}}const l=new Map,h=new Array;for(const e of r.scene.children)h.push(e);for(;h.length>0;){const t=h.pop();let s=null;t instanceof o.Kj0?(s=new PrimitiveNode(t,this.materials,this[fa],e),this[ca].push(s)):s=new primitive_node_Node(t.name);const r=l.get(t);null!=r?r.children.push(s):this[ha].push(s),this[la].push(s);for(const e of t.children)h.push(e),l.set(t,s)}}get materials(){return this[Aa]}[(ta=Aa,ia=la,sa=ha,na=ca,ra=Ea,aa=fa,Ia)](){const e=Array.from(this[fa].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[Aa].filter((t=>t.name===e));return t.length>0?t[0]:null}[ma](e,t){const s=this[la].find((s=>{if(s instanceof PrimitiveNode){const{meshes:r,primitives:o}=s.mesh.userData.associations;if(r==e&&o==t)return!0}return!1}));return null==s?null:s}[pa](e){return this[la].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[ga](e){return this[pa](e).getActiveMaterial()}async[da](e){for(const t of this[ca])await t.enableVariant(e);for(const e of this.materials)e[zr](!1);for(const e of this[ca])this.materials[e.getActiveMaterial().index][zr](!0)}async[ua](){const e=new Array;for(const t of this[ca])e.push(t.instantiateVariants());await Promise.all(e)}[Ca](e,t){const s=this.materials[e];s.isLoaded||oa.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const r=s[Xn],o=new Set;for(const[e,s]of r.entries()){const A=s.clone();A.name=t+(r.size>1?"_inst"+e:""),o.add(A)}const A=new Material(this[Ea],this[Aa].length,!1,this[fa],o,t);return this[Aa].push(A),A}createMaterialInstanceForVariant(e,t,s,r=!0){let o=null;for(const r of this[ca]){const A=this[fa].get(s);null!=A&&r.variantInfo.has(A.index)||null!=r.getMaterial(e)&&(this.hasVariant(s)||this.createVariant(s),null==o&&(o=this[Ca](e,t)),r.addVariant(o,s))}if(r&&null!=o){o[zr](!0),this.materials[e][zr](!1);for(const e of this[ca])e.enableVariant(s)}return o}createVariant(e){this[fa].has(e)?oa.warn(`Variant '${e}'' already exists`):this[fa].set(e,{name:e,index:this[fa].size})}hasVariant(e){return this[fa].has(e)}setMaterialToVariant(e,t){if(null!=this[Ia]().find((e=>e===t)))if(e<0||e>=this.materials.length)oa.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const s of this[ca]){const r=s.getMaterial(e);null!=r&&s.addVariant(r,t)}else oa.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const s=this[fa].get(e);null!=s&&(s.name=t,this[fa].set(t,s),this[fa].delete(e))}deleteVariant(e){const t=this[fa].get(e);if(null!=t){for(const s of this.materials)s.hasVariant(e)&&s[$r].delete(t.index);for(const e of this[ca])e.deleteVariant(t.index);this[fa].delete(e)}}}var scene_graph_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Ba=Symbol("currentGLTF"),ya=Symbol("originalGltfJson"),wa=Symbol("model"),va=Symbol("getOnUpdateMethod"),Qa=Symbol("buildTexture");class GroundedSkybox extends o.Kj0{constructor(){super(void 0,new o.vBJ({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,s=128){e==this.height&&t==this.radius&&s==this.resolution||(this.height=e,this.radius=t,this.resolution=s,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,s){const r=new o.xo$(t,2*s,s);r.scale(1,1,-1);const A=r.getAttribute("position"),l=new o.Pa4;for(let t=0;t<A.count;++t)if(l.fromBufferAttribute(A,t),l.y<0){const s=3*-e/2,r=l.y<s?-e/l.y:1-l.y*l.y/(3*s*s);l.multiplyScalar(r),l.toArray(A.array,3*t)}return A.needsUpdate=!0,r}(e,t,s)))}}const xa=new o.Pa4,ba=new o.Pa4,Sa=new o.Pa4,Ma=new o.Vkp,Ta=new o.CJI,Ra=new o._fP;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new o.Pa4(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=_i(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,qi(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=_i(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:s,bary:r}=this;if(null==t||null==s||null==r)return;t.getVertexPosition(s.x,xa),t.getVertexPosition(s.y,ba),t.getVertexPosition(s.z,Sa),xa.toArray(Ma.elements,0),ba.toArray(Ma.elements,3),Sa.toArray(Ma.elements,6),this.position.copy(r).applyMatrix3(Ma);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),Ta.set(xa,ba,Sa),Ta.getNormal(this.normal).transformDirection(t.matrixWorld);const A=o.parent;Ra.setFromAxisAngle(xa.set(0,1,0),-A.yaw),this.normal.applyQuaternion(Ra)}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 s=t,r=s.dataset.visibilityAttribute;if(null!=r){const t=`data-${r}`;s.toggleAttribute(t,e)}s.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const Da={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}"},La={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}"};var Fa=s(64426);class Shadow extends o.Tme{constructor(e,t,s){super(),this.camera=new o.iKG,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new o.lRF,this.horizontalBlurMaterial=new o.jyz(Da),this.verticalBlurMaterial=new o.jyz(La),this.intensity=0,this.softness=1,this.boundingBox=new o.ZzF,this.size=new o.Pa4,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:r}=this;r.rotation.x=Math.PI/2,r.left=-.5,r.right=.5,r.bottom=-.5,r.top=.5,this.add(r);const A=new o._12,l=new o.vBJ({opacity:1,transparent:!0,side:o._Li});this.floor=new o.Kj0(A,l),this.floor.userData.noHit=!0,r.add(this.floor),this.blurPlane=new o.Kj0(A),this.blurPlane.visible=!1,r.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,s)}setScene(e,t,s){const{boundingBox:r,size:o,rotation:A,position:l}=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(l),"back"===s){const{min:e,max:t}=r;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],A.x=Math.PI/2,A.y=Math.PI}else A.x=0,A.y=0;if(this.isAnimated){const e=r.min.y,t=r.max.y;o.y=this.maxDimension,r.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),r.min.y=e,r.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===s?l.y=r.min.y:l.z=r.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:s}=this,r=this.isAnimated?2:1,o=r*Math.pow(2,9-3*e);this.setMapSize(o);const A=t.y/2,l=t.y*r;s.near=0,s.far=(0,Fa.t7)(l,A,e),this.depthMaterial.opacity=1/e,s.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const s=Math.floor(t.x>t.z?e:e*t.x/t.z),r=Math.floor(t.x>t.z?e*t.z/t.x:e),A=10+s,l=10+r;if(null==this.renderTarget||this.renderTarget.width===A&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:o.wk1};this.renderTarget=new o.dd2(A,l,e),this.renderTargetBlur=new o.dd2(A,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/s),t.z*(1+10/r),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*(0,Fa.t7)(.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 s=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const r=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=r,e.setRenderTarget(o),e.setClearAlpha(s)}blurShadow(e){const{camera:t,horizontalBlurMaterial:s,verticalBlurMaterial:r,renderTarget:o,renderTargetBlur:A,blurPlane:l}=this;l.visible=!0,l.material=s,s.uniforms.h.value=1/this.renderTarget.width,s.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(A),e.render(l,t),l.material=r,r.uniforms.v.value=1/this.renderTarget.height,r.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(l,t),l.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 ka=s(25108);const _a=new o.Pa4,Ua=new o.Pa4,Ga=new o.Pa4,Na=new o.iMs,Pa=new o.Pa4,Oa=new o.FM8;class ModelScene extends o.xsS{constructor({canvas:e,element:t,width:s,height:r}){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 o.cPb(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new o.Tme,this.animationNames=[],this.boundingBox=new o.ZzF,this.boundingSphere=new o.aLr,this.size=new o.Pa4,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=o.LY2,this.canScale=!0,this.isDirty=!1,this.goalTarget=new o.Pa4,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 o.cPb(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(s,r),this.target.name="Target",this.mixer=new o.Xcj(this.target);const{domElement:A}=this.annotationRenderer,{style:l}=A;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(A),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 s;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{s=await new Promise((async(s,r)=>{this.cancelPendingSourceChange=()=>r();try{s(await this.element[Do].loader.load(e,this.element,t))}catch(e){r(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=s,null!=s&&(this._model=s.scene,this.target.add(s.scene));const{animations:r}=s,o=new Map,A=[];for(const e of r)o.set(e.name,e),A.push(e.name);this.animations=r,this.animationsByName=o,this.animationNames=A,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[Ba]=null,this.element[ya]=null,this.element[wa]=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 s=ye();this.externalRenderer.resize(e*s,t*s)}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 o.ZzF;e.traverse((e=>{const s=e;if(!s.material)return;if(!s.material.transparent)return;t.setFromObject(s);const r=t.getSize(Pa),o=Math.min(r.x,r.y,r.z);Math.max(r.x,r.y,r.z)<100*o||this.markBakedShadow(s)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,s=new o.ZzF;this.boundingBox.getSize(this.size);for(const r of this.bakedShadows)s.setFromObject(r),s.min.y<e.y+this.size.y/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.z<=e.z&&s.max.z>=t.z||s.min.z<e.z+this.size.z/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.y<=e.y&&s.max.y>=t.y||this.unmarkBakedShadow(r)}applyTransform(){const{model:e}=this;if(null==e)return;const t=_i(this.element.orientation)[0].terms,s=qi(t[0]).number,r=qi(t[1]).number,A=qi(t[2]).number;e.quaternion.setFromEuler(new o.USm(r,A,s,"YXZ"));const l=_i(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 o.ZzF),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new o.ZzF)),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,s)=>Math.max(e,t.distanceToSquared(s))),0));this.idealAspect=reduceVertices(e,((e,s)=>{s.sub(t);const r=Math.sqrt(s.x*s.x+s.z*s.z);return Math.max(e,r/(this.idealCameraDistance()-Math.abs(s.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)Oa.set(e/window.screen.width,t/window.screen.height);else{const s=this.element.getBoundingClientRect();Oa.set((e-s.x)/this.width,(t-s.y)/this.height)}return Oa.multiplyScalar(2).subScalar(1),Oa.y*=-1,Oa}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[Do].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=_i(this.element.skyboxHeight)[0].terms[0],t=qi(e).number,s=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,s),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,s){this.goalTarget.set(-e,-t,-s)}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,s=this.target.position;if(t.equals(s))return!1;{const r=this.boundingSphere.radius/10;let{x:o,y:A,z:l}=s;return o=this.targetDamperX.update(o,t.x,e,r),A=this.targetDamperY.update(A,t.y,e,r),l=this.targetDamperZ.update(l,t.z,e,r),this.groundedSkybox.position.x=-o,this.groundedSkybox.position.z=-l,this.target.position.set(o,A,l),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:s,z:r}=this.position;this.yaw=Math.atan2(e-s,t-r)}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!==o.uEv||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,s=o.YKA,r=1/0){if(null==this._currentGLTF)return;const{animations:A}=this;if(null==A||0===A.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<A.length&&(l=A[t])}null==l&&(l=A[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(s,r),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){ka.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){Na.setFromCamera(e,this.getCamera());return Na.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var s;const r=this.hitFromPoint(e,t);if(null==r)return null;return{position:r.point,normal:null!=r.face?r.face.normal.clone().applyNormalMatrix((new o.Vkp).getNormalMatrix(r.object.matrixWorld)):Na.ray.direction.clone().multiplyScalar(-1),uv:null!==(s=r.uv)&&void 0!==s?s:null}}surfaceFromPoint(e,t=this){const s=this.element.model;if(null==s)return null;const r=this.hitFromPoint(e,t);if(null==r||null==r.face)return null;const A=s[pa](r),{meshes:l,primitives:h}=A.mesh.userData.associations,c=new o.Pa4,d=new o.Pa4,g=new o.Pa4,{a:p,b:m,c:f}=r.face,I=r.object;I.getVertexPosition(p,c),I.getVertexPosition(m,d),I.getVertexPosition(f,g);const E=new o.CJI(c,d,g),C=new o.Pa4;return E.getBarycoord(I.worldToLocal(r.point),C),`${l} ${h} ${p} ${m} ${f} ${C.x.toFixed(3)} ${C.y.toFixed(3)} ${C.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 s=0,r=t.length;s<r;s++){const r=t[s];r instanceof Hotspot&&e(r)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=_i(e.surface)[0].terms;if(8!=t.length)return void ka.warn(e.surface+" does not have exactly 8 numbers.");const s=this.element.model[ma](t[0].number,t[1].number),r=new o.Pa4(t[2].number,t[3].number,t[4].number);if(null==s)return void ka.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const A=s.mesh.geometry.attributes.position.count;if(r.x>=A||r.y>=A||r.z>=A)return void ka.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new o.Pa4(t[5].number,t[6].number,t[7].number);e.mesh=s.mesh,e.tri=r,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{_a.copy(e),Ua.setFromMatrixPosition(t.matrixWorld),_a.sub(Ua),Ga.copy(t.normal).transformDirection(this.target.matrixWorld),_a.dot(Ga)<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:s,element:r}=this,{alt:o,poster:A,iosSrc:l}=r;if(null!=e){const r=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];l&&r.push({"@type":"MediaObject",contentUrl:l,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=A?A:void 0,name:null!=o?o:void 0,encoding:r};s.textContent=JSON.stringify(h),document.head.appendChild(s)}else null!=s.parentElement&&s.parentElement.removeChild(s)}}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),s=>{let r;return r=Math.max(clamp(s,0,1),t.progress),r!==t.progress&&this.announceTotalProgress(t,r,e),t.progress}}announceTotalProgress(e,t,s){let r=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;r+=1-t,e.completed&&o++}const A=e.progress;e.progress=t,this.totalProgress+=(t-A)*(1-this.totalProgress)/r;const l=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:l,reason:s}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var Ha,Va,qa,Ka,Ja,za,Ya,ja,$a,Wa,Xa,Za,eo,to=s(25108),model_viewer_base_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const io=document.createElement("canvas"),so=Symbol("fallbackResizeHandler"),no=Symbol("defaultAriaLabel"),ro=Symbol("resizeObserver"),ao=Symbol("clearModelTimeout"),oo=Symbol("onContextLost"),Ao=Symbol("loaded"),lo=Symbol("status"),ho=Symbol("onFocus"),co=Symbol("onBlur"),uo=Symbol("updateSize"),go=Symbol("intersectionObserver"),po=Symbol("isElementInViewport"),mo=Symbol("announceModelVisibility"),fo=Symbol("ariaLabel"),Io=Symbol("altDefaulted"),Eo=Symbol("statusElement"),Co=Symbol("updateStatus"),Bo=Symbol("loadedTime"),yo=Symbol("updateSource"),wo=Symbol("markLoaded"),vo=Symbol("container"),Qo=Symbol("input"),xo=Symbol("canvas"),bo=Symbol("scene"),So=Symbol("needsRender"),Mo=Symbol("tick"),To=Symbol("onModelLoad"),Ro=Symbol("onResize"),Do=Symbol("renderer"),Lo=Symbol("progressTracker"),Fo=Symbol("getLoaded"),ko=Symbol("getModelIsVisible"),_o=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[Ha]=!1,this[Va]=!1,this[qa]=0,this[Ka]="",this[Ja]=null,this[za]=debounce((()=>{const e=this.getBoundingClientRect();this[uo](e)}),50),this[Ya]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[ja]=null,this[$a]=null,this[Wa]=new ProgressTracker,this[Xa]=()=>{this[Eo].textContent=this[lo]},this[Za]=()=>{this[Eo].textContent=""},this[eo]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,s;if((e=>{D(Se,e)})(e),this[vo]=e.querySelector(".container"),this[Qo]=e.querySelector(".userInput"),this[xo]=e.querySelector("canvas"),this[Eo]=e.querySelector("#status"),this[no]=this[Qo].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,s=e.height}else t=300,s=150;this[bo]=new ModelScene({canvas:this[xo],element:this,width:t,height:s}),Promise.resolve().then((()=>{this[uo](this.getBoundingClientRect())})),ce&&(this[ro]=new ResizeObserver((e=>{if(!this[Do].isPresenting)for(let t of e)t.target===this&&this[uo](t.contentRect)}))),ue?this[go]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[po]=t.isIntersecting,this[mo](e),this[po]&&!this.loaded&&this[yo]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[po]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[qt].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[qt].evictionThreshold}static set minimumRenderScale(e){e>1&&to.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&to.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[Fo]()}get[(Ha=po,Va=Ao,qa=Bo,Ka=lo,Ja=ao,za=so,Ya=mo,ja=ro,$a=go,Wa=Lo,Do)](){return Renderer.singleton}get modelIsVisible(){return this[ko]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),ce?this[ro].observe(this):self.addEventListener("resize",this[so]),ue&&this[go].observe(this),this.addEventListener("focus",this[ho]),this.addEventListener("blur",this[co]);const e=this[Do];e.addEventListener("contextlost",this[oo]),e.registerScene(this[bo]),null!=this[ao]&&(self.clearTimeout(this[ao]),this[ao]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),ce?this[ro].unobserve(this):self.removeEventListener("resize",this[so]),ue&&this[go].unobserve(this),this.removeEventListener("focus",this[ho]),this.removeEventListener("blur",this[co]);const e=this[Do];e.removeEventListener("contextlost",this[oo]),e.unregisterScene(this[bo]),this[ao]=self.setTimeout((()=>{this[bo].dispose(),this[ao]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Ao]=!1,this[Bo]=0,this[bo].reset()):this.src!==this[bo].url&&(this[Ao]=!1,this[Bo]=0,this[yo]())),e.has("alt")&&this[Qo].setAttribute("aria-label",this[fo]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[Do].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[bo].updateSchema(this.src):this[bo].updateSchema(null))}toDataURL(e,t){return this[Do].displayCanvas(this[bo]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,s=e?e.qualityArgument:void 0,r=e?e.idealAspect:void 0,{width:o,height:A,idealAspect:l,aspect:h}=this[bo],{dpr:c,scaleFactor:d}=this[Do];let g=o*d*c,p=A*d*c,m=0,f=0;if(!0===r)if(l>h){const e=p;p=Math.round(g/l),f=(e-p)/2}else{const e=g;g=Math.round(p*l),m=(e-g)/2}io.width=g,io.height=p;try{return new Promise((async(e,r)=>{io.getContext("2d").drawImage(this[Do].displayCanvas(this[bo]),m,f,g,p,0,0,g,p),io.toBlob((t=>{if(!t)return r(new Error("Unable to retrieve canvas blob"));e(t)}),t,s)}))}finally{this[uo]({width:o,height:A})}}registerEffectComposer(e){e.setRenderer(this[Do].threeRenderer),e.setMainCamera(this[bo].getCamera()),e.setMainScene(this[bo]),this[bo].effectRenderer=e}unregisterEffectComposer(){this[bo].effectRenderer=null}registerRenderer(e){this[bo].externalRenderer=e}unregisterRenderer(){this[bo].externalRenderer=null}get[fo](){return this[Io]}get[Io](){return null==this.alt||"null"===this.alt?this[no]:this.alt}[Fo](){return this[Ao]}[ko](){return this.loaded&&this[po]}[_o](){return!!this.src&&this[po]}[uo]({width:e,height:t}){0!==e&&0!==t&&(this[vo].style.width=`${e}px`,this[vo].style.height=`${t}px`,this[Ro]({width:e,height:t}))}[Mo](e,t){var s;null===(s=this[bo].effectRenderer)||void 0===s||s.beforeRender(e,t)}[wo](){this[Ao]||(this[Ao]=!0,this[Bo]=performance.now())}[So](){this[bo].queueRender()}[To](){}[Co](e){this[lo]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Eo].textContent!=e&&(this[Eo].textContent=e)}[(Xa=ho,Za=co,Ro)](e){this[bo].setSize(e.width,e.height)}async[(eo=oo,yo)](){const e=this[bo];if(this.loaded||!this[_o]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[Co]("Loading"),e.stopAnimation();const t=this[Lo].beginActivity("model-load"),s=this.src;try{const r=e.setSource(s,(e=>t(.95*clamp(e,0,1)))),o=this[xe]();await Promise.all([r,o]),this[wo](),this[To](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:s}})),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,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Uo=Symbol("changeAnimation"),Go=Symbol("paused"),No={repetitions:1/0,pingpong:!1},Po=Symbol("hotspotMap"),Oo=Symbol("mutationCallback"),Ho=Symbol("observer"),Vo=Symbol("addHotspot"),qo=Symbol("removeHotspot"),Ko=new o.yGw;var Jo=Uint8Array,zo=Uint16Array,Yo=Int32Array,jo=new Jo([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]),$o=new Jo([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]),Wo=new Jo([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 s=new zo(31),r=0;r<31;++r)s[r]=t+=1<<e[r-1];var o=new Yo(s[30]);for(r=1;r<30;++r)for(var A=s[r];A<s[r+1];++A)o[A]=A-s[r]<<5|r;return{b:s,r:o}},Xo=freb(jo,2),Zo=Xo.b,eA=Xo.r;Zo[28]=258,eA[258]=28;for(var tA=freb($o,0),iA=(tA.b,tA.r),sA=new zo(32768),nA=0;nA<32768;++nA){var rA=(43690&nA)>>1|(21845&nA)<<1;rA=(61680&(rA=(52428&rA)>>2|(13107&rA)<<2))>>4|(3855&rA)<<4,sA[nA]=((65280&rA)>>8|(255&rA)<<8)>>1}var hMap=function(e,t,s){for(var r=e.length,o=0,A=new zo(t);o<r;++o)e[o]&&++A[e[o]-1];var l,h=new zo(t);for(o=1;o<t;++o)h[o]=h[o-1]+A[o-1]<<1;if(s){l=new zo(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var d=o<<4|e[o],g=t-e[o],p=h[e[o]-1]++<<g,m=p|(1<<g)-1;p<=m;++p)l[sA[p]>>c]=d}else for(l=new zo(r),o=0;o<r;++o)e[o]&&(l[o]=sA[h[e[o]-1]++]>>15-e[o]);return l},aA=new Jo(288);for(nA=0;nA<144;++nA)aA[nA]=8;for(nA=144;nA<256;++nA)aA[nA]=9;for(nA=256;nA<280;++nA)aA[nA]=7;for(nA=280;nA<288;++nA)aA[nA]=8;var oA=new Jo(32);for(nA=0;nA<32;++nA)oA[nA]=5;var AA=hMap(aA,9,0),lA=hMap(oA,5,0),shft=function(e){return(e+7)/8|0},slc=function(e,t,s){return(null==t||t<0)&&(t=0),(null==s||s>e.length)&&(s=e.length),new Jo(e.subarray(t,s))},hA=["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,s){var r=new Error(t||hA[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,err),!s)throw r;return r},wbits=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>8},wbits16=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>8,e[r+2]|=s>>16},hTree=function(e,t){for(var s=[],r=0;r<e.length;++r)e[r]&&s.push({s:r,f:e[r]});var o=s.length,A=s.slice();if(!o)return{t:uA,l:0};if(1==o){var l=new Jo(s[0].s+1);return l[s[0].s]=1,{t:l,l:1}}s.sort((function(e,t){return e.f-t.f})),s.push({s:-1,f:25001});var h=s[0],c=s[1],d=0,g=1,p=2;for(s[0]={s:-1,f:h.f+c.f,l:h,r:c};g!=o-1;)h=s[s[d].f<s[p].f?d++:p++],c=s[d!=g&&s[d].f<s[p].f?d++:p++],s[g++]={s:-1,f:h.f+c.f,l:h,r:c};var m=A[0].s;for(r=1;r<o;++r)A[r].s>m&&(m=A[r].s);var f=new zo(m+1),I=fflate_module_ln(s[g-1],f,0);if(I>t){r=0;var E=0,C=I-t,B=1<<C;for(A.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));r<o;++r){var y=A[r].s;if(!(f[y]>t))break;E+=B-(1<<I-f[y]),f[y]=t}for(E>>=C;E>0;){var Q=A[r].s;f[Q]<t?E-=1<<t-f[Q]++-1:++r}for(;r>=0&&E;--r){var x=A[r].s;f[x]==t&&(--f[x],++E)}I=t}return{t:new Jo(f),l:I}},fflate_module_ln=function(e,t,s){return-1==e.s?Math.max(fflate_module_ln(e.l,t,s+1),fflate_module_ln(e.r,t,s+1)):t[e.s]=s},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new zo(++t),r=0,o=e[0],A=1,w=function(e){s[r++]=e},l=1;l<=t;++l)if(e[l]==o&&l!=t)++A;else{if(!o&&A>2){for(;A>138;A-=138)w(32754);A>2&&(w(A>10?A-11<<5|28690:A-3<<5|12305),A=0)}else if(A>3){for(w(o),--A;A>6;A-=6)w(8304);A>2&&(w(A-3<<5|8208),A=0)}for(;A--;)w(o);A=1,o=e[l]}return{c:s.subarray(0,r),n:t}},clen=function(e,t){for(var s=0,r=0;r<t.length;++r)s+=e[r]*t[r];return s},wfblk=function(e,t,s){var r=s.length,o=shft(t+2);e[o]=255&r,e[o+1]=r>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var A=0;A<r;++A)e[o+A+4]=s[A];return 8*(o+4+r)},wblk=function(e,t,s,r,o,A,l,h,c,d,g){wbits(t,g++,s),++o[256];for(var p=hTree(o,15),m=p.t,f=p.l,I=hTree(A,15),E=I.t,C=I.l,B=lc(m),y=B.c,Q=B.n,x=lc(E),b=x.c,S=x.n,T=new zo(19),F=0;F<y.length;++F)++T[31&y[F]];for(F=0;F<b.length;++F)++T[31&b[F]];for(var _=hTree(T,7),U=_.t,G=_.l,O=19;O>4&&!U[Wo[O-1]];--O);var q,K,J,Y,j=d+5<<3,$=clen(o,aA)+clen(A,oA)+l,W=clen(o,m)+clen(A,E)+l+14+3*O+clen(T,U)+2*T[16]+3*T[17]+7*T[18];if(c>=0&&j<=$&&j<=W)return wfblk(t,g,e.subarray(c,c+d));if(wbits(t,g,1+(W<$)),g+=2,W<$){q=hMap(m,f,0),K=m,J=hMap(E,C,0),Y=E;var X=hMap(U,G,0);wbits(t,g,Q-257),wbits(t,g+5,S-1),wbits(t,g+10,O-4),g+=14;for(F=0;F<O;++F)wbits(t,g+3*F,U[Wo[F]]);g+=3*O;for(var ee=[y,b],te=0;te<2;++te){var ie=ee[te];for(F=0;F<ie.length;++F){var se=31&ie[F];wbits(t,g,X[se]),g+=U[se],se>15&&(wbits(t,g,ie[F]>>5&127),g+=ie[F]>>12)}}}else q=AA,K=aA,J=lA,Y=oA;for(F=0;F<h;++F){var ne=r[F];if(ne>255){wbits16(t,g,q[(se=ne>>18&31)+257]),g+=K[se+257],se>7&&(wbits(t,g,ne>>23&31),g+=jo[se]);var re=31≠wbits16(t,g,J[re]),g+=Y[re],re>3&&(wbits16(t,g,ne>>5&8191),g+=$o[re])}else wbits16(t,g,q[ne]),g+=K[ne]}return wbits16(t,g,q[256]),g+K[256]},cA=new Yo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uA=new Jo(0),dflt=function(e,t,s,r,o,A){var l=A.z||e.length,h=new Jo(r+l+5*(1+Math.ceil(l/7e3))+o),c=h.subarray(r,h.length-o),d=A.l,g=7&(A.r||0);if(t){g&&(c[0]=A.r>>3);for(var p=cA[t-1],m=p>>13,f=8191&p,I=(1<<s)-1,E=A.p||new zo(32768),C=A.h||new zo(I+1),B=Math.ceil(s/3),y=2*B,hsh=function(t){return(e[t]^e[t+1]<<B^e[t+2]<<y)&I},Q=new Yo(25e3),x=new zo(288),b=new zo(32),S=0,T=0,F=A.i||0,_=0,U=A.w||0,G=0;F+2<l;++F){var O=hsh(F),q=32767&F,K=C[O];if(E[q]=K,C[O]=q,U<=F){var J=l-F;if((S>7e3||_>24576)&&(J>423||!d)){g=wblk(e,c,0,Q,x,b,T,_,G,F-G,g),_=S=T=0,G=F;for(var Y=0;Y<286;++Y)x[Y]=0;for(Y=0;Y<30;++Y)b[Y]=0}var j=2,$=0,W=f,X=q-K&32767;if(J>2&&O==hsh(F-X))for(var ee=Math.min(m,J)-1,te=Math.min(32767,F),ie=Math.min(258,J);X<=te&&--W&&q!=K;){if(e[F+j]==e[F+j-X]){for(var se=0;se<ie&&e[F+se]==e[F+se-X];++se);if(se>j){if(j=se,$=X,se>ee)break;var ne=Math.min(X,se-2),re=0;for(Y=0;Y<ne;++Y){var ae=F-X+Y&32767,oe=ae-E[ae]&32767;oe>re&&(re=oe,K=ae)}}}X+=(q=K)-(K=E[q])&32767}if($){Q[_++]=268435456|eA[j]<<18|iA[$];var Ae=31&eA[j],le=31&iA[$];T+=jo[Ae]+$o[le],++x[257+Ae],++b[le],U=F+j,++S}else Q[_++]=e[F],++x[e[F]]}}for(F=Math.max(F,U);F<l;++F)Q[_++]=e[F],++x[e[F]];g=wblk(e,c,d,Q,x,b,T,_,G,F-G,g),d||(A.r=7&g|c[g/8|0]<<3,g-=7,A.h=C,A.p=E,A.i=F,A.w=U)}else{for(F=A.w||0;F<l+d;F+=65535){var he=F+65535;he>=l&&(c[g/8|0]=d,he=l),g=wfblk(c,g+1,e.subarray(F,he))}A.i=l}return slc(h,0,r+shft(g)+o)},dA=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var s=t,r=9;--r;)s=(1&s&&-306674912)^s>>>1;e[t]=s}return e}(),crc=function(){var e=-1;return{p:function(t){for(var s=e,r=0;r<t.length;++r)s=dA[255&s^t[r]]^s>>>8;e=s},d:function(){return~e}}},dopt=function(e,t,s,r,o){if(!o&&(o={l:1},t.dictionary)){var A=t.dictionary.subarray(-32768),l=new Jo(A.length+e.length);l.set(A),l.set(e,A.length),e=l,o.w=A.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,s,r,o)},mrg=function(e,t){var s={};for(var r in e)s[r]=e[r];for(var r in t)s[r]=t[r];return s},wbytes=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,s,r){for(var o in e){var A=e[o],l=t+o,h=r;Array.isArray(A)&&(h=mrg(r,A[1]),A=A[0]),A instanceof Jo?s[l]=[A,h]:(s[l+="/"]=[new Jo(0),h],fltn(A,l,s,r))}},gA="undefined"!=typeof TextEncoder&&new TextEncoder,pA="undefined"!=typeof TextDecoder&&new TextDecoder;try{pA.decode(uA,{stream:!0})}catch(e){}function strToU8(e,t){if(t){for(var s=new Jo(e.length),r=0;r<e.length;++r)s[r]=e.charCodeAt(r);return s}if(gA)return gA.encode(e);var o=e.length,A=new Jo(e.length+(e.length>>1)),l=0,w=function(e){A[l++]=e};for(r=0;r<o;++r){if(l+5>A.length){var h=new Jo(l+8+(o-r<<1));h.set(A),A=h}var c=e.charCodeAt(r);c<128||t?w(c):c<2048?(w(192|c>>6),w(128|63&c)):c>55295&&c<57344?(w(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++r))>>18),w(128|c>>12&63),w(128|c>>6&63),w(128|63&c)):(w(224|c>>12),w(128|c>>6&63),w(128|63&c))}return slc(A,0,l)}var exfl=function(e){var t=0;if(e)for(var s in e){var r=e[s].length;r>65535&&err(9),t+=r+4}return t},wzh=function(e,t,s,r,o,A,l,h){var c=r.length,d=s.extra,g=h&&h.length,p=exfl(d);wbytes(e,t,null!=l?33639248:67324752),t+=4,null!=l&&(e[t++]=20,e[t++]=s.os),e[t]=20,t+=2,e[t++]=s.flag<<1|(A<0&&8),e[t++]=o&&8,e[t++]=255&s.compression,e[t++]=s.compression>>8;var m=new Date(null==s.mtime?Date.now():s.mtime),f=m.getFullYear()-1980;if((f<0||f>119)&&err(10),wbytes(e,t,f<<25|m.getMonth()+1<<21|m.getDate()<<16|m.getHours()<<11|m.getMinutes()<<5|m.getSeconds()>>1),t+=4,-1!=A&&(wbytes(e,t,s.crc),wbytes(e,t+4,A<0?-A-2:A),wbytes(e,t+8,s.size)),wbytes(e,t+12,c),wbytes(e,t+14,p),t+=16,null!=l&&(wbytes(e,t,g),wbytes(e,t+6,s.attrs),wbytes(e,t+10,l),t+=14),e.set(r,t),t+=c,p)for(var I in d){var E=d[I],C=E.length;wbytes(e,t,+I),wbytes(e,t+2,C),e.set(E,t+4),t+=4+C}return g&&(e.set(h,t),t+=g),t},wzf=function(e,t,s,r,o){wbytes(e,t,101010256),wbytes(e,t+8,s),wbytes(e,t+10,s),wbytes(e,t+12,r),wbytes(e,t+16,o)};"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;var mA=s(25108);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1,maxTextureSize:1024},t);const s={},r="model.usda";s[r]=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 A={},l={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,r=e.material;if(r.isMeshStandardMaterial){const l="geometries/Geometry_"+t.id+".usda";if(!(l in s)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",s=e.attributes,r=s.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,s=[];if(null!==t)for(let e=0;e<t.count;e++)s.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)s.push(e)}return s.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(s.normal,r)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(s.position,r)}]\n${function buildPrimvars(e){let t="";for(let s=0;s<4;s++){const r=s>0?s:"",o=e["uv"+r];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${r} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}const s=e.color;if(void 0!==s){t+=`\n\tcolor3f[] primvars:displayColor = [${buildVector3Array(s,s.count)}] (\n\t\tinterpolation = "vertex"\n\t\t)`}return t}(s)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);s[l]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}r.uuid in A||(A[r.uuid]=r),o+=function buildXform(e,t,s){const r="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&mA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${r}" (\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_${s.id}>\n}\n\n`}(e,t,r)}else mA.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,s=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&mA.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 = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(fA)}, ${e.far.toPrecision(fA)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(fA)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(fA)}\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 = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(fA)}, ${e.far.toPrecision(fA)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(fA)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(fA)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(fA)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(fA)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,s=!1){const r=[];for(const o in e){const A=e[o];r.push(buildMaterial(A,t,s))}return`def "Materials"\n{\n${r.join("")}\n}\n\n`}(A,l,t.quickLookCompatible),s[r]=strToU8(o),o=null;for(const e in l){let r=l[e];!0===r.isCompressedTexture&&(r=decompress(r));const o=imageToCanvas(r.image,r.flipY,t.maxTextureSize),A=await new Promise((e=>o.toBlob(e,"image/png",1)));s[`textures/Texture_${e}.png`]=new Uint8Array(await A.arrayBuffer())}let h=0;for(const e in s){const t=s[e];h+=34+e.length;const r=63&h;if(4!==r){const o=new Uint8Array(64-r);s[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var s={},r=[];fltn(e,"",s,t);var o=0,A=0;for(var l in s){var h=s[l],c=h[0],d=h[1],g=0==d.level?0:8,p=(T=strToU8(l)).length,m=d.comment,f=m&&strToU8(m),I=f&&f.length,E=exfl(d.extra);p>65535&&err(11);var C=g?deflateSync(c,d):c,B=C.length,y=crc();y.p(c),r.push(mrg(d,{size:c.length,crc:y.d(),c:C,f:T,m:f,u:p!=l.length||f&&m.length!=I,o,compression:g})),o+=30+p+E+B,A+=76+2*(p+E)+(I||0)+B}for(var Q=new Jo(A+22),x=o,b=A-o,S=0;S<r.length;++S){var T=r[S];wzh(Q,T.o,T,T.f,T.u,T.c.length);var F=30+T.f.length+exfl(T.extra);Q.set(T.c,T.o+F),wzh(Q,o,T,T.f,T.u,T.c.length,T.o,T.m),o+=16+F+(T.m?T.m.length:0)}return wzf(Q,o,r.length,b,x),Q}(s,{level:0})}}function imageToCanvas(e,t,s){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 r=s/Math.max(e.width,e.height),o=document.createElement("canvas");o.width=e.width*Math.min(1,r),o.height=e.height*Math.min(1,r);const A=o.getContext("2d");return!0===t&&(A.translate(0,o.height),A.scale(1,-1)),A.drawImage(e,0,0,o.width,o.height),o}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const fA=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 mA.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const s=[];for(let t=0;t<e.count;t++){const r=e.getX(t),o=e.getY(t),A=e.getZ(t);s.push(`(${r.toPrecision(fA)}, ${o.toPrecision(fA)}, ${A.toPrecision(fA)})`)}return s.join(", ")}function buildVector2Array(e){const t=[];for(let s=0;s<e.count;s++){const r=e.getX(s),o=e.getY(s);t.push(`(${r.toPrecision(fA)}, ${1-o.toPrecision(fA)})`)}return t.join(", ")}function buildMaterial(e,t,s=!1){const r="\t\t\t",A=[],l=[];function buildTexture(r,A,l){const h=r.source.id+"_"+r.flipY;t[h]=r;const c=r.channel>0?"st"+r.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},g=r.repeat.clone(),p=r.offset.clone(),m=r.rotation,f=Math.sin(m),I=Math.cos(m);return p.y=1-p.y-g.y,s?(p.x=p.x/g.x,p.y=p.y/g.y,p.x+=f/g.x,p.y+=I-1):(p.x+=f*g.x,p.y+=(1-I)*g.y),`\n\t\tdef Shader "PrimvarReader_${A}"\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 = "${c}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${A}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(fA)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(g)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(p)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${r.id}_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${h}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${A}.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 = "${r.colorSpace===o.aCh?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[r.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[r.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 e.side===o.ehD&&mA.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(A.push(`${r}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),A.push(`${r}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):A.push(`${r}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(A.push(`${r}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&&A.push(`${r}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(A.push(`${r}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(A.push(`${r}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?(A.push(`${r}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):A.push(`${r}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(A.push(`${r}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):A.push(`${r}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),A.push(`${r}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):A.push(`${r}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(A.push(`${r}float inputs:clearcoat = ${e.clearcoat}`),A.push(`${r}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),A.push(`${r}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${A.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 IA=s(25108),ar_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};let EA=!1,CA=!1;const BA="#model-viewer-no-ar-fallback",yA=(wA=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=_i(e),s=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>wA.indexOf(e)>-1));return new Set(s)}catch(e){}return new Set});var wA;const vA="quick-look",QA="scene-viewer",xA="webxr",bA="none",SA=Symbol("arButtonContainer"),MA=Symbol("enterARWithWebXR"),TA=Symbol("openSceneViewer"),RA=Symbol("openIOSARQuickLook"),DA=Symbol("canActivateAR"),LA=Symbol("arMode"),FA=Symbol("arModes"),kA=Symbol("arAnchor"),_A=Symbol("preload"),UA=Symbol("onARButtonContainerClick"),GA=Symbol("onARStatus"),NA=Symbol("onARTracking"),PA=Symbol("onARTap"),OA=Symbol("selectARMode"),HA=Symbol("triggerLoad");var loading_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const VA="auto",qA="auto",KA="eager",JA=Symbol("defaultProgressBarElement"),zA=Symbol("posterContainerElement"),YA=Symbol("defaultPosterElement"),jA=Symbol("shouldDismissPoster"),$A=Symbol("hidePoster"),WA=Symbol("modelIsRevealed"),XA=Symbol("updateProgressBar"),ZA=Symbol("ariaLabelCallToAction"),el=Symbol("onProgress");var staging_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const tl=Math.PI/32,il={basis:[degreesToRadians(numberNode(tl,"rad"))],keywords:{auto:[null]}},sl=Symbol("autoRotateStartTime"),nl=Symbol("radiansPerSecond"),rl=Symbol("syncRotationRate"),al=Symbol("onCameraChange"),ol=(e=>{var t,s,r;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[s]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[Vo](e)})),e.removedNodes.forEach((e=>{this[qo](e)})),this[So]())}))},this[r]=new MutationObserver(this[Oo])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[Vo](this.children[e]);const{ShadyDOM:e}=self;null==e?this[Ho].observe(this,{childList:!0}):this[Ho]=e.observeChildren(this,this[Oo])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[Ho].disconnect():e.unobserveChildren(this[Ho])}[(t=Po,s=Oo,r=Ho,Mo)](e,t){super[Mo](e,t);const s=this[bo],{annotationRenderer:r}=s,o=s.getCamera();s.shouldRender()&&(s.updateSurfaceHotspots(),s.updateHotspotsVisibility(o.position),r.domElement.style.display="",r.render(s,o))}updateHotspot(e){const t=this[Po].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[So]())}queryHotspot(e){const t=this[Po].get(e);if(null==t)return null;const s=toVector3D(t.position),r=toVector3D(t.normal),A=t.facingCamera,l=this[bo],h=l.getCamera(),c=new o.Pa4;c.setFromMatrixPosition(t.matrixWorld),c.project(h);const d=l.width/2,g=l.height/2;c.x=c.x*d+d,c.y=-c.y*g+g;const p=toVector3D(new o.Pa4(c.x,c.y,c.z));return Number.isFinite(p.x)&&Number.isFinite(p.y)?{position:s,normal:r,canvasPosition:p,facingCamera:A}:null}positionAndNormalFromPoint(e,t){const s=this[bo],r=s.getNDC(e,t),o=s.positionAndNormalFromPoint(r);if(null==o)return null;Ko.copy(s.target.matrixWorld).invert();const A=toVector3D(o.position.applyMatrix4(Ko)),l=toVector3D(o.normal.transformDirection(Ko));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:A,normal:l,uv:h}}surfaceFromPoint(e,t){const s=this[bo],r=s.getNDC(e,t);return s.surfaceFromPoint(r)}[Vo](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[Po].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[Po].set(e.slot,t),this[bo].addHotspot(t)),this[bo].queueRender()}[qo](e){if(!(e instanceof HTMLElement))return;const t=this[Po].get(e.slot);t&&(t.decrement()&&(this[bo].removeHotspot(t),this[Po].delete(e.slot)),this[bo].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,s,r;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[s]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[wa]}get availableVariants(){return this.model?this.model[Ia]():[]}get originalGltfJson(){return this[ya]}[(t=wa,s=Ba,r=ya,va)](){return()=>{this[So]()}}[Qa](e){return e.colorSpace=o.KI_,e.wrapS=o.rpg,e.wrapT=o.rpg,new Texture(this[va](),e)}async createTexture(e,t="image/png"){const{textureUtils:s}=this[Do],r=await s.loadImage(e);return r.userData.mimeType=t,this[Qa](r)}async createLottieTexture(e,t=1){const{textureUtils:s}=this[Do],r=await s.loadLottie(e,t);return this[Qa](r)}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 s=new o.fO1(t);return this[Qa](s)}createCanvasTexture(){const e=document.createElement("canvas"),t=new o.ROQ(e);return this[Qa](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[Lo].beginActivity("variant-update");e(.1);const t=this[wa],{variantName:s}=this;null!=t&&(await t[da](s),this[So](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[bo];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[Do].arRenderer.onUpdateScene(),this[So]()}}[To](){super[To]();const{currentGLTF:e}=this[bo];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[Ba]&&(this[wa]=new Model(t,this[va]()),this[ya]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[Ba]=e}async exportScene(e){const t=this[bo];return new Promise((async(s,r)=>{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 A=t.shadow;let l=!1;null!=A&&(l=A.visible,A.visible=!1),await this[wa][ua]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>s(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>r("glTF export failed")),o),null!=A&&(A.visible=l)}))}materialFromPoint(e,t){const s=this[wa];if(null==s)return null;const r=this[bo],o=r.getNDC(e,t),A=r.hitFromPoint(o);return null==A||null==A.face?null:s[ga](A)}}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,s,r;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[s]=0,this[r]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[sl]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[al]),this[sl]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[al]),this[sl]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[sl]=performance.now())}[(t=sl,s=nl,rl)](e){this[nl]=e[0]}[Mo](e,t){if(super[Mo](e,t),!this.autoRotate||!this[ko]()||this[Do].isPresenting)return;const s=Math.min(t,e-this[sl]-this.autoRotateDelay);s>0&&(this[bo].yaw=this.turntableRotation+this[nl]*s*.001)}get turntableRotation(){return this[bo].yaw}resetTurntableRotation(e=0){this[bo].yaw=e}}return r=al,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:il,updateHandler:rl}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,s,r;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[s]=null,this[r]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[bo].setShadowIntensity(.5*this.shadowIntensity),this[So]()),e.has("shadowSoftness")&&(this[bo].setShadowSoftness(this.shadowSoftness),this[So]()),e.has("exposure")&&(this[bo].exposure=this.exposure,this[So]()),e.has("toneMapping")&&(this[bo].toneMapping="commerce"===this.toneMapping||"neutral"===this.toneMapping?o.ORg:"agx"===this.toneMapping?o.Bgp:o.LY2,this[So]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[_o]()&&this[xe](),e.has("skyboxHeight")&&(this[bo].setGroundedSkybox(),this[So]())}hasBakedShadow(){return this[bo].bakedShadows.size>0}async[(t=ve,s=Qe,r=be,xe)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[be]&&(this[be](),this[be]=null);const{textureUtils:s}=this[Do];if(null==s)return;const r=this[Lo].beginActivity("environment-update");try{const{environmentMap:o,skybox:A}=await s.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>r(clamp(e,0,1))));this[ve]!==o&&(this[ve]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[Qe]=null!=A?A.name===o.name?o:A:null,this[bo].setEnvironmentAndSkybox(this[ve],this[Qe])}catch(e){if(e instanceof Error)throw this[bo].setEnvironmentAndSkybox(null,null),e}finally{r(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,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B,y,Q;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=ws,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=xs,this.interactionPromptStyle=Ss,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=Ms,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[s]=this.shadowRoot.querySelector("#prompt"),this[r]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[A]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[h]=1/0,this[c]=!1,this[d]=!1,this[g]=mn.AUTOMATIC,this[p]=new SmoothControls(this[bo].camera,this[Qo],this[bo]),this[m]=new o.$V,this[f]=!1,this[I]=!1,this[E]=!1,this[C]={},this[B]=()=>{const e=this[ks].changeSource;this[Xs]=e,e===mn.USER_INTERACTION&&(this[js]=!0,this[Ps]())},this[y]=()=>{this[Os](),this[So]();const e=this[ks].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[Q]=e=>{this[vo].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[ks].inputSensitivity}set inputSensitivity(e){this[ks].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:s}=this[Zs];return{theta:e,phi:t,radius:s,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[Do].isPresenting?this[Do].arRenderer.target:this[bo].getTarget())}getFieldOfView(){return this[ks].getFieldOfView()}getMinimumFieldOfView(){return this[ks].options.minimumFieldOfView}getMaximumFieldOfView(){return this[ks].options.maximumFieldOfView}getIdealAspect(){return this[bo].idealAspect}jumpCameraToGoal(){this[en]=!0,this.requestUpdate(en,!1)}resetInteractionPrompt(){this[Ws]=0,this[$s]=1/0,this[js]=!1,this[Ys]=this.interactionPrompt===xs&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Qo].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[ks].addEventListener("user-interaction",this[Ks]),this[ks].addEventListener("pointer-change-start",this[zs]),this[ks].addEventListener("pointer-change-end",this[zs])}disconnectedCallback(){super.disconnectedCallback(),this[ks].removeEventListener("user-interaction",this[Ks]),this[ks].removeEventListener("pointer-change-start",this[zs]),this[ks].removeEventListener("pointer-change-end",this[zs])}updated(e){super.updated(e);const t=this[ks],s=this[bo];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===xs&&(this[Ys]=!0)):(t.disableInteraction(),this[Ps]()),this[Qo].setAttribute("aria-label",this[fo])),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===xs&&this.cameraControls&&!this[js]?this[Ys]=!0:this[Ps]()),e.has("interactionPromptStyle")&&(this[Gs].style.opacity=this.interactionPromptStyle==bs?"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),s.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[Vs](),!0===this[en]&&Promise.resolve().then((()=>{t.jumpToGoal(),s.jumpToGoal(),this[Js](),this[en]=!1}))}async updateFraming(){const e=this[bo],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const s=e.adjustedFoV(e.framedFoVDeg),r=this[ks].getFieldOfView()/t;this[ks].setFieldOfView(s*r),this[sn]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,s){const r=this[Qo],o=this[Ns];if("1"===o[0].style.opacity)return void Cs.warn("interact() failed because an existing interaction is running.");const A=new Array;A.push({x:timeline(t.x),y:timeline(t.y)});const l=[{x:A[0].x(0),y:A[0].y(0)}];null!=s&&(A.push({x:timeline(s.x),y:timeline(s.y)}),l.push({x:A[1].x(0),y:A[1].y(0)}));let h=performance.now();const{width:c,height:d}=this[bo],g=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,s]of l.entries()){const{style:A}=o[t];A.transform=`translateX(${c*s.x}px) translateY(${d*s.y}px)`,"pointerdown"===e?A.opacity="1":"pointerup"===e&&(A.opacity="0");const l={pointerId:t-5678,pointerType:"touch",target:r,clientX:c*s.x+g.x,clientY:d*s.y+g.y,altKey:!0};r.dispatchEvent(new PointerEvent(e,l))}},moveTouches=()=>{const t=this[Xs];if(t!==mn.AUTOMATIC||!r.isConnected){for(const e of this[Ns])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const s=Math.min(1,(performance.now()-h)/e);for(const[e,t]of l.entries())t.x=A[e].x(s),t.y=A[e].y(s);dispatchTouches("pointermove"),s<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:mn.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[Xs]=mn.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=Us,s=Gs,r=Ns,A=_s,l=Ws,h=$s,c=js,d=Ys,g=Xs,p=ks,m=Zs,f=en,I=tn,E=sn,C=Hs,rn)](e){const t=this[ks],s=this[bo];s.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=mn.NONE,t.setFieldOfView(s.adjustedFoV(s.framedFoVDeg)),this[Ks]()}[nn](e){const t=this[ks];if(this[sn]){const{theta:t,phi:s}=this.getCameraOrbit();e[0]=t,e[1]=s,this[sn]=!1}t.changeSource=mn.NONE,t.setOrbit(e[0],e[1],e[2]),this[Ks]()}[on](e){this[ks].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[An](e){this[ks].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[qs](e[2]),this.jumpCameraToGoal()}[ln](e){this[ks].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[hn](e){const t=this[bo].adjustedFoV(180*e[0]/Math.PI);this[ks].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[an](e){const[t,s,r]=e;this[Do].arRenderer.isPresenting||this[bo].setTarget(t,s,r),this[ks].changeSource=mn.NONE,this[Do].arRenderer.updateTarget(),this[Ks]()}[Mo](e,t){if(super[Mo](e,t),this[Do].isPresenting||!this[ko]())return;const s=this[ks],r=this[bo],o=performance.now();if(this[Ys]&&this.loaded&&o>this[Bo]+this.interactionPromptThreshold&&(this[Ys]=!1,this[$s]=o,this[Us].classList.add("visible")),isFinite(this[$s])&&this.interactionPromptStyle===Ss){const e=(o-this[$s])/5e3%1,t=Bs(e),A=ys(e);if(this[Gs].style.opacity=`${A}`,t!==this[Ws]){const e=t*r.width*.05,o=(t-this[Ws])*Math.PI/16;this[Gs].style.transform=`translateX(${e}px)`,s.changeSource=mn.AUTOMATIC,s.adjustOrbit(o,0,0),this[Ws]=t}}const A=s.update(e,t),l=r.updateTarget(t);(A||l)&&this[Js]()}[Ps](){this[Ys]=!1,this[Us].classList.remove("visible"),this[$s]=1/0}[qs](e){const t=Math.max(this[bo].farRadius(),e),s=Math.abs(2*t);this[ks].updateNearFar(0,s)}[Os](){const{theta:e,phi:t}=this[ks].getCameraSpherical(this[Zs]),s=(4+Math.floor((e%Fs+Ls)/Rs))%4,r=Math.floor(t/Ds),o=`${Qs[r]}${vs[s]}`,A=o;A in this[Hs]?this[Co](this[Hs][A]):this[Co](`View from stage ${o}`)}get[fo](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[Hs]&&(e=`. ${this[Hs]["interaction-prompt"]}`),super[fo].replace(/\.$/,"")+(this.cameraControls?e:"")}async[Ro](e){const t=this[ks],s=this[bo],r=s.adjustedFoV(s.framedFoVDeg);super[Ro](e);const o=s.adjustedFoV(s.framedFoVDeg)/r,A=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[bo].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[ks].setFieldOfView(A),this.jumpCameraToGoal()}[To](){super[To](),this[tn]?this[sn]=!0:this[tn]=!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()}[(B=Ks,y=Js,Q=zs,Vs)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[Hs]=JSON.parse(this.a11y)}catch(e){Cs.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?Cs.warn("Error not supported format, should be a JSON string:",this.a11y):this[Hs]={};else"object"==typeof this.a11y&&null!=this.a11y?this[Hs]=Object.assign({},this.a11y):this[Hs]={};this[Qo].setAttribute("aria-label",this[fo])}}return controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:Ts,observeEffects:!0,updateHandler:nn}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:an}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:rn}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:on}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:An}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:ln}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:hn}),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,s,r,o,A,l,h,c,d,g;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[s]=this.shadowRoot.querySelector(".ar-button"),this[r]=document.createElement("a"),this[o]=new Set,this[A]=bA,this[l]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[c]=({status:e})=>{e!==En&&this[Do].arRenderer.presentedScene!==this[bo]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===En?this.removeAttribute("ar-tracking"):e===Cn&&this.setAttribute("ar-tracking",wn))},this[d]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[g]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[LA]!==bA}connectedCallback(){super.connectedCallback(),this[Do].arRenderer.addEventListener("status",this[GA]),this.setAttribute("ar-status",En),this[Do].arRenderer.addEventListener("tracking",this[NA]),this[kA].addEventListener("message",this[PA])}disconnectedCallback(){super.disconnectedCallback(),this[Do].arRenderer.removeEventListener("status",this[GA]),this[Do].arRenderer.removeEventListener("tracking",this[NA]),this[kA].removeEventListener("message",this[PA])}update(e){super.update(e),e.has("arScale")&&(this[bo].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[bo].updateShadow(),this[So]()),e.has("arModes")&&(this[FA]=yA(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[OA]()}async activateAR(){switch(this[LA]){case vA:await this[RA]();break;case xA:await this[MA]();break;case QA:this[TA]();break;default:IA.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=DA,s=SA,r=kA,o=FA,A=LA,l=_A,h=UA,c=GA,d=NA,g=PA,OA)](){var e;let t=bA;if(this.ar){if(null!=this.src)for(const s of this[FA]){if("webxr"===s&&de&&!EA&&await this[Do].arRenderer.supportsPresentation()){t=xA;break}if("scene-viewer"===s&&!CA&&(Ie||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=QA;break}if("quick-look"===s&&Ce){t=vA;break}}t===bA&&null!=this.iosSrc&&Ce&&(t=vA)}if(t!==bA)this[SA].classList.add("enabled"),this[SA].addEventListener("click",this[UA]);else if(this[SA].classList.contains("enabled")){this[SA].removeEventListener("click",this[UA]),this[SA].classList.remove("enabled");const e=yn;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[LA]=t}async[MA](){IA.log("Attempting to present in AR with WebXR..."),await this[HA]();try{this[SA].removeEventListener("click",this[UA]);const{arRenderer:e}=this[Do];e.placeOnWall="wall"===this.arPlacement,await e.present(this[bo],this.xrEnvironment)}catch(e){IA.warn("Error while trying to present in AR with WebXR"),IA.error(e),await this[Do].arRenderer.stopPresenting(),EA=!0,IA.warn("Falling back to next ar-mode"),await this[OA](),this.activateAR()}finally{this[OA]()}}async[HA](){this.loaded||(this[_A]=!0,this[yo](),await((e,t,s=null)=>new Promise((r=>{e.addEventListener(t,(function handler(o){s&&!s(o)||(r(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[_A]=!1)}[_o](){return super[_o]()||this[_A]}[TA](){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,e);s.hash&&(s.hash="");const r=new URLSearchParams(s.search);if(t.hash=BA,r.set("mode","ar_preferred"),r.has("disable_occlusion")||r.set("disable_occlusion","true"),"fixed"===this.arScale&&r.set("resizable","false"),"wall"===this.arPlacement&&r.set("enable_vertical_placement","true"),r.has("sound")){const t=new URL(r.get("sound"),e);r.set("sound",t.toString())}if(r.has("link")){const t=new URL(r.get("link"),e);r.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.2?${r.toString()+"&file="+encodeURIComponent(s.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===BA&&(CA=!0,self.history.back(),IA.warn("Error while trying to present in AR with Scene Viewer"),IA.warn("Falling back to next ar-mode"),this[OA]())}),{once:!0}),this[kA].setAttribute("href",o),IA.log("Attempting to present in AR with Scene Viewer..."),this[kA].click()}async[RA](){const e=!this.iosSrc;this[SA].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,s=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,t);r.hash&&(s.hash=r.hash)}"fixed"===this.arScale&&(s.hash&&(s.hash+="&"),s.hash+="allowsContentScaling=0");const r=this[kA];r.setAttribute("rel","ar");const o=document.createElement("img");r.appendChild(o),r.setAttribute("href",s.toString()),e&&r.setAttribute("download","model.usdz"),r.style.display="none",r.isConnected||this.shadowRoot.appendChild(r),IA.log("Attempting to present in AR with Quick Look..."),r.click(),r.removeChild(o),e&&URL.revokeObjectURL(t),this[SA].classList.add("enabled")}async prepareUSDZ(){const e=this[Lo].beginActivity("usdz-conversion");await this[HA]();const{model:t,shadow:s,target:r}=this[bo];if(null==t)return"";let o=!1;null!=s&&(o=s.visible,s.visible=!1),e(.2);const A=new USDZExporter;r.remove(t),t.position.copy(r.position),t.updateWorldMatrix(!1,!0);const l=await A.parse(t);t.position.set(0,0,0),r.add(t);const h=new Blob([l],{type:"model/vnd.usdz+zip"}),c=URL.createObjectURL(h);return e(1),null!=s&&(s.visible=o),c}}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,s,r,A,l,h,c,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=VA,this.loading=qA,this[t]=!1,this[s]=!1,this[r]=this.shadowRoot.querySelector(".slot.poster"),this[A]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[h]=this[YA].getAttribute("aria-label"),this[c]=((e,t)=>{let s=null;const throttled=(...r)=>{null==s&&(e(...r),s=self.setTimeout((()=>s=null),t))};return throttled.flush=()=>{null!=s&&(self.clearTimeout(s),s=null)},throttled})((e=>{const t=this[JA].parentNode;requestAnimationFrame((()=>{this[JA].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[JA]),t.appendChild(this[JA])),this[JA].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress,s=e.detail.reason;1===t&&(this[XA].flush(),this.loaded&&(this[jA]||this.reveal===VA)&&this[$A]()),this[XA](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:s}}))};const o=self.ModelViewerElement||{},g=o.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(g);const p=o.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(p),o.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(o.meshoptDecoderLocation);const m=o.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=m}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[Vt].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[$A]():(this[jA]=!0,this[yo]())}showPoster(){const e=this[zA];if(e.classList.contains("show"))return;e.classList.add("show"),this[Qo].classList.remove("show");const t=this[YA];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const s=this.modelIsVisible;this[WA]=!1,this[mo](s)}getDimensions(){return toVector3D(this[bo].size)}getBoundingBoxCenter(){return toVector3D(this[bo].boundingBox.getCenter(new o.Pa4))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[Lo].addEventListener("progress",this[el])}disconnectedCallback(){super.disconnectedCallback(),this[Lo].removeEventListener("progress",this[el])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[YA].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[YA].setAttribute("aria-label",this[Io]),(e.has("reveal")||e.has("loading"))&&this[yo]()}[(t=WA,s=jA,r=zA,A=YA,l=JA,h=ZA,c=XA,d=el,_o)](){return!!this.src&&(this[jA]||this.loading===KA||this.reveal===VA&&this[po])}[$A](){this[jA]=!1;const e=this[zA];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Qo].classList.add("show");const t=this.modelIsVisible;this[WA]=!0,this[mo](t);const s=this.getRootNode();s&&s.activeElement===this&&this[Qo].focus();const r=this[YA];r.setAttribute("aria-hidden","true"),r.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[ko](){return super[ko]()&&this[WA]}}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[bo].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[bo].subscribeMixerEvent("finished",(()=>{this[Go]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[bo].animationNames:[]}get duration(){return this[bo].duration}get paused(){return this[Go]}get currentTime(){return this[bo].animationTime}set currentTime(e){this[bo].animationTime=e,this[So]()}get timeScale(){return this[bo].animationTimeScale}set timeScale(e){this[bo].animationTimeScale=e}pause(){this[Go]||(this[Go]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[Go]=!1,this[Uo](e),this.dispatchEvent(new CustomEvent("play")))}[(t=Go,To)](){super[To](),this[Go]=!0,null!=this.animationName&&this[Uo](),this.autoplay&&this.play()}[Mo](e,t){super[Mo](e,t),this[Go]||!this[ko]()&&!this[Do].isPresenting||(this[bo].updateAnimation(t/1e3),this[So]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[Uo]()}[Uo](e=No){var t;const s=null!==(t=e.repetitions)&&void 0!==t?t:1/0,r=e.pingpong?o.uEv:1===s?o.jAl:o.YKA;this[bo].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,r,s),this[Go]&&(this[bo].updateAnimation(0),this[So]())}}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",ol)}}]);
|