@needle-tools/engine 3.31.7 → 3.31.8

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/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [3.31.7] - 2023-02-26
7
+ ## [3.31.8] - 2023-02-26
8
8
  - Fix: PostProcessing Exposure not working anymore with tonemapping
9
9
  - Fix: PostProcessing multisampling being disabled on mobile
10
10
  - Change: bump postprocessing package to `6.34.3`
@@ -31406,11 +31406,11 @@ function xr(i, A) {
31406
31406
  return !0;
31407
31407
  }
31408
31408
  const AT = sA("debugdefines");
31409
- Gw('if(!globalThis[""3.31.7""]) globalThis[""3.31.7""] = "0.0.0";');
31409
+ Gw('if(!globalThis[""3.31.8""]) globalThis[""3.31.8""] = "0.0.0";');
31410
31410
  Gw('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
31411
- Gw('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.7";');
31411
+ Gw('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.8";');
31412
31412
  Gw('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
31413
- const ZC = "3.31.7", bR = "undefined";
31413
+ const ZC = "3.31.8", bR = "undefined";
31414
31414
  AT && console.log(`Engine version: ${ZC} (generator: ${bR})`);
31415
31415
  const ra = "needle_isActiveInHierarchy", BQ = "builtin_components", Up = "needle_editor_guid";
31416
31416
  function Gw(i) {
@@ -31406,11 +31406,11 @@ function gu(n, e) {
31406
31406
  return !0;
31407
31407
  }
31408
31408
  const vU = re("debugdefines");
31409
- C_('if(!globalThis[""3.31.7""]) globalThis[""3.31.7""] = "0.0.0";');
31409
+ C_('if(!globalThis[""3.31.8""]) globalThis[""3.31.8""] = "0.0.0";');
31410
31410
  C_('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
31411
- C_('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.7";');
31411
+ C_('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.8";');
31412
31412
  C_('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
31413
- const Fl = "3.31.7", _T = "undefined";
31413
+ const Fl = "3.31.8", _T = "undefined";
31414
31414
  vU && console.log(`Engine version: ${Fl} (generator: ${_T})`);
31415
31415
  const Wc = "needle_isActiveInHierarchy", Gd = "builtin_components", qy = "needle_editor_guid";
31416
31416
  function C_(n) {
@@ -4076,7 +4076,7 @@ void main() {
4076
4076
  `){super("lineBreak",e,!0),this._newLineBreakability=null}update(e,t){this._needsProcess=!0}process(e){const t=e._whiteSpace._newLineBreakability;if(e._inlines._value)for(let s=0;s<e._inlines._value.length;s++){const r=e._inlines._value[s],n=r.char;let o=null;n!==void 0&&(t!=="nowrap"&&(this._value.includes(n)||n.match(/\s/g))&&(o="possible"),n.match(/\n/g)&&(o=t)),r.lineBreak=o}}get value(){return this._value}}class MO extends fi{constructor(){super("layouter",null,!1),this._value=null}update(e,t){this._value=e._parent.find(s=>s.isUI&&s.isText),this._needsProcess=!0}process(e){this._value&&(this._value._layouter._needsProcess=!0)}}class yY extends Vm{constructor(e){super("backgroundColor",e,!1),this._allowsInherit=!1,this._input=0}computeOutputValue(e){this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._value.set(this._input)}}class TO extends xk{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class IO extends wk{constructor(){super()}computeOutputValue(e){this._value=yC(this.getInheritedInput(e))}}class RO extends Rk{constructor(){super("fontFamily","inherit",!0),this._input="inherit",this._needsUpdate=!0,this._allowsInherit=!1}computeOutputValue(e){let t=this._inheritedInput;if(t==="inherit"&&(t=this.getInheritedInput(e)),t instanceof C0)this._value=t,e._font._needsUpdate=!0;else if(typeof t=="string"){const s=fu.getFontFamily(t);s?(this._value=s,e._font._needsUpdate=!0):console.warn(`(.style) fontFamily, the font '${t}' is not registered. Aborted.`)}else console.warn("(.style) fontFamily requires a registered fontFamily instance, or the id of a registered fontFamily."),console.warn("If you want to set a specific font, please use .font property instead.")}get value(){return this._value}}class iE extends Bk{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited,this._whiteSpacedContent="",this._stringCollapser=this.emptyStrategyLogic,this._inlineCollapser=this.emptyStrategyLogic,this._inlineWrapper=this.emptyStrategyLogic}_computeFromInherited(e){switch(super._computeFromInherited(e),this._newLineBreakability=bY(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=_Y;break;case"pre-line":this._stringCollapser=BO;break;default:this._stringCollapser=xY}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=MY;break;case"pre-wrap":this._inlineCollapser=EY;break;default:this._inlineCollapser=TY}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=wY;break;case"pre":this._inlineWrapper=SY;break;default:this._inlineWrapper=CY}this._needsProcess=!0}process(e){e.isInline&&!e.isInlineBlock&&(this._whiteSpacedContent=this._stringCollapser(e._textContent._value),e._glyphs._needsProcess=!0)}}const PO={" ":" ","\n":`
4077
4077
  `,"\r":"\r"," ":" "},bY=function(i){switch(i){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function _Y(i){return BO(i.replace(/\n/g," "))}function BO(i){return i.replace(/[ ]{2,}/g," ")}function xY(i){return i}function wY(i,e,t,s){const r=i[e];if(r.lineBreak==="mandatory"||t+r.xadvance+r.xoffset+r.kerning>s.INNER_WIDTH)return!0;const n=OO(i,e,s);return IY(i[e-1],t,n,s)}function SY(i,e,t,s){return i[e].lineBreak==="mandatory"}function CY(){return!1}function EY(i){if(!i[0])return 0;const e=i[0],t=i[i.length-1];return e.char&&e.char===`
4078
4078
  `&&i.length>1&&kO([e],i[1]),t.char&&t.char===`
4079
- `&&i.length>1&&DO([t],i[i.length-2]),e.offsetX}function MY(i){if(!i[0])return 0;let e=[],t;for(let s=0;s<i.length;s++){const r=i[s];if(r.char&&PO[r.char]&&i.length>s){e.push(r),t=i[s+1];continue}break}kO(e,t),e=[],t=null;for(let s=i.length-1;s>0;s--){const r=i[s];if(r.char&&PO[r.char]&&s>0){e.push(r),t=i[s-1];continue}break}return DO(e,t),i[0].offsetX}function TY(i){return i[0]?i[0].offsetX:0}function DO(i,e){if(e)for(let t=0;t<i.length;t++){const s=i[t];s.fontFactor=0,s.offsetX=e.offsetX+e.cumulativeWidth,s.cumulativeWidth=0}}function kO(i,e){if(e)for(let t=0;t<i.length;t++){const s=i[t];s.fontFactor=0,s.offsetX=e.offsetX,s.cumulativeWidth=0}}function OO(i,e,t,s){if(s=s||0,!i[e])return s;const r=i[e];return r.lineBreak?s+r.xadvance:OO(i,e+1,t,s+r.xadvance+r.xoffset+r.kerning+t.LETTERSPACING)}function IY(i,e,t,s){return!i||!i.char||e+t<s.INNER_WIDTH?!1:s.BREAKON.indexOf(i.char)>-1}class LO extends Dk{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._fontSize._needsProcess=!0,e._layouter._needsProcess=!0}}class UO extends Ni{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._font._fontVariant&&(e._bounds._needsProcess=!0,e._layouter._needsProcess=!0)}process(e){if(!e._font._fontVariant||!e._font._fontVariant.isReady)return;const t=this._value/e._font._fontVariant.typographic.size,s=e._inlines._value;for(let r=0;r<s.length;r++){const n=s[r];n.resetOffsets(),n.fontSize=this._value,n.fontFactor=t}}get value(){return this._value}}class FO extends kk{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),e._layouter._needsUpdate=!0}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class RY extends FO{constructor(){super(),this._value="inherit"}}class PY extends M0{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value._layouter._needsProcess=!1}process(e){if(this._value!=="none"){const t=e._whiteSpace._whiteSpacedContent,s=e._inlines._value;for(let r=1;r<s.length;r++){const n=t[r-1]+t[r];s[r].kerning=e._font._fontVariant.getKerningAmount(n)}}}}class NO extends fi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function BY(i,e=!1){const t=i[0].index!==null,s=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),n={},o={},a=i[0].morphTargetsRelative,l=new Qe.BufferGeometry;let c=0;for(let u=0;u<i.length;++u){const d=i[u];let p=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in d.attributes){if(!s.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;n[f]===void 0&&(n[f]=[]),n[f].push(d.attributes[f]),p++}if(p!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in d.morphAttributes){if(!r.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[f]===void 0&&(o[f]=[]),o[f].push(d.morphAttributes[f])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(d.userData),e){let f;if(t)f=d.index.count;else if(d.attributes.position!==void 0)f=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,f,u),c+=f}}if(t){let u=0;const d=[];for(let p=0;p<i.length;++p){const f=i[p].index;for(let m=0;m<f.count;++m)d.push(f.getX(m)+u);u+=i[p].attributes.position.count}l.setIndex(d)}for(const u in n){const d=zO(n[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(const u in o){const d=o[u][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let p=0;p<d;++p){const f=[];for(let A=0;A<o[u].length;++A)f.push(o[u][A][p]);const m=zO(f);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function zO(i){let e,t,s,r=0;for(let a=0;a<i.length;++a){const l=i[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(s===void 0&&(s=l.normalized),s!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=l.array.length}const n=new e(r);let o=0;for(let a=0;a<i.length;++a)n.set(i[a].array,o),o+=i[a].array.length;return new Qe.BufferAttribute(n,t,s)}class DY extends fi{constructor(){super("renderer")}render(e){if(!e._inlines._value||!e._inlines._value.length)return;const t=e._inlines._value.map(r=>e._font._fontVariant.getGeometricGlyph(r,e).translate(r.offsetX,r.offsetY,0)),s=BY(t);e.setFontMesh(new Qe.Mesh(s,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class kY extends xC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class Wf extends Jm{constructor(e={}){const t={};Wf.definePropertiesValues(t,e),super(t,e),h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),Wf.init(this)}add(e){const t=[];for(let s=0;s<arguments.length;s++){const r=arguments[s];!r.isUI||r.isInline?(t.push(r),r.position.z=.005):console.warn("Block element can only contain Box elements.",r)}return super.add(...t)}set textContent(e){this._textContent.value=e}get textContent(){return this._textContent._value}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(e,t){e.children||(e.children=NO),e.textContent||(e.textContent=mY),e.glyphs||(e.glyphs=vY),e.inlines||(e.inlines=gY),e.layouter||(e.layouter=MO),e.renderer||(e.renderer=DY),e.fontFamily||(e.fontFamily=RO),e.fontWeight||(e.fontWeight=IO),e.fontStyle||(e.fontStyle=TO),e.fontSize||(e.fontSize=UO),e.color||(e.color=AY),e.backgroundColor||(e.backgroundColor=yY),e.lineBreak||(e.lineBreak=EO),e.letterSpacing||(e.letterSpacing=LO),e.whiteSpace||(e.whiteSpace=iE),e.segments||(e.segments=RY),e.textAlign||(e.textAlign=kY),e.fontKerning||(e.fontKerning=PY)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class OY extends _k{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this._needsUpdate=!1;for(let s=e.children.length-1;s>=0;s--){const r=e.children[s];r.isUI&&(e.remove(r),r.clear())}e._children._uis=[],this._value&&e.add(new Wf({name:"anonymousInline",textContent:this._value}))}}class LY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class UY extends fi{constructor(){super("layouter",null,!1),this._value=null}update(e,t){}process(e){let t=e._width._value;e._width._auto?t=1/0:t=e._bounds._innerWidth;const s=e._lineHeight._value,r=new LY(new CO);let n=0;e._children._inlines.forEach(d=>{if(!d._inlines.value)return;this._resetInlines(d);const p=d._fontSize._value,f=d._letterSpacing._value*p,m=d._whiteSpace._value,A=d._lineBreak._value,v={WHITESPACE:m,LETTERSPACING:f,BREAKON:A,INNER_WIDTH:t},g=d._whiteSpace._inlineWrapper;n+=d._margin._value.w+d._padding._value.w,d._inlines.value.forEach((b,y,_)=>{const S=r[r.length-1];if(g(_,y,n,v)){if(r.push(new CO(b)),b.offsetX=b.xoffset,b.width===0){n=0;return}b.cumulativeWidth=b.xadvance+f,n=b.cumulativeWidth;return}r[r.length-1].push(b),b.offsetX=n+b.xoffset+b.kerning,b.cumulativeWidth=b.xadvance+b.kerning+f,n+=b.cumulativeWidth,S.length-1===1&&S[S.length-2].width===0&&(b.offsetX-=b.xoffset,n-=b.xoffset)}),n+=d._margin._value.y+d._padding._value.y});const o=e._whiteSpace._inlineCollapser;let a=0,l=0,c=0;r.forEach((d,p)=>{const f=o(d);let m=0,A=0;if(d.forEach(v=>{m=Math.max(m,v.lineHeight),A=Math.max(A,v.lineBase),v.offsetX-=f}),d.lineHeight=m,d.lineBase=A,p===0?c=-(m*s-m)*.5:c-=r[p-1].lineHeight*s,d.y=c,d.x=0,d.forEach(v=>{v.offsetY=c-v.anchor,v.lineHeight<d.lineHeight&&(v.offsetY-=d.lineBase-v.lineBase)}),l+=d.lineHeight*s,d.width=0,d[0]){const v=d[d.length-1];d.width=v.offsetX+v.cumulativeWidth+v.paddingRight+v.marginRight+d[0].offsetX,a=Math.max(a,d.width)}}),r.height=l,r.width=a,this._value=r,t===1/0&&e._bounds.setChildrenWidth(e,r.width),e._height._auto&&e._bounds.setChildrenHeight(e,r.height);const u=e._parent._value;u&&(u._autoSize._needsProcess=!0,u._flexDirection._needsProcess=!0),e._inlineJustificator._needsProcess=!0,e._textAlign._needsProcess=!0,e._overflow._needsUpdate=!0}_resetInlines(e){e._fontSize.process(e)}}class FY extends xC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){NY(e),e._renderer._needsRender=!0}}function NY(i){const e=i._layouter._value,t=i._textAlign._value,s=i._bounds._innerWidth;for(let r=0;r<e.length;r++){const n=e[r],o=zY(i,n,r===e.length-1),a=i._padding._value,l=i._borderWidth._value,c=(-a.w+a.y)/2+(-l.w+l.y)/2;n.x+=o;for(let u=0;u<n.length;u++)n[u].offsetX+=o-c}if(t.indexOf("justify")===0)for(let r=0;r<e.length;r++){const n=e[r];if(t.indexOf("-")!==-1&&r===e.length-1)return;const o=s-n.width;if(o<=0)return;let a=0;for(let d=1;d<n.length-1;d++)a+=n[d].char===" "?1:0;const l=o/a;let c=1;t==="justify-right"&&(n.reverse(),c=-1);let u=0;for(let d=1;d<=n.length-1;d++){const p=n[d];p.offsetX+=u*c,u+=p.char===" "?l:0}t==="justify-right"&&n.reverse()}}function zY(i,e,t){switch(i._textAlign._value){case"justify-left":case"justify":case"left":return-i._bounds._innerWidth/2;case"justify-right":case"right":return-e.width+i._bounds._innerWidth/2;case"center":return-e.width/2;case"justify-center":return t?-e.width/2:-i._bounds._innerWidth/2;default:console.warn(`textAlign: '${i._textAlign._value}' is not valid`)}}class jY extends wC{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class GY extends Pk{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class QY extends M0{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class VY extends _O{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class HY extends fi{constructor(){super("children",null,!1),h(this,"_sortOrder",(e,t)=>e._order._value<t._order._value?-1:e._order._value>t._order._value?1:this._uis.indexOf(e)<this._uis.indexOf(t)?-1:1),this._uis=[],this._inlines=[],this._boxes=[]}update(e,t){this._compute(e),this._needsProcess=!0}process(e){this._compute(e),e._overflow._needsRender=!0}_compute(e){this._uis=e.children.filter(t=>t.visible&&t.isUI),this._inlines=this._uis.filter(t=>t.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class WY extends fi{constructor(){super("autosize")}process(e){if(e._layouter._value&&e._layouter._value.length){const t=e._layouter._value,s=e._padding._value,r=e._borderWidth._value;e._width._auto&&e._bounds.setOffsetWidth(e,t.width+s.w+s.y+r.w+r.y),e._height._auto&&e._bounds.setOffsetHeight(e,t.height+s.x+s.z+r.x+r.z)}}}class XY extends SO{constructor(){super("renderer"),this._needsUpdate=!1}render(e){super.render(e);for(const t of e._children._inlines)t._renderer.render(t);e.performAfterUpdate()}}class DA extends PA{constructor(e={},t={}){DA.definePropertiesValues(t,e),super(t,e),DA.init(this)}add(e){const t=[];let s=!1;for(let r=0;r<arguments.length;r++){const n=arguments[r];!n.isUI||n.isInline?(n.isInline&&(s=!0),t.push(n)):console.warn("Block element can only contain Box elements.",n)}return t.length>0&&super.add(...t),s&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(e){this._textContent.value=e}get textContent(){return super.textContent}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(e,t){e.flexDirection=jY,e.justifyContent=SC,e.alignItems=_C,e.bounds=VY,e.autoSize=WY,e.renderer=XY,e.children||(e.children=HY),e.textContent||(e.textContent=OY),e.layouter||(e.layouter=UY),e.lineHeight||(e.lineHeight=GY),e.textAlign||(e.textAlign=FY),e.whiteSpace||(e.whiteSpace=iE),e.fontKerning||(e.fontKerning=QY),e.segments||(e.segments=FO),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class qY extends fi{constructor(){super("inlines",null,!1),this._value=[]}process(e){this._value[0].paddingLeft=e._padding._value.w,this._value[0].marginLeft=e._margin._value.w;const t=this._value.length-1;this._value[t].paddingRight=e._padding._value.y,this._value[t].marginRight=e._margin._value.y}}class YY extends fi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new wO(e)),e._backgroundMesh.position.x=e._inlines._value[0].offsetX+e._inlines._value[0].width/2,e._backgroundMesh.position.y=e._inlines._value[0].offsetY+e._inlines._value[0].lineBase/2,e._bounds.render(e)}}class KY extends fi{constructor(){super("bounds",null,!1),this._size=new Qe.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(e,t){this.output(t),this._needsProcess=!0}process(e){this._offsetWidth=this._innerWidth=e._inlines._value[0].width,this._offsetHeight=this._innerHeight=e._inlines._value[0].height,this._needsRender=!0,e._borderWidth._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(e){e.size=this._size}}class kA extends Jm{constructor(e={}){const t={};kA.definePropertiesValues(t,e),super(t,e),kA.init(this)}clear(){for(const e of this._inlines._value)e.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new Qe.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(e){const t=[];for(let s=0;s<arguments.length;s++){const r=arguments[s];r.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",r):(t.push(r),r.position.z=.005)}return super.add(...t)}static definePropertiesValues(e,t){e.children||(e.children=NO),e.bounds||(e.bounds=KY),e.inlines||(e.inlines=qY),e.layouter||(e.layouter=MO),e.renderer||(e.renderer=YY),e.fontFamily||(e.fontFamily=RO),e.fontWeight||(e.fontWeight=IO),e.fontStyle||(e.fontStyle=TO),e.fontSize||(e.fontSize=UO),e.backgroundColor||(e.backgroundColor=Ak),e.lineBreak||(e.lineBreak=EO),e.letterSpacing||(e.letterSpacing=LO),e.whiteSpace||(e.whiteSpace=iE),e.fontKerning||(e.fontKerning=M0),t.backgroundSize||(t.backgroundSize="cover"),t.width||(t.width="100%"),t.height||(t.height="100%"),t.boxSizing||(t.boxSizing="border-box")}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),e._inlines._value=[new JY(e)],e.backgroundMaterial=new bO,e._renderer.render(e)}}class JY extends Ek{constructor(e){super(),this._uiElement=e}get xadvance(){const e=this._uiElement._padding._value,t=this._uiElement._width;return t._relative?t._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.w+e.y+t.value}get width(){const e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get height(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get anchor(){return this.height}get lineHeight(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get lineBase(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}clear(){this._uiElement=null}}class jO{constructor(e){this._subject=e}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const GO=()=>L0.update(),QO={BaseProperty:fi,Block:BA,Text:DA,Inline:Wf,InlineBlock:kA,MeshUIBaseElement:Jm,FontLibrary:fu,update:GO,MSDFFontMaterialUtils:Ho,ShaderChunkUI:yO,Behavior:jO,FontVariant:Qm};typeof global<"u"&&(global.ThreeMeshUI=QO);const ZY=QO;var $Y=Cs.w8,VO=Cs.cg,sE=Cs.gO,e7=Cs.wb,rE=Cs.zV,t7=Cs.HS,i7=Cs.Ec,F0=Cs.gF,s7=Cs.ol,r7=Cs.pz,n7=Cs.tx,o7=Cs.hj,a7=Cs.FV,l7=Cs.sV,nE=Cs.xv,c7=Cs.mx,h7=Cs.gE,pp=Cs.ZP,HO=Cs.Vx;const oE=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:$Y,Behavior:VO,Block:sE,DefaultValues:e7,FontLibrary:rE,FontVariant:t7,InheritableProperty:i7,Inline:F0,InlineBlock:s7,InlineGlyph:r7,MSDFFontMaterialUtils:n7,MaterialTransformers:o7,MeshUIBaseElement:a7,ShaderChunkUI:l7,Text:nE,TypographicFont:c7,TypographicGlyph:h7,default:pp,update:HO},Symbol.toStringTag,{value:"Module"}));function gu(i,e){try{e?i(e):i()}catch(t){return console.error(t),!1}return!0}const WO=oe("debugdefines");z0('if(!globalThis[""3.31.7""]) globalThis[""3.31.7""] = "0.0.0";'),z0('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),z0('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.7";'),z0('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Pl="3.31.7",N0="undefined";WO&&console.log(`Engine version: ${Pl} (generator: ${N0})`);const Bl="needle_isActiveInHierarchy",vu="builtin_components",Zm="needle_editor_guid";function z0(i){try{(0,eval)(i)}catch(e){WO&&console.error(e)}}const aE=oe("debugnewscripts"),u7=oe("debughierarchy"),ji=[];function d7(){return ji.length>0}function j0(i){if(!(i.new_scripts.length<=0)){if(aE&&console.log("Register new components",i.new_scripts.length,[...i.new_scripts],i.alias?"element: "+i.alias:i.hash,i),i.new_scripts_pre_setup_callbacks.length>0){for(const e of i.new_scripts_pre_setup_callbacks)e&&e();i.new_scripts_pre_setup_callbacks.length=0}ji.length=0,i.new_scripts.length>0&&ji.push(...i.new_scripts),i.new_scripts.length=0;for(let e=0;e<ji.length;e++)try{const t=ji[e];if(t.isComponent!==!0){(Gt()||aE)&&console.error(`Registered script is not a Needle Engine component.
4079
+ `&&i.length>1&&DO([t],i[i.length-2]),e.offsetX}function MY(i){if(!i[0])return 0;let e=[],t;for(let s=0;s<i.length;s++){const r=i[s];if(r.char&&PO[r.char]&&i.length>s){e.push(r),t=i[s+1];continue}break}kO(e,t),e=[],t=null;for(let s=i.length-1;s>0;s--){const r=i[s];if(r.char&&PO[r.char]&&s>0){e.push(r),t=i[s-1];continue}break}return DO(e,t),i[0].offsetX}function TY(i){return i[0]?i[0].offsetX:0}function DO(i,e){if(e)for(let t=0;t<i.length;t++){const s=i[t];s.fontFactor=0,s.offsetX=e.offsetX+e.cumulativeWidth,s.cumulativeWidth=0}}function kO(i,e){if(e)for(let t=0;t<i.length;t++){const s=i[t];s.fontFactor=0,s.offsetX=e.offsetX,s.cumulativeWidth=0}}function OO(i,e,t,s){if(s=s||0,!i[e])return s;const r=i[e];return r.lineBreak?s+r.xadvance:OO(i,e+1,t,s+r.xadvance+r.xoffset+r.kerning+t.LETTERSPACING)}function IY(i,e,t,s){return!i||!i.char||e+t<s.INNER_WIDTH?!1:s.BREAKON.indexOf(i.char)>-1}class LO extends Dk{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._fontSize._needsProcess=!0,e._layouter._needsProcess=!0}}class UO extends Ni{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._font._fontVariant&&(e._bounds._needsProcess=!0,e._layouter._needsProcess=!0)}process(e){if(!e._font._fontVariant||!e._font._fontVariant.isReady)return;const t=this._value/e._font._fontVariant.typographic.size,s=e._inlines._value;for(let r=0;r<s.length;r++){const n=s[r];n.resetOffsets(),n.fontSize=this._value,n.fontFactor=t}}get value(){return this._value}}class FO extends kk{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),e._layouter._needsUpdate=!0}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class RY extends FO{constructor(){super(),this._value="inherit"}}class PY extends M0{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value._layouter._needsProcess=!1}process(e){if(this._value!=="none"){const t=e._whiteSpace._whiteSpacedContent,s=e._inlines._value;for(let r=1;r<s.length;r++){const n=t[r-1]+t[r];s[r].kerning=e._font._fontVariant.getKerningAmount(n)}}}}class NO extends fi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function BY(i,e=!1){const t=i[0].index!==null,s=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),n={},o={},a=i[0].morphTargetsRelative,l=new Qe.BufferGeometry;let c=0;for(let u=0;u<i.length;++u){const d=i[u];let p=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in d.attributes){if(!s.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;n[f]===void 0&&(n[f]=[]),n[f].push(d.attributes[f]),p++}if(p!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in d.morphAttributes){if(!r.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[f]===void 0&&(o[f]=[]),o[f].push(d.morphAttributes[f])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(d.userData),e){let f;if(t)f=d.index.count;else if(d.attributes.position!==void 0)f=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,f,u),c+=f}}if(t){let u=0;const d=[];for(let p=0;p<i.length;++p){const f=i[p].index;for(let m=0;m<f.count;++m)d.push(f.getX(m)+u);u+=i[p].attributes.position.count}l.setIndex(d)}for(const u in n){const d=zO(n[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(const u in o){const d=o[u][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let p=0;p<d;++p){const f=[];for(let A=0;A<o[u].length;++A)f.push(o[u][A][p]);const m=zO(f);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function zO(i){let e,t,s,r=0;for(let a=0;a<i.length;++a){const l=i[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(s===void 0&&(s=l.normalized),s!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=l.array.length}const n=new e(r);let o=0;for(let a=0;a<i.length;++a)n.set(i[a].array,o),o+=i[a].array.length;return new Qe.BufferAttribute(n,t,s)}class DY extends fi{constructor(){super("renderer")}render(e){if(!e._inlines._value||!e._inlines._value.length)return;const t=e._inlines._value.map(r=>e._font._fontVariant.getGeometricGlyph(r,e).translate(r.offsetX,r.offsetY,0)),s=BY(t);e.setFontMesh(new Qe.Mesh(s,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class kY extends xC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class Wf extends Jm{constructor(e={}){const t={};Wf.definePropertiesValues(t,e),super(t,e),h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),Wf.init(this)}add(e){const t=[];for(let s=0;s<arguments.length;s++){const r=arguments[s];!r.isUI||r.isInline?(t.push(r),r.position.z=.005):console.warn("Block element can only contain Box elements.",r)}return super.add(...t)}set textContent(e){this._textContent.value=e}get textContent(){return this._textContent._value}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(e,t){e.children||(e.children=NO),e.textContent||(e.textContent=mY),e.glyphs||(e.glyphs=vY),e.inlines||(e.inlines=gY),e.layouter||(e.layouter=MO),e.renderer||(e.renderer=DY),e.fontFamily||(e.fontFamily=RO),e.fontWeight||(e.fontWeight=IO),e.fontStyle||(e.fontStyle=TO),e.fontSize||(e.fontSize=UO),e.color||(e.color=AY),e.backgroundColor||(e.backgroundColor=yY),e.lineBreak||(e.lineBreak=EO),e.letterSpacing||(e.letterSpacing=LO),e.whiteSpace||(e.whiteSpace=iE),e.segments||(e.segments=RY),e.textAlign||(e.textAlign=kY),e.fontKerning||(e.fontKerning=PY)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class OY extends _k{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this._needsUpdate=!1;for(let s=e.children.length-1;s>=0;s--){const r=e.children[s];r.isUI&&(e.remove(r),r.clear())}e._children._uis=[],this._value&&e.add(new Wf({name:"anonymousInline",textContent:this._value}))}}class LY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class UY extends fi{constructor(){super("layouter",null,!1),this._value=null}update(e,t){}process(e){let t=e._width._value;e._width._auto?t=1/0:t=e._bounds._innerWidth;const s=e._lineHeight._value,r=new LY(new CO);let n=0;e._children._inlines.forEach(d=>{if(!d._inlines.value)return;this._resetInlines(d);const p=d._fontSize._value,f=d._letterSpacing._value*p,m=d._whiteSpace._value,A=d._lineBreak._value,v={WHITESPACE:m,LETTERSPACING:f,BREAKON:A,INNER_WIDTH:t},g=d._whiteSpace._inlineWrapper;n+=d._margin._value.w+d._padding._value.w,d._inlines.value.forEach((b,y,_)=>{const S=r[r.length-1];if(g(_,y,n,v)){if(r.push(new CO(b)),b.offsetX=b.xoffset,b.width===0){n=0;return}b.cumulativeWidth=b.xadvance+f,n=b.cumulativeWidth;return}r[r.length-1].push(b),b.offsetX=n+b.xoffset+b.kerning,b.cumulativeWidth=b.xadvance+b.kerning+f,n+=b.cumulativeWidth,S.length-1===1&&S[S.length-2].width===0&&(b.offsetX-=b.xoffset,n-=b.xoffset)}),n+=d._margin._value.y+d._padding._value.y});const o=e._whiteSpace._inlineCollapser;let a=0,l=0,c=0;r.forEach((d,p)=>{const f=o(d);let m=0,A=0;if(d.forEach(v=>{m=Math.max(m,v.lineHeight),A=Math.max(A,v.lineBase),v.offsetX-=f}),d.lineHeight=m,d.lineBase=A,p===0?c=-(m*s-m)*.5:c-=r[p-1].lineHeight*s,d.y=c,d.x=0,d.forEach(v=>{v.offsetY=c-v.anchor,v.lineHeight<d.lineHeight&&(v.offsetY-=d.lineBase-v.lineBase)}),l+=d.lineHeight*s,d.width=0,d[0]){const v=d[d.length-1];d.width=v.offsetX+v.cumulativeWidth+v.paddingRight+v.marginRight+d[0].offsetX,a=Math.max(a,d.width)}}),r.height=l,r.width=a,this._value=r,t===1/0&&e._bounds.setChildrenWidth(e,r.width),e._height._auto&&e._bounds.setChildrenHeight(e,r.height);const u=e._parent._value;u&&(u._autoSize._needsProcess=!0,u._flexDirection._needsProcess=!0),e._inlineJustificator._needsProcess=!0,e._textAlign._needsProcess=!0,e._overflow._needsUpdate=!0}_resetInlines(e){e._fontSize.process(e)}}class FY extends xC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){NY(e),e._renderer._needsRender=!0}}function NY(i){const e=i._layouter._value,t=i._textAlign._value,s=i._bounds._innerWidth;for(let r=0;r<e.length;r++){const n=e[r],o=zY(i,n,r===e.length-1),a=i._padding._value,l=i._borderWidth._value,c=(-a.w+a.y)/2+(-l.w+l.y)/2;n.x+=o;for(let u=0;u<n.length;u++)n[u].offsetX+=o-c}if(t.indexOf("justify")===0)for(let r=0;r<e.length;r++){const n=e[r];if(t.indexOf("-")!==-1&&r===e.length-1)return;const o=s-n.width;if(o<=0)return;let a=0;for(let d=1;d<n.length-1;d++)a+=n[d].char===" "?1:0;const l=o/a;let c=1;t==="justify-right"&&(n.reverse(),c=-1);let u=0;for(let d=1;d<=n.length-1;d++){const p=n[d];p.offsetX+=u*c,u+=p.char===" "?l:0}t==="justify-right"&&n.reverse()}}function zY(i,e,t){switch(i._textAlign._value){case"justify-left":case"justify":case"left":return-i._bounds._innerWidth/2;case"justify-right":case"right":return-e.width+i._bounds._innerWidth/2;case"center":return-e.width/2;case"justify-center":return t?-e.width/2:-i._bounds._innerWidth/2;default:console.warn(`textAlign: '${i._textAlign._value}' is not valid`)}}class jY extends wC{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class GY extends Pk{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class QY extends M0{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class VY extends _O{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class HY extends fi{constructor(){super("children",null,!1),h(this,"_sortOrder",(e,t)=>e._order._value<t._order._value?-1:e._order._value>t._order._value?1:this._uis.indexOf(e)<this._uis.indexOf(t)?-1:1),this._uis=[],this._inlines=[],this._boxes=[]}update(e,t){this._compute(e),this._needsProcess=!0}process(e){this._compute(e),e._overflow._needsRender=!0}_compute(e){this._uis=e.children.filter(t=>t.visible&&t.isUI),this._inlines=this._uis.filter(t=>t.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class WY extends fi{constructor(){super("autosize")}process(e){if(e._layouter._value&&e._layouter._value.length){const t=e._layouter._value,s=e._padding._value,r=e._borderWidth._value;e._width._auto&&e._bounds.setOffsetWidth(e,t.width+s.w+s.y+r.w+r.y),e._height._auto&&e._bounds.setOffsetHeight(e,t.height+s.x+s.z+r.x+r.z)}}}class XY extends SO{constructor(){super("renderer"),this._needsUpdate=!1}render(e){super.render(e);for(const t of e._children._inlines)t._renderer.render(t);e.performAfterUpdate()}}class DA extends PA{constructor(e={},t={}){DA.definePropertiesValues(t,e),super(t,e),DA.init(this)}add(e){const t=[];let s=!1;for(let r=0;r<arguments.length;r++){const n=arguments[r];!n.isUI||n.isInline?(n.isInline&&(s=!0),t.push(n)):console.warn("Block element can only contain Box elements.",n)}return t.length>0&&super.add(...t),s&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(e){this._textContent.value=e}get textContent(){return super.textContent}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(e,t){e.flexDirection=jY,e.justifyContent=SC,e.alignItems=_C,e.bounds=VY,e.autoSize=WY,e.renderer=XY,e.children||(e.children=HY),e.textContent||(e.textContent=OY),e.layouter||(e.layouter=UY),e.lineHeight||(e.lineHeight=GY),e.textAlign||(e.textAlign=FY),e.whiteSpace||(e.whiteSpace=iE),e.fontKerning||(e.fontKerning=QY),e.segments||(e.segments=FO),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class qY extends fi{constructor(){super("inlines",null,!1),this._value=[]}process(e){this._value[0].paddingLeft=e._padding._value.w,this._value[0].marginLeft=e._margin._value.w;const t=this._value.length-1;this._value[t].paddingRight=e._padding._value.y,this._value[t].marginRight=e._margin._value.y}}class YY extends fi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new wO(e)),e._backgroundMesh.position.x=e._inlines._value[0].offsetX+e._inlines._value[0].width/2,e._backgroundMesh.position.y=e._inlines._value[0].offsetY+e._inlines._value[0].lineBase/2,e._bounds.render(e)}}class KY extends fi{constructor(){super("bounds",null,!1),this._size=new Qe.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(e,t){this.output(t),this._needsProcess=!0}process(e){this._offsetWidth=this._innerWidth=e._inlines._value[0].width,this._offsetHeight=this._innerHeight=e._inlines._value[0].height,this._needsRender=!0,e._borderWidth._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(e){e.size=this._size}}class kA extends Jm{constructor(e={}){const t={};kA.definePropertiesValues(t,e),super(t,e),kA.init(this)}clear(){for(const e of this._inlines._value)e.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new Qe.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(e){const t=[];for(let s=0;s<arguments.length;s++){const r=arguments[s];r.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",r):(t.push(r),r.position.z=.005)}return super.add(...t)}static definePropertiesValues(e,t){e.children||(e.children=NO),e.bounds||(e.bounds=KY),e.inlines||(e.inlines=qY),e.layouter||(e.layouter=MO),e.renderer||(e.renderer=YY),e.fontFamily||(e.fontFamily=RO),e.fontWeight||(e.fontWeight=IO),e.fontStyle||(e.fontStyle=TO),e.fontSize||(e.fontSize=UO),e.backgroundColor||(e.backgroundColor=Ak),e.lineBreak||(e.lineBreak=EO),e.letterSpacing||(e.letterSpacing=LO),e.whiteSpace||(e.whiteSpace=iE),e.fontKerning||(e.fontKerning=M0),t.backgroundSize||(t.backgroundSize="cover"),t.width||(t.width="100%"),t.height||(t.height="100%"),t.boxSizing||(t.boxSizing="border-box")}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),e._inlines._value=[new JY(e)],e.backgroundMaterial=new bO,e._renderer.render(e)}}class JY extends Ek{constructor(e){super(),this._uiElement=e}get xadvance(){const e=this._uiElement._padding._value,t=this._uiElement._width;return t._relative?t._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.w+e.y+t.value}get width(){const e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get height(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get anchor(){return this.height}get lineHeight(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get lineBase(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}clear(){this._uiElement=null}}class jO{constructor(e){this._subject=e}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const GO=()=>L0.update(),QO={BaseProperty:fi,Block:BA,Text:DA,Inline:Wf,InlineBlock:kA,MeshUIBaseElement:Jm,FontLibrary:fu,update:GO,MSDFFontMaterialUtils:Ho,ShaderChunkUI:yO,Behavior:jO,FontVariant:Qm};typeof global<"u"&&(global.ThreeMeshUI=QO);const ZY=QO;var $Y=Cs.w8,VO=Cs.cg,sE=Cs.gO,e7=Cs.wb,rE=Cs.zV,t7=Cs.HS,i7=Cs.Ec,F0=Cs.gF,s7=Cs.ol,r7=Cs.pz,n7=Cs.tx,o7=Cs.hj,a7=Cs.FV,l7=Cs.sV,nE=Cs.xv,c7=Cs.mx,h7=Cs.gE,pp=Cs.ZP,HO=Cs.Vx;const oE=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:$Y,Behavior:VO,Block:sE,DefaultValues:e7,FontLibrary:rE,FontVariant:t7,InheritableProperty:i7,Inline:F0,InlineBlock:s7,InlineGlyph:r7,MSDFFontMaterialUtils:n7,MaterialTransformers:o7,MeshUIBaseElement:a7,ShaderChunkUI:l7,Text:nE,TypographicFont:c7,TypographicGlyph:h7,default:pp,update:HO},Symbol.toStringTag,{value:"Module"}));function gu(i,e){try{e?i(e):i()}catch(t){return console.error(t),!1}return!0}const WO=oe("debugdefines");z0('if(!globalThis[""3.31.8""]) globalThis[""3.31.8""] = "0.0.0";'),z0('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),z0('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.8";'),z0('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Pl="3.31.8",N0="undefined";WO&&console.log(`Engine version: ${Pl} (generator: ${N0})`);const Bl="needle_isActiveInHierarchy",vu="builtin_components",Zm="needle_editor_guid";function z0(i){try{(0,eval)(i)}catch(e){WO&&console.error(e)}}const aE=oe("debugnewscripts"),u7=oe("debughierarchy"),ji=[];function d7(){return ji.length>0}function j0(i){if(!(i.new_scripts.length<=0)){if(aE&&console.log("Register new components",i.new_scripts.length,[...i.new_scripts],i.alias?"element: "+i.alias:i.hash,i),i.new_scripts_pre_setup_callbacks.length>0){for(const e of i.new_scripts_pre_setup_callbacks)e&&e();i.new_scripts_pre_setup_callbacks.length=0}ji.length=0,i.new_scripts.length>0&&ji.push(...i.new_scripts),i.new_scripts.length=0;for(let e=0;e<ji.length;e++)try{const t=ji[e];if(t.isComponent!==!0){(Gt()||aE)&&console.error(`Registered script is not a Needle Engine component.
4080
4080
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4081
4081
  `,t),ji.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.error("MISSING GAMEOBJECT - will ignore",t),ji.splice(e,1),e--;continue}t.context=i,$m(t.gameObject),lE(t,i)}catch(t){console.error(t),Dl(ji[e],i),ji.splice(e,1),e--}for(let e=0;e<ji.length;e++)try{const t=ji[e];if(t.destroyed){Dl(ji[e],i),ji.splice(e,1),e--;continue}if(t.registering)try{t.registering()}catch(s){console.error(s)}t.__internalAwake!==void 0&&(t.gameObject||console.error("MISSING GAMEOBJECT",t,t.gameObject),$m(t.gameObject),t.activeAndEnabled&&gu(t.__internalAwake.bind(t)))}catch(t){console.error(t),Dl(ji[e],i),ji.splice(e,1),e--}for(let e=0;e<ji.length;e++)try{const t=ji[e];if(t.destroyed||t.enabled===!1||($m(t.gameObject),t.activeAndEnabled===!1))continue;t.__internalEnable!==void 0&&(t.enabled=!0,gu(t.__internalEnable.bind(t)))}catch(t){console.error(t),Dl(ji[e],i),ji.splice(e,1),e--}for(let e=0;e<ji.length;e++)try{const t=ji[e];if(t.destroyed||!t.gameObject)continue;i.new_script_start.push(t)}catch(t){console.error(t),Dl(ji[e],i),ji.splice(e,1),e--}ji.length=0;for(const e of i.new_scripts_post_setup_callbacks)e&&e();i.new_scripts_post_setup_callbacks.length=0}}function p7(i){i&&(i.__internalDisable(!0),Dl(i,i.context))}function XO(i,e){for(let t=0;t<i.new_script_start.length;t++)try{const s=i.new_script_start[t];if(e!==void 0&&s.gameObject!==e||s.destroyed||s.activeAndEnabled===!1)continue;gu(s.__internalAwake.bind(s)),s.enabled&&(gu(s.__internalEnable.bind(s)),gu(s.__internalStart.bind(s)),i.new_script_start.splice(t,1),t--)}catch(s){console.error(s),Dl(i.new_script_start[t],i),i.new_script_start.splice(t,1),t--}}function lE(i,e){e.scripts.indexOf(i)===-1&&(e.scripts.push(i),i.earlyUpdate&&e.scripts_earlyUpdate.push(i),i.update&&e.scripts_update.push(i),i.lateUpdate&&e.scripts_lateUpdate.push(i),i.onBeforeRender&&e.scripts_onBeforeRender.push(i),i.onAfterRender&&e.scripts_onAfterRender.push(i),i.onPausedChanged&&e.scripts_pausedChanged.push(i))}function Dl(i,e){kl(i,e.new_scripts),kl(i,e.new_script_start),kl(i,e.scripts),kl(i,e.scripts_earlyUpdate),kl(i,e.scripts_update),kl(i,e.scripts_lateUpdate),kl(i,e.scripts_onBeforeRender),kl(i,e.scripts_onAfterRender),kl(i,e.scripts_pausedChanged),e.stopAllCoroutinesFrom(i)}function kl(i,e){const t=e.indexOf(i);t>=0&&e.splice(t,1)}function G0(i){if(i||(i=Mi.Current.scene),!i){console.trace("Invalid call - no current context.");return}const e=vp(i);qO(i,e,!0)||(aE||Gt()?console.error(`Error updating hierarchy
4082
4082
  Do you have circular references in your project? <a target="_blank" href="https://docs.needle.tools/circular-reference"> Click here for more information.`,i):console.error('Failed to update active state in hierarchy of "'+i.name+'"',i),console.warn(" \u2191 this error might be caused by circular references. Please make sure you don't have files with circular references (e.g. one GLB 1 is loading GLB 2 which is then loading GLB 1 again)."))}function qO(i,e,t,s=0){if(s>1e3)return console.warn("Hierarchy is too deep (> 1000 level) - will abort updating active state"),!1;const r=vp(i);if(e&&(e=r,e&&i.parent)){const a=i.parent;e=a[Bl],e===void 0&&(a instanceof _n||(e=!0))}const n=i[Bl]!==e;i[Bl]=e,n&&(u7&&console.warn("ACTIVE CHANGE",i.name,r,i.visible,e,"changed?"+n,i),t&&f7(i,a=>{e?a.enabled&&(gu(a.__internalAwake.bind(a)),a.enabled&&(a.__didEnable=!0,a.onEnable())):a.__didAwake&&a.enabled&&(a.__didEnable=!1,a.onDisable())}));let o=!0;if(i.children){const a=s+1;for(const l of i.children)qO(l,e,t,a)===!1&&(o=!1)}return o}function $m(i){let e=!0,t=i,s=!1;for(;t&&t;){if(t.type==="Scene"&&(s=!0),!vp(t)){e=!1;break}t=t.parent}if(!i){console.error("GO is null");return}i[Bl]=e&&s}function f7(i,e){var t;if((t=i.userData)!=null&&t.components)for(const s of i.userData.components)e(s)}const Q0=new Map,YO=Symbol("prewarmFlag"),cE=Symbol("waitingForPrewarm"),hE=oe("debugprewarm");function KO(i,e){!i||i[YO]===!0||i[cE]===!0||(Q0.has(e)||Q0.set(e,[]),i[cE]=!0,Q0.get(e).push(i),hE&&console.debug("register prewarm",i.name))}let uE=null,dE=null;function m7(i){if(!i)return;const e=Q0.get(i);if(!(e!=null&&e.length))return;const t=i.mainCamera;if(t){hE&&console.log("prewarm",e.length,"objects",[...e]);const s=i.renderer;if(s.compile){const r=i.scene;s.compile(r,t),uE??(uE=new Q1(64)),dE??(dE=new G1(.001,9999999,uE)),dE.update(s,r);for(const n of e)n[YO]=!0,n[cE]=!1;e.length=0,hE&&console.log("prewarm done")}}}const g7=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function v7(i){return typeof i=="string"&&g7.test(i)}const hr=[];for(let i=0;i<256;++i)hr.push((i+256).toString(16).slice(1));function A7(i,e=0){return hr[i[e+0]]+hr[i[e+1]]+hr[i[e+2]]+hr[i[e+3]]+"-"+hr[i[e+4]]+hr[i[e+5]]+"-"+hr[i[e+6]]+hr[i[e+7]]+"-"+hr[i[e+8]]+hr[i[e+9]]+"-"+hr[i[e+10]]+hr[i[e+11]]+hr[i[e+12]]+hr[i[e+13]]+hr[i[e+14]]+hr[i[e+15]]}function y7(i){if(!v7(i))throw TypeError("Invalid UUID");let e;const t=new Uint8Array(16);return t[0]=(e=parseInt(i.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(i.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(i.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(i.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(i.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}function b7(i){i=unescape(encodeURIComponent(i));const e=[];for(let t=0;t<i.length;++t)e.push(i.charCodeAt(t));return e}const _7="6ba7b810-9dad-11d1-80b4-00c04fd430c8",x7="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function w7(i,e,t){function s(r,n,o,a){var l;if(typeof r=="string"&&(r=b7(r)),typeof n=="string"&&(n=y7(n)),((l=n)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+r.length);if(c.set(n),c.set(r,n.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,o){a=a||0;for(let u=0;u<16;++u)o[a+u]=c[u];return o}return A7(c)}try{s.name=i}catch{}return s.DNS=_7,s.URL=x7,s}function S7(i,e,t,s){switch(i){case 0:return e&t^~e&s;case 1:return e^t^s;case 2:return e&t^e&s^t&s;case 3:return e^t^s}}function pE(i,e){return i<<e|i>>>32-e}function C7(i){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){const o=unescape(encodeURIComponent(i));i=[];for(let a=0;a<o.length;++a)i.push(o.charCodeAt(a))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);const s=i.length/4+2,r=Math.ceil(s/16),n=new Array(r);for(let o=0;o<r;++o){const a=new Uint32Array(16);for(let l=0;l<16;++l)a[l]=i[o*64+l*4]<<24|i[o*64+l*4+1]<<16|i[o*64+l*4+2]<<8|i[o*64+l*4+3];n[o]=a}n[r-1][14]=(i.length-1)*8/Math.pow(2,32),n[r-1][14]=Math.floor(n[r-1][14]),n[r-1][15]=(i.length-1)*8&4294967295;for(let o=0;o<r;++o){const a=new Uint32Array(80);for(let f=0;f<16;++f)a[f]=n[o][f];for(let f=16;f<80;++f)a[f]=pE(a[f-3]^a[f-8]^a[f-14]^a[f-16],1);let l=t[0],c=t[1],u=t[2],d=t[3],p=t[4];for(let f=0;f<80;++f){const m=Math.floor(f/20),A=pE(l,5)+S7(m,c,u,d)+p+e[m]+a[f]>>>0;p=d,d=u,u=pE(c,30)>>>0,c=l,l=A}t[0]=t[0]+l>>>0,t[1]=t[1]+c>>>0,t[2]=t[2]+u>>>0,t[3]=t[3]+d>>>0,t[4]=t[4]+p>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}const E7=w7("v5",80,C7),JO=E7;var Hn=(i=>(i[i.OnConnection=0]="OnConnection",i[i.OnRoomJoin=1]="OnRoomJoin",i[i.Queued=2]="Queued",i[i.Immediate=3]="Immediate",i))(Hn||{});Mi.registerCallback(Ws.ContextCreated,i=>{const e=i.context;sL(e),iL(e)});const V0=oe("debugcomponents"),ZO="eff8ba80-635d-11ec-90d6-0242ac120003";class nr{constructor(e){h(this,"_originalSeed"),h(this,"_seed"),typeof e=="string"&&(e=nr.hash(e)),this._originalSeed=e,this._seed=e}get seed(){return this._seed}set seed(e){this._seed=e}reset(){this._seed=this._originalSeed}generateUUID(e){if(typeof e=="string")return JO(e,ZO);const t=this._seed;return this._seed-=1,JO(t.toString(),ZO)}initialize(e){typeof e=="string"?this._seed=nr.hash(e):this._seed=e}static createFromString(e){return new nr(this.hash(e))}static hash(e){let t=0;for(let s=0;s<e.length;s++)t=e.charCodeAt(s)+((t<<5)-t);return t}}var $O=(i=>(i.NewInstanceCreated="new-instance-created",i.InstanceDestroyed="instance-destroyed",i))($O||{});class eL{constructor(e){h(this,"guid"),this.guid=e}}function H0(i,e,t=!0){if(!i)return;const s=i;if(Ba(i,t),!e){console.warn("Can not send destroy: No networking connection provided",i.guid);return}if(!e.isConnected){console.warn("Can not send destroy: not connected",i.guid);return}let r=i.guid;if(!r&&s.uuid&&(r=s.uuid),!r){console.warn("Can not send destroy: failed to find guid",i);return}const n=new eL(r);e.send("instance-destroyed",n,Hn.Queued)}function tL(i,e){const t=new eL(i);e.send("instance-destroyed",t,Hn.Queued)}function iL(i){i.connection.beginListen("instance-destroyed",e=>{V0&&console.log("[Remote] Destroyed",i.scene,e);const t=mg(e.guid,i.scene);t&&Ba(t)})}class M7{constructor(e,t,s){h(this,"filename"),h(this,"hash"),h(this,"size"),this.filename=e,this.hash=t,this.size=s}}class T7{constructor(e,t){h(this,"guid"),h(this,"originalGuid"),h(this,"seed"),h(this,"visible"),h(this,"hostData"),h(this,"dontSave"),h(this,"parent"),h(this,"position"),h(this,"rotation"),h(this,"scale"),this.originalGuid=e,this.guid=t}}function fE(i,e,t,s){var r;const n=i;if(!n.guid)return console.warn("Can not instantiate: No guid",n),null;if(e.context||(e.context=Nt.Current),!e.context)return console.error("Missing network instantiate options / reference to network connection in sync instantiate"),null;const o=e?{...e}:null,{instance:a,seed:l}=I7(n,e);if(a){const c=a;if(c.guid){V0&&console.log("[Local] new instance","gameobject:",a?.guid);const u=new T7(n.guid,c.guid);u.seed=l,o&&(o.position&&(u.position={x:o.position.x,y:o.position.y,z:o.position.z}),o.rotation&&(u.rotation={x:o.rotation.x,y:o.rotation.y,z:o.rotation.z,w:o.rotation.w}),o.scale&&(u.scale={x:o.scale.x,y:o.scale.y,z:o.scale.z})),u.position||(u.position={x:c.position.x,y:c.position.y,z:c.position.z}),u.rotation||(u.rotation={x:c.quaternion.x,y:c.quaternion.y,z:c.quaternion.z,w:c.quaternion.w}),u.scale||(u.scale={x:c.scale.x,y:c.scale.y,z:c.scale.z}),u.visible=n.visible,o!=null&&o.parent&&(typeof o.parent=="string"?u.parent=o.parent:u.parent=o.parent.guid),u.hostData=t,s===!1&&(u.dontSave=!0),(r=e?.context)==null||r.connection.send("new-instance-created",u)}else console.warn("Missing guid, can not send new instance event",c)}return a}function W0(){return Math.random()*9999999}function sL(i){i.connection.beginListen("new-instance-created",async e=>{const t=await R7(e.originalGuid,i.scene);if(!t){console.warn("could not find object that was instantiated: "+e.guid);return}const s=new _a;e.position&&(s.position=new w(e.position.x,e.position.y,e.position.z)),e.rotation&&(s.rotation=new Me(e.rotation.x,e.rotation.y,e.rotation.z,e.rotation.w)),e.scale&&(s.scale=new w(e.scale.x,e.scale.y,e.scale.z)),s.parent=e.parent,e.seed&&(s.idProvider=new nr(e.seed)),s.visible=e.visible,s.context=i,V0&&i.alias&&console.log("[Remote] instantiate in: "+i.alias);const r=gg(t,s);r&&(e.parent==="scene"&&i.scene.add(r),V0&&console.log("[Remote] new instance","gameobject:",r?.guid,t))})}function I7(i,e){const t=W0(),s=e??new _a;s.idProvider=new nr(t);const r=gg(i,s);return{seed:t,instance:r}}const rL={};function nL(i,e){rL[i]=e}async function R7(i,e){const t=rL[i];if(t!=null){const s=await t(i);if(s)return s}return oL(i,e)}function oL(i,e){if(e===null||!i)return null;if(e.guid===i)return e;if(e.children)for(const t of e.children){const s=oL(i,t);if(s)return s}return null}const aL=new Map;function P7(i,e){if(!i)return;if(!e){console.warn("No prototype found",i,i.prototype,i.constructor);return}const t=aL.get(e);t&&t.apply(i)}function B7(i){const e=D7(i.prototype);aL.set(i,e)}function D7(i){return new k7(i)}class k7{constructor(e){h(this,"$symbol"),h(this,"extensions"),h(this,"descriptors"),this.$symbol=Symbol("prototype-extension"),this.extensions=Object.keys(e),this.descriptors=new Array;for(let t=0;t<this.extensions.length;t++){const s=this.extensions[t],r=Object.getOwnPropertyDescriptor(e,s);r&&this.descriptors.push(r)}}apply(e){if(!e[this.$symbol]){e[this.$symbol]=!0;for(let t=0;t<this.extensions.length;t++){const s=this.extensions[t],r=this.descriptors[t];r&&Object.defineProperty(e,s,r)}}}}var eg=(i=>(i.Added="component-added",i.Removing="removing-component",i))(eg||{});const lL=oe("debugcomponentevents");class tg{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let s=this.eventListeners.get(e);s||(s=[]),s.push(t),this.eventListeners.set(e,s),lL&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const s=this.eventListeners.get(e);if(!s)return;const r=s.indexOf(t);r<0||s.splice(r,1)}static dispatchComponentLifecycleEvent(e,t){const s=this.eventListeners.get(e);if(lL&&console.log("Dispatching event "+e,s),!!s)for(const r of s)r(t)}}h(tg,"eventListeners",new Map);const mE=oe("debuggetcomponent");function O7(i){return i==null||i.isObject3D?i:i.object&&i.object.isObject3D?i.object:i}function gE(i,e){if(!i||!i.userData.components)return;const t=i.userData.components.indexOf(e);t<0||(tg.dispatchComponentLifecycleEvent(eg.Removing,e),e.gameObject=null,i.userData.components.splice(t,1))}function X0(i,e){const t=fp(i,e);if(t)return t;const s=new e;return jc(i,s)}const cL=new nr("addComponentIdProvider");function jc(i,e,t=!0){i.userData||(i.userData={}),i.userData.components||(i.userData.components=[]),i.userData.components.push(e),e.gameObject=i,(e.guid===void 0||e.guid==="invalid")&&(e.guid=cL.generateUUID()),$0(i),Hb(e);try{t&&e.__internalAwake&&($m(i),e.activeAndEnabled&&e.__internalAwake()),tg.dispatchComponentLifecycleEvent(eg.Added,e)}catch(s){console.error(s)}return e}function vE(i,e){if(typeof e=="function")return jc(i,new e);if(e.destroyed)return console.warn("Can not move/add a destroyed component",e),e;if(e.gameObject===i)return e;if(e.gameObject&&e.gameObject.userData.components){const t=e.gameObject.userData.components.indexOf(e);e.gameObject.userData.components.splice(t,1)}if(!i.userData.components)i.userData.components=[];else if(i.userData.components.includes(e))return e;return i.userData.components.push(e),e.gameObject=i,(e.guid===void 0||e.guid==="invalid")&&(e.guid=cL.generateUUID()),Hb(e),e}function hL(i){if(i.gameObject&&i.gameObject.userData.components){const e=i.gameObject.userData.components.indexOf(i);i.gameObject.userData.components.splice(e,1)}i.__internalDisable&&i.__internalDisable(),Dl(i,i.context??Nt.Current),i.destroy(),i.gameObject=null}let uL=!1;function dL(i,e,t){var s;if(i==null)return null;if(!i.isObject3D)return console.error("Object is not object3D"),null;if(!((s=i?.userData)!=null&&s.components)||(typeof e=="string"&&(uL||(uL=!0,console.warn(`Accessing components by name is not supported.
@@ -4076,7 +4076,7 @@ void main() {
4076
4076
  `){super("lineBreak",e,!0),this._newLineBreakability=null}update(e,t){this._needsProcess=!0}process(e){const t=e._whiteSpace._newLineBreakability;if(e._inlines._value)for(let i=0;i<e._inlines._value.length;i++){const s=e._inlines._value[i],r=s.char;let o=null;r!==void 0&&(t!=="nowrap"&&(this._value.includes(r)||r.match(/\s/g))&&(o="possible"),r.match(/\n/g)&&(o=t)),s.lineBreak=o}}get value(){return this._value}}class lN extends vi{constructor(){super("layouter",null,!1),this._value=null}update(e,t){this._value=e._parent.find(i=>i.isUI&&i.isText),this._needsProcess=!0}process(e){this._value&&(this._value._layouter._needsProcess=!0)}}class yY extends iA{constructor(e){super("backgroundColor",e,!1),this._allowsInherit=!1,this._input=0}computeOutputValue(e){this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._value.set(this._input)}}class cN extends hU{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class hN extends uU{constructor(){super()}computeOutputValue(e){this._value=WT(this.getInheritedInput(e))}}class uN extends vU{constructor(){super("fontFamily","inherit",!0),this._input="inherit",this._needsUpdate=!0,this._allowsInherit=!1}computeOutputValue(e){let t=this._inheritedInput;if(t==="inherit"&&(t=this.getInheritedInput(e)),t instanceof mx)this._value=t,e._font._needsUpdate=!0;else if(typeof t=="string"){const i=Yu.getFontFamily(t);i?(this._value=i,e._font._needsUpdate=!0):console.warn(`(.style) fontFamily, the font '${t}' is not registered. Aborted.`)}else console.warn("(.style) fontFamily requires a registered fontFamily instance, or the id of a registered fontFamily."),console.warn("If you want to set a specific font, please use .font property instead.")}get value(){return this._value}}class vI extends bU{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited,this._whiteSpacedContent="",this._stringCollapser=this.emptyStrategyLogic,this._inlineCollapser=this.emptyStrategyLogic,this._inlineWrapper=this.emptyStrategyLogic}_computeFromInherited(e){switch(super._computeFromInherited(e),this._newLineBreakability=bY(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=_Y;break;case"pre-line":this._stringCollapser=dN;break;default:this._stringCollapser=xY}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=MY;break;case"pre-wrap":this._inlineCollapser=EY;break;default:this._inlineCollapser=TY}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=wY;break;case"pre":this._inlineWrapper=SY;break;default:this._inlineWrapper=CY}this._needsProcess=!0}process(e){e.isInline&&!e.isInlineBlock&&(this._whiteSpacedContent=this._stringCollapser(e._textContent._value),e._glyphs._needsProcess=!0)}}const bD={" ":" ","\n":`
4077
4077
  `,"\r":"\r"," ":" "},bY=function(n){switch(n){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function _Y(n){return dN(n.replace(/\n/g," "))}function dN(n){return n.replace(/[ ]{2,}/g," ")}function xY(n){return n}function wY(n,e,t,i){const s=n[e];if(s.lineBreak==="mandatory"||t+s.xadvance+s.xoffset+s.kerning>i.INNER_WIDTH)return!0;const r=mN(n,e,i);return IY(n[e-1],t,r,i)}function SY(n,e,t,i){return n[e].lineBreak==="mandatory"}function CY(){return!1}function EY(n){if(!n[0])return 0;const e=n[0],t=n[n.length-1];return e.char&&e.char===`
4078
4078
  `&&n.length>1&&pN([e],n[1]),t.char&&t.char===`
4079
- `&&n.length>1&&fN([t],n[n.length-2]),e.offsetX}function MY(n){if(!n[0])return 0;let e=[],t;for(let i=0;i<n.length;i++){const s=n[i];if(s.char&&bD[s.char]&&n.length>i){e.push(s),t=n[i+1];continue}break}pN(e,t),e=[],t=null;for(let i=n.length-1;i>0;i--){const s=n[i];if(s.char&&bD[s.char]&&i>0){e.push(s),t=n[i-1];continue}break}return fN(e,t),n[0].offsetX}function TY(n){return n[0]?n[0].offsetX:0}function fN(n,e){if(e)for(let t=0;t<n.length;t++){const i=n[t];i.fontFactor=0,i.offsetX=e.offsetX+e.cumulativeWidth,i.cumulativeWidth=0}}function pN(n,e){if(e)for(let t=0;t<n.length;t++){const i=n[t];i.fontFactor=0,i.offsetX=e.offsetX,i.cumulativeWidth=0}}function mN(n,e,t,i){if(i=i||0,!n[e])return i;const s=n[e];return s.lineBreak?i+s.xadvance:mN(n,e+1,t,i+s.xadvance+s.xoffset+s.kerning+t.LETTERSPACING)}function IY(n,e,t,i){return!n||!n.char||e+t<i.INNER_WIDTH?!1:i.BREAKON.indexOf(n.char)>-1}class gN extends _U{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._fontSize._needsProcess=!0,e._layouter._needsProcess=!0}}class AN extends qi{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._font._fontVariant&&(e._bounds._needsProcess=!0,e._layouter._needsProcess=!0)}process(e){if(!e._font._fontVariant||!e._font._fontVariant.isReady)return;const t=this._value/e._font._fontVariant.typographic.size,i=e._inlines._value;for(let s=0;s<i.length;s++){const r=i[s];r.resetOffsets(),r.fontSize=this._value,r.fontFactor=t}}get value(){return this._value}}class vN extends xU{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),e._layouter._needsUpdate=!0}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class RY extends vN{constructor(){super(),this._value="inherit"}}class PY extends gx{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value._layouter._needsProcess=!1}process(e){if(this._value!=="none"){const t=e._whiteSpace._whiteSpacedContent,i=e._inlines._value;for(let s=1;s<i.length;s++){const r=t[s-1]+t[s];i[s].kerning=e._font._fontVariant.getKerningAmount(r)}}}}class yN extends vi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function BY(n,e=!1){const t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),r={},o={},a=n[0].morphTargetsRelative,l=new He.BufferGeometry;let c=0;for(let u=0;u<n.length;++u){const d=n[u];let f=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const p in d.attributes){if(!i.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;r[p]===void 0&&(r[p]=[]),r[p].push(d.attributes[p]),f++}if(f!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const p in d.morphAttributes){if(!s.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[p]===void 0&&(o[p]=[]),o[p].push(d.morphAttributes[p])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(d.userData),e){let p;if(t)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(t){let u=0;const d=[];for(let f=0;f<n.length;++f){const p=n[f].index;for(let m=0;m<p.count;++m)d.push(p.getX(m)+u);u+=n[f].attributes.position.count}l.setIndex(d)}for(const u in r){const d=_D(r[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(const u in o){const d=o[u][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<d;++f){const p=[];for(let v=0;v<o[u].length;++v)p.push(o[u][v][f]);const m=_D(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function _D(n){let e,t,i,s=0;for(let a=0;a<n.length;++a){const l=n[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=l.normalized),i!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;s+=l.array.length}const r=new e(s);let o=0;for(let a=0;a<n.length;++a)r.set(n[a].array,o),o+=n[a].array.length;return new He.BufferAttribute(r,t,i)}class DY extends vi{constructor(){super("renderer")}render(e){if(!e._inlines._value||!e._inlines._value.length)return;const t=e._inlines._value.map(s=>e._font._fontVariant.getGeometricGlyph(s,e).translate(s.offsetX,s.offsetY,0)),i=BY(t);e.setFontMesh(new He.Mesh(i,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class OY extends qT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class mp extends iv{constructor(t={}){const i={};mp.definePropertiesValues(i,t);super(i,t);h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});mp.init(this)}add(t){const i=[];for(let s=0;s<arguments.length;s++){const r=arguments[s];!r.isUI||r.isInline?(i.push(r),r.position.z=.005):console.warn("Block element can only contain Box elements.",r)}return super.add(...i)}set textContent(t){this._textContent.value=t}get textContent(){return this._textContent._value}set invertAlpha(t){this._invertAlpha.value=t}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(t,i){t.children||(t.children=yN),t.textContent||(t.textContent=mY),t.glyphs||(t.glyphs=AY),t.inlines||(t.inlines=gY),t.layouter||(t.layouter=lN),t.renderer||(t.renderer=DY),t.fontFamily||(t.fontFamily=uN),t.fontWeight||(t.fontWeight=hN),t.fontStyle||(t.fontStyle=cN),t.fontSize||(t.fontSize=AN),t.color||(t.color=vY),t.backgroundColor||(t.backgroundColor=yY),t.lineBreak||(t.lineBreak=aN),t.letterSpacing||(t.letterSpacing=gN),t.whiteSpace||(t.whiteSpace=vI),t.segments||(t.segments=RY),t.textAlign||(t.textAlign=OY),t.fontKerning||(t.fontKerning=PY)}static init(t){Object.defineProperties(t,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class kY extends cU{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this._needsUpdate=!1;for(let i=e.children.length-1;i>=0;i--){const s=e.children[i];s.isUI&&(e.remove(s),s.clear())}e._children._uis=[],this._value&&e.add(new mp({name:"anonymousInline",textContent:this._value}))}}class LY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class FY extends vi{constructor(){super("layouter",null,!1),this._value=null}update(e,t){}process(e){let t=e._width._value;e._width._auto?t=1/0:t=e._bounds._innerWidth;const i=e._lineHeight._value,s=new LY(new yD);let r=0;e._children._inlines.forEach(d=>{if(!d._inlines.value)return;this._resetInlines(d);const f=d._fontSize._value,p=d._letterSpacing._value*f,m=d._whiteSpace._value,v=d._lineBreak._value,A={WHITESPACE:m,LETTERSPACING:p,BREAKON:v,INNER_WIDTH:t},g=d._whiteSpace._inlineWrapper;r+=d._margin._value.w+d._padding._value.w,d._inlines.value.forEach((b,y,_)=>{const E=s[s.length-1];if(g(_,y,r,A)){if(s.push(new yD(b)),b.offsetX=b.xoffset,b.width===0){r=0;return}b.cumulativeWidth=b.xadvance+p,r=b.cumulativeWidth;return}s[s.length-1].push(b),b.offsetX=r+b.xoffset+b.kerning,b.cumulativeWidth=b.xadvance+b.kerning+p,r+=b.cumulativeWidth,E.length-1===1&&E[E.length-2].width===0&&(b.offsetX-=b.xoffset,r-=b.xoffset)}),r+=d._margin._value.y+d._padding._value.y});const o=e._whiteSpace._inlineCollapser;let a=0,l=0,c=0;s.forEach((d,f)=>{const p=o(d);let m=0,v=0;if(d.forEach(A=>{m=Math.max(m,A.lineHeight),v=Math.max(v,A.lineBase),A.offsetX-=p}),d.lineHeight=m,d.lineBase=v,f===0?c=-(m*i-m)*.5:c-=s[f-1].lineHeight*i,d.y=c,d.x=0,d.forEach(A=>{A.offsetY=c-A.anchor,A.lineHeight<d.lineHeight&&(A.offsetY-=d.lineBase-A.lineBase)}),l+=d.lineHeight*i,d.width=0,d[0]){const A=d[d.length-1];d.width=A.offsetX+A.cumulativeWidth+A.paddingRight+A.marginRight+d[0].offsetX,a=Math.max(a,d.width)}}),s.height=l,s.width=a,this._value=s,t===1/0&&e._bounds.setChildrenWidth(e,s.width),e._height._auto&&e._bounds.setChildrenHeight(e,s.height);const u=e._parent._value;u&&(u._autoSize._needsProcess=!0,u._flexDirection._needsProcess=!0),e._inlineJustificator._needsProcess=!0,e._textAlign._needsProcess=!0,e._overflow._needsUpdate=!0}_resetInlines(e){e._fontSize.process(e)}}class UY extends qT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){NY(e),e._renderer._needsRender=!0}}function NY(n){const e=n._layouter._value,t=n._textAlign._value,i=n._bounds._innerWidth;for(let s=0;s<e.length;s++){const r=e[s],o=zY(n,r,s===e.length-1),a=n._padding._value,l=n._borderWidth._value,c=(-a.w+a.y)/2+(-l.w+l.y)/2;r.x+=o;for(let u=0;u<r.length;u++)r[u].offsetX+=o-c}if(t.indexOf("justify")===0)for(let s=0;s<e.length;s++){const r=e[s];if(t.indexOf("-")!==-1&&s===e.length-1)return;const o=i-r.width;if(o<=0)return;let a=0;for(let d=1;d<r.length-1;d++)a+=r[d].char===" "?1:0;const l=o/a;let c=1;t==="justify-right"&&(r.reverse(),c=-1);let u=0;for(let d=1;d<=r.length-1;d++){const f=r[d];f.offsetX+=u*c,u+=f.char===" "?l:0}t==="justify-right"&&r.reverse()}}function zY(n,e,t){switch(n._textAlign._value){case"justify-left":case"justify":case"left":return-n._bounds._innerWidth/2;case"justify-right":case"right":return-e.width+n._bounds._innerWidth/2;case"center":return-e.width/2;case"justify-center":return t?-e.width/2:-n._bounds._innerWidth/2;default:console.warn(`textAlign: '${n._textAlign._value}' is not valid`)}}class GY extends XT{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class HY extends yU{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class VY extends gx{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class QY extends sN{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class WY extends vi{constructor(){super("children",null,!1);h(this,"_sortOrder",(t,i)=>t._order._value<i._order._value?-1:t._order._value>i._order._value?1:this._uis.indexOf(t)<this._uis.indexOf(i)?-1:1);this._uis=[],this._inlines=[],this._boxes=[]}update(t,i){this._compute(t),this._needsProcess=!0}process(t){this._compute(t),t._overflow._needsRender=!0}_compute(t){this._uis=t.children.filter(i=>i.visible&&i.isUI),this._inlines=this._uis.filter(i=>i.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class jY extends vi{constructor(){super("autosize")}process(e){if(e._layouter._value&&e._layouter._value.length){const t=e._layouter._value,i=e._padding._value,s=e._borderWidth._value;e._width._auto&&e._bounds.setOffsetWidth(e,t.width+i.w+i.y+s.w+s.y),e._height._auto&&e._bounds.setOffsetHeight(e,t.height+i.x+i.z+s.x+s.z)}}}class qY extends oN{constructor(){super("renderer"),this._needsUpdate=!1}render(e){super.render(e);for(const t of e._children._inlines)t._renderer.render(t);e.performAfterUpdate()}}class aA extends rA{constructor(e={},t={}){aA.definePropertiesValues(t,e),super(t,e),aA.init(this)}add(e){const t=[];let i=!1;for(let s=0;s<arguments.length;s++){const r=arguments[s];!r.isUI||r.isInline?(r.isInline&&(i=!0),t.push(r)):console.warn("Block element can only contain Box elements.",r)}return t.length>0&&super.add(...t),i&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(e){this._textContent.value=e}get textContent(){return super.textContent}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(e,t){e.flexDirection=GY,e.justifyContent=YT,e.alignItems=jT,e.bounds=QY,e.autoSize=jY,e.renderer=qY,e.children||(e.children=WY),e.textContent||(e.textContent=kY),e.layouter||(e.layouter=FY),e.lineHeight||(e.lineHeight=HY),e.textAlign||(e.textAlign=UY),e.whiteSpace||(e.whiteSpace=vI),e.fontKerning||(e.fontKerning=VY),e.segments||(e.segments=vN),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class XY extends vi{constructor(){super("inlines",null,!1),this._value=[]}process(e){this._value[0].paddingLeft=e._padding._value.w,this._value[0].marginLeft=e._margin._value.w;const t=this._value.length-1;this._value[t].paddingRight=e._padding._value.y,this._value[t].marginRight=e._margin._value.y}}class YY extends vi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new rN(e)),e._backgroundMesh.position.x=e._inlines._value[0].offsetX+e._inlines._value[0].width/2,e._backgroundMesh.position.y=e._inlines._value[0].offsetY+e._inlines._value[0].lineBase/2,e._bounds.render(e)}}class KY extends vi{constructor(){super("bounds",null,!1),this._size=new He.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(e,t){this.output(t),this._needsProcess=!0}process(e){this._offsetWidth=this._innerWidth=e._inlines._value[0].width,this._offsetHeight=this._innerHeight=e._inlines._value[0].height,this._needsRender=!0,e._borderWidth._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(e){e.size=this._size}}class lA extends iv{constructor(e={}){const t={};lA.definePropertiesValues(t,e),super(t,e),lA.init(this)}clear(){for(const e of this._inlines._value)e.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new He.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(e){const t=[];for(let i=0;i<arguments.length;i++){const s=arguments[i];s.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",s):(t.push(s),s.position.z=.005)}return super.add(...t)}static definePropertiesValues(e,t){e.children||(e.children=yN),e.bounds||(e.bounds=KY),e.inlines||(e.inlines=XY),e.layouter||(e.layouter=lN),e.renderer||(e.renderer=YY),e.fontFamily||(e.fontFamily=uN),e.fontWeight||(e.fontWeight=hN),e.fontStyle||(e.fontStyle=cN),e.fontSize||(e.fontSize=AN),e.backgroundColor||(e.backgroundColor=oU),e.lineBreak||(e.lineBreak=aN),e.letterSpacing||(e.letterSpacing=gN),e.whiteSpace||(e.whiteSpace=vI),e.fontKerning||(e.fontKerning=gx),t.backgroundSize||(t.backgroundSize="cover"),t.width||(t.width="100%"),t.height||(t.height="100%"),t.boxSizing||(t.boxSizing="border-box")}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),e._inlines._value=[new JY(e)],e.backgroundMaterial=new nN,e._renderer.render(e)}}class JY extends pU{constructor(e){super(),this._uiElement=e}get xadvance(){const e=this._uiElement._padding._value,t=this._uiElement._width;return t._relative?t._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.w+e.y+t.value}get width(){const e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get height(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get anchor(){return this.height}get lineHeight(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get lineBase(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}clear(){this._uiElement=null}}class bN{constructor(e){this._subject=e}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const _N=()=>qb.update(),xN={BaseProperty:vi,Block:oA,Text:aA,Inline:mp,InlineBlock:lA,MeshUIBaseElement:iv,FontLibrary:Yu,update:_N,MSDFFontMaterialUtils:ko,ShaderChunkUI:iN,Behavior:bN,FontVariant:ZA};typeof global<"u"&&(global.ThreeMeshUI=xN);const ZY=xN;var $Y=kn.w8,wN=kn.cg,yI=kn.gO,e7=kn.wb,hM=kn.zV,t7=kn.HS,i7=kn.Ec,X0=kn.gF,n7=kn.ol,s7=kn.pz,r7=kn.tx,o7=kn.hj,a7=kn.FV,l7=kn.sV,bI=kn.xv,c7=kn.mx,h7=kn.gE,gf=kn.ZP,SN=kn.Vx;const GS=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:$Y,Behavior:wN,Block:yI,DefaultValues:e7,FontLibrary:hM,FontVariant:t7,InheritableProperty:i7,Inline:X0,InlineBlock:n7,InlineGlyph:s7,MSDFFontMaterialUtils:r7,MaterialTransformers:o7,MeshUIBaseElement:a7,ShaderChunkUI:l7,Text:bI,TypographicFont:c7,TypographicGlyph:h7,default:gf,update:SN},Symbol.toStringTag,{value:"Module"}));function Uu(n,e){try{e?n(e):n()}catch(t){return console.error(t),!1}return!0}const CN=re("debugdefines");xx('if(!globalThis[""3.31.7""]) globalThis[""3.31.7""] = "0.0.0";');xx('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');xx('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.7";');xx('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Ya="3.31.7",_x="undefined";CN&&console.log(`Engine version: ${Ya} (generator: ${_x})`);const oc="needle_isActiveInHierarchy",_u="builtin_components",yg="needle_editor_guid";function xx(n){try{(0,eval)(n)}catch(e){CN&&console.error(e)}}const uM=re("debugnewscripts"),u7=re("debughierarchy"),Gi=[];function d7(){return Gi.length>0}function Yb(n){if(!(n.new_scripts.length<=0)){if(uM&&console.log("Register new components",n.new_scripts.length,[...n.new_scripts],n.alias?"element: "+n.alias:n.hash,n),n.new_scripts_pre_setup_callbacks.length>0){for(const e of n.new_scripts_pre_setup_callbacks)e&&e();n.new_scripts_pre_setup_callbacks.length=0}Gi.length=0,n.new_scripts.length>0&&Gi.push(...n.new_scripts),n.new_scripts.length=0;for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.isComponent!==!0){(Vt()||uM)&&console.error(`Registered script is not a Needle Engine component.
4079
+ `&&n.length>1&&fN([t],n[n.length-2]),e.offsetX}function MY(n){if(!n[0])return 0;let e=[],t;for(let i=0;i<n.length;i++){const s=n[i];if(s.char&&bD[s.char]&&n.length>i){e.push(s),t=n[i+1];continue}break}pN(e,t),e=[],t=null;for(let i=n.length-1;i>0;i--){const s=n[i];if(s.char&&bD[s.char]&&i>0){e.push(s),t=n[i-1];continue}break}return fN(e,t),n[0].offsetX}function TY(n){return n[0]?n[0].offsetX:0}function fN(n,e){if(e)for(let t=0;t<n.length;t++){const i=n[t];i.fontFactor=0,i.offsetX=e.offsetX+e.cumulativeWidth,i.cumulativeWidth=0}}function pN(n,e){if(e)for(let t=0;t<n.length;t++){const i=n[t];i.fontFactor=0,i.offsetX=e.offsetX,i.cumulativeWidth=0}}function mN(n,e,t,i){if(i=i||0,!n[e])return i;const s=n[e];return s.lineBreak?i+s.xadvance:mN(n,e+1,t,i+s.xadvance+s.xoffset+s.kerning+t.LETTERSPACING)}function IY(n,e,t,i){return!n||!n.char||e+t<i.INNER_WIDTH?!1:i.BREAKON.indexOf(n.char)>-1}class gN extends _U{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._fontSize._needsProcess=!0,e._layouter._needsProcess=!0}}class AN extends qi{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._font._fontVariant&&(e._bounds._needsProcess=!0,e._layouter._needsProcess=!0)}process(e){if(!e._font._fontVariant||!e._font._fontVariant.isReady)return;const t=this._value/e._font._fontVariant.typographic.size,i=e._inlines._value;for(let s=0;s<i.length;s++){const r=i[s];r.resetOffsets(),r.fontSize=this._value,r.fontFactor=t}}get value(){return this._value}}class vN extends xU{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),e._layouter._needsUpdate=!0}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class RY extends vN{constructor(){super(),this._value="inherit"}}class PY extends gx{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value._layouter._needsProcess=!1}process(e){if(this._value!=="none"){const t=e._whiteSpace._whiteSpacedContent,i=e._inlines._value;for(let s=1;s<i.length;s++){const r=t[s-1]+t[s];i[s].kerning=e._font._fontVariant.getKerningAmount(r)}}}}class yN extends vi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function BY(n,e=!1){const t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),s=new Set(Object.keys(n[0].morphAttributes)),r={},o={},a=n[0].morphTargetsRelative,l=new He.BufferGeometry;let c=0;for(let u=0;u<n.length;++u){const d=n[u];let f=0;if(t!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const p in d.attributes){if(!i.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;r[p]===void 0&&(r[p]=[]),r[p].push(d.attributes[p]),f++}if(f!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const p in d.morphAttributes){if(!s.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[p]===void 0&&(o[p]=[]),o[p].push(d.morphAttributes[p])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(d.userData),e){let p;if(t)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(t){let u=0;const d=[];for(let f=0;f<n.length;++f){const p=n[f].index;for(let m=0;m<p.count;++m)d.push(p.getX(m)+u);u+=n[f].attributes.position.count}l.setIndex(d)}for(const u in r){const d=_D(r[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(const u in o){const d=o[u][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<d;++f){const p=[];for(let v=0;v<o[u].length;++v)p.push(o[u][v][f]);const m=_D(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function _D(n){let e,t,i,s=0;for(let a=0;a<n.length;++a){const l=n[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=l.normalized),i!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;s+=l.array.length}const r=new e(s);let o=0;for(let a=0;a<n.length;++a)r.set(n[a].array,o),o+=n[a].array.length;return new He.BufferAttribute(r,t,i)}class DY extends vi{constructor(){super("renderer")}render(e){if(!e._inlines._value||!e._inlines._value.length)return;const t=e._inlines._value.map(s=>e._font._fontVariant.getGeometricGlyph(s,e).translate(s.offsetX,s.offsetY,0)),i=BY(t);e.setFontMesh(new He.Mesh(i,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class OY extends qT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class mp extends iv{constructor(t={}){const i={};mp.definePropertiesValues(i,t);super(i,t);h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});mp.init(this)}add(t){const i=[];for(let s=0;s<arguments.length;s++){const r=arguments[s];!r.isUI||r.isInline?(i.push(r),r.position.z=.005):console.warn("Block element can only contain Box elements.",r)}return super.add(...i)}set textContent(t){this._textContent.value=t}get textContent(){return this._textContent._value}set invertAlpha(t){this._invertAlpha.value=t}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(t,i){t.children||(t.children=yN),t.textContent||(t.textContent=mY),t.glyphs||(t.glyphs=AY),t.inlines||(t.inlines=gY),t.layouter||(t.layouter=lN),t.renderer||(t.renderer=DY),t.fontFamily||(t.fontFamily=uN),t.fontWeight||(t.fontWeight=hN),t.fontStyle||(t.fontStyle=cN),t.fontSize||(t.fontSize=AN),t.color||(t.color=vY),t.backgroundColor||(t.backgroundColor=yY),t.lineBreak||(t.lineBreak=aN),t.letterSpacing||(t.letterSpacing=gN),t.whiteSpace||(t.whiteSpace=vI),t.segments||(t.segments=RY),t.textAlign||(t.textAlign=OY),t.fontKerning||(t.fontKerning=PY)}static init(t){Object.defineProperties(t,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class kY extends cU{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(e){this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this._needsUpdate=!1;for(let i=e.children.length-1;i>=0;i--){const s=e.children[i];s.isUI&&(e.remove(s),s.clear())}e._children._uis=[],this._value&&e.add(new mp({name:"anonymousInline",textContent:this._value}))}}class LY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class FY extends vi{constructor(){super("layouter",null,!1),this._value=null}update(e,t){}process(e){let t=e._width._value;e._width._auto?t=1/0:t=e._bounds._innerWidth;const i=e._lineHeight._value,s=new LY(new yD);let r=0;e._children._inlines.forEach(d=>{if(!d._inlines.value)return;this._resetInlines(d);const f=d._fontSize._value,p=d._letterSpacing._value*f,m=d._whiteSpace._value,v=d._lineBreak._value,A={WHITESPACE:m,LETTERSPACING:p,BREAKON:v,INNER_WIDTH:t},g=d._whiteSpace._inlineWrapper;r+=d._margin._value.w+d._padding._value.w,d._inlines.value.forEach((b,y,_)=>{const E=s[s.length-1];if(g(_,y,r,A)){if(s.push(new yD(b)),b.offsetX=b.xoffset,b.width===0){r=0;return}b.cumulativeWidth=b.xadvance+p,r=b.cumulativeWidth;return}s[s.length-1].push(b),b.offsetX=r+b.xoffset+b.kerning,b.cumulativeWidth=b.xadvance+b.kerning+p,r+=b.cumulativeWidth,E.length-1===1&&E[E.length-2].width===0&&(b.offsetX-=b.xoffset,r-=b.xoffset)}),r+=d._margin._value.y+d._padding._value.y});const o=e._whiteSpace._inlineCollapser;let a=0,l=0,c=0;s.forEach((d,f)=>{const p=o(d);let m=0,v=0;if(d.forEach(A=>{m=Math.max(m,A.lineHeight),v=Math.max(v,A.lineBase),A.offsetX-=p}),d.lineHeight=m,d.lineBase=v,f===0?c=-(m*i-m)*.5:c-=s[f-1].lineHeight*i,d.y=c,d.x=0,d.forEach(A=>{A.offsetY=c-A.anchor,A.lineHeight<d.lineHeight&&(A.offsetY-=d.lineBase-A.lineBase)}),l+=d.lineHeight*i,d.width=0,d[0]){const A=d[d.length-1];d.width=A.offsetX+A.cumulativeWidth+A.paddingRight+A.marginRight+d[0].offsetX,a=Math.max(a,d.width)}}),s.height=l,s.width=a,this._value=s,t===1/0&&e._bounds.setChildrenWidth(e,s.width),e._height._auto&&e._bounds.setChildrenHeight(e,s.height);const u=e._parent._value;u&&(u._autoSize._needsProcess=!0,u._flexDirection._needsProcess=!0),e._inlineJustificator._needsProcess=!0,e._textAlign._needsProcess=!0,e._overflow._needsUpdate=!0}_resetInlines(e){e._fontSize.process(e)}}class UY extends qT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){NY(e),e._renderer._needsRender=!0}}function NY(n){const e=n._layouter._value,t=n._textAlign._value,i=n._bounds._innerWidth;for(let s=0;s<e.length;s++){const r=e[s],o=zY(n,r,s===e.length-1),a=n._padding._value,l=n._borderWidth._value,c=(-a.w+a.y)/2+(-l.w+l.y)/2;r.x+=o;for(let u=0;u<r.length;u++)r[u].offsetX+=o-c}if(t.indexOf("justify")===0)for(let s=0;s<e.length;s++){const r=e[s];if(t.indexOf("-")!==-1&&s===e.length-1)return;const o=i-r.width;if(o<=0)return;let a=0;for(let d=1;d<r.length-1;d++)a+=r[d].char===" "?1:0;const l=o/a;let c=1;t==="justify-right"&&(r.reverse(),c=-1);let u=0;for(let d=1;d<=r.length-1;d++){const f=r[d];f.offsetX+=u*c,u+=f.char===" "?l:0}t==="justify-right"&&r.reverse()}}function zY(n,e,t){switch(n._textAlign._value){case"justify-left":case"justify":case"left":return-n._bounds._innerWidth/2;case"justify-right":case"right":return-e.width+n._bounds._innerWidth/2;case"center":return-e.width/2;case"justify-center":return t?-e.width/2:-n._bounds._innerWidth/2;default:console.warn(`textAlign: '${n._textAlign._value}' is not valid`)}}class GY extends XT{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class HY extends yU{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class VY extends gx{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class QY extends sN{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class WY extends vi{constructor(){super("children",null,!1);h(this,"_sortOrder",(t,i)=>t._order._value<i._order._value?-1:t._order._value>i._order._value?1:this._uis.indexOf(t)<this._uis.indexOf(i)?-1:1);this._uis=[],this._inlines=[],this._boxes=[]}update(t,i){this._compute(t),this._needsProcess=!0}process(t){this._compute(t),t._overflow._needsRender=!0}_compute(t){this._uis=t.children.filter(i=>i.visible&&i.isUI),this._inlines=this._uis.filter(i=>i.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class jY extends vi{constructor(){super("autosize")}process(e){if(e._layouter._value&&e._layouter._value.length){const t=e._layouter._value,i=e._padding._value,s=e._borderWidth._value;e._width._auto&&e._bounds.setOffsetWidth(e,t.width+i.w+i.y+s.w+s.y),e._height._auto&&e._bounds.setOffsetHeight(e,t.height+i.x+i.z+s.x+s.z)}}}class qY extends oN{constructor(){super("renderer"),this._needsUpdate=!1}render(e){super.render(e);for(const t of e._children._inlines)t._renderer.render(t);e.performAfterUpdate()}}class aA extends rA{constructor(e={},t={}){aA.definePropertiesValues(t,e),super(t,e),aA.init(this)}add(e){const t=[];let i=!1;for(let s=0;s<arguments.length;s++){const r=arguments[s];!r.isUI||r.isInline?(r.isInline&&(i=!0),t.push(r)):console.warn("Block element can only contain Box elements.",r)}return t.length>0&&super.add(...t),i&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(e){this._textContent.value=e}get textContent(){return super.textContent}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(e,t){e.flexDirection=GY,e.justifyContent=YT,e.alignItems=jT,e.bounds=QY,e.autoSize=jY,e.renderer=qY,e.children||(e.children=WY),e.textContent||(e.textContent=kY),e.layouter||(e.layouter=FY),e.lineHeight||(e.lineHeight=HY),e.textAlign||(e.textAlign=UY),e.whiteSpace||(e.whiteSpace=vI),e.fontKerning||(e.fontKerning=VY),e.segments||(e.segments=vN),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class XY extends vi{constructor(){super("inlines",null,!1),this._value=[]}process(e){this._value[0].paddingLeft=e._padding._value.w,this._value[0].marginLeft=e._margin._value.w;const t=this._value.length-1;this._value[t].paddingRight=e._padding._value.y,this._value[t].marginRight=e._margin._value.y}}class YY extends vi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new rN(e)),e._backgroundMesh.position.x=e._inlines._value[0].offsetX+e._inlines._value[0].width/2,e._backgroundMesh.position.y=e._inlines._value[0].offsetY+e._inlines._value[0].lineBase/2,e._bounds.render(e)}}class KY extends vi{constructor(){super("bounds",null,!1),this._size=new He.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(e,t){this.output(t),this._needsProcess=!0}process(e){this._offsetWidth=this._innerWidth=e._inlines._value[0].width,this._offsetHeight=this._innerHeight=e._inlines._value[0].height,this._needsRender=!0,e._borderWidth._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(e){e.size=this._size}}class lA extends iv{constructor(e={}){const t={};lA.definePropertiesValues(t,e),super(t,e),lA.init(this)}clear(){for(const e of this._inlines._value)e.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new He.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(e){const t=[];for(let i=0;i<arguments.length;i++){const s=arguments[i];s.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",s):(t.push(s),s.position.z=.005)}return super.add(...t)}static definePropertiesValues(e,t){e.children||(e.children=yN),e.bounds||(e.bounds=KY),e.inlines||(e.inlines=XY),e.layouter||(e.layouter=lN),e.renderer||(e.renderer=YY),e.fontFamily||(e.fontFamily=uN),e.fontWeight||(e.fontWeight=hN),e.fontStyle||(e.fontStyle=cN),e.fontSize||(e.fontSize=AN),e.backgroundColor||(e.backgroundColor=oU),e.lineBreak||(e.lineBreak=aN),e.letterSpacing||(e.letterSpacing=gN),e.whiteSpace||(e.whiteSpace=vI),e.fontKerning||(e.fontKerning=gx),t.backgroundSize||(t.backgroundSize="cover"),t.width||(t.width="100%"),t.height||(t.height="100%"),t.boxSizing||(t.boxSizing="border-box")}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),e._inlines._value=[new JY(e)],e.backgroundMaterial=new nN,e._renderer.render(e)}}class JY extends pU{constructor(e){super(),this._uiElement=e}get xadvance(){const e=this._uiElement._padding._value,t=this._uiElement._width;return t._relative?t._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.w+e.y+t.value}get width(){const e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get height(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get anchor(){return this.height}get lineHeight(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}get lineBase(){const e=this._uiElement._height;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):e.value}clear(){this._uiElement=null}}class bN{constructor(e){this._subject=e}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const _N=()=>qb.update(),xN={BaseProperty:vi,Block:oA,Text:aA,Inline:mp,InlineBlock:lA,MeshUIBaseElement:iv,FontLibrary:Yu,update:_N,MSDFFontMaterialUtils:ko,ShaderChunkUI:iN,Behavior:bN,FontVariant:ZA};typeof global<"u"&&(global.ThreeMeshUI=xN);const ZY=xN;var $Y=kn.w8,wN=kn.cg,yI=kn.gO,e7=kn.wb,hM=kn.zV,t7=kn.HS,i7=kn.Ec,X0=kn.gF,n7=kn.ol,s7=kn.pz,r7=kn.tx,o7=kn.hj,a7=kn.FV,l7=kn.sV,bI=kn.xv,c7=kn.mx,h7=kn.gE,gf=kn.ZP,SN=kn.Vx;const GS=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:$Y,Behavior:wN,Block:yI,DefaultValues:e7,FontLibrary:hM,FontVariant:t7,InheritableProperty:i7,Inline:X0,InlineBlock:n7,InlineGlyph:s7,MSDFFontMaterialUtils:r7,MaterialTransformers:o7,MeshUIBaseElement:a7,ShaderChunkUI:l7,Text:bI,TypographicFont:c7,TypographicGlyph:h7,default:gf,update:SN},Symbol.toStringTag,{value:"Module"}));function Uu(n,e){try{e?n(e):n()}catch(t){return console.error(t),!1}return!0}const CN=re("debugdefines");xx('if(!globalThis[""3.31.8""]) globalThis[""3.31.8""] = "0.0.0";');xx('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');xx('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.8";');xx('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Ya="3.31.8",_x="undefined";CN&&console.log(`Engine version: ${Ya} (generator: ${_x})`);const oc="needle_isActiveInHierarchy",_u="builtin_components",yg="needle_editor_guid";function xx(n){try{(0,eval)(n)}catch(e){CN&&console.error(e)}}const uM=re("debugnewscripts"),u7=re("debughierarchy"),Gi=[];function d7(){return Gi.length>0}function Yb(n){if(!(n.new_scripts.length<=0)){if(uM&&console.log("Register new components",n.new_scripts.length,[...n.new_scripts],n.alias?"element: "+n.alias:n.hash,n),n.new_scripts_pre_setup_callbacks.length>0){for(const e of n.new_scripts_pre_setup_callbacks)e&&e();n.new_scripts_pre_setup_callbacks.length=0}Gi.length=0,n.new_scripts.length>0&&Gi.push(...n.new_scripts),n.new_scripts.length=0;for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.isComponent!==!0){(Vt()||uM)&&console.error(`Registered script is not a Needle Engine component.
4080
4080
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4081
4081
  `,t),Gi.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.error("MISSING GAMEOBJECT - will ignore",t),Gi.splice(e,1),e--;continue}t.context=n,bg(t.gameObject),_I(t,n)}catch(t){console.error(t),Hl(Gi[e],n),Gi.splice(e,1),e--}for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.destroyed){Hl(Gi[e],n),Gi.splice(e,1),e--;continue}if(t.registering)try{t.registering()}catch(i){console.error(i)}t.__internalAwake!==void 0&&(t.gameObject||console.error("MISSING GAMEOBJECT",t,t.gameObject),bg(t.gameObject),t.activeAndEnabled&&Uu(t.__internalAwake.bind(t)))}catch(t){console.error(t),Hl(Gi[e],n),Gi.splice(e,1),e--}for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.destroyed||t.enabled===!1||(bg(t.gameObject),t.activeAndEnabled===!1))continue;t.__internalEnable!==void 0&&(t.enabled=!0,Uu(t.__internalEnable.bind(t)))}catch(t){console.error(t),Hl(Gi[e],n),Gi.splice(e,1),e--}for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.destroyed||!t.gameObject)continue;n.new_script_start.push(t)}catch(t){console.error(t),Hl(Gi[e],n),Gi.splice(e,1),e--}Gi.length=0;for(const e of n.new_scripts_post_setup_callbacks)e&&e();n.new_scripts_post_setup_callbacks.length=0}}function f7(n){n&&(n.__internalDisable(!0),Hl(n,n.context))}function EN(n,e){for(let t=0;t<n.new_script_start.length;t++)try{const i=n.new_script_start[t];if(e!==void 0&&i.gameObject!==e||i.destroyed||i.activeAndEnabled===!1)continue;Uu(i.__internalAwake.bind(i)),i.enabled&&(Uu(i.__internalEnable.bind(i)),Uu(i.__internalStart.bind(i)),n.new_script_start.splice(t,1),t--)}catch(i){console.error(i),Hl(n.new_script_start[t],n),n.new_script_start.splice(t,1),t--}}function _I(n,e){e.scripts.indexOf(n)===-1&&(e.scripts.push(n),n.earlyUpdate&&e.scripts_earlyUpdate.push(n),n.update&&e.scripts_update.push(n),n.lateUpdate&&e.scripts_lateUpdate.push(n),n.onBeforeRender&&e.scripts_onBeforeRender.push(n),n.onAfterRender&&e.scripts_onAfterRender.push(n),n.onPausedChanged&&e.scripts_pausedChanged.push(n))}function Hl(n,e){wl(n,e.new_scripts),wl(n,e.new_script_start),wl(n,e.scripts),wl(n,e.scripts_earlyUpdate),wl(n,e.scripts_update),wl(n,e.scripts_lateUpdate),wl(n,e.scripts_onBeforeRender),wl(n,e.scripts_onAfterRender),wl(n,e.scripts_pausedChanged),e.stopAllCoroutinesFrom(n)}function wl(n,e){const t=e.indexOf(n);t>=0&&e.splice(t,1)}function Y0(n){if(n||(n=Ii.Current.scene),!n){console.trace("Invalid call - no current context.");return}const e=Bp(n);MN(n,e,!0)||(uM||Vt()?console.error(`Error updating hierarchy
4082
4082
  Do you have circular references in your project? <a target="_blank" href="https://docs.needle.tools/circular-reference"> Click here for more information.`,n):console.error('Failed to update active state in hierarchy of "'+n.name+'"',n),console.warn(" ↑ this error might be caused by circular references. Please make sure you don't have files with circular references (e.g. one GLB 1 is loading GLB 2 which is then loading GLB 1 again)."))}function MN(n,e,t,i=0){if(i>1e3)return console.warn("Hierarchy is too deep (> 1000 level) - will abort updating active state"),!1;const s=Bp(n);if(e&&(e=s,e&&n.parent)){const l=n.parent;e=l[oc],e===void 0&&(l instanceof Dr||(e=!0))}const o=n[oc]!==e;n[oc]=e,o&&(u7&&console.warn("ACTIVE CHANGE",n.name,s,n.visible,e,"changed?"+o,n),t&&p7(n,l=>{e?l.enabled&&(Uu(l.__internalAwake.bind(l)),l.enabled&&(l.__didEnable=!0,l.onEnable())):l.__didAwake&&l.enabled&&(l.__didEnable=!1,l.onDisable())}));let a=!0;if(n.children){const l=i+1;for(const c of n.children)MN(c,e,t,l)===!1&&(a=!1)}return a}function bg(n){let e=!0,t=n,i=!1;for(;t&&t;){if(t.type==="Scene"&&(i=!0),!Bp(t)){e=!1;break}t=t.parent}if(!n){console.error("GO is null");return}n[oc]=e&&i}function p7(n,e){var t;if((t=n.userData)!=null&&t.components)for(const i of n.userData.components)e(i)}const K0=new Map,TN=Symbol("prewarmFlag"),dM=Symbol("waitingForPrewarm"),fM=re("debugprewarm");function IN(n,e){if(!n||n[TN]===!0||n[dM]===!0)return;K0.has(e)||K0.set(e,[]),n[dM]=!0,K0.get(e).push(n),fM&&console.debug("register prewarm",n.name)}let xD=null,wD=null;function m7(n){if(!n)return;const e=K0.get(n);if(!(e!=null&&e.length))return;const t=n.mainCamera;if(t){fM&&console.log("prewarm",e.length,"objects",[...e]);const i=n.renderer;if(i.compile){const s=n.scene;i.compile(s,t),xD??(xD=new tT(64)),wD??(wD=new eT(.001,9999999,xD)),wD.update(i,s);for(const r of e)r[TN]=!0,r[dM]=!1;e.length=0,fM&&console.log("prewarm done")}}}const g7=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function A7(n){return typeof n=="string"&&g7.test(n)}const As=[];for(let n=0;n<256;++n)As.push((n+256).toString(16).slice(1));function v7(n,e=0){return As[n[e+0]]+As[n[e+1]]+As[n[e+2]]+As[n[e+3]]+"-"+As[n[e+4]]+As[n[e+5]]+"-"+As[n[e+6]]+As[n[e+7]]+"-"+As[n[e+8]]+As[n[e+9]]+"-"+As[n[e+10]]+As[n[e+11]]+As[n[e+12]]+As[n[e+13]]+As[n[e+14]]+As[n[e+15]]}function y7(n){if(!A7(n))throw TypeError("Invalid UUID");let e;const t=new Uint8Array(16);return t[0]=(e=parseInt(n.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(n.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(n.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(n.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(n.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}function b7(n){n=unescape(encodeURIComponent(n));const e=[];for(let t=0;t<n.length;++t)e.push(n.charCodeAt(t));return e}const _7="6ba7b810-9dad-11d1-80b4-00c04fd430c8",x7="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function w7(n,e,t){function i(s,r,o,a){var l;if(typeof s=="string"&&(s=b7(s)),typeof r=="string"&&(r=y7(r)),((l=r)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);if(c.set(r),c.set(s,r.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,o){a=a||0;for(let u=0;u<16;++u)o[a+u]=c[u];return o}return v7(c)}try{i.name=n}catch{}return i.DNS=_7,i.URL=x7,i}function S7(n,e,t,i){switch(n){case 0:return e&t^~e&i;case 1:return e^t^i;case 2:return e&t^e&i^t&i;case 3:return e^t^i}}function HS(n,e){return n<<e|n>>>32-e}function C7(n){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof n=="string"){const o=unescape(encodeURIComponent(n));n=[];for(let a=0;a<o.length;++a)n.push(o.charCodeAt(a))}else Array.isArray(n)||(n=Array.prototype.slice.call(n));n.push(128);const i=n.length/4+2,s=Math.ceil(i/16),r=new Array(s);for(let o=0;o<s;++o){const a=new Uint32Array(16);for(let l=0;l<16;++l)a[l]=n[o*64+l*4]<<24|n[o*64+l*4+1]<<16|n[o*64+l*4+2]<<8|n[o*64+l*4+3];r[o]=a}r[s-1][14]=(n.length-1)*8/Math.pow(2,32),r[s-1][14]=Math.floor(r[s-1][14]),r[s-1][15]=(n.length-1)*8&4294967295;for(let o=0;o<s;++o){const a=new Uint32Array(80);for(let p=0;p<16;++p)a[p]=r[o][p];for(let p=16;p<80;++p)a[p]=HS(a[p-3]^a[p-8]^a[p-14]^a[p-16],1);let l=t[0],c=t[1],u=t[2],d=t[3],f=t[4];for(let p=0;p<80;++p){const m=Math.floor(p/20),v=HS(l,5)+S7(m,c,u,d)+f+e[m]+a[p]>>>0;f=d,d=u,u=HS(c,30)>>>0,c=l,l=v}t[0]=t[0]+l>>>0,t[1]=t[1]+c>>>0,t[2]=t[2]+u>>>0,t[3]=t[3]+d>>>0,t[4]=t[4]+f>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}const E7=w7("v5",80,C7),SD=E7;var qr=(n=>(n[n.OnConnection=0]="OnConnection",n[n.OnRoomJoin=1]="OnRoomJoin",n[n.Queued=2]="Queued",n[n.Immediate=3]="Immediate",n))(qr||{});Ii.registerCallback(is.ContextCreated,n=>{const e=n.context;ON(e),DN(e)});const Kb=re("debugcomponents"),CD="eff8ba80-635d-11ec-90d6-0242ac120003";class os{constructor(e){h(this,"_originalSeed");h(this,"_seed");typeof e=="string"&&(e=os.hash(e)),this._originalSeed=e,this._seed=e}get seed(){return this._seed}set seed(e){this._seed=e}reset(){this._seed=this._originalSeed}generateUUID(e){if(typeof e=="string")return SD(e,CD);const t=this._seed;return this._seed-=1,SD(t.toString(),CD)}initialize(e){typeof e=="string"?this._seed=os.hash(e):this._seed=e}static createFromString(e){return new os(this.hash(e))}static hash(e){let t=0;for(let i=0;i<e.length;i++)t=e.charCodeAt(i)+((t<<5)-t);return t}}var RN=(n=>(n.NewInstanceCreated="new-instance-created",n.InstanceDestroyed="instance-destroyed",n))(RN||{});class PN{constructor(e){h(this,"guid");this.guid=e}}function wx(n,e,t=!0){if(!n)return;const i=n;if(ol(n,t),!e){console.warn("Can not send destroy: No networking connection provided",n.guid);return}if(!e.isConnected){console.warn("Can not send destroy: not connected",n.guid);return}let s=n.guid;if(!s&&i.uuid&&(s=i.uuid),!s){console.warn("Can not send destroy: failed to find guid",n);return}const r=new PN(s);e.send("instance-destroyed",r,qr.Queued)}function BN(n,e){const t=new PN(n);e.send("instance-destroyed",t,qr.Queued)}function DN(n){n.connection.beginListen("instance-destroyed",e=>{Kb&&console.log("[Remote] Destroyed",n.scene,e);const t=cv(e.guid,n.scene);t&&ol(t)})}class M7{constructor(e,t,i){h(this,"filename");h(this,"hash");h(this,"size");this.filename=e,this.hash=t,this.size=i}}class T7{constructor(e,t){h(this,"guid");h(this,"originalGuid");h(this,"seed");h(this,"visible");h(this,"hostData");h(this,"dontSave");h(this,"parent");h(this,"position");h(this,"rotation");h(this,"scale");this.originalGuid=e,this.guid=t}}function xI(n,e,t,i){var l;const s=n;if(!s.guid)return console.warn("Can not instantiate: No guid",s),null;if(e.context||(e.context=Nt.Current),!e.context)return console.error("Missing network instantiate options / reference to network connection in sync instantiate"),null;const r=e?{...e}:null,{instance:o,seed:a}=I7(s,e);if(o){const c=o;if(c.guid){Kb&&console.log("[Local] new instance","gameobject:",o==null?void 0:o.guid);const u=new T7(s.guid,c.guid);u.seed=a,r&&(r.position&&(u.position={x:r.position.x,y:r.position.y,z:r.position.z}),r.rotation&&(u.rotation={x:r.rotation.x,y:r.rotation.y,z:r.rotation.z,w:r.rotation.w}),r.scale&&(u.scale={x:r.scale.x,y:r.scale.y,z:r.scale.z})),u.position||(u.position={x:c.position.x,y:c.position.y,z:c.position.z}),u.rotation||(u.rotation={x:c.quaternion.x,y:c.quaternion.y,z:c.quaternion.z,w:c.quaternion.w}),u.scale||(u.scale={x:c.scale.x,y:c.scale.y,z:c.scale.z}),u.visible=s.visible,r!=null&&r.parent&&(typeof r.parent=="string"?u.parent=r.parent:u.parent=r.parent.guid),u.hostData=t,i===!1&&(u.dontSave=!0),(l=e==null?void 0:e.context)==null||l.connection.send("new-instance-created",u)}else console.warn("Missing guid, can not send new instance event",c)}return o}function Sx(){return Math.random()*9999999}function ON(n){n.connection.beginListen("new-instance-created",async e=>{const t=await R7(e.originalGuid,n.scene);if(!t){console.warn("could not find object that was instantiated: "+e.guid);return}const i=new Ma;e.position&&(i.position=new w(e.position.x,e.position.y,e.position.z)),e.rotation&&(i.rotation=new Ce(e.rotation.x,e.rotation.y,e.rotation.z,e.rotation.w)),e.scale&&(i.scale=new w(e.scale.x,e.scale.y,e.scale.z)),i.parent=e.parent,e.seed&&(i.idProvider=new os(e.seed)),i.visible=e.visible,i.context=n,Kb&&n.alias&&console.log("[Remote] instantiate in: "+n.alias);const s=hv(t,i);s&&(e.parent==="scene"&&n.scene.add(s),Kb&&console.log("[Remote] new instance","gameobject:",s==null?void 0:s.guid,t))})}function I7(n,e){const t=Sx(),i=e??new Ma;i.idProvider=new os(t);const s=hv(n,i);return{seed:t,instance:s}}const kN={};function LN(n,e){kN[n]=e}async function R7(n,e){const t=kN[n];if(t!=null){const i=await t(n);if(i)return i}return FN(n,e)}function FN(n,e){if(e===null||!n)return null;if(e.guid===n)return e;if(e.children)for(const t of e.children){const i=FN(n,t);if(i)return i}return null}const UN=new Map;function P7(n,e){if(!n)return;if(!e){console.warn("No prototype found",n,n.prototype,n.constructor);return}const t=UN.get(e);t&&t.apply(n)}function B7(n){const e=D7(n.prototype);UN.set(n,e)}function D7(n){return new O7(n)}class O7{constructor(e){h(this,"$symbol");h(this,"extensions");h(this,"descriptors");this.$symbol=Symbol("prototype-extension"),this.extensions=Object.keys(e),this.descriptors=new Array;for(let t=0;t<this.extensions.length;t++){const i=this.extensions[t],s=Object.getOwnPropertyDescriptor(e,i);s&&this.descriptors.push(s)}}apply(e){if(!e[this.$symbol]){e[this.$symbol]=!0;for(let t=0;t<this.extensions.length;t++){const i=this.extensions[t],s=this.descriptors[t];s&&Object.defineProperty(e,i,s)}}}}var nv=(n=>(n.Added="component-added",n.Removing="removing-component",n))(nv||{});const ED=re("debugcomponentevents");class sv{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let i=this.eventListeners.get(e);i||(i=[]),i.push(t),this.eventListeners.set(e,i),ED&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const i=this.eventListeners.get(e);if(!i)return;const s=i.indexOf(t);s<0||i.splice(s,1)}static dispatchComponentLifecycleEvent(e,t){const i=this.eventListeners.get(e);if(ED&&console.log("Dispatching event "+e,i),!!i)for(const s of i)s(t)}}h(sv,"eventListeners",new Map);const VS=re("debuggetcomponent");function k7(n){return n==null||n.isObject3D?n:n.object&&n.object.isObject3D?n.object:n}function wI(n,e){if(!n||!n.userData.components)return;const t=n.userData.components.indexOf(e);t<0||(sv.dispatchComponentLifecycleEvent(nv.Removing,e),e.gameObject=null,n.userData.components.splice(t,1))}function Cx(n,e){const t=Pp(n,e);if(t)return t;const i=new e;return Mh(n,i)}const NN=new os("addComponentIdProvider");function Mh(n,e,t=!0){n.userData||(n.userData={}),n.userData.components||(n.userData.components=[]),n.userData.components.push(e),e.gameObject=n,(e.guid===void 0||e.guid==="invalid")&&(e.guid=NN.generateUUID()),Mx(n),Gx(e);try{t&&e.__internalAwake&&(bg(n),e.activeAndEnabled&&e.__internalAwake()),sv.dispatchComponentLifecycleEvent(nv.Added,e)}catch(i){console.error(i)}return e}function SI(n,e){if(typeof e=="function")return Mh(n,new e);if(e.destroyed)return console.warn("Can not move/add a destroyed component",e),e;if(e.gameObject===n)return e;if(e.gameObject&&e.gameObject.userData.components){const t=e.gameObject.userData.components.indexOf(e);e.gameObject.userData.components.splice(t,1)}if(!n.userData.components)n.userData.components=[];else if(n.userData.components.includes(e))return e;return n.userData.components.push(e),e.gameObject=n,(e.guid===void 0||e.guid==="invalid")&&(e.guid=NN.generateUUID()),Gx(e),e}function zN(n){if(n.gameObject&&n.gameObject.userData.components){const e=n.gameObject.userData.components.indexOf(n);n.gameObject.userData.components.splice(e,1)}n.__internalDisable&&n.__internalDisable(),Hl(n,n.context??Nt.Current),n.destroy(),n.gameObject=null}let MD=!1;function GN(n,e,t){var i;if(n==null)return null;if(!n.isObject3D)return console.error("Object is not object3D"),null;if(!((i=n==null?void 0:n.userData)!=null&&i.components)||(typeof e=="string"&&(MD||(MD=!0,console.warn(`Accessing components by name is not supported.
@@ -4076,7 +4076,7 @@ void main() {
4076
4076
  `){super("lineBreak",A,!0),this._newLineBreakability=null}update(A,e){this._needsProcess=!0}process(A){const e=A._whiteSpace._newLineBreakability;if(A._inlines._value)for(let g=0;g<A._inlines._value.length;g++){const i=A._inlines._value[g],I=i.char;let o=null;I!==void 0&&(e!=="nowrap"&&(this._value.includes(I)||I.match(/\s/g))&&(o="possible"),I.match(/\n/g)&&(o=e)),i.lineBreak=o}}get value(){return this._value}}class dL extends dt{constructor(){super("layouter",null,!1),this._value=null}update(A,e){this._value=A._parent.find(g=>g.isUI&&g.isText),this._needsProcess=!0}process(A){this._value&&(this._value._layouter._needsProcess=!0)}}class WX extends yc{constructor(A){super("backgroundColor",A,!1),this._allowsInherit=!1,this._input=0}computeOutputValue(A){this._input==="inherit"?this._value.set(this.getInheritedInput(A)):this._value.set(this._input)}}class uL extends Qq{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class pL extends Eq{constructor(){super()}computeOutputValue(A){this._value=Yk(this.getInheritedInput(A))}}class DL extends Dq{constructor(){super("fontFamily","inherit",!0),this._input="inherit",this._needsUpdate=!0,this._allowsInherit=!1}computeOutputValue(A){let e=this._inheritedInput;if(e==="inherit"&&(e=this.getInheritedInput(A)),e instanceof aD)this._value=e,A._font._needsUpdate=!0;else if(typeof e=="string"){const g=br.getFontFamily(e);g?(this._value=g,A._font._needsUpdate=!0):console.warn(`(.style) fontFamily, the font '${e}' is not registered. Aborted.`)}else console.warn("(.style) fontFamily requires a registered fontFamily instance, or the id of a registered fontFamily."),console.warn("If you want to set a specific font, please use .font property instead.")}get value(){return this._value}}class SG extends yq{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited,this._whiteSpacedContent="",this._stringCollapser=this.emptyStrategyLogic,this._inlineCollapser=this.emptyStrategyLogic,this._inlineWrapper=this.emptyStrategyLogic}_computeFromInherited(A){switch(super._computeFromInherited(A),this._newLineBreakability=VX(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=ZX;break;case"pre-line":this._stringCollapser=yL;break;default:this._stringCollapser=zX}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=t9;break;case"pre-wrap":this._inlineCollapser=e9;break;default:this._inlineCollapser=g9}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=XX;break;case"pre":this._inlineWrapper=$X;break;default:this._inlineWrapper=A9}this._needsProcess=!0}process(A){A.isInline&&!A.isInlineBlock&&(this._whiteSpacedContent=this._stringCollapser(A._textContent._value),A._glyphs._needsProcess=!0)}}const wL={" ":" ","\n":`
4077
4077
  `,"\r":"\r"," ":" "},VX=function(t){switch(t){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function ZX(t){return yL(t.replace(/\n/g," "))}function yL(t){return t.replace(/[ ]{2,}/g," ")}function zX(t){return t}function XX(t,A,e,g){const i=t[A];if(i.lineBreak==="mandatory"||e+i.xadvance+i.xoffset+i.kerning>g.INNER_WIDTH)return!0;const I=mL(t,A,g);return i9(t[A-1],e,I,g)}function $X(t,A,e,g){return t[A].lineBreak==="mandatory"}function A9(){return!1}function e9(t){if(!t[0])return 0;const A=t[0],e=t[t.length-1];return A.char&&A.char===`
4078
4078
  `&&t.length>1&&fL([A],t[1]),e.char&&e.char===`
4079
- `&&t.length>1&&SL([e],t[t.length-2]),A.offsetX}function t9(t){if(!t[0])return 0;let A=[],e;for(let g=0;g<t.length;g++){const i=t[g];if(i.char&&wL[i.char]&&t.length>g){A.push(i),e=t[g+1];continue}break}fL(A,e),A=[],e=null;for(let g=t.length-1;g>0;g--){const i=t[g];if(i.char&&wL[i.char]&&g>0){A.push(i),e=t[g-1];continue}break}return SL(A,e),t[0].offsetX}function g9(t){return t[0]?t[0].offsetX:0}function SL(t,A){if(A)for(let e=0;e<t.length;e++){const g=t[e];g.fontFactor=0,g.offsetX=A.offsetX+A.cumulativeWidth,g.cumulativeWidth=0}}function fL(t,A){if(A)for(let e=0;e<t.length;e++){const g=t[e];g.fontFactor=0,g.offsetX=A.offsetX,g.cumulativeWidth=0}}function mL(t,A,e,g){if(g=g||0,!t[A])return g;const i=t[A];return i.lineBreak?g+i.xadvance:mL(t,A+1,e,g+i.xadvance+i.xoffset+i.kerning+e.LETTERSPACING)}function i9(t,A,e,g){return!t||!t.char||A+e<g.INNER_WIDTH?!1:g.BREAKON.indexOf(t.char)>-1}class kL extends Sq{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._fontSize._needsProcess=!0,A._layouter._needsProcess=!0}}class GL extends Pt{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(A){this._value=this._inheritedInput,A._font._fontVariant&&(A._bounds._needsProcess=!0,A._layouter._needsProcess=!0)}process(A){if(!A._font._fontVariant||!A._font._fontVariant.isReady)return;const e=this._value/A._font._fontVariant.typographic.size,g=A._inlines._value;for(let i=0;i<g.length;i++){const I=g[i];I.resetOffsets(),I.fontSize=this._value,I.fontFactor=e}}get value(){return this._value}}class ML extends fq{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(A,e){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(A)),A._layouter._needsUpdate=!0}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class I9 extends ML{constructor(){super(),this._value="inherit"}}class o9 extends rD{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._parent._value._layouter._needsProcess=!1}process(A){if(this._value!=="none"){const e=A._whiteSpace._whiteSpacedContent,g=A._inlines._value;for(let i=1;i<g.length;i++){const I=e[i-1]+e[i];g[i].kerning=A._font._fontVariant.getKerningAmount(I)}}}}class RL extends dt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function C9(t,A=!1){const e=t[0].index!==null,g=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),I={},o={},C=t[0].morphTargetsRelative,s=new _A.BufferGeometry;let a=0;for(let r=0;r<t.length;++r){const B=t[r];let Q=0;if(e!==(B.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const E in B.attributes){if(!g.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;I[E]===void 0&&(I[E]=[]),I[E].push(B.attributes[E]),Q++}if(Q!==g.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". Make sure all geometries have the same number of attributes."),null;if(C!==B.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const E in B.morphAttributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". .morphAttributes must be consistent throughout all geometries."),null;o[E]===void 0&&(o[E]=[]),o[E].push(B.morphAttributes[E])}if(s.userData.mergedUserData=s.userData.mergedUserData||[],s.userData.mergedUserData.push(B.userData),A){let E;if(e)E=B.index.count;else if(B.attributes.position!==void 0)E=B.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". The geometry must have either an index or a position attribute"),null;s.addGroup(a,E,r),a+=E}}if(e){let r=0;const B=[];for(let Q=0;Q<t.length;++Q){const E=t[Q].index;for(let h=0;h<E.count;++h)B.push(E.getX(h)+r);r+=t[Q].attributes.position.count}s.setIndex(B)}for(const r in I){const B=UL(I[r]);if(!B)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" attribute."),null;s.setAttribute(r,B)}for(const r in o){const B=o[r][0].length;if(B===0)break;s.morphAttributes=s.morphAttributes||{},s.morphAttributes[r]=[];for(let Q=0;Q<B;++Q){const E=[];for(let d=0;d<o[r].length;++d)E.push(o[r][d][Q]);const h=UL(E);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;s.morphAttributes[r].push(h)}}return s}function UL(t){let A,e,g,i=0;for(let C=0;C<t.length;++C){const s=t[C];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(A===void 0&&(A=s.array.constructor),A!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=s.itemSize),e!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(g===void 0&&(g=s.normalized),g!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}const I=new A(i);let o=0;for(let C=0;C<t.length;++C)I.set(t[C].array,o),o+=t[C].array.length;return new _A.BufferAttribute(I,e,g)}class s9 extends dt{constructor(){super("renderer")}render(A){if(!A._inlines._value||!A._inlines._value.length)return;const e=A._inlines._value.map(i=>A._font._fontVariant.getGeometricGlyph(i,A).translate(i.offsetX,i.offsetY,0)),g=C9(e);A.setFontMesh(new _A.Mesh(g,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class a9 extends Ok{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class Sh extends Rc{constructor(A={}){const e={};Sh.definePropertiesValues(e,A),super(e,A),n(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),Sh.init(this)}add(A){const e=[];for(let g=0;g<arguments.length;g++){const i=arguments[g];!i.isUI||i.isInline?(e.push(i),i.position.z=.005):console.warn("Block element can only contain Box elements.",i)}return super.add(...e)}set textContent(A){this._textContent.value=A}get textContent(){return this._textContent._value}set invertAlpha(A){this._invertAlpha.value=A}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(A,e){A.children||(A.children=RL),A.textContent||(A.textContent=OX),A.glyphs||(A.glyphs=PX),A.inlines||(A.inlines=_X),A.layouter||(A.layouter=dL),A.renderer||(A.renderer=s9),A.fontFamily||(A.fontFamily=DL),A.fontWeight||(A.fontWeight=pL),A.fontStyle||(A.fontStyle=uL),A.fontSize||(A.fontSize=GL),A.color||(A.color=jX),A.backgroundColor||(A.backgroundColor=WX),A.lineBreak||(A.lineBreak=lL),A.letterSpacing||(A.letterSpacing=kL),A.whiteSpace||(A.whiteSpace=SG),A.segments||(A.segments=I9),A.textAlign||(A.textAlign=a9),A.fontKerning||(A.fontKerning=o9)}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class n9 extends Bq{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}update(A,e){this._needsUpdate=!1;for(let g=A.children.length-1;g>=0;g--){const i=A.children[g];i.isUI&&(A.remove(i),i.clear())}A._children._uis=[],this._value&&A.add(new Sh({name:"anonymousInline",textContent:this._value}))}}class r9 extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class B9 extends dt{constructor(){super("layouter",null,!1),this._value=null}update(A,e){}process(A){let e=A._width._value;A._width._auto?e=1/0:e=A._bounds._innerWidth;const g=A._lineHeight._value,i=new r9(new cL);let I=0;A._children._inlines.forEach(B=>{if(!B._inlines.value)return;this._resetInlines(B);const Q=B._fontSize._value,E=B._letterSpacing._value*Q,h=B._whiteSpace._value,d=B._lineBreak._value,l={WHITESPACE:h,LETTERSPACING:E,BREAKON:d,INNER_WIDTH:e},c=B._whiteSpace._inlineWrapper;I+=B._margin._value.w+B._padding._value.w,B._inlines.value.forEach((p,u,D)=>{const S=i[i.length-1];if(c(D,u,I,l)){if(i.push(new cL(p)),p.offsetX=p.xoffset,p.width===0){I=0;return}p.cumulativeWidth=p.xadvance+E,I=p.cumulativeWidth;return}i[i.length-1].push(p),p.offsetX=I+p.xoffset+p.kerning,p.cumulativeWidth=p.xadvance+p.kerning+E,I+=p.cumulativeWidth,S.length-1===1&&S[S.length-2].width===0&&(p.offsetX-=p.xoffset,I-=p.xoffset)}),I+=B._margin._value.y+B._padding._value.y});const o=A._whiteSpace._inlineCollapser;let C=0,s=0,a=0;i.forEach((B,Q)=>{const E=o(B);let h=0,d=0;if(B.forEach(l=>{h=Math.max(h,l.lineHeight),d=Math.max(d,l.lineBase),l.offsetX-=E}),B.lineHeight=h,B.lineBase=d,Q===0?a=-(h*g-h)*.5:a-=i[Q-1].lineHeight*g,B.y=a,B.x=0,B.forEach(l=>{l.offsetY=a-l.anchor,l.lineHeight<B.lineHeight&&(l.offsetY-=B.lineBase-l.lineBase)}),s+=B.lineHeight*g,B.width=0,B[0]){const l=B[B.length-1];B.width=l.offsetX+l.cumulativeWidth+l.paddingRight+l.marginRight+B[0].offsetX,C=Math.max(C,B.width)}}),i.height=s,i.width=C,this._value=i,e===1/0&&A._bounds.setChildrenWidth(A,i.width),A._height._auto&&A._bounds.setChildrenHeight(A,i.height);const r=A._parent._value;r&&(r._autoSize._needsProcess=!0,r._flexDirection._needsProcess=!0),A._inlineJustificator._needsProcess=!0,A._textAlign._needsProcess=!0,A._overflow._needsUpdate=!0}_resetInlines(A){A._fontSize.process(A)}}class Q9 extends Ok{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){E9(A),A._renderer._needsRender=!0}}function E9(t){const A=t._layouter._value,e=t._textAlign._value,g=t._bounds._innerWidth;for(let i=0;i<A.length;i++){const I=A[i],o=h9(t,I,i===A.length-1),C=t._padding._value,s=t._borderWidth._value,a=(-C.w+C.y)/2+(-s.w+s.y)/2;I.x+=o;for(let r=0;r<I.length;r++)I[r].offsetX+=o-a}if(e.indexOf("justify")===0)for(let i=0;i<A.length;i++){const I=A[i];if(e.indexOf("-")!==-1&&i===A.length-1)return;const o=g-I.width;if(o<=0)return;let C=0;for(let B=1;B<I.length-1;B++)C+=I[B].char===" "?1:0;const s=o/C;let a=1;e==="justify-right"&&(I.reverse(),a=-1);let r=0;for(let B=1;B<=I.length-1;B++){const Q=I[B];Q.offsetX+=r*a,r+=Q.char===" "?s:0}e==="justify-right"&&I.reverse()}}function h9(t,A,e){switch(t._textAlign._value){case"justify-left":case"justify":case"left":return-t._bounds._innerWidth/2;case"justify-right":case"right":return-A.width+t._bounds._innerWidth/2;case"center":return-A.width/2;case"justify-center":return e?-A.width/2:-t._bounds._innerWidth/2;default:console.warn(`textAlign: '${t._textAlign._value}' is not valid`)}}class c9 extends _k{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class l9 extends wq{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class d9 extends rD{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class u9 extends BL{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class p9 extends dt{constructor(){super("children",null,!1),n(this,"_sortOrder",(A,e)=>A._order._value<e._order._value?-1:A._order._value>e._order._value?1:this._uis.indexOf(A)<this._uis.indexOf(e)?-1:1),this._uis=[],this._inlines=[],this._boxes=[]}update(A,e){this._compute(A),this._needsProcess=!0}process(A){this._compute(A),A._overflow._needsRender=!0}_compute(A){this._uis=A.children.filter(e=>e.visible&&e.isUI),this._inlines=this._uis.filter(e=>e.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class D9 extends dt{constructor(){super("autosize")}process(A){if(A._layouter._value&&A._layouter._value.length){const e=A._layouter._value,g=A._padding._value,i=A._borderWidth._value;A._width._auto&&A._bounds.setOffsetWidth(A,e.width+g.w+g.y+i.w+i.y),A._height._auto&&A._bounds.setOffsetHeight(A,e.height+g.x+g.z+i.x+i.z)}}}class w9 extends hL{constructor(){super("renderer"),this._needsUpdate=!1}render(A){super.render(A);for(const e of A._children._inlines)e._renderer.render(e);A.performAfterUpdate()}}class Eu extends Bu{constructor(A={},e={}){Eu.definePropertiesValues(e,A),super(e,A),Eu.init(this)}add(A){const e=[];let g=!1;for(let i=0;i<arguments.length;i++){const I=arguments[i];!I.isUI||I.isInline?(I.isInline&&(g=!0),e.push(I)):console.warn("Block element can only contain Box elements.",I)}return e.length>0&&super.add(...e),g&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(A){this._textContent.value=A}get textContent(){return super.textContent}set invertAlpha(A){this._invertAlpha.value=A}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(A,e){A.flexDirection=c9,A.justifyContent=Pk,A.alignItems=Hk,A.bounds=u9,A.autoSize=D9,A.renderer=w9,A.children||(A.children=p9),A.textContent||(A.textContent=n9),A.layouter||(A.layouter=B9),A.lineHeight||(A.lineHeight=l9),A.textAlign||(A.textAlign=Q9),A.whiteSpace||(A.whiteSpace=SG),A.fontKerning||(A.fontKerning=d9),A.segments||(A.segments=ML),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class y9 extends dt{constructor(){super("inlines",null,!1),this._value=[]}process(A){this._value[0].paddingLeft=A._padding._value.w,this._value[0].marginLeft=A._margin._value.w;const e=this._value.length-1;this._value[e].paddingRight=A._padding._value.y,this._value[e].marginRight=A._margin._value.y}}class S9 extends dt{constructor(){super("renderer")}render(A){A._backgroundMesh||A.setBackgroundMesh(new EL(A)),A._backgroundMesh.position.x=A._inlines._value[0].offsetX+A._inlines._value[0].width/2,A._backgroundMesh.position.y=A._inlines._value[0].offsetY+A._inlines._value[0].lineBase/2,A._bounds.render(A)}}class f9 extends dt{constructor(){super("bounds",null,!1),this._size=new _A.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(A,e){this.output(e),this._needsProcess=!0}process(A){this._offsetWidth=this._innerWidth=A._inlines._value[0].width,this._offsetHeight=this._innerHeight=A._inlines._value[0].height,this._needsRender=!0,A._borderWidth._needsRender=!0,A._borderRadius._needsRender=!0}render(A){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(A){A.size=this._size}}class hu extends Rc{constructor(A={}){const e={};hu.definePropertiesValues(e,A),super(e,A),hu.init(this)}clear(){for(const A of this._inlines._value)A.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new _A.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(A){const e=[];for(let g=0;g<arguments.length;g++){const i=arguments[g];i.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",i):(e.push(i),i.position.z=.005)}return super.add(...e)}static definePropertiesValues(A,e){A.children||(A.children=RL),A.bounds||(A.bounds=f9),A.inlines||(A.inlines=y9),A.layouter||(A.layouter=dL),A.renderer||(A.renderer=S9),A.fontFamily||(A.fontFamily=DL),A.fontWeight||(A.fontWeight=pL),A.fontStyle||(A.fontStyle=uL),A.fontSize||(A.fontSize=GL),A.backgroundColor||(A.backgroundColor=aq),A.lineBreak||(A.lineBreak=lL),A.letterSpacing||(A.letterSpacing=kL),A.whiteSpace||(A.whiteSpace=SG),A.fontKerning||(A.fontKerning=rD),e.backgroundSize||(e.backgroundSize="cover"),e.width||(e.width="100%"),e.height||(e.height="100%"),e.boxSizing||(e.boxSizing="border-box")}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),A._inlines._value=[new m9(A)],A.backgroundMaterial=new rL,A._renderer.render(A)}}class m9 extends lq{constructor(A){super(),this._uiElement=A}get xadvance(){const A=this._uiElement._padding._value,e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.w+A.y+e.value}get width(){const A=this._uiElement._width;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get height(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get anchor(){return this.height}get lineHeight(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get lineBase(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}clear(){this._uiElement=null}}class NL{constructor(A){this._subject=A}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const FL=()=>pD.update(),KL={BaseProperty:dt,Block:Qu,Text:Eu,Inline:Sh,InlineBlock:hu,MeshUIBaseElement:Rc,FontLibrary:br,update:FL,MSDFFontMaterialUtils:eC,ShaderChunkUI:nL,Behavior:NL,FontVariant:wc};typeof global<"u"&&(global.ThreeMeshUI=KL);const k9=KL;var G9=vg.w8,JL=vg.cg,fG=vg.gO,M9=vg.wb,mG=vg.zV,R9=vg.HS,U9=vg.Ec,wD=vg.gF,N9=vg.ol,F9=vg.pz,K9=vg.tx,J9=vg.hj,v9=vg.FV,b9=vg.sV,kG=vg.xv,q9=vg.mx,L9=vg.gE,LQ=vg.ZP,vL=vg.Vx;const GG=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:G9,Behavior:JL,Block:fG,DefaultValues:M9,FontLibrary:mG,FontVariant:R9,InheritableProperty:U9,Inline:wD,InlineBlock:N9,InlineGlyph:F9,MSDFFontMaterialUtils:K9,MaterialTransformers:J9,MeshUIBaseElement:v9,ShaderChunkUI:b9,Text:kG,TypographicFont:q9,TypographicGlyph:L9,default:LQ,update:vL},Symbol.toStringTag,{value:"Module"}));function Lr(t,A){try{A?t(A):t()}catch(e){return console.error(e),!1}return!0}const bL=sA("debugdefines");SD('if(!globalThis[""3.31.7""]) globalThis[""3.31.7""] = "0.0.0";'),SD('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),SD('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.7";'),SD('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Os="3.31.7",yD="undefined";bL&&console.log(`Engine version: ${Os} (generator: ${yD})`);const _s="needle_isActiveInHierarchy",xr="builtin_components",Uc="needle_editor_guid";function SD(t){try{(0,eval)(t)}catch(A){bL&&console.error(A)}}const MG=sA("debugnewscripts"),x9=sA("debughierarchy"),Wt=[];function Y9(){return Wt.length>0}function fD(t){if(!(t.new_scripts.length<=0)){if(MG&&console.log("Register new components",t.new_scripts.length,[...t.new_scripts],t.alias?"element: "+t.alias:t.hash,t),t.new_scripts_pre_setup_callbacks.length>0){for(const A of t.new_scripts_pre_setup_callbacks)A&&A();t.new_scripts_pre_setup_callbacks.length=0}Wt.length=0,t.new_scripts.length>0&&Wt.push(...t.new_scripts),t.new_scripts.length=0;for(let A=0;A<Wt.length;A++)try{const e=Wt[A];if(e.isComponent!==!0){(He()||MG)&&console.error(`Registered script is not a Needle Engine component.
4079
+ `&&t.length>1&&SL([e],t[t.length-2]),A.offsetX}function t9(t){if(!t[0])return 0;let A=[],e;for(let g=0;g<t.length;g++){const i=t[g];if(i.char&&wL[i.char]&&t.length>g){A.push(i),e=t[g+1];continue}break}fL(A,e),A=[],e=null;for(let g=t.length-1;g>0;g--){const i=t[g];if(i.char&&wL[i.char]&&g>0){A.push(i),e=t[g-1];continue}break}return SL(A,e),t[0].offsetX}function g9(t){return t[0]?t[0].offsetX:0}function SL(t,A){if(A)for(let e=0;e<t.length;e++){const g=t[e];g.fontFactor=0,g.offsetX=A.offsetX+A.cumulativeWidth,g.cumulativeWidth=0}}function fL(t,A){if(A)for(let e=0;e<t.length;e++){const g=t[e];g.fontFactor=0,g.offsetX=A.offsetX,g.cumulativeWidth=0}}function mL(t,A,e,g){if(g=g||0,!t[A])return g;const i=t[A];return i.lineBreak?g+i.xadvance:mL(t,A+1,e,g+i.xadvance+i.xoffset+i.kerning+e.LETTERSPACING)}function i9(t,A,e,g){return!t||!t.char||A+e<g.INNER_WIDTH?!1:g.BREAKON.indexOf(t.char)>-1}class kL extends Sq{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._fontSize._needsProcess=!0,A._layouter._needsProcess=!0}}class GL extends Pt{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(A){this._value=this._inheritedInput,A._font._fontVariant&&(A._bounds._needsProcess=!0,A._layouter._needsProcess=!0)}process(A){if(!A._font._fontVariant||!A._font._fontVariant.isReady)return;const e=this._value/A._font._fontVariant.typographic.size,g=A._inlines._value;for(let i=0;i<g.length;i++){const I=g[i];I.resetOffsets(),I.fontSize=this._value,I.fontFactor=e}}get value(){return this._value}}class ML extends fq{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(A,e){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(A)),A._layouter._needsUpdate=!0}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class I9 extends ML{constructor(){super(),this._value="inherit"}}class o9 extends rD{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._parent._value._layouter._needsProcess=!1}process(A){if(this._value!=="none"){const e=A._whiteSpace._whiteSpacedContent,g=A._inlines._value;for(let i=1;i<g.length;i++){const I=e[i-1]+e[i];g[i].kerning=A._font._fontVariant.getKerningAmount(I)}}}}class RL extends dt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function C9(t,A=!1){const e=t[0].index!==null,g=new Set(Object.keys(t[0].attributes)),i=new Set(Object.keys(t[0].morphAttributes)),I={},o={},C=t[0].morphTargetsRelative,s=new _A.BufferGeometry;let a=0;for(let r=0;r<t.length;++r){const B=t[r];let Q=0;if(e!==(B.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const E in B.attributes){if(!g.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;I[E]===void 0&&(I[E]=[]),I[E].push(B.attributes[E]),Q++}if(Q!==g.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". Make sure all geometries have the same number of attributes."),null;if(C!==B.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const E in B.morphAttributes){if(!i.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". .morphAttributes must be consistent throughout all geometries."),null;o[E]===void 0&&(o[E]=[]),o[E].push(B.morphAttributes[E])}if(s.userData.mergedUserData=s.userData.mergedUserData||[],s.userData.mergedUserData.push(B.userData),A){let E;if(e)E=B.index.count;else if(B.attributes.position!==void 0)E=B.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+r+". The geometry must have either an index or a position attribute"),null;s.addGroup(a,E,r),a+=E}}if(e){let r=0;const B=[];for(let Q=0;Q<t.length;++Q){const E=t[Q].index;for(let h=0;h<E.count;++h)B.push(E.getX(h)+r);r+=t[Q].attributes.position.count}s.setIndex(B)}for(const r in I){const B=UL(I[r]);if(!B)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" attribute."),null;s.setAttribute(r,B)}for(const r in o){const B=o[r][0].length;if(B===0)break;s.morphAttributes=s.morphAttributes||{},s.morphAttributes[r]=[];for(let Q=0;Q<B;++Q){const E=[];for(let d=0;d<o[r].length;++d)E.push(o[r][d][Q]);const h=UL(E);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;s.morphAttributes[r].push(h)}}return s}function UL(t){let A,e,g,i=0;for(let C=0;C<t.length;++C){const s=t[C];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(A===void 0&&(A=s.array.constructor),A!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=s.itemSize),e!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(g===void 0&&(g=s.normalized),g!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}const I=new A(i);let o=0;for(let C=0;C<t.length;++C)I.set(t[C].array,o),o+=t[C].array.length;return new _A.BufferAttribute(I,e,g)}class s9 extends dt{constructor(){super("renderer")}render(A){if(!A._inlines._value||!A._inlines._value.length)return;const e=A._inlines._value.map(i=>A._font._fontVariant.getGeometricGlyph(i,A).translate(i.offsetX,i.offsetY,0)),g=C9(e);A.setFontMesh(new _A.Mesh(g,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class a9 extends Ok{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class Sh extends Rc{constructor(A={}){const e={};Sh.definePropertiesValues(e,A),super(e,A),n(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),Sh.init(this)}add(A){const e=[];for(let g=0;g<arguments.length;g++){const i=arguments[g];!i.isUI||i.isInline?(e.push(i),i.position.z=.005):console.warn("Block element can only contain Box elements.",i)}return super.add(...e)}set textContent(A){this._textContent.value=A}get textContent(){return this._textContent._value}set invertAlpha(A){this._invertAlpha.value=A}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(A,e){A.children||(A.children=RL),A.textContent||(A.textContent=OX),A.glyphs||(A.glyphs=PX),A.inlines||(A.inlines=_X),A.layouter||(A.layouter=dL),A.renderer||(A.renderer=s9),A.fontFamily||(A.fontFamily=DL),A.fontWeight||(A.fontWeight=pL),A.fontStyle||(A.fontStyle=uL),A.fontSize||(A.fontSize=GL),A.color||(A.color=jX),A.backgroundColor||(A.backgroundColor=WX),A.lineBreak||(A.lineBreak=lL),A.letterSpacing||(A.letterSpacing=kL),A.whiteSpace||(A.whiteSpace=SG),A.segments||(A.segments=I9),A.textAlign||(A.textAlign=a9),A.fontKerning||(A.fontKerning=o9)}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class n9 extends Bq{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}update(A,e){this._needsUpdate=!1;for(let g=A.children.length-1;g>=0;g--){const i=A.children[g];i.isUI&&(A.remove(i),i.clear())}A._children._uis=[],this._value&&A.add(new Sh({name:"anonymousInline",textContent:this._value}))}}class r9 extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class B9 extends dt{constructor(){super("layouter",null,!1),this._value=null}update(A,e){}process(A){let e=A._width._value;A._width._auto?e=1/0:e=A._bounds._innerWidth;const g=A._lineHeight._value,i=new r9(new cL);let I=0;A._children._inlines.forEach(B=>{if(!B._inlines.value)return;this._resetInlines(B);const Q=B._fontSize._value,E=B._letterSpacing._value*Q,h=B._whiteSpace._value,d=B._lineBreak._value,l={WHITESPACE:h,LETTERSPACING:E,BREAKON:d,INNER_WIDTH:e},c=B._whiteSpace._inlineWrapper;I+=B._margin._value.w+B._padding._value.w,B._inlines.value.forEach((p,u,D)=>{const S=i[i.length-1];if(c(D,u,I,l)){if(i.push(new cL(p)),p.offsetX=p.xoffset,p.width===0){I=0;return}p.cumulativeWidth=p.xadvance+E,I=p.cumulativeWidth;return}i[i.length-1].push(p),p.offsetX=I+p.xoffset+p.kerning,p.cumulativeWidth=p.xadvance+p.kerning+E,I+=p.cumulativeWidth,S.length-1===1&&S[S.length-2].width===0&&(p.offsetX-=p.xoffset,I-=p.xoffset)}),I+=B._margin._value.y+B._padding._value.y});const o=A._whiteSpace._inlineCollapser;let C=0,s=0,a=0;i.forEach((B,Q)=>{const E=o(B);let h=0,d=0;if(B.forEach(l=>{h=Math.max(h,l.lineHeight),d=Math.max(d,l.lineBase),l.offsetX-=E}),B.lineHeight=h,B.lineBase=d,Q===0?a=-(h*g-h)*.5:a-=i[Q-1].lineHeight*g,B.y=a,B.x=0,B.forEach(l=>{l.offsetY=a-l.anchor,l.lineHeight<B.lineHeight&&(l.offsetY-=B.lineBase-l.lineBase)}),s+=B.lineHeight*g,B.width=0,B[0]){const l=B[B.length-1];B.width=l.offsetX+l.cumulativeWidth+l.paddingRight+l.marginRight+B[0].offsetX,C=Math.max(C,B.width)}}),i.height=s,i.width=C,this._value=i,e===1/0&&A._bounds.setChildrenWidth(A,i.width),A._height._auto&&A._bounds.setChildrenHeight(A,i.height);const r=A._parent._value;r&&(r._autoSize._needsProcess=!0,r._flexDirection._needsProcess=!0),A._inlineJustificator._needsProcess=!0,A._textAlign._needsProcess=!0,A._overflow._needsUpdate=!0}_resetInlines(A){A._fontSize.process(A)}}class Q9 extends Ok{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){E9(A),A._renderer._needsRender=!0}}function E9(t){const A=t._layouter._value,e=t._textAlign._value,g=t._bounds._innerWidth;for(let i=0;i<A.length;i++){const I=A[i],o=h9(t,I,i===A.length-1),C=t._padding._value,s=t._borderWidth._value,a=(-C.w+C.y)/2+(-s.w+s.y)/2;I.x+=o;for(let r=0;r<I.length;r++)I[r].offsetX+=o-a}if(e.indexOf("justify")===0)for(let i=0;i<A.length;i++){const I=A[i];if(e.indexOf("-")!==-1&&i===A.length-1)return;const o=g-I.width;if(o<=0)return;let C=0;for(let B=1;B<I.length-1;B++)C+=I[B].char===" "?1:0;const s=o/C;let a=1;e==="justify-right"&&(I.reverse(),a=-1);let r=0;for(let B=1;B<=I.length-1;B++){const Q=I[B];Q.offsetX+=r*a,r+=Q.char===" "?s:0}e==="justify-right"&&I.reverse()}}function h9(t,A,e){switch(t._textAlign._value){case"justify-left":case"justify":case"left":return-t._bounds._innerWidth/2;case"justify-right":case"right":return-A.width+t._bounds._innerWidth/2;case"center":return-A.width/2;case"justify-center":return e?-A.width/2:-t._bounds._innerWidth/2;default:console.warn(`textAlign: '${t._textAlign._value}' is not valid`)}}class c9 extends _k{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class l9 extends wq{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class d9 extends rD{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class u9 extends BL{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class p9 extends dt{constructor(){super("children",null,!1),n(this,"_sortOrder",(A,e)=>A._order._value<e._order._value?-1:A._order._value>e._order._value?1:this._uis.indexOf(A)<this._uis.indexOf(e)?-1:1),this._uis=[],this._inlines=[],this._boxes=[]}update(A,e){this._compute(A),this._needsProcess=!0}process(A){this._compute(A),A._overflow._needsRender=!0}_compute(A){this._uis=A.children.filter(e=>e.visible&&e.isUI),this._inlines=this._uis.filter(e=>e.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class D9 extends dt{constructor(){super("autosize")}process(A){if(A._layouter._value&&A._layouter._value.length){const e=A._layouter._value,g=A._padding._value,i=A._borderWidth._value;A._width._auto&&A._bounds.setOffsetWidth(A,e.width+g.w+g.y+i.w+i.y),A._height._auto&&A._bounds.setOffsetHeight(A,e.height+g.x+g.z+i.x+i.z)}}}class w9 extends hL{constructor(){super("renderer"),this._needsUpdate=!1}render(A){super.render(A);for(const e of A._children._inlines)e._renderer.render(e);A.performAfterUpdate()}}class Eu extends Bu{constructor(A={},e={}){Eu.definePropertiesValues(e,A),super(e,A),Eu.init(this)}add(A){const e=[];let g=!1;for(let i=0;i<arguments.length;i++){const I=arguments[i];!I.isUI||I.isInline?(I.isInline&&(g=!0),e.push(I)):console.warn("Block element can only contain Box elements.",I)}return e.length>0&&super.add(...e),g&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(A){this._textContent.value=A}get textContent(){return super.textContent}set invertAlpha(A){this._invertAlpha.value=A}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(A,e){A.flexDirection=c9,A.justifyContent=Pk,A.alignItems=Hk,A.bounds=u9,A.autoSize=D9,A.renderer=w9,A.children||(A.children=p9),A.textContent||(A.textContent=n9),A.layouter||(A.layouter=B9),A.lineHeight||(A.lineHeight=l9),A.textAlign||(A.textAlign=Q9),A.whiteSpace||(A.whiteSpace=SG),A.fontKerning||(A.fontKerning=d9),A.segments||(A.segments=ML),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class y9 extends dt{constructor(){super("inlines",null,!1),this._value=[]}process(A){this._value[0].paddingLeft=A._padding._value.w,this._value[0].marginLeft=A._margin._value.w;const e=this._value.length-1;this._value[e].paddingRight=A._padding._value.y,this._value[e].marginRight=A._margin._value.y}}class S9 extends dt{constructor(){super("renderer")}render(A){A._backgroundMesh||A.setBackgroundMesh(new EL(A)),A._backgroundMesh.position.x=A._inlines._value[0].offsetX+A._inlines._value[0].width/2,A._backgroundMesh.position.y=A._inlines._value[0].offsetY+A._inlines._value[0].lineBase/2,A._bounds.render(A)}}class f9 extends dt{constructor(){super("bounds",null,!1),this._size=new _A.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(A,e){this.output(e),this._needsProcess=!0}process(A){this._offsetWidth=this._innerWidth=A._inlines._value[0].width,this._offsetHeight=this._innerHeight=A._inlines._value[0].height,this._needsRender=!0,A._borderWidth._needsRender=!0,A._borderRadius._needsRender=!0}render(A){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(A){A.size=this._size}}class hu extends Rc{constructor(A={}){const e={};hu.definePropertiesValues(e,A),super(e,A),hu.init(this)}clear(){for(const A of this._inlines._value)A.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new _A.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(A){const e=[];for(let g=0;g<arguments.length;g++){const i=arguments[g];i.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",i):(e.push(i),i.position.z=.005)}return super.add(...e)}static definePropertiesValues(A,e){A.children||(A.children=RL),A.bounds||(A.bounds=f9),A.inlines||(A.inlines=y9),A.layouter||(A.layouter=dL),A.renderer||(A.renderer=S9),A.fontFamily||(A.fontFamily=DL),A.fontWeight||(A.fontWeight=pL),A.fontStyle||(A.fontStyle=uL),A.fontSize||(A.fontSize=GL),A.backgroundColor||(A.backgroundColor=aq),A.lineBreak||(A.lineBreak=lL),A.letterSpacing||(A.letterSpacing=kL),A.whiteSpace||(A.whiteSpace=SG),A.fontKerning||(A.fontKerning=rD),e.backgroundSize||(e.backgroundSize="cover"),e.width||(e.width="100%"),e.height||(e.height="100%"),e.boxSizing||(e.boxSizing="border-box")}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),A._inlines._value=[new m9(A)],A.backgroundMaterial=new rL,A._renderer.render(A)}}class m9 extends lq{constructor(A){super(),this._uiElement=A}get xadvance(){const A=this._uiElement._padding._value,e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.w+A.y+e.value}get width(){const A=this._uiElement._width;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get height(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get anchor(){return this.height}get lineHeight(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get lineBase(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}clear(){this._uiElement=null}}class NL{constructor(A){this._subject=A}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const FL=()=>pD.update(),KL={BaseProperty:dt,Block:Qu,Text:Eu,Inline:Sh,InlineBlock:hu,MeshUIBaseElement:Rc,FontLibrary:br,update:FL,MSDFFontMaterialUtils:eC,ShaderChunkUI:nL,Behavior:NL,FontVariant:wc};typeof global<"u"&&(global.ThreeMeshUI=KL);const k9=KL;var G9=vg.w8,JL=vg.cg,fG=vg.gO,M9=vg.wb,mG=vg.zV,R9=vg.HS,U9=vg.Ec,wD=vg.gF,N9=vg.ol,F9=vg.pz,K9=vg.tx,J9=vg.hj,v9=vg.FV,b9=vg.sV,kG=vg.xv,q9=vg.mx,L9=vg.gE,LQ=vg.ZP,vL=vg.Vx;const GG=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:G9,Behavior:JL,Block:fG,DefaultValues:M9,FontLibrary:mG,FontVariant:R9,InheritableProperty:U9,Inline:wD,InlineBlock:N9,InlineGlyph:F9,MSDFFontMaterialUtils:K9,MaterialTransformers:J9,MeshUIBaseElement:v9,ShaderChunkUI:b9,Text:kG,TypographicFont:q9,TypographicGlyph:L9,default:LQ,update:vL},Symbol.toStringTag,{value:"Module"}));function Lr(t,A){try{A?t(A):t()}catch(e){return console.error(e),!1}return!0}const bL=sA("debugdefines");SD('if(!globalThis[""3.31.8""]) globalThis[""3.31.8""] = "0.0.0";'),SD('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),SD('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.8";'),SD('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Os="3.31.8",yD="undefined";bL&&console.log(`Engine version: ${Os} (generator: ${yD})`);const _s="needle_isActiveInHierarchy",xr="builtin_components",Uc="needle_editor_guid";function SD(t){try{(0,eval)(t)}catch(A){bL&&console.error(A)}}const MG=sA("debugnewscripts"),x9=sA("debughierarchy"),Wt=[];function Y9(){return Wt.length>0}function fD(t){if(!(t.new_scripts.length<=0)){if(MG&&console.log("Register new components",t.new_scripts.length,[...t.new_scripts],t.alias?"element: "+t.alias:t.hash,t),t.new_scripts_pre_setup_callbacks.length>0){for(const A of t.new_scripts_pre_setup_callbacks)A&&A();t.new_scripts_pre_setup_callbacks.length=0}Wt.length=0,t.new_scripts.length>0&&Wt.push(...t.new_scripts),t.new_scripts.length=0;for(let A=0;A<Wt.length;A++)try{const e=Wt[A];if(e.isComponent!==!0){(He()||MG)&&console.error(`Registered script is not a Needle Engine component.
4080
4080
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4081
4081
  `,e),Wt.splice(A,1),A--;continue}if(e.destroyed)continue;if(!e.gameObject){console.error("MISSING GAMEOBJECT - will ignore",e),Wt.splice(A,1),A--;continue}e.context=t,Nc(e.gameObject),RG(e,t)}catch(e){console.error(e),Ps(Wt[A],t),Wt.splice(A,1),A--}for(let A=0;A<Wt.length;A++)try{const e=Wt[A];if(e.destroyed){Ps(Wt[A],t),Wt.splice(A,1),A--;continue}if(e.registering)try{e.registering()}catch(g){console.error(g)}e.__internalAwake!==void 0&&(e.gameObject||console.error("MISSING GAMEOBJECT",e,e.gameObject),Nc(e.gameObject),e.activeAndEnabled&&Lr(e.__internalAwake.bind(e)))}catch(e){console.error(e),Ps(Wt[A],t),Wt.splice(A,1),A--}for(let A=0;A<Wt.length;A++)try{const e=Wt[A];if(e.destroyed||e.enabled===!1||(Nc(e.gameObject),e.activeAndEnabled===!1))continue;e.__internalEnable!==void 0&&(e.enabled=!0,Lr(e.__internalEnable.bind(e)))}catch(e){console.error(e),Ps(Wt[A],t),Wt.splice(A,1),A--}for(let A=0;A<Wt.length;A++)try{const e=Wt[A];if(e.destroyed||!e.gameObject)continue;t.new_script_start.push(e)}catch(e){console.error(e),Ps(Wt[A],t),Wt.splice(A,1),A--}Wt.length=0;for(const A of t.new_scripts_post_setup_callbacks)A&&A();t.new_scripts_post_setup_callbacks.length=0}}function T9(t){t&&(t.__internalDisable(!0),Ps(t,t.context))}function qL(t,A){for(let e=0;e<t.new_script_start.length;e++)try{const g=t.new_script_start[e];if(A!==void 0&&g.gameObject!==A||g.destroyed||g.activeAndEnabled===!1)continue;Lr(g.__internalAwake.bind(g)),g.enabled&&(Lr(g.__internalEnable.bind(g)),Lr(g.__internalStart.bind(g)),t.new_script_start.splice(e,1),e--)}catch(g){console.error(g),Ps(t.new_script_start[e],t),t.new_script_start.splice(e,1),e--}}function RG(t,A){A.scripts.indexOf(t)===-1&&(A.scripts.push(t),t.earlyUpdate&&A.scripts_earlyUpdate.push(t),t.update&&A.scripts_update.push(t),t.lateUpdate&&A.scripts_lateUpdate.push(t),t.onBeforeRender&&A.scripts_onBeforeRender.push(t),t.onAfterRender&&A.scripts_onAfterRender.push(t),t.onPausedChanged&&A.scripts_pausedChanged.push(t))}function Ps(t,A){js(t,A.new_scripts),js(t,A.new_script_start),js(t,A.scripts),js(t,A.scripts_earlyUpdate),js(t,A.scripts_update),js(t,A.scripts_lateUpdate),js(t,A.scripts_onBeforeRender),js(t,A.scripts_onAfterRender),js(t,A.scripts_pausedChanged),A.stopAllCoroutinesFrom(t)}function js(t,A){const e=A.indexOf(t);e>=0&&A.splice(e,1)}function mD(t){if(t||(t=Mt.Current.scene),!t){console.trace("Invalid call - no current context.");return}const A=HQ(t);LL(t,A,!0)||(MG||He()?console.error(`Error updating hierarchy
4082
4082
  Do you have circular references in your project? <a target="_blank" href="https://docs.needle.tools/circular-reference"> Click here for more information.`,t):console.error('Failed to update active state in hierarchy of "'+t.name+'"',t),console.warn(" \u2191 this error might be caused by circular references. Please make sure you don't have files with circular references (e.g. one GLB 1 is loading GLB 2 which is then loading GLB 1 again)."))}function LL(t,A,e,g=0){if(g>1e3)return console.warn("Hierarchy is too deep (> 1000 level) - will abort updating active state"),!1;const i=HQ(t);if(A&&(A=i,A&&t.parent)){const C=t.parent;A=C[_s],A===void 0&&(C instanceof UI||(A=!0))}const I=t[_s]!==A;t[_s]=A,I&&(x9&&console.warn("ACTIVE CHANGE",t.name,i,t.visible,A,"changed?"+I,t),e&&H9(t,C=>{A?C.enabled&&(Lr(C.__internalAwake.bind(C)),C.enabled&&(C.__didEnable=!0,C.onEnable())):C.__didAwake&&C.enabled&&(C.__didEnable=!1,C.onDisable())}));let o=!0;if(t.children){const C=g+1;for(const s of t.children)LL(s,A,e,C)===!1&&(o=!1)}return o}function Nc(t){let A=!0,e=t,g=!1;for(;e&&e;){if(e.type==="Scene"&&(g=!0),!HQ(e)){A=!1;break}e=e.parent}if(!t){console.error("GO is null");return}t[_s]=A&&g}function H9(t,A){var e;if((e=t.userData)!=null&&e.components)for(const g of t.userData.components)A(g)}const kD=new Map,xL=Symbol("prewarmFlag"),UG=Symbol("waitingForPrewarm"),NG=sA("debugprewarm");function YL(t,A){!t||t[xL]===!0||t[UG]===!0||(kD.has(A)||kD.set(A,[]),t[UG]=!0,kD.get(A).push(t),NG&&console.debug("register prewarm",t.name))}let FG=null,KG=null;function O9(t){if(!t)return;const A=kD.get(t);if(!(A!=null&&A.length))return;const e=t.mainCamera;if(e){NG&&console.log("prewarm",A.length,"objects",[...A]);const g=t.renderer;if(g.compile){const i=t.scene;g.compile(i,e),FG??(FG=new rm(64)),KG??(KG=new nm(.001,9999999,FG)),KG.update(g,i);for(const I of A)I[xL]=!0,I[UG]=!1;A.length=0,NG&&console.log("prewarm done")}}}const _9=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function P9(t){return typeof t=="string"&&_9.test(t)}const Di=[];for(let t=0;t<256;++t)Di.push((t+256).toString(16).slice(1));function j9(t,A=0){return Di[t[A+0]]+Di[t[A+1]]+Di[t[A+2]]+Di[t[A+3]]+"-"+Di[t[A+4]]+Di[t[A+5]]+"-"+Di[t[A+6]]+Di[t[A+7]]+"-"+Di[t[A+8]]+Di[t[A+9]]+"-"+Di[t[A+10]]+Di[t[A+11]]+Di[t[A+12]]+Di[t[A+13]]+Di[t[A+14]]+Di[t[A+15]]}function W9(t){if(!P9(t))throw TypeError("Invalid UUID");let A;const e=new Uint8Array(16);return e[0]=(A=parseInt(t.slice(0,8),16))>>>24,e[1]=A>>>16&255,e[2]=A>>>8&255,e[3]=A&255,e[4]=(A=parseInt(t.slice(9,13),16))>>>8,e[5]=A&255,e[6]=(A=parseInt(t.slice(14,18),16))>>>8,e[7]=A&255,e[8]=(A=parseInt(t.slice(19,23),16))>>>8,e[9]=A&255,e[10]=(A=parseInt(t.slice(24,36),16))/1099511627776&255,e[11]=A/4294967296&255,e[12]=A>>>24&255,e[13]=A>>>16&255,e[14]=A>>>8&255,e[15]=A&255,e}function V9(t){t=unescape(encodeURIComponent(t));const A=[];for(let e=0;e<t.length;++e)A.push(t.charCodeAt(e));return A}const Z9="6ba7b810-9dad-11d1-80b4-00c04fd430c8",z9="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function X9(t,A,e){function g(i,I,o,C){var s;if(typeof i=="string"&&(i=V9(i)),typeof I=="string"&&(I=W9(I)),((s=I)===null||s===void 0?void 0:s.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let a=new Uint8Array(16+i.length);if(a.set(I),a.set(i,I.length),a=e(a),a[6]=a[6]&15|A,a[8]=a[8]&63|128,o){C=C||0;for(let r=0;r<16;++r)o[C+r]=a[r];return o}return j9(a)}try{g.name=t}catch{}return g.DNS=Z9,g.URL=z9,g}function $9(t,A,e,g){switch(t){case 0:return A&e^~A&g;case 1:return A^e^g;case 2:return A&e^A&g^e&g;case 3:return A^e^g}}function JG(t,A){return t<<A|t>>>32-A}function A6(t){const A=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){const o=unescape(encodeURIComponent(t));t=[];for(let C=0;C<o.length;++C)t.push(o.charCodeAt(C))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const g=t.length/4+2,i=Math.ceil(g/16),I=new Array(i);for(let o=0;o<i;++o){const C=new Uint32Array(16);for(let s=0;s<16;++s)C[s]=t[o*64+s*4]<<24|t[o*64+s*4+1]<<16|t[o*64+s*4+2]<<8|t[o*64+s*4+3];I[o]=C}I[i-1][14]=(t.length-1)*8/Math.pow(2,32),I[i-1][14]=Math.floor(I[i-1][14]),I[i-1][15]=(t.length-1)*8&4294967295;for(let o=0;o<i;++o){const C=new Uint32Array(80);for(let E=0;E<16;++E)C[E]=I[o][E];for(let E=16;E<80;++E)C[E]=JG(C[E-3]^C[E-8]^C[E-14]^C[E-16],1);let s=e[0],a=e[1],r=e[2],B=e[3],Q=e[4];for(let E=0;E<80;++E){const h=Math.floor(E/20),d=JG(s,5)+$9(h,a,r,B)+Q+A[h]+C[E]>>>0;Q=B,B=r,r=JG(a,30)>>>0,a=s,s=d}e[0]=e[0]+s>>>0,e[1]=e[1]+a>>>0,e[2]=e[2]+r>>>0,e[3]=e[3]+B>>>0,e[4]=e[4]+Q>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}const e6=X9("v5",80,A6),TL=e6;var eo=(t=>(t[t.OnConnection=0]="OnConnection",t[t.OnRoomJoin=1]="OnRoomJoin",t[t.Queued=2]="Queued",t[t.Immediate=3]="Immediate",t))(eo||{});Mt.registerCallback(zg.ContextCreated,t=>{const A=t.context;WL(A),jL(A)});const GD=sA("debugcomponents"),HL="eff8ba80-635d-11ec-90d6-0242ac120003";class li{constructor(A){n(this,"_originalSeed"),n(this,"_seed"),typeof A=="string"&&(A=li.hash(A)),this._originalSeed=A,this._seed=A}get seed(){return this._seed}set seed(A){this._seed=A}reset(){this._seed=this._originalSeed}generateUUID(A){if(typeof A=="string")return TL(A,HL);const e=this._seed;return this._seed-=1,TL(e.toString(),HL)}initialize(A){typeof A=="string"?this._seed=li.hash(A):this._seed=A}static createFromString(A){return new li(this.hash(A))}static hash(A){let e=0;for(let g=0;g<A.length;g++)e=A.charCodeAt(g)+((e<<5)-e);return e}}var OL=(t=>(t.NewInstanceCreated="new-instance-created",t.InstanceDestroyed="instance-destroyed",t))(OL||{});class _L{constructor(A){n(this,"guid"),this.guid=A}}function MD(t,A,e=!0){if(!t)return;const g=t;if(OC(t,e),!A){console.warn("Can not send destroy: No networking connection provided",t.guid);return}if(!A.isConnected){console.warn("Can not send destroy: not connected",t.guid);return}let i=t.guid;if(!i&&g.uuid&&(i=g.uuid),!i){console.warn("Can not send destroy: failed to find guid",t);return}const I=new _L(i);A.send("instance-destroyed",I,eo.Queued)}function PL(t,A){const e=new _L(t);A.send("instance-destroyed",e,eo.Queued)}function jL(t){t.connection.beginListen("instance-destroyed",A=>{GD&&console.log("[Remote] Destroyed",t.scene,A);const e=Wc(A.guid,t.scene);e&&OC(e)})}class t6{constructor(A,e,g){n(this,"filename"),n(this,"hash"),n(this,"size"),this.filename=A,this.hash=e,this.size=g}}class g6{constructor(A,e){n(this,"guid"),n(this,"originalGuid"),n(this,"seed"),n(this,"visible"),n(this,"hostData"),n(this,"dontSave"),n(this,"parent"),n(this,"position"),n(this,"rotation"),n(this,"scale"),this.originalGuid=A,this.guid=e}}function vG(t,A,e,g){var i;const I=t;if(!I.guid)return console.warn("Can not instantiate: No guid",I),null;if(A.context||(A.context=Ye.Current),!A.context)return console.error("Missing network instantiate options / reference to network connection in sync instantiate"),null;const o=A?{...A}:null,{instance:C,seed:s}=i6(I,A);if(C){const a=C;if(a.guid){GD&&console.log("[Local] new instance","gameobject:",C?.guid);const r=new g6(I.guid,a.guid);r.seed=s,o&&(o.position&&(r.position={x:o.position.x,y:o.position.y,z:o.position.z}),o.rotation&&(r.rotation={x:o.rotation.x,y:o.rotation.y,z:o.rotation.z,w:o.rotation.w}),o.scale&&(r.scale={x:o.scale.x,y:o.scale.y,z:o.scale.z})),r.position||(r.position={x:a.position.x,y:a.position.y,z:a.position.z}),r.rotation||(r.rotation={x:a.quaternion.x,y:a.quaternion.y,z:a.quaternion.z,w:a.quaternion.w}),r.scale||(r.scale={x:a.scale.x,y:a.scale.y,z:a.scale.z}),r.visible=I.visible,o!=null&&o.parent&&(typeof o.parent=="string"?r.parent=o.parent:r.parent=o.parent.guid),r.hostData=e,g===!1&&(r.dontSave=!0),(i=A?.context)==null||i.connection.send("new-instance-created",r)}else console.warn("Missing guid, can not send new instance event",a)}return C}function RD(){return Math.random()*9999999}function WL(t){t.connection.beginListen("new-instance-created",async A=>{const e=await I6(A.originalGuid,t.scene);if(!e){console.warn("could not find object that was instantiated: "+A.guid);return}const g=new NC;A.position&&(g.position=new y(A.position.x,A.position.y,A.position.z)),A.rotation&&(g.rotation=new UA(A.rotation.x,A.rotation.y,A.rotation.z,A.rotation.w)),A.scale&&(g.scale=new y(A.scale.x,A.scale.y,A.scale.z)),g.parent=A.parent,A.seed&&(g.idProvider=new li(A.seed)),g.visible=A.visible,g.context=t,GD&&t.alias&&console.log("[Remote] instantiate in: "+t.alias);const i=Vc(e,g);i&&(A.parent==="scene"&&t.scene.add(i),GD&&console.log("[Remote] new instance","gameobject:",i?.guid,e))})}function i6(t,A){const e=RD(),g=A??new NC;g.idProvider=new li(e);const i=Vc(t,g);return{seed:e,instance:i}}const VL={};function ZL(t,A){VL[t]=A}async function I6(t,A){const e=VL[t];if(e!=null){const g=await e(t);if(g)return g}return zL(t,A)}function zL(t,A){if(A===null||!t)return null;if(A.guid===t)return A;if(A.children)for(const e of A.children){const g=zL(t,e);if(g)return g}return null}const XL=new Map;function o6(t,A){if(!t)return;if(!A){console.warn("No prototype found",t,t.prototype,t.constructor);return}const e=XL.get(A);e&&e.apply(t)}function C6(t){const A=s6(t.prototype);XL.set(t,A)}function s6(t){return new a6(t)}class a6{constructor(A){n(this,"$symbol"),n(this,"extensions"),n(this,"descriptors"),this.$symbol=Symbol("prototype-extension"),this.extensions=Object.keys(A),this.descriptors=new Array;for(let e=0;e<this.extensions.length;e++){const g=this.extensions[e],i=Object.getOwnPropertyDescriptor(A,g);i&&this.descriptors.push(i)}}apply(A){if(!A[this.$symbol]){A[this.$symbol]=!0;for(let e=0;e<this.extensions.length;e++){const g=this.extensions[e],i=this.descriptors[e];i&&Object.defineProperty(A,g,i)}}}}var Fc=(t=>(t.Added="component-added",t.Removing="removing-component",t))(Fc||{});const $L=sA("debugcomponentevents");class Kc{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let g=this.eventListeners.get(A);g||(g=[]),g.push(e),this.eventListeners.set(A,g),$L&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const g=this.eventListeners.get(A);if(!g)return;const i=g.indexOf(e);i<0||g.splice(i,1)}static dispatchComponentLifecycleEvent(A,e){const g=this.eventListeners.get(A);if($L&&console.log("Dispatching event "+A,g),!!g)for(const i of g)i(e)}}n(Kc,"eventListeners",new Map);const bG=sA("debuggetcomponent");function n6(t){return t==null||t.isObject3D?t:t.object&&t.object.isObject3D?t.object:t}function qG(t,A){if(!t||!t.userData.components)return;const e=t.userData.components.indexOf(A);e<0||(Kc.dispatchComponentLifecycleEvent(Fc.Removing,A),A.gameObject=null,t.userData.components.splice(e,1))}function UD(t,A){const e=xQ(t,A);if(e)return e;const g=new A;return gn(t,g)}const Ax=new li("addComponentIdProvider");function gn(t,A,e=!0){t.userData||(t.userData={}),t.userData.components||(t.userData.components=[]),t.userData.components.push(A),A.gameObject=t,(A.guid===void 0||A.guid==="invalid")&&(A.guid=Ax.generateUUID()),bD(t),Mw(A);try{e&&A.__internalAwake&&(Nc(t),A.activeAndEnabled&&A.__internalAwake()),Kc.dispatchComponentLifecycleEvent(Fc.Added,A)}catch(g){console.error(g)}return A}function LG(t,A){if(typeof A=="function")return gn(t,new A);if(A.destroyed)return console.warn("Can not move/add a destroyed component",A),A;if(A.gameObject===t)return A;if(A.gameObject&&A.gameObject.userData.components){const e=A.gameObject.userData.components.indexOf(A);A.gameObject.userData.components.splice(e,1)}if(!t.userData.components)t.userData.components=[];else if(t.userData.components.includes(A))return A;return t.userData.components.push(A),A.gameObject=t,(A.guid===void 0||A.guid==="invalid")&&(A.guid=Ax.generateUUID()),Mw(A),A}function ex(t){if(t.gameObject&&t.gameObject.userData.components){const A=t.gameObject.userData.components.indexOf(t);t.gameObject.userData.components.splice(A,1)}t.__internalDisable&&t.__internalDisable(),Ps(t,t.context??Ye.Current),t.destroy(),t.gameObject=null}let tx=!1;function gx(t,A,e){var g;if(t==null)return null;if(!t.isObject3D)return console.error("Object is not object3D"),null;if(!((g=t?.userData)!=null&&g.components)||(typeof A=="string"&&(tx||(tx=!0,console.warn(`Accessing components by name is not supported.
@@ -4076,7 +4076,7 @@ void main() {
4076
4076
  `){super("lineBreak",A,!0),this._newLineBreakability=null}update(A,e){this._needsProcess=!0}process(A){const e=A._whiteSpace._newLineBreakability;if(A._inlines._value)for(let t=0;t<A._inlines._value.length;t++){const g=A._inlines._value[t],I=g.char;let o=null;I!==void 0&&(e!=="nowrap"&&(this._value.includes(I)||I.match(/\s/g))&&(o="possible"),I.match(/\n/g)&&(o=e)),g.lineBreak=o}}get value(){return this._value}}class _T extends yt{constructor(){super("layouter",null,!1),this._value=null}update(A,e){this._value=A._parent.find(t=>t.isUI&&t.isText),this._needsProcess=!0}process(A){this._value&&(this._value._layouter._needsProcess=!0)}}class jX extends Fl{constructor(A){super("backgroundColor",A,!1),this._allowsInherit=!1,this._input=0}computeOutputValue(A){this._input==="inherit"?this._value.set(this.getInheritedInput(A)):this._value.set(this._input)}}class OT extends PY{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class PT extends WY{constructor(){super()}computeOutputValue(A){this._value=sU(this.getInheritedInput(A))}}class WT extends AT{constructor(){super("fontFamily","inherit",!0),this._input="inherit",this._needsUpdate=!0,this._allowsInherit=!1}computeOutputValue(A){let e=this._inheritedInput;if(e==="inherit"&&(e=this.getInheritedInput(A)),e instanceof lw)this._value=e,A._font._needsUpdate=!0;else if(typeof e=="string"){const t=dB.getFontFamily(e);t?(this._value=t,A._font._needsUpdate=!0):console.warn(`(.style) fontFamily, the font '${e}' is not registered. Aborted.`)}else console.warn("(.style) fontFamily requires a registered fontFamily instance, or the id of a registered fontFamily."),console.warn("If you want to set a specific font, please use .font property instead.")}get value(){return this._value}}class KU extends tT{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited,this._whiteSpacedContent="",this._stringCollapser=this.emptyStrategyLogic,this._inlineCollapser=this.emptyStrategyLogic,this._inlineWrapper=this.emptyStrategyLogic}_computeFromInherited(A){switch(super._computeFromInherited(A),this._newLineBreakability=VX(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=ZX;break;case"pre-line":this._stringCollapser=jT;break;default:this._stringCollapser=zX}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=t9;break;case"pre-wrap":this._inlineCollapser=e9;break;default:this._inlineCollapser=i9}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=XX;break;case"pre":this._inlineWrapper=$X;break;default:this._inlineWrapper=A9}this._needsProcess=!0}process(A){A.isInline&&!A.isInlineBlock&&(this._whiteSpacedContent=this._stringCollapser(A._textContent._value),A._glyphs._needsProcess=!0)}}const rq={" ":" ","\n":`
4077
4077
  `,"\r":"\r"," ":" "},VX=function(i){switch(i){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function ZX(i){return jT(i.replace(/\n/g," "))}function jT(i){return i.replace(/[ ]{2,}/g," ")}function zX(i){return i}function XX(i,A,e,t){const g=i[A];if(g.lineBreak==="mandatory"||e+g.xadvance+g.xoffset+g.kerning>t.INNER_WIDTH)return!0;const I=zT(i,A,t);return g9(i[A-1],e,I,t)}function $X(i,A,e,t){return i[A].lineBreak==="mandatory"}function A9(){return!1}function e9(i){if(!i[0])return 0;const A=i[0],e=i[i.length-1];return A.char&&A.char===`
4078
4078
  `&&i.length>1&&ZT([A],i[1]),e.char&&e.char===`
4079
- `&&i.length>1&&VT([e],i[i.length-2]),A.offsetX}function t9(i){if(!i[0])return 0;let A=[],e;for(let t=0;t<i.length;t++){const g=i[t];if(g.char&&rq[g.char]&&i.length>t){A.push(g),e=i[t+1];continue}break}ZT(A,e),A=[],e=null;for(let t=i.length-1;t>0;t--){const g=i[t];if(g.char&&rq[g.char]&&t>0){A.push(g),e=i[t-1];continue}break}return VT(A,e),i[0].offsetX}function i9(i){return i[0]?i[0].offsetX:0}function VT(i,A){if(A)for(let e=0;e<i.length;e++){const t=i[e];t.fontFactor=0,t.offsetX=A.offsetX+A.cumulativeWidth,t.cumulativeWidth=0}}function ZT(i,A){if(A)for(let e=0;e<i.length;e++){const t=i[e];t.fontFactor=0,t.offsetX=A.offsetX,t.cumulativeWidth=0}}function zT(i,A,e,t){if(t=t||0,!i[A])return t;const g=i[A];return g.lineBreak?t+g.xadvance:zT(i,A+1,e,t+g.xadvance+g.xoffset+g.kerning+e.LETTERSPACING)}function g9(i,A,e,t){return!i||!i.char||A+e<t.INNER_WIDTH?!1:t.BREAKON.indexOf(i.char)>-1}class XT extends iT{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._fontSize._needsProcess=!0,A._layouter._needsProcess=!0}}class $T extends $t{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(A){this._value=this._inheritedInput,A._font._fontVariant&&(A._bounds._needsProcess=!0,A._layouter._needsProcess=!0)}process(A){if(!A._font._fontVariant||!A._font._fontVariant.isReady)return;const e=this._value/A._font._fontVariant.typographic.size,t=A._inlines._value;for(let g=0;g<t.length;g++){const I=t[g];I.resetOffsets(),I.fontSize=this._value,I.fontFactor=e}}get value(){return this._value}}class AH extends gT{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(A,e){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(A)),A._layouter._needsUpdate=!0}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class I9 extends AH{constructor(){super(),this._value="inherit"}}class o9 extends dw{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._parent._value._layouter._needsProcess=!1}process(A){if(this._value!=="none"){const e=A._whiteSpace._whiteSpacedContent,t=A._inlines._value;for(let g=1;g<t.length;g++){const I=e[g-1]+e[g];t[g].kerning=A._font._fontVariant.getKerningAmount(I)}}}}class eH extends yt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function s9(i,A=!1){const e=i[0].index!==null,t=new Set(Object.keys(i[0].attributes)),g=new Set(Object.keys(i[0].morphAttributes)),I={},o={},s=i[0].morphTargetsRelative,C=new _A.BufferGeometry;let n=0;for(let a=0;a<i.length;++a){const B=i[a];let Q=0;if(e!==(B.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const E in B.attributes){if(!t.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;I[E]===void 0&&(I[E]=[]),I[E].push(B.attributes[E]),Q++}if(Q!==t.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". Make sure all geometries have the same number of attributes."),null;if(s!==B.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const E in B.morphAttributes){if(!g.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". .morphAttributes must be consistent throughout all geometries."),null;o[E]===void 0&&(o[E]=[]),o[E].push(B.morphAttributes[E])}if(C.userData.mergedUserData=C.userData.mergedUserData||[],C.userData.mergedUserData.push(B.userData),A){let E;if(e)E=B.index.count;else if(B.attributes.position!==void 0)E=B.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". The geometry must have either an index or a position attribute"),null;C.addGroup(n,E,a),n+=E}}if(e){let a=0;const B=[];for(let Q=0;Q<i.length;++Q){const E=i[Q].index;for(let c=0;c<E.count;++c)B.push(E.getX(c)+a);a+=i[Q].attributes.position.count}C.setIndex(B)}for(const a in I){const B=Bq(I[a]);if(!B)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+a+" attribute."),null;C.setAttribute(a,B)}for(const a in o){const B=o[a][0].length;if(B===0)break;C.morphAttributes=C.morphAttributes||{},C.morphAttributes[a]=[];for(let Q=0;Q<B;++Q){const E=[];for(let d=0;d<o[a].length;++d)E.push(o[a][d][Q]);const c=Bq(E);if(!c)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+a+" morphAttribute."),null;C.morphAttributes[a].push(c)}}return C}function Bq(i){let A,e,t,g=0;for(let s=0;s<i.length;++s){const C=i[s];if(C.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(A===void 0&&(A=C.array.constructor),A!==C.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=C.itemSize),e!==C.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(t===void 0&&(t=C.normalized),t!==C.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;g+=C.array.length}const I=new A(g);let o=0;for(let s=0;s<i.length;++s)I.set(i[s].array,o),o+=i[s].array.length;return new _A.BufferAttribute(I,e,t)}class C9 extends yt{constructor(){super("renderer")}render(A){if(!A._inlines._value||!A._inlines._value.length)return;const e=A._inlines._value.map(g=>A._font._fontVariant.getGeometricGlyph(g,A).translate(g.offsetX,g.offsetY,0)),t=s9(e);A.setFontMesh(new _A.Mesh(t,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class n9 extends nU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class bE extends Ld{constructor(e={}){const t={};bE.definePropertiesValues(t,e);super(t,e);r(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});bE.init(this)}add(e){const t=[];for(let g=0;g<arguments.length;g++){const I=arguments[g];!I.isUI||I.isInline?(t.push(I),I.position.z=.005):console.warn("Block element can only contain Box elements.",I)}return super.add(...t)}set textContent(e){this._textContent.value=e}get textContent(){return this._textContent._value}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(e,t){e.children||(e.children=eH),e.textContent||(e.textContent=_X),e.glyphs||(e.glyphs=PX),e.inlines||(e.inlines=OX),e.layouter||(e.layouter=_T),e.renderer||(e.renderer=C9),e.fontFamily||(e.fontFamily=WT),e.fontWeight||(e.fontWeight=PT),e.fontStyle||(e.fontStyle=OT),e.fontSize||(e.fontSize=$T),e.color||(e.color=WX),e.backgroundColor||(e.backgroundColor=jX),e.lineBreak||(e.lineBreak=HT),e.letterSpacing||(e.letterSpacing=XT),e.whiteSpace||(e.whiteSpace=KU),e.segments||(e.segments=I9),e.textAlign||(e.textAlign=n9),e.fontKerning||(e.fontKerning=o9)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class a9 extends OY{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}update(A,e){this._needsUpdate=!1;for(let t=A.children.length-1;t>=0;t--){const g=A.children[t];g.isUI&&(A.remove(g),g.clear())}A._children._uis=[],this._value&&A.add(new bE({name:"anonymousInline",textContent:this._value}))}}class r9 extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class B9 extends yt{constructor(){super("layouter",null,!1),this._value=null}update(A,e){}process(A){let e=A._width._value;A._width._auto?e=1/0:e=A._bounds._innerWidth;const t=A._lineHeight._value,g=new r9(new aq);let I=0;A._children._inlines.forEach(B=>{if(!B._inlines.value)return;this._resetInlines(B);const Q=B._fontSize._value,E=B._letterSpacing._value*Q,c=B._whiteSpace._value,d=B._lineBreak._value,l={WHITESPACE:c,LETTERSPACING:E,BREAKON:d,INNER_WIDTH:e},h=B._whiteSpace._inlineWrapper;I+=B._margin._value.w+B._padding._value.w,B._inlines.value.forEach((p,u,f)=>{const k=g[g.length-1];if(h(f,u,I,l)){if(g.push(new aq(p)),p.offsetX=p.xoffset,p.width===0){I=0;return}p.cumulativeWidth=p.xadvance+E,I=p.cumulativeWidth;return}g[g.length-1].push(p),p.offsetX=I+p.xoffset+p.kerning,p.cumulativeWidth=p.xadvance+p.kerning+E,I+=p.cumulativeWidth,k.length-1===1&&k[k.length-2].width===0&&(p.offsetX-=p.xoffset,I-=p.xoffset)}),I+=B._margin._value.y+B._padding._value.y});const o=A._whiteSpace._inlineCollapser;let s=0,C=0,n=0;g.forEach((B,Q)=>{const E=o(B);let c=0,d=0;if(B.forEach(l=>{c=Math.max(c,l.lineHeight),d=Math.max(d,l.lineBase),l.offsetX-=E}),B.lineHeight=c,B.lineBase=d,Q===0?n=-(c*t-c)*.5:n-=g[Q-1].lineHeight*t,B.y=n,B.x=0,B.forEach(l=>{l.offsetY=n-l.anchor,l.lineHeight<B.lineHeight&&(l.offsetY-=B.lineBase-l.lineBase)}),C+=B.lineHeight*t,B.width=0,B[0]){const l=B[B.length-1];B.width=l.offsetX+l.cumulativeWidth+l.paddingRight+l.marginRight+B[0].offsetX,s=Math.max(s,B.width)}}),g.height=C,g.width=s,this._value=g,e===1/0&&A._bounds.setChildrenWidth(A,g.width),A._height._auto&&A._bounds.setChildrenHeight(A,g.height);const a=A._parent._value;a&&(a._autoSize._needsProcess=!0,a._flexDirection._needsProcess=!0),A._inlineJustificator._needsProcess=!0,A._textAlign._needsProcess=!0,A._overflow._needsUpdate=!0}_resetInlines(A){A._fontSize.process(A)}}class Q9 extends nU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){E9(A),A._renderer._needsRender=!0}}function E9(i){const A=i._layouter._value,e=i._textAlign._value,t=i._bounds._innerWidth;for(let g=0;g<A.length;g++){const I=A[g],o=c9(i,I,g===A.length-1),s=i._padding._value,C=i._borderWidth._value,n=(-s.w+s.y)/2+(-C.w+C.y)/2;I.x+=o;for(let a=0;a<I.length;a++)I[a].offsetX+=o-n}if(e.indexOf("justify")===0)for(let g=0;g<A.length;g++){const I=A[g];if(e.indexOf("-")!==-1&&g===A.length-1)return;const o=t-I.width;if(o<=0)return;let s=0;for(let B=1;B<I.length-1;B++)s+=I[B].char===" "?1:0;const C=o/s;let n=1;e==="justify-right"&&(I.reverse(),n=-1);let a=0;for(let B=1;B<=I.length-1;B++){const Q=I[B];Q.offsetX+=a*n,a+=Q.char===" "?C:0}e==="justify-right"&&I.reverse()}}function c9(i,A,e){switch(i._textAlign._value){case"justify-left":case"justify":case"left":return-i._bounds._innerWidth/2;case"justify-right":case"right":return-A.width+i._bounds._innerWidth/2;case"center":return-A.width/2;case"justify-center":return e?-A.width/2:-i._bounds._innerWidth/2;default:console.warn(`textAlign: '${i._textAlign._value}' is not valid`)}}class h9 extends aU{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class l9 extends eT{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class d9 extends dw{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class u9 extends xT{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class p9 extends yt{constructor(){super("children",null,!1);r(this,"_sortOrder",(e,t)=>e._order._value<t._order._value?-1:e._order._value>t._order._value?1:this._uis.indexOf(e)<this._uis.indexOf(t)?-1:1);this._uis=[],this._inlines=[],this._boxes=[]}update(e,t){this._compute(e),this._needsProcess=!0}process(e){this._compute(e),e._overflow._needsRender=!0}_compute(e){this._uis=e.children.filter(t=>t.visible&&t.isUI),this._inlines=this._uis.filter(t=>t.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class f9 extends yt{constructor(){super("autosize")}process(A){if(A._layouter._value&&A._layouter._value.length){const e=A._layouter._value,t=A._padding._value,g=A._borderWidth._value;A._width._auto&&A._bounds.setOffsetWidth(A,e.width+t.w+t.y+g.w+g.y),A._height._auto&&A._bounds.setOffsetHeight(A,e.height+t.x+t.z+g.x+g.z)}}}class D9 extends TT{constructor(){super("renderer"),this._needsUpdate=!1}render(A){super.render(A);for(const e of A._children._inlines)e._renderer.render(e);A.performAfterUpdate()}}class vl extends ql{constructor(A={},e={}){vl.definePropertiesValues(e,A),super(e,A),vl.init(this)}add(A){const e=[];let t=!1;for(let g=0;g<arguments.length;g++){const I=arguments[g];!I.isUI||I.isInline?(I.isInline&&(t=!0),e.push(I)):console.warn("Block element can only contain Box elements.",I)}return e.length>0&&super.add(...e),t&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(A){this._textContent.value=A}get textContent(){return super.textContent}set invertAlpha(A){this._invertAlpha.value=A}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(A,e){A.flexDirection=h9,A.justifyContent=rU,A.alignItems=CU,A.bounds=u9,A.autoSize=f9,A.renderer=D9,A.children||(A.children=p9),A.textContent||(A.textContent=a9),A.layouter||(A.layouter=B9),A.lineHeight||(A.lineHeight=l9),A.textAlign||(A.textAlign=Q9),A.whiteSpace||(A.whiteSpace=KU),A.fontKerning||(A.fontKerning=d9),A.segments||(A.segments=AH),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class y9 extends yt{constructor(){super("inlines",null,!1),this._value=[]}process(A){this._value[0].paddingLeft=A._padding._value.w,this._value[0].marginLeft=A._margin._value.w;const e=this._value.length-1;this._value[e].paddingRight=A._padding._value.y,this._value[e].marginRight=A._margin._value.y}}class w9 extends yt{constructor(){super("renderer")}render(A){A._backgroundMesh||A.setBackgroundMesh(new YT(A)),A._backgroundMesh.position.x=A._inlines._value[0].offsetX+A._inlines._value[0].width/2,A._backgroundMesh.position.y=A._inlines._value[0].offsetY+A._inlines._value[0].lineBase/2,A._bounds.render(A)}}class S9 extends yt{constructor(){super("bounds",null,!1),this._size=new _A.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(A,e){this.output(e),this._needsProcess=!0}process(A){this._offsetWidth=this._innerWidth=A._inlines._value[0].width,this._offsetHeight=this._innerHeight=A._inlines._value[0].height,this._needsRender=!0,A._borderWidth._needsRender=!0,A._borderRadius._needsRender=!0}render(A){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(A){A.size=this._size}}class Ll extends Ld{constructor(A={}){const e={};Ll.definePropertiesValues(e,A),super(e,A),Ll.init(this)}clear(){for(const A of this._inlines._value)A.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new _A.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(A){const e=[];for(let t=0;t<arguments.length;t++){const g=arguments[t];g.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",g):(e.push(g),g.position.z=.005)}return super.add(...e)}static definePropertiesValues(A,e){A.children||(A.children=eH),A.bounds||(A.bounds=S9),A.inlines||(A.inlines=y9),A.layouter||(A.layouter=_T),A.renderer||(A.renderer=w9),A.fontFamily||(A.fontFamily=WT),A.fontWeight||(A.fontWeight=PT),A.fontStyle||(A.fontStyle=OT),A.fontSize||(A.fontSize=$T),A.backgroundColor||(A.backgroundColor=TY),A.lineBreak||(A.lineBreak=HT),A.letterSpacing||(A.letterSpacing=XT),A.whiteSpace||(A.whiteSpace=KU),A.fontKerning||(A.fontKerning=dw),e.backgroundSize||(e.backgroundSize="cover"),e.width||(e.width="100%"),e.height||(e.height="100%"),e.boxSizing||(e.boxSizing="border-box")}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),A._inlines._value=[new k9(A)],A.backgroundMaterial=new LT,A._renderer.render(A)}}class k9 extends ZY{constructor(A){super(),this._uiElement=A}get xadvance(){const A=this._uiElement._padding._value,e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.w+A.y+e.value}get width(){const A=this._uiElement._width;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get height(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get anchor(){return this.height}get lineHeight(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get lineBase(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}clear(){this._uiElement=null}}class tH{constructor(A){this._subject=A}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const iH=()=>bD.update(),gH={BaseProperty:yt,Block:bl,Text:vl,Inline:bE,InlineBlock:Ll,MeshUIBaseElement:Ld,FontLibrary:dB,update:iH,MSDFFontMaterialUtils:Oo,ShaderChunkUI:vT,Behavior:tH,FontVariant:Jd};typeof global<"u"&&(global.ThreeMeshUI=gH);const G9=gH;var M9=Pi.w8,IH=Pi.cg,JU=Pi.gO,m9=Pi.wb,RM=Pi.zV,R9=Pi.HS,U9=Pi.Ec,Ff=Pi.gF,N9=Pi.ol,F9=Pi.pz,K9=Pi.tx,J9=Pi.hj,q9=Pi.FV,b9=Pi.sV,qU=Pi.xv,v9=Pi.mx,L9=Pi.gE,xQ=Pi.ZP,oH=Pi.Vx;const nk=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:M9,Behavior:IH,Block:JU,DefaultValues:m9,FontLibrary:RM,FontVariant:R9,InheritableProperty:U9,Inline:Ff,InlineBlock:N9,InlineGlyph:F9,MSDFFontMaterialUtils:K9,MaterialTransformers:J9,MeshUIBaseElement:q9,ShaderChunkUI:b9,Text:qU,TypographicFont:v9,TypographicGlyph:L9,default:xQ,update:oH},Symbol.toStringTag,{value:"Module"}));function sB(i,A){try{A?i(A):i()}catch(e){return console.error(e),!1}return!0}const sH=sA("debugdefines");ww('if(!globalThis[""3.31.7""]) globalThis[""3.31.7""] = "0.0.0";');ww('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');ww('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.7";');ww('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const IC="3.31.7",yw="undefined";sH&&console.log(`Engine version: ${IC} (generator: ${yw})`);const pn="needle_isActiveInHierarchy",_r="builtin_components",zh="needle_editor_guid";function ww(i){try{(0,eval)(i)}catch(A){sH&&console.error(A)}}const UM=sA("debugnewscripts"),x9=sA("debughierarchy"),jt=[];function Y9(){return jt.length>0}function LD(i){if(!(i.new_scripts.length<=0)){if(UM&&console.log("Register new components",i.new_scripts.length,[...i.new_scripts],i.alias?"element: "+i.alias:i.hash,i),i.new_scripts_pre_setup_callbacks.length>0){for(const A of i.new_scripts_pre_setup_callbacks)A&&A();i.new_scripts_pre_setup_callbacks.length=0}jt.length=0,i.new_scripts.length>0&&jt.push(...i.new_scripts),i.new_scripts.length=0;for(let A=0;A<jt.length;A++)try{const e=jt[A];if(e.isComponent!==!0){(_e()||UM)&&console.error(`Registered script is not a Needle Engine component.
4079
+ `&&i.length>1&&VT([e],i[i.length-2]),A.offsetX}function t9(i){if(!i[0])return 0;let A=[],e;for(let t=0;t<i.length;t++){const g=i[t];if(g.char&&rq[g.char]&&i.length>t){A.push(g),e=i[t+1];continue}break}ZT(A,e),A=[],e=null;for(let t=i.length-1;t>0;t--){const g=i[t];if(g.char&&rq[g.char]&&t>0){A.push(g),e=i[t-1];continue}break}return VT(A,e),i[0].offsetX}function i9(i){return i[0]?i[0].offsetX:0}function VT(i,A){if(A)for(let e=0;e<i.length;e++){const t=i[e];t.fontFactor=0,t.offsetX=A.offsetX+A.cumulativeWidth,t.cumulativeWidth=0}}function ZT(i,A){if(A)for(let e=0;e<i.length;e++){const t=i[e];t.fontFactor=0,t.offsetX=A.offsetX,t.cumulativeWidth=0}}function zT(i,A,e,t){if(t=t||0,!i[A])return t;const g=i[A];return g.lineBreak?t+g.xadvance:zT(i,A+1,e,t+g.xadvance+g.xoffset+g.kerning+e.LETTERSPACING)}function g9(i,A,e,t){return!i||!i.char||A+e<t.INNER_WIDTH?!1:t.BREAKON.indexOf(i.char)>-1}class XT extends iT{constructor(){super(),this._input="inherit",this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._fontSize._needsProcess=!0,A._layouter._needsProcess=!0}}class $T extends $t{constructor(){super("fontSize","inherit",!0),this._allowsInherit=!1}computeOutputValue(A){this._value=this._inheritedInput,A._font._fontVariant&&(A._bounds._needsProcess=!0,A._layouter._needsProcess=!0)}process(A){if(!A._font._fontVariant||!A._font._fontVariant.isReady)return;const e=this._value/A._font._fontVariant.typographic.size,t=A._inlines._value;for(let g=0;g<t.length;g++){const I=t[g];I.resetOffsets(),I.fontSize=this._value,I.fontFactor=e}}get value(){return this._value}}class AH extends gT{constructor(){super("segments",1,!1),this._notInheritedValue=void 0}update(A,e){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(A)),A._layouter._needsUpdate=!0}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class I9 extends AH{constructor(){super(),this._value="inherit"}}class o9 extends dw{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A),A._parent._value._layouter._needsProcess=!1}process(A){if(this._value!=="none"){const e=A._whiteSpace._whiteSpacedContent,t=A._inlines._value;for(let g=1;g<t.length;g++){const I=e[g-1]+e[g];t[g].kerning=A._font._fontVariant.getKerningAmount(I)}}}}class eH extends yt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function s9(i,A=!1){const e=i[0].index!==null,t=new Set(Object.keys(i[0].attributes)),g=new Set(Object.keys(i[0].morphAttributes)),I={},o={},s=i[0].morphTargetsRelative,C=new _A.BufferGeometry;let n=0;for(let a=0;a<i.length;++a){const B=i[a];let Q=0;if(e!==(B.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const E in B.attributes){if(!t.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+'. All geometries must have compatible attributes; make sure "'+E+'" attribute exists among all geometries, or in none of them.'),null;I[E]===void 0&&(I[E]=[]),I[E].push(B.attributes[E]),Q++}if(Q!==t.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". Make sure all geometries have the same number of attributes."),null;if(s!==B.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const E in B.morphAttributes){if(!g.has(E))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". .morphAttributes must be consistent throughout all geometries."),null;o[E]===void 0&&(o[E]=[]),o[E].push(B.morphAttributes[E])}if(C.userData.mergedUserData=C.userData.mergedUserData||[],C.userData.mergedUserData.push(B.userData),A){let E;if(e)E=B.index.count;else if(B.attributes.position!==void 0)E=B.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+a+". The geometry must have either an index or a position attribute"),null;C.addGroup(n,E,a),n+=E}}if(e){let a=0;const B=[];for(let Q=0;Q<i.length;++Q){const E=i[Q].index;for(let c=0;c<E.count;++c)B.push(E.getX(c)+a);a+=i[Q].attributes.position.count}C.setIndex(B)}for(const a in I){const B=Bq(I[a]);if(!B)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+a+" attribute."),null;C.setAttribute(a,B)}for(const a in o){const B=o[a][0].length;if(B===0)break;C.morphAttributes=C.morphAttributes||{},C.morphAttributes[a]=[];for(let Q=0;Q<B;++Q){const E=[];for(let d=0;d<o[a].length;++d)E.push(o[a][d][Q]);const c=Bq(E);if(!c)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+a+" morphAttribute."),null;C.morphAttributes[a].push(c)}}return C}function Bq(i){let A,e,t,g=0;for(let s=0;s<i.length;++s){const C=i[s];if(C.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(A===void 0&&(A=C.array.constructor),A!==C.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=C.itemSize),e!==C.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(t===void 0&&(t=C.normalized),t!==C.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;g+=C.array.length}const I=new A(g);let o=0;for(let s=0;s<i.length;++s)I.set(i[s].array,o),o+=i[s].array.length;return new _A.BufferAttribute(I,e,t)}class C9 extends yt{constructor(){super("renderer")}render(A){if(!A._inlines._value||!A._inlines._value.length)return;const e=A._inlines._value.map(g=>A._font._fontVariant.getGeometricGlyph(g,A).translate(g.offsetX,g.offsetY,0)),t=s9(e);A.setFontMesh(new _A.Mesh(t,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class n9 extends nU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class bE extends Ld{constructor(e={}){const t={};bE.definePropertiesValues(t,e);super(t,e);r(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});bE.init(this)}add(e){const t=[];for(let g=0;g<arguments.length;g++){const I=arguments[g];!I.isUI||I.isInline?(t.push(I),I.position.z=.005):console.warn("Block element can only contain Box elements.",I)}return super.add(...t)}set textContent(e){this._textContent.value=e}get textContent(){return this._textContent._value}set invertAlpha(e){this._invertAlpha.value=e}get invertAlpha(){return this._invertAlpha._value}static definePropertiesValues(e,t){e.children||(e.children=eH),e.textContent||(e.textContent=_X),e.glyphs||(e.glyphs=PX),e.inlines||(e.inlines=OX),e.layouter||(e.layouter=_T),e.renderer||(e.renderer=C9),e.fontFamily||(e.fontFamily=WT),e.fontWeight||(e.fontWeight=PT),e.fontStyle||(e.fontStyle=OT),e.fontSize||(e.fontSize=$T),e.color||(e.color=WX),e.backgroundColor||(e.backgroundColor=jX),e.lineBreak||(e.lineBreak=HT),e.letterSpacing||(e.letterSpacing=XT),e.whiteSpace||(e.whiteSpace=KU),e.segments||(e.segments=I9),e.textAlign||(e.textAlign=n9),e.fontKerning||(e.fontKerning=o9)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class a9 extends OY{constructor(){super("textContent",null,!1),this._needsUpdate=!1}set value(A){this._value!==A&&(this._value=A,this._needsUpdate=!0)}update(A,e){this._needsUpdate=!1;for(let t=A.children.length-1;t>=0;t--){const g=A.children[t];g.isUI&&(A.remove(g),g.clear())}A._children._uis=[],this._value&&A.add(new bE({name:"anonymousInline",textContent:this._value}))}}class r9 extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class B9 extends yt{constructor(){super("layouter",null,!1),this._value=null}update(A,e){}process(A){let e=A._width._value;A._width._auto?e=1/0:e=A._bounds._innerWidth;const t=A._lineHeight._value,g=new r9(new aq);let I=0;A._children._inlines.forEach(B=>{if(!B._inlines.value)return;this._resetInlines(B);const Q=B._fontSize._value,E=B._letterSpacing._value*Q,c=B._whiteSpace._value,d=B._lineBreak._value,l={WHITESPACE:c,LETTERSPACING:E,BREAKON:d,INNER_WIDTH:e},h=B._whiteSpace._inlineWrapper;I+=B._margin._value.w+B._padding._value.w,B._inlines.value.forEach((p,u,f)=>{const k=g[g.length-1];if(h(f,u,I,l)){if(g.push(new aq(p)),p.offsetX=p.xoffset,p.width===0){I=0;return}p.cumulativeWidth=p.xadvance+E,I=p.cumulativeWidth;return}g[g.length-1].push(p),p.offsetX=I+p.xoffset+p.kerning,p.cumulativeWidth=p.xadvance+p.kerning+E,I+=p.cumulativeWidth,k.length-1===1&&k[k.length-2].width===0&&(p.offsetX-=p.xoffset,I-=p.xoffset)}),I+=B._margin._value.y+B._padding._value.y});const o=A._whiteSpace._inlineCollapser;let s=0,C=0,n=0;g.forEach((B,Q)=>{const E=o(B);let c=0,d=0;if(B.forEach(l=>{c=Math.max(c,l.lineHeight),d=Math.max(d,l.lineBase),l.offsetX-=E}),B.lineHeight=c,B.lineBase=d,Q===0?n=-(c*t-c)*.5:n-=g[Q-1].lineHeight*t,B.y=n,B.x=0,B.forEach(l=>{l.offsetY=n-l.anchor,l.lineHeight<B.lineHeight&&(l.offsetY-=B.lineBase-l.lineBase)}),C+=B.lineHeight*t,B.width=0,B[0]){const l=B[B.length-1];B.width=l.offsetX+l.cumulativeWidth+l.paddingRight+l.marginRight+B[0].offsetX,s=Math.max(s,B.width)}}),g.height=C,g.width=s,this._value=g,e===1/0&&A._bounds.setChildrenWidth(A,g.width),A._height._auto&&A._bounds.setChildrenHeight(A,g.height);const a=A._parent._value;a&&(a._autoSize._needsProcess=!0,a._flexDirection._needsProcess=!0),A._inlineJustificator._needsProcess=!0,A._textAlign._needsProcess=!0,A._overflow._needsUpdate=!0}_resetInlines(A){A._fontSize.process(A)}}class Q9 extends nU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){E9(A),A._renderer._needsRender=!0}}function E9(i){const A=i._layouter._value,e=i._textAlign._value,t=i._bounds._innerWidth;for(let g=0;g<A.length;g++){const I=A[g],o=c9(i,I,g===A.length-1),s=i._padding._value,C=i._borderWidth._value,n=(-s.w+s.y)/2+(-C.w+C.y)/2;I.x+=o;for(let a=0;a<I.length;a++)I[a].offsetX+=o-n}if(e.indexOf("justify")===0)for(let g=0;g<A.length;g++){const I=A[g];if(e.indexOf("-")!==-1&&g===A.length-1)return;const o=t-I.width;if(o<=0)return;let s=0;for(let B=1;B<I.length-1;B++)s+=I[B].char===" "?1:0;const C=o/s;let n=1;e==="justify-right"&&(I.reverse(),n=-1);let a=0;for(let B=1;B<=I.length-1;B++){const Q=I[B];Q.offsetX+=a*n,a+=Q.char===" "?C:0}e==="justify-right"&&I.reverse()}}function c9(i,A,e){switch(i._textAlign._value){case"justify-left":case"justify":case"left":return-i._bounds._innerWidth/2;case"justify-right":case"right":return-A.width+i._bounds._innerWidth/2;case"center":return-A.width/2;case"justify-center":return e?-A.width/2:-i._bounds._innerWidth/2;default:console.warn(`textAlign: '${i._textAlign._value}' is not valid`)}}class h9 extends aU{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class l9 extends eT{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class d9 extends dw{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class u9 extends xT{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class p9 extends yt{constructor(){super("children",null,!1);r(this,"_sortOrder",(e,t)=>e._order._value<t._order._value?-1:e._order._value>t._order._value?1:this._uis.indexOf(e)<this._uis.indexOf(t)?-1:1);this._uis=[],this._inlines=[],this._boxes=[]}update(e,t){this._compute(e),this._needsProcess=!0}process(e){this._compute(e),e._overflow._needsRender=!0}_compute(e){this._uis=e.children.filter(t=>t.visible&&t.isUI),this._inlines=this._uis.filter(t=>t.isInline).sort(this._sortOrder)}dispose(){this._inlines=null}}class f9 extends yt{constructor(){super("autosize")}process(A){if(A._layouter._value&&A._layouter._value.length){const e=A._layouter._value,t=A._padding._value,g=A._borderWidth._value;A._width._auto&&A._bounds.setOffsetWidth(A,e.width+t.w+t.y+g.w+g.y),A._height._auto&&A._bounds.setOffsetHeight(A,e.height+t.x+t.z+g.x+g.z)}}}class D9 extends TT{constructor(){super("renderer"),this._needsUpdate=!1}render(A){super.render(A);for(const e of A._children._inlines)e._renderer.render(e);A.performAfterUpdate()}}class vl extends ql{constructor(A={},e={}){vl.definePropertiesValues(e,A),super(e,A),vl.init(this)}add(A){const e=[];let t=!1;for(let g=0;g<arguments.length;g++){const I=arguments[g];!I.isUI||I.isInline?(I.isInline&&(t=!0),e.push(I)):console.warn("Block element can only contain Box elements.",I)}return e.length>0&&super.add(...e),t&&(this._children._needsUpdate=!0,this._layouter._needsProcess=!0),this}set textContent(A){this._textContent.value=A}get textContent(){return super.textContent}set invertAlpha(A){this._invertAlpha.value=A}get invertAlpha(){return this._invertAlpha._value}get lines(){return this._layouter._value}static definePropertiesValues(A,e){A.flexDirection=h9,A.justifyContent=rU,A.alignItems=CU,A.bounds=u9,A.autoSize=f9,A.renderer=D9,A.children||(A.children=p9),A.textContent||(A.textContent=a9),A.layouter||(A.layouter=B9),A.lineHeight||(A.lineHeight=l9),A.textAlign||(A.textAlign=Q9),A.whiteSpace||(A.whiteSpace=KU),A.fontKerning||(A.fontKerning=d9),A.segments||(A.segments=AH),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class y9 extends yt{constructor(){super("inlines",null,!1),this._value=[]}process(A){this._value[0].paddingLeft=A._padding._value.w,this._value[0].marginLeft=A._margin._value.w;const e=this._value.length-1;this._value[e].paddingRight=A._padding._value.y,this._value[e].marginRight=A._margin._value.y}}class w9 extends yt{constructor(){super("renderer")}render(A){A._backgroundMesh||A.setBackgroundMesh(new YT(A)),A._backgroundMesh.position.x=A._inlines._value[0].offsetX+A._inlines._value[0].width/2,A._backgroundMesh.position.y=A._inlines._value[0].offsetY+A._inlines._value[0].lineBase/2,A._bounds.render(A)}}class S9 extends yt{constructor(){super("bounds",null,!1),this._size=new _A.Vector3(1,1,1),this._offsetWidth=0,this._offsetHeight=0,this._innerWidth=0,this._innerHeight=0}update(A,e){this.output(e),this._needsProcess=!0}process(A){this._offsetWidth=this._innerWidth=A._inlines._value[0].width,this._offsetHeight=this._innerHeight=A._inlines._value[0].height,this._needsRender=!0,A._borderWidth._needsRender=!0,A._borderRadius._needsRender=!0}render(A){this._size.x=this._offsetWidth,this._size.y=this._offsetHeight}output(A){A.size=this._size}}class Ll extends Ld{constructor(A={}){const e={};Ll.definePropertiesValues(e,A),super(e,A),Ll.init(this)}clear(){for(const A of this._inlines._value)A.clear();return super.clear()}bindBackgroundMeshProperties(){this._backgroundMesh.raycast=()=>{},this._bounds._size=this._backgroundMesh.scale,this._bounds._needsUpdate=!0}unbindBackgroundMeshProperties(){this._bounds._size=new _A.Vector3(1,1,1),this._bounds._needsUpdate=!0}add(A){const e=[];for(let t=0;t<arguments.length;t++){const g=arguments[t];g.isUI?console.warn("ThreeMeshUI::InlineBlockElement cannot contains UI Elements.",g):(e.push(g),g.position.z=.005)}return super.add(...e)}static definePropertiesValues(A,e){A.children||(A.children=eH),A.bounds||(A.bounds=S9),A.inlines||(A.inlines=y9),A.layouter||(A.layouter=_T),A.renderer||(A.renderer=w9),A.fontFamily||(A.fontFamily=WT),A.fontWeight||(A.fontWeight=PT),A.fontStyle||(A.fontStyle=OT),A.fontSize||(A.fontSize=$T),A.backgroundColor||(A.backgroundColor=TY),A.lineBreak||(A.lineBreak=HT),A.letterSpacing||(A.letterSpacing=XT),A.whiteSpace||(A.whiteSpace=KU),A.fontKerning||(A.fontKerning=dw),e.backgroundSize||(e.backgroundSize="cover"),e.width||(e.width="100%"),e.height||(e.height="100%"),e.boxSizing||(e.boxSizing="border-box")}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0},isInlineBlock:{configurable:!1,enumerable:!0,value:!0}}),A._inlines._value=[new k9(A)],A.backgroundMaterial=new LT,A._renderer.render(A)}}class k9 extends ZY{constructor(A){super(),this._uiElement=A}get xadvance(){const A=this._uiElement._padding._value,e=this._uiElement._width;return e._relative?e._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.w+A.y+e.value}get width(){const A=this._uiElement._width;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get height(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get anchor(){return this.height}get lineHeight(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}get lineBase(){const A=this._uiElement._height;return A._relative?A._value*this._uiElement._fontSize.getInheritedInput(this._uiElement):A.value}clear(){this._uiElement=null}}class tH{constructor(A){this._subject=A}attach(){console.error(`Behavior::attach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}act(){throw new Error(`Behavior::act() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}detach(){console.error(`Behavior::detach() - Is abstract and therefore should be overridden in ${this.constructor.name}`)}clear(){}}const iH=()=>bD.update(),gH={BaseProperty:yt,Block:bl,Text:vl,Inline:bE,InlineBlock:Ll,MeshUIBaseElement:Ld,FontLibrary:dB,update:iH,MSDFFontMaterialUtils:Oo,ShaderChunkUI:vT,Behavior:tH,FontVariant:Jd};typeof global<"u"&&(global.ThreeMeshUI=gH);const G9=gH;var M9=Pi.w8,IH=Pi.cg,JU=Pi.gO,m9=Pi.wb,RM=Pi.zV,R9=Pi.HS,U9=Pi.Ec,Ff=Pi.gF,N9=Pi.ol,F9=Pi.pz,K9=Pi.tx,J9=Pi.hj,q9=Pi.FV,b9=Pi.sV,qU=Pi.xv,v9=Pi.mx,L9=Pi.gE,xQ=Pi.ZP,oH=Pi.Vx;const nk=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:M9,Behavior:IH,Block:JU,DefaultValues:m9,FontLibrary:RM,FontVariant:R9,InheritableProperty:U9,Inline:Ff,InlineBlock:N9,InlineGlyph:F9,MSDFFontMaterialUtils:K9,MaterialTransformers:J9,MeshUIBaseElement:q9,ShaderChunkUI:b9,Text:qU,TypographicFont:v9,TypographicGlyph:L9,default:xQ,update:oH},Symbol.toStringTag,{value:"Module"}));function sB(i,A){try{A?i(A):i()}catch(e){return console.error(e),!1}return!0}const sH=sA("debugdefines");ww('if(!globalThis[""3.31.8""]) globalThis[""3.31.8""] = "0.0.0";');ww('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');ww('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.8";');ww('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const IC="3.31.8",yw="undefined";sH&&console.log(`Engine version: ${IC} (generator: ${yw})`);const pn="needle_isActiveInHierarchy",_r="builtin_components",zh="needle_editor_guid";function ww(i){try{(0,eval)(i)}catch(A){sH&&console.error(A)}}const UM=sA("debugnewscripts"),x9=sA("debughierarchy"),jt=[];function Y9(){return jt.length>0}function LD(i){if(!(i.new_scripts.length<=0)){if(UM&&console.log("Register new components",i.new_scripts.length,[...i.new_scripts],i.alias?"element: "+i.alias:i.hash,i),i.new_scripts_pre_setup_callbacks.length>0){for(const A of i.new_scripts_pre_setup_callbacks)A&&A();i.new_scripts_pre_setup_callbacks.length=0}jt.length=0,i.new_scripts.length>0&&jt.push(...i.new_scripts),i.new_scripts.length=0;for(let A=0;A<jt.length;A++)try{const e=jt[A];if(e.isComponent!==!0){(_e()||UM)&&console.error(`Registered script is not a Needle Engine component.
4080
4080
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4081
4081
  `,e),jt.splice(A,1),A--;continue}if(e.destroyed)continue;if(!e.gameObject){console.error("MISSING GAMEOBJECT - will ignore",e),jt.splice(A,1),A--;continue}e.context=i,Xh(e.gameObject),bU(e,i)}catch(e){console.error(e),en(jt[A],i),jt.splice(A,1),A--}for(let A=0;A<jt.length;A++)try{const e=jt[A];if(e.destroyed){en(jt[A],i),jt.splice(A,1),A--;continue}if(e.registering)try{e.registering()}catch(t){console.error(t)}e.__internalAwake!==void 0&&(e.gameObject||console.error("MISSING GAMEOBJECT",e,e.gameObject),Xh(e.gameObject),e.activeAndEnabled&&sB(e.__internalAwake.bind(e)))}catch(e){console.error(e),en(jt[A],i),jt.splice(A,1),A--}for(let A=0;A<jt.length;A++)try{const e=jt[A];if(e.destroyed||e.enabled===!1||(Xh(e.gameObject),e.activeAndEnabled===!1))continue;e.__internalEnable!==void 0&&(e.enabled=!0,sB(e.__internalEnable.bind(e)))}catch(e){console.error(e),en(jt[A],i),jt.splice(A,1),A--}for(let A=0;A<jt.length;A++)try{const e=jt[A];if(e.destroyed||!e.gameObject)continue;i.new_script_start.push(e)}catch(e){console.error(e),en(jt[A],i),jt.splice(A,1),A--}jt.length=0;for(const A of i.new_scripts_post_setup_callbacks)A&&A();i.new_scripts_post_setup_callbacks.length=0}}function T9(i){i&&(i.__internalDisable(!0),en(i,i.context))}function CH(i,A){for(let e=0;e<i.new_script_start.length;e++)try{const t=i.new_script_start[e];if(A!==void 0&&t.gameObject!==A||t.destroyed||t.activeAndEnabled===!1)continue;sB(t.__internalAwake.bind(t)),t.enabled&&(sB(t.__internalEnable.bind(t)),sB(t.__internalStart.bind(t)),i.new_script_start.splice(e,1),e--)}catch(t){console.error(t),en(i.new_script_start[e],i),i.new_script_start.splice(e,1),e--}}function bU(i,A){A.scripts.indexOf(i)===-1&&(A.scripts.push(i),i.earlyUpdate&&A.scripts_earlyUpdate.push(i),i.update&&A.scripts_update.push(i),i.lateUpdate&&A.scripts_lateUpdate.push(i),i.onBeforeRender&&A.scripts_onBeforeRender.push(i),i.onAfterRender&&A.scripts_onAfterRender.push(i),i.onPausedChanged&&A.scripts_pausedChanged.push(i))}function en(i,A){qC(i,A.new_scripts),qC(i,A.new_script_start),qC(i,A.scripts),qC(i,A.scripts_earlyUpdate),qC(i,A.scripts_update),qC(i,A.scripts_lateUpdate),qC(i,A.scripts_onBeforeRender),qC(i,A.scripts_onAfterRender),qC(i,A.scripts_pausedChanged),A.stopAllCoroutinesFrom(i)}function qC(i,A){const e=A.indexOf(i);e>=0&&A.splice(e,1)}function Kf(i){if(i||(i=Nt.Current.scene),!i){console.trace("Invalid call - no current context.");return}const A=oc(i);nH(i,A,!0)||(UM||_e()?console.error(`Error updating hierarchy
4082
4082
  Do you have circular references in your project? <a target="_blank" href="https://docs.needle.tools/circular-reference"> Click here for more information.`,i):console.error('Failed to update active state in hierarchy of "'+i.name+'"',i),console.warn(" ↑ this error might be caused by circular references. Please make sure you don't have files with circular references (e.g. one GLB 1 is loading GLB 2 which is then loading GLB 1 again)."))}function nH(i,A,e,t=0){if(t>1e3)return console.warn("Hierarchy is too deep (> 1000 level) - will abort updating active state"),!1;const g=oc(i);if(A&&(A=g,A&&i.parent)){const C=i.parent;A=C[pn],A===void 0&&(C instanceof HI||(A=!0))}const o=i[pn]!==A;i[pn]=A,o&&(x9&&console.warn("ACTIVE CHANGE",i.name,g,i.visible,A,"changed?"+o,i),e&&H9(i,C=>{A?C.enabled&&(sB(C.__internalAwake.bind(C)),C.enabled&&(C.__didEnable=!0,C.onEnable())):C.__didAwake&&C.enabled&&(C.__didEnable=!1,C.onDisable())}));let s=!0;if(i.children){const C=t+1;for(const n of i.children)nH(n,A,e,C)===!1&&(s=!1)}return s}function Xh(i){let A=!0,e=i,t=!1;for(;e&&e;){if(e.type==="Scene"&&(t=!0),!oc(e)){A=!1;break}e=e.parent}if(!i){console.error("GO is null");return}i[pn]=A&&t}function H9(i,A){var e;if((e=i.userData)!=null&&e.components)for(const t of i.userData.components)A(t)}const Jf=new Map,aH=Symbol("prewarmFlag"),NM=Symbol("waitingForPrewarm"),FM=sA("debugprewarm");function rH(i,A){if(!i||i[aH]===!0||i[NM]===!0)return;Jf.has(A)||Jf.set(A,[]),i[NM]=!0,Jf.get(A).push(i),FM&&console.debug("register prewarm",i.name)}let Qq=null,Eq=null;function _9(i){if(!i)return;const A=Jf.get(i);if(!(A!=null&&A.length))return;const e=i.mainCamera;if(e){FM&&console.log("prewarm",A.length,"objects",[...A]);const t=i.renderer;if(t.compile){const g=i.scene;t.compile(g,e),Qq??(Qq=new lR(64)),Eq??(Eq=new hR(.001,9999999,Qq)),Eq.update(t,g);for(const I of A)I[aH]=!0,I[NM]=!1;A.length=0,FM&&console.log("prewarm done")}}}const O9=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function P9(i){return typeof i=="string"&&O9.test(i)}const Gg=[];for(let i=0;i<256;++i)Gg.push((i+256).toString(16).slice(1));function W9(i,A=0){return Gg[i[A+0]]+Gg[i[A+1]]+Gg[i[A+2]]+Gg[i[A+3]]+"-"+Gg[i[A+4]]+Gg[i[A+5]]+"-"+Gg[i[A+6]]+Gg[i[A+7]]+"-"+Gg[i[A+8]]+Gg[i[A+9]]+"-"+Gg[i[A+10]]+Gg[i[A+11]]+Gg[i[A+12]]+Gg[i[A+13]]+Gg[i[A+14]]+Gg[i[A+15]]}function j9(i){if(!P9(i))throw TypeError("Invalid UUID");let A;const e=new Uint8Array(16);return e[0]=(A=parseInt(i.slice(0,8),16))>>>24,e[1]=A>>>16&255,e[2]=A>>>8&255,e[3]=A&255,e[4]=(A=parseInt(i.slice(9,13),16))>>>8,e[5]=A&255,e[6]=(A=parseInt(i.slice(14,18),16))>>>8,e[7]=A&255,e[8]=(A=parseInt(i.slice(19,23),16))>>>8,e[9]=A&255,e[10]=(A=parseInt(i.slice(24,36),16))/1099511627776&255,e[11]=A/4294967296&255,e[12]=A>>>24&255,e[13]=A>>>16&255,e[14]=A>>>8&255,e[15]=A&255,e}function V9(i){i=unescape(encodeURIComponent(i));const A=[];for(let e=0;e<i.length;++e)A.push(i.charCodeAt(e));return A}const Z9="6ba7b810-9dad-11d1-80b4-00c04fd430c8",z9="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function X9(i,A,e){function t(g,I,o,s){var C;if(typeof g=="string"&&(g=V9(g)),typeof I=="string"&&(I=j9(I)),((C=I)===null||C===void 0?void 0:C.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let n=new Uint8Array(16+g.length);if(n.set(I),n.set(g,I.length),n=e(n),n[6]=n[6]&15|A,n[8]=n[8]&63|128,o){s=s||0;for(let a=0;a<16;++a)o[s+a]=n[a];return o}return W9(n)}try{t.name=i}catch{}return t.DNS=Z9,t.URL=z9,t}function $9(i,A,e,t){switch(i){case 0:return A&e^~A&t;case 1:return A^e^t;case 2:return A&e^A&t^e&t;case 3:return A^e^t}}function ak(i,A){return i<<A|i>>>32-A}function A6(i){const A=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){const o=unescape(encodeURIComponent(i));i=[];for(let s=0;s<o.length;++s)i.push(o.charCodeAt(s))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);const t=i.length/4+2,g=Math.ceil(t/16),I=new Array(g);for(let o=0;o<g;++o){const s=new Uint32Array(16);for(let C=0;C<16;++C)s[C]=i[o*64+C*4]<<24|i[o*64+C*4+1]<<16|i[o*64+C*4+2]<<8|i[o*64+C*4+3];I[o]=s}I[g-1][14]=(i.length-1)*8/Math.pow(2,32),I[g-1][14]=Math.floor(I[g-1][14]),I[g-1][15]=(i.length-1)*8&4294967295;for(let o=0;o<g;++o){const s=new Uint32Array(80);for(let E=0;E<16;++E)s[E]=I[o][E];for(let E=16;E<80;++E)s[E]=ak(s[E-3]^s[E-8]^s[E-14]^s[E-16],1);let C=e[0],n=e[1],a=e[2],B=e[3],Q=e[4];for(let E=0;E<80;++E){const c=Math.floor(E/20),d=ak(C,5)+$9(c,n,a,B)+Q+A[c]+s[E]>>>0;Q=B,B=a,a=ak(n,30)>>>0,n=C,C=d}e[0]=e[0]+C>>>0,e[1]=e[1]+n>>>0,e[2]=e[2]+a>>>0,e[3]=e[3]+B>>>0,e[4]=e[4]+Q>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}const e6=X9("v5",80,A6),cq=e6;var io=(i=>(i[i.OnConnection=0]="OnConnection",i[i.OnRoomJoin=1]="OnRoomJoin",i[i.Queued=2]="Queued",i[i.Immediate=3]="Immediate",i))(io||{});Nt.registerCallback($i.ContextCreated,i=>{const A=i.context;hH(A),cH(A)});const xD=sA("debugcomponents"),hq="eff8ba80-635d-11ec-90d6-0242ac120003";class lg{constructor(A){r(this,"_originalSeed");r(this,"_seed");typeof A=="string"&&(A=lg.hash(A)),this._originalSeed=A,this._seed=A}get seed(){return this._seed}set seed(A){this._seed=A}reset(){this._seed=this._originalSeed}generateUUID(A){if(typeof A=="string")return cq(A,hq);const e=this._seed;return this._seed-=1,cq(e.toString(),hq)}initialize(A){typeof A=="string"?this._seed=lg.hash(A):this._seed=A}static createFromString(A){return new lg(this.hash(A))}static hash(A){let e=0;for(let t=0;t<A.length;t++)e=A.charCodeAt(t)+((e<<5)-e);return e}}var BH=(i=>(i.NewInstanceCreated="new-instance-created",i.InstanceDestroyed="instance-destroyed",i))(BH||{});class QH{constructor(A){r(this,"guid");this.guid=A}}function Sw(i,A,e=!0){if(!i)return;const t=i;if(hC(i,e),!A){console.warn("Can not send destroy: No networking connection provided",i.guid);return}if(!A.isConnected){console.warn("Can not send destroy: not connected",i.guid);return}let g=i.guid;if(!g&&t.uuid&&(g=t.uuid),!g){console.warn("Can not send destroy: failed to find guid",i);return}const I=new QH(g);A.send("instance-destroyed",I,io.Queued)}function EH(i,A){const e=new QH(i);A.send("instance-destroyed",e,io.Queued)}function cH(i){i.connection.beginListen("instance-destroyed",A=>{xD&&console.log("[Remote] Destroyed",i.scene,A);const e=Pd(A.guid,i.scene);e&&hC(e)})}class t6{constructor(A,e,t){r(this,"filename");r(this,"hash");r(this,"size");this.filename=A,this.hash=e,this.size=t}}class i6{constructor(A,e){r(this,"guid");r(this,"originalGuid");r(this,"seed");r(this,"visible");r(this,"hostData");r(this,"dontSave");r(this,"parent");r(this,"position");r(this,"rotation");r(this,"scale");this.originalGuid=A,this.guid=e}}function vU(i,A,e,t){var C;const g=i;if(!g.guid)return console.warn("Can not instantiate: No guid",g),null;if(A.context||(A.context=Ye.Current),!A.context)return console.error("Missing network instantiate options / reference to network connection in sync instantiate"),null;const I=A?{...A}:null,{instance:o,seed:s}=g6(g,A);if(o){const n=o;if(n.guid){xD&&console.log("[Local] new instance","gameobject:",o==null?void 0:o.guid);const a=new i6(g.guid,n.guid);a.seed=s,I&&(I.position&&(a.position={x:I.position.x,y:I.position.y,z:I.position.z}),I.rotation&&(a.rotation={x:I.rotation.x,y:I.rotation.y,z:I.rotation.z,w:I.rotation.w}),I.scale&&(a.scale={x:I.scale.x,y:I.scale.y,z:I.scale.z})),a.position||(a.position={x:n.position.x,y:n.position.y,z:n.position.z}),a.rotation||(a.rotation={x:n.quaternion.x,y:n.quaternion.y,z:n.quaternion.z,w:n.quaternion.w}),a.scale||(a.scale={x:n.scale.x,y:n.scale.y,z:n.scale.z}),a.visible=g.visible,I!=null&&I.parent&&(typeof I.parent=="string"?a.parent=I.parent:a.parent=I.parent.guid),a.hostData=e,t===!1&&(a.dontSave=!0),(C=A==null?void 0:A.context)==null||C.connection.send("new-instance-created",a)}else console.warn("Missing guid, can not send new instance event",n)}return o}function kw(){return Math.random()*9999999}function hH(i){i.connection.beginListen("new-instance-created",async A=>{const e=await I6(A.originalGuid,i.scene);if(!e){console.warn("could not find object that was instantiated: "+A.guid);return}const t=new Ls;A.position&&(t.position=new y(A.position.x,A.position.y,A.position.z)),A.rotation&&(t.rotation=new mA(A.rotation.x,A.rotation.y,A.rotation.z,A.rotation.w)),A.scale&&(t.scale=new y(A.scale.x,A.scale.y,A.scale.z)),t.parent=A.parent,A.seed&&(t.idProvider=new lg(A.seed)),t.visible=A.visible,t.context=i,xD&&i.alias&&console.log("[Remote] instantiate in: "+i.alias);const g=Wd(e,t);g&&(A.parent==="scene"&&i.scene.add(g),xD&&console.log("[Remote] new instance","gameobject:",g==null?void 0:g.guid,e))})}function g6(i,A){const e=kw(),t=A??new Ls;t.idProvider=new lg(e);const g=Wd(i,t);return{seed:e,instance:g}}const lH={};function dH(i,A){lH[i]=A}async function I6(i,A){const e=lH[i];if(e!=null){const t=await e(i);if(t)return t}return uH(i,A)}function uH(i,A){if(A===null||!i)return null;if(A.guid===i)return A;if(A.children)for(const e of A.children){const t=uH(i,e);if(t)return t}return null}const pH=new Map;function o6(i,A){if(!i)return;if(!A){console.warn("No prototype found",i,i.prototype,i.constructor);return}const e=pH.get(A);e&&e.apply(i)}function s6(i){const A=C6(i.prototype);pH.set(i,A)}function C6(i){return new n6(i)}class n6{constructor(A){r(this,"$symbol");r(this,"extensions");r(this,"descriptors");this.$symbol=Symbol("prototype-extension"),this.extensions=Object.keys(A),this.descriptors=new Array;for(let e=0;e<this.extensions.length;e++){const t=this.extensions[e],g=Object.getOwnPropertyDescriptor(A,t);g&&this.descriptors.push(g)}}apply(A){if(!A[this.$symbol]){A[this.$symbol]=!0;for(let e=0;e<this.extensions.length;e++){const t=this.extensions[e],g=this.descriptors[e];g&&Object.defineProperty(A,t,g)}}}}var xd=(i=>(i.Added="component-added",i.Removing="removing-component",i))(xd||{});const lq=sA("debugcomponentevents");class Yd{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let t=this.eventListeners.get(A);t||(t=[]),t.push(e),this.eventListeners.set(A,t),lq&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const t=this.eventListeners.get(A);if(!t)return;const g=t.indexOf(e);g<0||t.splice(g,1)}static dispatchComponentLifecycleEvent(A,e){const t=this.eventListeners.get(A);if(lq&&console.log("Dispatching event "+A,t),!!t)for(const g of t)g(e)}}r(Yd,"eventListeners",new Map);const rk=sA("debuggetcomponent");function a6(i){return i==null||i.isObject3D?i:i.object&&i.object.isObject3D?i.object:i}function LU(i,A){if(!i||!i.userData.components)return;const e=i.userData.components.indexOf(A);e<0||(Yd.dispatchComponentLifecycleEvent(xd.Removing,A),A.gameObject=null,i.userData.components.splice(e,1))}function Gw(i,A){const e=Ic(i,A);if(e)return e;const t=new A;return za(i,t)}const fH=new lg("addComponentIdProvider");function za(i,A,e=!0){i.userData||(i.userData={}),i.userData.components||(i.userData.components=[]),i.userData.components.push(A),A.gameObject=i,(A.guid===void 0||A.guid==="invalid")&&(A.guid=fH.generateUUID()),mw(i),Hw(A);try{e&&A.__internalAwake&&(Xh(i),A.activeAndEnabled&&A.__internalAwake()),Yd.dispatchComponentLifecycleEvent(xd.Added,A)}catch(t){console.error(t)}return A}function xU(i,A){if(typeof A=="function")return za(i,new A);if(A.destroyed)return console.warn("Can not move/add a destroyed component",A),A;if(A.gameObject===i)return A;if(A.gameObject&&A.gameObject.userData.components){const e=A.gameObject.userData.components.indexOf(A);A.gameObject.userData.components.splice(e,1)}if(!i.userData.components)i.userData.components=[];else if(i.userData.components.includes(A))return A;return i.userData.components.push(A),A.gameObject=i,(A.guid===void 0||A.guid==="invalid")&&(A.guid=fH.generateUUID()),Hw(A),A}function DH(i){if(i.gameObject&&i.gameObject.userData.components){const A=i.gameObject.userData.components.indexOf(i);i.gameObject.userData.components.splice(A,1)}i.__internalDisable&&i.__internalDisable(),en(i,i.context??Ye.Current),i.destroy(),i.gameObject=null}let dq=!1;function yH(i,A,e){var t;if(i==null)return null;if(!i.isObject3D)return console.error("Object is not object3D"),null;if(!((t=i==null?void 0:i.userData)!=null&&t.components)||(typeof A=="string"&&(dq||(dq=!0,console.warn(`Accessing components by name is not supported.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "3.31.7",
3
+ "version": "3.31.8",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "type": "module",