@needle-tools/engine 3.37.12-alpha.3 → 3.37.12-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.37.12-alpha.4] - 2024-05-18
8
+ - Fix: AR placement being prevented by other scripts that caused the event being `used`
9
+
7
10
  ## [3.37.12-alpha.1] - 2024-05-17
8
11
  - Fix: USDZ rel arrays must contain no duplicate entries
9
12
  - Change: Renderer now manually calls reset for stats at the very end of a frame
@@ -29513,13 +29513,13 @@ function EwA(g) {
29513
29513
  WU = g;
29514
29514
  }
29515
29515
  const AP = IA("debugdefines");
29516
- bh('if(!globalThis[""3.37.12-alpha.3""]) globalThis[""3.37.12-alpha.3""] = "0.0.0";');
29516
+ bh('if(!globalThis[""3.37.12-alpha.4""]) globalThis[""3.37.12-alpha.4""] = "0.0.0";');
29517
29517
  bh('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
29518
- bh('if(!globalThis[""Fri May 17 2024 20:41:18 GMT+0200 (Central European Summer Time)""]) globalThis[""Fri May 17 2024 20:41:18 GMT+0200 (Central European Summer Time)""] = "unknown";');
29519
- bh('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.12-alpha.3";');
29518
+ bh('if(!globalThis[""Sat May 18 2024 14:44:17 GMT+0200 (Central European Summer Time)""]) globalThis[""Sat May 18 2024 14:44:17 GMT+0200 (Central European Summer Time)""] = "unknown";');
29519
+ bh('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.12-alpha.4";');
29520
29520
  bh('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
29521
- bh('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri May 17 2024 20:41:18 GMT+0200 (Central European Summer Time)";');
29522
- const en = "3.37.12-alpha.3", Xb = "undefined", eP = "Fri May 17 2024 20:41:18 GMT+0200 (Central European Summer Time)";
29521
+ bh('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Sat May 18 2024 14:44:17 GMT+0200 (Central European Summer Time)";');
29522
+ const en = "3.37.12-alpha.4", Xb = "undefined", eP = "Sat May 18 2024 14:44:17 GMT+0200 (Central European Summer Time)";
29523
29523
  AP && console.log(`Engine version: ${en} (generator: ${Xb})
29524
29524
  Project built at ${eP}`);
29525
29525
  const Jr = "needle_isActiveInHierarchy", Ec = "builtin_components", Cy = "needle_editor_guid";
@@ -83158,7 +83158,7 @@ class ks extends FA {
83158
83158
  console.warn("Scene Placement is disabled while images are being tracked");
83159
83159
  return;
83160
83160
  }
83161
- e.stopImmediatePropagation(), e.use(), this._isPlacing = !1, this.context.input.removeEventListener("pointerup", this.onPlaceScene), this.onRevertSceneChanges(), t.position.copy(t.lastPos), t.quaternion.copy(t.lastQuat), this.onApplyPose(t), this.useXRAnchor && this.onCreateAnchor(we.active, i);
83161
+ e.stopImmediatePropagation(), e.stopPropagation(), e.use(), this._isPlacing = !1, this.context.input.removeEventListener("pointerup", this.onPlaceScene), this.onRevertSceneChanges(), t.position.copy(t.lastPos), t.quaternion.copy(t.lastQuat), this.onApplyPose(t), this.useXRAnchor && this.onCreateAnchor(we.active, i);
83162
83162
  });
83163
83163
  B(this, "upVec", new S(0, 1, 0));
83164
83164
  B(this, "lookPoint", new S());
@@ -83188,10 +83188,10 @@ class ks extends FA {
83188
83188
  this.context.scene.add(t), this._reparentedComponents.length = 0, this._reparentedComponents.push({ comp: this, originalObject: this.gameObject }), nA.addComponent(t, this);
83189
83189
  for (const i of this._reticle)
83190
83190
  CC(i);
83191
- this._reticle.length = 0, this._isPlacing = !0, this.context.input.addEventListener("pointerup", this.onPlaceScene, { queue: jC.Late });
83191
+ this._reticle.length = 0, this._isPlacing = !0, this.context.input.addEventListener("pointerup", this.onPlaceScene, { queue: jC.Early });
83192
83192
  }
83193
83193
  onLeaveXR() {
83194
- this.context.input.removeEventListener("pointerup", this.onPlaceScene, { queue: jC.Late }), this.onRevertSceneChanges(), this._anchor = null, this._rigPlacementMatrix = void 0;
83194
+ this.context.input.removeEventListener("pointerup", this.onPlaceScene, { queue: jC.Early }), this.onRevertSceneChanges(), this._anchor = null, this._rigPlacementMatrix = void 0;
83195
83195
  }
