@needle-tools/engine 3.31.3 → 3.31.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/needle-engine.js +3 -3
- package/dist/needle-engine.light.js +3 -3
- package/dist/needle-engine.light.min.js +1 -1
- package/dist/needle-engine.light.umd.cjs +1 -1
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/package.json +1 -1
- package/plugins/next/next.js +5 -4
package/dist/needle-engine.js
CHANGED
|
@@ -31390,11 +31390,11 @@ function xr(i, A) {
|
|
|
31390
31390
|
return !0;
|
|
31391
31391
|
}
|
|
31392
31392
|
const HY = sA("debugdefines");
|
|
31393
|
-
yy('if(!globalThis[""3.31.
|
|
31393
|
+
yy('if(!globalThis[""3.31.5""]) globalThis[""3.31.5""] = "0.0.0";');
|
|
31394
31394
|
yy('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
31395
|
-
yy('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.
|
|
31395
|
+
yy('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.5";');
|
|
31396
31396
|
yy('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
31397
|
-
const ZC = "3.31.
|
|
31397
|
+
const ZC = "3.31.5", MR = "undefined";
|
|
31398
31398
|
HY && console.log(`Engine version: ${ZC} (generator: ${MR})`);
|
|
31399
31399
|
const ra = "needle_isActiveInHierarchy", aQ = "builtin_components", Mp = "needle_editor_guid";
|
|
31400
31400
|
function yy(i) {
|
|
@@ -31390,11 +31390,11 @@ function gu(n, e) {
|
|
|
31390
31390
|
return !0;
|
|
31391
31391
|
}
|
|
31392
31392
|
const aU = re("debugdefines");
|
|
31393
|
-
__('if(!globalThis[""3.31.
|
|
31393
|
+
__('if(!globalThis[""3.31.5""]) globalThis[""3.31.5""] = "0.0.0";');
|
|
31394
31394
|
__('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
31395
|
-
__('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.
|
|
31395
|
+
__('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.5";');
|
|
31396
31396
|
__('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
31397
|
-
const Fl = "3.31.
|
|
31397
|
+
const Fl = "3.31.5", dT = "undefined";
|
|
31398
31398
|
aU && console.log(`Engine version: ${Fl} (generator: ${dT})`);
|
|
31399
31399
|
const Wc = "needle_isActiveInHierarchy", Nd = "builtin_components", Qy = "needle_editor_guid";
|
|
31400
31400
|
function __(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 gO 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 sY extends Qm{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 vO extends uk{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class AO extends dk{constructor(){super()}computeOutputValue(e){this._value=uC(this.getInheritedInput(e))}}class yO extends yk{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 _0)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 qC extends _k{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=rY(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=nY;break;case"pre-line":this._stringCollapser=_O;break;default:this._stringCollapser=oY}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=uY;break;case"pre-wrap":this._inlineCollapser=hY;break;default:this._inlineCollapser=dY}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=aY;break;case"pre":this._inlineWrapper=lY;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 bO={" ":" ","\n":`
|
|
4077
4077
|
`,"\r":"\r"," ":" "},rY=function(i){switch(i){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function nY(i){return _O(i.replace(/\n/g," "))}function _O(i){return i.replace(/[ ]{2,}/g," ")}function oY(i){return i}function aY(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=SO(i,e,s);return pY(i[e-1],t,n,s)}function lY(i,e,t,s){return i[e].lineBreak==="mandatory"}function cY(){return!1}function hY(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&&wO([e],i[1]),t.char&&t.char===`
|
|
4079
|
-
`&&i.length>1&&xO([t],i[i.length-2]),e.offsetX}function uY(i){if(!i[0])return 0;let e=[],t;for(let s=0;s<i.length;s++){const r=i[s];if(r.char&&bO[r.char]&&i.length>s){e.push(r),t=i[s+1];continue}break}wO(e,t),e=[],t=null;for(let s=i.length-1;s>0;s--){const r=i[s];if(r.char&&bO[r.char]&&s>0){e.push(r),t=i[s-1];continue}break}return xO(e,t),i[0].offsetX}function dY(i){return i[0]?i[0].offsetX:0}function xO(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 wO(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 SO(i,e,t,s){if(s=s||0,!i[e])return s;const r=i[e];return r.lineBreak?s+r.xadvance:SO(i,e+1,t,s+r.xadvance+r.xoffset+r.kerning+t.LETTERSPACING)}function pY(i,e,t,s){return!i||!i.char||e+t<s.INNER_WIDTH?!1:s.BREAKON.indexOf(i.char)>-1}class CO extends xk{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 EO 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 MO extends wk{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 fY extends MO{constructor(){super(),this._value="inherit"}}class mY extends w0{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 TO extends fi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function gY(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=IO(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=IO(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 IO(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 vY 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=gY(t);e.setFontMesh(new Qe.Mesh(s,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class AY extends fC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class Vf extends Km{constructor(e={}){const t={};Vf.definePropertiesValues(t,e),super(t,e),h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),Vf.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=TO),e.textContent||(e.textContent=$q),e.glyphs||(e.glyphs=tY),e.inlines||(e.inlines=eY),e.layouter||(e.layouter=gO),e.renderer||(e.renderer=vY),e.fontFamily||(e.fontFamily=yO),e.fontWeight||(e.fontWeight=AO),e.fontStyle||(e.fontStyle=vO),e.fontSize||(e.fontSize=EO),e.color||(e.color=iY),e.backgroundColor||(e.backgroundColor=sY),e.lineBreak||(e.lineBreak=mO),e.letterSpacing||(e.letterSpacing=CO),e.whiteSpace||(e.whiteSpace=qC),e.segments||(e.segments=fY),e.textAlign||(e.textAlign=AY),e.fontKerning||(e.fontKerning=mY)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class yY extends hk{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 Vf({name:"anonymousInline",textContent:this._value}))}}class bY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class _Y 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 bY(new fO);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 fO(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 xY extends fC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){wY(e),e._renderer._needsRender=!0}}function wY(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=SY(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 SY(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 CY extends mC{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class EY extends bk{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class MY extends w0{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class TY extends hO{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class IY 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 RY 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 PY extends pO{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 RA extends TA{constructor(e={},t={}){RA.definePropertiesValues(t,e),super(t,e),RA.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=CY,e.justifyContent=gC,e.alignItems=pC,e.bounds=TY,e.autoSize=RY,e.renderer=PY,e.children||(e.children=IY),e.textContent||(e.textContent=yY),e.layouter||(e.layouter=_Y),e.lineHeight||(e.lineHeight=EY),e.textAlign||(e.textAlign=xY),e.whiteSpace||(e.whiteSpace=qC),e.fontKerning||(e.fontKerning=MY),e.segments||(e.segments=MO),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class BY 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 DY extends fi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new dO(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 PA extends Km{constructor(e={}){const t={};PA.definePropertiesValues(t,e),super(t,e),PA.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=TO),e.bounds||(e.bounds=kY),e.inlines||(e.inlines=BY),e.layouter||(e.layouter=gO),e.renderer||(e.renderer=DY),e.fontFamily||(e.fontFamily=yO),e.fontWeight||(e.fontWeight=AO),e.fontStyle||(e.fontStyle=vO),e.fontSize||(e.fontSize=EO),e.backgroundColor||(e.backgroundColor=ak),e.lineBreak||(e.lineBreak=mO),e.letterSpacing||(e.letterSpacing=CO),e.whiteSpace||(e.whiteSpace=qC),e.fontKerning||(e.fontKerning=w0),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 OY(e)],e.backgroundMaterial=new cO,e._renderer.render(e)}}class OY extends mk{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 RO{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 PO=()=>B0.update(),BO={BaseProperty:fi,Block:IA,Text:RA,Inline:Vf,InlineBlock:PA,MeshUIBaseElement:Km,FontLibrary:fu,update:PO,MSDFFontMaterialUtils:Vo,ShaderChunkUI:lO,Behavior:RO,FontVariant:Gm};typeof global<"u"&&(global.ThreeMeshUI=BO);const LY=BO;var UY=Es.w8,DO=Es.cg,YC=Es.gO,FY=Es.wb,KC=Es.zV,NY=Es.HS,zY=Es.Ec,k0=Es.gF,jY=Es.ol,GY=Es.pz,QY=Es.tx,VY=Es.hj,HY=Es.FV,WY=Es.sV,JC=Es.xv,XY=Es.mx,qY=Es.gE,up=Es.ZP,kO=Es.Vx;const ZC=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:UY,Behavior:DO,Block:YC,DefaultValues:FY,FontLibrary:KC,FontVariant:NY,InheritableProperty:zY,Inline:k0,InlineBlock:jY,InlineGlyph:GY,MSDFFontMaterialUtils:QY,MaterialTransformers:VY,MeshUIBaseElement:HY,ShaderChunkUI:WY,Text:JC,TypographicFont:XY,TypographicGlyph:qY,default:up,update:kO},Symbol.toStringTag,{value:"Module"}));function gu(i,e){try{e?i(e):i()}catch(t){return console.error(t),!1}return!0}const OO=oe("debugdefines");L0('if(!globalThis[""3.31.3""]) globalThis[""3.31.3""] = "0.0.0";'),L0('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),L0('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.3";'),L0('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Pl="3.31.3",O0="undefined";OO&&console.log(`Engine version: ${Pl} (generator: ${O0})`);const Bl="needle_isActiveInHierarchy",vu="builtin_components",Jm="needle_editor_guid";function L0(i){try{(0,eval)(i)}catch(e){OO&&console.error(e)}}const $C=oe("debugnewscripts"),YY=oe("debughierarchy"),ji=[];function KY(){return ji.length>0}function U0(i){if(!(i.new_scripts.length<=0)){if($C&&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){(jt()||$C)&&console.error(`Registered script is not a Needle Engine component.
|
|
4079
|
+
`&&i.length>1&&xO([t],i[i.length-2]),e.offsetX}function uY(i){if(!i[0])return 0;let e=[],t;for(let s=0;s<i.length;s++){const r=i[s];if(r.char&&bO[r.char]&&i.length>s){e.push(r),t=i[s+1];continue}break}wO(e,t),e=[],t=null;for(let s=i.length-1;s>0;s--){const r=i[s];if(r.char&&bO[r.char]&&s>0){e.push(r),t=i[s-1];continue}break}return xO(e,t),i[0].offsetX}function dY(i){return i[0]?i[0].offsetX:0}function xO(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 wO(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 SO(i,e,t,s){if(s=s||0,!i[e])return s;const r=i[e];return r.lineBreak?s+r.xadvance:SO(i,e+1,t,s+r.xadvance+r.xoffset+r.kerning+t.LETTERSPACING)}function pY(i,e,t,s){return!i||!i.char||e+t<s.INNER_WIDTH?!1:s.BREAKON.indexOf(i.char)>-1}class CO extends xk{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 EO 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 MO extends wk{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 fY extends MO{constructor(){super(),this._value="inherit"}}class mY extends w0{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 TO extends fi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function gY(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=IO(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=IO(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 IO(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 vY 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=gY(t);e.setFontMesh(new Qe.Mesh(s,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class AY extends fC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class Vf extends Km{constructor(e={}){const t={};Vf.definePropertiesValues(t,e),super(t,e),h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),Vf.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=TO),e.textContent||(e.textContent=$q),e.glyphs||(e.glyphs=tY),e.inlines||(e.inlines=eY),e.layouter||(e.layouter=gO),e.renderer||(e.renderer=vY),e.fontFamily||(e.fontFamily=yO),e.fontWeight||(e.fontWeight=AO),e.fontStyle||(e.fontStyle=vO),e.fontSize||(e.fontSize=EO),e.color||(e.color=iY),e.backgroundColor||(e.backgroundColor=sY),e.lineBreak||(e.lineBreak=mO),e.letterSpacing||(e.letterSpacing=CO),e.whiteSpace||(e.whiteSpace=qC),e.segments||(e.segments=fY),e.textAlign||(e.textAlign=AY),e.fontKerning||(e.fontKerning=mY)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class yY extends hk{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 Vf({name:"anonymousInline",textContent:this._value}))}}class bY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class _Y 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 bY(new fO);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 fO(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 xY extends fC{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){wY(e),e._renderer._needsRender=!0}}function wY(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=SY(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 SY(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 CY extends mC{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class EY extends bk{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class MY extends w0{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class TY extends hO{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class IY 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 RY 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 PY extends pO{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 RA extends TA{constructor(e={},t={}){RA.definePropertiesValues(t,e),super(t,e),RA.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=CY,e.justifyContent=gC,e.alignItems=pC,e.bounds=TY,e.autoSize=RY,e.renderer=PY,e.children||(e.children=IY),e.textContent||(e.textContent=yY),e.layouter||(e.layouter=_Y),e.lineHeight||(e.lineHeight=EY),e.textAlign||(e.textAlign=xY),e.whiteSpace||(e.whiteSpace=qC),e.fontKerning||(e.fontKerning=MY),e.segments||(e.segments=MO),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class BY 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 DY extends fi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new dO(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 PA extends Km{constructor(e={}){const t={};PA.definePropertiesValues(t,e),super(t,e),PA.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=TO),e.bounds||(e.bounds=kY),e.inlines||(e.inlines=BY),e.layouter||(e.layouter=gO),e.renderer||(e.renderer=DY),e.fontFamily||(e.fontFamily=yO),e.fontWeight||(e.fontWeight=AO),e.fontStyle||(e.fontStyle=vO),e.fontSize||(e.fontSize=EO),e.backgroundColor||(e.backgroundColor=ak),e.lineBreak||(e.lineBreak=mO),e.letterSpacing||(e.letterSpacing=CO),e.whiteSpace||(e.whiteSpace=qC),e.fontKerning||(e.fontKerning=w0),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 OY(e)],e.backgroundMaterial=new cO,e._renderer.render(e)}}class OY extends mk{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 RO{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 PO=()=>B0.update(),BO={BaseProperty:fi,Block:IA,Text:RA,Inline:Vf,InlineBlock:PA,MeshUIBaseElement:Km,FontLibrary:fu,update:PO,MSDFFontMaterialUtils:Vo,ShaderChunkUI:lO,Behavior:RO,FontVariant:Gm};typeof global<"u"&&(global.ThreeMeshUI=BO);const LY=BO;var UY=Es.w8,DO=Es.cg,YC=Es.gO,FY=Es.wb,KC=Es.zV,NY=Es.HS,zY=Es.Ec,k0=Es.gF,jY=Es.ol,GY=Es.pz,QY=Es.tx,VY=Es.hj,HY=Es.FV,WY=Es.sV,JC=Es.xv,XY=Es.mx,qY=Es.gE,up=Es.ZP,kO=Es.Vx;const ZC=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:UY,Behavior:DO,Block:YC,DefaultValues:FY,FontLibrary:KC,FontVariant:NY,InheritableProperty:zY,Inline:k0,InlineBlock:jY,InlineGlyph:GY,MSDFFontMaterialUtils:QY,MaterialTransformers:VY,MeshUIBaseElement:HY,ShaderChunkUI:WY,Text:JC,TypographicFont:XY,TypographicGlyph:qY,default:up,update:kO},Symbol.toStringTag,{value:"Module"}));function gu(i,e){try{e?i(e):i()}catch(t){return console.error(t),!1}return!0}const OO=oe("debugdefines");L0('if(!globalThis[""3.31.5""]) globalThis[""3.31.5""] = "0.0.0";'),L0('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),L0('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.5";'),L0('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Pl="3.31.5",O0="undefined";OO&&console.log(`Engine version: ${Pl} (generator: ${O0})`);const Bl="needle_isActiveInHierarchy",vu="builtin_components",Jm="needle_editor_guid";function L0(i){try{(0,eval)(i)}catch(e){OO&&console.error(e)}}const $C=oe("debugnewscripts"),YY=oe("debughierarchy"),ji=[];function KY(){return ji.length>0}function U0(i){if(!(i.new_scripts.length<=0)){if($C&&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){(jt()||$C)&&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,Zm(t.gameObject),eE(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),Zm(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||(Zm(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 JY(i){i&&(i.__internalDisable(!0),Dl(i,i.context))}function LO(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 eE(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 F0(i){if(i||(i=Ti.Current.scene),!i){console.trace("Invalid call - no current context.");return}const e=mp(i);UO(i,e,!0)||($C||jt()?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 UO(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=mp(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&&(YY&&console.warn("ACTIVE CHANGE",i.name,r,i.visible,e,"changed?"+n,i),t&&ZY(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)UO(l,e,t,a)===!1&&(o=!1)}return o}function Zm(i){let e=!0,t=i,s=!1;for(;t&&t;){if(t.type==="Scene"&&(s=!0),!mp(t)){e=!1;break}t=t.parent}if(!i){console.error("GO is null");return}i[Bl]=e&&s}function ZY(i,e){var t;if((t=i.userData)!=null&&t.components)for(const s of i.userData.components)e(s)}const N0=new Map,FO=Symbol("prewarmFlag"),tE=Symbol("waitingForPrewarm"),iE=oe("debugprewarm");function NO(i,e){!i||i[FO]===!0||i[tE]===!0||(N0.has(e)||N0.set(e,[]),i[tE]=!0,N0.get(e).push(i),iE&&console.debug("register prewarm",i.name))}let sE=null,rE=null;function $Y(i){if(!i)return;const e=N0.get(i);if(!(e!=null&&e.length))return;const t=i.mainCamera;if(t){iE&&console.log("prewarm",e.length,"objects",[...e]);const s=i.renderer;if(s.compile){const r=i.scene;s.compile(r,t),sE??(sE=new O1(64)),rE??(rE=new k1(.001,9999999,sE)),rE.update(s,r);for(const n of e)n[FO]=!0,n[tE]=!1;e.length=0,iE&&console.log("prewarm done")}}}const e7=/^(?:[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 t7(i){return typeof i=="string"&&e7.test(i)}const ur=[];for(let i=0;i<256;++i)ur.push((i+256).toString(16).slice(1));function i7(i,e=0){return ur[i[e+0]]+ur[i[e+1]]+ur[i[e+2]]+ur[i[e+3]]+"-"+ur[i[e+4]]+ur[i[e+5]]+"-"+ur[i[e+6]]+ur[i[e+7]]+"-"+ur[i[e+8]]+ur[i[e+9]]+"-"+ur[i[e+10]]+ur[i[e+11]]+ur[i[e+12]]+ur[i[e+13]]+ur[i[e+14]]+ur[i[e+15]]}function s7(i){if(!t7(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 r7(i){i=unescape(encodeURIComponent(i));const e=[];for(let t=0;t<i.length;++t)e.push(i.charCodeAt(t));return e}const n7="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o7="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function a7(i,e,t){function s(r,n,o,a){var l;if(typeof r=="string"&&(r=r7(r)),typeof n=="string"&&(n=s7(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 i7(c)}try{s.name=i}catch{}return s.DNS=n7,s.URL=o7,s}function l7(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 nE(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]=nE(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=nE(l,5)+l7(m,c,u,d)+p+e[m]+a[f]>>>0;p=d,d=u,u=nE(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 h7=a7("v5",80,c7),zO=h7;var Vn=(i=>(i[i.OnConnection=0]="OnConnection",i[i.OnRoomJoin=1]="OnRoomJoin",i[i.Queued=2]="Queued",i[i.Immediate=3]="Immediate",i))(Vn||{});Ti.registerCallback(Xs.ContextCreated,i=>{const e=i.context;WO(e),HO(e)});const z0=oe("debugcomponents"),jO="eff8ba80-635d-11ec-90d6-0242ac120003";class or{constructor(e){h(this,"_originalSeed"),h(this,"_seed"),typeof e=="string"&&(e=or.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 zO(e,jO);const t=this._seed;return this._seed-=1,zO(t.toString(),jO)}initialize(e){typeof e=="string"?this._seed=or.hash(e):this._seed=e}static createFromString(e){return new or(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 GO=(i=>(i.NewInstanceCreated="new-instance-created",i.InstanceDestroyed="instance-destroyed",i))(GO||{});class QO{constructor(e){h(this,"guid"),this.guid=e}}function j0(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 QO(r);e.send("instance-destroyed",n,Vn.Queued)}function VO(i,e){const t=new QO(i);e.send("instance-destroyed",t,Vn.Queued)}function HO(i){i.connection.beginListen("instance-destroyed",e=>{z0&&console.log("[Remote] Destroyed",i.scene,e);const t=fg(e.guid,i.scene);t&&Ba(t)})}class u7{constructor(e,t,s){h(this,"filename"),h(this,"hash"),h(this,"size"),this.filename=e,this.hash=t,this.size=s}}class d7{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 oE(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=Ft.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}=p7(n,e);if(a){const c=a;if(c.guid){z0&&console.log("[Local] new instance","gameobject:",a?.guid);const u=new d7(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 G0(){return Math.random()*9999999}function WO(i){i.connection.beginListen("new-instance-created",async e=>{const t=await f7(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 or(e.seed)),s.visible=e.visible,s.context=i,z0&&i.alias&&console.log("[Remote] instantiate in: "+i.alias);const r=mg(t,s);r&&(e.parent==="scene"&&i.scene.add(r),z0&&console.log("[Remote] new instance","gameobject:",r?.guid,t))})}function p7(i,e){const t=G0(),s=e??new _a;s.idProvider=new or(t);const r=mg(i,s);return{seed:t,instance:r}}const XO={};function qO(i,e){XO[i]=e}async function f7(i,e){const t=XO[i];if(t!=null){const s=await t(i);if(s)return s}return YO(i,e)}function YO(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=YO(i,t);if(s)return s}return null}const KO=new Map;function m7(i,e){if(!i)return;if(!e){console.warn("No prototype found",i,i.prototype,i.constructor);return}const t=KO.get(e);t&&t.apply(i)}function g7(i){const e=v7(i.prototype);KO.set(i,e)}function v7(i){return new A7(i)}class A7{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 $m=(i=>(i.Added="component-added",i.Removing="removing-component",i))($m||{});const JO=oe("debugcomponentevents");class eg{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),JO&&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(JO&&console.log("Dispatching event "+e,s),!!s)for(const r of s)r(t)}}h(eg,"eventListeners",new Map);const aE=oe("debuggetcomponent");function y7(i){return i==null||i.isObject3D?i:i.object&&i.object.isObject3D?i.object:i}function lE(i,e){if(!i||!i.userData.components)return;const t=i.userData.components.indexOf(e);t<0||(eg.dispatchComponentLifecycleEvent($m.Removing,e),e.gameObject=null,i.userData.components.splice(t,1))}function Q0(i,e){const t=dp(i,e);if(t)return t;const s=new e;return jc(i,s)}const ZO=new or("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=ZO.generateUUID()),Y0(i),jb(e);try{t&&e.__internalAwake&&(Zm(i),e.activeAndEnabled&&e.__internalAwake()),eg.dispatchComponentLifecycleEvent($m.Added,e)}catch(s){console.error(s)}return e}function cE(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=ZO.generateUUID()),jb(e),e}function $O(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??Ft.Current),i.destroy(),i.gameObject=null}let eL=!1;function tL(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"&&(eL||(eL=!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 JU 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 nY extends tA{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 ZU extends $F{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class $U extends eU{constructor(){super()}computeOutputValue(e){this._value=FT(this.getInheritedInput(e))}}class eN extends aU{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 hx)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 hI extends cU{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=sY(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=rY;break;case"pre-line":this._stringCollapser=tN;break;default:this._stringCollapser=oY}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=uY;break;case"pre-wrap":this._inlineCollapser=hY;break;default:this._inlineCollapser=dY}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=aY;break;case"pre":this._inlineWrapper=lY;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 cD={" ":" ","\n":`
|
|
4077
4077
|
`,"\r":"\r"," ":" "},sY=function(n){switch(n){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function rY(n){return tN(n.replace(/\n/g," "))}function tN(n){return n.replace(/[ ]{2,}/g," ")}function oY(n){return n}function aY(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=sN(n,e,i);return fY(n[e-1],t,r,i)}function lY(n,e,t,i){return n[e].lineBreak==="mandatory"}function cY(){return!1}function hY(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&&nN([e],n[1]),t.char&&t.char===`
|
|
4079
|
-
`&&n.length>1&&iN([t],n[n.length-2]),e.offsetX}function uY(n){if(!n[0])return 0;let e=[],t;for(let i=0;i<n.length;i++){const s=n[i];if(s.char&&cD[s.char]&&n.length>i){e.push(s),t=n[i+1];continue}break}nN(e,t),e=[],t=null;for(let i=n.length-1;i>0;i--){const s=n[i];if(s.char&&cD[s.char]&&i>0){e.push(s),t=n[i-1];continue}break}return iN(e,t),n[0].offsetX}function dY(n){return n[0]?n[0].offsetX:0}function iN(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 nN(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 sN(n,e,t,i){if(i=i||0,!n[e])return i;const s=n[e];return s.lineBreak?i+s.xadvance:sN(n,e+1,t,i+s.xadvance+s.xoffset+s.kerning+t.LETTERSPACING)}function fY(n,e,t,i){return!n||!n.char||e+t<i.INNER_WIDTH?!1:i.BREAKON.indexOf(n.char)>-1}class rN extends hU{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 oN 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 aN extends uU{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 pY extends aN{constructor(){super(),this._value="inherit"}}class mY extends ux{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 lN extends vi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function gY(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=hD(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=hD(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 hD(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 AY 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=gY(t);e.setFontMesh(new He.Mesh(i,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class vY extends NT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class dp extends tv{constructor(t={}){const i={};dp.definePropertiesValues(i,t);super(i,t);h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});dp.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=lN),t.textContent||(t.textContent=$X),t.glyphs||(t.glyphs=tY),t.inlines||(t.inlines=eY),t.layouter||(t.layouter=JU),t.renderer||(t.renderer=AY),t.fontFamily||(t.fontFamily=eN),t.fontWeight||(t.fontWeight=$U),t.fontStyle||(t.fontStyle=ZU),t.fontSize||(t.fontSize=oN),t.color||(t.color=iY),t.backgroundColor||(t.backgroundColor=nY),t.lineBreak||(t.lineBreak=KU),t.letterSpacing||(t.letterSpacing=rN),t.whiteSpace||(t.whiteSpace=hI),t.segments||(t.segments=pY),t.textAlign||(t.textAlign=vY),t.fontKerning||(t.fontKerning=mY)}static init(t){Object.defineProperties(t,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class yY extends ZF{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 dp({name:"anonymousInline",textContent:this._value}))}}class bY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class _Y 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 bY(new lD);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 lD(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 xY extends NT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){wY(e),e._renderer._needsRender=!0}}function wY(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=SY(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 SY(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 CY extends zT{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class EY extends lU{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class MY extends ux{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class TY extends qU{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class IY 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 RY 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 PY extends YU{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 oA extends sA{constructor(e={},t={}){oA.definePropertiesValues(t,e),super(t,e),oA.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=CY,e.justifyContent=GT,e.alignItems=UT,e.bounds=TY,e.autoSize=RY,e.renderer=PY,e.children||(e.children=IY),e.textContent||(e.textContent=yY),e.layouter||(e.layouter=_Y),e.lineHeight||(e.lineHeight=EY),e.textAlign||(e.textAlign=xY),e.whiteSpace||(e.whiteSpace=hI),e.fontKerning||(e.fontKerning=MY),e.segments||(e.segments=aN),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class BY 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 DY extends vi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new XU(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 OY 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 aA extends tv{constructor(e={}){const t={};aA.definePropertiesValues(t,e),super(t,e),aA.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=lN),e.bounds||(e.bounds=OY),e.inlines||(e.inlines=BY),e.layouter||(e.layouter=JU),e.renderer||(e.renderer=DY),e.fontFamily||(e.fontFamily=eN),e.fontWeight||(e.fontWeight=$U),e.fontStyle||(e.fontStyle=ZU),e.fontSize||(e.fontSize=oN),e.backgroundColor||(e.backgroundColor=YF),e.lineBreak||(e.lineBreak=KU),e.letterSpacing||(e.letterSpacing=rN),e.whiteSpace||(e.whiteSpace=hI),e.fontKerning||(e.fontKerning=ux),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 kY(e)],e.backgroundMaterial=new jU,e._renderer.render(e)}}class kY extends nU{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 cN{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 hN=()=>Vb.update(),uN={BaseProperty:vi,Block:rA,Text:oA,Inline:dp,InlineBlock:aA,MeshUIBaseElement:tv,FontLibrary:Yu,update:hN,MSDFFontMaterialUtils:Oo,ShaderChunkUI:WU,Behavior:cN,FontVariant:JA};typeof global<"u"&&(global.ThreeMeshUI=uN);const LY=uN;var FY=Ln.w8,dN=Ln.cg,uI=Ln.gO,UY=Ln.wb,tM=Ln.zV,NY=Ln.HS,zY=Ln.Ec,Q0=Ln.gF,GY=Ln.ol,HY=Ln.pz,VY=Ln.tx,QY=Ln.hj,WY=Ln.FV,jY=Ln.sV,dI=Ln.xv,qY=Ln.mx,XY=Ln.gE,pf=Ln.ZP,fN=Ln.Vx;const BS=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:FY,Behavior:dN,Block:uI,DefaultValues:UY,FontLibrary:tM,FontVariant:NY,InheritableProperty:zY,Inline:Q0,InlineBlock:GY,InlineGlyph:HY,MSDFFontMaterialUtils:VY,MaterialTransformers:QY,MeshUIBaseElement:WY,ShaderChunkUI:jY,Text:dI,TypographicFont:qY,TypographicGlyph:XY,default:pf,update:fN},Symbol.toStringTag,{value:"Module"}));function Uu(n,e){try{e?n(e):n()}catch(t){return console.error(t),!1}return!0}const pN=re("debugdefines");Ax('if(!globalThis[""3.31.3""]) globalThis[""3.31.3""] = "0.0.0";');Ax('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');Ax('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.3";');Ax('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Ya="3.31.3",gx="undefined";pN&&console.log(`Engine version: ${Ya} (generator: ${gx})`);const oc="needle_isActiveInHierarchy",_u="builtin_components",Ag="needle_editor_guid";function Ax(n){try{(0,eval)(n)}catch(e){pN&&console.error(e)}}const iM=re("debugnewscripts"),YY=re("debughierarchy"),Hi=[];function KY(){return Hi.length>0}function Wb(n){if(!(n.new_scripts.length<=0)){if(iM&&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}Hi.length=0,n.new_scripts.length>0&&Hi.push(...n.new_scripts),n.new_scripts.length=0;for(let e=0;e<Hi.length;e++)try{const t=Hi[e];if(t.isComponent!==!0){(Vt()||iM)&&console.error(`Registered script is not a Needle Engine component.
|
|
4079
|
+
`&&n.length>1&&iN([t],n[n.length-2]),e.offsetX}function uY(n){if(!n[0])return 0;let e=[],t;for(let i=0;i<n.length;i++){const s=n[i];if(s.char&&cD[s.char]&&n.length>i){e.push(s),t=n[i+1];continue}break}nN(e,t),e=[],t=null;for(let i=n.length-1;i>0;i--){const s=n[i];if(s.char&&cD[s.char]&&i>0){e.push(s),t=n[i-1];continue}break}return iN(e,t),n[0].offsetX}function dY(n){return n[0]?n[0].offsetX:0}function iN(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 nN(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 sN(n,e,t,i){if(i=i||0,!n[e])return i;const s=n[e];return s.lineBreak?i+s.xadvance:sN(n,e+1,t,i+s.xadvance+s.xoffset+s.kerning+t.LETTERSPACING)}function fY(n,e,t,i){return!n||!n.char||e+t<i.INNER_WIDTH?!1:i.BREAKON.indexOf(n.char)>-1}class rN extends hU{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 oN 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 aN extends uU{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 pY extends aN{constructor(){super(),this._value="inherit"}}class mY extends ux{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 lN extends vi{constructor(){super("children",null,!1),this._uis=[]}update(e,t){}process(e){}_compute(e){}dispose(){}}function gY(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=hD(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=hD(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 hD(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 AY 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=gY(t);e.setFontMesh(new He.Mesh(i,e.fontMaterial)),e._fontMesh.renderOrder=1/0}}class vY extends NT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(e){this._value=this._inheritedInput,e._layouter._needsProcess=!0}}class dp extends tv{constructor(t={}){const i={};dp.definePropertiesValues(i,t);super(i,t);h(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});dp.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=lN),t.textContent||(t.textContent=$X),t.glyphs||(t.glyphs=tY),t.inlines||(t.inlines=eY),t.layouter||(t.layouter=JU),t.renderer||(t.renderer=AY),t.fontFamily||(t.fontFamily=eN),t.fontWeight||(t.fontWeight=$U),t.fontStyle||(t.fontStyle=ZU),t.fontSize||(t.fontSize=oN),t.color||(t.color=iY),t.backgroundColor||(t.backgroundColor=nY),t.lineBreak||(t.lineBreak=KU),t.letterSpacing||(t.letterSpacing=rN),t.whiteSpace||(t.whiteSpace=hI),t.segments||(t.segments=pY),t.textAlign||(t.textAlign=vY),t.fontKerning||(t.fontKerning=mY)}static init(t){Object.defineProperties(t,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class yY extends ZF{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 dp({name:"anonymousInline",textContent:this._value}))}}class bY extends Array{constructor(...e){super(...e),this.width=0,this.height=0}}class _Y 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 bY(new lD);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 lD(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 xY extends NT{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput,this._needsProcess=!0}process(e){wY(e),e._renderer._needsRender=!0}}function wY(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=SY(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 SY(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 CY extends zT{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(e){this._value=this._inheritedInput}}class EY extends lU{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class MY extends ux{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(e){super._computeFromInherited(e)}}class TY extends qU{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class IY 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 RY 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 PY extends YU{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 oA extends sA{constructor(e={},t={}){oA.definePropertiesValues(t,e),super(t,e),oA.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=CY,e.justifyContent=GT,e.alignItems=UT,e.bounds=TY,e.autoSize=RY,e.renderer=PY,e.children||(e.children=IY),e.textContent||(e.textContent=yY),e.layouter||(e.layouter=_Y),e.lineHeight||(e.lineHeight=EY),e.textAlign||(e.textAlign=xY),e.whiteSpace||(e.whiteSpace=hI),e.fontKerning||(e.fontKerning=MY),e.segments||(e.segments=aN),t.width||(t.width="100%"),t.fontSide||(t.fontSide=0)}static init(e){Object.defineProperties(e,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class BY 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 DY extends vi{constructor(){super("renderer")}render(e){e._backgroundMesh||e.setBackgroundMesh(new XU(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 OY 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 aA extends tv{constructor(e={}){const t={};aA.definePropertiesValues(t,e),super(t,e),aA.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=lN),e.bounds||(e.bounds=OY),e.inlines||(e.inlines=BY),e.layouter||(e.layouter=JU),e.renderer||(e.renderer=DY),e.fontFamily||(e.fontFamily=eN),e.fontWeight||(e.fontWeight=$U),e.fontStyle||(e.fontStyle=ZU),e.fontSize||(e.fontSize=oN),e.backgroundColor||(e.backgroundColor=YF),e.lineBreak||(e.lineBreak=KU),e.letterSpacing||(e.letterSpacing=rN),e.whiteSpace||(e.whiteSpace=hI),e.fontKerning||(e.fontKerning=ux),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 kY(e)],e.backgroundMaterial=new jU,e._renderer.render(e)}}class kY extends nU{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 cN{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 hN=()=>Vb.update(),uN={BaseProperty:vi,Block:rA,Text:oA,Inline:dp,InlineBlock:aA,MeshUIBaseElement:tv,FontLibrary:Yu,update:hN,MSDFFontMaterialUtils:Oo,ShaderChunkUI:WU,Behavior:cN,FontVariant:JA};typeof global<"u"&&(global.ThreeMeshUI=uN);const LY=uN;var FY=Ln.w8,dN=Ln.cg,uI=Ln.gO,UY=Ln.wb,tM=Ln.zV,NY=Ln.HS,zY=Ln.Ec,Q0=Ln.gF,GY=Ln.ol,HY=Ln.pz,VY=Ln.tx,QY=Ln.hj,WY=Ln.FV,jY=Ln.sV,dI=Ln.xv,qY=Ln.mx,XY=Ln.gE,pf=Ln.ZP,fN=Ln.Vx;const BS=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:FY,Behavior:dN,Block:uI,DefaultValues:UY,FontLibrary:tM,FontVariant:NY,InheritableProperty:zY,Inline:Q0,InlineBlock:GY,InlineGlyph:HY,MSDFFontMaterialUtils:VY,MaterialTransformers:QY,MeshUIBaseElement:WY,ShaderChunkUI:jY,Text:dI,TypographicFont:qY,TypographicGlyph:XY,default:pf,update:fN},Symbol.toStringTag,{value:"Module"}));function Uu(n,e){try{e?n(e):n()}catch(t){return console.error(t),!1}return!0}const pN=re("debugdefines");Ax('if(!globalThis[""3.31.5""]) globalThis[""3.31.5""] = "0.0.0";');Ax('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');Ax('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.5";');Ax('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Ya="3.31.5",gx="undefined";pN&&console.log(`Engine version: ${Ya} (generator: ${gx})`);const oc="needle_isActiveInHierarchy",_u="builtin_components",Ag="needle_editor_guid";function Ax(n){try{(0,eval)(n)}catch(e){pN&&console.error(e)}}const iM=re("debugnewscripts"),YY=re("debughierarchy"),Hi=[];function KY(){return Hi.length>0}function Wb(n){if(!(n.new_scripts.length<=0)){if(iM&&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}Hi.length=0,n.new_scripts.length>0&&Hi.push(...n.new_scripts),n.new_scripts.length=0;for(let e=0;e<Hi.length;e++)try{const t=Hi[e];if(t.isComponent!==!0){(Vt()||iM)&&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),Hi.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.error("MISSING GAMEOBJECT - will ignore",t),Hi.splice(e,1),e--;continue}t.context=n,vg(t.gameObject),fI(t,n)}catch(t){console.error(t),Hl(Hi[e],n),Hi.splice(e,1),e--}for(let e=0;e<Hi.length;e++)try{const t=Hi[e];if(t.destroyed){Hl(Hi[e],n),Hi.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),vg(t.gameObject),t.activeAndEnabled&&Uu(t.__internalAwake.bind(t)))}catch(t){console.error(t),Hl(Hi[e],n),Hi.splice(e,1),e--}for(let e=0;e<Hi.length;e++)try{const t=Hi[e];if(t.destroyed||t.enabled===!1||(vg(t.gameObject),t.activeAndEnabled===!1))continue;t.__internalEnable!==void 0&&(t.enabled=!0,Uu(t.__internalEnable.bind(t)))}catch(t){console.error(t),Hl(Hi[e],n),Hi.splice(e,1),e--}for(let e=0;e<Hi.length;e++)try{const t=Hi[e];if(t.destroyed||!t.gameObject)continue;n.new_script_start.push(t)}catch(t){console.error(t),Hl(Hi[e],n),Hi.splice(e,1),e--}Hi.length=0;for(const e of n.new_scripts_post_setup_callbacks)e&&e();n.new_scripts_post_setup_callbacks.length=0}}function JY(n){n&&(n.__internalDisable(!0),Hl(n,n.context))}function mN(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 fI(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 W0(n){if(n||(n=Ri.Current.scene),!n){console.trace("Invalid call - no current context.");return}const e=Ip(n);gN(n,e,!0)||(iM||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 gN(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=Ip(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&&(YY&&console.warn("ACTIVE CHANGE",n.name,s,n.visible,e,"changed?"+o,n),t&&ZY(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)gN(c,e,t,l)===!1&&(a=!1)}return a}function vg(n){let e=!0,t=n,i=!1;for(;t&&t;){if(t.type==="Scene"&&(i=!0),!Ip(t)){e=!1;break}t=t.parent}if(!n){console.error("GO is null");return}n[oc]=e&&i}function ZY(n,e){var t;if((t=n.userData)!=null&&t.components)for(const i of n.userData.components)e(i)}const j0=new Map,AN=Symbol("prewarmFlag"),nM=Symbol("waitingForPrewarm"),sM=re("debugprewarm");function vN(n,e){if(!n||n[AN]===!0||n[nM]===!0)return;j0.has(e)||j0.set(e,[]),n[nM]=!0,j0.get(e).push(n),sM&&console.debug("register prewarm",n.name)}let uD=null,dD=null;function $Y(n){if(!n)return;const e=j0.get(n);if(!(e!=null&&e.length))return;const t=n.mainCamera;if(t){sM&&console.log("prewarm",e.length,"objects",[...e]);const i=n.renderer;if(i.compile){const s=n.scene;i.compile(s,t),uD??(uD=new q1(64)),dD??(dD=new j1(.001,9999999,uD)),dD.update(i,s);for(const r of e)r[AN]=!0,r[nM]=!1;e.length=0,sM&&console.log("prewarm done")}}}const e7=/^(?:[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 t7(n){return typeof n=="string"&&e7.test(n)}const vs=[];for(let n=0;n<256;++n)vs.push((n+256).toString(16).slice(1));function i7(n,e=0){return vs[n[e+0]]+vs[n[e+1]]+vs[n[e+2]]+vs[n[e+3]]+"-"+vs[n[e+4]]+vs[n[e+5]]+"-"+vs[n[e+6]]+vs[n[e+7]]+"-"+vs[n[e+8]]+vs[n[e+9]]+"-"+vs[n[e+10]]+vs[n[e+11]]+vs[n[e+12]]+vs[n[e+13]]+vs[n[e+14]]+vs[n[e+15]]}function n7(n){if(!t7(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 s7(n){n=unescape(encodeURIComponent(n));const e=[];for(let t=0;t<n.length;++t)e.push(n.charCodeAt(t));return e}const r7="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o7="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function a7(n,e,t){function i(s,r,o,a){var l;if(typeof s=="string"&&(s=s7(s)),typeof r=="string"&&(r=n7(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 i7(c)}try{i.name=n}catch{}return i.DNS=r7,i.URL=o7,i}function l7(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 DS(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]=DS(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=DS(l,5)+l7(m,c,u,d)+f+e[m]+a[p]>>>0;f=d,d=u,u=DS(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 h7=a7("v5",80,c7),fD=h7;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||{});Ri.registerCallback(ns.ContextCreated,n=>{const e=n.context;wN(e),xN(e)});const jb=re("debugcomponents"),pD="eff8ba80-635d-11ec-90d6-0242ac120003";class as{constructor(e){h(this,"_originalSeed");h(this,"_seed");typeof e=="string"&&(e=as.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 fD(e,pD);const t=this._seed;return this._seed-=1,fD(t.toString(),pD)}initialize(e){typeof e=="string"?this._seed=as.hash(e):this._seed=e}static createFromString(e){return new as(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 yN=(n=>(n.NewInstanceCreated="new-instance-created",n.InstanceDestroyed="instance-destroyed",n))(yN||{});class bN{constructor(e){h(this,"guid");this.guid=e}}function vx(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 bN(s);e.send("instance-destroyed",r,qr.Queued)}function _N(n,e){const t=new bN(n);e.send("instance-destroyed",t,qr.Queued)}function xN(n){n.connection.beginListen("instance-destroyed",e=>{jb&&console.log("[Remote] Destroyed",n.scene,e);const t=lv(e.guid,n.scene);t&&ol(t)})}class u7{constructor(e,t,i){h(this,"filename");h(this,"hash");h(this,"size");this.filename=e,this.hash=t,this.size=i}}class d7{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 pI(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=Ut.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}=f7(s,e);if(o){const c=o;if(c.guid){jb&&console.log("[Local] new instance","gameobject:",o==null?void 0:o.guid);const u=new d7(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 yx(){return Math.random()*9999999}function wN(n){n.connection.beginListen("new-instance-created",async e=>{const t=await p7(e.originalGuid,n.scene);if(!t){console.warn("could not find object that was instantiated: "+e.guid);return}const i=new Ea;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 as(e.seed)),i.visible=e.visible,i.context=n,jb&&n.alias&&console.log("[Remote] instantiate in: "+n.alias);const s=cv(t,i);s&&(e.parent==="scene"&&n.scene.add(s),jb&&console.log("[Remote] new instance","gameobject:",s==null?void 0:s.guid,t))})}function f7(n,e){const t=yx(),i=e??new Ea;i.idProvider=new as(t);const s=cv(n,i);return{seed:t,instance:s}}const SN={};function CN(n,e){SN[n]=e}async function p7(n,e){const t=SN[n];if(t!=null){const i=await t(n);if(i)return i}return EN(n,e)}function EN(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=EN(n,t);if(i)return i}return null}const MN=new Map;function m7(n,e){if(!n)return;if(!e){console.warn("No prototype found",n,n.prototype,n.constructor);return}const t=MN.get(e);t&&t.apply(n)}function g7(n){const e=A7(n.prototype);MN.set(n,e)}function A7(n){return new v7(n)}class v7{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 iv=(n=>(n.Added="component-added",n.Removing="removing-component",n))(iv||{});const mD=re("debugcomponentevents");class nv{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),mD&&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(mD&&console.log("Dispatching event "+e,i),!!i)for(const s of i)s(t)}}h(nv,"eventListeners",new Map);const OS=re("debuggetcomponent");function y7(n){return n==null||n.isObject3D?n:n.object&&n.object.isObject3D?n.object:n}function mI(n,e){if(!n||!n.userData.components)return;const t=n.userData.components.indexOf(e);t<0||(nv.dispatchComponentLifecycleEvent(iv.Removing,e),e.gameObject=null,n.userData.components.splice(t,1))}function bx(n,e){const t=Tp(n,e);if(t)return t;const i=new e;return Mh(n,i)}const TN=new as("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=TN.generateUUID()),xx(n),Fx(e);try{t&&e.__internalAwake&&(vg(n),e.activeAndEnabled&&e.__internalAwake()),nv.dispatchComponentLifecycleEvent(iv.Added,e)}catch(i){console.error(i)}return e}function gI(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=TN.generateUUID()),Fx(e),e}function IN(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??Ut.Current),n.destroy(),n.gameObject=null}let gD=!1;function RN(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"&&(gD||(gD=!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 CL 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 NX 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 sL extends tq{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class aL extends gq{constructor(){super()}computeOutputValue(A){this._value=Fk(this.getInheritedInput(A))}}class nL extends nq{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 ID)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 cG extends Bq{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=FX(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=KX;break;case"pre-line":this._stringCollapser=BL;break;default:this._stringCollapser=JX}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=xX;break;case"pre-wrap":this._inlineCollapser=LX;break;default:this._inlineCollapser=YX}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=vX;break;case"pre":this._inlineWrapper=bX;break;default:this._inlineWrapper=qX}this._needsProcess=!0}process(A){A.isInline&&!A.isInlineBlock&&(this._whiteSpacedContent=this._stringCollapser(A._textContent._value),A._glyphs._needsProcess=!0)}}const rL={" ":" ","\n":`
|
|
4077
4077
|
`,"\r":"\r"," ":" "},FX=function(t){switch(t){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function KX(t){return BL(t.replace(/\n/g," "))}function BL(t){return t.replace(/[ ]{2,}/g," ")}function JX(t){return t}function vX(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=hL(t,A,g);return TX(t[A-1],e,I,g)}function bX(t,A,e,g){return t[A].lineBreak==="mandatory"}function qX(){return!1}function LX(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&&EL([A],t[1]),e.char&&e.char===`
|
|
4079
|
-
`&&t.length>1&&QL([e],t[t.length-2]),A.offsetX}function xX(t){if(!t[0])return 0;let A=[],e;for(let g=0;g<t.length;g++){const i=t[g];if(i.char&&rL[i.char]&&t.length>g){A.push(i),e=t[g+1];continue}break}EL(A,e),A=[],e=null;for(let g=t.length-1;g>0;g--){const i=t[g];if(i.char&&rL[i.char]&&g>0){A.push(i),e=t[g-1];continue}break}return QL(A,e),t[0].offsetX}function YX(t){return t[0]?t[0].offsetX:0}function QL(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 EL(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 hL(t,A,e,g){if(g=g||0,!t[A])return g;const i=t[A];return i.lineBreak?g+i.xadvance:hL(t,A+1,e,g+i.xadvance+i.xoffset+i.kerning+e.LETTERSPACING)}function TX(t,A,e,g){return!t||!t.char||A+e<g.INNER_WIDTH?!1:g.BREAKON.indexOf(t.char)>-1}class cL extends Qq{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 lL 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 dL extends Eq{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 HX extends dL{constructor(){super(),this._value="inherit"}}class OX extends CD{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 uL extends dt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function _X(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=pL(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=pL(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 pL(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 PX 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=_X(e);A.setFontMesh(new _A.Mesh(g,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class jX extends vk{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class yh extends Mc{constructor(A={}){const e={};yh.definePropertiesValues(e,A),super(e,A),n(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),yh.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=uL),A.textContent||(A.textContent=GX),A.glyphs||(A.glyphs=RX),A.inlines||(A.inlines=MX),A.layouter||(A.layouter=CL),A.renderer||(A.renderer=PX),A.fontFamily||(A.fontFamily=nL),A.fontWeight||(A.fontWeight=aL),A.fontStyle||(A.fontStyle=sL),A.fontSize||(A.fontSize=lL),A.color||(A.color=UX),A.backgroundColor||(A.backgroundColor=NX),A.lineBreak||(A.lineBreak=oL),A.letterSpacing||(A.letterSpacing=cL),A.whiteSpace||(A.whiteSpace=cG),A.segments||(A.segments=HX),A.textAlign||(A.textAlign=jX),A.fontKerning||(A.fontKerning=OX)}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class WX extends eq{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 yh({name:"anonymousInline",textContent:this._value}))}}class VX extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class ZX 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 VX(new IL);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 IL(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 zX extends vk{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){XX(A),A._renderer._needsRender=!0}}function XX(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=$X(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 $X(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 A9 extends bk{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class e9 extends rq{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class t9 extends CD{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class g9 extends eL{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class i9 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 I9 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 o9 extends iL{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 ru extends au{constructor(A={},e={}){ru.definePropertiesValues(e,A),super(e,A),ru.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=A9,A.justifyContent=qk,A.alignItems=Jk,A.bounds=g9,A.autoSize=I9,A.renderer=o9,A.children||(A.children=i9),A.textContent||(A.textContent=WX),A.layouter||(A.layouter=ZX),A.lineHeight||(A.lineHeight=e9),A.textAlign||(A.textAlign=zX),A.whiteSpace||(A.whiteSpace=cG),A.fontKerning||(A.fontKerning=t9),A.segments||(A.segments=dL),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class C9 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 gL(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 a9 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 Bu extends Mc{constructor(A={}){const e={};Bu.definePropertiesValues(e,A),super(e,A),Bu.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=uL),A.bounds||(A.bounds=a9),A.inlines||(A.inlines=C9),A.layouter||(A.layouter=CL),A.renderer||(A.renderer=s9),A.fontFamily||(A.fontFamily=nL),A.fontWeight||(A.fontWeight=aL),A.fontStyle||(A.fontStyle=sL),A.fontSize||(A.fontSize=lL),A.backgroundColor||(A.backgroundColor=Xb),A.lineBreak||(A.lineBreak=oL),A.letterSpacing||(A.letterSpacing=cL),A.whiteSpace||(A.whiteSpace=cG),A.fontKerning||(A.fontKerning=CD),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 n9(A)],A.backgroundMaterial=new AL,A._renderer.render(A)}}class n9 extends oq{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 DL{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 yL=()=>cD.update(),wL={BaseProperty:dt,Block:nu,Text:ru,Inline:yh,InlineBlock:Bu,MeshUIBaseElement:Mc,FontLibrary:br,update:yL,MSDFFontMaterialUtils:AC,ShaderChunkUI:$q,Behavior:DL,FontVariant:Dc};typeof global<"u"&&(global.ThreeMeshUI=wL);const r9=wL;var B9=bg.w8,SL=bg.cg,lG=bg.gO,Q9=bg.wb,dG=bg.zV,E9=bg.HS,h9=bg.Ec,dD=bg.gF,c9=bg.ol,l9=bg.pz,d9=bg.tx,u9=bg.hj,p9=bg.FV,D9=bg.sV,uG=bg.xv,y9=bg.mx,w9=bg.gE,bQ=bg.ZP,fL=bg.Vx;const pG=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:B9,Behavior:SL,Block:lG,DefaultValues:Q9,FontLibrary:dG,FontVariant:E9,InheritableProperty:h9,Inline:dD,InlineBlock:c9,InlineGlyph:l9,MSDFFontMaterialUtils:d9,MaterialTransformers:u9,MeshUIBaseElement:p9,ShaderChunkUI:D9,Text:uG,TypographicFont:y9,TypographicGlyph:w9,default:bQ,update:fL},Symbol.toStringTag,{value:"Module"}));function Lr(t,A){try{A?t(A):t()}catch(e){return console.error(e),!1}return!0}const mL=sA("debugdefines");pD('if(!globalThis[""3.31.3""]) globalThis[""3.31.3""] = "0.0.0";'),pD('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),pD('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.3";'),pD('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Os="3.31.3",uD="undefined";mL&&console.log(`Engine version: ${Os} (generator: ${uD})`);const _s="needle_isActiveInHierarchy",xr="builtin_components",Rc="needle_editor_guid";function pD(t){try{(0,eval)(t)}catch(A){mL&&console.error(A)}}const DG=sA("debugnewscripts"),S9=sA("debughierarchy"),Wt=[];function f9(){return Wt.length>0}function DD(t){if(!(t.new_scripts.length<=0)){if(DG&&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){(Te()||DG)&&console.error(`Registered script is not a Needle Engine component.
|
|
4079
|
+
`&&t.length>1&&QL([e],t[t.length-2]),A.offsetX}function xX(t){if(!t[0])return 0;let A=[],e;for(let g=0;g<t.length;g++){const i=t[g];if(i.char&&rL[i.char]&&t.length>g){A.push(i),e=t[g+1];continue}break}EL(A,e),A=[],e=null;for(let g=t.length-1;g>0;g--){const i=t[g];if(i.char&&rL[i.char]&&g>0){A.push(i),e=t[g-1];continue}break}return QL(A,e),t[0].offsetX}function YX(t){return t[0]?t[0].offsetX:0}function QL(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 EL(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 hL(t,A,e,g){if(g=g||0,!t[A])return g;const i=t[A];return i.lineBreak?g+i.xadvance:hL(t,A+1,e,g+i.xadvance+i.xoffset+i.kerning+e.LETTERSPACING)}function TX(t,A,e,g){return!t||!t.char||A+e<g.INNER_WIDTH?!1:g.BREAKON.indexOf(t.char)>-1}class cL extends Qq{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 lL 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 dL extends Eq{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 HX extends dL{constructor(){super(),this._value="inherit"}}class OX extends CD{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 uL extends dt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function _X(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=pL(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=pL(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 pL(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 PX 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=_X(e);A.setFontMesh(new _A.Mesh(g,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class jX extends vk{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class yh extends Mc{constructor(A={}){const e={};yh.definePropertiesValues(e,A),super(e,A),n(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0}),yh.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=uL),A.textContent||(A.textContent=GX),A.glyphs||(A.glyphs=RX),A.inlines||(A.inlines=MX),A.layouter||(A.layouter=CL),A.renderer||(A.renderer=PX),A.fontFamily||(A.fontFamily=nL),A.fontWeight||(A.fontWeight=aL),A.fontStyle||(A.fontStyle=sL),A.fontSize||(A.fontSize=lL),A.color||(A.color=UX),A.backgroundColor||(A.backgroundColor=NX),A.lineBreak||(A.lineBreak=oL),A.letterSpacing||(A.letterSpacing=cL),A.whiteSpace||(A.whiteSpace=cG),A.segments||(A.segments=HX),A.textAlign||(A.textAlign=jX),A.fontKerning||(A.fontKerning=OX)}static init(A){Object.defineProperties(A,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class WX extends eq{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 yh({name:"anonymousInline",textContent:this._value}))}}class VX extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class ZX 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 VX(new IL);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 IL(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 zX extends vk{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){XX(A),A._renderer._needsRender=!0}}function XX(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=$X(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 $X(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 A9 extends bk{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class e9 extends rq{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class t9 extends CD{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class g9 extends eL{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class i9 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 I9 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 o9 extends iL{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 ru extends au{constructor(A={},e={}){ru.definePropertiesValues(e,A),super(e,A),ru.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=A9,A.justifyContent=qk,A.alignItems=Jk,A.bounds=g9,A.autoSize=I9,A.renderer=o9,A.children||(A.children=i9),A.textContent||(A.textContent=WX),A.layouter||(A.layouter=ZX),A.lineHeight||(A.lineHeight=e9),A.textAlign||(A.textAlign=zX),A.whiteSpace||(A.whiteSpace=cG),A.fontKerning||(A.fontKerning=t9),A.segments||(A.segments=dL),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class C9 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 gL(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 a9 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 Bu extends Mc{constructor(A={}){const e={};Bu.definePropertiesValues(e,A),super(e,A),Bu.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=uL),A.bounds||(A.bounds=a9),A.inlines||(A.inlines=C9),A.layouter||(A.layouter=CL),A.renderer||(A.renderer=s9),A.fontFamily||(A.fontFamily=nL),A.fontWeight||(A.fontWeight=aL),A.fontStyle||(A.fontStyle=sL),A.fontSize||(A.fontSize=lL),A.backgroundColor||(A.backgroundColor=Xb),A.lineBreak||(A.lineBreak=oL),A.letterSpacing||(A.letterSpacing=cL),A.whiteSpace||(A.whiteSpace=cG),A.fontKerning||(A.fontKerning=CD),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 n9(A)],A.backgroundMaterial=new AL,A._renderer.render(A)}}class n9 extends oq{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 DL{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 yL=()=>cD.update(),wL={BaseProperty:dt,Block:nu,Text:ru,Inline:yh,InlineBlock:Bu,MeshUIBaseElement:Mc,FontLibrary:br,update:yL,MSDFFontMaterialUtils:AC,ShaderChunkUI:$q,Behavior:DL,FontVariant:Dc};typeof global<"u"&&(global.ThreeMeshUI=wL);const r9=wL;var B9=bg.w8,SL=bg.cg,lG=bg.gO,Q9=bg.wb,dG=bg.zV,E9=bg.HS,h9=bg.Ec,dD=bg.gF,c9=bg.ol,l9=bg.pz,d9=bg.tx,u9=bg.hj,p9=bg.FV,D9=bg.sV,uG=bg.xv,y9=bg.mx,w9=bg.gE,bQ=bg.ZP,fL=bg.Vx;const pG=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:B9,Behavior:SL,Block:lG,DefaultValues:Q9,FontLibrary:dG,FontVariant:E9,InheritableProperty:h9,Inline:dD,InlineBlock:c9,InlineGlyph:l9,MSDFFontMaterialUtils:d9,MaterialTransformers:u9,MeshUIBaseElement:p9,ShaderChunkUI:D9,Text:uG,TypographicFont:y9,TypographicGlyph:w9,default:bQ,update:fL},Symbol.toStringTag,{value:"Module"}));function Lr(t,A){try{A?t(A):t()}catch(e){return console.error(e),!1}return!0}const mL=sA("debugdefines");pD('if(!globalThis[""3.31.5""]) globalThis[""3.31.5""] = "0.0.0";'),pD('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),pD('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.5";'),pD('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const Os="3.31.5",uD="undefined";mL&&console.log(`Engine version: ${Os} (generator: ${uD})`);const _s="needle_isActiveInHierarchy",xr="builtin_components",Rc="needle_editor_guid";function pD(t){try{(0,eval)(t)}catch(A){mL&&console.error(A)}}const DG=sA("debugnewscripts"),S9=sA("debughierarchy"),Wt=[];function f9(){return Wt.length>0}function DD(t){if(!(t.new_scripts.length<=0)){if(DG&&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){(Te()||DG)&&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,Uc(e.gameObject),yG(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),Uc(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||(Uc(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 m9(t){t&&(t.__internalDisable(!0),Ps(t,t.context))}function kL(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 yG(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 yD(t){if(t||(t=Rt.Current.scene),!t){console.trace("Invalid call - no current context.");return}const A=YQ(t);GL(t,A,!0)||(DG||Te()?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 GL(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=YQ(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&&(S9&&console.warn("ACTIVE CHANGE",t.name,i,t.visible,A,"changed?"+I,t),e&&k9(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)GL(s,A,e,C)===!1&&(o=!1)}return o}function Uc(t){let A=!0,e=t,g=!1;for(;e&&e;){if(e.type==="Scene"&&(g=!0),!YQ(e)){A=!1;break}e=e.parent}if(!t){console.error("GO is null");return}t[_s]=A&&g}function k9(t,A){var e;if((e=t.userData)!=null&&e.components)for(const g of t.userData.components)A(g)}const wD=new Map,ML=Symbol("prewarmFlag"),wG=Symbol("waitingForPrewarm"),SG=sA("debugprewarm");function RL(t,A){!t||t[ML]===!0||t[wG]===!0||(wD.has(A)||wD.set(A,[]),t[wG]=!0,wD.get(A).push(t),SG&&console.debug("register prewarm",t.name))}let fG=null,mG=null;function G9(t){if(!t)return;const A=wD.get(t);if(!(A!=null&&A.length))return;const e=t.mainCamera;if(e){SG&&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 gm(64)),mG??(mG=new tm(.001,9999999,fG)),mG.update(g,i);for(const I of A)I[ML]=!0,I[wG]=!1;A.length=0,SG&&console.log("prewarm done")}}}const M9=/^(?:[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 R9(t){return typeof t=="string"&&M9.test(t)}const yi=[];for(let t=0;t<256;++t)yi.push((t+256).toString(16).slice(1));function U9(t,A=0){return yi[t[A+0]]+yi[t[A+1]]+yi[t[A+2]]+yi[t[A+3]]+"-"+yi[t[A+4]]+yi[t[A+5]]+"-"+yi[t[A+6]]+yi[t[A+7]]+"-"+yi[t[A+8]]+yi[t[A+9]]+"-"+yi[t[A+10]]+yi[t[A+11]]+yi[t[A+12]]+yi[t[A+13]]+yi[t[A+14]]+yi[t[A+15]]}function N9(t){if(!R9(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 F9(t){t=unescape(encodeURIComponent(t));const A=[];for(let e=0;e<t.length;++e)A.push(t.charCodeAt(e));return A}const K9="6ba7b810-9dad-11d1-80b4-00c04fd430c8",J9="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function v9(t,A,e){function g(i,I,o,C){var s;if(typeof i=="string"&&(i=F9(i)),typeof I=="string"&&(I=N9(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 U9(a)}try{g.name=t}catch{}return g.DNS=K9,g.URL=J9,g}function b9(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 kG(t,A){return t<<A|t>>>32-A}function q9(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]=kG(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=kG(s,5)+b9(h,a,r,B)+Q+A[h]+C[E]>>>0;Q=B,B=r,r=kG(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 L9=v9("v5",80,q9),UL=L9;var Ao=(t=>(t[t.OnConnection=0]="OnConnection",t[t.OnRoomJoin=1]="OnRoomJoin",t[t.Queued=2]="Queued",t[t.Immediate=3]="Immediate",t))(Ao||{});Rt.registerCallback(Xg.ContextCreated,t=>{const A=t.context;bL(A),vL(A)});const SD=sA("debugcomponents"),NL="eff8ba80-635d-11ec-90d6-0242ac120003";class di{constructor(A){n(this,"_originalSeed"),n(this,"_seed"),typeof A=="string"&&(A=di.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 UL(A,NL);const e=this._seed;return this._seed-=1,UL(e.toString(),NL)}initialize(A){typeof A=="string"?this._seed=di.hash(A):this._seed=A}static createFromString(A){return new di(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 FL=(t=>(t.NewInstanceCreated="new-instance-created",t.InstanceDestroyed="instance-destroyed",t))(FL||{});class KL{constructor(A){n(this,"guid"),this.guid=A}}function fD(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 KL(i);A.send("instance-destroyed",I,Ao.Queued)}function JL(t,A){const e=new KL(t);A.send("instance-destroyed",e,Ao.Queued)}function vL(t){t.connection.beginListen("instance-destroyed",A=>{SD&&console.log("[Remote] Destroyed",t.scene,A);const e=jc(A.guid,t.scene);e&&OC(e)})}class x9{constructor(A,e,g){n(this,"filename"),n(this,"hash"),n(this,"size"),this.filename=A,this.hash=e,this.size=g}}class Y9{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 GG(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=xe.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}=T9(I,A);if(C){const a=C;if(a.guid){SD&&console.log("[Local] new instance","gameobject:",C?.guid);const r=new Y9(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 mD(){return Math.random()*9999999}function bL(t){t.connection.beginListen("new-instance-created",async A=>{const e=await H9(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 w(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 w(A.scale.x,A.scale.y,A.scale.z)),g.parent=A.parent,A.seed&&(g.idProvider=new di(A.seed)),g.visible=A.visible,g.context=t,SD&&t.alias&&console.log("[Remote] instantiate in: "+t.alias);const i=Wc(e,g);i&&(A.parent==="scene"&&t.scene.add(i),SD&&console.log("[Remote] new instance","gameobject:",i?.guid,e))})}function T9(t,A){const e=mD(),g=A??new NC;g.idProvider=new di(e);const i=Wc(t,g);return{seed:e,instance:i}}const qL={};function LL(t,A){qL[t]=A}async function H9(t,A){const e=qL[t];if(e!=null){const g=await e(t);if(g)return g}return xL(t,A)}function xL(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=xL(t,e);if(g)return g}return null}const YL=new Map;function O9(t,A){if(!t)return;if(!A){console.warn("No prototype found",t,t.prototype,t.constructor);return}const e=YL.get(A);e&&e.apply(t)}function _9(t){const A=P9(t.prototype);YL.set(t,A)}function P9(t){return new j9(t)}class j9{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 Nc=(t=>(t.Added="component-added",t.Removing="removing-component",t))(Nc||{});const TL=sA("debugcomponentevents");class Fc{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),TL&&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(TL&&console.log("Dispatching event "+A,g),!!g)for(const i of g)i(e)}}n(Fc,"eventListeners",new Map);const MG=sA("debuggetcomponent");function W9(t){return t==null||t.isObject3D?t:t.object&&t.object.isObject3D?t.object:t}function RG(t,A){if(!t||!t.userData.components)return;const e=t.userData.components.indexOf(A);e<0||(Fc.dispatchComponentLifecycleEvent(Nc.Removing,A),A.gameObject=null,t.userData.components.splice(e,1))}function kD(t,A){const e=qQ(t,A);if(e)return e;const g=new A;return gn(t,g)}const HL=new di("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=HL.generateUUID()),FD(t),fy(A);try{e&&A.__internalAwake&&(Uc(t),A.activeAndEnabled&&A.__internalAwake()),Fc.dispatchComponentLifecycleEvent(Nc.Added,A)}catch(g){console.error(g)}return A}function UG(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=HL.generateUUID()),fy(A),A}function OL(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??xe.Current),t.destroy(),t.gameObject=null}let _L=!1;function PL(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"&&(_L||(_L=!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 FT 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 NX extends Nl{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 KT extends JY{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class JT extends qY{constructor(){super()}computeOutputValue(A){this._value=$R(this.getInheritedInput(A))}}class qT extends HY{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 Bw)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 OY{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=FX(this._value),this._value){case"nowrap":case"normal":this._stringCollapser=KX;break;case"pre-line":this._stringCollapser=bT;break;default:this._stringCollapser=JX}switch(this._value){case"pre-line":case"nowrap":case"normal":this._inlineCollapser=xX;break;case"pre-wrap":this._inlineCollapser=LX;break;default:this._inlineCollapser=YX}switch(this._value){case"pre-line":case"pre-wrap":case"normal":this._inlineWrapper=qX;break;case"pre":this._inlineWrapper=bX;break;default:this._inlineWrapper=vX}this._needsProcess=!0}process(A){A.isInline&&!A.isInlineBlock&&(this._whiteSpacedContent=this._stringCollapser(A._textContent._value),A._glyphs._needsProcess=!0)}}const Aq={" ":" ","\n":`
|
|
4077
4077
|
`,"\r":"\r"," ":" "},FX=function(i){switch(i){case"pre":case"pre-wrap":case"pre-line":return"mandatory"}return null};function KX(i){return bT(i.replace(/\n/g," "))}function bT(i){return i.replace(/[ ]{2,}/g," ")}function JX(i){return i}function qX(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=xT(i,A,t);return TX(i[A-1],e,I,t)}function bX(i,A,e,t){return i[A].lineBreak==="mandatory"}function vX(){return!1}function LX(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&<([A],i[1]),e.char&&e.char===`
|
|
4079
|
-
`&&i.length>1&&vT([e],i[i.length-2]),A.offsetX}function xX(i){if(!i[0])return 0;let A=[],e;for(let t=0;t<i.length;t++){const g=i[t];if(g.char&&Aq[g.char]&&i.length>t){A.push(g),e=i[t+1];continue}break}LT(A,e),A=[],e=null;for(let t=i.length-1;t>0;t--){const g=i[t];if(g.char&&Aq[g.char]&&t>0){A.push(g),e=i[t-1];continue}break}return vT(A,e),i[0].offsetX}function YX(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 LT(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 xT(i,A,e,t){if(t=t||0,!i[A])return t;const g=i[A];return g.lineBreak?t+g.xadvance:xT(i,A+1,e,t+g.xadvance+g.xoffset+g.kerning+e.LETTERSPACING)}function TX(i,A,e,t){return!i||!i.char||A+e<t.INNER_WIDTH?!1:t.BREAKON.indexOf(i.char)>-1}class YT extends PY{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 TT 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 HT extends WY{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 HX extends HT{constructor(){super(),this._value="inherit"}}class _X extends Qw{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 _T extends yt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function OX(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=eq(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=eq(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 eq(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 PX 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=OX(e);A.setFontMesh(new _A.Mesh(t,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class WX extends eU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class KE extends vd{constructor(e={}){const t={};KE.definePropertiesValues(t,e);super(t,e);r(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});KE.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=_T),e.textContent||(e.textContent=MX),e.glyphs||(e.glyphs=RX),e.inlines||(e.inlines=mX),e.layouter||(e.layouter=FT),e.renderer||(e.renderer=PX),e.fontFamily||(e.fontFamily=qT),e.fontWeight||(e.fontWeight=JT),e.fontStyle||(e.fontStyle=KT),e.fontSize||(e.fontSize=TT),e.color||(e.color=UX),e.backgroundColor||(e.backgroundColor=NX),e.lineBreak||(e.lineBreak=NT),e.letterSpacing||(e.letterSpacing=YT),e.whiteSpace||(e.whiteSpace=kU),e.segments||(e.segments=HX),e.textAlign||(e.textAlign=WX),e.fontKerning||(e.fontKerning=_X)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class jX extends KY{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 KE({name:"anonymousInline",textContent:this._value}))}}class VX extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class ZX 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 VX(new $J);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 $J(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 zX extends eU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){XX(A),A._renderer._needsRender=!0}}function XX(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=$X(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 $X(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 A9 extends tU{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class e9 extends _Y{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class t9 extends Qw{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class i9 extends mT{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class g9 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 I9 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 o9 extends UT{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 bl extends Jl{constructor(A={},e={}){bl.definePropertiesValues(e,A),super(e,A),bl.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=A9,A.justifyContent=iU,A.alignItems=AU,A.bounds=i9,A.autoSize=I9,A.renderer=o9,A.children||(A.children=g9),A.textContent||(A.textContent=jX),A.layouter||(A.layouter=ZX),A.lineHeight||(A.lineHeight=e9),A.textAlign||(A.textAlign=zX),A.whiteSpace||(A.whiteSpace=kU),A.fontKerning||(A.fontKerning=t9),A.segments||(A.segments=HT),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class s9 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 C9 extends yt{constructor(){super("renderer")}render(A){A._backgroundMesh||A.setBackgroundMesh(new RT(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 n9 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 vl extends vd{constructor(A={}){const e={};vl.definePropertiesValues(e,A),super(e,A),vl.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=_T),A.bounds||(A.bounds=n9),A.inlines||(A.inlines=s9),A.layouter||(A.layouter=FT),A.renderer||(A.renderer=C9),A.fontFamily||(A.fontFamily=qT),A.fontWeight||(A.fontWeight=JT),A.fontStyle||(A.fontStyle=KT),A.fontSize||(A.fontSize=TT),A.backgroundColor||(A.backgroundColor=UY),A.lineBreak||(A.lineBreak=NT),A.letterSpacing||(A.letterSpacing=YT),A.whiteSpace||(A.whiteSpace=kU),A.fontKerning||(A.fontKerning=Qw),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 a9(A)],A.backgroundMaterial=new MT,A._renderer.render(A)}}class a9 extends LY{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 OT{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 PT=()=>FD.update(),WT={BaseProperty:yt,Block:ql,Text:bl,Inline:KE,InlineBlock:vl,MeshUIBaseElement:vd,FontLibrary:dB,update:PT,MSDFFontMaterialUtils:_o,ShaderChunkUI:GT,Behavior:OT,FontVariant:Kd};typeof global<"u"&&(global.ThreeMeshUI=WT);const r9=WT;var B9=Wi.w8,jT=Wi.cg,GU=Wi.gO,Q9=Wi.wb,fM=Wi.zV,E9=Wi.HS,c9=Wi.Ec,mf=Wi.gF,h9=Wi.ol,l9=Wi.pz,d9=Wi.tx,u9=Wi.hj,p9=Wi.FV,f9=Wi.sV,MU=Wi.xv,D9=Wi.mx,y9=Wi.gE,vQ=Wi.ZP,VT=Wi.Vx;const Ak=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:B9,Behavior:jT,Block:GU,DefaultValues:Q9,FontLibrary:fM,FontVariant:E9,InheritableProperty:c9,Inline:mf,InlineBlock:h9,InlineGlyph:l9,MSDFFontMaterialUtils:d9,MaterialTransformers:u9,MeshUIBaseElement:p9,ShaderChunkUI:f9,Text:MU,TypographicFont:D9,TypographicGlyph:y9,default:vQ,update:VT},Symbol.toStringTag,{value:"Module"}));function sB(i,A){try{A?i(A):i()}catch(e){return console.error(e),!1}return!0}const ZT=sA("debugdefines");uw('if(!globalThis[""3.31.3""]) globalThis[""3.31.3""] = "0.0.0";');uw('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');uw('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.3";');uw('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const IC="3.31.3",dw="undefined";ZT&&console.log(`Engine version: ${IC} (generator: ${dw})`);const pn="needle_isActiveInHierarchy",_r="builtin_components",Vh="needle_editor_guid";function uw(i){try{(0,eval)(i)}catch(A){ZT&&console.error(A)}}const DM=sA("debugnewscripts"),w9=sA("debughierarchy"),Vt=[];function S9(){return Vt.length>0}function JD(i){if(!(i.new_scripts.length<=0)){if(DM&&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}Vt.length=0,i.new_scripts.length>0&&Vt.push(...i.new_scripts),i.new_scripts.length=0;for(let A=0;A<Vt.length;A++)try{const e=Vt[A];if(e.isComponent!==!0){(_e()||DM)&&console.error(`Registered script is not a Needle Engine component.
|
|
4079
|
+
`&&i.length>1&&vT([e],i[i.length-2]),A.offsetX}function xX(i){if(!i[0])return 0;let A=[],e;for(let t=0;t<i.length;t++){const g=i[t];if(g.char&&Aq[g.char]&&i.length>t){A.push(g),e=i[t+1];continue}break}LT(A,e),A=[],e=null;for(let t=i.length-1;t>0;t--){const g=i[t];if(g.char&&Aq[g.char]&&t>0){A.push(g),e=i[t-1];continue}break}return vT(A,e),i[0].offsetX}function YX(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 LT(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 xT(i,A,e,t){if(t=t||0,!i[A])return t;const g=i[A];return g.lineBreak?t+g.xadvance:xT(i,A+1,e,t+g.xadvance+g.xoffset+g.kerning+e.LETTERSPACING)}function TX(i,A,e,t){return!i||!i.char||A+e<t.INNER_WIDTH?!1:t.BREAKON.indexOf(i.char)>-1}class YT extends PY{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 TT 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 HT extends WY{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 HX extends HT{constructor(){super(),this._value="inherit"}}class _X extends Qw{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 _T extends yt{constructor(){super("children",null,!1),this._uis=[]}update(A,e){}process(A){}_compute(A){}dispose(){}}function OX(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=eq(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=eq(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 eq(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 PX 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=OX(e);A.setFontMesh(new _A.Mesh(t,A.fontMaterial)),A._fontMesh.renderOrder=1/0}}class WX extends eU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!1}computeOutputValue(A){this._value=this._inheritedInput,A._layouter._needsProcess=!0}}class KE extends vd{constructor(e={}){const t={};KE.definePropertiesValues(t,e);super(t,e);r(this,"_rebuildParentUI",()=>{super._rebuildParentUI(),this._layouter._needsUpdate=!0});KE.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=_T),e.textContent||(e.textContent=MX),e.glyphs||(e.glyphs=RX),e.inlines||(e.inlines=mX),e.layouter||(e.layouter=FT),e.renderer||(e.renderer=PX),e.fontFamily||(e.fontFamily=qT),e.fontWeight||(e.fontWeight=JT),e.fontStyle||(e.fontStyle=KT),e.fontSize||(e.fontSize=TT),e.color||(e.color=UX),e.backgroundColor||(e.backgroundColor=NX),e.lineBreak||(e.lineBreak=NT),e.letterSpacing||(e.letterSpacing=YT),e.whiteSpace||(e.whiteSpace=kU),e.segments||(e.segments=HX),e.textAlign||(e.textAlign=WX),e.fontKerning||(e.fontKerning=_X)}static init(e){Object.defineProperties(e,{isInline:{configurable:!1,enumerable:!0,value:!0}})}}class jX extends KY{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 KE({name:"anonymousInline",textContent:this._value}))}}class VX extends Array{constructor(...A){super(...A),this.width=0,this.height=0}}class ZX 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 VX(new $J);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 $J(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 zX extends eU{constructor(){super(),this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput,this._needsProcess=!0}process(A){XX(A),A._renderer._needsRender=!0}}function XX(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=$X(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 $X(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 A9 extends tU{constructor(){super(),this._value=this._input="column",this._allowsInherit=!1,this._needsUpdate=!0}computeOutputValue(A){this._value=this._inheritedInput}}class e9 extends _Y{constructor(){super(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}}class t9 extends Qw{constructor(){super(),this._value=this._input=this.getDefaultValue(),this._allowsInherit=!1,this.computeOutputValue=this._computeFromInherited}_computeFromInherited(A){super._computeFromInherited(A)}}class i9 extends mT{constructor(){super(),this._innerWidth=1/0,this._innerHeight=0}}class g9 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 I9 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 o9 extends UT{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 bl extends Jl{constructor(A={},e={}){bl.definePropertiesValues(e,A),super(e,A),bl.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=A9,A.justifyContent=iU,A.alignItems=AU,A.bounds=i9,A.autoSize=I9,A.renderer=o9,A.children||(A.children=g9),A.textContent||(A.textContent=jX),A.layouter||(A.layouter=ZX),A.lineHeight||(A.lineHeight=e9),A.textAlign||(A.textAlign=zX),A.whiteSpace||(A.whiteSpace=kU),A.fontKerning||(A.fontKerning=t9),A.segments||(A.segments=HT),e.width||(e.width="100%"),e.fontSide||(e.fontSide=0)}static init(A){Object.defineProperties(A,{isText:{configurable:!1,enumerable:!0,value:!0}})}}class s9 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 C9 extends yt{constructor(){super("renderer")}render(A){A._backgroundMesh||A.setBackgroundMesh(new RT(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 n9 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 vl extends vd{constructor(A={}){const e={};vl.definePropertiesValues(e,A),super(e,A),vl.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=_T),A.bounds||(A.bounds=n9),A.inlines||(A.inlines=s9),A.layouter||(A.layouter=FT),A.renderer||(A.renderer=C9),A.fontFamily||(A.fontFamily=qT),A.fontWeight||(A.fontWeight=JT),A.fontStyle||(A.fontStyle=KT),A.fontSize||(A.fontSize=TT),A.backgroundColor||(A.backgroundColor=UY),A.lineBreak||(A.lineBreak=NT),A.letterSpacing||(A.letterSpacing=YT),A.whiteSpace||(A.whiteSpace=kU),A.fontKerning||(A.fontKerning=Qw),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 a9(A)],A.backgroundMaterial=new MT,A._renderer.render(A)}}class a9 extends LY{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 OT{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 PT=()=>FD.update(),WT={BaseProperty:yt,Block:ql,Text:bl,Inline:KE,InlineBlock:vl,MeshUIBaseElement:vd,FontLibrary:dB,update:PT,MSDFFontMaterialUtils:_o,ShaderChunkUI:GT,Behavior:OT,FontVariant:Kd};typeof global<"u"&&(global.ThreeMeshUI=WT);const r9=WT;var B9=Wi.w8,jT=Wi.cg,GU=Wi.gO,Q9=Wi.wb,fM=Wi.zV,E9=Wi.HS,c9=Wi.Ec,mf=Wi.gF,h9=Wi.ol,l9=Wi.pz,d9=Wi.tx,u9=Wi.hj,p9=Wi.FV,f9=Wi.sV,MU=Wi.xv,D9=Wi.mx,y9=Wi.gE,vQ=Wi.ZP,VT=Wi.Vx;const Ak=Object.freeze(Object.defineProperty({__proto__:null,BaseProperty:B9,Behavior:jT,Block:GU,DefaultValues:Q9,FontLibrary:fM,FontVariant:E9,InheritableProperty:c9,Inline:mf,InlineBlock:h9,InlineGlyph:l9,MSDFFontMaterialUtils:d9,MaterialTransformers:u9,MeshUIBaseElement:p9,ShaderChunkUI:f9,Text:MU,TypographicFont:D9,TypographicGlyph:y9,default:vQ,update:VT},Symbol.toStringTag,{value:"Module"}));function sB(i,A){try{A?i(A):i()}catch(e){return console.error(e),!1}return!0}const ZT=sA("debugdefines");uw('if(!globalThis[""3.31.5""]) globalThis[""3.31.5""] = "0.0.0";');uw('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');uw('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.31.5";');uw('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');const IC="3.31.5",dw="undefined";ZT&&console.log(`Engine version: ${IC} (generator: ${dw})`);const pn="needle_isActiveInHierarchy",_r="builtin_components",Vh="needle_editor_guid";function uw(i){try{(0,eval)(i)}catch(A){ZT&&console.error(A)}}const DM=sA("debugnewscripts"),w9=sA("debughierarchy"),Vt=[];function S9(){return Vt.length>0}function JD(i){if(!(i.new_scripts.length<=0)){if(DM&&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}Vt.length=0,i.new_scripts.length>0&&Vt.push(...i.new_scripts),i.new_scripts.length=0;for(let A=0;A<Vt.length;A++)try{const e=Vt[A];if(e.isComponent!==!0){(_e()||DM)&&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),Vt.splice(A,1),A--;continue}if(e.destroyed)continue;if(!e.gameObject){console.error("MISSING GAMEOBJECT - will ignore",e),Vt.splice(A,1),A--;continue}e.context=i,Zh(e.gameObject),mU(e,i)}catch(e){console.error(e),en(Vt[A],i),Vt.splice(A,1),A--}for(let A=0;A<Vt.length;A++)try{const e=Vt[A];if(e.destroyed){en(Vt[A],i),Vt.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),Zh(e.gameObject),e.activeAndEnabled&&sB(e.__internalAwake.bind(e)))}catch(e){console.error(e),en(Vt[A],i),Vt.splice(A,1),A--}for(let A=0;A<Vt.length;A++)try{const e=Vt[A];if(e.destroyed||e.enabled===!1||(Zh(e.gameObject),e.activeAndEnabled===!1))continue;e.__internalEnable!==void 0&&(e.enabled=!0,sB(e.__internalEnable.bind(e)))}catch(e){console.error(e),en(Vt[A],i),Vt.splice(A,1),A--}for(let A=0;A<Vt.length;A++)try{const e=Vt[A];if(e.destroyed||!e.gameObject)continue;i.new_script_start.push(e)}catch(e){console.error(e),en(Vt[A],i),Vt.splice(A,1),A--}Vt.length=0;for(const A of i.new_scripts_post_setup_callbacks)A&&A();i.new_scripts_post_setup_callbacks.length=0}}function k9(i){i&&(i.__internalDisable(!0),en(i,i.context))}function zT(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 mU(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 Rf(i){if(i||(i=Ft.Current.scene),!i){console.trace("Invalid call - no current context.");return}const A=ic(i);XT(i,A,!0)||(DM||_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 XT(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=ic(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&&(w9&&console.warn("ACTIVE CHANGE",i.name,g,i.visible,A,"changed?"+o,i),e&&G9(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)XT(n,A,e,C)===!1&&(s=!1)}return s}function Zh(i){let A=!0,e=i,t=!1;for(;e&&e;){if(e.type==="Scene"&&(t=!0),!ic(e)){A=!1;break}e=e.parent}if(!i){console.error("GO is null");return}i[pn]=A&&t}function G9(i,A){var e;if((e=i.userData)!=null&&e.components)for(const t of i.userData.components)A(t)}const Uf=new Map,$T=Symbol("prewarmFlag"),yM=Symbol("waitingForPrewarm"),wM=sA("debugprewarm");function AH(i,A){if(!i||i[$T]===!0||i[yM]===!0)return;Uf.has(A)||Uf.set(A,[]),i[yM]=!0,Uf.get(A).push(i),wM&&console.debug("register prewarm",i.name)}let tq=null,iq=null;function M9(i){if(!i)return;const A=Uf.get(i);if(!(A!=null&&A.length))return;const e=i.mainCamera;if(e){wM&&console.log("prewarm",A.length,"objects",[...A]);const t=i.renderer;if(t.compile){const g=i.scene;t.compile(g,e),tq??(tq=new nR(64)),iq??(iq=new CR(.001,9999999,tq)),iq.update(t,g);for(const I of A)I[$T]=!0,I[yM]=!1;A.length=0,wM&&console.log("prewarm done")}}}const m9=/^(?:[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 R9(i){return typeof i=="string"&&m9.test(i)}const Mg=[];for(let i=0;i<256;++i)Mg.push((i+256).toString(16).slice(1));function U9(i,A=0){return Mg[i[A+0]]+Mg[i[A+1]]+Mg[i[A+2]]+Mg[i[A+3]]+"-"+Mg[i[A+4]]+Mg[i[A+5]]+"-"+Mg[i[A+6]]+Mg[i[A+7]]+"-"+Mg[i[A+8]]+Mg[i[A+9]]+"-"+Mg[i[A+10]]+Mg[i[A+11]]+Mg[i[A+12]]+Mg[i[A+13]]+Mg[i[A+14]]+Mg[i[A+15]]}function N9(i){if(!R9(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 F9(i){i=unescape(encodeURIComponent(i));const A=[];for(let e=0;e<i.length;++e)A.push(i.charCodeAt(e));return A}const K9="6ba7b810-9dad-11d1-80b4-00c04fd430c8",J9="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function q9(i,A,e){function t(g,I,o,s){var C;if(typeof g=="string"&&(g=F9(g)),typeof I=="string"&&(I=N9(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 U9(n)}try{t.name=i}catch{}return t.DNS=K9,t.URL=J9,t}function b9(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 ek(i,A){return i<<A|i>>>32-A}function v9(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]=ek(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=ek(C,5)+b9(c,n,a,B)+Q+A[c]+s[E]>>>0;Q=B,B=a,a=ek(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 L9=q9("v5",80,v9),gq=L9;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||{});Ft.registerCallback(Ag.ContextCreated,i=>{const A=i.context;IH(A),gH(A)});const qD=sA("debugcomponents"),Iq="eff8ba80-635d-11ec-90d6-0242ac120003";class dg{constructor(A){r(this,"_originalSeed");r(this,"_seed");typeof A=="string"&&(A=dg.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 gq(A,Iq);const e=this._seed;return this._seed-=1,gq(e.toString(),Iq)}initialize(A){typeof A=="string"?this._seed=dg.hash(A):this._seed=A}static createFromString(A){return new dg(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 eH=(i=>(i.NewInstanceCreated="new-instance-created",i.InstanceDestroyed="instance-destroyed",i))(eH||{});class tH{constructor(A){r(this,"guid");this.guid=A}}function pw(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 tH(g);A.send("instance-destroyed",I,io.Queued)}function iH(i,A){const e=new tH(i);A.send("instance-destroyed",e,io.Queued)}function gH(i){i.connection.beginListen("instance-destroyed",A=>{qD&&console.log("[Remote] Destroyed",i.scene,A);const e=Od(A.guid,i.scene);e&&hC(e)})}class x9{constructor(A,e,t){r(this,"filename");r(this,"hash");r(this,"size");this.filename=A,this.hash=e,this.size=t}}class Y9{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 RU(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=xe.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}=T9(g,A);if(o){const n=o;if(n.guid){qD&&console.log("[Local] new instance","gameobject:",o==null?void 0:o.guid);const a=new Y9(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 fw(){return Math.random()*9999999}function IH(i){i.connection.beginListen("new-instance-created",async A=>{const e=await H9(A.originalGuid,i.scene);if(!e){console.warn("could not find object that was instantiated: "+A.guid);return}const t=new vs;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 dg(A.seed)),t.visible=A.visible,t.context=i,qD&&i.alias&&console.log("[Remote] instantiate in: "+i.alias);const g=Pd(e,t);g&&(A.parent==="scene"&&i.scene.add(g),qD&&console.log("[Remote] new instance","gameobject:",g==null?void 0:g.guid,e))})}function T9(i,A){const e=fw(),t=A??new vs;t.idProvider=new dg(e);const g=Pd(i,t);return{seed:e,instance:g}}const oH={};function sH(i,A){oH[i]=A}async function H9(i,A){const e=oH[i];if(e!=null){const t=await e(i);if(t)return t}return CH(i,A)}function CH(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=CH(i,e);if(t)return t}return null}const nH=new Map;function _9(i,A){if(!i)return;if(!A){console.warn("No prototype found",i,i.prototype,i.constructor);return}const e=nH.get(A);e&&e.apply(i)}function O9(i){const A=P9(i.prototype);nH.set(i,A)}function P9(i){return new W9(i)}class W9{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 Ld=(i=>(i.Added="component-added",i.Removing="removing-component",i))(Ld||{});const oq=sA("debugcomponentevents");class xd{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),oq&&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(oq&&console.log("Dispatching event "+A,t),!!t)for(const g of t)g(e)}}r(xd,"eventListeners",new Map);const tk=sA("debuggetcomponent");function j9(i){return i==null||i.isObject3D?i:i.object&&i.object.isObject3D?i.object:i}function UU(i,A){if(!i||!i.userData.components)return;const e=i.userData.components.indexOf(A);e<0||(xd.dispatchComponentLifecycleEvent(Ld.Removing,A),A.gameObject=null,i.userData.components.splice(e,1))}function Dw(i,A){const e=tc(i,A);if(e)return e;const t=new A;return za(i,t)}const aH=new dg("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=aH.generateUUID()),ww(i),Lw(A);try{e&&A.__internalAwake&&(Zh(i),A.activeAndEnabled&&A.__internalAwake()),xd.dispatchComponentLifecycleEvent(Ld.Added,A)}catch(t){console.error(t)}return A}function NU(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=aH.generateUUID()),Lw(A),A}function rH(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??xe.Current),i.destroy(),i.gameObject=null}let sq=!1;function BH(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"&&(sq||(sq=!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.
|
|
3
|
+
"version": "3.31.5",
|
|
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",
|
package/plugins/next/next.js
CHANGED
|
@@ -27,7 +27,7 @@ export const needleNext = (nextConfig, userSettings) => {
|
|
|
27
27
|
if (!nextConfig.transpilePackages) {
|
|
28
28
|
nextConfig.transpilePackages = [];
|
|
29
29
|
}
|
|
30
|
-
nextConfig.transpilePackages.push("
|
|
30
|
+
nextConfig.transpilePackages.push("three", "peerjs", "three-mesh-ui");
|
|
31
31
|
|
|
32
32
|
// add webpack config
|
|
33
33
|
if (!nextConfig.webpack) nextConfig.webpack = nextWebPack;
|
|
@@ -42,9 +42,10 @@ export const needleNext = (nextConfig, userSettings) => {
|
|
|
42
42
|
function nextWebPack(config, { buildId, dev, isServer, defaultLoaders, webpack }) {
|
|
43
43
|
|
|
44
44
|
// workaround: fix type finding in production builds
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
if (config.optimization.minimize) {
|
|
46
|
+
console.log("WARN: 😳 disabling minimization for custom scripts. If you don't use custom scripts in your webproject you can enable minimize in the webpack callback like so: needleNext({webpack: (config) => { config.optimization.minimize = true; return config; }})\n")
|
|
47
|
+
config.optimization.minimize = false;
|
|
48
|
+
}
|
|
48
49
|
|
|
49
50
|
const meta = getMeta();
|
|
50
51
|
let useRapier = true;
|