needle-engine-ui.BNxZ9JGV.js
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./materialx.O52Qgj-4.js","./materialx.DvP4Fl1E.js","./rolldown-runtime.CYVBeYYp.js","./three@0.169.19.js","./rapier3d.CfAT3ZNm.js","./needle-engine.dep.Iqi60wM5.js","./postprocessing.D_9Ug_6_.js","./N8AO.BQBX9S-2.js","./postprocessing.ao.DBMyjH8x.js","./three-examples.extras@0.169.19.js","./peerjs.BBv9D-1e.js","./needle-engine.CPHA0M3C.js","./needle-engine.dep.C5Vii0xi.js","./three-mesh-bvh.CILjAQAz.js","./GenerateMeshBVHWorker.CwON7Fxz.js","./needle-engine.D3bSdWlf.js"])))=>i.map(i=>d[i]);
import{n as e,r as t,t as n}from"./rolldown-runtime.CYVBeYYp.js";import{d as r}from"./materialx.DvP4Fl1E.js";import{$n as i,A as a,Ar as o,At as s,B as c,Bt as l,Cn as u,Fr as d,Ft as f,Gn as p,H as m,Ir as h,Jt as g,Kn as _,L as v,Nt as ee,On as y,Ot as b,Pr as te,Qn as ne,Qt as re,S as ie,St as ae,Wt as oe,X as se,Xt as ce,Yt as le,Z as ue,Zn as de,Zt as x,_ as fe,_n as pe,_r as me,a as he,ct as ge,d as _e,dt as ve,et as ye,fn as S,gn as C,gr as be,h as xe,i as Se,in as Ce,it as we,jr as Te,jt as Ee,k as De,kr as w,lr as Oe,mn as ke,mr as Ae,nr as je,o as Me,on as Ne,or as Pe,p as Fe,pr as Ie,qt as T,rr as Le,rt as Re,sr as ze,st as Be,tr as Ve,tt as He,ur as Ue,ut as We,v as Ge,vn as Ke,w as qe,wn as E,x as Je,xr as Ye,y as Xe,yn as Ze}from"./three@0.169.19.js";import{a as Qe,c as $e,i as et,n as tt,o as D,r as nt,s as rt,t as it}from"./three-mesh-ui.DW6dDe2V.js";import{A as at,C as ot,E as st,M as ct,N as lt,T as ut,_ as dt,j as ft,o as pt,s as mt,v as ht,w as gt,y as _t}from"./three-examples@0.169.19.js";import{n as vt,o as yt,r as bt,t as xt}from"./gltf-progressive.CxhBRdS_.js";var St=window.location.search.includes(`debugcontext`),O;(function(e){e.ContextRegistered=`ContextRegistered`,e.ContextCreationStart=`ContextCreationStart`,e.ContextCreated=`ContextCreated`,e.ContextFirstFrameRendered=`ContextFirstFrameRendered`,e.ContextDestroying=`ContextDestroying`,e.ContextDestroyed=`ContextDestroyed`,e.MissingCamera=`MissingCamera`,e.ContextClearing=`ContextClearing`,e.ContextCleared=`ContextCleared`})(O||={});var k=class{static get Current(){return globalThis[`NeedleEngine.Context.Current`]}static set Current(e){globalThis[`NeedleEngine.Context.Current`]=e}static get All(){return this.Registered}static Registered=[];static register(e){this.Registered.indexOf(e)===-1&&(St&&console.warn(`Registering context`),this.Registered.push(e),this.dispatchCallback(O.ContextRegistered,e))}static unregister(e){let t=this.Registered.indexOf(e);t!==-1&&(St&&console.warn(`Unregistering context`),this.Registered.splice(t,1))}static _callbacks={};static registerCallback(e,t){this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t)}static unregisterCallback(e,t){if(!this._callbacks[e])return;let n=this._callbacks[e].indexOf(t);n!==-1&&this._callbacks[e].splice(n,1)}static dispatchCallback(e,t,n){if(!this._callbacks[e])return!0;let r={event:e,context:t};if(n)for(let e in n)r[e]=n[e];let i=[];return this._callbacks[e].forEach(e=>{let t=e(r);t instanceof Promise&&i.push(t)}),Promise.all(i)}static addContextCreatedCallback(e){this.registerCallback(O.ContextCreated,e)}static addContextDestroyedCallback(e){this.registerCallback(O.ContextDestroyed,e)}},Ct=new Map;function wt(e=globalThis.location?.hostname){if(Ct.has(e))return Ct.get(e);let t=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(e);return Ct.set(e,t),t===!0}function Tt(){return window.location.hostname.includes(`glitch.me`)}var Et=class{_factory;_cache=[];_maxSize;_index=0;constructor(e,t){this._factory=e,this._maxSize=t}get(){let e=this._index%this._maxSize;return this._index++,this._cache.length<=e&&(this._cache[e]=this._factory()),this._cache[e]}},Dt=!1,Ot=[];typeof window<`u`&&setTimeout(()=>{if(Dt){let e={},t=new URL(window.location.href),n=new URL(t);n.searchParams.append(`console`,``);let r=n.toString().replace(/=$|=(?=&)/g,``);for(let n of Ot){let r=new URL(t);r.searchParams.append(n,``),e[n]=r.toString().replace(/=$|=(?=&)/g,``)}console.log(`đ” ?help: Debug Options for Needle Engine.
Append any of these parameters to the URL to enable specific debug options.
Example: ${r} will show an onscreen console window.`);let i=Dt===!0?``:` (containing "${Dt}")`;console.group(`Available URL parameters:`+i);for(let t of Object.keys(e).sort())typeof Dt==`string`&&!t.toLowerCase().includes(Dt.toLowerCase())||(console.groupCollapsed(t),console.log(`Reload with this flag enabled:`),console.log(e[t]),console.groupEnd());console.groupEnd()}},100);function kt(){return new URLSearchParams(globalThis.location?.search)}function A(e){Dt&&!Ot.includes(e)&&Ot.push(e);let t=kt();if(t.has(e)){let n=t.get(e);if(n){let e=Number(n);return isNaN(e)?n:e}else return!0}return!1}Dt=A(`help`);function At(e,t,n=!0){let r=kt();r.has(e)?t===null?r.delete(e):r.set(e,t):t!==null&&r.append(e,t),n?Mt(e,r):Nt(e,r)}function jt(e,t,n){e.has(t)?e.set(t,n.toString()):e.append(t,n.toString())}function Mt(e,t,n){window.history.pushState(n,e,`?`+t.toString())}function Nt(e,t,n){window.history.replaceState(n,e,`?`+t.toString())}var Pt=`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`.split(`.`),Ft=`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`.split(`.`);function It(){let e=Pt[Math.floor(Math.random()*Pt.length)],t=Ft[Math.floor(Math.random()*Ft.length)];return e+`_`+t}function Lt(e){return e=e.replace(/[^a-z0-9ĂĄĂ©ĂĂłĂșĂ±ĂŒ \.,_-]/gim,``),e.trim()}function Rt(e,t,n=!0,r=!1){if(t==null)return null;if(t.userData&&t.userData.guid===e||t.guid==e)return t;if(r&&t.userData?.components){for(let n of t.userData.components)if(n.guid===e)return n}if(n){if(t.scenes)for(let i in t.scenes){let a=t.scenes[i],o=Rt(e,a,n,r);if(o)return o}if(t.children)for(let i in t.children){let a=t.children[i],o=Rt(e,a,n,r);if(o)return o}}}function zt(e,t){if(typeof e==`object`&&e){let n;Array.isArray(e)?n=[]:(n=Object.create(e),Object.assign(n,e));for(let r of Object.keys(e)){let i=e[r];t&&!t(e,r,i)?n[r]=i:i?.clone!==void 0&&typeof i.clone==`function`?n[r]=i.clone():n[r]=zt(i,t)}return n}return e}function Bt(e){return new Promise((t,n)=>{setTimeout(t,e)})}function Vt(e,t){if(e<=0)return Promise.resolve();if(t||=k.Current,!t)return Promise.reject(`No context`);let n=t.time.frameCount+e;return new Promise((e,r)=>{if(!t)return r(`No context`);let i=()=>{t.time.frameCount>=n&&(t.pre_update_callbacks.splice(t.pre_update_callbacks.indexOf(i),1),e())};t.pre_update_callbacks.push(i)})}var Ht=A(`debugresolveurl`);function Ut(e,t){if(t===void 0)return Ht&&console.warn(`getPath: uri is undefined, returning uri`,t),t;if(t.startsWith(`./`))return t;if(t.startsWith(`http`))return Ht&&console.warn(`getPath: uri is absolute, returning uri`,t),t;if(e===void 0)return Ht&&console.warn(`getPath: source is undefined, returning uri`,t),t;t.startsWith(`rel:`)&&(t=t.substring(4));let n=e.lastIndexOf(`/`);if(n>=0){let r=e.substring(0,n+1);for(;r.endsWith(`/`)&&t.startsWith(`/`);)t=t.substring(1);let i=r+t;return Ht&&console.log(`source:`,e,`changed uri
from`,t,`
to `,i,`
basePath: `+r),i}return t}function Wt(e){if(e)return e=e.trim(),e=e.split(`?`)[0]?.split(`#`)[0],e}var Gt=class{subscribeWrite(e){this.writeCallbacks.push(e)}unsubscribeWrite(e){let t=this.writeCallbacks.indexOf(e);t!==-1&&this.writeCallbacks.splice(t,1)}writeCallbacks=[];constructor(e,t){this._object=e,this._prop=t,this._wrapperProp=Symbol(`$`+t),this.apply()}_applied=!1;_object;_prop;_wrapperProp;apply(){if(this._applied||!this._object)return;let e=this._object,t=this._prop;if(e[t]===void 0)return;this._applied=!0,e[this._wrapperProp]!==void 0&&console.warn(`Watcher is being applied to an object that already has a wrapper property. This is not (yet) supported`);let n=e[t];e[this._wrapperProp]=n,Object.defineProperty(e,t,{get:()=>e[this._wrapperProp],set:t=>{e[this._wrapperProp]=t;for(let e of this.writeCallbacks)e(t,this._prop)}})}revoke(){if(!this._applied||!this._object)return;this._applied=!1;let e=this._object,t=this._prop;Reflect.deleteProperty(e,t),e[t]=e[this._wrapperProp],Reflect.deleteProperty(e,this._wrapperProp)}dispose(){this.revoke(),this.writeCallbacks.length=0,this._object=null}},Kt=class e{_watches=[];constructor(t,n){if(Array.isArray(n))for(let r of n)this._watches.push(new e(t,r));else this._watches.push(new Gt(t,n))}subscribeWrite(e){for(let t of this._watches)t.subscribeWrite(e)}unsubscribeWrite(e){for(let t of this._watches)t.unsubscribeWrite(e)}apply(){for(let e of this._watches)e.apply()}revoke(){for(let e of this._watches)e.revoke()}dispose(){for(let e of this._watches)e.dispose();this._watches.length=0}},qt=Symbol(`needle:watches`);function Jt(e,t){if(!e[qt])if(e instanceof w)e[qt]=new Kt(e,[`x`,`y`]);else if(e instanceof o)e[qt]=new Kt(e,[`x`,`y`,`z`]);else if(e instanceof Te||e instanceof E)e[qt]=new Kt(e,[`x`,`y`,`z`,`w`]);else return!1;return e[qt].subscribeWrite(t),!0}function Yt(e,t){if(!e)return;let n=e[qt];n&&n.unsubscribeWrite(t)}var j;(function(e){let t;function n(){if(t!==void 0)return t;let e=window.navigator.userAgent,n=/Windows|MacOS|Mac OS/.test(e),r=/Windows NT/.test(e)&&/Edg/.test(e)&&!/Win64/.test(e);return t=n&&!r&&!y()}e.isDesktop=n;let r;function i(){return r===void 0?r=window.orientation!==void 0||navigator.userAgent.indexOf(`IEMobile`)!==-1?!0:/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent):r}e.isMobileDevice=i;function a(){return s()}e.isIPad=a;let o;function s(){if(o!==void 0)return o;let e=navigator.userAgent.toLowerCase();return o=/iPad/.test(navigator.userAgent)||e.includes(`macintosh`)&&`ontouchend`in document}e.isiPad=s;let c;function l(){return c===void 0?c=/Android/.test(navigator.userAgent):c}e.isAndroidDevice=l;let u;function d(){return u===void 0?u=/WebXRViewer\//i.test(navigator.userAgent):u}e.isMozillaXR=d;let f;function p(){return f===void 0?f=/NeedleAppClip\//i.test(navigator.userAgent):f}e.isNeedleAppClip=p;let m;function h(){if(m!==void 0)return m;if(y()||s())return m=!1;let e=navigator.userAgent.toLowerCase();return m=navigator.userAgentData?navigator.userAgentData.platform===`macOS`:e.includes(`mac os x`)||e.includes(`macintosh`)}e.isMacOS=h;let g;function _(){return g===void 0?g=s()&&`xr`in navigator&&ae():g}e.isVisionOS=_;let v,ee=[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`];function y(){return v===void 0?v=ee.includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document:v}e.isiOS=y;let b;function te(){return b===void 0&&(b=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),b}e.isSafari=te;let ne;function re(){return ne===void 0?ne=navigator.userAgent.includes(`OculusBrowser`):ne}e.isQuest=re;let ie;function ae(){return ie===void 0&&(ie=document.createElement(`a`).relList.supports(`ar`)),ie}e.supportsQuickLookAR=ae;async function oe(){try{return(await navigator.permissions.query({name:`microphone`})).state!==`denied`}catch(e){return console.error("Error querying `microphone` permissions.",e),!1}}e.microphonePermissionsGranted=oe;let se;function ce(){if(se!==void 0)return se;let e=navigator.userAgent.match(/iPhone OS (\d+_\d+)/);if(e&&(se=e[1].replace(`_`,`.`)),!se){let e=navigator.userAgent.match(/(?:\(Macintosh;|iPhone;|iPad;).*Version\/(\d+\.\d+)/);e&&(se=e[1])}return se||=null,se}e.getiOSVersion=ce;let le;function ue(){if(le!==void 0)return le;let e=navigator.userAgent.match(/(?:CriOS|Chrome)\/(\d+\.\d+\.\d+\.\d+)/);return le=e?e[1].replace(`_`,`.`):null,le}e.getChromeVersion=ue;let de;function x(){if(de!==void 0)return de;let e=navigator.userAgent.match(/Version\/(\d+\.\d+)/);return de=e&&te()?e[1]:null,de}e.getSafariVersion=x})(j||={});function Xt(){return j.isMobileDevice()}var Zt=new WeakMap;function Qt(e,t,n){if(!Zt.get(e)){let t=new MutationObserver(t=>{en(e,t)});Zt.set(e,{observer:t,attributeChangedListeners:new Map}),t.observe(e,{attributes:!0})}let r=Zt.get(e).attributeChangedListeners;return r.has(t)||r.set(t,[]),r.get(t).push(n),()=>{$t(e,t,n)}}function $t(e,t,n){if(!Zt.get(e))return;let r=Zt.get(e).attributeChangedListeners;if(!r.has(t))return;let i=r.get(t),a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length<=0&&(r.delete(t),Zt.get(e)?.observer.disconnect(),Zt.delete(e)))}function en(e,t){let n=Zt.get(e).attributeChangedListeners;for(let r of t)if(r.type===`attributes`){let t=r.attributeName,i=e.getAttribute(t);if(n.has(t))for(let e of n.get(t))e(i)}}var tn=class{reason;constructor(e){this.reason=e}};async function nn(e){let t=await Promise.allSettled(e).catch(e=>[new tn(e.message)]),n=!1,r=t.map(e=>`value`in e?e.value:(n=!0,new tn(e.reason)));return{anyFailed:n,results:r}}A(`debugdebug`);var rn=!1;(A(`noerrors`)||A(`nooverlaymessages`))&&(rn=!0);var an=`needle_engine_global_error_container`,on;(function(e){e[e.Log=0]=`Log`,e[e.Warn=1]=`Warn`,e[e.Error=2]=`Error`})(on||={});var sn=[];function cn(e){sn.push(e)}var ln=new Set;function un(e,t,n={},r,i){if(rn)return;if(n.once===!0){let e=``;if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];r instanceof Error&&(r=r.message),typeof r!=`object`&&(n>0&&(e+=` `),e+=r)}else typeof t==`string`&&(e=t);if(ln.has(e))return;ln.add(e)}let a=k.Current,o=a?.domElement??document.querySelector(`needle-engine`);if(a?.isInAR&&(o=a.arOverlayElement),o){if(Array.isArray(t)){let e=``;for(let n=0;n<t.length;n++){let r=t[n];r instanceof Error&&(r=r.message),typeof r!=`object`&&(n>0&&(e+=` `),e+=r)}t=e}!t||t.length<=0||pn(e,o,t,n)}}var dn=new Map,fn=.2;function pn(e,t,n,r={}){if(n==null)return;let i=hn(t);if(i.childElementCount>=20){let e=i.lastElementChild;vn(e)}n.length>400&&(n=n.substring(0,400)+`...`);let a=r.key??n;if(dn.has(a)){dn.get(a)?.update(n,r);return}let o=yn(e,n);i.prepend(o);let s=()=>{dn.delete(a),vn(o)},c=setTimeout(s,Math.max(fn,r.duration??10)*1e3);dn.set(a,{update:(e,t)=>{e.length>400&&(e=e.substring(0,400)+`...`),o.innerHTML=e,t.duration&&(clearTimeout(c),c=setTimeout(s,Math.max(fn,t.duration)*1e3))},removeFunction:s})}var mn=`
@import url('https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap');
div[data-needle_engine_debug_overlay] {
This file has been truncated. show original
needle-engine.extras.CFz2vAB1.js
import{A as e,Fr as t,Jt as n,X as r,cr as i,ft as a,gn as o,kr as s,xr as c}from"./three@0.169.19.js";import{$ as l,Bn as u,Fr as d,Mr as f,Q as p,R as m,Ut as ee,Vr as h,Xt as te,Y as ne,an as re,bt as ie,cr as ae,jr as oe,lr as se,sr as ce}from"./needle-engine-ui.BNxZ9JGV.js";import{B as le}from"./postprocessing.D_9Ug_6_.js";var g=h(`debugpost`),_=null;function ue(e){_=e}function de(e){let t=e.gameObject;for(;t;){for(let e of ee(t))if(e.isPostProcessingManager===!0)return e;t=t.parent}return null}function fe(e){let t=de(e);if(!t)if(_){g&&console.warn(`Adding postprocessing manager to the scene.`);let n=e.scene;t=te(n,_)}else f()&&console.warn(`No post processing manager found`);return t}var v={AT_START:-1e4,NormalPass:0,DepthDownsamplingPass:10,SSAO:20,SMAA:30,TiltShift:40,DepthOfField:50,ChromaticAberration:60,Bloom:70,Vignette:80,Pixelation:90,ToneMapping:100,HueSaturation:110,BrightnessContrast:120,Sharpening:130,AT_END:1e4},y=null;function pe(e){if(g===`verbose`&&console.debug(`Before ordering effects`,[...e]),!y){y=new Map,y.set(u.POSTPROCESSING.MODULE.NormalPass,v.NormalPass),y.set(u.POSTPROCESSING.MODULE.DepthDownsamplingPass,v.DepthDownsamplingPass),y.set(u.POSTPROCESSING.MODULE.SMAAEffect,v.SMAA),y.set(u.POSTPROCESSING.MODULE.SSAOEffect,v.SSAO);let e=u.POSTPROCESSING_AO.MAYBEMODULE;e&&(y.set(e.N8AOPostPass,v.SSAO),y.set(e.N8AOPass,v.SSAO)),y.set(u.POSTPROCESSING.MODULE.TiltShiftEffect,v.TiltShift),y.set(u.POSTPROCESSING.MODULE.DepthOfFieldEffect,v.DepthOfField),y.set(u.POSTPROCESSING.MODULE.ChromaticAberrationEffect,v.ChromaticAberration),y.set(u.POSTPROCESSING.MODULE.BloomEffect,v.Bloom),y.set(u.POSTPROCESSING.MODULE.SelectiveBloomEffect,v.Bloom),y.set(u.POSTPROCESSING.MODULE.VignetteEffect,v.Vignette),y.set(u.POSTPROCESSING.MODULE.PixelationEffect,v.Pixelation),y.set(u.POSTPROCESSING.MODULE.ToneMappingEffect,v.ToneMapping),y.set(u.POSTPROCESSING.MODULE.HueSaturationEffect,v.HueSaturation),y.set(u.POSTPROCESSING.MODULE.BrightnessContrastEffect,v.BrightnessContrast)}e.sort((e,t)=>{let n=typeof e.priority==`number`?e.priority:y.get(e.effect.constructor)??-1/0,r=typeof t.priority==`number`?t.priority:y.get(t.effect.constructor)??-1/0;return n===-1/0?(g&&console.warn(`Unknown effect found: `,e.constructor.name,e),1):r===-1/0?(g&&console.warn(`Unknown effect found: `,t.constructor.name,t),-1):n-r}),g===`verbose`&&console.debug(`After ordering effects`,[...e])}var me=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},he=h(`debugpost`),b=class{isVolumeParameter=!0;constructor(e){e!==void 0&&this.initialize(e)}_isInitialized=!1;get isInitialized(){return this._isInitialized}initialize(e){e!==void 0&&(this._value=e,this._defaultValue=e,this._valueRaw=e,this._isInitialized=!0)}get overrideState(){return this._active}set overrideState(e){if(this._active===e)return;this._active=e;let t=e?this._valueRaw:this._defaultValue;this.processValue(t,!0)}_active=!0;get value(){return this._valueRaw}set value(e){this.isInitialized||this.initialize(e),this.processValue(e,!1)}_value;_valueRaw;set defaultValue(e){this._defaultValue=e}_defaultValue=void 0;__init(){this.processValue(this._valueRaw,!0)}valueProcessor;onValueChanged;processValue(e,t){if(e==null||!t&&this.testIfValueChanged(e)===!1)return;let n=this._value;he&&typeof n==`number`&&typeof e==`number`&&(n?.toFixed(4),e?.toFixed(4)),!this._active&&this._defaultValue!==void 0?(this._value=this._defaultValue,e=this._defaultValue,this._valueRaw=e):(this._valueRaw=e,this._active&&this.valueProcessor&&(e=this.valueProcessor(e)),this._value=e),this.onValueChanged&&this.onValueChanged(e,n,this)}testIfValueChanged(e){return this._valueRaw!==e}};me([p()],b.prototype,`overrideState`,null),me([p()],b.prototype,`value`,null),new class extends re{constructor(){super([b])}onSerialize(e,t){}onDeserialize(e,t){let n=t.target,r=t.path,i;if(n&&r&&(i=n[r]),(typeof i!=`object`||typeof i==`object`&&i.isVolumeParameter!==!0)&&(i=new b),typeof e==`object`&&`value`in e){let t=e.value;i.initialize(t),i.overrideState=e.overrideState}else i.value=e;return i}};var ge=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},x=h(`debugpost`),S=class extends ne{get isPostProcessingEffect(){return!0}order=void 0;constructor(e=void 0){if(super(),e)for(let t of Object.keys(e)){let n=e[t],r=this[t];r instanceof b?r.initialize(n):r!==void 0&&(this[t]=n)}}active=!0;_manager=null;onEnable(){super.onEnable(),x&&console.warn(`Enable`,this.constructor.name+(this.__internalDidAwakeAndStart?``:` (awake)`)),this.__internalDidAwakeAndStart&&(this.active=!0),this.onEffectEnabled()}onDisable(){super.onDisable(),x&&console.warn(`Disable`,this.constructor.name),this._manager?.removeEffect(this),this.active=!1}onEffectEnabled(e){e&&e.isPostProcessingManager===!0?this._manager=e:this._manager||=fe(this),this._manager.addEffect(this),this._manager.dirty=!0}init(){}_result;_postprocessingContext=null;get postprocessingContext(){return this._postprocessingContext}apply(e){return this._postprocessingContext=e,this._result||=(this.initParameters(),this.onCreateEffect?.call(this)),this._result&&this.initParameters(),this._result}unapply(){}dispose(){x&&console.warn(`DISPOSE`,this),this._result&&(Array.isArray(this._result)?this._result.forEach(e=>e.dispose()):this._result.dispose()),this._result=void 0}initParameters(){let e=Object.keys(this);for(let t of e){let e=this[t];e instanceof b&&e.__init()}}onEditorModification(e){let t=e.propertyName;if(this[t]instanceof b){let n=e.value;return this[t].value=n,!0}}};ge([p()],S.prototype,`active`,void 0);var _e=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ve=h(`debugpost`),ye={};function C(e,t){ye[e]=t}function be(e){return e.__type in ye?ye[e.__type]:(ve&&e.__type&&console.warn(`Unknown postprocessing type`,e.__type,e),S)}var w=class{components=[];__init(e){this.components?.forEach(t=>{t.gameObject===void 0&&e.gameObject.addComponent(t),t.init()})}addEffect(e){this.components.push(e)}removeEffect(e){let t=this.components.indexOf(e);t>=0&&this.components.splice(t,1)}};_e([l([e=>be(e),S])],w.prototype,`components`,void 0);var xe=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Se=h(`debugpost`),Ce;(function(e){e[e.LOW=0]=`LOW`,e[e.MEDIUM=1]=`MEDIUM`,e[e.HIGH=2]=`HIGH`,e[e.ULTRA=3]=`ULTRA`})(Ce||={});var T=class extends S{get typeName(){return`Antialiasing`}preset=new b(2);onCreateEffect(){let e=new u.POSTPROCESSING.MODULE.SMAAEffect({preset:this.preset?.value??u.POSTPROCESSING.MODULE.SMAAPreset.HIGH,edgeDetectionMode:u.POSTPROCESSING.MODULE.EdgeDetectionMode.LUMA});return this.preset.onValueChanged=t=>{Se&&console.log(`Antialiasing preset changed to`,t),e.applyPreset(t)},e}};xe([p(b)],T.prototype,`preset`,void 0),C(`Antialiasing`,T);var E=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},D=class e extends S{static useSelectiveBloom=!1;get typeName(){return`Bloom`}threshold=new b(.9);intensity=new b(1);scatter=new b(.7);selectiveBloom;init(){this.threshold.valueProcessor=e=>e,this.intensity.valueProcessor=e=>e,this.scatter.valueProcessor=e=>e}onCreateEffect(){let t;if(this.selectiveBloom??=e.useSelectiveBloom,this.selectiveBloom){let e=t=new u.POSTPROCESSING.MODULE.SelectiveBloomEffect(this.context.scene,this.context.mainCamera,{blendFunction:u.POSTPROCESSING.MODULE.BlendFunction.ADD,mipmapBlur:!0,luminanceThreshold:this.threshold.value,luminanceSmoothing:this.scatter.value,radius:.85,intensity:this.intensity.value});e.inverted=!0}else t=new u.POSTPROCESSING.MODULE.BloomEffect({blendFunction:u.POSTPROCESSING.MODULE.BlendFunction.ADD,mipmapBlur:!0,luminanceThreshold:this.threshold.value,luminanceSmoothing:this.scatter.value,radius:.85,intensity:this.intensity.value});return this.intensity.onValueChanged=e=>{t.intensity=e},this.threshold.onValueChanged=e=>{t.luminanceMaterial.threshold=e**2.2},this.scatter.onValueChanged=e=>{t.luminancePass.enabled=!0,t.luminanceMaterial.smoothing=e,t.mipmapBlurPass&&(t.mipmapBlurPass.radius=n.lerp(.1,.9,e))},t}};E([p(b)],D.prototype,`threshold`,void 0),E([p(b)],D.prototype,`intensity`,void 0),E([p(b)],D.prototype,`scatter`,void 0),C(`Bloom`,D);var we=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},O=class extends S{get typeName(){return`ChromaticAberration`}intensity=new b(0);onCreateEffect(){let e=new u.POSTPROCESSING.MODULE.ChromaticAberrationEffect;return e.offset=new s(0,0),e.radialModulation=!0,e.modulationOffset=.15,this.intensity.valueProcessor=e=>e*.02,this.intensity.onValueChanged=t=>{e.offset.x=-t,e.offset.y=t},e}};we([p(b)],O.prototype,`intensity`,void 0),C(`ChromaticAberration`,O);var k;(function(e){e[e.None=0]=`None`,e[e.Neutral=1]=`Neutral`,e[e.ACES=2]=`ACES`,e[e.AgX=3]=`AgX`,e[e.KhronosNeutral=4]=`KhronosNeutral`})(k||={});var Te=new Map;function A(e){switch(e){case k.None:return 1;case k.Neutral:return 2;case k.ACES:return 4;case k.AgX:return 6;case k.KhronosNeutral:return 7;default:return Te.has(e)||(Te.set(e,!0),console.warn(`[Postprocessing] Unknown tone mapping mode`,e)),7}}function Ee(e){switch(e){case 1:return k.None;case 4:return k.ACES;case 6:return k.AgX;case 7:return k.Neutral;case 2:return k.Neutral;default:return k.None}}function j(e){switch(e){case 1:return u.POSTPROCESSING.MODULE.ToneMappingMode.LINEAR;case 4:return u.POSTPROCESSING.MODULE.ToneMappingMode.ACES_FILMIC;case 6:return u.POSTPROCESSING.MODULE.ToneMappingMode.AGX;case 7:return u.POSTPROCESSING.MODULE.ToneMappingMode.NEUTRAL;case 2:return u.POSTPROCESSING.MODULE.ToneMappingMode.REINHARD;default:return u.POSTPROCESSING.MODULE.ToneMappingMode.LINEAR}}var De=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},M=h(`debugpost`),N=class extends S{get typeName(){return`ToneMapping`}mode=new b(void 0);exposure=new b(1);setMode(e){let t=k[e];return t===void 0?(console.error(`[PostProcessing] Invalid ToneMapping mode`,e),this):(this.mode.value=t,this)}get isToneMapping(){return!0}onEffectEnabled(){let e=de(this);e&&super.onEffectEnabled(e)}_tonemappingEffect=null;onCreateEffect(){if(this.mode.isInitialized==0){let e=Ee(this.context.renderer.toneMapping);M&&console.log(`[PostProcessing] Initializing ToneMapping mode to renderer.toneMapping`,this.context.renderer.toneMapping+` â `+e),this.mode.initialize(e)}this._tonemappingEffect?.dispose();let e=A(this.mode.value),t=this._tonemappingEffect=new u.POSTPROCESSING.MODULE.ToneMappingEffect({mode:j(e)});return this.mode.onValueChanged=n=>{typeof n==`string`?(n=ie(n),t.mode=j(n)):t.mode=j(A(n)),t.name=`ToneMapping (`+k[n]+`)`,M&&console.log(`[PostProcessing] ToneMapping mode changed to`,k[n],e,t.mode)},M&&console.log(`[PostProcessing] Use ToneMapping`,k[this.mode.value],e,t.mode,`renderer.tonemapping: `+this.context.renderer.toneMapping),t}onBeforeRender(){if(this._tonemappingEffect&&this.postprocessingContext?.handler.getEffectIsActive(this._tonemappingEffect)&&(this.mode.overrideState&&(this.context.renderer.toneMapping=A(this.mode.value)),this.exposure.overrideState&&this.exposure.value!==void 0)){let e=Math.max(0,this.exposure.value);this.context.renderer.toneMappingExposure=e}}};De([p(b)],N.prototype,`mode`,void 0),De([p(b)],N.prototype,`exposure`,void 0),C(`Tonemapping`,N);var P=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},F=class extends S{get typeName(){return`ColorAdjustments`}remap=!0;postExposure=new b(1);contrast=new b(0);hueShift=new b(0);saturation=new b(0);init(){this.postExposure.valueProcessor=e=>(this.remap&&(e=2**e),e),this.contrast.valueProcessor=e=>{if(!this.remap)return e;let t=1;return e>0?t=200:e<0&&(t=100),e/t},this.contrast.defaultValue=0,this.hueShift.valueProcessor=e=>this.remap?Math.PI*e/180:e,this.hueShift.defaultValue=0,this.saturation.valueProcessor=e=>this.remap?e<0?e/100:e/(100*Math.PI):e,this.saturation.defaultValue=0}onCreateEffect(){let e=[],t=this.postprocessingContext?.components.find(e=>e instanceof N);t||(t=new N,this.postprocessingContext?.components.push(t)),this.postExposure.onValueChanged=e=>{this.postExposure.overrideState&&t?t.exposure.value=e:console.warn(`[PostProcessing] PostExposure is set to override but no ToneMappingEffect found in the postprocessing stack. Please add a ToneMappingEffect to your postprocessing stack to use PostExposure.`)};let n=new u.POSTPROCESSING.MODULE.BrightnessContrastEffect;this.contrast.onValueChanged=e=>n.contrast=e;let r=new u.POSTPROCESSING.MODULE.HueSaturationEffect;return this.hueShift.onValueChanged=e=>r.hue=e,this.saturation.onValueChanged=e=>r.saturation=e,e.push(n),e.push(r),e}};P([p(b)],F.prototype,`postExposure`,void 0),P([p(b)],F.prototype,`contrast`,void 0),P([p(b)],F.prototype,`hueShift`,void 0),P([p(b)],F.prototype,`saturation`,void 0),C(`ColorAdjustments`,F);var I=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Oe;(function(e){e[e.Off=0]=`Off`,e[e.Gaussian=1]=`Gaussian`,e[e.Bokeh=2]=`Bokeh`})(Oe||={});var ke=h(`debugpost`),L=class extends S{get typeName(){return`DepthOfField`}mode;focusDistance=new b(1);focalLength=new b(.2);aperture=new b(20);gaussianMaxRadius=new b;resolutionScale=new b(1/window.devicePixelRatio);bokehScale=new b;init(){this.focalLength.valueProcessor=e=>{let t=e/300;return oe.lerp(2,.01,t)},this.aperture.valueProcessor=e=>{let t=1-e/32;return oe.lerp(1,20,t)}}onCreateEffect(){if(this.mode===Oe.Off){ke&&console.warn(`DepthOfField: Mode is set to Off`);return}let e=new u.POSTPROCESSING.MODULE.DepthOfFieldEffect(this.context.mainCamera,{worldFocusRange:.2,focalLength:1,bokehScale:20,resolutionScale:this.resolutionScale.value});return this.focusDistance.onValueChanged=t=>{e.cocMaterial.worldFocusDistance=t},this.focalLength.onValueChanged=t=>e.cocMaterial.worldFocusRange=t,this.aperture.onValueChanged=t=>e.bokehScale=t,this.resolutionScale&&(this.resolutionScale.onValueChanged=t=>e.resolution.scale=t),[e]}unapply(){}};I([p()],L.prototype,`mode`,void 0),I([p(b)],L.prototype,`focusDistance`,void 0),I([p(b)],L.prototype,`focalLength`,void 0),I([p(b)],L.prototype,`aperture`,void 0),I([p(b)],L.prototype,`gaussianMaxRadius`,void 0),I([p(b)],L.prototype,`resolutionScale`,void 0),I([p(b)],L.prototype,`bokehScale`,void 0),C(`DepthOfField`,L);var R=class extends S{effect;constructor(e){super(),this.effect=e}get typeName(){return this.effect.constructor.name}onCreateEffect(){return this.effect}},Ae=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},z=class extends S{get typeName(){return`PixelationEffect`}granularity=new b(10);onCreateEffect(){let e=new u.POSTPROCESSING.MODULE.PixelationEffect;return this.granularity.onValueChanged=t=>{e.granularity=t},e}};Ae([p(b)],z.prototype,`granularity`,void 0),C(`PixelationEffect`,z);var B=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},V=class extends S{get typeName(){return`ScreenSpaceAmbientOcclusion`}intensity=new b(2);falloff=new b(1);samples=new b(9);color=new b(new e(0,0,0));luminanceInfluence=new b(.7);onBeforeRender(){if(this._ssao&&this.context.mainCamera instanceof o){let e=this.context.mainCamera.far-this.context.mainCamera.near;this._ssao.ssaoMaterial.worldDistanceFalloff=e*.01,this._ssao.ssaoMaterial.worldDistanceThreshold=this.context.mainCamera.far}}_ssao;onCreateEffect(){let t=this.context.mainCamera,n=new u.POSTPROCESSING.MODULE.NormalPass(this.context.scene,t),r=new u.POSTPROCESSING.MODULE.DepthDownsamplingPass({normalBuffer:n.texture,resolutionScale:.5}),i=this._ssao=new u.POSTPROCESSING.MODULE.SSAOEffect(t,n.texture,{normalDepthBuffer:r.texture,worldDistanceThreshold:1,worldDistanceFalloff:1,worldProximityThreshold:.1,worldProximityFalloff:2,intensity:1,blendFunction:u.POSTPROCESSING.MODULE.BlendFunction.MULTIPLY,luminanceInfluence:.5});this.intensity.onValueChanged=e=>{i.intensity=e},this.falloff.onValueChanged=e=>{i.ssaoMaterial.radius=e*.1},this.samples.onValueChanged=e=>{i.ssaoMaterial.samples=e},this.color.onValueChanged=t=>{i.color||=new e,i.color.copy(t)},this.luminanceInfluence.onValueChanged=e=>{i.luminanceInfluence=e};let a=[];return a.push(n),a.push(r),a.push(i),a}};B([p(b)],V.prototype,`intensity`,void 0),B([p(b)],V.prototype,`falloff`,void 0),B([p(b)],V.prototype,`samples`,void 0),B([p(b)],V.prototype,`color`,void 0),B([p(b)],V.prototype,`luminanceInfluence`,void 0),C(`ScreenSpaceAmbientOcclusion`,V);var H=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},je=h(`debugN8AO`),U;(function(e){e[e.Performance=0]=`Performance`,e[e.Low=1]=`Low`,e[e.Medium=2]=`Medium`,e[e.High=3]=`High`,e[e.Ultra=4]=`Ultra`})(U||={});var W=class extends S{get typeName(){return`ScreenSpaceAmbientOcclusionN8`}get pass(){return this._ssao}gammaCorrection=!0;aoRadius=new b(1);falloff=new b(1);intensity=new b(1);color=new b(new e(0,0,0));screenspaceRadius=!1;quality=U.Medium;_ssao;onValidate(){this._ssao&&(this._ssao.setQualityMode(U[this.quality]),this._ssao.configuration.gammaCorrection=this.gammaCorrection,this._ssao.configuration.screenSpaceRadius=this.screenspaceRadius)}onCreateEffect(){let n=this.context.mainCamera,r=this.context.domWidth,i=this.context.domHeight,a=this._ssao=new u.POSTPROCESSING_AO.MODULE.N8AOPostPass(this.context.scene,n,r,i);a.name=`SSAO_N8`;let o=U[this.quality];if(a.setQualityMode(o),a.configuration.transparencyAware=!1,a.configuration.halfRes=window.devicePixelRatio>1,a.effectCompositerQuad?.material){let e=a.effectCompositerQuad.material;e.fragmentShader=e.fragmentShader.replace(`if (depth == 1.0) {
texel = vec4(0.0, 0.0, 0.0, 1.0);`,`if (depth == 1.0) {
gl_FragColor = sceneTexel;
return;`),e.needsUpdate=!0}let s=new t(r,i);return a.configuration.beautyRenderTarget=s,a.configuration.autoRenderBeauty=!1,a.configuration.gammaCorrection=this.gammaCorrection,a.configuration.screenSpaceRadius=this.screenspaceRadius,je&&(a.enableDebugMode(),console.log(a),setInterval(()=>{console.log(`SSAO`,a.lastTime)},1e3),setInterval(()=>{console.log(`SSAO`,a.enabled,{ssao:a,autoRenderBeauty:a.configuration.autoRenderBeauty})},4e3)),this.intensity.onValueChanged=e=>{a.configuration.intensity=e},this.falloff.onValueChanged=e=>{a.configuration.distanceFalloff=e},this.aoRadius.onValueChanged=e=>{a.configuration.aoRadius=e},this.color.onValueChanged=t=>{a.color||=new e,a.configuration.color.copy(t)},a}};H([m(),p()],W.prototype,`gammaCorrection`,void 0),H([p(b)],W.prototype,`aoRadius`,void 0),H([p(b)],W.prototype,`falloff`,void 0),H([p(b)],W.prototype,`intensity`,void 0),H([p(b)],W.prototype,`color`,void 0),H([m(),p()],W.prototype,`screenspaceRadius`,void 0),H([m(),p()],W.prototype,`quality`,void 0),C(`ScreenSpaceAmbientOcclusionN8`,W);var Me=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ne=class extends S{get typeName(){return`Sharpening`}order=v.Sharpening;_effect;onCreateEffect(){return this._effect??=new(Pe()),this.effect}get effect(){return this._effect}set amount(e){this._amount=e,this._effect&&(this._effect.uniforms.get(`amount`).value=e)}get amount(){return this._effect?this._effect.uniforms.get(`amount`).value:this._amount}_amount=1;set radius(e){this._radius=e,this._effect&&(this._effect.uniforms.get(`radius`).value=e)}get radius(){return this._effect?this._effect.uniforms.get(`radius`).value:this._radius}_radius=1};Me([p()],Ne.prototype,`amount`,null),Me([p()],Ne.prototype,`radius`,null);function Pe(){class e extends u.POSTPROCESSING.MODULE.Effect{constructor(){super(`Sharpening`,`
uniform sampler2D tDiffuse;
uniform float amount;
uniform float radius;
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
float tx = 1.0 / resolution.x;
This file has been truncated. show original
needle-engine.extras.DjbtahoH.js
import{n as e}from"./rolldown-runtime.CYVBeYYp.js";import{d as t}from"./materialx.DvP4Fl1E.js";import{$n as n,A as r,Ar as i,At as a,D as o,Gn as s,Jt as c,Kn as l,Mr as u,Mt as d,Nr as f,Nt as p,P as m,Q as ee,Qn as h,Qt as g,R as te,Rr as ne,S as re,T as ie,Tn as ae,Xt as oe,Z as se,Zn as ce,Zt as _,_ as le,_n as v,_r as ue,a as de,c as fe,d as pe,fn as y,fr as me,gn as he,gr as ge,hn as _e,i as ve,in as ye,jr as be,jt as xe,kr as Se,kt as Ce,nr as we,qt as Te,s as Ee,st as De,tr as Oe,tt as ke,u as Ae,ur as je,ut as Me,vn as Ne,wn as b,x as Pe,y as Fe,yn as Ie}from"./three@0.169.19.js";import{$ as x,$n as Le,A as Re,An as ze,B as Be,Bn as Ve,Br as He,Bt as Ue,C as We,Cr as Ge,D as Ke,Dn as qe,Dt as Je,E as Ye,Er as Xe,F as S,Fn as Ze,Fr as C,Ft as Qe,G as $e,Gr as et,Gt as tt,H as nt,Hn as rt,Hr as it,Ht as at,I as ot,It as st,J as ct,Jr as lt,K as w,Kn as ut,Kr as dt,L as T,Ln as E,Lr as ft,Lt as pt,M as mt,Mr as D,Nn as ht,Nr as gt,Nt as _t,O as vt,On as yt,Or as bt,P as xt,Pn as St,Pt as Ct,Q as O,Qr as wt,Qt as Tt,Rr as k,Rt as Et,S as Dt,Sn as Ot,T as kt,Tr as At,U as jt,Ur as Mt,V as Nt,Vn as Pt,Vr as A,Vt as Ft,W as j,Wn as It,Wt as M,X as Lt,Xr as Rt,Y as N,Yn as zt,Yr as Bt,Yt as Vt,Z as P,Zr as Ht,Zt as Ut,_ as Wt,_n as Gt,_r as Kt,_t as F,a as qt,ar as Jt,at as Yt,b as Xt,br as Zt,bt as Qt,cn as $t,cr as en,ct as tn,d as nn,dr as rn,et as an,f as on,fr as sn,ft as cn,g as ln,gn as un,gr as dn,gt as fn,h as pn,hn as mn,hr as I,ht as hn,i as gn,in as _n,it as vn,j as yn,jn as bn,jr as L,k as xn,kn as R,kr as Sn,kt as Cn,l as wn,lt as Tn,mn as En,mt as Dn,n as On,ni as kn,nn as An,nr as jn,nt as Mn,o as Nn,on as Pn,ot as Fn,p as In,pn as z,pr as B,pt as Ln,q as Rn,qr as zn,r as Bn,ri as Vn,rn as Hn,rr as Un,rt as Wn,s as Gn,sn as Kn,sr as V,st as qn,t as Jn,ti as Yn,tn as Xn,tr as Zn,tt as Qn,u as $n,ur as er,ut as tr,v as nr,vn as rr,vr as ir,vt as ar,w as or,wr as sr,x as cr,xr as lr,xt as ur,y as dr,yn as fr,yr as pr,yt as mr,z as hr,zr as gr,zt as _r}from"./needle-engine-ui.BNxZ9JGV.js";import{A as vr,S as yr,i as br,n as xr,p as Sr,r as Cr,t as wr}from"./three-examples@0.169.19.js";import{$ as Tr,A as Er,At as Dr,B as Or,Bt as kr,C as Ar,Ct as jr,D as Mr,Dt as Nr,E as Pr,Et as Fr,F as Ir,Ft as Lr,G as Rr,Gt as zr,H as Br,Ht as Vr,I as Hr,It as Ur,J as Wr,K as Gr,Kt as Kr,L as qr,Lt as Jr,M as Yr,Mt as Xr,N as Zr,Nt as Qr,O as $r,Ot as ei,P as ti,Pt as ni,Q as ri,R as ii,Rt as ai,S as oi,St as si,T as ci,Tt as li,U as ui,Ut as di,V as fi,Vt as pi,W as mi,Wt as hi,X as gi,Y as _i,Z as vi,_ as yi,_t as bi,a as xi,at as Si,b as Ci,bt as wi,c as Ti,ct as Ei,d as Di,dt as Oi,et as ki,f as Ai,ft as ji,g as Mi,gt as Ni,h as Pi,ht as Fi,i as Ii,it as H,j as Li,jt as Ri,k as zi,kt as Bi,l as Vi,lt as Hi,m as Ui,mt as Wi,n as Gi,nt as Ki,o as qi,ot as Ji,p as Yi,pt as Xi,q as U,qt as Zi,r as Qi,rt as $i,s as ea,st as ta,t as na,tt as ra,u as ia,ut as aa,v as oa,vt as sa,w as ca,wt as la,x as ua,xt as da,y as fa,yt as pa,z as ma,zt as ha}from"./needle-engine-webxr.BCDw_IOW.js";import{C as ga,E as _a,S as va,T as ya,_ as ba,a as xa,b as Sa,c as Ca,d as wa,f as Ta,g as Ea,h as Da,i as Oa,l as ka,m as Aa,n as ja,o as Ma,p as Na,r as Pa,s as Fa,t as Ia,u as La,v as Ra,w as za,x as Ba,y as Va}from"./needle-engine-particles.pwaenldd.js";import{_ as Ha,a as Ua,c as Wa,d as Ga,f as Ka,g as qa,h as Ja,i as Ya,l as Xa,m as Za,n as Qa,o as $a,p as eo,r as to,s as no,t as ro,u as io}from"./needle-engine.extras.CFz2vAB1.js";var ao=A(`debugoverlay`),oo=`quit-ar`,so=class{get ARContainer(){return this.arContainer}arContainer=null;currentSession=null;_createdAROnlyElements=[];_reparentedObjects=[];contentElement=null;originalDomOverlayParent=null;requestEndAR=()=>{this.onRequestedEndAR()};onBegin(e,t,n){if(this.currentSession=n,this.arContainer=t,C.isMozillaXR()||C.isNeedleAppClip()){let n=e.domElement.children;for(let e=0;e<n?.length;e++){let t=n[e];if(!t||t===this.arContainer)return;this._reparentedObjects.push({el:t,previousParent:t.parentElement}),this.arContainer?.appendChild(t)}t?(this.originalDomOverlayParent=t.parentNode,this.originalDomOverlayParent&&(console.log(`Reparent DOM Overlay to body`,t,t.style.display),t.style.display=``,t.style.visibility=``,document.body.appendChild(t))):console.warn(`WebXRViewer: No DOM Overlay found`)}this.ensureQuitARButton(this.arContainer)}onEnd(e){for(let e of this._createdAROnlyElements)e.remove&&e.remove();for(let e of this._reparentedObjects){let t=e.el;e.previousParent?.appendChild(t)}this._reparentedObjects.length=0,C.isMozillaXR()&&setTimeout(()=>{let t=e.renderer.domElement;t&&e.domElement.shadowRoot?.prepend(t);let n=document.querySelectorAll(`*`);for(var r=0;r<n.length;r++){let e=n[r];e&&e._displayChanged!==void 0&&e._displayWas!==void 0&&(e.style.display=e._displayWas)}},10)}createOverlayContainer(e){if(this.contentElement)return this.contentElement;ao&&console.log(`Setup overlay container`);let t=e.shadowRoot.querySelector(`.content`);this.contentElement=t;let n=e.shadowRoot.querySelector(`.overlay-content`);return n&&t.appendChild(n),ao&&!C.isMobileDevice()&&this.ensureQuitARButton(t),t}onRequestedEndAR(){this.currentSession&&=(this.currentSession.end(),null)}ensureQuitARButton(e){let t=document.createElement(`slot`);if(t.style.display=`contents`,t.style.padding=`10px`,t.setAttribute(`name`,`quit-ar`),this.appendElement(t,e),this._createdAROnlyElements.push(t),t.style.pointerEvents=`auto`,C.isNeedleAppClip()){globalThis.NEEDLE_ENGINE_APPCLIP_DISABLE_MENU=!0;let e=document.querySelector(`meta[name="viewport"]`);e&&!e.getAttribute(`content`)?.includes(`viewport-fit=`)&&e.setAttribute(`content`,e.getAttribute(`content`)+`,viewport-fit=cover`)}let n=document.querySelector(`.${oo}`);if(n){n.addEventListener(`click`,this.requestEndAR),ao&&n.addEventListener(`click`,()=>console.log(`Clicked quit-ar button`));return}t.addEventListener(`click`,this.requestEndAR),ao&&t.addEventListener(`click`,()=>console.log(`Clicked fallback close button`));let r=document.createElement(`div`);r.style.cssText=`
position: fixed;
top: 0;
right: 0;
z-index: 600;
pointer-events: all;
padding-top: env(safe-area-inset-top, 0px);
padding-right: calc(env(safe-area-inset-right, 0px) + 10px);
`,this.appendElement(r,t);var i=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);i.classList.add(`quit-ar-button`),i.setAttribute(`width`,`40px`),i.setAttribute(`height`,`40px`),i.style.cssText=`
background: rgba(255, 255, 255, .4);
This file has been truncated. show original