import{T as ye,a as Q,b as fe,L as Se,c as G,F as he,M,V as pe,C as D,d as O,S as U,e as Me,P as be,D as me,f as j,g as N,I as Ie,Q as ge,h as Ne,O as Ae,i as Oe,j as Ce,B as V,k as Pe,l as Te,N as Fe,m as De,n as He,o as Z,p as xe,R as J,q as ve,r as ke,s as Ge,t as X,u as Be,v as Re,w as Ue,x as k,y as je,z as Ke,A as Ve,E as Xe,G as ze,H as We,J as qe,K as Ye,U as z,W as Ee,X as Qe,Y as Ze,Z as Je,_ as $e,$ as et,a0 as tt,a1 as we,a2 as nt,a3 as ne,a4 as se,a5 as re,a6 as ie,a7 as oe,a8 as st,a9 as rt,aa as $,ab as it,ac as ot,ad as at,ae as ct}from"./three-BBdsPnFb.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function e(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=e(n);fetch(n.href,r)}})();var B=function(){var f=0,t=document.createElement("div");t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",function(u){u.preventDefault(),i(++f%t.children.length)},!1);function e(u){return t.appendChild(u.dom),u}function i(u){for(var l=0;l=r+1e3&&(a.update(s*1e3/(u-r),100),r=u,s=0,c)){var l=performance.memory;c.update(l.usedJSHeapSize/1048576,l.jsHeapSizeLimit/1048576)}return u},update:function(){n=this.end()},domElement:t,setMode:i}};B.Panel=function(f,t,e){var i=1/0,n=0,r=Math.round,s=r(window.devicePixelRatio||1),a=80*s,o=48*s,c=3*s,u=2*s,l=3*s,d=15*s,h=74*s,m=30*s,g=document.createElement("canvas");g.width=a,g.height=o,g.style.cssText="width:80px;height:48px";var p=g.getContext("2d");return p.font="bold "+9*s+"px Helvetica,Arial,sans-serif",p.textBaseline="top",p.fillStyle=e,p.fillRect(0,0,a,o),p.fillStyle=t,p.fillText(f,c,u),p.fillRect(l,d,h,m),p.fillStyle=e,p.globalAlpha=.9,p.fillRect(l,d,h,m),{dom:g,update:function(A,R){i=Math.min(i,A),n=Math.max(n,A),p.fillStyle=e,p.globalAlpha=1,p.fillRect(0,0,a,d),p.fillStyle=t,p.fillText(r(A)+" "+f+" ("+r(i)+"-"+r(n)+")",c,u),p.drawImage(g,l+s,d,h-s,m,l,d,h-s,m),p.fillRect(l+h-s,d,s,m),p.fillStyle=e,p.globalAlpha=.9,p.fillRect(l+h-s,d,s,r((1-A/R)*m))}}};const lt=()=>{const f=document.getElementById("loader");f&&(f.addEventListener("transitionend",()=>f.remove()),f.style.opacity="0")};function ae(f,t){if(t===ye)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(t===Q||t===fe){let e=f.getIndex();if(e===null){const s=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o=2.0 are supported."));return}const c=new Kt(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,r){i.parse(t,e,n,r)})}}function dt(){let f={};return{get:function(t){return f[t]},add:function(t,e){f[t]=e},remove:function(t){delete f[t]},removeAll:function(){f={}}}}const T={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_DISPERSION:"KHR_materials_dispersion",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 ft{constructor(t){this.parser=t,this.name=T.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class St{constructor(t){this.parser=t,this.name=T.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class Mt{constructor(t){this.parser=t,this.name=T.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class bt{constructor(t){this.name=T.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,u=n.count,l=n.byteStride,d=new Uint8Array(a,o,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(u,l,d,n.mode,n.filter).then(function(h){return h.buffer}):s.ready.then(function(){const h=new ArrayBuffer(u*l);return s.decodeGltfBuffer(new Uint8Array(h),u,l,d,n.mode,n.filter),h})})}else return null}}class It{constructor(t){this.name=T.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=e.meshes[i.mesh];for(const c of n.primitives)if(c.mode!==y.TRIANGLES&&c.mode!==y.TRIANGLE_STRIP&&c.mode!==y.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=i.extensions[this.name].attributes,a=[],o={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],d=c[0].count,h=[];for(const m of l){const g=new j,p=new N,A=new ge,R=new N(1,1,1),E=new Ie(m.geometry,m.material,d);for(let x=0;x0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const jt=new j;class Kt{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new dt,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 i=!1,n=-1,r=!1,s=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=i&&o?parseInt(o[1],10):-1,r=a.indexOf("Firefox")>-1,s=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&n<17||r&&s<98?this.textureLoader=new Oe(this.options.manager):this.textureLoader=new Ce(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new he(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:i,userData:{}};return F(r,a,n),I(a,n),Promise.all(i._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let n=0,r=e.length;n{const o=this.associations.get(s);o!=null&&this.associations.set(a,o);for(const[c,u]of s.children.entries())r(u,a.children[c])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i=2&&p.setY(L,S[w*o+1]),o>=3&&p.setZ(L,S[w*o+2]),o>=4&&p.setW(L,S[w*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=m}return p})}loadTexture(t){const e=this.json,i=this.options,r=e.textures[t].source,s=e.images[r];let a=this.textureLoader;if(s.uri){const o=i.manager.getHandler(s.uri);o!==null&&(a=o)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,i){const n=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,i).then(function(u){u.flipY=!1,u.name=s.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const d=(r.samplers||{})[s.sampler]||{};return u.magFilter=le[d.magFilter]||Z,u.minFilter=le[d.minFilter]||Te,u.wrapS=ue[d.wrapS]||J,u.wrapT=ue[d.wrapT]||J,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==xe&&u.minFilter!==Z,n.associations.set(u,{textures:t}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const i=this,n=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(l=>l.clone());const s=n.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",c=!1;if(s.bufferView!==void 0)o=i.getDependency("bufferView",s.bufferView).then(function(l){c=!0;const d=new Blob([l],{type:s.mimeType});return o=a.createObjectURL(d),o});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(d,h){let m=d;e.isImageBitmapLoader===!0&&(m=function(g){const p=new ne(g);p.needsUpdate=!0,d(p)}),e.load(G.resolveURL(l,r.path),m,void 0,h)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),I(l,s),l.userData.mimeType=s.mimeType||Ut(s.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[t]=u,u}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),r.extensions[T.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[T.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(s);s=r.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,o)}}return n!==void 0&&(s.colorSpace=n),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,s=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,o.sizeAttenuation=!1,this.cache.add(a,o)),i=o}else if(t.isLine){const a="LineBasicMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new Be,X.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,this.cache.add(a,o)),i=o}if(n||r||s){let a="ClonedMaterial:"+i.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=i.clone(),r&&(o.vertexColors=!0),s&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(i))),i=o}t.material=i}getMaterialType(){return Re}loadMaterial(t){const e=this,i=this.json,n=this.extensions,r=i.materials[t];let s;const a={},o=r.extensions||{},c=[];if(o[T.KHR_MATERIALS_UNLIT]){const l=n[T.KHR_MATERIALS_UNLIT];s=l.getMaterialType(),c.push(l.extendParams(a,r,e))}else{const l=r.pbrMetallicRoughness||{};if(a.color=new D(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const d=l.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],O),a.opacity=d[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),s=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=Ue);const u=r.alphaMode||q.OPAQUE;if(u===q.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===q.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==k&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new pe(1,1),r.normalTexture.scale!==void 0)){const l=r.normalTexture.scale;a.normalScale.set(l,l)}if(r.occlusionTexture!==void 0&&s!==k&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==k){const l=r.emissiveFactor;a.emissive=new D().setRGB(l[0],l[1],l[2],O)}return r.emissiveTexture!==void 0&&s!==k&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,U)),Promise.all(c).then(function(){const l=new s(a);return r.name&&(l.name=r.name),I(l,r),e.associations.set(l,{materials:t}),r.extensions&&F(n,l,r),l})}createUniqueName(t){const e=je.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function r(a){return i[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return de(o,a,e)})}const s=[];for(let a=0,o=t.length;a0&&Gt(A,r),A.name=e.createUniqueName(r.name||"mesh_"+t),I(A,r),p.extensions&&F(n,A,p),e.assignFinalMaterial(A),l.push(A)}for(let h=0,m=l.length;h1?u=new z:c.length===1?u=c[0]:u=new Ae,u!==c[0])for(let l=0,d=c.length;l{const l=new Map;for(const[d,h]of n.associations)(d instanceof X||d instanceof ne)&&l.set(d,h);return u.traverse(d=>{const h=n.associations.get(d);h!=null&&l.set(d,h)}),l};return n.associations=c(r),r})}_createAnimationTracks(t,e,i,n,r){const s=[],a=t.name?t.name:t.uuid,o=[];C[r.path]===C.weights?t.traverse(function(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}):o.push(a);let c;switch(C[r.path]){case C.weights:c=re;break;case C.rotation:c=ie;break;case C.translation:case C.scale:c=se;break;default:switch(i.itemSize){case 1:c=re;break;case 2:case 3:default:c=se;break}break}const u=n.interpolation!==void 0?Ht[n.interpolation]:we,l=this._getArrayFromAccessor(i);for(let d=0,h=o.length;d{this.gltfLoader.load(t,n=>e(n.scene),void 0,n=>i(n))})}async loadAssets(t){const e=Object.entries(t).map(([r,s])=>this.loadGLB(s).then(a=>({key:r,asset:a}))),i=await Promise.all(e),n={};return i.forEach(({key:r,asset:s})=>{n[r]=s}),n}}const zt=async f=>{const t=new ot,e=new Ee(60,window.innerWidth/window.innerHeight,.1,1e3);e.position.set(0,6,0),e.lookAt(0,0,0);const i=new at({antialias:!0});i.setSize(window.innerWidth,window.innerHeight),document.getElementById(f)?.appendChild(i.domElement);const n=new ct(16777215,2);t.add(n);const r=new me(16777215,1);r.position.set(10,20,20),t.add(r);const s=new B;document.body.appendChild(s.dom);const a=new Xt,o={plane:"/plane.glb",middleObject:"/apollo13.glb"},c=(l,d,h)=>{const m=new $().setFromObject(l),g=new N;m.getSize(g);const p=new N;m.getCenter(p),l.position.sub(p);const A=h.fov*(Math.PI/180),R=2*Math.tan(A/2)*h.position.y,E=R*h.aspect,x=Math.ceil(R/g.z)+2,_=Math.ceil(E/g.x)+2,S=.01,w=g.x-S,b=g.z-S;d.children=d.children.filter(L=>!L.isTile);for(let L=0;L{const m=2*Math.tan(h.fov*Math.PI/180/2)*h.position.y*h.aspect;l.children.forEach(g=>{if(g.isTile&&(g.position.x-=.01,g.position.x<-m/2-d.x)){const p=d.x-.01,A=(Math.ceil(m/p)+2)*p;g.position.x+=A}})};try{const l=await a.loadAssets(o),d=l.plane,h=new $().setFromObject(d),m=new N;h.getSize(m),c(d,t,e);const g=l.middleObject;g.scale.set(.2,.2,.2),g.position.set(0,2,0),g.traverse(A=>{A.isMesh&&(A.frustumCulled=!1)}),t.add(g),window.addEventListener("resize",()=>{i.setSize(window.innerWidth,window.innerHeight),e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix(),c(d,t,e)});const p=()=>{requestAnimationFrame(p),g.rotation.x+=.01,u(t,m,e),i.render(t,e),s.update()};p(),lt()}catch(l){console.error("Error loading assets:",l)}};zt("app");