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.
Files changed (161) hide show
  1. package/build/iwer.js +4628 -0
  2. package/build/iwer.min.js +1 -0
  3. package/build/iwer.module.js +4591 -0
  4. package/build/iwer.module.min.js +1 -0
  5. package/lib/action/ActionPlayer.d.ts +75 -0
  6. package/lib/action/ActionPlayer.d.ts.map +1 -0
  7. package/lib/action/ActionPlayer.js +206 -0
  8. package/lib/action/ActionPlayer.js.map +1 -0
  9. package/lib/action/ActionRecorder.d.ts +59 -0
  10. package/lib/action/ActionRecorder.d.ts.map +1 -0
  11. package/lib/action/ActionRecorder.js +162 -0
  12. package/lib/action/ActionRecorder.js.map +1 -0
  13. package/lib/action/Capture.d.ts +3 -0
  14. package/lib/action/Capture.d.ts.map +1 -0
  15. package/lib/action/Capture.js +26907 -0
  16. package/lib/action/Capture.js.map +1 -0
  17. package/lib/device/XRController.d.ts +24 -0
  18. package/lib/device/XRController.d.ts.map +1 -0
  19. package/lib/device/XRController.js +82 -0
  20. package/lib/device/XRController.js.map +1 -0
  21. package/lib/device/XRDevice.d.ts +142 -0
  22. package/lib/device/XRDevice.d.ts.map +1 -0
  23. package/lib/device/XRDevice.js +370 -0
  24. package/lib/device/XRDevice.js.map +1 -0
  25. package/lib/device/XRHandInput.d.ts +44 -0
  26. package/lib/device/XRHandInput.d.ts.map +1 -0
  27. package/lib/device/XRHandInput.js +133 -0
  28. package/lib/device/XRHandInput.js.map +1 -0
  29. package/lib/device/XRTrackedInput.d.ts +22 -0
  30. package/lib/device/XRTrackedInput.d.ts.map +1 -0
  31. package/lib/device/XRTrackedInput.js +89 -0
  32. package/lib/device/XRTrackedInput.js.map +1 -0
  33. package/lib/device/configs/controller/meta.d.ts +6 -0
  34. package/lib/device/configs/controller/meta.d.ts.map +1 -0
  35. package/lib/device/configs/controller/meta.js +152 -0
  36. package/lib/device/configs/controller/meta.js.map +1 -0
  37. package/lib/device/configs/hand/pinch.d.ts +3 -0
  38. package/lib/device/configs/hand/pinch.d.ts.map +1 -0
  39. package/lib/device/configs/hand/pinch.js +237 -0
  40. package/lib/device/configs/hand/pinch.js.map +1 -0
  41. package/lib/device/configs/hand/point.d.ts +3 -0
  42. package/lib/device/configs/hand/point.d.ts.map +1 -0
  43. package/lib/device/configs/hand/point.js +236 -0
  44. package/lib/device/configs/hand/point.js.map +1 -0
  45. package/lib/device/configs/hand/relaxed.d.ts +3 -0
  46. package/lib/device/configs/hand/relaxed.d.ts.map +1 -0
  47. package/lib/device/configs/hand/relaxed.js +236 -0
  48. package/lib/device/configs/hand/relaxed.js.map +1 -0
  49. package/lib/device/configs/headset/meta.d.ts +6 -0
  50. package/lib/device/configs/headset/meta.d.ts.map +1 -0
  51. package/lib/device/configs/headset/meta.js +99 -0
  52. package/lib/device/configs/headset/meta.js.map +1 -0
  53. package/lib/device/controllers.d.ts +31 -0
  54. package/lib/device/controllers.d.ts.map +1 -0
  55. package/lib/device/controllers.js +8 -0
  56. package/lib/device/controllers.js.map +1 -0
  57. package/lib/events/XRInputSourceEvent.d.ts +16 -0
  58. package/lib/events/XRInputSourceEvent.d.ts.map +1 -0
  59. package/lib/events/XRInputSourceEvent.js +14 -0
  60. package/lib/events/XRInputSourceEvent.js.map +1 -0
  61. package/lib/events/XRInputSourcesChangeEvent.d.ts +18 -0
  62. package/lib/events/XRInputSourcesChangeEvent.d.ts.map +1 -0
  63. package/lib/events/XRInputSourcesChangeEvent.js +18 -0
  64. package/lib/events/XRInputSourcesChangeEvent.js.map +1 -0
  65. package/lib/events/XRReferenceSpaceEvent.d.ts +16 -0
  66. package/lib/events/XRReferenceSpaceEvent.d.ts.map +1 -0
  67. package/lib/events/XRReferenceSpaceEvent.js +11 -0
  68. package/lib/events/XRReferenceSpaceEvent.js.map +1 -0
  69. package/lib/events/XRSessionEvent.d.ts +13 -0
  70. package/lib/events/XRSessionEvent.d.ts.map +1 -0
  71. package/lib/events/XRSessionEvent.js +10 -0
  72. package/lib/events/XRSessionEvent.js.map +1 -0
  73. package/lib/frameloop/XRFrame.d.ts +28 -0
  74. package/lib/frameloop/XRFrame.d.ts.map +1 -0
  75. package/lib/frameloop/XRFrame.js +117 -0
  76. package/lib/frameloop/XRFrame.js.map +1 -0
  77. package/lib/gamepad/Gamepad.d.ts +72 -0
  78. package/lib/gamepad/Gamepad.d.ts.map +1 -0
  79. package/lib/gamepad/Gamepad.js +126 -0
  80. package/lib/gamepad/Gamepad.js.map +1 -0
  81. package/lib/index.d.ts +24 -0
  82. package/lib/index.d.ts.map +1 -0
  83. package/lib/index.js +36 -0
  84. package/lib/index.js.map +1 -0
  85. package/lib/initialization/XRSystem.d.ts +13 -0
  86. package/lib/initialization/XRSystem.d.ts.map +1 -0
  87. package/lib/initialization/XRSystem.js +65 -0
  88. package/lib/initialization/XRSystem.js.map +1 -0
  89. package/lib/input/XRHand.d.ts +31 -0
  90. package/lib/input/XRHand.d.ts.map +1 -0
  91. package/lib/input/XRHand.js +31 -0
  92. package/lib/input/XRHand.js.map +1 -0
  93. package/lib/input/XRInputSource.d.ts +37 -0
  94. package/lib/input/XRInputSource.d.ts.map +1 -0
  95. package/lib/input/XRInputSource.js +51 -0
  96. package/lib/input/XRInputSource.js.map +1 -0
  97. package/lib/input/XRInputSourceArray.d.ts +11 -0
  98. package/lib/input/XRInputSourceArray.d.ts.map +1 -0
  99. package/lib/input/XRInputSourceArray.js +17 -0
  100. package/lib/input/XRInputSourceArray.js.map +1 -0
  101. package/lib/layers/XRWebGLLayer.d.ts +31 -0
  102. package/lib/layers/XRWebGLLayer.d.ts.map +1 -0
  103. package/lib/layers/XRWebGLLayer.js +67 -0
  104. package/lib/layers/XRWebGLLayer.js.map +1 -0
  105. package/lib/pose/XRJointPose.d.ts +11 -0
  106. package/lib/pose/XRJointPose.d.ts.map +1 -0
  107. package/lib/pose/XRJointPose.js +12 -0
  108. package/lib/pose/XRJointPose.js.map +1 -0
  109. package/lib/pose/XRPose.d.ts +16 -0
  110. package/lib/pose/XRPose.d.ts.map +1 -0
  111. package/lib/pose/XRPose.js +24 -0
  112. package/lib/pose/XRPose.js.map +1 -0
  113. package/lib/pose/XRViewerPose.d.ts +12 -0
  114. package/lib/pose/XRViewerPose.d.ts.map +1 -0
  115. package/lib/pose/XRViewerPose.js +14 -0
  116. package/lib/pose/XRViewerPose.js.map +1 -0
  117. package/lib/primitives/XRRigidTransform.d.ts +17 -0
  118. package/lib/primitives/XRRigidTransform.d.ts.map +1 -0
  119. package/lib/primitives/XRRigidTransform.js +54 -0
  120. package/lib/primitives/XRRigidTransform.js.map +1 -0
  121. package/lib/session/XRRenderState.d.ts +22 -0
  122. package/lib/session/XRRenderState.d.ts.map +1 -0
  123. package/lib/session/XRRenderState.js +26 -0
  124. package/lib/session/XRRenderState.js.map +1 -0
  125. package/lib/session/XRSession.d.ts +103 -0
  126. package/lib/session/XRSession.d.ts.map +1 -0
  127. package/lib/session/XRSession.js +459 -0
  128. package/lib/session/XRSession.js.map +1 -0
  129. package/lib/spaces/XRJointSpace.d.ts +13 -0
  130. package/lib/spaces/XRJointSpace.d.ts.map +1 -0
  131. package/lib/spaces/XRJointSpace.js +12 -0
  132. package/lib/spaces/XRJointSpace.js.map +1 -0
  133. package/lib/spaces/XRReferenceSpace.d.ts +22 -0
  134. package/lib/spaces/XRReferenceSpace.d.ts.map +1 -0
  135. package/lib/spaces/XRReferenceSpace.js +42 -0
  136. package/lib/spaces/XRReferenceSpace.js.map +1 -0
  137. package/lib/spaces/XRSpace.d.ts +20 -0
  138. package/lib/spaces/XRSpace.d.ts.map +1 -0
  139. package/lib/spaces/XRSpace.js +45 -0
  140. package/lib/spaces/XRSpace.js.map +1 -0
  141. package/lib/utils/DOMPointReadOnly.d.ts +17 -0
  142. package/lib/utils/DOMPointReadOnly.d.ts.map +1 -0
  143. package/lib/utils/DOMPointReadOnly.js +26 -0
  144. package/lib/utils/DOMPointReadOnly.js.map +1 -0
  145. package/lib/utils/Math.d.ts +49 -0
  146. package/lib/utils/Math.d.ts.map +1 -0
  147. package/lib/utils/Math.js +129 -0
  148. package/lib/utils/Math.js.map +1 -0
  149. package/lib/version.d.ts +2 -0
  150. package/lib/version.d.ts.map +1 -0
  151. package/lib/version.js +2 -0
  152. package/lib/version.js.map +1 -0
  153. package/lib/views/XRView.d.ts +25 -0
  154. package/lib/views/XRView.d.ts.map +1 -0
  155. package/lib/views/XRView.js +39 -0
  156. package/lib/views/XRView.js.map +1 -0
  157. package/lib/views/XRViewport.d.ts +15 -0
  158. package/lib/views/XRViewport.d.ts.map +1 -0
  159. package/lib/views/XRViewport.js +19 -0
  160. package/lib/views/XRViewport.js.map +1 -0
  161. package/package.json +63 -0
