import{T as Pe,a as te,b as Ae,L as De,c as j,F as Te,M,V as xe,C as F,d as I,S as z,e as Fe,P as He,D as Re,f as W,g as D,I as ke,Q as Ee,h as Ge,O as Le,i as ve,j as Be,B as Y,k as Ue,l as we,N as je,m as Ke,n as Ve,o as ne,p as _e,R as se,q as Xe,r as ze,s as We,t as Q,u as qe,v as ye,w as Ye,x as U,y as Qe,z as Ze,A as Je,E as $e,G as et,H as tt,J as nt,K as st,U as Z,W as rt,X as it,Y as Se,Z as ot,_ as at,$ as ct,a0 as lt,a1 as Me,a2 as ut,a3 as ae,a4 as ce,a5 as le,a6 as ue,a7 as de,a8 as dt,a9 as ft,aa as be,ab as ht,ac as pt,ad as mt,ae as gt}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 K=function(){var d=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(++d%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}};K.Panel=function(d,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,f=15*s,h=74*s,m=30*s,T=document.createElement("canvas");T.width=a,T.height=o,T.style.cssText="width:80px;height:48px";var p=T.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(d,c,u),p.fillRect(l,f,h,m),p.fillStyle=e,p.globalAlpha=.9,p.fillRect(l,f,h,m),{dom:T,update:function(g,R){i=Math.min(i,g),n=Math.max(n,g),p.fillStyle=e,p.globalAlpha=1,p.fillRect(0,0,a,f),p.fillStyle=t,p.fillText(r(g)+" "+d+" ("+r(i)+"-"+r(n)+")",c,u),p.drawImage(T,l+s,f,h-s,m,l,f,h-s,m),p.fillRect(l+h-s,f,s,m),p.fillStyle=e,p.globalAlpha=.9,p.fillRect(l+h-s,f,s,r((1-g/R)*m))}}};function fe(d,t){if(t===Pe)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),d;if(t===te||t===Ae){let e=d.getIndex();if(e===null){const s=[],a=d.getAttribute("position");if(a!==void 0){for(let o=0;o=2.0 are supported."));return}const c=new Qt(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 Tt(){let d={};return{get:function(t){return d[t]},add:function(t,e){d[t]=e},remove:function(t){delete d[t]},removeAll:function(){d={}}}}const A={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 xt{constructor(t){this.parser=t,this.name=A.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 Pt{constructor(t){this.parser=t,this.name=A.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 Dt{constructor(t){this.parser=t,this.name=A.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 Ft{constructor(t){this.name=A.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,f=new Uint8Array(a,o,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(u,l,f,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,f,n.mode,n.filter),h})})}else return null}}class Ht{constructor(t){this.name=A.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!==L.TRIANGLES&&c.mode!==L.TRIANGLE_STRIP&&c.mode!==L.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],f=c[0].count,h=[];for(const m of l){const T=new W,p=new D,g=new Ee,R=new D(1,1,1),E=new ke(m.geometry,m.material,f);for(let x=0;x0||d.search(/^data\:image\/jpeg/)===0?"image/jpeg":d.search(/\.webp($|\?)/i)>0||d.search(/^data\:image\/webp/)===0?"image/webp":d.search(/\.ktx2($|\?)/i)>0||d.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Yt=new W;class Qt{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Tt,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 ve(this.options.manager):this.textureLoader=new Be(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Te(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 P(r,a,n),b(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(O,N[_*o+1]),o>=3&&p.setZ(O,N[_*o+2]),o>=4&&p.setW(O,N[_*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 f=(r.samplers||{})[s.sampler]||{};return u.magFilter=pe[f.magFilter]||ne,u.minFilter=pe[f.minFilter]||we,u.wrapS=me[f.wrapS]||se,u.wrapT=me[f.wrapT]||se,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==_e&&u.minFilter!==ne,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 f=new Blob([l],{type:s.mimeType});return o=a.createObjectURL(f),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(f,h){let m=f;e.isImageBitmapLoader===!0&&(m=function(T){const p=new ae(T);p.needsUpdate=!0,f(p)}),e.load(j.resolveURL(l,r.path),m,void 0,h)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),b(l,s),l.userData.mimeType=s.mimeType||qt(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[A.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[A.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(s);s=r.extensions[A.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 We,Q.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 qe,Q.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 ye}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[A.KHR_MATERIALS_UNLIT]){const l=n[A.KHR_MATERIALS_UNLIT];s=l.getMaterialType(),c.push(l.extendParams(a,r,e))}else{const l=r.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const f=l.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],I),a.opacity=f[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,z)),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(f){return f.getMaterialType&&f.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=Ye);const u=r.alphaMode||$.OPAQUE;if(u===$.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===$.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==U&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new xe(1,1),r.normalTexture.scale!==void 0)){const l=r.normalTexture.scale;a.normalScale.set(l,l)}if(r.occlusionTexture!==void 0&&s!==U&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==U){const l=r.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],I)}return r.emissiveTexture!==void 0&&s!==U&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,z)),Promise.all(c).then(function(){const l=new s(a);return r.name&&(l.name=r.name),b(l,r),e.associations.set(l,{materials:t}),r.extensions&&P(n,l,r),l})}createUniqueName(t){const e=Qe.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[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return ge(o,a,e)})}const s=[];for(let a=0,o=t.length;a0&&zt(g,r),g.name=e.createUniqueName(r.name||"mesh_"+t),b(g,r),p.extensions&&P(n,g,p),e.assignFinalMaterial(g),l.push(g)}for(let h=0,m=l.length;h1?u=new Z:c.length===1?u=c[0]:u=new Le,u!==c[0])for(let l=0,f=c.length;l{const l=new Map;for(const[f,h]of n.associations)(f instanceof Q||f instanceof ae)&&l.set(f,h);return u.traverse(f=>{const h=n.associations.get(f);h!=null&&l.set(f,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(f){f.morphTargetInfluences&&o.push(f.name?f.name:f.uuid)}):o.push(a);let c;switch(C[r.path]){case C.weights:c=le;break;case C.rotation:c=ue;break;case C.translation:case C.scale:c=ce;break;default:switch(i.itemSize){case 1:c=le;break;case 2:case 3:default:c=ce;break}break}const u=n.interpolation!==void 0?Kt[n.interpolation]:Me,l=this._getArrayFromAccessor(i);for(let f=0,h=o.length;f{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 $t=d=>{const t=document.getElementById(d);t&&(t.style.opacity="0",setTimeout(()=>t.style.display="none",500))};let V=window.innerHeight,X=window.innerWidth,H,w,oe,S,G={};const en={plane:"/plane.glb",middleObject:"/apollo13.glb"},tn=async()=>{G=await new Jt().loadAssets(en)},Oe=(d,t,e)=>{const i=new be().setFromObject(d),n=new D;i.getSize(n);const r=e.right-e.left,s=e.top-e.bottom,a=Math.ceil(r/n.x)+1,o=Math.ceil(s/n.z);for(let c=0;c{const t=X/V,e=5;S=new pt,oe=new K,w=new Se(e*t/-2,e*t/2,e/2,e/-2,.1,1e4),w.position.set(0,10,0),w.lookAt(0,0,0),H=new mt({antialias:!0,alpha:!0}),H.setSize(X,V),H.shadowMap.enabled=!0;const i=document.getElementById(d);i&&i.appendChild(H.domElement),document.body.appendChild(oe.dom),window.addEventListener("resize",rn,!1);const n=G.middleObject;n.scale.set(.2,.2,.2),n.position.set(0,2,0),S.add(n),$t("loader")},sn=(d,t)=>{let e;return(...i)=>{clearTimeout(e),e=setTimeout(()=>d(...i),t)}},rn=sn(()=>{V=window.innerHeight,X=window.innerWidth;const d=X/V,t=5;w.left=-5*d/2,w.right=t*d/2,w.top=t/2,w.bottom=-5/2,w.updateProjectionMatrix(),H.setSize(X,V),on()},100),on=()=>{S.children=S.children.filter(t=>!t.isPlaneTile);const d=G.plane;d&&Oe(d,S,w)},an=(d,t,e)=>{const i=e.right-e.left;d.children.forEach(n=>{n.isPlaneTile&&t&&(n.position.x-=.005,n.position.x<-i/2-t.x/2&&(n.position.x+=i+t.x))})},cn=()=>{const d=new gt(16777215,2);S.add(d);const t=new Re(16777215,1);t.position.set(10,20,20),S.add(t)},Ce=d=>{requestAnimationFrame(()=>Ce(d)),an(S,d,w),G.middleObject.rotation.x+=.02,G.middleObject.rotation.y+=.01,oe.update(),H.render(S,w)},ln=async()=>{await tn(),await nn("app"),cn();const d=Oe(G.plane,S,w);Ce(d)};await ln();