83196
83196
  onUpdateXR(e) {
83197
83197
  var t, i, I, o;
@@ -29513,13 +29513,13 @@ function Ube(s) {
29513
29513
  DT = s;
29514
29514
  }
29515
29515
  const yG = ne("debugdefines");
29516
- rm('if(!globalThis[""3.37.12-alpha.3""]) globalThis[""3.37.12-alpha.3""] = "0.0.0";');
29516
+ rm('if(!globalThis[""3.37.12-alpha.4""]) globalThis[""3.37.12-alpha.4""] = "0.0.0";');
29517
29517
  rm('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
29518
- rm('if(!globalThis[""Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)""]) globalThis[""Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)""] = "unknown";');
29519
- rm('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.12-alpha.3";');
29518
+ rm('if(!globalThis[""Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)""]) globalThis[""Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)""] = "unknown";');
29519
+ rm('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.12-alpha.4";');
29520
29520
  rm('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
29521
- rm('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)";');
29522
- const za = "3.37.12-alpha.3", zP = "undefined", vG = "Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)";
29521
+ rm('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)";');
29522
+ const za = "3.37.12-alpha.4", zP = "undefined", vG = "Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)";
29523
29523
  yG && console.log(`Engine version: ${za} (generator: ${zP})
29524
29524
  Project built at ${vG}`);
29525
29525
  const mu = "needle_isActiveInHierarchy", Vp = "builtin_components", wx = "needle_editor_guid";
@@ -83158,7 +83158,7 @@ class Aa extends Te {
83158
83158
  console.warn("Scene Placement is disabled while images are being tracked");
83159
83159
  return;
83160
83160
  }
83161
- t.stopImmediatePropagation(), t.use(), this._isPlacing = !1, this.context.input.removeEventListener("pointerup", this.onPlaceScene), this.onRevertSceneChanges(), i.position.copy(i.lastPos), i.quaternion.copy(i.lastQuat), this.onApplyPose(i), this.useXRAnchor && this.onCreateAnchor(xt.active, n);
83161
+ t.stopImmediatePropagation(), t.stopPropagation(), t.use(), this._isPlacing = !1, this.context.input.removeEventListener("pointerup", this.onPlaceScene), this.onRevertSceneChanges(), i.position.copy(i.lastPos), i.quaternion.copy(i.lastQuat), this.onApplyPose(i), this.useXRAnchor && this.onCreateAnchor(xt.active, n);
83162
83162
  });
83163
83163
  u(this, "upVec", new S(0, 1, 0));
83164
83164
  u(this, "lookPoint", new S());
@@ -83188,10 +83188,10 @@ class Aa extends Te {
83188
83188
  this.context.scene.add(i), this._reparentedComponents.length = 0, this._reparentedComponents.push({ comp: this, originalObject: this.gameObject }), oe.addComponent(i, this);
83189
83189
  for (const n of this._reticle)
83190
83190
  Xc(n);
83191
- this._reticle.length = 0, this._isPlacing = !0, this.context.input.addEventListener("pointerup", this.onPlaceScene, { queue: Dl.Late });
83191
+ this._reticle.length = 0, this._isPlacing = !0, this.context.input.addEventListener("pointerup", this.onPlaceScene, { queue: Dl.Early });
83192
83192
  }
83193
83193
  onLeaveXR() {
83194
- this.context.input.removeEventListener("pointerup", this.onPlaceScene, { queue: Dl.Late }), this.onRevertSceneChanges(), this._anchor = null, this._rigPlacementMatrix = void 0;
83194
+ this.context.input.removeEventListener("pointerup", this.onPlaceScene, { queue: Dl.Early }), this.onRevertSceneChanges(), this._anchor = null, this._rigPlacementMatrix = void 0;
83195
83195
  }
83196
83196
  onUpdateXR(t) {
83197
83197
  var i, n, r, o;
@@ -4341,7 +4341,7 @@ void main() {
4341
4341
  }`),u(Fa,"blipMaterial"),u(Fa,"mesh");function A3(i){return Fa.copyTexture(i)}function Nte(i,e=!1){return Fa.textureToCanvas(i,e)}function Qte(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&i instanceof ImageBitmap}function PT(i,e=[]){const t=new bi;t.makeEmpty();const n=[];function r(o){let a=!0;if(o.visible&&h3(o)!==!1&&!(o.type==="TransformControlsGizmo"||o.type==="TransformControlsPlane")&&(o instanceof EM&&(a=!1),o instanceof ax&&(a=!1),o instanceof l3&&(a=!1),o.material instanceof q_&&(a=!1),o instanceof fe||(a=!1),!(e!=null&&e.includes(o))&&o.isUI!==!0)){if(a){const l=o.children;o.children=n;const c=o.position,h=o.scale;if(Number.isNaN(c.x)||Number.isNaN(c.y)||Number.isNaN(c.z)){console.warn(`Object "${o.name}" has NaN values in position or scale.... will ignore it`,c,h);return}t.expandByObject(o,!0),o.children=l}for(const l of o.children)r(l)}}let s=!1;for(const o of i)o&&(s=!0,o.updateMatrixWorld(),r(o));return s||console.warn("No objects to fit camera to..."),t}let kx=!1;kK((...i)=>{var e;dt()&&(e=li.Current)!=null&&e.isInXR&&(rg(!0),v3("error",...i))});function rg(i){if(i){if(kx)return;kx=!0,jte()}else{if(!kx)return;kx=!1,Gte()}}const s0={log:void 0,warn:void 0,error:void 0};class zte{constructor(){u(this,"familyName","needle-xr"),u(this,"root",null),u(this,"context",null),u(this,"defaultFontSize",.06),u(this,"targetObject",new be),u(this,"userForwardViewPoint",new E),u(this,"oneEuroFilter",new _T(90,.8)),u(this,"_lastElementRemoveTime",0),u(this,"onBeforeRender",()=>{var e,t;const n=(e=this.context)==null?void 0:e.mainCamera;if(this.context&&n instanceof Ft){const r=this.getRoot();Number.isNaN(r.position.x)&&r.position.set(0,0,0),Number.isNaN(r.quaternion.x)&&r.quaternion.set(0,0,0,1),this.context.scene.add(this.targetObject);const s=((t=this.context.xr)==null?void 0:t.rigScale)??1,o=3.5*s,a=n.worldForward;a.y=0,a.normalize().multiplyScalar(o),this.userForwardViewPoint.copy(n.worldPosition).sub(a),this.targetObject.position.distanceTo(this.userForwardViewPoint)>2*s&&(this.targetObject.position.copy(this.userForwardViewPoint),t0(this.targetObject,n,!0,!0),this.targetObject.rotateY(Math.PI)),this.oneEuroFilter.filter(this.targetObject.position,r.position,this.context.time.time);const l=this.context.time.deltaTime;if(r.quaternion.slerp(this.targetObject.quaternion,l*5),r.scale.setScalar(s),this.targetObject.removeFromParent(),this.context.scene.add(r),this.context.time.time-this._lastElementRemoveTime>.1){this._lastElementRemoveTime=this.context.time.time;const c=Date.now();for(let h=0;h<this._activeTexts.length;h++){const d=this._activeTexts[h];if(d instanceof Pi.Text&&c-d._activatedTime>2e4){d.removeFromParent(),this._textBuffer.push(d),this._activeTexts.splice(h,1);break}}}}}),u(this,"textOptions",{fontSize:this.defaultFontSize,fontFamily:this.familyName,padding:.03,margin:.005,color:0,backgroundColor:16777215,backgroundOpacity:.4,borderRadius:.03,offset:.025}),u(this,"_textBuffer",[]),u(this,"_activeTexts",[]),this.ensureFont()}onEnable(){this.context=li.Current||li.All[0],this.context.pre_render_callbacks.push(this.onBeforeRender)}onDisable(){var e,t,n;(t=this.context)==null||t.pre_render_callbacks.splice((e=this.context)==null?void 0:e.pre_render_callbacks.indexOf(this.onBeforeRender),1),(n=this.root)==null||n.removeFromParent()}addLog(e,t){const n=this.getRoot(),r=this.getText();let s=16777215,o=0;switch(e){case"log":s=16777215,o=0;break;case"warn":s=16772761,o=4465152;break;case"error":s=16755370,o=7798784;break}t.length>1e3&&(t=t.substring(0,1e3)+"...");const a=new Date().toISOString().split("T")[1].split(".")[0];r.textContent="["+a+"] "+t,r.visible=!0,r._activatedTime=Date.now(),n.add(r),this._activeTexts.push(r),this.context&&this.context.scene.add(n),r.set({backgroundColor:s,color:o}),Pi.update()}ensureFont(){let e=Pi.FontLibrary.getFontFamily(this.familyName);if(!e){e=Pi.FontLibrary.addFontFamily(this.familyName);const t=e.addVariant("normal","normal","./include/needle/arial-msdf.json","./include/needle/arial.png");t?.addEventListener("ready",()=>{Pi.update()})}}getText(){const e=this.getRoot();if(this._textBuffer.length>0){const n=this._textBuffer.pop();return n.visible=!0,setTimeout(()=>this.disableDepthTestRecursive(n),100),n}if(e.children.length>20&&this._activeTexts.length>0)return this._activeTexts.shift();const t=new Pi.Text(this.textOptions);return setTimeout(()=>this.disableDepthTestRecursive(t),500),setTimeout(()=>this.disableDepthTestRecursive(t),1500),t}disableDepthTestRecursive(e,t=0){for(let r=0;r<e.children.length;r++){const s=e.children[r];s instanceof be&&this.disableDepthTestRecursive(s,t+1)}e.renderOrder=10*t,e.layers.set(2);const n=e.material;n&&(n.depthWrite=!1,n.depthTest=!1,n.transparent=!0),t===0&&Pi.update()}getRoot(){if(this.root)return this.root;const e=this.defaultFontSize,t={boxSizing:"border-box",fontFamily:this.familyName,width:"2.6",fontSize:e,color:0,lineHeight:1,backgroundColor:16777215,backgroundOpacity:0,whiteSpace:"pre-wrap",flexDirection:"column-reverse"};return this.root=new Pi.Block(t),this.root}}let Ua=null;function jte(){Ua||(Ua=new zte),Ua.onEnable();for(const i in s0){s0[i]=console[i];let e=!1;console[i]=function(){var t;if((t=s0[i])==null||t.apply(console,arguments),!e)try{e=!0,v3(i,...arguments)}finally{e=!1}}}}function Gte(){Ua?.onDisable();for(const i in s0)console[i]=s0[i]}const o0=new Map;function v3(i,...e){try{switch(o0.clear(),i){case"log":Ua?.addLog("log",t());break;case"warn":Ua?.addLog("warn",t());break;case"error":Ua?.addLog("error",t());break}}catch(s){console.error("Error in spatial console",s)}finally{o0.clear()}function t(){let s="";for(let o=0;o<e.length;o++){const a=e[o];s+=n(a),o<e.length-1&&(s+=", ")}return s}function n(s,o=0){if(typeof s=="string")return'"'+s+'"';if(typeof s=="number"){if(s%1!==0){const a=s.toFixed(5),l=a.indexOf(".");let c=a.length-1;for(;c>l&&a[c]==="0";)c--;return a.substring(0,c+1)}return s.toString()}else if(Array.isArray(s)){let a="[";for(let l=0;l<s.length;l++){const c=s[l];a+=n(c,o+1),l<s.length-1&&(a+=", ")}return a+="]",a}else{if(s===null)return"null";if(s===void 0)return"undefined";if(typeof s=="function")return s.name+"()"}if(s instanceof $)return`(${n(s.x)}, ${n(s.y)})`;if(s instanceof E)return`(${n(s.x)}, ${n(s.y)}, ${n(s.z)})`;if(s instanceof Ze)return`(${n(s.x)}, ${n(s.y)}, ${n(s.z)}, ${n(s.w)})`;if(s instanceof Ie)return`(${n(s.x)}, ${n(s.y)}, ${n(s.z)}, ${n(s.w)})`;if(s instanceof Lt||s instanceof zt)return s.name;if(s instanceof Ot)return`[${s.elements.join(", ")}]`;if(s instanceof Me)return`[${s.elements.join(", ")}]`;if(s instanceof es)return s.mask.toString();if(typeof s=="object"){if(o0.has(s))return"*";let a=`{
4342
4342
  `;a+=r(o);const l=Object.keys(s);let c="";for(let h=0;h<l.length;h++){const d=l[h],p=s[d];if(o0.has(p)){c+="";continue}o0.set(p,!0),c+=d+":"+n(p,o+1),h<l.length-1&&(c+=", "),c.length>=60&&(c+=`
4343
4343
  `,c+=r(o),a+=c,c="")}return a+=c,a+=`
4344
- }`,a}return s}function r(s){let o="";for(let a=0;a<s;a++)o+=" ";return o}}const Hte=ee("nodevlogs");function on(i,e=go.Log){Al(e,i)}function an(i){on(i,go.Warn)}function kT(i){on(i,go.Error)}let OT;function dt(){return Hte?!1:OT!==void 0?OT:Cs()}function Vte(i){OT=i}const y3=ee("debugdefines");sg('if(!globalThis[""3.37.12-alpha.3""]) globalThis[""3.37.12-alpha.3""] = "0.0.0";'),sg('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),sg('if(!globalThis[""Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)""]) globalThis[""Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)""] = "unknown";'),sg('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.12-alpha.3";'),sg('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),sg('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)";');const Na="3.37.12-alpha.3",Ox="undefined",LT="Fri May 17 2024 20:41:29 GMT+0200 (Central European Summer Time)";y3&&console.log(`Engine version: ${Na} (generator: ${Ox})
4344
+ }`,a}return s}function r(s){let o="";for(let a=0;a<s;a++)o+=" ";return o}}const Hte=ee("nodevlogs");function on(i,e=go.Log){Al(e,i)}function an(i){on(i,go.Warn)}function kT(i){on(i,go.Error)}let OT;function dt(){return Hte?!1:OT!==void 0?OT:Cs()}function Vte(i){OT=i}const y3=ee("debugdefines");sg('if(!globalThis[""3.37.12-alpha.4""]) globalThis[""3.37.12-alpha.4""] = "0.0.0";'),sg('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),sg('if(!globalThis[""Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)""]) globalThis[""Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)""] = "unknown";'),sg('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.12-alpha.4";'),sg('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),sg('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)";');const Na="3.37.12-alpha.4",Ox="undefined",LT="Sat May 18 2024 14:44:29 GMT+0200 (Central European Summer Time)";y3&&console.log(`Engine version: ${Na} (generator: ${Ox})
4345
4345
  Project built at ${LT}`);const Tc="needle_isActiveInHierarchy",jd="builtin_components",a0="needle_editor_guid";function sg(i){try{(0,eval)(i)}catch(e){y3&&console.error(e)}}const Wte='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><linearGradient id="a" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="b" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="c" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="d" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="e" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="f" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="rotate(20 4088.49 13316.712)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="g" viewBox="0 0 160 187.74"><path style="fill:url(#a)" d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75z"/><path style="fill:url(#b)" d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98z"/><path style="fill:url(#c)" d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z"/><path style="fill:url(#d)" d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04z"/><path style="fill:#9c3" d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5z"/><path style="fill:url(#e)" d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59z"/><path style="fill:url(#f)" d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z"/><path style="fill:#ffe113" d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1z"/><path style="fill:#f3e600" d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75z"/></symbol></defs><use width="160" height="187.74" xlink:href="#g"/></svg>',qte=btoa(Wte),Xte="data:image/svg+xml;base64,"+qte,Yte=Xte,Jte=`<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'> <svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" version="1.1" viewBox="0 0 1014 282" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m665.95 132.73v44.88l-10.56-8.4c-0.8-0.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18 0.4-6.06 1.2s-3.54 1.8-4.98 3-2.56 2.5-3.36 3.9-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c0.32 0.24 0.56 0.44 0.72 0.6s0.36 0.32 0.6 0.48c0.96-1.2 2.14-2.28 3.54-3.24s2.92-1.76 4.56-2.4 3.34-1.14 5.1-1.5 3.44-0.54 5.04-0.54c1.44 0 2.92 0.04 4.44 0.12s2.84 0.28 3.96 0.6c4.56 1.12 7.8 3.12 9.72 6s2.88 6.56 2.88 11.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m732.38 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m795.93 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m858.57 97.21c0.64 0.48 0.96 1.16 0.96 2.04v74.88c-0.08 1.04-0.12 2.12-0.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18s-2.06-1.66-2.46-1.98c-1.76 2.48-4.26 4.44-7.5 5.88s-7.02 2.16-11.34 2.16c-3.84 0-7.4-0.7-10.68-2.1s-6.14-3.44-8.58-6.12-4.34-5.94-5.7-9.78-2.04-8.16-2.04-12.96c0-4.32 0.78-8.34 2.34-12.06s3.6-6.92 6.12-9.6 5.38-4.78 8.58-6.3 6.48-2.28 9.84-2.28c2.56 0 4.82 0.22 6.78 0.66s3.68 1.06 5.16 1.86 2.78 1.74 3.9 2.82 2.16 2.22 3.12 3.42v-35.04l10.68 8.64zm-27.96 67.92c3.6 0 6.52-0.68 8.76-2.04s3.98-3.06 5.22-5.1 2.1-4.22 2.58-6.54 0.72-4.44 0.72-6.36v-1.2c0-1.12-0.22-2.7-0.66-4.74s-1.28-4.06-2.52-6.06-3-3.7-5.28-5.1-5.22-2.02-8.82-1.86c-3.44 0-6.26 0.74-8.46 2.22s-3.96 3.26-5.28 5.34-2.24 4.2-2.76 6.36-0.78 3.92-0.78 5.28c0 1.84 0.24 3.92 0.72 6.24s1.36 4.48 2.64 6.48 3.04 3.68 5.28 5.04 5.12 2.04 8.64 2.04z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m882.81 97.09c0.64 0.48 0.96 1.12 0.96 1.92l-0.12 41.04v37.08l-10.56-8.4c-0.72-0.64-1.08-1.44-1.08-2.4v-77.88l10.8 8.64z" fill-rule="nonzero"/> </g> <g transform="matrix(1.008 0 0 1.008 -2.239 .61874)"> <path d="m950.36 146.05c0 0.88 0.02 1.5 0.06 1.86s-0.02 0.98-0.18 1.86h-7.08c-2.08 0-4.44-0.02-7.08-0.06s-5.36-0.06-8.16-0.06h-22.08c0 2.88 0.56 5.36 1.68 7.44s2.6 3.8 4.44 5.16 3.94 2.36 6.3 3 4.74 0.96 7.14 0.96c3.04 0 5.9-0.76 8.58-2.28s4.94-3.52 6.78-6c0.64 0.56 1.54 1.48 2.7 2.76s2.94 3.2 5.34 5.76c-2.8 3.36-6.22 6.02-10.26 7.98s-8.42 2.94-13.14 2.94-8.92-0.64-12.84-1.92-7.32-3.24-10.2-5.88-5.12-5.98-6.72-10.02-2.4-8.82-2.4-14.34c0-4.96 0.66-9.42 1.98-13.38s3.22-7.32 5.7-10.08 5.44-4.9 8.88-6.42 7.32-2.28 11.64-2.28c5.76 0 10.52 0.88 14.28 2.64s6.72 4.16 8.88 7.2 3.66 6.54 4.5 10.5 1.26 8.18 1.26 12.66zm-29.4-22.8c-2.16 0.16-4.16 0.72-6 1.68s-3.42 2.2-4.74 3.72-2.36 3.28-3.12 5.28-1.14 4.12-1.14 6.36h33.12c0-2-0.22-4.06-0.66-6.18s-1.3-4.02-2.58-5.7-3.1-3.02-5.46-4.02-5.5-1.38-9.42-1.14z" fill-rule="nonzero"/> </g> <g transform="matrix(1.8559 0 0 .7642 45.348 36.475)"> <g transform="translate(2.7114)"> <path d="m3.935 173.02c-0.331 0-0.497-0.402-0.497-1.207v-51.002c0-0.738 0.138-1.107 0.414-1.107h1.781c0.277 0 0.415 0.335 0.415 1.006v5.935c0 0.336 0.027 0.553 0.083 0.654 0.055 0.101 0.151-0.017 0.289-0.352 0.912-1.744 1.754-3.236 2.527-4.477 0.773-1.24 1.554-2.179 2.341-2.816s1.65-0.956 2.588-0.956c1.685 0 3.011 0.922 3.977 2.766 0.967 1.845 1.602 3.84 1.905 5.986 0.056 0.268 0.139 0.369 0.249 0.302s0.221-0.235 0.331-0.503c0.939-1.811 1.802-3.353 2.589-4.628 0.787-1.274 1.581-2.246 2.382-2.917s1.671-1.006 2.61-1.006c2.016 0 3.569 1.392 4.66 4.175 1.09 2.783 1.636 6.421 1.636 10.915v37.925c0 0.871-0.18 1.307-0.539 1.307h-1.739c-0.138 0-0.249-0.1-0.332-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.338-6.321-1.015-8.3-0.676-1.978-1.76-2.967-3.251-2.967-0.884 0-1.726 0.386-2.527 1.157s-1.519 1.727-2.154 2.867-1.201 2.213-1.699 3.219c-0.248 0.469-0.421 0.905-0.517 1.308-0.097 0.402-0.145 0.972-0.145 1.71v37.221c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.166 0-0.29-0.1-0.373-0.301-0.083-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.332-6.321-0.994-8.3-0.663-1.978-1.754-2.967-3.273-2.967-1.242 0-2.375 0.704-3.396 2.112-1.022 1.409-2.223 3.555-3.604 6.439v39.031c0 0.805-0.18 1.207-0.539 1.207h-1.698z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m53.642 166.28c-1.077 2.549-2.237 4.477-3.479 5.785-1.243 1.307-2.61 1.961-4.101 1.961-2.154 0-3.853-1.324-5.095-3.973-1.243-2.649-1.864-6.187-1.864-10.613 0-3.488 0.4-6.489 1.201-9.004s1.988-4.51 3.562-5.985c1.574-1.476 3.521-2.414 5.841-2.817l3.686-0.704c0.221-0.067 0.394-0.218 0.518-0.453 0.124-0.234 0.187-0.587 0.187-1.056v-2.917c0-3.89-0.504-6.975-1.512-9.255s-2.354-3.42-4.039-3.42c-1.298 0-2.472 0.72-3.521 2.162s-2.002 3.572-2.858 6.388c-0.083 0.268-0.159 0.453-0.228 0.554-0.069 0.1-0.172 0.083-0.311-0.051l-1.698-1.71c-0.083-0.134-0.138-0.285-0.166-0.453-0.027-0.167 0.014-0.452 0.125-0.855 0.856-3.353 2.009-6.052 3.459-8.098 1.449-2.045 3.224-3.068 5.322-3.068 1.74 0 3.211 0.687 4.412 2.062s2.112 3.37 2.734 5.986c0.621 2.615 0.932 5.7 0.932 9.255v35.712c0 0.536-0.035 0.888-0.104 1.056s-0.2 0.251-0.393 0.251h-1.533c-0.166 0-0.29-0.117-0.373-0.352-0.083-0.234-0.124-0.553-0.124-0.955l-0.083-5.231c-0.055-0.939-0.221-1.006-0.497-0.202zm0.456-19.314c0-1.14-0.194-1.643-0.58-1.509l-3.107 0.603c-1.436 0.202-2.686 0.638-3.749 1.308-1.063 0.671-1.953 1.543-2.671 2.616s-1.257 2.33-1.616 3.772-0.538 3.102-0.538 4.98c0 3.152 0.455 5.616 1.367 7.393 0.911 1.778 2.14 2.666 3.686 2.666 0.939 0 1.85-0.419 2.734-1.257s1.671-1.895 2.361-3.169c0.663-1.408 1.181-2.85 1.553-4.326 0.373-1.475 0.56-2.883 0.56-4.225v-8.852z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m79.034 173.02c-0.166 0-0.297-0.117-0.394-0.352-0.096-0.234-0.145-0.553-0.145-0.955v-4.628c0-0.536-0.041-0.838-0.124-0.905s-0.207 0.1-0.373 0.503c-0.276 0.67-0.69 1.593-1.242 2.766-0.553 1.174-1.271 2.23-2.154 3.169-0.884 0.939-1.961 1.408-3.231 1.408-1.74 0-3.314-0.989-4.722-2.967-1.409-1.979-2.534-4.963-3.376-8.953-0.843-3.991-1.264-8.937-1.264-14.838 0-5.701 0.415-10.68 1.243-14.939s1.988-7.595 3.479-10.009c1.492-2.415 3.204-3.622 5.137-3.622 1.436 0 2.616 0.57 3.541 1.71 0.926 1.14 1.719 2.381 2.382 3.722 0.249 0.47 0.414 0.637 0.497 0.503s0.125-0.536 0.125-1.207v-23.841c0-0.805 0.151-1.208 0.455-1.208h1.864c0.276 0 0.414 0.369 0.414 1.107v72.128c0 0.537-0.041 0.905-0.124 1.107-0.083 0.201-0.235 0.301-0.455 0.301h-1.533zm-0.621-42.049c-0.939-2.213-1.885-3.94-2.838-5.181s-2.009-1.861-3.169-1.861c-1.463 0-2.768 0.889-3.914 2.666s-2.044 4.376-2.693 7.796-0.973 7.578-0.973 12.474c0 5.097 0.338 9.272 1.015 12.524 0.676 3.253 1.567 5.651 2.672 7.193 1.104 1.543 2.305 2.314 3.603 2.314 1.188 0 2.258-0.704 3.211-2.113 0.952-1.408 1.705-3.118 2.257-5.13s0.829-3.957 0.829-5.835v-24.847z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m89.514 149.38c0 3.42 0.345 6.606 1.035 9.557 0.691 2.951 1.609 5.315 2.755 7.092s2.437 2.666 3.873 2.666c1.519 0 2.837-0.738 3.956-2.213 1.118-1.476 2.064-3.655 2.837-6.539 0.083-0.336 0.166-0.52 0.249-0.554 0.083-0.033 0.179 0.017 0.29 0.151l1.408 1.912c0.221 0.268 0.235 0.67 0.041 1.207-0.69 2.548-1.47 4.661-2.34 6.337-0.87 1.677-1.857 2.935-2.962 3.773-1.104 0.838-2.319 1.257-3.645 1.257-2.043 0-3.838-1.14-5.385-3.42-1.546-2.28-2.761-5.482-3.645-9.607-0.884-4.124-1.325-8.836-1.325-14.134 0-5.901 0.455-10.931 1.367-15.089 0.911-4.158 2.14-7.377 3.686-9.658 1.547-2.28 3.3-3.42 5.261-3.42 1.988 0 3.714 1.073 5.178 3.219 1.463 2.146 2.595 5.231 3.396 9.255s1.201 8.886 1.201 14.587c0 0.469-0.02 0.939-0.062 1.408-0.041 0.469-0.214 0.704-0.517 0.704h-16.362c-0.083 0-0.152 0.151-0.207 0.453-0.056 0.302-0.083 0.654-0.083 1.056zm13.752-6.237c0.304 0 0.497-0.1 0.58-0.302 0.083-0.201 0.124-0.57 0.124-1.106 0-3.219-0.283-6.187-0.849-8.903s-1.367-4.896-2.402-6.539c-1.036-1.643-2.272-2.464-3.708-2.464-1.629 0-2.996 0.955-4.101 2.867-1.104 1.911-1.94 4.342-2.506 7.293s-0.849 6.002-0.849 9.154h13.711z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m148.54 119.7c0.165 0 0.283 0.117 0.352 0.352s0.076 0.52 0.02 0.855l-6.254 50.902c-0.028 0.47-0.104 0.788-0.228 0.956s-0.297 0.251-0.518 0.251h-1.615c-0.442 0-0.718-0.402-0.829-1.207l-5.26-40.138c-0.111-0.604-0.201-0.905-0.27-0.905s-0.131 0.301-0.186 0.905l-5.012 40.138c-0.028 0.47-0.097 0.788-0.207 0.956-0.111 0.168-0.277 0.251-0.497 0.251h-1.74c-0.442 0-0.718-0.402-0.829-1.207l-6.503-50.801c-0.055-0.403-0.048-0.721 0.021-0.956s0.2-0.352 0.393-0.352h1.823c0.166 0 0.297 0.067 0.393 0.201 0.097 0.134 0.159 0.403 0.187 0.805l5.302 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.219-41.949c0.055-0.268 0.124-0.47 0.207-0.604s0.193-0.201 0.331-0.201h1.533c0.138 0 0.262 0.067 0.373 0.201 0.11 0.134 0.179 0.403 0.207 0.805l5.468 41.848c0.083 0.671 0.179 0.989 0.29 0.956 0.11-0.034 0.207-0.386 0.29-1.056l5.053-41.849c0.055-0.335 0.138-0.57 0.249-0.704 0.11-0.134 0.234-0.201 0.373-0.201h1.284z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m156.49 171.51c0 0.604-0.042 1.006-0.125 1.208-0.082 0.201-0.262 0.301-0.538 0.301h-1.533c-0.221 0-0.366-0.083-0.435-0.251s-0.103-0.486-0.103-0.956v-50.902c0-0.805 0.152-1.207 0.456-1.207h1.822c0.304 0 0.456 0.402 0.456 1.207v50.6zm0.165-63.979c0 1.207-0.207 1.811-0.621 1.811h-1.905c-0.221 0-0.366-0.135-0.435-0.403s-0.104-0.67-0.104-1.207v-7.847c0-1.006 0.18-1.509 0.539-1.509h1.988c0.359 0 0.538 0.47 0.538 1.409v7.746z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m168.3 124.83c-0.221 0-0.331 0.269-0.331 0.805v33.801c0 3.42 0.221 5.667 0.663 6.74 0.441 1.073 1.09 1.609 1.946 1.609h3.024c0.138 0 0.242 0.084 0.311 0.252 0.069 0.167 0.103 0.419 0.103 0.754v2.716c0 0.537-0.138 0.906-0.414 1.107-0.248 0.067-0.614 0.134-1.098 0.201-0.483 0.067-0.959 0.118-1.429 0.151-0.469 0.034-0.828 0.05-1.077 0.05-1.712 0-2.934-0.955-3.665-2.867-0.732-1.911-1.098-5.013-1.098-9.305v-35.108c0-0.604-0.124-0.906-0.373-0.906h-3.521c-0.248 0-0.373-0.268-0.373-0.804v-3.521c0-0.537 0.111-0.805 0.332-0.805h3.686c0.166 0 0.263-0.268 0.29-0.805l0.415-16.095c0-0.805 0.124-1.207 0.372-1.207h1.492c0.303 0 0.455 0.436 0.455 1.307v15.995c0 0.537 0.097 0.805 0.29 0.805h5.468c0.221 0 0.331 0.268 0.331 0.805v3.521c0 0.536-0.124 0.804-0.373 0.804h-5.426z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> <g transform="translate(2.7114)"> <path d="m179.4 173.02c-0.331 0-0.497-0.402-0.497-1.207v-72.329c0-0.738 0.138-1.107 0.414-1.107h1.782c0.276 0 0.414 0.336 0.414 1.006v27.162c0 0.335 0.034 0.536 0.103 0.603s0.159-0.033 0.27-0.302c0.994-1.81 1.898-3.319 2.713-4.526 0.814-1.208 1.629-2.113 2.444-2.717 0.814-0.603 1.691-0.905 2.63-0.905 2.182 0 3.839 1.375 4.971 4.125 1.132 2.749 1.698 6.404 1.698 10.965v37.925c0 0.871-0.166 1.307-0.497 1.307h-1.74c-0.165 0-0.29-0.1-0.373-0.301-0.082-0.202-0.124-0.503-0.124-0.906v-36.315c0-3.555-0.366-6.321-1.097-8.3-0.732-1.978-1.899-2.967-3.501-2.967-0.883 0-1.705 0.318-2.464 0.956-0.76 0.637-1.526 1.576-2.299 2.816-0.773 1.241-1.643 2.834-2.61 4.779v39.031c0 0.805-0.179 1.207-0.538 1.207h-1.699z" fill-rule="nonzero" stroke="#000" stroke-width=".7px"/> </g> </g> <g transform="matrix(.80638 0 0 .80638 452.53 65.421)" fill-rule="nonzero"> <path d="m79.32 36.98v150.76l15.68-13.2 6.59-156.31-22.27 18.75z" fill="url(#f)"/> <path d="m79.32 36.98-22.27-18.75 6.59 156.31 15.68 13.2v-150.76z" fill="url(#e)"/> <path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33z" fill="url(#d)"/> <path d="m25.19 104.83-25.19-14.59 16.97 53.86 16.85 9.77-8.63-49.04z" fill="url(#c)"/> <path d="M43.86,82.5L18.69,67.98L0,90.24L25.18,104.83L43.86,82.5Z" fill="#9c3"/> <path d="m134.82 78.69-9.97 56.5 15.58-9.04 19.57-62.05-25.18 14.59z" fill="url(#b)"/> <path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5z" fill="url(#a)"/> <path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33 25.19-14.59z" fill="#ffe113"/> <path d="M101.59,18.23L79.32,0L57.05,18.23L79.32,36.98L101.59,18.23Z" fill="#f3e600"/> </g> <defs> <linearGradient id="f" x2="1" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)" gradientUnits="userSpaceOnUse"><stop stop-color="#62d399" offset="0"/><stop stop-color="#acd842" offset=".51"/><stop stop-color="#d7db0a" offset=".9"/><stop stop-color="#d7db0a" offset="1"/></linearGradient> <linearGradient id="e" x2="1" gradientTransform="matrix(-1.6,-162.13,162.13,-1.6,69.68,178.9)" gradientUnits="userSpaceOnUse"><stop stop-color="#0ba398" offset="0"/><stop stop-color="#4ca352" offset=".5"/><stop stop-color="#76a30a" offset="1"/></linearGradient> <linearGradient id="d" x2="1" gradientTransform="matrix(-1.9,-67.98,67.98,-1.9,36.6,152.17)" gradientUnits="userSpaceOnUse"><stop stop-color="#36a382" offset="0"/><stop stop-color="#36a382" offset=".19"/><stop stop-color="#49a459" offset=".54"/><stop stop-color="#76a30b" offset="1"/></linearGradient> <linearGradient id="c" x2="1" gradientTransform="matrix(2.18,-62.38,62.38,2.18,15.82,153.24)" gradientUnits="userSpaceOnUse"><stop stop-color="#267880" offset="0"/><stop stop-color="#457a5c" offset=".51"/><stop stop-color="#717516" offset="1"/></linearGradient> <linearGradient id="b" x2="1" gradientTransform="matrix(13.85,-71.96,71.96,13.85,135.08,135.43)" gradientUnits="userSpaceOnUse"><stop stop-color="#b0d939" offset="0"/><stop stop-color="#eadb04" offset="1"/></linearGradient> <linearGradient id="a" x2="1" gradientTransform="matrix(26.159 -64.737 64.737 26.159 107.42 128.14)" gradientUnits="userSpaceOnUse"><stop stop-color="#74af52" offset="0"/><stop stop-color="#74af52" offset=".17"/><stop stop-color="#99be32" offset=".48"/><stop stop-color="#c0c40a" offset="1"/></linearGradient> </defs> </svg>`;btoa(Jte);const Kte='<svg viewBox="0 0 509 154" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M665.95 132.73v44.88l-10.56-8.4c-.8-.64-1.2-1.44-1.2-2.4v-32.4c0-6.48-4.12-9.72-12.36-9.72-2.16 0-4.18.4-6.06 1.2-1.88.8-3.54 1.8-4.98 3-1.44 1.2-2.56 2.5-3.36 3.9-.8 1.4-1.2 2.7-1.2 3.9v40.92l-10.68-8.4c-.72-.64-1.08-1.44-1.08-2.4v-53.76l10.92 8.52c.32.24.56.44.72.6.16.16.36.32.6.48.96-1.2 2.14-2.28 3.54-3.24 1.4-.96 2.92-1.76 4.56-2.4 1.64-.64 3.34-1.14 5.1-1.5 1.76-.36 3.44-.54 5.04-.54 1.44 0 2.92.04 4.44.12 1.52.08 2.84.28 3.96.6 4.56 1.12 7.8 3.12 9.72 6 1.92 2.88 2.88 6.56 2.88 11.04ZM732.38 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM795.93 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14ZM858.57 97.21c.64.48.96 1.16.96 2.04v74.88c-.08 1.04-.12 2.12-.12 3.24-1.84-1.52-3.56-2.92-5.16-4.2-1.36-1.12-2.66-2.18-3.9-3.18-1.24-1-2.06-1.66-2.46-1.98-1.76 2.48-4.26 4.44-7.5 5.88-3.24 1.44-7.02 2.16-11.34 2.16-3.84 0-7.4-.7-10.68-2.1-3.28-1.4-6.14-3.44-8.58-6.12-2.44-2.68-4.34-5.94-5.7-9.78-1.36-3.84-2.04-8.16-2.04-12.96 0-4.32.78-8.34 2.34-12.06 1.56-3.72 3.6-6.92 6.12-9.6 2.52-2.68 5.38-4.78 8.58-6.3 3.2-1.52 6.48-2.28 9.84-2.28 2.56 0 4.82.22 6.78.66 1.96.44 3.68 1.06 5.16 1.86s2.78 1.74 3.9 2.82a35.92 35.92 0 0 1 3.12 3.42V88.57l10.68 8.64Zm-27.96 67.92c3.6 0 6.52-.68 8.76-2.04 2.24-1.36 3.98-3.06 5.22-5.1a20.5 20.5 0 0 0 2.58-6.54c.48-2.32.72-4.44.72-6.36v-1.2c0-1.12-.22-2.7-.66-4.74-.44-2.04-1.28-4.06-2.52-6.06s-3-3.7-5.28-5.1c-2.28-1.4-5.22-2.02-8.82-1.86-3.44 0-6.26.74-8.46 2.22-2.2 1.48-3.96 3.26-5.28 5.34-1.32 2.08-2.24 4.2-2.76 6.36-.52 2.16-.78 3.92-.78 5.28 0 1.84.24 3.92.72 6.24.48 2.32 1.36 4.48 2.64 6.48s3.04 3.68 5.28 5.04c2.24 1.36 5.12 2.04 8.64 2.04ZM882.81 97.09c.64.48.96 1.12.96 1.92l-.12 41.04v37.08l-10.56-8.4c-.72-.64-1.08-1.44-1.08-2.4V88.45l10.8 8.64ZM950.36 146.05c0 .88.02 1.5.06 1.86.04.36-.02.98-.18 1.86h-7.08c-2.08 0-4.44-.02-7.08-.06-2.64-.04-5.36-.06-8.16-.06h-22.08c0 2.88.56 5.36 1.68 7.44 1.12 2.08 2.6 3.8 4.44 5.16 1.84 1.36 3.94 2.36 6.3 3 2.36.64 4.74.96 7.14.96 3.04 0 5.9-.76 8.58-2.28 2.68-1.52 4.94-3.52 6.78-6 .64.56 1.54 1.48 2.7 2.76 1.16 1.28 2.94 3.2 5.34 5.76-2.8 3.36-6.22 6.02-10.26 7.98-4.04 1.96-8.42 2.94-13.14 2.94-4.72 0-8.92-.64-12.84-1.92-3.92-1.28-7.32-3.24-10.2-5.88-2.88-2.64-5.12-5.98-6.72-10.02-1.6-4.04-2.4-8.82-2.4-14.34 0-4.96.66-9.42 1.98-13.38 1.32-3.96 3.22-7.32 5.7-10.08s5.44-4.9 8.88-6.42c3.44-1.52 7.32-2.28 11.64-2.28 5.76 0 10.52.88 14.28 2.64 3.76 1.76 6.72 4.16 8.88 7.2 2.16 3.04 3.66 6.54 4.5 10.5.84 3.96 1.26 8.18 1.26 12.66Zm-29.4-22.8c-2.16.16-4.16.72-6 1.68-1.84.96-3.42 2.2-4.74 3.72-1.32 1.52-2.36 3.28-3.12 5.28-.76 2-1.14 4.12-1.14 6.36h33.12c0-2-.22-4.06-.66-6.18-.44-2.12-1.3-4.02-2.58-5.7-1.28-1.68-3.1-3.02-5.46-4.02-2.36-1-5.5-1.38-9.42-1.14Z" style="fill-rule:nonzero" transform="translate(-452.406 -63.709) scale(1.00797)"/><path d="M79.32 36.98v150.76L95 174.54l6.59-156.31-22.27 18.75Z" style="fill:url(#a);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M79.32 36.98 57.05 18.23l6.59 156.31 15.68 13.2V36.98Z" style="fill:url(#b);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m25.19 104.83 8.63 49.04 12.5-14.95-2.46-56.42-18.67 22.33Z" style="fill:url(#c);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M25.19 104.83 0 90.24l16.97 53.86 16.85 9.77-8.63-49.04Z" style="fill:url(#d);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M43.86 82.5 18.69 67.98 0 90.24l25.18 14.59L43.86 82.5Z" style="fill:#9c3;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-9.97 56.5 15.58-9.04L160 64.1l-25.18 14.59Z" style="fill:url(#e);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m134.82 78.69-18.68-22.33-2.86 65 11.57 13.83 9.97-56.5Z" style="fill:url(#f);fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="m160 64.1-18.69-22.26-25.17 14.52 18.67 22.33L160 64.1Z" style="fill:#ffe113;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><path d="M101.59 18.23 79.32 0 57.05 18.23l22.27 18.75 22.27-18.75Z" style="fill:#f3e600;fill-rule:nonzero" transform="matrix(.80638 0 0 .80638 2.361 1.094)"/><defs><linearGradient id="a" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(.84 -162.96 162.96 .84 89.64 184.81)"><stop offset="0" style="stop-color:#62d399;stop-opacity:1"/><stop offset=".51" style="stop-color:#acd842;stop-opacity:1"/><stop offset=".9" style="stop-color:#d7db0a;stop-opacity:1"/><stop offset="1" style="stop-color:#d7db0a;stop-opacity:1"/></linearGradient><linearGradient id="b" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-90.565 123.412 54.953) scale(162.14)"><stop offset="0" style="stop-color:#0ba398;stop-opacity:1"/><stop offset=".5" style="stop-color:#4ca352;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30a;stop-opacity:1"/></linearGradient><linearGradient id="c" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="scale(-68) rotate(88.4 .881 -1.396)"><stop offset="0" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".19" style="stop-color:#36a382;stop-opacity:1"/><stop offset=".54" style="stop-color:#49a459;stop-opacity:1"/><stop offset="1" style="stop-color:#76a30b;stop-opacity:1"/></linearGradient><linearGradient id="d" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-88 87.255 68.431) scale(62.42)"><stop offset="0" style="stop-color:#267880;stop-opacity:1"/><stop offset=".51" style="stop-color:#457a5c;stop-opacity:1"/><stop offset="1" style="stop-color:#717516;stop-opacity:1"/></linearGradient><linearGradient id="e" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-79.1 149.53 -14.065) scale(73.28)"><stop offset="0" style="stop-color:#b0d939;stop-opacity:1"/><stop offset="1" style="stop-color:#eadb04;stop-opacity:1"/></linearGradient><linearGradient id="f" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="rotate(-67.997 148.705 -15.558) scale(69.8226)"><stop offset="0" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".17" style="stop-color:#74af52;stop-opacity:1"/><stop offset=".48" style="stop-color:#99be32;stop-opacity:1"/><stop offset="1" style="stop-color:#c0c40a;stop-opacity:1"/></linearGradient></defs></svg>',Zte=btoa(Kte),$te="data:image/svg+xml;charset=utf-8;base64,"+Zte,eie=$te,ea=ee("debuglicense");let Gd="basic";ea&&console.log("License Type: "+Gd);function Qa(){switch(Gd){case"pro":case"enterprise":return!0}return!1}function FT(){switch(Gd){case"indie":return!0}return!1}function og(){return Qa()||FT()}const b3=[];function tie(i){if(Qa()||FT())return i(!0);b3.push(i)}function iie(i){for(const e of b3)try{e(i)}catch{}}li.registerCallback(Si.ContextRegistered,i=>{sie(i.context),aie(),rie(i.context)});let Hd,UT=!1,Lx="";async function nie(){if(Hd)return Hd;if(Gd==="basic")try{const i="https://engine.needle.tools/licensing/check?location="+encodeURIComponent(window.location.href)+"&version="+Na+"&generator="+encodeURIComponent(Ox),e=await fetch(i,{method:"GET"}).catch(t=>{ea&&console.error("License check failed",t)});e?.status===200?(UT=!1,ea&&console.log("License check succeeded"),Gd="pro",iie(!0)):e?.status===403?(UT=!0,Lx=await e.text()):ea&&console.log("License check failed with status "+e?.status)}catch(i){ea&&console.error("License check failed",i)}else ea&&console.log('Runtime license check is skipped because license is already applied as "'+Gd+'"')}Hd=nie();async function rie(i){function e(){const r=document.createElement("div");r.className="needle-forbidden",r.style.cssText=`
4346
4346
  position: fixed;
4347
4347
  top: 0;
@@ -6327,7 +6327,7 @@ Texture:`,n),this.setLightmapDebugMaterial()):dy&&console.log("Use debuglightmap
6327
6327
  }`};var Gfe=Object.defineProperty,Hfe=Object.getOwnPropertyDescriptor,Mm=(i,e,t,n)=>{for(var r=n>1?void 0:n?Hfe(e,t):e,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(e,t,r):o(r))||r);return n&&r&&Gfe(e,t,r),r};const TC=ee("debugcontactshadows");var gP;const gH=(gP=class extends Be{constructor(){super(...arguments),u(this,"autoFit",!1),u(this,"darkness",.5),u(this,"opacity",.5),u(this,"blur",4),u(this,"occludeBelowGround",!1),u(this,"backfaceShadows",!0),u(this,"shadowCamera"),u(this,"shadowGroup"),u(this,"renderTarget"),u(this,"renderTargetBlur"),u(this,"plane"),u(this,"occluderMesh"),u(this,"blurPlane"),u(this,"depthMaterial"),u(this,"horizontalBlurMaterial"),u(this,"verticalBlurMaterial"),u(this,"textureSize",512)}static auto(i){if(i||(i=Pt.Current),!i)throw new Error("No context provided and no current context set.");let e=this._instances.get(i);if(!e||e.destroyed){const t=new be;e=Eu(t,gH,{autoFit:!1,occludeBelowGround:!1}),this._instances.set(i,e)}return i.scene.add(e.gameObject),e.fitShadows(),e}fitShadows(){TC&&console.log("Fitting shadows to scene"),CT(this.gameObject,!1);const i=PT(this.context.scene.children,[this.gameObject]),e=Math.max(.5,this.blur/32),t=i.max.x-i.min.x,n=i.max.z-i.min.z;i.expandByVector(new E(e*t,0,e*n)),TC&&wt.DrawWireBox3(i,16776960,60),this.gameObject.parent&&i.applyMatrix4(this.gameObject.parent.matrixWorld.clone().invert());const r=i.min,s=Math.max(1e-5,(i.max.y-r.y)*.002);i.max.y+=s,this.gameObject.position.set((r.x+i.max.x)/2,r.y-s,(r.z+i.max.z)/2),this.gameObject.scale.set(i.max.x-r.x,i.max.y-r.y,i.max.z-r.z),this.gameObject.matrixWorldNeedsUpdate=!0}awake(){CT(this.gameObject,!1)}start(){TC&&console.log("Create ContactShadows on "+this.gameObject.name,this),this.shadowGroup=new Js,this.gameObject.add(this.shadowGroup),this.renderTarget=new Ht(this.textureSize,this.textureSize),this.renderTarget.texture.generateMipmaps=!1,this.renderTargetBlur=new Ht(this.textureSize,this.textureSize),this.renderTargetBlur.texture.generateMipmaps=!1;const i=new Wn(1,1).rotateX(Math.PI/2);this.gameObject instanceof fe&&(console.warn("ContactShadows can not be added to a Mesh. Please add it to a Group or an empty Object"),Np(this.gameObject,!1));const e=new Jt({map:this.renderTarget.texture,opacity:this.opacity,color:0,transparent:!0,depthWrite:!1,side:Xn});this.plane=new fe(i,e),this.plane.scale.y=-1,this.gameObject.add(this.plane),this.plane&&(this.plane.renderOrder=1),this.occluderMesh=new fe(this.plane.geometry,new Jt({depthWrite:!0,stencilWrite:!0,colorWrite:!1,side:tn})).translateY(-1e-4),this.occluderMesh.renderOrder=-100,this.gameObject.add(this.occluderMesh),this.blurPlane=new fe(i),this.blurPlane.visible=!1,this.shadowGroup.add(this.blurPlane),this.shadowCamera=new _c(-1/2,1/2,1/2,-1/2,0,1),this.shadowCamera.rotation.x=Math.PI/2,this.shadowGroup.add(this.shadowCamera),this.depthMaterial=new TA,this.depthMaterial.userData.darkness={value:this.darkness},this.depthMaterial.blending=mE,this.depthMaterial.blendEquation=Cb,this.depthMaterial.onBeforeCompile=t=>{this.depthMaterial&&(t.uniforms.darkness=this.depthMaterial.userData.darkness,t.fragmentShader=`
6328
6328
  uniform float darkness;
6329
6329
  ${t.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 1.0 ), ( 1.0 - fragCoordZ ) * darkness * opacity * (gl_FrontFacing ? 1.0 : 0.66) );")}
6330
- `)},this.depthMaterial.depthTest=!1,this.depthMaterial.depthWrite=!1,this.horizontalBlurMaterial=new Mt(zfe),this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial=new Mt(jfe),this.verticalBlurMaterial.depthTest=!1,this.shadowGroup.visible=!1,this.autoFit&&this.fitShadows()}onDestroy(){var i,e,t,n,r,s,o,a;(i=this.renderTarget)==null||i.dispose(),(e=this.renderTargetBlur)==null||e.dispose(),(t=this.depthMaterial)==null||t.dispose(),(n=this.horizontalBlurMaterial)==null||n.dispose(),(r=this.verticalBlurMaterial)==null||r.dispose(),(s=this.blurPlane)==null||s.geometry.dispose(),(o=this.plane)==null||o.geometry.dispose(),(a=this.occluderMesh)==null||a.geometry.dispose()}onBeforeRender(i){if(!this.renderTarget||!this.renderTargetBlur||!this.depthMaterial||!this.shadowCamera||!this.blurPlane||!this.shadowGroup||!this.plane||!this.horizontalBlurMaterial||!this.verticalBlurMaterial){TC&&console.error("ContactShadows: not initialized yet");return}const e=this.context.scene,t=this.context.renderer,n=t.getRenderTarget();this.shadowGroup.visible=!0,this.occluderMesh&&(this.occluderMesh.visible=!1);const r=this.plane.visible;this.plane.visible=!1,this.gameObject instanceof fe&&Np(this.gameObject,!1);const s=e.background;e.background=null,e.overrideMaterial=this.depthMaterial,this.backfaceShadows?this.depthMaterial.side=ui:this.depthMaterial.side=Xn;const o=t.getClearAlpha();t.setClearAlpha(0);const a=t.xr.enabled;t.xr.enabled=!1;const l=t.renderLists.get(e,0),c=l.transparent;l.transparent=[],t.setRenderTarget(this.renderTarget),t.clear(),t.render(e,this.shadowCamera),l.transparent=c,e.overrideMaterial=null;const h=Math.max(this.blur,.05);this.blurShadow(h*2),this.blurShadow(h*.5),this.shadowGroup.visible=!1,this.occluderMesh&&(this.occluderMesh.visible=this.occludeBelowGround),this.plane.visible=r,t.setRenderTarget(n),t.setClearAlpha(o),e.background=s,t.xr.enabled=a}blurShadow(i){if(!this.blurPlane||!this.shadowCamera||!this.renderTarget||!this.renderTargetBlur||!this.horizontalBlurMaterial||!this.verticalBlurMaterial)return;this.blurPlane.visible=!0;const e=this.gameObject.worldScale,t=(e.x+e.z)/2,n=e.z/t,r=e.x/t;this.blurPlane.material=this.horizontalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTarget.texture,this.horizontalBlurMaterial.uniforms.h.value=i*1/this.textureSize*n;const s=this.context.renderer,o=s.getRenderTarget();s.setRenderTarget(this.renderTargetBlur),s.render(this.blurPlane,this.shadowCamera),this.blurPlane.material=this.verticalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTargetBlur.texture,this.verticalBlurMaterial.uniforms.v.value=i*1/this.textureSize*r,s.setRenderTarget(this.renderTarget),s.render(this.blurPlane,this.shadowCamera),this.blurPlane.visible=!1,s.setRenderTarget(o)}},u(gP,"_instances",new Map),gP);let hh=gH;Mm([x()],hh.prototype,"autoFit",2),Mm([x()],hh.prototype,"darkness",2),Mm([x()],hh.prototype,"opacity",2),Mm([x()],hh.prototype,"blur",2),Mm([x()],hh.prototype,"occludeBelowGround",2),Mm([x()],hh.prototype,"backfaceShadows",2);var Vfe=Object.defineProperty,Wfe=Object.getOwnPropertyDescriptor,by=(i,e,t,n)=>{for(var r=n>1?void 0:n?Wfe(e,t):e,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(e,t,r):o(r))||r);return n&&r&&Vfe(e,t,r),r};const mH=ee("debugwebxr"),qfe=new Me().makeRotationY(Math.PI);class Do extends Be{constructor(){super(...arguments),u(this,"_arScale",1),u(this,"invertForward",!1),u(this,"customReticle"),u(this,"useXRAnchor",!1),u(this,"arTouchTransform",!1),u(this,"_isPlacing",!0),u(this,"_startOffset",new Me),u(this,"_createdPlacementObject",null),u(this,"_reparentedComponents",[]),u(this,"_placementScene",new is),u(this,"_reticle",[]),u(this,"_hits",[]),u(this,"_placementStartTime",-1),u(this,"_rigPlacementMatrix"),u(this,"_anchor",null),u(this,"userInput"),u(this,"onPlaceScene",e=>{var t;if(this._isPlacing==!1||e.used)return;let n=this._reticle[0],r=this._hits[0];if(e.origin instanceof I2){const s=this._reticle[e.origin.index];s&&(n=s,r=this._hits[e.origin.index])}if(!n){console.warn("No reticle to place...");return}if(!n.visible){console.warn("Reticle is not visible (can not place)");return}if((t=yt.active)!=null&&t.isTrackingImages){console.warn("Scene Placement is disabled while images are being tracked");return}e.stopImmediatePropagation(),e.use(),this._isPlacing=!1,this.context.input.removeEventListener("pointerup",this.onPlaceScene),this.onRevertSceneChanges(),n.position.copy(n.lastPos),n.quaternion.copy(n.lastQuat),this.onApplyPose(n),this.useXRAnchor&&this.onCreateAnchor(yt.active,r)}),u(this,"upVec",new E(0,1,0)),u(this,"lookPoint",new E),u(this,"worldUpVec",new E(0,1,0))}get arScale(){return this._arScale}set arScale(e){e!==this._arScale&&(this._arScale=e,this.onScaleChanged())}onEnable(){var e;(e=this.customReticle)==null||e.preload()}supportsXR(e){return e==="immersive-ar"}onEnterXR(e){mH&&console.log("ENTER WEBXR: SessionRoot start..."),this._anchor=null,this.gameObject.updateMatrixWorld(),this._startOffset.copy(this.gameObject.matrixWorld);const t=new be;this._createdPlacementObject=t,t.name="AR Session Root",this._placementScene.name="AR Placement Scene",this._placementScene.children.length=0;for(let n=this.context.scene.children.length-1;n>=0;n--){const r=this.context.scene.children[n];this._placementScene.add(r)}this.context.scene.add(t),this._reparentedComponents.length=0,this._reparentedComponents.push({comp:this,originalObject:this.gameObject}),ne.addComponent(t,this);for(const n of this._reticle)$a(n);this._reticle.length=0,this._isPlacing=!0,this.context.input.addEventListener("pointerup",this.onPlaceScene,{queue:Il.Late})}onLeaveXR(){this.context.input.removeEventListener("pointerup",this.onPlaceScene,{queue:Il.Late}),this.onRevertSceneChanges(),this._anchor=null,this._rigPlacementMatrix=void 0}onUpdateXR(e){var t,n,r,s;if(e.xr.isTrackingImages){for(const o of this._reticle)o.visible=!1;return}if(this._isPlacing){const o=(t=e.xr.rig)==null?void 0:t.gameObject;o&&o.parent!==this.context.scene&&this.context.scene.add(o);let a=!1;if(e.xr.isPassThrough&&e.xr.controllers.length>0)for(const l of e.xr.controllers){const c=l.getHitTest();c&&(a=!0,this.updateReticleAndHits(e.xr,l.index,c,e.xr.rigScale))}if(!a){const l=e.xr.getHitTest();l&&this.updateReticleAndHits(e.xr,0,l,e.xr.rigScale)}}else{if(this._anchor&&e.xr.referenceSpace){const o=e.xr.frame.getPose(this._anchor.anchorSpace,e.xr.referenceSpace);if(o&&this.context.time.frame%20===0){const a=e.xr.convertSpace(o.transform),l=this._reticle[0];l&&(l.position.copy(a.position),l.quaternion.copy(a.quaternion),this.onApplyPose(l))}}if(this.arTouchTransform?(this.userInput||(this.userInput=new BC(this.context)),(n=this.userInput)==null||n.enable()):(r=this.userInput)==null||r.disable(),this.arTouchTransform&&(s=this.userInput)!=null&&s.hasChanged){if(e.xr.rig){const o=e.xr.rig.gameObject;this.userInput.applyMatrixTo(o.matrix,!0),o.matrix.decompose(o.position,o.quaternion,o.scale),this.userInput.factor=o.scale.x}this.userInput.reset()}}}updateReticleAndHits(e,t,n,r){this._hits[t]=n.hit;let s=this._reticle[t];if(!s){if(this.customReticle)if(this.customReticle.asset)s=tm(this.customReticle.asset);else{this.customReticle.loadAssetAsync();return}else s=new fe(new pf(.07,.09,32).rotateX(-Math.PI/2),new Jt({side:ui})),s.name="AR Placement Reticle";if(mH){const o=new qo(1);o.position.y+=.01,s.add(o)}this._reticle[t]=s,s.matrixAutoUpdate=!1,s.visible=!1}s.lastPos=s.lastPos||n.position.clone(),s.lastQuat=s.lastQuat||n.quaternion.clone(),s.position.copy(s.lastPos.lerp(n.position,this.context.time.deltaTime/.1)),s.lastPos.copy(s.position),s.quaternion.copy(s.lastQuat.slerp(n.quaternion,this.context.time.deltaTime/.05)),s.lastQuat.copy(s.quaternion),s.scale.set(r,r,r),this.customReticle&&this.applyViewBasedTransform(s),s.updateMatrix(),s.visible=!0,s.parent!==this.context.scene&&this.context.scene.add(s),this._placementStartTime<0&&(this._placementStartTime=this.context.time.realtimeSinceStartup)}onScaleChanged(){}onRevertSceneChanges(){var e;for(const t of this._reticle)t&&(t.visible=!1,t?.removeFromParent());this._reticle.length=0;for(let t=this._placementScene.children.length-1;t>=0;t--){const n=this._placementScene.children[t];this.context.scene.add(n)}(e=this._createdPlacementObject)==null||e.removeFromParent();for(const t of this._reparentedComponents)ne.addComponent(t.originalObject,t.comp)}async onCreateAnchor(e,t){if(t.createAnchor===void 0){console.warn("Hit does not support creating an anchor",t),dt()&&an("Hit does not support creating an anchor");return}else{const n=await t.createAnchor(e.viewerPose.transform);e.running&&n&&(this._anchor=n)}}applyViewBasedTransform(e){const t=this.context.mainCamera,n=e,r=t.worldPosition,s=n.worldPosition;this.upVec.set(0,1,0).applyQuaternion(e.quaternion);const o=t.worldPosition;o&&e.position.clone().sub(o).angleTo(this.upVec)<Math.PI/2&&this.upVec.negate();const a=this.upVec.angleTo(this.worldUpVec)*180/Math.PI,l=30;a>l&&a<180-l||a<-l&&a>-180+l?(this.lookPoint.copy(e.position).add(this.upVec),this.lookPoint.y=e.position.y,e.lookAt(this.lookPoint)):(r.y=s.y,e.lookAt(r))}onApplyPose(e){var t,n,r,s;const o=(n=(t=yt.active)==null?void 0:t.rig)==null?void 0:n.gameObject;if(!o){console.warn("No rig object to place");return}(r=yt.active)!=null&&r.rigScale;const a=o.parent||this.context.scene;this._rigPlacementMatrix?(s=this._rigPlacementMatrix)==null||s.decompose(o.position,o.quaternion,o.scale):this._rigPlacementMatrix=o.matrix.clone(),this.applyViewBasedTransform(e),e.updateMatrix(),this.context.scene.add(e),e.attach(o),e.removeFromParent(),o.scale.set(this.arScale,this.arScale,this.arScale),o.position.multiplyScalar(this.arScale),o.updateMatrix(),this.invertForward&&o.matrix.premultiply(qfe),o.matrix.premultiply(this._startOffset),o.matrix.decompose(o.position,o.quaternion,o.scale),a.add(o)}}by([x()],Do.prototype,"arScale",1),by([x()],Do.prototype,"invertForward",2),by([x($t)],Do.prototype,"customReticle",2),by([x()],Do.prototype,"useXRAnchor",2),by([x()],Do.prototype,"arTouchTransform",2);const mP=class{constructor(i){u(this,"oneFingerDrag",!0),u(this,"twoFingerRotate",!0),u(this,"twoFingerScale",!0),u(this,"factor",1),u(this,"context"),u(this,"offset"),u(this,"plane"),u(this,"_scale",1),u(this,"_hasChanged",!1),u(this,"_enabled",!1),u(this,"currentlyUsedPointerIds",new Set),u(this,"currentlyUnusedPointerIds",new Set),u(this,"onPointerDownEarly",e=>{this.isActive&&e.stopPropagation()}),u(this,"onPointerDownLate",e=>{e.used?this.currentlyUsedPointerIds.add(e.pointerId):this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.add(e.pointerId)}),u(this,"onPointerUpEarly",e=>{this.currentlyUsedPointerIds.delete(e.pointerId),this.currentlyUnusedPointerIds.delete(e.pointerId)}),u(this,"prev",new Map),u(this,"_didMultitouch",!1),u(this,"touchStart",e=>{for(let t=0;t<e.changedTouches.length;t++){const n=e.changedTouches[t],r=WU()&&n.clientY<window.innerHeight*.1;this.prev.has(n.identifier)||this.prev.set(n.identifier,{ignore:r,x:0,z:0,screenx:0,screeny:0});const s=this.prev.get(n.identifier);if(s){const o=this.getPositionOnPlane(n.clientX,n.clientY);s.x=o.x,s.z=o.z,s.screenx=n.clientX,s.screeny=n.clientY}}}),u(this,"touchEnd",e=>{e.touches.length<=0&&(this._didMultitouch=!1);for(let t=0;t<e.changedTouches.length;t++){const n=e.changedTouches[t];this.prev.delete(n.identifier)}}),u(this,"touchMove",e=>{if(!e.defaultPrevented&&this.isActive){if(e.touches.length===1){if(this._didMultitouch)return;const t=e.touches[0],n=this.prev.get(t.identifier);if(!n||n.ignore)return;const r=this.getPositionOnPlane(t.clientX,t.clientY),s=r.x-n.x,o=r.z-n.z;if(s===0&&o===0)return;this.oneFingerDrag&&this.addMovement(s,o),n.x=r.x,n.z=r.z,n.screenx=t.clientX,n.screeny=t.clientY;return}else if(e.touches.length===2){this._didMultitouch=!0;const t=e.touches[0],n=e.touches[1],r=this.prev.get(t.identifier),s=this.prev.get(n.identifier);if(!r||!s)return;if(this.twoFingerRotate){const o=Math.atan2(t.clientY-n.clientY,t.clientX-n.clientX),a=Math.atan2(r.screeny-s.screeny,r.screenx-s.screenx),l=o-a;Math.abs(l)>.001&&this.addRotation(l)}if(this.twoFingerScale){const o=t.clientX-n.clientX,a=t.clientY-n.clientY,l=Math.sqrt(o*o+a*a),c=r.screenx-s.screenx,h=r.screeny-s.screeny,d=Math.sqrt(c*c+h*h),p=l-d;Math.abs(p)>2&&this.addScale(p)}r.screenx=t.clientX,r.screeny=t.clientY,s.screenx=n.clientX,s.screeny=n.clientY}}}),u(this,"_raycaster",new kd),u(this,"_intersection",new E),u(this,"_screenPos",new E),u(this,"_tempMatrix",new Me),this.context=i,this.offset=new Me,this.plane=new Ts,this.plane.setFromNormalAndCoplanarPoint(mP.up,mP.zero)}reset(){this._scale=1,this.offset.identity()}get hasChanged(){return this._hasChanged}applyMatrixTo(i,e){this._hasChanged=!1,e?(this.offset.invert(),i.premultiply(this.offset)):i.multiply(this.offset)}get isActive(){return this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.size>0}enable(){this._enabled||(this._enabled=!0,this.context.input.addEventListener("pointerdown",this.onPointerDownEarly,{queue:Il.Early}),this.context.input.addEventListener("pointerdown",this.onPointerDownLate,{queue:Il.Late}),this.context.input.addEventListener("pointerup",this.onPointerUpEarly,{queue:Il.Early}),window.addEventListener("touchstart",this.touchStart,{passive:!1}),window.addEventListener("touchmove",this.touchMove,{passive:!1}),window.addEventListener("touchend",this.touchEnd,{passive:!1}))}disable(){this._enabled&&(this._enabled=!1,this.context.input.removeEventListener("pointerdown",this.onPointerDownEarly,{queue:Il.Early}),this.context.input.removeEventListener("pointerdown",this.onPointerDownLate,{queue:Il.Late}),this.context.input.removeEventListener("pointerup",this.onPointerUpEarly,{queue:Il.Early}),window.removeEventListener("touchstart",this.touchStart),window.removeEventListener("touchmove",this.touchMove),window.removeEventListener("touchend",this.touchEnd))}getPositionOnPlane(i,e){const t=this.context.mainCamera;return this._screenPos.x=i/window.innerWidth*2-1,this._screenPos.y=-(e/window.innerHeight)*2+1,this._screenPos.z=1,this._screenPos.unproject(t),this._raycaster.set(t.position,this._screenPos.sub(t.position)),this._raycaster.ray.intersectPlane(this.plane,this._intersection),this._intersection}addMovement(i,e){i/=this._scale,e/=this._scale,i*=this.factor,e*=this.factor,this.offset.elements[12]+=i,this.offset.elements[14]+=e,(i!==0||e!==0)&&(this._hasChanged=!0)}addScale(i){i/=window.innerWidth,i*=-1,this._scale*=1+i,this._tempMatrix.makeScale(1-i,1-i,1-i),this.offset.premultiply(this._tempMatrix),i!==0&&(this._hasChanged=!0)}addRotation(i){i*=-1,this._tempMatrix.makeRotationY(i),this.offset.premultiply(this._tempMatrix),i!==0&&(this._hasChanged=!0)}};let BC=mP;u(BC,"up",new E(0,1,0)),u(BC,"zero",new E(0,0,0)),u(BC,"one",new E(1,1,1));const _n={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function AH(i){const e=await fetch(i);if(e.ok)return e.json();throw new Error(e.statusText)}async function Xfe(i){if(!i)throw new Error("No basePath supplied");return await AH(`${i}/profilesList.json`)}async function Yfe(i,e,t=null,n=!0){if(!i)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await Xfe(e);let s;if(i.profiles.some(l=>{const c=r[l];return c&&(s={profileId:l,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const l=r[t];if(!l)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}}const o=await AH(s.profilePath);let a;if(n){let l;if(i.handedness==="any"?l=o.layouts[Object.keys(o.layouts)[0]]:l=o.layouts[i.handedness],!l)throw new Error(`No matching handedness, ${i.handedness}, in profile ${s.profileId}`);l.assetPath&&(a=s.profilePath.replace("profile.json",l.assetPath))}return{profile:o,assetPath:a}}const Jfe={xAxis:0,yAxis:0,button:0,state:_n.ComponentState.DEFAULT};function Kfe(i=0,e=0){let t=i,n=e;if(Math.sqrt(i*i+e*e)>1){const r=Math.atan2(e,i);t=Math.cos(r),n=Math.sin(r)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:n*.5+.5}}class Zfe{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===_n.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Jfe)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=Kfe(e,t);switch(this.componentProperty){case _n.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case _n.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case _n.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case _n.ComponentProperty.STATE:this.valueNodeProperty===_n.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class $fe{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(n=>{const r=new Zfe(t.visualResponses[n]);this.visualResponses[n]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:_n.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=_n.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=_n.ComponentState.PRESSED:(t.touched||this.values.button>_n.ButtonTouchThreshold)&&(this.values.state=_n.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===_n.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>_n.AxisTouchThreshold&&(this.values.state=_n.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===_n.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>_n.AxisTouchThreshold&&(this.values.state=_n.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class ege{constructor(e,t,n){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new $fe(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const tge="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",ige="generic-trigger";let nge=class extends be{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(i){return this.envMap==i?this:(this.envMap=i,this.traverse(e=>{e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(i){super.updateMatrixWorld(i),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(t=>{const{valueNode:n,minNode:r,maxNode:s,value:o,valueNodeProperty:a}=t;n&&(a===_n.VisualResponseProperty.VISIBILITY?n.visible=o:a===_n.VisualResponseProperty.TRANSFORM&&(n.quaternion.slerpQuaternions(r.quaternion,s.quaternion,o),n.position.lerpVectors(r.position,s.position,o)))})}))}};function rge(i,e){Object.values(i.components).forEach(t=>{const{type:n,touchPointNodeName:r,visualResponses:s}=t;if(n===_n.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(r),t.touchPointNode){const o=new al(.001),a=new Jt({color:255}),l=new fe(o,a);t.touchPointNode.add(l)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(s).forEach(o=>{const{valueNodeName:a,minNodeName:l,maxNodeName:c,valueNodeProperty:h}=o;if(h===_n.VisualResponseProperty.TRANSFORM){if(o.minNode=e.getObjectByName(l),o.maxNode=e.getObjectByName(c),!o.minNode){console.warn(`Could not find ${l} in the model`);return}if(!o.maxNode){console.warn(`Could not find ${c} in the model`);return}}o.valueNode=e.getObjectByName(a),o.valueNode||console.warn(`Could not find ${a} in the model`)})})}function vH(i,e){rge(i.motionController,e),i.envMap&&e.traverse(t=>{t.isMesh&&(t.material.envMap=i.envMap,t.material.needsUpdate=!0)}),i.layers.mask!=0&&e.traverse(t=>{t.layers.mask=i.layers.mask}),i.add(e)}class sge{constructor(e=null,t=null){this.gltfLoader=e,this.path=tge,this._assetCache={},this.onLoad=t,this.gltfLoader||(this.gltfLoader=new O0)}setPath(e){return this.path=e,this}createControllerModel(e){const t=new nge;let n=null;return e.addEventListener("connected",r=>{const s=r.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||Yfe(s,this.path,ige).then(({profile:o,assetPath:a})=>{t.motionController=new ege(s,o,a);const l=this._assetCache[t.motionController.assetUrl];if(l)n=l.scene.clone(),vH(t,n),this.onLoad&&this.onLoad(n);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,c=>{this._assetCache[t.motionController.assetUrl]=c,n=c.scene.clone(),vH(t,n),this.onLoad&&this.onLoad(n)},null,()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)})}}).catch(o=>{console.warn(o)})}),e.addEventListener("disconnected",()=>{t.motionController=null,t.remove(n),n=null}),t}}const oge="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/";class age{constructor(e,t,n,r,s=null,o=null){this.controller=t,this.handModel=e,this.bones=[],s===null&&(s=new O0,s.setPath(n||oge)),s.load(`${r}.glb`,a=>{const l=a.scene.children[0];this.handModel.add(l),l.layers.mask=this.handModel.layers.mask;const c=l.getObjectByProperty("type","SkinnedMesh");c.frustumCulled=!1,c.castShadow=!0,c.receiveShadow=!0,["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"].forEach(h=>{const d=l.getObjectByName(h);d!==void 0?d.jointName=h:console.warn(`Couldn't find ${h} in ${r} hand mesh`),this.bones.push(d)}),o&&o(l)})}updateMesh(){const e=this.controller.joints;for(let t=0;t<this.bones.length;t++){const n=this.bones[t];if(n){const r=e[n.jointName];if(r.visible){const s=r.position;n.position.copy(s),n.quaternion.copy(r.quaternion)}}}}}var lge=Object.defineProperty,cge=Object.getOwnPropertyDescriptor,RC=(i,e,t,n)=>{for(var r=n>1?void 0:n?cge(e,t):e,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(e,t,r):o(r))||r);return n&&r&&lge(e,t,r),r};const Vl=ee("debugwebxr"),Wu=new Array;class Wl extends Be{constructor(){super(...arguments),u(this,"createControllerModel",!0),u(this,"createHandModel",!0),u(this,"customLeftHand"),u(this,"customRightHand"),u(this,"_models",new Array)}supportsXR(e){return e==="immersive-vr"||e==="immersive-ar"}async onXRControllerAdded(e){var t,n,r;if(!(e.xr.isVR||e.xr.isPassThrough))return;const{controller:s}=e;if(Vl&&console.warn("Add Controller Model for",s.side,s.index),this.createControllerModel){if(s.hand){if(this.createHandModel){const o=await this.loadHandModel(s);if(!o||!s.connected||!s.isHand){(t=o?.handObject)==null||t.removeFromParent(),(r=(n=o?.handmesh)==null?void 0:n.controller)==null||r.removeFromParent();return}this._models.push({controller:s,model:o.handObject,handmesh:o.handmesh}),this._models.sort((a,l)=>a.controller.index-l.controller.index),this.scene.add(o.handObject)}}else if(this.createControllerModel){const o=await s.getModelUrl();if(o){const a=await this.loadModel(s,o);if(!a||!s.connected||s.isHand)return;this._models.push({controller:s,model:a}),this._models.sort((l,c)=>l.controller.index-c.controller.index),this.scene.add(a),a.traverse(l=>{l.layers.set(2)})}else s.targetRayMode!=="transient-pointer"&&console.warn("XRControllerModel: no model found for "+s.side)}}}onXRControllerRemoved(e){var t;const n=this._models.findIndex(s=>s.controller===e.controller),r=this._models[n];r&&(this._models.splice(n,1),r.handmesh&&((t=r.handmesh.handModel)==null||t.removeFromParent(),r.handmesh=void 0),r.model&&(r.model.removeFromParent(),r.model=void 0))}onBeforeRender(){if(yt.active&&(Vl&&(Wu[0]=Date.now()),this.updateRendering(yt.active),Vl)){const e=Date.now()-Wu[0];if(Wu.push(e),Wu.length>=30){Wu[0]=0;const t=Wu.reduce((n,r)=>n+r,0)/Wu.length;Wu.length=0,console.log("[XRControllerModel] "+t.toFixed(2)+" ms")}}}onLeaveXR(e){var t;for(const n of this._models)n&&((t=n.model)==null||t.removeFromParent());this._models.length=0}updateRendering(e){var t,n,r,s,o;for(let a=0;a<this._models.length;a++){const l=this._models[a];if(!l)continue;const c=l.controller;if(!c.connected){Vl&&console.warn("XRControllerModel.onUpdateXR: controller is not connected anymore",c.side,c.hand);continue}if(l.model&&!l.handmesh)l.model.position.copy(c.gripPosition),l.model.quaternion.copy(c.gripQuaternion),l.model.visible=c.isTracking,(t=e.rig)==null||t.gameObject.add(l.model);else if(c.inputSource.hand&&l.handmesh){const h=e.referenceSpace,d=this.context.renderer.xr.getHand(c.index);if(h&&e.frame.getJointPose){for(const p of c.inputSource.hand.values()){const f=d.joints[p.jointName];if(f){const g=c.getHandJointPose(p);if(g){const{position:A,quaternion:v}=e.convertSpace(g.transform);f.position.copy(A),f.quaternion.copy(v),f.matrixWorldAutoUpdate=!1}f.visible=g!=null}}l.model&&(l.model.visible=c.isTracking,l.model.visible&&l.model.parent!==((n=e.rig)==null?void 0:n.gameObject)&&((r=e.rig)==null||r.gameObject.add(l.model)),l.model.position.set(0,0,0)),(s=l.model)!=null&&s.visible&&((o=l.handmesh)==null||o.updateMesh())}}}}async loadModel(e,t){var n;if(!e.connected)return console.warn("XRControllerModel.onXRControllerAdded: controller is not connected anymore",e.side),null;const r=await $t.getOrCreate("",t).instantiate();return cD(r),(n=yt.active)!=null&&n.isPassThrough&&r.traverseVisible(s=>{this.makeOccluder(s)}),r}async loadHandModel(e){const t=this.context,n=t.renderer.xr.getHand(e.index);n||(Vl?wt.DrawLabel(e.rayWorldPosition,"No hand found for index "+e.index,.05,5):console.warn("No hand found for index "+e.index));const r=new O0;mw(r,t),await hP(r,t,this.sourceId??""),r.setPath("https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/");const s=e.side==="left"?"left.":"right.",o=e.side==="left"?this.customLeftHand:this.customRightHand;if(o)if(!o.uri.includes(s))console.warn("XRControllerModel: custom hand model must be named "+s),an("Custom Hand: unexpected name, please see the console for details");else{const c=o.uri.substring(0,o.uri.indexOf(s));r.setPath(c),Vl&&console.log("XRControllerModel: loading custom hand model from "+c)}const a=new be;cD(a);const l=new age(a,n,r.path,e.inputSource.handedness,r,c=>{c.traverse(h=>{var d;h.layers.set(2),(d=yt.active)!=null&&d.isPassThrough&&this.makeOccluder(h),h instanceof fe&&pi.assignMeshLOD(h,0)}),e.connected||(Vl&&wt.DrawLabel(e.rayWorldPosition,"Hand is loaded but not connected anymore",.05,5),c.removeFromParent())});if(Vl&&a.add(new qo(.5)),e.inputSource.hand){Vl&&console.log(e.inputSource.hand);for(const c of e.inputSource.hand.values())if(n.joints[c.jointName]===void 0){const h=new Js;h.matrixAutoUpdate=!1,h.visible=!0,n.joints[c.jointName]=h,n.add(h)}}else Vl&&wt.DrawLabel(e.rayWorldPosition,"No inputSource.hand found for index "+e.index,.05,5);return{handObject:a,handmesh:l}}makeOccluder(e){if(e instanceof fe){let t=e.material;t instanceof Lt&&(t=e.material=t.clone(),t.depthWrite=!0,t.depthTest=!0,t.colorWrite=!1,e.renderOrder=-100)}}}u(Wl,"factory",new sge),RC([x()],Wl.prototype,"createControllerModel",2),RC([x()],Wl.prototype,"createHandModel",2),RC([x($t)],Wl.prototype,"customLeftHand",2),RC([x($t)],Wl.prototype,"customRightHand",2);const yH=new bi,DC=new E;class bH extends $_{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new lt(e,3)),this.setAttribute("uv",new lt(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new rx(t,6,1);return this.setAttribute("instanceStart",new ho(n,3,0)),this.setAttribute("instanceEnd",new ho(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new rx(t,6,1);return this.setAttribute("instanceColorStart",new ho(n,3,0)),this.setAttribute("instanceColorEnd",new ho(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new aM(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bi);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),yH.setFromBufferAttribute(t),this.boundingBox.union(yH))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)DC.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(DC)),DC.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(DC));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}ze.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new $(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Er.line={uniforms:Lf.merge([ze.common,ze.fog,ze.line]),vertexShader:`
6330
+ `)},this.depthMaterial.depthTest=!1,this.depthMaterial.depthWrite=!1,this.horizontalBlurMaterial=new Mt(zfe),this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial=new Mt(jfe),this.verticalBlurMaterial.depthTest=!1,this.shadowGroup.visible=!1,this.autoFit&&this.fitShadows()}onDestroy(){var i,e,t,n,r,s,o,a;(i=this.renderTarget)==null||i.dispose(),(e=this.renderTargetBlur)==null||e.dispose(),(t=this.depthMaterial)==null||t.dispose(),(n=this.horizontalBlurMaterial)==null||n.dispose(),(r=this.verticalBlurMaterial)==null||r.dispose(),(s=this.blurPlane)==null||s.geometry.dispose(),(o=this.plane)==null||o.geometry.dispose(),(a=this.occluderMesh)==null||a.geometry.dispose()}onBeforeRender(i){if(!this.renderTarget||!this.renderTargetBlur||!this.depthMaterial||!this.shadowCamera||!this.blurPlane||!this.shadowGroup||!this.plane||!this.horizontalBlurMaterial||!this.verticalBlurMaterial){TC&&console.error("ContactShadows: not initialized yet");return}const e=this.context.scene,t=this.context.renderer,n=t.getRenderTarget();this.shadowGroup.visible=!0,this.occluderMesh&&(this.occluderMesh.visible=!1);const r=this.plane.visible;this.plane.visible=!1,this.gameObject instanceof fe&&Np(this.gameObject,!1);const s=e.background;e.background=null,e.overrideMaterial=this.depthMaterial,this.backfaceShadows?this.depthMaterial.side=ui:this.depthMaterial.side=Xn;const o=t.getClearAlpha();t.setClearAlpha(0);const a=t.xr.enabled;t.xr.enabled=!1;const l=t.renderLists.get(e,0),c=l.transparent;l.transparent=[],t.setRenderTarget(this.renderTarget),t.clear(),t.render(e,this.shadowCamera),l.transparent=c,e.overrideMaterial=null;const h=Math.max(this.blur,.05);this.blurShadow(h*2),this.blurShadow(h*.5),this.shadowGroup.visible=!1,this.occluderMesh&&(this.occluderMesh.visible=this.occludeBelowGround),this.plane.visible=r,t.setRenderTarget(n),t.setClearAlpha(o),e.background=s,t.xr.enabled=a}blurShadow(i){if(!this.blurPlane||!this.shadowCamera||!this.renderTarget||!this.renderTargetBlur||!this.horizontalBlurMaterial||!this.verticalBlurMaterial)return;this.blurPlane.visible=!0;const e=this.gameObject.worldScale,t=(e.x+e.z)/2,n=e.z/t,r=e.x/t;this.blurPlane.material=this.horizontalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTarget.texture,this.horizontalBlurMaterial.uniforms.h.value=i*1/this.textureSize*n;const s=this.context.renderer,o=s.getRenderTarget();s.setRenderTarget(this.renderTargetBlur),s.render(this.blurPlane,this.shadowCamera),this.blurPlane.material=this.verticalBlurMaterial,this.blurPlane.material.uniforms.tDiffuse.value=this.renderTargetBlur.texture,this.verticalBlurMaterial.uniforms.v.value=i*1/this.textureSize*r,s.setRenderTarget(this.renderTarget),s.render(this.blurPlane,this.shadowCamera),this.blurPlane.visible=!1,s.setRenderTarget(o)}},u(gP,"_instances",new Map),gP);let hh=gH;Mm([x()],hh.prototype,"autoFit",2),Mm([x()],hh.prototype,"darkness",2),Mm([x()],hh.prototype,"opacity",2),Mm([x()],hh.prototype,"blur",2),Mm([x()],hh.prototype,"occludeBelowGround",2),Mm([x()],hh.prototype,"backfaceShadows",2);var Vfe=Object.defineProperty,Wfe=Object.getOwnPropertyDescriptor,by=(i,e,t,n)=>{for(var r=n>1?void 0:n?Wfe(e,t):e,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(e,t,r):o(r))||r);return n&&r&&Vfe(e,t,r),r};const mH=ee("debugwebxr"),qfe=new Me().makeRotationY(Math.PI);class Do extends Be{constructor(){super(...arguments),u(this,"_arScale",1),u(this,"invertForward",!1),u(this,"customReticle"),u(this,"useXRAnchor",!1),u(this,"arTouchTransform",!1),u(this,"_isPlacing",!0),u(this,"_startOffset",new Me),u(this,"_createdPlacementObject",null),u(this,"_reparentedComponents",[]),u(this,"_placementScene",new is),u(this,"_reticle",[]),u(this,"_hits",[]),u(this,"_placementStartTime",-1),u(this,"_rigPlacementMatrix"),u(this,"_anchor",null),u(this,"userInput"),u(this,"onPlaceScene",e=>{var t;if(this._isPlacing==!1||e.used)return;let n=this._reticle[0],r=this._hits[0];if(e.origin instanceof I2){const s=this._reticle[e.origin.index];s&&(n=s,r=this._hits[e.origin.index])}if(!n){console.warn("No reticle to place...");return}if(!n.visible){console.warn("Reticle is not visible (can not place)");return}if((t=yt.active)!=null&&t.isTrackingImages){console.warn("Scene Placement is disabled while images are being tracked");return}e.stopImmediatePropagation(),e.stopPropagation(),e.use(),this._isPlacing=!1,this.context.input.removeEventListener("pointerup",this.onPlaceScene),this.onRevertSceneChanges(),n.position.copy(n.lastPos),n.quaternion.copy(n.lastQuat),this.onApplyPose(n),this.useXRAnchor&&this.onCreateAnchor(yt.active,r)}),u(this,"upVec",new E(0,1,0)),u(this,"lookPoint",new E),u(this,"worldUpVec",new E(0,1,0))}get arScale(){return this._arScale}set arScale(e){e!==this._arScale&&(this._arScale=e,this.onScaleChanged())}onEnable(){var e;(e=this.customReticle)==null||e.preload()}supportsXR(e){return e==="immersive-ar"}onEnterXR(e){mH&&console.log("ENTER WEBXR: SessionRoot start..."),this._anchor=null,this.gameObject.updateMatrixWorld(),this._startOffset.copy(this.gameObject.matrixWorld);const t=new be;this._createdPlacementObject=t,t.name="AR Session Root",this._placementScene.name="AR Placement Scene",this._placementScene.children.length=0;for(let n=this.context.scene.children.length-1;n>=0;n--){const r=this.context.scene.children[n];this._placementScene.add(r)}this.context.scene.add(t),this._reparentedComponents.length=0,this._reparentedComponents.push({comp:this,originalObject:this.gameObject}),ne.addComponent(t,this);for(const n of this._reticle)$a(n);this._reticle.length=0,this._isPlacing=!0,this.context.input.addEventListener("pointerup",this.onPlaceScene,{queue:Il.Early})}onLeaveXR(){this.context.input.removeEventListener("pointerup",this.onPlaceScene,{queue:Il.Early}),this.onRevertSceneChanges(),this._anchor=null,this._rigPlacementMatrix=void 0}onUpdateXR(e){var t,n,r,s;if(e.xr.isTrackingImages){for(const o of this._reticle)o.visible=!1;return}if(this._isPlacing){const o=(t=e.xr.rig)==null?void 0:t.gameObject;o&&o.parent!==this.context.scene&&this.context.scene.add(o);let a=!1;if(e.xr.isPassThrough&&e.xr.controllers.length>0)for(const l of e.xr.controllers){const c=l.getHitTest();c&&(a=!0,this.updateReticleAndHits(e.xr,l.index,c,e.xr.rigScale))}if(!a){const l=e.xr.getHitTest();l&&this.updateReticleAndHits(e.xr,0,l,e.xr.rigScale)}}else{if(this._anchor&&e.xr.referenceSpace){const o=e.xr.frame.getPose(this._anchor.anchorSpace,e.xr.referenceSpace);if(o&&this.context.time.frame%20===0){const a=e.xr.convertSpace(o.transform),l=this._reticle[0];l&&(l.position.copy(a.position),l.quaternion.copy(a.quaternion),this.onApplyPose(l))}}if(this.arTouchTransform?(this.userInput||(this.userInput=new BC(this.context)),(n=this.userInput)==null||n.enable()):(r=this.userInput)==null||r.disable(),this.arTouchTransform&&(s=this.userInput)!=null&&s.hasChanged){if(e.xr.rig){const o=e.xr.rig.gameObject;this.userInput.applyMatrixTo(o.matrix,!0),o.matrix.decompose(o.position,o.quaternion,o.scale),this.userInput.factor=o.scale.x}this.userInput.reset()}}}updateReticleAndHits(e,t,n,r){this._hits[t]=n.hit;let s=this._reticle[t];if(!s){if(this.customReticle)if(this.customReticle.asset)s=tm(this.customReticle.asset);else{this.customReticle.loadAssetAsync();return}else s=new fe(new pf(.07,.09,32).rotateX(-Math.PI/2),new Jt({side:ui})),s.name="AR Placement Reticle";if(mH){const o=new qo(1);o.position.y+=.01,s.add(o)}this._reticle[t]=s,s.matrixAutoUpdate=!1,s.visible=!1}s.lastPos=s.lastPos||n.position.clone(),s.lastQuat=s.lastQuat||n.quaternion.clone(),s.position.copy(s.lastPos.lerp(n.position,this.context.time.deltaTime/.1)),s.lastPos.copy(s.position),s.quaternion.copy(s.lastQuat.slerp(n.quaternion,this.context.time.deltaTime/.05)),s.lastQuat.copy(s.quaternion),s.scale.set(r,r,r),this.customReticle&&this.applyViewBasedTransform(s),s.updateMatrix(),s.visible=!0,s.parent!==this.context.scene&&this.context.scene.add(s),this._placementStartTime<0&&(this._placementStartTime=this.context.time.realtimeSinceStartup)}onScaleChanged(){}onRevertSceneChanges(){var e;for(const t of this._reticle)t&&(t.visible=!1,t?.removeFromParent());this._reticle.length=0;for(let t=this._placementScene.children.length-1;t>=0;t--){const n=this._placementScene.children[t];this.context.scene.add(n)}(e=this._createdPlacementObject)==null||e.removeFromParent();for(const t of this._reparentedComponents)ne.addComponent(t.originalObject,t.comp)}async onCreateAnchor(e,t){if(t.createAnchor===void 0){console.warn("Hit does not support creating an anchor",t),dt()&&an("Hit does not support creating an anchor");return}else{const n=await t.createAnchor(e.viewerPose.transform);e.running&&n&&(this._anchor=n)}}applyViewBasedTransform(e){const t=this.context.mainCamera,n=e,r=t.worldPosition,s=n.worldPosition;this.upVec.set(0,1,0).applyQuaternion(e.quaternion);const o=t.worldPosition;o&&e.position.clone().sub(o).angleTo(this.upVec)<Math.PI/2&&this.upVec.negate();const a=this.upVec.angleTo(this.worldUpVec)*180/Math.PI,l=30;a>l&&a<180-l||a<-l&&a>-180+l?(this.lookPoint.copy(e.position).add(this.upVec),this.lookPoint.y=e.position.y,e.lookAt(this.lookPoint)):(r.y=s.y,e.lookAt(r))}onApplyPose(e){var t,n,r,s;const o=(n=(t=yt.active)==null?void 0:t.rig)==null?void 0:n.gameObject;if(!o){console.warn("No rig object to place");return}(r=yt.active)!=null&&r.rigScale;const a=o.parent||this.context.scene;this._rigPlacementMatrix?(s=this._rigPlacementMatrix)==null||s.decompose(o.position,o.quaternion,o.scale):this._rigPlacementMatrix=o.matrix.clone(),this.applyViewBasedTransform(e),e.updateMatrix(),this.context.scene.add(e),e.attach(o),e.removeFromParent(),o.scale.set(this.arScale,this.arScale,this.arScale),o.position.multiplyScalar(this.arScale),o.updateMatrix(),this.invertForward&&o.matrix.premultiply(qfe),o.matrix.premultiply(this._startOffset),o.matrix.decompose(o.position,o.quaternion,o.scale),a.add(o)}}by([x()],Do.prototype,"arScale",1),by([x()],Do.prototype,"invertForward",2),by([x($t)],Do.prototype,"customReticle",2),by([x()],Do.prototype,"useXRAnchor",2),by([x()],Do.prototype,"arTouchTransform",2);const mP=class{constructor(i){u(this,"oneFingerDrag",!0),u(this,"twoFingerRotate",!0),u(this,"twoFingerScale",!0),u(this,"factor",1),u(this,"context"),u(this,"offset"),u(this,"plane"),u(this,"_scale",1),u(this,"_hasChanged",!1),u(this,"_enabled",!1),u(this,"currentlyUsedPointerIds",new Set),u(this,"currentlyUnusedPointerIds",new Set),u(this,"onPointerDownEarly",e=>{this.isActive&&e.stopPropagation()}),u(this,"onPointerDownLate",e=>{e.used?this.currentlyUsedPointerIds.add(e.pointerId):this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.add(e.pointerId)}),u(this,"onPointerUpEarly",e=>{this.currentlyUsedPointerIds.delete(e.pointerId),this.currentlyUnusedPointerIds.delete(e.pointerId)}),u(this,"prev",new Map),u(this,"_didMultitouch",!1),u(this,"touchStart",e=>{for(let t=0;t<e.changedTouches.length;t++){const n=e.changedTouches[t],r=WU()&&n.clientY<window.innerHeight*.1;this.prev.has(n.identifier)||this.prev.set(n.identifier,{ignore:r,x:0,z:0,screenx:0,screeny:0});const s=this.prev.get(n.identifier);if(s){const o=this.getPositionOnPlane(n.clientX,n.clientY);s.x=o.x,s.z=o.z,s.screenx=n.clientX,s.screeny=n.clientY}}}),u(this,"touchEnd",e=>{e.touches.length<=0&&(this._didMultitouch=!1);for(let t=0;t<e.changedTouches.length;t++){const n=e.changedTouches[t];this.prev.delete(n.identifier)}}),u(this,"touchMove",e=>{if(!e.defaultPrevented&&this.isActive){if(e.touches.length===1){if(this._didMultitouch)return;const t=e.touches[0],n=this.prev.get(t.identifier);if(!n||n.ignore)return;const r=this.getPositionOnPlane(t.clientX,t.clientY),s=r.x-n.x,o=r.z-n.z;if(s===0&&o===0)return;this.oneFingerDrag&&this.addMovement(s,o),n.x=r.x,n.z=r.z,n.screenx=t.clientX,n.screeny=t.clientY;return}else if(e.touches.length===2){this._didMultitouch=!0;const t=e.touches[0],n=e.touches[1],r=this.prev.get(t.identifier),s=this.prev.get(n.identifier);if(!r||!s)return;if(this.twoFingerRotate){const o=Math.atan2(t.clientY-n.clientY,t.clientX-n.clientX),a=Math.atan2(r.screeny-s.screeny,r.screenx-s.screenx),l=o-a;Math.abs(l)>.001&&this.addRotation(l)}if(this.twoFingerScale){const o=t.clientX-n.clientX,a=t.clientY-n.clientY,l=Math.sqrt(o*o+a*a),c=r.screenx-s.screenx,h=r.screeny-s.screeny,d=Math.sqrt(c*c+h*h),p=l-d;Math.abs(p)>2&&this.addScale(p)}r.screenx=t.clientX,r.screeny=t.clientY,s.screenx=n.clientX,s.screeny=n.clientY}}}),u(this,"_raycaster",new kd),u(this,"_intersection",new E),u(this,"_screenPos",new E),u(this,"_tempMatrix",new Me),this.context=i,this.offset=new Me,this.plane=new Ts,this.plane.setFromNormalAndCoplanarPoint(mP.up,mP.zero)}reset(){this._scale=1,this.offset.identity()}get hasChanged(){return this._hasChanged}applyMatrixTo(i,e){this._hasChanged=!1,e?(this.offset.invert(),i.premultiply(this.offset)):i.multiply(this.offset)}get isActive(){return this.currentlyUsedPointerIds.size<=0&&this.currentlyUnusedPointerIds.size>0}enable(){this._enabled||(this._enabled=!0,this.context.input.addEventListener("pointerdown",this.onPointerDownEarly,{queue:Il.Early}),this.context.input.addEventListener("pointerdown",this.onPointerDownLate,{queue:Il.Late}),this.context.input.addEventListener("pointerup",this.onPointerUpEarly,{queue:Il.Early}),window.addEventListener("touchstart",this.touchStart,{passive:!1}),window.addEventListener("touchmove",this.touchMove,{passive:!1}),window.addEventListener("touchend",this.touchEnd,{passive:!1}))}disable(){this._enabled&&(this._enabled=!1,this.context.input.removeEventListener("pointerdown",this.onPointerDownEarly,{queue:Il.Early}),this.context.input.removeEventListener("pointerdown",this.onPointerDownLate,{queue:Il.Late}),this.context.input.removeEventListener("pointerup",this.onPointerUpEarly,{queue:Il.Early}),window.removeEventListener("touchstart",this.touchStart),window.removeEventListener("touchmove",this.touchMove),window.removeEventListener("touchend",this.touchEnd))}getPositionOnPlane(i,e){const t=this.context.mainCamera;return this._screenPos.x=i/window.innerWidth*2-1,this._screenPos.y=-(e/window.innerHeight)*2+1,this._screenPos.z=1,this._screenPos.unproject(t),this._raycaster.set(t.position,this._screenPos.sub(t.position)),this._raycaster.ray.intersectPlane(this.plane,this._intersection),this._intersection}addMovement(i,e){i/=this._scale,e/=this._scale,i*=this.factor,e*=this.factor,this.offset.elements[12]+=i,this.offset.elements[14]+=e,(i!==0||e!==0)&&(this._hasChanged=!0)}addScale(i){i/=window.innerWidth,i*=-1,this._scale*=1+i,this._tempMatrix.makeScale(1-i,1-i,1-i),this.offset.premultiply(this._tempMatrix),i!==0&&(this._hasChanged=!0)}addRotation(i){i*=-1,this._tempMatrix.makeRotationY(i),this.offset.premultiply(this._tempMatrix),i!==0&&(this._hasChanged=!0)}};let BC=mP;u(BC,"up",new E(0,1,0)),u(BC,"zero",new E(0,0,0)),u(BC,"one",new E(1,1,1));const _n={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function AH(i){const e=await fetch(i);if(e.ok)return e.json();throw new Error(e.statusText)}async function Xfe(i){if(!i)throw new Error("No basePath supplied");return await AH(`${i}/profilesList.json`)}async function Yfe(i,e,t=null,n=!0){if(!i)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const r=await Xfe(e);let s;if(i.profiles.some(l=>{const c=r[l];return c&&(s={profileId:l,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const l=r[t];if(!l)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}}const o=await AH(s.profilePath);let a;if(n){let l;if(i.handedness==="any"?l=o.layouts[Object.keys(o.layouts)[0]]:l=o.layouts[i.handedness],!l)throw new Error(`No matching handedness, ${i.handedness}, in profile ${s.profileId}`);l.assetPath&&(a=s.profilePath.replace("profile.json",l.assetPath))}return{profile:o,assetPath:a}}const Jfe={xAxis:0,yAxis:0,button:0,state:_n.ComponentState.DEFAULT};function Kfe(i=0,e=0){let t=i,n=e;if(Math.sqrt(i*i+e*e)>1){const r=Math.atan2(e,i);t=Math.cos(r),n=Math.sin(r)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:n*.5+.5}}class Zfe{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===_n.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Jfe)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=Kfe(e,t);switch(this.componentProperty){case _n.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case _n.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case _n.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case _n.ComponentProperty.STATE:this.valueNodeProperty===_n.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class $fe{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(n=>{const r=new Zfe(t.visualResponses[n]);this.visualResponses[n]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:_n.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=_n.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=_n.ComponentState.PRESSED:(t.touched||this.values.button>_n.ButtonTouchThreshold)&&(this.values.state=_n.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===_n.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>_n.AxisTouchThreshold&&(this.values.state=_n.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===_n.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>_n.AxisTouchThreshold&&(this.values.state=_n.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class ege{constructor(e,t,n){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new $fe(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const tge="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",ige="generic-trigger";let nge=class extends be{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(i){return this.envMap==i?this:(this.envMap=i,this.traverse(e=>{e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(i){super.updateMatrixWorld(i),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(t=>{const{valueNode:n,minNode:r,maxNode:s,value:o,valueNodeProperty:a}=t;n&&(a===_n.VisualResponseProperty.VISIBILITY?n.visible=o:a===_n.VisualResponseProperty.TRANSFORM&&(n.quaternion.slerpQuaternions(r.quaternion,s.quaternion,o),n.position.lerpVectors(r.position,s.position,o)))})}))}};function rge(i,e){Object.values(i.components).forEach(t=>{const{type:n,touchPointNodeName:r,visualResponses:s}=t;if(n===_n.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(r),t.touchPointNode){const o=new al(.001),a=new Jt({color:255}),l=new fe(o,a);t.touchPointNode.add(l)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(s).forEach(o=>{const{valueNodeName:a,minNodeName:l,maxNodeName:c,valueNodeProperty:h}=o;if(h===_n.VisualResponseProperty.TRANSFORM){if(o.minNode=e.getObjectByName(l),o.maxNode=e.getObjectByName(c),!o.minNode){console.warn(`Could not find ${l} in the model`);return}if(!o.maxNode){console.warn(`Could not find ${c} in the model`);return}}o.valueNode=e.getObjectByName(a),o.valueNode||console.warn(`Could not find ${a} in the model`)})})}function vH(i,e){rge(i.motionController,e),i.envMap&&e.traverse(t=>{t.isMesh&&(t.material.envMap=i.envMap,t.material.needsUpdate=!0)}),i.layers.mask!=0&&e.traverse(t=>{t.layers.mask=i.layers.mask}),i.add(e)}class sge{constructor(e=null,t=null){this.gltfLoader=e,this.path=tge,this._assetCache={},this.onLoad=t,this.gltfLoader||(this.gltfLoader=new O0)}setPath(e){return this.path=e,this}createControllerModel(e){const t=new nge;let n=null;return e.addEventListener("connected",r=>{const s=r.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||Yfe(s,this.path,ige).then(({profile:o,assetPath:a})=>{t.motionController=new ege(s,o,a);const l=this._assetCache[t.motionController.assetUrl];if(l)n=l.scene.clone(),vH(t,n),this.onLoad&&this.onLoad(n);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,c=>{this._assetCache[t.motionController.assetUrl]=c,n=c.scene.clone(),vH(t,n),this.onLoad&&this.onLoad(n)},null,()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)})}}).catch(o=>{console.warn(o)})}),e.addEventListener("disconnected",()=>{t.motionController=null,t.remove(n),n=null}),t}}const oge="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/";class age{constructor(e,t,n,r,s=null,o=null){this.controller=t,this.handModel=e,this.bones=[],s===null&&(s=new O0,s.setPath(n||oge)),s.load(`${r}.glb`,a=>{const l=a.scene.children[0];this.handModel.add(l),l.layers.mask=this.handModel.layers.mask;const c=l.getObjectByProperty("type","SkinnedMesh");c.frustumCulled=!1,c.castShadow=!0,c.receiveShadow=!0,["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"].forEach(h=>{const d=l.getObjectByName(h);d!==void 0?d.jointName=h:console.warn(`Couldn't find ${h} in ${r} hand mesh`),this.bones.push(d)}),o&&o(l)})}updateMesh(){const e=this.controller.joints;for(let t=0;t<this.bones.length;t++){const n=this.bones[t];if(n){const r=e[n.jointName];if(r.visible){const s=r.position;n.position.copy(s),n.quaternion.copy(r.quaternion)}}}}}var lge=Object.defineProperty,cge=Object.getOwnPropertyDescriptor,RC=(i,e,t,n)=>{for(var r=n>1?void 0:n?cge(e,t):e,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(e,t,r):o(r))||r);return n&&r&&lge(e,t,r),r};const Vl=ee("debugwebxr"),Wu=new Array;class Wl extends Be{constructor(){super(...arguments),u(this,"createControllerModel",!0),u(this,"createHandModel",!0),u(this,"customLeftHand"),u(this,"customRightHand"),u(this,"_models",new Array)}supportsXR(e){return e==="immersive-vr"||e==="immersive-ar"}async onXRControllerAdded(e){var t,n,r;if(!(e.xr.isVR||e.xr.isPassThrough))return;const{controller:s}=e;if(Vl&&console.warn("Add Controller Model for",s.side,s.index),this.createControllerModel){if(s.hand){if(this.createHandModel){const o=await this.loadHandModel(s);if(!o||!s.connected||!s.isHand){(t=o?.handObject)==null||t.removeFromParent(),(r=(n=o?.handmesh)==null?void 0:n.controller)==null||r.removeFromParent();return}this._models.push({controller:s,model:o.handObject,handmesh:o.handmesh}),this._models.sort((a,l)=>a.controller.index-l.controller.index),this.scene.add(o.handObject)}}else if(this.createControllerModel){const o=await s.getModelUrl();if(o){const a=await this.loadModel(s,o);if(!a||!s.connected||s.isHand)return;this._models.push({controller:s,model:a}),this._models.sort((l,c)=>l.controller.index-c.controller.index),this.scene.add(a),a.traverse(l=>{l.layers.set(2)})}else s.targetRayMode!=="transient-pointer"&&console.warn("XRControllerModel: no model found for "+s.side)}}}onXRControllerRemoved(e){var t;const n=this._models.findIndex(s=>s.controller===e.controller),r=this._models[n];r&&(this._models.splice(n,1),r.handmesh&&((t=r.handmesh.handModel)==null||t.removeFromParent(),r.handmesh=void 0),r.model&&(r.model.removeFromParent(),r.model=void 0))}onBeforeRender(){if(yt.active&&(Vl&&(Wu[0]=Date.now()),this.updateRendering(yt.active),Vl)){const e=Date.now()-Wu[0];if(Wu.push(e),Wu.length>=30){Wu[0]=0;const t=Wu.reduce((n,r)=>n+r,0)/Wu.length;Wu.length=0,console.log("[XRControllerModel] "+t.toFixed(2)+" ms")}}}onLeaveXR(e){var t;for(const n of this._models)n&&((t=n.model)==null||t.removeFromParent());this._models.length=0}updateRendering(e){var t,n,r,s,o;for(let a=0;a<this._models.length;a++){const l=this._models[a];if(!l)continue;const c=l.controller;if(!c.connected){Vl&&console.warn("XRControllerModel.onUpdateXR: controller is not connected anymore",c.side,c.hand);continue}if(l.model&&!l.handmesh)l.model.position.copy(c.gripPosition),l.model.quaternion.copy(c.gripQuaternion),l.model.visible=c.isTracking,(t=e.rig)==null||t.gameObject.add(l.model);else if(c.inputSource.hand&&l.handmesh){const h=e.referenceSpace,d=this.context.renderer.xr.getHand(c.index);if(h&&e.frame.getJointPose){for(const p of c.inputSource.hand.values()){const f=d.joints[p.jointName];if(f){const g=c.getHandJointPose(p);if(g){const{position:A,quaternion:v}=e.convertSpace(g.transform);f.position.copy(A),f.quaternion.copy(v),f.matrixWorldAutoUpdate=!1}f.visible=g!=null}}l.model&&(l.model.visible=c.isTracking,l.model.visible&&l.model.parent!==((n=e.rig)==null?void 0:n.gameObject)&&((r=e.rig)==null||r.gameObject.add(l.model)),l.model.position.set(0,0,0)),(s=l.model)!=null&&s.visible&&((o=l.handmesh)==null||o.updateMesh())}}}}async loadModel(e,t){var n;if(!e.connected)return console.warn("XRControllerModel.onXRControllerAdded: controller is not connected anymore",e.side),null;const r=await $t.getOrCreate("",t).instantiate();return cD(r),(n=yt.active)!=null&&n.isPassThrough&&r.traverseVisible(s=>{this.makeOccluder(s)}),r}async loadHandModel(e){const t=this.context,n=t.renderer.xr.getHand(e.index);n||(Vl?wt.DrawLabel(e.rayWorldPosition,"No hand found for index "+e.index,.05,5):console.warn("No hand found for index "+e.index));const r=new O0;mw(r,t),await hP(r,t,this.sourceId??""),r.setPath("https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/");const s=e.side==="left"?"left.":"right.",o=e.side==="left"?this.customLeftHand:this.customRightHand;if(o)if(!o.uri.includes(s))console.warn("XRControllerModel: custom hand model must be named "+s),an("Custom Hand: unexpected name, please see the console for details");else{const c=o.uri.substring(0,o.uri.indexOf(s));r.setPath(c),Vl&&console.log("XRControllerModel: loading custom hand model from "+c)}const a=new be;cD(a);const l=new age(a,n,r.path,e.inputSource.handedness,r,c=>{c.traverse(h=>{var d;h.layers.set(2),(d=yt.active)!=null&&d.isPassThrough&&this.makeOccluder(h),h instanceof fe&&pi.assignMeshLOD(h,0)}),e.connected||(Vl&&wt.DrawLabel(e.rayWorldPosition,"Hand is loaded but not connected anymore",.05,5),c.removeFromParent())});if(Vl&&a.add(new qo(.5)),e.inputSource.hand){Vl&&console.log(e.inputSource.hand);for(const c of e.inputSource.hand.values())if(n.joints[c.jointName]===void 0){const h=new Js;h.matrixAutoUpdate=!1,h.visible=!0,n.joints[c.jointName]=h,n.add(h)}}else Vl&&wt.DrawLabel(e.rayWorldPosition,"No inputSource.hand found for index "+e.index,.05,5);return{handObject:a,handmesh:l}}makeOccluder(e){if(e instanceof fe){let t=e.material;t instanceof Lt&&(t=e.material=t.clone(),t.depthWrite=!0,t.depthTest=!0,t.colorWrite=!1,e.renderOrder=-100)}}}u(Wl,"factory",new sge),RC([x()],Wl.prototype,"createControllerModel",2),RC([x()],Wl.prototype,"createHandModel",2),RC([x($t)],Wl.prototype,"customLeftHand",2),RC([x($t)],Wl.prototype,"customRightHand",2);const yH=new bi,DC=new E;class bH extends $_{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new lt(e,3)),this.setAttribute("uv",new lt(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new rx(t,6,1);return this.setAttribute("instanceStart",new ho(n,3,0)),this.setAttribute("instanceEnd",new ho(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new rx(t,6,1);return this.setAttribute("instanceColorStart",new ho(n,3,0)),this.setAttribute("instanceColorEnd",new ho(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new aM(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new bi);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),yH.setFromBufferAttribute(t),this.boundingBox.union(yH))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)DC.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(DC)),DC.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(DC));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}ze.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new $(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Er.line={uniforms:Lf.merge([ze.common,ze.fog,ze.line]),vertexShader:`
6331
6331
  #include <common>
6332
6332
  #include <color_pars_vertex>
6333
6333
  #include <fog_pars_vertex>