@@ -0,0 +1 @@
1
+ var e="undefined"!=typeof Float32Array?Float32Array:Array;function t(){var t=new e(16);return e!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function i(t){var i=new e(16);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i}function n(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 r(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],m=t[12],f=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,F=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,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 o(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,m=r*c,f=a*c,g=s*o,v=s*u,x=s*c;return e[0]=1-(p+f),e[1]=d+x,e[2]=h-v,e[3]=0,e[4]=d-x,e[5]=1-(l+f),e[6]=m+g,e[7]=0,e[8]=h+v,e[9]=m-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 u(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function c(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 l(t,i){var n=new e(3);c(n,i);var r=1/n[0],a=1/n[1],s=1/n[2],o=i[0]*r,u=i[1]*a,l=i[2]*s,d=i[4]*r,h=i[5]*a,p=i[6]*s,m=i[8]*r,f=i[9]*a,g=i[10]*s,v=o+h+g,x=0;return v>0?(x=2*Math.sqrt(v+1),t[3]=.25*x,t[0]=(p-f)/x,t[1]=(m-l)/x,t[2]=(u-d)/x):o>h&&o>g?(x=2*Math.sqrt(1+o-h-g),t[3]=(p-f)/x,t[0]=.25*x,t[1]=(u+d)/x,t[2]=(m+l)/x):h>g?(x=2*Math.sqrt(1+h-o-g),t[3]=(m-l)/x,t[0]=(u+d)/x,t[1]=.25*x,t[2]=(p+f)/x):(x=2*Math.sqrt(1+g-o-h),t[3]=(u-d)/x,t[0]=(m+l)/x,t[1]=(p+f)/x,t[2]=.25*x),t}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var d=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 h(){var t=new e(3);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function p(t,i,n){var r=new e(3);return r[0]=t,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 f(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 g(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 v(){var t=new e(4);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function x(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 y(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],m=i[1],f=i[2],g=i[3];return(a=c*p+l*m+d*f+h*g)<0&&(a=-a,p=-p,m=-m,f=-f,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*m,e[2]=o*d+u*f,e[3]=o*h+u*g,e}h(),function(){var t,i=(t=new e(4),e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var S,w=function(t,i,n,r){var a=new e(4);return a[0]=t,a[1]=i,a[2]=n,a[3]=r,a},b=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},M=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};h(),p(1,0,0),p(0,1,0),v(),v(),S=new e(9),e!=Float32Array&&(S[1]=0,S[2]=0,S[3]=0,S[5]=0,S[6]=0,S[7]=0),S[0]=1,S[4]=1,S[8]=1;const R=Symbol("@immersive-web-emulation-runtime/xr-space");class E extends EventTarget{constructor(e,n){super(),this[R]={parentSpace:e,offsetMatrix:n?i(n):t(),emulated:!0}}}class q extends E{constructor(){super(void 0,t())}}class I{static updateOffsetPosition(e,t){s(e[R].offsetMatrix,t)}static updateOffsetQuaternion(e,t){const i=e[R].offsetMatrix,n=h();u(n,i),o(i,t,n)}static updateOffsetMatrix(e,t){n(e[R].offsetMatrix,t)}static calculateGlobalOffsetMatrix(e,i=t()){return a(i,e[R].parentSpace?I.calculateGlobalOffsetMatrix(e[R].parentSpace):t(),e[R].offsetMatrix),i}}class T{constructor(e=0,t=0,i=0){this.vec3=p(e,t,i),this.tempVec3=h()}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),f(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,m=a*l-n*h,f=n*d-r*l,g=2*s;l*=g,d*=g,h*=g,p*=2,m*=2,f*=2,e[0]=o+l+p,e[1]=u+d+m,e[2]=c+h+f}(this.vec3,this.tempVec3,e.quat),this}}class P{constructor(e=0,t=0,i=0,n=1){this.quat=w(e,t,i,n),this.tempQuat=v()}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 M(this.quat,e,t,i,n),this}clone(){return new P(this.x,this.y,this.z,this.w)}copy(e){return M(this.quat,e.x,e.y,e.z,e.w),this}normalize(){return b(this.tempQuat,this.quat),F(this.quat,this.tempQuat),this}invert(){return b(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 b(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 x(this.quat,e.vec3,t),this}}const V=Symbol("@immersive-web-emulation-runtime/gamepad");var O,L,k;!function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"}(O||(O={}));class A{constructor(e,t){this[V]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[V].type?this[V].pressed:this[V].value>0}get touched(){return"manual"===this[V].type?this[V].touched:this[V].touched||this.pressed}get value(){return this[V].value}}class z{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class D{constructor(e,t="",i=-1){this[V]={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[V].buttonsSequence.push(null):(this[V].buttonsSequence.push(e.id),this[V].buttonsMap[e.id]=new A(e.type,null!==(t=e.eventTrigger)&&void 0!==t?t:null))})),e.axes.forEach((e=>{null===e?this[V].axesSequence.push(null):(this[V].axesSequence.push(e.id+e.type),this[V].axesMap[e.id]||(this[V].axesMap[e.id]={x:0,y:0}))}))}get id(){return this[V].id}get index(){return this[V].index}get connected(){return this[V].connected}get timestamp(){return this[V].timestamp}get mapping(){return this[V].mapping}get axes(){const e=[];return this[V].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[V].axesMap[i].y:this[V].axesMap[i].x)}})),e}get buttons(){return this[V].buttonsSequence.map((e=>null===e?new z:this[V].buttonsMap[e]))}get hapticActuators(){return this[V].hapticActuators}get vibrationActuator(){return null}}!function(e){e.None="none",e.Left="left",e.Right="right"}(L||(L={})),function(e){e.Gaze="gaze",e.TrackedPointer="tracked-pointer",e.Screen="screen",e.TransientPointer="transient-pointer"}(k||(k={}));class C extends Array{}const X=Symbol("@immersive-web-emulation-runtime/xr-input-source");class j{constructor(e,t,i,n,r,a,s){this[X]={handedness:e,targetRayMode:t,targetRaySpace:n,gripSpace:a,profiles:i,gamepad:r,hand:s}}get handedness(){return this[X].handedness}get targetRayMode(){return this[X].targetRayMode}get targetRaySpace(){return this[X].targetRaySpace}get gripSpace(){return this[X].gripSpace}get profiles(){return this[X].profiles}get gamepad(){return this[X].gamepad}get hand(){return this[X].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 H=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),B={[L.Left]:{position:new T(-.25,1.5,-.4),quaternion:new P},[L.Right]:{position:new T(.25,1.5,-.4),quaternion:new P},[L.None]:{position:new T(.25,1.5,-.4),quaternion:new P}};class G{constructor(e){this[H]={inputSource:e,position:B[e.handedness].position.clone(),quaternion:B[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[H].position}get quaternion(){return this[H].quaternion}get inputSource(){return this[H].inputSource}get connected(){return this[H].connected}set connected(e){this[H].connected=e,this[H].inputSource.gamepad[V].connected=e}onFrameStart(e){o(this[H].inputSource.targetRaySpace[R].offsetMatrix,this[H].quaternion.quat,this[H].position.vec3);const t=e.session;this[H].inputSource.gamepad.buttons.forEach((i=>{i instanceof A&&(i[V].lastFrameValue=i[V].value,null!=i[V].pendingValue&&(i[V].value=i[V].pendingValue,i[V].pendingValue=null),null!=i[V].eventTrigger&&(0===i[V].lastFrameValue&&i[V].value>0?(t.dispatchEvent(new N(i[V].eventTrigger,{frame:e,inputSource:this[H].inputSource})),t.dispatchEvent(new N(i[V].eventTrigger+"start",{frame:e,inputSource:this[H].inputSource}))):i[V].lastFrameValue>0&&0===i[V].value&&t.dispatchEvent(new N(i[V].eventTrigger+"end",{frame:e,inputSource:this[H].inputSource}))))})),this[H].inputSourceChanged=this.connected!==this[H].lastFrameConnected,this[H].lastFrameConnected=this.connected}}class Q extends G{constructor(e,t,i){if(!e.layout[t])throw new DOMException("Handedness not supported","InvalidStateError");const n=new E(i),r=e.layout[t].gripOffsetMatrix?new E(n,e.layout[t].gripOffsetMatrix):void 0,a=[e.profileId,...e.fallbackProfileIds];super(new j(t,k.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[H].inputSource.gamepad[V].buttonsMap[e];if(i){if("binary"===i[V].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[V].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[H].inputSource.gamepad[V].buttonsMap[e];i?i[V].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[H].inputSource.gamepad[V].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[H].inputSource.gamepad[V].axesMap[e];n?(n.x=t,n.y=i):console.warn(`Current controller does not have ${e} axes.`)}}const $=Symbol("@immersive-web-emulation-runtime/xr-view");var U,_;!function(e){e.None="none",e.Left="left",e.Right="right"}(U||(U={}));class K{constructor(e,t,i,n){this[$]={eye:e,projectionMatrix:t,transform:i,recommendedViewportScale:null,requestedViewportScale:1,session:n}}get eye(){return this[$].eye}get projectionMatrix(){return this[$].projectionMatrix}get transform(){return this[$].transform}get recommendedViewportScale(){return this[$].recommendedViewportScale}requestViewportScale(e){null===e||e<=0||e>1?console.warn("Invalid scale value. Scale must be > 0 and <= 1."):this[$].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"}(_||(_={}));class W extends Map{}const J=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class Y extends E{constructor(e,t,i){super(t,i),this[J]={jointName:e,radius:0}}get jointName(){return this[J].jointName}}const Z={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]}}},ee={mapping:O.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},te=h(),ie=v(),ne=h(),re=h(),ae=v(),se=h(),oe=h(),ue=v(),ce=h(),le=(e,t,i,n)=>(u(te,t),l(ie,t),c(ne,t),u(re,i),l(ae,i),c(se,i),g(oe,te,re,n),y(ue,ie,ae,n),g(ce,ne,se,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,m=a*c,f=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-(m+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]=(f+v)*w,e[7]=0,e[8]=(p+x)*b,e[9]=(f-v)*b,e[10]=(1-(d+m))*b,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1}(e,ue,oe,ce),e),de=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],he=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class pe extends G{constructor(e,t,i){if(t!==L.Left&&t!==L.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 E(i),r=new E(n),a=[e.profileId,...e.fallbackProfileIds],s=new W;Object.values(_).forEach((e=>{s.set(e,new Y(e,n))}));super(new j(t,k.TrackedPointer,a,n,new D(ee),r,s)),this[he]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[he].poseId}set poseId(e){this[he].poses[e]?this[he].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){const e=this[he].poses[this[he].poseId],t=this[he].poses.pinch;Object.values(_).forEach((i=>{const n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);le(a[R].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===L.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=de[t]})(a[R].offsetMatrix),a[J].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius})),e.gripOffsetMatrix&&t.gripOffsetMatrix&&le(this.inputSource.gripSpace[R].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[H].inputSource.gamepad[V].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0)return void console.warn(`Out-of-range value ${e} provided for pinch`);this[H].inputSource.gamepad[V].buttonsMap.pinch[V].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const me=Symbol("@immersive-web-emulation-runtime/xr-pose");class fe{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 ge=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class ve extends fe{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[ge]={radius:t}}get radius(){return this[ge].radius}}class xe{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 xe(e.x,e.y,e.z,e.w)}matrixTransform(e){return new xe}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const ye=void 0!==globalThis.DOMPointReadOnly?globalThis.DOMPointReadOnly:xe,Se=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class we{constructor(e,i){const n=p(0,0,0),r=v();this[Se]={matrix:t(),position:e?p(e.x,e.y,e.z):n,orientation:i?F(v(),w(i.x,i.y,i.z,i.w)):r,inverse:null},this.updateMatrix()}updateMatrix(){o(this[Se].matrix,this[Se].orientation,this[Se].position)}get matrix(){return this[Se].matrix}get position(){const e=this[Se].position;return new ye(e[0],e[1],e[2],1)}get orientation(){const e=this[Se].orientation;return new ye(e[0],e[1],e[2],e[3])}get inverse(){if(!this[Se].inverse){const e=t();if(!r(e,this[Se].matrix))throw new Error("Matrix is not invertible.");let i=h();u(i,e);let n=v();l(n,e),this[Se].inverse=new we(new ye(i[0],i[1],i[2],1),new ye(n[0],n[1],n[2],n[3])),this[Se].inverse[Se].inverse=this}return this[Se].inverse}}const be=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class Me extends fe{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[be]={views:Object.freeze(t)}}get views(){return this[be].views}}const Fe=Symbol("@immersive-web-emulation-runtime/xr-frame"),Re=t(),Ee=t(),qe=t(),Ie=(e,t,i)=>{I.calculateGlobalOffsetMatrix(t,Re),I.calculateGlobalOffsetMatrix(i,Ee),r(qe,Ee),a(e,qe,Re)};class Te{constructor(e,i,n,r,a){this[Fe]={session:e,id:i,active:n,animationFrame:r,predictedDisplayTime:a,tempMat4:t()}}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");Ie(this[Fe].tempMat4,e,t);const i=h();u(i,this[Fe].tempMat4);const n=v();return l(n,this[Fe].tempMat4),new fe(new we({x:i[0],y:i[1],z:i[2],w:1},{x:n[0],y:n[1],z:n[2],w:n[3]}),e[R].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[je].device,n=this.getPose(i.viewerSpace,e),r=t[je].mode===Xe.Inline?[U.None]:[U.Left,U.Right],a=[];return r.forEach((n=>{const r=i.viewSpaces[n],s=this.getPose(r,e),o=t[je].getProjectionMatrix(n),u=new K(n,new Float32Array(o),s.transform,t);a.push(u)})),new Me(n.transform,a,!1)}getJointPose(e,t){const i=this.getPose(e,t),n=e[J].radius;return new ve(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][J].radius?t[n]=e[n][J].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)=>{Ie(this[Fe].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[Fe].tempMat4[e]})),!0}}class Pe 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 Ve;const Oe=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var Le;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"}(Le||(Le={}));class ke extends E{constructor(e,t,i){super(t,i),this[Ve]={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 ke(this[Oe].type,this,e)}}Ve=Oe;const Ae=Symbol("@immersive-web-emulation-runtime/xr-render-state");class ze{constructor(e={},t){this[Ae]={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[Ae].depthNear}get depthFar(){return this[Ae].depthFar}get inlineVerticalFieldOfView(){return this[Ae].inlineVerticalFieldOfView}get baseLayer(){return this[Ae].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,Xe;!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"}(Xe||(Xe={}));const je=Symbol("@immersive-web-emulation-runtime/xr-session");class Ne extends EventTarget{constructor(e,i,r){super(),this[je]={device:e,mode:i,renderState:new ze,pendingRenderState:null,enabledFeatures:r,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[U.Left]:t(),[U.Right]:t(),[U.None]:t()},getProjectionMatrix:e=>this[je].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[je].enabledFeatures.includes(e))return!1;switch(e){case Le.Viewer:return!0;case Le.Local:case Le.LocalFloor:case Le.BoundedFloor:case Le.Unbounded:return this[je].mode!=Xe.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[je].ended)return;this[je].deviceFrameHandle=globalThis.requestAnimationFrame(this[je].onDeviceFrame),null!=this[je].pendingRenderState&&(this[je].renderState=this[je].pendingRenderState,this[je].pendingRenderState=null,this[je].device[et].onBaseLayerSet(this[je].renderState.baseLayer));const e=this[je].renderState.baseLayer;if(null===e)return;const t=e.context,i=t.canvas;if(this[je].mode!=Xe.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:r,depthFar:a}=this[je].renderState,{width:s,height:o}=i;if(this[je].mode!==Xe.Inline){const e=s*(this[je].device.stereoEnabled?.5:1)/o;d(this[je].projectionMatrices[U.Left],this[je].device.fovy,e,r,a),n(this[je].projectionMatrices[U.Right],this[je].projectionMatrices[U.Left])}else{const e=s/o;d(this[je].projectionMatrices[U.None],this[je].renderState.inlineVerticalFieldOfView,e,r,a)}const u=new Te(this,this[je].frameHandle,!0,!0,performance.now());this[je].device[et].onFrameStart(u),this[je].updateActiveInputSources();const c=this[je].currentFrameCallbacks=this[je].frameCallbacks;this[je].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[je].currentFrameCallbacks=null,u[Fe].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{const e=this[je].enabledFeatures.includes(Ze.HandTracking),t=this[je].activeInputSources,i=this[je].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 Pe("inputsourceschange",{session:this,added:n,removed:r})),this[je].activeInputSources=i},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[je].onDeviceFrame()}get visibilityState(){return this[je].device.visibilityState}get frameRate(){return this[je].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[je].device.supportedFrameRates)}get renderState(){return this[je].renderState}get inputSources(){return this[je].inputSourceArray.length=0,this[je].ended||this[je].mode===Xe.Inline||this[je].inputSourceArray.push(...this[je].activeInputSources),this[je].inputSourceArray}get enabledFeatures(){return this[je].enabledFeatures}get isSystemKeyboardSupported(){return this[je].isSystemKeyboardSupported}updateRenderState(e={}){if(this[je].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Be].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&this[je].mode!==Xe.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");this[je].pendingRenderState=new ze(e,this[je].renderState)}async updateTargetFrameRate(e){return new Promise(((t,i)=>{this[je].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[je].device.supportedFrameRates.includes(e)?(this[je].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[je].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[je].ended||!this[je].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));let n;switch(e){case Le.Viewer:n=this[je].device.viewerSpace;break;case Le.Local:n=new ke(e,this[je].device[et].globalSpace,this[je].device.viewerSpace[R].offsetMatrix);break;case Le.LocalFloor:case Le.BoundedFloor:case Le.Unbounded:n=new ke(e,this[je].device[et].globalSpace)}this[je].referenceSpaces.push(n),t(n)}))}requestAnimationFrame(e){if(this[je].ended)return 0;const t=++this[je].frameHandle;return this[je].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[je].frameCallbacks,i=t.findIndex((t=>t&&t.handle===e));i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[je].currentFrameCallbacks,t&&(i=t.findIndex((t=>t&&t.handle===e)),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise(((e,t)=>{this[je].ended||null===this[je].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[je].deviceFrameHandle),this[je].device[et].onSessionEnd(),this.dispatchEvent(new De("end",{session:this})),e())}))}get onend(){var e;return null!==(e=this[je].onend)&&void 0!==e?e:()=>{}}set onend(e){this[je].onend&&this.removeEventListener("end",this[je].onend),this[je].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!==(e=this[je].oninputsourceschange)&&void 0!==e?e:()=>{}}set oninputsourceschange(e){this[je].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[je].oninputsourceschange),this[je].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!==(e=this[je].onselect)&&void 0!==e?e:()=>{}}set onselect(e){this[je].onselect&&this.removeEventListener("select",this[je].onselect),this[je].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!==(e=this[je].onselectstart)&&void 0!==e?e:()=>{}}set onselectstart(e){this[je].onselectstart&&this.removeEventListener("selectstart",this[je].onselectstart),this[je].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!==(e=this[je].onselectend)&&void 0!==e?e:()=>{}}set onselectend(e){this[je].onselectend&&this.removeEventListener("selectend",this[je].onselectend),this[je].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!==(e=this[je].onsqueeze)&&void 0!==e?e:()=>{}}set onsqueeze(e){this[je].onsqueeze&&this.removeEventListener("squeeze",this[je].onsqueeze),this[je].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!==(e=this[je].onsqueezestart)&&void 0!==e?e:()=>{}}set onsqueezestart(e){this[je].onsqueezestart&&this.removeEventListener("squeezestart",this[je].onsqueezestart),this[je].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!==(e=this[je].onsqueezeend)&&void 0!==e?e:()=>{}}set onsqueezeend(e){this[je].onsqueezeend&&this.removeEventListener("squeezeend",this[je].onsqueezeend),this[je].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!==(e=this[je].onvisibilitychange)&&void 0!==e?e:()=>{}}set onvisibilitychange(e){this[je].onvisibilitychange&&this.removeEventListener("visibilitychange",this[je].onvisibilitychange),this[je].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!==(e=this[je].onframeratechange)&&void 0!==e?e:()=>{}}set onframeratechange(e){this[je].onframeratechange&&this.removeEventListener("frameratechange",this[je].onframeratechange),this[je].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}class He extends EventTarget{}const Be=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),Ge={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class Qe extends He{constructor(e,t,i={}){if(super(),e[je].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...Ge,...i};this[Be]={session:e,context:t,antialias:n.antialias}}get context(){return this[Be].context}get antialias(){return this[Be].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Be].context.drawingBufferWidth}get framebufferHeight(){return this[Be].context.drawingBufferHeight}getViewport(e){if(e[$].session!==this[Be].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Be].session[je].device[et].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof Ne))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[je].ended?0:1}}const $e=Symbol("@immersive-web-emulation-runtime/action-player");class Ue{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 ke(Le.Viewer,e),o={[U.Left]:new E(a),[U.Right]:new E(a),[U.None]:new E(a)};this[$e]={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:o,vec3:h(),quat:v()},s(this[$e].viewSpaces[U.Left][R].offsetMatrix,p(-i/2,0,0)),s(this[$e].viewSpaces[U.Right][R].offsetMatrix,p(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 E(e);let s;n.hasHand&&(s=new W,Object.values(_).forEach((e=>{s.set(e,new Y(e,a))})));const o=new j(n.handedness,n.targetRayMode,n.profiles,a,r,n.hasGrip?new E(e):void 0,n.hasHand?s:void 0);this[$e].inputSources.set(i,{active:!1,source:o}),this[$e].inputSchemas.set(i,n)}))}play(){this[$e].recordedFramePointer=0,this[$e].playbackTime=this[$e].startingTimeStamp,this[$e].playing=!0,this[$e].actualTimeStamp=performance.now()}stop(){this[$e].playing=!1}get playing(){return this[$e].playing}get viewerSpace(){return this[$e].viewerSpace}get viewSpaces(){return this[$e].viewSpaces}get inputSources(){return Array.from(this[$e].inputSources.values()).filter((e=>e.active)).map((e=>e.source))}playFrame(){const e=performance.now(),t=e-this[$e].actualTimeStamp;if(this[$e].actualTimeStamp=e,this[$e].playbackTime+=t,this[$e].playbackTime>this[$e].endingTimeStamp)return void this.stop();for(;this[$e].frames[this[$e].recordedFramePointer+1][0]<this[$e].playbackTime;)this[$e].recordedFramePointer++;const i=this[$e].frames[this[$e].recordedFramePointer],n=this[$e].frames[this[$e].recordedFramePointer+1],r=(this[$e].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[$e].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[$e].inputSources.forEach((e=>{e.active=!1})),s.forEach(((e,t)=>{this[$e].inputSources.get(t).active=!0;const i=this[$e].inputSources.get(t).source,n=this[$e].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[J].radius=(c-u)*r+u}if(t.hasGamepad){const t=e.gamepad;n.buttons.forEach(((e,n)=>{const a=t.buttons[n];a[V].pressed=1===e[0],a[V].touched=1===e[1];const s=i.buttons[n][2],o=e[2];a[V].value=(o-s)*r+s})),n.axes.forEach(((e,n)=>{const a=i.axes[n];t[V].axesMap[n.toString()].x=(e-a)*r+a}))}}updateXRSpaceFromMergedFrames(e,t,i,n){const r=p(t[0],t[1],t[2]),a=w(t[3],t[4],t[5],t[6]),s=p(i[0],i[1],i[2]),u=w(i[3],i[4],i[5],i[6]);g(this[$e].vec3,r,s,n),y(this[$e].quat,a,u,n),o(e[R].offsetMatrix,this[$e].quat,this[$e].vec3)}processRawInputData(e){const t=e[0],i=this[$e].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 _e 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 Ke=Symbol("@immersive-web-emulation-runtime/xr-system");class We extends EventTarget{constructor(e){super(),this[Ke]={device:e}}isSessionSupported(e){return new Promise(((t,i)=>{e===Xe.Inline?t(!0):t(this[Ke].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[Ke].activeSession)return void n(new DOMException("An active XRSession already exists.","InvalidStateError"));const{requiredFeatures:a=[],optionalFeatures:s=[]}=t,{supportedFeatures:o}=this[Ke].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,Ze.Viewer,Ze.Local])),l=new Ne(this[Ke].device,e,c);this[Ke].activeSession=l,l.addEventListener("end",(()=>{this[Ke].activeSession=void 0})),i(l)})).catch(n)}))}}const Je=Symbol("@immersive-web-emulation-runtime/xr-viewport");class Ye{constructor(e,t,i,n){this[Je]={x:e,y:t,width:i,height:n}}get x(){return this[Je].x}get y(){return this[Je].y}get width(){return this[Je].width}get height(){return this[Je].height}}var Ze;!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"}(Ze||(Ze={}));const et=Symbol("@immersive-web-emulation-runtime/xr-device"),tt={ipd:.063,fovy:Math.PI/2,headsetPosition:new T(0,1.6,0),headsetQuaternion:new P,stereoEnabled:!1};class it{constructor(e,i={}){var n,r,a,u,c,l;const d=new q,h=new ke(Le.Viewer,d),m={[U.Left]:new E(h),[U.Right]:new E(h),[U.None]:new E(h)},f=e.controllerConfig,g={};f&&Object.values(L).forEach((e=>{f.layout[e]&&(g[e]=new Q(f,e,d))}));const v={[L.Left]:new pe(Z,L.Left,d),[L.Right]:new pe(Z,L.Right,d)},x=null!==(n=i.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[et]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,position:null!==(r=i.headsetPosition)&&void 0!==r?r:tt.headsetPosition.clone(),quaternion:null!==(a=i.headsetQuaternion)&&void 0!==a?a:tt.headsetQuaternion.clone(),stereoEnabled:null!==(u=i.stereoEnabled)&&void 0!==u?u:tt.stereoEnabled,ipd:null!==(c=i.ipd)&&void 0!==c?c:tt.ipd,fovy:null!==(l=i.fovy)&&void 0!==l?l:tt.fovy,controllers:g,hands:v,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:Ce.Visible,pendingVisibilityState:null,matrix:t(),globalSpace:d,viewerSpace:h,viewSpaces:m,canvasContainer:x,getViewport:(e,t)=>{const i=e.context.canvas,{width:n,height:r}=i;switch(t.eye){case U.None:return new Ye(0,0,n,r);case U.Left:return new Ye(0,0,this[et].stereoEnabled?n/2:n,r);case U.Right:return new Ye(n/2,0,this[et].stereoEnabled?n/2:0,r)}},updateViews:()=>{o(this[et].viewerSpace[R].offsetMatrix,this[et].quaternion.quat,this[et].position.vec3),s(this[et].viewSpaces[U.Left][R].offsetMatrix,p(-this[et].ipd/2,0,0)),s(this[et].viewSpaces[U.Right][R].offsetMatrix,p(this[et].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;const t=e.context.canvas;t.parentElement!==this[et].canvasContainer&&(this[et].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height},this[et].canvasContainer.appendChild(t),document.body.appendChild(this[et].canvasContainer)),t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[et].canvasData){const{canvas:e,parent:t,width:i,height:n}=this[et].canvasData;e.width=i,e.height=n,t?t.appendChild(e):this[et].canvasContainer.removeChild(e),document.body.removeChild(this[et].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null===(t=this[et].actionPlayer)||void 0===t?void 0:t.playing)this[et].actionPlayer.playFrame();else{const t=e.session;this[et].updateViews(),this[et].pendingVisibilityState&&(this[et].visibilityState=this[et].pendingVisibilityState,this[et].pendingVisibilityState=null,t.dispatchEvent(new De("visibilitychange",{session:t}))),this[et].visibilityState===Ce.Visible&&this.activeInputs.forEach((t=>{t.onFrameStart(e)})),this[et].pendingReferenceSpaceReset&&(t[je].referenceSpaces.forEach((e=>{switch(e[Oe].type){case Le.Local:case Le.LocalFloor:case Le.BoundedFloor:case Le.Unbounded:e.dispatchEvent(new _e("reset",{referenceSpace:e}))}})),this[et].pendingReferenceSpaceReset=!1)}this[et].updateViews()}},this[et].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 We(this),configurable:!0}),e.XRSystem=We,e.XRSession=Ne,e.XRRenderState=ze,e.XRFrame=Te,e.XRSpace=E,e.XRReferenceSpace=ke,e.XRJointSpace=Y,e.XRView=K,e.XRViewport=Ye,e.XRRigidTransform=we,e.XRPose=fe,e.XRViewerPose=Me,e.XRJointPose=ve,e.XRInputSource=j,e.XRInputSourceArray=C,e.XRHand=W,e.XRLayer=He,e.XRWebGLLayer=Qe,e.XRSessionEvent=De,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=Pe,e.XRReferenceSpaceEvent=_e}get supportedSessionModes(){return this[et].supportedSessionModes}get supportedFeatures(){return this[et].supportedFeatures}get supportedFrameRates(){return this[et].supportedFrameRates}get isSystemKeyboardSupported(){return this[et].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[et].internalNominalFrameRate}get stereoEnabled(){return this[et].stereoEnabled}set stereoEnabled(e){this[et].stereoEnabled=e}get ipd(){return this[et].ipd}set ipd(e){this[et].ipd=e}get fovy(){return this[et].fovy}set fovy(e){this[et].fovy=e}get position(){return this[et].position}get quaternion(){return this[et].quaternion}get viewerSpace(){var e;return(null===(e=this[et].actionPlayer)||void 0===e?void 0:e.playing)?this[et].actionPlayer.viewerSpace:this[et].viewerSpace}get viewSpaces(){var e;return(null===(e=this[et].actionPlayer)||void 0===e?void 0:e.playing)?this[et].actionPlayer.viewSpaces:this[et].viewSpaces}get controllers(){return this[et].controllers}get hands(){return this[et].hands}get primaryInputMode(){return this[et].primaryInputMode}set primaryInputMode(e){"controller"===e||"hand"===e?this[et].primaryInputMode=e:console.warn('primary input mode can only be "controller" or "hand"')}get activeInputs(){if(this[et].visibilityState!==Ce.Visible)return[];return("controller"===this[et].primaryInputMode?Object.values(this[et].controllers):Object.values(this[et].hands)).filter((e=>e.connected))}get inputSources(){var e;return(null===(e=this[et].actionPlayer)||void 0===e?void 0:e.playing)?this[et].actionPlayer.inputSources:this.activeInputs.map((e=>e.inputSource))}get canvasContainer(){return this[et].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 P).setFromAxisAngle(new T(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[et].controllers),...Object.values(this[et].hands)].forEach((t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)})),this[et].pendingReferenceSpaceReset=!0}get visibilityState(){return this[et].visibilityState}updateVisibilityState(e){if(!Object.values(Ce).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[et].visibilityState&&(this[et].pendingVisibilityState=e)}createActionPlayer(e,t){return this[et].actionPlayer=new Ue(e,t,this[et].ipd),this[et].actionPlayer}}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:[Xe.Inline,Xe.ImmersiveVR,Xe.ImmersiveAR],supportedFeatures:[Ze.Viewer,Ze.Local,Ze.LocalFloor,Ze.BoundedFloor,Ze.Unbounded,Ze.Anchors,Ze.PlaneDetection,Ze.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72},ct={name:"Meta Quest 2",controllerConfig:at,supportedSessionModes:[Xe.Inline,Xe.ImmersiveVR,Xe.ImmersiveAR],supportedFeatures:[Ze.Viewer,Ze.Local,Ze.LocalFloor,Ze.BoundedFloor,Ze.Unbounded,Ze.Anchors,Ze.PlaneDetection,Ze.MeshDetection,Ze.HitTest,Ze.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72},lt={name:"Meta Quest Pro",controllerConfig:st,supportedSessionModes:[Xe.Inline,Xe.ImmersiveVR,Xe.ImmersiveAR],supportedFeatures:[Ze.Viewer,Ze.Local,Ze.LocalFloor,Ze.BoundedFloor,Ze.Unbounded,Ze.Anchors,Ze.PlaneDetection,Ze.MeshDetection,Ze.HitTest,Ze.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90},dt={name:"Meta Quest 3",controllerConfig:ot,supportedSessionModes:[Xe.Inline,Xe.ImmersiveVR,Xe.ImmersiveAR],supportedFeatures:[Ze.Viewer,Ze.Local,Ze.LocalFloor,Ze.BoundedFloor,Ze.Unbounded,Ze.Anchors,Ze.PlaneDetection,Ze.MeshDetection,Ze.HitTest,Ze.HandTracking,Ze.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};class mt{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:u(h(),n),quaternion:l(v(),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:u(h(),o),quaternion:l(v(),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=u(h(),r),t=l(v(),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=u(h(),i),s=l(v(),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))}}export{mt as ActionRecorder,it as XRDevice,Te as XRFrame,W as XRHand,j as XRInputSource,C as XRInputSourceArray,N as XRInputSourceEvent,Pe as XRInputSourcesChangeEvent,ve as XRJointPose,Y as XRJointSpace,He as XRLayer,fe as XRPose,ke as XRReferenceSpace,_e as XRReferenceSpaceEvent,ze as XRRenderState,we as XRRigidTransform,Ne as XRSession,De as XRSessionEvent,E as XRSpace,We as XRSystem,K as XRView,Me as XRViewerPose,Ye as XRViewport,Qe as XRWebGLLayer,ct as metaQuest2,dt as metaQuest3,lt as metaQuestPro,ut as oculusQuest1};
@@ -0,0 +1,75 @@
1
+ import { XRInputSource } from '../input/XRInputSource';
2
+ import { XRReferenceSpace } from '../spaces/XRReferenceSpace';
3
+ import { XRSpace } from '../spaces/XRSpace';
4
+ import { quat, vec3 } from 'gl-matrix';
5
+ import { InputSchema } from './ActionRecorder';
6
+ import { XREye } from '../views/XRView';
7
+ export interface CompressedRecording {
8
+ schema: {
9
+ 0: number;
10
+ 1: InputSchema;
11
+ }[];
12
+ frames: any[];
13
+ }
14
+ export declare const PRIVATE: unique symbol;
15
+ type ProcessedInputData = {
16
+ targetRayTransform: number[];
17
+ gripTransform?: number[];
18
+ handTransforms?: any[];
19
+ buttons?: {
20
+ 0: 0 | 1;
21
+ 1: 0 | 1;
22
+ 2: number;
23
+ }[];
24
+ axes?: number[];
25
+ };
26
+ export declare class ActionPlayer {
27
+ [PRIVATE]: {
28
+ refSpace: XRReferenceSpace;
29
+ inputSources: Map<number, {
30
+ active: boolean;
31
+ source: XRInputSource;
32
+ }>;
33
+ inputSchemas: Map<number, InputSchema>;
34
+ frames: any[];
35
+ recordedFramePointer: number;
36
+ startingTimeStamp: DOMHighResTimeStamp;
37
+ endingTimeStamp: DOMHighResTimeStamp;
38
+ playbackTime: DOMHighResTimeStamp;
39
+ actualTimeStamp?: DOMHighResTimeStamp;
40
+ playing: boolean;
41
+ viewerSpace: XRReferenceSpace;
42
+ viewSpaces: {
43
+ [key in XREye]: XRSpace;
44
+ };
45
+ vec3: vec3;
46
+ quat: quat;
47
+ };
48
+ constructor(refSpace: XRReferenceSpace, recording: {
49
+ schema: {
50
+ 0: number;
51
+ 1: InputSchema;
52
+ }[];
53
+ frames: any[];
54
+ }, ipd: number);
55
+ play(): void;
56
+ stop(): void;
57
+ get playing(): boolean;
58
+ get viewerSpace(): XRReferenceSpace;
59
+ get viewSpaces(): {
60
+ none: XRSpace;
61
+ left: XRSpace;
62
+ right: XRSpace;
63
+ };
64
+ get inputSources(): XRInputSource[];
65
+ playFrame(): void;
66
+ updateInputSource(inputSource: XRInputSource, schema: InputSchema, lastInputData: ProcessedInputData, nextInputData: ProcessedInputData, alpha: number): void;
67
+ updateXRSpaceFromMergedFrames(space: XRSpace, lastTransform: number[], nextTransform: number[], alpha: number): void;
68
+ processRawInputData(inputDataRaw: any[]): {
69
+ index: any;
70
+ inputData: ProcessedInputData;
71
+ };
72
+ }
73
+ export declare const mergeTransform: (f1: number[], f2: number[], alpha: number, position: vec3, quaternion: quat) => void;
74
+ export {};
75
+ //# sourceMappingURL=ActionPlayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionPlayer.d.ts","sourceRoot":"","sources":["../../src/action/ActionPlayer.ts"],"names":[],"mappings":"AASA,OAAO,EAEN,aAAa,EAEb,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EACN,gBAAgB,EAEhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAA8B,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAQ,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE;QACP,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,WAAW,CAAC;KACf,EAAE,CAAC;IACJ,MAAM,EAAE,GAAG,EAAE,CAAC;CACd;AAED,eAAO,MAAM,OAAO,eAA2D,CAAC;AAEhF,KAAK,kBAAkB,GAAG;IACzB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE;QAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,qBAAa,YAAY;IACxB,CAAC,OAAO,CAAC,EAAE;QACV,QAAQ,EAAE,gBAAgB,CAAC;QAC3B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE,OAAO,CAAC;YA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AE,SACL,MAAM,YACH,IAAI,cACF,IAAI,SAQhB,CAAC"}
@@ -0,0 +1,206 @@
1
+ import { PRIVATE as GAMEPAD_PRIVATE, Gamepad, } from '../gamepad/Gamepad';
2
+ import { XRHand, XRHandJoint } from '../input/XRHand';
3
+ import { XRInputSource, } from '../input/XRInputSource';
4
+ import { PRIVATE as XRJOINTSPACE_PRIVATE, XRJointSpace, } from '../spaces/XRJointSpace';
5
+ import { XRReferenceSpace, XRReferenceSpaceType, } from '../spaces/XRReferenceSpace';
6
+ import { PRIVATE as XRSPACE_PRIVATE, XRSpace } from '../spaces/XRSpace';
7
+ import { mat4, quat, vec3 } from 'gl-matrix';
8
+ import { XREye } from '../views/XRView';
9
+ export const PRIVATE = Symbol('@immersive-web-emulation-runtime/action-player');
10
+ export class ActionPlayer {
11
+ constructor(refSpace, recording, ipd) {
12
+ const { schema, frames } = recording;
13
+ if (!frames || !schema || frames.length === 0) {
14
+ throw new DOMException('wrong recording format', 'NotSupportedError');
15
+ }
16
+ const viewerSpace = new XRReferenceSpace(XRReferenceSpaceType.Viewer, refSpace);
17
+ const viewSpaces = {
18
+ [XREye.Left]: new XRSpace(viewerSpace),
19
+ [XREye.Right]: new XRSpace(viewerSpace),
20
+ [XREye.None]: new XRSpace(viewerSpace),
21
+ };
22
+ this[PRIVATE] = {
23
+ refSpace,
24
+ inputSources: new Map(),
25
+ inputSchemas: new Map(),
26
+ frames,
27
+ recordedFramePointer: 0,
28
+ startingTimeStamp: frames[0][0],
29
+ endingTimeStamp: frames[frames.length - 1][0],
30
+ playbackTime: frames[0][0],
31
+ playing: false,
32
+ viewerSpace,
33
+ viewSpaces,
34
+ vec3: vec3.create(),
35
+ quat: quat.create(),
36
+ };
37
+ mat4.fromTranslation(this[PRIVATE].viewSpaces[XREye.Left][XRSPACE_PRIVATE].offsetMatrix, vec3.fromValues(-ipd / 2, 0, 0));
38
+ mat4.fromTranslation(this[PRIVATE].viewSpaces[XREye.Right][XRSPACE_PRIVATE].offsetMatrix, vec3.fromValues(ipd / 2, 0, 0));
39
+ schema.forEach((schemaEntry) => {
40
+ const index = schemaEntry[0];
41
+ const schema = schemaEntry[1];
42
+ let gamepad;
43
+ if (schema.hasGamepad) {
44
+ const buttons = [];
45
+ for (let i = 0; i < schema.numButtons; i++) {
46
+ buttons.push({ id: i.toString(), type: 'manual' });
47
+ }
48
+ const axes = [];
49
+ for (let i = 0; i < schema.numAxes; i++) {
50
+ axes.push({ id: i.toString(), type: 'manual' });
51
+ }
52
+ gamepad = new Gamepad({
53
+ mapping: schema.mapping,
54
+ buttons,
55
+ axes,
56
+ });
57
+ }
58
+ const targetRaySpace = new XRSpace(refSpace);
59
+ let hand = undefined;
60
+ if (schema.hasHand) {
61
+ hand = new XRHand();
62
+ Object.values(XRHandJoint).forEach((jointName) => {
63
+ hand.set(jointName, new XRJointSpace(jointName, targetRaySpace));
64
+ });
65
+ }
66
+ const inputSource = new XRInputSource(schema.handedness, schema.targetRayMode, schema.profiles, targetRaySpace, gamepad, schema.hasGrip ? new XRSpace(refSpace) : undefined, schema.hasHand ? hand : undefined);
67
+ this[PRIVATE].inputSources.set(index, {
68
+ active: false,
69
+ source: inputSource,
70
+ });
71
+ this[PRIVATE].inputSchemas.set(index, schema);
72
+ });
73
+ }
74
+ play() {
75
+ this[PRIVATE].recordedFramePointer = 0;
76
+ this[PRIVATE].playbackTime = this[PRIVATE].startingTimeStamp;
77
+ this[PRIVATE].playing = true;
78
+ this[PRIVATE].actualTimeStamp = performance.now();
79
+ }
80
+ stop() {
81
+ this[PRIVATE].playing = false;
82
+ }
83
+ get playing() {
84
+ return this[PRIVATE].playing;
85
+ }
86
+ get viewerSpace() {
87
+ return this[PRIVATE].viewerSpace;
88
+ }
89
+ get viewSpaces() {
90
+ return this[PRIVATE].viewSpaces;
91
+ }
92
+ get inputSources() {
93
+ return Array.from(this[PRIVATE].inputSources.values())
94
+ .filter((wrapper) => wrapper.active)
95
+ .map((wrapper) => wrapper.source);
96
+ }
97
+ playFrame() {
98
+ const now = performance.now();
99
+ const delta = now - this[PRIVATE].actualTimeStamp;
100
+ this[PRIVATE].actualTimeStamp = now;
101
+ this[PRIVATE].playbackTime += delta;
102
+ if (this[PRIVATE].playbackTime > this[PRIVATE].endingTimeStamp) {
103
+ this.stop();
104
+ return;
105
+ }
106
+ while (this[PRIVATE].frames[this[PRIVATE].recordedFramePointer + 1][0] < this[PRIVATE].playbackTime) {
107
+ this[PRIVATE].recordedFramePointer++;
108
+ }
109
+ const lastFrameData = this[PRIVATE].frames[this[PRIVATE].recordedFramePointer];
110
+ const nextFrameData = this[PRIVATE].frames[this[PRIVATE].recordedFramePointer + 1];
111
+ const alpha = (this[PRIVATE].playbackTime - lastFrameData[0]) /
112
+ (nextFrameData[0] - lastFrameData[0]);
113
+ this.updateXRSpaceFromMergedFrames(this[PRIVATE].viewerSpace, lastFrameData.slice(1, 8), nextFrameData.slice(1, 8), alpha);
114
+ const lastFrameInputs = new Map();
115
+ for (let i = 8; i < lastFrameData.length; i++) {
116
+ const { index, inputData } = this.processRawInputData(lastFrameData[i]);
117
+ lastFrameInputs.set(index, inputData);
118
+ }
119
+ const nextFrameInputs = new Map();
120
+ for (let i = 8; i < nextFrameData.length; i++) {
121
+ const { index, inputData } = this.processRawInputData(nextFrameData[i]);
122
+ nextFrameInputs.set(index, inputData);
123
+ }
124
+ this[PRIVATE].inputSources.forEach((sourceWrapper) => {
125
+ sourceWrapper.active = false;
126
+ });
127
+ nextFrameInputs.forEach((inputData, index) => {
128
+ this[PRIVATE].inputSources.get(index).active = true;
129
+ const inputSource = this[PRIVATE].inputSources.get(index).source;
130
+ const schema = this[PRIVATE].inputSchemas.get(index);
131
+ this.updateInputSource(inputSource, schema, lastFrameInputs.has(index) ? lastFrameInputs.get(index) : inputData, inputData, alpha);
132
+ });
133
+ }
134
+ updateInputSource(inputSource, schema, lastInputData, nextInputData, alpha) {
135
+ this.updateXRSpaceFromMergedFrames(inputSource.targetRaySpace, lastInputData.targetRayTransform, nextInputData.targetRayTransform, alpha);
136
+ if (schema.hasGrip) {
137
+ this.updateXRSpaceFromMergedFrames(inputSource.gripSpace, lastInputData.gripTransform, nextInputData.gripTransform, alpha);
138
+ }
139
+ if (schema.hasHand) {
140
+ for (let i = 0; i < 25; i++) {
141
+ const lastTransformArray = lastInputData.handTransforms.slice(i * 8, i * 8 + 7);
142
+ const nextTransformArray = nextInputData.handTransforms.slice(i * 8, i * 8 + 7);
143
+ const lastRadius = lastInputData.handTransforms[i * 8 + 7];
144
+ const nextRadius = nextInputData.handTransforms[i * 8 + 7];
145
+ const jointSpace = inputSource.hand.get(schema.jointSequence[i]);
146
+ this.updateXRSpaceFromMergedFrames(jointSpace, lastTransformArray, nextTransformArray, alpha);
147
+ jointSpace[XRJOINTSPACE_PRIVATE].radius =
148
+ (nextRadius - lastRadius) * alpha + lastRadius;
149
+ }
150
+ }
151
+ if (schema.hasGamepad) {
152
+ const gamepad = inputSource.gamepad;
153
+ nextInputData.buttons.forEach((states, index) => {
154
+ const gamepadButton = gamepad.buttons[index];
155
+ gamepadButton[GAMEPAD_PRIVATE].pressed = states[0] === 1 ? true : false;
156
+ gamepadButton[GAMEPAD_PRIVATE].touched = states[1] === 1 ? true : false;
157
+ const lastValue = lastInputData.buttons[index][2];
158
+ const nextValue = states[2];
159
+ gamepadButton[GAMEPAD_PRIVATE].value =
160
+ (nextValue - lastValue) * alpha + lastValue;
161
+ });
162
+ nextInputData.axes.forEach((nextValue, index) => {
163
+ const lastValue = lastInputData.axes[index];
164
+ gamepad[GAMEPAD_PRIVATE].axesMap[index.toString()].x =
165
+ (nextValue - lastValue) * alpha + lastValue;
166
+ });
167
+ }
168
+ }
169
+ updateXRSpaceFromMergedFrames(space, lastTransform, nextTransform, alpha) {
170
+ const f1p = vec3.fromValues(lastTransform[0], lastTransform[1], lastTransform[2]);
171
+ const f1q = quat.fromValues(lastTransform[3], lastTransform[4], lastTransform[5], lastTransform[6]);
172
+ const f2p = vec3.fromValues(nextTransform[0], nextTransform[1], nextTransform[2]);
173
+ const f2q = quat.fromValues(nextTransform[3], nextTransform[4], nextTransform[5], nextTransform[6]);
174
+ vec3.lerp(this[PRIVATE].vec3, f1p, f2p, alpha);
175
+ quat.slerp(this[PRIVATE].quat, f1q, f2q, alpha);
176
+ mat4.fromRotationTranslation(space[XRSPACE_PRIVATE].offsetMatrix, this[PRIVATE].quat, this[PRIVATE].vec3);
177
+ }
178
+ processRawInputData(inputDataRaw) {
179
+ const index = inputDataRaw[0];
180
+ const schema = this[PRIVATE].inputSchemas.get(index);
181
+ const targetRayTransform = inputDataRaw.slice(1, 8);
182
+ const inputData = { targetRayTransform };
183
+ let dataCounter = 8;
184
+ if (schema.hasGrip) {
185
+ inputData.gripTransform = inputDataRaw[dataCounter++];
186
+ }
187
+ if (schema.hasHand) {
188
+ inputData.handTransforms = inputDataRaw[dataCounter++];
189
+ }
190
+ if (schema.hasGamepad) {
191
+ const gamepadData = inputDataRaw[dataCounter];
192
+ inputData.buttons = gamepadData.slice(0, schema.numButtons);
193
+ inputData.axes = gamepadData.slice(schema.numButtons);
194
+ }
195
+ return { index, inputData };
196
+ }
197
+ }
198
+ export const mergeTransform = (f1, f2, alpha, position, quaternion) => {
199
+ const f1p = vec3.fromValues(f1[0], f1[1], f1[2]);
200
+ const f1q = quat.fromValues(f1[3], f1[4], f1[5], f1[6]);
201
+ const f2p = vec3.fromValues(f2[0], f2[1], f2[2]);
202
+ const f2q = quat.fromValues(f2[3], f2[4], f2[5], f2[6]);
203
+ vec3.lerp(position, f1p, f2p, alpha);
204
+ quat.slerp(quaternion, f1q, f2q, alpha);
205
+ };
206
+ //# sourceMappingURL=ActionPlayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionPlayer.js","sourceRoot":"","sources":["../../src/action/ActionPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,OAAO,IAAI,eAAe,EAC1B,OAAO,GAGP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAA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AAC,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /// <reference types="webxr" />
2
+ import { quat, vec3 } from 'gl-matrix';
3
+ export declare const PRIVATE: unique symbol;
4
+ export interface InputFrame {
5
+ index: number;
6
+ targetRayTransform: {
7
+ position: vec3;
8
+ quaternion: quat;
9
+ };
10
+ gripTransform?: {
11
+ position: vec3;
12
+ quaternion: quat;
13
+ };
14
+ hand?: {
15
+ [joint in XRHandJoint]: {
16
+ position: vec3;
17
+ quaternion: quat;
18
+ radius: number;
19
+ };
20
+ };
21
+ gamepad?: {
22
+ buttons: (number[] | null)[];
23
+ axes: (number | null)[];
24
+ };
25
+ }
26
+ export interface InputSchema {
27
+ handedness: XRHandedness;
28
+ targetRayMode: XRTargetRayMode;
29
+ profiles: string[];
30
+ hasGrip: boolean;
31
+ hasHand: boolean;
32
+ jointSequence?: XRHandJoint[];
33
+ hasGamepad: boolean;
34
+ mapping?: GamepadMappingType;
35
+ numButtons?: number;
36
+ numAxes?: number;
37
+ }
38
+ export interface ActionFrame {
39
+ timeStamp: DOMHighResTimeStamp;
40
+ position: vec3;
41
+ quaternion: quat;
42
+ inputFrames: InputFrame[];
43
+ }
44
+ export declare class ActionRecorder {
45
+ [PRIVATE]: {
46
+ session: XRSession;
47
+ refSpace: XRReferenceSpace;
48
+ inputMap: Map<XRInputSource, number>;
49
+ schemaMap: Map<number, InputSchema>;
50
+ compressedFrames: any[];
51
+ jointRadii: Float32Array;
52
+ jointTransforms: Float32Array;
53
+ };
54
+ constructor(session: XRSession, refSpace: XRReferenceSpace);
55
+ recordFrame(frame: XRFrame): void;
56
+ compressActionFrame(af: ActionFrame): any[];
57
+ log(): void;
58
+ }
59
+ //# sourceMappingURL=ActionRecorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionRecorder.d.ts","sourceRoot":"","sources":["../../src/action/ActionRecorder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAQ,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE7C,eAAO,MAAM,OAAO,eAEnB,CAAC;AAEF,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE;QACnB,QAAQ,EAAE,IAAI,CAAC;QACf,UAAU,EAAE,IAAI,CAAC;KACjB,CAAC;IACF,aAAa,CAAC,EAAE;QACf,QAAQ,EAAE,IAAI,CAAC;QACf,UAAU,EAAE,IAAI,CAAC;KACjB,CAAC;IACF,IAAI,CAAC,EAAE;SACL,KAAK,IAAI,WAAW,GAAG;YACvB,QAAQ,EAAE,IAAI,CAAC;YACf,UAAU,EAAE,IAAI,CAAC;YACjB,MAAM,EAAE,MAAM,CAAC;SACf;KACD,CAAC;IACF,OAAO,CAAC,EAAE;QACT,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAC7B,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;KACxB,CAAC;CACF;AAED,MAAM,WAAW,WAAW;IAC3B,UAAU,EAAE,YAAY,CAAC;IACzB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE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