@needle-tools/engine 4.7.3-next.1603bb0 → 4.7.3-next.3bba8e3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gltf-progressive-BMJtMiwp.js +1204 -0
- package/dist/gltf-progressive-DMJSXxbo.umd.cjs +8 -0
- package/dist/gltf-progressive-zQ2CaD2H.min.js +8 -0
- package/dist/{needle-engine.bundle-CL5SiInU.js → needle-engine.bundle-BJYLZI6V.js} +4 -4
- package/dist/{needle-engine.bundle-6bPQlS1q.min.js → needle-engine.bundle-B_whWHGK.min.js} +3 -3
- package/dist/{needle-engine.bundle-Dm9L7JpU.umd.cjs → needle-engine.bundle-Bd2symsR.umd.cjs} +4 -4
- package/dist/needle-engine.js +3 -3
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_lods.js +1 -1
- package/lib/engine/engine_lods.js.map +1 -1
- package/package.json +2 -2
- package/src/engine/engine_lods.ts +3 -3
- package/dist/gltf-progressive-BCZdu3Gc.min.js +0 -8
- package/dist/gltf-progressive-C6QbvrB4.umd.cjs +0 -8
- package/dist/gltf-progressive-CCddD-3B.js +0 -1159
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";var Xe=Object.defineProperty;var Ge=o=>{throw TypeError(o)};var Ke=(o,e,t)=>e in o?Xe(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var u=(o,e,t)=>Ke(o,typeof e!="symbol"?e+"":e,t),Be=(o,e,t)=>e.has(o)||Ge("Cannot "+t);var x=(o,e,t)=>(Be(o,e,"read from private field"),t?t.call(o):e.get(o)),Y=(o,e,t)=>e.has(o)?Ge("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),z=(o,e,t,s)=>(Be(o,e,"write to private field"),s?s.call(o,t):e.set(o,t),t);const y=require("./three-B_hneGZr.umd.cjs"),te=require("./three-examples-DUcCNw9s.umd.cjs"),Ye="";globalThis.GLTF_PROGRESSIVE_VERSION=Ye;console.debug("[gltf-progressive] version -");let q="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",se="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";const He=q,Qe=se,Re=new URL(q+"draco_decoder.js");Re.searchParams.append("range","true");fetch(Re,{method:"GET",headers:{Range:"bytes=0-1"}}).catch(o=>{console.debug(`Failed to fetch remote Draco decoder from ${q} (offline: ${typeof navigator<"u"?navigator.onLine:"unknown"})`),q===He&&Ie("./include/draco/"),se===Qe&&Fe("./include/ktx2/")}).finally(()=>{Ue()});function Ie(o){q=o,k&&k[be]!=q?(console.debug("Updating Draco decoder path to "+o),k[be]=q,k.setDecoderPath(q),k.preload()):console.debug("Setting Draco decoder path to "+o)}function Fe(o){se=o,U&&U.transcoderPath!=se?(console.debug("Updating KTX2 transcoder path to "+o),U.setTranscoderPath(se),U.init()):console.debug("Setting KTX2 transcoder path to "+o)}const be=Symbol("dracoDecoderPath");let k,ye,U;function Ue(){k||(k=new te.DRACOLoader,k[be]=q,k.setDecoderPath(q),k.setDecoderConfig({type:"js"}),k.preload()),U||(U=new te.KTX2Loader,U.setTranscoderPath(se),U.init()),ye||(ye=te.MeshoptDecoder)}function Te(o){return Ue(),o?U.detectSupport(o):o!==null&&console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"),{dracoLoader:k,ktx2Loader:U,meshoptDecoder:ye}}function Ae(o){o.dracoLoader||o.setDRACOLoader(k),o.ktx2Loader||o.setKTX2Loader(U),o.meshoptDecoder||o.setMeshoptDecoder(ye)}const Se=new WeakMap;function Ce(o,e){let t=Se.get(o);t?t=Object.assign(t,e):t=e,Se.set(o,t)}const Me=te.GLTFLoader.prototype.load;function je(...o){const e=Se.get(this);let t=o[0];const s=new URL(t,window.location.href);if(s.hostname.endsWith("needle.tools")){const r=(e==null?void 0:e.progressive)!==void 0?e.progressive:!0,i=e!=null&&e.usecase?e.usecase:"default";r?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${i}`:this.requestHeader.Accept=`*/*;usecase=${i}`,t=s.toString()}return o[0]=t,Me==null?void 0:Me.call(this,...o)}te.GLTFLoader.prototype.load=je;de("debugprogressive");function de(o){if(typeof window>"u")return!1;const t=new URL(window.location.href).searchParams.get(o);return t==null||t==="0"||t==="false"?!1:t===""?!0:t}function Je(o,e){if(e===void 0||e.startsWith("./")||e.startsWith("http")||o===void 0)return e;const t=o.lastIndexOf("/");if(t>=0){const s=o.substring(0,t+1);for(;s.endsWith("/")&&e.startsWith("/");)e=e.substring(1);return s+e}return e}let oe;function Ze(){return oe!==void 0||(oe=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),de("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",oe)),oe}function et(){if(typeof window>"u")return!1;const o=new URL(window.location.href),e=o.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(o.hostname);return o.hostname==="127.0.0.1"||e}class tt{constructor(e=100,t={}){u(this,"_running",new Map);u(this,"_queue",[]);u(this,"debug",!1);u(this,"tick",()=>{this.internalUpdate(),setTimeout(this.tick,10)});this.maxConcurrent=e,this.debug=t.debug??!1,window.requestAnimationFrame(this.tick)}slot(e){return this.debug&&console.debug(`[PromiseQueue]: Requesting slot for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`),new Promise(t=>{this._queue.push({key:e,resolve:t})})}add(e,t){this._running.has(e)||(this._running.set(e,t),t.finally(()=>{this._running.delete(e),this.debug&&console.debug(`[PromiseQueue]: Promise for key ${e} finished, running: ${this._running.size}, waiting: ${this._queue.length}`)}),this.debug&&console.debug(`[PromiseQueue]: Adding promise for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`))}internalUpdate(){const e=this.maxConcurrent-this._running.size;for(let t=0;t<e&&this._queue.length>0;t++){this.debug&&console.debug(`[PromiseQueue]: Running ${this._running.size} promises, waiting for ${this._queue.length} more.`);const{key:s,resolve:n}=this._queue.shift();n({use:r=>this.add(s,r)})}}}const st=typeof window>"u"&&typeof document>"u",Pe=Symbol("needle:raycast-mesh");function ie(o){return(o==null?void 0:o[Pe])instanceof y.BufferGeometry?o[Pe]:null}function rt(o,e){if((o.type==="Mesh"||o.type==="SkinnedMesh")&&!ie(o)){const s=nt(e);s.userData={isRaycastMesh:!0},o[Pe]=s}}function it(o=!0){if(o){if(ae)return;const e=ae=y.Mesh.prototype.raycast;y.Mesh.prototype.raycast=function(t,s){const n=this,r=ie(n);let i;r&&n.isMesh&&(i=n.geometry,n.geometry=r),e.call(this,t,s),i&&(n.geometry=i)}}else{if(!ae)return;y.Mesh.prototype.raycast=ae,ae=null}}let ae=null;function nt(o){const e=new y.BufferGeometry;for(const t in o.attributes)e.setAttribute(t,o.getAttribute(t));return e.setIndex(o.getIndex()),e}const Q=new Array,w=de("debugprogressive");let pe,ee=-1;if(w){let o=function(){ee+=1,ee>=e&&(ee=-1),console.log(`Toggle LOD level [${ee}]`)},e=6;window.addEventListener("keyup",t=>{t.key==="p"&&o(),t.key==="w"&&(pe=!pe,console.log(`Toggle wireframe [${pe}]`));const s=parseInt(t.key);!isNaN(s)&&s>=0&&(ee=s,console.log(`Set LOD level to [${ee}]`))})}function Ne(o){if(w)if(Array.isArray(o))for(const e of o)Ne(e);else o&&"wireframe"in o&&(o.wireframe=pe===!0)}const W="NEEDLE_progressive",De=Symbol("needle-progressive-texture"),M=class M{constructor(e,t){u(this,"parser");u(this,"url");u(this,"_isLoadingMesh");u(this,"loadMesh",e=>{var s,n;if(this._isLoadingMesh)return null;const t=(n=(s=this.parser.json.meshes[e])==null?void 0:s.extensions)==null?void 0:n[W];return t?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",e).then(r=>{var i;return this._isLoadingMesh=!1,r&&M.registerMesh(this.url,t.guid,r,(i=t.lods)==null?void 0:i.length,0,t),r})):null});w&&console.log("Progressive extension registered for",t),this.parser=e,this.url=t}get name(){return W}static getMeshLODExtension(e){const t=this.getAssignedLODInformation(e);return t!=null&&t.key?this.lodInfos.get(t.key):null}static getPrimitiveIndex(e){var s;const t=(s=this.getAssignedLODInformation(e))==null?void 0:s.index;return t??-1}static getMaterialMinMaxLODsCount(e,t){const s=this,n="LODS:minmax",r=e[n];if(r!=null)return r;if(t||(t={min_count:1/0,max_count:0,lods:[]}),Array.isArray(e)){for(const a of e)this.getMaterialMinMaxLODsCount(a,t);return e[n]=t,t}if(w==="verbose"&&console.log("getMaterialMinMaxLODsCount",e),e.type==="ShaderMaterial"||e.type==="RawShaderMaterial"){const a=e;for(const l of Object.keys(a.uniforms)){const c=a.uniforms[l].value;(c==null?void 0:c.isTexture)===!0&&i(c,t)}}else if(e.isMaterial)for(const a of Object.keys(e)){const l=e[a];(l==null?void 0:l.isTexture)===!0&&i(l,t)}return e[n]=t,t;function i(a,l){const c=s.getAssignedLODInformation(a);if(c){const d=s.lodInfos.get(c.key);if(d&&d.lods){l.min_count=Math.min(l.min_count,d.lods.length),l.max_count=Math.max(l.max_count,d.lods.length);for(let p=0;p<d.lods.length;p++){const f=d.lods[p];f.width&&(l.lods[p]=l.lods[p]||{min_height:1/0,max_height:0},l.lods[p].min_height=Math.min(l.lods[p].min_height,f.height),l.lods[p].max_height=Math.max(l.lods[p].max_height,f.height))}}}}}static hasLODLevelAvailable(e,t){var r;if(Array.isArray(e)){for(const i of e)if(this.hasLODLevelAvailable(i,t))return!0;return!1}if(e.isMaterial===!0){for(const i of Object.keys(e)){const a=e[i];if(a&&a.isTexture&&this.hasLODLevelAvailable(a,t))return!0}return!1}else if(e.isGroup===!0){for(const i of e.children)if(i.isMesh===!0&&this.hasLODLevelAvailable(i,t))return!0}let s,n;if(e.isMesh?s=e.geometry:(e.isBufferGeometry||e.isTexture)&&(s=e),s&&(r=s==null?void 0:s.userData)!=null&&r.LODS){const i=s.userData.LODS;if(n=this.lodInfos.get(i.key),t===void 0)return n!=null;if(n)return Array.isArray(n.lods)?t<n.lods.length:t===0}return!1}static assignMeshLOD(e,t){var s;if(!e)return Promise.resolve(null);if(e instanceof y.Mesh||e.isMesh===!0){const n=e.geometry,r=this.getAssignedLODInformation(n);if(!r)return Promise.resolve(null);for(const i of Q)(s=i.onBeforeGetLODMesh)==null||s.call(i,e,t);return e["LOD:requested level"]=t,M.getOrLoadLOD(n,t).then(i=>{if(Array.isArray(i)){const a=r.index||0;i=i[a]}return e["LOD:requested level"]===t&&(delete e["LOD:requested level"],i&&n!=i&&((i==null?void 0:i.isBufferGeometry)?e.geometry=i:w&&console.error("Invalid LOD geometry",i))),i}).catch(i=>(console.error("Error loading mesh LOD",e,i),null))}else w&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",e);return Promise.resolve(null)}static assignTextureLOD(e,t=0){if(!e)return Promise.resolve(null);if(e.isMesh===!0){const s=e;if(Array.isArray(s.material)){const n=new Array;for(const r of s.material){const i=this.assignTextureLOD(r,t);n.push(i)}return Promise.all(n).then(r=>{const i=new Array;for(const a of r)Array.isArray(a)&&i.push(...a);return i})}else return this.assignTextureLOD(s.material,t)}if(e.isMaterial===!0){const s=e,n=[],r=new Array;if(s.uniforms&&(s.isRawShaderMaterial||s.isShaderMaterial===!0)){const i=s;for(const a of Object.keys(i.uniforms)){const l=i.uniforms[a].value;if((l==null?void 0:l.isTexture)===!0){const c=this.assignTextureLODForSlot(l,t,s,a).then(d=>(d&&i.uniforms[a].value!=d&&(i.uniforms[a].value=d,i.uniformsNeedUpdate=!0),d));n.push(c),r.push(a)}}}else for(const i of Object.keys(s)){const a=s[i];if((a==null?void 0:a.isTexture)===!0){const l=this.assignTextureLODForSlot(a,t,s,i);n.push(l),r.push(i)}}return Promise.all(n).then(i=>{const a=new Array;for(let l=0;l<i.length;l++){const c=i[l],d=r[l];c&&c.isTexture===!0?a.push({material:s,slot:d,texture:c,level:t}):a.push({material:s,slot:d,texture:null,level:t})}return a})}if(e instanceof y.Texture||e.isTexture===!0){const s=e;return this.assignTextureLODForSlot(s,t,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(e,t,s,n){return(e==null?void 0:e.isTexture)!==!0?Promise.resolve(null):n==="glyphMap"?Promise.resolve(e):M.getOrLoadLOD(e,t).then(r=>{if(Array.isArray(r))return null;if((r==null?void 0:r.isTexture)===!0){if(r!=e&&s&&n){const i=s[n];if(i&&!w){const a=this.getAssignedLODInformation(i);if(a&&(a==null?void 0:a.level)<t)return w==="verbose"&&console.warn("Assigned texture level is already higher: ",a.level,t,s,i,r),null}s[n]=r}return r}else w=="verbose"&&console.warn("No LOD found for",e,t);return null}).catch(r=>(console.error("Error loading LOD",e,r),null))}afterRoot(e){var t,s;return w&&console.log("AFTER",this.url,e),(t=this.parser.json.textures)==null||t.forEach((n,r)=>{var i;if(n!=null&&n.extensions){const a=n==null?void 0:n.extensions[W];if(a){if(!a.lods){w&&console.warn("Texture has no LODs",a);return}let l=!1;for(const c of this.parser.associations.keys())if(c.isTexture===!0){const d=this.parser.associations.get(c);(d==null?void 0:d.textures)===r&&(l=!0,M.registerTexture(this.url,c,(i=a.lods)==null?void 0:i.length,r,a))}l||this.parser.getDependency("texture",r).then(c=>{var d;c&&M.registerTexture(this.url,c,(d=a.lods)==null?void 0:d.length,r,a)})}}}),(s=this.parser.json.meshes)==null||s.forEach((n,r)=>{if(n!=null&&n.extensions){const i=n==null?void 0:n.extensions[W];if(i&&i.lods){for(const a of this.parser.associations.keys())if(a.isMesh){const l=this.parser.associations.get(a);(l==null?void 0:l.meshes)===r&&M.registerMesh(this.url,i.guid,a,i.lods.length,l.primitives,i)}}}}),null}static async getOrLoadLOD(e,t){var a,l,c,d;const s=w=="verbose",n=e.userData.LODS;if(!n)return null;const r=n==null?void 0:n.key;let i;if(e.isTexture===!0){const p=e;p.source&&p.source[De]&&(i=p.source[De])}if(i||(i=M.lodInfos.get(r)),i){if(t>0){let v=!1;const b=Array.isArray(i.lods);if(b&&t>=i.lods.length?v=!0:b||(v=!0),v)return this.lowresCache.get(r)}const p=Array.isArray(i.lods)?(a=i.lods[t])==null?void 0:a.path:i.lods;if(!p)return w&&!i["missing:uri"]&&(i["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+t,i)),null;const f=Je(n.url,p);if(f.endsWith(".glb")||f.endsWith(".gltf")){if(!i.guid)return console.warn("missing pointer for glb/gltf texture",i),null;const v=f+"_"+i.guid,b=this.previouslyLoaded.get(v);if(b!==void 0){s&&console.log(`LOD ${t} was already loading/loaded: ${v}`);let h=await b.catch(A=>(console.error(`Error loading LOD ${t} from ${f}
|
|
2
|
+
`,A),null)),_=!1;if(h==null||(h instanceof y.Texture&&e instanceof y.Texture?(l=h.image)!=null&&l.data||(c=h.source)!=null&&c.data?h=this.copySettings(e,h):(_=!0,this.previouslyLoaded.delete(v)):h instanceof y.BufferGeometry&&e instanceof y.BufferGeometry&&((d=h.attributes.position)!=null&&d.array||(_=!0,this.previouslyLoaded.delete(v)))),!_)return h}const T=await this.queue.slot(f);if(!T.use)return w&&console.log(`LOD ${t} was aborted: ${f}`),null;const S=i,R=new Promise(async(h,_)=>{const A=new te.GLTFLoader;Ae(A),w&&(await new Promise(O=>setTimeout(O,1e3)),s&&console.warn("Start loading (delayed) "+f,S.guid));let N=f;if(S&&Array.isArray(S.lods)){const O=S.lods[t];O.hash&&(N+="?v="+O.hash)}const P=await A.loadAsync(N).catch(O=>(console.error(`Error loading LOD ${t} from ${f}
|
|
3
|
+
`,O),h(null)));if(!P)return h(null);const Z=P.parser;s&&console.log("Loading finished "+f,S.guid);let C=0;if(P.parser.json.textures){let O=!1;for(const m of P.parser.json.textures){if(m!=null&&m.extensions){const g=m==null?void 0:m.extensions[W];if(g!=null&&g.guid&&g.guid===S.guid){O=!0;break}}C++}if(O){let m=await Z.getDependency("texture",C);return m&&M.assignLODInformation(n.url,m,r,t,void 0),s&&console.log('change "'+e.name+'" → "'+m.name+'"',f,C,m,v),e instanceof y.Texture&&(m=this.copySettings(e,m)),m&&(m.guid=S.guid),h(m)}else w&&console.warn("Could not find texture with guid",S.guid,P.parser.json)}if(C=0,P.parser.json.meshes){let O=!1;for(const m of P.parser.json.meshes){if(m!=null&&m.extensions){const g=m==null?void 0:m.extensions[W];if(g!=null&&g.guid&&g.guid===S.guid){O=!0;break}}C++}if(O){const m=await Z.getDependency("mesh",C);if(s&&console.log(`Loaded Mesh "${m.name}"`,f,C,m,v),m.isMesh===!0){const g=m.geometry;return M.assignLODInformation(n.url,g,r,t,0),h(g)}else{const g=new Array;for(let D=0;D<m.children.length;D++){const G=m.children[D];if(G.isMesh===!0){const B=G.geometry;M.assignLODInformation(n.url,B,r,t,D),g.push(B)}}return h(g)}}else w&&console.warn("Could not find mesh with guid",S.guid,P.parser.json)}return h(null)});return this.previouslyLoaded.set(v,R),T.use(R),await R}else if(e instanceof y.Texture){s&&console.log("Load texture from uri: "+f);const b=await new y.TextureLoader().loadAsync(f);return b?(b.guid=i.guid,b.flipY=!1,b.needsUpdate=!0,b.colorSpace=e.colorSpace,s&&console.log(i,b)):w&&console.warn("failed loading",f),b}}else w&&console.warn(`Can not load LOD ${t}: no LOD info found for "${r}" ${e.name}`,e.type);return null}static assignLODInformation(e,t,s,n,r){if(!t)return;t.userData||(t.userData={});const i=new ot(e,s,n,r);t.userData.LODS=i}static getAssignedLODInformation(e){var t;return((t=e==null?void 0:e.userData)==null?void 0:t.LODS)||null}static copySettings(e,t){return t?(w&&console.warn(`Copy texture settings
|
|
4
|
+
`,e.uuid,`
|
|
5
|
+
`,t.uuid),t=t.clone(),t.offset=e.offset,t.repeat=e.repeat,t.colorSpace=e.colorSpace,t.magFilter=e.magFilter,t.minFilter=e.minFilter,t.wrapS=e.wrapS,t.wrapT=e.wrapT,t.flipY=e.flipY,t.anisotropy=e.anisotropy,t.mipmaps||(t.generateMipmaps=e.generateMipmaps),t):e}};u(M,"registerTexture",(e,t,s,n,r)=>{if(w&&console.log("> Progressive: register texture",n,t.name,t.uuid,t,r),!t){w&&console.error("gltf-progressive: Register texture without texture");return}t.source&&(t.source[De]=r);const i=r.guid;M.assignLODInformation(e,t,i,s,n),M.lodInfos.set(i,r),M.lowresCache.set(i,t)}),u(M,"registerMesh",(e,t,s,n,r,i)=>{var c;const a=s.geometry;if(!a){w&&console.warn("gltf-progressive: Register mesh without geometry");return}a.userData||(a.userData={}),w&&console.log("> Progressive: register mesh "+s.name,{index:r,uuid:s.uuid},i,s),M.assignLODInformation(e,a,t,n,r),M.lodInfos.set(t,i);let l=M.lowresCache.get(t);l?l.push(s.geometry):l=[s.geometry],M.lowresCache.set(t,l),n>0&&!ie(s)&&rt(s,a);for(const d of Q)(c=d.onRegisteredNewMesh)==null||c.call(d,s,i)}),u(M,"lodInfos",new Map),u(M,"previouslyLoaded",new Map),u(M,"lowresCache",new Map),u(M,"queue",new tt(100,{debug:w!=!1}));let F=M;class ot{constructor(e,t,s,n){u(this,"url");u(this,"key");u(this,"level");u(this,"index");this.url=e,this.key=t,this.level=s,n!=null&&(this.index=n)}}class me{constructor(e,t){u(this,"frame_start");u(this,"frame_capture_end");u(this,"ready");u(this,"_resolve");u(this,"_signal");u(this,"_resolved",!1);u(this,"_addedCount",0);u(this,"_resolvedCount",0);u(this,"_awaiting",[]);u(this,"_maxPromisesPerObject",1);u(this,"_currentFrame",0);u(this,"_seen",new WeakMap);var r;const n=Math.max(t.frames??2,2);this.frame_start=e,this.frame_capture_end=e+n,this.ready=new Promise(i=>{this._resolve=i}),this.ready.finally(()=>{this._resolved=!0,this._awaiting.length=0}),this._signal=t.signal,(r=this._signal)==null||r.addEventListener("abort",()=>{this.resolveNow()}),this._maxPromisesPerObject=Math.max(1,t.maxPromisesPerObject??1)}get awaitedCount(){return this._addedCount}get resolvedCount(){return this._resolvedCount}get currentlyAwaiting(){return this._awaiting.length}update(e){var t;this._currentFrame=e,((t=this._signal)!=null&&t.aborted||this._currentFrame>this.frame_capture_end&&this._awaiting.length===0)&&this.resolveNow()}add(e,t,s){if(this._resolved){w&&console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");return}if(!(this._currentFrame>this.frame_capture_end)){if(this._maxPromisesPerObject>=1)if(this._seen.has(t)){let n=this._seen.get(t);if(n>=this._maxPromisesPerObject){w&&console.warn("PromiseGroup: Already awaiting object ignoring new promise for it.");return}this._seen.set(t,n+1)}else this._seen.set(t,1);this._awaiting.push(s),this._addedCount++,s.finally(()=>{this._resolvedCount++,this._awaiting.splice(this._awaiting.indexOf(s),1)})}}resolveNow(){var e,t;this._resolved||(t=this._resolve)==null||t.call(this,{awaited_count:this._addedCount,resolved_count:this._resolvedCount,cancelled:((e=this._signal)==null?void 0:e.aborted)??!1})}}u(me,"addPromise",(e,t,s,n)=>{n.forEach(r=>{r.add(e,t,s)})});const I=de("debugprogressive"),at=de("noprogressive"),ve=Symbol("Needle:LODSManager"),Oe=Symbol("Needle:LODState"),H=Symbol("Needle:CurrentLOD"),E={mesh_lod:-1,texture_lod:-1};var L,$,X,Le,j,re,xe,K;let ue=(L=class{constructor(e,t){u(this,"renderer");u(this,"context");u(this,"projectionScreenMatrix",new y.Matrix4);u(this,"targetTriangleDensity",2e5);u(this,"skinnedMeshAutoUpdateBoundsInterval",30);u(this,"updateInterval","auto");Y(this,$,1);u(this,"pause",!1);u(this,"manual",!1);u(this,"_newPromiseGroups",[]);u(this,"_promiseGroupIds",0);u(this,"_lodchangedlisteners",[]);Y(this,X);Y(this,Le,new y.Clock);Y(this,j,0);Y(this,re,0);Y(this,xe,0);Y(this,K,0);u(this,"_fpsBuffer",[60,60,60,60,60]);u(this,"_sphere",new y.Sphere);u(this,"_tempBox",new y.Box3);u(this,"_tempBox2",new y.Box3);u(this,"tempMatrix",new y.Matrix4);u(this,"_tempWorldPosition",new y.Vector3);u(this,"_tempBoxSize",new y.Vector3);u(this,"_tempBox2Size",new y.Vector3);this.renderer=e,this.context={...t}}static getObjectLODState(e){return e[Oe]}static addPlugin(e){Q.push(e)}static removePlugin(e){const t=Q.indexOf(e);t>=0&&Q.splice(t,1)}static get(e,t){if(e[ve])return console.debug("[gltf-progressive] LODsManager already exists for this renderer"),e[ve];const s=new L(e,{engine:"unknown",...t});return e[ve]=s,s}get plugins(){return Q}awaitLoading(e){const t=this._promiseGroupIds++,s=new me(x(this,j),{...e});this._newPromiseGroups.push(s);const n=performance.now();return s.ready.finally(()=>{const r=this._newPromiseGroups.indexOf(s);r>=0&&(this._newPromiseGroups.splice(r,1),et()&&performance.measure("LODsManager:awaitLoading",{start:n,detail:{id:t,name:e==null?void 0:e.name,awaited:s.awaitedCount,resolved:s.resolvedCount}}))}),s.ready}_postprocessPromiseGroups(){if(this._newPromiseGroups.length!==0)for(let e=this._newPromiseGroups.length-1;e>=0;e--)this._newPromiseGroups[e].update(x(this,j))}addEventListener(e,t){e==="changed"&&this._lodchangedlisteners.push(t)}removeEventListener(e,t){if(e==="changed"){const s=this._lodchangedlisteners.indexOf(t);s>=0&&this._lodchangedlisteners.splice(s,1)}}enable(){if(x(this,X))return;console.debug("[gltf-progressive] Enabling LODsManager for renderer");let e=0;z(this,X,this.renderer.render);const t=this;Te(this.renderer),this.renderer.render=function(s,n){const r=t.renderer.getRenderTarget();(r==null||"isXRRenderTarget"in r&&r.isXRRenderTarget)&&(e=0,z(t,j,x(t,j)+1),z(t,re,x(t,Le).getDelta()),z(t,xe,x(t,xe)+x(t,re)),t._fpsBuffer.shift(),t._fpsBuffer.push(1/x(t,re)),z(t,K,t._fpsBuffer.reduce((a,l)=>a+l)/t._fpsBuffer.length),I&&x(t,j)%200===0&&console.log("FPS",Math.round(x(t,K)),"Interval:",x(t,$)));const i=e++;x(t,X).call(this,s,n),t.onAfterRender(s,n,i)}}disable(){x(this,X)&&(console.debug("[gltf-progressive] Disabling LODsManager for renderer"),this.renderer.render=x(this,X),z(this,X,void 0))}update(e,t){this.internalUpdate(e,t)}onAfterRender(e,t,s){if(this.pause)return;const r=this.renderer.renderLists.get(e,0).opaque;let i=!0;if(r.length===1){const a=r[0].material;(a.name==="EffectMaterial"||a.name==="CopyShader")&&(i=!1)}if((t.parent&&t.parent.type==="CubeCamera"||s>=1&&t.type==="OrthographicCamera")&&(i=!1),i){if(at||(this.updateInterval==="auto"?x(this,K)<40&&x(this,$)<10?(z(this,$,x(this,$)+1),I&&console.warn("↓ Reducing LOD updates",x(this,$),x(this,K).toFixed(0))):x(this,K)>=60&&x(this,$)>1&&(z(this,$,x(this,$)-1),I&&console.warn("↑ Increasing LOD updates",x(this,$),x(this,K).toFixed(0))):z(this,$,this.updateInterval),x(this,$)>0&&x(this,j)%x(this,$)!=0))return;this.internalUpdate(e,t),this._postprocessPromiseGroups()}}internalUpdate(e,t){var l,c;const s=this.renderer.renderLists.get(e,0),n=s.opaque;this.projectionScreenMatrix.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);const r=this.targetTriangleDensity;for(const d of n){if(d.material&&(((l=d.geometry)==null?void 0:l.type)==="BoxGeometry"||((c=d.geometry)==null?void 0:c.type)==="BufferGeometry")&&(d.material.name==="SphericalGaussianBlur"||d.material.name=="BackgroundCubeMaterial"||d.material.name==="CubemapFromEquirect"||d.material.name==="EquirectangularToCubeUV")){I&&(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]||(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]=!0,console.warn("Ignoring skybox or BLIT object",d,d.material.name,d.material.type)));continue}switch(d.material.type){case"LineBasicMaterial":case"LineDashedMaterial":case"PointsMaterial":case"ShadowMaterial":case"MeshDistanceMaterial":case"MeshDepthMaterial":continue}if(I==="color"&&d.material&&!d.object.progressive_debug_color){d.object.progressive_debug_color=!0;const f=Math.random()*16777215,v=new y.MeshStandardMaterial({color:f});d.object.material=v}const p=d.object;(p instanceof y.Mesh||p.isMesh)&&this.updateLODs(e,t,p,r)}const i=s.transparent;for(const d of i){const p=d.object;(p instanceof y.Mesh||p.isMesh)&&this.updateLODs(e,t,p,r)}const a=s.transmissive;for(const d of a){const p=d.object;(p instanceof y.Mesh||p.isMesh)&&this.updateLODs(e,t,p,r)}}updateLODs(e,t,s,n){var a,l;s.userData||(s.userData={});let r=s[Oe];if(r||(r=new lt,s[Oe]=r),r.frames++<2)return;for(const c of Q)(a=c.onBeforeUpdateLOD)==null||a.call(c,this.renderer,e,t,s);const i=L.overrideGlobalLodLevel!==void 0?L.overrideGlobalLodLevel:ee;i>=0?(E.mesh_lod=i,E.texture_lod=i):(this.calculateLodLevel(t,s,r,n,E),E.mesh_lod=Math.round(E.mesh_lod),E.texture_lod=Math.round(E.texture_lod)),E.mesh_lod>=0&&this.loadProgressiveMeshes(s,E.mesh_lod),s.material&&E.texture_lod>=0&&this.loadProgressiveTextures(s.material,E.texture_lod),w&&s.material&&!s.isGizmo&&Ne(s.material);for(const c of Q)(l=c.onAfterUpdatedLOD)==null||l.call(c,this.renderer,e,t,s,E);r.lastLodLevel_Mesh=E.mesh_lod,r.lastLodLevel_Texture=E.texture_lod}loadProgressiveTextures(e,t){if(!e)return;if(Array.isArray(e)){for(const r of e)this.loadProgressiveTextures(r,t);return}let s=!1;(e[H]===void 0||t<e[H])&&(s=!0);const n=e["DEBUG:LOD"];if(n!=null&&(s=e[H]!=n,t=n),s){e[H]=t;const r=F.assignTextureLOD(e,t).then(i=>{this._lodchangedlisteners.forEach(a=>a({type:"texture",level:t,object:e}))});me.addPromise("texture",e,r,this._newPromiseGroups)}}loadProgressiveMeshes(e,t){if(!e)return Promise.resolve(null);let s=e[H]!==t;const n=e["DEBUG:LOD"];if(n!=null&&(s=e[H]!=n,t=n),s){e[H]=t;const r=e.geometry,i=F.assignMeshLOD(e,t).then(a=>(a&&e[H]==t&&r!=e.geometry&&this._lodchangedlisteners.forEach(l=>l({type:"mesh",level:t,object:e})),a));return me.addPromise("mesh",e,i,this._newPromiseGroups),i}return Promise.resolve(null)}static isInside(e,t){const s=e.min,n=e.max,r=(s.x+n.x)*.5,i=(s.y+n.y)*.5;return this._tempPtInside.set(r,i,s.z).applyMatrix4(t).z<0}calculateLodLevel(e,t,s,n,r){var S,R,J;if(!t){r.mesh_lod=-1,r.texture_lod=-1;return}if(!e){r.mesh_lod=-1,r.texture_lod=-1;return}let a=10+1,l=!1;if(I&&t["DEBUG:LOD"]!=null)return t["DEBUG:LOD"];const c=(S=F.getMeshLODExtension(t.geometry))==null?void 0:S.lods,d=F.getPrimitiveIndex(t.geometry),p=c&&c.length>0,f=F.getMaterialMinMaxLODsCount(t.material),v=(f==null?void 0:f.min_count)!=1/0&&f.min_count>0&&f.max_count>0;if(!p&&!v){r.mesh_lod=0,r.texture_lod=0;return}p||(l=!0,a=0);const b=this.renderer.domElement.clientHeight||this.renderer.domElement.height;let T=t.geometry.boundingBox;if(t.type==="SkinnedMesh"){const h=t;if(!h.boundingBox)h.computeBoundingBox();else if(this.skinnedMeshAutoUpdateBoundsInterval>0){if(!h[L.$skinnedMeshBoundsOffset]){const A=L.skinnedMeshBoundsFrameOffsetCounter++;h[L.$skinnedMeshBoundsOffset]=A}const _=h[L.$skinnedMeshBoundsOffset];if((s.frames+_)%this.skinnedMeshAutoUpdateBoundsInterval===0){const A=ie(h),N=h.geometry;A&&(h.geometry=A),h.computeBoundingBox(),h.geometry=N}}T=h.boundingBox}if(T){const h=e;if(t.geometry.attributes.color&&t.geometry.attributes.color.count<100&&t.geometry.boundingSphere){this._sphere.copy(t.geometry.boundingSphere),this._sphere.applyMatrix4(t.matrixWorld);const g=e.getWorldPosition(this._tempWorldPosition);if(this._sphere.containsPoint(g)){r.mesh_lod=0,r.texture_lod=0;return}}if(this._tempBox.copy(T),this._tempBox.applyMatrix4(t.matrixWorld),h.isPerspectiveCamera&&L.isInside(this._tempBox,this.projectionScreenMatrix)){r.mesh_lod=0,r.texture_lod=0;return}if(this._tempBox.applyMatrix4(this.projectionScreenMatrix),this.renderer.xr.enabled&&h.isPerspectiveCamera&&h.fov>70){const g=this._tempBox.min,D=this._tempBox.max;let G=g.x,B=g.y,V=D.x,ne=D.y;const ce=2,we=1.5,fe=(g.x+D.x)*.5,he=(g.y+D.y)*.5;G=(G-fe)*ce+fe,B=(B-he)*ce+he,V=(V-fe)*ce+fe,ne=(ne-he)*ce+he;const qe=G<0&&V>0?0:Math.min(Math.abs(g.x),Math.abs(D.x)),We=B<0&&ne>0?0:Math.min(Math.abs(g.y),Math.abs(D.y)),_e=Math.max(qe,We);s.lastCentrality=(we-_e)*(we-_e)*(we-_e)}else s.lastCentrality=1;const _=this._tempBox.getSize(this._tempBoxSize);_.multiplyScalar(.5),screen.availHeight>0&&b>0&&_.multiplyScalar(b/screen.availHeight),e.isPerspectiveCamera?_.x*=e.aspect:e.isOrthographicCamera;const A=e.matrixWorldInverse,N=this._tempBox2;N.copy(T),N.applyMatrix4(t.matrixWorld),N.applyMatrix4(A);const P=N.getSize(this._tempBox2Size),Z=Math.max(P.x,P.y);if(Math.max(_.x,_.y)!=0&&Z!=0&&(_.z=P.z/Math.max(P.x,P.y)*Math.max(_.x,_.y)),s.lastScreenCoverage=Math.max(_.x,_.y,_.z),s.lastScreenspaceVolume.copy(_),s.lastScreenCoverage*=s.lastCentrality,I&&L.debugDrawLine){const g=this.tempMatrix.copy(this.projectionScreenMatrix);g.invert();const D=L.corner0,G=L.corner1,B=L.corner2,V=L.corner3;D.copy(this._tempBox.min),G.copy(this._tempBox.max),G.x=D.x,B.copy(this._tempBox.max),B.y=D.y,V.copy(this._tempBox.max);const ne=(D.z+V.z)*.5;D.z=G.z=B.z=V.z=ne,D.applyMatrix4(g),G.applyMatrix4(g),B.applyMatrix4(g),V.applyMatrix4(g),L.debugDrawLine(D,G,255),L.debugDrawLine(D,B,255),L.debugDrawLine(G,V,255),L.debugDrawLine(B,V,255)}let O=999;if(c&&s.lastScreenCoverage>0)for(let g=0;g<c.length;g++){const D=c[g];if((((R=D.densities)==null?void 0:R[d])||D.density||1e-5)/s.lastScreenCoverage<n){O=g;break}}O<a&&(a=O,l=!0)}if(l?r.mesh_lod=a:r.mesh_lod=s.lastLodLevel_Mesh,I&&r.mesh_lod!=s.lastLodLevel_Mesh){const _=c==null?void 0:c[r.mesh_lod];_&&console.log(`Mesh LOD changed: ${s.lastLodLevel_Mesh} → ${r.mesh_lod} (${_.density.toFixed(0)}) - ${t.name}`)}if(v){const h="saveData"in globalThis.navigator&&globalThis.navigator.saveData===!0;if(s.lastLodLevel_Texture<0){if(r.texture_lod=f.max_count-1,I){const _=f.lods[f.max_count-1];I&&console.log(`First Texture LOD ${r.texture_lod} (${_.max_height}px) - ${t.name}`)}}else{const _=s.lastScreenspaceVolume.x+s.lastScreenspaceVolume.y+s.lastScreenspaceVolume.z;let A=s.lastScreenCoverage*4;((J=this.context)==null?void 0:J.engine)==="model-viewer"&&(A*=1.5);const P=b/window.devicePixelRatio*A;let Z=!1;for(let C=f.lods.length-1;C>=0;C--){const O=f.lods[C];if(!(h&&O.max_height>=2048)&&!(Ze()&&O.max_height>4096)&&(O.max_height>P||!Z&&C===0)){if(Z=!0,r.texture_lod=C,r.texture_lod<s.lastLodLevel_Texture){const m=O.max_height;I&&console.log(`Texture LOD changed: ${s.lastLodLevel_Texture} → ${r.texture_lod} = ${m}px
|
|
6
|
+
Screensize: ${P.toFixed(0)}px, Coverage: ${(100*s.lastScreenCoverage).toFixed(2)}%, Volume ${_.toFixed(1)}
|
|
7
|
+
${t.name}`)}break}}}}else r.texture_lod=0}},$=new WeakMap,X=new WeakMap,Le=new WeakMap,j=new WeakMap,re=new WeakMap,xe=new WeakMap,K=new WeakMap,u(L,"debugDrawLine"),u(L,"overrideGlobalLodLevel"),u(L,"corner0",new y.Vector3),u(L,"corner1",new y.Vector3),u(L,"corner2",new y.Vector3),u(L,"corner3",new y.Vector3),u(L,"_tempPtInside",new y.Vector3),u(L,"skinnedMeshBoundsFrameOffsetCounter",0),u(L,"$skinnedMeshBoundsOffset",Symbol("gltf-progressive-skinnedMeshBoundsOffset")),L);class lt{constructor(){u(this,"frames",0);u(this,"lastLodLevel_Mesh",-1);u(this,"lastLodLevel_Texture",-1);u(this,"lastScreenCoverage",0);u(this,"lastScreenspaceVolume",new y.Vector3);u(this,"lastCentrality",0)}}const Ee=Symbol("NEEDLE_mesh_lod"),ge=Symbol("NEEDLE_texture_lod");let le=null;function Ve(){const o=ut();o&&(o.mapURLs(function(e){return $e(),e}),$e(),le==null||le.disconnect(),le=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(s=>{s instanceof HTMLElement&&s.tagName.toLowerCase()==="model-viewer"&&ze(s)})})}),le.observe(document,{childList:!0,subtree:!0}))}function ut(){if(typeof customElements>"u")return null;const o=customElements.get("model-viewer");return o||(customElements.whenDefined("model-viewer").then(()=>{console.debug("[gltf-progressive] model-viewer defined"),Ve()}),null)}function $e(){if(typeof document>"u")return;document.querySelectorAll("model-viewer").forEach(e=>{ze(e)})}const ke=new WeakSet;let dt=0;function ze(o){if(!o||ke.has(o))return null;ke.add(o),console.debug("[gltf-progressive] found new model-viewer..."+ ++dt+`
|
|
8
|
+
`,o.getAttribute("src"));let e=null,t=null,s=null;for(let n=o;n!=null;n=Object.getPrototypeOf(n)){const r=Object.getOwnPropertySymbols(n),i=r.find(c=>c.toString()=="Symbol(renderer)"),a=r.find(c=>c.toString()=="Symbol(scene)"),l=r.find(c=>c.toString()=="Symbol(needsRender)");!e&&i!=null&&(e=o[i].threeRenderer),!t&&a!=null&&(t=o[a]),!s&&l!=null&&(s=o[l])}if(e&&t){let n=function(){if(s){let i=0,a=setInterval(()=>{if(i++>5){clearInterval(a);return}s==null||s.call(o)},300)}};console.debug("[gltf-progressive] setup model-viewer");const r=ue.get(e,{engine:"model-viewer"});return ue.addPlugin(new ct),r.enable(),r.addEventListener("changed",()=>{s==null||s.call(o)}),o.addEventListener("model-visibility",i=>{i.detail.visible&&(s==null||s.call(o))}),o.addEventListener("load",()=>{n()}),()=>{r.disable()}}return null}class ct{constructor(){u(this,"_didWarnAboutMissingUrl",!1)}onBeforeUpdateLOD(e,t,s,n){this.tryParseMeshLOD(t,n),this.tryParseTextureLOD(t,n)}getUrl(e){if(!e)return null;let t=e.getAttribute("src");return t||(t=e.src),t||(this._didWarnAboutMissingUrl||console.warn("No url found in modelviewer",e),this._didWarnAboutMissingUrl=!0),t}tryGetCurrentGLTF(e){return e._currentGLTF}tryGetCurrentModelViewer(e){return e.element}tryParseTextureLOD(e,t){if(t[ge]==!0)return;t[ge]=!0;const s=this.tryGetCurrentGLTF(e),n=this.tryGetCurrentModelViewer(e),r=this.getUrl(n);if(r&&s&&t.material){let i=function(l){var d,p,f;if(l[ge]==!0)return;l[ge]=!0,l.userData&&(l.userData.LOD=-1);const c=Object.keys(l);for(let v=0;v<c.length;v++){const b=c[v],T=l[b];if((T==null?void 0:T.isTexture)===!0){const S=(p=(d=T.userData)==null?void 0:d.associations)==null?void 0:p.textures;if(S==null)continue;const R=s.parser.json.textures[S];if(!R){console.warn("Texture data not found for texture index "+S);continue}if((f=R==null?void 0:R.extensions)!=null&&f[W]){const J=R.extensions[W];J&&r&&F.registerTexture(r,T,J.lods.length,S,J)}}}};const a=t.material;if(Array.isArray(a))for(const l of a)i(l);else i(a)}}tryParseMeshLOD(e,t){var i,a;if(t[Ee]==!0)return;t[Ee]=!0;const s=this.tryGetCurrentModelViewer(e),n=this.getUrl(s);if(!n)return;const r=(a=(i=t.userData)==null?void 0:i.gltfExtensions)==null?void 0:a[W];if(r&&n){const l=t.uuid;F.registerMesh(n,l,t,0,r.lods.length,r)}}}function ft(o,e,t,s){Te(e),Ae(t),Ce(t,{progressive:!0,...s==null?void 0:s.hints}),t.register(r=>new F(r,o));const n=ue.get(e);return(s==null?void 0:s.enableLODsManager)!==!1&&n.enable(),n}Ve();if(!st){const o={gltfProgressive:{useNeedleProgressive:ft,LODsManager:ue,configureLoader:Ce,getRaycastMesh:ie,useRaycastMeshes:it}};if(!globalThis.Needle)globalThis.Needle=o;else for(const e in o)globalThis.Needle[e]=o[e]}exports.LODsManager=ue;exports.NEEDLE_progressive=F;exports.addDracoAndKTX2Loaders=Ae;exports.configureLoader=Ce;exports.createLoaders=Te;exports.getRaycastMesh=ie;exports.setDracoDecoderLocation=Ie;exports.setKTX2TranscoderLocation=Fe;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var Ke=Object.defineProperty,Ee=s=>{throw TypeError(s)},He=(s,e,t)=>e in s?Ke(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,u=(s,e,t)=>He(s,typeof e!="symbol"?e+"":e,t),Ce=(s,e,t)=>e.has(s)||Ee("Cannot "+t),_=(s,e,t)=>(Ce(s,e,"read from private field"),t?t.call(s):e.get(s)),Z=(s,e,t)=>e.has(s)?Ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),N=(s,e,t,n)=>(Ce(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t);import{BufferGeometry as de,Mesh as J,Texture as re,TextureLoader as Qe,Matrix4 as ke,Clock as Ye,MeshStandardMaterial as Ze,Sphere as Je,Box3 as Be,Vector3 as U}from"./three-DuDKwKB8.min.js";import{DRACOLoader as et,KTX2Loader as tt,MeshoptDecoder as st,GLTFLoader as we}from"./three-examples-BMOhDaYR.min.js";const rt="";globalThis.GLTF_PROGRESSIVE_VERSION=rt,console.debug("[gltf-progressive] version -");let F="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",te="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";const nt=F,ot=te,Ie=new URL(F+"draco_decoder.js");Ie.searchParams.append("range","true"),fetch(Ie,{method:"GET",headers:{Range:"bytes=0-1"}}).catch(s=>{console.debug(`Failed to fetch remote Draco decoder from ${F} (offline: ${typeof navigator<"u"?navigator.onLine:"unknown"})`),F===nt&&Ge("./include/draco/"),te===ot&&$e("./include/ktx2/")}).finally(()=>{je()});function Ge(s){F=s,C&&C[_e]!=F?(console.debug("Updating Draco decoder path to "+s),C[_e]=F,C.setDecoderPath(F),C.preload()):console.debug("Setting Draco decoder path to "+s)}function $e(s){te=s,G&&G.transcoderPath!=te?(console.debug("Updating KTX2 transcoder path to "+s),G.setTranscoderPath(te),G.init()):console.debug("Setting KTX2 transcoder path to "+s)}const _e=Symbol("dracoDecoderPath");let C,ce,G;function je(){C||(C=new et,C[_e]=F,C.setDecoderPath(F),C.setDecoderConfig({type:"js"}),C.preload()),G||(G=new tt,G.setTranscoderPath(te),G.init()),ce||(ce=st)}function Le(s){return je(),s?G.detectSupport(s):s!==null&&console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"),{dracoLoader:C,ktx2Loader:G,meshoptDecoder:ce}}function Me(s){s.dracoLoader||s.setDRACOLoader(C),s.ktx2Loader||s.setKTX2Loader(G),s.meshoptDecoder||s.setMeshoptDecoder(ce)}const De=new WeakMap;function be(s,e){let t=De.get(s);t?t=Object.assign(t,e):t=e,De.set(s,t)}const Re=we.prototype.load;function it(...s){const e=De.get(this);let t=s[0];const n=new URL(t,window.location.href);if(n.hostname.endsWith("needle.tools")){const r=e?.progressive!==void 0?e.progressive:!0,i=e!=null&&e.usecase?e.usecase:"default";r?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${i}`:this.requestHeader.Accept=`*/*;usecase=${i}`,t=n.toString()}return s[0]=t,Re?.call(this,...s)}we.prototype.load=it,ne("debugprogressive");function ne(s){if(typeof window>"u")return!1;const e=new URL(window.location.href).searchParams.get(s);return e==null||e==="0"||e==="false"?!1:e===""?!0:e}function at(s,e){if(e===void 0||e.startsWith("./")||e.startsWith("http")||s===void 0)return e;const t=s.lastIndexOf("/");if(t>=0){const n=s.substring(0,t+1);for(;n.endsWith("/")&&e.startsWith("/");)e=e.substring(1);return n+e}return e}let he;function lt(){return he!==void 0||(he=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),ne("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",he)),he}function ut(){if(typeof window>"u")return!1;const s=new URL(window.location.href),e=s.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(s.hostname);return s.hostname==="127.0.0.1"||e}class dt{constructor(e=100,t={}){u(this,"_running",new Map),u(this,"_queue",[]),u(this,"debug",!1),u(this,"tick",()=>{this.internalUpdate(),setTimeout(this.tick,10)}),this.maxConcurrent=e,this.debug=t.debug??!1,window.requestAnimationFrame(this.tick)}slot(e){return this.debug&&console.debug(`[PromiseQueue]: Requesting slot for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`),new Promise(t=>{this._queue.push({key:e,resolve:t})})}add(e,t){this._running.has(e)||(this._running.set(e,t),t.finally(()=>{this._running.delete(e),this.debug&&console.debug(`[PromiseQueue]: Promise for key ${e} finished, running: ${this._running.size}, waiting: ${this._queue.length}`)}),this.debug&&console.debug(`[PromiseQueue]: Adding promise for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`))}internalUpdate(){const e=this.maxConcurrent-this._running.size;for(let t=0;t<e&&this._queue.length>0;t++){this.debug&&console.debug(`[PromiseQueue]: Running ${this._running.size} promises, waiting for ${this._queue.length} more.`);const{key:n,resolve:r}=this._queue.shift();r({use:i=>this.add(n,i)})}}}const ct=typeof window>"u"&&typeof document>"u",Oe=Symbol("needle:raycast-mesh");function se(s){return s?.[Oe]instanceof de?s[Oe]:null}function ht(s,e){if((s.type==="Mesh"||s.type==="SkinnedMesh")&&!se(s)){const t=ft(e);t.userData={isRaycastMesh:!0},s[Oe]=t}}function gt(s=!0){if(s){if(oe)return;const e=oe=J.prototype.raycast;J.prototype.raycast=function(t,n){const r=this,i=se(r);let o;i&&r.isMesh&&(o=r.geometry,r.geometry=i),e.call(this,t,n),o&&(r.geometry=o)}}else{if(!oe)return;J.prototype.raycast=oe,oe=null}}let oe=null;function ft(s){const e=new de;for(const t in s.attributes)e.setAttribute(t,s.getAttribute(t));return e.setIndex(s.getIndex()),e}const V=new Array,x=ne("debugprogressive");let ge,ee=-1;if(x){let s=function(){ee+=1,ee>=e&&(ee=-1),console.log(`Toggle LOD level [${ee}]`)},e=6;window.addEventListener("keyup",t=>{t.key==="p"&&s(),t.key==="w"&&(ge=!ge,console.log(`Toggle wireframe [${ge}]`));const n=parseInt(t.key);!isNaN(n)&&n>=0&&(ee=n,console.log(`Set LOD level to [${ee}]`))})}function Fe(s){if(x)if(Array.isArray(s))for(const e of s)Fe(e);else s&&"wireframe"in s&&(s.wireframe=ge===!0)}const W="NEEDLE_progressive",Pe=Symbol("needle-progressive-texture"),T=class j{constructor(e,t){u(this,"parser"),u(this,"url"),u(this,"_isLoadingMesh"),u(this,"loadMesh",n=>{var r,i;if(this._isLoadingMesh)return null;const o=(i=(r=this.parser.json.meshes[n])==null?void 0:r.extensions)==null?void 0:i[W];return o?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",n).then(a=>{var l;return this._isLoadingMesh=!1,a&&j.registerMesh(this.url,o.guid,a,(l=o.lods)==null?void 0:l.length,0,o),a})):null}),x&&console.log("Progressive extension registered for",t),this.parser=e,this.url=t}get name(){return W}static getMeshLODExtension(e){const t=this.getAssignedLODInformation(e);return t!=null&&t.key?this.lodInfos.get(t.key):null}static getPrimitiveIndex(e){var t;return((t=this.getAssignedLODInformation(e))==null?void 0:t.index)??-1}static getMaterialMinMaxLODsCount(e,t){const n=this,r="LODS:minmax",i=e[r];if(i!=null)return i;if(t||(t={min_count:1/0,max_count:0,lods:[]}),Array.isArray(e)){for(const a of e)this.getMaterialMinMaxLODsCount(a,t);return e[r]=t,t}if(x==="verbose"&&console.log("getMaterialMinMaxLODsCount",e),e.type==="ShaderMaterial"||e.type==="RawShaderMaterial"){const a=e;for(const l of Object.keys(a.uniforms)){const d=a.uniforms[l].value;d?.isTexture===!0&&o(d,t)}}else if(e.isMaterial)for(const a of Object.keys(e)){const l=e[a];l?.isTexture===!0&&o(l,t)}return e[r]=t,t;function o(a,l){const d=n.getAssignedLODInformation(a);if(d){const c=n.lodInfos.get(d.key);if(c&&c.lods){l.min_count=Math.min(l.min_count,c.lods.length),l.max_count=Math.max(l.max_count,c.lods.length);for(let M=0;M<c.lods.length;M++){const w=c.lods[M];w.width&&(l.lods[M]=l.lods[M]||{min_height:1/0,max_height:0},l.lods[M].min_height=Math.min(l.lods[M].min_height,w.height),l.lods[M].max_height=Math.max(l.lods[M].max_height,w.height))}}}}}static hasLODLevelAvailable(e,t){var n;if(Array.isArray(e)){for(const o of e)if(this.hasLODLevelAvailable(o,t))return!0;return!1}if(e.isMaterial===!0){for(const o of Object.keys(e)){const a=e[o];if(a&&a.isTexture&&this.hasLODLevelAvailable(a,t))return!0}return!1}else if(e.isGroup===!0){for(const o of e.children)if(o.isMesh===!0&&this.hasLODLevelAvailable(o,t))return!0}let r,i;if(e.isMesh?r=e.geometry:(e.isBufferGeometry||e.isTexture)&&(r=e),r&&(n=r?.userData)!=null&&n.LODS){const o=r.userData.LODS;if(i=this.lodInfos.get(o.key),t===void 0)return i!=null;if(i)return Array.isArray(i.lods)?t<i.lods.length:t===0}return!1}static assignMeshLOD(e,t){var n;if(!e)return Promise.resolve(null);if(e instanceof J||e.isMesh===!0){const r=e.geometry,i=this.getAssignedLODInformation(r);if(!i)return Promise.resolve(null);for(const o of V)(n=o.onBeforeGetLODMesh)==null||n.call(o,e,t);return e["LOD:requested level"]=t,j.getOrLoadLOD(r,t).then(o=>{if(Array.isArray(o)){const a=i.index||0;o=o[a]}return e["LOD:requested level"]===t&&(delete e["LOD:requested level"],o&&r!=o&&(o?.isBufferGeometry?e.geometry=o:x&&console.error("Invalid LOD geometry",o))),o}).catch(o=>(console.error("Error loading mesh LOD",e,o),null))}else x&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",e);return Promise.resolve(null)}static assignTextureLOD(e,t=0){if(!e)return Promise.resolve(null);if(e.isMesh===!0){const n=e;if(Array.isArray(n.material)){const r=new Array;for(const i of n.material){const o=this.assignTextureLOD(i,t);r.push(o)}return Promise.all(r).then(i=>{const o=new Array;for(const a of i)Array.isArray(a)&&o.push(...a);return o})}else return this.assignTextureLOD(n.material,t)}if(e.isMaterial===!0){const n=e,r=[],i=new Array;if(n.uniforms&&(n.isRawShaderMaterial||n.isShaderMaterial===!0)){const o=n;for(const a of Object.keys(o.uniforms)){const l=o.uniforms[a].value;if(l?.isTexture===!0){const d=this.assignTextureLODForSlot(l,t,n,a).then(c=>(c&&o.uniforms[a].value!=c&&(o.uniforms[a].value=c,o.uniformsNeedUpdate=!0),c));r.push(d),i.push(a)}}}else for(const o of Object.keys(n)){const a=n[o];if(a?.isTexture===!0){const l=this.assignTextureLODForSlot(a,t,n,o);r.push(l),i.push(o)}}return Promise.all(r).then(o=>{const a=new Array;for(let l=0;l<o.length;l++){const d=o[l],c=i[l];d&&d.isTexture===!0?a.push({material:n,slot:c,texture:d,level:t}):a.push({material:n,slot:c,texture:null,level:t})}return a})}if(e instanceof re||e.isTexture===!0){const n=e;return this.assignTextureLODForSlot(n,t,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(e,t,n,r){return e?.isTexture!==!0?Promise.resolve(null):r==="glyphMap"?Promise.resolve(e):j.getOrLoadLOD(e,t).then(i=>{if(Array.isArray(i))return null;if(i?.isTexture===!0){if(i!=e&&n&&r){const o=n[r];if(o&&!x){const a=this.getAssignedLODInformation(o);if(a&&a?.level<t)return x==="verbose"&&console.warn("Assigned texture level is already higher: ",a.level,t,n,o,i),null}n[r]=i}return i}else x=="verbose"&&console.warn("No LOD found for",e,t);return null}).catch(i=>(console.error("Error loading LOD",e,i),null))}afterRoot(e){var t,n;return x&&console.log("AFTER",this.url,e),(t=this.parser.json.textures)==null||t.forEach((r,i)=>{var o;if(r!=null&&r.extensions){const a=r?.extensions[W];if(a){if(!a.lods){x&&console.warn("Texture has no LODs",a);return}let l=!1;for(const d of this.parser.associations.keys())if(d.isTexture===!0){const c=this.parser.associations.get(d);c?.textures===i&&(l=!0,j.registerTexture(this.url,d,(o=a.lods)==null?void 0:o.length,i,a))}l||this.parser.getDependency("texture",i).then(d=>{var c;d&&j.registerTexture(this.url,d,(c=a.lods)==null?void 0:c.length,i,a)})}}}),(n=this.parser.json.meshes)==null||n.forEach((r,i)=>{if(r!=null&&r.extensions){const o=r?.extensions[W];if(o&&o.lods){for(const a of this.parser.associations.keys())if(a.isMesh){const l=this.parser.associations.get(a);l?.meshes===i&&j.registerMesh(this.url,o.guid,a,o.lods.length,l.primitives,o)}}}}),null}static async getOrLoadLOD(e,t){var n,r,i,o;const a=x=="verbose",l=e.userData.LODS;if(!l)return null;const d=l?.key;let c;if(e.isTexture===!0){const M=e;M.source&&M.source[Pe]&&(c=M.source[Pe])}if(c||(c=j.lodInfos.get(d)),c){if(t>0){let f=!1;const R=Array.isArray(c.lods);if(R&&t>=c.lods.length?f=!0:R||(f=!0),f)return this.lowresCache.get(d)}const M=Array.isArray(c.lods)?(n=c.lods[t])==null?void 0:n.path:c.lods;if(!M)return x&&!c["missing:uri"]&&(c["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+t,c)),null;const w=at(l.url,M);if(w.endsWith(".glb")||w.endsWith(".gltf")){if(!c.guid)return console.warn("missing pointer for glb/gltf texture",c),null;const f=w+"_"+c.guid,R=this.previouslyLoaded.get(f);if(R!==void 0){a&&console.log(`LOD ${t} was already loading/loaded: ${f}`);let h=await R.catch(S=>(console.error(`Error loading LOD ${t} from ${w}
|
|
2
|
+
`,S),null)),P=!1;if(h==null||(h instanceof re&&e instanceof re?(r=h.image)!=null&&r.data||(i=h.source)!=null&&i.data?h=this.copySettings(e,h):(P=!0,this.previouslyLoaded.delete(f)):h instanceof de&&e instanceof de&&((o=h.attributes.position)!=null&&o.array||(P=!0,this.previouslyLoaded.delete(f)))),!P)return h}const k=await this.queue.slot(w);if(!k.use)return x&&console.log(`LOD ${t} was aborted: ${w}`),null;const D=c,p=new Promise(async(h,P)=>{const S=new we;Me(S),x&&(await new Promise(m=>setTimeout(m,1e3)),a&&console.warn("Start loading (delayed) "+w,D.guid));let B=w;if(D&&Array.isArray(D.lods)){const m=D.lods[t];m.hash&&(B+="?v="+m.hash)}const b=await S.loadAsync(B).catch(m=>(console.error(`Error loading LOD ${t} from ${w}
|
|
3
|
+
`,m),h(null)));if(!b)return h(null);const I=b.parser;a&&console.log("Loading finished "+w,D.guid);let v=0;if(b.parser.json.textures){let m=!1;for(const g of b.parser.json.textures){if(g!=null&&g.extensions){const L=g?.extensions[W];if(L!=null&&L.guid&&L.guid===D.guid){m=!0;break}}v++}if(m){let g=await I.getDependency("texture",v);return g&&j.assignLODInformation(l.url,g,d,t,void 0),a&&console.log('change "'+e.name+'" \u2192 "'+g.name+'"',w,v,g,f),e instanceof re&&(g=this.copySettings(e,g)),g&&(g.guid=D.guid),h(g)}else x&&console.warn("Could not find texture with guid",D.guid,b.parser.json)}if(v=0,b.parser.json.meshes){let m=!1;for(const g of b.parser.json.meshes){if(g!=null&&g.extensions){const L=g?.extensions[W];if(L!=null&&L.guid&&L.guid===D.guid){m=!0;break}}v++}if(m){const g=await I.getDependency("mesh",v);if(a&&console.log(`Loaded Mesh "${g.name}"`,w,v,g,f),g.isMesh===!0){const L=g.geometry;return j.assignLODInformation(l.url,L,d,t,0),h(L)}else{const L=new Array;for(let O=0;O<g.children.length;O++){const q=g.children[O];if(q.isMesh===!0){const Y=q.geometry;j.assignLODInformation(l.url,Y,d,t,O),L.push(Y)}}return h(L)}}else x&&console.warn("Could not find mesh with guid",D.guid,b.parser.json)}return h(null)});return this.previouslyLoaded.set(f,p),k.use(p),await p}else if(e instanceof re){a&&console.log("Load texture from uri: "+w);const f=await new Qe().loadAsync(w);return f?(f.guid=c.guid,f.flipY=!1,f.needsUpdate=!0,f.colorSpace=e.colorSpace,a&&console.log(c,f)):x&&console.warn("failed loading",w),f}}else x&&console.warn(`Can not load LOD ${t}: no LOD info found for "${d}" ${e.name}`,e.type);return null}static assignLODInformation(e,t,n,r,i){if(!t)return;t.userData||(t.userData={});const o=new mt(e,n,r,i);t.userData.LODS=o}static getAssignedLODInformation(e){var t;return((t=e?.userData)==null?void 0:t.LODS)||null}static copySettings(e,t){return t?(x&&console.warn(`Copy texture settings
|
|
4
|
+
`,e.uuid,`
|
|
5
|
+
`,t.uuid),t=t.clone(),t.offset=e.offset,t.repeat=e.repeat,t.colorSpace=e.colorSpace,t.magFilter=e.magFilter,t.minFilter=e.minFilter,t.wrapS=e.wrapS,t.wrapT=e.wrapT,t.flipY=e.flipY,t.anisotropy=e.anisotropy,t.mipmaps||(t.generateMipmaps=e.generateMipmaps),t):e}};u(T,"registerTexture",(s,e,t,n,r)=>{if(x&&console.log("> Progressive: register texture",n,e.name,e.uuid,e,r),!e){x&&console.error("gltf-progressive: Register texture without texture");return}e.source&&(e.source[Pe]=r);const i=r.guid;T.assignLODInformation(s,e,i,t,n),T.lodInfos.set(i,r),T.lowresCache.set(i,e)}),u(T,"registerMesh",(s,e,t,n,r,i)=>{var o;const a=t.geometry;if(!a){x&&console.warn("gltf-progressive: Register mesh without geometry");return}a.userData||(a.userData={}),x&&console.log("> Progressive: register mesh "+t.name,{index:r,uuid:t.uuid},i,t),T.assignLODInformation(s,a,e,n,r),T.lodInfos.set(e,i);let l=T.lowresCache.get(e);l?l.push(t.geometry):l=[t.geometry],T.lowresCache.set(e,l),n>0&&!se(t)&&ht(t,a);for(const d of V)(o=d.onRegisteredNewMesh)==null||o.call(d,t,i)}),u(T,"lodInfos",new Map),u(T,"previouslyLoaded",new Map),u(T,"lowresCache",new Map),u(T,"queue",new dt(100,{debug:x!=!1}));let z=T;class mt{constructor(e,t,n,r){u(this,"url"),u(this,"key"),u(this,"level"),u(this,"index"),this.url=e,this.key=t,this.level=n,r!=null&&(this.index=r)}}class fe{constructor(e,t){u(this,"frame_start"),u(this,"frame_capture_end"),u(this,"ready"),u(this,"_resolve"),u(this,"_signal"),u(this,"_resolved",!1),u(this,"_addedCount",0),u(this,"_resolvedCount",0),u(this,"_awaiting",[]),u(this,"_maxPromisesPerObject",1),u(this,"_currentFrame",0),u(this,"_seen",new WeakMap);var n;const r=Math.max(t.frames??2,2);this.frame_start=e,this.frame_capture_end=e+r,this.ready=new Promise(i=>{this._resolve=i}),this.ready.finally(()=>{this._resolved=!0,this._awaiting.length=0}),this._signal=t.signal,(n=this._signal)==null||n.addEventListener("abort",()=>{this.resolveNow()}),this._maxPromisesPerObject=Math.max(1,t.maxPromisesPerObject??1)}get awaitedCount(){return this._addedCount}get resolvedCount(){return this._resolvedCount}get currentlyAwaiting(){return this._awaiting.length}update(e){var t;this._currentFrame=e,((t=this._signal)!=null&&t.aborted||this._currentFrame>this.frame_capture_end&&this._awaiting.length===0)&&this.resolveNow()}add(e,t,n){if(this._resolved){x&&console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");return}if(!(this._currentFrame>this.frame_capture_end)){if(this._maxPromisesPerObject>=1)if(this._seen.has(t)){let r=this._seen.get(t);if(r>=this._maxPromisesPerObject){x&&console.warn("PromiseGroup: Already awaiting object ignoring new promise for it.");return}this._seen.set(t,r+1)}else this._seen.set(t,1);this._awaiting.push(n),this._addedCount++,n.finally(()=>{this._resolvedCount++,this._awaiting.splice(this._awaiting.indexOf(n),1)})}}resolveNow(){var e,t;this._resolved||(t=this._resolve)==null||t.call(this,{awaited_count:this._addedCount,resolved_count:this._resolvedCount,cancelled:((e=this._signal)==null?void 0:e.aborted)??!1})}}u(fe,"addPromise",(s,e,t,n)=>{n.forEach(r=>{r.add(s,e,t)})});const $=ne("debugprogressive"),pt=ne("noprogressive"),Se=Symbol("Needle:LODSManager"),Te=Symbol("Needle:LODState"),X=Symbol("Needle:CurrentLOD"),A={mesh_lod:-1,texture_lod:-1};var y,E,K,Ae,H,ie,me,Q;let ae=(y=class{constructor(s,e){u(this,"renderer"),u(this,"context"),u(this,"projectionScreenMatrix",new ke),u(this,"targetTriangleDensity",2e5),u(this,"skinnedMeshAutoUpdateBoundsInterval",30),u(this,"updateInterval","auto"),Z(this,E,1),u(this,"pause",!1),u(this,"manual",!1),u(this,"_newPromiseGroups",[]),u(this,"_promiseGroupIds",0),u(this,"_lodchangedlisteners",[]),Z(this,K),Z(this,Ae,new Ye),Z(this,H,0),Z(this,ie,0),Z(this,me,0),Z(this,Q,0),u(this,"_fpsBuffer",[60,60,60,60,60]),u(this,"_sphere",new Je),u(this,"_tempBox",new Be),u(this,"_tempBox2",new Be),u(this,"tempMatrix",new ke),u(this,"_tempWorldPosition",new U),u(this,"_tempBoxSize",new U),u(this,"_tempBox2Size",new U),this.renderer=s,this.context={...e}}static getObjectLODState(s){return s[Te]}static addPlugin(s){V.push(s)}static removePlugin(s){const e=V.indexOf(s);e>=0&&V.splice(e,1)}static get(s,e){if(s[Se])return console.debug("[gltf-progressive] LODsManager already exists for this renderer"),s[Se];const t=new y(s,{engine:"unknown",...e});return s[Se]=t,t}get plugins(){return V}awaitLoading(s){const e=this._promiseGroupIds++,t=new fe(_(this,H),{...s});this._newPromiseGroups.push(t);const n=performance.now();return t.ready.finally(()=>{const r=this._newPromiseGroups.indexOf(t);r>=0&&(this._newPromiseGroups.splice(r,1),ut()&&performance.measure("LODsManager:awaitLoading",{start:n,detail:{id:e,name:s?.name,awaited:t.awaitedCount,resolved:t.resolvedCount}}))}),t.ready}_postprocessPromiseGroups(){if(this._newPromiseGroups.length!==0)for(let s=this._newPromiseGroups.length-1;s>=0;s--)this._newPromiseGroups[s].update(_(this,H))}addEventListener(s,e){s==="changed"&&this._lodchangedlisteners.push(e)}removeEventListener(s,e){if(s==="changed"){const t=this._lodchangedlisteners.indexOf(e);t>=0&&this._lodchangedlisteners.splice(t,1)}}enable(){if(_(this,K))return;console.debug("[gltf-progressive] Enabling LODsManager for renderer");let s=0;N(this,K,this.renderer.render);const e=this;Le(this.renderer),this.renderer.render=function(t,n){const r=e.renderer.getRenderTarget();(r==null||"isXRRenderTarget"in r&&r.isXRRenderTarget)&&(s=0,N(e,H,_(e,H)+1),N(e,ie,_(e,Ae).getDelta()),N(e,me,_(e,me)+_(e,ie)),e._fpsBuffer.shift(),e._fpsBuffer.push(1/_(e,ie)),N(e,Q,e._fpsBuffer.reduce((o,a)=>o+a)/e._fpsBuffer.length),$&&_(e,H)%200===0&&console.log("FPS",Math.round(_(e,Q)),"Interval:",_(e,E)));const i=s++;_(e,K).call(this,t,n),e.onAfterRender(t,n,i)}}disable(){_(this,K)&&(console.debug("[gltf-progressive] Disabling LODsManager for renderer"),this.renderer.render=_(this,K),N(this,K,void 0))}update(s,e){this.internalUpdate(s,e)}onAfterRender(s,e,t){if(this.pause)return;const n=this.renderer.renderLists.get(s,0).opaque;let r=!0;if(n.length===1){const i=n[0].material;(i.name==="EffectMaterial"||i.name==="CopyShader")&&(r=!1)}if((e.parent&&e.parent.type==="CubeCamera"||t>=1&&e.type==="OrthographicCamera")&&(r=!1),r){if(pt||(this.updateInterval==="auto"?_(this,Q)<40&&_(this,E)<10?(N(this,E,_(this,E)+1),$&&console.warn("\u2193 Reducing LOD updates",_(this,E),_(this,Q).toFixed(0))):_(this,Q)>=60&&_(this,E)>1&&(N(this,E,_(this,E)-1),$&&console.warn("\u2191 Increasing LOD updates",_(this,E),_(this,Q).toFixed(0))):N(this,E,this.updateInterval),_(this,E)>0&&_(this,H)%_(this,E)!=0))return;this.internalUpdate(s,e),this._postprocessPromiseGroups()}}internalUpdate(s,e){var t,n;const r=this.renderer.renderLists.get(s,0),i=r.opaque;this.projectionScreenMatrix.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);const o=this.targetTriangleDensity;for(const d of i){if(d.material&&(((t=d.geometry)==null?void 0:t.type)==="BoxGeometry"||((n=d.geometry)==null?void 0:n.type)==="BufferGeometry")&&(d.material.name==="SphericalGaussianBlur"||d.material.name=="BackgroundCubeMaterial"||d.material.name==="CubemapFromEquirect"||d.material.name==="EquirectangularToCubeUV")){$&&(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]||(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]=!0,console.warn("Ignoring skybox or BLIT object",d,d.material.name,d.material.type)));continue}switch(d.material.type){case"LineBasicMaterial":case"LineDashedMaterial":case"PointsMaterial":case"ShadowMaterial":case"MeshDistanceMaterial":case"MeshDepthMaterial":continue}if($==="color"&&d.material&&!d.object.progressive_debug_color){d.object.progressive_debug_color=!0;const M=Math.random()*16777215,w=new Ze({color:M});d.object.material=w}const c=d.object;(c instanceof J||c.isMesh)&&this.updateLODs(s,e,c,o)}const a=r.transparent;for(const d of a){const c=d.object;(c instanceof J||c.isMesh)&&this.updateLODs(s,e,c,o)}const l=r.transmissive;for(const d of l){const c=d.object;(c instanceof J||c.isMesh)&&this.updateLODs(s,e,c,o)}}updateLODs(s,e,t,n){var r,i;t.userData||(t.userData={});let o=t[Te];if(o||(o=new vt,t[Te]=o),o.frames++<2)return;for(const l of V)(r=l.onBeforeUpdateLOD)==null||r.call(l,this.renderer,s,e,t);const a=y.overrideGlobalLodLevel!==void 0?y.overrideGlobalLodLevel:ee;a>=0?(A.mesh_lod=a,A.texture_lod=a):(this.calculateLodLevel(e,t,o,n,A),A.mesh_lod=Math.round(A.mesh_lod),A.texture_lod=Math.round(A.texture_lod)),A.mesh_lod>=0&&this.loadProgressiveMeshes(t,A.mesh_lod),t.material&&A.texture_lod>=0&&this.loadProgressiveTextures(t.material,A.texture_lod),x&&t.material&&!t.isGizmo&&Fe(t.material);for(const l of V)(i=l.onAfterUpdatedLOD)==null||i.call(l,this.renderer,s,e,t,A);o.lastLodLevel_Mesh=A.mesh_lod,o.lastLodLevel_Texture=A.texture_lod}loadProgressiveTextures(s,e){if(!s)return;if(Array.isArray(s)){for(const r of s)this.loadProgressiveTextures(r,e);return}let t=!1;(s[X]===void 0||e<s[X])&&(t=!0);const n=s["DEBUG:LOD"];if(n!=null&&(t=s[X]!=n,e=n),t){s[X]=e;const r=z.assignTextureLOD(s,e).then(i=>{this._lodchangedlisteners.forEach(o=>o({type:"texture",level:e,object:s}))});fe.addPromise("texture",s,r,this._newPromiseGroups)}}loadProgressiveMeshes(s,e){if(!s)return Promise.resolve(null);let t=s[X]!==e;const n=s["DEBUG:LOD"];if(n!=null&&(t=s[X]!=n,e=n),t){s[X]=e;const r=s.geometry,i=z.assignMeshLOD(s,e).then(o=>(o&&s[X]==e&&r!=s.geometry&&this._lodchangedlisteners.forEach(a=>a({type:"mesh",level:e,object:s})),o));return fe.addPromise("mesh",s,i,this._newPromiseGroups),i}return Promise.resolve(null)}static isInside(s,e){const t=s.min,n=s.max,r=(t.x+n.x)*.5,i=(t.y+n.y)*.5;return this._tempPtInside.set(r,i,t.z).applyMatrix4(e).z<0}calculateLodLevel(s,e,t,n,r){var i,o,a;if(!e){r.mesh_lod=-1,r.texture_lod=-1;return}if(!s){r.mesh_lod=-1,r.texture_lod=-1;return}let l=10+1,d=!1;if($&&e["DEBUG:LOD"]!=null)return e["DEBUG:LOD"];const c=(i=z.getMeshLODExtension(e.geometry))==null?void 0:i.lods,M=z.getPrimitiveIndex(e.geometry),w=c&&c.length>0,f=z.getMaterialMinMaxLODsCount(e.material),R=f?.min_count!=1/0&&f.min_count>0&&f.max_count>0;if(!w&&!R){r.mesh_lod=0,r.texture_lod=0;return}w||(d=!0,l=0);const k=this.renderer.domElement.clientHeight||this.renderer.domElement.height;let D=e.geometry.boundingBox;if(e.type==="SkinnedMesh"){const p=e;if(!p.boundingBox)p.computeBoundingBox();else if(this.skinnedMeshAutoUpdateBoundsInterval>0){if(!p[y.$skinnedMeshBoundsOffset]){const P=y.skinnedMeshBoundsFrameOffsetCounter++;p[y.$skinnedMeshBoundsOffset]=P}const h=p[y.$skinnedMeshBoundsOffset];if((t.frames+h)%this.skinnedMeshAutoUpdateBoundsInterval===0){const P=se(p),S=p.geometry;P&&(p.geometry=P),p.computeBoundingBox(),p.geometry=S}}D=p.boundingBox}if(D){const p=s;if(e.geometry.attributes.color&&e.geometry.attributes.color.count<100&&e.geometry.boundingSphere){this._sphere.copy(e.geometry.boundingSphere),this._sphere.applyMatrix4(e.matrixWorld);const v=s.getWorldPosition(this._tempWorldPosition);if(this._sphere.containsPoint(v)){r.mesh_lod=0,r.texture_lod=0;return}}if(this._tempBox.copy(D),this._tempBox.applyMatrix4(e.matrixWorld),p.isPerspectiveCamera&&y.isInside(this._tempBox,this.projectionScreenMatrix)){r.mesh_lod=0,r.texture_lod=0;return}if(this._tempBox.applyMatrix4(this.projectionScreenMatrix),this.renderer.xr.enabled&&p.isPerspectiveCamera&&p.fov>70){const v=this._tempBox.min,m=this._tempBox.max;let g=v.x,L=v.y,O=m.x,q=m.y;const Y=2,xe=1.5,le=(v.x+m.x)*.5,ue=(v.y+m.y)*.5;g=(g-le)*Y+le,L=(L-ue)*Y+ue,O=(O-le)*Y+le,q=(q-ue)*Y+ue;const Ve=g<0&&O>0?0:Math.min(Math.abs(v.x),Math.abs(m.x)),Xe=L<0&&q>0?0:Math.min(Math.abs(v.y),Math.abs(m.y)),ye=Math.max(Ve,Xe);t.lastCentrality=(xe-ye)*(xe-ye)*(xe-ye)}else t.lastCentrality=1;const h=this._tempBox.getSize(this._tempBoxSize);h.multiplyScalar(.5),screen.availHeight>0&&k>0&&h.multiplyScalar(k/screen.availHeight),s.isPerspectiveCamera?h.x*=s.aspect:s.isOrthographicCamera;const P=s.matrixWorldInverse,S=this._tempBox2;S.copy(D),S.applyMatrix4(e.matrixWorld),S.applyMatrix4(P);const B=S.getSize(this._tempBox2Size),b=Math.max(B.x,B.y);if(Math.max(h.x,h.y)!=0&&b!=0&&(h.z=B.z/Math.max(B.x,B.y)*Math.max(h.x,h.y)),t.lastScreenCoverage=Math.max(h.x,h.y,h.z),t.lastScreenspaceVolume.copy(h),t.lastScreenCoverage*=t.lastCentrality,$&&y.debugDrawLine){const v=this.tempMatrix.copy(this.projectionScreenMatrix);v.invert();const m=y.corner0,g=y.corner1,L=y.corner2,O=y.corner3;m.copy(this._tempBox.min),g.copy(this._tempBox.max),g.x=m.x,L.copy(this._tempBox.max),L.y=m.y,O.copy(this._tempBox.max);const q=(m.z+O.z)*.5;m.z=g.z=L.z=O.z=q,m.applyMatrix4(v),g.applyMatrix4(v),L.applyMatrix4(v),O.applyMatrix4(v),y.debugDrawLine(m,g,255),y.debugDrawLine(m,L,255),y.debugDrawLine(g,O,255),y.debugDrawLine(L,O,255)}let I=999;if(c&&t.lastScreenCoverage>0)for(let v=0;v<c.length;v++){const m=c[v];if((((o=m.densities)==null?void 0:o[M])||m.density||1e-5)/t.lastScreenCoverage<n){I=v;break}}I<l&&(l=I,d=!0)}if(d?r.mesh_lod=l:r.mesh_lod=t.lastLodLevel_Mesh,$&&r.mesh_lod!=t.lastLodLevel_Mesh){const p=c?.[r.mesh_lod];p&&console.log(`Mesh LOD changed: ${t.lastLodLevel_Mesh} \u2192 ${r.mesh_lod} (${p.density.toFixed(0)}) - ${e.name}`)}if(R){const p="saveData"in globalThis.navigator&&globalThis.navigator.saveData===!0;if(t.lastLodLevel_Texture<0){if(r.texture_lod=f.max_count-1,$){const h=f.lods[f.max_count-1];$&&console.log(`First Texture LOD ${r.texture_lod} (${h.max_height}px) - ${e.name}`)}}else{const h=t.lastScreenspaceVolume.x+t.lastScreenspaceVolume.y+t.lastScreenspaceVolume.z;let P=t.lastScreenCoverage*4;((a=this.context)==null?void 0:a.engine)==="model-viewer"&&(P*=1.5);const S=k/window.devicePixelRatio*P;let B=!1;for(let b=f.lods.length-1;b>=0;b--){const I=f.lods[b];if(!(p&&I.max_height>=2048)&&!(lt()&&I.max_height>4096)&&(I.max_height>S||!B&&b===0)){if(B=!0,r.texture_lod=b,r.texture_lod<t.lastLodLevel_Texture){const v=I.max_height;$&&console.log(`Texture LOD changed: ${t.lastLodLevel_Texture} \u2192 ${r.texture_lod} = ${v}px
|
|
6
|
+
Screensize: ${S.toFixed(0)}px, Coverage: ${(100*t.lastScreenCoverage).toFixed(2)}%, Volume ${h.toFixed(1)}
|
|
7
|
+
${e.name}`)}break}}}}else r.texture_lod=0}},E=new WeakMap,K=new WeakMap,Ae=new WeakMap,H=new WeakMap,ie=new WeakMap,me=new WeakMap,Q=new WeakMap,u(y,"debugDrawLine"),u(y,"overrideGlobalLodLevel"),u(y,"corner0",new U),u(y,"corner1",new U),u(y,"corner2",new U),u(y,"corner3",new U),u(y,"_tempPtInside",new U),u(y,"skinnedMeshBoundsFrameOffsetCounter",0),u(y,"$skinnedMeshBoundsOffset",Symbol("gltf-progressive-skinnedMeshBoundsOffset")),y);class vt{constructor(){u(this,"frames",0),u(this,"lastLodLevel_Mesh",-1),u(this,"lastLodLevel_Texture",-1),u(this,"lastScreenCoverage",0),u(this,"lastScreenspaceVolume",new U),u(this,"lastCentrality",0)}}const Ne=Symbol("NEEDLE_mesh_lod"),pe=Symbol("NEEDLE_texture_lod");let ve=null;function Ue(){const s=xt();s&&(s.mapURLs(function(e){return We(),e}),We(),ve?.disconnect(),ve=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(n=>{n instanceof HTMLElement&&n.tagName.toLowerCase()==="model-viewer"&&qe(n)})})}),ve.observe(document,{childList:!0,subtree:!0}))}function xt(){return typeof customElements>"u"?null:customElements.get("model-viewer")||(customElements.whenDefined("model-viewer").then(()=>{console.debug("[gltf-progressive] model-viewer defined"),Ue()}),null)}function We(){typeof document>"u"||document.querySelectorAll("model-viewer").forEach(s=>{qe(s)})}const ze=new WeakSet;let yt=0;function qe(s){if(!s||ze.has(s))return null;ze.add(s),console.debug("[gltf-progressive] found new model-viewer..."+ ++yt+`
|
|
8
|
+
`,s.getAttribute("src"));let e=null,t=null,n=null;for(let r=s;r!=null;r=Object.getPrototypeOf(r)){const i=Object.getOwnPropertySymbols(r),o=i.find(d=>d.toString()=="Symbol(renderer)"),a=i.find(d=>d.toString()=="Symbol(scene)"),l=i.find(d=>d.toString()=="Symbol(needsRender)");!e&&o!=null&&(e=s[o].threeRenderer),!t&&a!=null&&(t=s[a]),!n&&l!=null&&(n=s[l])}if(e&&t){let r=function(){if(n){let o=0,a=setInterval(()=>{if(o++>5){clearInterval(a);return}n?.call(s)},300)}};console.debug("[gltf-progressive] setup model-viewer");const i=ae.get(e,{engine:"model-viewer"});return ae.addPlugin(new wt),i.enable(),i.addEventListener("changed",()=>{n?.call(s)}),s.addEventListener("model-visibility",o=>{o.detail.visible&&n?.call(s)}),s.addEventListener("load",()=>{r()}),()=>{i.disable()}}return null}class wt{constructor(){u(this,"_didWarnAboutMissingUrl",!1)}onBeforeUpdateLOD(e,t,n,r){this.tryParseMeshLOD(t,r),this.tryParseTextureLOD(t,r)}getUrl(e){if(!e)return null;let t=e.getAttribute("src");return t||(t=e.src),t||(this._didWarnAboutMissingUrl||console.warn("No url found in modelviewer",e),this._didWarnAboutMissingUrl=!0),t}tryGetCurrentGLTF(e){return e._currentGLTF}tryGetCurrentModelViewer(e){return e.element}tryParseTextureLOD(e,t){if(t[pe]==!0)return;t[pe]=!0;const n=this.tryGetCurrentGLTF(e),r=this.tryGetCurrentModelViewer(e),i=this.getUrl(r);if(i&&n&&t.material){let o=function(l){var d,c,M;if(l[pe]==!0)return;l[pe]=!0,l.userData&&(l.userData.LOD=-1);const w=Object.keys(l);for(let f=0;f<w.length;f++){const R=w[f],k=l[R];if(k?.isTexture===!0){const D=(c=(d=k.userData)==null?void 0:d.associations)==null?void 0:c.textures;if(D==null)continue;const p=n.parser.json.textures[D];if(!p){console.warn("Texture data not found for texture index "+D);continue}if((M=p?.extensions)!=null&&M[W]){const h=p.extensions[W];h&&i&&z.registerTexture(i,k,h.lods.length,D,h)}}}};const a=t.material;if(Array.isArray(a))for(const l of a)o(l);else o(a)}}tryParseMeshLOD(e,t){var n,r;if(t[Ne]==!0)return;t[Ne]=!0;const i=this.tryGetCurrentModelViewer(e),o=this.getUrl(i);if(!o)return;const a=(r=(n=t.userData)==null?void 0:n.gltfExtensions)==null?void 0:r[W];if(a&&o){const l=t.uuid;z.registerMesh(o,l,t,0,a.lods.length,a)}}}function _t(s,e,t,n){Le(e),Me(t),be(t,{progressive:!0,...n?.hints}),t.register(i=>new z(i,s));const r=ae.get(e);return n?.enableLODsManager!==!1&&r.enable(),r}if(Ue(),!ct){const s={gltfProgressive:{useNeedleProgressive:_t,LODsManager:ae,configureLoader:be,getRaycastMesh:se,useRaycastMeshes:gt}};if(!globalThis.Needle)globalThis.Needle=s;else for(const e in s)globalThis.Needle[e]=s[e]}export{ae as LODsManager,z as NEEDLE_progressive,Me as addDracoAndKTX2Loaders,be as configureLoader,Le as createLoaders,se as getRaycastMesh,Ge as setDracoDecoderLocation,$e as setKTX2TranscoderLocation};
|
|
@@ -6,7 +6,7 @@ var aS = (o, t, e) => t in o ? rS(o, t, { enumerable: !0, configurable: !0, writ
|
|
|
6
6
|
var r = (o, t, e) => aS(o, typeof t != "symbol" ? t + "" : t, e), Xf = (o, t, e) => t.has(o) || t_("Cannot " + e);
|
|
7
7
|
var ue = (o, t, e) => (Xf(o, t, "read from private field"), e ? e.call(o) : t.get(o)), mn = (o, t, e) => t.has(o) ? t_("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), gn = (o, t, e, i) => (Xf(o, t, "write to private field"), i ? i.call(o, e) : t.set(o, e), e), $l = (o, t, e) => (Xf(o, t, "access private method"), e);
|
|
8
8
|
import { Vector2 as ne, Vector3 as w, Vector4 as ye, Quaternion as W, PlaneGeometry as ls, WebGLRenderer as Kr, PerspectiveCamera as ve, OrthographicCamera as Lu, Scene as ji, Mesh as G, Texture as Fe, Uniform$1 as tn, Color as ae, ShaderMaterial as ns, Box3 as Li, ShadowMaterial as b0, Euler as Ft, MeshStandardMaterial as yt, Box3Helper as lS, GridHelper as gg, Object3D as D, Material as Pe, Matrix3 as v0, Matrix4 as re, Layers as $o, Ray as Wo, MathUtils as zs, AxesHelper as Di, MeshBasicMaterial as Me, DoubleSide as Bi, BufferGeometry as es, Group as Do, CylinderGeometry as w0, SphereGeometry as Du, BoxGeometry as Za, SpriteMaterial as cS, Sprite as hS, Shape as dS, ExtrudeGeometry as uS, Fog as x0, DirectionalLight as rm, PointLight as yg, EdgesGeometry as fS, LineSegments as S0, LineBasicMaterial as C0, Line as Wc, BufferAttribute as _t, Raycaster as ju, Sphere as Bu, ArrayCamera as pS, Plane as Vr, SkinnedMesh as Us, InterleavedBufferAttribute as P0, Skeleton as mS, Bone as gS, Source as yS, WebGLCubeRenderTarget as _S, CubeCamera as bS, AnimationClip as jo, FileLoader as _g, TextureLoader as $a, PropertyBinding as Ja, LinearSRGBColorSpace as Gs, ShaderChunk as ni, UniformsLib as vS, DataTexture as bg, RGBAFormat as Fu, EquirectangularReflectionMapping as Ns, SRGBColorSpace as qs, Clock as wS, NeutralToneMapping as el, AgXToneMapping as zu, ACESFilmicToneMapping as Uu, NoToneMapping as jd, PCFSoftShadowMap$1 as xS, BasicNodeLibrary as SS, WebGLRenderTarget as ss, DepthTexture as O0, NearestFilter as Bd, LoopRepeat as CS, LoopOnce as am, AnimationMixer as vg, CompressedTexture as PS, FrontSide as Vo, Camera as OS, Frustum as i_, AudioListener as kS, PositionalAudio as MS, AudioLoader as lm, EventDispatcher as wg, BackSide as Nu, MeshDepthMaterial as RS, CustomBlending as TS, MaxEquation as ES, AmbientLight as AS, HemisphereLight as IS, AlwaysStencilFunc as LS, GreaterEqualStencilFunc as DS, NotEqualStencilFunc as jS, GreaterStencilFunc as BS, LessEqualStencilFunc as FS, EqualStencilFunc as zS, LessStencilFunc as US, NeverStencilFunc as n_, InvertStencilOp as NS, DecrementWrapStencilOp as $S, IncrementWrapStencilOp as WS, DecrementStencilOp as VS, IncrementStencilOp as HS, ReplaceStencilOp as GS, ZeroStencilOp as qS, KeepStencilOp as XS, RawShaderMaterial as k0, GLSL3 as QS, AlwaysDepth as YS, GreaterEqualDepth as KS, GreaterDepth as ZS, LessEqualDepth as JS, LessDepth as eC, NotEqualDepth as tC, EqualDepth as iC, BatchedMesh as s_, MeshPhysicalMaterial as cm, LinearFilter as Fd, UnsignedByteType as nC, RingGeometry as sC, Line3 as oC, AdditiveBlending as M0, BoxHelper as rC, SpotLight as aC, DirectionalLightHelper as lC, CameraHelper as cC, LOD as hC, Triangle as dC, NormalBlending as uC, ReinhardToneMapping as xg, LinearToneMapping as Sg, HalfFloatType as Qf, VideoTexture as fC, CubeTexture as pC, CompressedCubeTexture as mC, EquirectangularRefractionMapping as gC, VectorKeyframeTrack as yC, QuaternionKeyframeTrack as _C, Audio as bC, ShaderLib as zd, UniformsUtils as R0, MirroredRepeatWrapping as o_, MeshNormalMaterial as vC, AudioContext as wC, PMREMGenerator$1 as xC } from "./three-DrqIzZTH.js";
|
|
9
|
-
import { createLoaders as Cg, getRaycastMesh as T0, LODsManager as fa, NEEDLE_progressive as Ze, addDracoAndKTX2Loaders as SC, configureLoader as CC, setKTX2TranscoderLocation as PC, setDracoDecoderLocation as OC } from "./gltf-progressive-
|
|
9
|
+
import { createLoaders as Cg, getRaycastMesh as T0, LODsManager as fa, NEEDLE_progressive as Ze, addDracoAndKTX2Loaders as SC, configureLoader as CC, setKTX2TranscoderLocation as PC, setDracoDecoderLocation as OC } from "./gltf-progressive-BMJtMiwp.js";
|
|
10
10
|
import { GroundedSkybox as tl, Font as kC, TextGeometry as MC, FontLoader as RC, GLTFLoader as Xs, TransformControlsGizmo as E0, EXRLoader as Ud, RGBELoader as hm, Stats as TC, nodeFrame as EC, OrbitControls as A0, PositionalAudioHelper as AC, HorizontalBlurShader as IC, VerticalBlurShader as LC, GLTFExporter as I0, strToU8 as L0, zipSync as DC, XRControllerModelFactory as jC, XRHandMeshModel as BC, Line2 as FC, LineGeometry as zC, LineMaterial as UC, KTX2Loader as NC, TransformControls as $C, InteractiveGroup as WC, HTMLMesh as VC, VertexNormalsHelper as HC, OBJLoader as Pg, FBXLoader as D0, mergeVertices as GC } from "./three-examples-tvuhV8Ne.js";
|
|
11
11
|
import { fetchProfile as qC, MotionController as XC, $70d766613f57b014$export$2e2bcd8739ae039 as r_, ByteBuffer as QC, v5 as a_, md5 as l_, SIZE_PREFIX_LENGTH as j0, Builder as Og, createNoise4D as YC, Matrix4 as Yf, BatchedParticleRenderer as KC, ParticleSystem as ZC, RenderMode as Ps, ConstantColor as JC, Vector4 as e1, ConstantValue as t1, TrailParticle as c_, WorkerBase as i1, MeshBVH as n1 } from "./vendor-BmYIgaS1.js";
|
|
12
12
|
import { __webpack_exports__default as Ee, __webpack_exports__Text as B0, __webpack_exports__Block as F0, __webpack_exports__update as s1, SimpleStateBehavior as o1, __webpack_exports__Inline as Kf, __webpack_exports__FontLibrary as h_, ThreeMeshUI as d_ } from "./three-mesh-ui-CxuWt7m-.js";
|
|
@@ -1806,9 +1806,9 @@ Go('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUIL
|
|
|
1806
1806
|
Go('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');
|
|
1807
1807
|
Go('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3-alpha";');
|
|
1808
1808
|
Go('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
1809
|
-
Go('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Aug 06 2025
|
|
1809
|
+
Go('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Aug 06 2025 10:55:32 GMT+0000 (Coordinated Universal Time)";');
|
|
1810
1810
|
Go('globalThis["__NEEDLE_PUBLIC_KEY__"] = "' + NEEDLE_PUBLIC_KEY + '";');
|
|
1811
|
-
const ts = "4.7.3-alpha", Eg = "undefined", av = "Wed Aug 06 2025
|
|
1811
|
+
const ts = "4.7.3-alpha", Eg = "undefined", av = "Wed Aug 06 2025 10:55:32 GMT+0000 (Coordinated Universal Time)";
|
|
1812
1812
|
rv && console.log(`Engine version: ${ts} (generator: ${Eg})
|
|
1813
1813
|
Project built at ${av}`);
|
|
1814
1814
|
const hc = NEEDLE_PUBLIC_KEY, Fo = "needle_isActiveInHierarchy", Sa = "builtin_components", vd = "needle_editor_guid";
|
|
@@ -8630,7 +8630,7 @@ class ok {
|
|
|
8630
8630
|
/** @internal */
|
|
8631
8631
|
setRenderer(t) {
|
|
8632
8632
|
var e;
|
|
8633
|
-
(e = this._lodsManager) == null || e.disable(), fa.removePlugin(this), fa.addPlugin(this), fa.debugDrawLine = H.DrawLine, this._lodsManager = fa.get(t), this.applySettings(), this._lodsManager.enable();
|
|
8633
|
+
(e = this._lodsManager) == null || e.disable(), fa.removePlugin(this), fa.addPlugin(this), fa.debugDrawLine = H.DrawLine, this._lodsManager = fa.get(t, { engine: "needle-engine" }), this.applySettings(), this._lodsManager.enable();
|
|
8634
8634
|
}
|
|
8635
8635
|
disable() {
|
|
8636
8636
|
var t;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var RC=Object.defineProperty,Mv=n=>{throw TypeError(n)},TC=(n,e,t)=>e in n?RC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,a=(n,e,t)=>TC(n,typeof e!="symbol"?e+"":e,t),Mm=(n,e,t)=>e.has(n)||Mv("Cannot "+t),ge=(n,e,t)=>(Mm(n,e,"read from private field"),t?t.call(n):e.get(n)),Fs=(n,e,t)=>e.has(n)?Mv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Us=(n,e,t,s)=>(Mm(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),ud=(n,e,t)=>(Mm(n,e,"access private method"),t);import{Vector2 as ie,Vector3 as S,Vector4 as fe,Quaternion as V,PlaneGeometry as zs,WebGLRenderer as gr,PerspectiveCamera as we,OrthographicCamera as pd,Scene as Si,Mesh as q,Texture as je,Uniform$1 as Qi,Color as re,ShaderMaterial as Ns,Box3 as Ci,ShadowMaterial as Rv,Euler as Dt,MeshStandardMaterial as bt,Box3Helper as EC,GridHelper as Rm,Object3D as A,Material as Pe,Matrix3 as Tv,Matrix4 as ne,Layers as po,Ray as mo,MathUtils as Cn,AxesHelper as Pi,MeshBasicMaterial as Me,DoubleSide as Oi,BufferGeometry as Ws,Group as go,CylinderGeometry as Ev,SphereGeometry as md,BoxGeometry as xa,SpriteMaterial as AC,Sprite as IC,Shape as LC,ExtrudeGeometry as jC,Fog as Av,DirectionalLight as Tm,PointLight as Em,EdgesGeometry as DC,LineSegments as Iv,LineBasicMaterial as Lv,Line as Hl,BufferAttribute as _t,Raycaster as gd,Sphere as fd,ArrayCamera as BC,Plane as fr,SkinnedMesh as Pn,InterleavedBufferAttribute as jv,Skeleton as FC,Bone as UC,Source as zC,WebGLCubeRenderTarget as NC,CubeCamera as WC,AnimationClip as fo,FileLoader as Am,TextureLoader as Sa,PropertyBinding as Ca,LinearSRGBColorSpace as On,ShaderChunk as qt,UniformsLib as VC,DataTexture as Im,RGBAFormat as yd,EquirectangularReflectionMapping as kn,SRGBColorSpace as Mn,Clock as $C,NeutralToneMapping as Pa,AgXToneMapping as vd,ACESFilmicToneMapping as bd,NoToneMapping as _d,PCFSoftShadowMap$1 as HC,BasicNodeLibrary as GC,WebGLRenderTarget as Vs,DepthTexture as Dv,NearestFilter as wd,LoopRepeat as qC,LoopOnce as Lm,AnimationMixer as jm,CompressedTexture as XC,FrontSide as yo,Camera as QC,Frustum as Bv,AudioListener as YC,PositionalAudio as KC,AudioLoader as Dm,EventDispatcher as Bm,BackSide as xd,MeshDepthMaterial as ZC,CustomBlending as JC,MaxEquation as eP,AmbientLight as tP,HemisphereLight as iP,AlwaysStencilFunc as sP,GreaterEqualStencilFunc as nP,NotEqualStencilFunc as oP,GreaterStencilFunc as rP,LessEqualStencilFunc as aP,EqualStencilFunc as lP,LessStencilFunc as cP,NeverStencilFunc as Fv,InvertStencilOp as hP,DecrementWrapStencilOp as dP,IncrementWrapStencilOp as uP,DecrementStencilOp as pP,IncrementStencilOp as mP,ReplaceStencilOp as gP,ZeroStencilOp as fP,KeepStencilOp as yP,RawShaderMaterial as Uv,GLSL3 as vP,AlwaysDepth as bP,GreaterEqualDepth as _P,GreaterDepth as wP,LessEqualDepth as xP,LessDepth as SP,NotEqualDepth as CP,EqualDepth as PP,BatchedMesh as zv,MeshPhysicalMaterial as Fm,LinearFilter as Sd,UnsignedByteType as OP,RingGeometry as kP,Line3 as MP,AdditiveBlending as Nv,BoxHelper as RP,SpotLight as TP,DirectionalLightHelper as EP,CameraHelper as AP,LOD as IP,Triangle as LP,NormalBlending as jP,ReinhardToneMapping as Um,LinearToneMapping as zm,HalfFloatType as Nm,VideoTexture as DP,CubeTexture as BP,CompressedCubeTexture as FP,EquirectangularRefractionMapping as UP,VectorKeyframeTrack as zP,QuaternionKeyframeTrack as NP,Audio as WP,ShaderLib as Cd,UniformsUtils as Wv,MirroredRepeatWrapping as Vv,MeshNormalMaterial as VP,AudioContext as $P,PMREMGenerator$1 as HP}from"./three-DuDKwKB8.min.js";import{createLoaders as Wm,getRaycastMesh as $v,LODsManager as Oa,NEEDLE_progressive as Xe,addDracoAndKTX2Loaders as GP,configureLoader as qP,setKTX2TranscoderLocation as XP,setDracoDecoderLocation as QP}from"./gltf-progressive-BCZdu3Gc.min.js";import{GroundedSkybox as ka,Font as YP,TextGeometry as KP,FontLoader as ZP,GLTFLoader as Rn,TransformControlsGizmo as Hv,EXRLoader as Pd,RGBELoader as Vm,Stats as JP,nodeFrame as eO,OrbitControls as Gv,PositionalAudioHelper as tO,HorizontalBlurShader as iO,VerticalBlurShader as sO,GLTFExporter as qv,strToU8 as Xv,zipSync as nO,XRControllerModelFactory as oO,XRHandMeshModel as rO,Line2 as aO,LineGeometry as lO,LineMaterial as cO,KTX2Loader as hO,TransformControls as dO,InteractiveGroup as uO,HTMLMesh as pO,VertexNormalsHelper as mO,OBJLoader as $m,FBXLoader as Qv,mergeVertices as gO}from"./three-examples-BMOhDaYR.min.js";import{fetchProfile as fO,MotionController as yO,$70d766613f57b014$export$2e2bcd8739ae039 as Yv,ByteBuffer as vO,v5 as Kv,md5 as Zv,SIZE_PREFIX_LENGTH as Jv,Builder as Hm,createNoise4D as bO,Matrix4 as Gm,BatchedParticleRenderer as _O,ParticleSystem as wO,RenderMode as Tn,ConstantColor as xO,Vector4 as SO,ConstantValue as CO,TrailParticle as eb,WorkerBase as PO,MeshBVH as OO}from"./vendor-BlSxe9JJ.min.js";import{__webpack_exports__default as Re,__webpack_exports__Text as tb,__webpack_exports__Block as ib,__webpack_exports__update as kO,SimpleStateBehavior as MO,__webpack_exports__Inline as qm,__webpack_exports__FontLibrary as sb,ThreeMeshUI as nb}from"./three-mesh-ui-B3p3gyUz.min.js";import{EffectAttribute as RO}from"./postprocessing-BzY0H7ry.min.js";const Xm=new Map;function Xt(n=(e=>(e=globalThis.location)==null?void 0:e.hostname)()){if(Xm.has(n))return Xm.get(n);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(n);return Xm.set(n,e),e===!0}function ob(){return window.location.hostname.includes("glitch.me")}const TO='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',EO=btoa(TO),AO="data:image/svg+xml;base64,"+EO,rb=AO,IO=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(IO);const LO='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',jO=btoa(LO),DO="data:image/svg+xml;charset=utf-8;base64,"+jO,BO=DO,ab=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var me=(n=>(n.ContextRegistered="ContextRegistered",n.ContextCreationStart="ContextCreationStart",n.ContextCreated="ContextCreated",n.ContextFirstFrameRendered="ContextFirstFrameRendered",n.ContextDestroying="ContextDestroying",n.ContextDestroyed="ContextDestroyed",n.MissingCamera="MissingCamera",n.ContextClearing="ContextClearing",n.ContextCleared="ContextCleared",n))(me||{});class pe{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(e){globalThis["NeedleEngine.Context.Current"]=e}static get All(){return this.Registered}static register(e){this.Registered.indexOf(e)===-1&&(ab&&console.warn("Registering context"),this.Registered.push(e),this.dispatchCallback("ContextRegistered",e))}static unregister(e){const t=this.Registered.indexOf(e);t!==-1&&(ab&&console.warn("Unregistering context"),this.Registered.splice(t,1))}static registerCallback(e,t){this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t)}static unregisterCallback(e,t){if(!this._callbacks[e])return;const s=this._callbacks[e].indexOf(t);s!==-1&&this._callbacks[e].splice(s,1)}static dispatchCallback(e,t,s){if(!this._callbacks[e])return!0;const o={event:e,context:t};if(s)for(const l in s)o[l]=s[l];const r=new Array;return this._callbacks[e].forEach(l=>{const c=l(o);c instanceof Promise&&r.push(c)}),Promise.all(r)}static addContextCreatedCallback(e){this.registerCallback("ContextCreated",e)}static addContextDestroyedCallback(e){this.registerCallback("ContextDestroyed",e)}}a(pe,"Registered",[]),a(pe,"_callbacks",{});const lb=()=>n=>n;function FO(n){return lb()(n)}function UO(){return!!C("debug")}class ki{constructor(e,t){a(this,"_factory"),a(this,"_cache",[]),a(this,"_maxSize"),a(this,"_index",0),this._factory=e,this._maxSize=t}get(){const e=this._index%this._maxSize;return this._index++,this._cache.length<=e&&(this._cache[e]=this._factory()),this._cache[e]}}let yr=!1;const Qm=new Array;typeof window<"u"&&setTimeout(()=>{if(yr){const n={},e=new URL(window.location.href),t=new URL(e);t.searchParams.append("console","");const s=t.toString().replace(/=$|=(?=&)/g,"");for(const r of Qm){const l=new URL(e);l.searchParams.append(r,""),n[r]=l.toString().replace(/=$|=(?=&)/g,"")}console.log(`\u{1F335} ?help: Debug Options for Needle Engine.
|
|
1
|
+
var RC=Object.defineProperty,Mv=n=>{throw TypeError(n)},TC=(n,e,t)=>e in n?RC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,a=(n,e,t)=>TC(n,typeof e!="symbol"?e+"":e,t),Mm=(n,e,t)=>e.has(n)||Mv("Cannot "+t),ge=(n,e,t)=>(Mm(n,e,"read from private field"),t?t.call(n):e.get(n)),Fs=(n,e,t)=>e.has(n)?Mv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Us=(n,e,t,s)=>(Mm(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),ud=(n,e,t)=>(Mm(n,e,"access private method"),t);import{Vector2 as ie,Vector3 as S,Vector4 as fe,Quaternion as V,PlaneGeometry as zs,WebGLRenderer as gr,PerspectiveCamera as we,OrthographicCamera as pd,Scene as Si,Mesh as q,Texture as je,Uniform$1 as Qi,Color as re,ShaderMaterial as Ns,Box3 as Ci,ShadowMaterial as Rv,Euler as Dt,MeshStandardMaterial as bt,Box3Helper as EC,GridHelper as Rm,Object3D as A,Material as Pe,Matrix3 as Tv,Matrix4 as ne,Layers as po,Ray as mo,MathUtils as Cn,AxesHelper as Pi,MeshBasicMaterial as Me,DoubleSide as Oi,BufferGeometry as Ws,Group as go,CylinderGeometry as Ev,SphereGeometry as md,BoxGeometry as xa,SpriteMaterial as AC,Sprite as IC,Shape as LC,ExtrudeGeometry as jC,Fog as Av,DirectionalLight as Tm,PointLight as Em,EdgesGeometry as DC,LineSegments as Iv,LineBasicMaterial as Lv,Line as Hl,BufferAttribute as _t,Raycaster as gd,Sphere as fd,ArrayCamera as BC,Plane as fr,SkinnedMesh as Pn,InterleavedBufferAttribute as jv,Skeleton as FC,Bone as UC,Source as zC,WebGLCubeRenderTarget as NC,CubeCamera as WC,AnimationClip as fo,FileLoader as Am,TextureLoader as Sa,PropertyBinding as Ca,LinearSRGBColorSpace as On,ShaderChunk as qt,UniformsLib as VC,DataTexture as Im,RGBAFormat as yd,EquirectangularReflectionMapping as kn,SRGBColorSpace as Mn,Clock as $C,NeutralToneMapping as Pa,AgXToneMapping as vd,ACESFilmicToneMapping as bd,NoToneMapping as _d,PCFSoftShadowMap$1 as HC,BasicNodeLibrary as GC,WebGLRenderTarget as Vs,DepthTexture as Dv,NearestFilter as wd,LoopRepeat as qC,LoopOnce as Lm,AnimationMixer as jm,CompressedTexture as XC,FrontSide as yo,Camera as QC,Frustum as Bv,AudioListener as YC,PositionalAudio as KC,AudioLoader as Dm,EventDispatcher as Bm,BackSide as xd,MeshDepthMaterial as ZC,CustomBlending as JC,MaxEquation as eP,AmbientLight as tP,HemisphereLight as iP,AlwaysStencilFunc as sP,GreaterEqualStencilFunc as nP,NotEqualStencilFunc as oP,GreaterStencilFunc as rP,LessEqualStencilFunc as aP,EqualStencilFunc as lP,LessStencilFunc as cP,NeverStencilFunc as Fv,InvertStencilOp as hP,DecrementWrapStencilOp as dP,IncrementWrapStencilOp as uP,DecrementStencilOp as pP,IncrementStencilOp as mP,ReplaceStencilOp as gP,ZeroStencilOp as fP,KeepStencilOp as yP,RawShaderMaterial as Uv,GLSL3 as vP,AlwaysDepth as bP,GreaterEqualDepth as _P,GreaterDepth as wP,LessEqualDepth as xP,LessDepth as SP,NotEqualDepth as CP,EqualDepth as PP,BatchedMesh as zv,MeshPhysicalMaterial as Fm,LinearFilter as Sd,UnsignedByteType as OP,RingGeometry as kP,Line3 as MP,AdditiveBlending as Nv,BoxHelper as RP,SpotLight as TP,DirectionalLightHelper as EP,CameraHelper as AP,LOD as IP,Triangle as LP,NormalBlending as jP,ReinhardToneMapping as Um,LinearToneMapping as zm,HalfFloatType as Nm,VideoTexture as DP,CubeTexture as BP,CompressedCubeTexture as FP,EquirectangularRefractionMapping as UP,VectorKeyframeTrack as zP,QuaternionKeyframeTrack as NP,Audio as WP,ShaderLib as Cd,UniformsUtils as Wv,MirroredRepeatWrapping as Vv,MeshNormalMaterial as VP,AudioContext as $P,PMREMGenerator$1 as HP}from"./three-DuDKwKB8.min.js";import{createLoaders as Wm,getRaycastMesh as $v,LODsManager as Oa,NEEDLE_progressive as Xe,addDracoAndKTX2Loaders as GP,configureLoader as qP,setKTX2TranscoderLocation as XP,setDracoDecoderLocation as QP}from"./gltf-progressive-zQ2CaD2H.min.js";import{GroundedSkybox as ka,Font as YP,TextGeometry as KP,FontLoader as ZP,GLTFLoader as Rn,TransformControlsGizmo as Hv,EXRLoader as Pd,RGBELoader as Vm,Stats as JP,nodeFrame as eO,OrbitControls as Gv,PositionalAudioHelper as tO,HorizontalBlurShader as iO,VerticalBlurShader as sO,GLTFExporter as qv,strToU8 as Xv,zipSync as nO,XRControllerModelFactory as oO,XRHandMeshModel as rO,Line2 as aO,LineGeometry as lO,LineMaterial as cO,KTX2Loader as hO,TransformControls as dO,InteractiveGroup as uO,HTMLMesh as pO,VertexNormalsHelper as mO,OBJLoader as $m,FBXLoader as Qv,mergeVertices as gO}from"./three-examples-BMOhDaYR.min.js";import{fetchProfile as fO,MotionController as yO,$70d766613f57b014$export$2e2bcd8739ae039 as Yv,ByteBuffer as vO,v5 as Kv,md5 as Zv,SIZE_PREFIX_LENGTH as Jv,Builder as Hm,createNoise4D as bO,Matrix4 as Gm,BatchedParticleRenderer as _O,ParticleSystem as wO,RenderMode as Tn,ConstantColor as xO,Vector4 as SO,ConstantValue as CO,TrailParticle as eb,WorkerBase as PO,MeshBVH as OO}from"./vendor-BlSxe9JJ.min.js";import{__webpack_exports__default as Re,__webpack_exports__Text as tb,__webpack_exports__Block as ib,__webpack_exports__update as kO,SimpleStateBehavior as MO,__webpack_exports__Inline as qm,__webpack_exports__FontLibrary as sb,ThreeMeshUI as nb}from"./three-mesh-ui-B3p3gyUz.min.js";import{EffectAttribute as RO}from"./postprocessing-BzY0H7ry.min.js";const Xm=new Map;function Xt(n=(e=>(e=globalThis.location)==null?void 0:e.hostname)()){if(Xm.has(n))return Xm.get(n);const e=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(n);return Xm.set(n,e),e===!0}function ob(){return window.location.hostname.includes("glitch.me")}const TO='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',EO=btoa(TO),AO="data:image/svg+xml;base64,"+EO,rb=AO,IO=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(IO);const LO='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',jO=btoa(LO),DO="data:image/svg+xml;charset=utf-8;base64,"+jO,BO=DO,ab=typeof window!==void 0?window.location.search.includes("debugcontext"):!1;var me=(n=>(n.ContextRegistered="ContextRegistered",n.ContextCreationStart="ContextCreationStart",n.ContextCreated="ContextCreated",n.ContextFirstFrameRendered="ContextFirstFrameRendered",n.ContextDestroying="ContextDestroying",n.ContextDestroyed="ContextDestroyed",n.MissingCamera="MissingCamera",n.ContextClearing="ContextClearing",n.ContextCleared="ContextCleared",n))(me||{});class pe{static get Current(){return globalThis["NeedleEngine.Context.Current"]}static set Current(e){globalThis["NeedleEngine.Context.Current"]=e}static get All(){return this.Registered}static register(e){this.Registered.indexOf(e)===-1&&(ab&&console.warn("Registering context"),this.Registered.push(e),this.dispatchCallback("ContextRegistered",e))}static unregister(e){const t=this.Registered.indexOf(e);t!==-1&&(ab&&console.warn("Unregistering context"),this.Registered.splice(t,1))}static registerCallback(e,t){this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t)}static unregisterCallback(e,t){if(!this._callbacks[e])return;const s=this._callbacks[e].indexOf(t);s!==-1&&this._callbacks[e].splice(s,1)}static dispatchCallback(e,t,s){if(!this._callbacks[e])return!0;const o={event:e,context:t};if(s)for(const l in s)o[l]=s[l];const r=new Array;return this._callbacks[e].forEach(l=>{const c=l(o);c instanceof Promise&&r.push(c)}),Promise.all(r)}static addContextCreatedCallback(e){this.registerCallback("ContextCreated",e)}static addContextDestroyedCallback(e){this.registerCallback("ContextDestroyed",e)}}a(pe,"Registered",[]),a(pe,"_callbacks",{});const lb=()=>n=>n;function FO(n){return lb()(n)}function UO(){return!!C("debug")}class ki{constructor(e,t){a(this,"_factory"),a(this,"_cache",[]),a(this,"_maxSize"),a(this,"_index",0),this._factory=e,this._maxSize=t}get(){const e=this._index%this._maxSize;return this._index++,this._cache.length<=e&&(this._cache[e]=this._factory()),this._cache[e]}}let yr=!1;const Qm=new Array;typeof window<"u"&&setTimeout(()=>{if(yr){const n={},e=new URL(window.location.href),t=new URL(e);t.searchParams.append("console","");const s=t.toString().replace(/=$|=(?=&)/g,"");for(const r of Qm){const l=new URL(e);l.searchParams.append(r,""),n[r]=l.toString().replace(/=$|=(?=&)/g,"")}console.log(`\u{1F335} ?help: Debug Options for Needle Engine.
|
|
2
2
|
Append any of these parameters to the URL to enable specific debug options.
|
|
3
3
|
Example: ${s} will show an onscreen console window.`);const o=yr===!0?"":` (containing "${yr}")`;console.group("Available URL parameters:"+o);for(const r of Object.keys(n).sort())typeof yr=="string"&&!r.toLowerCase().includes(yr.toLowerCase())||(console.groupCollapsed(r),console.log("Reload with this flag enabled:"),console.log(n[r]),console.groupEnd());console.groupEnd()}},100);function Gl(){var n;return new URLSearchParams((n=globalThis.location)==null?void 0:n.search)}function C(n){yr&&!Qm.includes(n)&&Qm.push(n);const e=Gl();if(e.has(n)){const t=e.get(n);if(t){const s=Number(t);return isNaN(s)?t:s}else return!0}return!1}yr=C("help");function zO(n,e){const t=Gl();t.has(n)?t.set(n,e):t.append(n,e),document.location.search=t.toString()}function ql(n,e,t=!0){const s=Gl();s.has(n)?e===null?s.delete(n):s.set(n,e):e!==null&&s.append(n,e),t?cb(n,s):Km(n,s)}function Ym(n,e,t){n.has(e)?n.set(e,t.toString()):n.append(e,t.toString())}function cb(n,e,t){window.history.pushState(t,n,"?"+e.toString())}function Km(n,e,t){window.history.replaceState(t,n,"?"+e.toString())}function NO(n){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=t.length,o=0;o<n;o++)e+=t.charAt(Math.floor(Math.random()*s));return e}function WO(n,e){return Math.floor(Math.random()*(e-n+1))+n}const hb=["smol","tiny","giant","interesting","smart","bright","dull","extreme","beautiful","pretty","dark","epic","salty","silly","funny","lame","lazy","loud","lucky","mad","mean","mighty","mysterious","nasty","odd","old","powerful","quiet","rapid","scary","shiny","shy","silly","smooth","sour","spicy","stupid","sweet","tasty","terrible","ugly","unusual","vast","wet","wild","witty","wrong","zany","zealous","zippy","zombie","zorro"],db=["cat","dog","mouse","pig","cow","horse","sheep","chicken","duck","goat","panda","tiger","lion","elephant","monkey","bird","fish","snake","frog","turtle","hamster","penguin","kangaroo","whale","dolphin","crocodile","snail","ant","bee","beetle","butterfly","dragon","eagle","fish","giraffe","lizard","panda","penguin","rabbit","snake","spider","tiger","zebra"];function ub(){const n=hb[Math.floor(Math.random()*hb.length)],e=db[Math.floor(Math.random()*db.length)];return n+"_"+e}function pb(n){return n=n.replace(/[^a-z0-9áéíóúñü \.,_-]/gim,""),n.trim()}function Ma(n,e,t=!0,s=!1){var o;if(e==null)return null;if(e.userData&&e.userData.guid===n||e.guid==n)return e;if(s&&(o=e.userData)!=null&&o.components){for(const r of e.userData.components)if(r.guid===n)return r}if(t){if(e.scenes)for(const r in e.scenes){const l=e.scenes[r],c=Ma(n,l,t,s);if(c)return c}if(e.children)for(const r in e.children){const l=e.children[r],c=Ma(n,l,t,s);if(c)return c}}}function Xl(n,e){if(n!=null&&typeof n=="object"){let t;Array.isArray(n)?t=[]:(t=Object.create(n),Object.assign(t,n));for(const s of Object.keys(n)){const o=n[s];e&&!e(n,s,o)?t[s]=o:o?.clone!==void 0&&typeof o.clone=="function"?t[s]=o.clone():t[s]=Xl(o,e)}return t}return n}function $s(n){return new Promise((e,t)=>{setTimeout(e,n)})}function Ql(n,e){if(n<=0)return Promise.resolve();if(e||(e=pe.Current),!e)return Promise.reject("No context");const t=e.time.frameCount+n;return new Promise((s,o)=>{if(!e)return o("No context");const r=()=>{e.time.frameCount>=t&&(e.pre_update_callbacks.splice(e.pre_update_callbacks.indexOf(r),1),s())};e.pre_update_callbacks.push(r)})}const Od=C("debugresolveurl"),mb="rel:";function VO(n,e){return vo(n,e)}function vo(n,e){if(e===void 0)return Od&&console.warn("getPath: uri is undefined, returning uri",e),e;if(e.startsWith("./"))return e;if(e.startsWith("http"))return Od&&console.warn("getPath: uri is absolute, returning uri",e),e;if(n===void 0)return Od&&console.warn("getPath: source is undefined, returning uri",e),e;e.startsWith(mb)&&(e=e.substring(4));const t=n.lastIndexOf("/");if(t>=0){const s=n.substring(0,t+1);for(;s.endsWith("/")&&e.startsWith("/");)e=e.substring(1);const o=s+e;return Od&&console.log("source:",n,`changed uri
|
|
4
4
|
from`,e,`
|
|
@@ -142,7 +142,7 @@ Open this page to get the console: `+e.toString())}const n=Q.isMobileDevice()||Q
|
|
|
142
142
|
#__vconsole .vc-mask {
|
|
143
143
|
overflow: hidden;
|
|
144
144
|
}
|
|
145
|
-
`,Ki?.prepend(s),n===!0&&ig()<=0&&qb(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),nc=!1,oi=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(e)}function Wk(){if(!globalThis.VConsole)return;const n=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+n._id+" iframe");return n.on("renderTab",function(t){const s=globalThis["needle:codegen_files"];if(!s||s.length===0)return;let o=globalThis["needle:codegen_files"][0];const r=o.indexOf("?");r>-1&&(o=o.substring(0,r));const l=location.protocol+"//"+location.host+location.pathname+"/"+o,c=encodeURIComponent(l);n.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(h)}),n.on("show",function(){const t=e();t&&t.src!==n.fullUrl&&(t.src=n.fullUrl)}),n.on("hide",function(){const t=e();t&&(t.src="")}),n.on("addTopBar",function(t){var s=new Array;s.push({name:"Open in new window \u2197",onClick:function(o){window.open(n.fullUrl,"_blank"),oi?.hide()}}),s.push({name:"Reload",onClick:function(o){const r=e();r&&(r.src=n.fullUrl)}}),s.push({name:"Fullscreen",onClick:function(o){const r=e();r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen instanceof Function&&r.webkitRequestFullscreen()}}),t(s)}),n}function Vk(){return document.querySelector("#__vconsole .vc-switch")||null}function $k(){return document.querySelector("#__vconsole")||null}const Kb=C("debugdefines");_o('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),_o('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),_o('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),_o('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),_o('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3-alpha";'),_o('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),_o('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Aug 06 2025
|
|
145
|
+
`,Ki?.prepend(s),n===!0&&ig()<=0&&qb(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),nc=!1,oi=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.9.1/dist/vconsole.min.js",document.body.appendChild(e)}function Wk(){if(!globalThis.VConsole)return;const n=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+n._id+" iframe");return n.on("renderTab",function(t){const s=globalThis["needle:codegen_files"];if(!s||s.length===0)return;let o=globalThis["needle:codegen_files"][0];const r=o.indexOf("?");r>-1&&(o=o.substring(0,r));const l=location.protocol+"//"+location.host+location.pathname+"/"+o,c=encodeURIComponent(l);n.fullUrl="https://viewer.needle.tools?inspect&file="+c;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(h)}),n.on("show",function(){const t=e();t&&t.src!==n.fullUrl&&(t.src=n.fullUrl)}),n.on("hide",function(){const t=e();t&&(t.src="")}),n.on("addTopBar",function(t){var s=new Array;s.push({name:"Open in new window \u2197",onClick:function(o){window.open(n.fullUrl,"_blank"),oi?.hide()}}),s.push({name:"Reload",onClick:function(o){const r=e();r&&(r.src=n.fullUrl)}}),s.push({name:"Fullscreen",onClick:function(o){const r=e();r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen instanceof Function&&r.webkitRequestFullscreen()}}),t(s)}),n}function Vk(){return document.querySelector("#__vconsole .vc-switch")||null}function $k(){return document.querySelector("#__vconsole")||null}const Kb=C("debugdefines");_o('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),_o('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),_o('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),_o('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),_o('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.7.3-alpha";'),_o('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),_o('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Aug 06 2025 10:55:32 GMT+0000 (Coordinated Universal Time)";'),_o('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const _s="4.7.3-alpha",Dd="undefined",wg="Wed Aug 06 2025 10:55:32 GMT+0000 (Coordinated Universal Time)";Kb&&console.log(`Engine version: ${_s} (generator: ${Dd})
|
|
146
146
|
Project built at ${wg}`);const Ea=NEEDLE_PUBLIC_KEY,En="needle_isActiveInHierarchy",wr="builtin_components",rc="needle_editor_guid";function _o(n){try{(0,eval)(n)}catch(e){Kb&&console.error(e)}}let Zb,Jb=null;function ws(){return Zb}function xg(n){if(n==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}Jb!==n&&(Jb=n,Zb=new n)}const Ri=Symbol("shadowDomOwner"),Hk=C("debugpatch");function Bd(n,e,t,s){const o=Hk===e;if(!t&&!s)return;const r=e+"___needle";qk(n,e,t,s);const l=Object.getOwnPropertyDescriptor(n,e),c=n[e];o&&console.log("Patch",n.constructor.name,e,l,c),l?(o&&console.log("Apply patch with existing descriptor",n.constructor.name,e,l),typeof l.value=="function"&&(n[e]=t_(l.value,n,e))):(o&&console.log("Create patch with new property",n.constructor.name,e,l),Object.defineProperty(n,e,{set:function(h){if(typeof h=="function")this[r]=t_(h,n,e);else{const d=this[r];i_(n,e,this,d,h),this[r]=h,s_(n,e,this,d,h)}},get:function(){const h=this[r];return typeof h=="function"&&h[r]?h[r]:h}}))}function Gk(n,e,t){const s=Cg(n,e);if(s)for(let o=s.length-1;o>=0;o--){const r=s[o];r.prefix===t&&(r.prefix=null),r.postfix===t&&(r.postfix=null),!r.prefix&&!r.postfix&&s.splice(o,1)}}const e_=Symbol("Needle:Patches:WrappedFunction");function t_(n,e,t){if(n[e_])return n;const s=function(...o){i_(e,t,this,...o);const r=n.apply(this,o);return s_(e,t,this,r,...o),r};return s[e_]=!0,s}const Fd="Needle:Patches";function Sg(){return globalThis[Fd]||(globalThis[Fd]=new WeakMap),globalThis[Fd]}function Cg(n,e){const t=Sg().get(n);return t?t.get(e):null}function qk(n,e,t,s){let o=Sg().get(n);o||(o=new Map,Sg().set(n,o));let r=o.get(e);r||(r=[],o.set(e,r)),r.push({prefix:t,postfix:s})}function i_(n,e,t,...s){var o;if(!t)return;const r=Cg(n,e);if(r)for(const l of r)(o=l.prefix)==null||o.call(t,...s)}function s_(n,e,t,s,...o){var r;if(!t)return;const l=Cg(n,e);if(l)for(const c of l)(r=c.postfix)==null||r.call(t,s,...o)}const Aa=[];function Ud(n){Aa.indexOf(n)===-1&&Aa.push(n)}function Xk(n){const e=Aa.indexOf(n);e!==-1&&Aa.splice(e,1)}const Ia=[];function Pg(n){Ia.indexOf(n)===-1&&Ia.push(n)}function Qk(n){const e=Ia.indexOf(n);e!==-1&&Ia.splice(e,1)}function n_(n){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-start",{detail:n}));for(let e=0;e<Aa.length;e++)Aa[e](n)}function o_(n){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-end",{detail:n}));for(let e=0;e<Ia.length;e++)Ia[e](n)}const ct=C("debuginput");var zd=(n=>(n.Mouse="mouse",n.Touch="touch",n.Controller="controller",n.Hand="hand",n))(zd||{}),Be=(n=>(n.PointerDown="pointerdown",n.PointerUp="pointerup",n.PointerMove="pointermove",n.KeyDown="keydown",n.KeyUp="keyup",n.KeyPressed="keypress",n))(Be||{});class An extends PointerEvent{constructor(e,t,s){super(e,s),a(this,"clientZ"),a(this,"deviceIndex"),a(this,"origin"),a(this,"source"),a(this,"mode"),a(this,"_ray"),a(this,"space"),a(this,"isClick",!1),a(this,"isDoubleClick",!1),a(this,"_used",!1),a(this,"_pointerid"),a(this,"_pointerType"),a(this,"_type"),a(this,"metadata",{}),a(this,"intersections",new Array),a(this,"_immediatePropagationStopped",!1),a(this,"_propagationStopped",!1),this.clientZ=s.clientZ,this._pointerid=s.pointerId,this._pointerType=s.pointerType,this._type=e,this.deviceIndex=s.deviceIndex,this.origin=s.origin,this.source=t,this.mode=s.mode,this._ray=s.ray,this.space=s.device}get isSpatial(){return this.mode!="screen"}get ray(){return this._ray||(this._ray=new mo(this.space.worldPosition.clone(),this.space.worldForward.clone())),this._ray}set ray(e){this._ray=e}get hasRay(){return this._ray!==void 0}get used(){return this._used}use(){this._used=!0}get pointerId(){return this._pointerid}get pointerType(){return this._pointerType}get type(){return this._type}get immediatePropagationStopped(){return this._immediatePropagationStopped}get propagationStopped(){return this._immediatePropagationStopped||this._propagationStopped}stopImmediatePropagation(){var e;this._immediatePropagationStopped=!0,super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}stopPropagation(){var e;this._propagationStopped=!0,super.stopPropagation(),(e=this.source)==null||e.stopPropagation(),ct&&console.warn("Stop propagation...",this.pointerId,this.pointerType)}}class ac extends KeyboardEvent{constructor(e,t,s){super(e,s),a(this,"source"),this.source=t}stopImmediatePropagation(){var e;super.stopImmediatePropagation(),(e=this.source)==null||e.stopImmediatePropagation()}}class Yk{constructor(e){a(this,"key"),a(this,"keyType"),a(this,"source"),this.key=e.key,this.keyType=e.type,this.source=e}}var ri=(n=>(n[n.Early=-100]="Early",n[n.Default=0]="Default",n[n.Late=100]="Late",n))(ri||{});class r_{constructor(e){a(this,"_eventListeners",{}),a(this,"_doubleClickTimeThreshold",.2),a(this,"_longPressTimeThreshold",1),a(this,"_setCursorTypes",[]),a(this,"context"),a(this,"_pointerDown",[!1]),a(this,"_pointerUp",[!1]),a(this,"_pointerClick",[!1]),a(this,"_pointerDoubleClick",[!1]),a(this,"_pointerPressed",[!1]),a(this,"_pointerPositions",[new ie]),a(this,"_pointerPositionsLastFrame",[new ie]),a(this,"_pointerPositionsDelta",[new ie]),a(this,"_pointerPositionsRC",[new ie]),a(this,"_pointerPositionDown",[new S]),a(this,"_pointerDownTime",[]),a(this,"_pointerUpTime",[]),a(this,"_pointerUpTimestamp",[]),a(this,"_pointerIds",[]),a(this,"_pointerTypes",[""]),a(this,"_mouseWheelChanged",[!1]),a(this,"_mouseWheelDeltaY",[0]),a(this,"_pointerEvent",[]),a(this,"_pointerEventsPressed",[]),a(this,"_pointerSpace",[]),a(this,"_pressedStack",new Map),a(this,"_htmlEventSource"),a(this,"onLostFocus",()=>{for(const t in this.keysPressed)this.keysPressed[t].pressed=!1}),a(this,"_receivedPointerMoveEventsThisFrame",new Array),a(this,"onEndOfFrame",()=>{this._receivedPointerMoveEventsThisFrame.length=0;for(let t=0;t<this._pointerUp.length;t++)this._pointerUp[t]=!1;for(let t=0;t<this._pointerDown.length;t++)this._pointerDown[t]=!1;for(let t=0;t<this._pointerClick.length;t++)this._pointerClick[t]=!1;for(let t=0;t<this._pointerDoubleClick.length;t++)this._pointerDoubleClick[t]=!1;for(const t of this._pointerPositionsDelta)t.set(0,0);for(let t=0;t<this._mouseWheelChanged.length;t++)this._mouseWheelChanged[t]=!1;for(let t=0;t<this._mouseWheelDeltaY.length;t++)this._mouseWheelDeltaY[t]=0}),a(this,"onContextMenu",t=>{this.canReceiveInput(t)!==!1&&t instanceof PointerEvent&&t.pointerType}),a(this,"keysPressed",{}),a(this,"onKeyDown",t=>{if(ct&&console.log(`key down ${t.code}, ${this.context.application.hasFocus}`,t),!this.context.application.hasFocus)return;const s=this.keysPressed[t.code];if(s&&s.pressed)return;this.keysPressed[t.code]={pressed:!0,frame:this.context.time.frameCount+1,startFrame:this.context.time.frameCount+1,key:t.key,code:t.code};const o=new ac("keydown",t,t);this.onDispatchEvent(o)}),a(this,"onKeyPressed",t=>{if(!this.context.application.hasFocus)return;const s=this.keysPressed[t.code];if(!s)return;s.pressed=!0,s.frame=this.context.time.frameCount+1;const o=new ac("keypress",t,t);this.onDispatchEvent(o)}),a(this,"onKeyUp",t=>{if(!this.context.application.hasFocus)return;const s=this.keysPressed[t.code];if(!s)return;s.pressed=!1,s.frame=this.context.time.frameCount+1;const o=new ac("keyup",t,t);this.onDispatchEvent(o)}),a(this,"onWheelWindow",t=>{document.pointerLockElement&&this.onMouseWheel(t)}),a(this,"onMouseWheel",t=>{if(this.canReceiveInput(t)===!1)return;this._mouseWheelDeltaY.length<=0&&this._mouseWheelDeltaY.push(0),this._mouseWheelChanged.length<=0&&this._mouseWheelChanged.push(!1),this._mouseWheelChanged[0]=!0;const s=this._mouseWheelDeltaY[0];this._mouseWheelDeltaY[0]=s+t.deltaY}),a(this,"onPointerDown",t=>{if(this.context.isInAR||this.canReceiveInput(t)===!1)return;t.target instanceof HTMLElement&&t.target.setPointerCapture(t.pointerId);const s=this.getPointerId(t);ct&&De(`pointer down #${s}, identifier:${t.pointerId}`);const o=this.getAndUpdateSpatialObjectForScreenPosition(s,t.clientX,t.clientY),r=new An("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:s,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:o,pressure:t.pressure});this.onDown(r)}),a(this,"onPointerMove",t=>{if(this.context.isInAR||this._receivedPointerMoveEventsThisFrame.includes(t.pointerId))return;this._receivedPointerMoveEventsThisFrame.push(t.pointerId);let s=t.button;t.pointerType==="mouse"&&(s=this.getFirstPressedButtonForPointer(0)??0);const o=this.getPointerId(t,s);s===-1&&(s=o);const r=this.getAndUpdateSpatialObjectForScreenPosition(o,t.clientX,t.clientY),l=new An("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:o,button:s,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:r,pressure:t.pressure});this.onMove(l)}),a(this,"onPointerCancel",t=>{this.context.isInAR||(ct&&console.log("Pointer cancel",t),this.onPointerUp(t))}),a(this,"onPointerUp",t=>{if(this.context.isInAR)return;t.target instanceof HTMLElement&&t.target.releasePointerCapture(t.pointerId);const s=this.getPointerId(t),o=new An("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:s,button:t.button,clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,buttonName:this.getButtonName(t),device:this.getAndUpdateSpatialObjectForScreenPosition(s,t.clientX,t.clientY),pressure:t.pressure});this.onUp(o),this._pointerIds[s]=-1,ct&&console.log("ID="+s,"PointerId="+t.pointerId,"ALL:",[...this._pointerIds])}),a(this,"onTouchStart",t=>{if(this.context.isInAR)for(let s=0;s<t.changedTouches.length;s++){const o=t.changedTouches[s],r=this.getPointerIndex(o.identifier),l=this.getAndUpdateSpatialObjectForScreenPosition(r,o.clientX,o.clientY),c=new An("pointerdown",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:r,button:0,clientX:o.clientX,clientY:o.clientY,pointerType:"touch",buttonName:"unknown",device:l,pressure:o.force});this.onDown(c)}}),a(this,"onTouchMove",t=>{if(this.context.isInAR)for(let s=0;s<t.changedTouches.length;s++){const o=t.changedTouches[s],r=this.getPointerIndex(o.identifier),l=this.getAndUpdateSpatialObjectForScreenPosition(r,o.clientX,o.clientY),c=new An("pointermove",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:r,button:0,clientX:o.clientX,clientY:o.clientY,pointerType:"touch",buttonName:"unknown",device:l,pressure:o.force});this.onMove(c)}}),a(this,"onTouchEnd",t=>{if(this.context.isInAR)for(let s=0;s<t.changedTouches.length;s++){const o=t.changedTouches[s],r=this.getPointerIndex(o.identifier),l=new An("pointerup",t,{origin:this,mode:"screen",deviceIndex:0,pointerId:r,button:0,clientX:o.clientX,clientY:o.clientY,pointerType:"touch",buttonName:"unknown",device:this.getAndUpdateSpatialObjectForScreenPosition(r,o.clientX,o.clientY),pressure:o.force});this.onUp(l),this._pointerIds[r]=-1}}),a(this,"tempNearPlaneVector",new S),a(this,"tempFarPlaneVector",new S),a(this,"tempLookMatrix",new ne),this.context=e,this.context.post_render_callbacks.push(this.onEndOfFrame)}addEventListener(e,t,s){if(this._eventListeners[e]||(this._eventListeners[e]=[]),!t||typeof t!="function"){console.error("Invalid call to addEventListener: callback is required and must be a function!");return}s?s={...s}:s={};let o=0;s?.queue!=null&&(o=s.queue);const r=this._eventListeners[e],l=r.find(c=>c.priority===o);l?l.listeners.push({callback:t,options:s}):(r.push({priority:o,listeners:[{callback:t,options:s}]}),r.sort((c,h)=>c.priority-h.priority))}removeEventListener(e,t,s){if(!this._eventListeners[e]||!t)return;const o=this._eventListeners[e];if(s?.queue!=null){const r=o.find(c=>c.priority===s.queue);if(!r)return;const l=r.listeners.findIndex(c=>c.callback===t);l>=0&&r.listeners.splice(l,1)}else for(const r of o){const l=r.listeners.findIndex(c=>c.callback===t);l>=0&&r.listeners.splice(l,1)}}dispatchEvent(e){var t,s,o,r;let l=!1;if(e instanceof ac){const c=this._eventListeners[e.type];if(c)for(const h of c)for(let d=0;d<h.listeners.length;d++){const u=h.listeners[d];if((s=(t=u.options)==null?void 0:t.signal)!=null&&s.aborted){h.listeners.splice(d,1),d--;continue}u.options.once&&(h.listeners.splice(d,1),d--),u.callback(e)}}if(e instanceof An){const c=this._eventListeners[e.type];if(c)for(const h of c){if(l)break;for(let d=0;d<h.listeners.length;d++){const u=h.listeners[d];if((r=(o=u.options)==null?void 0:o.signal)!=null&&r.aborted){h.listeners.splice(d,1),d--;continue}if(e.immediatePropagationStopped){l=!0,ct&&console.log("immediatePropagationStopped",e.type);break}else e.propagationStopped&&(l=!0,ct&&console.log("propagationStopped",e.type));u.options.once&&(h.listeners.splice(d,1),d--),u.callback(e)}}}}get mousePosition(){return this._pointerPositions[0]}get mousePositionRC(){return this._pointerPositionsRC[0]}get mouseDown(){return this._pointerDown[0]}get mouseUp(){return this._pointerUp[0]}get mouseClick(){return this._pointerClick[0]}get mouseDoubleClick(){return this._pointerDoubleClick[0]}get mousePressed(){return this._pointerPressed[0]}get mouseWheelChanged(){return this.getMouseWheelChanged(0)}get click(){return this._pointerClick[0]}get doubleClick(){return this._pointerDoubleClick[0]}getGamepad(e=0){return typeof navigator<"u"&&"getGamepads"in navigator&&navigator.getGamepads()[e]||null}setCursorPointer(){this.setCursor("pointer")}setCursorNormal(){this.unsetCursor("pointer")}setCursor(e){this._setCursorTypes.push(e),this._setCursorTypes.length>10&&this._setCursorTypes.shift(),this.updateCursor()}unsetCursor(e){for(let t=this._setCursorTypes.length-1;t>=0;t--)if(this._setCursorTypes[t]===e){this._setCursorTypes.splice(t,1),this.updateCursor();break}}updateCursor(){var e;((e=this._setCursorTypes)==null?void 0:e.length)==0?this.context.domElement.style.cursor="default":this.context.domElement.style.cursor=this._setCursorTypes[this._setCursorTypes.length-1]}getIsPointerIdInUse(e){for(const t of this._pointerEventsPressed)if(t.pointerId===e&&t.used)return!0;return!1}getPointerPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&e++;return e}getPointerPosition(e){return e>=this._pointerPositions.length?null:this._pointerPositions[e]}getPointerPositionLastFrame(e){return e>=this._pointerPositionsLastFrame.length?null:this._pointerPositionsLastFrame[e]}getPointerPositionDelta(e){return e>=this._pointerPositionsDelta.length?null:this._pointerPositionsDelta[e]}getPointerPositionRC(e){return e>=this._pointerPositionsRC.length?null:this._pointerPositionsRC[e]}getPointerDown(e){return e>=this._pointerDown.length?!1:this._pointerDown[e]}getPointerUp(e){return e>=this._pointerUp.length?!1:this._pointerUp[e]}getPointerPressed(e){return e>=this._pointerPressed.length?!1:this._pointerPressed[e]}getPointerClicked(e){return e>=this._pointerClick.length?!1:this._pointerClick[e]}getPointerDoubleClicked(e){return e>=this._pointerDoubleClick.length?!1:this._pointerDoubleClick[e]}getPointerDownTime(e){return e>=this._pointerDownTime.length?-1:this._pointerDownTime[e]}getPointerUpTime(e){return e>=this._pointerUpTime.length?-1:this._pointerUpTime[e]}getPointerLongPress(e){return e>=this._pointerDownTime.length?!1:this.getPointerPressed(e)&&this.context.time.time-this._pointerDownTime[e]>this._longPressTimeThreshold}getIsMouse(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="mouse"}getIsTouch(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="touch"}getTouchesPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&this.getIsTouch(t)&&e++;return e}getMouseWheelChanged(e=0){return e>=this._mouseWheelChanged.length?!1:this._mouseWheelChanged[e]}getMouseWheelDeltaY(e=0){return e>=this._mouseWheelDeltaY.length?0:this._mouseWheelDeltaY[e]}getPointerEvent(e){if(!(e>=this._pointerEvent.length))return this._pointerEvent[e]??void 0}*foreachPointerId(e){for(let t=0;t<this._pointerTypes.length;t++)if(this._pointerIsActive(t)){if(e!==void 0){const s=this._pointerTypes[t];if(Array.isArray(e)){let o=!1;for(const r of e)if(s===r){o=!0;break}if(!o)continue}else if(e!==s)continue}yield t}}*foreachTouchId(){for(let e=0;e<this._pointerTypes.length;e++)this._pointerTypes[e]==="touch"&&this._pointerIsActive[e]&&(yield e)}_pointerIsActive(e){return e<0?!1:this._pointerPressed[e]||this._pointerDown[e]||this._pointerUp[e]}onDownButton(e,t){let s=this._pressedStack.get(e);s||(s=[],this._pressedStack.set(e,s)),s.push(t)}onReleaseButton(e,t){const s=this._pressedStack.get(e);if(!s)return;const o=s.indexOf(t);o>=0&&s.splice(o,1)}getFirstPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[0]}getLatestPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[t.length-1]}getKeyDown(e){if(e!==void 0)return this.isKeyDown(e);for(const t in this.keysPressed){const s=this.keysPressed[t];if(s.startFrame===this.context.time.frameCount)return s.key}return null}getKeyPressed(e){if(e!==void 0)return this.isKeyPressed(e);for(const t in this.keysPressed){const s=this.keysPressed[t];if(s.pressed)return s.key}return null}getKeyUp(e){if(e!==void 0)return this.isKeyUp(e);for(const t in this.keysPressed){const s=this.keysPressed[t];return s.pressed===!1&&s.frame===this.context.time.frameCount}return null}isKeyDown(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const o of t)if(this.isKeyDown(o))return!0;return!1}const s=this.keysPressed[e];return s?s.startFrame===this.context.time.frameCount&&s.pressed:!1}isKeyUp(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const o of t)if(this.isKeyUp(o))return!0;return!1}const s=this.keysPressed[e];return s?s.frame===this.context.time.frameCount&&s.pressed===!1:!1}isKeyPressed(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const o of t)if(this.isKeyPressed(o))return!0;return!1}const s=this.keysPressed[e];return s&&s.pressed||!1}getCodeForCommonKeyName(e){if(e.length===1){if(e>="0"&&e<="9")return["Digit"+e];if(e>="a"&&e<="z")return["Key"+e.toUpperCase()];if(e==" ")return["Space"]}switch(e){case"shift":case"Shift":return["ShiftLeft","ShiftRight"];case"control":case"Control":return["ControlLeft","ControlRight"];case"alt":case"Alt":return["AltLeft","AltRight"]}return null}createInputEvent(e){switch(e.type){case"pointerdown":ct&&De("Create Pointer down"),this.onDownButton(e.deviceIndex,e.button),this.onDown(e);break;case"pointermove":ct&&De("Create Pointer move"),this.onMove(e);break;case"pointerup":ct&&De("Create Pointer up"),this.onUp(e),this.onReleaseButton(e.deviceIndex,e.button);break}}convertScreenspaceToRaycastSpace(e){return e.x=(e.x-this.context.domX)/this.context.domWidth*2-1,e.y=-((e.y-this.context.domY)/this.context.domHeight)*2+1,e}bindEvents(){this.unbindEvents(),this._htmlEventSource=this.context.renderer.domElement,window.addEventListener("contextmenu",this.onContextMenu),this._htmlEventSource.addEventListener("pointerdown",this.onPointerDown,{passive:!0}),window.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),window.addEventListener("pointerup",this.onPointerUp,{passive:!0}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!0}),window.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this._htmlEventSource.addEventListener("wheel",this.onMouseWheel,{passive:!0}),window.addEventListener("wheel",this.onWheelWindow,{passive:!0}),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keypress",this.onKeyPressed,!1),window.addEventListener("keyup",this.onKeyUp,!1),window.addEventListener("blur",this.onLostFocus)}unbindEvents(){var e,t;for(const s in this._eventListeners)this._eventListeners[s].length=0;window.removeEventListener("contextmenu",this.onContextMenu),(e=this._htmlEventSource)==null||e.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel),window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),(t=this._htmlEventSource)==null||t.removeEventListener("wheel",this.onMouseWheel,!1),window.removeEventListener("wheel",this.onWheelWindow,!1),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keypress",this.onKeyPressed,!1),window.removeEventListener("keyup",this.onKeyUp,!1),window.removeEventListener("blur",this.onLostFocus)}dispose(){const e=this.context.post_render_callbacks.indexOf(this.onEndOfFrame);e>=0&&this.context.post_render_callbacks.splice(e,1),this.unbindEvents()}canReceiveInput(e){var t;return e.target===((t=this.context.renderer)==null?void 0:t.domElement)||e.target===this.context.domElement||this.context.isInAR||this.context.isInAR&&e.target===document.body&&Q.isMozillaXR()?!0:(ct&&console.warn("CanReceiveInput:False for",e.target),!1)}getPointerId(e,t){return e.pointerType==="mouse"?0+(t??e.button):this.getPointerIndex(e.pointerId)}getButtonName(e){const t=e.button;if(e.pointerType==="mouse")switch(t){case 0:return"left";case 1:return"middle";case 2:return"right"}return"unknown"}getAndUpdateSpatialObjectForScreenPosition(e,t,s){let o=this._pointerSpace[e];o||(o=new A,this._pointerSpace[e]=o),this._pointerSpace[e]=o;const r=this.context.mainCamera;if(r){const l=this.tempNearPlaneVector.set(t,s,-1);this.convertScreenspaceToRaycastSpace(l);const c=this.tempFarPlaneVector.set(l.x,l.y,1);l.unproject(r),c.unproject(r);const h=r.worldUp||X(0,1,0).applyQuaternion(Se(r));this.tempLookMatrix.lookAt(c,l,h),o.position.set(l.x,l.y,l.z),o.quaternion.setFromRotationMatrix(this.tempLookMatrix)}return o}isInRect(e){if(this.context.isInXR)return!0;const t=this.context.domElement.getBoundingClientRect(),s=e.clientX,o=e.clientY,r=s>=t.x&&s<=t.right&&o>=t.y&&o<=t.bottom;return ct&&!r&&console.log("Not in rect",t,s,o),r}onDown(e){const t=e.pointerId;if(this.getPointerPressed(t)&&console.warn(`Received pointerDown for pointerId that is already pressed: ${t}`,ct?e:""),ct&&console.log(e.pointerType,"DOWN",t),!!this.isInRect(e)){for(this.setPointerState(t,this._pointerPressed,!0),this.setPointerState(t,this._pointerDown,!0),this.setPointerStateT(t,this._pointerEvent,e.source);t>=this._pointerTypes.length;)this._pointerTypes.push(e.pointerType);for(this._pointerTypes[t]=e.pointerType;t>=this._pointerPositionDown.length;)this._pointerPositionDown.push(new S);for(this._pointerPositionDown[t].set(e.clientX,e.clientY,e.clientZ??0);t>=this._pointerPositions.length;)this._pointerPositions.push(new ie);this._pointerPositions[t].set(e.clientX,e.clientY),t>=this._pointerDownTime.length&&this._pointerDownTime.push(0),this._pointerDownTime[t]=this.context.time.realtimeSinceStartup,this.updatePointerPosition(e),this._pointerEventsPressed.push(e),this.onDispatchEvent(e)}}onMove(e){const t=e.pointerId,s=this.getPointerPressed(t);s===!1&&!this.isInRect(e)||e.pointerType==="touch"&&!s||(this.updatePointerPosition(e),this.setPointerStateT(t,this._pointerEvent,e.source),this.onDispatchEvent(e))}onUp(e){const t=e.pointerId;if(!this.getPointerPressed(t)){ct&&console.log(e.pointerType,"UP",t,"was not down");return}ct&&console.log(e.pointerType,"UP",t),this.setPointerState(t,this._pointerPressed,!1),this.setPointerStateT(t,this._pointerEvent,e.source),this.setPointerState(t,this._pointerUp,!0),this.updatePointerPosition(e);for(let c=this._pointerEventsPressed.length-1;c>=0;c--)if(this._pointerEventsPressed[c].pointerId===t){this._pointerEventsPressed.splice(c,1);break}if(!this._pointerPositionDown[t]){ct&&be("Received pointer up event without matching down event for button: "+t),console.warn("Received pointer up event without matching down event for button: "+t);return}const s=this._pointerUpTime[t],o=this._pointerDownTime[t],r=this.context.time.realtimeSinceStartup,l=r-o;if(t>=this._pointerUpTime.length&&this._pointerUpTime.push(-99),this._pointerUpTime[t]=r,l<1){let c=e.clientX-this._pointerPositionDown[t].x,h=e.clientY-this._pointerPositionDown[t].y,d=0;if(e.isSpatial&&e.clientZ!=null&&(d=e.clientZ-this._pointerPositionDown[t].z,c*=200,h*=200,d*=200),Math.abs(c)<5&&Math.abs(h)<5&&Math.abs(d)<5){this.setPointerState(t,this._pointerClick,!0),e.isClick=!0;const u=r-s;ct&&console.log("CLICK",t,c,h,d,u),u<this._doubleClickTimeThreshold&&u>0&&(this.setPointerState(t,this._pointerDoubleClick,!0),e.isDoubleClick=!0)}}this.onDispatchEvent(e)}updatePointerPosition(e){const t=e.pointerId;for(;t>=this._pointerPositions.length;)this._pointerPositions.push(new ie);for(;t>=this._pointerPositionsLastFrame.length;)this._pointerPositionsLastFrame.push(new ie);for(;t>=this._pointerPositionsDelta.length;)this._pointerPositionsDelta.push(new ie);const s=this._pointerPositionsLastFrame[t];s.copy(this._pointerPositions[t]);const o=this._pointerPositionsDelta[t];let r=e.clientX-s.x,l=e.clientY-s.y;if(e.source instanceof MouseEvent||e.source instanceof TouchEvent){const u=e.source;r===0&&u.movementX!==0&&(r=u.movementX||0),l===0&&u.movementY!==0&&(l=u.movementY||0)}o.x+=r,o.y+=l,this._pointerPositions[t].x=e.clientX,this._pointerPositions[t].y=e.clientY;const c=e.clientX,h=e.clientY;for(;t>=this._pointerPositionsRC.length;)this._pointerPositionsRC.push(new ie);const d=this._pointerPositionsRC[t];d.set(c,h),this.convertScreenspaceToRaycastSpace(d)}getPointerIndex(e){let t=-1;for(let s=0;s<this._pointerIds.length;s++){if(this._pointerIds[s]===e)return s;t===-1&&this._pointerIds[s]===-1&&(t=s)}return t!==-1?(this._pointerIds[t]=e,t):(ct&&console.log("PUSH pointerId:",e),this._pointerIds.push(e),this._pointerIds.length-1)}setPointerState(e,t,s){t[e]=s}setPointerStateT(e,t,s){return t[e]=s,s}onDispatchEvent(e){const t=J.Current;try{J.Current=this.context,this.dispatchEvent(e)}finally{J.Current=t}}}const La=new ne().makeRotationY(Math.PI),Zi=new V().setFromAxisAngle(new S(0,1,0),Math.PI),Kk=C("debugwebxr");class Zk{constructor(){if(a(this,"priority",-1e5),a(this,"gameObject"),this.gameObject=new A,this.gameObject.name="Implicit XR Rig",Kk){const e=$g(16733661);e.position.y+=.5,this.gameObject.add(e)}}isXRRig(){return!0}get isActive(){return this.gameObject.visible}}const In=C("debugwebxr"),Nd=C("debugcustomgesture"),Jk="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",eM="generic-trigger",tM=new V().setFromEuler(new Dt(Cn.degToRad(0),Cn.degToRad(-90),Cn.degToRad(-90))),iM=new S(.04,-.04,0);class Og{constructor(e,t,s){a(this,"xr"),a(this,"inputSource"),a(this,"index",0),a(this,"emitEvents",!0),a(this,"_connected",!0),a(this,"_isTracking",!1),a(this,"__gamepad"),a(this,"__hand"),a(this,"__side"),a(this,"_hitTestSource"),a(this,"_hasSelectEvent",!1),a(this,"_isMxInk",!1),a(this,"_isMetaQuestTouchController",!1),a(this,"_handJointPoses",new Map),a(this,"_gripMatrix",new ne),a(this,"_gripPosition",new S),a(this,"_gripQuaternion",new V),a(this,"_linearVelocity",new S),a(this,"_rayPositionRaw",new S),a(this,"_rayRotationRaw",new V),a(this,"_rayMatrix",new ne),a(this,"_rayPosition",new S),a(this,"_rayQuaternion",new V),a(this,"_gripWorldPosition",new S),a(this,"_gripWorldQuaternion",new V),a(this,"_rayWorldPosition",new S),a(this,"_rayWorldQuaternion",new V),a(this,"_pinchPosition",new S),a(this,"_ray"),a(this,"_hand_wristDotUp"),a(this,"_object"),a(this,"_gripSpaceObject"),a(this,"_raySpaceObject"),a(this,"model",null),a(this,"_debugAxesHelper",new Pi(.15)),a(this,"_debugGripAxesHelper",new Pi(.07)),a(this,"_debugRayAxesHelper",new Pi(.07)),a(this,"_hitTestSourcePromise",null),a(this,"onPointerHits",o=>{}),a(this,"_needleGamepadButtons",{}),a(this,"_buttonMap",new Map),a(this,"_motioncontroller"),a(this,"_layout"),a(this,"getMotionController"),a(this,"emitPointerDownEvent",!0),a(this,"emitPointerUpEvent",!0),a(this,"emitPointerMoveEvent",!0),a(this,"pointerMoveDistanceThreshold",.03),a(this,"pointerMoveAngleThreshold",.05),a(this,"_selectButtonIndex"),a(this,"_squeezeButtonIndex"),a(this,"onSelectStart",o=>{var r,l,c,h;if(!this.emitPointerDownEvent||this.inputSource!==o.inputSource)return;this.onUpdateFrame(o.frame),this._hasSelectEvent=!0;const d=(r=this._layout)==null?void 0:r.selectComponentId,u=(h=(c=(l=this._layout)==null?void 0:l.components[d])==null?void 0:c.gamepadIndices)==null?void 0:h.button;u!==void 0&&(this._selectButtonIndex=u),!Nd&&(In&&G.DrawDirection(this.rayWorldPosition,X(0,.01,1).applyQuaternion(this.rayWorldQuaternion),16711680,10),this.emitPointerEvent(Be.PointerDown,this._selectButtonIndex||0,"xr-standard-trigger",!0,o))}),a(this,"onSelectEnd",o=>{this.emitPointerUpEvent&&(Nd||this.inputSource===o.inputSource&&this.emitPointerEvent(Be.PointerUp,this._selectButtonIndex||0,"xr-standard-trigger",!0,o))}),a(this,"onSequeezeStart",o=>{var r,l,c;this.emitPointerDownEvent&&this.inputSource===o.inputSource&&(this._squeezeButtonIndex=(c=(l=(r=this._layout)==null?void 0:r.components["xr-standard-squeeze"])==null?void 0:l.gamepadIndices)==null?void 0:c.button,this._squeezeButtonIndex!==void 0&&(In&&G.DrawDirection(this.rayWorldPosition,X(0,.01,1).applyQuaternion(this.rayWorldQuaternion),255,10),this.emitPointerEvent(Be.PointerDown,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,o)))}),a(this,"onSequeezeEnd",o=>{this.emitPointerUpEvent&&this.inputSource===o.inputSource&&this._squeezeButtonIndex!==void 0&&this.emitPointerEvent(Be.PointerUp,this._squeezeButtonIndex||0,"xr-standard-squeeze",!0,o)}),a(this,"states",{}),a(this,"_didMoveLastFrame",!1),a(this,"_lastPointerMovePosition",new S),a(this,"_lastPointerMoveQuaternion",new V),a(this,"pointerInit"),this.xr=e,this.inputSource=t,this.index=s,this._object=new A,this._object.name=`NeedleXRController_${s}`,In&&(this._object.add(this._debugAxesHelper),this._gripSpaceObject=new A,this._raySpaceObject=new A,this._gripSpaceObject.name=`NeedleXRController_${s}_gripSpace`,this._raySpaceObject.name=`NeedleXRController_${s}_raySpace`,this._gripSpaceObject.add(this._debugGripAxesHelper),this._raySpaceObject.add(this._debugRayAxesHelper),this.xr.context.scene.add(this._gripSpaceObject),this.xr.context.scene.add(this._raySpaceObject)),this.xr.context.scene.add(this._object),this._ray=new mo,this.pointerInit={origin:this,pointerType:this.hand?"hand":"controller",deviceIndex:this.index,pointerId:-1,mode:this.inputSource.targetRayMode,ray:this._ray,device:this._object,buttonName:"none"},this.initialize(),this.subscribeEvents()}get context(){return this.xr.context}get connected(){return this._connected}get isTracking(){return this._isTracking}get gamepad(){return this.__gamepad??(this.__gamepad=this.inputSource.gamepad)}get isHand(){return this.hand!=null}get hand(){return this.__hand??(this.__hand=this.inputSource.hand)}get handObject(){return this.context.renderer.xr.getHand(this.index)}get profiles(){return this.inputSource.profiles}get layout(){return this._layout}get targetRayMode(){return this.inputSource.targetRayMode}get targetRaySpace(){return this.inputSource.targetRaySpace}get gripSpace(){return this.inputSource.gripSpace}get side(){return this.__side??(this.__side=this.inputSource.handedness)}get isRight(){return this.side==="right"}get isLeft(){return this.side==="left"}get isStylus(){return this._isMxInk}getHitTestSource(){return this._hitTestSource||this._requestHitTestSource(),this._hitTestSource}get hasHitTestSource(){return this._hitTestSource}cancelHitTestSource(){this._hitTestSource&&(this._hitTestSource.cancel(),this._hitTestSource=void 0)}get hasSelectEvent(){return this._hasSelectEvent}getHitTest(){return this.xr.getHitTest(this)}getHandJointPose(e,t){var s;if(t=t||this.xr.frame,!this.hand||!(t!=null&&t.getJointPose)||!this.xr.referenceSpace)return null;let o=(s=this._handJointPoses)==null?void 0:s.get(e);return o||(o=t.getJointPose(e,this.xr.referenceSpace),o&&this._handJointPoses.set(e,o),o)}get gripPosition(){return X(this._gripPosition)}get gripQuaternion(){return vs(this._gripQuaternion)}get gripMatrix(){return this._gripMatrix}get gripLinearVelocity(){return X(this._linearVelocity).applyQuaternion(Zi)}get rayPosition(){return X(this._rayPosition)}get rayQuaternion(){return vs(this._rayQuaternion)}get gripWorldPosition(){return X(this._gripWorldPosition)}get gripWorldQuaternion(){return vs(this._gripWorldQuaternion)}get rayWorldPosition(){return X(this._rayWorldPosition)}updateRayWorldPosition(){var e;const t=(e=this.xr.context.mainCamera)==null?void 0:e.parent;this._rayWorldPosition.copy(this._rayPositionRaw),t&&this._rayWorldPosition.applyMatrix4(t.matrixWorld)}get rayWorldQuaternion(){return vs(this._rayWorldQuaternion)}get pinchPosition(){return X(this._pinchPosition)}updateRayWorldQuaternion(){var e;const t=(e=this.xr.context.mainCamera)==null?void 0:e.parent,s=t?Se(t):void 0;this._rayWorldQuaternion.copy(this._rayRotationRaw).multiply(Zi),s&&this._rayWorldQuaternion.premultiply(s)}get ray(){return this._ray.origin.copy(this.rayWorldPosition),this._ray.direction.copy(X(0,0,1).applyQuaternion(this.rayWorldQuaternion)),this._ray}get handWristDotUp(){var e;if(this._hand_wristDotUp!==void 0)return this._hand_wristDotUp;const t=(e=this.handObject)==null?void 0:e.joints.wrist;if(t){const s=X(0,1,0).applyQuaternion(t.quaternion),o=X(0,1,0).dot(s);return this._hand_wristDotUp=o}}get isHandUpsideDown(){return this.handWristDotUp!==void 0?this.handWristDotUp<-.7:!1}get isTeleportGesture(){var e;return this.isHandUpsideDown&&((e=this.getGesture("pinch"))==null?void 0:e.isDown)}get object(){return this._object}async getModelUrl(){var e;return(e=this.getMotionController)==null?void 0:e.then(t=>t?.assetUrl||null)}_requestHitTestSource(){var e;return this._hitTestSourcePromise?this._hitTestSourcePromise:this.xr.mode==="immersive-ar"&&this.inputSource.targetRayMode==="tracked-pointer"&&this.xr.session.requestHitTestSourceForTransientInput?this._hitTestSourcePromise=((e=this.xr.session.requestHitTestSourceForTransientInput({profile:this.inputSource.profiles[0],offsetRay:new XRRay}))==null?void 0:e.then(t=>(this._hitTestSourcePromise=null,this.connected?this._hitTestSource=t:(t.cancel(),null))))??null:null}onUpdate(e){this.onUpdateFrame(e),this.updateInputEvents(),this.onUpdateMove()}onRenderDebug(){var e;G.DrawSphere(this.rayWorldPosition,.003),G.DrawDirection(this.rayWorldPosition,X(0,0,10).applyQuaternion(this.rayWorldQuaternion));const t=(this.inputSource.gripSpace?this.gripWorldPosition:this.object.worldPosition).sub(this.object.worldForward.multiplyScalar(.1)),s=this.inputSource.profiles.join(`
|
|
147
147
|
`);let o=`Controller[${this.index}] (${this.inputSource.targetRayMode}, ${this.side})
|
|
148
148
|
C:${this.connected?"x":"-"} T:${this.isTracking?"x":"-"} Hand:${this.inputSource.hand?"x":"-"} Pen: ${this._isMxInk?"x":"-"}`;if(this.inputSource.hand&&(o+=`
|
|
@@ -211,7 +211,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
|
|
|
211
211
|
irradiance += 0.;
|
|
212
212
|
#else
|
|
213
213
|
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
214
|
-
#endif`),VC.lightmap.lightmapScaleOffset={value:new fe(1,1,0,0)};const Sf=C("debugprogressive"),uu=new Ci,pu=new fd;class mR{constructor(e){a(this,"context"),a(this,"_lodsManager"),a(this,"_settings",{}),this.context=e}get manager(){return this._lodsManager}get skinnedMeshAutoUpdateBoundsInterval(){var e;return((e=this._lodsManager)==null?void 0:e.skinnedMeshAutoUpdateBoundsInterval)||this._settings.skinnedMeshAutoUpdateBoundsInterval||0}set skinnedMeshAutoUpdateBoundsInterval(e){this._settings.skinnedMeshAutoUpdateBoundsInterval=e,this.applySettings()}get targetTriangleDensity(){var e;return((e=this._lodsManager)==null?void 0:e.targetTriangleDensity)||this._settings.targetTriangleDensity||2e5}set targetTriangleDensity(e){this._settings.targetTriangleDensity=e,this.applySettings()}applySettings(){if(this._lodsManager)for(const e in this._settings)this._lodsManager[e]=this._settings[e]}setRenderer(e){var t;(t=this._lodsManager)==null||t.disable(),Oa.removePlugin(this),Oa.addPlugin(this),Oa.debugDrawLine=G.DrawLine,this._lodsManager=Oa.get(e),this.applySettings(),this._lodsManager.enable()}disable(){var e;(e=this._lodsManager)==null||e.disable(),Oa.removePlugin(this)}onAfterUpdatedLOD(e,t,s,o,r){Sf&&this.onRenderDebug(s,o,r)}onRenderDebug(e,t,s){var o,r,l;if(!t.geometry||!Xe.hasLODLevelAvailable(t.geometry)&&!Xe.hasLODLevelAvailable(t.material))return;const c=Oa.getObjectLODState(t);if(!c)return;let h=s.mesh_lod;const d=s.mesh_lod!=c.lastLodLevel_Mesh||s.texture_lod!=c.lastLodLevel_Texture;if(Sf&&t.geometry.boundingSphere){const u=t.geometry.boundingSphere;pu.copy(u),pu.applyMatrix4(t.matrixWorld);const p=pu.center,g=pu.radius,f=["#76c43e","#bcc43e","#c4ac3e","#c4673e","#ff3e3e"];if(d)G.DrawWireSphere(p,g,f[h],.1);else{const y=((o=t.geometry.index)==null?void 0:o.count)??0,v=(r=Xe.getMeshLODExtension(t.geometry))==null?void 0:r.lods;h=v?Math.min(v?.length-1,h):0;let b="";if(v&&c.lastScreenCoverage>0)for(let x=0;x<v.length;x++){const k=v[x].density,M=x==v.length-1;b+=k.toFixed(0)+">"+(k/c.lastScreenCoverage).toFixed(0)+(M?"":",")}const _=v?(l=v[h])==null?void 0:l.density:-1;let w="LOD "+s.mesh_lod+`
|
|
214
|
+
#endif`),VC.lightmap.lightmapScaleOffset={value:new fe(1,1,0,0)};const Sf=C("debugprogressive"),uu=new Ci,pu=new fd;class mR{constructor(e){a(this,"context"),a(this,"_lodsManager"),a(this,"_settings",{}),this.context=e}get manager(){return this._lodsManager}get skinnedMeshAutoUpdateBoundsInterval(){var e;return((e=this._lodsManager)==null?void 0:e.skinnedMeshAutoUpdateBoundsInterval)||this._settings.skinnedMeshAutoUpdateBoundsInterval||0}set skinnedMeshAutoUpdateBoundsInterval(e){this._settings.skinnedMeshAutoUpdateBoundsInterval=e,this.applySettings()}get targetTriangleDensity(){var e;return((e=this._lodsManager)==null?void 0:e.targetTriangleDensity)||this._settings.targetTriangleDensity||2e5}set targetTriangleDensity(e){this._settings.targetTriangleDensity=e,this.applySettings()}applySettings(){if(this._lodsManager)for(const e in this._settings)this._lodsManager[e]=this._settings[e]}setRenderer(e){var t;(t=this._lodsManager)==null||t.disable(),Oa.removePlugin(this),Oa.addPlugin(this),Oa.debugDrawLine=G.DrawLine,this._lodsManager=Oa.get(e,{engine:"needle-engine"}),this.applySettings(),this._lodsManager.enable()}disable(){var e;(e=this._lodsManager)==null||e.disable(),Oa.removePlugin(this)}onAfterUpdatedLOD(e,t,s,o,r){Sf&&this.onRenderDebug(s,o,r)}onRenderDebug(e,t,s){var o,r,l;if(!t.geometry||!Xe.hasLODLevelAvailable(t.geometry)&&!Xe.hasLODLevelAvailable(t.material))return;const c=Oa.getObjectLODState(t);if(!c)return;let h=s.mesh_lod;const d=s.mesh_lod!=c.lastLodLevel_Mesh||s.texture_lod!=c.lastLodLevel_Texture;if(Sf&&t.geometry.boundingSphere){const u=t.geometry.boundingSphere;pu.copy(u),pu.applyMatrix4(t.matrixWorld);const p=pu.center,g=pu.radius,f=["#76c43e","#bcc43e","#c4ac3e","#c4673e","#ff3e3e"];if(d)G.DrawWireSphere(p,g,f[h],.1);else{const y=((o=t.geometry.index)==null?void 0:o.count)??0,v=(r=Xe.getMeshLODExtension(t.geometry))==null?void 0:r.lods;h=v?Math.min(v?.length-1,h):0;let b="";if(v&&c.lastScreenCoverage>0)for(let x=0;x<v.length;x++){const k=v[x].density,M=x==v.length-1;b+=k.toFixed(0)+">"+(k/c.lastScreenCoverage).toFixed(0)+(M?"":",")}const _=v?(l=v[h])==null?void 0:l.density:-1;let w="LOD "+s.mesh_lod+`
|
|
215
215
|
TEX `+s.texture_lod;if(Sf=="density"&&(w+=`
|
|
216
216
|
`+y+` tris
|
|
217
217
|
`+(_/c.lastScreenCoverage).toFixed(0)+` dens
|