diff --git a/examples/minecraft/assets/emulate-CrWpOIO2.js b/examples/minecraft/assets/emulate-BcR5c3Lg.js similarity index 99% rename from examples/minecraft/assets/emulate-CrWpOIO2.js rename to examples/minecraft/assets/emulate-BcR5c3Lg.js index 44f6ba7..3a0da9e 100644 --- a/examples/minecraft/assets/emulate-CrWpOIO2.js +++ b/examples/minecraft/assets/emulate-BcR5c3Lg.js @@ -1,4 +1,4 @@ -import{g as Oo,o as xt,r as D,j as f,R as Lo,V as z,O as Lr,Q as Ae,E as To,M as ra,a as si,L as jo,C as he,B as ce,b as Ai,F as Ii,c as A,d as Sn,e as We,S as _o,T as qt,P as Co,D as Fo,f as zo,h as No,G as Ri,i as Do,k as $o,W as Vo,l as qo}from"./index-Dtng-XR7.js";var ia={exports:{}},Ho="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Zo=Ho,Xo=Zo;function sa(){}function aa(){}aa.resetWarningCache=sa;var Bo=function(){function e(r,i,a,s,o,l){if(l!==Xo){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:aa,resetWarningCache:sa};return n.PropTypes=n,n};ia.exports=Bo();var Yo=ia.exports;const C=Oo(Yo);var Wo=1e-6,ye=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Qo(){var e=new ye(9);return ye!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ge(){var e=new ye(16);return ye!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Go(e){var t=new ye(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function oa(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function la(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],u=t[8],h=t[9],p=t[10],g=t[11],x=t[12],v=t[13],d=t[14],y=t[15],b=n*o-r*s,w=n*l-i*s,M=n*c-a*s,k=r*l-i*o,E=r*c-a*o,R=i*c-a*l,re=u*v-h*x,X=u*d-p*x,ie=u*y-g*x,le=h*d-p*v,$=h*y-g*v,F=p*y-g*d,T=b*F-w*$+M*le+k*ie-E*X+R*re;return T?(T=1/T,e[0]=(o*F-l*$+c*le)*T,e[1]=(i*$-r*F-a*le)*T,e[2]=(v*R-d*E+y*k)*T,e[3]=(p*E-h*R-g*k)*T,e[4]=(l*ie-s*F-c*X)*T,e[5]=(n*F-i*ie+a*X)*T,e[6]=(d*M-x*R-y*w)*T,e[7]=(u*R-p*M+g*w)*T,e[8]=(s*$-o*ie+c*re)*T,e[9]=(r*ie-n*$-a*re)*T,e[10]=(x*E-v*M+y*b)*T,e[11]=(h*M-u*E-g*b)*T,e[12]=(o*X-s*le-l*re)*T,e[13]=(n*le-r*X+i*re)*T,e[14]=(v*w-x*k-d*b)*T,e[15]=(u*k-h*w+p*b)*T,e):null}function ca(e,t,n){var r=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=t[9],g=t[10],x=t[11],v=t[12],d=t[13],y=t[14],b=t[15],w=n[0],M=n[1],k=n[2],E=n[3];return e[0]=w*r+M*o+k*h+E*v,e[1]=w*i+M*l+k*p+E*d,e[2]=w*a+M*c+k*g+E*y,e[3]=w*s+M*u+k*x+E*b,w=n[4],M=n[5],k=n[6],E=n[7],e[4]=w*r+M*o+k*h+E*v,e[5]=w*i+M*l+k*p+E*d,e[6]=w*a+M*c+k*g+E*y,e[7]=w*s+M*u+k*x+E*b,w=n[8],M=n[9],k=n[10],E=n[11],e[8]=w*r+M*o+k*h+E*v,e[9]=w*i+M*l+k*p+E*d,e[10]=w*a+M*c+k*g+E*y,e[11]=w*s+M*u+k*x+E*b,w=n[12],M=n[13],k=n[14],E=n[15],e[12]=w*r+M*o+k*h+E*v,e[13]=w*i+M*l+k*p+E*d,e[14]=w*a+M*c+k*g+E*y,e[15]=w*s+M*u+k*x+E*b,e}function sn(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function pn(e,t,n){var r=t[0],i=t[1],a=t[2],s=t[3],o=r+r,l=i+i,c=a+a,u=r*o,h=r*l,p=r*c,g=i*l,x=i*c,v=a*c,d=s*o,y=s*l,b=s*c;return e[0]=1-(g+v),e[1]=h+b,e[2]=p-y,e[3]=0,e[4]=h-b,e[5]=1-(u+v),e[6]=x+d,e[7]=0,e[8]=p+y,e[9]=x-d,e[10]=1-(u+g),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function an(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Tr(e,t){var n=t[0],r=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,r,i),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(l,c,u),e}function $n(e,t){var n=new ye(3);Tr(n,t);var r=1/n[0],i=1/n[1],a=1/n[2],s=t[0]*r,o=t[1]*i,l=t[2]*a,c=t[4]*r,u=t[5]*i,h=t[6]*a,p=t[8]*r,g=t[9]*i,x=t[10]*a,v=s+u+x,d=0;return v>0?(d=Math.sqrt(v+1)*2,e[3]=.25*d,e[0]=(h-g)/d,e[1]=(p-l)/d,e[2]=(o-c)/d):s>u&&s>x?(d=Math.sqrt(1+s-u-x)*2,e[3]=(h-g)/d,e[0]=.25*d,e[1]=(o+c)/d,e[2]=(p+l)/d):u>x?(d=Math.sqrt(1+u-s-x)*2,e[3]=(p-l)/d,e[0]=(o+c)/d,e[1]=.25*d,e[2]=(h+g)/d):(d=Math.sqrt(1+x-s-u)*2,e[3]=(o-c)/d,e[0]=(p+l)/d,e[1]=(h+g)/d,e[2]=.25*d),e}function Uo(e,t,n,r){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,c=a+a,u=s+s,h=i*l,p=i*c,g=i*u,x=a*c,v=a*u,d=s*u,y=o*l,b=o*c,w=o*u,M=r[0],k=r[1],E=r[2];return e[0]=(1-(x+d))*M,e[1]=(p+w)*M,e[2]=(g-b)*M,e[3]=0,e[4]=(p-w)*k,e[5]=(1-(h+d))*k,e[6]=(v+y)*k,e[7]=0,e[8]=(g+b)*E,e[9]=(v-y)*E,e[10]=(1-(h+x))*E,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function Ko(e,t,n,r,i){var a=1/Math.tan(t/2),s;return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(s=1/(r-i),e[10]=(i+r)*s,e[14]=2*i*r*s):(e[10]=-1,e[14]=-2*r),e}var Oi=Ko;function ke(){var e=new ye(3);return ye!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Jo(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function Re(e,t,n){var r=new ye(3);return r[0]=e,r[1]=t,r[2]=n,r}function gr(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function e0(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function t0(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function fa(e,t){var n=t[0],r=t[1],i=t[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function n0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function yr(e,t,n){var r=t[0],i=t[1],a=t[2],s=n[0],o=n[1],l=n[2];return e[0]=i*l-a*o,e[1]=a*s-r*l,e[2]=r*o-i*s,e}function jr(e,t,n,r){var i=t[0],a=t[1],s=t[2];return e[0]=i+r*(n[0]-i),e[1]=a+r*(n[1]-a),e[2]=s+r*(n[2]-s),e}function r0(e,t,n){var r=n[0],i=n[1],a=n[2],s=n[3],o=t[0],l=t[1],c=t[2],u=i*c-a*l,h=a*o-r*c,p=r*l-i*o,g=i*p-a*h,x=a*u-r*p,v=r*h-i*u,d=s*2;return u*=d,h*=d,p*=d,g*=2,x*=2,v*=2,e[0]=o+u+g,e[1]=l+h+x,e[2]=c+p+v,e}var i0=Jo;(function(){var e=ke();return function(t,n,r,i,a,s){var o,l;for(n||(n=3),r||(r=0),i?l=Math.min(i*n+r,t.length):l=t.length,o=r;o0&&(s=1/Math.sqrt(s)),e[0]=n*s,e[1]=r*s,e[2]=i*s,e[3]=a*s,e}(function(){var e=s0();return function(t,n,r,i,a,s){var o,l;for(n||(n=4),r||(r=0),i?l=Math.min(i*n+r,t.length):l=t.length,o=r;oWo?(p=Math.acos(g),x=Math.sin(p),v=Math.sin((1-r)*p)/x,d=Math.sin(r*p)/x):(v=1-r,d=r),e[0]=v*i+d*l,e[1]=v*a+d*c,e[2]=v*s+d*u,e[3]=v*o+d*h,e}function u0(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function d0(e,t){var n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;r=Math.sqrt(t[i*3+i]-t[a*3+a]-t[s*3+s]+1),e[i]=.5*r,r=.5/r,e[3]=(t[a*3+s]-t[s*3+a])*r,e[a]=(t[a*3+i]+t[i*3+a])*r,e[s]=(t[s*3+i]+t[i*3+s])*r}return e}var Vn=a0,vr=o0,Li=l0,Jn=c0;(function(){var e=ke(),t=Re(1,0,0),n=Re(0,1,0);return function(r,i,a){var s=n0(i,a);return s<-.999999?(yr(e,t,i),i0(e)<1e-6&&yr(e,n,i),fa(e,e),ua(r,e,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(yr(e,i,a),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+s,Jn(r,r))}})();(function(){var e=Oe(),t=Oe();return function(n,r,i,a,s,o){return en(e,r,s,o),en(t,i,a,o),en(n,e,t,2*o*(1-o)),n}})();(function(){var e=Qo();return function(t,n,r,i){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],Jn(t,d0(t,e))}})();const ne=Symbol("@immersive-web-emulation-runtime/xr-space");class ue extends EventTarget{constructor(t,n){super(),this[ne]={parentSpace:t,offsetMatrix:n?Go(n):ge(),emulated:!0}}}class h0 extends ue{constructor(){super(void 0,ge())}}class qn{static updateOffsetPosition(t,n){const r=t[ne].offsetMatrix;sn(r,n)}static updateOffsetQuaternion(t,n){const r=t[ne].offsetMatrix,i=ke();an(i,r),pn(r,n,i)}static updateOffsetMatrix(t,n){const r=t[ne].offsetMatrix;oa(r,n)}static calculateGlobalOffsetMatrix(t,n=ge()){const r=t[ne].parentSpace?qn.calculateGlobalOffsetMatrix(t[ne].parentSpace):ge();return ca(n,r,t[ne].offsetMatrix),n}}class He{constructor(t=0,n=0,r=0){this.vec3=Re(t,n,r),this.tempVec3=ke()}get x(){return this.vec3[0]}set x(t){this.vec3[0]=t}get y(){return this.vec3[1]}set y(t){this.vec3[1]=t}get z(){return this.vec3[2]}set z(t){this.vec3[2]=t}set(t,n,r){return e0(this.vec3,t,n,r),this}clone(){return new He(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}normalize(){return gr(this.tempVec3,this.vec3),fa(this.vec3,this.tempVec3),this}add(t){return gr(this.tempVec3,this.vec3),t0(this.vec3,this.tempVec3,t.vec3),this}applyQuaternion(t){return gr(this.tempVec3,this.vec3),r0(this.vec3,this.tempVec3,t.quat),this}}class ht{constructor(t=0,n=0,r=0,i=1){this.quat=Vn(t,n,r,i),this.tempQuat=Oe()}get x(){return this.quat[0]}set x(t){this.quat[0]=t}get y(){return this.quat[1]}set y(t){this.quat[1]=t}get z(){return this.quat[2]}set z(t){this.quat[2]=t}get w(){return this.quat[3]}set w(t){this.quat[3]=t}set(t,n,r,i){return Li(this.quat,t,n,r,i),this}clone(){return new ht(this.x,this.y,this.z,this.w)}copy(t){return Li(this.quat,t.x,t.y,t.z,t.w),this}normalize(){return vr(this.tempQuat,this.quat),Jn(this.quat,this.tempQuat),this}invert(){return vr(this.tempQuat,this.quat),u0(this.quat,this.tempQuat),this}multiply(t){return vr(this.tempQuat,this.quat),f0(this.quat,this.tempQuat,t.quat),this}setFromAxisAngle(t,n){return ua(this.quat,t.vec3,n),this}}const I=Symbol("@immersive-web-emulation-runtime/gamepad");var on;(function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"})(on||(on={}));class da{constructor(t,n){this[I]={type:t,eventTrigger:n,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return this[I].type==="manual"?this[I].pressed:this[I].value>0}get touched(){return this[I].type==="manual"?this[I].touched:this[I].touched||this.pressed}get value(){return this[I].value}}class p0{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class ai{constructor(t,n="",r=-1){this[I]={id:n,index:r,connected:!1,timestamp:performance.now(),mapping:t.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},t.buttons.forEach(i=>{var a;i===null?this[I].buttonsSequence.push(null):(this[I].buttonsSequence.push(i.id),this[I].buttonsMap[i.id]=new da(i.type,(a=i.eventTrigger)!==null&&a!==void 0?a:null))}),t.axes.forEach(i=>{i===null?this[I].axesSequence.push(null):(this[I].axesSequence.push(i.id+i.type),this[I].axesMap[i.id]||(this[I].axesMap[i.id]={x:0,y:0}))})}get id(){return this[I].id}get index(){return this[I].index}get connected(){return this[I].connected}get timestamp(){return this[I].timestamp}get mapping(){return this[I].mapping}get axes(){const t=[];return this[I].axesSequence.forEach(n=>{if(n===null)t.push(null);else{const r=n.substring(0,n.length-6),i=n.substring(n.length-6);t.push(i==="y-axis"?this[I].axesMap[r].y:this[I].axesMap[r].x)}}),t}get buttons(){return this[I].buttonsSequence.map(t=>t===null?new p0:this[I].buttonsMap[t])}get hapticActuators(){return this[I].hapticActuators}get vibrationActuator(){return null}}var be;(function(e){e.None="none",e.Left="left",e.Right="right"})(be||(be={}));var Hn;(function(e){e.Gaze="gaze",e.TrackedPointer="tracked-pointer",e.Screen="screen",e.TransientPointer="transient-pointer"})(Hn||(Hn={}));class m0 extends Array{}const Qe=Symbol("@immersive-web-emulation-runtime/xr-input-source");class er{constructor(t,n,r,i,a,s,o){this[Qe]={handedness:t,targetRayMode:n,targetRaySpace:i,gripSpace:s,profiles:r,gamepad:a,hand:o}}get handedness(){return this[Qe].handedness}get targetRayMode(){return this[Qe].targetRayMode}get targetRaySpace(){return this[Qe].targetRaySpace}get gripSpace(){return this[Qe].gripSpace}get profiles(){return this[Qe].profiles}get gamepad(){return this[Qe].gamepad}get hand(){return this[Qe].hand}}class Ln extends Event{constructor(t,n){if(super(t,n),!n.frame)throw new Error("XRInputSourceEventInit.frame is required");if(!n.inputSource)throw new Error("XRInputSourceEventInit.inputSource is required");this.frame=n.frame,this.inputSource=n.inputSource}}const G=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),Ti={[be.Left]:{position:new He(-.25,1.5,-.4),quaternion:new ht},[be.Right]:{position:new He(.25,1.5,-.4),quaternion:new ht},[be.None]:{position:new He(.25,1.5,-.4),quaternion:new ht}};class ha{constructor(t){this[G]={inputSource:t,position:Ti[t.handedness].position.clone(),quaternion:Ti[t.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[G].position}get quaternion(){return this[G].quaternion}get inputSource(){return this[G].inputSource}get connected(){return this[G].connected}set connected(t){this[G].connected=t,this[G].inputSource.gamepad[I].connected=t}onFrameStart(t){const n=this[G].inputSource.targetRaySpace;pn(n[ne].offsetMatrix,this[G].quaternion.quat,this[G].position.vec3);const r=t.session;this[G].inputSource.gamepad.buttons.forEach(i=>{i instanceof da&&(i[I].lastFrameValue=i[I].value,i[I].pendingValue!=null&&(i[I].value=i[I].pendingValue,i[I].pendingValue=null),i[I].eventTrigger!=null&&(i[I].lastFrameValue===0&&i[I].value>0?(r.dispatchEvent(new Ln(i[I].eventTrigger,{frame:t,inputSource:this[G].inputSource})),r.dispatchEvent(new Ln(i[I].eventTrigger+"start",{frame:t,inputSource:this[G].inputSource}))):i[I].lastFrameValue>0&&i[I].value===0&&r.dispatchEvent(new Ln(i[I].eventTrigger+"end",{frame:t,inputSource:this[G].inputSource}))))}),this[G].inputSourceChanged=this.connected!==this[G].lastFrameConnected,this[G].lastFrameConnected=this.connected}}const ji=Symbol("@immersive-web-emulation-runtime/xr-controller");class g0 extends ha{constructor(t,n,r){if(!t.layout[n])throw new DOMException("Handedness not supported","InvalidStateError");const i=new ue(r),a=t.layout[n].gripOffsetMatrix?new ue(i,t.layout[n].gripOffsetMatrix):void 0,s=[t.profileId,...t.fallbackProfileIds],o=new er(n,Hn.TrackedPointer,s,i,new ai(t.layout[n].gamepad),a);super(o),this[ji]={gamepadConfig:t.layout[n].gamepad}}get gamepadConfig(){return this[ji].gamepadConfig}updateButtonValue(t,n){if(n>1||n<0){console.warn(`Out-of-range value ${n} provided for button ${t}.`);return}const r=this[G].inputSource.gamepad[I].buttonsMap[t];if(r){if(r[I].type==="binary"&&n!=1&&n!=0){console.warn(`Non-binary value ${n} provided for binary button ${t}.`);return}r[I].pendingValue=n}else console.warn(`Current controller does not have button ${t}.`)}updateButtonTouch(t,n){const r=this[G].inputSource.gamepad[I].buttonsMap[t];r?r[I].touched=n:console.warn(`Current controller does not have button ${t}.`)}updateAxis(t,n,r){if(r>1||r<-1){console.warn(`Out-of-range value ${r} provided for ${t} axes.`);return}const i=this[G].inputSource.gamepad[I].axesMap[t];i?n==="x-axis"?i.x=r:n==="y-axis"&&(i.y=r):console.warn(`Current controller does not have ${t} axes.`)}updateAxes(t,n,r){if(n>1||n<-1||r>1||r<-1){console.warn(`Out-of-range value x:${n}, y:${r} provided for ${t} axes.`);return}const i=this[G].inputSource.gamepad[I].axesMap[t];i?(i.x=n,i.y=r):console.warn(`Current controller does not have ${t} axes.`)}}const ct=Symbol("@immersive-web-emulation-runtime/xr-view");var H;(function(e){e.None="none",e.Left="left",e.Right="right"})(H||(H={}));class pa{constructor(t,n,r,i){this[ct]={eye:t,projectionMatrix:n,transform:r,recommendedViewportScale:null,requestedViewportScale:1,session:i}}get eye(){return this[ct].eye}get projectionMatrix(){return this[ct].projectionMatrix}get transform(){return this[ct].transform}get recommendedViewportScale(){return this[ct].recommendedViewportScale}requestViewportScale(t){if(t===null||t<=0||t>1){console.warn("Invalid scale value. Scale must be > 0 and <= 1.");return}this[ct].requestedViewportScale=t}}var ln;(function(e){e.Wrist="wrist",e.ThumbMetacarpal="thumb-metacarpal",e.ThumbPhalanxProximal="thumb-phalanx-proximal",e.ThumbPhalanxDistal="thumb-phalanx-distal",e.ThumbTip="thumb-tip",e.IndexFingerMetacarpal="index-finger-metacarpal",e.IndexFingerPhalanxProximal="index-finger-phalanx-proximal",e.IndexFingerPhalanxIntermediate="index-finger-phalanx-intermediate",e.IndexFingerPhalanxDistal="index-finger-phalanx-distal",e.IndexFingerTip="index-finger-tip",e.MiddleFingerMetacarpal="middle-finger-metacarpal",e.MiddleFingerPhalanxProximal="middle-finger-phalanx-proximal",e.MiddleFingerPhalanxIntermediate="middle-finger-phalanx-intermediate",e.MiddleFingerPhalanxDistal="middle-finger-phalanx-distal",e.MiddleFingerTip="middle-finger-tip",e.RingFingerMetacarpal="ring-finger-metacarpal",e.RingFingerPhalanxProximal="ring-finger-phalanx-proximal",e.RingFingerPhalanxIntermediate="ring-finger-phalanx-intermediate",e.RingFingerPhalanxDistal="ring-finger-phalanx-distal",e.RingFingerTip="ring-finger-tip",e.PinkyFingerMetacarpal="pinky-finger-metacarpal",e.PinkyFingerPhalanxProximal="pinky-finger-phalanx-proximal",e.PinkyFingerPhalanxIntermediate="pinky-finger-phalanx-intermediate",e.PinkyFingerPhalanxDistal="pinky-finger-phalanx-distal",e.PinkyFingerTip="pinky-finger-tip"})(ln||(ln={}));class oi extends Map{}const pt=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class li extends ue{constructor(t,n,r){super(n,r),this[pt]={jointName:t,radius:0}}get jointName(){return this[pt].jointName}}const y0={jointTransforms:{wrist:{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06867414712905884,-.009423808194696903,.10627774149179459,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.5012241005897522,-.8650535345077515,-.0213695727288723,0,.7415963411331177,-.4421543478965759,.5045139193534851,0,-.44587990641593933,.23702676594257355,.8631392121315002,0,-.032122574746608734,-.01196830440312624,.07194234430789948,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[-.3175753057003021,-.9460570216178894,-.06419729441404343,0,.8958902955055237,-.32153913378715515,.30658137798309326,0,-.3106854259967804,.03984907269477844,.9496771097183228,0,-.017625702545046806,-.01967475935816765,.04387917369604111,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,-.007126678712666035,-.021021386608481407,.011786630377173424,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,.0003423091256991029,-.024528030306100845,-.011410919018089771,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.038037415593862534,-.0020236473064869642,.07626739144325256,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.7986818552017212,-.35985732078552246,.48229536414146423,0,.538311243057251,.7854709625244141,-.30537736415863037,0,-.2689369022846222,.5035246014595032,.8210577368736267,0,-.006869405973702669,.033938243985176086,.04206443578004837,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.8285930156707764,-.32672837376594543,.4546217918395996,0,.5577570199966431,.4116027057170868,-.7207564115524292,0,.04836784675717354,.8507823944091797,.5232869386672974,0,.0033306588884443045,.014840902760624886,.010923954658210278,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,.0021551470272243023,-.0058362227864563465,-.0017938464879989624,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,-.00131594471167773,-.025222131982445717,-.012442642822861671,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.05395089089870453,.003063359996303916,.07402937114238739,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9187911748886108,-.1530158370733261,.36387869715690613,0,.038666240870952606,.9522662162780762,.302808940410614,0,-.3928440511226654,-.26414817571640015,.8808513283729553,0,-.02717282809317112,.04162866622209549,.03678669035434723,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9228746294975281,-.12856416404247284,.36300456523895264,0,.14524033665657043,.9892153143882751,-.01890045404434204,0,-.3566599190235138,.07016586512327194,.9315956234931946,0,-.01030921470373869,.05296773463487625,-.0010256498353555799,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,-.0004833847051486373,.05103470757603645,-.026690717786550522,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,.008158999495208263,.05004044249653816,-.050120558589696884,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06732909381389618,.007902119308710098,.07209732383489609,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9391821026802063,-.027994679287075996,.34227466583251953,0,-.18282271921634674,.8029410243034363,.5673282742500305,0,-.2907087206840515,-.5954000353813171,.7489906549453735,0,-.047129884362220764,.03806127607822418,.032147664576768875,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9249380826950073,.03699534013867378,.3783116042613983,0,-.12898847460746765,.9667453765869141,.2208271026611328,0,-.3575615882873535,-.25304901599884033,.8989526629447937,0,-.03579339757561684,.06127955764532089,.002939916681498289,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.026291755959391594,.06800390034914017,-.02094830758869648,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.016345610842108727,.07300511747598648,-.04263874143362045,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.8769711852073669,.31462907791137695,.36322021484375,0,-.4506046175956726,.801031768321991,.39408499002456665,0,-.16696058213710785,-.5092697143554688,.8442559838294983,0,-.07460174709558487,.0062340241856873035,.06756893545389175,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9498357176780701,.1553308218717575,.2714462876319885,0,-.3019258379936218,.6817675232887268,.6663586497306824,0,-.08155745267868042,-.7148879170417786,.694466233253479,0,-.06697750836610794,.029482364654541016,.02902858518064022,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9214097261428833,.27928245067596436,.2701927423477173,0,-.3670244514942169,.8538867831230164,.36901235580444336,0,-.12765564024448395,-.43917882442474365,.8892839550971985,0,-.06447203457355499,.05144399777054787,.0076942890882492065,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.06187915802001953,.060364335775375366,-.010368337854743004,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.056796226650476456,.07042007893323898,-.02921444922685623,1],radius:.005425984505563974}},gripOffsetMatrix:[.08027800917625427,-.8086723685264587,-.5827556252479553,0,-.4154181480407715,-.5585916638374329,.7179154753684998,0,-.9060805439949036,.1844543218612671,-.3807799518108368,0,-.038054611533880234,-.002910431008785963,.03720742464065552,1]},v0={jointTransforms:{wrist:{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05789132043719292,.01670890860259533,.11183350533246994,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[.02145560085773468,-.9978390336036682,.0621047280728817,0,.41311800479888916,.06541631370782852,.9083252549171448,0,-.9104245901107788,.006167683284729719,.4136286973953247,0,-.016488194465637207,.012708572670817375,.08862338215112686,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.21270370483398438,-.966137707233429,.14606566727161407,0,.49890995025634766,.2359165996313095,.8339261412620544,0,-.8401462435722351,-.10450579971075058,.5321959853172302,0,.013112368993461132,.012508046813309193,.07517509907484055,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.04150351136922836,.016039609909057617,.05719054117798805,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.06548332422971725,.01683700829744339,.0516640841960907,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.02592567168176174,.019982583820819855,.08479326963424683,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9063700437545776,-.21756279468536377,.3621589243412018,0,.0970839336514473,.9415287375450134,.3226419687271118,0,-.41117796301841736,-.2572731077671051,.8744958639144897,0,-.0015709538711234927,.043078210204839706,.034657616168260574,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9159826040267944,-.1651475727558136,.36565208435058594,0,.09755707532167435,.9756820797920227,.1962820291519165,0,-.3891757130622864,-.14411886036396027,.9098196625709534,0,.014023927971720695,.052835866808891296,.0014903299743309617,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.023482320830225945,.05633850023150444,-.020621655508875847,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.03096788562834263,.06281610578298569,-.040703095495700836,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.04184452444314957,.022474845871329308,.08177298307418823,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9720265865325928,-.08313076198101044,.21966552734375,0,.20477405190467834,.7580050826072693,-.6192700862884521,0,-.11502730846405029,.6469289064407349,.7538246512413025,0,-.022107340395450592,.05035499855875969,.02970452979207039,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9779140949249268,-.07129573822021484,.19646917283535004,0,.1287083923816681,-.5352076292037964,-.8348574042320251,0,.1646735966205597,.8417060971260071,-.5142109394073486,0,-.017169542610645294,.022584279999136925,-.00265491777099669,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02170622907578945,-.0006043742760084569,.011511396616697311,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02438267692923546,-.0026927536819130182,.03627248480916023,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05944233387708664,.0264605600386858,.07478221505880356,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9842101335525513,.024470895528793335,.1753024309873581,0,.12200043350458145,.6237703561782837,-.7720272541046143,0,-.12824076414108276,.7812241315841675,.610936164855957,0,-.04249368980526924,.0467497780919075,.027722163125872612,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9941774606704712,.05949164181947708,.08983955532312393,0,.10504482686519623,-.7208291888237,-.6851072907447815,0,.024001073092222214,.6905553936958313,-.7228817939758301,0,-.0374927744269371,.016285063698887825,.0038980208337306976,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.038130562752485275,-.0020653479732573032,.02310742810368538,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.0390593595802784,.004176302347332239,.0466572530567646,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9147363901138306,.3458845317363739,.20885537564754486,0,-.3923271894454956,.8839452862739563,.2544005811214447,0,-.09662359952926636,-.3146490156650543,.9442773461341858,0,-.06715242564678192,.024195827543735504,.07137546688318253,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9613109827041626,.22439135611057281,.15977802872657776,0,.01002211682498455,.5511574745178223,-.8343409299850464,0,-.27528178691864014,.8036624789237976,.5275853276252747,0,-.06273911893367767,.038559623062610626,.028268879279494286,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9820972084999084,.18811029195785522,-.00995189044624567,0,.14063723385334015,-.7673450708389282,-.6256227493286133,0,-.12532226741313934,.6130226850509644,-.7800630927085876,0,-.05428232625126839,.013870777562260628,.012061242014169693,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05173685774207115,.0014194445684552193,.02790539152920246,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05098633095622063,.008463085629045963,.048688892275094986,1],radius:.005425984505563974}},gripOffsetMatrix:[.005510995630174875,-.9149997234344482,-.40341615676879883,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.9340395331382751,.13936474919319153,-.32885703444480896,0,-.031803809106349945,.007837686687707901,.04313928261399269,1]},x0={jointTransforms:{wrist:{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.04913589730858803,.0021463718730956316,.11701996624469757,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.07536252588033676,-.9959676265716553,-.04867160692811012,0,.5877083539962769,-.08379616588354111,.8047218918800354,0,-.8055551648139954,.032041035592556,.5916536450386047,0,-.010643752291798592,.0006936835707165301,.08736639469861984,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.1374533325433731,-.9904957413673401,.004982374142855406,0,.5534393787384033,.08097179979085922,.8289443850517273,0,-.8214688897132874,-.11118389666080475,.559309184551239,0,.015547193586826324,-.0003480653394944966,.0681300163269043,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.04330715537071228,.003409178927540779,.0492292083799839,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.062003348022699356,.004069602582603693,.03322213143110275,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.02009812369942665,.008770795539021492,.08660387247800827,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9001791477203369,-.2598813474178314,.3494834005832672,0,.06073702871799469,.8695210218429565,.490146666765213,0,-.4312632381916046,-.41999316215515137,.7985095381736755,0,-.00017739279428496957,.03890012577176094,.039073407649993896,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9082008600234985,-.20898112654685974,.36262574791908264,0,.11045389622449875,.9553793668746948,.27395179867744446,0,-.40369608998298645,-.20874978601932526,.8907597661018372,0,.01617925800383091,.05482936650514603,.008788082748651505,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.02599053829908371,.059902746230363846,-.012860597111284733,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.03362493962049484,.06421422213315964,-.033461250364780426,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.03627845644950867,.011579737067222595,.08550142496824265,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9876697659492493,-.06786545366048813,.1410750150680542,0,-.015095947310328484,.855663537979126,.5173118710517883,0,-.15582047402858734,-.5130629539489746,.8440889716148376,0,-.021259509027004242,.04587256908416748,.03659208118915558,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.988391637802124,-.04354291781783104,.14555205404758453,0,.008894841186702251,.9729899168014526,.23067504167556763,0,-.15166506171226501,-.22670257091522217,.9620829224586487,0,-.014570588245987892,.06789684295654297,.0003578895702958107,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.010392282158136368,.07414241135120392,-.026147106662392616,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.0069718430750072,.08024183660745621,-.05014154314994812,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.05402477830648422,.015797706320881844,.08152295649051666,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9940828680992126,.05735103040933609,.09224652498960495,0,-.10022822767496109,.8116500377655029,.5754809379577637,0,-.041867565363645554,-.5813214182853699,.8125960826873779,0,-.041623555123806,.04171867296099663,.03582974523305893,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9843675494194031,.12044742703437805,.12850022315979004,0,-.15629759430885315,.9337108135223389,.3221098482608795,0,-.08118485659360886,-.3371586799621582,.937940776348114,0,-.039990875869989395,.06438793987035751,.004141641780734062,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03783353418111801,.07334739714860916,-.020782606676220894,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03445569798350334,.0802423357963562,-.04392268508672714,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9181402921676636,.35625091195106506,.17350243031978607,0,-.39615097641944885,.8352503180503845,.38134080171585083,0,-.009065053425729275,-.41885748505592346,.9080066680908203,0,-.06191859766840935,.013620133511722088,.07850203663110733,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9714386463165283,.236698180437088,-.016745081171393394,0,-.18462024629116058,.7982627749443054,.5733163952827454,0,.14906984567642212,-.5538501739501953,.8191629648208618,0,-.061502378433942795,.032741155475378036,.03705105185508728,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9337416291236877,.35620439052581787,-.03527557849884033,0,-.33203884959220886,.8987522721290588,.28634607791900635,0,.13370157778263092,-.2556603252887726,.9574766755104065,0,-.06608185172080994,.049755651503801346,.011886020191013813,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.0687975287437439,.054948460310697556,-.007561664097011089,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.06947512179613113,.0613851435482502,-.028543535619974136,1],radius:.005425984505563974}},gripOffsetMatrix:[-.0005348679260350764,-.8648636937141418,-.5020061135292053,0,-.2741127908229828,-.48265108466148376,.8318111896514893,0,-.9616971015930176,.13805119693279266,-.2368120402097702,0,-.02878567762672901,.0017147823236882687,.04536811262369156,1]},_i={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:x0,pinch:y0,point:v0}},w0={mapping:on.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},Ci=ke(),Fi=Oe(),zi=ke(),Ni=ke(),Di=Oe(),$i=ke(),Vi=ke(),qi=Oe(),Hi=ke(),Zi=(e,t,n,r)=>(an(Ci,t),$n(Fi,t),Tr(zi,t),an(Ni,n),$n(Di,n),Tr($i,n),jr(Vi,Ci,Ni,r),en(qi,Fi,Di,r),jr(Hi,zi,$i,r),Uo(e,qi,Vi,Hi),e),b0=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],S0=e=>{for(let t=0;t<16;t++)e[t]*=b0[t]},ot=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class Xi extends ha{constructor(t,n,r){if(n!==be.Left&&n!==be.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!t.poses.default||!t.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const i=new ue(r),a=new ue(i),s=[t.profileId,...t.fallbackProfileIds],o=new oi;Object.values(ln).forEach(c=>{o.set(c,new li(c,i))});const l=new er(n,Hn.TrackedPointer,s,i,new ai(w0),a,o);super(l),this[ot]={poseId:"default",poses:t.poses},this.updateHandPose()}get poseId(){return this[ot].poseId}set poseId(t){if(!this[ot].poses[t]){console.warn(`Pose config ${t} not found`);return}this[ot].poseId=t}updateHandPose(){const t=this[ot].poses[this[ot].poseId],n=this[ot].poses.pinch;Object.values(ln).forEach(r=>{const i=t.jointTransforms[r].offsetMatrix,a=n.jointTransforms[r].offsetMatrix,s=this.inputSource.hand.get(r);Zi(s[ne].offsetMatrix,i,a,this.pinchValue),this.inputSource.handedness===be.Right&&S0(s[ne].offsetMatrix),s[pt].radius=(1-this.pinchValue)*t.jointTransforms[r].radius+this.pinchValue*n.jointTransforms[r].radius}),t.gripOffsetMatrix&&n.gripOffsetMatrix&&Zi(this.inputSource.gripSpace[ne].offsetMatrix,t.gripOffsetMatrix,n.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[G].inputSource.gamepad[I].buttonsMap.pinch.value}updatePinchValue(t){if(t>1||t<0){console.warn(`Out-of-range value ${t} provided for pinch`);return}const n=this[G].inputSource.gamepad[I].buttonsMap.pinch;n[I].pendingValue=t}onFrameStart(t){super.onFrameStart(t),this.updateHandPose()}}const Ht=Symbol("@immersive-web-emulation-runtime/xr-pose");class tr{constructor(t,n=!1,r=void 0,i=void 0){this[Ht]={transform:t,emulatedPosition:n,linearVelocity:r,angularVelocity:i}}get transform(){return this[Ht].transform}get emulatedPosition(){return this[Ht].emulatedPosition}get linearVelocity(){return this[Ht].linearVelocity}get angularVelocity(){return this[Ht].angularVelocity}}const Bi=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class ma extends tr{constructor(t,n,r=!1,i=void 0,a=void 0){super(t,r,i,a),this[Bi]={radius:n}}get radius(){return this[Bi].radius}}class Zn{constructor(t=0,n=0,r=0,i=1){this.x=t,this.y=n,this.z=r,this.w=i,Object.freeze(this)}static fromPoint(t){return new Zn(t.x,t.y,t.z,t.w)}matrixTransform(t){return new Zn}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const Mn=typeof globalThis.DOMPointReadOnly<"u"?globalThis.DOMPointReadOnly:Zn,xe=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class nr{constructor(t,n){const r=Re(0,0,0),i=Oe();this[xe]={matrix:ge(),position:t?Re(t.x,t.y,t.z):r,orientation:n?Jn(Oe(),Vn(n.x,n.y,n.z,n.w)):i,inverse:null},this.updateMatrix()}updateMatrix(){pn(this[xe].matrix,this[xe].orientation,this[xe].position)}get matrix(){return this[xe].matrix}get position(){const t=this[xe].position;return new Mn(t[0],t[1],t[2],1)}get orientation(){const t=this[xe].orientation;return new Mn(t[0],t[1],t[2],t[3])}get inverse(){if(!this[xe].inverse){const t=ge();if(!la(t,this[xe].matrix))throw new Error("Matrix is not invertible.");let n=ke();an(n,t);let r=Oe();$n(r,t),this[xe].inverse=new nr(new Mn(n[0],n[1],n[2],1),new Mn(r[0],r[1],r[2],r[3])),this[xe].inverse[xe].inverse=this}return this[xe].inverse}}const Yi=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class ga extends tr{constructor(t,n,r=!1,i=void 0,a=void 0){super(t,r,i,a),this[Yi]={views:Object.freeze(n)}}get views(){return this[Yi].views}}const pe=Symbol("@immersive-web-emulation-runtime/xr-frame"),Wi=ge(),Qi=ge(),Gi=ge(),Ui=(e,t,n)=>{qn.calculateGlobalOffsetMatrix(t,Wi),qn.calculateGlobalOffsetMatrix(n,Qi),la(Gi,Qi),ca(e,Gi,Wi)};class ya{constructor(t,n,r,i,a){this[pe]={session:t,id:n,active:r,animationFrame:i,predictedDisplayTime:a,tempMat4:ge()}}get session(){return this[pe].session}get predictedDisplayTime(){return this[pe].predictedDisplayTime}getPose(t,n){if(!this[pe].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");Ui(this[pe].tempMat4,t,n);const r=ke();an(r,this[pe].tempMat4);const i=Oe();return $n(i,this[pe].tempMat4),new tr(new nr({x:r[0],y:r[1],z:r[2],w:1},{x:i[0],y:i[1],z:i[2],w:i[3]}),t[ne].emulated)}getViewerPose(t){if(!this[pe].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const n=this[pe].session,r=n[m].device,i=this.getPose(r.viewerSpace,t),a=n[m].mode===J.Inline?[H.None]:[H.Left,H.Right],s=[];return a.forEach(o=>{const l=r.viewSpaces[o],c=this.getPose(l,t),u=n[m].getProjectionMatrix(o),h=new pa(o,new Float32Array(u),c.transform,n);s.push(h)}),new ga(i.transform,s,!1)}getJointPose(t,n){const r=this.getPose(t,n),i=t[pt].radius;return new ma(r.transform,i,!1)}fillJointRadii(t,n){if(t=Array.from(t),!this[pe].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(t.length>n.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let r=!0;for(let i=0;ir.length)throw new DOMException("The length of spaces multiplied by 16 is larger than the number of elements in transforms","TypeError");return t.forEach((i,a)=>{Ui(this[pe].tempMat4,i,n);for(let s=0;s<16;s++)r[a*16+s]=this[pe].tempMat4[s]}),!0}}class va extends Event{constructor(t,n){if(super(t,n),!n.session)throw new Error("XRInputSourcesChangeEventInit.session is required");if(!n.added)throw new Error("XRInputSourcesChangeEventInit.added is required");if(!n.removed)throw new Error("XRInputSourcesChangeEventInit.removed is required");this.session=n.session,this.added=n.added,this.removed=n.removed}}var xa;const tt=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var se;(function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"})(se||(se={}));class wt extends ue{constructor(t,n,r){super(n,r),this[xa]={type:null,onreset:()=>{}},this[tt].type=t}get onreset(){var t;return(t=this[tt].onreset)!==null&&t!==void 0?t:()=>{}}set onreset(t){this[tt].onreset&&this.removeEventListener("reset",this[tt].onreset),this[tt].onreset=t,t&&this.addEventListener("reset",t)}getOffsetReferenceSpace(t){return new wt(this[tt].type,this,t)}}xa=tt;const Zt=Symbol("@immersive-web-emulation-runtime/xr-render-state");class _r{constructor(t={},n){this[Zt]={depthNear:t.depthNear||(n==null?void 0:n.depthNear)||.1,depthFar:t.depthFar||(n==null?void 0:n.depthFar)||1e3,inlineVerticalFieldOfView:t.inlineVerticalFieldOfView||(n==null?void 0:n.inlineVerticalFieldOfView)||null,baseLayer:t.baseLayer||(n==null?void 0:n.baseLayer)||null}}get depthNear(){return this[Zt].depthNear}get depthFar(){return this[Zt].depthFar}get inlineVerticalFieldOfView(){return this[Zt].inlineVerticalFieldOfView}get baseLayer(){return this[Zt].baseLayer}}class Xn extends Event{constructor(t,n){if(super(t,n),!n.session)throw new Error("XRSessionEventInit.session is required");this.session=n.session}}var Et;(function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"})(Et||(Et={}));var J;(function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"})(J||(J={}));const m=Symbol("@immersive-web-emulation-runtime/xr-session");class ci extends EventTarget{constructor(t,n,r){super(),this[m]={device:t,mode:n,renderState:new _r,pendingRenderState:null,enabledFeatures:r,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[H.Left]:ge(),[H.Right]:ge(),[H.None]:ge()},getProjectionMatrix:i=>this[m].projectionMatrices[i],referenceSpaceIsSupported:i=>{if(!this[m].enabledFeatures.includes(i))return!1;switch(i){case se.Viewer:return!0;case se.Local:case se.LocalFloor:case se.BoundedFloor:case se.Unbounded:return this[m].mode!=J.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[m].ended)return;this[m].deviceFrameHandle=globalThis.requestAnimationFrame(this[m].onDeviceFrame),this[m].pendingRenderState!=null&&(this[m].renderState=this[m].pendingRenderState,this[m].pendingRenderState=null,this[m].device[S].onBaseLayerSet(this[m].renderState.baseLayer));const i=this[m].renderState.baseLayer;if(i===null)return;const a=i.context,s=a.canvas;if(this[m].mode!=J.Inline){const x=a.getParameter(a.COLOR_CLEAR_VALUE),v=a.getParameter(a.DEPTH_CLEAR_VALUE),d=a.getParameter(a.STENCIL_CLEAR_VALUE);a.clearColor(0,0,0,0),a.clearDepth(1),a.clearStencil(0),a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT),a.clearColor(x[0],x[1],x[2],x[3]),a.clearDepth(v),a.clearStencil(d)}const{depthNear:o,depthFar:l}=this[m].renderState,{width:c,height:u}=s;if(this[m].mode!==J.Inline){const x=c*(this[m].device.stereoEnabled?.5:1)/u;Oi(this[m].projectionMatrices[H.Left],this[m].device.fovy,x,o,l),oa(this[m].projectionMatrices[H.Right],this[m].projectionMatrices[H.Left])}else{const x=c/u;Oi(this[m].projectionMatrices[H.None],this[m].renderState.inlineVerticalFieldOfView,x,o,l)}const h=new ya(this,this[m].frameHandle,!0,!0,performance.now());this[m].device[S].onFrameStart(h),this[m].updateActiveInputSources();const p=this[m].currentFrameCallbacks=this[m].frameCallbacks;this[m].frameCallbacks=[];const g=performance.now();for(let x=0;x{const i=this[m].enabledFeatures.includes(L.HandTracking),a=this[m].activeInputSources,s=this[m].device.inputSources.filter(c=>!c.hand||i),o=s.filter(c=>!a.includes(c)),l=a.filter(c=>!s.includes(c));this[m].activeInputSources=s,(o.length>0||l.length>0)&&this.dispatchEvent(new va("inputsourceschange",{session:this,added:o,removed:l}))},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[m].onDeviceFrame()}get visibilityState(){return this[m].device.visibilityState}get frameRate(){return this[m].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[m].device.supportedFrameRates)}get renderState(){return this[m].renderState}get inputSources(){return this[m].inputSourceArray.length=0,!this[m].ended&&this[m].mode!==J.Inline&&this[m].inputSourceArray.push(...this[m].activeInputSources),this[m].inputSourceArray}get enabledFeatures(){return this[m].enabledFeatures}get isSystemKeyboardSupported(){return this[m].isSystemKeyboardSupported}updateRenderState(t={}){var n,r,i,a;if(this[m].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(t.baseLayer&&t.baseLayer[Ke].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(t.inlineVerticalFieldOfView!=null&&this[m].mode!==J.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const s={baseLayer:t.baseLayer||((n=this[m].pendingRenderState)===null||n===void 0?void 0:n.baseLayer)||void 0,depthFar:t.depthFar||((r=this[m].pendingRenderState)===null||r===void 0?void 0:r.depthFar)||void 0,depthNear:t.depthNear||((i=this[m].pendingRenderState)===null||i===void 0?void 0:i.depthNear)||void 0,inlineVerticalFieldOfView:t.inlineVerticalFieldOfView||((a=this[m].pendingRenderState)===null||a===void 0?void 0:a.inlineVerticalFieldOfView)||void 0};this[m].pendingRenderState=new _r(s,this[m].renderState)}async updateTargetFrameRate(t){return new Promise((n,r)=>{this[m].ended?r(new DOMException("XRSession has already ended.","InvalidStateError")):this[m].device.supportedFrameRates.includes(t)?(this[m].nominalFrameRate===t?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[m].nominalFrameRate=t,this.dispatchEvent(new Xn("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${t}`)),n()):r(new DOMException("Requested frame rate not supported.","InvalidStateError"))})}async requestReferenceSpace(t){return new Promise((n,r)=>{if(this[m].ended||!this[m].referenceSpaceIsSupported(t)){r(new DOMException("The requested reference space type is not supported.","NotSupportedError"));return}let i;switch(t){case se.Viewer:i=this[m].device.viewerSpace;break;case se.Local:i=new wt(t,this[m].device[S].globalSpace,this[m].device.viewerSpace[ne].offsetMatrix);break;case se.LocalFloor:case se.BoundedFloor:case se.Unbounded:i=new wt(t,this[m].device[S].globalSpace);break}this[m].referenceSpaces.push(i),n(i)})}requestAnimationFrame(t){if(this[m].ended)return 0;const n=++this[m].frameHandle;return this[m].frameCallbacks.push({handle:n,callback:t,cancelled:!1}),n}cancelAnimationFrame(t){let n=this[m].frameCallbacks,r=n.findIndex(i=>i&&i.handle===t);r>-1&&(n[r].cancelled=!0,n.splice(r,1)),n=this[m].currentFrameCallbacks,n&&(r=n.findIndex(i=>i&&i.handle===t),r>-1&&(n[r].cancelled=!0))}async end(){return new Promise((t,n)=>{this[m].ended||this[m].deviceFrameHandle===null?n(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[m].deviceFrameHandle),this[m].device[S].onSessionEnd(),this.dispatchEvent(new Xn("end",{session:this})),t())})}get onend(){var t;return(t=this[m].onend)!==null&&t!==void 0?t:()=>{}}set onend(t){this[m].onend&&this.removeEventListener("end",this[m].onend),this[m].onend=t,t&&this.addEventListener("end",t)}get oninputsourceschange(){var t;return(t=this[m].oninputsourceschange)!==null&&t!==void 0?t:()=>{}}set oninputsourceschange(t){this[m].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[m].oninputsourceschange),this[m].oninputsourceschange=t,t&&this.addEventListener("inputsourceschange",t)}get onselect(){var t;return(t=this[m].onselect)!==null&&t!==void 0?t:()=>{}}set onselect(t){this[m].onselect&&this.removeEventListener("select",this[m].onselect),this[m].onselect=t,t&&this.addEventListener("select",t)}get onselectstart(){var t;return(t=this[m].onselectstart)!==null&&t!==void 0?t:()=>{}}set onselectstart(t){this[m].onselectstart&&this.removeEventListener("selectstart",this[m].onselectstart),this[m].onselectstart=t,t&&this.addEventListener("selectstart",t)}get onselectend(){var t;return(t=this[m].onselectend)!==null&&t!==void 0?t:()=>{}}set onselectend(t){this[m].onselectend&&this.removeEventListener("selectend",this[m].onselectend),this[m].onselectend=t,t&&this.addEventListener("selectend",t)}get onsqueeze(){var t;return(t=this[m].onsqueeze)!==null&&t!==void 0?t:()=>{}}set onsqueeze(t){this[m].onsqueeze&&this.removeEventListener("squeeze",this[m].onsqueeze),this[m].onsqueeze=t,t&&this.addEventListener("squeeze",t)}get onsqueezestart(){var t;return(t=this[m].onsqueezestart)!==null&&t!==void 0?t:()=>{}}set onsqueezestart(t){this[m].onsqueezestart&&this.removeEventListener("squeezestart",this[m].onsqueezestart),this[m].onsqueezestart=t,t&&this.addEventListener("squeezestart",t)}get onsqueezeend(){var t;return(t=this[m].onsqueezeend)!==null&&t!==void 0?t:()=>{}}set onsqueezeend(t){this[m].onsqueezeend&&this.removeEventListener("squeezeend",this[m].onsqueezeend),this[m].onsqueezeend=t,t&&this.addEventListener("squeezeend",t)}get onvisibilitychange(){var t;return(t=this[m].onvisibilitychange)!==null&&t!==void 0?t:()=>{}}set onvisibilitychange(t){this[m].onvisibilitychange&&this.removeEventListener("visibilitychange",this[m].onvisibilitychange),this[m].onvisibilitychange=t,t&&this.addEventListener("visibilitychange",t)}get onframeratechange(){var t;return(t=this[m].onframeratechange)!==null&&t!==void 0?t:()=>{}}set onframeratechange(t){this[m].onframeratechange&&this.removeEventListener("frameratechange",this[m].onframeratechange),this[m].onframeratechange=t,t&&this.addEventListener("frameratechange",t)}}class wa extends EventTarget{}const Ke=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),M0={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class k0 extends wa{constructor(t,n,r={}){if(super(),t[m].ended)throw new DOMException("Session has ended","InvalidStateError");const i={...M0,...r};this[Ke]={session:t,context:n,antialias:i.antialias}}get context(){return this[Ke].context}get antialias(){return this[Ke].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Ke].context.drawingBufferWidth}get framebufferHeight(){return this[Ke].context.drawingBufferHeight}getViewport(t){if(t[ct].session!==this[Ke].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Ke].session[m].device[S].getViewport(this,t)}static getNativeFramebufferScaleFactor(t){if(!(t instanceof ci))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return t[m].ended?0:1}}const Je=Symbol("@immersive-web-emulation-runtime/xr-system");class Ki extends EventTarget{constructor(t){super(),this[Je]={device:t}}isSessionSupported(t){return new Promise((n,r)=>{t===J.Inline?n(!0):n(this[Je].device.supportedSessionModes.includes(t))})}requestSession(t,n={}){return new Promise((r,i)=>{this.isSessionSupported(t).then(a=>{if(!a){i(new DOMException("The requested XRSession mode is not supported.","NotSupportedError"));return}if(this[Je].activeSession){i(new DOMException("An active XRSession already exists.","InvalidStateError"));return}const{requiredFeatures:s=[],optionalFeatures:o=[]}=n,{supportedFeatures:l}=this[Je].device;if(!s.every(g=>l.includes(g))){i(new Error("One or more required features are not supported by the device."));return}const u=o.filter(g=>l.includes(g)),h=Array.from(new Set([...s,...u,L.Viewer,L.Local])),p=new ci(this[Je].device,t,h);this[Je].activeSession=p,p.addEventListener("end",()=>{this[Je].activeSession=void 0}),r(p)}).catch(i)})}}const _=Symbol("@immersive-web-emulation-runtime/action-player");class E0{constructor(t,n,r){const{schema:i,frames:a}=n;if(!a||!i||a.length===0)throw new DOMException("wrong recording format","NotSupportedError");const s=new wt(se.Viewer,t),o={[H.Left]:new ue(s),[H.Right]:new ue(s),[H.None]:new ue(s)};this[_]={refSpace:t,inputSources:new Map,inputSchemas:new Map,frames:a,recordedFramePointer:0,startingTimeStamp:a[0][0],endingTimeStamp:a[a.length-1][0],playbackTime:a[0][0],playing:!1,viewerSpace:s,viewSpaces:o,vec3:ke(),quat:Oe()},sn(this[_].viewSpaces[H.Left][ne].offsetMatrix,Re(-r/2,0,0)),sn(this[_].viewSpaces[H.Right][ne].offsetMatrix,Re(r/2,0,0)),i.forEach(l=>{const c=l[0],u=l[1];let h;if(u.hasGamepad){const v=[];for(let y=0;y{g.set(v,new li(v,p))}));const x=new er(u.handedness,u.targetRayMode,u.profiles,p,h,u.hasGrip?new ue(t):void 0,u.hasHand?g:void 0);this[_].inputSources.set(c,{active:!1,source:x}),this[_].inputSchemas.set(c,u)})}play(){this[_].recordedFramePointer=0,this[_].playbackTime=this[_].startingTimeStamp,this[_].playing=!0,this[_].actualTimeStamp=performance.now()}stop(){this[_].playing=!1}get playing(){return this[_].playing}get viewerSpace(){return this[_].viewerSpace}get viewSpaces(){return this[_].viewSpaces}get inputSources(){return Array.from(this[_].inputSources.values()).filter(t=>t.active).map(t=>t.source)}playFrame(){const t=performance.now(),n=t-this[_].actualTimeStamp;if(this[_].actualTimeStamp=t,this[_].playbackTime+=n,this[_].playbackTime>this[_].endingTimeStamp){this.stop();return}for(;this[_].frames[this[_].recordedFramePointer+1][0]{l.active=!1}),o.forEach((l,c)=>{this[_].inputSources.get(c).active=!0;const u=this[_].inputSources.get(c).source,h=this[_].inputSchemas.get(c);this.updateInputSource(u,h,s.has(c)?s.get(c):l,l,a)})}updateInputSource(t,n,r,i,a){if(this.updateXRSpaceFromMergedFrames(t.targetRaySpace,r.targetRayTransform,i.targetRayTransform,a),n.hasGrip&&this.updateXRSpaceFromMergedFrames(t.gripSpace,r.gripTransform,i.gripTransform,a),n.hasHand)for(let s=0;s<25;s++){const o=r.handTransforms.slice(s*8,s*8+7),l=i.handTransforms.slice(s*8,s*8+7),c=r.handTransforms[s*8+7],u=i.handTransforms[s*8+7],h=t.hand.get(n.jointSequence[s]);this.updateXRSpaceFromMergedFrames(h,o,l,a),h[pt].radius=(u-c)*a+c}if(n.hasGamepad){const s=t.gamepad;i.buttons.forEach((o,l)=>{const c=s.buttons[l];c[I].pressed=o[0]===1,c[I].touched=o[1]===1;const u=r.buttons[l][2],h=o[2];c[I].value=(h-u)*a+u}),i.axes.forEach((o,l)=>{const c=r.axes[l];s[I].axesMap[l.toString()].x=(o-c)*a+c})}}updateXRSpaceFromMergedFrames(t,n,r,i){const a=Re(n[0],n[1],n[2]),s=Vn(n[3],n[4],n[5],n[6]),o=Re(r[0],r[1],r[2]),l=Vn(r[3],r[4],r[5],r[6]);jr(this[_].vec3,a,o,i),en(this[_].quat,s,l,i),pn(t[ne].offsetMatrix,this[_].quat,this[_].vec3)}processRawInputData(t){const n=t[0],r=this[_].inputSchemas.get(n),a={targetRayTransform:t.slice(1,8)};let s=8;if(r.hasGrip&&(a.gripTransform=t[s++]),r.hasHand&&(a.handTransforms=t[s++]),r.hasGamepad){const o=t[s];a.buttons=o.slice(0,r.numButtons),a.axes=o.slice(r.numButtons)}return{index:n,inputData:a}}}const P0="1.0.3";class Ji extends Event{constructor(t,n){if(super(t,n),!n.referenceSpace)throw new Error("XRReferenceSpaceEventInit.referenceSpace is required");this.referenceSpace=n.referenceSpace,this.transform=n.transform}}const Xt=Symbol("@immersive-web-emulation-runtime/xr-viewport");class kn{constructor(t,n,r,i){this[Xt]={x:t,y:n,width:r,height:i}}get x(){return this[Xt].x}get y(){return this[Xt].y}get width(){return this[Xt].width}get height(){return this[Xt].height}}var L;(function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded",e.DomOverlay="dom-overlay",e.Anchors="anchors",e.PlaneDetection="plane-detection",e.MeshDetection="mesh-detection",e.HitTest="hit-test",e.HandTracking="hand-tracking",e.DepthSensing="depth-sensing"})(L||(L={}));const S=Symbol("@immersive-web-emulation-runtime/xr-device"),Bt={ipd:.063,fovy:Math.PI/2,headsetPosition:new He(0,1.6,0),headsetQuaternion:new ht,stereoEnabled:!1};class A0{constructor(t,n={}){var r,i,a,s,o,l;const c=new h0,u=new wt(se.Viewer,c),h={[H.Left]:new ue(u),[H.Right]:new ue(u),[H.None]:new ue(u)},p=t.controllerConfig,g={};p&&Object.values(be).forEach(d=>{p.layout[d]&&(g[d]=new g0(p,d,c))});const x={[be.Left]:new Xi(_i,be.Left,c),[be.Right]:new Xi(_i,be.Right,c)},v=(r=n.canvasContainer)!==null&&r!==void 0?r:document.createElement("div");v.dataset.webxr_runtime=`Immersive Web Emulation Runtime v${P0}`,v.style.position="fixed",v.style.width="100%",v.style.height="100%",v.style.top="0",v.style.left="0",v.style.display="flex",v.style.justifyContent="center",v.style.alignItems="center",v.style.overflow="hidden",v.style.zIndex="999",this[S]={name:t.name,supportedSessionModes:t.supportedSessionModes,supportedFeatures:t.supportedFeatures,supportedFrameRates:t.supportedFrameRates,isSystemKeyboardSupported:t.isSystemKeyboardSupported,internalNominalFrameRate:t.internalNominalFrameRate,userAgent:t.userAgent,position:(i=n.headsetPosition)!==null&&i!==void 0?i:Bt.headsetPosition.clone(),quaternion:(a=n.headsetQuaternion)!==null&&a!==void 0?a:Bt.headsetQuaternion.clone(),stereoEnabled:(s=n.stereoEnabled)!==null&&s!==void 0?s:Bt.stereoEnabled,ipd:(o=n.ipd)!==null&&o!==void 0?o:Bt.ipd,fovy:(l=n.fovy)!==null&&l!==void 0?l:Bt.fovy,controllers:g,hands:x,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:Et.Visible,pendingVisibilityState:null,xrSystem:null,matrix:ge(),globalSpace:c,viewerSpace:u,viewSpaces:h,canvasContainer:v,getViewport:(d,y)=>{const b=d.context.canvas,{width:w,height:M}=b;switch(y.eye){case H.None:return new kn(0,0,w,M);case H.Left:return new kn(0,0,this[S].stereoEnabled?w/2:w,M);case H.Right:return new kn(w/2,0,this[S].stereoEnabled?w/2:0,M)}},updateViews:()=>{const d=this[S].viewerSpace;pn(d[ne].offsetMatrix,this[S].quaternion.quat,this[S].position.vec3),sn(this[S].viewSpaces[H.Left][ne].offsetMatrix,Re(-this[S].ipd/2,0,0)),sn(this[S].viewSpaces[H.Right][ne].offsetMatrix,Re(this[S].ipd/2,0,0))},onBaseLayerSet:d=>{if(!d)return;const y=d.context.canvas;y.parentElement!==this[S].canvasContainer&&(this[S].canvasData={canvas:y,parent:y.parentElement,width:y.width,height:y.height},this[S].canvasContainer.appendChild(y),document.body.appendChild(this[S].canvasContainer)),y.width=window.innerWidth,y.height=window.innerHeight},onSessionEnd:()=>{if(this[S].canvasData){const{canvas:d,parent:y,width:b,height:w}=this[S].canvasData;d.width=b,d.height=w,y?y.appendChild(d):this[S].canvasContainer.removeChild(d),document.body.removeChild(this[S].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:d=>{var y;if(!((y=this[S].actionPlayer)===null||y===void 0)&&y.playing)this[S].actionPlayer.playFrame();else{const b=d.session;this[S].updateViews(),this[S].pendingVisibilityState&&(this[S].visibilityState=this[S].pendingVisibilityState,this[S].pendingVisibilityState=null,b.dispatchEvent(new Xn("visibilitychange",{session:b}))),this[S].visibilityState===Et.Visible&&this.activeInputs.forEach(w=>{w.onFrameStart(d)}),this[S].pendingReferenceSpaceReset&&(b[m].referenceSpaces.forEach(w=>{switch(w[tt].type){case se.Local:case se.LocalFloor:case se.BoundedFloor:case se.Unbounded:w.dispatchEvent(new Ji("reset",{referenceSpace:w}));break}}),this[S].pendingReferenceSpaceReset=!1)}this[S].updateViews()}},this[S].updateViews()}installRuntime(t=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise((n,r)=>{n(!0)})},configurable:!0}),this[S].xrSystem=new Ki(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[S].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[S].userAgent,writable:!1,configurable:!1,enumerable:!0}),t.XRSystem=Ki,t.XRSession=ci,t.XRRenderState=_r,t.XRFrame=ya,t.XRSpace=ue,t.XRReferenceSpace=wt,t.XRJointSpace=li,t.XRView=pa,t.XRViewport=kn,t.XRRigidTransform=nr,t.XRPose=tr,t.XRViewerPose=ga,t.XRJointPose=ma,t.XRInputSource=er,t.XRInputSourceArray=m0,t.XRHand=oi,t.XRLayer=wa,t.XRWebGLLayer=k0,t.XRSessionEvent=Xn,t.XRInputSourceEvent=Ln,t.XRInputSourcesChangeEvent=va,t.XRReferenceSpaceEvent=Ji}get supportedSessionModes(){return this[S].supportedSessionModes}get supportedFeatures(){return this[S].supportedFeatures}get supportedFrameRates(){return this[S].supportedFrameRates}get isSystemKeyboardSupported(){return this[S].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[S].internalNominalFrameRate}get stereoEnabled(){return this[S].stereoEnabled}set stereoEnabled(t){this[S].stereoEnabled=t}get ipd(){return this[S].ipd}set ipd(t){this[S].ipd=t}get fovy(){return this[S].fovy}set fovy(t){this[S].fovy=t}get position(){return this[S].position}get quaternion(){return this[S].quaternion}get viewerSpace(){var t;return!((t=this[S].actionPlayer)===null||t===void 0)&&t.playing?this[S].actionPlayer.viewerSpace:this[S].viewerSpace}get viewSpaces(){var t;return!((t=this[S].actionPlayer)===null||t===void 0)&&t.playing?this[S].actionPlayer.viewSpaces:this[S].viewSpaces}get controllers(){return this[S].controllers}get hands(){return this[S].hands}get primaryInputMode(){return this[S].primaryInputMode}set primaryInputMode(t){if(t!=="controller"&&t!=="hand"){console.warn('primary input mode can only be "controller" or "hand"');return}this[S].primaryInputMode=t}get activeInputs(){return this[S].visibilityState!==Et.Visible?[]:(this[S].primaryInputMode==="controller"?Object.values(this[S].controllers):Object.values(this[S].hands)).filter(n=>n.connected)}get inputSources(){var t;return!((t=this[S].actionPlayer)===null||t===void 0)&&t.playing?this[S].actionPlayer.inputSources:this.activeInputs.map(n=>n.inputSource)}get canvasContainer(){return this[S].canvasContainer}get activeSession(){var t;return(t=this[S].xrSystem)===null||t===void 0?void 0:t[Je].activeSession}recenter(){const t=new He(-this.position.x,0,-this.position.z),n=new He(0,0,-1).applyQuaternion(this.quaternion);n.y=0,n.normalize();const r=Math.atan2(n.x,-n.z),i=new ht().setFromAxisAngle(new He(0,1,0),r);this.position.add(t),this.quaternion.multiply(i),[...Object.values(this[S].controllers),...Object.values(this[S].hands)].forEach(a=>{a.position.add(t),a.quaternion.multiply(i),a.position.applyQuaternion(i)}),this[S].pendingReferenceSpaceReset=!0}get visibilityState(){return this[S].visibilityState}updateVisibilityState(t){if(!Object.values(Et).includes(t))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");t!==this[S].visibilityState&&(this[S].pendingVisibilityState=t)}createActionPlayer(t,n){return this[S].actionPlayer=new E0(t,n,this[S].ipd),this[S].actionPlayer}}const rr={mapping:on.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"x-button",type:"binary"},{id:"y-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},ir={mapping:on.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"a-button",type:"binary"},{id:"b-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},I0={profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,4673031295254759e-24,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,3688163374704345e-23,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},R0={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,20823669899527886e-24,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,-8329467959811154e-23,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},O0={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,-15779937356796836e-24,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},L0={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,10736208366779465e-24,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,-26238110351073374e-24,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},T0={name:"Oculus Quest 1",controllerConfig:I0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},j0={name:"Meta Quest 2",controllerConfig:R0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.MeshDetection,L.HitTest,L.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},_0={name:"Meta Quest Pro",controllerConfig:O0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.MeshDetection,L.HitTest,L.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},C0={name:"Meta Quest 3",controllerConfig:L0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.MeshDetection,L.HitTest,L.HandTracking,L.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},es=()=>{};let fi={},ba={},Sa=null,Ma={mark:es,measure:es};try{typeof window<"u"&&(fi=window),typeof document<"u"&&(ba=document),typeof MutationObserver<"u"&&(Sa=MutationObserver),typeof performance<"u"&&(Ma=performance)}catch{}const{userAgent:ts=""}=fi.navigator||{},rt=fi,Z=ba,ns=Sa,En=Ma;rt.document;const Be=!!Z.documentElement&&!!Z.head&&typeof Z.addEventListener=="function"&&typeof Z.createElement=="function",ka=~ts.indexOf("MSIE")||~ts.indexOf("Trident/");var W="classic",Ea="duotone",Se="sharp",Me="sharp-duotone",F0=[W,Ea,Se,Me],z0={classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds"}},rs={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},N0=["kit"],D0=/fa(s|r|l|t|d|b|k|kd|ss|sr|sl|st|sds)?[\-\ ]/,$0=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i,V0={"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}},q0={"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds"}},H0={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds"}},Z0={classic:["fas","far","fal","fat"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds"]},X0={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid"}},B0={classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",duotone:"fad",brands:"fab"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds"}},Pa={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fad:"duotone","fa-duotone":"duotone",fab:"brands","fa-brands":"brands"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid"}},Y0=["solid","regular","light","thin","duotone","brands"],Aa=[1,2,3,4,5,6,7,8,9,10],W0=Aa.concat([11,12,13,14,15,16,17,18,19,20]),Qt={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},Q0=[...Object.keys(Z0),...Y0,"2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",Qt.GROUP,Qt.SWAP_OPACITY,Qt.PRIMARY,Qt.SECONDARY].concat(Aa.map(e=>"".concat(e,"x"))).concat(W0.map(e=>"w-".concat(e))),G0={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},U0={kit:{"fa-kit":"fak"},"kit-duotone":{"fa-kit-duotone":"fakd"}},K0={kit:{fak:"fa-kit"},"kit-duotone":{fakd:"fa-kit-duotone"}},is={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}};const Ze="___FONT_AWESOME___",Cr=16,Ia="fa",Ra="svg-inline--fa",bt="data-fa-i2svg",Fr="data-fa-pseudo-element",J0="data-fa-pseudo-element-pending",ui="data-prefix",di="data-icon",ss="fontawesome-i2svg",e1="async",t1=["HTML","HEAD","STYLE","SCRIPT"],Oa=(()=>{try{return!0}catch{return!1}})(),La=[W,Se,Me];function mn(e){return new Proxy(e,{get(t,n){return n in t?t[n]:t[W]}})}const Ta={...Pa};Ta[W]={...Pa[W],...rs.kit,...rs["kit-duotone"]};const mt=mn(Ta),zr={...B0};zr[W]={...zr[W],...is.kit,...is["kit-duotone"]};const cn=mn(zr),Nr={...X0};Nr[W]={...Nr[W],...K0.kit};const gt=mn(Nr),Dr={...H0};Dr[W]={...Dr[W],...U0.kit};const n1=mn(Dr),r1=D0,ja="fa-layers-text",i1=$0,s1={...z0};mn(s1);const a1=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],xr=Qt,Ot=new Set;Object.keys(cn[W]).map(Ot.add.bind(Ot));Object.keys(cn[Se]).map(Ot.add.bind(Ot));Object.keys(cn[Me]).map(Ot.add.bind(Ot));const o1=[...N0,...Q0],tn=rt.FontAwesomeConfig||{};function l1(e){var t=Z.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}function c1(e){return e===""?!0:e==="false"?!1:e==="true"?!0:e}Z&&typeof Z.querySelector=="function"&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(t=>{let[n,r]=t;const i=c1(l1(n));i!=null&&(tn[r]=i)});const _a={styleDefault:"solid",familyDefault:"classic",cssPrefix:Ia,replacementClass:Ra,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};tn.familyPrefix&&(tn.cssPrefix=tn.familyPrefix);const Lt={..._a,...tn};Lt.autoReplaceSvg||(Lt.observeMutations=!1);const P={};Object.keys(_a).forEach(e=>{Object.defineProperty(P,e,{enumerable:!0,set:function(t){Lt[e]=t,nn.forEach(n=>n(P))},get:function(){return Lt[e]}})});Object.defineProperty(P,"familyPrefix",{enumerable:!0,set:function(e){Lt.cssPrefix=e,nn.forEach(t=>t(P))},get:function(){return Lt.cssPrefix}});rt.FontAwesomeConfig=P;const nn=[];function f1(e){return nn.push(e),()=>{nn.splice(nn.indexOf(e),1)}}const Ge=Cr,ze={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function u1(e){if(!e||!Be)return;const t=Z.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;const n=Z.head.childNodes;let r=null;for(let i=n.length-1;i>-1;i--){const a=n[i],s=(a.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(s)>-1&&(r=a)}return Z.head.insertBefore(t,r),e}const d1="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function fn(){let e=12,t="";for(;e-- >0;)t+=d1[Math.random()*62|0];return t}function Nt(e){const t=[];for(let n=(e||[]).length>>>0;n--;)t[n]=e[n];return t}function hi(e){return e.classList?Nt(e.classList):(e.getAttribute("class")||"").split(" ").filter(t=>t)}function Ca(e){return"".concat(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function h1(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,'="').concat(Ca(e[n]),'" '),"").trim()}function sr(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,": ").concat(e[n].trim(),";"),"")}function pi(e){return e.size!==ze.size||e.x!==ze.x||e.y!==ze.y||e.rotate!==ze.rotate||e.flipX||e.flipY}function p1(e){let{transform:t,containerWidth:n,iconWidth:r}=e;const i={transform:"translate(".concat(n/2," 256)")},a="translate(".concat(t.x*32,", ").concat(t.y*32,") "),s="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),o="rotate(".concat(t.rotate," 0 0)"),l={transform:"".concat(a," ").concat(s," ").concat(o)},c={transform:"translate(".concat(r/2*-1," -256)")};return{outer:i,inner:l,path:c}}function m1(e){let{transform:t,width:n=Cr,height:r=Cr,startCentered:i=!1}=e,a="";return i&&ka?a+="translate(".concat(t.x/Ge-n/2,"em, ").concat(t.y/Ge-r/2,"em) "):i?a+="translate(calc(-50% + ".concat(t.x/Ge,"em), calc(-50% + ").concat(t.y/Ge,"em)) "):a+="translate(".concat(t.x/Ge,"em, ").concat(t.y/Ge,"em) "),a+="scale(".concat(t.size/Ge*(t.flipX?-1:1),", ").concat(t.size/Ge*(t.flipY?-1:1),") "),a+="rotate(".concat(t.rotate,"deg) "),a}var g1=`:root, :host { +import{g as Oo,o as xt,r as D,j as f,R as Lo,V as z,O as Lr,Q as Ae,E as To,M as ra,a as si,L as jo,C as he,B as ce,b as Ai,F as Ii,c as A,d as Sn,e as We,S as _o,T as qt,P as Co,D as Fo,f as zo,h as No,G as Ri,i as Do,k as $o,W as Vo,l as qo}from"./index-BV9Fj0rk.js";var ia={exports:{}},Ho="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Zo=Ho,Xo=Zo;function sa(){}function aa(){}aa.resetWarningCache=sa;var Bo=function(){function e(r,i,a,s,o,l){if(l!==Xo){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:aa,resetWarningCache:sa};return n.PropTypes=n,n};ia.exports=Bo();var Yo=ia.exports;const C=Oo(Yo);var Wo=1e-6,ye=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Qo(){var e=new ye(9);return ye!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ge(){var e=new ye(16);return ye!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Go(e){var t=new ye(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function oa(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function la(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],u=t[8],h=t[9],p=t[10],g=t[11],x=t[12],v=t[13],d=t[14],y=t[15],b=n*o-r*s,w=n*l-i*s,M=n*c-a*s,k=r*l-i*o,E=r*c-a*o,R=i*c-a*l,re=u*v-h*x,X=u*d-p*x,ie=u*y-g*x,le=h*d-p*v,$=h*y-g*v,F=p*y-g*d,T=b*F-w*$+M*le+k*ie-E*X+R*re;return T?(T=1/T,e[0]=(o*F-l*$+c*le)*T,e[1]=(i*$-r*F-a*le)*T,e[2]=(v*R-d*E+y*k)*T,e[3]=(p*E-h*R-g*k)*T,e[4]=(l*ie-s*F-c*X)*T,e[5]=(n*F-i*ie+a*X)*T,e[6]=(d*M-x*R-y*w)*T,e[7]=(u*R-p*M+g*w)*T,e[8]=(s*$-o*ie+c*re)*T,e[9]=(r*ie-n*$-a*re)*T,e[10]=(x*E-v*M+y*b)*T,e[11]=(h*M-u*E-g*b)*T,e[12]=(o*X-s*le-l*re)*T,e[13]=(n*le-r*X+i*re)*T,e[14]=(v*w-x*k-d*b)*T,e[15]=(u*k-h*w+p*b)*T,e):null}function ca(e,t,n){var r=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=t[9],g=t[10],x=t[11],v=t[12],d=t[13],y=t[14],b=t[15],w=n[0],M=n[1],k=n[2],E=n[3];return e[0]=w*r+M*o+k*h+E*v,e[1]=w*i+M*l+k*p+E*d,e[2]=w*a+M*c+k*g+E*y,e[3]=w*s+M*u+k*x+E*b,w=n[4],M=n[5],k=n[6],E=n[7],e[4]=w*r+M*o+k*h+E*v,e[5]=w*i+M*l+k*p+E*d,e[6]=w*a+M*c+k*g+E*y,e[7]=w*s+M*u+k*x+E*b,w=n[8],M=n[9],k=n[10],E=n[11],e[8]=w*r+M*o+k*h+E*v,e[9]=w*i+M*l+k*p+E*d,e[10]=w*a+M*c+k*g+E*y,e[11]=w*s+M*u+k*x+E*b,w=n[12],M=n[13],k=n[14],E=n[15],e[12]=w*r+M*o+k*h+E*v,e[13]=w*i+M*l+k*p+E*d,e[14]=w*a+M*c+k*g+E*y,e[15]=w*s+M*u+k*x+E*b,e}function sn(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function pn(e,t,n){var r=t[0],i=t[1],a=t[2],s=t[3],o=r+r,l=i+i,c=a+a,u=r*o,h=r*l,p=r*c,g=i*l,x=i*c,v=a*c,d=s*o,y=s*l,b=s*c;return e[0]=1-(g+v),e[1]=h+b,e[2]=p-y,e[3]=0,e[4]=h-b,e[5]=1-(u+v),e[6]=x+d,e[7]=0,e[8]=p+y,e[9]=x-d,e[10]=1-(u+g),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function an(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Tr(e,t){var n=t[0],r=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.hypot(n,r,i),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(l,c,u),e}function $n(e,t){var n=new ye(3);Tr(n,t);var r=1/n[0],i=1/n[1],a=1/n[2],s=t[0]*r,o=t[1]*i,l=t[2]*a,c=t[4]*r,u=t[5]*i,h=t[6]*a,p=t[8]*r,g=t[9]*i,x=t[10]*a,v=s+u+x,d=0;return v>0?(d=Math.sqrt(v+1)*2,e[3]=.25*d,e[0]=(h-g)/d,e[1]=(p-l)/d,e[2]=(o-c)/d):s>u&&s>x?(d=Math.sqrt(1+s-u-x)*2,e[3]=(h-g)/d,e[0]=.25*d,e[1]=(o+c)/d,e[2]=(p+l)/d):u>x?(d=Math.sqrt(1+u-s-x)*2,e[3]=(p-l)/d,e[0]=(o+c)/d,e[1]=.25*d,e[2]=(h+g)/d):(d=Math.sqrt(1+x-s-u)*2,e[3]=(o-c)/d,e[0]=(p+l)/d,e[1]=(h+g)/d,e[2]=.25*d),e}function Uo(e,t,n,r){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,c=a+a,u=s+s,h=i*l,p=i*c,g=i*u,x=a*c,v=a*u,d=s*u,y=o*l,b=o*c,w=o*u,M=r[0],k=r[1],E=r[2];return e[0]=(1-(x+d))*M,e[1]=(p+w)*M,e[2]=(g-b)*M,e[3]=0,e[4]=(p-w)*k,e[5]=(1-(h+d))*k,e[6]=(v+y)*k,e[7]=0,e[8]=(g+b)*E,e[9]=(v-y)*E,e[10]=(1-(h+x))*E,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function Ko(e,t,n,r,i){var a=1/Math.tan(t/2),s;return e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(s=1/(r-i),e[10]=(i+r)*s,e[14]=2*i*r*s):(e[10]=-1,e[14]=-2*r),e}var Oi=Ko;function ke(){var e=new ye(3);return ye!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Jo(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function Re(e,t,n){var r=new ye(3);return r[0]=e,r[1]=t,r[2]=n,r}function gr(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function e0(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function t0(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function fa(e,t){var n=t[0],r=t[1],i=t[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function n0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function yr(e,t,n){var r=t[0],i=t[1],a=t[2],s=n[0],o=n[1],l=n[2];return e[0]=i*l-a*o,e[1]=a*s-r*l,e[2]=r*o-i*s,e}function jr(e,t,n,r){var i=t[0],a=t[1],s=t[2];return e[0]=i+r*(n[0]-i),e[1]=a+r*(n[1]-a),e[2]=s+r*(n[2]-s),e}function r0(e,t,n){var r=n[0],i=n[1],a=n[2],s=n[3],o=t[0],l=t[1],c=t[2],u=i*c-a*l,h=a*o-r*c,p=r*l-i*o,g=i*p-a*h,x=a*u-r*p,v=r*h-i*u,d=s*2;return u*=d,h*=d,p*=d,g*=2,x*=2,v*=2,e[0]=o+u+g,e[1]=l+h+x,e[2]=c+p+v,e}var i0=Jo;(function(){var e=ke();return function(t,n,r,i,a,s){var o,l;for(n||(n=3),r||(r=0),i?l=Math.min(i*n+r,t.length):l=t.length,o=r;o0&&(s=1/Math.sqrt(s)),e[0]=n*s,e[1]=r*s,e[2]=i*s,e[3]=a*s,e}(function(){var e=s0();return function(t,n,r,i,a,s){var o,l;for(n||(n=4),r||(r=0),i?l=Math.min(i*n+r,t.length):l=t.length,o=r;oWo?(p=Math.acos(g),x=Math.sin(p),v=Math.sin((1-r)*p)/x,d=Math.sin(r*p)/x):(v=1-r,d=r),e[0]=v*i+d*l,e[1]=v*a+d*c,e[2]=v*s+d*u,e[3]=v*o+d*h,e}function u0(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function d0(e,t){var n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;r=Math.sqrt(t[i*3+i]-t[a*3+a]-t[s*3+s]+1),e[i]=.5*r,r=.5/r,e[3]=(t[a*3+s]-t[s*3+a])*r,e[a]=(t[a*3+i]+t[i*3+a])*r,e[s]=(t[s*3+i]+t[i*3+s])*r}return e}var Vn=a0,vr=o0,Li=l0,Jn=c0;(function(){var e=ke(),t=Re(1,0,0),n=Re(0,1,0);return function(r,i,a){var s=n0(i,a);return s<-.999999?(yr(e,t,i),i0(e)<1e-6&&yr(e,n,i),fa(e,e),ua(r,e,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(yr(e,i,a),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+s,Jn(r,r))}})();(function(){var e=Oe(),t=Oe();return function(n,r,i,a,s,o){return en(e,r,s,o),en(t,i,a,o),en(n,e,t,2*o*(1-o)),n}})();(function(){var e=Qo();return function(t,n,r,i){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],Jn(t,d0(t,e))}})();const ne=Symbol("@immersive-web-emulation-runtime/xr-space");class ue extends EventTarget{constructor(t,n){super(),this[ne]={parentSpace:t,offsetMatrix:n?Go(n):ge(),emulated:!0}}}class h0 extends ue{constructor(){super(void 0,ge())}}class qn{static updateOffsetPosition(t,n){const r=t[ne].offsetMatrix;sn(r,n)}static updateOffsetQuaternion(t,n){const r=t[ne].offsetMatrix,i=ke();an(i,r),pn(r,n,i)}static updateOffsetMatrix(t,n){const r=t[ne].offsetMatrix;oa(r,n)}static calculateGlobalOffsetMatrix(t,n=ge()){const r=t[ne].parentSpace?qn.calculateGlobalOffsetMatrix(t[ne].parentSpace):ge();return ca(n,r,t[ne].offsetMatrix),n}}class He{constructor(t=0,n=0,r=0){this.vec3=Re(t,n,r),this.tempVec3=ke()}get x(){return this.vec3[0]}set x(t){this.vec3[0]=t}get y(){return this.vec3[1]}set y(t){this.vec3[1]=t}get z(){return this.vec3[2]}set z(t){this.vec3[2]=t}set(t,n,r){return e0(this.vec3,t,n,r),this}clone(){return new He(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}normalize(){return gr(this.tempVec3,this.vec3),fa(this.vec3,this.tempVec3),this}add(t){return gr(this.tempVec3,this.vec3),t0(this.vec3,this.tempVec3,t.vec3),this}applyQuaternion(t){return gr(this.tempVec3,this.vec3),r0(this.vec3,this.tempVec3,t.quat),this}}class ht{constructor(t=0,n=0,r=0,i=1){this.quat=Vn(t,n,r,i),this.tempQuat=Oe()}get x(){return this.quat[0]}set x(t){this.quat[0]=t}get y(){return this.quat[1]}set y(t){this.quat[1]=t}get z(){return this.quat[2]}set z(t){this.quat[2]=t}get w(){return this.quat[3]}set w(t){this.quat[3]=t}set(t,n,r,i){return Li(this.quat,t,n,r,i),this}clone(){return new ht(this.x,this.y,this.z,this.w)}copy(t){return Li(this.quat,t.x,t.y,t.z,t.w),this}normalize(){return vr(this.tempQuat,this.quat),Jn(this.quat,this.tempQuat),this}invert(){return vr(this.tempQuat,this.quat),u0(this.quat,this.tempQuat),this}multiply(t){return vr(this.tempQuat,this.quat),f0(this.quat,this.tempQuat,t.quat),this}setFromAxisAngle(t,n){return ua(this.quat,t.vec3,n),this}}const I=Symbol("@immersive-web-emulation-runtime/gamepad");var on;(function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"})(on||(on={}));class da{constructor(t,n){this[I]={type:t,eventTrigger:n,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return this[I].type==="manual"?this[I].pressed:this[I].value>0}get touched(){return this[I].type==="manual"?this[I].touched:this[I].touched||this.pressed}get value(){return this[I].value}}class p0{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class ai{constructor(t,n="",r=-1){this[I]={id:n,index:r,connected:!1,timestamp:performance.now(),mapping:t.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},t.buttons.forEach(i=>{var a;i===null?this[I].buttonsSequence.push(null):(this[I].buttonsSequence.push(i.id),this[I].buttonsMap[i.id]=new da(i.type,(a=i.eventTrigger)!==null&&a!==void 0?a:null))}),t.axes.forEach(i=>{i===null?this[I].axesSequence.push(null):(this[I].axesSequence.push(i.id+i.type),this[I].axesMap[i.id]||(this[I].axesMap[i.id]={x:0,y:0}))})}get id(){return this[I].id}get index(){return this[I].index}get connected(){return this[I].connected}get timestamp(){return this[I].timestamp}get mapping(){return this[I].mapping}get axes(){const t=[];return this[I].axesSequence.forEach(n=>{if(n===null)t.push(null);else{const r=n.substring(0,n.length-6),i=n.substring(n.length-6);t.push(i==="y-axis"?this[I].axesMap[r].y:this[I].axesMap[r].x)}}),t}get buttons(){return this[I].buttonsSequence.map(t=>t===null?new p0:this[I].buttonsMap[t])}get hapticActuators(){return this[I].hapticActuators}get vibrationActuator(){return null}}var be;(function(e){e.None="none",e.Left="left",e.Right="right"})(be||(be={}));var Hn;(function(e){e.Gaze="gaze",e.TrackedPointer="tracked-pointer",e.Screen="screen",e.TransientPointer="transient-pointer"})(Hn||(Hn={}));class m0 extends Array{}const Qe=Symbol("@immersive-web-emulation-runtime/xr-input-source");class er{constructor(t,n,r,i,a,s,o){this[Qe]={handedness:t,targetRayMode:n,targetRaySpace:i,gripSpace:s,profiles:r,gamepad:a,hand:o}}get handedness(){return this[Qe].handedness}get targetRayMode(){return this[Qe].targetRayMode}get targetRaySpace(){return this[Qe].targetRaySpace}get gripSpace(){return this[Qe].gripSpace}get profiles(){return this[Qe].profiles}get gamepad(){return this[Qe].gamepad}get hand(){return this[Qe].hand}}class Ln extends Event{constructor(t,n){if(super(t,n),!n.frame)throw new Error("XRInputSourceEventInit.frame is required");if(!n.inputSource)throw new Error("XRInputSourceEventInit.inputSource is required");this.frame=n.frame,this.inputSource=n.inputSource}}const G=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),Ti={[be.Left]:{position:new He(-.25,1.5,-.4),quaternion:new ht},[be.Right]:{position:new He(.25,1.5,-.4),quaternion:new ht},[be.None]:{position:new He(.25,1.5,-.4),quaternion:new ht}};class ha{constructor(t){this[G]={inputSource:t,position:Ti[t.handedness].position.clone(),quaternion:Ti[t.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[G].position}get quaternion(){return this[G].quaternion}get inputSource(){return this[G].inputSource}get connected(){return this[G].connected}set connected(t){this[G].connected=t,this[G].inputSource.gamepad[I].connected=t}onFrameStart(t){const n=this[G].inputSource.targetRaySpace;pn(n[ne].offsetMatrix,this[G].quaternion.quat,this[G].position.vec3);const r=t.session;this[G].inputSource.gamepad.buttons.forEach(i=>{i instanceof da&&(i[I].lastFrameValue=i[I].value,i[I].pendingValue!=null&&(i[I].value=i[I].pendingValue,i[I].pendingValue=null),i[I].eventTrigger!=null&&(i[I].lastFrameValue===0&&i[I].value>0?(r.dispatchEvent(new Ln(i[I].eventTrigger,{frame:t,inputSource:this[G].inputSource})),r.dispatchEvent(new Ln(i[I].eventTrigger+"start",{frame:t,inputSource:this[G].inputSource}))):i[I].lastFrameValue>0&&i[I].value===0&&r.dispatchEvent(new Ln(i[I].eventTrigger+"end",{frame:t,inputSource:this[G].inputSource}))))}),this[G].inputSourceChanged=this.connected!==this[G].lastFrameConnected,this[G].lastFrameConnected=this.connected}}const ji=Symbol("@immersive-web-emulation-runtime/xr-controller");class g0 extends ha{constructor(t,n,r){if(!t.layout[n])throw new DOMException("Handedness not supported","InvalidStateError");const i=new ue(r),a=t.layout[n].gripOffsetMatrix?new ue(i,t.layout[n].gripOffsetMatrix):void 0,s=[t.profileId,...t.fallbackProfileIds],o=new er(n,Hn.TrackedPointer,s,i,new ai(t.layout[n].gamepad),a);super(o),this[ji]={gamepadConfig:t.layout[n].gamepad}}get gamepadConfig(){return this[ji].gamepadConfig}updateButtonValue(t,n){if(n>1||n<0){console.warn(`Out-of-range value ${n} provided for button ${t}.`);return}const r=this[G].inputSource.gamepad[I].buttonsMap[t];if(r){if(r[I].type==="binary"&&n!=1&&n!=0){console.warn(`Non-binary value ${n} provided for binary button ${t}.`);return}r[I].pendingValue=n}else console.warn(`Current controller does not have button ${t}.`)}updateButtonTouch(t,n){const r=this[G].inputSource.gamepad[I].buttonsMap[t];r?r[I].touched=n:console.warn(`Current controller does not have button ${t}.`)}updateAxis(t,n,r){if(r>1||r<-1){console.warn(`Out-of-range value ${r} provided for ${t} axes.`);return}const i=this[G].inputSource.gamepad[I].axesMap[t];i?n==="x-axis"?i.x=r:n==="y-axis"&&(i.y=r):console.warn(`Current controller does not have ${t} axes.`)}updateAxes(t,n,r){if(n>1||n<-1||r>1||r<-1){console.warn(`Out-of-range value x:${n}, y:${r} provided for ${t} axes.`);return}const i=this[G].inputSource.gamepad[I].axesMap[t];i?(i.x=n,i.y=r):console.warn(`Current controller does not have ${t} axes.`)}}const ct=Symbol("@immersive-web-emulation-runtime/xr-view");var H;(function(e){e.None="none",e.Left="left",e.Right="right"})(H||(H={}));class pa{constructor(t,n,r,i){this[ct]={eye:t,projectionMatrix:n,transform:r,recommendedViewportScale:null,requestedViewportScale:1,session:i}}get eye(){return this[ct].eye}get projectionMatrix(){return this[ct].projectionMatrix}get transform(){return this[ct].transform}get recommendedViewportScale(){return this[ct].recommendedViewportScale}requestViewportScale(t){if(t===null||t<=0||t>1){console.warn("Invalid scale value. Scale must be > 0 and <= 1.");return}this[ct].requestedViewportScale=t}}var ln;(function(e){e.Wrist="wrist",e.ThumbMetacarpal="thumb-metacarpal",e.ThumbPhalanxProximal="thumb-phalanx-proximal",e.ThumbPhalanxDistal="thumb-phalanx-distal",e.ThumbTip="thumb-tip",e.IndexFingerMetacarpal="index-finger-metacarpal",e.IndexFingerPhalanxProximal="index-finger-phalanx-proximal",e.IndexFingerPhalanxIntermediate="index-finger-phalanx-intermediate",e.IndexFingerPhalanxDistal="index-finger-phalanx-distal",e.IndexFingerTip="index-finger-tip",e.MiddleFingerMetacarpal="middle-finger-metacarpal",e.MiddleFingerPhalanxProximal="middle-finger-phalanx-proximal",e.MiddleFingerPhalanxIntermediate="middle-finger-phalanx-intermediate",e.MiddleFingerPhalanxDistal="middle-finger-phalanx-distal",e.MiddleFingerTip="middle-finger-tip",e.RingFingerMetacarpal="ring-finger-metacarpal",e.RingFingerPhalanxProximal="ring-finger-phalanx-proximal",e.RingFingerPhalanxIntermediate="ring-finger-phalanx-intermediate",e.RingFingerPhalanxDistal="ring-finger-phalanx-distal",e.RingFingerTip="ring-finger-tip",e.PinkyFingerMetacarpal="pinky-finger-metacarpal",e.PinkyFingerPhalanxProximal="pinky-finger-phalanx-proximal",e.PinkyFingerPhalanxIntermediate="pinky-finger-phalanx-intermediate",e.PinkyFingerPhalanxDistal="pinky-finger-phalanx-distal",e.PinkyFingerTip="pinky-finger-tip"})(ln||(ln={}));class oi extends Map{}const pt=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class li extends ue{constructor(t,n,r){super(n,r),this[pt]={jointName:t,radius:0}}get jointName(){return this[pt].jointName}}const y0={jointTransforms:{wrist:{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06867414712905884,-.009423808194696903,.10627774149179459,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.5012241005897522,-.8650535345077515,-.0213695727288723,0,.7415963411331177,-.4421543478965759,.5045139193534851,0,-.44587990641593933,.23702676594257355,.8631392121315002,0,-.032122574746608734,-.01196830440312624,.07194234430789948,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[-.3175753057003021,-.9460570216178894,-.06419729441404343,0,.8958902955055237,-.32153913378715515,.30658137798309326,0,-.3106854259967804,.03984907269477844,.9496771097183228,0,-.017625702545046806,-.01967475935816765,.04387917369604111,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,-.007126678712666035,-.021021386608481407,.011786630377173424,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,.0003423091256991029,-.024528030306100845,-.011410919018089771,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.038037415593862534,-.0020236473064869642,.07626739144325256,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.7986818552017212,-.35985732078552246,.48229536414146423,0,.538311243057251,.7854709625244141,-.30537736415863037,0,-.2689369022846222,.5035246014595032,.8210577368736267,0,-.006869405973702669,.033938243985176086,.04206443578004837,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.8285930156707764,-.32672837376594543,.4546217918395996,0,.5577570199966431,.4116027057170868,-.7207564115524292,0,.04836784675717354,.8507823944091797,.5232869386672974,0,.0033306588884443045,.014840902760624886,.010923954658210278,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,.0021551470272243023,-.0058362227864563465,-.0017938464879989624,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,-.00131594471167773,-.025222131982445717,-.012442642822861671,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.05395089089870453,.003063359996303916,.07402937114238739,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9187911748886108,-.1530158370733261,.36387869715690613,0,.038666240870952606,.9522662162780762,.302808940410614,0,-.3928440511226654,-.26414817571640015,.8808513283729553,0,-.02717282809317112,.04162866622209549,.03678669035434723,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9228746294975281,-.12856416404247284,.36300456523895264,0,.14524033665657043,.9892153143882751,-.01890045404434204,0,-.3566599190235138,.07016586512327194,.9315956234931946,0,-.01030921470373869,.05296773463487625,-.0010256498353555799,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,-.0004833847051486373,.05103470757603645,-.026690717786550522,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,.008158999495208263,.05004044249653816,-.050120558589696884,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06732909381389618,.007902119308710098,.07209732383489609,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9391821026802063,-.027994679287075996,.34227466583251953,0,-.18282271921634674,.8029410243034363,.5673282742500305,0,-.2907087206840515,-.5954000353813171,.7489906549453735,0,-.047129884362220764,.03806127607822418,.032147664576768875,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9249380826950073,.03699534013867378,.3783116042613983,0,-.12898847460746765,.9667453765869141,.2208271026611328,0,-.3575615882873535,-.25304901599884033,.8989526629447937,0,-.03579339757561684,.06127955764532089,.002939916681498289,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.026291755959391594,.06800390034914017,-.02094830758869648,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.016345610842108727,.07300511747598648,-.04263874143362045,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.8769711852073669,.31462907791137695,.36322021484375,0,-.4506046175956726,.801031768321991,.39408499002456665,0,-.16696058213710785,-.5092697143554688,.8442559838294983,0,-.07460174709558487,.0062340241856873035,.06756893545389175,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9498357176780701,.1553308218717575,.2714462876319885,0,-.3019258379936218,.6817675232887268,.6663586497306824,0,-.08155745267868042,-.7148879170417786,.694466233253479,0,-.06697750836610794,.029482364654541016,.02902858518064022,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9214097261428833,.27928245067596436,.2701927423477173,0,-.3670244514942169,.8538867831230164,.36901235580444336,0,-.12765564024448395,-.43917882442474365,.8892839550971985,0,-.06447203457355499,.05144399777054787,.0076942890882492065,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.06187915802001953,.060364335775375366,-.010368337854743004,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.056796226650476456,.07042007893323898,-.02921444922685623,1],radius:.005425984505563974}},gripOffsetMatrix:[.08027800917625427,-.8086723685264587,-.5827556252479553,0,-.4154181480407715,-.5585916638374329,.7179154753684998,0,-.9060805439949036,.1844543218612671,-.3807799518108368,0,-.038054611533880234,-.002910431008785963,.03720742464065552,1]},v0={jointTransforms:{wrist:{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05789132043719292,.01670890860259533,.11183350533246994,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[.02145560085773468,-.9978390336036682,.0621047280728817,0,.41311800479888916,.06541631370782852,.9083252549171448,0,-.9104245901107788,.006167683284729719,.4136286973953247,0,-.016488194465637207,.012708572670817375,.08862338215112686,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.21270370483398438,-.966137707233429,.14606566727161407,0,.49890995025634766,.2359165996313095,.8339261412620544,0,-.8401462435722351,-.10450579971075058,.5321959853172302,0,.013112368993461132,.012508046813309193,.07517509907484055,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.04150351136922836,.016039609909057617,.05719054117798805,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.06548332422971725,.01683700829744339,.0516640841960907,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.02592567168176174,.019982583820819855,.08479326963424683,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9063700437545776,-.21756279468536377,.3621589243412018,0,.0970839336514473,.9415287375450134,.3226419687271118,0,-.41117796301841736,-.2572731077671051,.8744958639144897,0,-.0015709538711234927,.043078210204839706,.034657616168260574,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9159826040267944,-.1651475727558136,.36565208435058594,0,.09755707532167435,.9756820797920227,.1962820291519165,0,-.3891757130622864,-.14411886036396027,.9098196625709534,0,.014023927971720695,.052835866808891296,.0014903299743309617,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.023482320830225945,.05633850023150444,-.020621655508875847,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.03096788562834263,.06281610578298569,-.040703095495700836,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.04184452444314957,.022474845871329308,.08177298307418823,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9720265865325928,-.08313076198101044,.21966552734375,0,.20477405190467834,.7580050826072693,-.6192700862884521,0,-.11502730846405029,.6469289064407349,.7538246512413025,0,-.022107340395450592,.05035499855875969,.02970452979207039,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9779140949249268,-.07129573822021484,.19646917283535004,0,.1287083923816681,-.5352076292037964,-.8348574042320251,0,.1646735966205597,.8417060971260071,-.5142109394073486,0,-.017169542610645294,.022584279999136925,-.00265491777099669,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02170622907578945,-.0006043742760084569,.011511396616697311,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02438267692923546,-.0026927536819130182,.03627248480916023,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05944233387708664,.0264605600386858,.07478221505880356,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9842101335525513,.024470895528793335,.1753024309873581,0,.12200043350458145,.6237703561782837,-.7720272541046143,0,-.12824076414108276,.7812241315841675,.610936164855957,0,-.04249368980526924,.0467497780919075,.027722163125872612,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9941774606704712,.05949164181947708,.08983955532312393,0,.10504482686519623,-.7208291888237,-.6851072907447815,0,.024001073092222214,.6905553936958313,-.7228817939758301,0,-.0374927744269371,.016285063698887825,.0038980208337306976,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.038130562752485275,-.0020653479732573032,.02310742810368538,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.0390593595802784,.004176302347332239,.0466572530567646,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9147363901138306,.3458845317363739,.20885537564754486,0,-.3923271894454956,.8839452862739563,.2544005811214447,0,-.09662359952926636,-.3146490156650543,.9442773461341858,0,-.06715242564678192,.024195827543735504,.07137546688318253,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9613109827041626,.22439135611057281,.15977802872657776,0,.01002211682498455,.5511574745178223,-.8343409299850464,0,-.27528178691864014,.8036624789237976,.5275853276252747,0,-.06273911893367767,.038559623062610626,.028268879279494286,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9820972084999084,.18811029195785522,-.00995189044624567,0,.14063723385334015,-.7673450708389282,-.6256227493286133,0,-.12532226741313934,.6130226850509644,-.7800630927085876,0,-.05428232625126839,.013870777562260628,.012061242014169693,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05173685774207115,.0014194445684552193,.02790539152920246,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05098633095622063,.008463085629045963,.048688892275094986,1],radius:.005425984505563974}},gripOffsetMatrix:[.005510995630174875,-.9149997234344482,-.40341615676879883,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.9340395331382751,.13936474919319153,-.32885703444480896,0,-.031803809106349945,.007837686687707901,.04313928261399269,1]},x0={jointTransforms:{wrist:{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.04913589730858803,.0021463718730956316,.11701996624469757,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.07536252588033676,-.9959676265716553,-.04867160692811012,0,.5877083539962769,-.08379616588354111,.8047218918800354,0,-.8055551648139954,.032041035592556,.5916536450386047,0,-.010643752291798592,.0006936835707165301,.08736639469861984,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.1374533325433731,-.9904957413673401,.004982374142855406,0,.5534393787384033,.08097179979085922,.8289443850517273,0,-.8214688897132874,-.11118389666080475,.559309184551239,0,.015547193586826324,-.0003480653394944966,.0681300163269043,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.04330715537071228,.003409178927540779,.0492292083799839,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.062003348022699356,.004069602582603693,.03322213143110275,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.02009812369942665,.008770795539021492,.08660387247800827,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9001791477203369,-.2598813474178314,.3494834005832672,0,.06073702871799469,.8695210218429565,.490146666765213,0,-.4312632381916046,-.41999316215515137,.7985095381736755,0,-.00017739279428496957,.03890012577176094,.039073407649993896,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9082008600234985,-.20898112654685974,.36262574791908264,0,.11045389622449875,.9553793668746948,.27395179867744446,0,-.40369608998298645,-.20874978601932526,.8907597661018372,0,.01617925800383091,.05482936650514603,.008788082748651505,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.02599053829908371,.059902746230363846,-.012860597111284733,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.03362493962049484,.06421422213315964,-.033461250364780426,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.03627845644950867,.011579737067222595,.08550142496824265,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9876697659492493,-.06786545366048813,.1410750150680542,0,-.015095947310328484,.855663537979126,.5173118710517883,0,-.15582047402858734,-.5130629539489746,.8440889716148376,0,-.021259509027004242,.04587256908416748,.03659208118915558,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.988391637802124,-.04354291781783104,.14555205404758453,0,.008894841186702251,.9729899168014526,.23067504167556763,0,-.15166506171226501,-.22670257091522217,.9620829224586487,0,-.014570588245987892,.06789684295654297,.0003578895702958107,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.010392282158136368,.07414241135120392,-.026147106662392616,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.0069718430750072,.08024183660745621,-.05014154314994812,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.05402477830648422,.015797706320881844,.08152295649051666,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9940828680992126,.05735103040933609,.09224652498960495,0,-.10022822767496109,.8116500377655029,.5754809379577637,0,-.041867565363645554,-.5813214182853699,.8125960826873779,0,-.041623555123806,.04171867296099663,.03582974523305893,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9843675494194031,.12044742703437805,.12850022315979004,0,-.15629759430885315,.9337108135223389,.3221098482608795,0,-.08118485659360886,-.3371586799621582,.937940776348114,0,-.039990875869989395,.06438793987035751,.004141641780734062,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03783353418111801,.07334739714860916,-.020782606676220894,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03445569798350334,.0802423357963562,-.04392268508672714,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9181402921676636,.35625091195106506,.17350243031978607,0,-.39615097641944885,.8352503180503845,.38134080171585083,0,-.009065053425729275,-.41885748505592346,.9080066680908203,0,-.06191859766840935,.013620133511722088,.07850203663110733,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9714386463165283,.236698180437088,-.016745081171393394,0,-.18462024629116058,.7982627749443054,.5733163952827454,0,.14906984567642212,-.5538501739501953,.8191629648208618,0,-.061502378433942795,.032741155475378036,.03705105185508728,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9337416291236877,.35620439052581787,-.03527557849884033,0,-.33203884959220886,.8987522721290588,.28634607791900635,0,.13370157778263092,-.2556603252887726,.9574766755104065,0,-.06608185172080994,.049755651503801346,.011886020191013813,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.0687975287437439,.054948460310697556,-.007561664097011089,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.06947512179613113,.0613851435482502,-.028543535619974136,1],radius:.005425984505563974}},gripOffsetMatrix:[-.0005348679260350764,-.8648636937141418,-.5020061135292053,0,-.2741127908229828,-.48265108466148376,.8318111896514893,0,-.9616971015930176,.13805119693279266,-.2368120402097702,0,-.02878567762672901,.0017147823236882687,.04536811262369156,1]},_i={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:x0,pinch:y0,point:v0}},w0={mapping:on.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},Ci=ke(),Fi=Oe(),zi=ke(),Ni=ke(),Di=Oe(),$i=ke(),Vi=ke(),qi=Oe(),Hi=ke(),Zi=(e,t,n,r)=>(an(Ci,t),$n(Fi,t),Tr(zi,t),an(Ni,n),$n(Di,n),Tr($i,n),jr(Vi,Ci,Ni,r),en(qi,Fi,Di,r),jr(Hi,zi,$i,r),Uo(e,qi,Vi,Hi),e),b0=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],S0=e=>{for(let t=0;t<16;t++)e[t]*=b0[t]},ot=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class Xi extends ha{constructor(t,n,r){if(n!==be.Left&&n!==be.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!t.poses.default||!t.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const i=new ue(r),a=new ue(i),s=[t.profileId,...t.fallbackProfileIds],o=new oi;Object.values(ln).forEach(c=>{o.set(c,new li(c,i))});const l=new er(n,Hn.TrackedPointer,s,i,new ai(w0),a,o);super(l),this[ot]={poseId:"default",poses:t.poses},this.updateHandPose()}get poseId(){return this[ot].poseId}set poseId(t){if(!this[ot].poses[t]){console.warn(`Pose config ${t} not found`);return}this[ot].poseId=t}updateHandPose(){const t=this[ot].poses[this[ot].poseId],n=this[ot].poses.pinch;Object.values(ln).forEach(r=>{const i=t.jointTransforms[r].offsetMatrix,a=n.jointTransforms[r].offsetMatrix,s=this.inputSource.hand.get(r);Zi(s[ne].offsetMatrix,i,a,this.pinchValue),this.inputSource.handedness===be.Right&&S0(s[ne].offsetMatrix),s[pt].radius=(1-this.pinchValue)*t.jointTransforms[r].radius+this.pinchValue*n.jointTransforms[r].radius}),t.gripOffsetMatrix&&n.gripOffsetMatrix&&Zi(this.inputSource.gripSpace[ne].offsetMatrix,t.gripOffsetMatrix,n.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[G].inputSource.gamepad[I].buttonsMap.pinch.value}updatePinchValue(t){if(t>1||t<0){console.warn(`Out-of-range value ${t} provided for pinch`);return}const n=this[G].inputSource.gamepad[I].buttonsMap.pinch;n[I].pendingValue=t}onFrameStart(t){super.onFrameStart(t),this.updateHandPose()}}const Ht=Symbol("@immersive-web-emulation-runtime/xr-pose");class tr{constructor(t,n=!1,r=void 0,i=void 0){this[Ht]={transform:t,emulatedPosition:n,linearVelocity:r,angularVelocity:i}}get transform(){return this[Ht].transform}get emulatedPosition(){return this[Ht].emulatedPosition}get linearVelocity(){return this[Ht].linearVelocity}get angularVelocity(){return this[Ht].angularVelocity}}const Bi=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class ma extends tr{constructor(t,n,r=!1,i=void 0,a=void 0){super(t,r,i,a),this[Bi]={radius:n}}get radius(){return this[Bi].radius}}class Zn{constructor(t=0,n=0,r=0,i=1){this.x=t,this.y=n,this.z=r,this.w=i,Object.freeze(this)}static fromPoint(t){return new Zn(t.x,t.y,t.z,t.w)}matrixTransform(t){return new Zn}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const Mn=typeof globalThis.DOMPointReadOnly<"u"?globalThis.DOMPointReadOnly:Zn,xe=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class nr{constructor(t,n){const r=Re(0,0,0),i=Oe();this[xe]={matrix:ge(),position:t?Re(t.x,t.y,t.z):r,orientation:n?Jn(Oe(),Vn(n.x,n.y,n.z,n.w)):i,inverse:null},this.updateMatrix()}updateMatrix(){pn(this[xe].matrix,this[xe].orientation,this[xe].position)}get matrix(){return this[xe].matrix}get position(){const t=this[xe].position;return new Mn(t[0],t[1],t[2],1)}get orientation(){const t=this[xe].orientation;return new Mn(t[0],t[1],t[2],t[3])}get inverse(){if(!this[xe].inverse){const t=ge();if(!la(t,this[xe].matrix))throw new Error("Matrix is not invertible.");let n=ke();an(n,t);let r=Oe();$n(r,t),this[xe].inverse=new nr(new Mn(n[0],n[1],n[2],1),new Mn(r[0],r[1],r[2],r[3])),this[xe].inverse[xe].inverse=this}return this[xe].inverse}}const Yi=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class ga extends tr{constructor(t,n,r=!1,i=void 0,a=void 0){super(t,r,i,a),this[Yi]={views:Object.freeze(n)}}get views(){return this[Yi].views}}const pe=Symbol("@immersive-web-emulation-runtime/xr-frame"),Wi=ge(),Qi=ge(),Gi=ge(),Ui=(e,t,n)=>{qn.calculateGlobalOffsetMatrix(t,Wi),qn.calculateGlobalOffsetMatrix(n,Qi),la(Gi,Qi),ca(e,Gi,Wi)};class ya{constructor(t,n,r,i,a){this[pe]={session:t,id:n,active:r,animationFrame:i,predictedDisplayTime:a,tempMat4:ge()}}get session(){return this[pe].session}get predictedDisplayTime(){return this[pe].predictedDisplayTime}getPose(t,n){if(!this[pe].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");Ui(this[pe].tempMat4,t,n);const r=ke();an(r,this[pe].tempMat4);const i=Oe();return $n(i,this[pe].tempMat4),new tr(new nr({x:r[0],y:r[1],z:r[2],w:1},{x:i[0],y:i[1],z:i[2],w:i[3]}),t[ne].emulated)}getViewerPose(t){if(!this[pe].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const n=this[pe].session,r=n[m].device,i=this.getPose(r.viewerSpace,t),a=n[m].mode===J.Inline?[H.None]:[H.Left,H.Right],s=[];return a.forEach(o=>{const l=r.viewSpaces[o],c=this.getPose(l,t),u=n[m].getProjectionMatrix(o),h=new pa(o,new Float32Array(u),c.transform,n);s.push(h)}),new ga(i.transform,s,!1)}getJointPose(t,n){const r=this.getPose(t,n),i=t[pt].radius;return new ma(r.transform,i,!1)}fillJointRadii(t,n){if(t=Array.from(t),!this[pe].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(t.length>n.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let r=!0;for(let i=0;ir.length)throw new DOMException("The length of spaces multiplied by 16 is larger than the number of elements in transforms","TypeError");return t.forEach((i,a)=>{Ui(this[pe].tempMat4,i,n);for(let s=0;s<16;s++)r[a*16+s]=this[pe].tempMat4[s]}),!0}}class va extends Event{constructor(t,n){if(super(t,n),!n.session)throw new Error("XRInputSourcesChangeEventInit.session is required");if(!n.added)throw new Error("XRInputSourcesChangeEventInit.added is required");if(!n.removed)throw new Error("XRInputSourcesChangeEventInit.removed is required");this.session=n.session,this.added=n.added,this.removed=n.removed}}var xa;const tt=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var se;(function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"})(se||(se={}));class wt extends ue{constructor(t,n,r){super(n,r),this[xa]={type:null,onreset:()=>{}},this[tt].type=t}get onreset(){var t;return(t=this[tt].onreset)!==null&&t!==void 0?t:()=>{}}set onreset(t){this[tt].onreset&&this.removeEventListener("reset",this[tt].onreset),this[tt].onreset=t,t&&this.addEventListener("reset",t)}getOffsetReferenceSpace(t){return new wt(this[tt].type,this,t)}}xa=tt;const Zt=Symbol("@immersive-web-emulation-runtime/xr-render-state");class _r{constructor(t={},n){this[Zt]={depthNear:t.depthNear||(n==null?void 0:n.depthNear)||.1,depthFar:t.depthFar||(n==null?void 0:n.depthFar)||1e3,inlineVerticalFieldOfView:t.inlineVerticalFieldOfView||(n==null?void 0:n.inlineVerticalFieldOfView)||null,baseLayer:t.baseLayer||(n==null?void 0:n.baseLayer)||null}}get depthNear(){return this[Zt].depthNear}get depthFar(){return this[Zt].depthFar}get inlineVerticalFieldOfView(){return this[Zt].inlineVerticalFieldOfView}get baseLayer(){return this[Zt].baseLayer}}class Xn extends Event{constructor(t,n){if(super(t,n),!n.session)throw new Error("XRSessionEventInit.session is required");this.session=n.session}}var Et;(function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"})(Et||(Et={}));var J;(function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"})(J||(J={}));const m=Symbol("@immersive-web-emulation-runtime/xr-session");class ci extends EventTarget{constructor(t,n,r){super(),this[m]={device:t,mode:n,renderState:new _r,pendingRenderState:null,enabledFeatures:r,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[H.Left]:ge(),[H.Right]:ge(),[H.None]:ge()},getProjectionMatrix:i=>this[m].projectionMatrices[i],referenceSpaceIsSupported:i=>{if(!this[m].enabledFeatures.includes(i))return!1;switch(i){case se.Viewer:return!0;case se.Local:case se.LocalFloor:case se.BoundedFloor:case se.Unbounded:return this[m].mode!=J.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[m].ended)return;this[m].deviceFrameHandle=globalThis.requestAnimationFrame(this[m].onDeviceFrame),this[m].pendingRenderState!=null&&(this[m].renderState=this[m].pendingRenderState,this[m].pendingRenderState=null,this[m].device[S].onBaseLayerSet(this[m].renderState.baseLayer));const i=this[m].renderState.baseLayer;if(i===null)return;const a=i.context,s=a.canvas;if(this[m].mode!=J.Inline){const x=a.getParameter(a.COLOR_CLEAR_VALUE),v=a.getParameter(a.DEPTH_CLEAR_VALUE),d=a.getParameter(a.STENCIL_CLEAR_VALUE);a.clearColor(0,0,0,0),a.clearDepth(1),a.clearStencil(0),a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT),a.clearColor(x[0],x[1],x[2],x[3]),a.clearDepth(v),a.clearStencil(d)}const{depthNear:o,depthFar:l}=this[m].renderState,{width:c,height:u}=s;if(this[m].mode!==J.Inline){const x=c*(this[m].device.stereoEnabled?.5:1)/u;Oi(this[m].projectionMatrices[H.Left],this[m].device.fovy,x,o,l),oa(this[m].projectionMatrices[H.Right],this[m].projectionMatrices[H.Left])}else{const x=c/u;Oi(this[m].projectionMatrices[H.None],this[m].renderState.inlineVerticalFieldOfView,x,o,l)}const h=new ya(this,this[m].frameHandle,!0,!0,performance.now());this[m].device[S].onFrameStart(h),this[m].updateActiveInputSources();const p=this[m].currentFrameCallbacks=this[m].frameCallbacks;this[m].frameCallbacks=[];const g=performance.now();for(let x=0;x{const i=this[m].enabledFeatures.includes(L.HandTracking),a=this[m].activeInputSources,s=this[m].device.inputSources.filter(c=>!c.hand||i),o=s.filter(c=>!a.includes(c)),l=a.filter(c=>!s.includes(c));this[m].activeInputSources=s,(o.length>0||l.length>0)&&this.dispatchEvent(new va("inputsourceschange",{session:this,added:o,removed:l}))},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[m].onDeviceFrame()}get visibilityState(){return this[m].device.visibilityState}get frameRate(){return this[m].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[m].device.supportedFrameRates)}get renderState(){return this[m].renderState}get inputSources(){return this[m].inputSourceArray.length=0,!this[m].ended&&this[m].mode!==J.Inline&&this[m].inputSourceArray.push(...this[m].activeInputSources),this[m].inputSourceArray}get enabledFeatures(){return this[m].enabledFeatures}get isSystemKeyboardSupported(){return this[m].isSystemKeyboardSupported}updateRenderState(t={}){var n,r,i,a;if(this[m].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(t.baseLayer&&t.baseLayer[Ke].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(t.inlineVerticalFieldOfView!=null&&this[m].mode!==J.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const s={baseLayer:t.baseLayer||((n=this[m].pendingRenderState)===null||n===void 0?void 0:n.baseLayer)||void 0,depthFar:t.depthFar||((r=this[m].pendingRenderState)===null||r===void 0?void 0:r.depthFar)||void 0,depthNear:t.depthNear||((i=this[m].pendingRenderState)===null||i===void 0?void 0:i.depthNear)||void 0,inlineVerticalFieldOfView:t.inlineVerticalFieldOfView||((a=this[m].pendingRenderState)===null||a===void 0?void 0:a.inlineVerticalFieldOfView)||void 0};this[m].pendingRenderState=new _r(s,this[m].renderState)}async updateTargetFrameRate(t){return new Promise((n,r)=>{this[m].ended?r(new DOMException("XRSession has already ended.","InvalidStateError")):this[m].device.supportedFrameRates.includes(t)?(this[m].nominalFrameRate===t?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[m].nominalFrameRate=t,this.dispatchEvent(new Xn("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${t}`)),n()):r(new DOMException("Requested frame rate not supported.","InvalidStateError"))})}async requestReferenceSpace(t){return new Promise((n,r)=>{if(this[m].ended||!this[m].referenceSpaceIsSupported(t)){r(new DOMException("The requested reference space type is not supported.","NotSupportedError"));return}let i;switch(t){case se.Viewer:i=this[m].device.viewerSpace;break;case se.Local:i=new wt(t,this[m].device[S].globalSpace,this[m].device.viewerSpace[ne].offsetMatrix);break;case se.LocalFloor:case se.BoundedFloor:case se.Unbounded:i=new wt(t,this[m].device[S].globalSpace);break}this[m].referenceSpaces.push(i),n(i)})}requestAnimationFrame(t){if(this[m].ended)return 0;const n=++this[m].frameHandle;return this[m].frameCallbacks.push({handle:n,callback:t,cancelled:!1}),n}cancelAnimationFrame(t){let n=this[m].frameCallbacks,r=n.findIndex(i=>i&&i.handle===t);r>-1&&(n[r].cancelled=!0,n.splice(r,1)),n=this[m].currentFrameCallbacks,n&&(r=n.findIndex(i=>i&&i.handle===t),r>-1&&(n[r].cancelled=!0))}async end(){return new Promise((t,n)=>{this[m].ended||this[m].deviceFrameHandle===null?n(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[m].deviceFrameHandle),this[m].device[S].onSessionEnd(),this.dispatchEvent(new Xn("end",{session:this})),t())})}get onend(){var t;return(t=this[m].onend)!==null&&t!==void 0?t:()=>{}}set onend(t){this[m].onend&&this.removeEventListener("end",this[m].onend),this[m].onend=t,t&&this.addEventListener("end",t)}get oninputsourceschange(){var t;return(t=this[m].oninputsourceschange)!==null&&t!==void 0?t:()=>{}}set oninputsourceschange(t){this[m].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[m].oninputsourceschange),this[m].oninputsourceschange=t,t&&this.addEventListener("inputsourceschange",t)}get onselect(){var t;return(t=this[m].onselect)!==null&&t!==void 0?t:()=>{}}set onselect(t){this[m].onselect&&this.removeEventListener("select",this[m].onselect),this[m].onselect=t,t&&this.addEventListener("select",t)}get onselectstart(){var t;return(t=this[m].onselectstart)!==null&&t!==void 0?t:()=>{}}set onselectstart(t){this[m].onselectstart&&this.removeEventListener("selectstart",this[m].onselectstart),this[m].onselectstart=t,t&&this.addEventListener("selectstart",t)}get onselectend(){var t;return(t=this[m].onselectend)!==null&&t!==void 0?t:()=>{}}set onselectend(t){this[m].onselectend&&this.removeEventListener("selectend",this[m].onselectend),this[m].onselectend=t,t&&this.addEventListener("selectend",t)}get onsqueeze(){var t;return(t=this[m].onsqueeze)!==null&&t!==void 0?t:()=>{}}set onsqueeze(t){this[m].onsqueeze&&this.removeEventListener("squeeze",this[m].onsqueeze),this[m].onsqueeze=t,t&&this.addEventListener("squeeze",t)}get onsqueezestart(){var t;return(t=this[m].onsqueezestart)!==null&&t!==void 0?t:()=>{}}set onsqueezestart(t){this[m].onsqueezestart&&this.removeEventListener("squeezestart",this[m].onsqueezestart),this[m].onsqueezestart=t,t&&this.addEventListener("squeezestart",t)}get onsqueezeend(){var t;return(t=this[m].onsqueezeend)!==null&&t!==void 0?t:()=>{}}set onsqueezeend(t){this[m].onsqueezeend&&this.removeEventListener("squeezeend",this[m].onsqueezeend),this[m].onsqueezeend=t,t&&this.addEventListener("squeezeend",t)}get onvisibilitychange(){var t;return(t=this[m].onvisibilitychange)!==null&&t!==void 0?t:()=>{}}set onvisibilitychange(t){this[m].onvisibilitychange&&this.removeEventListener("visibilitychange",this[m].onvisibilitychange),this[m].onvisibilitychange=t,t&&this.addEventListener("visibilitychange",t)}get onframeratechange(){var t;return(t=this[m].onframeratechange)!==null&&t!==void 0?t:()=>{}}set onframeratechange(t){this[m].onframeratechange&&this.removeEventListener("frameratechange",this[m].onframeratechange),this[m].onframeratechange=t,t&&this.addEventListener("frameratechange",t)}}class wa extends EventTarget{}const Ke=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),M0={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class k0 extends wa{constructor(t,n,r={}){if(super(),t[m].ended)throw new DOMException("Session has ended","InvalidStateError");const i={...M0,...r};this[Ke]={session:t,context:n,antialias:i.antialias}}get context(){return this[Ke].context}get antialias(){return this[Ke].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Ke].context.drawingBufferWidth}get framebufferHeight(){return this[Ke].context.drawingBufferHeight}getViewport(t){if(t[ct].session!==this[Ke].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Ke].session[m].device[S].getViewport(this,t)}static getNativeFramebufferScaleFactor(t){if(!(t instanceof ci))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return t[m].ended?0:1}}const Je=Symbol("@immersive-web-emulation-runtime/xr-system");class Ki extends EventTarget{constructor(t){super(),this[Je]={device:t}}isSessionSupported(t){return new Promise((n,r)=>{t===J.Inline?n(!0):n(this[Je].device.supportedSessionModes.includes(t))})}requestSession(t,n={}){return new Promise((r,i)=>{this.isSessionSupported(t).then(a=>{if(!a){i(new DOMException("The requested XRSession mode is not supported.","NotSupportedError"));return}if(this[Je].activeSession){i(new DOMException("An active XRSession already exists.","InvalidStateError"));return}const{requiredFeatures:s=[],optionalFeatures:o=[]}=n,{supportedFeatures:l}=this[Je].device;if(!s.every(g=>l.includes(g))){i(new Error("One or more required features are not supported by the device."));return}const u=o.filter(g=>l.includes(g)),h=Array.from(new Set([...s,...u,L.Viewer,L.Local])),p=new ci(this[Je].device,t,h);this[Je].activeSession=p,p.addEventListener("end",()=>{this[Je].activeSession=void 0}),r(p)}).catch(i)})}}const _=Symbol("@immersive-web-emulation-runtime/action-player");class E0{constructor(t,n,r){const{schema:i,frames:a}=n;if(!a||!i||a.length===0)throw new DOMException("wrong recording format","NotSupportedError");const s=new wt(se.Viewer,t),o={[H.Left]:new ue(s),[H.Right]:new ue(s),[H.None]:new ue(s)};this[_]={refSpace:t,inputSources:new Map,inputSchemas:new Map,frames:a,recordedFramePointer:0,startingTimeStamp:a[0][0],endingTimeStamp:a[a.length-1][0],playbackTime:a[0][0],playing:!1,viewerSpace:s,viewSpaces:o,vec3:ke(),quat:Oe()},sn(this[_].viewSpaces[H.Left][ne].offsetMatrix,Re(-r/2,0,0)),sn(this[_].viewSpaces[H.Right][ne].offsetMatrix,Re(r/2,0,0)),i.forEach(l=>{const c=l[0],u=l[1];let h;if(u.hasGamepad){const v=[];for(let y=0;y{g.set(v,new li(v,p))}));const x=new er(u.handedness,u.targetRayMode,u.profiles,p,h,u.hasGrip?new ue(t):void 0,u.hasHand?g:void 0);this[_].inputSources.set(c,{active:!1,source:x}),this[_].inputSchemas.set(c,u)})}play(){this[_].recordedFramePointer=0,this[_].playbackTime=this[_].startingTimeStamp,this[_].playing=!0,this[_].actualTimeStamp=performance.now()}stop(){this[_].playing=!1}get playing(){return this[_].playing}get viewerSpace(){return this[_].viewerSpace}get viewSpaces(){return this[_].viewSpaces}get inputSources(){return Array.from(this[_].inputSources.values()).filter(t=>t.active).map(t=>t.source)}playFrame(){const t=performance.now(),n=t-this[_].actualTimeStamp;if(this[_].actualTimeStamp=t,this[_].playbackTime+=n,this[_].playbackTime>this[_].endingTimeStamp){this.stop();return}for(;this[_].frames[this[_].recordedFramePointer+1][0]{l.active=!1}),o.forEach((l,c)=>{this[_].inputSources.get(c).active=!0;const u=this[_].inputSources.get(c).source,h=this[_].inputSchemas.get(c);this.updateInputSource(u,h,s.has(c)?s.get(c):l,l,a)})}updateInputSource(t,n,r,i,a){if(this.updateXRSpaceFromMergedFrames(t.targetRaySpace,r.targetRayTransform,i.targetRayTransform,a),n.hasGrip&&this.updateXRSpaceFromMergedFrames(t.gripSpace,r.gripTransform,i.gripTransform,a),n.hasHand)for(let s=0;s<25;s++){const o=r.handTransforms.slice(s*8,s*8+7),l=i.handTransforms.slice(s*8,s*8+7),c=r.handTransforms[s*8+7],u=i.handTransforms[s*8+7],h=t.hand.get(n.jointSequence[s]);this.updateXRSpaceFromMergedFrames(h,o,l,a),h[pt].radius=(u-c)*a+c}if(n.hasGamepad){const s=t.gamepad;i.buttons.forEach((o,l)=>{const c=s.buttons[l];c[I].pressed=o[0]===1,c[I].touched=o[1]===1;const u=r.buttons[l][2],h=o[2];c[I].value=(h-u)*a+u}),i.axes.forEach((o,l)=>{const c=r.axes[l];s[I].axesMap[l.toString()].x=(o-c)*a+c})}}updateXRSpaceFromMergedFrames(t,n,r,i){const a=Re(n[0],n[1],n[2]),s=Vn(n[3],n[4],n[5],n[6]),o=Re(r[0],r[1],r[2]),l=Vn(r[3],r[4],r[5],r[6]);jr(this[_].vec3,a,o,i),en(this[_].quat,s,l,i),pn(t[ne].offsetMatrix,this[_].quat,this[_].vec3)}processRawInputData(t){const n=t[0],r=this[_].inputSchemas.get(n),a={targetRayTransform:t.slice(1,8)};let s=8;if(r.hasGrip&&(a.gripTransform=t[s++]),r.hasHand&&(a.handTransforms=t[s++]),r.hasGamepad){const o=t[s];a.buttons=o.slice(0,r.numButtons),a.axes=o.slice(r.numButtons)}return{index:n,inputData:a}}}const P0="1.0.3";class Ji extends Event{constructor(t,n){if(super(t,n),!n.referenceSpace)throw new Error("XRReferenceSpaceEventInit.referenceSpace is required");this.referenceSpace=n.referenceSpace,this.transform=n.transform}}const Xt=Symbol("@immersive-web-emulation-runtime/xr-viewport");class kn{constructor(t,n,r,i){this[Xt]={x:t,y:n,width:r,height:i}}get x(){return this[Xt].x}get y(){return this[Xt].y}get width(){return this[Xt].width}get height(){return this[Xt].height}}var L;(function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded",e.DomOverlay="dom-overlay",e.Anchors="anchors",e.PlaneDetection="plane-detection",e.MeshDetection="mesh-detection",e.HitTest="hit-test",e.HandTracking="hand-tracking",e.DepthSensing="depth-sensing"})(L||(L={}));const S=Symbol("@immersive-web-emulation-runtime/xr-device"),Bt={ipd:.063,fovy:Math.PI/2,headsetPosition:new He(0,1.6,0),headsetQuaternion:new ht,stereoEnabled:!1};class A0{constructor(t,n={}){var r,i,a,s,o,l;const c=new h0,u=new wt(se.Viewer,c),h={[H.Left]:new ue(u),[H.Right]:new ue(u),[H.None]:new ue(u)},p=t.controllerConfig,g={};p&&Object.values(be).forEach(d=>{p.layout[d]&&(g[d]=new g0(p,d,c))});const x={[be.Left]:new Xi(_i,be.Left,c),[be.Right]:new Xi(_i,be.Right,c)},v=(r=n.canvasContainer)!==null&&r!==void 0?r:document.createElement("div");v.dataset.webxr_runtime=`Immersive Web Emulation Runtime v${P0}`,v.style.position="fixed",v.style.width="100%",v.style.height="100%",v.style.top="0",v.style.left="0",v.style.display="flex",v.style.justifyContent="center",v.style.alignItems="center",v.style.overflow="hidden",v.style.zIndex="999",this[S]={name:t.name,supportedSessionModes:t.supportedSessionModes,supportedFeatures:t.supportedFeatures,supportedFrameRates:t.supportedFrameRates,isSystemKeyboardSupported:t.isSystemKeyboardSupported,internalNominalFrameRate:t.internalNominalFrameRate,userAgent:t.userAgent,position:(i=n.headsetPosition)!==null&&i!==void 0?i:Bt.headsetPosition.clone(),quaternion:(a=n.headsetQuaternion)!==null&&a!==void 0?a:Bt.headsetQuaternion.clone(),stereoEnabled:(s=n.stereoEnabled)!==null&&s!==void 0?s:Bt.stereoEnabled,ipd:(o=n.ipd)!==null&&o!==void 0?o:Bt.ipd,fovy:(l=n.fovy)!==null&&l!==void 0?l:Bt.fovy,controllers:g,hands:x,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:Et.Visible,pendingVisibilityState:null,xrSystem:null,matrix:ge(),globalSpace:c,viewerSpace:u,viewSpaces:h,canvasContainer:v,getViewport:(d,y)=>{const b=d.context.canvas,{width:w,height:M}=b;switch(y.eye){case H.None:return new kn(0,0,w,M);case H.Left:return new kn(0,0,this[S].stereoEnabled?w/2:w,M);case H.Right:return new kn(w/2,0,this[S].stereoEnabled?w/2:0,M)}},updateViews:()=>{const d=this[S].viewerSpace;pn(d[ne].offsetMatrix,this[S].quaternion.quat,this[S].position.vec3),sn(this[S].viewSpaces[H.Left][ne].offsetMatrix,Re(-this[S].ipd/2,0,0)),sn(this[S].viewSpaces[H.Right][ne].offsetMatrix,Re(this[S].ipd/2,0,0))},onBaseLayerSet:d=>{if(!d)return;const y=d.context.canvas;y.parentElement!==this[S].canvasContainer&&(this[S].canvasData={canvas:y,parent:y.parentElement,width:y.width,height:y.height},this[S].canvasContainer.appendChild(y),document.body.appendChild(this[S].canvasContainer)),y.width=window.innerWidth,y.height=window.innerHeight},onSessionEnd:()=>{if(this[S].canvasData){const{canvas:d,parent:y,width:b,height:w}=this[S].canvasData;d.width=b,d.height=w,y?y.appendChild(d):this[S].canvasContainer.removeChild(d),document.body.removeChild(this[S].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:d=>{var y;if(!((y=this[S].actionPlayer)===null||y===void 0)&&y.playing)this[S].actionPlayer.playFrame();else{const b=d.session;this[S].updateViews(),this[S].pendingVisibilityState&&(this[S].visibilityState=this[S].pendingVisibilityState,this[S].pendingVisibilityState=null,b.dispatchEvent(new Xn("visibilitychange",{session:b}))),this[S].visibilityState===Et.Visible&&this.activeInputs.forEach(w=>{w.onFrameStart(d)}),this[S].pendingReferenceSpaceReset&&(b[m].referenceSpaces.forEach(w=>{switch(w[tt].type){case se.Local:case se.LocalFloor:case se.BoundedFloor:case se.Unbounded:w.dispatchEvent(new Ji("reset",{referenceSpace:w}));break}}),this[S].pendingReferenceSpaceReset=!1)}this[S].updateViews()}},this[S].updateViews()}installRuntime(t=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise((n,r)=>{n(!0)})},configurable:!0}),this[S].xrSystem=new Ki(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[S].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[S].userAgent,writable:!1,configurable:!1,enumerable:!0}),t.XRSystem=Ki,t.XRSession=ci,t.XRRenderState=_r,t.XRFrame=ya,t.XRSpace=ue,t.XRReferenceSpace=wt,t.XRJointSpace=li,t.XRView=pa,t.XRViewport=kn,t.XRRigidTransform=nr,t.XRPose=tr,t.XRViewerPose=ga,t.XRJointPose=ma,t.XRInputSource=er,t.XRInputSourceArray=m0,t.XRHand=oi,t.XRLayer=wa,t.XRWebGLLayer=k0,t.XRSessionEvent=Xn,t.XRInputSourceEvent=Ln,t.XRInputSourcesChangeEvent=va,t.XRReferenceSpaceEvent=Ji}get supportedSessionModes(){return this[S].supportedSessionModes}get supportedFeatures(){return this[S].supportedFeatures}get supportedFrameRates(){return this[S].supportedFrameRates}get isSystemKeyboardSupported(){return this[S].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[S].internalNominalFrameRate}get stereoEnabled(){return this[S].stereoEnabled}set stereoEnabled(t){this[S].stereoEnabled=t}get ipd(){return this[S].ipd}set ipd(t){this[S].ipd=t}get fovy(){return this[S].fovy}set fovy(t){this[S].fovy=t}get position(){return this[S].position}get quaternion(){return this[S].quaternion}get viewerSpace(){var t;return!((t=this[S].actionPlayer)===null||t===void 0)&&t.playing?this[S].actionPlayer.viewerSpace:this[S].viewerSpace}get viewSpaces(){var t;return!((t=this[S].actionPlayer)===null||t===void 0)&&t.playing?this[S].actionPlayer.viewSpaces:this[S].viewSpaces}get controllers(){return this[S].controllers}get hands(){return this[S].hands}get primaryInputMode(){return this[S].primaryInputMode}set primaryInputMode(t){if(t!=="controller"&&t!=="hand"){console.warn('primary input mode can only be "controller" or "hand"');return}this[S].primaryInputMode=t}get activeInputs(){return this[S].visibilityState!==Et.Visible?[]:(this[S].primaryInputMode==="controller"?Object.values(this[S].controllers):Object.values(this[S].hands)).filter(n=>n.connected)}get inputSources(){var t;return!((t=this[S].actionPlayer)===null||t===void 0)&&t.playing?this[S].actionPlayer.inputSources:this.activeInputs.map(n=>n.inputSource)}get canvasContainer(){return this[S].canvasContainer}get activeSession(){var t;return(t=this[S].xrSystem)===null||t===void 0?void 0:t[Je].activeSession}recenter(){const t=new He(-this.position.x,0,-this.position.z),n=new He(0,0,-1).applyQuaternion(this.quaternion);n.y=0,n.normalize();const r=Math.atan2(n.x,-n.z),i=new ht().setFromAxisAngle(new He(0,1,0),r);this.position.add(t),this.quaternion.multiply(i),[...Object.values(this[S].controllers),...Object.values(this[S].hands)].forEach(a=>{a.position.add(t),a.quaternion.multiply(i),a.position.applyQuaternion(i)}),this[S].pendingReferenceSpaceReset=!0}get visibilityState(){return this[S].visibilityState}updateVisibilityState(t){if(!Object.values(Et).includes(t))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");t!==this[S].visibilityState&&(this[S].pendingVisibilityState=t)}createActionPlayer(t,n){return this[S].actionPlayer=new E0(t,n,this[S].ipd),this[S].actionPlayer}}const rr={mapping:on.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"x-button",type:"binary"},{id:"y-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},ir={mapping:on.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"a-button",type:"binary"},{id:"b-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},I0={profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,4673031295254759e-24,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,3688163374704345e-23,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},R0={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,20823669899527886e-24,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,-8329467959811154e-23,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},O0={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,-15779937356796836e-24,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},L0={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rr,gripOffsetMatrix:[.9925461411476135,10736208366779465e-24,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:ir,gripOffsetMatrix:[.9925461411476135,-26238110351073374e-24,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},T0={name:"Oculus Quest 1",controllerConfig:I0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},j0={name:"Meta Quest 2",controllerConfig:R0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.MeshDetection,L.HitTest,L.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},_0={name:"Meta Quest Pro",controllerConfig:O0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.MeshDetection,L.HitTest,L.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},C0={name:"Meta Quest 3",controllerConfig:L0,supportedSessionModes:[J.Inline,J.ImmersiveVR,J.ImmersiveAR],supportedFeatures:[L.Viewer,L.Local,L.LocalFloor,L.BoundedFloor,L.Unbounded,L.Anchors,L.PlaneDetection,L.MeshDetection,L.HitTest,L.HandTracking,L.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},es=()=>{};let fi={},ba={},Sa=null,Ma={mark:es,measure:es};try{typeof window<"u"&&(fi=window),typeof document<"u"&&(ba=document),typeof MutationObserver<"u"&&(Sa=MutationObserver),typeof performance<"u"&&(Ma=performance)}catch{}const{userAgent:ts=""}=fi.navigator||{},rt=fi,Z=ba,ns=Sa,En=Ma;rt.document;const Be=!!Z.documentElement&&!!Z.head&&typeof Z.addEventListener=="function"&&typeof Z.createElement=="function",ka=~ts.indexOf("MSIE")||~ts.indexOf("Trident/");var W="classic",Ea="duotone",Se="sharp",Me="sharp-duotone",F0=[W,Ea,Se,Me],z0={classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds"}},rs={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},N0=["kit"],D0=/fa(s|r|l|t|d|b|k|kd|ss|sr|sl|st|sds)?[\-\ ]/,$0=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i,V0={"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}},q0={"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds"}},H0={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds"}},Z0={classic:["fas","far","fal","fat"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds"]},X0={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid"}},B0={classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",duotone:"fad",brands:"fab"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds"}},Pa={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fad:"duotone","fa-duotone":"duotone",fab:"brands","fa-brands":"brands"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid"}},Y0=["solid","regular","light","thin","duotone","brands"],Aa=[1,2,3,4,5,6,7,8,9,10],W0=Aa.concat([11,12,13,14,15,16,17,18,19,20]),Qt={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},Q0=[...Object.keys(Z0),...Y0,"2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",Qt.GROUP,Qt.SWAP_OPACITY,Qt.PRIMARY,Qt.SECONDARY].concat(Aa.map(e=>"".concat(e,"x"))).concat(W0.map(e=>"w-".concat(e))),G0={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},U0={kit:{"fa-kit":"fak"},"kit-duotone":{"fa-kit-duotone":"fakd"}},K0={kit:{fak:"fa-kit"},"kit-duotone":{fakd:"fa-kit-duotone"}},is={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}};const Ze="___FONT_AWESOME___",Cr=16,Ia="fa",Ra="svg-inline--fa",bt="data-fa-i2svg",Fr="data-fa-pseudo-element",J0="data-fa-pseudo-element-pending",ui="data-prefix",di="data-icon",ss="fontawesome-i2svg",e1="async",t1=["HTML","HEAD","STYLE","SCRIPT"],Oa=(()=>{try{return!0}catch{return!1}})(),La=[W,Se,Me];function mn(e){return new Proxy(e,{get(t,n){return n in t?t[n]:t[W]}})}const Ta={...Pa};Ta[W]={...Pa[W],...rs.kit,...rs["kit-duotone"]};const mt=mn(Ta),zr={...B0};zr[W]={...zr[W],...is.kit,...is["kit-duotone"]};const cn=mn(zr),Nr={...X0};Nr[W]={...Nr[W],...K0.kit};const gt=mn(Nr),Dr={...H0};Dr[W]={...Dr[W],...U0.kit};const n1=mn(Dr),r1=D0,ja="fa-layers-text",i1=$0,s1={...z0};mn(s1);const a1=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],xr=Qt,Ot=new Set;Object.keys(cn[W]).map(Ot.add.bind(Ot));Object.keys(cn[Se]).map(Ot.add.bind(Ot));Object.keys(cn[Me]).map(Ot.add.bind(Ot));const o1=[...N0,...Q0],tn=rt.FontAwesomeConfig||{};function l1(e){var t=Z.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}function c1(e){return e===""?!0:e==="false"?!1:e==="true"?!0:e}Z&&typeof Z.querySelector=="function"&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(t=>{let[n,r]=t;const i=c1(l1(n));i!=null&&(tn[r]=i)});const _a={styleDefault:"solid",familyDefault:"classic",cssPrefix:Ia,replacementClass:Ra,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};tn.familyPrefix&&(tn.cssPrefix=tn.familyPrefix);const Lt={..._a,...tn};Lt.autoReplaceSvg||(Lt.observeMutations=!1);const P={};Object.keys(_a).forEach(e=>{Object.defineProperty(P,e,{enumerable:!0,set:function(t){Lt[e]=t,nn.forEach(n=>n(P))},get:function(){return Lt[e]}})});Object.defineProperty(P,"familyPrefix",{enumerable:!0,set:function(e){Lt.cssPrefix=e,nn.forEach(t=>t(P))},get:function(){return Lt.cssPrefix}});rt.FontAwesomeConfig=P;const nn=[];function f1(e){return nn.push(e),()=>{nn.splice(nn.indexOf(e),1)}}const Ge=Cr,ze={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function u1(e){if(!e||!Be)return;const t=Z.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;const n=Z.head.childNodes;let r=null;for(let i=n.length-1;i>-1;i--){const a=n[i],s=(a.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(s)>-1&&(r=a)}return Z.head.insertBefore(t,r),e}const d1="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function fn(){let e=12,t="";for(;e-- >0;)t+=d1[Math.random()*62|0];return t}function Nt(e){const t=[];for(let n=(e||[]).length>>>0;n--;)t[n]=e[n];return t}function hi(e){return e.classList?Nt(e.classList):(e.getAttribute("class")||"").split(" ").filter(t=>t)}function Ca(e){return"".concat(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function h1(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,'="').concat(Ca(e[n]),'" '),"").trim()}function sr(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,": ").concat(e[n].trim(),";"),"")}function pi(e){return e.size!==ze.size||e.x!==ze.x||e.y!==ze.y||e.rotate!==ze.rotate||e.flipX||e.flipY}function p1(e){let{transform:t,containerWidth:n,iconWidth:r}=e;const i={transform:"translate(".concat(n/2," 256)")},a="translate(".concat(t.x*32,", ").concat(t.y*32,") "),s="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),o="rotate(".concat(t.rotate," 0 0)"),l={transform:"".concat(a," ").concat(s," ").concat(o)},c={transform:"translate(".concat(r/2*-1," -256)")};return{outer:i,inner:l,path:c}}function m1(e){let{transform:t,width:n=Cr,height:r=Cr,startCentered:i=!1}=e,a="";return i&&ka?a+="translate(".concat(t.x/Ge-n/2,"em, ").concat(t.y/Ge-r/2,"em) "):i?a+="translate(calc(-50% + ".concat(t.x/Ge,"em), calc(-50% + ").concat(t.y/Ge,"em)) "):a+="translate(".concat(t.x/Ge,"em, ").concat(t.y/Ge,"em) "),a+="scale(".concat(t.size/Ge*(t.flipX?-1:1),", ").concat(t.size/Ge*(t.flipY?-1:1),") "),a+="rotate(".concat(t.rotate,"deg) "),a}var g1=`:root, :host { --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free"; --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free"; --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro"; diff --git a/examples/minecraft/assets/index-Dtng-XR7.js b/examples/minecraft/assets/index-BV9Fj0rk.js similarity index 99% rename from examples/minecraft/assets/index-Dtng-XR7.js rename to examples/minecraft/assets/index-BV9Fj0rk.js index 4f22350..6c374ae 100644 --- a/examples/minecraft/assets/index-Dtng-XR7.js +++ b/examples/minecraft/assets/index-BV9Fj0rk.js @@ -4094,7 +4094,7 @@ No matching component was found for: `+A.vertexShader,A.vertexShader=A.vertexShader.replace("#include ",`#include vFade = position.z + 0.5;`),A.fragmentShader=`varying float vFade; `+A.fragmentShader,A.fragmentShader=A.fragmentShader.replace("#include ",`#include - diffuseColor.a *= vFade;`)}}function C1(g,A,I,C){if(!I.getEnabled()){g.visible=!1;return}g.visible=!0;const i=I.getIntersection(),B=typeof C.color=="function"?C.color(I):C.color;Array.isArray(B)?A.color.set(...B):A.color.set(B??"white"),A.opacity=typeof C.opacity=="function"?C.opacity(I):C.opacity??.4;let Q=C.maxLength??1;i!=null&&(Q=Math.min(Q,i.distance)),g.position.z=-Q/2;const e=C.size??.005;g.scale.set(e,e,Q),g.updateMatrix()}function i1(g,A,I,C,i,B={}){const Q=a=>{a.inputSource===I&&g.down(Object.assign(a,{button:B.button??0}))},e=a=>{a.inputSource===I&&g.up(Object.assign(a,{button:B.button??0}))},t=`${C}start`,E=`${C}end`,s=i.length;for(let a=0;a{A.removeEventListener(t,Q),A.removeEventListener(E,e)}}function B1(g){var A;return g.getButtonsDown().size>0?.6:Tm(((A=g.getIntersection())==null?void 0:A.distance)??1/0,.07,0,.2,.4)}function gh(g){return g.getButtonsDown().size>0?.6:.4}function Q1(g){var A;return Tm(((A=g.getIntersection())==null?void 0:A.distance)??1/0,.1,.03,.2,.6)}function Tm(g,A,I,C,i){return C+Math.max(0,Math.min(1,(g-A)/(I-A)))*(i-C)}function e1(g,A){return(I,C)=>{if(g===A)return I.identity(),!0;const i=typeof A=="function"?A():A;if(i==null)return!1;const B=C==null?void 0:C.getPose(g,i);return B==null?!1:(I.fromArray(B.transform.matrix),!0)}}function xm(g,A,I){if(A==null){I.copy(g.matrixWorld);return}I.copy(A.matrixWorld).invert().multiply(g.matrixWorld)}function t1(g,A,I,C){C==null||C.copy(g.matrix);const i=vm(g,C);return i!=null||A==null||I==null?i:(C!=null&&xm(g,A,C),I)}function vm({parent:g},A){if(g!=null)return A!=null&&A.premultiply(g.matrix),g.xrSpace??vm(g,A)}var E1={BASE_URL:"/xr/examples/minecraft/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const vF=g=>{let A;const I=new Set,C=(s,a)=>{const r=typeof s=="function"?s(A):s;if(!Object.is(r,A)){const l=A;A=a??(typeof r!="object"||r===null)?r:Object.assign({},A,r),I.forEach(h=>h(A,l))}},i=()=>A,t={setState:C,getState:i,getInitialState:()=>E,subscribe:s=>(I.add(s),()=>I.delete(s)),destroy:()=>{(E1?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),I.clear()}},E=A=g(C,i,t);return t},o1=g=>g?vF(g):vF;function n1(g,A,{anchors:I=!0,handTracking:C=!0,layers:i=!0,meshDetection:B=!0,planeDetection:Q=!0,customSessionInit:e,depthSensing:t=!1,hitTest:E=!0,domOverlay:s=!0,bounded:a}={}){if(e!=null)return e;const r=a==null?["local-floor"]:a?["bounded-floor"]:["unbounded","local-floor"],l=[];s instanceof Element&&(s=!0),oe(I,"anchors",r,l),oe(C,"hand-tracking",r,l),oe(i,"layers",r,l),oe(B,"mesh-detection",r,l),oe(Q,"plane-detection",r,l),oe(t,"depth-sensing",r,l),oe(s,"dom-overlay",r,l),oe(E,"hit-test",r,l);const h={requiredFeatures:r,optionalFeatures:l,domOverlay:{root:A}};return t&&Object.assign(h,{depthSensing:{usagePreference:["gpu-optimized"],dataFormatPreference:[]}}),h}function oe(g,A,I,C){if(g!==!1){if(g===!0){C.push(A);return}I.push(A)}}function ce(g,A,I){return typeof g=="function"?g:(typeof g=="object"&&(A!=null&&s1(g,A)?g=g[A]:"default"in g&&(g=g.default)),g===!1?!1:g===!0?I:g??I)}function s1(g,A){return A in g}function bm(g,A,I){return g??(g=I),g===!1?!1:typeof g=="function"?g:A!=null&&A in g?g[A]??I:"default"in g?g.default??I:g}const Om={session:void 0,originReferenceSpace:void 0,visibilityState:void 0,mode:null,frameRate:void 0,handStates:[],controllerStates:[],transientPointerStates:[],gazeStates:[],screenInputStates:[],detectedMeshes:[],detectedPlanes:[]};function bF(g,A){var I,C;Promise.all([(I=navigator.xr)==null?void 0:I.isSessionSupported("immersive-vr"),(C=navigator.xr)==null?void 0:C.isSessionSupported("immersive-ar")]).then(([i,B])=>!B&&!i?im(()=>import("./emulate-CrWpOIO2.js"),[]):void 0).then(i=>{A&&window.alert("emulator started"),i==null||i.emulate(g)})}function a1(g){const A="metaQuest3";let I;{window.location.hostname==="localhost"&&bF(A,!1);const r=l=>{l.altKey&&l.metaKey&&l.code==="KeyE"&&bF(A,!0)};window.addEventListener("keydown",r),I=()=>window.removeEventListener("keydown",r)}const C=(g==null?void 0:g.domOverlay)instanceof HTMLElement?g.domOverlay:document.createElement("div"),i=o1(()=>({...Om,controller:g==null?void 0:g.controller,hand:g==null?void 0:g.hand,gaze:g==null?void 0:g.gaze,screenInput:g==null?void 0:g.screenInput,transientPointer:g==null?void 0:g.transientPointer,detectedMesh:g==null?void 0:g.detectedMesh,detectedPlane:g==null?void 0:g.detectedPlane,domOverlayRoot:C}));let B;if(C.parentNode==null){const r=h=>{C.style.display=h.session!=null?"block":"none"},l=i.subscribe(r);r(i.getState()),document.body.appendChild(C),B=()=>{C.remove(),l()}}document.body.append(C);const Q=X8({controller:r=>i.setState({controllerStates:[...i.getState().controllerStates,r]})},g),e=D1(i,Q),t=c1(g==null?void 0:g.enterGrantedSession,r=>ac(C,r,g,a));let E;const s=[];let a;return Object.assign(i,{requestFrame(){return new Promise(r=>s.push(r))},setWebXRManager(r){if(a===r)return;a=r;const{foveation:l,bounded:h}={};r.setReferenceSpaceType(h?"bounded-floor":"local-floor"),l!=null&&r.setFoveation(l),E==null||E(),E=l1(r,e)},setFrameRate(r){const{session:l}=i.getState();l!=null&&_m(l,r)},setHand(r,l){if(l==null){i.setState({hand:r});return}const h=i.getState().hand,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({hand:w})},setController(r,l){if(l==null){i.setState({controller:r});return}const h=i.getState().controller,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({controller:w})},setTransientPointer(r,l){if(l==null){i.setState({transientPointer:r});return}const h=i.getState().transientPointer,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({transientPointer:w})},setGaze(r){i.setState({gaze:r})},setScreenInput(r){i.setState({screenInput:r})},setDetectedPlane(r,l){if(l==null){i.setState({detectedPlane:r});return}const h=i.getState().detectedPlane,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({detectedPlane:w})},setDetectedMesh(r,l){if(l==null){i.setState({detectedMesh:r});return}const h=i.getState().detectedMesh,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({detectedMesh:w})},destroy(){I==null||I(),B==null||B(),E==null||E(),t==null||t(),e(void 0,void 0)},enterXR:r=>ac(C,r,g,a),enterAR:()=>ac(C,"immersive-ar",g,a),enterVR:()=>ac(C,"immersive-vr",g,a),onBeforeFrame(r,l,h){const{origin:w}=i.getState(),S=l.parent??r,c=(a==null?void 0:a.getReferenceSpace())??void 0;w!=S&&(S.xrSpace=c,i.setState({origin:S}));const{originReferenceSpace:G}=i.getState();if(c!=G&&(S.xrSpace=c,i.setState({originReferenceSpace:c})),h==null)return;a!=null&&h1(i,h,a);const u=s.length;for(let k=0;k component?"));const i=await navigator.xr.requestSession(A,n1(A,g,I));return _m(i,"high"),r1(C,i),i}function r1(g,A,I){g!=null&&(XRWebGLLayer.getNativeFramebufferScaleFactor(A),g==null||g.setSession(A))}const OF=["immersive-ar","immersive-vr","inline"];function l1(g,A){const I=()=>{const C=g.getSession();A(C,C.environmentBlendMode==="opaque"?"immersive-vr":"immersive-ar")};return g.addEventListener("sessionstart",I),()=>g.removeEventListener("sessionstart",I)}function c1(g=OF,A){var C;if(g===!1)return;g===!0&&(g=OF);const I=async()=>{var i;for(const B of g)await((i=navigator.xr)==null?void 0:i.isSessionSupported(B))&&A(B)};return(C=navigator.xr)==null||C.addEventListener("sessiongranted",I),()=>{var i;return(i=navigator.xr)==null?void 0:i.removeEventListener("sessiongranted",I)}}function D1(g,A){let I;return(C,i)=>{if(I==null||I(),C==null||i==null)return;const B=t=>g.setState(A(t.session,g.getState(),t.added,t.removed));C.addEventListener("inputsourceschange",B);const Q=()=>g.setState({frameRate:C.frameRate,visibilityState:C.visibilityState}),e=()=>{I==null||I(),I=void 0,g.setState(Om)};C.addEventListener("end",e),C.addEventListener("frameratechange",Q),C.addEventListener("visibilitychange",Q),g.setState({...A(C,void 0,C.inputSources,void 0),frameRate:C.frameRate,visibilityState:C.visibilityState,detectedMeshes:[],detectedPlanes:[],mode:i,session:C}),I=()=>{A(C,g.getState(),void 0,"all"),C.removeEventListener("end",e),C.removeEventListener("frameratechange",Q),C.removeEventListener("visibilitychange",Q),C.removeEventListener("inputsourceschange",B)}}}function h1(g,A,I){const C=I.getReferenceSpace(),{detectedMeshes:i,detectedPlanes:B,session:Q,controllerStates:e,handStates:t}=g.getState();if(C==null||Q==null)return;const E=_F(B,A.detectedPlanes),s=_F(i,A.detectedMeshes);(B!=E||i!=s)&&g.setState({detectedPlanes:E,detectedMeshes:s});const a=e.length;for(let l=0;l{I instanceof eg&&I.material instanceof hg&&(I.material.colorWrite=(A==null?void 0:A.colorWrite)??!0)})}function u1(g,A,I){const C=[];for(const i in A.components){const B=A.components[i];let Q=I[i];Q==null&&(I[i]=Q={state:"default"}),C.push(...Object.values(B.visualResponses).map(e=>k1(g,Q,e)))}return()=>{const i=C.length;for(let B=0;B{};if(I.valueNodeProperty==="visibility")return()=>C.visible=I.states.includes(A.state);const i=g.getObjectByName(I.minNodeName),B=g.getObjectByName(I.maxNodeName);return i==null||B==null?()=>{}:()=>{const Q=M1(A,I);C.quaternion.slerpQuaternions(i.quaternion,B.quaternion,Q),C.position.lerpVectors(i.position,B.position,Q),C.updateMatrix()}}function M1(g,{componentProperty:A,states:I}){const C=I.includes(g.state);switch(A){case"xAxis":return C?PF(g).x:.5;case"yAxis":return C?PF(g).y:.5;case"button":return C?g.button??0:0;case"state":return C?1:0}}const Cs=new lA;function PF({xAxis:g=0,yAxis:A=0}){if(Cs.lengthSq()>1){const C=Math.atan2(A,g);Cs.set(Math.cos(C),Math.sin(C))}else Cs.set(g,A);return Cs.multiplyScalar(.5).addScalar(.5),Cs}function d1({_listeners:g,__r3f:A}){return g!=null&&Object.keys(g).length>0||A!=null&&(A==null?void 0:A.eventCount)>0}function p1({_listeners:g,__r3f:A},I){if(g!=null&&I in g)return g[I];if(A==null)return;const C=A.handlers[U1[I]];if(C!=null)return[C]}const U1={click:"onClick",contextmenu:"onContextMenu",dblclick:"onDoubleClick",pointercancel:"onPointerCancel",pointerdown:"onPointerDown",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",pointermove:"onPointerMove",pointerout:"onPointerOut",pointerover:"onPointerOver",pointerup:"onPointerUp",wheel:"onWheel"};class WC{constructor(A,I,C,i,B,Q=B.object,e=Q){JI(this,"type");JI(this,"bubbles");JI(this,"nativeEvent");JI(this,"pointer");JI(this,"intersection");JI(this,"currentObject");JI(this,"object");JI(this,"stopPropagation");JI(this,"stopImmediatePropagation");this.type=A,this.bubbles=I,this.nativeEvent=C,this.pointer=i,this.intersection=B,this.currentObject=Q,this.object=e}get pointerId(){return this.pointer.id}get pointerType(){return this.pointer.type}get pointerState(){return this.pointer.state}get timeStamp(){return this.nativeEvent.timeStamp}get button(){return this.nativeEvent.button}get shiftKey(){return this.nativeEvent.shiftKey??!1}get metaKey(){return this.nativeEvent.metaKey??!1}get ctrlKey(){return this.nativeEvent.ctrlKey??!1}get altKey(){return this.nativeEvent.altKey??!1}get distance(){return this.intersection.distance}get distanceToRay(){return this.intersection.distanceToRay}get point(){return this.intersection.point}get index(){return this.intersection.index}get face(){return this.intersection.face}get faceIndex(){return this.intersection.faceIndex}get uv(){return this.intersection.uv}get uv1(){return this.intersection.uv1}get normal(){return this.intersection.normal}get instanceId(){return this.intersection.instanceId}get pointOnLine(){return this.intersection.pointOnLine}get batchId(){return this.intersection.batchId}get pointerPosition(){return this.intersection.pointerPosition}get pointerQuaternion(){return this.intersection.pointerQuaternion}get pointOnFace(){return this.intersection.pointOnFace}get localPoint(){return this.intersection.localPoint}get details(){return this.intersection.details}get target(){return this.object}get currentTarget(){return this.currentObject}retarget(A){const{type:I,bubbles:C,nativeEvent:i,pointer:B,intersection:Q,target:e}=this;return new WC(I,C,i,B,Q,A,e)}}class Gd extends WC{get deltaX(){return this.nativeEvent.deltaX}get deltaY(){return this.nativeEvent.deltaY}get deltaZ(){return this.nativeEvent.deltaZ}constructor(A,I,C,i,B){super("wheel",!0,A,I,C,i,B)}retarget(A){const{type:I,bubbles:C,nativeEvent:i,pointer:B,intersection:Q,target:e}=this;return new Gd(i,B,Q,A,e)}}function _i(g){Pm(g,g.currentObject)}function Pm(g,A){if(A==null)return;const I=p1(A,g.type);let C=!g.bubbles;if(I!=null&&I.length>0){const i=g.retarget(A),B=I.length;i.stopPropagation=()=>C=!0;let Q=!1;i.stopImmediatePropagation=()=>{C=!0,Q=!0};for(let e=0;e=0;e--){const t=this.pointerEnteredHelper[e];_i(new WC("pointerenter",!1,A,this,C,t))}if(C!=null&&_i(new WC("pointermove",!0,A,this,C)),this.prevIntersection=this.intersection,this.prevEnabled=this.enabled,!this.wasMoved){this.wasMoved=!0;const e=this.onFirstMove.length;for(let t=0;tC){e.set(A.button,A.timeStamp);return}_i(new WC("dblclick",!0,A,this,this.intersection)),e.delete(A.button)}cancel(A){if(this.enabled){if(!this.wasMoved){this.onFirstMove.push(this.cancel.bind(this,A));return}this.intersection!=null&&_i(new WC("pointercancel",!0,A,this,this.intersection))}}wheel(A,I,C){if(!this.enabled)return;let i=this.intersection;if(C||(i=this.computeIntersection(A,I,this.pointerCapture)),!this.wasMoved&&C){this.onFirstMove.push(this.cancel.bind(this,I));return}i!=null&&_i(new Gd(I,this,i))}exit(A){var I;if(!this.wasMoved){this.onFirstMove.push(this.exit.bind(this,A));return}this.pointerCapture!=null&&((I=this.parentReleasePointerCapture)==null||I.call(this),this.pointerCapture=void 0),this.intersection=void 0,this.commit(A)}}function Wm(g,A,I,C){if(g==null)return;const i=I.indexOf(g);i!=-1?I.splice(i,1):C.push(g),A.push(g),Wm(g.parent,A,I,C)}function N1(g,A,I,C,i){if(A==null)return!1;const B=A.get(I);return!(B==null||C-B>i||B!=g.get(I))}function kd(g,A,I){return A.face==null?!1:(g.setFromNormalAndCoplanarPoint(A.face.normal,A.localPoint),g.applyMatrix4(I.matrixWorld),!0)}function F1(g,A,I,C,i,B){if(A==="none"||A==="listener"&&!g)return!1;if(I==="all")return!0;if(typeof I=="function")return I(C,i,B);let Q,e;"deny"in I?(e=!0,Q=I.deny):(e=!1,Q=I.allow);let t;return Array.isArray(Q)?t=Q.includes(i):t=Q===i,e?!t:t}function FS(g,A,I,C,i,B=!1,Q,e,t){const E=B||d1(g),s=g.pointerEvents??Q,a=g.pointerEventsType??e,r=g.pointerEventsOrder??t;F1(E,s??"listener",a??"all",A,I,C)&&i(g,r);const h=g.children.length;for(let w=0;w0)&&(g=E,Q=t)}return Q}function R1(g,A=0,I,C=0){return A!=C?C-A:g.distance-I.distance}const aQ=new Pa,K1=new _A,Ao=[];function f1(g,A,I,C,i,B,Q,e){if(Q!=null)return J1(g,A,Q);let t,E;if(FS(I,C,i,B,(s,a)=>{let r=0;const l=((t==null?void 0:t.details.lineIndex)??A.length-2)+2;for(let h=1;h0;C--){const i=A[C-1],B=A[C];if(yy.origin.copy(i).applyMatrix4(g),yy.direction.copy(B).applyMatrix4(g).sub(aQ.ray.origin).normalize(),yy.intersectPlane(I,WF)!=null)return WF.clone()}}const uy=new Pa,ky=new J,VF=new GB,m1=new _A,rc=[];function Y1(g,A,I,C,i,B,Q,e,t){if(e!=null)return L1(g,A,I,e);let E,s;if(uy.ray.origin.copy(g),uy.ray.direction.copy(I).applyQuaternion(A),FS(C,i,B,Q,(a,r)=>{a.raycast(uy,rc);const l=Md(E,s,rc,r,t);l!=null&&(E=rc[l],s=r),rc.length=0}),E!=null)return Object.assign(E,{details:{type:"ray"},pointerPosition:g.clone(),pointerQuaternion:A.clone(),pointOnFace:E.point,localPoint:E.point.clone().applyMatrix4(m1.copy(E.object.matrixWorld).invert())})}const jF=new xe;function L1(g,A,I,{intersection:C,object:i}){if(C.details.type!="ray")return;ky.copy(I).applyQuaternion(A),jF.set(g,ky),kd(VF,C,i);const B=jF.intersectPlane(VF,new J)??C.point;return{...C,object:i,pointOnFace:B,point:ky.clone().multiplyScalar(C.distance).add(g),pointerPosition:g.clone(),pointerQuaternion:A.clone()}}const My=new zg,lc=[];function Vm(g,A,I,C,i,B,Q,e,t){if(e!=null)return x1(g,A,e);let E,s;if(My.center.copy(g),My.radius=I,FS(C,i,B,Q,(a,r)=>{T1(My,a,lc);const l=Md(E,s,lc,r,t);l!=null&&(E=lc[l],s=r),lc.length=0}),E!=null)return Object.assign(E,{details:{type:"sphere"},pointOnFace:E.point,pointerPosition:g.clone(),pointerQuaternion:A.clone(),localPoint:E.point.clone().applyMatrix4(Ch.copy(E.object.matrixWorld).invert())})}const cc=new _A;function H1(g){return"spherecast"in g}function T1(g,A,I){if(A.updateWorldMatrix(!0,!1),H1(A)){A.spherecast(g,I);return}if(A instanceof Ta){A.geometry.boundingSphere==null&&A.geometry.computeBoundingSphere(),A.geometry.boundingBox==null&&A.geometry.computeBoundingBox();for(let i=0;ig.radius*g.radius)return;dy.max(v1);const Q=Ro.center.clone().sub(IR);Q.divide(dy),b1(Q);const e=Dc.clone();return{distance:Math.sqrt(B),face:{a:0,b:0,c:0,materialIndex:0,normal:Q},normal:Q,point:e,instanceId:C,object:A}}function b1(g){const A=Math.abs(g.x),I=Math.abs(g.y),C=Math.abs(g.z);if(A>=I&&A>=C){g.set(g.x<0?-1:1,0,0);return}if(I>=A&&I>=C){g.set(0,g.y<0?-1:1,0);return}g.set(0,0,g.z<0?-1:1)}const Pu={radius:.07};function O1(g,A,I=Pu,C="grab"){const i=new J,B=new XI,Q=dd();return new ud(Q,C,A,(e,t,E)=>{const s=g.current;if(s!=null)return s.updateWorldMatrix(!0,!1),i.setFromMatrixPosition(s.matrixWorld),B.setFromRotationMatrix(s.matrixWorld),Vm(i,B,I.radius??Pu.radius,e,Q,C,A,E,I)},void 0,void 0,void 0,I)}const _1=new J(0,0,-1),P1=new J,hs={direction:_1,minDistance:0,linePoints:null};function Z1(g,A,I=hs,C="ray"){const i=new J,B=new XI,Q=dd();return new ud(Q,C,A,(e,t,E)=>{const s=g.current;if(s==null)return;s.updateWorldMatrix(!0,!1);let a;const r=I.linePoints??hs.linePoints;if(r==null?(i.setFromMatrixPosition(s.matrixWorld),B.setFromRotationMatrix(s.matrixWorld),a=Y1(i,B,I.direction??hs.direction,e,Q,C,A,E,I)):a=f1(s.matrixWorld,r,e,Q,C,A,E,I),!(a==null||a.distance*s.getWorldScale(P1).x<(I.minDistance??hs.minDistance)))return a},void 0,void 0,void 0,I)}const Ko={button:0,downRadius:.03,hoverRadius:.1};function W1(g,A,I=Ko,C="touch"){const i=new J,B=new XI,Q=dd();return new ud(Q,C,A,(e,t,E)=>{const s=g.current;if(s!=null)return s.updateWorldMatrix(!0,!1),i.setFromMatrixPosition(s.matrixWorld),B.setFromRotationMatrix(s.matrixWorld),Vm(i,B,I.hoverRadius??Ko.hoverRadius,e,Q,C,A,E,I)},V1(I),void 0,void 0,I)}function V1(g=Ko){let A=!1;return I=>{if(!I.getEnabled())return;const C=I.getIntersection(),i=j1(C,g.downRadius??Ko.downRadius);if(i===A)return;const B={timeStamp:performance.now(),button:g.button??Ko.button};i?I.down(B):I.up(B),A=i}}function j1(g,A){return g==null?!1:g.distance<=A}let X1=23412;function dd(){return X1++}new J;new lA;let z1=class{constructor(){JI(this,"pointers",[]);JI(this,"isDefaults",[]);JI(this,"enabled",!0)}register(A,I){return this.pointers.push(A),this.isDefaults.push(I),this.unregister.bind(this,A)}unregister(A){const I=this.pointers.indexOf(A);I!==-1&&(this.isDefaults.splice(I,1),this.pointers.splice(I,1))}move(A,I){var Q,e;if(!this.enabled)return;const C=this.pointers.length;if(C===0)return;for(let t=0;t=g.lastChangedTime)return A;const I=new yI;return I.setIndex(new hI(g.indices,1)),I.setAttribute("position",new hI(g.vertices,3)),Object.assign(I,{creationTime:g.lastChangedTime})}function iR(g,A){return A!=null&&A.createdAt!=null&&A.createdAt>=g.lastChangedTime?A:Object.assign($1(g.polygon),{createdAt:g.lastChangedTime})}const Bs=new Mq,hc=new lA;function $1(g){const A=new Ne,I=g.map(({x:i,z:B})=>new lA(i,B));Bs.setFromPoints(I),Bs.getSize(hc);for(const i of I)i.sub(Bs.min),i.divide(hc);A.setFromPoints(I);const C=new Oa(A);return C.scale(hc.x,hc.y,1),C.translate(Bs.min.x,Bs.min.y,0),C.rotateX(Math.PI/2),C}new J;new J;new J;var AV=Object.defineProperty,IV=(g,A,I)=>A in g?AV(g,A,{enumerable:!0,configurable:!0,writable:!0,value:I}):g[A]=I,jI=(g,A,I)=>(IV(g,typeof A!="symbol"?A+"":A,I),I);function py(g,A,I,C,i){let B;if(g=g.subarray||g.slice?g:g.buffer,I=I.subarray||I.slice?I:I.buffer,g=A?g.subarray?g.subarray(A,i&&A+i):g.slice(A,i&&A+i):g,I.set)I.set(g,C);else for(B=0;B{const I=Array.isArray(A);return A instanceof J?[A.x,A.y,A.z]:A instanceof lA?[A.x,A.y,0]:I&&A.length===3?[A[0],A[1],A[2]]:I&&A.length===2?[A[0],A[1],0]:A}).flat()}class CV extends yI{constructor(){super(),jI(this,"type","MeshLine"),jI(this,"isMeshLine",!0),jI(this,"positions",[]),jI(this,"previous",[]),jI(this,"next",[]),jI(this,"side",[]),jI(this,"width",[]),jI(this,"indices_array",[]),jI(this,"uvs",[]),jI(this,"counters",[]),jI(this,"widthCallback",null),jI(this,"_attributes"),jI(this,"_points",[]),jI(this,"points"),jI(this,"matrixWorld",new _A),Object.defineProperties(this,{points:{enumerable:!0,get(){return this._points},set(A){this.setPoints(A,this.widthCallback)}}})}setMatrixWorld(A){this.matrixWorld=A}setPoints(A,I){if(A=gV(A),this._points=A,this.widthCallback=I??null,this.positions=[],this.counters=[],A.length&&A[0]instanceof J)for(let C=0;C0&&(C=this.copyV3(i),this.next.push(C[0],C[1],C[2]),this.next.push(C[0],C[1],C[2]))}this.compareV3(A-1,0)?C=this.copyV3(1):C=this.copyV3(A-1),this.next.push(C[0],C[1],C[2]),this.next.push(C[0],C[1],C[2]),!this._attributes||this._attributes.position.count!==this.counters.length?this._attributes={position:new hI(new Float32Array(this.positions),3),previous:new hI(new Float32Array(this.previous),3),next:new hI(new Float32Array(this.next),3),side:new hI(new Float32Array(this.side),1),width:new hI(new Float32Array(this.width),1),uv:new hI(new Float32Array(this.uvs),2),index:new hI(new Uint16Array(this.indices_array),1),counters:new hI(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}advance({x:A,y:I,z:C}){const i=this._attributes.position.array,B=this._attributes.previous.array,Q=this._attributes.next.array,e=i.length;py(i,0,B,0,e),py(i,6,i,0,e-6),i[e-6]=A,i[e-5]=I,i[e-4]=C,i[e-3]=A,i[e-2]=I,i[e-1]=C,py(i,6,Q,0,e-6),Q[e-6]=A,Q[e-5]=I,Q[e-4]=C,Q[e-3]=A,Q[e-2]=I,Q[e-1]=C,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}}const iV=` + diffuseColor.a *= vFade;`)}}function C1(g,A,I,C){if(!I.getEnabled()){g.visible=!1;return}g.visible=!0;const i=I.getIntersection(),B=typeof C.color=="function"?C.color(I):C.color;Array.isArray(B)?A.color.set(...B):A.color.set(B??"white"),A.opacity=typeof C.opacity=="function"?C.opacity(I):C.opacity??.4;let Q=C.maxLength??1;i!=null&&(Q=Math.min(Q,i.distance)),g.position.z=-Q/2;const e=C.size??.005;g.scale.set(e,e,Q),g.updateMatrix()}function i1(g,A,I,C,i,B={}){const Q=a=>{a.inputSource===I&&g.down(Object.assign(a,{button:B.button??0}))},e=a=>{a.inputSource===I&&g.up(Object.assign(a,{button:B.button??0}))},t=`${C}start`,E=`${C}end`,s=i.length;for(let a=0;a{A.removeEventListener(t,Q),A.removeEventListener(E,e)}}function B1(g){var A;return g.getButtonsDown().size>0?.6:Tm(((A=g.getIntersection())==null?void 0:A.distance)??1/0,.07,0,.2,.4)}function gh(g){return g.getButtonsDown().size>0?.6:.4}function Q1(g){var A;return Tm(((A=g.getIntersection())==null?void 0:A.distance)??1/0,.1,.03,.2,.6)}function Tm(g,A,I,C,i){return C+Math.max(0,Math.min(1,(g-A)/(I-A)))*(i-C)}function e1(g,A){return(I,C)=>{if(g===A)return I.identity(),!0;const i=typeof A=="function"?A():A;if(i==null)return!1;const B=C==null?void 0:C.getPose(g,i);return B==null?!1:(I.fromArray(B.transform.matrix),!0)}}function xm(g,A,I){if(A==null){I.copy(g.matrixWorld);return}I.copy(A.matrixWorld).invert().multiply(g.matrixWorld)}function t1(g,A,I,C){C==null||C.copy(g.matrix);const i=vm(g,C);return i!=null||A==null||I==null?i:(C!=null&&xm(g,A,C),I)}function vm({parent:g},A){if(g!=null)return A!=null&&A.premultiply(g.matrix),g.xrSpace??vm(g,A)}var E1={BASE_URL:"/xr/examples/minecraft/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const vF=g=>{let A;const I=new Set,C=(s,a)=>{const r=typeof s=="function"?s(A):s;if(!Object.is(r,A)){const l=A;A=a??(typeof r!="object"||r===null)?r:Object.assign({},A,r),I.forEach(h=>h(A,l))}},i=()=>A,t={setState:C,getState:i,getInitialState:()=>E,subscribe:s=>(I.add(s),()=>I.delete(s)),destroy:()=>{(E1?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),I.clear()}},E=A=g(C,i,t);return t},o1=g=>g?vF(g):vF;function n1(g,A,{anchors:I=!0,handTracking:C=!0,layers:i=!0,meshDetection:B=!0,planeDetection:Q=!0,customSessionInit:e,depthSensing:t=!1,hitTest:E=!0,domOverlay:s=!0,bounded:a}={}){if(e!=null)return e;const r=a==null?["local-floor"]:a?["bounded-floor"]:["unbounded","local-floor"],l=[];s instanceof Element&&(s=!0),oe(I,"anchors",r,l),oe(C,"hand-tracking",r,l),oe(i,"layers",r,l),oe(B,"mesh-detection",r,l),oe(Q,"plane-detection",r,l),oe(t,"depth-sensing",r,l),oe(s,"dom-overlay",r,l),oe(E,"hit-test",r,l);const h={requiredFeatures:r,optionalFeatures:l,domOverlay:{root:A}};return t&&Object.assign(h,{depthSensing:{usagePreference:["gpu-optimized"],dataFormatPreference:[]}}),h}function oe(g,A,I,C){if(g!==!1){if(g===!0){C.push(A);return}I.push(A)}}function ce(g,A,I){return typeof g=="function"?g:(typeof g=="object"&&(A!=null&&s1(g,A)?g=g[A]:"default"in g&&(g=g.default)),g===!1?!1:g===!0?I:g??I)}function s1(g,A){return A in g}function bm(g,A,I){return g??(g=I),g===!1?!1:typeof g=="function"?g:A!=null&&A in g?g[A]??I:"default"in g?g.default??I:g}const Om={session:void 0,originReferenceSpace:void 0,visibilityState:void 0,mode:null,frameRate:void 0,handStates:[],controllerStates:[],transientPointerStates:[],gazeStates:[],screenInputStates:[],detectedMeshes:[],detectedPlanes:[]};function bF(g,A){var I,C;Promise.all([(I=navigator.xr)==null?void 0:I.isSessionSupported("immersive-vr"),(C=navigator.xr)==null?void 0:C.isSessionSupported("immersive-ar")]).then(([i,B])=>!B&&!i?im(()=>import("./emulate-BcR5c3Lg.js"),[]):void 0).then(i=>{A&&window.alert("emulator started"),i==null||i.emulate(g)})}function a1(g){const A="metaQuest3";let I;{window.location.hostname==="localhost"&&bF(A,!1);const r=l=>{l.altKey&&l.metaKey&&l.code==="KeyE"&&bF(A,!0)};window.addEventListener("keydown",r),I=()=>window.removeEventListener("keydown",r)}const C=(g==null?void 0:g.domOverlay)instanceof HTMLElement?g.domOverlay:document.createElement("div"),i=o1(()=>({...Om,controller:g==null?void 0:g.controller,hand:g==null?void 0:g.hand,gaze:g==null?void 0:g.gaze,screenInput:g==null?void 0:g.screenInput,transientPointer:g==null?void 0:g.transientPointer,detectedMesh:g==null?void 0:g.detectedMesh,detectedPlane:g==null?void 0:g.detectedPlane,domOverlayRoot:C}));let B;if(C.parentNode==null){const r=h=>{C.style.display=h.session!=null?"block":"none"},l=i.subscribe(r);r(i.getState()),document.body.appendChild(C),B=()=>{C.remove(),l()}}document.body.append(C);const Q=X8({controller:r=>i.setState({controllerStates:[...i.getState().controllerStates,r]})},g),e=D1(i,Q),t=c1(g==null?void 0:g.enterGrantedSession,r=>ac(C,r,g,a));let E;const s=[];let a;return Object.assign(i,{requestFrame(){return new Promise(r=>s.push(r))},setWebXRManager(r){if(a===r)return;a=r;const{foveation:l,bounded:h}={};r.setReferenceSpaceType(h?"bounded-floor":"local-floor"),l!=null&&r.setFoveation(l),E==null||E(),E=l1(r,e)},setFrameRate(r){const{session:l}=i.getState();l!=null&&_m(l,r)},setHand(r,l){if(l==null){i.setState({hand:r});return}const h=i.getState().hand,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({hand:w})},setController(r,l){if(l==null){i.setState({controller:r});return}const h=i.getState().controller,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({controller:w})},setTransientPointer(r,l){if(l==null){i.setState({transientPointer:r});return}const h=i.getState().transientPointer,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({transientPointer:w})},setGaze(r){i.setState({gaze:r})},setScreenInput(r){i.setState({screenInput:r})},setDetectedPlane(r,l){if(l==null){i.setState({detectedPlane:r});return}const h=i.getState().detectedPlane,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({detectedPlane:w})},setDetectedMesh(r,l){if(l==null){i.setState({detectedMesh:r});return}const h=i.getState().detectedMesh,w={};typeof h=="object"&&Object.assign(w,h),Object.assign(w,{default:ce(h,void 0,{}),[l]:r}),i.setState({detectedMesh:w})},destroy(){I==null||I(),B==null||B(),E==null||E(),t==null||t(),e(void 0,void 0)},enterXR:r=>ac(C,r,g,a),enterAR:()=>ac(C,"immersive-ar",g,a),enterVR:()=>ac(C,"immersive-vr",g,a),onBeforeFrame(r,l,h){const{origin:w}=i.getState(),S=l.parent??r,c=(a==null?void 0:a.getReferenceSpace())??void 0;w!=S&&(S.xrSpace=c,i.setState({origin:S}));const{originReferenceSpace:G}=i.getState();if(c!=G&&(S.xrSpace=c,i.setState({originReferenceSpace:c})),h==null)return;a!=null&&h1(i,h,a);const u=s.length;for(let k=0;k component?"));const i=await navigator.xr.requestSession(A,n1(A,g,I));return _m(i,"high"),r1(C,i),i}function r1(g,A,I){g!=null&&(XRWebGLLayer.getNativeFramebufferScaleFactor(A),g==null||g.setSession(A))}const OF=["immersive-ar","immersive-vr","inline"];function l1(g,A){const I=()=>{const C=g.getSession();A(C,C.environmentBlendMode==="opaque"?"immersive-vr":"immersive-ar")};return g.addEventListener("sessionstart",I),()=>g.removeEventListener("sessionstart",I)}function c1(g=OF,A){var C;if(g===!1)return;g===!0&&(g=OF);const I=async()=>{var i;for(const B of g)await((i=navigator.xr)==null?void 0:i.isSessionSupported(B))&&A(B)};return(C=navigator.xr)==null||C.addEventListener("sessiongranted",I),()=>{var i;return(i=navigator.xr)==null?void 0:i.removeEventListener("sessiongranted",I)}}function D1(g,A){let I;return(C,i)=>{if(I==null||I(),C==null||i==null)return;const B=t=>g.setState(A(t.session,g.getState(),t.added,t.removed));C.addEventListener("inputsourceschange",B);const Q=()=>g.setState({frameRate:C.frameRate,visibilityState:C.visibilityState}),e=()=>{I==null||I(),I=void 0,g.setState(Om)};C.addEventListener("end",e),C.addEventListener("frameratechange",Q),C.addEventListener("visibilitychange",Q),g.setState({...A(C,void 0,C.inputSources,void 0),frameRate:C.frameRate,visibilityState:C.visibilityState,detectedMeshes:[],detectedPlanes:[],mode:i,session:C}),I=()=>{A(C,g.getState(),void 0,"all"),C.removeEventListener("end",e),C.removeEventListener("frameratechange",Q),C.removeEventListener("visibilitychange",Q),C.removeEventListener("inputsourceschange",B)}}}function h1(g,A,I){const C=I.getReferenceSpace(),{detectedMeshes:i,detectedPlanes:B,session:Q,controllerStates:e,handStates:t}=g.getState();if(C==null||Q==null)return;const E=_F(B,A.detectedPlanes),s=_F(i,A.detectedMeshes);(B!=E||i!=s)&&g.setState({detectedPlanes:E,detectedMeshes:s});const a=e.length;for(let l=0;l{I instanceof eg&&I.material instanceof hg&&(I.material.colorWrite=(A==null?void 0:A.colorWrite)??!0)})}function u1(g,A,I){const C=[];for(const i in A.components){const B=A.components[i];let Q=I[i];Q==null&&(I[i]=Q={state:"default"}),C.push(...Object.values(B.visualResponses).map(e=>k1(g,Q,e)))}return()=>{const i=C.length;for(let B=0;B{};if(I.valueNodeProperty==="visibility")return()=>C.visible=I.states.includes(A.state);const i=g.getObjectByName(I.minNodeName),B=g.getObjectByName(I.maxNodeName);return i==null||B==null?()=>{}:()=>{const Q=M1(A,I);C.quaternion.slerpQuaternions(i.quaternion,B.quaternion,Q),C.position.lerpVectors(i.position,B.position,Q),C.updateMatrix()}}function M1(g,{componentProperty:A,states:I}){const C=I.includes(g.state);switch(A){case"xAxis":return C?PF(g).x:.5;case"yAxis":return C?PF(g).y:.5;case"button":return C?g.button??0:0;case"state":return C?1:0}}const Cs=new lA;function PF({xAxis:g=0,yAxis:A=0}){if(Cs.lengthSq()>1){const C=Math.atan2(A,g);Cs.set(Math.cos(C),Math.sin(C))}else Cs.set(g,A);return Cs.multiplyScalar(.5).addScalar(.5),Cs}function d1({_listeners:g,__r3f:A}){return g!=null&&Object.keys(g).length>0||A!=null&&(A==null?void 0:A.eventCount)>0}function p1({_listeners:g,__r3f:A},I){if(g!=null&&I in g)return g[I];if(A==null)return;const C=A.handlers[U1[I]];if(C!=null)return[C]}const U1={click:"onClick",contextmenu:"onContextMenu",dblclick:"onDoubleClick",pointercancel:"onPointerCancel",pointerdown:"onPointerDown",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",pointermove:"onPointerMove",pointerout:"onPointerOut",pointerover:"onPointerOver",pointerup:"onPointerUp",wheel:"onWheel"};class WC{constructor(A,I,C,i,B,Q=B.object,e=Q){JI(this,"type");JI(this,"bubbles");JI(this,"nativeEvent");JI(this,"pointer");JI(this,"intersection");JI(this,"currentObject");JI(this,"object");JI(this,"stopPropagation");JI(this,"stopImmediatePropagation");this.type=A,this.bubbles=I,this.nativeEvent=C,this.pointer=i,this.intersection=B,this.currentObject=Q,this.object=e}get pointerId(){return this.pointer.id}get pointerType(){return this.pointer.type}get pointerState(){return this.pointer.state}get timeStamp(){return this.nativeEvent.timeStamp}get button(){return this.nativeEvent.button}get shiftKey(){return this.nativeEvent.shiftKey??!1}get metaKey(){return this.nativeEvent.metaKey??!1}get ctrlKey(){return this.nativeEvent.ctrlKey??!1}get altKey(){return this.nativeEvent.altKey??!1}get distance(){return this.intersection.distance}get distanceToRay(){return this.intersection.distanceToRay}get point(){return this.intersection.point}get index(){return this.intersection.index}get face(){return this.intersection.face}get faceIndex(){return this.intersection.faceIndex}get uv(){return this.intersection.uv}get uv1(){return this.intersection.uv1}get normal(){return this.intersection.normal}get instanceId(){return this.intersection.instanceId}get pointOnLine(){return this.intersection.pointOnLine}get batchId(){return this.intersection.batchId}get pointerPosition(){return this.intersection.pointerPosition}get pointerQuaternion(){return this.intersection.pointerQuaternion}get pointOnFace(){return this.intersection.pointOnFace}get localPoint(){return this.intersection.localPoint}get details(){return this.intersection.details}get target(){return this.object}get currentTarget(){return this.currentObject}retarget(A){const{type:I,bubbles:C,nativeEvent:i,pointer:B,intersection:Q,target:e}=this;return new WC(I,C,i,B,Q,A,e)}}class Gd extends WC{get deltaX(){return this.nativeEvent.deltaX}get deltaY(){return this.nativeEvent.deltaY}get deltaZ(){return this.nativeEvent.deltaZ}constructor(A,I,C,i,B){super("wheel",!0,A,I,C,i,B)}retarget(A){const{type:I,bubbles:C,nativeEvent:i,pointer:B,intersection:Q,target:e}=this;return new Gd(i,B,Q,A,e)}}function _i(g){Pm(g,g.currentObject)}function Pm(g,A){if(A==null)return;const I=p1(A,g.type);let C=!g.bubbles;if(I!=null&&I.length>0){const i=g.retarget(A),B=I.length;i.stopPropagation=()=>C=!0;let Q=!1;i.stopImmediatePropagation=()=>{C=!0,Q=!0};for(let e=0;e=0;e--){const t=this.pointerEnteredHelper[e];_i(new WC("pointerenter",!1,A,this,C,t))}if(C!=null&&_i(new WC("pointermove",!0,A,this,C)),this.prevIntersection=this.intersection,this.prevEnabled=this.enabled,!this.wasMoved){this.wasMoved=!0;const e=this.onFirstMove.length;for(let t=0;tC){e.set(A.button,A.timeStamp);return}_i(new WC("dblclick",!0,A,this,this.intersection)),e.delete(A.button)}cancel(A){if(this.enabled){if(!this.wasMoved){this.onFirstMove.push(this.cancel.bind(this,A));return}this.intersection!=null&&_i(new WC("pointercancel",!0,A,this,this.intersection))}}wheel(A,I,C){if(!this.enabled)return;let i=this.intersection;if(C||(i=this.computeIntersection(A,I,this.pointerCapture)),!this.wasMoved&&C){this.onFirstMove.push(this.cancel.bind(this,I));return}i!=null&&_i(new Gd(I,this,i))}exit(A){var I;if(!this.wasMoved){this.onFirstMove.push(this.exit.bind(this,A));return}this.pointerCapture!=null&&((I=this.parentReleasePointerCapture)==null||I.call(this),this.pointerCapture=void 0),this.intersection=void 0,this.commit(A)}}function Wm(g,A,I,C){if(g==null)return;const i=I.indexOf(g);i!=-1?I.splice(i,1):C.push(g),A.push(g),Wm(g.parent,A,I,C)}function N1(g,A,I,C,i){if(A==null)return!1;const B=A.get(I);return!(B==null||C-B>i||B!=g.get(I))}function kd(g,A,I){return A.face==null?!1:(g.setFromNormalAndCoplanarPoint(A.face.normal,A.localPoint),g.applyMatrix4(I.matrixWorld),!0)}function F1(g,A,I,C,i,B){if(A==="none"||A==="listener"&&!g)return!1;if(I==="all")return!0;if(typeof I=="function")return I(C,i,B);let Q,e;"deny"in I?(e=!0,Q=I.deny):(e=!1,Q=I.allow);let t;return Array.isArray(Q)?t=Q.includes(i):t=Q===i,e?!t:t}function FS(g,A,I,C,i,B=!1,Q,e,t){const E=B||d1(g),s=g.pointerEvents??Q,a=g.pointerEventsType??e,r=g.pointerEventsOrder??t;F1(E,s??"listener",a??"all",A,I,C)&&i(g,r);const h=g.children.length;for(let w=0;w0)&&(g=E,Q=t)}return Q}function R1(g,A=0,I,C=0){return A!=C?C-A:g.distance-I.distance}const aQ=new Pa,K1=new _A,Ao=[];function f1(g,A,I,C,i,B,Q,e){if(Q!=null)return J1(g,A,Q);let t,E;if(FS(I,C,i,B,(s,a)=>{let r=0;const l=((t==null?void 0:t.details.lineIndex)??A.length-2)+2;for(let h=1;h0;C--){const i=A[C-1],B=A[C];if(yy.origin.copy(i).applyMatrix4(g),yy.direction.copy(B).applyMatrix4(g).sub(aQ.ray.origin).normalize(),yy.intersectPlane(I,WF)!=null)return WF.clone()}}const uy=new Pa,ky=new J,VF=new GB,m1=new _A,rc=[];function Y1(g,A,I,C,i,B,Q,e,t){if(e!=null)return L1(g,A,I,e);let E,s;if(uy.ray.origin.copy(g),uy.ray.direction.copy(I).applyQuaternion(A),FS(C,i,B,Q,(a,r)=>{a.raycast(uy,rc);const l=Md(E,s,rc,r,t);l!=null&&(E=rc[l],s=r),rc.length=0}),E!=null)return Object.assign(E,{details:{type:"ray"},pointerPosition:g.clone(),pointerQuaternion:A.clone(),pointOnFace:E.point,localPoint:E.point.clone().applyMatrix4(m1.copy(E.object.matrixWorld).invert())})}const jF=new xe;function L1(g,A,I,{intersection:C,object:i}){if(C.details.type!="ray")return;ky.copy(I).applyQuaternion(A),jF.set(g,ky),kd(VF,C,i);const B=jF.intersectPlane(VF,new J)??C.point;return{...C,object:i,pointOnFace:B,point:ky.clone().multiplyScalar(C.distance).add(g),pointerPosition:g.clone(),pointerQuaternion:A.clone()}}const My=new zg,lc=[];function Vm(g,A,I,C,i,B,Q,e,t){if(e!=null)return x1(g,A,e);let E,s;if(My.center.copy(g),My.radius=I,FS(C,i,B,Q,(a,r)=>{T1(My,a,lc);const l=Md(E,s,lc,r,t);l!=null&&(E=lc[l],s=r),lc.length=0}),E!=null)return Object.assign(E,{details:{type:"sphere"},pointOnFace:E.point,pointerPosition:g.clone(),pointerQuaternion:A.clone(),localPoint:E.point.clone().applyMatrix4(Ch.copy(E.object.matrixWorld).invert())})}const cc=new _A;function H1(g){return"spherecast"in g}function T1(g,A,I){if(A.updateWorldMatrix(!0,!1),H1(A)){A.spherecast(g,I);return}if(A instanceof Ta){A.geometry.boundingSphere==null&&A.geometry.computeBoundingSphere(),A.geometry.boundingBox==null&&A.geometry.computeBoundingBox();for(let i=0;ig.radius*g.radius)return;dy.max(v1);const Q=Ro.center.clone().sub(IR);Q.divide(dy),b1(Q);const e=Dc.clone();return{distance:Math.sqrt(B),face:{a:0,b:0,c:0,materialIndex:0,normal:Q},normal:Q,point:e,instanceId:C,object:A}}function b1(g){const A=Math.abs(g.x),I=Math.abs(g.y),C=Math.abs(g.z);if(A>=I&&A>=C){g.set(g.x<0?-1:1,0,0);return}if(I>=A&&I>=C){g.set(0,g.y<0?-1:1,0);return}g.set(0,0,g.z<0?-1:1)}const Pu={radius:.07};function O1(g,A,I=Pu,C="grab"){const i=new J,B=new XI,Q=dd();return new ud(Q,C,A,(e,t,E)=>{const s=g.current;if(s!=null)return s.updateWorldMatrix(!0,!1),i.setFromMatrixPosition(s.matrixWorld),B.setFromRotationMatrix(s.matrixWorld),Vm(i,B,I.radius??Pu.radius,e,Q,C,A,E,I)},void 0,void 0,void 0,I)}const _1=new J(0,0,-1),P1=new J,hs={direction:_1,minDistance:0,linePoints:null};function Z1(g,A,I=hs,C="ray"){const i=new J,B=new XI,Q=dd();return new ud(Q,C,A,(e,t,E)=>{const s=g.current;if(s==null)return;s.updateWorldMatrix(!0,!1);let a;const r=I.linePoints??hs.linePoints;if(r==null?(i.setFromMatrixPosition(s.matrixWorld),B.setFromRotationMatrix(s.matrixWorld),a=Y1(i,B,I.direction??hs.direction,e,Q,C,A,E,I)):a=f1(s.matrixWorld,r,e,Q,C,A,E,I),!(a==null||a.distance*s.getWorldScale(P1).x<(I.minDistance??hs.minDistance)))return a},void 0,void 0,void 0,I)}const Ko={button:0,downRadius:.03,hoverRadius:.1};function W1(g,A,I=Ko,C="touch"){const i=new J,B=new XI,Q=dd();return new ud(Q,C,A,(e,t,E)=>{const s=g.current;if(s!=null)return s.updateWorldMatrix(!0,!1),i.setFromMatrixPosition(s.matrixWorld),B.setFromRotationMatrix(s.matrixWorld),Vm(i,B,I.hoverRadius??Ko.hoverRadius,e,Q,C,A,E,I)},V1(I),void 0,void 0,I)}function V1(g=Ko){let A=!1;return I=>{if(!I.getEnabled())return;const C=I.getIntersection(),i=j1(C,g.downRadius??Ko.downRadius);if(i===A)return;const B={timeStamp:performance.now(),button:g.button??Ko.button};i?I.down(B):I.up(B),A=i}}function j1(g,A){return g==null?!1:g.distance<=A}let X1=23412;function dd(){return X1++}new J;new lA;let z1=class{constructor(){JI(this,"pointers",[]);JI(this,"isDefaults",[]);JI(this,"enabled",!0)}register(A,I){return this.pointers.push(A),this.isDefaults.push(I),this.unregister.bind(this,A)}unregister(A){const I=this.pointers.indexOf(A);I!==-1&&(this.isDefaults.splice(I,1),this.pointers.splice(I,1))}move(A,I){var Q,e;if(!this.enabled)return;const C=this.pointers.length;if(C===0)return;for(let t=0;t=g.lastChangedTime)return A;const I=new yI;return I.setIndex(new hI(g.indices,1)),I.setAttribute("position",new hI(g.vertices,3)),Object.assign(I,{creationTime:g.lastChangedTime})}function iR(g,A){return A!=null&&A.createdAt!=null&&A.createdAt>=g.lastChangedTime?A:Object.assign($1(g.polygon),{createdAt:g.lastChangedTime})}const Bs=new Mq,hc=new lA;function $1(g){const A=new Ne,I=g.map(({x:i,z:B})=>new lA(i,B));Bs.setFromPoints(I),Bs.getSize(hc);for(const i of I)i.sub(Bs.min),i.divide(hc);A.setFromPoints(I);const C=new Oa(A);return C.scale(hc.x,hc.y,1),C.translate(Bs.min.x,Bs.min.y,0),C.rotateX(Math.PI/2),C}new J;new J;new J;var AV=Object.defineProperty,IV=(g,A,I)=>A in g?AV(g,A,{enumerable:!0,configurable:!0,writable:!0,value:I}):g[A]=I,jI=(g,A,I)=>(IV(g,typeof A!="symbol"?A+"":A,I),I);function py(g,A,I,C,i){let B;if(g=g.subarray||g.slice?g:g.buffer,I=I.subarray||I.slice?I:I.buffer,g=A?g.subarray?g.subarray(A,i&&A+i):g.slice(A,i&&A+i):g,I.set)I.set(g,C);else for(B=0;B{const I=Array.isArray(A);return A instanceof J?[A.x,A.y,A.z]:A instanceof lA?[A.x,A.y,0]:I&&A.length===3?[A[0],A[1],A[2]]:I&&A.length===2?[A[0],A[1],0]:A}).flat()}class CV extends yI{constructor(){super(),jI(this,"type","MeshLine"),jI(this,"isMeshLine",!0),jI(this,"positions",[]),jI(this,"previous",[]),jI(this,"next",[]),jI(this,"side",[]),jI(this,"width",[]),jI(this,"indices_array",[]),jI(this,"uvs",[]),jI(this,"counters",[]),jI(this,"widthCallback",null),jI(this,"_attributes"),jI(this,"_points",[]),jI(this,"points"),jI(this,"matrixWorld",new _A),Object.defineProperties(this,{points:{enumerable:!0,get(){return this._points},set(A){this.setPoints(A,this.widthCallback)}}})}setMatrixWorld(A){this.matrixWorld=A}setPoints(A,I){if(A=gV(A),this._points=A,this.widthCallback=I??null,this.positions=[],this.counters=[],A.length&&A[0]instanceof J)for(let C=0;C0&&(C=this.copyV3(i),this.next.push(C[0],C[1],C[2]),this.next.push(C[0],C[1],C[2]))}this.compareV3(A-1,0)?C=this.copyV3(1):C=this.copyV3(A-1),this.next.push(C[0],C[1],C[2]),this.next.push(C[0],C[1],C[2]),!this._attributes||this._attributes.position.count!==this.counters.length?this._attributes={position:new hI(new Float32Array(this.positions),3),previous:new hI(new Float32Array(this.previous),3),next:new hI(new Float32Array(this.next),3),side:new hI(new Float32Array(this.side),1),width:new hI(new Float32Array(this.width),1),uv:new hI(new Float32Array(this.uvs),2),index:new hI(new Uint16Array(this.indices_array),1),counters:new hI(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}advance({x:A,y:I,z:C}){const i=this._attributes.position.array,B=this._attributes.previous.array,Q=this._attributes.next.array,e=i.length;py(i,0,B,0,e),py(i,6,i,0,e-6),i[e-6]=A,i[e-5]=I,i[e-4]=C,i[e-3]=A,i[e-2]=I,i[e-1]=C,py(i,6,Q,0,e-6),Q[e-6]=A,Q[e-5]=I,Q[e-4]=C,Q[e-3]=A,Q[e-2]=I,Q[e-1]=C,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}}const iV=` #include #include #include @@ -4207,4 +4207,4 @@ No matching component was found for: #include #include <${QV}> } -`;class tV extends Ri{constructor(A){super({uniforms:{...HA.fog,lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new KA(16777215)},gradient:{value:[new KA(16711680),new KA(65280)]},opacity:{value:1},resolution:{value:new lA(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useGradient:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new lA(1,1)}},vertexShader:iV,fragmentShader:eV}),jI(this,"lineWidth"),jI(this,"map"),jI(this,"useMap"),jI(this,"alphaMap"),jI(this,"useAlphaMap"),jI(this,"color"),jI(this,"gradient"),jI(this,"resolution"),jI(this,"sizeAttenuation"),jI(this,"dashArray"),jI(this,"dashOffset"),jI(this,"dashRatio"),jI(this,"useDash"),jI(this,"useGradient"),jI(this,"visibility"),jI(this,"repeat"),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(I){this.uniforms.lineWidth.value=I}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(I){this.uniforms.map.value=I}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(I){this.uniforms.useMap.value=I}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(I){this.uniforms.alphaMap.value=I}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(I){this.uniforms.useAlphaMap.value=I}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(I){this.uniforms.color.value=I}},gradient:{enumerable:!0,get(){return this.uniforms.gradient.value},set(I){this.uniforms.gradient.value=I}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(I){this.uniforms.opacity.value=I}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(I){this.uniforms.resolution.value.copy(I)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(I){this.uniforms.sizeAttenuation.value=I}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(I){this.uniforms.dashArray.value=I,this.useDash=I!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(I){this.uniforms.dashOffset.value=I}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(I){this.uniforms.dashRatio.value=I}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(I){this.uniforms.useDash.value=I}},useGradient:{enumerable:!0,get(){return this.uniforms.useGradient.value},set(I){this.uniforms.useGradient.value=I}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(I){this.uniforms.visibility.value=I}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(I){this.uniforms.alphaTest.value=I}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(I){this.uniforms.repeat.value.copy(I)}}}),this.setValues(A)}copy(A){return super.copy(A),this.lineWidth=A.lineWidth,this.map=A.map,this.useMap=A.useMap,this.alphaMap=A.alphaMap,this.useAlphaMap=A.useAlphaMap,this.color.copy(A.color),this.gradient=A.gradient,this.opacity=A.opacity,this.resolution.copy(A.resolution),this.sizeAttenuation=A.sizeAttenuation,this.dashArray=A.dashArray,this.dashOffset=A.dashOffset,this.dashRatio=A.dashRatio,this.useDash=A.useDash,this.useGradient=A.useGradient,this.visibility=A.visibility,this.alphaTest=A.alphaTest,this.repeat.copy(A.repeat),this}}const Qs=new BC(0,0,0,"YXZ"),Sc=new XI;function EV(g,A,I){g.matrixWorld.decompose(A.position,Sc,A.scale),Qs.setFromQuaternion(Sc),Qs.z=0,Qs.x=Lc(Qs.x-10*Math.PI/180,-Math.PI/2,1.1*Math.PI/4),Sc.setFromEuler(Qs),A.quaternion.slerp(Sc,I/100)}function oV(g){return g.userData.teleportTarget===!0}function nV(g={}){return A=>!(!oV(A.object)||g.customFilter!=null&&!g.customFilter(A))}function sV(){return new Th(new J(0,0,0),new J(0,0,-8),new J(0,-20,-15)).getPoints(20)}let aV=class extends eg{constructor(I){const C=new CV,i=new Float32Array(I.length*3);for(let e=0;ee.distanceTo(I[t+1]))}update(I){if(!I.getEnabled()||I.getButtonsDown().size===0){this.visible=!1;return}this.visible=!0;const i=I.getIntersection();if((i==null?void 0:i.details.type)!="lines"){this.material.visibility=this.multiplier;return}const{distanceOnLine:B,lineIndex:Q}=i.details,e=this.lineLengths[Q];this.material.visibility=this.multiplier*(Q+B/e)/this.lineLengths.length;const{color:t="white",opacity:E=.4,size:s=.01}=this.options;this.material.lineWidth=s,this.material.opacity=typeof E=="function"?E(I):E;const a=typeof t=="function"?t(I):t;Array.isArray(a)?this.material.color.set(...a):this.material.color.set(a)}};const wc=new _A,Gc=new J,BR=new XI;async function rV(g,A,I=["point","plane","mesh"]){var t,E;let C,i,B;const Q=g.getState();if(A instanceof XRSpace)i=A,B=Q.origin;else{if(Q.originReferenceSpace==null)return;B=A,i=t1(A,Q.origin,Q.originReferenceSpace,wc)??Q.originReferenceSpace,i===Q.originReferenceSpace&&xm(A,Q.origin,wc),Gc.setFromMatrixPosition(wc);const s={...Gc};BR.setFromRotationMatrix(wc),Gc.set(0,0,-1).applyQuaternion(BR);const a={...Gc};C=new XRRay(s,a)}const e=await((E=(t=g.getState().session)==null?void 0:t.requestHitTestSource)==null?void 0:E.call(t,{space:i,entityTypes:Array.isArray(I)?I:[I],offsetRay:C}));if(e!=null)return{source:e,getWorldMatrix:lV.bind(null,i,B)}}function lV(g,A,I,C){const i=C.getPose(g);return i==null?!1:(I.fromArray(i.transform.matrix),A!=null&&I.premultiply(A.matrixWorld),!0)}new J(1,1,1);new J(0,0,0);new _A;new _A;new J;new J;const jm=new g8,Xm="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/",cV="generic-trigger";class DV{constructor(A){JI(this,"baseAssetPath");JI(this,"defaultProfileId");JI(this,"profilesListPromise");JI(this,"profilePromisesMap",new Map);JI(this,"loadAsync",this.load);this.baseAssetPath=(A==null?void 0:A.baseAssetPath)??Xm,this.defaultProfileId=(A==null?void 0:A.defaultControllerProfileId)??cV}async load(A,I){const C=await this.loadProfile(A);for(const i in C.layouts)if(i.includes(I))return C.layouts[i];throw new Error(`No matching layout for "${I}", in profile ${C.profileId} with layouts ${Object.keys(C.layouts).join(", ")}.`)}async loadProfile(A){this.profilesListPromise??(this.profilesListPromise=QR(new URL("profilesList.json",this.baseAssetPath).href));const I=await this.profilesListPromise,C=A.length;for(let B=0;Bg;function gY(g,A=uV,I){(wV?"production":void 0)!=="production"&&I&&!eR&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),eR=!0);const C=yV(g.subscribe,g.getState,g.getServerState||g.getInitialState,A,I);return GV(C),C}let kV=0;const tR=new Map;function EE(g){let A=tR.get(g);return A==null&&tR.set(g,A=kV++),A}function MV(){return Fg(g=>g.visibilityState)}function dV(g,A){const I=v.useRef(A);I.current=A;const[C,i]=v.useMemo(()=>{let B;return[Q=>{let e=!1;return navigator.xr==null?(B=!1,()=>{}):(navigator.xr.isSessionSupported(g).then(t=>{B=t,!e&&Q()}).catch(t=>{var E;e||(E=I.current)==null||E.call(I,t)}),()=>e=!0)},()=>B]},[g]);return v.useSyncExternalStore(C,i)}v.forwardRef(({id:g,children:A,onPress:I,onRelease:C},i)=>{const B=ka(),[Q,e]=v.useState(void 0);if(v.useImperativeHandle(i,()=>Q,[Q]),pV(g,t=>t==="pressed"?I==null?void 0:I():C==null?void 0:C()),$g(()=>{var t;return e((t=B.gamepad[g])==null?void 0:t.object)}),Q!=null)return FM(A,Q)});function pV(g,A,I){const C=ka(),i=v.useRef();$g(()=>{var Q;const B=(Q=C==null?void 0:C.gamepad[g])==null?void 0:Q.state;B!=null&&B!=i.current&&A(B),i.current=B})}function ka(g){if(g!=null)return Fg(I=>I.controllerStates.find(C=>C.inputSource.handedness===g));const A=v.useContext(zB);if(A==null||A.type!="controller")throw new Error('useXRControllerState() can only be used inside a or using useXRControllerState("left")');return A}const UV=Symbol("loadXRControllerModel"),NV=v.forwardRef((g,A)=>{const I=ka(),C=CS(G1,[I.layout,void 0,UV]);y1(C,g),I.object=C,v.useImperativeHandle(A,()=>C,[C]);const i=v.useMemo(()=>u1(C,I.layout,I.gamepad),[C,I.layout,I.gamepad]);return $g(i),z.jsx("primitive",{object:C})});function pd(g){const A=v.useContext(zB);if(A==null||A.type!="hand")throw new Error('useXRHandState() can only be used inside a or with using useXRHandState("left")');return A}const FV=Symbol("loadXRHandModel"),RV=v.forwardRef((g,A)=>{const I=pd(),C=CS(b8,[I.assetPath,void 0,FV]);O8(C,g),v.useImperativeHandle(A,()=>C,[C]);const i=Aj(),B=v.useMemo(()=>W8(I.inputSource.hand,C,i),[I.inputSource,C,i]);return $g((Q,e,t)=>B(t)),z.jsx("primitive",{object:C})});v.forwardRef(({joint:g,children:A},I)=>{const C=pd();return z.jsx(tB,{ref:I,space:C.inputSource.hand.get(g),children:A})});function CY({children:g}){const A=v.useMemo(()=>new z1,[]);return BY(A),$g(I=>A.move(I.scene,{timeStamp:performance.now()}),-50),z.jsx(IY.Provider,{value:A,children:g})}function KV(g,A,I,C){const i=v.useMemo(()=>({}),[]);Object.assign(i,Pu,I);const B=v.useMemo(()=>O1(g,A,i,C),[g,A,i,C]);return Nd(B,I==null?void 0:I.makeDefault),B}function iY(g,A,I,C){const i=v.useMemo(()=>({}),[]);Object.assign(i,hs,I);const B=v.useMemo(()=>Z1(g,A,i,C),[g,A,i,C]);return Nd(B,I==null?void 0:I.makeDefault),B}function fV(g,A,I,C){const i=v.useMemo(()=>({}),[]);Object.assign(i,Ko,I);const B=v.useMemo(()=>W1(g,A,i,C),[g,A,i,C]);return Nd(B,I==null?void 0:I.makeDefault),B}const JV=v.forwardRef((g,A)=>{const I=v.useMemo(()=>new g1,[]),C=v.useRef(null);return v.useImperativeHandle(A,()=>C.current,[]),$g(()=>C.current!=null&&C1(C.current,I,g.pointer,g)),z.jsx("mesh",{matrixAutoUpdate:!1,renderOrder:g.renderOrder??2,ref:C,material:I,children:z.jsx("boxGeometry",{})})}),RS=v.forwardRef((g,A)=>{const I=v.useMemo(()=>new $8,[]),C=v.useRef(null);v.useImperativeHandle(A,()=>C.current,[]),$g(()=>C.current!=null&&I1(C.current,I,g.pointer,g));const i=ki(B=>B.scene);return FM(z.jsx("mesh",{renderOrder:g.renderOrder??1,ref:C,matrixAutoUpdate:!1,material:I,children:z.jsx("planeGeometry",{})}),i)});function Ud(g,A,I,C){const i=Fg(B=>B.session);v.useEffect(()=>{if(i!=null)return i1(g,i,A,I,C)},[I,A,g,i,C])}function Nd(g,A=!1){const I=v.useContext(IY);I==null?(BY(g),$g(C=>g.move(C.scene,{timeStamp:performance.now()}),-50)):v.useEffect(()=>I.register(g,A),[I,g,A]),v.useEffect(()=>()=>g.exit({timeStamp:performance.now()}),[g])}function BY(g){const A=Fd();v.useEffect(()=>z8(A,I=>g.setEnabled(I,{timeStamp:performance.now()})),[A,g])}const qV=v.forwardRef(({pointer:g,linePoints:A,...I},C)=>{const i=v.useMemo(()=>new aV(A),[A]);return v.useImperativeHandle(C,()=>i,[i]),i.options=I,$g(()=>i.update(g)),z.jsx("primitive",{object:i})});function QY(g,A,I){const C=v.useContext(zB);if(C==null)throw new Error("DefaultXRInputSourceGrabPointer can only be used inside a XRInputSource");const i=v.useRef(null),B=KV(i,C,I);Ud(B,C.inputSource,g,C.events);const Q=I.cursorModel;return z.jsx(tB,{ref:i,space:A(C.inputSource),children:Q!==!1&&z.jsx(RS,{pointer:B,opacity:B1,...MC(Q)})})}const mV=QY.bind(null,"select",g=>g.hand.get("index-finger-tip")),YV=QY.bind(null,"squeeze",g=>g.gripSpace);function Ir(g){const A=v.useContext(zB);if(A==null)throw new Error("DefaultXRInputSourceRayPointer can only be used inside a XRInputSource");const I=v.useRef(null),C=iY(I,A,g);Ud(C,A.inputSource,"select",A.events);const i=g.rayModel,B=g.cursorModel;return z.jsxs(tB,{ref:I,space:A.inputSource.targetRaySpace,children:[i!==!1&&z.jsx(JV,{pointer:C,opacity:gh,...MC(i)}),B!==!1&&z.jsx(RS,{pointer:C,opacity:gh,...MC(B)})]})}function LV(g){const A=pd(),I=v.useRef(null),C=fV(I,A,g),i=g.cursorModel;return z.jsx(tB,{ref:I,space:A.inputSource.hand.get("index-finger-tip"),children:i!==!1&&z.jsx(RS,{pointer:C,opacity:Q1,...MC(i)})})}function HV(g){const A=g.model,I=g.grabPointer,C=g.rayPointer,i=g.teleportPointer??!1;return z.jsxs(z.Fragment,{children:[A!==!1&&z.jsx(v.Suspense,{children:z.jsx(NV,{...MC(A)})}),z.jsxs(CY,{children:[I!==!1&&z.jsx(YV,{...MC(I)}),C!==!1&&z.jsx(Ir,{makeDefault:!0,minDistance:.2,...MC(C)}),i!==!1&&z.jsx(eY,{...MC(i)})]})]})}function TV(g){var e;const A=g.model,I=g.grabPointer,C=g.rayPointer,i=g.touchPointer,B=g.teleportPointer??!1,Q=C===!1?!1:(e=MC(C))==null?void 0:e.rayModel;return z.jsxs(z.Fragment,{children:[A!==!1&&z.jsx(v.Suspense,{children:z.jsx(RV,{...MC(A)})}),z.jsxs(CY,{children:[I!==!1&&z.jsx(mV,{...MC(I)}),i!==!1&&z.jsx(LV,{...MC(i)}),C!==!1&&z.jsx(Ir,{makeDefault:!0,minDistance:.2,...MC(C),rayModel:Q===!1?!1:{maxLength:.2,...MC(Q)}}),B!==!1&&z.jsx(eY,{...MC(B)})]})]})}function xV(g){return z.jsx(Ir,{...g,rayModel:!1})}function vV(g){return z.jsx(Ir,{...g,rayModel:!1})}function bV(g){return z.jsx(Ir,{...g,cursorModel:!1,rayModel:!1})}function eY(g){const A=v.useContext(zB);if(A==null)throw new Error("DefaultXRInputSourceRayPointer can only be used inside a XRInputSource");const I=v.useRef(null),C=v.useRef(null),i=v.useMemo(()=>sV(),[]),B=iY(C,A,{...g,linePoints:i,customFilter:nV(g)},"teleport");Ud(B,A.inputSource,"select",A.events);const Q=g.rayModel,e=g.cursorModel,t=ki(s=>s.scene),E=v.useRef(null);return $g((s,a)=>{E.current!=null&&(E.current.visible=B.getEnabled()&&B.getButtonsDown().size>0);const r=C.current,l=I.current;r==null||l==null||EV(l,r,a*1e3)}),z.jsxs(z.Fragment,{children:[z.jsx(tB,{ref:I,space:A.inputSource.targetRaySpace}),FM(z.jsxs("group",{ref:C,children:[Q!==!1&&z.jsx(qV,{linePoints:i,pointer:B,opacity:gh,...MC(Q)}),e!==!1&&z.jsx(RS,{ref:E,pointer:B,opacity:gh,...MC(e)})]}),t)]})}function MC(g){if(g!==!0)return g}function OV({children:g}){const A=Fg(Q=>Q.originReferenceSpace),I=Fg(Q=>Q.origin),C=MV()==="visible",i=Wa(),B=v.useMemo(()=>Object.assign({},i,{getState(){return{...i.getState(),scene:I}}}),[I,i]);return I==null||A==null?null:z.jsx(z.Fragment,{children:Oo.createPortal(z.jsx(iS.Provider,{value:i,children:z.jsxs(Ar.Provider,{value:A,children:[z.jsxs("group",{matrixAutoUpdate:!1,visible:C,children:[z.jsx(_V,{}),z.jsx(PV,{}),z.jsx(ZV,{}),z.jsx(WV,{}),z.jsx(VV,{})]}),z.jsx(jV,{}),z.jsx(XV,{}),g]})}),B,null)})}function _V(){const g=Fg(I=>I.controllerStates);let A=Fg(I=>I.controller);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>{const C=ce(A,I.inputSource.handedness,{});return C===!1?null:z.jsx(tB,{space:I.inputSource.gripSpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof C=="function"?z.jsx(C,{}):z.jsx(HV,{...C})})})},EE(I))})})}function PV(){const g=Fg(I=>I.handStates),A=Fg(I=>I.hand);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>{const C=ce(A,I.inputSource.handedness,{});return C===!1?null:z.jsx(tB,{space:I.inputSource.hand.get("wrist"),children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof C=="function"?z.jsx(C,{}):z.jsx(TV,{...C})})})},EE(I))})})}function ZV(){const g=Fg(I=>I.transientPointerStates),A=Fg(I=>I.transientPointer);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>{const C=ce(A,I.inputSource.handedness,{});return C===!1?null:z.jsx(tB,{space:I.inputSource.targetRaySpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof C=="function"?z.jsx(C,{}):z.jsx(xV,{...C})})})},EE(I))})})}function WV(){const g=Fg(I=>I.gazeStates),A=Fg(I=>I.gaze);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>z.jsx(tB,{space:I.inputSource.targetRaySpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof A=="function"?z.jsx(A,{}):z.jsx(vV,{...tY(A)})})})},EE(I)))})}function VV(){const g=Fg(I=>I.screenInputStates),A=Fg(I=>I.screenInput);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>z.jsx(tB,{space:I.inputSource.targetRaySpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof A=="function"?z.jsx(A,{}):z.jsx(bV,{...tY(A)})})})},EE(I)))})}function tY(g){if(g!==!0)return g}function jV(){const g=Fg(I=>I.detectedMeshes),A=Fg(I=>I.detectedMesh);if(A!==!1)return z.jsx(z.Fragment,{children:g.map(I=>{const C=bm(A,I.semanticLabel,!1);return C===!1?null:z.jsx(tB,{space:I.meshSpace,children:z.jsx($m.Provider,{value:I,children:z.jsx(v.Suspense,{children:z.jsx(C,{})})})},EE(I))})})}function XV(){const g=Fg(I=>I.detectedPlanes),A=Fg(I=>I.detectedPlane);if(A!=null)return z.jsx(z.Fragment,{children:g.map(I=>{const C=bm(A,I.semanticLabel,!1);return C===!1?null:z.jsx(tB,{space:I.planeSpace,children:z.jsx(AY.Provider,{value:I,children:z.jsx(v.Suspense,{children:z.jsx(C,{})})})},EE(I))})})}function zV(g){return a1(g)}function $V({children:g,store:A}){A.setWebXRManager(ki(C=>C.gl.xr));const I=Wa();return v.useEffect(()=>{let C;return A.subscribe((i,B)=>{const Q=i.mode!=null,e=B.mode!=null;if(Q!==e){if(Q){const{camera:t,gl:E}=I.getState();C=t,I.setState({camera:E.xr.getCamera()});return}C!=null&&I.setState({camera:C})}})},[I,A]),$g((C,i,B)=>A.onBeforeFrame(C.scene,C.camera,B),-1e3),z.jsxs(zm.Provider,{value:A,children:[z.jsx(OV,{}),g]})}function Fd(){const g=v.useContext(zm);if(g==null)throw new Error("XR features can only be used inside the component");return g}function Fg(g=A=>A){return gY(Fd(),g)}const tB=v.forwardRef(({space:g,children:A},I)=>{const C=v.useRef(null);return v.useImperativeHandle(I,()=>C.current,[]),gj(C,g,(i,B,Q)=>{C.current!=null&&(C.current.visible=Q!=null)}),z.jsx("group",{xrSpace:g,visible:!1,matrixAutoUpdate:!1,ref:C,children:z.jsx(Ar.Provider,{value:g,children:A})})});function Aj(){const g=v.useContext(Ar);if(g==null)throw new Error("XR objects must be placed inside the XROrigin");return g}function Ij(g){const A=v.useContext(Ar),I=Fg(C=>A??C.originReferenceSpace);return v.useMemo(()=>I==null?void 0:e1(g,I),[g,I])}function gj(g,A,I){const C=Ij(A);$g((i,B,Q)=>{g.current==null||C==null||(C(g.current.matrix,Q),I==null||I(i,B,Q))},-100)}v.forwardRef((g,A)=>{const I=Cj(),C=ij(I);return z.jsx("mesh",{ref:A,geometry:C,...g})});function Cj(){const g=v.useContext($m);if(g==null)throw new Error("useXRMesh can only be used inside XRMesh or ForEachXRMesh");return g}function ij(g,A=!0){const[I,C]=v.useState(CR(g,void 0));return $g(()=>C(i=>CR(g,i))),v.useEffect(()=>{if(A)return()=>I.dispose()},[I]),I}v.forwardRef((g,A)=>{const I=Bj(),C=Qj(I);return z.jsx("mesh",{ref:A,geometry:C,...g})});function Bj(){const g=v.useContext(AY);if(g==null)throw new Error("useXRPlane can only be used inside XRPlane or ForEachXRPlane");return g}function Qj(g,A=!0){const[I,C]=v.useState(iR(g,void 0));return $g(()=>C(i=>iR(g,i))),v.useEffect(()=>{if(A)return()=>I.dispose()},[I]),I}function ej(g,A){const I=Fg(C=>C.mode);return A!=null?Array.isArray(A)?!A.includes(I):A!=I:g!=null?Array.isArray(g)?g.includes(I):g===I:!0}function ER({children:g,allow:A,deny:I}){return ej(A,I)?z.jsx(z.Fragment,{children:g}):null}const tj=v.forwardRef(({children:g,...A},I)=>{const C=ki(B=>B.gl.xr.getCamera()),i=Fg(B=>B.originReferenceSpace);return i==null?null:z.jsxs("group",{ref:I,...A,children:[z.jsx("primitive",{object:C}),z.jsx(Ar.Provider,{value:i,children:g})]})});function Ej(g,A,I){const C=v.useRef(void 0);oj(A,I,v.useCallback(i=>C.current=i,[])),$g((i,B,Q)=>{g==null||Q==null||C.current==null||g(Q.getHitTestResults(C.current.source),C.current.getWorldMatrix)})}function oj(g,A,I){const C=Fd();v.useEffect(()=>{let i,B=!1;const Q=g instanceof XRSpace?g:g.current;if(Q!=null)return rV(C,Q,A).then(e=>{B||(i=e,I(e))}),()=>{I(void 0),B=!0,i==null||i.source.cancel()}},[C,g,A,I])}v.forwardRef((g,A)=>{const I=v.useRef(null);return v.useImperativeHandle(A,()=>I.current),Ej(g.onResults,I,g.trackableType),z.jsx("group",{...g,ref:I})});v.forwardRef((g,A)=>{const I=Fg(B=>B.domOverlayRoot),{In:C,Out:i}=v.useMemo(ZZ,[]);return v.useEffect(()=>{const B=xk(I);return B.render(z.jsx(i,{})),()=>B.unmount()},[I,i]),z.jsx(C,{children:z.jsx("div",{...g,ref:A})})});const EY=v.forwardRef(({store:g,mode:A,onError:I,children:C,...i},B)=>{const Q=gY(g,t=>t.session),e=dV(A,I);return z.jsx("button",{ref:B,...i,onClick:()=>Q!=null?Q.end():g.enterXR(A).catch(I),children:typeof C=="function"?C(e?Q!=null?"entered":"exited":"unsupported"):C})});v.forwardRef((g,A)=>z.jsx(EY,{ref:A,mode:"immersive-ar",...g}));v.forwardRef((g,A)=>z.jsx(EY,{ref:A,mode:"immersive-vr",...g}));const nj={onBlur:"pointerleave",onHover:"pointerenter",onMove:"pointermove",onSelect:{type:"click",filter:g=>g.pointerType==="ray"},onSelectEnd:{type:"pointerup",filter:g=>g.pointerType==="ray"},onSelectStart:{type:"pointerdown",filter:g=>g.pointerType==="ray"},onSqueeze:{type:"click",filter:g=>g.pointerType==="grab"},onSqueezeEnd:{type:"pointerup",filter:g=>g.pointerType==="grab"},onSqueezeStart:{type:"pointerdown",filter:g=>g.pointerType==="grab"}};function sQ(g,A,I){const C=v.useRef(I);C.current=I,v.useEffect(()=>{const{current:i}=g;if(i==null)return;const B=nj[A],Q=typeof B=="string"?t=>{var E;return(E=C.current)==null?void 0:E.call(C,{intersection:t,intersections:[t],target:t.pointerState})}:t=>{var E;t instanceof WC&&!B.filter(t)||(E=C.current)==null||E.call(C,{intersection:t,intersections:[t],target:t.pointerState})},e=typeof B=="string"?B:B.type;return i.addEventListener(e,Q),()=>i.removeEventListener(e,Q)},[g,A])}const sj=v.forwardRef(({onHover:g,onBlur:A,onSelectStart:I,onSelectEnd:C,onSelect:i,onSqueezeStart:B,onSqueezeEnd:Q,onSqueeze:e,onMove:t,children:E},s)=>{const a=v.useRef(null);return v.useImperativeHandle(s,()=>a.current),sQ(a,"onHover",g),sQ(a,"onBlur",A),sQ(a,"onSelectStart",I),sQ(a,"onSelectEnd",C),sQ(a,"onSelect",i),sQ(a,"onSqueezeStart",B),sQ(a,"onSqueezeEnd",Q),sQ(a,"onSqueeze",e),sQ(a,"onMove",t),z.jsx("group",{ref:a,children:E})});v.forwardRef(function({onSelectStart:A,onSelectEnd:I,children:C,...i},B){const Q=v.useRef(),e=v.useRef(null),t=v.useMemo(()=>new _A,[]);return v.useImperativeHandle(B,()=>e.current),$g(()=>{const E=Q.current,s=e.current;!s||!E||(s.applyMatrix4(t),s.applyMatrix4(E.matrixWorld),s.updateMatrixWorld(),t.copy(E.matrixWorld).invert())}),z.jsx(sj,{ref:e,onSelectStart:E=>{V8(E.target)&&(E.target.type==="controller"||E.target.type==="hand")&&E.target.object!=null&&(Q.current=E.target.object,t.copy(E.target.object.matrixWorld).invert(),A==null||A(E))},onSelectEnd:E=>{E.target.controller===Q.current&&(Q.current=void 0),I==null||I(E)},...i,children:C})});function aj(g){const{nodes:A,materials:I}=Va("axe.glb");return z.jsx("group",{dispose:null,...g,children:z.jsxs("group",{rotation:[0,Math.PI/1.8,-.3],scale:.5,children:[z.jsx("mesh",{geometry:A.Mesh_1001_1.geometry,material:I.material_2}),z.jsx("mesh",{geometry:A.Mesh_1001_2.geometry,material:I.material_3})]})})}Va.preload("axe.glb");const rj=1.5,oR=.5,Uy={euler:new BC,quaternion:new XI};function lj({playerJump:g,playerMove:A}){const I=v.useRef(null),C=ka("left"),i=ka("right");return $g((B,Q)=>{var E,s,a;const e=(E=C==null?void 0:C.gamepad)==null?void 0:E["xr-standard-thumbstick"];I.current!=null&&(e==null?void 0:e.xAxis)!=null&&e.xAxis!=0&&I.current.rotateY((e.xAxis<0?1:-1)*rj*Q),((a=(s=C==null?void 0:C.gamepad)==null?void 0:s["a-button"])==null?void 0:a.state)==="pressed"&&(g==null||g());const t=i==null?void 0:i.gamepad["xr-standard-thumbstick"];(t==null?void 0:t.xAxis)!=null&&t.yAxis!=null&&(B.camera.getWorldQuaternion(Uy.quaternion),A==null||A({forward:t.yAxis<0,backward:t.yAxis>0,left:t.xAxis<-oR,right:t.xAxis>oR,rotation:Uy.euler.setFromQuaternion(Uy.quaternion)}))}),z.jsx(tj,{ref:I,position:[0,-1.25,0]})}const cj=5,Ny=new J,nR=new J,sR=new J,Dj=new J,aR=new J;function hj({lerp:g=qa.lerp}){const A=v.useRef(null),I=v.useRef(null),{rapier:C,world:i}=za(),[,B]=MP(),Q=({forward:t,backward:E,left:s,right:a,rotation:r,velocity:l})=>{var h,w;l||(l=(h=I.current)==null?void 0:h.linvel()),nR.set(0,0,(E?1:0)-(t?1:0)),sR.set((s?1:0)-(a?1:0),0,0),Ny.subVectors(nR,sR).normalize().multiplyScalar(cj).applyEuler(r),(w=I.current)==null||w.setLinvel({x:Ny.x,y:l.y,z:Ny.z},!0)},e=()=>{if(I.current==null)return;const t=i.castRay(new C.Ray(I.current.translation(),{x:0,y:-1,z:0}),1/0,!1,void 0,ua([1,0],[1]));t!=null&&Math.abs(t.timeOfImpact)<=1.25&&I.current.setLinvel({x:0,y:7.5,z:0},!0)};return $g(t=>{if(I.current==null)return;const{forward:E,backward:s,left:a,right:r,jump:l}=B(),h=I.current.linvel();aR.set(h.x,h.y,h.z);const{x:w,y:S,z:c}=I.current.translation();t.camera.position.set(w,S,c),A.current!=null&&(A.current.children[0].rotation.x=g(A.current.children[0].rotation.x,Math.sin((aR.length()>1?1:0)*t.clock.elapsedTime*10)/6,.1),A.current.rotation.copy(t.camera.rotation),A.current.position.copy(t.camera.position).add(t.camera.getWorldDirection(Dj).multiplyScalar(1))),I.current&&(Q({forward:E,backward:s,left:a,right:r,rotation:t.camera.rotation,velocity:h}),l&&e())}),z.jsxs(z.Fragment,{children:[z.jsxs($a,{ref:I,colliders:!1,mass:1,type:"dynamic",position:[0,10,0],enabledRotations:[!1,!1,!1],canSleep:!1,collisionGroups:ua([0],[0]),children:[z.jsx(Fm,{args:[.75,.5]}),z.jsx(ER,{allow:["immersive-ar","immersive-vr"],children:z.jsx(lj,{playerJump:e,playerMove:Q})})]}),z.jsx(ER,{deny:"immersive-vr",children:z.jsx("group",{ref:A,onPointerMissed:t=>{A.current!=null&&(A.current.children[0].rotation.x=-.5)},children:z.jsx(aj,{position:[.3,-.35,.5]})})})]})}const oY=nm(g=>({cubes:[],addCube:(A,I,C)=>g(i=>({cubes:[...i.cubes,[A,I,C]]}))})),Sj=()=>oY(A=>A.cubes).map((A,I)=>z.jsx(nY,{position:A},I));function nY(g){const A=v.useRef(null),[I,C]=v.useState(null),i=oY(E=>E.addCube),B=BS("dirt.jpg"),Q=v.useCallback(E=>{E.faceIndex!=null&&(E.stopPropagation(),C(Math.floor(E.faceIndex/2)))},[]),e=v.useCallback(()=>C(null),[]),t=v.useCallback(E=>{if(A.current==null||E.faceIndex==null)return;E.stopPropagation();const{x:s,y:a,z:r}=A.current.translation(),l=[[s+1,a,r],[s-1,a,r],[s,a+1,r],[s,a-1,r],[s,a,r+1],[s,a,r-1]];i(...l[Math.floor(E.faceIndex/2)])},[]);return z.jsx($a,{...g,type:"fixed",colliders:"cuboid",collisionGroups:ua([0,1],[0]),ref:A,children:z.jsxs("mesh",{receiveShadow:!0,castShadow:!0,onPointerMove:Q,onPointerOut:e,onClick:t,children:[[...Array(6)].map((E,s)=>z.jsx("meshStandardMaterial",{attach:`material-${s}`,map:B,color:I===s?"hotpink":"white"},s)),z.jsx("boxGeometry",{})]})})}const rR=zV();function wj(){return z.jsxs(z.Fragment,{children:[z.jsx("button",{style:{position:"absolute",zIndex:1e4,background:"black",borderRadius:"0.5rem",border:"none",fontWeight:"bold",color:"white",padding:"1rem 2rem",cursor:"pointer",fontSize:"1.5rem",bottom:"1rem",left:"50%",boxShadow:"0px 0px 20px rgba(0,0,0,1)",transform:"translate(-50%, 0)"},onClick:()=>rR.enterVR(),children:"Enter VR"}),z.jsx(kP,{map:[{name:"forward",keys:["ArrowUp","w","W"]},{name:"backward",keys:["ArrowDown","s","S"]},{name:"left",keys:["ArrowLeft","a","A"]},{name:"right",keys:["ArrowRight","d","D"]},{name:"jump",keys:["Space"]}],children:z.jsx(yP,{shadows:!0,camera:{fov:45},children:z.jsxs($V,{store:rR,children:[z.jsx(GZ,{sunPosition:[100,20,100]}),z.jsx("ambientLight",{intensity:.8}),z.jsx("directionalLight",{intensity:5,position:[100,60,100]}),z.jsxs(qW,{gravity:[0,-30,0],children:[z.jsx(A8,{collisionGroups:ua([0,1],[0])}),z.jsx(hj,{}),z.jsx(nY,{collisionGroups:ua([0,1],[0]),position:[0,.5,-10]}),z.jsx(Sj,{})]}),z.jsx(DZ,{})]})})})]})}xk(document.getElementById("root")).render(z.jsx(v.StrictMode,{children:z.jsx(wj,{})}));export{vQ as B,Bn as C,$i as D,BC as E,iI as F,IB as G,NC as L,_A as M,FI as O,IE as P,XI as Q,Pa as R,_a as S,jh as T,J as V,TJ as W,Xg as a,yI as b,eg as c,ba as d,jB as e,YD as f,ih as g,Wg as h,Wh as i,z as j,pB as k,xk as l,wI as o,v as r}; +`;class tV extends Ri{constructor(A){super({uniforms:{...HA.fog,lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new KA(16777215)},gradient:{value:[new KA(16711680),new KA(65280)]},opacity:{value:1},resolution:{value:new lA(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useGradient:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new lA(1,1)}},vertexShader:iV,fragmentShader:eV}),jI(this,"lineWidth"),jI(this,"map"),jI(this,"useMap"),jI(this,"alphaMap"),jI(this,"useAlphaMap"),jI(this,"color"),jI(this,"gradient"),jI(this,"resolution"),jI(this,"sizeAttenuation"),jI(this,"dashArray"),jI(this,"dashOffset"),jI(this,"dashRatio"),jI(this,"useDash"),jI(this,"useGradient"),jI(this,"visibility"),jI(this,"repeat"),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(I){this.uniforms.lineWidth.value=I}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(I){this.uniforms.map.value=I}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(I){this.uniforms.useMap.value=I}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(I){this.uniforms.alphaMap.value=I}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(I){this.uniforms.useAlphaMap.value=I}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(I){this.uniforms.color.value=I}},gradient:{enumerable:!0,get(){return this.uniforms.gradient.value},set(I){this.uniforms.gradient.value=I}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(I){this.uniforms.opacity.value=I}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(I){this.uniforms.resolution.value.copy(I)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(I){this.uniforms.sizeAttenuation.value=I}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(I){this.uniforms.dashArray.value=I,this.useDash=I!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(I){this.uniforms.dashOffset.value=I}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(I){this.uniforms.dashRatio.value=I}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(I){this.uniforms.useDash.value=I}},useGradient:{enumerable:!0,get(){return this.uniforms.useGradient.value},set(I){this.uniforms.useGradient.value=I}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(I){this.uniforms.visibility.value=I}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(I){this.uniforms.alphaTest.value=I}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(I){this.uniforms.repeat.value.copy(I)}}}),this.setValues(A)}copy(A){return super.copy(A),this.lineWidth=A.lineWidth,this.map=A.map,this.useMap=A.useMap,this.alphaMap=A.alphaMap,this.useAlphaMap=A.useAlphaMap,this.color.copy(A.color),this.gradient=A.gradient,this.opacity=A.opacity,this.resolution.copy(A.resolution),this.sizeAttenuation=A.sizeAttenuation,this.dashArray=A.dashArray,this.dashOffset=A.dashOffset,this.dashRatio=A.dashRatio,this.useDash=A.useDash,this.useGradient=A.useGradient,this.visibility=A.visibility,this.alphaTest=A.alphaTest,this.repeat.copy(A.repeat),this}}const Qs=new BC(0,0,0,"YXZ"),Sc=new XI;function EV(g,A,I){g.matrixWorld.decompose(A.position,Sc,A.scale),Qs.setFromQuaternion(Sc),Qs.z=0,Qs.x=Lc(Qs.x-10*Math.PI/180,-Math.PI/2,1.1*Math.PI/4),Sc.setFromEuler(Qs),A.quaternion.slerp(Sc,I/100)}function oV(g){return g.userData.teleportTarget===!0}function nV(g={}){return A=>!(!oV(A.object)||g.customFilter!=null&&!g.customFilter(A))}function sV(){return new Th(new J(0,0,0),new J(0,0,-8),new J(0,-20,-15)).getPoints(20)}let aV=class extends eg{constructor(I){const C=new CV,i=new Float32Array(I.length*3);for(let e=0;ee.distanceTo(I[t+1]))}update(I){if(!I.getEnabled()||I.getButtonsDown().size===0){this.visible=!1;return}this.visible=!0;const i=I.getIntersection();if((i==null?void 0:i.details.type)!="lines"){this.material.visibility=this.multiplier;return}const{distanceOnLine:B,lineIndex:Q}=i.details,e=this.lineLengths[Q];this.material.visibility=this.multiplier*(Q+B/e)/this.lineLengths.length;const{color:t="white",opacity:E=.4,size:s=.01}=this.options;this.material.lineWidth=s,this.material.opacity=typeof E=="function"?E(I):E;const a=typeof t=="function"?t(I):t;Array.isArray(a)?this.material.color.set(...a):this.material.color.set(a)}};const wc=new _A,Gc=new J,BR=new XI;async function rV(g,A,I=["point","plane","mesh"]){var t,E;let C,i,B;const Q=g.getState();if(A instanceof XRSpace)i=A,B=Q.origin;else{if(Q.originReferenceSpace==null)return;B=A,i=t1(A,Q.origin,Q.originReferenceSpace,wc)??Q.originReferenceSpace,i===Q.originReferenceSpace&&xm(A,Q.origin,wc),Gc.setFromMatrixPosition(wc);const s={...Gc};BR.setFromRotationMatrix(wc),Gc.set(0,0,-1).applyQuaternion(BR);const a={...Gc};C=new XRRay(s,a)}const e=await((E=(t=g.getState().session)==null?void 0:t.requestHitTestSource)==null?void 0:E.call(t,{space:i,entityTypes:Array.isArray(I)?I:[I],offsetRay:C}));if(e!=null)return{source:e,getWorldMatrix:lV.bind(null,i,B)}}function lV(g,A,I,C){const i=C.getPose(g);return i==null?!1:(I.fromArray(i.transform.matrix),A!=null&&I.premultiply(A.matrixWorld),!0)}new J(1,1,1);new J(0,0,0);new _A;new _A;new J;new J;const jm=new g8,Xm="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/",cV="generic-trigger";class DV{constructor(A){JI(this,"baseAssetPath");JI(this,"defaultProfileId");JI(this,"profilesListPromise");JI(this,"profilePromisesMap",new Map);JI(this,"loadAsync",this.load);this.baseAssetPath=(A==null?void 0:A.baseAssetPath)??Xm,this.defaultProfileId=(A==null?void 0:A.defaultControllerProfileId)??cV}async load(A,I){const C=await this.loadProfile(A);for(const i in C.layouts)if(i.includes(I))return C.layouts[i];throw new Error(`No matching layout for "${I}", in profile ${C.profileId} with layouts ${Object.keys(C.layouts).join(", ")}.`)}async loadProfile(A){this.profilesListPromise??(this.profilesListPromise=QR(new URL("profilesList.json",this.baseAssetPath).href));const I=await this.profilesListPromise,C=A.length;for(let B=0;Bg;function gY(g,A=uV,I){(wV?"production":void 0)!=="production"&&I&&!eR&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),eR=!0);const C=yV(g.subscribe,g.getState,g.getServerState||g.getInitialState,A,I);return GV(C),C}let kV=0;const tR=new Map;function EE(g){let A=tR.get(g);return A==null&&tR.set(g,A=kV++),A}function MV(){return Fg(g=>g.visibilityState)}function dV(g,A){const I=v.useRef(A);I.current=A;const[C,i]=v.useMemo(()=>{let B;return[Q=>{let e=!1;return navigator.xr==null?(B=!1,()=>{}):(navigator.xr.isSessionSupported(g).then(t=>{B=t,!e&&Q()}).catch(t=>{var E;e||(E=I.current)==null||E.call(I,t)}),()=>e=!0)},()=>B]},[g]);return v.useSyncExternalStore(C,i)}v.forwardRef(({id:g,children:A,onPress:I,onRelease:C},i)=>{const B=ka(),[Q,e]=v.useState(void 0);if(v.useImperativeHandle(i,()=>Q,[Q]),pV(g,t=>t==="pressed"?I==null?void 0:I():C==null?void 0:C()),$g(()=>{var t;return e((t=B.gamepad[g])==null?void 0:t.object)}),Q!=null)return FM(A,Q)});function pV(g,A,I){const C=ka(),i=v.useRef();$g(()=>{var Q;const B=(Q=C==null?void 0:C.gamepad[g])==null?void 0:Q.state;B!=null&&B!=i.current&&A(B),i.current=B})}function ka(g){if(g!=null)return Fg(I=>I.controllerStates.find(C=>C.inputSource.handedness===g));const A=v.useContext(zB);if(A==null||A.type!="controller")throw new Error('useXRControllerState() can only be used inside a or using useXRControllerState("left")');return A}const UV=Symbol("loadXRControllerModel"),NV=v.forwardRef((g,A)=>{const I=ka(),C=CS(G1,[I.layout,void 0,UV]);y1(C,g),I.object=C,v.useImperativeHandle(A,()=>C,[C]);const i=v.useMemo(()=>u1(C,I.layout,I.gamepad),[C,I.layout,I.gamepad]);return $g(i),z.jsx("primitive",{object:C})});function pd(g){const A=v.useContext(zB);if(A==null||A.type!="hand")throw new Error('useXRHandState() can only be used inside a or with using useXRHandState("left")');return A}const FV=Symbol("loadXRHandModel"),RV=v.forwardRef((g,A)=>{const I=pd(),C=CS(b8,[I.assetPath,void 0,FV]);O8(C,g),v.useImperativeHandle(A,()=>C,[C]);const i=Aj(),B=v.useMemo(()=>W8(I.inputSource.hand,C,i),[I.inputSource,C,i]);return $g((Q,e,t)=>B(t)),z.jsx("primitive",{object:C})});v.forwardRef(({joint:g,children:A},I)=>{const C=pd();return z.jsx(tB,{ref:I,space:C.inputSource.hand.get(g),children:A})});function CY({children:g}){const A=v.useMemo(()=>new z1,[]);return BY(A),$g(I=>A.move(I.scene,{timeStamp:performance.now()}),-50),z.jsx(IY.Provider,{value:A,children:g})}function KV(g,A,I,C){const i=v.useMemo(()=>({}),[]);Object.assign(i,Pu,I);const B=v.useMemo(()=>O1(g,A,i,C),[g,A,i,C]);return Nd(B,I==null?void 0:I.makeDefault),B}function iY(g,A,I,C){const i=v.useMemo(()=>({}),[]);Object.assign(i,hs,I);const B=v.useMemo(()=>Z1(g,A,i,C),[g,A,i,C]);return Nd(B,I==null?void 0:I.makeDefault),B}function fV(g,A,I,C){const i=v.useMemo(()=>({}),[]);Object.assign(i,Ko,I);const B=v.useMemo(()=>W1(g,A,i,C),[g,A,i,C]);return Nd(B,I==null?void 0:I.makeDefault),B}const JV=v.forwardRef((g,A)=>{const I=v.useMemo(()=>new g1,[]),C=v.useRef(null);return v.useImperativeHandle(A,()=>C.current,[]),$g(()=>C.current!=null&&C1(C.current,I,g.pointer,g)),z.jsx("mesh",{matrixAutoUpdate:!1,renderOrder:g.renderOrder??2,ref:C,material:I,children:z.jsx("boxGeometry",{})})}),RS=v.forwardRef((g,A)=>{const I=v.useMemo(()=>new $8,[]),C=v.useRef(null);v.useImperativeHandle(A,()=>C.current,[]),$g(()=>C.current!=null&&I1(C.current,I,g.pointer,g));const i=ki(B=>B.scene);return FM(z.jsx("mesh",{renderOrder:g.renderOrder??1,ref:C,matrixAutoUpdate:!1,material:I,children:z.jsx("planeGeometry",{})}),i)});function Ud(g,A,I,C){const i=Fg(B=>B.session);v.useEffect(()=>{if(i!=null)return i1(g,i,A,I,C)},[I,A,g,i,C])}function Nd(g,A=!1){const I=v.useContext(IY);I==null?(BY(g),$g(C=>g.move(C.scene,{timeStamp:performance.now()}),-50)):v.useEffect(()=>I.register(g,A),[I,g,A]),v.useEffect(()=>()=>g.exit({timeStamp:performance.now()}),[g])}function BY(g){const A=Fd();v.useEffect(()=>z8(A,I=>g.setEnabled(I,{timeStamp:performance.now()})),[A,g])}const qV=v.forwardRef(({pointer:g,linePoints:A,...I},C)=>{const i=v.useMemo(()=>new aV(A),[A]);return v.useImperativeHandle(C,()=>i,[i]),i.options=I,$g(()=>i.update(g)),z.jsx("primitive",{object:i})});function QY(g,A,I){const C=v.useContext(zB);if(C==null)throw new Error("DefaultXRInputSourceGrabPointer can only be used inside a XRInputSource");const i=v.useRef(null),B=KV(i,C,I);Ud(B,C.inputSource,g,C.events);const Q=I.cursorModel;return z.jsx(tB,{ref:i,space:A(C.inputSource),children:Q!==!1&&z.jsx(RS,{pointer:B,opacity:B1,...MC(Q)})})}const mV=QY.bind(null,"select",g=>g.hand.get("index-finger-tip")),YV=QY.bind(null,"squeeze",g=>g.gripSpace);function Ir(g){const A=v.useContext(zB);if(A==null)throw new Error("DefaultXRInputSourceRayPointer can only be used inside a XRInputSource");const I=v.useRef(null),C=iY(I,A,g);Ud(C,A.inputSource,"select",A.events);const i=g.rayModel,B=g.cursorModel;return z.jsxs(tB,{ref:I,space:A.inputSource.targetRaySpace,children:[i!==!1&&z.jsx(JV,{pointer:C,opacity:gh,...MC(i)}),B!==!1&&z.jsx(RS,{pointer:C,opacity:gh,...MC(B)})]})}function LV(g){const A=pd(),I=v.useRef(null),C=fV(I,A,g),i=g.cursorModel;return z.jsx(tB,{ref:I,space:A.inputSource.hand.get("index-finger-tip"),children:i!==!1&&z.jsx(RS,{pointer:C,opacity:Q1,...MC(i)})})}function HV(g){const A=g.model,I=g.grabPointer,C=g.rayPointer,i=g.teleportPointer??!1;return z.jsxs(z.Fragment,{children:[A!==!1&&z.jsx(v.Suspense,{children:z.jsx(NV,{...MC(A)})}),z.jsxs(CY,{children:[I!==!1&&z.jsx(YV,{...MC(I)}),C!==!1&&z.jsx(Ir,{makeDefault:!0,minDistance:.2,...MC(C)}),i!==!1&&z.jsx(eY,{...MC(i)})]})]})}function TV(g){var e;const A=g.model,I=g.grabPointer,C=g.rayPointer,i=g.touchPointer,B=g.teleportPointer??!1,Q=C===!1?!1:(e=MC(C))==null?void 0:e.rayModel;return z.jsxs(z.Fragment,{children:[A!==!1&&z.jsx(v.Suspense,{children:z.jsx(RV,{...MC(A)})}),z.jsxs(CY,{children:[I!==!1&&z.jsx(mV,{...MC(I)}),i!==!1&&z.jsx(LV,{...MC(i)}),C!==!1&&z.jsx(Ir,{makeDefault:!0,minDistance:.2,...MC(C),rayModel:Q===!1?!1:{maxLength:.2,...MC(Q)}}),B!==!1&&z.jsx(eY,{...MC(B)})]})]})}function xV(g){return z.jsx(Ir,{...g,rayModel:!1})}function vV(g){return z.jsx(Ir,{...g,rayModel:!1})}function bV(g){return z.jsx(Ir,{...g,cursorModel:!1,rayModel:!1})}function eY(g){const A=v.useContext(zB);if(A==null)throw new Error("DefaultXRInputSourceRayPointer can only be used inside a XRInputSource");const I=v.useRef(null),C=v.useRef(null),i=v.useMemo(()=>sV(),[]),B=iY(C,A,{...g,linePoints:i,customFilter:nV(g)},"teleport");Ud(B,A.inputSource,"select",A.events);const Q=g.rayModel,e=g.cursorModel,t=ki(s=>s.scene),E=v.useRef(null);return $g((s,a)=>{E.current!=null&&(E.current.visible=B.getEnabled()&&B.getButtonsDown().size>0);const r=C.current,l=I.current;r==null||l==null||EV(l,r,a*1e3)}),z.jsxs(z.Fragment,{children:[z.jsx(tB,{ref:I,space:A.inputSource.targetRaySpace}),FM(z.jsxs("group",{ref:C,children:[Q!==!1&&z.jsx(qV,{linePoints:i,pointer:B,opacity:gh,...MC(Q)}),e!==!1&&z.jsx(RS,{ref:E,pointer:B,opacity:gh,...MC(e)})]}),t)]})}function MC(g){if(g!==!0)return g}function OV({children:g}){const A=Fg(Q=>Q.originReferenceSpace),I=Fg(Q=>Q.origin),C=MV()==="visible",i=Wa(),B=v.useMemo(()=>Object.assign({},i,{getState(){return{...i.getState(),scene:I}}}),[I,i]);return I==null||A==null?null:z.jsx(z.Fragment,{children:Oo.createPortal(z.jsx(iS.Provider,{value:i,children:z.jsxs(Ar.Provider,{value:A,children:[z.jsxs("group",{matrixAutoUpdate:!1,visible:C,children:[z.jsx(_V,{}),z.jsx(PV,{}),z.jsx(ZV,{}),z.jsx(WV,{}),z.jsx(VV,{})]}),z.jsx(jV,{}),z.jsx(XV,{}),g]})}),B,null)})}function _V(){const g=Fg(I=>I.controllerStates);let A=Fg(I=>I.controller);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>{const C=ce(A,I.inputSource.handedness,{});return C===!1?null:z.jsx(tB,{space:I.inputSource.gripSpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof C=="function"?z.jsx(C,{}):z.jsx(HV,{...C})})})},EE(I))})})}function PV(){const g=Fg(I=>I.handStates),A=Fg(I=>I.hand);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>{const C=ce(A,I.inputSource.handedness,{});return C===!1?null:z.jsx(tB,{space:I.inputSource.hand.get("wrist"),children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof C=="function"?z.jsx(C,{}):z.jsx(TV,{...C})})})},EE(I))})})}function ZV(){const g=Fg(I=>I.transientPointerStates),A=Fg(I=>I.transientPointer);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>{const C=ce(A,I.inputSource.handedness,{});return C===!1?null:z.jsx(tB,{space:I.inputSource.targetRaySpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof C=="function"?z.jsx(C,{}):z.jsx(xV,{...C})})})},EE(I))})})}function WV(){const g=Fg(I=>I.gazeStates),A=Fg(I=>I.gaze);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>z.jsx(tB,{space:I.inputSource.targetRaySpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof A=="function"?z.jsx(A,{}):z.jsx(vV,{...tY(A)})})})},EE(I)))})}function VV(){const g=Fg(I=>I.screenInputStates),A=Fg(I=>I.screenInput);return A===!1?null:z.jsx(z.Fragment,{children:g.map(I=>z.jsx(tB,{space:I.inputSource.targetRaySpace,children:z.jsx(zB.Provider,{value:I,children:z.jsx(v.Suspense,{children:typeof A=="function"?z.jsx(A,{}):z.jsx(bV,{...tY(A)})})})},EE(I)))})}function tY(g){if(g!==!0)return g}function jV(){const g=Fg(I=>I.detectedMeshes),A=Fg(I=>I.detectedMesh);if(A!==!1)return z.jsx(z.Fragment,{children:g.map(I=>{const C=bm(A,I.semanticLabel,!1);return C===!1?null:z.jsx(tB,{space:I.meshSpace,children:z.jsx($m.Provider,{value:I,children:z.jsx(v.Suspense,{children:z.jsx(C,{})})})},EE(I))})})}function XV(){const g=Fg(I=>I.detectedPlanes),A=Fg(I=>I.detectedPlane);if(A!=null)return z.jsx(z.Fragment,{children:g.map(I=>{const C=bm(A,I.semanticLabel,!1);return C===!1?null:z.jsx(tB,{space:I.planeSpace,children:z.jsx(AY.Provider,{value:I,children:z.jsx(v.Suspense,{children:z.jsx(C,{})})})},EE(I))})})}function zV(g){return a1(g)}function $V({children:g,store:A}){A.setWebXRManager(ki(C=>C.gl.xr));const I=Wa();return v.useEffect(()=>{let C;return A.subscribe((i,B)=>{const Q=i.mode!=null,e=B.mode!=null;if(Q!==e){if(Q){const{camera:t,gl:E}=I.getState();C=t,I.setState({camera:E.xr.getCamera()});return}C!=null&&I.setState({camera:C})}})},[I,A]),$g((C,i,B)=>A.onBeforeFrame(C.scene,C.camera,B),-1e3),z.jsxs(zm.Provider,{value:A,children:[z.jsx(OV,{}),g]})}function Fd(){const g=v.useContext(zm);if(g==null)throw new Error("XR features can only be used inside the component");return g}function Fg(g=A=>A){return gY(Fd(),g)}const tB=v.forwardRef(({space:g,children:A},I)=>{const C=v.useRef(null);return v.useImperativeHandle(I,()=>C.current,[]),gj(C,g,(i,B,Q)=>{C.current!=null&&(C.current.visible=Q!=null)}),z.jsx("group",{xrSpace:g,visible:!1,matrixAutoUpdate:!1,ref:C,children:z.jsx(Ar.Provider,{value:g,children:A})})});function Aj(){const g=v.useContext(Ar);if(g==null)throw new Error("XR objects must be placed inside the XROrigin");return g}function Ij(g){const A=v.useContext(Ar),I=Fg(C=>A??C.originReferenceSpace);return v.useMemo(()=>I==null?void 0:e1(g,I),[g,I])}function gj(g,A,I){const C=Ij(A);$g((i,B,Q)=>{g.current==null||C==null||(C(g.current.matrix,Q),I==null||I(i,B,Q))},-100)}v.forwardRef((g,A)=>{const I=Cj(),C=ij(I);return z.jsx("mesh",{ref:A,geometry:C,...g})});function Cj(){const g=v.useContext($m);if(g==null)throw new Error("useXRMesh can only be used inside XRMesh or ForEachXRMesh");return g}function ij(g,A=!0){const[I,C]=v.useState(CR(g,void 0));return $g(()=>C(i=>CR(g,i))),v.useEffect(()=>{if(A)return()=>I.dispose()},[I]),I}v.forwardRef((g,A)=>{const I=Bj(),C=Qj(I);return z.jsx("mesh",{ref:A,geometry:C,...g})});function Bj(){const g=v.useContext(AY);if(g==null)throw new Error("useXRPlane can only be used inside XRPlane or ForEachXRPlane");return g}function Qj(g,A=!0){const[I,C]=v.useState(iR(g,void 0));return $g(()=>C(i=>iR(g,i))),v.useEffect(()=>{if(A)return()=>I.dispose()},[I]),I}function ej(g,A){const I=Fg(C=>C.mode);return A!=null?Array.isArray(A)?!A.includes(I):A!=I:g!=null?Array.isArray(g)?g.includes(I):g===I:!0}function ER({children:g,allow:A,deny:I}){return ej(A,I)?z.jsx(z.Fragment,{children:g}):null}const tj=v.forwardRef(({children:g,...A},I)=>{const C=ki(B=>B.gl.xr.getCamera()),i=Fg(B=>B.originReferenceSpace);return i==null?null:z.jsxs("group",{ref:I,...A,children:[z.jsx("primitive",{object:C}),z.jsx(Ar.Provider,{value:i,children:g})]})});function Ej(g,A,I){const C=v.useRef(void 0);oj(A,I,v.useCallback(i=>C.current=i,[])),$g((i,B,Q)=>{g==null||Q==null||C.current==null||g(Q.getHitTestResults(C.current.source),C.current.getWorldMatrix)})}function oj(g,A,I){const C=Fd();v.useEffect(()=>{let i,B=!1;const Q=g instanceof XRSpace?g:g.current;if(Q!=null)return rV(C,Q,A).then(e=>{B||(i=e,I(e))}),()=>{I(void 0),B=!0,i==null||i.source.cancel()}},[C,g,A,I])}v.forwardRef((g,A)=>{const I=v.useRef(null);return v.useImperativeHandle(A,()=>I.current),Ej(g.onResults,I,g.trackableType),z.jsx("group",{...g,ref:I})});v.forwardRef((g,A)=>{const I=Fg(B=>B.domOverlayRoot),{In:C,Out:i}=v.useMemo(ZZ,[]);return v.useEffect(()=>{const B=xk(I);return B.render(z.jsx(i,{})),()=>B.unmount()},[I,i]),z.jsx(C,{children:z.jsx("div",{...g,ref:A})})});const EY=v.forwardRef(({store:g,mode:A,onError:I,children:C,...i},B)=>{const Q=gY(g,t=>t.session),e=dV(A,I);return z.jsx("button",{ref:B,...i,onClick:()=>Q!=null?Q.end():g.enterXR(A).catch(I),children:typeof C=="function"?C(e?Q!=null?"entered":"exited":"unsupported"):C})});v.forwardRef((g,A)=>z.jsx(EY,{ref:A,mode:"immersive-ar",...g}));v.forwardRef((g,A)=>z.jsx(EY,{ref:A,mode:"immersive-vr",...g}));const nj={onBlur:"pointerleave",onHover:"pointerenter",onMove:"pointermove",onSelect:{type:"click",filter:g=>g.pointerType==="ray"},onSelectEnd:{type:"pointerup",filter:g=>g.pointerType==="ray"},onSelectStart:{type:"pointerdown",filter:g=>g.pointerType==="ray"},onSqueeze:{type:"click",filter:g=>g.pointerType==="grab"},onSqueezeEnd:{type:"pointerup",filter:g=>g.pointerType==="grab"},onSqueezeStart:{type:"pointerdown",filter:g=>g.pointerType==="grab"}};function sQ(g,A,I){const C=v.useRef(I);C.current=I,v.useEffect(()=>{const{current:i}=g;if(i==null)return;const B=nj[A],Q=typeof B=="string"?t=>{var E;return(E=C.current)==null?void 0:E.call(C,{intersection:t,intersections:[t],target:t.pointerState})}:t=>{var E;t instanceof WC&&!B.filter(t)||(E=C.current)==null||E.call(C,{intersection:t,intersections:[t],target:t.pointerState})},e=typeof B=="string"?B:B.type;return i.addEventListener(e,Q),()=>i.removeEventListener(e,Q)},[g,A])}const sj=v.forwardRef(({onHover:g,onBlur:A,onSelectStart:I,onSelectEnd:C,onSelect:i,onSqueezeStart:B,onSqueezeEnd:Q,onSqueeze:e,onMove:t,children:E},s)=>{const a=v.useRef(null);return v.useImperativeHandle(s,()=>a.current),sQ(a,"onHover",g),sQ(a,"onBlur",A),sQ(a,"onSelectStart",I),sQ(a,"onSelectEnd",C),sQ(a,"onSelect",i),sQ(a,"onSqueezeStart",B),sQ(a,"onSqueezeEnd",Q),sQ(a,"onSqueeze",e),sQ(a,"onMove",t),z.jsx("group",{ref:a,children:E})});v.forwardRef(function({onSelectStart:A,onSelectEnd:I,children:C,...i},B){const Q=v.useRef(),e=v.useRef(null),t=v.useMemo(()=>new _A,[]);return v.useImperativeHandle(B,()=>e.current),$g(()=>{const E=Q.current,s=e.current;!s||!E||(s.applyMatrix4(t),s.applyMatrix4(E.matrixWorld),s.updateMatrixWorld(),t.copy(E.matrixWorld).invert())}),z.jsx(sj,{ref:e,onSelectStart:E=>{V8(E.target)&&(E.target.type==="controller"||E.target.type==="hand")&&E.target.object!=null&&(Q.current=E.target.object,t.copy(E.target.object.matrixWorld).invert(),A==null||A(E))},onSelectEnd:E=>{E.target.controller===Q.current&&(Q.current=void 0),I==null||I(E)},...i,children:C})});function aj(g){const{nodes:A,materials:I}=Va("axe.glb");return z.jsx("group",{dispose:null,...g,children:z.jsxs("group",{rotation:[0,Math.PI/1.8,-.3],scale:.5,children:[z.jsx("mesh",{geometry:A.Mesh_1001_1.geometry,material:I.material_2}),z.jsx("mesh",{geometry:A.Mesh_1001_2.geometry,material:I.material_3})]})})}Va.preload("axe.glb");const rj=1.5,oR=.5,Uy={euler:new BC,quaternion:new XI};function lj({playerJump:g,playerMove:A}){const I=v.useRef(null),C=ka("left"),i=ka("right");return $g((B,Q)=>{var E,s,a;const e=(E=i==null?void 0:i.gamepad)==null?void 0:E["xr-standard-thumbstick"];I.current!=null&&(e==null?void 0:e.xAxis)!=null&&e.xAxis!=0&&I.current.rotateY((e.xAxis<0?1:-1)*rj*Q),((a=(s=i==null?void 0:i.gamepad)==null?void 0:s["a-button"])==null?void 0:a.state)==="pressed"&&(g==null||g());const t=C==null?void 0:C.gamepad["xr-standard-thumbstick"];(t==null?void 0:t.xAxis)!=null&&t.yAxis!=null&&(B.camera.getWorldQuaternion(Uy.quaternion),A==null||A({forward:t.yAxis<0,backward:t.yAxis>0,left:t.xAxis<-oR,right:t.xAxis>oR,rotation:Uy.euler.setFromQuaternion(Uy.quaternion)}))}),z.jsx(tj,{ref:I,position:[0,-1.25,0]})}const cj=5,Ny=new J,nR=new J,sR=new J,Dj=new J,aR=new J;function hj({lerp:g=qa.lerp}){const A=v.useRef(null),I=v.useRef(null),{rapier:C,world:i}=za(),[,B]=MP(),Q=({forward:t,backward:E,left:s,right:a,rotation:r,velocity:l})=>{var h,w;l||(l=(h=I.current)==null?void 0:h.linvel()),nR.set(0,0,(E?1:0)-(t?1:0)),sR.set((s?1:0)-(a?1:0),0,0),Ny.subVectors(nR,sR).normalize().multiplyScalar(cj).applyEuler(r),(w=I.current)==null||w.setLinvel({x:Ny.x,y:l.y,z:Ny.z},!0)},e=()=>{if(I.current==null)return;const t=i.castRay(new C.Ray(I.current.translation(),{x:0,y:-1,z:0}),1/0,!1,void 0,ua([1,0],[1]));t!=null&&Math.abs(t.timeOfImpact)<=1.25&&I.current.setLinvel({x:0,y:7.5,z:0},!0)};return $g(t=>{if(I.current==null)return;const{forward:E,backward:s,left:a,right:r,jump:l}=B(),h=I.current.linvel();aR.set(h.x,h.y,h.z);const{x:w,y:S,z:c}=I.current.translation();t.camera.position.set(w,S,c),A.current!=null&&(A.current.children[0].rotation.x=g(A.current.children[0].rotation.x,Math.sin((aR.length()>1?1:0)*t.clock.elapsedTime*10)/6,.1),A.current.rotation.copy(t.camera.rotation),A.current.position.copy(t.camera.position).add(t.camera.getWorldDirection(Dj).multiplyScalar(1))),I.current&&(Q({forward:E,backward:s,left:a,right:r,rotation:t.camera.rotation,velocity:h}),l&&e())}),z.jsxs(z.Fragment,{children:[z.jsxs($a,{ref:I,colliders:!1,mass:1,type:"dynamic",position:[0,10,0],enabledRotations:[!1,!1,!1],canSleep:!1,collisionGroups:ua([0],[0]),children:[z.jsx(Fm,{args:[.75,.5]}),z.jsx(ER,{allow:["immersive-ar","immersive-vr"],children:z.jsx(lj,{playerJump:e,playerMove:Q})})]}),z.jsx(ER,{deny:"immersive-vr",children:z.jsx("group",{ref:A,onPointerMissed:t=>{A.current!=null&&(A.current.children[0].rotation.x=-.5)},children:z.jsx(aj,{position:[.3,-.35,.5]})})})]})}const oY=nm(g=>({cubes:[],addCube:(A,I,C)=>g(i=>({cubes:[...i.cubes,[A,I,C]]}))})),Sj=()=>oY(A=>A.cubes).map((A,I)=>z.jsx(nY,{position:A},I));function nY(g){const A=v.useRef(null),[I,C]=v.useState(null),i=oY(E=>E.addCube),B=BS("dirt.jpg"),Q=v.useCallback(E=>{E.faceIndex!=null&&(E.stopPropagation(),C(Math.floor(E.faceIndex/2)))},[]),e=v.useCallback(()=>C(null),[]),t=v.useCallback(E=>{if(A.current==null||E.faceIndex==null)return;E.stopPropagation();const{x:s,y:a,z:r}=A.current.translation(),l=[[s+1,a,r],[s-1,a,r],[s,a+1,r],[s,a-1,r],[s,a,r+1],[s,a,r-1]];i(...l[Math.floor(E.faceIndex/2)])},[]);return z.jsx($a,{...g,type:"fixed",colliders:"cuboid",collisionGroups:ua([0,1],[0]),ref:A,children:z.jsxs("mesh",{receiveShadow:!0,castShadow:!0,onPointerMove:Q,onPointerOut:e,onClick:t,children:[[...Array(6)].map((E,s)=>z.jsx("meshStandardMaterial",{attach:`material-${s}`,map:B,color:I===s?"hotpink":"white"},s)),z.jsx("boxGeometry",{})]})})}const rR=zV();function wj(){return z.jsxs(z.Fragment,{children:[z.jsx("button",{style:{position:"absolute",zIndex:1e4,background:"black",borderRadius:"0.5rem",border:"none",fontWeight:"bold",color:"white",padding:"1rem 2rem",cursor:"pointer",fontSize:"1.5rem",bottom:"1rem",left:"50%",boxShadow:"0px 0px 20px rgba(0,0,0,1)",transform:"translate(-50%, 0)"},onClick:()=>rR.enterVR(),children:"Enter VR"}),z.jsx(kP,{map:[{name:"forward",keys:["ArrowUp","w","W"]},{name:"backward",keys:["ArrowDown","s","S"]},{name:"left",keys:["ArrowLeft","a","A"]},{name:"right",keys:["ArrowRight","d","D"]},{name:"jump",keys:["Space"]}],children:z.jsx(yP,{shadows:!0,camera:{fov:45},children:z.jsxs($V,{store:rR,children:[z.jsx(GZ,{sunPosition:[100,20,100]}),z.jsx("ambientLight",{intensity:.8}),z.jsx("directionalLight",{intensity:5,position:[100,60,100]}),z.jsxs(qW,{gravity:[0,-30,0],children:[z.jsx(A8,{collisionGroups:ua([0,1],[0])}),z.jsx(hj,{}),z.jsx(nY,{collisionGroups:ua([0,1],[0]),position:[0,.5,-10]}),z.jsx(Sj,{})]}),z.jsx(DZ,{})]})})})]})}xk(document.getElementById("root")).render(z.jsx(v.StrictMode,{children:z.jsx(wj,{})}));export{vQ as B,Bn as C,$i as D,BC as E,iI as F,IB as G,NC as L,_A as M,FI as O,IE as P,XI as Q,Pa as R,_a as S,jh as T,J as V,TJ as W,Xg as a,yI as b,eg as c,ba as d,jB as e,YD as f,ih as g,Wg as h,Wh as i,z as j,pB as k,xk as l,wI as o,v as r}; diff --git a/examples/minecraft/index.html b/examples/minecraft/index.html index 585ad74..a36222d 100644 --- a/examples/minecraft/index.html +++ b/examples/minecraft/index.html @@ -4,7 +4,7 @@ Document - +