iwer 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/iwer.js CHANGED
@@ -3366,6 +3366,7 @@
3366
3366
  const currInputs = this[PRIVATE$6].device.inputSources.filter((inputSource) => !inputSource.hand || handTrackingOn);
3367
3367
  const added = currInputs.filter((item) => !prevInputs.includes(item));
3368
3368
  const removed = prevInputs.filter((item) => !currInputs.includes(item));
3369
+ this[PRIVATE$6].activeInputSources = currInputs;
3369
3370
  if (added.length > 0 || removed.length > 0) {
3370
3371
  this.dispatchEvent(new XRInputSourcesChangeEvent('inputsourceschange', {
3371
3372
  session: this,
@@ -3373,7 +3374,6 @@
3373
3374
  removed,
3374
3375
  }));
3375
3376
  }
3376
- this[PRIVATE$6].activeInputSources = currInputs;
3377
3377
  },
3378
3378
  onend: null,
3379
3379
  oninputsourceschange: null,
@@ -4006,7 +4006,7 @@
4006
4006
  }
4007
4007
  }
4008
4008
 
4009
- const VERSION = "1.0.2";
4009
+ const VERSION = "1.0.3";
4010
4010
 
4011
4011
  /**
4012
4012
  * Copyright (c) Meta Platforms, Inc. and affiliates.
package/build/iwer.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).IWER={})}(this,(function(e){"use strict";var t="undefined"!=typeof Float32Array?Float32Array:Array;function i(){var e=new t(16);return t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function n(e){var i=new t(16);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function r(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function a(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=t[4],o=t[5],u=t[6],l=t[7],c=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*l-a*s,w=n*u-r*o,b=n*l-a*o,M=r*l-a*u,R=c*f-d*m,F=c*g-h*m,E=c*v-p*m,I=d*g-h*f,q=d*v-p*f,T=h*v-p*g,V=x*T-y*q+S*I+w*E-b*F+M*R;return V?(V=1/V,e[0]=(o*T-u*q+l*I)*V,e[1]=(r*q-n*T-a*I)*V,e[2]=(f*M-g*b+v*w)*V,e[3]=(h*b-d*M-p*w)*V,e[4]=(u*E-s*T-l*F)*V,e[5]=(i*T-r*E+a*F)*V,e[6]=(g*S-m*M-v*y)*V,e[7]=(c*M-h*S+p*y)*V,e[8]=(s*q-o*E+l*R)*V,e[9]=(n*E-i*q-a*R)*V,e[10]=(m*b-f*S+v*x)*V,e[11]=(d*S-c*b-p*x)*V,e[12]=(o*F-s*I-u*R)*V,e[13]=(i*I-n*F+r*R)*V,e[14]=(f*y-m*w-g*x)*V,e[15]=(c*w-d*y+h*x)*V,e):null}function s(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=t[4],u=t[5],l=t[6],c=t[7],d=t[8],h=t[9],p=t[10],m=t[11],f=t[12],g=t[13],v=t[14],x=t[15],y=i[0],S=i[1],w=i[2],b=i[3];return e[0]=y*n+S*o+w*d+b*f,e[1]=y*r+S*u+w*h+b*g,e[2]=y*a+S*l+w*p+b*v,e[3]=y*s+S*c+w*m+b*x,y=i[4],S=i[5],w=i[6],b=i[7],e[4]=y*n+S*o+w*d+b*f,e[5]=y*r+S*u+w*h+b*g,e[6]=y*a+S*l+w*p+b*v,e[7]=y*s+S*c+w*m+b*x,y=i[8],S=i[9],w=i[10],b=i[11],e[8]=y*n+S*o+w*d+b*f,e[9]=y*r+S*u+w*h+b*g,e[10]=y*a+S*l+w*p+b*v,e[11]=y*s+S*c+w*m+b*x,y=i[12],S=i[13],w=i[14],b=i[15],e[12]=y*n+S*o+w*d+b*f,e[13]=y*r+S*u+w*h+b*g,e[14]=y*a+S*l+w*p+b*v,e[15]=y*s+S*c+w*m+b*x,e}function o(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function u(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=n+n,u=r+r,l=a+a,c=n*o,d=n*u,h=n*l,p=r*u,m=r*l,f=a*l,g=s*o,v=s*u,x=s*l;return e[0]=1-(p+f),e[1]=d+x,e[2]=h-v,e[3]=0,e[4]=d-x,e[5]=1-(c+f),e[6]=m+g,e[7]=0,e[8]=h+v,e[9]=m-g,e[10]=1-(c+p),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function l(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],l=t[9],c=t[10];return e[0]=Math.hypot(i,n,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(u,l,c),e}function d(e,i){var n=new t(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),e[3]=.25*x,e[0]=(p-f)/x,e[1]=(m-l)/x,e[2]=(u-d)/x):o>h&&o>g?(x=2*Math.sqrt(1+o-h-g),e[3]=(p-f)/x,e[0]=.25*x,e[1]=(u+d)/x,e[2]=(m+l)/x):h>g?(x=2*Math.sqrt(1+h-o-g),e[3]=(m-l)/x,e[0]=(u+d)/x,e[1]=.25*x,e[2]=(p+f)/x):(x=2*Math.sqrt(1+g-o-h),e[3]=(u-d)/x,e[0]=(m+l)/x,e[1]=(p+f)/x,e[2]=.25*x),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var h=function(e,t,i,n,r){var a,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(a=1/(n-r),e[10]=(r+n)*a,e[14]=2*r*n*a):(e[10]=-1,e[14]=-2*n),e};function p(){var e=new t(3);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function m(e,i,n){var r=new t(3);return r[0]=e,r[1]=i,r[2]=n,r}function f(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function g(e,t){var i=t[0],n=t[1],r=t[2],a=i*i+n*n+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function v(e,t,i,n){var r=t[0],a=t[1],s=t[2];return e[0]=r+n*(i[0]-r),e[1]=a+n*(i[1]-a),e[2]=s+n*(i[2]-s),e}function x(){var e=new t(4);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function y(e,t,i){i*=.5;var n=Math.sin(i);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(i),e}function S(e,t,i,n){var r,a,s,o,u,l=t[0],c=t[1],d=t[2],h=t[3],p=i[0],m=i[1],f=i[2],g=i[3];return(a=l*p+c*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*l+u*p,e[1]=o*c+u*m,e[2]=o*d+u*f,e[3]=o*h+u*g,e}p(),function(){var e,i=(e=new t(4),t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();var w,b=function(e,i,n,r){var a=new t(4);return a[0]=e,a[1]=i,a[2]=n,a[3]=r,a},M=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},R=function(e,t,i,n,r){return e[0]=t,e[1]=i,e[2]=n,e[3]=r,e},F=function(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=i*i+n*n+r*r+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=n*s,e[2]=r*s,e[3]=a*s,e};p(),m(1,0,0),m(0,1,0),x(),x(),w=new t(9),t!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1;const E=Symbol("@immersive-web-emulation-runtime/xr-space");class I extends EventTarget{constructor(e,t){super(),this[E]={parentSpace:e,offsetMatrix:t?n(t):i(),emulated:!0}}}class q extends I{constructor(){super(void 0,i())}}class T{static updateOffsetPosition(e,t){o(e[E].offsetMatrix,t)}static updateOffsetQuaternion(e,t){const i=e[E].offsetMatrix,n=p();l(n,i),u(i,t,n)}static updateOffsetMatrix(e,t){r(e[E].offsetMatrix,t)}static calculateGlobalOffsetMatrix(e,t=i()){return s(t,e[E].parentSpace?T.calculateGlobalOffsetMatrix(e[E].parentSpace):i(),e[E].offsetMatrix),t}}class V{constructor(e=0,t=0,i=0){this.vec3=m(e,t,i),this.tempVec3=p()}get x(){return this.vec3[0]}set x(e){this.vec3[0]=e}get y(){return this.vec3[1]}set y(e){this.vec3[1]=e}get z(){return this.vec3[2]}set z(e){this.vec3[2]=e}set(e,t,i){return function(e,t,i,n){e[0]=t,e[1]=i,e[2]=n}(this.vec3,e,t,i),this}clone(){return new V(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 f(this.tempVec3,this.vec3),g(this.vec3,this.tempVec3),this}add(e){return f(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 f(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],l=t[2],c=r*l-a*u,d=a*o-n*l,h=n*u-r*o,p=r*h-a*d,m=a*c-n*h,f=n*d-r*c,g=2*s;c*=g,d*=g,h*=g,p*=2,m*=2,f*=2,e[0]=o+c+p,e[1]=u+d+m,e[2]=l+h+f}(this.vec3,this.tempVec3,e.quat),this}}class P{constructor(e=0,t=0,i=0,n=1){this.quat=b(e,t,i,n),this.tempQuat=x()}get x(){return this.quat[0]}set x(e){this.quat[0]=e}get y(){return this.quat[1]}set y(e){this.quat[1]=e}get z(){return this.quat[2]}set z(e){this.quat[2]=e}get w(){return this.quat[3]}set w(e){this.quat[3]=e}set(e,t,i,n){return R(this.quat,e,t,i,n),this}clone(){return new P(this.x,this.y,this.z,this.w)}copy(e){return R(this.quat,e.x,e.y,e.z,e.w),this}normalize(){return M(this.tempQuat,this.quat),F(this.quat,this.tempQuat),this}invert(){return M(this.tempQuat,this.quat),function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this.quat,this.tempQuat),this}multiply(e){return M(this.tempQuat,this.quat),function(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=i[0],u=i[1],l=i[2],c=i[3];e[0]=n*c+s*o+r*l-a*u,e[1]=r*c+s*u+a*o-n*l,e[2]=a*c+s*l+n*u-r*o,e[3]=s*c-n*o-r*u-a*l}(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return y(this.quat,e.vec3,t),this}}const L=Symbol("@immersive-web-emulation-runtime/gamepad");var O,A,k;!function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"}(O||(O={}));class X{constructor(e,t){this[L]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[L].type?this[L].pressed:this[L].value>0}get touched(){return"manual"===this[L].type?this[L].touched:this[L].touched||this.pressed}get value(){return this[L].value}}class z{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class D{constructor(e,t="",i=-1){this[L]={id:t,index:i,connected:!1,timestamp:performance.now(),mapping:e.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},e.buttons.forEach((e=>{var t;null===e?this[L].buttonsSequence.push(null):(this[L].buttonsSequence.push(e.id),this[L].buttonsMap[e.id]=new X(e.type,null!==(t=e.eventTrigger)&&void 0!==t?t:null))})),e.axes.forEach((e=>{null===e?this[L].axesSequence.push(null):(this[L].axesSequence.push(e.id+e.type),this[L].axesMap[e.id]||(this[L].axesMap[e.id]={x:0,y:0}))}))}get id(){return this[L].id}get index(){return this[L].index}get connected(){return this[L].connected}get timestamp(){return this[L].timestamp}get mapping(){return this[L].mapping}get axes(){const e=[];return this[L].axesSequence.forEach((t=>{if(null===t)e.push(null);else{const i=t.substring(0,t.length-6),n=t.substring(t.length-6);e.push("y-axis"===n?this[L].axesMap[i].y:this[L].axesMap[i].x)}})),e}get buttons(){return this[L].buttonsSequence.map((e=>null===e?new z:this[L].buttonsMap[e]))}get hapticActuators(){return this[L].hapticActuators}get vibrationActuator(){return null}}!function(e){e.None="none",e.Left="left",e.Right="right"}(A||(A={})),function(e){e.Gaze="gaze",e.TrackedPointer="tracked-pointer",e.Screen="screen",e.TransientPointer="transient-pointer"}(k||(k={}));class C extends Array{}const j=Symbol("@immersive-web-emulation-runtime/xr-input-source");class H{constructor(e,t,i,n,r,a,s){this[j]={handedness:e,targetRayMode:t,targetRaySpace:n,gripSpace:a,profiles:i,gamepad:r,hand:s}}get handedness(){return this[j].handedness}get targetRayMode(){return this[j].targetRayMode}get targetRaySpace(){return this[j].targetRaySpace}get gripSpace(){return this[j].gripSpace}get profiles(){return this[j].profiles}get gamepad(){return this[j].gamepad}get hand(){return this[j].hand}}class N extends Event{constructor(e,t){if(super(e,t),!t.frame)throw new Error("XRInputSourceEventInit.frame is required");if(!t.inputSource)throw new Error("XRInputSourceEventInit.inputSource is required");this.frame=t.frame,this.inputSource=t.inputSource}}const B=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),G={[A.Left]:{position:new V(-.25,1.5,-.4),quaternion:new P},[A.Right]:{position:new V(.25,1.5,-.4),quaternion:new P},[A.None]:{position:new V(.25,1.5,-.4),quaternion:new P}};class Q{constructor(e){this[B]={inputSource:e,position:G[e.handedness].position.clone(),quaternion:G[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[B].position}get quaternion(){return this[B].quaternion}get inputSource(){return this[B].inputSource}get connected(){return this[B].connected}set connected(e){this[B].connected=e,this[B].inputSource.gamepad[L].connected=e}onFrameStart(e){u(this[B].inputSource.targetRaySpace[E].offsetMatrix,this[B].quaternion.quat,this[B].position.vec3);const t=e.session;this[B].inputSource.gamepad.buttons.forEach((i=>{i instanceof X&&(i[L].lastFrameValue=i[L].value,null!=i[L].pendingValue&&(i[L].value=i[L].pendingValue,i[L].pendingValue=null),null!=i[L].eventTrigger&&(0===i[L].lastFrameValue&&i[L].value>0?(t.dispatchEvent(new N(i[L].eventTrigger,{frame:e,inputSource:this[B].inputSource})),t.dispatchEvent(new N(i[L].eventTrigger+"start",{frame:e,inputSource:this[B].inputSource}))):i[L].lastFrameValue>0&&0===i[L].value&&t.dispatchEvent(new N(i[L].eventTrigger+"end",{frame:e,inputSource:this[B].inputSource}))))})),this[B].inputSourceChanged=this.connected!==this[B].lastFrameConnected,this[B].lastFrameConnected=this.connected}}const K=Symbol("@immersive-web-emulation-runtime/xr-controller");class _ extends Q{constructor(e,t,i){if(!e.layout[t])throw new DOMException("Handedness not supported","InvalidStateError");const n=new I(i),r=e.layout[t].gripOffsetMatrix?new I(n,e.layout[t].gripOffsetMatrix):void 0,a=[e.profileId,...e.fallbackProfileIds];super(new H(t,k.TrackedPointer,a,n,new D(e.layout[t].gamepad),r)),this[K]={gamepadConfig:e.layout[t].gamepad}}get gamepadConfig(){return this[K].gamepadConfig}updateButtonValue(e,t){if(t>1||t<0)return void console.warn(`Out-of-range value ${t} provided for button ${e}.`);const i=this[B].inputSource.gamepad[L].buttonsMap[e];if(i){if("binary"===i[L].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[L].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[B].inputSource.gamepad[L].buttonsMap[e];i?i[L].touched=t:console.warn(`Current controller does not have button ${e}.`)}updateAxis(e,t,i){if(i>1||i<-1)return void console.warn(`Out-of-range value ${i} provided for ${e} axes.`);const n=this[B].inputSource.gamepad[L].axesMap[e];n?"x-axis"===t?n.x=i:"y-axis"===t&&(n.y=i):console.warn(`Current controller does not have ${e} axes.`)}updateAxes(e,t,i){if(t>1||t<-1||i>1||i<-1)return void console.warn(`Out-of-range value x:${t}, y:${i} provided for ${e} axes.`);const n=this[B].inputSource.gamepad[L].axesMap[e];n?(n.x=t,n.y=i):console.warn(`Current controller does not have ${e} axes.`)}}const $=Symbol("@immersive-web-emulation-runtime/xr-view");var U,W;!function(e){e.None="none",e.Left="left",e.Right="right"}(U||(U={}));class J{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"}(W||(W={}));class Y extends Map{}const Z=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class ee extends I{constructor(e,t,i){super(t,i),this[Z]={jointName:e,radius:0}}get jointName(){return this[Z].jointName}}const te={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]}}},ie={mapping:O.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},ne=p(),re=x(),ae=p(),se=p(),oe=x(),ue=p(),le=p(),ce=x(),de=p(),he=(e,t,i,n)=>(l(ne,t),d(re,t),c(ae,t),l(se,i),d(oe,i),c(ue,i),v(le,ne,se,n),S(ce,re,oe,n),v(de,ae,ue,n),function(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=t[3],u=r+r,l=a+a,c=s+s,d=r*u,h=r*l,p=r*c,m=a*l,f=a*c,g=s*c,v=o*u,x=o*l,y=o*c,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,ce,le,de),e),pe=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],me=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class fe extends Q{constructor(e,t,i){if(t!==A.Left&&t!==A.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!e.poses.default||!e.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const n=new I(i),r=new I(n),a=[e.profileId,...e.fallbackProfileIds],s=new Y;Object.values(W).forEach((e=>{s.set(e,new ee(e,n))}));super(new H(t,k.TrackedPointer,a,n,new D(ie),r,s)),this[me]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[me].poseId}set poseId(e){this[me].poses[e]?this[me].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){const e=this[me].poses[this[me].poseId],t=this[me].poses.pinch;Object.values(W).forEach((i=>{const n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);he(a[E].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===A.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=pe[t]})(a[E].offsetMatrix),a[Z].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius})),e.gripOffsetMatrix&&t.gripOffsetMatrix&&he(this.inputSource.gripSpace[E].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[B].inputSource.gamepad[L].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0)return void console.warn(`Out-of-range value ${e} provided for pinch`);this[B].inputSource.gamepad[L].buttonsMap.pinch[L].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const ge=Symbol("@immersive-web-emulation-runtime/xr-pose");class ve{constructor(e,t=!1,i=void 0,n=void 0){this[ge]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:n}}get transform(){return this[ge].transform}get emulatedPosition(){return this[ge].emulatedPosition}get linearVelocity(){return this[ge].linearVelocity}get angularVelocity(){return this[ge].angularVelocity}}const xe=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class ye extends ve{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[xe]={radius:t}}get radius(){return this[xe].radius}}class Se{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 Se(e.x,e.y,e.z,e.w)}matrixTransform(e){return new Se}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const we=void 0!==globalThis.DOMPointReadOnly?globalThis.DOMPointReadOnly:Se,be=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class Me{constructor(e,t){const n=m(0,0,0),r=x();this[be]={matrix:i(),position:e?m(e.x,e.y,e.z):n,orientation:t?F(x(),b(t.x,t.y,t.z,t.w)):r,inverse:null},this.updateMatrix()}updateMatrix(){u(this[be].matrix,this[be].orientation,this[be].position)}get matrix(){return this[be].matrix}get position(){const e=this[be].position;return new we(e[0],e[1],e[2],1)}get orientation(){const e=this[be].orientation;return new we(e[0],e[1],e[2],e[3])}get inverse(){if(!this[be].inverse){const e=i();if(!a(e,this[be].matrix))throw new Error("Matrix is not invertible.");let t=p();l(t,e);let n=x();d(n,e),this[be].inverse=new Me(new we(t[0],t[1],t[2],1),new we(n[0],n[1],n[2],n[3])),this[be].inverse[be].inverse=this}return this[be].inverse}}const Re=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class Fe extends ve{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[Re]={views:Object.freeze(t)}}get views(){return this[Re].views}}const Ee=Symbol("@immersive-web-emulation-runtime/xr-frame"),Ie=i(),qe=i(),Te=i(),Ve=(e,t,i)=>{T.calculateGlobalOffsetMatrix(t,Ie),T.calculateGlobalOffsetMatrix(i,qe),a(Te,qe),s(e,Te,Ie)};class Pe{constructor(e,t,n,r,a){this[Ee]={session:e,id:t,active:n,animationFrame:r,predictedDisplayTime:a,tempMat4:i()}}get session(){return this[Ee].session}get predictedDisplayTime(){return this[Ee].predictedDisplayTime}getPose(e,t){if(!this[Ee].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");Ve(this[Ee].tempMat4,e,t);const i=p();l(i,this[Ee].tempMat4);const n=x();return d(n,this[Ee].tempMat4),new ve(new Me({x:i[0],y:i[1],z:i[2],w:1},{x:n[0],y:n[1],z:n[2],w:n[3]}),e[E].emulated)}getViewerPose(e){if(!this[Ee].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[Ee].session,i=t[Ne].device,n=this.getPose(i.viewerSpace,e),r=t[Ne].mode===He.Inline?[U.None]:[U.Left,U.Right],a=[];return r.forEach((n=>{const r=i.viewSpaces[n],s=this.getPose(r,e),o=t[Ne].getProjectionMatrix(n),u=new J(n,new Float32Array(o),s.transform,t);a.push(u)})),new Fe(n.transform,a,!1)}getJointPose(e,t){const i=this.getPose(e,t),n=e[Z].radius;return new ye(i.transform,n,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Ee].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][Z].radius?t[n]=e[n][Z].radius:(t[n]=NaN,i=!1);return i}fillPoses(e,t,i){if(e=Array.from(e),!this[Ee].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)=>{Ve(this[Ee].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[Ee].tempMat4[e]})),!0}}class Le 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 Oe;const Ae=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var ke;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"}(ke||(ke={}));class Xe extends I{constructor(e,t,i){super(t,i),this[Oe]={type:null,onreset:()=>{}},this[Ae].type=e}get onreset(){var e;return null!==(e=this[Ae].onreset)&&void 0!==e?e:()=>{}}set onreset(e){this[Ae].onreset&&this.removeEventListener("reset",this[Ae].onreset),this[Ae].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new Xe(this[Ae].type,this,e)}}Oe=Ae;const ze=Symbol("@immersive-web-emulation-runtime/xr-render-state");class De{constructor(e={},t){this[ze]={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[ze].depthNear}get depthFar(){return this[ze].depthFar}get inlineVerticalFieldOfView(){return this[ze].inlineVerticalFieldOfView}get baseLayer(){return this[ze].baseLayer}}class Ce extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}var je,He;!function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"}(je||(je={})),function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"}(He||(He={}));const Ne=Symbol("@immersive-web-emulation-runtime/xr-session");class Be extends EventTarget{constructor(e,t,n){super(),this[Ne]={device:e,mode:t,renderState:new De,pendingRenderState:null,enabledFeatures:n,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[U.Left]:i(),[U.Right]:i(),[U.None]:i()},getProjectionMatrix:e=>this[Ne].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[Ne].enabledFeatures.includes(e))return!1;switch(e){case ke.Viewer:return!0;case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:return this[Ne].mode!=He.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[Ne].ended)return;this[Ne].deviceFrameHandle=globalThis.requestAnimationFrame(this[Ne].onDeviceFrame),null!=this[Ne].pendingRenderState&&(this[Ne].renderState=this[Ne].pendingRenderState,this[Ne].pendingRenderState=null,this[Ne].device[it].onBaseLayerSet(this[Ne].renderState.baseLayer));const e=this[Ne].renderState.baseLayer;if(null===e)return;const t=e.context,i=t.canvas;if(this[Ne].mode!=He.Inline){const e=t.getParameter(t.COLOR_CLEAR_VALUE),i=t.getParameter(t.DEPTH_CLEAR_VALUE),n=t.getParameter(t.STENCIL_CLEAR_VALUE);t.clearColor(0,0,0,0),t.clearDepth(1),t.clearStencil(0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),t.clearColor(e[0],e[1],e[2],e[3]),t.clearDepth(i),t.clearStencil(n)}const{depthNear:n,depthFar:a}=this[Ne].renderState,{width:s,height:o}=i;if(this[Ne].mode!==He.Inline){const e=s*(this[Ne].device.stereoEnabled?.5:1)/o;h(this[Ne].projectionMatrices[U.Left],this[Ne].device.fovy,e,n,a),r(this[Ne].projectionMatrices[U.Right],this[Ne].projectionMatrices[U.Left])}else{const e=s/o;h(this[Ne].projectionMatrices[U.None],this[Ne].renderState.inlineVerticalFieldOfView,e,n,a)}const u=new Pe(this,this[Ne].frameHandle,!0,!0,performance.now());this[Ne].device[it].onFrameStart(u),this[Ne].updateActiveInputSources();const l=this[Ne].currentFrameCallbacks=this[Ne].frameCallbacks;this[Ne].frameCallbacks=[];const c=performance.now();for(let e=0;e<l.length;e++)try{l[e].cancelled||l[e].callback(c,u)}catch(e){console.error(e)}this[Ne].currentFrameCallbacks=null,u[Ee].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{const e=this[Ne].enabledFeatures.includes(tt.HandTracking),t=this[Ne].activeInputSources,i=this[Ne].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 Le("inputsourceschange",{session:this,added:n,removed:r})),this[Ne].activeInputSources=i},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[Ne].onDeviceFrame()}get visibilityState(){return this[Ne].device.visibilityState}get frameRate(){return this[Ne].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[Ne].device.supportedFrameRates)}get renderState(){return this[Ne].renderState}get inputSources(){return this[Ne].inputSourceArray.length=0,this[Ne].ended||this[Ne].mode===He.Inline||this[Ne].inputSourceArray.push(...this[Ne].activeInputSources),this[Ne].inputSourceArray}get enabledFeatures(){return this[Ne].enabledFeatures}get isSystemKeyboardSupported(){return this[Ne].isSystemKeyboardSupported}updateRenderState(e={}){var t,i,n,r;if(this[Ne].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Qe].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&this[Ne].mode!==He.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const a={baseLayer:e.baseLayer||(null===(t=this[Ne].pendingRenderState)||void 0===t?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||(null===(i=this[Ne].pendingRenderState)||void 0===i?void 0:i.depthFar)||void 0,depthNear:e.depthNear||(null===(n=this[Ne].pendingRenderState)||void 0===n?void 0:n.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null===(r=this[Ne].pendingRenderState)||void 0===r?void 0:r.inlineVerticalFieldOfView)||void 0};this[Ne].pendingRenderState=new De(a,this[Ne].renderState)}async updateTargetFrameRate(e){return new Promise(((t,i)=>{this[Ne].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[Ne].device.supportedFrameRates.includes(e)?(this[Ne].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[Ne].nominalFrameRate=e,this.dispatchEvent(new Ce("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[Ne].ended||!this[Ne].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));let n;switch(e){case ke.Viewer:n=this[Ne].device.viewerSpace;break;case ke.Local:n=new Xe(e,this[Ne].device[it].globalSpace,this[Ne].device.viewerSpace[E].offsetMatrix);break;case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:n=new Xe(e,this[Ne].device[it].globalSpace)}this[Ne].referenceSpaces.push(n),t(n)}))}requestAnimationFrame(e){if(this[Ne].ended)return 0;const t=++this[Ne].frameHandle;return this[Ne].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[Ne].frameCallbacks,i=t.findIndex((t=>t&&t.handle===e));i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[Ne].currentFrameCallbacks,t&&(i=t.findIndex((t=>t&&t.handle===e)),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise(((e,t)=>{this[Ne].ended||null===this[Ne].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[Ne].deviceFrameHandle),this[Ne].device[it].onSessionEnd(),this.dispatchEvent(new Ce("end",{session:this})),e())}))}get onend(){var e;return null!==(e=this[Ne].onend)&&void 0!==e?e:()=>{}}set onend(e){this[Ne].onend&&this.removeEventListener("end",this[Ne].onend),this[Ne].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!==(e=this[Ne].oninputsourceschange)&&void 0!==e?e:()=>{}}set oninputsourceschange(e){this[Ne].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[Ne].oninputsourceschange),this[Ne].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!==(e=this[Ne].onselect)&&void 0!==e?e:()=>{}}set onselect(e){this[Ne].onselect&&this.removeEventListener("select",this[Ne].onselect),this[Ne].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!==(e=this[Ne].onselectstart)&&void 0!==e?e:()=>{}}set onselectstart(e){this[Ne].onselectstart&&this.removeEventListener("selectstart",this[Ne].onselectstart),this[Ne].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!==(e=this[Ne].onselectend)&&void 0!==e?e:()=>{}}set onselectend(e){this[Ne].onselectend&&this.removeEventListener("selectend",this[Ne].onselectend),this[Ne].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!==(e=this[Ne].onsqueeze)&&void 0!==e?e:()=>{}}set onsqueeze(e){this[Ne].onsqueeze&&this.removeEventListener("squeeze",this[Ne].onsqueeze),this[Ne].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!==(e=this[Ne].onsqueezestart)&&void 0!==e?e:()=>{}}set onsqueezestart(e){this[Ne].onsqueezestart&&this.removeEventListener("squeezestart",this[Ne].onsqueezestart),this[Ne].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!==(e=this[Ne].onsqueezeend)&&void 0!==e?e:()=>{}}set onsqueezeend(e){this[Ne].onsqueezeend&&this.removeEventListener("squeezeend",this[Ne].onsqueezeend),this[Ne].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!==(e=this[Ne].onvisibilitychange)&&void 0!==e?e:()=>{}}set onvisibilitychange(e){this[Ne].onvisibilitychange&&this.removeEventListener("visibilitychange",this[Ne].onvisibilitychange),this[Ne].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!==(e=this[Ne].onframeratechange)&&void 0!==e?e:()=>{}}set onframeratechange(e){this[Ne].onframeratechange&&this.removeEventListener("frameratechange",this[Ne].onframeratechange),this[Ne].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}class Ge extends EventTarget{}const Qe=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),Ke={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class _e extends Ge{constructor(e,t,i={}){if(super(),e[Ne].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...Ke,...i};this[Qe]={session:e,context:t,antialias:n.antialias}}get context(){return this[Qe].context}get antialias(){return this[Qe].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Qe].context.drawingBufferWidth}get framebufferHeight(){return this[Qe].context.drawingBufferHeight}getViewport(e){if(e[$].session!==this[Qe].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Qe].session[Ne].device[it].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof Be))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[Ne].ended?0:1}}const $e=Symbol("@immersive-web-emulation-runtime/xr-system");class Ue extends EventTarget{constructor(e){super(),this[$e]={device:e}}isSessionSupported(e){return new Promise(((t,i)=>{e===He.Inline?t(!0):t(this[$e].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[$e].activeSession)return void n(new DOMException("An active XRSession already exists.","InvalidStateError"));const{requiredFeatures:a=[],optionalFeatures:s=[]}=t,{supportedFeatures:o}=this[$e].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))),l=Array.from(new Set([...a,...u,tt.Viewer,tt.Local])),c=new Be(this[$e].device,e,l);this[$e].activeSession=c,c.addEventListener("end",(()=>{this[$e].activeSession=void 0})),i(c)})).catch(n)}))}}const We=Symbol("@immersive-web-emulation-runtime/action-player");class Je{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 Xe(ke.Viewer,e),s={[U.Left]:new I(a),[U.Right]:new I(a),[U.None]:new I(a)};this[We]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:r,recordedFramePointer:0,startingTimeStamp:r[0][0],endingTimeStamp:r[r.length-1][0],playbackTime:r[0][0],playing:!1,viewerSpace:a,viewSpaces:s,vec3:p(),quat:x()},o(this[We].viewSpaces[U.Left][E].offsetMatrix,m(-i/2,0,0)),o(this[We].viewSpaces[U.Right][E].offsetMatrix,m(i/2,0,0)),n.forEach((t=>{const i=t[0],n=t[1];let r;if(n.hasGamepad){const e=[];for(let t=0;t<n.numButtons;t++)e.push({id:t.toString(),type:"manual"});const t=[];for(let e=0;e<n.numAxes;e++)t.push({id:e.toString(),type:"manual"});r=new D({mapping:n.mapping,buttons:e,axes:t})}const a=new I(e);let s;n.hasHand&&(s=new Y,Object.values(W).forEach((e=>{s.set(e,new ee(e,a))})));const o=new H(n.handedness,n.targetRayMode,n.profiles,a,r,n.hasGrip?new I(e):void 0,n.hasHand?s:void 0);this[We].inputSources.set(i,{active:!1,source:o}),this[We].inputSchemas.set(i,n)}))}play(){this[We].recordedFramePointer=0,this[We].playbackTime=this[We].startingTimeStamp,this[We].playing=!0,this[We].actualTimeStamp=performance.now()}stop(){this[We].playing=!1}get playing(){return this[We].playing}get viewerSpace(){return this[We].viewerSpace}get viewSpaces(){return this[We].viewSpaces}get inputSources(){return Array.from(this[We].inputSources.values()).filter((e=>e.active)).map((e=>e.source))}playFrame(){const e=performance.now(),t=e-this[We].actualTimeStamp;if(this[We].actualTimeStamp=e,this[We].playbackTime+=t,this[We].playbackTime>this[We].endingTimeStamp)return void this.stop();for(;this[We].frames[this[We].recordedFramePointer+1][0]<this[We].playbackTime;)this[We].recordedFramePointer++;const i=this[We].frames[this[We].recordedFramePointer],n=this[We].frames[this[We].recordedFramePointer+1],r=(this[We].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[We].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[We].inputSources.forEach((e=>{e.active=!1})),s.forEach(((e,t)=>{this[We].inputSources.get(t).active=!0;const i=this[We].inputSources.get(t).source,n=this[We].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],l=n.handTransforms[8*a+7],c=e.hand.get(t.jointSequence[a]);this.updateXRSpaceFromMergedFrames(c,s,o,r),c[Z].radius=(l-u)*r+u}if(t.hasGamepad){const t=e.gamepad;n.buttons.forEach(((e,n)=>{const a=t.buttons[n];a[L].pressed=1===e[0],a[L].touched=1===e[1];const s=i.buttons[n][2],o=e[2];a[L].value=(o-s)*r+s})),n.axes.forEach(((e,n)=>{const a=i.axes[n];t[L].axesMap[n.toString()].x=(e-a)*r+a}))}}updateXRSpaceFromMergedFrames(e,t,i,n){const r=m(t[0],t[1],t[2]),a=b(t[3],t[4],t[5],t[6]),s=m(i[0],i[1],i[2]),o=b(i[3],i[4],i[5],i[6]);v(this[We].vec3,r,s,n),S(this[We].quat,a,o,n),u(e[E].offsetMatrix,this[We].quat,this[We].vec3)}processRawInputData(e){const t=e[0],i=this[We].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 Ye 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 Ze=Symbol("@immersive-web-emulation-runtime/xr-viewport");class et{constructor(e,t,i,n){this[Ze]={x:e,y:t,width:i,height:n}}get x(){return this[Ze].x}get y(){return this[Ze].y}get width(){return this[Ze].width}get height(){return this[Ze].height}}var tt;!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"}(tt||(tt={}));const it=Symbol("@immersive-web-emulation-runtime/xr-device"),nt={ipd:.063,fovy:Math.PI/2,headsetPosition:new V(0,1.6,0),headsetQuaternion:new P,stereoEnabled:!1};const rt={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"}]},at={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"}]},st={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,2.0823669899527886e-8,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-8.329467959811154e-8,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},ot={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,-1.5779937356796836e-8,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},ut={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,1.0736208366779465e-8,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-2.6238110351073374e-8,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},lt={name:"Oculus Quest 1",controllerConfig:{profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,4.673031295254759e-9,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,3.688163374704345e-8,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ct={name:"Meta Quest 2",controllerConfig:st,supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.MeshDetection,tt.HitTest,tt.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},dt={name:"Meta Quest Pro",controllerConfig:ot,supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.MeshDetection,tt.HitTest,tt.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ht={name:"Meta Quest 3",controllerConfig:ut,supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.MeshDetection,tt.HitTest,tt.HandTracking,tt.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},pt=Symbol("@immersive-web-emulation-runtime/action-recorder"),mt=e=>{const t=[];return e.forEach((e=>{t.push(parseFloat(e.toFixed(3)))})),t};e.ActionRecorder=class{constructor(e,t){this[pt]={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[pt].refSpace))||void 0===t?void 0:t.transform.matrix;if(!n)return;const r={timeStamp:i,position:l(p(),n),quaternion:d(x(),n),inputFrames:[]};this[pt].session.inputSources.forEach((t=>{var i,n;if(!this[pt].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[pt].inputMap.size;this[pt].inputMap.set(t,i),this[pt].schemaMap.set(i,e)}const a=this[pt].inputMap.get(t),s=this[pt].schemaMap.get(a),o=null===(i=e.getPose(t.targetRaySpace,this[pt].refSpace))||void 0===i?void 0:i.transform.matrix;if(o){const i={index:a,targetRayTransform:{position:l(p(),o),quaternion:d(x(),o)}};if(s.hasGrip){const r=null===(n=e.getPose(t.gripSpace,this[pt].refSpace))||void 0===n?void 0:n.transform.matrix;if(r){const e=l(p(),r),t=d(x(),r);i.gripTransform={position:e,quaternion:t}}}if(s.hasHand){const n=Array.from(t.hand.values());let r=!0;if(r&&(r=e.fillPoses(n,t.targetRaySpace,this[pt].jointTransforms)),r&&(r=e.fillJointRadii(n,this[pt].jointRadii)),r){const e={};for(let t=0;t<25;t++){const i=this[pt].jointTransforms.slice(16*t,16*(t+1)),r=this[pt].jointRadii[t],a=l(p(),i),s=d(x(),i);e[n[t].jointName]={position:a,quaternion:s,radius:r}}i.hand=e}}if(s.hasGamepad){const e={buttons:t.gamepad.buttons.map((e=>e?[e.pressed?1:0,e.touched?1:0,e.value]:null)),axes:Array.from(t.gamepad.axes)};i.gamepad=e}r.inputFrames.push(i)}})),this[pt].compressedFrames.push(this.compressActionFrame(r))}compressActionFrame(e){const t=[Math.round(10*e.timeStamp)/10,...mt(e.position),...mt(e.quaternion)];return e.inputFrames.forEach((e=>{const i=e.index,n=this[pt].schemaMap.get(i),r=[i,...mt(e.targetRayTransform.position),...mt(e.targetRayTransform.quaternion)];if(n.hasGrip&&r.push([...mt(e.gripTransform.position),...mt(e.gripTransform.quaternion)]),n.hasHand){const t=[];Object.values(e.hand).forEach((({position:e,quaternion:i,radius:n})=>{t.push(...mt(e),...mt(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[pt].schemaMap.entries()),frames:this[pt].compressedFrames};console.log(JSON.stringify(e))}},e.XRDevice=class{constructor(e,t={}){var n,r,a,s,l,c;const d=new q,h=new Xe(ke.Viewer,d),p={[U.Left]:new I(h),[U.Right]:new I(h),[U.None]:new I(h)},f=e.controllerConfig,g={};f&&Object.values(A).forEach((e=>{f.layout[e]&&(g[e]=new _(f,e,d))}));const v={[A.Left]:new fe(te,A.Left,d),[A.Right]:new fe(te,A.Right,d)},x=null!==(n=t.canvasContainer)&&void 0!==n?n:document.createElement("div");x.dataset.webxr_runtime="Immersive Web Emulation Runtime v1.0.2",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[it]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,userAgent:e.userAgent,position:null!==(r=t.headsetPosition)&&void 0!==r?r:nt.headsetPosition.clone(),quaternion:null!==(a=t.headsetQuaternion)&&void 0!==a?a:nt.headsetQuaternion.clone(),stereoEnabled:null!==(s=t.stereoEnabled)&&void 0!==s?s:nt.stereoEnabled,ipd:null!==(l=t.ipd)&&void 0!==l?l:nt.ipd,fovy:null!==(c=t.fovy)&&void 0!==c?c:nt.fovy,controllers:g,hands:v,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:je.Visible,pendingVisibilityState:null,xrSystem:null,matrix:i(),globalSpace:d,viewerSpace:h,viewSpaces:p,canvasContainer:x,getViewport:(e,t)=>{const i=e.context.canvas,{width:n,height:r}=i;switch(t.eye){case U.None:return new et(0,0,n,r);case U.Left:return new et(0,0,this[it].stereoEnabled?n/2:n,r);case U.Right:return new et(n/2,0,this[it].stereoEnabled?n/2:0,r)}},updateViews:()=>{u(this[it].viewerSpace[E].offsetMatrix,this[it].quaternion.quat,this[it].position.vec3),o(this[it].viewSpaces[U.Left][E].offsetMatrix,m(-this[it].ipd/2,0,0)),o(this[it].viewSpaces[U.Right][E].offsetMatrix,m(this[it].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;const t=e.context.canvas;t.parentElement!==this[it].canvasContainer&&(this[it].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height},this[it].canvasContainer.appendChild(t),document.body.appendChild(this[it].canvasContainer)),t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[it].canvasData){const{canvas:e,parent:t,width:i,height:n}=this[it].canvasData;e.width=i,e.height=n,t?t.appendChild(e):this[it].canvasContainer.removeChild(e),document.body.removeChild(this[it].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null===(t=this[it].actionPlayer)||void 0===t?void 0:t.playing)this[it].actionPlayer.playFrame();else{const t=e.session;this[it].updateViews(),this[it].pendingVisibilityState&&(this[it].visibilityState=this[it].pendingVisibilityState,this[it].pendingVisibilityState=null,t.dispatchEvent(new Ce("visibilitychange",{session:t}))),this[it].visibilityState===je.Visible&&this.activeInputs.forEach((t=>{t.onFrameStart(e)})),this[it].pendingReferenceSpaceReset&&(t[Ne].referenceSpaces.forEach((e=>{switch(e[Ae].type){case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:e.dispatchEvent(new Ye("reset",{referenceSpace:e}))}})),this[it].pendingReferenceSpaceReset=!1)}this[it].updateViews()}},this[it].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise(((e,t)=>{e(!0)}))},configurable:!0}),this[it].xrSystem=new Ue(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[it].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[it].userAgent,writable:!1,configurable:!1,enumerable:!0}),e.XRSystem=Ue,e.XRSession=Be,e.XRRenderState=De,e.XRFrame=Pe,e.XRSpace=I,e.XRReferenceSpace=Xe,e.XRJointSpace=ee,e.XRView=J,e.XRViewport=et,e.XRRigidTransform=Me,e.XRPose=ve,e.XRViewerPose=Fe,e.XRJointPose=ye,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRHand=Y,e.XRLayer=Ge,e.XRWebGLLayer=_e,e.XRSessionEvent=Ce,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=Le,e.XRReferenceSpaceEvent=Ye}get supportedSessionModes(){return this[it].supportedSessionModes}get supportedFeatures(){return this[it].supportedFeatures}get supportedFrameRates(){return this[it].supportedFrameRates}get isSystemKeyboardSupported(){return this[it].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[it].internalNominalFrameRate}get stereoEnabled(){return this[it].stereoEnabled}set stereoEnabled(e){this[it].stereoEnabled=e}get ipd(){return this[it].ipd}set ipd(e){this[it].ipd=e}get fovy(){return this[it].fovy}set fovy(e){this[it].fovy=e}get position(){return this[it].position}get quaternion(){return this[it].quaternion}get viewerSpace(){var e;return(null===(e=this[it].actionPlayer)||void 0===e?void 0:e.playing)?this[it].actionPlayer.viewerSpace:this[it].viewerSpace}get viewSpaces(){var e;return(null===(e=this[it].actionPlayer)||void 0===e?void 0:e.playing)?this[it].actionPlayer.viewSpaces:this[it].viewSpaces}get controllers(){return this[it].controllers}get hands(){return this[it].hands}get primaryInputMode(){return this[it].primaryInputMode}set primaryInputMode(e){"controller"===e||"hand"===e?this[it].primaryInputMode=e:console.warn('primary input mode can only be "controller" or "hand"')}get activeInputs(){if(this[it].visibilityState!==je.Visible)return[];return("controller"===this[it].primaryInputMode?Object.values(this[it].controllers):Object.values(this[it].hands)).filter((e=>e.connected))}get inputSources(){var e;return(null===(e=this[it].actionPlayer)||void 0===e?void 0:e.playing)?this[it].actionPlayer.inputSources:this.activeInputs.map((e=>e.inputSource))}get canvasContainer(){return this[it].canvasContainer}get activeSession(){var e;return null===(e=this[it].xrSystem)||void 0===e?void 0:e[$e].activeSession}recenter(){const e=new V(-this.position.x,0,-this.position.z),t=new V(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();const i=Math.atan2(t.x,-t.z),n=(new P).setFromAxisAngle(new V(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[it].controllers),...Object.values(this[it].hands)].forEach((t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)})),this[it].pendingReferenceSpaceReset=!0}get visibilityState(){return this[it].visibilityState}updateVisibilityState(e){if(!Object.values(je).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[it].visibilityState&&(this[it].pendingVisibilityState=e)}createActionPlayer(e,t){return this[it].actionPlayer=new Je(e,t,this[it].ipd),this[it].actionPlayer}},e.XRFrame=Pe,e.XRHand=Y,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=Le,e.XRJointPose=ye,e.XRJointSpace=ee,e.XRLayer=Ge,e.XRPose=ve,e.XRReferenceSpace=Xe,e.XRReferenceSpaceEvent=Ye,e.XRRenderState=De,e.XRRigidTransform=Me,e.XRSession=Be,e.XRSessionEvent=Ce,e.XRSpace=I,e.XRSystem=Ue,e.XRView=J,e.XRViewerPose=Fe,e.XRViewport=et,e.XRWebGLLayer=_e,e.metaQuest2=ct,e.metaQuest3=ht,e.metaQuestPro=dt,e.oculusQuest1=lt,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).IWER={})}(this,(function(e){"use strict";var t="undefined"!=typeof Float32Array?Float32Array:Array;function i(){var e=new t(16);return t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function n(e){var i=new t(16);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function r(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function a(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=t[4],o=t[5],u=t[6],l=t[7],c=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*l-a*s,w=n*u-r*o,b=n*l-a*o,M=r*l-a*u,R=c*f-d*m,F=c*g-h*m,E=c*v-p*m,I=d*g-h*f,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11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function u(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=n+n,u=r+r,l=a+a,c=n*o,d=n*u,h=n*l,p=r*u,m=r*l,f=a*l,g=s*o,v=s*u,x=s*l;return e[0]=1-(p+f),e[1]=d+x,e[2]=h-v,e[3]=0,e[4]=d-x,e[5]=1-(c+f),e[6]=m+g,e[7]=0,e[8]=h+v,e[9]=m-g,e[10]=1-(c+p),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function l(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],l=t[9],c=t[10];return e[0]=Math.hypot(i,n,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(u,l,c),e}function d(e,i){var n=new t(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),e[3]=.25*x,e[0]=(p-f)/x,e[1]=(m-l)/x,e[2]=(u-d)/x):o>h&&o>g?(x=2*Math.sqrt(1+o-h-g),e[3]=(p-f)/x,e[0]=.25*x,e[1]=(u+d)/x,e[2]=(m+l)/x):h>g?(x=2*Math.sqrt(1+h-o-g),e[3]=(m-l)/x,e[0]=(u+d)/x,e[1]=.25*x,e[2]=(p+f)/x):(x=2*Math.sqrt(1+g-o-h),e[3]=(u-d)/x,e[0]=(m+l)/x,e[1]=(p+f)/x,e[2]=.25*x),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var h=function(e,t,i,n,r){var a,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(a=1/(n-r),e[10]=(r+n)*a,e[14]=2*r*n*a):(e[10]=-1,e[14]=-2*n),e};function p(){var e=new t(3);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function m(e,i,n){var r=new t(3);return r[0]=e,r[1]=i,r[2]=n,r}function f(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function g(e,t){var i=t[0],n=t[1],r=t[2],a=i*i+n*n+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function v(e,t,i,n){var r=t[0],a=t[1],s=t[2];return e[0]=r+n*(i[0]-r),e[1]=a+n*(i[1]-a),e[2]=s+n*(i[2]-s),e}function x(){var e=new t(4);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function y(e,t,i){i*=.5;var n=Math.sin(i);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(i),e}function S(e,t,i,n){var r,a,s,o,u,l=t[0],c=t[1],d=t[2],h=t[3],p=i[0],m=i[1],f=i[2],g=i[3];return(a=l*p+c*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*l+u*p,e[1]=o*c+u*m,e[2]=o*d+u*f,e[3]=o*h+u*g,e}p(),function(){var e,i=(e=new t(4),t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();var w,b=function(e,i,n,r){var a=new t(4);return a[0]=e,a[1]=i,a[2]=n,a[3]=r,a},M=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},R=function(e,t,i,n,r){return e[0]=t,e[1]=i,e[2]=n,e[3]=r,e},F=function(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=i*i+n*n+r*r+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=n*s,e[2]=r*s,e[3]=a*s,e};p(),m(1,0,0),m(0,1,0),x(),x(),w=new t(9),t!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1;const E=Symbol("@immersive-web-emulation-runtime/xr-space");class I extends EventTarget{constructor(e,t){super(),this[E]={parentSpace:e,offsetMatrix:t?n(t):i(),emulated:!0}}}class q extends I{constructor(){super(void 0,i())}}class T{static updateOffsetPosition(e,t){o(e[E].offsetMatrix,t)}static updateOffsetQuaternion(e,t){const i=e[E].offsetMatrix,n=p();l(n,i),u(i,t,n)}static updateOffsetMatrix(e,t){r(e[E].offsetMatrix,t)}static calculateGlobalOffsetMatrix(e,t=i()){return s(t,e[E].parentSpace?T.calculateGlobalOffsetMatrix(e[E].parentSpace):i(),e[E].offsetMatrix),t}}class V{constructor(e=0,t=0,i=0){this.vec3=m(e,t,i),this.tempVec3=p()}get x(){return this.vec3[0]}set x(e){this.vec3[0]=e}get y(){return this.vec3[1]}set y(e){this.vec3[1]=e}get z(){return this.vec3[2]}set z(e){this.vec3[2]=e}set(e,t,i){return function(e,t,i,n){e[0]=t,e[1]=i,e[2]=n}(this.vec3,e,t,i),this}clone(){return new V(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 f(this.tempVec3,this.vec3),g(this.vec3,this.tempVec3),this}add(e){return f(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 f(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],l=t[2],c=r*l-a*u,d=a*o-n*l,h=n*u-r*o,p=r*h-a*d,m=a*c-n*h,f=n*d-r*c,g=2*s;c*=g,d*=g,h*=g,p*=2,m*=2,f*=2,e[0]=o+c+p,e[1]=u+d+m,e[2]=l+h+f}(this.vec3,this.tempVec3,e.quat),this}}class P{constructor(e=0,t=0,i=0,n=1){this.quat=b(e,t,i,n),this.tempQuat=x()}get x(){return this.quat[0]}set x(e){this.quat[0]=e}get y(){return this.quat[1]}set y(e){this.quat[1]=e}get z(){return this.quat[2]}set z(e){this.quat[2]=e}get w(){return this.quat[3]}set w(e){this.quat[3]=e}set(e,t,i,n){return R(this.quat,e,t,i,n),this}clone(){return new P(this.x,this.y,this.z,this.w)}copy(e){return R(this.quat,e.x,e.y,e.z,e.w),this}normalize(){return M(this.tempQuat,this.quat),F(this.quat,this.tempQuat),this}invert(){return M(this.tempQuat,this.quat),function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this.quat,this.tempQuat),this}multiply(e){return M(this.tempQuat,this.quat),function(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=i[0],u=i[1],l=i[2],c=i[3];e[0]=n*c+s*o+r*l-a*u,e[1]=r*c+s*u+a*o-n*l,e[2]=a*c+s*l+n*u-r*o,e[3]=s*c-n*o-r*u-a*l}(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return y(this.quat,e.vec3,t),this}}const L=Symbol("@immersive-web-emulation-runtime/gamepad");var O,A,k;!function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"}(O||(O={}));class X{constructor(e,t){this[L]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[L].type?this[L].pressed:this[L].value>0}get touched(){return"manual"===this[L].type?this[L].touched:this[L].touched||this.pressed}get value(){return this[L].value}}class z{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class D{constructor(e,t="",i=-1){this[L]={id:t,index:i,connected:!1,timestamp:performance.now(),mapping:e.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},e.buttons.forEach((e=>{var t;null===e?this[L].buttonsSequence.push(null):(this[L].buttonsSequence.push(e.id),this[L].buttonsMap[e.id]=new X(e.type,null!==(t=e.eventTrigger)&&void 0!==t?t:null))})),e.axes.forEach((e=>{null===e?this[L].axesSequence.push(null):(this[L].axesSequence.push(e.id+e.type),this[L].axesMap[e.id]||(this[L].axesMap[e.id]={x:0,y:0}))}))}get id(){return this[L].id}get index(){return this[L].index}get connected(){return this[L].connected}get timestamp(){return this[L].timestamp}get mapping(){return this[L].mapping}get axes(){const e=[];return this[L].axesSequence.forEach((t=>{if(null===t)e.push(null);else{const i=t.substring(0,t.length-6),n=t.substring(t.length-6);e.push("y-axis"===n?this[L].axesMap[i].y:this[L].axesMap[i].x)}})),e}get buttons(){return this[L].buttonsSequence.map((e=>null===e?new z:this[L].buttonsMap[e]))}get hapticActuators(){return this[L].hapticActuators}get vibrationActuator(){return null}}!function(e){e.None="none",e.Left="left",e.Right="right"}(A||(A={})),function(e){e.Gaze="gaze",e.TrackedPointer="tracked-pointer",e.Screen="screen",e.TransientPointer="transient-pointer"}(k||(k={}));class C extends Array{}const j=Symbol("@immersive-web-emulation-runtime/xr-input-source");class H{constructor(e,t,i,n,r,a,s){this[j]={handedness:e,targetRayMode:t,targetRaySpace:n,gripSpace:a,profiles:i,gamepad:r,hand:s}}get handedness(){return this[j].handedness}get targetRayMode(){return this[j].targetRayMode}get targetRaySpace(){return this[j].targetRaySpace}get gripSpace(){return this[j].gripSpace}get profiles(){return this[j].profiles}get gamepad(){return this[j].gamepad}get hand(){return this[j].hand}}class N extends Event{constructor(e,t){if(super(e,t),!t.frame)throw new Error("XRInputSourceEventInit.frame is required");if(!t.inputSource)throw new Error("XRInputSourceEventInit.inputSource is required");this.frame=t.frame,this.inputSource=t.inputSource}}const B=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),G={[A.Left]:{position:new V(-.25,1.5,-.4),quaternion:new P},[A.Right]:{position:new V(.25,1.5,-.4),quaternion:new P},[A.None]:{position:new V(.25,1.5,-.4),quaternion:new P}};class Q{constructor(e){this[B]={inputSource:e,position:G[e.handedness].position.clone(),quaternion:G[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[B].position}get quaternion(){return this[B].quaternion}get inputSource(){return this[B].inputSource}get connected(){return this[B].connected}set connected(e){this[B].connected=e,this[B].inputSource.gamepad[L].connected=e}onFrameStart(e){u(this[B].inputSource.targetRaySpace[E].offsetMatrix,this[B].quaternion.quat,this[B].position.vec3);const t=e.session;this[B].inputSource.gamepad.buttons.forEach((i=>{i instanceof X&&(i[L].lastFrameValue=i[L].value,null!=i[L].pendingValue&&(i[L].value=i[L].pendingValue,i[L].pendingValue=null),null!=i[L].eventTrigger&&(0===i[L].lastFrameValue&&i[L].value>0?(t.dispatchEvent(new N(i[L].eventTrigger,{frame:e,inputSource:this[B].inputSource})),t.dispatchEvent(new N(i[L].eventTrigger+"start",{frame:e,inputSource:this[B].inputSource}))):i[L].lastFrameValue>0&&0===i[L].value&&t.dispatchEvent(new N(i[L].eventTrigger+"end",{frame:e,inputSource:this[B].inputSource}))))})),this[B].inputSourceChanged=this.connected!==this[B].lastFrameConnected,this[B].lastFrameConnected=this.connected}}const K=Symbol("@immersive-web-emulation-runtime/xr-controller");class _ extends Q{constructor(e,t,i){if(!e.layout[t])throw new DOMException("Handedness not supported","InvalidStateError");const n=new I(i),r=e.layout[t].gripOffsetMatrix?new I(n,e.layout[t].gripOffsetMatrix):void 0,a=[e.profileId,...e.fallbackProfileIds];super(new H(t,k.TrackedPointer,a,n,new D(e.layout[t].gamepad),r)),this[K]={gamepadConfig:e.layout[t].gamepad}}get gamepadConfig(){return this[K].gamepadConfig}updateButtonValue(e,t){if(t>1||t<0)return void console.warn(`Out-of-range value ${t} provided for button ${e}.`);const i=this[B].inputSource.gamepad[L].buttonsMap[e];if(i){if("binary"===i[L].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[L].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[B].inputSource.gamepad[L].buttonsMap[e];i?i[L].touched=t:console.warn(`Current controller does not have button ${e}.`)}updateAxis(e,t,i){if(i>1||i<-1)return void console.warn(`Out-of-range value ${i} provided for ${e} axes.`);const n=this[B].inputSource.gamepad[L].axesMap[e];n?"x-axis"===t?n.x=i:"y-axis"===t&&(n.y=i):console.warn(`Current controller does not have ${e} axes.`)}updateAxes(e,t,i){if(t>1||t<-1||i>1||i<-1)return void console.warn(`Out-of-range value x:${t}, y:${i} provided for ${e} axes.`);const n=this[B].inputSource.gamepad[L].axesMap[e];n?(n.x=t,n.y=i):console.warn(`Current controller does not have ${e} axes.`)}}const $=Symbol("@immersive-web-emulation-runtime/xr-view");var U,W;!function(e){e.None="none",e.Left="left",e.Right="right"}(U||(U={}));class J{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"}(W||(W={}));class Y extends Map{}const Z=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class ee extends I{constructor(e,t,i){super(t,i),this[Z]={jointName:e,radius:0}}get jointName(){return this[Z].jointName}}const te={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]}}},ie={mapping:O.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},ne=p(),re=x(),ae=p(),se=p(),oe=x(),ue=p(),le=p(),ce=x(),de=p(),he=(e,t,i,n)=>(l(ne,t),d(re,t),c(ae,t),l(se,i),d(oe,i),c(ue,i),v(le,ne,se,n),S(ce,re,oe,n),v(de,ae,ue,n),function(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=t[3],u=r+r,l=a+a,c=s+s,d=r*u,h=r*l,p=r*c,m=a*l,f=a*c,g=s*c,v=o*u,x=o*l,y=o*c,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,ce,le,de),e),pe=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],me=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class fe extends Q{constructor(e,t,i){if(t!==A.Left&&t!==A.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!e.poses.default||!e.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const n=new I(i),r=new I(n),a=[e.profileId,...e.fallbackProfileIds],s=new Y;Object.values(W).forEach((e=>{s.set(e,new ee(e,n))}));super(new H(t,k.TrackedPointer,a,n,new D(ie),r,s)),this[me]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[me].poseId}set poseId(e){this[me].poses[e]?this[me].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){const e=this[me].poses[this[me].poseId],t=this[me].poses.pinch;Object.values(W).forEach((i=>{const n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);he(a[E].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===A.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=pe[t]})(a[E].offsetMatrix),a[Z].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius})),e.gripOffsetMatrix&&t.gripOffsetMatrix&&he(this.inputSource.gripSpace[E].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[B].inputSource.gamepad[L].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0)return void console.warn(`Out-of-range value ${e} provided for pinch`);this[B].inputSource.gamepad[L].buttonsMap.pinch[L].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const ge=Symbol("@immersive-web-emulation-runtime/xr-pose");class ve{constructor(e,t=!1,i=void 0,n=void 0){this[ge]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:n}}get transform(){return this[ge].transform}get emulatedPosition(){return this[ge].emulatedPosition}get linearVelocity(){return this[ge].linearVelocity}get angularVelocity(){return this[ge].angularVelocity}}const xe=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class ye extends ve{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[xe]={radius:t}}get radius(){return this[xe].radius}}class Se{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 Se(e.x,e.y,e.z,e.w)}matrixTransform(e){return new Se}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const we=void 0!==globalThis.DOMPointReadOnly?globalThis.DOMPointReadOnly:Se,be=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class Me{constructor(e,t){const n=m(0,0,0),r=x();this[be]={matrix:i(),position:e?m(e.x,e.y,e.z):n,orientation:t?F(x(),b(t.x,t.y,t.z,t.w)):r,inverse:null},this.updateMatrix()}updateMatrix(){u(this[be].matrix,this[be].orientation,this[be].position)}get matrix(){return this[be].matrix}get position(){const e=this[be].position;return new we(e[0],e[1],e[2],1)}get orientation(){const e=this[be].orientation;return new we(e[0],e[1],e[2],e[3])}get inverse(){if(!this[be].inverse){const e=i();if(!a(e,this[be].matrix))throw new Error("Matrix is not invertible.");let t=p();l(t,e);let n=x();d(n,e),this[be].inverse=new Me(new we(t[0],t[1],t[2],1),new we(n[0],n[1],n[2],n[3])),this[be].inverse[be].inverse=this}return this[be].inverse}}const Re=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class Fe extends ve{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[Re]={views:Object.freeze(t)}}get views(){return this[Re].views}}const Ee=Symbol("@immersive-web-emulation-runtime/xr-frame"),Ie=i(),qe=i(),Te=i(),Ve=(e,t,i)=>{T.calculateGlobalOffsetMatrix(t,Ie),T.calculateGlobalOffsetMatrix(i,qe),a(Te,qe),s(e,Te,Ie)};class Pe{constructor(e,t,n,r,a){this[Ee]={session:e,id:t,active:n,animationFrame:r,predictedDisplayTime:a,tempMat4:i()}}get session(){return this[Ee].session}get predictedDisplayTime(){return this[Ee].predictedDisplayTime}getPose(e,t){if(!this[Ee].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");Ve(this[Ee].tempMat4,e,t);const i=p();l(i,this[Ee].tempMat4);const n=x();return d(n,this[Ee].tempMat4),new ve(new Me({x:i[0],y:i[1],z:i[2],w:1},{x:n[0],y:n[1],z:n[2],w:n[3]}),e[E].emulated)}getViewerPose(e){if(!this[Ee].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[Ee].session,i=t[Ne].device,n=this.getPose(i.viewerSpace,e),r=t[Ne].mode===He.Inline?[U.None]:[U.Left,U.Right],a=[];return r.forEach((n=>{const r=i.viewSpaces[n],s=this.getPose(r,e),o=t[Ne].getProjectionMatrix(n),u=new J(n,new Float32Array(o),s.transform,t);a.push(u)})),new Fe(n.transform,a,!1)}getJointPose(e,t){const i=this.getPose(e,t),n=e[Z].radius;return new ye(i.transform,n,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Ee].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][Z].radius?t[n]=e[n][Z].radius:(t[n]=NaN,i=!1);return i}fillPoses(e,t,i){if(e=Array.from(e),!this[Ee].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)=>{Ve(this[Ee].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[Ee].tempMat4[e]})),!0}}class Le 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 Oe;const Ae=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var ke;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"}(ke||(ke={}));class Xe extends I{constructor(e,t,i){super(t,i),this[Oe]={type:null,onreset:()=>{}},this[Ae].type=e}get onreset(){var e;return null!==(e=this[Ae].onreset)&&void 0!==e?e:()=>{}}set onreset(e){this[Ae].onreset&&this.removeEventListener("reset",this[Ae].onreset),this[Ae].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new Xe(this[Ae].type,this,e)}}Oe=Ae;const ze=Symbol("@immersive-web-emulation-runtime/xr-render-state");class De{constructor(e={},t){this[ze]={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[ze].depthNear}get depthFar(){return this[ze].depthFar}get inlineVerticalFieldOfView(){return this[ze].inlineVerticalFieldOfView}get baseLayer(){return this[ze].baseLayer}}class Ce extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}var je,He;!function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"}(je||(je={})),function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"}(He||(He={}));const Ne=Symbol("@immersive-web-emulation-runtime/xr-session");class Be extends EventTarget{constructor(e,t,n){super(),this[Ne]={device:e,mode:t,renderState:new De,pendingRenderState:null,enabledFeatures:n,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[U.Left]:i(),[U.Right]:i(),[U.None]:i()},getProjectionMatrix:e=>this[Ne].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[Ne].enabledFeatures.includes(e))return!1;switch(e){case ke.Viewer:return!0;case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:return this[Ne].mode!=He.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[Ne].ended)return;this[Ne].deviceFrameHandle=globalThis.requestAnimationFrame(this[Ne].onDeviceFrame),null!=this[Ne].pendingRenderState&&(this[Ne].renderState=this[Ne].pendingRenderState,this[Ne].pendingRenderState=null,this[Ne].device[it].onBaseLayerSet(this[Ne].renderState.baseLayer));const e=this[Ne].renderState.baseLayer;if(null===e)return;const t=e.context,i=t.canvas;if(this[Ne].mode!=He.Inline){const e=t.getParameter(t.COLOR_CLEAR_VALUE),i=t.getParameter(t.DEPTH_CLEAR_VALUE),n=t.getParameter(t.STENCIL_CLEAR_VALUE);t.clearColor(0,0,0,0),t.clearDepth(1),t.clearStencil(0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),t.clearColor(e[0],e[1],e[2],e[3]),t.clearDepth(i),t.clearStencil(n)}const{depthNear:n,depthFar:a}=this[Ne].renderState,{width:s,height:o}=i;if(this[Ne].mode!==He.Inline){const e=s*(this[Ne].device.stereoEnabled?.5:1)/o;h(this[Ne].projectionMatrices[U.Left],this[Ne].device.fovy,e,n,a),r(this[Ne].projectionMatrices[U.Right],this[Ne].projectionMatrices[U.Left])}else{const e=s/o;h(this[Ne].projectionMatrices[U.None],this[Ne].renderState.inlineVerticalFieldOfView,e,n,a)}const u=new Pe(this,this[Ne].frameHandle,!0,!0,performance.now());this[Ne].device[it].onFrameStart(u),this[Ne].updateActiveInputSources();const l=this[Ne].currentFrameCallbacks=this[Ne].frameCallbacks;this[Ne].frameCallbacks=[];const c=performance.now();for(let e=0;e<l.length;e++)try{l[e].cancelled||l[e].callback(c,u)}catch(e){console.error(e)}this[Ne].currentFrameCallbacks=null,u[Ee].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{const e=this[Ne].enabledFeatures.includes(tt.HandTracking),t=this[Ne].activeInputSources,i=this[Ne].device.inputSources.filter((t=>!t.hand||e)),n=i.filter((e=>!t.includes(e))),r=t.filter((e=>!i.includes(e)));this[Ne].activeInputSources=i,(n.length>0||r.length>0)&&this.dispatchEvent(new Le("inputsourceschange",{session:this,added:n,removed:r}))},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[Ne].onDeviceFrame()}get visibilityState(){return this[Ne].device.visibilityState}get frameRate(){return this[Ne].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[Ne].device.supportedFrameRates)}get renderState(){return this[Ne].renderState}get inputSources(){return this[Ne].inputSourceArray.length=0,this[Ne].ended||this[Ne].mode===He.Inline||this[Ne].inputSourceArray.push(...this[Ne].activeInputSources),this[Ne].inputSourceArray}get enabledFeatures(){return this[Ne].enabledFeatures}get isSystemKeyboardSupported(){return this[Ne].isSystemKeyboardSupported}updateRenderState(e={}){var t,i,n,r;if(this[Ne].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Qe].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&this[Ne].mode!==He.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const a={baseLayer:e.baseLayer||(null===(t=this[Ne].pendingRenderState)||void 0===t?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||(null===(i=this[Ne].pendingRenderState)||void 0===i?void 0:i.depthFar)||void 0,depthNear:e.depthNear||(null===(n=this[Ne].pendingRenderState)||void 0===n?void 0:n.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null===(r=this[Ne].pendingRenderState)||void 0===r?void 0:r.inlineVerticalFieldOfView)||void 0};this[Ne].pendingRenderState=new De(a,this[Ne].renderState)}async updateTargetFrameRate(e){return new Promise(((t,i)=>{this[Ne].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[Ne].device.supportedFrameRates.includes(e)?(this[Ne].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[Ne].nominalFrameRate=e,this.dispatchEvent(new Ce("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[Ne].ended||!this[Ne].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));let n;switch(e){case ke.Viewer:n=this[Ne].device.viewerSpace;break;case ke.Local:n=new Xe(e,this[Ne].device[it].globalSpace,this[Ne].device.viewerSpace[E].offsetMatrix);break;case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:n=new Xe(e,this[Ne].device[it].globalSpace)}this[Ne].referenceSpaces.push(n),t(n)}))}requestAnimationFrame(e){if(this[Ne].ended)return 0;const t=++this[Ne].frameHandle;return this[Ne].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[Ne].frameCallbacks,i=t.findIndex((t=>t&&t.handle===e));i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[Ne].currentFrameCallbacks,t&&(i=t.findIndex((t=>t&&t.handle===e)),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise(((e,t)=>{this[Ne].ended||null===this[Ne].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[Ne].deviceFrameHandle),this[Ne].device[it].onSessionEnd(),this.dispatchEvent(new Ce("end",{session:this})),e())}))}get onend(){var e;return null!==(e=this[Ne].onend)&&void 0!==e?e:()=>{}}set onend(e){this[Ne].onend&&this.removeEventListener("end",this[Ne].onend),this[Ne].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!==(e=this[Ne].oninputsourceschange)&&void 0!==e?e:()=>{}}set oninputsourceschange(e){this[Ne].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[Ne].oninputsourceschange),this[Ne].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!==(e=this[Ne].onselect)&&void 0!==e?e:()=>{}}set onselect(e){this[Ne].onselect&&this.removeEventListener("select",this[Ne].onselect),this[Ne].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!==(e=this[Ne].onselectstart)&&void 0!==e?e:()=>{}}set onselectstart(e){this[Ne].onselectstart&&this.removeEventListener("selectstart",this[Ne].onselectstart),this[Ne].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!==(e=this[Ne].onselectend)&&void 0!==e?e:()=>{}}set onselectend(e){this[Ne].onselectend&&this.removeEventListener("selectend",this[Ne].onselectend),this[Ne].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!==(e=this[Ne].onsqueeze)&&void 0!==e?e:()=>{}}set onsqueeze(e){this[Ne].onsqueeze&&this.removeEventListener("squeeze",this[Ne].onsqueeze),this[Ne].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!==(e=this[Ne].onsqueezestart)&&void 0!==e?e:()=>{}}set onsqueezestart(e){this[Ne].onsqueezestart&&this.removeEventListener("squeezestart",this[Ne].onsqueezestart),this[Ne].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!==(e=this[Ne].onsqueezeend)&&void 0!==e?e:()=>{}}set onsqueezeend(e){this[Ne].onsqueezeend&&this.removeEventListener("squeezeend",this[Ne].onsqueezeend),this[Ne].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!==(e=this[Ne].onvisibilitychange)&&void 0!==e?e:()=>{}}set onvisibilitychange(e){this[Ne].onvisibilitychange&&this.removeEventListener("visibilitychange",this[Ne].onvisibilitychange),this[Ne].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!==(e=this[Ne].onframeratechange)&&void 0!==e?e:()=>{}}set onframeratechange(e){this[Ne].onframeratechange&&this.removeEventListener("frameratechange",this[Ne].onframeratechange),this[Ne].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}class Ge extends EventTarget{}const Qe=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),Ke={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class _e extends Ge{constructor(e,t,i={}){if(super(),e[Ne].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...Ke,...i};this[Qe]={session:e,context:t,antialias:n.antialias}}get context(){return this[Qe].context}get antialias(){return this[Qe].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Qe].context.drawingBufferWidth}get framebufferHeight(){return this[Qe].context.drawingBufferHeight}getViewport(e){if(e[$].session!==this[Qe].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Qe].session[Ne].device[it].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof Be))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[Ne].ended?0:1}}const $e=Symbol("@immersive-web-emulation-runtime/xr-system");class Ue extends EventTarget{constructor(e){super(),this[$e]={device:e}}isSessionSupported(e){return new Promise(((t,i)=>{e===He.Inline?t(!0):t(this[$e].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[$e].activeSession)return void n(new DOMException("An active XRSession already exists.","InvalidStateError"));const{requiredFeatures:a=[],optionalFeatures:s=[]}=t,{supportedFeatures:o}=this[$e].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))),l=Array.from(new Set([...a,...u,tt.Viewer,tt.Local])),c=new Be(this[$e].device,e,l);this[$e].activeSession=c,c.addEventListener("end",(()=>{this[$e].activeSession=void 0})),i(c)})).catch(n)}))}}const We=Symbol("@immersive-web-emulation-runtime/action-player");class Je{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 Xe(ke.Viewer,e),s={[U.Left]:new I(a),[U.Right]:new I(a),[U.None]:new I(a)};this[We]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:r,recordedFramePointer:0,startingTimeStamp:r[0][0],endingTimeStamp:r[r.length-1][0],playbackTime:r[0][0],playing:!1,viewerSpace:a,viewSpaces:s,vec3:p(),quat:x()},o(this[We].viewSpaces[U.Left][E].offsetMatrix,m(-i/2,0,0)),o(this[We].viewSpaces[U.Right][E].offsetMatrix,m(i/2,0,0)),n.forEach((t=>{const i=t[0],n=t[1];let r;if(n.hasGamepad){const e=[];for(let t=0;t<n.numButtons;t++)e.push({id:t.toString(),type:"manual"});const t=[];for(let e=0;e<n.numAxes;e++)t.push({id:e.toString(),type:"manual"});r=new D({mapping:n.mapping,buttons:e,axes:t})}const a=new I(e);let s;n.hasHand&&(s=new Y,Object.values(W).forEach((e=>{s.set(e,new ee(e,a))})));const o=new H(n.handedness,n.targetRayMode,n.profiles,a,r,n.hasGrip?new I(e):void 0,n.hasHand?s:void 0);this[We].inputSources.set(i,{active:!1,source:o}),this[We].inputSchemas.set(i,n)}))}play(){this[We].recordedFramePointer=0,this[We].playbackTime=this[We].startingTimeStamp,this[We].playing=!0,this[We].actualTimeStamp=performance.now()}stop(){this[We].playing=!1}get playing(){return this[We].playing}get viewerSpace(){return this[We].viewerSpace}get viewSpaces(){return this[We].viewSpaces}get inputSources(){return Array.from(this[We].inputSources.values()).filter((e=>e.active)).map((e=>e.source))}playFrame(){const e=performance.now(),t=e-this[We].actualTimeStamp;if(this[We].actualTimeStamp=e,this[We].playbackTime+=t,this[We].playbackTime>this[We].endingTimeStamp)return void this.stop();for(;this[We].frames[this[We].recordedFramePointer+1][0]<this[We].playbackTime;)this[We].recordedFramePointer++;const i=this[We].frames[this[We].recordedFramePointer],n=this[We].frames[this[We].recordedFramePointer+1],r=(this[We].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[We].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[We].inputSources.forEach((e=>{e.active=!1})),s.forEach(((e,t)=>{this[We].inputSources.get(t).active=!0;const i=this[We].inputSources.get(t).source,n=this[We].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],l=n.handTransforms[8*a+7],c=e.hand.get(t.jointSequence[a]);this.updateXRSpaceFromMergedFrames(c,s,o,r),c[Z].radius=(l-u)*r+u}if(t.hasGamepad){const t=e.gamepad;n.buttons.forEach(((e,n)=>{const a=t.buttons[n];a[L].pressed=1===e[0],a[L].touched=1===e[1];const s=i.buttons[n][2],o=e[2];a[L].value=(o-s)*r+s})),n.axes.forEach(((e,n)=>{const a=i.axes[n];t[L].axesMap[n.toString()].x=(e-a)*r+a}))}}updateXRSpaceFromMergedFrames(e,t,i,n){const r=m(t[0],t[1],t[2]),a=b(t[3],t[4],t[5],t[6]),s=m(i[0],i[1],i[2]),o=b(i[3],i[4],i[5],i[6]);v(this[We].vec3,r,s,n),S(this[We].quat,a,o,n),u(e[E].offsetMatrix,this[We].quat,this[We].vec3)}processRawInputData(e){const t=e[0],i=this[We].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 Ye 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 Ze=Symbol("@immersive-web-emulation-runtime/xr-viewport");class et{constructor(e,t,i,n){this[Ze]={x:e,y:t,width:i,height:n}}get x(){return this[Ze].x}get y(){return this[Ze].y}get width(){return this[Ze].width}get height(){return this[Ze].height}}var tt;!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"}(tt||(tt={}));const it=Symbol("@immersive-web-emulation-runtime/xr-device"),nt={ipd:.063,fovy:Math.PI/2,headsetPosition:new V(0,1.6,0),headsetQuaternion:new P,stereoEnabled:!1};const rt={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"}]},at={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"}]},st={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,2.0823669899527886e-8,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-8.329467959811154e-8,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},ot={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,-1.5779937356796836e-8,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},ut={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,1.0736208366779465e-8,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-2.6238110351073374e-8,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},lt={name:"Oculus Quest 1",controllerConfig:{profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,4.673031295254759e-9,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,3.688163374704345e-8,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ct={name:"Meta Quest 2",controllerConfig:st,supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.MeshDetection,tt.HitTest,tt.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},dt={name:"Meta Quest Pro",controllerConfig:ot,supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.MeshDetection,tt.HitTest,tt.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ht={name:"Meta Quest 3",controllerConfig:ut,supportedSessionModes:[He.Inline,He.ImmersiveVR,He.ImmersiveAR],supportedFeatures:[tt.Viewer,tt.Local,tt.LocalFloor,tt.BoundedFloor,tt.Unbounded,tt.Anchors,tt.PlaneDetection,tt.MeshDetection,tt.HitTest,tt.HandTracking,tt.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},pt=Symbol("@immersive-web-emulation-runtime/action-recorder"),mt=e=>{const t=[];return e.forEach((e=>{t.push(parseFloat(e.toFixed(3)))})),t};e.ActionRecorder=class{constructor(e,t){this[pt]={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[pt].refSpace))||void 0===t?void 0:t.transform.matrix;if(!n)return;const r={timeStamp:i,position:l(p(),n),quaternion:d(x(),n),inputFrames:[]};this[pt].session.inputSources.forEach((t=>{var i,n;if(!this[pt].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[pt].inputMap.size;this[pt].inputMap.set(t,i),this[pt].schemaMap.set(i,e)}const a=this[pt].inputMap.get(t),s=this[pt].schemaMap.get(a),o=null===(i=e.getPose(t.targetRaySpace,this[pt].refSpace))||void 0===i?void 0:i.transform.matrix;if(o){const i={index:a,targetRayTransform:{position:l(p(),o),quaternion:d(x(),o)}};if(s.hasGrip){const r=null===(n=e.getPose(t.gripSpace,this[pt].refSpace))||void 0===n?void 0:n.transform.matrix;if(r){const e=l(p(),r),t=d(x(),r);i.gripTransform={position:e,quaternion:t}}}if(s.hasHand){const n=Array.from(t.hand.values());let r=!0;if(r&&(r=e.fillPoses(n,t.targetRaySpace,this[pt].jointTransforms)),r&&(r=e.fillJointRadii(n,this[pt].jointRadii)),r){const e={};for(let t=0;t<25;t++){const i=this[pt].jointTransforms.slice(16*t,16*(t+1)),r=this[pt].jointRadii[t],a=l(p(),i),s=d(x(),i);e[n[t].jointName]={position:a,quaternion:s,radius:r}}i.hand=e}}if(s.hasGamepad){const e={buttons:t.gamepad.buttons.map((e=>e?[e.pressed?1:0,e.touched?1:0,e.value]:null)),axes:Array.from(t.gamepad.axes)};i.gamepad=e}r.inputFrames.push(i)}})),this[pt].compressedFrames.push(this.compressActionFrame(r))}compressActionFrame(e){const t=[Math.round(10*e.timeStamp)/10,...mt(e.position),...mt(e.quaternion)];return e.inputFrames.forEach((e=>{const i=e.index,n=this[pt].schemaMap.get(i),r=[i,...mt(e.targetRayTransform.position),...mt(e.targetRayTransform.quaternion)];if(n.hasGrip&&r.push([...mt(e.gripTransform.position),...mt(e.gripTransform.quaternion)]),n.hasHand){const t=[];Object.values(e.hand).forEach((({position:e,quaternion:i,radius:n})=>{t.push(...mt(e),...mt(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[pt].schemaMap.entries()),frames:this[pt].compressedFrames};console.log(JSON.stringify(e))}},e.XRDevice=class{constructor(e,t={}){var n,r,a,s,l,c;const d=new q,h=new Xe(ke.Viewer,d),p={[U.Left]:new I(h),[U.Right]:new I(h),[U.None]:new I(h)},f=e.controllerConfig,g={};f&&Object.values(A).forEach((e=>{f.layout[e]&&(g[e]=new _(f,e,d))}));const v={[A.Left]:new fe(te,A.Left,d),[A.Right]:new fe(te,A.Right,d)},x=null!==(n=t.canvasContainer)&&void 0!==n?n:document.createElement("div");x.dataset.webxr_runtime="Immersive Web Emulation Runtime v1.0.3",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[it]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,userAgent:e.userAgent,position:null!==(r=t.headsetPosition)&&void 0!==r?r:nt.headsetPosition.clone(),quaternion:null!==(a=t.headsetQuaternion)&&void 0!==a?a:nt.headsetQuaternion.clone(),stereoEnabled:null!==(s=t.stereoEnabled)&&void 0!==s?s:nt.stereoEnabled,ipd:null!==(l=t.ipd)&&void 0!==l?l:nt.ipd,fovy:null!==(c=t.fovy)&&void 0!==c?c:nt.fovy,controllers:g,hands:v,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:je.Visible,pendingVisibilityState:null,xrSystem:null,matrix:i(),globalSpace:d,viewerSpace:h,viewSpaces:p,canvasContainer:x,getViewport:(e,t)=>{const i=e.context.canvas,{width:n,height:r}=i;switch(t.eye){case U.None:return new et(0,0,n,r);case U.Left:return new et(0,0,this[it].stereoEnabled?n/2:n,r);case U.Right:return new et(n/2,0,this[it].stereoEnabled?n/2:0,r)}},updateViews:()=>{u(this[it].viewerSpace[E].offsetMatrix,this[it].quaternion.quat,this[it].position.vec3),o(this[it].viewSpaces[U.Left][E].offsetMatrix,m(-this[it].ipd/2,0,0)),o(this[it].viewSpaces[U.Right][E].offsetMatrix,m(this[it].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;const t=e.context.canvas;t.parentElement!==this[it].canvasContainer&&(this[it].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height},this[it].canvasContainer.appendChild(t),document.body.appendChild(this[it].canvasContainer)),t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[it].canvasData){const{canvas:e,parent:t,width:i,height:n}=this[it].canvasData;e.width=i,e.height=n,t?t.appendChild(e):this[it].canvasContainer.removeChild(e),document.body.removeChild(this[it].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null===(t=this[it].actionPlayer)||void 0===t?void 0:t.playing)this[it].actionPlayer.playFrame();else{const t=e.session;this[it].updateViews(),this[it].pendingVisibilityState&&(this[it].visibilityState=this[it].pendingVisibilityState,this[it].pendingVisibilityState=null,t.dispatchEvent(new Ce("visibilitychange",{session:t}))),this[it].visibilityState===je.Visible&&this.activeInputs.forEach((t=>{t.onFrameStart(e)})),this[it].pendingReferenceSpaceReset&&(t[Ne].referenceSpaces.forEach((e=>{switch(e[Ae].type){case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:e.dispatchEvent(new Ye("reset",{referenceSpace:e}))}})),this[it].pendingReferenceSpaceReset=!1)}this[it].updateViews()}},this[it].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise(((e,t)=>{e(!0)}))},configurable:!0}),this[it].xrSystem=new Ue(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[it].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[it].userAgent,writable:!1,configurable:!1,enumerable:!0}),e.XRSystem=Ue,e.XRSession=Be,e.XRRenderState=De,e.XRFrame=Pe,e.XRSpace=I,e.XRReferenceSpace=Xe,e.XRJointSpace=ee,e.XRView=J,e.XRViewport=et,e.XRRigidTransform=Me,e.XRPose=ve,e.XRViewerPose=Fe,e.XRJointPose=ye,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRHand=Y,e.XRLayer=Ge,e.XRWebGLLayer=_e,e.XRSessionEvent=Ce,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=Le,e.XRReferenceSpaceEvent=Ye}get supportedSessionModes(){return this[it].supportedSessionModes}get supportedFeatures(){return this[it].supportedFeatures}get supportedFrameRates(){return this[it].supportedFrameRates}get isSystemKeyboardSupported(){return this[it].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[it].internalNominalFrameRate}get stereoEnabled(){return this[it].stereoEnabled}set stereoEnabled(e){this[it].stereoEnabled=e}get ipd(){return this[it].ipd}set ipd(e){this[it].ipd=e}get fovy(){return this[it].fovy}set fovy(e){this[it].fovy=e}get position(){return this[it].position}get quaternion(){return this[it].quaternion}get viewerSpace(){var e;return(null===(e=this[it].actionPlayer)||void 0===e?void 0:e.playing)?this[it].actionPlayer.viewerSpace:this[it].viewerSpace}get viewSpaces(){var e;return(null===(e=this[it].actionPlayer)||void 0===e?void 0:e.playing)?this[it].actionPlayer.viewSpaces:this[it].viewSpaces}get controllers(){return this[it].controllers}get hands(){return this[it].hands}get primaryInputMode(){return this[it].primaryInputMode}set primaryInputMode(e){"controller"===e||"hand"===e?this[it].primaryInputMode=e:console.warn('primary input mode can only be "controller" or "hand"')}get activeInputs(){if(this[it].visibilityState!==je.Visible)return[];return("controller"===this[it].primaryInputMode?Object.values(this[it].controllers):Object.values(this[it].hands)).filter((e=>e.connected))}get inputSources(){var e;return(null===(e=this[it].actionPlayer)||void 0===e?void 0:e.playing)?this[it].actionPlayer.inputSources:this.activeInputs.map((e=>e.inputSource))}get canvasContainer(){return this[it].canvasContainer}get activeSession(){var e;return null===(e=this[it].xrSystem)||void 0===e?void 0:e[$e].activeSession}recenter(){const e=new V(-this.position.x,0,-this.position.z),t=new V(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();const i=Math.atan2(t.x,-t.z),n=(new P).setFromAxisAngle(new V(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[it].controllers),...Object.values(this[it].hands)].forEach((t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)})),this[it].pendingReferenceSpaceReset=!0}get visibilityState(){return this[it].visibilityState}updateVisibilityState(e){if(!Object.values(je).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[it].visibilityState&&(this[it].pendingVisibilityState=e)}createActionPlayer(e,t){return this[it].actionPlayer=new Je(e,t,this[it].ipd),this[it].actionPlayer}},e.XRFrame=Pe,e.XRHand=Y,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=Le,e.XRJointPose=ye,e.XRJointSpace=ee,e.XRLayer=Ge,e.XRPose=ve,e.XRReferenceSpace=Xe,e.XRReferenceSpaceEvent=Ye,e.XRRenderState=De,e.XRRigidTransform=Me,e.XRSession=Be,e.XRSessionEvent=Ce,e.XRSpace=I,e.XRSystem=Ue,e.XRView=J,e.XRViewerPose=Fe,e.XRViewport=et,e.XRWebGLLayer=_e,e.metaQuest2=ct,e.metaQuest3=ht,e.metaQuestPro=dt,e.oculusQuest1=lt,Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -3360,6 +3360,7 @@ class XRSession extends EventTarget {
3360
3360
  const currInputs = this[PRIVATE$6].device.inputSources.filter((inputSource) => !inputSource.hand || handTrackingOn);
3361
3361
  const added = currInputs.filter((item) => !prevInputs.includes(item));
3362
3362
  const removed = prevInputs.filter((item) => !currInputs.includes(item));
3363
+ this[PRIVATE$6].activeInputSources = currInputs;
3363
3364
  if (added.length > 0 || removed.length > 0) {
3364
3365
  this.dispatchEvent(new XRInputSourcesChangeEvent('inputsourceschange', {
3365
3366
  session: this,
@@ -3367,7 +3368,6 @@ class XRSession extends EventTarget {
3367
3368
  removed,
3368
3369
  }));
3369
3370
  }
3370
- this[PRIVATE$6].activeInputSources = currInputs;
3371
3371
  },
3372
3372
  onend: null,
3373
3373
  oninputsourceschange: null,
@@ -4000,7 +4000,7 @@ class ActionPlayer {
4000
4000
  }
4001
4001
  }
4002
4002
 
4003
- const VERSION = "1.0.2";
4003
+ const VERSION = "1.0.3";
4004
4004
 
4005
4005
  /**
4006
4006
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -1 +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],l=t[7],c=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*l-a*s,w=n*u-r*o,b=n*l-a*o,M=r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=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function o(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=n+n,u=r+r,l=a+a,c=n*o,d=n*u,h=n*l,p=r*u,m=r*l,f=a*l,g=s*o,v=s*u,x=s*l;return e[0]=1-(p+f),e[1]=d+x,e[2]=h-v,e[3]=0,e[4]=d-x,e[5]=1-(c+f),e[6]=m+g,e[7]=0,e[8]=h+v,e[9]=m-g,e[10]=1-(c+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 l(e,t){var i=t[0],n=t[1],r=t[2],a=t[4],s=t[5],o=t[6],u=t[8],l=t[9],c=t[10];return e[0]=Math.hypot(i,n,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(u,l,c),e}function c(t,i){var n=new e(3);l(n,i);var r=1/n[0],a=1/n[1],s=1/n[2],o=i[0]*r,u=i[1]*a,c=i[2]*s,d=i[4]*r,h=i[5]*a,p=i[6]*s,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-c)/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+c)/x):h>g?(x=2*Math.sqrt(1+h-o-g),t[3]=(m-c)/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+c)/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,l=t[0],c=t[1],d=t[2],h=t[3],p=i[0],m=i[1],f=i[2],g=i[3];return(a=l*p+c*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*l+u*p,e[1]=o*c+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],l=t[2],c=r*l-a*u,d=a*o-n*l,h=n*u-r*o,p=r*h-a*d,m=a*c-n*h,f=n*d-r*c,g=2*s;c*=g,d*=g,h*=g,p*=2,m*=2,f*=2,e[0]=o+c+p,e[1]=u+d+m,e[2]=l+h+f}(this.vec3,this.tempVec3,e.quat),this}}class V{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 V(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],l=i[2],c=i[3];e[0]=n*c+s*o+r*l-a*u,e[1]=r*c+s*u+a*o-n*l,e[2]=a*c+s*l+n*u-r*o,e[3]=s*c-n*o-r*u-a*l}(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return x(this.quat,e.vec3,t),this}}const P=Symbol("@immersive-web-emulation-runtime/gamepad");var L,O,k;!function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"}(L||(L={}));class A{constructor(e,t){this[P]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[P].type?this[P].pressed:this[P].value>0}get touched(){return"manual"===this[P].type?this[P].touched:this[P].touched||this.pressed}get value(){return this[P].value}}class z{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class D{constructor(e,t="",i=-1){this[P]={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[P].buttonsSequence.push(null):(this[P].buttonsSequence.push(e.id),this[P].buttonsMap[e.id]=new A(e.type,null!==(t=e.eventTrigger)&&void 0!==t?t:null))})),e.axes.forEach((e=>{null===e?this[P].axesSequence.push(null):(this[P].axesSequence.push(e.id+e.type),this[P].axesMap[e.id]||(this[P].axesMap[e.id]={x:0,y:0}))}))}get id(){return this[P].id}get index(){return this[P].index}get connected(){return this[P].connected}get timestamp(){return this[P].timestamp}get mapping(){return this[P].mapping}get axes(){const e=[];return this[P].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[P].axesMap[i].y:this[P].axesMap[i].x)}})),e}get buttons(){return this[P].buttonsSequence.map((e=>null===e?new z:this[P].buttonsMap[e]))}get hapticActuators(){return this[P].hapticActuators}get vibrationActuator(){return null}}!function(e){e.None="none",e.Left="left",e.Right="right"}(O||(O={})),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 H 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 N=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),B={[O.Left]:{position:new T(-.25,1.5,-.4),quaternion:new V},[O.Right]:{position:new T(.25,1.5,-.4),quaternion:new V},[O.None]:{position:new T(.25,1.5,-.4),quaternion:new V}};class G{constructor(e){this[N]={inputSource:e,position:B[e.handedness].position.clone(),quaternion:B[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[N].position}get quaternion(){return this[N].quaternion}get inputSource(){return this[N].inputSource}get connected(){return this[N].connected}set connected(e){this[N].connected=e,this[N].inputSource.gamepad[P].connected=e}onFrameStart(e){o(this[N].inputSource.targetRaySpace[R].offsetMatrix,this[N].quaternion.quat,this[N].position.vec3);const t=e.session;this[N].inputSource.gamepad.buttons.forEach((i=>{i instanceof A&&(i[P].lastFrameValue=i[P].value,null!=i[P].pendingValue&&(i[P].value=i[P].pendingValue,i[P].pendingValue=null),null!=i[P].eventTrigger&&(0===i[P].lastFrameValue&&i[P].value>0?(t.dispatchEvent(new H(i[P].eventTrigger,{frame:e,inputSource:this[N].inputSource})),t.dispatchEvent(new H(i[P].eventTrigger+"start",{frame:e,inputSource:this[N].inputSource}))):i[P].lastFrameValue>0&&0===i[P].value&&t.dispatchEvent(new H(i[P].eventTrigger+"end",{frame:e,inputSource:this[N].inputSource}))))})),this[N].inputSourceChanged=this.connected!==this[N].lastFrameConnected,this[N].lastFrameConnected=this.connected}}const Q=Symbol("@immersive-web-emulation-runtime/xr-controller");class K 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)),this[Q]={gamepadConfig:e.layout[t].gamepad}}get gamepadConfig(){return this[Q].gamepadConfig}updateButtonValue(e,t){if(t>1||t<0)return void console.warn(`Out-of-range value ${t} provided for button ${e}.`);const i=this[N].inputSource.gamepad[P].buttonsMap[e];if(i){if("binary"===i[P].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[P].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[N].inputSource.gamepad[P].buttonsMap[e];i?i[P].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[N].inputSource.gamepad[P].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[N].inputSource.gamepad[P].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"}($||($={}));class W{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"}(U||(U={}));class J extends Map{}const Y=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class Z extends E{constructor(e,t,i){super(t,i),this[Y]={jointName:e,radius:0}}get jointName(){return this[Y].jointName}}const ee={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:{jointTransforms:{wrist:{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.04913589730858803,.0021463718730956316,.11701996624469757,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.07536252588033676,-.9959676265716553,-.04867160692811012,0,.5877083539962769,-.08379616588354111,.8047218918800354,0,-.8055551648139954,.032041035592556,.5916536450386047,0,-.010643752291798592,.0006936835707165301,.08736639469861984,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.1374533325433731,-.9904957413673401,.004982374142855406,0,.5534393787384033,.08097179979085922,.8289443850517273,0,-.8214688897132874,-.11118389666080475,.559309184551239,0,.015547193586826324,-.0003480653394944966,.0681300163269043,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.04330715537071228,.003409178927540779,.0492292083799839,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.062003348022699356,.004069602582603693,.03322213143110275,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.02009812369942665,.008770795539021492,.08660387247800827,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9001791477203369,-.2598813474178314,.3494834005832672,0,.06073702871799469,.8695210218429565,.490146666765213,0,-.4312632381916046,-.41999316215515137,.7985095381736755,0,-.00017739279428496957,.03890012577176094,.039073407649993896,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9082008600234985,-.20898112654685974,.36262574791908264,0,.11045389622449875,.9553793668746948,.27395179867744446,0,-.40369608998298645,-.20874978601932526,.8907597661018372,0,.01617925800383091,.05482936650514603,.008788082748651505,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.02599053829908371,.059902746230363846,-.012860597111284733,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.03362493962049484,.06421422213315964,-.033461250364780426,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.03627845644950867,.011579737067222595,.08550142496824265,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9876697659492493,-.06786545366048813,.1410750150680542,0,-.015095947310328484,.855663537979126,.5173118710517883,0,-.15582047402858734,-.5130629539489746,.8440889716148376,0,-.021259509027004242,.04587256908416748,.03659208118915558,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.988391637802124,-.04354291781783104,.14555205404758453,0,.008894841186702251,.9729899168014526,.23067504167556763,0,-.15166506171226501,-.22670257091522217,.9620829224586487,0,-.014570588245987892,.06789684295654297,.0003578895702958107,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.010392282158136368,.07414241135120392,-.026147106662392616,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.0069718430750072,.08024183660745621,-.05014154314994812,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.05402477830648422,.015797706320881844,.08152295649051666,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9940828680992126,.05735103040933609,.09224652498960495,0,-.10022822767496109,.8116500377655029,.5754809379577637,0,-.041867565363645554,-.5813214182853699,.8125960826873779,0,-.041623555123806,.04171867296099663,.03582974523305893,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9843675494194031,.12044742703437805,.12850022315979004,0,-.15629759430885315,.9337108135223389,.3221098482608795,0,-.08118485659360886,-.3371586799621582,.937940776348114,0,-.039990875869989395,.06438793987035751,.004141641780734062,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03783353418111801,.07334739714860916,-.020782606676220894,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03445569798350334,.0802423357963562,-.04392268508672714,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9181402921676636,.35625091195106506,.17350243031978607,0,-.39615097641944885,.8352503180503845,.38134080171585083,0,-.009065053425729275,-.41885748505592346,.9080066680908203,0,-.06191859766840935,.013620133511722088,.07850203663110733,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9714386463165283,.236698180437088,-.016745081171393394,0,-.18462024629116058,.7982627749443054,.5733163952827454,0,.14906984567642212,-.5538501739501953,.8191629648208618,0,-.061502378433942795,.032741155475378036,.03705105185508728,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9337416291236877,.35620439052581787,-.03527557849884033,0,-.33203884959220886,.8987522721290588,.28634607791900635,0,.13370157778263092,-.2556603252887726,.9574766755104065,0,-.06608185172080994,.049755651503801346,.011886020191013813,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.0687975287437439,.054948460310697556,-.007561664097011089,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.06947512179613113,.0613851435482502,-.028543535619974136,1],radius:.005425984505563974}},gripOffsetMatrix:[-.0005348679260350764,-.8648636937141418,-.5020061135292053,0,-.2741127908229828,-.48265108466148376,.8318111896514893,0,-.9616971015930176,.13805119693279266,-.2368120402097702,0,-.02878567762672901,.0017147823236882687,.04536811262369156,1]},pinch:{jointTransforms:{wrist:{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06867414712905884,-.009423808194696903,.10627774149179459,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.5012241005897522,-.8650535345077515,-.0213695727288723,0,.7415963411331177,-.4421543478965759,.5045139193534851,0,-.44587990641593933,.23702676594257355,.8631392121315002,0,-.032122574746608734,-.01196830440312624,.07194234430789948,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[-.3175753057003021,-.9460570216178894,-.06419729441404343,0,.8958902955055237,-.32153913378715515,.30658137798309326,0,-.3106854259967804,.03984907269477844,.9496771097183228,0,-.017625702545046806,-.01967475935816765,.04387917369604111,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,-.007126678712666035,-.021021386608481407,.011786630377173424,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,.0003423091256991029,-.024528030306100845,-.011410919018089771,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.038037415593862534,-.0020236473064869642,.07626739144325256,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.7986818552017212,-.35985732078552246,.48229536414146423,0,.538311243057251,.7854709625244141,-.30537736415863037,0,-.2689369022846222,.5035246014595032,.8210577368736267,0,-.006869405973702669,.033938243985176086,.04206443578004837,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.8285930156707764,-.32672837376594543,.4546217918395996,0,.5577570199966431,.4116027057170868,-.7207564115524292,0,.04836784675717354,.8507823944091797,.5232869386672974,0,.0033306588884443045,.014840902760624886,.010923954658210278,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,.0021551470272243023,-.0058362227864563465,-.0017938464879989624,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,-.00131594471167773,-.025222131982445717,-.012442642822861671,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.05395089089870453,.003063359996303916,.07402937114238739,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9187911748886108,-.1530158370733261,.36387869715690613,0,.038666240870952606,.9522662162780762,.302808940410614,0,-.3928440511226654,-.26414817571640015,.8808513283729553,0,-.02717282809317112,.04162866622209549,.03678669035434723,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9228746294975281,-.12856416404247284,.36300456523895264,0,.14524033665657043,.9892153143882751,-.01890045404434204,0,-.3566599190235138,.07016586512327194,.9315956234931946,0,-.01030921470373869,.05296773463487625,-.0010256498353555799,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,-.0004833847051486373,.05103470757603645,-.026690717786550522,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,.008158999495208263,.05004044249653816,-.050120558589696884,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06732909381389618,.007902119308710098,.07209732383489609,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9391821026802063,-.027994679287075996,.34227466583251953,0,-.18282271921634674,.8029410243034363,.5673282742500305,0,-.2907087206840515,-.5954000353813171,.7489906549453735,0,-.047129884362220764,.03806127607822418,.032147664576768875,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9249380826950073,.03699534013867378,.3783116042613983,0,-.12898847460746765,.9667453765869141,.2208271026611328,0,-.3575615882873535,-.25304901599884033,.8989526629447937,0,-.03579339757561684,.06127955764532089,.002939916681498289,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.026291755959391594,.06800390034914017,-.02094830758869648,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.016345610842108727,.07300511747598648,-.04263874143362045,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.8769711852073669,.31462907791137695,.36322021484375,0,-.4506046175956726,.801031768321991,.39408499002456665,0,-.16696058213710785,-.5092697143554688,.8442559838294983,0,-.07460174709558487,.0062340241856873035,.06756893545389175,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9498357176780701,.1553308218717575,.2714462876319885,0,-.3019258379936218,.6817675232887268,.6663586497306824,0,-.08155745267868042,-.7148879170417786,.694466233253479,0,-.06697750836610794,.029482364654541016,.02902858518064022,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9214097261428833,.27928245067596436,.2701927423477173,0,-.3670244514942169,.8538867831230164,.36901235580444336,0,-.12765564024448395,-.43917882442474365,.8892839550971985,0,-.06447203457355499,.05144399777054787,.0076942890882492065,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.06187915802001953,.060364335775375366,-.010368337854743004,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.056796226650476456,.07042007893323898,-.02921444922685623,1],radius:.005425984505563974}},gripOffsetMatrix:[.08027800917625427,-.8086723685264587,-.5827556252479553,0,-.4154181480407715,-.5585916638374329,.7179154753684998,0,-.9060805439949036,.1844543218612671,-.3807799518108368,0,-.038054611533880234,-.002910431008785963,.03720742464065552,1]},point:{jointTransforms:{wrist:{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05789132043719292,.01670890860259533,.11183350533246994,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[.02145560085773468,-.9978390336036682,.0621047280728817,0,.41311800479888916,.06541631370782852,.9083252549171448,0,-.9104245901107788,.006167683284729719,.4136286973953247,0,-.016488194465637207,.012708572670817375,.08862338215112686,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.21270370483398438,-.966137707233429,.14606566727161407,0,.49890995025634766,.2359165996313095,.8339261412620544,0,-.8401462435722351,-.10450579971075058,.5321959853172302,0,.013112368993461132,.012508046813309193,.07517509907484055,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.04150351136922836,.016039609909057617,.05719054117798805,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.06548332422971725,.01683700829744339,.0516640841960907,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.02592567168176174,.019982583820819855,.08479326963424683,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9063700437545776,-.21756279468536377,.3621589243412018,0,.0970839336514473,.9415287375450134,.3226419687271118,0,-.41117796301841736,-.2572731077671051,.8744958639144897,0,-.0015709538711234927,.043078210204839706,.034657616168260574,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9159826040267944,-.1651475727558136,.36565208435058594,0,.09755707532167435,.9756820797920227,.1962820291519165,0,-.3891757130622864,-.14411886036396027,.9098196625709534,0,.014023927971720695,.052835866808891296,.0014903299743309617,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.023482320830225945,.05633850023150444,-.020621655508875847,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.03096788562834263,.06281610578298569,-.040703095495700836,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.04184452444314957,.022474845871329308,.08177298307418823,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9720265865325928,-.08313076198101044,.21966552734375,0,.20477405190467834,.7580050826072693,-.6192700862884521,0,-.11502730846405029,.6469289064407349,.7538246512413025,0,-.022107340395450592,.05035499855875969,.02970452979207039,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9779140949249268,-.07129573822021484,.19646917283535004,0,.1287083923816681,-.5352076292037964,-.8348574042320251,0,.1646735966205597,.8417060971260071,-.5142109394073486,0,-.017169542610645294,.022584279999136925,-.00265491777099669,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02170622907578945,-.0006043742760084569,.011511396616697311,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02438267692923546,-.0026927536819130182,.03627248480916023,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05944233387708664,.0264605600386858,.07478221505880356,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9842101335525513,.024470895528793335,.1753024309873581,0,.12200043350458145,.6237703561782837,-.7720272541046143,0,-.12824076414108276,.7812241315841675,.610936164855957,0,-.04249368980526924,.0467497780919075,.027722163125872612,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9941774606704712,.05949164181947708,.08983955532312393,0,.10504482686519623,-.7208291888237,-.6851072907447815,0,.024001073092222214,.6905553936958313,-.7228817939758301,0,-.0374927744269371,.016285063698887825,.0038980208337306976,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.038130562752485275,-.0020653479732573032,.02310742810368538,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.0390593595802784,.004176302347332239,.0466572530567646,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9147363901138306,.3458845317363739,.20885537564754486,0,-.3923271894454956,.8839452862739563,.2544005811214447,0,-.09662359952926636,-.3146490156650543,.9442773461341858,0,-.06715242564678192,.024195827543735504,.07137546688318253,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9613109827041626,.22439135611057281,.15977802872657776,0,.01002211682498455,.5511574745178223,-.8343409299850464,0,-.27528178691864014,.8036624789237976,.5275853276252747,0,-.06273911893367767,.038559623062610626,.028268879279494286,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9820972084999084,.18811029195785522,-.00995189044624567,0,.14063723385334015,-.7673450708389282,-.6256227493286133,0,-.12532226741313934,.6130226850509644,-.7800630927085876,0,-.05428232625126839,.013870777562260628,.012061242014169693,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05173685774207115,.0014194445684552193,.02790539152920246,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05098633095622063,.008463085629045963,.048688892275094986,1],radius:.005425984505563974}},gripOffsetMatrix:[.005510995630174875,-.9149997234344482,-.40341615676879883,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.9340395331382751,.13936474919319153,-.32885703444480896,0,-.031803809106349945,.007837686687707901,.04313928261399269,1]}}},te={mapping:L.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},ie=h(),ne=v(),re=h(),ae=h(),se=v(),oe=h(),ue=h(),le=v(),ce=h(),de=(e,t,i,n)=>(u(ie,t),c(ne,t),l(re,t),u(ae,i),c(se,i),l(oe,i),g(ue,ie,ae,n),y(le,ne,se,n),g(ce,re,oe,n),function(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=t[3],u=r+r,l=a+a,c=s+s,d=r*u,h=r*l,p=r*c,m=a*l,f=a*c,g=s*c,v=o*u,x=o*l,y=o*c,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,le,ue,ce),e),he=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],pe=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class me extends G{constructor(e,t,i){if(t!==O.Left&&t!==O.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 J;Object.values(U).forEach((e=>{s.set(e,new Z(e,n))}));super(new j(t,k.TrackedPointer,a,n,new D(te),r,s)),this[pe]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[pe].poseId}set poseId(e){this[pe].poses[e]?this[pe].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){const e=this[pe].poses[this[pe].poseId],t=this[pe].poses.pinch;Object.values(U).forEach((i=>{const n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);de(a[R].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===O.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=he[t]})(a[R].offsetMatrix),a[Y].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius})),e.gripOffsetMatrix&&t.gripOffsetMatrix&&de(this.inputSource.gripSpace[R].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[N].inputSource.gamepad[P].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0)return void console.warn(`Out-of-range value ${e} provided for pinch`);this[N].inputSource.gamepad[P].buttonsMap.pinch[P].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const fe=Symbol("@immersive-web-emulation-runtime/xr-pose");class ge{constructor(e,t=!1,i=void 0,n=void 0){this[fe]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:n}}get transform(){return this[fe].transform}get emulatedPosition(){return this[fe].emulatedPosition}get linearVelocity(){return this[fe].linearVelocity}get angularVelocity(){return this[fe].angularVelocity}}const ve=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class xe extends ge{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[ve]={radius:t}}get radius(){return this[ve].radius}}class ye{constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n,Object.freeze(this)}static fromPoint(e){return new ye(e.x,e.y,e.z,e.w)}matrixTransform(e){return new ye}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const Se=void 0!==globalThis.DOMPointReadOnly?globalThis.DOMPointReadOnly:ye,we=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class be{constructor(e,i){const n=p(0,0,0),r=v();this[we]={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[we].matrix,this[we].orientation,this[we].position)}get matrix(){return this[we].matrix}get position(){const e=this[we].position;return new Se(e[0],e[1],e[2],1)}get orientation(){const e=this[we].orientation;return new Se(e[0],e[1],e[2],e[3])}get inverse(){if(!this[we].inverse){const e=t();if(!r(e,this[we].matrix))throw new Error("Matrix is not invertible.");let i=h();u(i,e);let n=v();c(n,e),this[we].inverse=new be(new Se(i[0],i[1],i[2],1),new Se(n[0],n[1],n[2],n[3])),this[we].inverse[we].inverse=this}return this[we].inverse}}const Me=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class Fe extends ge{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[Me]={views:Object.freeze(t)}}get views(){return this[Me].views}}const Re=Symbol("@immersive-web-emulation-runtime/xr-frame"),Ee=t(),qe=t(),Ie=t(),Te=(e,t,i)=>{I.calculateGlobalOffsetMatrix(t,Ee),I.calculateGlobalOffsetMatrix(i,qe),r(Ie,qe),a(e,Ie,Ee)};class Ve{constructor(e,i,n,r,a){this[Re]={session:e,id:i,active:n,animationFrame:r,predictedDisplayTime:a,tempMat4:t()}}get session(){return this[Re].session}get predictedDisplayTime(){return this[Re].predictedDisplayTime}getPose(e,t){if(!this[Re].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");Te(this[Re].tempMat4,e,t);const i=h();u(i,this[Re].tempMat4);const n=v();return c(n,this[Re].tempMat4),new ge(new be({x:i[0],y:i[1],z:i[2],w:1},{x:n[0],y:n[1],z:n[2],w:n[3]}),e[R].emulated)}getViewerPose(e){if(!this[Re].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[Re].session,i=t[He].device,n=this.getPose(i.viewerSpace,e),r=t[He].mode===je.Inline?[$.None]:[$.Left,$.Right],a=[];return r.forEach((n=>{const r=i.viewSpaces[n],s=this.getPose(r,e),o=t[He].getProjectionMatrix(n),u=new W(n,new Float32Array(o),s.transform,t);a.push(u)})),new Fe(n.transform,a,!1)}getJointPose(e,t){const i=this.getPose(e,t),n=e[Y].radius;return new xe(i.transform,n,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Re].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(e.length>t.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let i=!0;for(let n=0;n<e.length;n++)e[n][Y].radius?t[n]=e[n][Y].radius:(t[n]=NaN,i=!1);return i}fillPoses(e,t,i){if(e=Array.from(e),!this[Re].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)=>{Te(this[Re].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[Re].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 Le;const Oe=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var ke;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"}(ke||(ke={}));class Ae extends E{constructor(e,t,i){super(t,i),this[Le]={type:null,onreset:()=>{}},this[Oe].type=e}get onreset(){var e;return null!==(e=this[Oe].onreset)&&void 0!==e?e:()=>{}}set onreset(e){this[Oe].onreset&&this.removeEventListener("reset",this[Oe].onreset),this[Oe].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new Ae(this[Oe].type,this,e)}}Le=Oe;const ze=Symbol("@immersive-web-emulation-runtime/xr-render-state");class De{constructor(e={},t){this[ze]={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[ze].depthNear}get depthFar(){return this[ze].depthFar}get inlineVerticalFieldOfView(){return this[ze].inlineVerticalFieldOfView}get baseLayer(){return this[ze].baseLayer}}class Ce extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}var Xe,je;!function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"}(Xe||(Xe={})),function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"}(je||(je={}));const He=Symbol("@immersive-web-emulation-runtime/xr-session");class Ne extends EventTarget{constructor(e,i,r){super(),this[He]={device:e,mode:i,renderState:new De,pendingRenderState:null,enabledFeatures:r,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[$.Left]:t(),[$.Right]:t(),[$.None]:t()},getProjectionMatrix:e=>this[He].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[He].enabledFeatures.includes(e))return!1;switch(e){case ke.Viewer:return!0;case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:return this[He].mode!=je.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[He].ended)return;this[He].deviceFrameHandle=globalThis.requestAnimationFrame(this[He].onDeviceFrame),null!=this[He].pendingRenderState&&(this[He].renderState=this[He].pendingRenderState,this[He].pendingRenderState=null,this[He].device[tt].onBaseLayerSet(this[He].renderState.baseLayer));const e=this[He].renderState.baseLayer;if(null===e)return;const t=e.context,i=t.canvas;if(this[He].mode!=je.Inline){const e=t.getParameter(t.COLOR_CLEAR_VALUE),i=t.getParameter(t.DEPTH_CLEAR_VALUE),n=t.getParameter(t.STENCIL_CLEAR_VALUE);t.clearColor(0,0,0,0),t.clearDepth(1),t.clearStencil(0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),t.clearColor(e[0],e[1],e[2],e[3]),t.clearDepth(i),t.clearStencil(n)}const{depthNear:r,depthFar:a}=this[He].renderState,{width:s,height:o}=i;if(this[He].mode!==je.Inline){const e=s*(this[He].device.stereoEnabled?.5:1)/o;d(this[He].projectionMatrices[$.Left],this[He].device.fovy,e,r,a),n(this[He].projectionMatrices[$.Right],this[He].projectionMatrices[$.Left])}else{const e=s/o;d(this[He].projectionMatrices[$.None],this[He].renderState.inlineVerticalFieldOfView,e,r,a)}const u=new Ve(this,this[He].frameHandle,!0,!0,performance.now());this[He].device[tt].onFrameStart(u),this[He].updateActiveInputSources();const l=this[He].currentFrameCallbacks=this[He].frameCallbacks;this[He].frameCallbacks=[];const c=performance.now();for(let e=0;e<l.length;e++)try{l[e].cancelled||l[e].callback(c,u)}catch(e){console.error(e)}this[He].currentFrameCallbacks=null,u[Re].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{const e=this[He].enabledFeatures.includes(et.HandTracking),t=this[He].activeInputSources,i=this[He].device.inputSources.filter((t=>!t.hand||e)),n=i.filter((e=>!t.includes(e))),r=t.filter((e=>!i.includes(e)));(n.length>0||r.length>0)&&this.dispatchEvent(new Pe("inputsourceschange",{session:this,added:n,removed:r})),this[He].activeInputSources=i},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[He].onDeviceFrame()}get visibilityState(){return this[He].device.visibilityState}get frameRate(){return this[He].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[He].device.supportedFrameRates)}get renderState(){return this[He].renderState}get inputSources(){return this[He].inputSourceArray.length=0,this[He].ended||this[He].mode===je.Inline||this[He].inputSourceArray.push(...this[He].activeInputSources),this[He].inputSourceArray}get enabledFeatures(){return this[He].enabledFeatures}get isSystemKeyboardSupported(){return this[He].isSystemKeyboardSupported}updateRenderState(e={}){var t,i,n,r;if(this[He].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Ge].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&this[He].mode!==je.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const a={baseLayer:e.baseLayer||(null===(t=this[He].pendingRenderState)||void 0===t?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||(null===(i=this[He].pendingRenderState)||void 0===i?void 0:i.depthFar)||void 0,depthNear:e.depthNear||(null===(n=this[He].pendingRenderState)||void 0===n?void 0:n.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null===(r=this[He].pendingRenderState)||void 0===r?void 0:r.inlineVerticalFieldOfView)||void 0};this[He].pendingRenderState=new De(a,this[He].renderState)}async updateTargetFrameRate(e){return new Promise(((t,i)=>{this[He].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[He].device.supportedFrameRates.includes(e)?(this[He].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[He].nominalFrameRate=e,this.dispatchEvent(new Ce("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${e}`)),t()):i(new DOMException("Requested frame rate not supported.","InvalidStateError"))}))}async requestReferenceSpace(e){return new Promise(((t,i)=>{if(this[He].ended||!this[He].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));let n;switch(e){case ke.Viewer:n=this[He].device.viewerSpace;break;case ke.Local:n=new Ae(e,this[He].device[tt].globalSpace,this[He].device.viewerSpace[R].offsetMatrix);break;case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:n=new Ae(e,this[He].device[tt].globalSpace)}this[He].referenceSpaces.push(n),t(n)}))}requestAnimationFrame(e){if(this[He].ended)return 0;const t=++this[He].frameHandle;return this[He].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[He].frameCallbacks,i=t.findIndex((t=>t&&t.handle===e));i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[He].currentFrameCallbacks,t&&(i=t.findIndex((t=>t&&t.handle===e)),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise(((e,t)=>{this[He].ended||null===this[He].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[He].deviceFrameHandle),this[He].device[tt].onSessionEnd(),this.dispatchEvent(new Ce("end",{session:this})),e())}))}get onend(){var e;return null!==(e=this[He].onend)&&void 0!==e?e:()=>{}}set onend(e){this[He].onend&&this.removeEventListener("end",this[He].onend),this[He].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!==(e=this[He].oninputsourceschange)&&void 0!==e?e:()=>{}}set oninputsourceschange(e){this[He].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[He].oninputsourceschange),this[He].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!==(e=this[He].onselect)&&void 0!==e?e:()=>{}}set onselect(e){this[He].onselect&&this.removeEventListener("select",this[He].onselect),this[He].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!==(e=this[He].onselectstart)&&void 0!==e?e:()=>{}}set onselectstart(e){this[He].onselectstart&&this.removeEventListener("selectstart",this[He].onselectstart),this[He].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!==(e=this[He].onselectend)&&void 0!==e?e:()=>{}}set onselectend(e){this[He].onselectend&&this.removeEventListener("selectend",this[He].onselectend),this[He].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!==(e=this[He].onsqueeze)&&void 0!==e?e:()=>{}}set onsqueeze(e){this[He].onsqueeze&&this.removeEventListener("squeeze",this[He].onsqueeze),this[He].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!==(e=this[He].onsqueezestart)&&void 0!==e?e:()=>{}}set onsqueezestart(e){this[He].onsqueezestart&&this.removeEventListener("squeezestart",this[He].onsqueezestart),this[He].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!==(e=this[He].onsqueezeend)&&void 0!==e?e:()=>{}}set onsqueezeend(e){this[He].onsqueezeend&&this.removeEventListener("squeezeend",this[He].onsqueezeend),this[He].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!==(e=this[He].onvisibilitychange)&&void 0!==e?e:()=>{}}set onvisibilitychange(e){this[He].onvisibilitychange&&this.removeEventListener("visibilitychange",this[He].onvisibilitychange),this[He].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!==(e=this[He].onframeratechange)&&void 0!==e?e:()=>{}}set onframeratechange(e){this[He].onframeratechange&&this.removeEventListener("frameratechange",this[He].onframeratechange),this[He].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}class Be extends EventTarget{}const Ge=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),Qe={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class Ke extends Be{constructor(e,t,i={}){if(super(),e[He].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...Qe,...i};this[Ge]={session:e,context:t,antialias:n.antialias}}get context(){return this[Ge].context}get antialias(){return this[Ge].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Ge].context.drawingBufferWidth}get framebufferHeight(){return this[Ge].context.drawingBufferHeight}getViewport(e){if(e[_].session!==this[Ge].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Ge].session[He].device[tt].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof Ne))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[He].ended?0:1}}const _e=Symbol("@immersive-web-emulation-runtime/xr-system");class $e extends EventTarget{constructor(e){super(),this[_e]={device:e}}isSessionSupported(e){return new Promise(((t,i)=>{e===je.Inline?t(!0):t(this[_e].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[_e].activeSession)return void n(new DOMException("An active XRSession already exists.","InvalidStateError"));const{requiredFeatures:a=[],optionalFeatures:s=[]}=t,{supportedFeatures:o}=this[_e].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))),l=Array.from(new Set([...a,...u,et.Viewer,et.Local])),c=new Ne(this[_e].device,e,l);this[_e].activeSession=c,c.addEventListener("end",(()=>{this[_e].activeSession=void 0})),i(c)})).catch(n)}))}}const Ue=Symbol("@immersive-web-emulation-runtime/action-player");class We{constructor(e,t,i){const{schema:n,frames:r}=t;if(!r||!n||0===r.length)throw new DOMException("wrong recording format","NotSupportedError");const a=new Ae(ke.Viewer,e),o={[$.Left]:new E(a),[$.Right]:new E(a),[$.None]:new E(a)};this[Ue]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:r,recordedFramePointer:0,startingTimeStamp:r[0][0],endingTimeStamp:r[r.length-1][0],playbackTime:r[0][0],playing:!1,viewerSpace:a,viewSpaces:o,vec3:h(),quat:v()},s(this[Ue].viewSpaces[$.Left][R].offsetMatrix,p(-i/2,0,0)),s(this[Ue].viewSpaces[$.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 J,Object.values(U).forEach((e=>{s.set(e,new Z(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[Ue].inputSources.set(i,{active:!1,source:o}),this[Ue].inputSchemas.set(i,n)}))}play(){this[Ue].recordedFramePointer=0,this[Ue].playbackTime=this[Ue].startingTimeStamp,this[Ue].playing=!0,this[Ue].actualTimeStamp=performance.now()}stop(){this[Ue].playing=!1}get playing(){return this[Ue].playing}get viewerSpace(){return this[Ue].viewerSpace}get viewSpaces(){return this[Ue].viewSpaces}get inputSources(){return Array.from(this[Ue].inputSources.values()).filter((e=>e.active)).map((e=>e.source))}playFrame(){const e=performance.now(),t=e-this[Ue].actualTimeStamp;if(this[Ue].actualTimeStamp=e,this[Ue].playbackTime+=t,this[Ue].playbackTime>this[Ue].endingTimeStamp)return void this.stop();for(;this[Ue].frames[this[Ue].recordedFramePointer+1][0]<this[Ue].playbackTime;)this[Ue].recordedFramePointer++;const i=this[Ue].frames[this[Ue].recordedFramePointer],n=this[Ue].frames[this[Ue].recordedFramePointer+1],r=(this[Ue].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[Ue].viewerSpace,i.slice(1,8),n.slice(1,8),r);const a=new Map;for(let e=8;e<i.length;e++){const{index:t,inputData:n}=this.processRawInputData(i[e]);a.set(t,n)}const s=new Map;for(let e=8;e<n.length;e++){const{index:t,inputData:i}=this.processRawInputData(n[e]);s.set(t,i)}this[Ue].inputSources.forEach((e=>{e.active=!1})),s.forEach(((e,t)=>{this[Ue].inputSources.get(t).active=!0;const i=this[Ue].inputSources.get(t).source,n=this[Ue].inputSchemas.get(t);this.updateInputSource(i,n,a.has(t)?a.get(t):e,e,r)}))}updateInputSource(e,t,i,n,r){if(this.updateXRSpaceFromMergedFrames(e.targetRaySpace,i.targetRayTransform,n.targetRayTransform,r),t.hasGrip&&this.updateXRSpaceFromMergedFrames(e.gripSpace,i.gripTransform,n.gripTransform,r),t.hasHand)for(let a=0;a<25;a++){const s=i.handTransforms.slice(8*a,8*a+7),o=n.handTransforms.slice(8*a,8*a+7),u=i.handTransforms[8*a+7],l=n.handTransforms[8*a+7],c=e.hand.get(t.jointSequence[a]);this.updateXRSpaceFromMergedFrames(c,s,o,r),c[Y].radius=(l-u)*r+u}if(t.hasGamepad){const t=e.gamepad;n.buttons.forEach(((e,n)=>{const a=t.buttons[n];a[P].pressed=1===e[0],a[P].touched=1===e[1];const s=i.buttons[n][2],o=e[2];a[P].value=(o-s)*r+s})),n.axes.forEach(((e,n)=>{const a=i.axes[n];t[P].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[Ue].vec3,r,s,n),y(this[Ue].quat,a,u,n),o(e[R].offsetMatrix,this[Ue].quat,this[Ue].vec3)}processRawInputData(e){const t=e[0],i=this[Ue].inputSchemas.get(t),n={targetRayTransform:e.slice(1,8)};let r=8;if(i.hasGrip&&(n.gripTransform=e[r++]),i.hasHand&&(n.handTransforms=e[r++]),i.hasGamepad){const t=e[r];n.buttons=t.slice(0,i.numButtons),n.axes=t.slice(i.numButtons)}return{index:t,inputData:n}}}class Je 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 Ye=Symbol("@immersive-web-emulation-runtime/xr-viewport");class Ze{constructor(e,t,i,n){this[Ye]={x:e,y:t,width:i,height:n}}get x(){return this[Ye].x}get y(){return this[Ye].y}get width(){return this[Ye].width}get height(){return this[Ye].height}}var et;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded",e.DomOverlay="dom-overlay",e.Anchors="anchors",e.PlaneDetection="plane-detection",e.MeshDetection="mesh-detection",e.HitTest="hit-test",e.HandTracking="hand-tracking",e.DepthSensing="depth-sensing"}(et||(et={}));const tt=Symbol("@immersive-web-emulation-runtime/xr-device"),it={ipd:.063,fovy:Math.PI/2,headsetPosition:new T(0,1.6,0),headsetQuaternion:new V,stereoEnabled:!1};class nt{constructor(e,i={}){var n,r,a,u,l,c;const d=new q,h=new Ae(ke.Viewer,d),m={[$.Left]:new E(h),[$.Right]:new E(h),[$.None]:new E(h)},f=e.controllerConfig,g={};f&&Object.values(O).forEach((e=>{f.layout[e]&&(g[e]=new K(f,e,d))}));const v={[O.Left]:new me(ee,O.Left,d),[O.Right]:new me(ee,O.Right,d)},x=null!==(n=i.canvasContainer)&&void 0!==n?n:document.createElement("div");x.dataset.webxr_runtime="Immersive Web Emulation Runtime v1.0.2",x.style.position="fixed",x.style.width="100%",x.style.height="100%",x.style.top="0",x.style.left="0",x.style.display="flex",x.style.justifyContent="center",x.style.alignItems="center",x.style.overflow="hidden",x.style.zIndex="999",this[tt]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,userAgent:e.userAgent,position:null!==(r=i.headsetPosition)&&void 0!==r?r:it.headsetPosition.clone(),quaternion:null!==(a=i.headsetQuaternion)&&void 0!==a?a:it.headsetQuaternion.clone(),stereoEnabled:null!==(u=i.stereoEnabled)&&void 0!==u?u:it.stereoEnabled,ipd:null!==(l=i.ipd)&&void 0!==l?l:it.ipd,fovy:null!==(c=i.fovy)&&void 0!==c?c:it.fovy,controllers:g,hands:v,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:Xe.Visible,pendingVisibilityState:null,xrSystem: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 $.None:return new Ze(0,0,n,r);case $.Left:return new Ze(0,0,this[tt].stereoEnabled?n/2:n,r);case $.Right:return new Ze(n/2,0,this[tt].stereoEnabled?n/2:0,r)}},updateViews:()=>{o(this[tt].viewerSpace[R].offsetMatrix,this[tt].quaternion.quat,this[tt].position.vec3),s(this[tt].viewSpaces[$.Left][R].offsetMatrix,p(-this[tt].ipd/2,0,0)),s(this[tt].viewSpaces[$.Right][R].offsetMatrix,p(this[tt].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;const t=e.context.canvas;t.parentElement!==this[tt].canvasContainer&&(this[tt].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height},this[tt].canvasContainer.appendChild(t),document.body.appendChild(this[tt].canvasContainer)),t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[tt].canvasData){const{canvas:e,parent:t,width:i,height:n}=this[tt].canvasData;e.width=i,e.height=n,t?t.appendChild(e):this[tt].canvasContainer.removeChild(e),document.body.removeChild(this[tt].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null===(t=this[tt].actionPlayer)||void 0===t?void 0:t.playing)this[tt].actionPlayer.playFrame();else{const t=e.session;this[tt].updateViews(),this[tt].pendingVisibilityState&&(this[tt].visibilityState=this[tt].pendingVisibilityState,this[tt].pendingVisibilityState=null,t.dispatchEvent(new Ce("visibilitychange",{session:t}))),this[tt].visibilityState===Xe.Visible&&this.activeInputs.forEach((t=>{t.onFrameStart(e)})),this[tt].pendingReferenceSpaceReset&&(t[He].referenceSpaces.forEach((e=>{switch(e[Oe].type){case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:e.dispatchEvent(new Je("reset",{referenceSpace:e}))}})),this[tt].pendingReferenceSpaceReset=!1)}this[tt].updateViews()}},this[tt].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise(((e,t)=>{e(!0)}))},configurable:!0}),this[tt].xrSystem=new $e(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[tt].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[tt].userAgent,writable:!1,configurable:!1,enumerable:!0}),e.XRSystem=$e,e.XRSession=Ne,e.XRRenderState=De,e.XRFrame=Ve,e.XRSpace=E,e.XRReferenceSpace=Ae,e.XRJointSpace=Z,e.XRView=W,e.XRViewport=Ze,e.XRRigidTransform=be,e.XRPose=ge,e.XRViewerPose=Fe,e.XRJointPose=xe,e.XRInputSource=j,e.XRInputSourceArray=C,e.XRHand=J,e.XRLayer=Be,e.XRWebGLLayer=Ke,e.XRSessionEvent=Ce,e.XRInputSourceEvent=H,e.XRInputSourcesChangeEvent=Pe,e.XRReferenceSpaceEvent=Je}get supportedSessionModes(){return this[tt].supportedSessionModes}get supportedFeatures(){return this[tt].supportedFeatures}get supportedFrameRates(){return this[tt].supportedFrameRates}get isSystemKeyboardSupported(){return this[tt].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[tt].internalNominalFrameRate}get stereoEnabled(){return this[tt].stereoEnabled}set stereoEnabled(e){this[tt].stereoEnabled=e}get ipd(){return this[tt].ipd}set ipd(e){this[tt].ipd=e}get fovy(){return this[tt].fovy}set fovy(e){this[tt].fovy=e}get position(){return this[tt].position}get quaternion(){return this[tt].quaternion}get viewerSpace(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.viewerSpace:this[tt].viewerSpace}get viewSpaces(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.viewSpaces:this[tt].viewSpaces}get controllers(){return this[tt].controllers}get hands(){return this[tt].hands}get primaryInputMode(){return this[tt].primaryInputMode}set primaryInputMode(e){"controller"===e||"hand"===e?this[tt].primaryInputMode=e:console.warn('primary input mode can only be "controller" or "hand"')}get activeInputs(){if(this[tt].visibilityState!==Xe.Visible)return[];return("controller"===this[tt].primaryInputMode?Object.values(this[tt].controllers):Object.values(this[tt].hands)).filter((e=>e.connected))}get inputSources(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.inputSources:this.activeInputs.map((e=>e.inputSource))}get canvasContainer(){return this[tt].canvasContainer}get activeSession(){var e;return null===(e=this[tt].xrSystem)||void 0===e?void 0:e[_e].activeSession}recenter(){const e=new T(-this.position.x,0,-this.position.z),t=new T(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();const i=Math.atan2(t.x,-t.z),n=(new V).setFromAxisAngle(new T(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[tt].controllers),...Object.values(this[tt].hands)].forEach((t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)})),this[tt].pendingReferenceSpaceReset=!0}get visibilityState(){return this[tt].visibilityState}updateVisibilityState(e){if(!Object.values(Xe).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[tt].visibilityState&&(this[tt].pendingVisibilityState=e)}createActionPlayer(e,t){return this[tt].actionPlayer=new We(e,t,this[tt].ipd),this[tt].actionPlayer}}const rt={mapping:L.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"}]},at={mapping:L.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"}]},st={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,2.0823669899527886e-8,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-8.329467959811154e-8,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},ot={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,-1.5779937356796836e-8,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},ut={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,1.0736208366779465e-8,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-2.6238110351073374e-8,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},lt={name:"Oculus Quest 1",controllerConfig:{profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,4.673031295254759e-9,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,3.688163374704345e-8,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ct={name:"Meta Quest 2",controllerConfig:st,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},dt={name:"Meta Quest Pro",controllerConfig:ot,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ht={name:"Meta Quest 3",controllerConfig:ut,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking,et.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},pt=Symbol("@immersive-web-emulation-runtime/action-recorder"),mt=e=>{const t=[];return e.forEach((e=>{t.push(parseFloat(e.toFixed(3)))})),t};class ft{constructor(e,t){this[pt]={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[pt].refSpace))||void 0===t?void 0:t.transform.matrix;if(!n)return;const r={timeStamp:i,position:u(h(),n),quaternion:c(v(),n),inputFrames:[]};this[pt].session.inputSources.forEach((t=>{var i,n;if(!this[pt].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[pt].inputMap.size;this[pt].inputMap.set(t,i),this[pt].schemaMap.set(i,e)}const a=this[pt].inputMap.get(t),s=this[pt].schemaMap.get(a),o=null===(i=e.getPose(t.targetRaySpace,this[pt].refSpace))||void 0===i?void 0:i.transform.matrix;if(o){const i={index:a,targetRayTransform:{position:u(h(),o),quaternion:c(v(),o)}};if(s.hasGrip){const r=null===(n=e.getPose(t.gripSpace,this[pt].refSpace))||void 0===n?void 0:n.transform.matrix;if(r){const e=u(h(),r),t=c(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[pt].jointTransforms)),r&&(r=e.fillJointRadii(n,this[pt].jointRadii)),r){const e={};for(let t=0;t<25;t++){const i=this[pt].jointTransforms.slice(16*t,16*(t+1)),r=this[pt].jointRadii[t],a=u(h(),i),s=c(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[pt].compressedFrames.push(this.compressActionFrame(r))}compressActionFrame(e){const t=[Math.round(10*e.timeStamp)/10,...mt(e.position),...mt(e.quaternion)];return e.inputFrames.forEach((e=>{const i=e.index,n=this[pt].schemaMap.get(i),r=[i,...mt(e.targetRayTransform.position),...mt(e.targetRayTransform.quaternion)];if(n.hasGrip&&r.push([...mt(e.gripTransform.position),...mt(e.gripTransform.quaternion)]),n.hasHand){const t=[];Object.values(e.hand).forEach((({position:e,quaternion:i,radius:n})=>{t.push(...mt(e),...mt(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[pt].schemaMap.entries()),frames:this[pt].compressedFrames};console.log(JSON.stringify(e))}}export{ft as ActionRecorder,nt as XRDevice,Ve as XRFrame,J as XRHand,j as XRInputSource,C as XRInputSourceArray,H as XRInputSourceEvent,Pe as XRInputSourcesChangeEvent,xe as XRJointPose,Z as XRJointSpace,Be as XRLayer,ge as XRPose,Ae as XRReferenceSpace,Je as XRReferenceSpaceEvent,De as XRRenderState,be as XRRigidTransform,Ne as XRSession,Ce as XRSessionEvent,E as XRSpace,$e as XRSystem,W as XRView,Fe as XRViewerPose,Ze as XRViewport,Ke as XRWebGLLayer,ct as metaQuest2,ht as metaQuest3,dt as metaQuestPro,lt as oculusQuest1};
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],l=t[7],c=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*l-a*s,w=n*u-r*o,b=n*l-a*o,M=r*l-a*u,F=c*f-d*m,R=c*g-h*m,E=c*v-p*m,q=d*g-h*f,I=d*v-p*f,T=h*v-p*g,V=x*T-y*I+S*q+w*E-b*R+M*F;return V?(V=1/V,e[0]=(o*T-u*I+l*q)*V,e[1]=(r*I-n*T-a*q)*V,e[2]=(f*M-g*b+v*w)*V,e[3]=(h*b-d*M-p*w)*V,e[4]=(u*E-s*T-l*R)*V,e[5]=(i*T-r*E+a*R)*V,e[6]=(g*S-m*M-v*y)*V,e[7]=(c*M-h*S+p*y)*V,e[8]=(s*I-o*E+l*F)*V,e[9]=(n*E-i*I-a*F)*V,e[10]=(m*b-f*S+v*x)*V,e[11]=(d*S-c*b-p*x)*V,e[12]=(o*R-s*q-u*F)*V,e[13]=(i*q-n*R+r*F)*V,e[14]=(f*y-m*w-g*x)*V,e[15]=(c*w-d*y+h*x)*V,e):null}function a(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=t[4],u=t[5],l=t[6],c=t[7],d=t[8],h=t[9],p=t[10],m=t[11],f=t[12],g=t[13],v=t[14],x=t[15],y=i[0],S=i[1],w=i[2],b=i[3];return e[0]=y*n+S*o+w*d+b*f,e[1]=y*r+S*u+w*h+b*g,e[2]=y*a+S*l+w*p+b*v,e[3]=y*s+S*c+w*m+b*x,y=i[4],S=i[5],w=i[6],b=i[7],e[4]=y*n+S*o+w*d+b*f,e[5]=y*r+S*u+w*h+b*g,e[6]=y*a+S*l+w*p+b*v,e[7]=y*s+S*c+w*m+b*x,y=i[8],S=i[9],w=i[10],b=i[11],e[8]=y*n+S*o+w*d+b*f,e[9]=y*r+S*u+w*h+b*g,e[10]=y*a+S*l+w*p+b*v,e[11]=y*s+S*c+w*m+b*x,y=i[12],S=i[13],w=i[14],b=i[15],e[12]=y*n+S*o+w*d+b*f,e[13]=y*r+S*u+w*h+b*g,e[14]=y*a+S*l+w*p+b*v,e[15]=y*s+S*c+w*m+b*x,e}function s(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function o(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=n+n,u=r+r,l=a+a,c=n*o,d=n*u,h=n*l,p=r*u,m=r*l,f=a*l,g=s*o,v=s*u,x=s*l;return e[0]=1-(p+f),e[1]=d+x,e[2]=h-v,e[3]=0,e[4]=d-x,e[5]=1-(c+f),e[6]=m+g,e[7]=0,e[8]=h+v,e[9]=m-g,e[10]=1-(c+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 l(e,t){var i=t[0],n=t[1],r=t[2],a=t[4],s=t[5],o=t[6],u=t[8],l=t[9],c=t[10];return e[0]=Math.hypot(i,n,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(u,l,c),e}function c(t,i){var n=new e(3);l(n,i);var r=1/n[0],a=1/n[1],s=1/n[2],o=i[0]*r,u=i[1]*a,c=i[2]*s,d=i[4]*r,h=i[5]*a,p=i[6]*s,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-c)/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+c)/x):h>g?(x=2*Math.sqrt(1+h-o-g),t[3]=(m-c)/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+c)/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,l=t[0],c=t[1],d=t[2],h=t[3],p=i[0],m=i[1],f=i[2],g=i[3];return(a=l*p+c*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*l+u*p,e[1]=o*c+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],l=t[2],c=r*l-a*u,d=a*o-n*l,h=n*u-r*o,p=r*h-a*d,m=a*c-n*h,f=n*d-r*c,g=2*s;c*=g,d*=g,h*=g,p*=2,m*=2,f*=2,e[0]=o+c+p,e[1]=u+d+m,e[2]=l+h+f}(this.vec3,this.tempVec3,e.quat),this}}class V{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 V(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],l=i[2],c=i[3];e[0]=n*c+s*o+r*l-a*u,e[1]=r*c+s*u+a*o-n*l,e[2]=a*c+s*l+n*u-r*o,e[3]=s*c-n*o-r*u-a*l}(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return x(this.quat,e.vec3,t),this}}const P=Symbol("@immersive-web-emulation-runtime/gamepad");var L,O,k;!function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"}(L||(L={}));class A{constructor(e,t){this[P]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[P].type?this[P].pressed:this[P].value>0}get touched(){return"manual"===this[P].type?this[P].touched:this[P].touched||this.pressed}get value(){return this[P].value}}class z{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class D{constructor(e,t="",i=-1){this[P]={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[P].buttonsSequence.push(null):(this[P].buttonsSequence.push(e.id),this[P].buttonsMap[e.id]=new A(e.type,null!==(t=e.eventTrigger)&&void 0!==t?t:null))})),e.axes.forEach((e=>{null===e?this[P].axesSequence.push(null):(this[P].axesSequence.push(e.id+e.type),this[P].axesMap[e.id]||(this[P].axesMap[e.id]={x:0,y:0}))}))}get id(){return this[P].id}get index(){return this[P].index}get connected(){return this[P].connected}get timestamp(){return this[P].timestamp}get mapping(){return this[P].mapping}get axes(){const e=[];return this[P].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[P].axesMap[i].y:this[P].axesMap[i].x)}})),e}get buttons(){return this[P].buttonsSequence.map((e=>null===e?new z:this[P].buttonsMap[e]))}get hapticActuators(){return this[P].hapticActuators}get vibrationActuator(){return null}}!function(e){e.None="none",e.Left="left",e.Right="right"}(O||(O={})),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 H 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 N=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),B={[O.Left]:{position:new T(-.25,1.5,-.4),quaternion:new V},[O.Right]:{position:new T(.25,1.5,-.4),quaternion:new V},[O.None]:{position:new T(.25,1.5,-.4),quaternion:new V}};class G{constructor(e){this[N]={inputSource:e,position:B[e.handedness].position.clone(),quaternion:B[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[N].position}get quaternion(){return this[N].quaternion}get inputSource(){return this[N].inputSource}get connected(){return this[N].connected}set connected(e){this[N].connected=e,this[N].inputSource.gamepad[P].connected=e}onFrameStart(e){o(this[N].inputSource.targetRaySpace[R].offsetMatrix,this[N].quaternion.quat,this[N].position.vec3);const t=e.session;this[N].inputSource.gamepad.buttons.forEach((i=>{i instanceof A&&(i[P].lastFrameValue=i[P].value,null!=i[P].pendingValue&&(i[P].value=i[P].pendingValue,i[P].pendingValue=null),null!=i[P].eventTrigger&&(0===i[P].lastFrameValue&&i[P].value>0?(t.dispatchEvent(new H(i[P].eventTrigger,{frame:e,inputSource:this[N].inputSource})),t.dispatchEvent(new H(i[P].eventTrigger+"start",{frame:e,inputSource:this[N].inputSource}))):i[P].lastFrameValue>0&&0===i[P].value&&t.dispatchEvent(new H(i[P].eventTrigger+"end",{frame:e,inputSource:this[N].inputSource}))))})),this[N].inputSourceChanged=this.connected!==this[N].lastFrameConnected,this[N].lastFrameConnected=this.connected}}const Q=Symbol("@immersive-web-emulation-runtime/xr-controller");class K 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)),this[Q]={gamepadConfig:e.layout[t].gamepad}}get gamepadConfig(){return this[Q].gamepadConfig}updateButtonValue(e,t){if(t>1||t<0)return void console.warn(`Out-of-range value ${t} provided for button ${e}.`);const i=this[N].inputSource.gamepad[P].buttonsMap[e];if(i){if("binary"===i[P].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[P].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[N].inputSource.gamepad[P].buttonsMap[e];i?i[P].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[N].inputSource.gamepad[P].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[N].inputSource.gamepad[P].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"}($||($={}));class W{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"}(U||(U={}));class J extends Map{}const Y=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class Z extends E{constructor(e,t,i){super(t,i),this[Y]={jointName:e,radius:0}}get jointName(){return this[Y].jointName}}const ee={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:{jointTransforms:{wrist:{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.04913589730858803,.0021463718730956316,.11701996624469757,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.07536252588033676,-.9959676265716553,-.04867160692811012,0,.5877083539962769,-.08379616588354111,.8047218918800354,0,-.8055551648139954,.032041035592556,.5916536450386047,0,-.010643752291798592,.0006936835707165301,.08736639469861984,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.1374533325433731,-.9904957413673401,.004982374142855406,0,.5534393787384033,.08097179979085922,.8289443850517273,0,-.8214688897132874,-.11118389666080475,.559309184551239,0,.015547193586826324,-.0003480653394944966,.0681300163269043,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.04330715537071228,.003409178927540779,.0492292083799839,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.062003348022699356,.004069602582603693,.03322213143110275,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.02009812369942665,.008770795539021492,.08660387247800827,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9001791477203369,-.2598813474178314,.3494834005832672,0,.06073702871799469,.8695210218429565,.490146666765213,0,-.4312632381916046,-.41999316215515137,.7985095381736755,0,-.00017739279428496957,.03890012577176094,.039073407649993896,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9082008600234985,-.20898112654685974,.36262574791908264,0,.11045389622449875,.9553793668746948,.27395179867744446,0,-.40369608998298645,-.20874978601932526,.8907597661018372,0,.01617925800383091,.05482936650514603,.008788082748651505,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.02599053829908371,.059902746230363846,-.012860597111284733,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.03362493962049484,.06421422213315964,-.033461250364780426,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.03627845644950867,.011579737067222595,.08550142496824265,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9876697659492493,-.06786545366048813,.1410750150680542,0,-.015095947310328484,.855663537979126,.5173118710517883,0,-.15582047402858734,-.5130629539489746,.8440889716148376,0,-.021259509027004242,.04587256908416748,.03659208118915558,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.988391637802124,-.04354291781783104,.14555205404758453,0,.008894841186702251,.9729899168014526,.23067504167556763,0,-.15166506171226501,-.22670257091522217,.9620829224586487,0,-.014570588245987892,.06789684295654297,.0003578895702958107,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.010392282158136368,.07414241135120392,-.026147106662392616,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.0069718430750072,.08024183660745621,-.05014154314994812,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.05402477830648422,.015797706320881844,.08152295649051666,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9940828680992126,.05735103040933609,.09224652498960495,0,-.10022822767496109,.8116500377655029,.5754809379577637,0,-.041867565363645554,-.5813214182853699,.8125960826873779,0,-.041623555123806,.04171867296099663,.03582974523305893,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9843675494194031,.12044742703437805,.12850022315979004,0,-.15629759430885315,.9337108135223389,.3221098482608795,0,-.08118485659360886,-.3371586799621582,.937940776348114,0,-.039990875869989395,.06438793987035751,.004141641780734062,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03783353418111801,.07334739714860916,-.020782606676220894,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03445569798350334,.0802423357963562,-.04392268508672714,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9181402921676636,.35625091195106506,.17350243031978607,0,-.39615097641944885,.8352503180503845,.38134080171585083,0,-.009065053425729275,-.41885748505592346,.9080066680908203,0,-.06191859766840935,.013620133511722088,.07850203663110733,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9714386463165283,.236698180437088,-.016745081171393394,0,-.18462024629116058,.7982627749443054,.5733163952827454,0,.14906984567642212,-.5538501739501953,.8191629648208618,0,-.061502378433942795,.032741155475378036,.03705105185508728,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9337416291236877,.35620439052581787,-.03527557849884033,0,-.33203884959220886,.8987522721290588,.28634607791900635,0,.13370157778263092,-.2556603252887726,.9574766755104065,0,-.06608185172080994,.049755651503801346,.011886020191013813,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.0687975287437439,.054948460310697556,-.007561664097011089,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.06947512179613113,.0613851435482502,-.028543535619974136,1],radius:.005425984505563974}},gripOffsetMatrix:[-.0005348679260350764,-.8648636937141418,-.5020061135292053,0,-.2741127908229828,-.48265108466148376,.8318111896514893,0,-.9616971015930176,.13805119693279266,-.2368120402097702,0,-.02878567762672901,.0017147823236882687,.04536811262369156,1]},pinch:{jointTransforms:{wrist:{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06867414712905884,-.009423808194696903,.10627774149179459,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.5012241005897522,-.8650535345077515,-.0213695727288723,0,.7415963411331177,-.4421543478965759,.5045139193534851,0,-.44587990641593933,.23702676594257355,.8631392121315002,0,-.032122574746608734,-.01196830440312624,.07194234430789948,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[-.3175753057003021,-.9460570216178894,-.06419729441404343,0,.8958902955055237,-.32153913378715515,.30658137798309326,0,-.3106854259967804,.03984907269477844,.9496771097183228,0,-.017625702545046806,-.01967475935816765,.04387917369604111,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,-.007126678712666035,-.021021386608481407,.011786630377173424,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,.0003423091256991029,-.024528030306100845,-.011410919018089771,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.038037415593862534,-.0020236473064869642,.07626739144325256,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.7986818552017212,-.35985732078552246,.48229536414146423,0,.538311243057251,.7854709625244141,-.30537736415863037,0,-.2689369022846222,.5035246014595032,.8210577368736267,0,-.006869405973702669,.033938243985176086,.04206443578004837,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.8285930156707764,-.32672837376594543,.4546217918395996,0,.5577570199966431,.4116027057170868,-.7207564115524292,0,.04836784675717354,.8507823944091797,.5232869386672974,0,.0033306588884443045,.014840902760624886,.010923954658210278,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,.0021551470272243023,-.0058362227864563465,-.0017938464879989624,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,-.00131594471167773,-.025222131982445717,-.012442642822861671,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.05395089089870453,.003063359996303916,.07402937114238739,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9187911748886108,-.1530158370733261,.36387869715690613,0,.038666240870952606,.9522662162780762,.302808940410614,0,-.3928440511226654,-.26414817571640015,.8808513283729553,0,-.02717282809317112,.04162866622209549,.03678669035434723,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9228746294975281,-.12856416404247284,.36300456523895264,0,.14524033665657043,.9892153143882751,-.01890045404434204,0,-.3566599190235138,.07016586512327194,.9315956234931946,0,-.01030921470373869,.05296773463487625,-.0010256498353555799,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,-.0004833847051486373,.05103470757603645,-.026690717786550522,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,.008158999495208263,.05004044249653816,-.050120558589696884,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06732909381389618,.007902119308710098,.07209732383489609,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9391821026802063,-.027994679287075996,.34227466583251953,0,-.18282271921634674,.8029410243034363,.5673282742500305,0,-.2907087206840515,-.5954000353813171,.7489906549453735,0,-.047129884362220764,.03806127607822418,.032147664576768875,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9249380826950073,.03699534013867378,.3783116042613983,0,-.12898847460746765,.9667453765869141,.2208271026611328,0,-.3575615882873535,-.25304901599884033,.8989526629447937,0,-.03579339757561684,.06127955764532089,.002939916681498289,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.026291755959391594,.06800390034914017,-.02094830758869648,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.016345610842108727,.07300511747598648,-.04263874143362045,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.8769711852073669,.31462907791137695,.36322021484375,0,-.4506046175956726,.801031768321991,.39408499002456665,0,-.16696058213710785,-.5092697143554688,.8442559838294983,0,-.07460174709558487,.0062340241856873035,.06756893545389175,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9498357176780701,.1553308218717575,.2714462876319885,0,-.3019258379936218,.6817675232887268,.6663586497306824,0,-.08155745267868042,-.7148879170417786,.694466233253479,0,-.06697750836610794,.029482364654541016,.02902858518064022,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9214097261428833,.27928245067596436,.2701927423477173,0,-.3670244514942169,.8538867831230164,.36901235580444336,0,-.12765564024448395,-.43917882442474365,.8892839550971985,0,-.06447203457355499,.05144399777054787,.0076942890882492065,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.06187915802001953,.060364335775375366,-.010368337854743004,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.056796226650476456,.07042007893323898,-.02921444922685623,1],radius:.005425984505563974}},gripOffsetMatrix:[.08027800917625427,-.8086723685264587,-.5827556252479553,0,-.4154181480407715,-.5585916638374329,.7179154753684998,0,-.9060805439949036,.1844543218612671,-.3807799518108368,0,-.038054611533880234,-.002910431008785963,.03720742464065552,1]},point:{jointTransforms:{wrist:{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05789132043719292,.01670890860259533,.11183350533246994,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[.02145560085773468,-.9978390336036682,.0621047280728817,0,.41311800479888916,.06541631370782852,.9083252549171448,0,-.9104245901107788,.006167683284729719,.4136286973953247,0,-.016488194465637207,.012708572670817375,.08862338215112686,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.21270370483398438,-.966137707233429,.14606566727161407,0,.49890995025634766,.2359165996313095,.8339261412620544,0,-.8401462435722351,-.10450579971075058,.5321959853172302,0,.013112368993461132,.012508046813309193,.07517509907484055,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.04150351136922836,.016039609909057617,.05719054117798805,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.06548332422971725,.01683700829744339,.0516640841960907,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.02592567168176174,.019982583820819855,.08479326963424683,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9063700437545776,-.21756279468536377,.3621589243412018,0,.0970839336514473,.9415287375450134,.3226419687271118,0,-.41117796301841736,-.2572731077671051,.8744958639144897,0,-.0015709538711234927,.043078210204839706,.034657616168260574,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9159826040267944,-.1651475727558136,.36565208435058594,0,.09755707532167435,.9756820797920227,.1962820291519165,0,-.3891757130622864,-.14411886036396027,.9098196625709534,0,.014023927971720695,.052835866808891296,.0014903299743309617,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.023482320830225945,.05633850023150444,-.020621655508875847,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.03096788562834263,.06281610578298569,-.040703095495700836,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.04184452444314957,.022474845871329308,.08177298307418823,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9720265865325928,-.08313076198101044,.21966552734375,0,.20477405190467834,.7580050826072693,-.6192700862884521,0,-.11502730846405029,.6469289064407349,.7538246512413025,0,-.022107340395450592,.05035499855875969,.02970452979207039,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9779140949249268,-.07129573822021484,.19646917283535004,0,.1287083923816681,-.5352076292037964,-.8348574042320251,0,.1646735966205597,.8417060971260071,-.5142109394073486,0,-.017169542610645294,.022584279999136925,-.00265491777099669,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02170622907578945,-.0006043742760084569,.011511396616697311,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02438267692923546,-.0026927536819130182,.03627248480916023,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05944233387708664,.0264605600386858,.07478221505880356,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9842101335525513,.024470895528793335,.1753024309873581,0,.12200043350458145,.6237703561782837,-.7720272541046143,0,-.12824076414108276,.7812241315841675,.610936164855957,0,-.04249368980526924,.0467497780919075,.027722163125872612,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9941774606704712,.05949164181947708,.08983955532312393,0,.10504482686519623,-.7208291888237,-.6851072907447815,0,.024001073092222214,.6905553936958313,-.7228817939758301,0,-.0374927744269371,.016285063698887825,.0038980208337306976,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.038130562752485275,-.0020653479732573032,.02310742810368538,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.0390593595802784,.004176302347332239,.0466572530567646,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9147363901138306,.3458845317363739,.20885537564754486,0,-.3923271894454956,.8839452862739563,.2544005811214447,0,-.09662359952926636,-.3146490156650543,.9442773461341858,0,-.06715242564678192,.024195827543735504,.07137546688318253,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9613109827041626,.22439135611057281,.15977802872657776,0,.01002211682498455,.5511574745178223,-.8343409299850464,0,-.27528178691864014,.8036624789237976,.5275853276252747,0,-.06273911893367767,.038559623062610626,.028268879279494286,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9820972084999084,.18811029195785522,-.00995189044624567,0,.14063723385334015,-.7673450708389282,-.6256227493286133,0,-.12532226741313934,.6130226850509644,-.7800630927085876,0,-.05428232625126839,.013870777562260628,.012061242014169693,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05173685774207115,.0014194445684552193,.02790539152920246,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05098633095622063,.008463085629045963,.048688892275094986,1],radius:.005425984505563974}},gripOffsetMatrix:[.005510995630174875,-.9149997234344482,-.40341615676879883,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.9340395331382751,.13936474919319153,-.32885703444480896,0,-.031803809106349945,.007837686687707901,.04313928261399269,1]}}},te={mapping:L.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},ie=h(),ne=v(),re=h(),ae=h(),se=v(),oe=h(),ue=h(),le=v(),ce=h(),de=(e,t,i,n)=>(u(ie,t),c(ne,t),l(re,t),u(ae,i),c(se,i),l(oe,i),g(ue,ie,ae,n),y(le,ne,se,n),g(ce,re,oe,n),function(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=t[3],u=r+r,l=a+a,c=s+s,d=r*u,h=r*l,p=r*c,m=a*l,f=a*c,g=s*c,v=o*u,x=o*l,y=o*c,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,le,ue,ce),e),he=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],pe=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class me extends G{constructor(e,t,i){if(t!==O.Left&&t!==O.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 J;Object.values(U).forEach((e=>{s.set(e,new Z(e,n))}));super(new j(t,k.TrackedPointer,a,n,new D(te),r,s)),this[pe]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[pe].poseId}set poseId(e){this[pe].poses[e]?this[pe].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){const e=this[pe].poses[this[pe].poseId],t=this[pe].poses.pinch;Object.values(U).forEach((i=>{const n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);de(a[R].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===O.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=he[t]})(a[R].offsetMatrix),a[Y].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius})),e.gripOffsetMatrix&&t.gripOffsetMatrix&&de(this.inputSource.gripSpace[R].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[N].inputSource.gamepad[P].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0)return void console.warn(`Out-of-range value ${e} provided for pinch`);this[N].inputSource.gamepad[P].buttonsMap.pinch[P].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const fe=Symbol("@immersive-web-emulation-runtime/xr-pose");class ge{constructor(e,t=!1,i=void 0,n=void 0){this[fe]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:n}}get transform(){return this[fe].transform}get emulatedPosition(){return this[fe].emulatedPosition}get linearVelocity(){return this[fe].linearVelocity}get angularVelocity(){return this[fe].angularVelocity}}const ve=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class xe extends ge{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[ve]={radius:t}}get radius(){return this[ve].radius}}class ye{constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n,Object.freeze(this)}static fromPoint(e){return new ye(e.x,e.y,e.z,e.w)}matrixTransform(e){return new ye}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const Se=void 0!==globalThis.DOMPointReadOnly?globalThis.DOMPointReadOnly:ye,we=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class be{constructor(e,i){const n=p(0,0,0),r=v();this[we]={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[we].matrix,this[we].orientation,this[we].position)}get matrix(){return this[we].matrix}get position(){const e=this[we].position;return new Se(e[0],e[1],e[2],1)}get orientation(){const e=this[we].orientation;return new Se(e[0],e[1],e[2],e[3])}get inverse(){if(!this[we].inverse){const e=t();if(!r(e,this[we].matrix))throw new Error("Matrix is not invertible.");let i=h();u(i,e);let n=v();c(n,e),this[we].inverse=new be(new Se(i[0],i[1],i[2],1),new Se(n[0],n[1],n[2],n[3])),this[we].inverse[we].inverse=this}return this[we].inverse}}const Me=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class Fe extends ge{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[Me]={views:Object.freeze(t)}}get views(){return this[Me].views}}const Re=Symbol("@immersive-web-emulation-runtime/xr-frame"),Ee=t(),qe=t(),Ie=t(),Te=(e,t,i)=>{I.calculateGlobalOffsetMatrix(t,Ee),I.calculateGlobalOffsetMatrix(i,qe),r(Ie,qe),a(e,Ie,Ee)};class Ve{constructor(e,i,n,r,a){this[Re]={session:e,id:i,active:n,animationFrame:r,predictedDisplayTime:a,tempMat4:t()}}get session(){return this[Re].session}get predictedDisplayTime(){return this[Re].predictedDisplayTime}getPose(e,t){if(!this[Re].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");Te(this[Re].tempMat4,e,t);const i=h();u(i,this[Re].tempMat4);const n=v();return c(n,this[Re].tempMat4),new ge(new be({x:i[0],y:i[1],z:i[2],w:1},{x:n[0],y:n[1],z:n[2],w:n[3]}),e[R].emulated)}getViewerPose(e){if(!this[Re].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[Re].session,i=t[He].device,n=this.getPose(i.viewerSpace,e),r=t[He].mode===je.Inline?[$.None]:[$.Left,$.Right],a=[];return r.forEach((n=>{const r=i.viewSpaces[n],s=this.getPose(r,e),o=t[He].getProjectionMatrix(n),u=new W(n,new Float32Array(o),s.transform,t);a.push(u)})),new Fe(n.transform,a,!1)}getJointPose(e,t){const i=this.getPose(e,t),n=e[Y].radius;return new xe(i.transform,n,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Re].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(e.length>t.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let i=!0;for(let n=0;n<e.length;n++)e[n][Y].radius?t[n]=e[n][Y].radius:(t[n]=NaN,i=!1);return i}fillPoses(e,t,i){if(e=Array.from(e),!this[Re].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)=>{Te(this[Re].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[Re].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 Le;const Oe=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var ke;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"}(ke||(ke={}));class Ae extends E{constructor(e,t,i){super(t,i),this[Le]={type:null,onreset:()=>{}},this[Oe].type=e}get onreset(){var e;return null!==(e=this[Oe].onreset)&&void 0!==e?e:()=>{}}set onreset(e){this[Oe].onreset&&this.removeEventListener("reset",this[Oe].onreset),this[Oe].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new Ae(this[Oe].type,this,e)}}Le=Oe;const ze=Symbol("@immersive-web-emulation-runtime/xr-render-state");class De{constructor(e={},t){this[ze]={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[ze].depthNear}get depthFar(){return this[ze].depthFar}get inlineVerticalFieldOfView(){return this[ze].inlineVerticalFieldOfView}get baseLayer(){return this[ze].baseLayer}}class Ce extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}var Xe,je;!function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"}(Xe||(Xe={})),function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"}(je||(je={}));const He=Symbol("@immersive-web-emulation-runtime/xr-session");class Ne extends EventTarget{constructor(e,i,r){super(),this[He]={device:e,mode:i,renderState:new De,pendingRenderState:null,enabledFeatures:r,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[$.Left]:t(),[$.Right]:t(),[$.None]:t()},getProjectionMatrix:e=>this[He].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[He].enabledFeatures.includes(e))return!1;switch(e){case ke.Viewer:return!0;case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:return this[He].mode!=je.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[He].ended)return;this[He].deviceFrameHandle=globalThis.requestAnimationFrame(this[He].onDeviceFrame),null!=this[He].pendingRenderState&&(this[He].renderState=this[He].pendingRenderState,this[He].pendingRenderState=null,this[He].device[tt].onBaseLayerSet(this[He].renderState.baseLayer));const e=this[He].renderState.baseLayer;if(null===e)return;const t=e.context,i=t.canvas;if(this[He].mode!=je.Inline){const e=t.getParameter(t.COLOR_CLEAR_VALUE),i=t.getParameter(t.DEPTH_CLEAR_VALUE),n=t.getParameter(t.STENCIL_CLEAR_VALUE);t.clearColor(0,0,0,0),t.clearDepth(1),t.clearStencil(0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),t.clearColor(e[0],e[1],e[2],e[3]),t.clearDepth(i),t.clearStencil(n)}const{depthNear:r,depthFar:a}=this[He].renderState,{width:s,height:o}=i;if(this[He].mode!==je.Inline){const e=s*(this[He].device.stereoEnabled?.5:1)/o;d(this[He].projectionMatrices[$.Left],this[He].device.fovy,e,r,a),n(this[He].projectionMatrices[$.Right],this[He].projectionMatrices[$.Left])}else{const e=s/o;d(this[He].projectionMatrices[$.None],this[He].renderState.inlineVerticalFieldOfView,e,r,a)}const u=new Ve(this,this[He].frameHandle,!0,!0,performance.now());this[He].device[tt].onFrameStart(u),this[He].updateActiveInputSources();const l=this[He].currentFrameCallbacks=this[He].frameCallbacks;this[He].frameCallbacks=[];const c=performance.now();for(let e=0;e<l.length;e++)try{l[e].cancelled||l[e].callback(c,u)}catch(e){console.error(e)}this[He].currentFrameCallbacks=null,u[Re].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{const e=this[He].enabledFeatures.includes(et.HandTracking),t=this[He].activeInputSources,i=this[He].device.inputSources.filter((t=>!t.hand||e)),n=i.filter((e=>!t.includes(e))),r=t.filter((e=>!i.includes(e)));this[He].activeInputSources=i,(n.length>0||r.length>0)&&this.dispatchEvent(new Pe("inputsourceschange",{session:this,added:n,removed:r}))},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[He].onDeviceFrame()}get visibilityState(){return this[He].device.visibilityState}get frameRate(){return this[He].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[He].device.supportedFrameRates)}get renderState(){return this[He].renderState}get inputSources(){return this[He].inputSourceArray.length=0,this[He].ended||this[He].mode===je.Inline||this[He].inputSourceArray.push(...this[He].activeInputSources),this[He].inputSourceArray}get enabledFeatures(){return this[He].enabledFeatures}get isSystemKeyboardSupported(){return this[He].isSystemKeyboardSupported}updateRenderState(e={}){var t,i,n,r;if(this[He].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Ge].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&this[He].mode!==je.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const a={baseLayer:e.baseLayer||(null===(t=this[He].pendingRenderState)||void 0===t?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||(null===(i=this[He].pendingRenderState)||void 0===i?void 0:i.depthFar)||void 0,depthNear:e.depthNear||(null===(n=this[He].pendingRenderState)||void 0===n?void 0:n.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null===(r=this[He].pendingRenderState)||void 0===r?void 0:r.inlineVerticalFieldOfView)||void 0};this[He].pendingRenderState=new De(a,this[He].renderState)}async updateTargetFrameRate(e){return new Promise(((t,i)=>{this[He].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[He].device.supportedFrameRates.includes(e)?(this[He].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[He].nominalFrameRate=e,this.dispatchEvent(new Ce("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${e}`)),t()):i(new DOMException("Requested frame rate not supported.","InvalidStateError"))}))}async requestReferenceSpace(e){return new Promise(((t,i)=>{if(this[He].ended||!this[He].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));let n;switch(e){case ke.Viewer:n=this[He].device.viewerSpace;break;case ke.Local:n=new Ae(e,this[He].device[tt].globalSpace,this[He].device.viewerSpace[R].offsetMatrix);break;case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:n=new Ae(e,this[He].device[tt].globalSpace)}this[He].referenceSpaces.push(n),t(n)}))}requestAnimationFrame(e){if(this[He].ended)return 0;const t=++this[He].frameHandle;return this[He].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[He].frameCallbacks,i=t.findIndex((t=>t&&t.handle===e));i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[He].currentFrameCallbacks,t&&(i=t.findIndex((t=>t&&t.handle===e)),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise(((e,t)=>{this[He].ended||null===this[He].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[He].deviceFrameHandle),this[He].device[tt].onSessionEnd(),this.dispatchEvent(new Ce("end",{session:this})),e())}))}get onend(){var e;return null!==(e=this[He].onend)&&void 0!==e?e:()=>{}}set onend(e){this[He].onend&&this.removeEventListener("end",this[He].onend),this[He].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!==(e=this[He].oninputsourceschange)&&void 0!==e?e:()=>{}}set oninputsourceschange(e){this[He].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[He].oninputsourceschange),this[He].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!==(e=this[He].onselect)&&void 0!==e?e:()=>{}}set onselect(e){this[He].onselect&&this.removeEventListener("select",this[He].onselect),this[He].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!==(e=this[He].onselectstart)&&void 0!==e?e:()=>{}}set onselectstart(e){this[He].onselectstart&&this.removeEventListener("selectstart",this[He].onselectstart),this[He].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!==(e=this[He].onselectend)&&void 0!==e?e:()=>{}}set onselectend(e){this[He].onselectend&&this.removeEventListener("selectend",this[He].onselectend),this[He].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!==(e=this[He].onsqueeze)&&void 0!==e?e:()=>{}}set onsqueeze(e){this[He].onsqueeze&&this.removeEventListener("squeeze",this[He].onsqueeze),this[He].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!==(e=this[He].onsqueezestart)&&void 0!==e?e:()=>{}}set onsqueezestart(e){this[He].onsqueezestart&&this.removeEventListener("squeezestart",this[He].onsqueezestart),this[He].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!==(e=this[He].onsqueezeend)&&void 0!==e?e:()=>{}}set onsqueezeend(e){this[He].onsqueezeend&&this.removeEventListener("squeezeend",this[He].onsqueezeend),this[He].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!==(e=this[He].onvisibilitychange)&&void 0!==e?e:()=>{}}set onvisibilitychange(e){this[He].onvisibilitychange&&this.removeEventListener("visibilitychange",this[He].onvisibilitychange),this[He].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!==(e=this[He].onframeratechange)&&void 0!==e?e:()=>{}}set onframeratechange(e){this[He].onframeratechange&&this.removeEventListener("frameratechange",this[He].onframeratechange),this[He].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}class Be extends EventTarget{}const Ge=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),Qe={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class Ke extends Be{constructor(e,t,i={}){if(super(),e[He].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...Qe,...i};this[Ge]={session:e,context:t,antialias:n.antialias}}get context(){return this[Ge].context}get antialias(){return this[Ge].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Ge].context.drawingBufferWidth}get framebufferHeight(){return this[Ge].context.drawingBufferHeight}getViewport(e){if(e[_].session!==this[Ge].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Ge].session[He].device[tt].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof Ne))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[He].ended?0:1}}const _e=Symbol("@immersive-web-emulation-runtime/xr-system");class $e extends EventTarget{constructor(e){super(),this[_e]={device:e}}isSessionSupported(e){return new Promise(((t,i)=>{e===je.Inline?t(!0):t(this[_e].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[_e].activeSession)return void n(new DOMException("An active XRSession already exists.","InvalidStateError"));const{requiredFeatures:a=[],optionalFeatures:s=[]}=t,{supportedFeatures:o}=this[_e].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))),l=Array.from(new Set([...a,...u,et.Viewer,et.Local])),c=new Ne(this[_e].device,e,l);this[_e].activeSession=c,c.addEventListener("end",(()=>{this[_e].activeSession=void 0})),i(c)})).catch(n)}))}}const Ue=Symbol("@immersive-web-emulation-runtime/action-player");class We{constructor(e,t,i){const{schema:n,frames:r}=t;if(!r||!n||0===r.length)throw new DOMException("wrong recording format","NotSupportedError");const a=new Ae(ke.Viewer,e),o={[$.Left]:new E(a),[$.Right]:new E(a),[$.None]:new E(a)};this[Ue]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:r,recordedFramePointer:0,startingTimeStamp:r[0][0],endingTimeStamp:r[r.length-1][0],playbackTime:r[0][0],playing:!1,viewerSpace:a,viewSpaces:o,vec3:h(),quat:v()},s(this[Ue].viewSpaces[$.Left][R].offsetMatrix,p(-i/2,0,0)),s(this[Ue].viewSpaces[$.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 J,Object.values(U).forEach((e=>{s.set(e,new Z(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[Ue].inputSources.set(i,{active:!1,source:o}),this[Ue].inputSchemas.set(i,n)}))}play(){this[Ue].recordedFramePointer=0,this[Ue].playbackTime=this[Ue].startingTimeStamp,this[Ue].playing=!0,this[Ue].actualTimeStamp=performance.now()}stop(){this[Ue].playing=!1}get playing(){return this[Ue].playing}get viewerSpace(){return this[Ue].viewerSpace}get viewSpaces(){return this[Ue].viewSpaces}get inputSources(){return Array.from(this[Ue].inputSources.values()).filter((e=>e.active)).map((e=>e.source))}playFrame(){const e=performance.now(),t=e-this[Ue].actualTimeStamp;if(this[Ue].actualTimeStamp=e,this[Ue].playbackTime+=t,this[Ue].playbackTime>this[Ue].endingTimeStamp)return void this.stop();for(;this[Ue].frames[this[Ue].recordedFramePointer+1][0]<this[Ue].playbackTime;)this[Ue].recordedFramePointer++;const i=this[Ue].frames[this[Ue].recordedFramePointer],n=this[Ue].frames[this[Ue].recordedFramePointer+1],r=(this[Ue].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[Ue].viewerSpace,i.slice(1,8),n.slice(1,8),r);const a=new Map;for(let e=8;e<i.length;e++){const{index:t,inputData:n}=this.processRawInputData(i[e]);a.set(t,n)}const s=new Map;for(let e=8;e<n.length;e++){const{index:t,inputData:i}=this.processRawInputData(n[e]);s.set(t,i)}this[Ue].inputSources.forEach((e=>{e.active=!1})),s.forEach(((e,t)=>{this[Ue].inputSources.get(t).active=!0;const i=this[Ue].inputSources.get(t).source,n=this[Ue].inputSchemas.get(t);this.updateInputSource(i,n,a.has(t)?a.get(t):e,e,r)}))}updateInputSource(e,t,i,n,r){if(this.updateXRSpaceFromMergedFrames(e.targetRaySpace,i.targetRayTransform,n.targetRayTransform,r),t.hasGrip&&this.updateXRSpaceFromMergedFrames(e.gripSpace,i.gripTransform,n.gripTransform,r),t.hasHand)for(let a=0;a<25;a++){const s=i.handTransforms.slice(8*a,8*a+7),o=n.handTransforms.slice(8*a,8*a+7),u=i.handTransforms[8*a+7],l=n.handTransforms[8*a+7],c=e.hand.get(t.jointSequence[a]);this.updateXRSpaceFromMergedFrames(c,s,o,r),c[Y].radius=(l-u)*r+u}if(t.hasGamepad){const t=e.gamepad;n.buttons.forEach(((e,n)=>{const a=t.buttons[n];a[P].pressed=1===e[0],a[P].touched=1===e[1];const s=i.buttons[n][2],o=e[2];a[P].value=(o-s)*r+s})),n.axes.forEach(((e,n)=>{const a=i.axes[n];t[P].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[Ue].vec3,r,s,n),y(this[Ue].quat,a,u,n),o(e[R].offsetMatrix,this[Ue].quat,this[Ue].vec3)}processRawInputData(e){const t=e[0],i=this[Ue].inputSchemas.get(t),n={targetRayTransform:e.slice(1,8)};let r=8;if(i.hasGrip&&(n.gripTransform=e[r++]),i.hasHand&&(n.handTransforms=e[r++]),i.hasGamepad){const t=e[r];n.buttons=t.slice(0,i.numButtons),n.axes=t.slice(i.numButtons)}return{index:t,inputData:n}}}class Je 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 Ye=Symbol("@immersive-web-emulation-runtime/xr-viewport");class Ze{constructor(e,t,i,n){this[Ye]={x:e,y:t,width:i,height:n}}get x(){return this[Ye].x}get y(){return this[Ye].y}get width(){return this[Ye].width}get height(){return this[Ye].height}}var et;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded",e.DomOverlay="dom-overlay",e.Anchors="anchors",e.PlaneDetection="plane-detection",e.MeshDetection="mesh-detection",e.HitTest="hit-test",e.HandTracking="hand-tracking",e.DepthSensing="depth-sensing"}(et||(et={}));const tt=Symbol("@immersive-web-emulation-runtime/xr-device"),it={ipd:.063,fovy:Math.PI/2,headsetPosition:new T(0,1.6,0),headsetQuaternion:new V,stereoEnabled:!1};class nt{constructor(e,i={}){var n,r,a,u,l,c;const d=new q,h=new Ae(ke.Viewer,d),m={[$.Left]:new E(h),[$.Right]:new E(h),[$.None]:new E(h)},f=e.controllerConfig,g={};f&&Object.values(O).forEach((e=>{f.layout[e]&&(g[e]=new K(f,e,d))}));const v={[O.Left]:new me(ee,O.Left,d),[O.Right]:new me(ee,O.Right,d)},x=null!==(n=i.canvasContainer)&&void 0!==n?n:document.createElement("div");x.dataset.webxr_runtime="Immersive Web Emulation Runtime v1.0.3",x.style.position="fixed",x.style.width="100%",x.style.height="100%",x.style.top="0",x.style.left="0",x.style.display="flex",x.style.justifyContent="center",x.style.alignItems="center",x.style.overflow="hidden",x.style.zIndex="999",this[tt]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,userAgent:e.userAgent,position:null!==(r=i.headsetPosition)&&void 0!==r?r:it.headsetPosition.clone(),quaternion:null!==(a=i.headsetQuaternion)&&void 0!==a?a:it.headsetQuaternion.clone(),stereoEnabled:null!==(u=i.stereoEnabled)&&void 0!==u?u:it.stereoEnabled,ipd:null!==(l=i.ipd)&&void 0!==l?l:it.ipd,fovy:null!==(c=i.fovy)&&void 0!==c?c:it.fovy,controllers:g,hands:v,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:Xe.Visible,pendingVisibilityState:null,xrSystem: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 $.None:return new Ze(0,0,n,r);case $.Left:return new Ze(0,0,this[tt].stereoEnabled?n/2:n,r);case $.Right:return new Ze(n/2,0,this[tt].stereoEnabled?n/2:0,r)}},updateViews:()=>{o(this[tt].viewerSpace[R].offsetMatrix,this[tt].quaternion.quat,this[tt].position.vec3),s(this[tt].viewSpaces[$.Left][R].offsetMatrix,p(-this[tt].ipd/2,0,0)),s(this[tt].viewSpaces[$.Right][R].offsetMatrix,p(this[tt].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;const t=e.context.canvas;t.parentElement!==this[tt].canvasContainer&&(this[tt].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height},this[tt].canvasContainer.appendChild(t),document.body.appendChild(this[tt].canvasContainer)),t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[tt].canvasData){const{canvas:e,parent:t,width:i,height:n}=this[tt].canvasData;e.width=i,e.height=n,t?t.appendChild(e):this[tt].canvasContainer.removeChild(e),document.body.removeChild(this[tt].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null===(t=this[tt].actionPlayer)||void 0===t?void 0:t.playing)this[tt].actionPlayer.playFrame();else{const t=e.session;this[tt].updateViews(),this[tt].pendingVisibilityState&&(this[tt].visibilityState=this[tt].pendingVisibilityState,this[tt].pendingVisibilityState=null,t.dispatchEvent(new Ce("visibilitychange",{session:t}))),this[tt].visibilityState===Xe.Visible&&this.activeInputs.forEach((t=>{t.onFrameStart(e)})),this[tt].pendingReferenceSpaceReset&&(t[He].referenceSpaces.forEach((e=>{switch(e[Oe].type){case ke.Local:case ke.LocalFloor:case ke.BoundedFloor:case ke.Unbounded:e.dispatchEvent(new Je("reset",{referenceSpace:e}))}})),this[tt].pendingReferenceSpaceReset=!1)}this[tt].updateViews()}},this[tt].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise(((e,t)=>{e(!0)}))},configurable:!0}),this[tt].xrSystem=new $e(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[tt].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[tt].userAgent,writable:!1,configurable:!1,enumerable:!0}),e.XRSystem=$e,e.XRSession=Ne,e.XRRenderState=De,e.XRFrame=Ve,e.XRSpace=E,e.XRReferenceSpace=Ae,e.XRJointSpace=Z,e.XRView=W,e.XRViewport=Ze,e.XRRigidTransform=be,e.XRPose=ge,e.XRViewerPose=Fe,e.XRJointPose=xe,e.XRInputSource=j,e.XRInputSourceArray=C,e.XRHand=J,e.XRLayer=Be,e.XRWebGLLayer=Ke,e.XRSessionEvent=Ce,e.XRInputSourceEvent=H,e.XRInputSourcesChangeEvent=Pe,e.XRReferenceSpaceEvent=Je}get supportedSessionModes(){return this[tt].supportedSessionModes}get supportedFeatures(){return this[tt].supportedFeatures}get supportedFrameRates(){return this[tt].supportedFrameRates}get isSystemKeyboardSupported(){return this[tt].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[tt].internalNominalFrameRate}get stereoEnabled(){return this[tt].stereoEnabled}set stereoEnabled(e){this[tt].stereoEnabled=e}get ipd(){return this[tt].ipd}set ipd(e){this[tt].ipd=e}get fovy(){return this[tt].fovy}set fovy(e){this[tt].fovy=e}get position(){return this[tt].position}get quaternion(){return this[tt].quaternion}get viewerSpace(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.viewerSpace:this[tt].viewerSpace}get viewSpaces(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.viewSpaces:this[tt].viewSpaces}get controllers(){return this[tt].controllers}get hands(){return this[tt].hands}get primaryInputMode(){return this[tt].primaryInputMode}set primaryInputMode(e){"controller"===e||"hand"===e?this[tt].primaryInputMode=e:console.warn('primary input mode can only be "controller" or "hand"')}get activeInputs(){if(this[tt].visibilityState!==Xe.Visible)return[];return("controller"===this[tt].primaryInputMode?Object.values(this[tt].controllers):Object.values(this[tt].hands)).filter((e=>e.connected))}get inputSources(){var e;return(null===(e=this[tt].actionPlayer)||void 0===e?void 0:e.playing)?this[tt].actionPlayer.inputSources:this.activeInputs.map((e=>e.inputSource))}get canvasContainer(){return this[tt].canvasContainer}get activeSession(){var e;return null===(e=this[tt].xrSystem)||void 0===e?void 0:e[_e].activeSession}recenter(){const e=new T(-this.position.x,0,-this.position.z),t=new T(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();const i=Math.atan2(t.x,-t.z),n=(new V).setFromAxisAngle(new T(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[tt].controllers),...Object.values(this[tt].hands)].forEach((t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)})),this[tt].pendingReferenceSpaceReset=!0}get visibilityState(){return this[tt].visibilityState}updateVisibilityState(e){if(!Object.values(Xe).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[tt].visibilityState&&(this[tt].pendingVisibilityState=e)}createActionPlayer(e,t){return this[tt].actionPlayer=new We(e,t,this[tt].ipd),this[tt].actionPlayer}}const rt={mapping:L.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"}]},at={mapping:L.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"}]},st={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,2.0823669899527886e-8,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-8.329467959811154e-8,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},ot={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,-1.5779937356796836e-8,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},ut={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,1.0736208366779465e-8,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,-2.6238110351073374e-8,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},lt={name:"Oculus Quest 1",controllerConfig:{profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:rt,gripOffsetMatrix:[.9925461411476135,4.673031295254759e-9,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:at,gripOffsetMatrix:[.9925461411476135,3.688163374704345e-8,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ct={name:"Meta Quest 2",controllerConfig:st,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},dt={name:"Meta Quest Pro",controllerConfig:ot,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ht={name:"Meta Quest 3",controllerConfig:ut,supportedSessionModes:[je.Inline,je.ImmersiveVR,je.ImmersiveAR],supportedFeatures:[et.Viewer,et.Local,et.LocalFloor,et.BoundedFloor,et.Unbounded,et.Anchors,et.PlaneDetection,et.MeshDetection,et.HitTest,et.HandTracking,et.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},pt=Symbol("@immersive-web-emulation-runtime/action-recorder"),mt=e=>{const t=[];return e.forEach((e=>{t.push(parseFloat(e.toFixed(3)))})),t};class ft{constructor(e,t){this[pt]={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[pt].refSpace))||void 0===t?void 0:t.transform.matrix;if(!n)return;const r={timeStamp:i,position:u(h(),n),quaternion:c(v(),n),inputFrames:[]};this[pt].session.inputSources.forEach((t=>{var i,n;if(!this[pt].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[pt].inputMap.size;this[pt].inputMap.set(t,i),this[pt].schemaMap.set(i,e)}const a=this[pt].inputMap.get(t),s=this[pt].schemaMap.get(a),o=null===(i=e.getPose(t.targetRaySpace,this[pt].refSpace))||void 0===i?void 0:i.transform.matrix;if(o){const i={index:a,targetRayTransform:{position:u(h(),o),quaternion:c(v(),o)}};if(s.hasGrip){const r=null===(n=e.getPose(t.gripSpace,this[pt].refSpace))||void 0===n?void 0:n.transform.matrix;if(r){const e=u(h(),r),t=c(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[pt].jointTransforms)),r&&(r=e.fillJointRadii(n,this[pt].jointRadii)),r){const e={};for(let t=0;t<25;t++){const i=this[pt].jointTransforms.slice(16*t,16*(t+1)),r=this[pt].jointRadii[t],a=u(h(),i),s=c(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[pt].compressedFrames.push(this.compressActionFrame(r))}compressActionFrame(e){const t=[Math.round(10*e.timeStamp)/10,...mt(e.position),...mt(e.quaternion)];return e.inputFrames.forEach((e=>{const i=e.index,n=this[pt].schemaMap.get(i),r=[i,...mt(e.targetRayTransform.position),...mt(e.targetRayTransform.quaternion)];if(n.hasGrip&&r.push([...mt(e.gripTransform.position),...mt(e.gripTransform.quaternion)]),n.hasHand){const t=[];Object.values(e.hand).forEach((({position:e,quaternion:i,radius:n})=>{t.push(...mt(e),...mt(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[pt].schemaMap.entries()),frames:this[pt].compressedFrames};console.log(JSON.stringify(e))}}export{ft as ActionRecorder,nt as XRDevice,Ve as XRFrame,J as XRHand,j as XRInputSource,C as XRInputSourceArray,H as XRInputSourceEvent,Pe as XRInputSourcesChangeEvent,xe as XRJointPose,Z as XRJointSpace,Be as XRLayer,ge as XRPose,Ae as XRReferenceSpace,Je as XRReferenceSpaceEvent,De as XRRenderState,be as XRRigidTransform,Ne as XRSession,Ce as XRSessionEvent,E as XRSpace,$e as XRSystem,W as XRView,Fe as XRViewerPose,Ze as XRViewport,Ke as XRWebGLLayer,ct as metaQuest2,ht as metaQuest3,dt as metaQuestPro,lt as oculusQuest1};
@@ -173,6 +173,7 @@ export class XRSession extends EventTarget {
173
173
  const currInputs = this[PRIVATE].device.inputSources.filter((inputSource) => !inputSource.hand || handTrackingOn);
174
174
  const added = currInputs.filter((item) => !prevInputs.includes(item));
175
175
  const removed = prevInputs.filter((item) => !currInputs.includes(item));
176
+ this[PRIVATE].activeInputSources = currInputs;
176
177
  if (added.length > 0 || removed.length > 0) {
177
178
  this.dispatchEvent(new XRInputSourcesChangeEvent('inputsourceschange', {
178
179
  session: this,
@@ -180,7 +181,6 @@ export class XRSession extends EventTarget {
180
181
  removed,
181
182
  }));
182
183
  }
183
- this[PRIVATE].activeInputSources = currInputs;
184
184
  },
185
185
  onend: null,
186
186
  oninputsourceschange: null,
@@ -1 +1 @@
1
- {"version":3,"file":"XRSession.js","sourceRoot":"","sources":["../../src/session/XRSession.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,aAAa,EACb,OAAO,IAAI,gBAAgB,GAE3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EACN,yBAAyB,GAEzB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,gBAAgB,EAChB,oBAAoB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EACN,cAAc,GAEd,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC5B,wCAAmB,CAAA;IACnB,uDAAkC,CAAA;IAClC,sCA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GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,kBAAkB,CAAC,QAA+B;QACrD,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,kBAAkB,EAAE;YACrC,IAAI,CAAC,mBAAmB,CACvB,kBAAkB,EAClB,IAAI,CAAC,OAAO,CAAC,CAAC,kBAAmC,CACjD,CAAC;SACF;QACD,IAAI,CAAC,OAAO,CAAC,CAAC,kBAAkB,GAAG,QAAQ,CAAC;QAC5C,IAAI,QAAQ,EAAE;YACb,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,QAAyB,CAAC,CAAC;SACrE;IACF,CAAC;IAED,IAAI,iBAAiB;;QACpB,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,CAAC,iBAAiB,mCAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,iBAAiB,CAAC,QAA+B;QACpD,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,iBAAiB,EAAE;YACpC,IAAI,CAAC,mBAAmB,CACvB,iBAAiB,EACjB,IAAI,CAAC,OAAO,CAAC,CAAC,iBAAkC,CAChD,CAAC;SACF;QACD,IAAI,CAAC,OAAO,CAAC,CAAC,iBAAiB,GAAG,QAAQ,CAAC;QAC3C,IAAI,QAAQ,EAAE;YACb,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,QAAyB,CAAC,CAAC;SACpE;IACF,CAAC;CACD"}
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.2";
1
+ export declare const VERSION = "1.0.3";
2
2
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = "1.0.2";
1
+ export const VERSION = "1.0.3";
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iwer",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Javascript WebXR Runtime for Emulation",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",