iwer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/iwer.js +4628 -0
- package/build/iwer.min.js +1 -0
- package/build/iwer.module.js +4591 -0
- package/build/iwer.module.min.js +1 -0
- package/lib/action/ActionPlayer.d.ts +75 -0
- package/lib/action/ActionPlayer.d.ts.map +1 -0
- package/lib/action/ActionPlayer.js +206 -0
- package/lib/action/ActionPlayer.js.map +1 -0
- package/lib/action/ActionRecorder.d.ts +59 -0
- package/lib/action/ActionRecorder.d.ts.map +1 -0
- package/lib/action/ActionRecorder.js +162 -0
- package/lib/action/ActionRecorder.js.map +1 -0
- package/lib/action/Capture.d.ts +3 -0
- package/lib/action/Capture.d.ts.map +1 -0
- package/lib/action/Capture.js +26907 -0
- package/lib/action/Capture.js.map +1 -0
- package/lib/device/XRController.d.ts +24 -0
- package/lib/device/XRController.d.ts.map +1 -0
- package/lib/device/XRController.js +82 -0
- package/lib/device/XRController.js.map +1 -0
- package/lib/device/XRDevice.d.ts +142 -0
- package/lib/device/XRDevice.d.ts.map +1 -0
- package/lib/device/XRDevice.js +370 -0
- package/lib/device/XRDevice.js.map +1 -0
- package/lib/device/XRHandInput.d.ts +44 -0
- package/lib/device/XRHandInput.d.ts.map +1 -0
- package/lib/device/XRHandInput.js +133 -0
- package/lib/device/XRHandInput.js.map +1 -0
- package/lib/device/XRTrackedInput.d.ts +22 -0
- package/lib/device/XRTrackedInput.d.ts.map +1 -0
- package/lib/device/XRTrackedInput.js +89 -0
- package/lib/device/XRTrackedInput.js.map +1 -0
- package/lib/device/configs/controller/meta.d.ts +6 -0
- package/lib/device/configs/controller/meta.d.ts.map +1 -0
- package/lib/device/configs/controller/meta.js +152 -0
- package/lib/device/configs/controller/meta.js.map +1 -0
- package/lib/device/configs/hand/pinch.d.ts +3 -0
- package/lib/device/configs/hand/pinch.d.ts.map +1 -0
- package/lib/device/configs/hand/pinch.js +237 -0
- package/lib/device/configs/hand/pinch.js.map +1 -0
- package/lib/device/configs/hand/point.d.ts +3 -0
- package/lib/device/configs/hand/point.d.ts.map +1 -0
- package/lib/device/configs/hand/point.js +236 -0
- package/lib/device/configs/hand/point.js.map +1 -0
- package/lib/device/configs/hand/relaxed.d.ts +3 -0
- package/lib/device/configs/hand/relaxed.d.ts.map +1 -0
- package/lib/device/configs/hand/relaxed.js +236 -0
- package/lib/device/configs/hand/relaxed.js.map +1 -0
- package/lib/device/configs/headset/meta.d.ts +6 -0
- package/lib/device/configs/headset/meta.d.ts.map +1 -0
- package/lib/device/configs/headset/meta.js +99 -0
- package/lib/device/configs/headset/meta.js.map +1 -0
- package/lib/device/controllers.d.ts +31 -0
- package/lib/device/controllers.d.ts.map +1 -0
- package/lib/device/controllers.js +8 -0
- package/lib/device/controllers.js.map +1 -0
- package/lib/events/XRInputSourceEvent.d.ts +16 -0
- package/lib/events/XRInputSourceEvent.d.ts.map +1 -0
- package/lib/events/XRInputSourceEvent.js +14 -0
- package/lib/events/XRInputSourceEvent.js.map +1 -0
- package/lib/events/XRInputSourcesChangeEvent.d.ts +18 -0
- package/lib/events/XRInputSourcesChangeEvent.d.ts.map +1 -0
- package/lib/events/XRInputSourcesChangeEvent.js +18 -0
- package/lib/events/XRInputSourcesChangeEvent.js.map +1 -0
- package/lib/events/XRReferenceSpaceEvent.d.ts +16 -0
- package/lib/events/XRReferenceSpaceEvent.d.ts.map +1 -0
- package/lib/events/XRReferenceSpaceEvent.js +11 -0
- package/lib/events/XRReferenceSpaceEvent.js.map +1 -0
- package/lib/events/XRSessionEvent.d.ts +13 -0
- package/lib/events/XRSessionEvent.d.ts.map +1 -0
- package/lib/events/XRSessionEvent.js +10 -0
- package/lib/events/XRSessionEvent.js.map +1 -0
- package/lib/frameloop/XRFrame.d.ts +28 -0
- package/lib/frameloop/XRFrame.d.ts.map +1 -0
- package/lib/frameloop/XRFrame.js +117 -0
- package/lib/frameloop/XRFrame.js.map +1 -0
- package/lib/gamepad/Gamepad.d.ts +72 -0
- package/lib/gamepad/Gamepad.d.ts.map +1 -0
- package/lib/gamepad/Gamepad.js +126 -0
- package/lib/gamepad/Gamepad.js.map +1 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +36 -0
- package/lib/index.js.map +1 -0
- package/lib/initialization/XRSystem.d.ts +13 -0
- package/lib/initialization/XRSystem.d.ts.map +1 -0
- package/lib/initialization/XRSystem.js +65 -0
- package/lib/initialization/XRSystem.js.map +1 -0
- package/lib/input/XRHand.d.ts +31 -0
- package/lib/input/XRHand.d.ts.map +1 -0
- package/lib/input/XRHand.js +31 -0
- package/lib/input/XRHand.js.map +1 -0
- package/lib/input/XRInputSource.d.ts +37 -0
- package/lib/input/XRInputSource.d.ts.map +1 -0
- package/lib/input/XRInputSource.js +51 -0
- package/lib/input/XRInputSource.js.map +1 -0
- package/lib/input/XRInputSourceArray.d.ts +11 -0
- package/lib/input/XRInputSourceArray.d.ts.map +1 -0
- package/lib/input/XRInputSourceArray.js +17 -0
- package/lib/input/XRInputSourceArray.js.map +1 -0
- package/lib/layers/XRWebGLLayer.d.ts +31 -0
- package/lib/layers/XRWebGLLayer.d.ts.map +1 -0
- package/lib/layers/XRWebGLLayer.js +67 -0
- package/lib/layers/XRWebGLLayer.js.map +1 -0
- package/lib/pose/XRJointPose.d.ts +11 -0
- package/lib/pose/XRJointPose.d.ts.map +1 -0
- package/lib/pose/XRJointPose.js +12 -0
- package/lib/pose/XRJointPose.js.map +1 -0
- package/lib/pose/XRPose.d.ts +16 -0
- package/lib/pose/XRPose.d.ts.map +1 -0
- package/lib/pose/XRPose.js +24 -0
- package/lib/pose/XRPose.js.map +1 -0
- package/lib/pose/XRViewerPose.d.ts +12 -0
- package/lib/pose/XRViewerPose.d.ts.map +1 -0
- package/lib/pose/XRViewerPose.js +14 -0
- package/lib/pose/XRViewerPose.js.map +1 -0
- package/lib/primitives/XRRigidTransform.d.ts +17 -0
- package/lib/primitives/XRRigidTransform.d.ts.map +1 -0
- package/lib/primitives/XRRigidTransform.js +54 -0
- package/lib/primitives/XRRigidTransform.js.map +1 -0
- package/lib/session/XRRenderState.d.ts +22 -0
- package/lib/session/XRRenderState.d.ts.map +1 -0
- package/lib/session/XRRenderState.js +26 -0
- package/lib/session/XRRenderState.js.map +1 -0
- package/lib/session/XRSession.d.ts +103 -0
- package/lib/session/XRSession.d.ts.map +1 -0
- package/lib/session/XRSession.js +459 -0
- package/lib/session/XRSession.js.map +1 -0
- package/lib/spaces/XRJointSpace.d.ts +13 -0
- package/lib/spaces/XRJointSpace.d.ts.map +1 -0
- package/lib/spaces/XRJointSpace.js +12 -0
- package/lib/spaces/XRJointSpace.js.map +1 -0
- package/lib/spaces/XRReferenceSpace.d.ts +22 -0
- package/lib/spaces/XRReferenceSpace.d.ts.map +1 -0
- package/lib/spaces/XRReferenceSpace.js +42 -0
- package/lib/spaces/XRReferenceSpace.js.map +1 -0
- package/lib/spaces/XRSpace.d.ts +20 -0
- package/lib/spaces/XRSpace.d.ts.map +1 -0
- package/lib/spaces/XRSpace.js +45 -0
- package/lib/spaces/XRSpace.js.map +1 -0
- package/lib/utils/DOMPointReadOnly.d.ts +17 -0
- package/lib/utils/DOMPointReadOnly.d.ts.map +1 -0
- package/lib/utils/DOMPointReadOnly.js +26 -0
- package/lib/utils/DOMPointReadOnly.js.map +1 -0
- package/lib/utils/Math.d.ts +49 -0
- package/lib/utils/Math.d.ts.map +1 -0
- package/lib/utils/Math.js +129 -0
- package/lib/utils/Math.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/lib/views/XRView.d.ts +25 -0
- package/lib/views/XRView.d.ts.map +1 -0
- package/lib/views/XRView.js +39 -0
- package/lib/views/XRView.js.map +1 -0
- package/lib/views/XRViewport.d.ts +15 -0
- package/lib/views/XRViewport.d.ts.map +1 -0
- package/lib/views/XRViewport.js +19 -0
- package/lib/views/XRViewport.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).IWER={})}(this,(function(e){"use strict";var t="undefined"!=typeof Float32Array?Float32Array:Array;function i(){var e=new t(16);return t!=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 n(e){var i=new t(16);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function r(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 a(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=t[4],o=t[5],u=t[6],c=t[7],l=t[8],d=t[9],h=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],x=i*o-n*s,y=i*u-r*s,S=i*c-a*s,w=n*u-r*o,b=n*c-a*o,M=r*c-a*u,R=l*m-d*f,F=l*g-h*f,E=l*v-p*f,I=d*g-h*m,q=d*v-p*m,P=h*v-p*g,T=x*P-y*q+S*I+w*E-b*F+M*R;return T?(T=1/T,e[0]=(o*P-u*q+c*I)*T,e[1]=(r*q-n*P-a*I)*T,e[2]=(m*M-g*b+v*w)*T,e[3]=(h*b-d*M-p*w)*T,e[4]=(u*E-s*P-c*F)*T,e[5]=(i*P-r*E+a*F)*T,e[6]=(g*S-f*M-v*y)*T,e[7]=(l*M-h*S+p*y)*T,e[8]=(s*q-o*E+c*R)*T,e[9]=(n*E-i*q-a*R)*T,e[10]=(f*b-m*S+v*x)*T,e[11]=(d*S-l*b-p*x)*T,e[12]=(o*F-s*I-u*R)*T,e[13]=(i*I-n*F+r*R)*T,e[14]=(m*y-f*w-g*x)*T,e[15]=(l*w-d*y+h*x)*T,e):null}function s(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],l=t[7],d=t[8],h=t[9],p=t[10],f=t[11],m=t[12],g=t[13],v=t[14],x=t[15],y=i[0],S=i[1],w=i[2],b=i[3];return e[0]=y*n+S*o+w*d+b*m,e[1]=y*r+S*u+w*h+b*g,e[2]=y*a+S*c+w*p+b*v,e[3]=y*s+S*l+w*f+b*x,y=i[4],S=i[5],w=i[6],b=i[7],e[4]=y*n+S*o+w*d+b*m,e[5]=y*r+S*u+w*h+b*g,e[6]=y*a+S*c+w*p+b*v,e[7]=y*s+S*l+w*f+b*x,y=i[8],S=i[9],w=i[10],b=i[11],e[8]=y*n+S*o+w*d+b*m,e[9]=y*r+S*u+w*h+b*g,e[10]=y*a+S*c+w*p+b*v,e[11]=y*s+S*l+w*f+b*x,y=i[12],S=i[13],w=i[14],b=i[15],e[12]=y*n+S*o+w*d+b*m,e[13]=y*r+S*u+w*h+b*g,e[14]=y*a+S*c+w*p+b*v,e[15]=y*s+S*l+w*f+b*x,e}function o(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 u(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=n+n,u=r+r,c=a+a,l=n*o,d=n*u,h=n*c,p=r*u,f=r*c,m=a*c,g=s*o,v=s*u,x=s*c;return e[0]=1-(p+m),e[1]=d+x,e[2]=h-v,e[3]=0,e[4]=d-x,e[5]=1-(l+m),e[6]=f+g,e[7]=0,e[8]=h+v,e[9]=f-g,e[10]=1-(l+p),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function c(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function l(e,t){var i=t[0],n=t[1],r=t[2],a=t[4],s=t[5],o=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.hypot(i,n,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(u,c,l),e}function d(e,i){var n=new t(3);l(n,i);var r=1/n[0],a=1/n[1],s=1/n[2],o=i[0]*r,u=i[1]*a,c=i[2]*s,d=i[4]*r,h=i[5]*a,p=i[6]*s,f=i[8]*r,m=i[9]*a,g=i[10]*s,v=o+h+g,x=0;return v>0?(x=2*Math.sqrt(v+1),e[3]=.25*x,e[0]=(p-m)/x,e[1]=(f-c)/x,e[2]=(u-d)/x):o>h&&o>g?(x=2*Math.sqrt(1+o-h-g),e[3]=(p-m)/x,e[0]=.25*x,e[1]=(u+d)/x,e[2]=(f+c)/x):h>g?(x=2*Math.sqrt(1+h-o-g),e[3]=(f-c)/x,e[0]=(u+d)/x,e[1]=.25*x,e[2]=(p+m)/x):(x=2*Math.sqrt(1+g-o-h),e[3]=(u-d)/x,e[0]=(f+c)/x,e[1]=(p+m)/x,e[2]=.25*x),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var h=function(e,t,i,n,r){var a,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(a=1/(n-r),e[10]=(r+n)*a,e[14]=2*r*n*a):(e[10]=-1,e[14]=-2*n),e};function p(){var e=new t(3);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function f(e,i,n){var r=new t(3);return r[0]=e,r[1]=i,r[2]=n,r}function m(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function g(e,t){var i=t[0],n=t[1],r=t[2],a=i*i+n*n+r*r;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 v(e,t,i,n){var r=t[0],a=t[1],s=t[2];return e[0]=r+n*(i[0]-r),e[1]=a+n*(i[1]-a),e[2]=s+n*(i[2]-s),e}function x(){var e=new t(4);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function y(e,t,i){i*=.5;var n=Math.sin(i);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(i),e}function S(e,t,i,n){var r,a,s,o,u,c=t[0],l=t[1],d=t[2],h=t[3],p=i[0],f=i[1],m=i[2],g=i[3];return(a=c*p+l*f+d*m+h*g)<0&&(a=-a,p=-p,f=-f,m=-m,g=-g),1-a>1e-6?(r=Math.acos(a),s=Math.sin(r),o=Math.sin((1-n)*r)/s,u=Math.sin(n*r)/s):(o=1-n,u=n),e[0]=o*c+u*p,e[1]=o*l+u*f,e[2]=o*d+u*m,e[3]=o*h+u*g,e}p(),function(){var e,i=(e=new t(4),t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();var w,b=function(e,i,n,r){var a=new t(4);return a[0]=e,a[1]=i,a[2]=n,a[3]=r,a},M=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},R=function(e,t,i,n,r){return e[0]=t,e[1]=i,e[2]=n,e[3]=r,e},F=function(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=i*i+n*n+r*r+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=n*s,e[2]=r*s,e[3]=a*s,e};p(),f(1,0,0),f(0,1,0),x(),x(),w=new t(9),t!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1;const E=Symbol("@immersive-web-emulation-runtime/xr-space");class I extends EventTarget{constructor(e,t){super(),this[E]={parentSpace:e,offsetMatrix:t?n(t):i(),emulated:!0}}}class q extends I{constructor(){super(void 0,i())}}class P{static updateOffsetPosition(e,t){o(e[E].offsetMatrix,t)}static updateOffsetQuaternion(e,t){const i=e[E].offsetMatrix,n=p();c(n,i),u(i,t,n)}static updateOffsetMatrix(e,t){r(e[E].offsetMatrix,t)}static calculateGlobalOffsetMatrix(e,t=i()){return s(t,e[E].parentSpace?P.calculateGlobalOffsetMatrix(e[E].parentSpace):i(),e[E].offsetMatrix),t}}class T{constructor(e=0,t=0,i=0){this.vec3=f(e,t,i),this.tempVec3=p()}get x(){return this.vec3[0]}set x(e){this.vec3[0]=e}get y(){return this.vec3[1]}set y(e){this.vec3[1]=e}get z(){return this.vec3[2]}set z(e){this.vec3[2]=e}set(e,t,i){return function(e,t,i,n){e[0]=t,e[1]=i,e[2]=n}(this.vec3,e,t,i),this}clone(){return new T(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.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 m(this.tempVec3,this.vec3),g(this.vec3,this.tempVec3),this}add(e){return m(this.tempVec3,this.vec3),function(e,t,i){e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2]}(this.vec3,this.tempVec3,e.vec3),this}applyQuaternion(e){return m(this.tempVec3,this.vec3),function(e,t,i){var n=i[0],r=i[1],a=i[2],s=i[3],o=t[0],u=t[1],c=t[2],l=r*c-a*u,d=a*o-n*c,h=n*u-r*o,p=r*h-a*d,f=a*l-n*h,m=n*d-r*l,g=2*s;l*=g,d*=g,h*=g,p*=2,f*=2,m*=2,e[0]=o+l+p,e[1]=u+d+f,e[2]=c+h+m}(this.vec3,this.tempVec3,e.quat),this}}class V{constructor(e=0,t=0,i=0,n=1){this.quat=b(e,t,i,n),this.tempQuat=x()}get x(){return this.quat[0]}set x(e){this.quat[0]=e}get y(){return this.quat[1]}set y(e){this.quat[1]=e}get z(){return this.quat[2]}set z(e){this.quat[2]=e}get w(){return this.quat[3]}set w(e){this.quat[3]=e}set(e,t,i,n){return R(this.quat,e,t,i,n),this}clone(){return new V(this.x,this.y,this.z,this.w)}copy(e){return R(this.quat,e.x,e.y,e.z,e.w),this}normalize(){return M(this.tempQuat,this.quat),F(this.quat,this.tempQuat),this}invert(){return M(this.tempQuat,this.quat),function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this.quat,this.tempQuat),this}multiply(e){return M(this.tempQuat,this.quat),function(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=i[0],u=i[1],c=i[2],l=i[3];e[0]=n*l+s*o+r*c-a*u,e[1]=r*l+s*u+a*o-n*c,e[2]=a*l+s*c+n*u-r*o,e[3]=s*l-n*o-r*u-a*c}(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return y(this.quat,e.vec3,t),this}}const L=Symbol("@immersive-web-emulation-runtime/gamepad");var O,k,A;!function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"}(O||(O={}));class X{constructor(e,t){this[L]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[L].type?this[L].pressed:this[L].value>0}get touched(){return"manual"===this[L].type?this[L].touched:this[L].touched||this.pressed}get value(){return this[L].value}}class z{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class D{constructor(e,t="",i=-1){this[L]={id:t,index:i,connected:!1,timestamp:performance.now(),mapping:e.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},e.buttons.forEach((e=>{var t;null===e?this[L].buttonsSequence.push(null):(this[L].buttonsSequence.push(e.id),this[L].buttonsMap[e.id]=new X(e.type,null!==(t=e.eventTrigger)&&void 0!==t?t:null))})),e.axes.forEach((e=>{null===e?this[L].axesSequence.push(null):(this[L].axesSequence.push(e.id+e.type),this[L].axesMap[e.id]||(this[L].axesMap[e.id]={x:0,y:0}))}))}get id(){return this[L].id}get index(){return this[L].index}get connected(){return this[L].connected}get timestamp(){return this[L].timestamp}get mapping(){return this[L].mapping}get axes(){const e=[];return this[L].axesSequence.forEach((t=>{if(null===t)e.push(null);else{const i=t.substring(0,t.length-6),n=t.substring(t.length-6);e.push("y-axis"===n?this[L].axesMap[i].y:this[L].axesMap[i].x)}})),e}get buttons(){return this[L].buttonsSequence.map((e=>null===e?new z:this[L].buttonsMap[e]))}get hapticActuators(){return this[L].hapticActuators}get vibrationActuator(){return null}}!function(e){e.None="none",e.Left="left",e.Right="right"}(k||(k={})),function(e){e.Gaze="gaze",e.TrackedPointer="tracked-pointer",e.Screen="screen",e.TransientPointer="transient-pointer"}(A||(A={}));class C extends Array{}const j=Symbol("@immersive-web-emulation-runtime/xr-input-source");class H{constructor(e,t,i,n,r,a,s){this[j]={handedness:e,targetRayMode:t,targetRaySpace:n,gripSpace:a,profiles:i,gamepad:r,hand:s}}get handedness(){return this[j].handedness}get targetRayMode(){return this[j].targetRayMode}get targetRaySpace(){return this[j].targetRaySpace}get gripSpace(){return this[j].gripSpace}get profiles(){return this[j].profiles}get gamepad(){return this[j].gamepad}get hand(){return this[j].hand}}class N extends Event{constructor(e,t){if(super(e,t),!t.frame)throw new Error("XRInputSourceEventInit.frame is required");if(!t.inputSource)throw new Error("XRInputSourceEventInit.inputSource is required");this.frame=t.frame,this.inputSource=t.inputSource}}const B=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),G={[k.Left]:{position:new T(-.25,1.5,-.4),quaternion:new V},[k.Right]:{position:new T(.25,1.5,-.4),quaternion:new V},[k.None]:{position:new T(.25,1.5,-.4),quaternion:new V}};class Q{constructor(e){this[B]={inputSource:e,position:G[e.handedness].position.clone(),quaternion:G[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[B].position}get quaternion(){return this[B].quaternion}get inputSource(){return this[B].inputSource}get connected(){return this[B].connected}set connected(e){this[B].connected=e,this[B].inputSource.gamepad[L].connected=e}onFrameStart(e){u(this[B].inputSource.targetRaySpace[E].offsetMatrix,this[B].quaternion.quat,this[B].position.vec3);const t=e.session;this[B].inputSource.gamepad.buttons.forEach((i=>{i instanceof X&&(i[L].lastFrameValue=i[L].value,null!=i[L].pendingValue&&(i[L].value=i[L].pendingValue,i[L].pendingValue=null),null!=i[L].eventTrigger&&(0===i[L].lastFrameValue&&i[L].value>0?(t.dispatchEvent(new N(i[L].eventTrigger,{frame:e,inputSource:this[B].inputSource})),t.dispatchEvent(new N(i[L].eventTrigger+"start",{frame:e,inputSource:this[B].inputSource}))):i[L].lastFrameValue>0&&0===i[L].value&&t.dispatchEvent(new N(i[L].eventTrigger+"end",{frame:e,inputSource:this[B].inputSource}))))})),this[B].inputSourceChanged=this.connected!==this[B].lastFrameConnected,this[B].lastFrameConnected=this.connected}}class $ extends Q{constructor(e,t,i){if(!e.layout[t])throw new DOMException("Handedness not supported","InvalidStateError");const n=new I(i),r=e.layout[t].gripOffsetMatrix?new I(n,e.layout[t].gripOffsetMatrix):void 0,a=[e.profileId,...e.fallbackProfileIds];super(new H(t,A.TrackedPointer,a,n,new D(e.layout[t].gamepad),r))}updateButtonValue(e,t){if(t>1||t<0)return void console.warn(`Out-of-range value ${t} provided for button ${e}.`);const i=this[B].inputSource.gamepad[L].buttonsMap[e];if(i){if("binary"===i[L].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[L].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[B].inputSource.gamepad[L].buttonsMap[e];i?i[L].touched=t:console.warn(`Current controller does not have button ${e}.`)}updateAxis(e,t,i){if(i>1||i<-1)return void console.warn(`Out-of-range value ${i} provided for ${e} axes.`);const n=this[B].inputSource.gamepad[L].axesMap[e];n?"x-axis"===t?n.x=i:"y-axis"===t&&(n.y=i):console.warn(`Current controller does not have ${e} axes.`)}updateAxes(e,t,i){if(t>1||t<-1||i>1||i<-1)return void console.warn(`Out-of-range value x:${t}, y:${i} provided for ${e} axes.`);const n=this[B].inputSource.gamepad[L].axesMap[e];n?(n.x=t,n.y=i):console.warn(`Current controller does not have ${e} axes.`)}}const U=Symbol("@immersive-web-emulation-runtime/xr-view");var _,K;!function(e){e.None="none",e.Left="left",e.Right="right"}(_||(_={}));class W{constructor(e,t,i,n){this[U]={eye:e,projectionMatrix:t,transform:i,recommendedViewportScale:null,requestedViewportScale:1,session:n}}get eye(){return this[U].eye}get projectionMatrix(){return this[U].projectionMatrix}get transform(){return this[U].transform}get recommendedViewportScale(){return this[U].recommendedViewportScale}requestViewportScale(e){null===e||e<=0||e>1?console.warn("Invalid scale value. Scale must be > 0 and <= 1."):this[U].requestedViewportScale=e}}!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"}(K||(K={}));class J extends Map{}const Y=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class Z extends I{constructor(e,t,i){super(t,i),this[Y]={jointName:e,radius:0}}get jointName(){return this[Y].jointName}}const ee={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:{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]},pinch:{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]},point:{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]}}},te={mapping:O.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},ie=p(),ne=x(),re=p(),ae=p(),se=x(),oe=p(),ue=p(),ce=x(),le=p(),de=(e,t,i,n)=>(c(ie,t),d(ne,t),l(re,t),c(ae,i),d(se,i),l(oe,i),v(ue,ie,ae,n),S(ce,ne,se,n),v(le,re,oe,n),function(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=t[3],u=r+r,c=a+a,l=s+s,d=r*u,h=r*c,p=r*l,f=a*c,m=a*l,g=s*l,v=o*u,x=o*c,y=o*l,S=n[0],w=n[1],b=n[2];e[0]=(1-(f+g))*S,e[1]=(h+y)*S,e[2]=(p-x)*S,e[3]=0,e[4]=(h-y)*w,e[5]=(1-(d+g))*w,e[6]=(m+v)*w,e[7]=0,e[8]=(p+x)*b,e[9]=(m-v)*b,e[10]=(1-(d+f))*b,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1}(e,ce,ue,le),e),he=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],pe=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class fe extends Q{constructor(e,t,i){if(t!==k.Left&&t!==k.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!e.poses.default||!e.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const n=new I(i),r=new I(n),a=[e.profileId,...e.fallbackProfileIds],s=new J;Object.values(K).forEach((e=>{s.set(e,new Z(e,n))}));super(new H(t,A.TrackedPointer,a,n,new D(te),r,s)),this[pe]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[pe].poseId}set poseId(e){this[pe].poses[e]?this[pe].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){const e=this[pe].poses[this[pe].poseId],t=this[pe].poses.pinch;Object.values(K).forEach((i=>{const n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);de(a[E].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===k.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=he[t]})(a[E].offsetMatrix),a[Y].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius})),e.gripOffsetMatrix&&t.gripOffsetMatrix&&de(this.inputSource.gripSpace[E].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[B].inputSource.gamepad[L].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0)return void console.warn(`Out-of-range value ${e} provided for pinch`);this[B].inputSource.gamepad[L].buttonsMap.pinch[L].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const me=Symbol("@immersive-web-emulation-runtime/xr-pose");class ge{constructor(e,t=!1,i=void 0,n=void 0){this[me]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:n}}get transform(){return this[me].transform}get emulatedPosition(){return this[me].emulatedPosition}get linearVelocity(){return this[me].linearVelocity}get angularVelocity(){return this[me].angularVelocity}}const ve=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class xe extends ge{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[ve]={radius:t}}get radius(){return this[ve].radius}}class ye{constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n,Object.freeze(this)}static fromPoint(e){return new ye(e.x,e.y,e.z,e.w)}matrixTransform(e){return new ye}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const Se=void 0!==globalThis.DOMPointReadOnly?globalThis.DOMPointReadOnly:ye,we=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class be{constructor(e,t){const n=f(0,0,0),r=x();this[we]={matrix:i(),position:e?f(e.x,e.y,e.z):n,orientation:t?F(x(),b(t.x,t.y,t.z,t.w)):r,inverse:null},this.updateMatrix()}updateMatrix(){u(this[we].matrix,this[we].orientation,this[we].position)}get matrix(){return this[we].matrix}get position(){const e=this[we].position;return new Se(e[0],e[1],e[2],1)}get orientation(){const e=this[we].orientation;return new Se(e[0],e[1],e[2],e[3])}get inverse(){if(!this[we].inverse){const e=i();if(!a(e,this[we].matrix))throw new Error("Matrix is not invertible.");let t=p();c(t,e);let n=x();d(n,e),this[we].inverse=new be(new Se(t[0],t[1],t[2],1),new Se(n[0],n[1],n[2],n[3])),this[we].inverse[we].inverse=this}return this[we].inverse}}const Me=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class Re extends ge{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[Me]={views:Object.freeze(t)}}get views(){return this[Me].views}}const Fe=Symbol("@immersive-web-emulation-runtime/xr-frame"),Ee=i(),Ie=i(),qe=i(),Pe=(e,t,i)=>{P.calculateGlobalOffsetMatrix(t,Ee),P.calculateGlobalOffsetMatrix(i,Ie),a(qe,Ie),s(e,qe,Ee)};class Te{constructor(e,t,n,r,a){this[Fe]={session:e,id:t,active:n,animationFrame:r,predictedDisplayTime:a,tempMat4:i()}}get session(){return this[Fe].session}get predictedDisplayTime(){return this[Fe].predictedDisplayTime}getPose(e,t){if(!this[Fe].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");Pe(this[Fe].tempMat4,e,t);const i=p();c(i,this[Fe].tempMat4);const n=x();return d(n,this[Fe].tempMat4),new ge(new be({x:i[0],y:i[1],z:i[2],w:1},{x:n[0],y:n[1],z:n[2],w:n[3]}),e[E].emulated)}getViewerPose(e){if(!this[Fe].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[Fe].session,i=t[He].device,n=this.getPose(i.viewerSpace,e),r=t[He].mode===je.Inline?[_.None]:[_.Left,_.Right],a=[];return r.forEach((n=>{const r=i.viewSpaces[n],s=this.getPose(r,e),o=t[He].getProjectionMatrix(n),u=new W(n,new Float32Array(o),s.transform,t);a.push(u)})),new Re(n.transform,a,!1)}getJointPose(e,t){const i=this.getPose(e,t),n=e[Y].radius;return new xe(i.transform,n,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Fe].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(e.length>t.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let i=!0;for(let n=0;n<e.length;n++)e[n][Y].radius?t[n]=e[n][Y].radius:(t[n]=NaN,i=!1);return i}fillPoses(e,t,i){if(e=Array.from(e),!this[Fe].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(16*e.length>i.length)throw new DOMException("The length of spaces multiplied by 16 is larger than the number of elements in transforms","TypeError");return e.forEach(((e,n)=>{Pe(this[Fe].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[Fe].tempMat4[e]})),!0}}class Ve extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRInputSourcesChangeEventInit.session is required");if(!t.added)throw new Error("XRInputSourcesChangeEventInit.added is required");if(!t.removed)throw new Error("XRInputSourcesChangeEventInit.removed is required");this.session=t.session,this.added=t.added,this.removed=t.removed}}var Le;const Oe=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var ke;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"}(ke||(ke={}));class Ae extends I{constructor(e,t,i){super(t,i),this[Le]={type:null,onreset:()=>{}},this[Oe].type=e}get onreset(){var e;return null!==(e=this[Oe].onreset)&&void 0!==e?e:()=>{}}set onreset(e){this[Oe].onreset&&this.removeEventListener("reset",this[Oe].onreset),this[Oe].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new Ae(this[Oe].type,this,e)}}Le=Oe;const Xe=Symbol("@immersive-web-emulation-runtime/xr-render-state");class ze{constructor(e={},t){this[Xe]={depthNear:e.depthNear||(null==t?void 0:t.depthNear)||.1,depthFar:e.depthFar||(null==t?void 0:t.depthFar)||1e3,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null==t?void 0:t.inlineVerticalFieldOfView)||null,baseLayer:e.baseLayer||(null==t?void 0:t.baseLayer)||null}}get depthNear(){return this[Xe].depthNear}get depthFar(){return this[Xe].depthFar}get inlineVerticalFieldOfView(){return this[Xe].inlineVerticalFieldOfView}get baseLayer(){return this[Xe].baseLayer}}class De extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}var Ce,je;!function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"}(Ce||(Ce={})),function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"}(je||(je={}));const He=Symbol("@immersive-web-emulation-runtime/xr-session");class Ne extends EventTarget{constructor(e,t,n){super(),this[He]={device:e,mode:t,renderState:new ze,pendingRenderState:null,enabledFeatures:n,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[_.Left]:i(),[_.Right]:i(),[_.None]:i()},getProjectionMatrix:e=>this[He].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[He].enabledFeatures.includes(e))return!1;switch(e){case ke.Viewer:return!0;case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:return this[He].mode!=je.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[He].ended)return;this[He].deviceFrameHandle=globalThis.requestAnimationFrame(this[He].onDeviceFrame),null!=this[He].pendingRenderState&&(this[He].renderState=this[He].pendingRenderState,this[He].pendingRenderState=null,this[He].device[tt].onBaseLayerSet(this[He].renderState.baseLayer));const e=this[He].renderState.baseLayer;if(null===e)return;const t=e.context,i=t.canvas;if(this[He].mode!=je.Inline){const e=t.getParameter(t.COLOR_CLEAR_VALUE),i=t.getParameter(t.DEPTH_CLEAR_VALUE),n=t.getParameter(t.STENCIL_CLEAR_VALUE);t.clearColor(0,0,0,0),t.clearDepth(1),t.clearStencil(0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),t.clearColor(e[0],e[1],e[2],e[3]),t.clearDepth(i),t.clearStencil(n)}const{depthNear:n,depthFar:a}=this[He].renderState,{width:s,height:o}=i;if(this[He].mode!==je.Inline){const e=s*(this[He].device.stereoEnabled?.5:1)/o;h(this[He].projectionMatrices[_.Left],this[He].device.fovy,e,n,a),r(this[He].projectionMatrices[_.Right],this[He].projectionMatrices[_.Left])}else{const e=s/o;h(this[He].projectionMatrices[_.None],this[He].renderState.inlineVerticalFieldOfView,e,n,a)}const u=new Te(this,this[He].frameHandle,!0,!0,performance.now());this[He].device[tt].onFrameStart(u),this[He].updateActiveInputSources();const c=this[He].currentFrameCallbacks=this[He].frameCallbacks;this[He].frameCallbacks=[];const l=performance.now();for(let e=0;e<c.length;e++)try{c[e].cancelled||c[e].callback(l,u)}catch(e){console.error(e)}this[He].currentFrameCallbacks=null,u[Fe].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{const e=this[He].enabledFeatures.includes(et.HandTracking),t=this[He].activeInputSources,i=this[He].device.inputSources.filter((t=>!t.hand||e)),n=i.filter((e=>!t.includes(e))),r=t.filter((e=>!i.includes(e)));(n.length>0||r.length>0)&&this.dispatchEvent(new Ve("inputsourceschange",{session:this,added:n,removed:r})),this[He].activeInputSources=i},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[He].onDeviceFrame()}get visibilityState(){return this[He].device.visibilityState}get frameRate(){return this[He].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[He].device.supportedFrameRates)}get renderState(){return this[He].renderState}get inputSources(){return this[He].inputSourceArray.length=0,this[He].ended||this[He].mode===je.Inline||this[He].inputSourceArray.push(...this[He].activeInputSources),this[He].inputSourceArray}get enabledFeatures(){return this[He].enabledFeatures}get isSystemKeyboardSupported(){return this[He].isSystemKeyboardSupported}updateRenderState(e={}){if(this[He].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Ge].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&this[He].mode!==je.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");this[He].pendingRenderState=new ze(e,this[He].renderState)}async updateTargetFrameRate(e){return new Promise(((t,i)=>{this[He].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[He].device.supportedFrameRates.includes(e)?(this[He].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[He].nominalFrameRate=e,this.dispatchEvent(new De("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${e}`)),t()):i(new DOMException("Requested frame rate not supported.","InvalidStateError"))}))}async requestReferenceSpace(e){return new Promise(((t,i)=>{if(this[He].ended||!this[He].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));let n;switch(e){case ke.Viewer:n=this[He].device.viewerSpace;break;case ke.Local:n=new Ae(e,this[He].device[tt].globalSpace,this[He].device.viewerSpace[E].offsetMatrix);break;case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:n=new Ae(e,this[He].device[tt].globalSpace)}this[He].referenceSpaces.push(n),t(n)}))}requestAnimationFrame(e){if(this[He].ended)return 0;const t=++this[He].frameHandle;return this[He].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[He].frameCallbacks,i=t.findIndex((t=>t&&t.handle===e));i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[He].currentFrameCallbacks,t&&(i=t.findIndex((t=>t&&t.handle===e)),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise(((e,t)=>{this[He].ended||null===this[He].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[He].deviceFrameHandle),this[He].device[tt].onSessionEnd(),this.dispatchEvent(new De("end",{session:this})),e())}))}get onend(){var e;return null!==(e=this[He].onend)&&void 0!==e?e:()=>{}}set onend(e){this[He].onend&&this.removeEventListener("end",this[He].onend),this[He].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!==(e=this[He].oninputsourceschange)&&void 0!==e?e:()=>{}}set oninputsourceschange(e){this[He].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[He].oninputsourceschange),this[He].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!==(e=this[He].onselect)&&void 0!==e?e:()=>{}}set onselect(e){this[He].onselect&&this.removeEventListener("select",this[He].onselect),this[He].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!==(e=this[He].onselectstart)&&void 0!==e?e:()=>{}}set onselectstart(e){this[He].onselectstart&&this.removeEventListener("selectstart",this[He].onselectstart),this[He].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!==(e=this[He].onselectend)&&void 0!==e?e:()=>{}}set onselectend(e){this[He].onselectend&&this.removeEventListener("selectend",this[He].onselectend),this[He].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!==(e=this[He].onsqueeze)&&void 0!==e?e:()=>{}}set onsqueeze(e){this[He].onsqueeze&&this.removeEventListener("squeeze",this[He].onsqueeze),this[He].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!==(e=this[He].onsqueezestart)&&void 0!==e?e:()=>{}}set onsqueezestart(e){this[He].onsqueezestart&&this.removeEventListener("squeezestart",this[He].onsqueezestart),this[He].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!==(e=this[He].onsqueezeend)&&void 0!==e?e:()=>{}}set onsqueezeend(e){this[He].onsqueezeend&&this.removeEventListener("squeezeend",this[He].onsqueezeend),this[He].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!==(e=this[He].onvisibilitychange)&&void 0!==e?e:()=>{}}set onvisibilitychange(e){this[He].onvisibilitychange&&this.removeEventListener("visibilitychange",this[He].onvisibilitychange),this[He].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!==(e=this[He].onframeratechange)&&void 0!==e?e:()=>{}}set onframeratechange(e){this[He].onframeratechange&&this.removeEventListener("frameratechange",this[He].onframeratechange),this[He].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}class Be extends EventTarget{}const Ge=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),Qe={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class $e extends Be{constructor(e,t,i={}){if(super(),e[He].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...Qe,...i};this[Ge]={session:e,context:t,antialias:n.antialias}}get context(){return this[Ge].context}get antialias(){return this[Ge].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Ge].context.drawingBufferWidth}get framebufferHeight(){return this[Ge].context.drawingBufferHeight}getViewport(e){if(e[U].session!==this[Ge].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Ge].session[He].device[tt].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof Ne))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[He].ended?0:1}}const Ue=Symbol("@immersive-web-emulation-runtime/action-player");class _e{constructor(e,t,i){const{schema:n,frames:r}=t;if(!r||!n||0===r.length)throw new DOMException("wrong recording format","NotSupportedError");const a=new Ae(ke.Viewer,e),s={[_.Left]:new I(a),[_.Right]:new I(a),[_.None]:new I(a)};this[Ue]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:r,recordedFramePointer:0,startingTimeStamp:r[0][0],endingTimeStamp:r[r.length-1][0],playbackTime:r[0][0],playing:!1,viewerSpace:a,viewSpaces:s,vec3:p(),quat:x()},o(this[Ue].viewSpaces[_.Left][E].offsetMatrix,f(-i/2,0,0)),o(this[Ue].viewSpaces[_.Right][E].offsetMatrix,f(i/2,0,0)),n.forEach((t=>{const i=t[0],n=t[1];let r;if(n.hasGamepad){const e=[];for(let t=0;t<n.numButtons;t++)e.push({id:t.toString(),type:"manual"});const t=[];for(let e=0;e<n.numAxes;e++)t.push({id:e.toString(),type:"manual"});r=new D({mapping:n.mapping,buttons:e,axes:t})}const a=new I(e);let s;n.hasHand&&(s=new J,Object.values(K).forEach((e=>{s.set(e,new Z(e,a))})));const o=new H(n.handedness,n.targetRayMode,n.profiles,a,r,n.hasGrip?new I(e):void 0,n.hasHand?s:void 0);this[Ue].inputSources.set(i,{active:!1,source:o}),this[Ue].inputSchemas.set(i,n)}))}play(){this[Ue].recordedFramePointer=0,this[Ue].playbackTime=this[Ue].startingTimeStamp,this[Ue].playing=!0,this[Ue].actualTimeStamp=performance.now()}stop(){this[Ue].playing=!1}get playing(){return this[Ue].playing}get viewerSpace(){return this[Ue].viewerSpace}get viewSpaces(){return this[Ue].viewSpaces}get inputSources(){return Array.from(this[Ue].inputSources.values()).filter((e=>e.active)).map((e=>e.source))}playFrame(){const e=performance.now(),t=e-this[Ue].actualTimeStamp;if(this[Ue].actualTimeStamp=e,this[Ue].playbackTime+=t,this[Ue].playbackTime>this[Ue].endingTimeStamp)return void this.stop();for(;this[Ue].frames[this[Ue].recordedFramePointer+1][0]<this[Ue].playbackTime;)this[Ue].recordedFramePointer++;const i=this[Ue].frames[this[Ue].recordedFramePointer],n=this[Ue].frames[this[Ue].recordedFramePointer+1],r=(this[Ue].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[Ue].viewerSpace,i.slice(1,8),n.slice(1,8),r);const a=new Map;for(let e=8;e<i.length;e++){const{index:t,inputData:n}=this.processRawInputData(i[e]);a.set(t,n)}const s=new Map;for(let e=8;e<n.length;e++){const{index:t,inputData:i}=this.processRawInputData(n[e]);s.set(t,i)}this[Ue].inputSources.forEach((e=>{e.active=!1})),s.forEach(((e,t)=>{this[Ue].inputSources.get(t).active=!0;const i=this[Ue].inputSources.get(t).source,n=this[Ue].inputSchemas.get(t);this.updateInputSource(i,n,a.has(t)?a.get(t):e,e,r)}))}updateInputSource(e,t,i,n,r){if(this.updateXRSpaceFromMergedFrames(e.targetRaySpace,i.targetRayTransform,n.targetRayTransform,r),t.hasGrip&&this.updateXRSpaceFromMergedFrames(e.gripSpace,i.gripTransform,n.gripTransform,r),t.hasHand)for(let a=0;a<25;a++){const s=i.handTransforms.slice(8*a,8*a+7),o=n.handTransforms.slice(8*a,8*a+7),u=i.handTransforms[8*a+7],c=n.handTransforms[8*a+7],l=e.hand.get(t.jointSequence[a]);this.updateXRSpaceFromMergedFrames(l,s,o,r),l[Y].radius=(c-u)*r+u}if(t.hasGamepad){const t=e.gamepad;n.buttons.forEach(((e,n)=>{const a=t.buttons[n];a[L].pressed=1===e[0],a[L].touched=1===e[1];const s=i.buttons[n][2],o=e[2];a[L].value=(o-s)*r+s})),n.axes.forEach(((e,n)=>{const a=i.axes[n];t[L].axesMap[n.toString()].x=(e-a)*r+a}))}}updateXRSpaceFromMergedFrames(e,t,i,n){const r=f(t[0],t[1],t[2]),a=b(t[3],t[4],t[5],t[6]),s=f(i[0],i[1],i[2]),o=b(i[3],i[4],i[5],i[6]);v(this[Ue].vec3,r,s,n),S(this[Ue].quat,a,o,n),u(e[E].offsetMatrix,this[Ue].quat,this[Ue].vec3)}processRawInputData(e){const t=e[0],i=this[Ue].inputSchemas.get(t),n={targetRayTransform:e.slice(1,8)};let r=8;if(i.hasGrip&&(n.gripTransform=e[r++]),i.hasHand&&(n.handTransforms=e[r++]),i.hasGamepad){const t=e[r];n.buttons=t.slice(0,i.numButtons),n.axes=t.slice(i.numButtons)}return{index:t,inputData:n}}}class Ke extends Event{constructor(e,t){if(super(e,t),!t.referenceSpace)throw new Error("XRReferenceSpaceEventInit.referenceSpace is required");this.referenceSpace=t.referenceSpace,this.transform=t.transform}}const We=Symbol("@immersive-web-emulation-runtime/xr-system");class Je extends EventTarget{constructor(e){super(),this[We]={device:e}}isSessionSupported(e){return new Promise(((t,i)=>{e===je.Inline?t(!0):t(this[We].device.supportedSessionModes.includes(e))}))}requestSession(e,t={}){return new Promise(((i,n)=>{this.isSessionSupported(e).then((r=>{if(!r)return void n(new DOMException("The requested XRSession mode is not supported.","NotSupportedError"));if(this[We].activeSession)return void n(new DOMException("An active XRSession already exists.","InvalidStateError"));const{requiredFeatures:a=[],optionalFeatures:s=[]}=t,{supportedFeatures:o}=this[We].device;if(!a.every((e=>o.includes(e))))return void n(new Error("One or more required features are not supported by the device."));const u=s.filter((e=>o.includes(e))),c=Array.from(new Set([...a,...u,et.Viewer,et.Local])),l=new Ne(this[We].device,e,c);this[We].activeSession=l,l.addEventListener("end",(()=>{this[We].activeSession=void 0})),i(l)})).catch(n)}))}}const Ye=Symbol("@immersive-web-emulation-runtime/xr-viewport");class Ze{constructor(e,t,i,n){this[Ye]={x:e,y:t,width:i,height:n}}get x(){return this[Ye].x}get y(){return this[Ye].y}get width(){return this[Ye].width}get height(){return this[Ye].height}}var et;!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"}(et||(et={}));const tt=Symbol("@immersive-web-emulation-runtime/xr-device"),it={ipd:.063,fovy:Math.PI/2,headsetPosition:new T(0,1.6,0),headsetQuaternion:new V,stereoEnabled:!1};const nt={mapping:O.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"}]},rt={mapping:O.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"}]},at={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:nt,gripOffsetMatrix:[.9925461411476135,2.0823669899527886e-8,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,-8.329467959811154e-8,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},st={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:nt,gripOffsetMatrix:[.9925461411476135,-1.5779937356796836e-8,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},ot={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:nt,gripOffsetMatrix:[.9925461411476135,1.0736208366779465e-8,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,-2.6238110351073374e-8,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},ut={name:"Oculus Quest 1",controllerConfig:{profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:nt,gripOffsetMatrix:[.9925461411476135,4.673031295254759e-9,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,3.688163374704345e-8,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72},ct={name:"Meta Quest 2",controllerConfig:at,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72},lt={name:"Meta Quest Pro",controllerConfig:st,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90},dt={name:"Meta Quest 3",controllerConfig:ot,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking,et.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90},ht=Symbol("@immersive-web-emulation-runtime/action-recorder"),pt=e=>{const t=[];return e.forEach((e=>{t.push(parseFloat(e.toFixed(3)))})),t};e.ActionRecorder=class{constructor(e,t){this[ht]={session:e,refSpace:t,inputMap:new Map,schemaMap:new Map,compressedFrames:[],jointRadii:new Float32Array(25),jointTransforms:new Float32Array(400)}}recordFrame(e){var t;const i=performance.now(),n=null===(t=e.getViewerPose(this[ht].refSpace))||void 0===t?void 0:t.transform.matrix;if(!n)return;const r={timeStamp:i,position:c(p(),n),quaternion:d(x(),n),inputFrames:[]};this[ht].session.inputSources.forEach((t=>{var i,n;if(!this[ht].inputMap.has(t)){const e={handedness:t.handedness,targetRayMode:t.targetRayMode,profiles:t.profiles,hasGrip:null!=t.gripSpace,hasHand:null!=t.hand,hasGamepad:null!=t.gamepad};e.hasHand&&(e.jointSequence=Array.from(t.hand.values()).map((e=>e.jointName))),e.hasGamepad&&(e.mapping=t.gamepad.mapping,e.numButtons=t.gamepad.buttons.length,e.numAxes=t.gamepad.axes.length);const i=this[ht].inputMap.size;this[ht].inputMap.set(t,i),this[ht].schemaMap.set(i,e)}const a=this[ht].inputMap.get(t),s=this[ht].schemaMap.get(a),o=null===(i=e.getPose(t.targetRaySpace,this[ht].refSpace))||void 0===i?void 0:i.transform.matrix;if(o){const i={index:a,targetRayTransform:{position:c(p(),o),quaternion:d(x(),o)}};if(s.hasGrip){const r=null===(n=e.getPose(t.gripSpace,this[ht].refSpace))||void 0===n?void 0:n.transform.matrix;if(r){const e=c(p(),r),t=d(x(),r);i.gripTransform={position:e,quaternion:t}}}if(s.hasHand){const n=Array.from(t.hand.values());let r=!0;if(r&&(r=e.fillPoses(n,t.targetRaySpace,this[ht].jointTransforms)),r&&(r=e.fillJointRadii(n,this[ht].jointRadii)),r){const e={};for(let t=0;t<25;t++){const i=this[ht].jointTransforms.slice(16*t,16*(t+1)),r=this[ht].jointRadii[t],a=c(p(),i),s=d(x(),i);e[n[t].jointName]={position:a,quaternion:s,radius:r}}i.hand=e}}if(s.hasGamepad){const e={buttons:t.gamepad.buttons.map((e=>e?[e.pressed?1:0,e.touched?1:0,e.value]:null)),axes:Array.from(t.gamepad.axes)};i.gamepad=e}r.inputFrames.push(i)}})),this[ht].compressedFrames.push(this.compressActionFrame(r))}compressActionFrame(e){const t=[Math.round(10*e.timeStamp)/10,...pt(e.position),...pt(e.quaternion)];return e.inputFrames.forEach((e=>{const i=e.index,n=this[ht].schemaMap.get(i),r=[i,...pt(e.targetRayTransform.position),...pt(e.targetRayTransform.quaternion)];if(n.hasGrip&&r.push([...pt(e.gripTransform.position),...pt(e.gripTransform.quaternion)]),n.hasHand){const t=[];Object.values(e.hand).forEach((({position:e,quaternion:i,radius:n})=>{t.push(...pt(e),...pt(i),parseFloat(n.toFixed(3)))})),r.push(t)}n.hasGamepad&&r.push([...e.gamepad.buttons,...e.gamepad.axes]),t.push(r)})),t}log(){const e={schema:Array.from(this[ht].schemaMap.entries()),frames:this[ht].compressedFrames};console.log(JSON.stringify(e))}},e.XRDevice=class{constructor(e,t={}){var n,r,a,s,c,l;const d=new q,h=new Ae(ke.Viewer,d),p={[_.Left]:new I(h),[_.Right]:new I(h),[_.None]:new I(h)},m=e.controllerConfig,g={};m&&Object.values(k).forEach((e=>{m.layout[e]&&(g[e]=new $(m,e,d))}));const v={[k.Left]:new fe(ee,k.Left,d),[k.Right]:new fe(ee,k.Right,d)},x=null!==(n=t.canvasContainer)&&void 0!==n?n:document.createElement("div");x.dataset.webxr_runtime="Immersive Web Emulation Runtime v0.0.1",x.style.position="fixed",x.style.width="100%",x.style.height="100%",x.style.top="0",x.style.left="0",x.style.display="flex",x.style.justifyContent="center",x.style.alignItems="center",x.style.overflow="hidden",x.style.zIndex="999",this[tt]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,position:null!==(r=t.headsetPosition)&&void 0!==r?r:it.headsetPosition.clone(),quaternion:null!==(a=t.headsetQuaternion)&&void 0!==a?a:it.headsetQuaternion.clone(),stereoEnabled:null!==(s=t.stereoEnabled)&&void 0!==s?s:it.stereoEnabled,ipd:null!==(c=t.ipd)&&void 0!==c?c:it.ipd,fovy:null!==(l=t.fovy)&&void 0!==l?l:it.fovy,controllers:g,hands:v,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:Ce.Visible,pendingVisibilityState:null,matrix:i(),globalSpace:d,viewerSpace:h,viewSpaces:p,canvasContainer:x,getViewport:(e,t)=>{const i=e.context.canvas,{width:n,height:r}=i;switch(t.eye){case _.None:return new Ze(0,0,n,r);case _.Left:return new Ze(0,0,this[tt].stereoEnabled?n/2:n,r);case _.Right:return new Ze(n/2,0,this[tt].stereoEnabled?n/2:0,r)}},updateViews:()=>{u(this[tt].viewerSpace[E].offsetMatrix,this[tt].quaternion.quat,this[tt].position.vec3),o(this[tt].viewSpaces[_.Left][E].offsetMatrix,f(-this[tt].ipd/2,0,0)),o(this[tt].viewSpaces[_.Right][E].offsetMatrix,f(this[tt].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;const t=e.context.canvas;t.parentElement!==this[tt].canvasContainer&&(this[tt].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height},this[tt].canvasContainer.appendChild(t),document.body.appendChild(this[tt].canvasContainer)),t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[tt].canvasData){const{canvas:e,parent:t,width:i,height:n}=this[tt].canvasData;e.width=i,e.height=n,t?t.appendChild(e):this[tt].canvasContainer.removeChild(e),document.body.removeChild(this[tt].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null===(t=this[tt].actionPlayer)||void 0===t?void 0:t.playing)this[tt].actionPlayer.playFrame();else{const t=e.session;this[tt].updateViews(),this[tt].pendingVisibilityState&&(this[tt].visibilityState=this[tt].pendingVisibilityState,this[tt].pendingVisibilityState=null,t.dispatchEvent(new De("visibilitychange",{session:t}))),this[tt].visibilityState===Ce.Visible&&this.activeInputs.forEach((t=>{t.onFrameStart(e)})),this[tt].pendingReferenceSpaceReset&&(t[He].referenceSpaces.forEach((e=>{switch(e[Oe].type){case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:e.dispatchEvent(new Ke("reset",{referenceSpace:e}))}})),this[tt].pendingReferenceSpaceReset=!1)}this[tt].updateViews()}},this[tt].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise(((e,t)=>{e(!0)}))},configurable:!0}),Object.defineProperty(globalThis.navigator,"xr",{value:new Je(this),configurable:!0}),e.XRSystem=Je,e.XRSession=Ne,e.XRRenderState=ze,e.XRFrame=Te,e.XRSpace=I,e.XRReferenceSpace=Ae,e.XRJointSpace=Z,e.XRView=W,e.XRViewport=Ze,e.XRRigidTransform=be,e.XRPose=ge,e.XRViewerPose=Re,e.XRJointPose=xe,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRHand=J,e.XRLayer=Be,e.XRWebGLLayer=$e,e.XRSessionEvent=De,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=Ve,e.XRReferenceSpaceEvent=Ke}get supportedSessionModes(){return this[tt].supportedSessionModes}get supportedFeatures(){return this[tt].supportedFeatures}get supportedFrameRates(){return this[tt].supportedFrameRates}get isSystemKeyboardSupported(){return this[tt].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[tt].internalNominalFrameRate}get stereoEnabled(){return this[tt].stereoEnabled}set stereoEnabled(e){this[tt].stereoEnabled=e}get ipd(){return this[tt].ipd}set ipd(e){this[tt].ipd=e}get fovy(){return this[tt].fovy}set fovy(e){this[tt].fovy=e}get position(){return this[tt].position}get quaternion(){return this[tt].quaternion}get viewerSpace(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.viewerSpace:this[tt].viewerSpace}get viewSpaces(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.viewSpaces:this[tt].viewSpaces}get controllers(){return this[tt].controllers}get hands(){return this[tt].hands}get primaryInputMode(){return this[tt].primaryInputMode}set primaryInputMode(e){"controller"===e||"hand"===e?this[tt].primaryInputMode=e:console.warn('primary input mode can only be "controller" or "hand"')}get activeInputs(){if(this[tt].visibilityState!==Ce.Visible)return[];return("controller"===this[tt].primaryInputMode?Object.values(this[tt].controllers):Object.values(this[tt].hands)).filter((e=>e.connected))}get inputSources(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.inputSources:this.activeInputs.map((e=>e.inputSource))}get canvasContainer(){return this[tt].canvasContainer}recenter(){const e=new T(-this.position.x,0,-this.position.z),t=new T(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();const i=Math.atan2(t.x,-t.z),n=(new V).setFromAxisAngle(new T(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[tt].controllers),...Object.values(this[tt].hands)].forEach((t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)})),this[tt].pendingReferenceSpaceReset=!0}get visibilityState(){return this[tt].visibilityState}updateVisibilityState(e){if(!Object.values(Ce).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[tt].visibilityState&&(this[tt].pendingVisibilityState=e)}createActionPlayer(e,t){return this[tt].actionPlayer=new _e(e,t,this[tt].ipd),this[tt].actionPlayer}},e.XRFrame=Te,e.XRHand=J,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=Ve,e.XRJointPose=xe,e.XRJointSpace=Z,e.XRLayer=Be,e.XRPose=ge,e.XRReferenceSpace=Ae,e.XRReferenceSpaceEvent=Ke,e.XRRenderState=ze,e.XRRigidTransform=be,e.XRSession=Ne,e.XRSessionEvent=De,e.XRSpace=I,e.XRSystem=Je,e.XRView=W,e.XRViewerPose=Re,e.XRViewport=Ze,e.XRWebGLLayer=$e,e.metaQuest2=ct,e.metaQuest3=dt,e.metaQuestPro=lt,e.oculusQuest1=ut,Object.defineProperty(e,"__esModule",{value:!0})}));
|