iwer 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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],d=t[8],c=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=d*f-c*m,F=d*g-h*m,E=d*v-p*m,I=c*g-h*f,q=c*v-p*f,V=h*v-p*g,T=x*V-y*q+S*I+w*E-b*F+M*R;return T?(T=1/T,e[0]=(o*V-u*q+l*I)*T,e[1]=(r*q-n*V-a*I)*T,e[2]=(f*M-g*b+v*w)*T,e[3]=(h*b-c*M-p*w)*T,e[4]=(u*E-s*V-l*F)*T,e[5]=(i*V-r*E+a*F)*T,e[6]=(g*S-m*M-v*y)*T,e[7]=(d*M-h*S+p*y)*T,e[8]=(s*q-o*E+l*R)*T,e[9]=(n*E-i*q-a*R)*T,e[10]=(m*b-f*S+v*x)*T,e[11]=(c*S-d*b-p*x)*T,e[12]=(o*F-s*I-u*R)*T,e[13]=(i*I-n*F+r*R)*T,e[14]=(f*y-m*w-g*x)*T,e[15]=(d*w-c*y+h*x)*T,e):null}function s(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=t[4],u=t[5],l=t[6],d=t[7],c=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*c+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*d+w*m+b*x,y=i[4],S=i[5],w=i[6],b=i[7],e[4]=y*n+S*o+w*c+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*d+w*m+b*x,y=i[8],S=i[9],w=i[10],b=i[11],e[8]=y*n+S*o+w*c+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*d+w*m+b*x,y=i[12],S=i[13],w=i[14],b=i[15],e[12]=y*n+S*o+w*c+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*d+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,d=n*o,c=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]=c+x,e[2]=h-v,e[3]=0,e[4]=c-x,e[5]=1-(d+f),e[6]=m+g,e[7]=0,e[8]=h+v,e[9]=m-g,e[10]=1-(d+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 d(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],d=t[10];return e[0]=Math.hypot(i,n,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(u,l,d),e}function c(e,i){var n=new t(3);d(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,c=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-c)/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+c)/x,e[2]=(m+l)/x):h>g?(x=2*Math.sqrt(1+h-o-g),e[3]=(m-l)/x,e[0]=(u+c)/x,e[1]=.25*x,e[2]=(p+f)/x):(x=2*Math.sqrt(1+g-o-h),e[3]=(u-c)/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],d=t[1],c=t[2],h=t[3],p=i[0],m=i[1],f=i[2],g=i[3];return(a=l*p+d*m+c*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*d+u*m,e[2]=o*c+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 V{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?V.calculateGlobalOffsetMatrix(e[E].parentSpace):i(),e[E].offsetMatrix),t}}class T{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 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 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],d=r*l-a*u,c=a*o-n*l,h=n*u-r*o,p=r*h-a*c,m=a*d-n*h,f=n*c-r*d,g=2*s;d*=g,c*=g,h*=g,p*=2,m*=2,f*=2,e[0]=o+d+p,e[1]=u+c+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],d=i[3];e[0]=n*d+s*o+r*l-a*u,e[1]=r*d+s*u+a*o-n*l,e[2]=a*d+s*l+n*u-r*o,e[3]=s*d-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 O=Symbol("@immersive-web-emulation-runtime/gamepad");var L,A,k;!function(e){e.None="",e.Standard="standard",e.XRStandard="xr-standard"}(L||(L={}));class X{constructor(e,t){this[O]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[O].type?this[O].pressed:this[O].value>0}get touched(){return"manual"===this[O].type?this[O].touched:this[O].touched||this.pressed}get value(){return this[O].value}}class z{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class D{constructor(e,t="",i=-1){this[O]={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[O].buttonsSequence.push(null):(this[O].buttonsSequence.push(e.id),this[O].buttonsMap[e.id]=new X(e.type,null!==(t=e.eventTrigger)&&void 0!==t?t:null))})),e.axes.forEach((e=>{null===e?this[O].axesSequence.push(null):(this[O].axesSequence.push(e.id+e.type),this[O].axesMap[e.id]||(this[O].axesMap[e.id]={x:0,y:0}))}))}get id(){return this[O].id}get index(){return this[O].index}get connected(){return this[O].connected}get timestamp(){return this[O].timestamp}get mapping(){return this[O].mapping}get axes(){const e=[];return this[O].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[O].axesMap[i].y:this[O].axesMap[i].x)}})),e}get buttons(){return this[O].buttonsSequence.map((e=>null===e?new z:this[O].buttonsMap[e]))}get hapticActuators(){return this[O].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 T(-.25,1.5,-.4),quaternion:new P},[A.Right]:{position:new T(.25,1.5,-.4),quaternion:new P},[A.None]:{position:new T(.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[O].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[O].lastFrameValue=i[O].value,null!=i[O].pendingValue&&(i[O].value=i[O].pendingValue,i[O].pendingValue=null),null!=i[O].eventTrigger&&(0===i[O].lastFrameValue&&i[O].value>0?(t.dispatchEvent(new N(i[O].eventTrigger,{frame:e,inputSource:this[B].inputSource})),t.dispatchEvent(new N(i[O].eventTrigger+"start",{frame:e,inputSource:this[B].inputSource}))):i[O].lastFrameValue>0&&0===i[O].value&&t.dispatchEvent(new N(i[O].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 W 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[O].buttonsMap[e];if(i){if("binary"===i[O].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[O].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[B].inputSource.gamepad[O].buttonsMap[e];i?i[O].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[O].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[O].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 $;!function(e){e.None="none",e.Left="left",e.Right="right"}($||($={}));class U{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}}const J=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class Y extends I{constructor(e,t,i){super(t,i),this[J]={jointName:e,radius:0}}get jointName(){return this[J].jointName}}const Z=Symbol("@immersive-web-emulation-runtime/xr-pose");class ee{constructor(e,t=!1,i=void 0,n=void 0){this[Z]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:n}}get transform(){return this[Z].transform}get emulatedPosition(){return this[Z].emulatedPosition}get linearVelocity(){return this[Z].linearVelocity}get angularVelocity(){return this[Z].angularVelocity}}const te=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class ie extends ee{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[te]={radius:t}}get radius(){return this[te].radius}}class ne{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 ne(e.x,e.y,e.z,e.w)}matrixTransform(e){return new ne}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const re=void 0!==globalThis.DOMPointReadOnly?globalThis.DOMPointReadOnly:ne,ae=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class se{constructor(e,t){const n=m(0,0,0),r=x();this[ae]={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[ae].matrix,this[ae].orientation,this[ae].position)}get matrix(){return this[ae].matrix}get position(){const e=this[ae].position;return new re(e[0],e[1],e[2],1)}get orientation(){const e=this[ae].orientation;return new re(e[0],e[1],e[2],e[3])}get inverse(){if(!this[ae].inverse){const e=i();if(!a(e,this[ae].matrix))throw new Error("Matrix is not invertible.");let t=p();l(t,e);let n=x();c(n,e),this[ae].inverse=new se(new re(t[0],t[1],t[2],1),new re(n[0],n[1],n[2],n[3])),this[ae].inverse[ae].inverse=this}return this[ae].inverse}}const oe=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class ue extends ee{constructor(e,t,i=!1,n=void 0,r=void 0){super(e,i,n,r),this[oe]={views:Object.freeze(t)}}get views(){return this[oe].views}}const le=Symbol("@immersive-web-emulation-runtime/xr-frame"),de=i(),ce=i(),he=i(),pe=(e,t,i)=>{V.calculateGlobalOffsetMatrix(t,de),V.calculateGlobalOffsetMatrix(i,ce),a(he,ce),s(e,he,de)};class me{constructor(e,t,n,r,a){this[le]={session:e,id:t,active:n,animationFrame:r,predictedDisplayTime:a,tempMat4:i()}}get session(){return this[le].session}get predictedDisplayTime(){return this[le].predictedDisplayTime}getPose(e,t){if(!this[le].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");pe(this[le].tempMat4,e,t);const i=p();l(i,this[le].tempMat4);const n=x();return c(n,this[le].tempMat4),new ee(new se({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[le].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[le].session,i=t[Pe].device,n=this.getPose(i.viewerSpace,e),r=t[Pe].mode===qe.Inline?[$.None]:[$.Left,$.Right],a=[];return r.forEach((n=>{const r=i.viewSpaces[n],s=this.getPose(r,e),o=t[Pe].getProjectionMatrix(n),u=new U(n,new Float32Array(o),s.transform,t);a.push(u)})),new ue(n.transform,a,!1)}getJointPose(e,t){const i=this.getPose(e,t),n=e[J].radius;return new ie(i.transform,n,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[le].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(e.length>t.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let i=!0;for(let n=0;n<e.length;n++)e[n][J].radius?t[n]=e[n][J].radius:(t[n]=NaN,i=!1);return i}fillPoses(e,t,i){if(e=Array.from(e),!this[le].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(16*e.length>i.length)throw new DOMException("The length of spaces multiplied by 16 is larger than the number of elements in transforms","TypeError");return e.forEach(((e,n)=>{pe(this[le].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[le].tempMat4[e]})),!0}}class fe 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 ge;const ve=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var xe;!function(e){e.Viewer="viewer",e.Local="local",e.LocalFloor="local-floor",e.BoundedFloor="bounded-floor",e.Unbounded="unbounded"}(xe||(xe={}));class ye extends I{constructor(e,t,i){super(t,i),this[ge]={type:null,onreset:()=>{}},this[ve].type=e}get onreset(){var e;return null!==(e=this[ve].onreset)&&void 0!==e?e:()=>{}}set onreset(e){this[ve].onreset&&this.removeEventListener("reset",this[ve].onreset),this[ve].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new ye(this[ve].type,this,e)}}ge=ve;const Se=Symbol("@immersive-web-emulation-runtime/xr-render-state");class we{constructor(e={},t){this[Se]={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[Se].depthNear}get depthFar(){return this[Se].depthFar}get inlineVerticalFieldOfView(){return this[Se].inlineVerticalFieldOfView}get baseLayer(){return this[Se].baseLayer}}class be extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}class Me extends EventTarget{}const Re=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),Fe={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class Ee extends Me{constructor(e,t,i={}){if(super(),e[Pe].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...Fe,...i};this[Re]={session:e,context:t,antialias:n.antialias}}get context(){return this[Re].context}get antialias(){return this[Re].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Re].context.drawingBufferWidth}get framebufferHeight(){return this[Re].context.drawingBufferHeight}getViewport(e){if(e[_].session!==this[Re].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Re].session[Pe].device[rt].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof Oe))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[Pe].ended?0:1}}var Ie,qe,Ve,Te;!function(e){e.Visible="visible",e.VisibleBlurred="visible-blurred",e.Hidden="hidden"}(Ie||(Ie={})),function(e){e.Inline="inline",e.ImmersiveVR="immersive-vr",e.ImmersiveAR="immersive-ar"}(qe||(qe={})),function(e){e.Opaque="opaque",e.AlphaBlend="alpha-blend",e.Additive="additive"}(Ve||(Ve={})),function(e){e.ScreenSpace="screen-space",e.WorldSpace="world-space"}(Te||(Te={}));const Pe=Symbol("@immersive-web-emulation-runtime/xr-session");class Oe extends EventTarget{constructor(e,t,n){super(),this[Pe]={device:e,mode:t,renderState:new we,pendingRenderState:null,enabledFeatures:n,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[$.Left]:i(),[$.Right]:i(),[$.None]:i()},getProjectionMatrix:e=>this[Pe].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[Pe].enabledFeatures.includes(e))return!1;switch(e){case xe.Viewer:return!0;case xe.Local:case xe.LocalFloor:case xe.BoundedFloor:case xe.Unbounded:return this[Pe].mode!=qe.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[Pe].ended)return;this[Pe].deviceFrameHandle=globalThis.requestAnimationFrame(this[Pe].onDeviceFrame),null!=this[Pe].pendingRenderState&&(this[Pe].renderState=this[Pe].pendingRenderState,this[Pe].pendingRenderState=null,this[Pe].device[rt].onBaseLayerSet(this[Pe].renderState.baseLayer));const e=this[Pe].renderState.baseLayer;if(null===e)return;const t=e.context,i=t.canvas;if(this[Pe].mode!=qe.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[Pe].renderState,{width:s,height:o}=i;if(this[Pe].mode!==qe.Inline){const e=s*(this[Pe].device.stereoEnabled?.5:1)/o;h(this[Pe].projectionMatrices[$.Left],this[Pe].device.fovy,e,n,a),r(this[Pe].projectionMatrices[$.Right],this[Pe].projectionMatrices[$.Left])}else{const e=s/o;h(this[Pe].projectionMatrices[$.None],this[Pe].renderState.inlineVerticalFieldOfView,e,n,a)}const u=new me(this,this[Pe].frameHandle,!0,!0,performance.now());this[Pe].device[rt].onFrameStart(u),this[Pe].updateActiveInputSources();const l=this[Pe].currentFrameCallbacks=this[Pe].frameCallbacks;this[Pe].frameCallbacks=[];const d=performance.now();for(let e=0;e<l.length;e++)try{l[e].cancelled||l[e].callback(d,u)}catch(e){console.error(e)}this[Pe].currentFrameCallbacks=null,u[le].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{const e=this[Pe].enabledFeatures.includes(nt.HandTracking),t=this[Pe].activeInputSources,i=this[Pe].device.inputSources.filter((t=>!t.hand||e)),n=i.filter((e=>!t.includes(e))),r=t.filter((e=>!i.includes(e)));this[Pe].activeInputSources=i,(n.length>0||r.length>0)&&this.dispatchEvent(new fe("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[Pe].onDeviceFrame()}get visibilityState(){return this[Pe].device.visibilityState}get frameRate(){return this[Pe].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[Pe].device.supportedFrameRates)}get renderState(){return this[Pe].renderState}get inputSources(){return this[Pe].inputSourceArray.length=0,this[Pe].ended||this[Pe].mode===qe.Inline||this[Pe].inputSourceArray.push(...this[Pe].activeInputSources),this[Pe].inputSourceArray}get enabledFeatures(){return this[Pe].enabledFeatures}get isSystemKeyboardSupported(){return this[Pe].isSystemKeyboardSupported}get environmentBlendMode(){var e;return null!==(e=this[Pe].device[rt].environmentBlendModes[this[Pe].mode])&&void 0!==e?e:Ve.Opaque}get interactionMode(){return this[Pe].device[rt].interactionMode}updateRenderState(e={}){var t,i,n,r;if(this[Pe].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Re].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&this[Pe].mode!==qe.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const a={baseLayer:e.baseLayer||(null===(t=this[Pe].pendingRenderState)||void 0===t?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||(null===(i=this[Pe].pendingRenderState)||void 0===i?void 0:i.depthFar)||void 0,depthNear:e.depthNear||(null===(n=this[Pe].pendingRenderState)||void 0===n?void 0:n.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null===(r=this[Pe].pendingRenderState)||void 0===r?void 0:r.inlineVerticalFieldOfView)||void 0};this[Pe].pendingRenderState=new we(a,this[Pe].renderState)}async updateTargetFrameRate(e){return new Promise(((t,i)=>{this[Pe].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[Pe].device.supportedFrameRates.includes(e)?(this[Pe].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[Pe].nominalFrameRate=e,this.dispatchEvent(new be("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[Pe].ended||!this[Pe].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));let n;switch(e){case xe.Viewer:n=this[Pe].device.viewerSpace;break;case xe.Local:n=new ye(e,this[Pe].device[rt].globalSpace,this[Pe].device.viewerSpace[E].offsetMatrix);break;case xe.LocalFloor:case xe.BoundedFloor:case xe.Unbounded:n=new ye(e,this[Pe].device[rt].globalSpace)}this[Pe].referenceSpaces.push(n),t(n)}))}requestAnimationFrame(e){if(this[Pe].ended)return 0;const t=++this[Pe].frameHandle;return this[Pe].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[Pe].frameCallbacks,i=t.findIndex((t=>t&&t.handle===e));i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[Pe].currentFrameCallbacks,t&&(i=t.findIndex((t=>t&&t.handle===e)),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise(((e,t)=>{this[Pe].ended||null===this[Pe].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[Pe].deviceFrameHandle),this[Pe].device[rt].onSessionEnd(),this.dispatchEvent(new be("end",{session:this})),e())}))}get onend(){var e;return null!==(e=this[Pe].onend)&&void 0!==e?e:()=>{}}set onend(e){this[Pe].onend&&this.removeEventListener("end",this[Pe].onend),this[Pe].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!==(e=this[Pe].oninputsourceschange)&&void 0!==e?e:()=>{}}set oninputsourceschange(e){this[Pe].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[Pe].oninputsourceschange),this[Pe].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!==(e=this[Pe].onselect)&&void 0!==e?e:()=>{}}set onselect(e){this[Pe].onselect&&this.removeEventListener("select",this[Pe].onselect),this[Pe].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!==(e=this[Pe].onselectstart)&&void 0!==e?e:()=>{}}set onselectstart(e){this[Pe].onselectstart&&this.removeEventListener("selectstart",this[Pe].onselectstart),this[Pe].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!==(e=this[Pe].onselectend)&&void 0!==e?e:()=>{}}set onselectend(e){this[Pe].onselectend&&this.removeEventListener("selectend",this[Pe].onselectend),this[Pe].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!==(e=this[Pe].onsqueeze)&&void 0!==e?e:()=>{}}set onsqueeze(e){this[Pe].onsqueeze&&this.removeEventListener("squeeze",this[Pe].onsqueeze),this[Pe].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!==(e=this[Pe].onsqueezestart)&&void 0!==e?e:()=>{}}set onsqueezestart(e){this[Pe].onsqueezestart&&this.removeEventListener("squeezestart",this[Pe].onsqueezestart),this[Pe].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!==(e=this[Pe].onsqueezeend)&&void 0!==e?e:()=>{}}set onsqueezeend(e){this[Pe].onsqueezeend&&this.removeEventListener("squeezeend",this[Pe].onsqueezeend),this[Pe].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!==(e=this[Pe].onvisibilitychange)&&void 0!==e?e:()=>{}}set onvisibilitychange(e){this[Pe].onvisibilitychange&&this.removeEventListener("visibilitychange",this[Pe].onvisibilitychange),this[Pe].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!==(e=this[Pe].onframeratechange)&&void 0!==e?e:()=>{}}set onframeratechange(e){this[Pe].onframeratechange&&this.removeEventListener("frameratechange",this[Pe].onframeratechange),this[Pe].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}var Le;!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"}(Le||(Le={}));class Ae extends Map{}const ke={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]}}},Xe={mapping:L.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},ze=p(),De=x(),Ce=p(),je=p(),He=x(),Ne=p(),Be=p(),Ge=x(),Qe=p(),Ke=(e,t,i,n)=>(l(ze,t),c(De,t),d(Ce,t),l(je,i),c(He,i),d(Ne,i),v(Be,ze,je,n),S(Ge,De,He,n),v(Qe,Ce,Ne,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,d=s+s,c=r*u,h=r*l,p=r*d,m=a*l,f=a*d,g=s*d,v=o*u,x=o*l,y=o*d,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-(c+g))*w,e[6]=(f+v)*w,e[7]=0,e[8]=(p+x)*b,e[9]=(f-v)*b,e[10]=(1-(c+m))*b,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1}(e,Ge,Be,Qe),e),We=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],_e=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class $e 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 Ae;Object.values(Le).forEach((e=>{s.set(e,new Y(e,n))}));super(new H(t,k.TrackedPointer,a,n,new D(Xe),r,s)),this[_e]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[_e].poseId}set poseId(e){this[_e].poses[e]?this[_e].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){const e=this[_e].poses[this[_e].poseId],t=this[_e].poses.pinch;Object.values(Le).forEach((i=>{const n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);Ke(a[E].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===A.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=We[t]})(a[E].offsetMatrix),a[J].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius})),e.gripOffsetMatrix&&t.gripOffsetMatrix&&Ke(this.inputSource.gripSpace[E].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[B].inputSource.gamepad[O].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[O].buttonsMap.pinch[O].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const Ue=Symbol("@immersive-web-emulation-runtime/xr-system");class Je extends EventTarget{constructor(e){super(),this[Ue]={device:e}}isSessionSupported(e){return new Promise(((t,i)=>{e===qe.Inline?t(!0):t(this[Ue].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[Ue].activeSession)return void n(new DOMException("An active XRSession already exists.","InvalidStateError"));const{requiredFeatures:a=[],optionalFeatures:s=[]}=t,{supportedFeatures:o}=this[Ue].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,nt.Viewer,nt.Local])),d=new Oe(this[Ue].device,e,l);this[Ue].activeSession=d,d.addEventListener("end",(()=>{this[Ue].activeSession=void 0})),i(d)})).catch(n)}))}}const Ye=Symbol("@immersive-web-emulation-runtime/action-player");class Ze{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 ye(xe.Viewer,e),s={[$.Left]:new I(a),[$.Right]:new I(a),[$.None]:new I(a)};this[Ye]={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[Ye].viewSpaces[$.Left][E].offsetMatrix,m(-i/2,0,0)),o(this[Ye].viewSpaces[$.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 Ae,Object.values(Le).forEach((e=>{s.set(e,new Y(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[Ye].inputSources.set(i,{active:!1,source:o}),this[Ye].inputSchemas.set(i,n)}))}play(){this[Ye].recordedFramePointer=0,this[Ye].playbackTime=this[Ye].startingTimeStamp,this[Ye].playing=!0,this[Ye].actualTimeStamp=performance.now()}stop(){this[Ye].playing=!1}get playing(){return this[Ye].playing}get viewerSpace(){return this[Ye].viewerSpace}get viewSpaces(){return this[Ye].viewSpaces}get inputSources(){return Array.from(this[Ye].inputSources.values()).filter((e=>e.active)).map((e=>e.source))}playFrame(){const e=performance.now(),t=e-this[Ye].actualTimeStamp;if(this[Ye].actualTimeStamp=e,this[Ye].playbackTime+=t,this[Ye].playbackTime>this[Ye].endingTimeStamp)return void this.stop();for(;this[Ye].frames[this[Ye].recordedFramePointer+1][0]<this[Ye].playbackTime;)this[Ye].recordedFramePointer++;const i=this[Ye].frames[this[Ye].recordedFramePointer],n=this[Ye].frames[this[Ye].recordedFramePointer+1],r=(this[Ye].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[Ye].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[Ye].inputSources.forEach((e=>{e.active=!1})),s.forEach(((e,t)=>{this[Ye].inputSources.get(t).active=!0;const i=this[Ye].inputSources.get(t).source,n=this[Ye].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],d=e.hand.get(t.jointSequence[a]);this.updateXRSpaceFromMergedFrames(d,s,o,r),d[J].radius=(l-u)*r+u}if(t.hasGamepad){const t=e.gamepad;n.buttons.forEach(((e,n)=>{const a=t.buttons[n];a[O].pressed=1===e[0],a[O].touched=1===e[1];const s=i.buttons[n][2],o=e[2];a[O].value=(o-s)*r+s})),n.axes.forEach(((e,n)=>{const a=i.axes[n];t[O].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[Ye].vec3,r,s,n),S(this[Ye].quat,a,o,n),u(e[E].offsetMatrix,this[Ye].quat,this[Ye].vec3)}processRawInputData(e){const t=e[0],i=this[Ye].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 et 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 tt=Symbol("@immersive-web-emulation-runtime/xr-viewport");class it{constructor(e,t,i,n){this[tt]={x:e,y:t,width:i,height:n}}get x(){return this[tt].x}get y(){return this[tt].y}get width(){return this[tt].width}get height(){return this[tt].height}}var nt;!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"}(nt||(nt={}));const rt=Symbol("@immersive-web-emulation-runtime/xr-device"),at={ipd:.063,fovy:Math.PI/2,headsetPosition:new T(0,1.6,0),headsetQuaternion:new P,stereoEnabled:!1};const st={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"}]},ot={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"}]},ut={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:st,gripOffsetMatrix:[.9925461411476135,2.0823669899527886e-8,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:ot,gripOffsetMatrix:[.9925461411476135,-8.329467959811154e-8,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},lt={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:st,gripOffsetMatrix:[.9925461411476135,-1.5779937356796836e-8,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:ot,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},dt={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:st,gripOffsetMatrix:[.9925461411476135,1.0736208366779465e-8,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:ot,gripOffsetMatrix:[.9925461411476135,-2.6238110351073374e-8,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},ct={name:"Oculus Quest 1",controllerConfig:{profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:st,gripOffsetMatrix:[.9925461411476135,4.673031295254759e-9,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:ot,gripOffsetMatrix:[.9925461411476135,3.688163374704345e-8,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:[qe.Inline,qe.ImmersiveVR,qe.ImmersiveAR],supportedFeatures:[nt.Viewer,nt.Local,nt.LocalFloor,nt.BoundedFloor,nt.Unbounded,nt.Anchors,nt.PlaneDetection,nt.HandTracking],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,environmentBlendModes:{[qe.ImmersiveVR]:Ve.Opaque,[qe.ImmersiveAR]:Ve.AlphaBlend},interactionMode:Te.WorldSpace,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"},ht={name:"Meta Quest 2",controllerConfig:ut,supportedSessionModes:[qe.Inline,qe.ImmersiveVR,qe.ImmersiveAR],supportedFeatures:[nt.Viewer,nt.Local,nt.LocalFloor,nt.BoundedFloor,nt.Unbounded,nt.Anchors,nt.PlaneDetection,nt.MeshDetection,nt.HitTest,nt.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,environmentBlendModes:{[qe.ImmersiveVR]:Ve.Opaque,[qe.ImmersiveAR]:Ve.AlphaBlend},interactionMode:Te.WorldSpace,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"},pt={name:"Meta Quest Pro",controllerConfig:lt,supportedSessionModes:[qe.Inline,qe.ImmersiveVR,qe.ImmersiveAR],supportedFeatures:[nt.Viewer,nt.Local,nt.LocalFloor,nt.BoundedFloor,nt.Unbounded,nt.Anchors,nt.PlaneDetection,nt.MeshDetection,nt.HitTest,nt.HandTracking],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,environmentBlendModes:{[qe.ImmersiveVR]:Ve.Opaque,[qe.ImmersiveAR]:Ve.AlphaBlend},interactionMode:Te.WorldSpace,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"},mt={name:"Meta Quest 3",controllerConfig:dt,supportedSessionModes:[qe.Inline,qe.ImmersiveVR,qe.ImmersiveAR],supportedFeatures:[nt.Viewer,nt.Local,nt.LocalFloor,nt.BoundedFloor,nt.Unbounded,nt.Anchors,nt.PlaneDetection,nt.MeshDetection,nt.HitTest,nt.HandTracking,nt.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,environmentBlendModes:{[qe.ImmersiveVR]:Ve.Opaque,[qe.ImmersiveAR]:Ve.AlphaBlend},interactionMode:Te.WorldSpace,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"},ft=Symbol("@immersive-web-emulation-runtime/action-recorder"),gt=e=>{const t=[];return e.forEach((e=>{t.push(parseFloat(e.toFixed(3)))})),t};e.ActionRecorder=class{constructor(e,t){this[ft]={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[ft].refSpace))||void 0===t?void 0:t.transform.matrix;if(!n)return;const r={timeStamp:i,position:l(p(),n),quaternion:c(x(),n),inputFrames:[]};this[ft].session.inputSources.forEach((t=>{var i,n;if(!this[ft].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[ft].inputMap.size;this[ft].inputMap.set(t,i),this[ft].schemaMap.set(i,e)}const a=this[ft].inputMap.get(t),s=this[ft].schemaMap.get(a),o=null===(i=e.getPose(t.targetRaySpace,this[ft].refSpace))||void 0===i?void 0:i.transform.matrix;if(o){const i={index:a,targetRayTransform:{position:l(p(),o),quaternion:c(x(),o)}};if(s.hasGrip){const r=null===(n=e.getPose(t.gripSpace,this[ft].refSpace))||void 0===n?void 0:n.transform.matrix;if(r){const e=l(p(),r),t=c(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[ft].jointTransforms)),r&&(r=e.fillJointRadii(n,this[ft].jointRadii)),r){const e={};for(let t=0;t<25;t++){const i=this[ft].jointTransforms.slice(16*t,16*(t+1)),r=this[ft].jointRadii[t],a=l(p(),i),s=c(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[ft].compressedFrames.push(this.compressActionFrame(r))}compressActionFrame(e){const t=[Math.round(10*e.timeStamp)/10,...gt(e.position),...gt(e.quaternion)];return e.inputFrames.forEach((e=>{const i=e.index,n=this[ft].schemaMap.get(i),r=[i,...gt(e.targetRayTransform.position),...gt(e.targetRayTransform.quaternion)];if(n.hasGrip&&r.push([...gt(e.gripTransform.position),...gt(e.gripTransform.quaternion)]),n.hasHand){const t=[];Object.values(e.hand).forEach((({position:e,quaternion:i,radius:n})=>{t.push(...gt(e),...gt(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[ft].schemaMap.entries()),frames:this[ft].compressedFrames};console.log(JSON.stringify(e))}},e.XRDevice=class{constructor(e,t={}){var n,r,a,s,l,d;const c=new q,h=new ye(xe.Viewer,c),p={[$.Left]:new I(h),[$.Right]:new I(h),[$.None]:new I(h)},f=e.controllerConfig,g={};f&&Object.values(A).forEach((e=>{f.layout[e]&&(g[e]=new W(f,e,c))}));const v={[A.Left]:new $e(ke,A.Left,c),[A.Right]:new $e(ke,A.Right,c)},x=null!==(n=t.canvasContainer)&&void 0!==n?n:document.createElement("div");x.dataset.webxr_runtime="Immersive Web Emulation Runtime v1.0.4",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[rt]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,environmentBlendModes:e.environmentBlendModes,interactionMode:e.interactionMode,userAgent:e.userAgent,position:null!==(r=t.headsetPosition)&&void 0!==r?r:at.headsetPosition.clone(),quaternion:null!==(a=t.headsetQuaternion)&&void 0!==a?a:at.headsetQuaternion.clone(),stereoEnabled:null!==(s=t.stereoEnabled)&&void 0!==s?s:at.stereoEnabled,ipd:null!==(l=t.ipd)&&void 0!==l?l:at.ipd,fovy:null!==(d=t.fovy)&&void 0!==d?d:at.fovy,controllers:g,hands:v,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:Ie.Visible,pendingVisibilityState:null,xrSystem:null,matrix:i(),globalSpace:c,viewerSpace:h,viewSpaces:p,canvasContainer:x,getViewport:(e,t)=>{const i=e.context.canvas,{width:n,height:r}=i;switch(t.eye){case $.None:return new it(0,0,n,r);case $.Left:return new it(0,0,this[rt].stereoEnabled?n/2:n,r);case $.Right:return new it(n/2,0,this[rt].stereoEnabled?n/2:0,r)}},updateViews:()=>{u(this[rt].viewerSpace[E].offsetMatrix,this[rt].quaternion.quat,this[rt].position.vec3),o(this[rt].viewSpaces[$.Left][E].offsetMatrix,m(-this[rt].ipd/2,0,0)),o(this[rt].viewSpaces[$.Right][E].offsetMatrix,m(this[rt].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;const t=e.context.canvas;t.parentElement!==this[rt].canvasContainer&&(this[rt].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height},this[rt].canvasContainer.appendChild(t),document.body.appendChild(this[rt].canvasContainer)),t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[rt].canvasData){const{canvas:e,parent:t,width:i,height:n}=this[rt].canvasData;e.width=i,e.height=n,t?t.appendChild(e):this[rt].canvasContainer.removeChild(e),document.body.removeChild(this[rt].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null===(t=this[rt].actionPlayer)||void 0===t?void 0:t.playing)this[rt].actionPlayer.playFrame();else{const t=e.session;this[rt].updateViews(),this[rt].pendingVisibilityState&&(this[rt].visibilityState=this[rt].pendingVisibilityState,this[rt].pendingVisibilityState=null,t.dispatchEvent(new be("visibilitychange",{session:t}))),this[rt].visibilityState===Ie.Visible&&this.activeInputs.forEach((t=>{t.onFrameStart(e)})),this[rt].pendingReferenceSpaceReset&&(t[Pe].referenceSpaces.forEach((e=>{switch(e[ve].type){case xe.Local:case xe.LocalFloor:case xe.BoundedFloor:case xe.Unbounded:e.dispatchEvent(new et("reset",{referenceSpace:e}))}})),this[rt].pendingReferenceSpaceReset=!1)}this[rt].updateViews()}},this[rt].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise(((e,t)=>{e(!0)}))},configurable:!0}),this[rt].xrSystem=new Je(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[rt].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[rt].userAgent,writable:!1,configurable:!1,enumerable:!0}),e.XRSystem=Je,e.XRSession=Oe,e.XRRenderState=we,e.XRFrame=me,e.XRSpace=I,e.XRReferenceSpace=ye,e.XRJointSpace=Y,e.XRView=U,e.XRViewport=it,e.XRRigidTransform=se,e.XRPose=ee,e.XRViewerPose=ue,e.XRJointPose=ie,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRHand=Ae,e.XRLayer=Me,e.XRWebGLLayer=Ee,e.XRSessionEvent=be,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=fe,e.XRReferenceSpaceEvent=et}get supportedSessionModes(){return this[rt].supportedSessionModes}get supportedFeatures(){return this[rt].supportedFeatures}get supportedFrameRates(){return this[rt].supportedFrameRates}get isSystemKeyboardSupported(){return this[rt].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[rt].internalNominalFrameRate}get stereoEnabled(){return this[rt].stereoEnabled}set stereoEnabled(e){this[rt].stereoEnabled=e}get ipd(){return this[rt].ipd}set ipd(e){this[rt].ipd=e}get fovy(){return this[rt].fovy}set fovy(e){this[rt].fovy=e}get position(){return this[rt].position}get quaternion(){return this[rt].quaternion}get viewerSpace(){var e;return(null===(e=this[rt].actionPlayer)||void 0===e?void 0:e.playing)?this[rt].actionPlayer.viewerSpace:this[rt].viewerSpace}get viewSpaces(){var e;return(null===(e=this[rt].actionPlayer)||void 0===e?void 0:e.playing)?this[rt].actionPlayer.viewSpaces:this[rt].viewSpaces}get controllers(){return this[rt].controllers}get hands(){return this[rt].hands}get primaryInputMode(){return this[rt].primaryInputMode}set primaryInputMode(e){"controller"===e||"hand"===e?this[rt].primaryInputMode=e:console.warn('primary input mode can only be "controller" or "hand"')}get activeInputs(){if(this[rt].visibilityState!==Ie.Visible)return[];return("controller"===this[rt].primaryInputMode?Object.values(this[rt].controllers):Object.values(this[rt].hands)).filter((e=>e.connected))}get inputSources(){var e;return(null===(e=this[rt].actionPlayer)||void 0===e?void 0:e.playing)?this[rt].actionPlayer.inputSources:this.activeInputs.map((e=>e.inputSource))}get canvasContainer(){return this[rt].canvasContainer}get activeSession(){var e;return null===(e=this[rt].xrSystem)||void 0===e?void 0:e[Ue].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 P).setFromAxisAngle(new T(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[rt].controllers),...Object.values(this[rt].hands)].forEach((t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)})),this[rt].pendingReferenceSpaceReset=!0}get visibilityState(){return this[rt].visibilityState}updateVisibilityState(e){if(!Object.values(Ie).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[rt].visibilityState&&(this[rt].pendingVisibilityState=e)}createActionPlayer(e,t){return this[rt].actionPlayer=new Ze(e,t,this[rt].ipd),this[rt].actionPlayer}},e.XRFrame=me,e.XRHand=Ae,e.XRInputSource=H,e.XRInputSourceArray=C,e.XRInputSourceEvent=N,e.XRInputSourcesChangeEvent=fe,e.XRJointPose=ie,e.XRJointSpace=Y,e.XRLayer=Me,e.XRPose=ee,e.XRReferenceSpace=ye,e.XRReferenceSpaceEvent=et,e.XRRenderState=we,e.XRRigidTransform=se,e.XRSession=Oe,e.XRSessionEvent=be,e.XRSpace=I,e.XRSystem=Je,e.XRView=U,e.XRViewerPose=ue,e.XRViewport=it,e.XRWebGLLayer=Ee,e.metaQuest2=ht,e.metaQuest3=mt,e.metaQuestPro=pt,e.oculusQuest1=ct,Object.defineProperty(e,"__esModule",{value:!0})}));