@needle-tools/engine 4.1.0-beta.8 → 4.1.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/gltf-progressive.js +148 -150
  3. package/dist/gltf-progressive.light.js +148 -150
  4. package/dist/gltf-progressive.light.min.js +6 -6
  5. package/dist/gltf-progressive.light.umd.cjs +7 -7
  6. package/dist/gltf-progressive.min.js +6 -6
  7. package/dist/gltf-progressive.umd.cjs +7 -7
  8. package/dist/needle-engine.bundle.js +4018 -4003
  9. package/dist/needle-engine.bundle.light.js +4018 -4003
  10. package/dist/needle-engine.bundle.light.min.js +109 -109
  11. package/dist/needle-engine.bundle.light.umd.cjs +115 -115
  12. package/dist/needle-engine.bundle.min.js +109 -109
  13. package/dist/needle-engine.bundle.umd.cjs +109 -109
  14. package/dist/needle-engine.d.ts +4 -0
  15. package/dist/needle-engine.js +2 -2
  16. package/dist/needle-engine.light.d.ts +13 -9
  17. package/dist/needle-engine.light.js +2 -2
  18. package/dist/needle-engine.light.min.js +1 -1
  19. package/dist/needle-engine.min.js +1 -1
  20. package/dist/postprocessing.js +1 -1
  21. package/dist/postprocessing.light.js +1 -1
  22. package/dist/postprocessing.light.min.js +1 -1
  23. package/dist/postprocessing.min.js +1 -1
  24. package/dist/three-examples.js +1 -1
  25. package/dist/three-examples.light.js +1 -1
  26. package/dist/three-examples.light.min.js +1 -1
  27. package/dist/three-examples.min.js +1 -1
  28. package/dist/three-mesh-ui.js +1 -1
  29. package/dist/three-mesh-ui.light.js +1 -1
  30. package/dist/three-mesh-ui.light.min.js +1 -1
  31. package/dist/three-mesh-ui.min.js +1 -1
  32. package/dist/three.js +14 -14
  33. package/dist/three.light.js +14 -14
  34. package/dist/three.light.min.js +1 -1
  35. package/dist/three.min.js +1 -1
  36. package/dist/vendor.js +1 -1
  37. package/dist/vendor.light.js +1 -1
  38. package/dist/vendor.light.min.js +1 -1
  39. package/dist/vendor.min.js +1 -1
  40. package/lib/engine/engine_gameobject.d.ts +0 -12
  41. package/lib/engine/engine_gameobject.js +0 -13
  42. package/lib/engine/engine_gameobject.js.map +1 -1
  43. package/lib/engine/engine_types.d.ts +5 -0
  44. package/lib/engine/engine_types.js +6 -0
  45. package/lib/engine/engine_types.js.map +1 -1
  46. package/lib/engine/export/gltf/Writers.js.map +1 -1
  47. package/lib/engine/export/gltf/index.js +11 -1
  48. package/lib/engine/export/gltf/index.js.map +1 -1
  49. package/lib/engine/export/utils.d.ts +2 -0
  50. package/lib/engine/export/utils.js +8 -0
  51. package/lib/engine/export/utils.js.map +1 -0
  52. package/lib/engine/extensions/NEEDLE_gameobject_data.js +1 -1
  53. package/lib/engine/extensions/NEEDLE_gameobject_data.js.map +1 -1
  54. package/lib/engine/js-extensions/Object3D.d.ts +5 -1
  55. package/lib/engine/js-extensions/Object3D.js.map +1 -1
  56. package/lib/engine-components/Component.d.ts +1 -2
  57. package/lib/engine-components/Component.js +3 -3
  58. package/lib/engine-components/Component.js.map +1 -1
  59. package/lib/engine-components/ContactShadows.d.ts +1 -1
  60. package/lib/engine-components/ContactShadows.js +7 -0
  61. package/lib/engine-components/ContactShadows.js.map +1 -1
  62. package/lib/engine-components/export/gltf/GltfExport.js +23 -4
  63. package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
  64. package/package.json +2 -2
  65. package/src/engine/engine_gameobject.ts +0 -13
  66. package/src/engine/engine_types.ts +6 -0
  67. package/src/engine/export/gltf/Writers.ts +0 -1
  68. package/src/engine/export/gltf/index.ts +13 -3
  69. package/src/engine/export/index.ts +1 -1
  70. package/src/engine/export/utils.ts +10 -0
  71. package/src/engine/extensions/NEEDLE_gameobject_data.ts +1 -2
  72. package/src/engine/js-extensions/Object3D.ts +6 -1
  73. package/src/engine-components/Component.ts +4 -4
  74. package/src/engine-components/ContactShadows.ts +11 -2
  75. package/src/engine-components/export/gltf/GltfExport.ts +26 -6
@@ -1,4 +1,4 @@
1
- import{P as Jo,a9 as Rl,bc as we,V as K,L as xn,q as xs,D as Ss,b6 as Uo,O as fs,c0 as Yt,cM as Ve,cI as Ll,U as Fe,k as Ws,B as Ot,I as be,M as Sn,e as xl,b1 as Sl,g as De,Y as Po,b5 as rt,S as wo,c as Te,d as fe,bC as Fo,ax as fl,aq as Qo,r as Wl,X as gl,b0 as Cl,R as zl,ac as gs,al as Dt,bB as yi,cN as fn,bG as Gi,b2 as Bo,cO as vl,cP as Eo,cQ as Kl,ad as Wn,cR as Cs,bP as Ml,bO as Tl,cS as jo,cT as Yl,o as Hl,h as zs}from"./three.light.min.js";const se={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Oo(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function kl(n){if(!n)throw new Error("No basePath supplied");return await Oo(`${n}/profilesList.json`)}async function Nl(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const s=await kl(e);let o;if(n.profiles.some(r=>{const l=s[r];return l&&(o={profileId:r,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}),!!o}),!o){if(!t)throw new Error("No matching profile name found");const r=s[t];if(!r)throw new Error(`No matching profile name found and default profile "${t}" missing.`);o={profileId:t,profilePath:`${e}/${r.path}`,deprecated:!!r.deprecated}}const a=await Oo(o.profilePath);let c;if(i){let r;if(n.handedness==="any"?r=a.layouts[Object.keys(a.layouts)[0]]:r=a.layouts[n.handedness],!r)throw new Error(`No matching handedness, ${n.handedness}, in profile ${o.profileId}`);r.assetPath&&(c=o.profilePath.replace("profile.json",r.assetPath))}return{profile:a,assetPath:c}}const Il={xAxis:0,yAxis:0,button:0,state:se.ComponentState.DEFAULT};function Jl(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const s=Math.atan2(e,n);t=Math.cos(s),i=Math.sin(s)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Ul{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===se.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Il)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:s}){const{normalizedXAxis:o,normalizedYAxis:a}=Jl(e,t);switch(this.componentProperty){case se.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?o:.5;break;case se.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?a:.5;break;case se.ComponentProperty.BUTTON:this.value=this.states.includes(s)?i:0;break;case se.ComponentProperty.STATE:this.valueNodeProperty===se.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Pl{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const s=new Ul(t.visualResponses[i]);this.visualResponses[i]=s}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:se.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=se.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=se.ComponentState.PRESSED:(t.touched||this.values.button>se.ButtonTouchThreshold)&&(this.values.state=se.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class wl{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(s=>{const o=this.layoutDescription.components[s];this.components[s]=new Pl(s,o)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const vs=2,_e=4,lt=4,Do=4,bt=new Int32Array(2),_o=new Float32Array(bt.buffer),Ao=new Float64Array(bt.buffer),gn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Ks;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Ks||(Ks={}));class Bi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new Bi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return bt[0]=this.readInt32(e),_o[0]}readFloat64(e){return bt[gn?0:1]=this.readInt32(e),bt[gn?1:0]=this.readInt32(e+4),Ao[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){_o[0]=t,this.writeInt32(e,bt[0])}writeFloat64(e,t){Ao[0]=t,this.writeInt32(e,bt[gn?0:1]),this.writeInt32(e+4,bt[gn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+_e+lt)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<lt;t++)e+=String.fromCharCode(this.readInt8(this.position_+_e+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let s="",o=0;if(e+=_e,t===Ks.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;o<i;){let a;const c=this.readUint8(e+o++);if(c<192)a=c;else{const r=this.readUint8(e+o++);if(c<224)a=(c&31)<<6|r&63;else{const l=this.readUint8(e+o++);if(c<240)a=(c&15)<<12|(r&63)<<6|l&63;else{const d=this.readUint8(e+o++);a=(c&7)<<18|(r&63)<<12|(l&63)<<6|d&63}}}a<65536?s+=String.fromCharCode(a):(a-=65536,s+=String.fromCharCode((a>>10)+55296,(a&1024-1)+56320))}return s}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+_e}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let t=0;t<lt;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+_e+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let s=0;s<t;++s)e(s)!==null&&i.push(e(s));return i}createObjList(e,t){const i=[];for(let s=0;s<t;++s){const o=e(s);o!==null&&i.push(o.unpack())}return i}}class ko{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=Bi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const s=this.bb.capacity();this.bb=ko.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,s=Bi.allocate(i);return s.setPosition(i-t),s.bytes().set(e.bytes(),i-t),s}addOffset(e){this.prep(_e,0),this.writeInt32(this.offset()-e+_e)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const s=2;this.addInt16(e-this.object_start);const o=(i+s)*vs;this.addInt16(o);let a=0;const c=this.space;e:for(t=0;t<this.vtables.length;t++){const r=this.bb.capacity()-this.vtables[t];if(o==this.bb.readInt16(r)){for(let l=vs;l<o;l+=vs)if(this.bb.readInt16(c+l)!=this.bb.readInt16(r+l))continue e;a=this.vtables[t];break}}return a?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,a-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const s=i?Do:0;if(t){const o=t;if(this.prep(this.minalign,_e+lt+s),o.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let a=lt-1;a>=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,_e+s),this.addOffset(e),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,s=i-this.bb.readInt32(i);if(this.bb.readInt16(s+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(_e,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let s;const o=e.charCodeAt(i++);if(o<55296||o>=56320)s=o;else{const a=e.charCodeAt(i++);s=(o<<10)+a+(65536-56623104-56320)}s<128?t.push(s):(s<2048?t.push(s>>6&31|192):(s<65536?t.push(s>>12&15|224):t.push(s>>18&7|240,s>>12&63|128),t.push(s>>6&63|128)),t.push(s&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,s=this.space,o=this.bb.bytes();i<t.length;i++)o[s++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const s=e[i];if(s!==null)t.push(this.createObjectOffset(s));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function Cn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qo={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(s){typeof s=="number"?this._pieces.push(s):(this.flush(),this._parts.push(s))},i.prototype.flush=function(){if(this._pieces.length>0){var s=new Uint8Array(this._pieces);e.useArrayBufferView||(s=s.buffer),this._parts.push(s),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var s=new t,o=0,a=this._parts.length;o<a;o++)s.append(this._parts[o]);return s.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(qo);var $o=qo.exports,Fl=$o.BufferBuilder,ea=$o.binaryFeatures,Ql={unpack:function(n){var e=new re(n);return e.unpack()},pack:function(n){var e=new le;e.pack(n);var t=e.getBuffer();return t}},Bl=Ql;function re(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}re.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},re.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},re.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},re.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},re.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},re.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},re.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},re.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},re.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},re.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},re.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",s,o;t<n;)s=e[t],s<128?(i+=String.fromCharCode(s),t++):(s^192)<32?(o=(s^192)<<6|e[t+1]&63,i+=String.fromCharCode(o),t+=2):(o=(s&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(o),t+=3);return this.index+=n,i},re.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},re.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),s=this.unpack();e[i]=s}return e},re.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},re.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,s=n&1048575|1048576,o=s*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*o},re.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function le(){this.bufferBuilder=new Fl}le.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},le.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},le.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_string=function(n){var e=jl(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},le.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},le.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,s=Math.floor(i*Math.pow(2,52)),o=Math.pow(2,32),a=e<<31|t+1023<<20|s/o&1048575,c=s%o;this.bufferBuilder.append(203),this.pack_int32(a),this.pack_int32(c)},le.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},le.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},le.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},le.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},le.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},le.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function El(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function jl(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,El).length}const ta=Cn(Bl);let ia=!0,na=!0;function Zi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function _t(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,s=i.addEventListener;i.addEventListener=function(a,c){if(a!==e)return s.apply(this,arguments);const r=l=>{const d=t(l);d&&(c.handleEvent?c.handleEvent(d):c(d))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,r),s.apply(this,[a,r])};const o=i.removeEventListener;i.removeEventListener=function(a,c){if(a!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(c))return o.apply(this,arguments);const r=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[a,r])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}function Ol(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(ia=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Dl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(na=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Ms(){if(typeof window=="object"){if(ia)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function zn(n,e){na&&console.warn(n+" is deprecated, please use "+e+" instead.")}function _l(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=Zi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=Zi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=Zi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=Zi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function sa(n){return Object.prototype.toString.call(n)==="[object Object]"}function oa(n){return sa(n)?Object.keys(n).reduce(function(e,t){const i=sa(n[t]),s=i?oa(n[t]):n[t],o=i&&!Object.keys(s).length;return s===void 0||o?e:Object.assign(e,{[t]:s})},{}):n}function Ts(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Ts(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(s=>{Ts(n,n.get(s),t)})}))}function aa(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",s=new Map;if(e===null)return s;const o=[];return n.forEach(a=>{a.type==="track"&&a.trackIdentifier===e.id&&o.push(a)}),o.forEach(a=>{n.forEach(c=>{c.type===i&&c.trackId===a.id&&Ts(n,c,s)})}),s}const ra=Ms;function la(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const r={};return Object.keys(c).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const d=typeof c[l]=="object"?c[l]:{ideal:c[l]};d.exact!==void 0&&typeof d.exact=="number"&&(d.min=d.max=d.exact);const h=function(u,p){return u?u+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(d.ideal!==void 0){r.optional=r.optional||[];let u={};typeof d.ideal=="number"?(u[h("min",l)]=d.ideal,r.optional.push(u),u={},u[h("max",l)]=d.ideal,r.optional.push(u)):(u[h("",l)]=d.ideal,r.optional.push(u))}d.exact!==void 0&&typeof d.exact!="number"?(r.mandatory=r.mandatory||{},r.mandatory[h("",l)]=d.exact):["min","max"].forEach(u=>{d[u]!==void 0&&(r.mandatory=r.mandatory||{},r.mandatory[h(u,l)]=d[u])})}),c.advanced&&(r.optional=(r.optional||[]).concat(c.advanced)),r},s=function(c,r){if(e.version>=61)return r(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const l=function(d,h,u){h in d&&!(u in d)&&(d[u]=d[h],delete d[h])};c=JSON.parse(JSON.stringify(c)),l(c.audio,"autoGainControl","googAutoGainControl"),l(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=i(c.audio)}if(c&&typeof c.video=="object"){let l=c.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const d=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!d)){delete c.video.facingMode;let h;if(l.exact==="environment"||l.ideal==="environment"?h=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(h=["front"]),h)return t.mediaDevices.enumerateDevices().then(u=>{u=u.filter(m=>m.kind==="videoinput");let p=u.find(m=>h.some(b=>m.label.toLowerCase().includes(b)));return!p&&u.length&&h.includes("back")&&(p=u[u.length-1]),p&&(c.video.deviceId=l.exact?{exact:p.deviceId}:{ideal:p.deviceId}),c.video=i(c.video),ra("chrome: "+JSON.stringify(c)),r(c)})}c.video=i(c.video)}return ra("chrome: "+JSON.stringify(c)),r(c)},o=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(c,r,l){s(c,d=>{t.webkitGetUserMedia(d,r,h=>{l&&l(o(h))})})};if(t.getUserMedia=a.bind(t),t.mediaDevices.getUserMedia){const c=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(r){return s(r,l=>c(l).then(d=>{if(l.audio&&!d.getAudioTracks().length||l.video&&!d.getVideoTracks().length)throw d.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return d},d=>Promise.reject(o(d))))}}}function Al(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const s=t.video&&t.video.width,o=t.video&&t.video.height,a=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:a||3}},s&&(t.video.mandatory.maxWidth=s),o&&(t.video.mandatory.maxHeight=o),n.navigator.mediaDevices.getUserMedia(t)})}}}function ca(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function da(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):s={track:i.track};const o=new Event("track");o.track=i.track,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)}),t.stream.getTracks().forEach(i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.id):s={track:i};const o=new Event("track");o.track=i,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else _t(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ha(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(s,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=s.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:s}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const s=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(a,c){let r=s.apply(this,arguments);return r||(r=e(this,a),this._senders.push(r)),r};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(a){o.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],t.apply(this,[s]),s.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(o=>{const a=this._senders.find(c=>c.track===o);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function ua(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,s]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const o=function(c){const r={};return c.result().forEach(l=>{const d={id:l.id,timestamp:l.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[l.type]||l.type};l.names().forEach(h=>{d[h]=l.stat(h)}),r[d.id]=d}),r},a=function(c){return new Map(Object.keys(c).map(r=>[r,c[r]]))};if(arguments.length>=2){const c=function(r){i(a(o(r)))};return e.apply(this,[c,t])}return new Promise((c,r)=>{e.apply(this,[function(l){c(a(o(l)))},r])}).then(i,s)}}function pa(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const s=t.apply(this,[]);return s.forEach(o=>o._pc=this),s});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const s=i.apply(this,arguments);return s._pc=this,s}),n.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(o=>aa(o,s.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(s=>s._pc=this),i}),_t(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(s=>aa(s,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,s,o;return this.getSenders().forEach(a=>{a.track===t&&(i?o=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===t&&(s?o=!0:s=a),a.track===t)),o||i&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function ma(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(r=>{if(this.getSenders().find(l=>l.track===r))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();t.apply(this,arguments);const c=this.getSenders().filter(r=>a.indexOf(r)===-1);this._shimmedLocalStreams[o.id]=[o].concat(c)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],i.apply(this,arguments)};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(o);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),s.apply(this,arguments)}}function ba(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return ma(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(d=>this._reverseStreams[d.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(d=>{if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const d=new n.MediaStream(l.getTracks());this._streams[l.id]=d,this._reverseStreams[d.id]=l,l=d}i.apply(this,[l])};const s=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},n.RTCPeerConnection.prototype.addTrack=function(l,d){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const h=[].slice.call(arguments,1);if(h.length!==1||!h[0].getTracks().find(p=>p===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const u=this._streams[d.id];if(u)u.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([l]);this._streams[d.id]=p,this._reverseStreams[p.id]=d,this.addStream(p)}return this.getSenders().find(p=>p.track===l)};function o(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(m.id,"g"),p.id)}),new RTCSessionDescription({type:d.type,sdp:h})}function a(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(p.id,"g"),m.id)}),new RTCSessionDescription({type:d.type,sdp:h})}["createOffer","createAnswer"].forEach(function(l){const d=n.RTCPeerConnection.prototype[l],h={[l](){const u=arguments;return arguments.length&&typeof arguments[0]=="function"?d.apply(this,[p=>{const m=o(this,p);u[0].apply(null,[m])},p=>{u[1]&&u[1].apply(null,p)},arguments[2]]):d.apply(this,arguments).then(p=>o(this,p))}};n.RTCPeerConnection.prototype[l]=h[l]});const c=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=a(this,arguments[0]),c.apply(this,arguments))};const r=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=r.get.apply(this);return l.type===""?l:o(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(l._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(u=>l.track===u)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ys(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],s={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=s[t]})}function ya(n,e){_t(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const Ga=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:ya,shimAddTrackRemoveTrack:ba,shimAddTrackRemoveTrackWithNative:ma,shimGetDisplayMedia:Al,shimGetSendersWithDtmf:ha,shimGetStats:ua,shimGetUserMedia:la,shimMediaStream:ca,shimOnTrack:da,shimPeerConnection:Ys,shimSenderReceiverGetStats:pa},Symbol.toStringTag,{value:"Module"}));function ql(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let s=i.urls||i.url;i.url&&!i.urls&&zn("RTCIceServer.url","RTCIceServer.urls");const o=typeof s=="string";return o&&(s=[s]),s=s.filter(a=>{if(a.indexOf("stun:")===0)return!1;const c=a.startsWith("turn")&&!a.startsWith("turn:[")&&a.includes("transport=udp");return c&&!t?(t=!0,!0):c&&!t}),delete i.url,i.urls=o?s[0]:s,!!s.length}})}var Za={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
1
+ import{P as Jo,a9 as Rl,bc as we,V as K,L as xn,q as xs,D as Ss,b6 as Uo,O as fs,c0 as Yt,cM as Ve,cI as Ll,U as Fe,j as Ws,B as Ot,I as be,M as Sn,d as xl,b1 as Sl,f as De,Y as Po,b5 as rt,S as wo,b as Te,c as fe,bC as Fo,ax as fl,aq as Qo,r as Wl,X as gl,b0 as Cl,R as zl,ac as gs,al as Dt,bB as yi,cN as fn,bG as Gi,b2 as Bo,cO as vl,cP as Eo,cQ as Kl,ad as Wn,cR as Cs,bP as Ml,bO as Tl,cS as jo,cT as Yl,o as Hl,g as zs}from"./three.light.min.js";const se={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Oo(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function kl(n){if(!n)throw new Error("No basePath supplied");return await Oo(`${n}/profilesList.json`)}async function Nl(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const s=await kl(e);let o;if(n.profiles.some(r=>{const l=s[r];return l&&(o={profileId:r,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}),!!o}),!o){if(!t)throw new Error("No matching profile name found");const r=s[t];if(!r)throw new Error(`No matching profile name found and default profile "${t}" missing.`);o={profileId:t,profilePath:`${e}/${r.path}`,deprecated:!!r.deprecated}}const a=await Oo(o.profilePath);let c;if(i){let r;if(n.handedness==="any"?r=a.layouts[Object.keys(a.layouts)[0]]:r=a.layouts[n.handedness],!r)throw new Error(`No matching handedness, ${n.handedness}, in profile ${o.profileId}`);r.assetPath&&(c=o.profilePath.replace("profile.json",r.assetPath))}return{profile:a,assetPath:c}}const Il={xAxis:0,yAxis:0,button:0,state:se.ComponentState.DEFAULT};function Jl(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const s=Math.atan2(e,n);t=Math.cos(s),i=Math.sin(s)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Ul{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===se.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Il)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:s}){const{normalizedXAxis:o,normalizedYAxis:a}=Jl(e,t);switch(this.componentProperty){case se.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?o:.5;break;case se.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?a:.5;break;case se.ComponentProperty.BUTTON:this.value=this.states.includes(s)?i:0;break;case se.ComponentProperty.STATE:this.valueNodeProperty===se.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Pl{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const s=new Ul(t.visualResponses[i]);this.visualResponses[i]=s}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:se.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=se.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=se.ComponentState.PRESSED:(t.touched||this.values.button>se.ButtonTouchThreshold)&&(this.values.state=se.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class wl{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(s=>{const o=this.layoutDescription.components[s];this.components[s]=new Pl(s,o)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const vs=2,_e=4,lt=4,Do=4,bt=new Int32Array(2),_o=new Float32Array(bt.buffer),Ao=new Float64Array(bt.buffer),gn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Ks;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Ks||(Ks={}));class Bi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new Bi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return bt[0]=this.readInt32(e),_o[0]}readFloat64(e){return bt[gn?0:1]=this.readInt32(e),bt[gn?1:0]=this.readInt32(e+4),Ao[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){_o[0]=t,this.writeInt32(e,bt[0])}writeFloat64(e,t){Ao[0]=t,this.writeInt32(e,bt[gn?0:1]),this.writeInt32(e+4,bt[gn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+_e+lt)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<lt;t++)e+=String.fromCharCode(this.readInt8(this.position_+_e+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let s="",o=0;if(e+=_e,t===Ks.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;o<i;){let a;const c=this.readUint8(e+o++);if(c<192)a=c;else{const r=this.readUint8(e+o++);if(c<224)a=(c&31)<<6|r&63;else{const l=this.readUint8(e+o++);if(c<240)a=(c&15)<<12|(r&63)<<6|l&63;else{const d=this.readUint8(e+o++);a=(c&7)<<18|(r&63)<<12|(l&63)<<6|d&63}}}a<65536?s+=String.fromCharCode(a):(a-=65536,s+=String.fromCharCode((a>>10)+55296,(a&1024-1)+56320))}return s}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+_e}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let t=0;t<lt;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+_e+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let s=0;s<t;++s)e(s)!==null&&i.push(e(s));return i}createObjList(e,t){const i=[];for(let s=0;s<t;++s){const o=e(s);o!==null&&i.push(o.unpack())}return i}}class ko{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=Bi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const s=this.bb.capacity();this.bb=ko.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,s=Bi.allocate(i);return s.setPosition(i-t),s.bytes().set(e.bytes(),i-t),s}addOffset(e){this.prep(_e,0),this.writeInt32(this.offset()-e+_e)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const s=2;this.addInt16(e-this.object_start);const o=(i+s)*vs;this.addInt16(o);let a=0;const c=this.space;e:for(t=0;t<this.vtables.length;t++){const r=this.bb.capacity()-this.vtables[t];if(o==this.bb.readInt16(r)){for(let l=vs;l<o;l+=vs)if(this.bb.readInt16(c+l)!=this.bb.readInt16(r+l))continue e;a=this.vtables[t];break}}return a?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,a-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const s=i?Do:0;if(t){const o=t;if(this.prep(this.minalign,_e+lt+s),o.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let a=lt-1;a>=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,_e+s),this.addOffset(e),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,s=i-this.bb.readInt32(i);if(this.bb.readInt16(s+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(_e,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let s;const o=e.charCodeAt(i++);if(o<55296||o>=56320)s=o;else{const a=e.charCodeAt(i++);s=(o<<10)+a+(65536-56623104-56320)}s<128?t.push(s):(s<2048?t.push(s>>6&31|192):(s<65536?t.push(s>>12&15|224):t.push(s>>18&7|240,s>>12&63|128),t.push(s>>6&63|128)),t.push(s&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,s=this.space,o=this.bb.bytes();i<t.length;i++)o[s++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const s=e[i];if(s!==null)t.push(this.createObjectOffset(s));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function Cn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qo={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(s){typeof s=="number"?this._pieces.push(s):(this.flush(),this._parts.push(s))},i.prototype.flush=function(){if(this._pieces.length>0){var s=new Uint8Array(this._pieces);e.useArrayBufferView||(s=s.buffer),this._parts.push(s),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var s=new t,o=0,a=this._parts.length;o<a;o++)s.append(this._parts[o]);return s.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(qo);var $o=qo.exports,Fl=$o.BufferBuilder,ea=$o.binaryFeatures,Ql={unpack:function(n){var e=new re(n);return e.unpack()},pack:function(n){var e=new le;e.pack(n);var t=e.getBuffer();return t}},Bl=Ql;function re(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}re.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},re.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},re.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},re.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},re.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},re.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},re.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},re.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},re.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},re.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},re.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",s,o;t<n;)s=e[t],s<128?(i+=String.fromCharCode(s),t++):(s^192)<32?(o=(s^192)<<6|e[t+1]&63,i+=String.fromCharCode(o),t+=2):(o=(s&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(o),t+=3);return this.index+=n,i},re.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},re.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),s=this.unpack();e[i]=s}return e},re.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},re.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,s=n&1048575|1048576,o=s*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*o},re.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function le(){this.bufferBuilder=new Fl}le.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},le.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},le.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_string=function(n){var e=jl(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},le.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},le.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,s=Math.floor(i*Math.pow(2,52)),o=Math.pow(2,32),a=e<<31|t+1023<<20|s/o&1048575,c=s%o;this.bufferBuilder.append(203),this.pack_int32(a),this.pack_int32(c)},le.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},le.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},le.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},le.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},le.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},le.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function El(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function jl(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,El).length}const ta=Cn(Bl);let ia=!0,na=!0;function Zi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function _t(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,s=i.addEventListener;i.addEventListener=function(a,c){if(a!==e)return s.apply(this,arguments);const r=l=>{const d=t(l);d&&(c.handleEvent?c.handleEvent(d):c(d))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,r),s.apply(this,[a,r])};const o=i.removeEventListener;i.removeEventListener=function(a,c){if(a!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(c))return o.apply(this,arguments);const r=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[a,r])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}function Ol(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(ia=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Dl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(na=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Ms(){if(typeof window=="object"){if(ia)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function zn(n,e){na&&console.warn(n+" is deprecated, please use "+e+" instead.")}function _l(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=Zi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=Zi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=Zi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=Zi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function sa(n){return Object.prototype.toString.call(n)==="[object Object]"}function oa(n){return sa(n)?Object.keys(n).reduce(function(e,t){const i=sa(n[t]),s=i?oa(n[t]):n[t],o=i&&!Object.keys(s).length;return s===void 0||o?e:Object.assign(e,{[t]:s})},{}):n}function Ts(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Ts(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(s=>{Ts(n,n.get(s),t)})}))}function aa(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",s=new Map;if(e===null)return s;const o=[];return n.forEach(a=>{a.type==="track"&&a.trackIdentifier===e.id&&o.push(a)}),o.forEach(a=>{n.forEach(c=>{c.type===i&&c.trackId===a.id&&Ts(n,c,s)})}),s}const ra=Ms;function la(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const r={};return Object.keys(c).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const d=typeof c[l]=="object"?c[l]:{ideal:c[l]};d.exact!==void 0&&typeof d.exact=="number"&&(d.min=d.max=d.exact);const h=function(u,p){return u?u+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(d.ideal!==void 0){r.optional=r.optional||[];let u={};typeof d.ideal=="number"?(u[h("min",l)]=d.ideal,r.optional.push(u),u={},u[h("max",l)]=d.ideal,r.optional.push(u)):(u[h("",l)]=d.ideal,r.optional.push(u))}d.exact!==void 0&&typeof d.exact!="number"?(r.mandatory=r.mandatory||{},r.mandatory[h("",l)]=d.exact):["min","max"].forEach(u=>{d[u]!==void 0&&(r.mandatory=r.mandatory||{},r.mandatory[h(u,l)]=d[u])})}),c.advanced&&(r.optional=(r.optional||[]).concat(c.advanced)),r},s=function(c,r){if(e.version>=61)return r(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const l=function(d,h,u){h in d&&!(u in d)&&(d[u]=d[h],delete d[h])};c=JSON.parse(JSON.stringify(c)),l(c.audio,"autoGainControl","googAutoGainControl"),l(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=i(c.audio)}if(c&&typeof c.video=="object"){let l=c.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const d=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!d)){delete c.video.facingMode;let h;if(l.exact==="environment"||l.ideal==="environment"?h=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(h=["front"]),h)return t.mediaDevices.enumerateDevices().then(u=>{u=u.filter(m=>m.kind==="videoinput");let p=u.find(m=>h.some(b=>m.label.toLowerCase().includes(b)));return!p&&u.length&&h.includes("back")&&(p=u[u.length-1]),p&&(c.video.deviceId=l.exact?{exact:p.deviceId}:{ideal:p.deviceId}),c.video=i(c.video),ra("chrome: "+JSON.stringify(c)),r(c)})}c.video=i(c.video)}return ra("chrome: "+JSON.stringify(c)),r(c)},o=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(c,r,l){s(c,d=>{t.webkitGetUserMedia(d,r,h=>{l&&l(o(h))})})};if(t.getUserMedia=a.bind(t),t.mediaDevices.getUserMedia){const c=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(r){return s(r,l=>c(l).then(d=>{if(l.audio&&!d.getAudioTracks().length||l.video&&!d.getVideoTracks().length)throw d.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return d},d=>Promise.reject(o(d))))}}}function Al(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const s=t.video&&t.video.width,o=t.video&&t.video.height,a=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:a||3}},s&&(t.video.mandatory.maxWidth=s),o&&(t.video.mandatory.maxHeight=o),n.navigator.mediaDevices.getUserMedia(t)})}}}function ca(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function da(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):s={track:i.track};const o=new Event("track");o.track=i.track,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)}),t.stream.getTracks().forEach(i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.id):s={track:i};const o=new Event("track");o.track=i,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else _t(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ha(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(s,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=s.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:s}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const s=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(a,c){let r=s.apply(this,arguments);return r||(r=e(this,a),this._senders.push(r)),r};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(a){o.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],t.apply(this,[s]),s.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(o=>{const a=this._senders.find(c=>c.track===o);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function ua(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,s]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const o=function(c){const r={};return c.result().forEach(l=>{const d={id:l.id,timestamp:l.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[l.type]||l.type};l.names().forEach(h=>{d[h]=l.stat(h)}),r[d.id]=d}),r},a=function(c){return new Map(Object.keys(c).map(r=>[r,c[r]]))};if(arguments.length>=2){const c=function(r){i(a(o(r)))};return e.apply(this,[c,t])}return new Promise((c,r)=>{e.apply(this,[function(l){c(a(o(l)))},r])}).then(i,s)}}function pa(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const s=t.apply(this,[]);return s.forEach(o=>o._pc=this),s});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const s=i.apply(this,arguments);return s._pc=this,s}),n.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(o=>aa(o,s.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(s=>s._pc=this),i}),_t(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(s=>aa(s,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,s,o;return this.getSenders().forEach(a=>{a.track===t&&(i?o=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===t&&(s?o=!0:s=a),a.track===t)),o||i&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function ma(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(r=>{if(this.getSenders().find(l=>l.track===r))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();t.apply(this,arguments);const c=this.getSenders().filter(r=>a.indexOf(r)===-1);this._shimmedLocalStreams[o.id]=[o].concat(c)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],i.apply(this,arguments)};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(o);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),s.apply(this,arguments)}}function ba(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return ma(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(d=>this._reverseStreams[d.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(d=>{if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const d=new n.MediaStream(l.getTracks());this._streams[l.id]=d,this._reverseStreams[d.id]=l,l=d}i.apply(this,[l])};const s=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},n.RTCPeerConnection.prototype.addTrack=function(l,d){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const h=[].slice.call(arguments,1);if(h.length!==1||!h[0].getTracks().find(p=>p===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const u=this._streams[d.id];if(u)u.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([l]);this._streams[d.id]=p,this._reverseStreams[p.id]=d,this.addStream(p)}return this.getSenders().find(p=>p.track===l)};function o(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(m.id,"g"),p.id)}),new RTCSessionDescription({type:d.type,sdp:h})}function a(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(p.id,"g"),m.id)}),new RTCSessionDescription({type:d.type,sdp:h})}["createOffer","createAnswer"].forEach(function(l){const d=n.RTCPeerConnection.prototype[l],h={[l](){const u=arguments;return arguments.length&&typeof arguments[0]=="function"?d.apply(this,[p=>{const m=o(this,p);u[0].apply(null,[m])},p=>{u[1]&&u[1].apply(null,p)},arguments[2]]):d.apply(this,arguments).then(p=>o(this,p))}};n.RTCPeerConnection.prototype[l]=h[l]});const c=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=a(this,arguments[0]),c.apply(this,arguments))};const r=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=r.get.apply(this);return l.type===""?l:o(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(l._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(u=>l.track===u)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ys(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],s={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=s[t]})}function ya(n,e){_t(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const Ga=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:ya,shimAddTrackRemoveTrack:ba,shimAddTrackRemoveTrackWithNative:ma,shimGetDisplayMedia:Al,shimGetSendersWithDtmf:ha,shimGetStats:ua,shimGetUserMedia:la,shimMediaStream:ca,shimOnTrack:da,shimPeerConnection:Ys,shimSenderReceiverGetStats:pa},Symbol.toStringTag,{value:"Module"}));function ql(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let s=i.urls||i.url;i.url&&!i.urls&&zn("RTCIceServer.url","RTCIceServer.urls");const o=typeof s=="string";return o&&(s=[s]),s=s.filter(a=>{if(a.indexOf("stun:")===0)return!1;const c=a.startsWith("turn")&&!a.startsWith("turn:[")&&a.includes("transport=udp");return c&&!t?(t=!0,!0):c&&!t}),delete i.url,i.urls=o?s[0]:s,!!s.length}})}var Za={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
2
2
  `).map(function(i){return i.trim()})},e.splitSections=function(t){var i=t.split(`
3
3
  m=`);return i.map(function(s,o){return(o>0?"m="+s:s).trim()+`\r
4
4
  `})},e.getDescription=function(t){var i=e.splitSections(t);return i&&i[0]},e.getMediaSections=function(t){var i=e.splitSections(t);return i.shift(),i},e.matchPrefix=function(t,i){return e.splitLines(t).filter(function(s){return s.indexOf(i)===0})},e.parseCandidate=function(t){var i;t.indexOf("a=candidate:")===0?i=t.substring(12).split(" "):i=t.substring(10).split(" ");for(var s={foundation:i[0],component:parseInt(i[1],10),protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]},o=8;o<i.length;o+=2)switch(i[o]){case"raddr":s.relatedAddress=i[o+1];break;case"rport":s.relatedPort=parseInt(i[o+1],10);break;case"tcptype":s.tcpType=i[o+1];break;case"ufrag":s.ufrag=i[o+1],s.usernameFragment=i[o+1];break;default:s[i[o]]=i[o+1];break}return s},e.writeCandidate=function(t){var i=[];i.push(t.foundation),i.push(t.component),i.push(t.protocol.toUpperCase()),i.push(t.priority),i.push(t.address||t.ip),i.push(t.port);var s=t.type;return i.push("typ"),i.push(s),s!=="host"&&t.relatedAddress&&t.relatedPort&&(i.push("raddr"),i.push(t.relatedAddress),i.push("rport"),i.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(i.push("ufrag"),i.push(t.usernameFragment||t.ufrag)),"candidate:"+i.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){var i=t.substr(9).split(" "),s={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),s.name=i[0],s.clockRate=parseInt(i[1],10),s.channels=i.length===3?parseInt(i[2],10):1,s.numChannels=s.channels,s},e.writeRtpMap=function(t){var i=t.payloadType;t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType);var s=t.channels||t.numChannels||1;return"a=rtpmap:"+i+" "+t.name+"/"+t.clockRate+(s!==1?"/"+s:"")+`\r
@@ -1,4 +1,4 @@
1
- import{P as Jo,a9 as Rl,bc as we,V as K,L as xn,q as xs,D as Ss,b6 as Uo,O as fs,c0 as Yt,cM as Ve,cI as Ll,U as Fe,k as Ws,B as Ot,I as be,M as Sn,e as xl,b1 as Sl,g as De,Y as Po,b5 as rt,S as wo,c as Te,d as fe,bC as Fo,ax as fl,aq as Qo,r as Wl,X as gl,b0 as Cl,R as zl,ac as gs,al as Dt,bB as yi,cN as fn,bG as Gi,b2 as Bo,cO as vl,cP as Eo,cQ as Kl,ad as Wn,cR as Cs,bP as Ml,bO as Tl,cS as jo,cT as Yl,o as Hl,h as zs}from"./three.min.js";const se={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Oo(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function kl(n){if(!n)throw new Error("No basePath supplied");return await Oo(`${n}/profilesList.json`)}async function Nl(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const s=await kl(e);let o;if(n.profiles.some(r=>{const l=s[r];return l&&(o={profileId:r,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}),!!o}),!o){if(!t)throw new Error("No matching profile name found");const r=s[t];if(!r)throw new Error(`No matching profile name found and default profile "${t}" missing.`);o={profileId:t,profilePath:`${e}/${r.path}`,deprecated:!!r.deprecated}}const a=await Oo(o.profilePath);let c;if(i){let r;if(n.handedness==="any"?r=a.layouts[Object.keys(a.layouts)[0]]:r=a.layouts[n.handedness],!r)throw new Error(`No matching handedness, ${n.handedness}, in profile ${o.profileId}`);r.assetPath&&(c=o.profilePath.replace("profile.json",r.assetPath))}return{profile:a,assetPath:c}}const Il={xAxis:0,yAxis:0,button:0,state:se.ComponentState.DEFAULT};function Jl(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const s=Math.atan2(e,n);t=Math.cos(s),i=Math.sin(s)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Ul{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===se.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Il)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:s}){const{normalizedXAxis:o,normalizedYAxis:a}=Jl(e,t);switch(this.componentProperty){case se.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?o:.5;break;case se.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?a:.5;break;case se.ComponentProperty.BUTTON:this.value=this.states.includes(s)?i:0;break;case se.ComponentProperty.STATE:this.valueNodeProperty===se.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Pl{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const s=new Ul(t.visualResponses[i]);this.visualResponses[i]=s}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:se.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=se.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=se.ComponentState.PRESSED:(t.touched||this.values.button>se.ButtonTouchThreshold)&&(this.values.state=se.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class wl{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(s=>{const o=this.layoutDescription.components[s];this.components[s]=new Pl(s,o)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const vs=2,_e=4,lt=4,Do=4,bt=new Int32Array(2),_o=new Float32Array(bt.buffer),Ao=new Float64Array(bt.buffer),gn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Ks;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Ks||(Ks={}));class Bi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new Bi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return bt[0]=this.readInt32(e),_o[0]}readFloat64(e){return bt[gn?0:1]=this.readInt32(e),bt[gn?1:0]=this.readInt32(e+4),Ao[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){_o[0]=t,this.writeInt32(e,bt[0])}writeFloat64(e,t){Ao[0]=t,this.writeInt32(e,bt[gn?0:1]),this.writeInt32(e+4,bt[gn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+_e+lt)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<lt;t++)e+=String.fromCharCode(this.readInt8(this.position_+_e+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let s="",o=0;if(e+=_e,t===Ks.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;o<i;){let a;const c=this.readUint8(e+o++);if(c<192)a=c;else{const r=this.readUint8(e+o++);if(c<224)a=(c&31)<<6|r&63;else{const l=this.readUint8(e+o++);if(c<240)a=(c&15)<<12|(r&63)<<6|l&63;else{const d=this.readUint8(e+o++);a=(c&7)<<18|(r&63)<<12|(l&63)<<6|d&63}}}a<65536?s+=String.fromCharCode(a):(a-=65536,s+=String.fromCharCode((a>>10)+55296,(a&1024-1)+56320))}return s}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+_e}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let t=0;t<lt;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+_e+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let s=0;s<t;++s)e(s)!==null&&i.push(e(s));return i}createObjList(e,t){const i=[];for(let s=0;s<t;++s){const o=e(s);o!==null&&i.push(o.unpack())}return i}}class ko{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=Bi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const s=this.bb.capacity();this.bb=ko.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,s=Bi.allocate(i);return s.setPosition(i-t),s.bytes().set(e.bytes(),i-t),s}addOffset(e){this.prep(_e,0),this.writeInt32(this.offset()-e+_e)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const s=2;this.addInt16(e-this.object_start);const o=(i+s)*vs;this.addInt16(o);let a=0;const c=this.space;e:for(t=0;t<this.vtables.length;t++){const r=this.bb.capacity()-this.vtables[t];if(o==this.bb.readInt16(r)){for(let l=vs;l<o;l+=vs)if(this.bb.readInt16(c+l)!=this.bb.readInt16(r+l))continue e;a=this.vtables[t];break}}return a?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,a-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const s=i?Do:0;if(t){const o=t;if(this.prep(this.minalign,_e+lt+s),o.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let a=lt-1;a>=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,_e+s),this.addOffset(e),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,s=i-this.bb.readInt32(i);if(this.bb.readInt16(s+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(_e,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let s;const o=e.charCodeAt(i++);if(o<55296||o>=56320)s=o;else{const a=e.charCodeAt(i++);s=(o<<10)+a+(65536-56623104-56320)}s<128?t.push(s):(s<2048?t.push(s>>6&31|192):(s<65536?t.push(s>>12&15|224):t.push(s>>18&7|240,s>>12&63|128),t.push(s>>6&63|128)),t.push(s&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,s=this.space,o=this.bb.bytes();i<t.length;i++)o[s++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const s=e[i];if(s!==null)t.push(this.createObjectOffset(s));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function Cn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qo={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(s){typeof s=="number"?this._pieces.push(s):(this.flush(),this._parts.push(s))},i.prototype.flush=function(){if(this._pieces.length>0){var s=new Uint8Array(this._pieces);e.useArrayBufferView||(s=s.buffer),this._parts.push(s),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var s=new t,o=0,a=this._parts.length;o<a;o++)s.append(this._parts[o]);return s.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(qo);var $o=qo.exports,Fl=$o.BufferBuilder,ea=$o.binaryFeatures,Ql={unpack:function(n){var e=new re(n);return e.unpack()},pack:function(n){var e=new le;e.pack(n);var t=e.getBuffer();return t}},Bl=Ql;function re(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}re.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},re.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},re.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},re.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},re.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},re.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},re.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},re.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},re.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},re.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},re.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",s,o;t<n;)s=e[t],s<128?(i+=String.fromCharCode(s),t++):(s^192)<32?(o=(s^192)<<6|e[t+1]&63,i+=String.fromCharCode(o),t+=2):(o=(s&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(o),t+=3);return this.index+=n,i},re.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},re.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),s=this.unpack();e[i]=s}return e},re.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},re.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,s=n&1048575|1048576,o=s*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*o},re.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function le(){this.bufferBuilder=new Fl}le.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},le.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},le.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_string=function(n){var e=jl(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},le.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},le.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,s=Math.floor(i*Math.pow(2,52)),o=Math.pow(2,32),a=e<<31|t+1023<<20|s/o&1048575,c=s%o;this.bufferBuilder.append(203),this.pack_int32(a),this.pack_int32(c)},le.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},le.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},le.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},le.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},le.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},le.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function El(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function jl(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,El).length}const ta=Cn(Bl);let ia=!0,na=!0;function Zi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function _t(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,s=i.addEventListener;i.addEventListener=function(a,c){if(a!==e)return s.apply(this,arguments);const r=l=>{const d=t(l);d&&(c.handleEvent?c.handleEvent(d):c(d))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,r),s.apply(this,[a,r])};const o=i.removeEventListener;i.removeEventListener=function(a,c){if(a!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(c))return o.apply(this,arguments);const r=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[a,r])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}function Ol(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(ia=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Dl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(na=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Ms(){if(typeof window=="object"){if(ia)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function zn(n,e){na&&console.warn(n+" is deprecated, please use "+e+" instead.")}function _l(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=Zi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=Zi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=Zi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=Zi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function sa(n){return Object.prototype.toString.call(n)==="[object Object]"}function oa(n){return sa(n)?Object.keys(n).reduce(function(e,t){const i=sa(n[t]),s=i?oa(n[t]):n[t],o=i&&!Object.keys(s).length;return s===void 0||o?e:Object.assign(e,{[t]:s})},{}):n}function Ts(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Ts(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(s=>{Ts(n,n.get(s),t)})}))}function aa(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",s=new Map;if(e===null)return s;const o=[];return n.forEach(a=>{a.type==="track"&&a.trackIdentifier===e.id&&o.push(a)}),o.forEach(a=>{n.forEach(c=>{c.type===i&&c.trackId===a.id&&Ts(n,c,s)})}),s}const ra=Ms;function la(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const r={};return Object.keys(c).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const d=typeof c[l]=="object"?c[l]:{ideal:c[l]};d.exact!==void 0&&typeof d.exact=="number"&&(d.min=d.max=d.exact);const h=function(u,p){return u?u+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(d.ideal!==void 0){r.optional=r.optional||[];let u={};typeof d.ideal=="number"?(u[h("min",l)]=d.ideal,r.optional.push(u),u={},u[h("max",l)]=d.ideal,r.optional.push(u)):(u[h("",l)]=d.ideal,r.optional.push(u))}d.exact!==void 0&&typeof d.exact!="number"?(r.mandatory=r.mandatory||{},r.mandatory[h("",l)]=d.exact):["min","max"].forEach(u=>{d[u]!==void 0&&(r.mandatory=r.mandatory||{},r.mandatory[h(u,l)]=d[u])})}),c.advanced&&(r.optional=(r.optional||[]).concat(c.advanced)),r},s=function(c,r){if(e.version>=61)return r(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const l=function(d,h,u){h in d&&!(u in d)&&(d[u]=d[h],delete d[h])};c=JSON.parse(JSON.stringify(c)),l(c.audio,"autoGainControl","googAutoGainControl"),l(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=i(c.audio)}if(c&&typeof c.video=="object"){let l=c.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const d=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!d)){delete c.video.facingMode;let h;if(l.exact==="environment"||l.ideal==="environment"?h=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(h=["front"]),h)return t.mediaDevices.enumerateDevices().then(u=>{u=u.filter(m=>m.kind==="videoinput");let p=u.find(m=>h.some(b=>m.label.toLowerCase().includes(b)));return!p&&u.length&&h.includes("back")&&(p=u[u.length-1]),p&&(c.video.deviceId=l.exact?{exact:p.deviceId}:{ideal:p.deviceId}),c.video=i(c.video),ra("chrome: "+JSON.stringify(c)),r(c)})}c.video=i(c.video)}return ra("chrome: "+JSON.stringify(c)),r(c)},o=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(c,r,l){s(c,d=>{t.webkitGetUserMedia(d,r,h=>{l&&l(o(h))})})};if(t.getUserMedia=a.bind(t),t.mediaDevices.getUserMedia){const c=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(r){return s(r,l=>c(l).then(d=>{if(l.audio&&!d.getAudioTracks().length||l.video&&!d.getVideoTracks().length)throw d.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return d},d=>Promise.reject(o(d))))}}}function Al(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const s=t.video&&t.video.width,o=t.video&&t.video.height,a=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:a||3}},s&&(t.video.mandatory.maxWidth=s),o&&(t.video.mandatory.maxHeight=o),n.navigator.mediaDevices.getUserMedia(t)})}}}function ca(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function da(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):s={track:i.track};const o=new Event("track");o.track=i.track,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)}),t.stream.getTracks().forEach(i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.id):s={track:i};const o=new Event("track");o.track=i,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else _t(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ha(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(s,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=s.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:s}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const s=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(a,c){let r=s.apply(this,arguments);return r||(r=e(this,a),this._senders.push(r)),r};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(a){o.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],t.apply(this,[s]),s.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(o=>{const a=this._senders.find(c=>c.track===o);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function ua(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,s]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const o=function(c){const r={};return c.result().forEach(l=>{const d={id:l.id,timestamp:l.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[l.type]||l.type};l.names().forEach(h=>{d[h]=l.stat(h)}),r[d.id]=d}),r},a=function(c){return new Map(Object.keys(c).map(r=>[r,c[r]]))};if(arguments.length>=2){const c=function(r){i(a(o(r)))};return e.apply(this,[c,t])}return new Promise((c,r)=>{e.apply(this,[function(l){c(a(o(l)))},r])}).then(i,s)}}function pa(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const s=t.apply(this,[]);return s.forEach(o=>o._pc=this),s});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const s=i.apply(this,arguments);return s._pc=this,s}),n.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(o=>aa(o,s.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(s=>s._pc=this),i}),_t(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(s=>aa(s,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,s,o;return this.getSenders().forEach(a=>{a.track===t&&(i?o=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===t&&(s?o=!0:s=a),a.track===t)),o||i&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function ma(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(r=>{if(this.getSenders().find(l=>l.track===r))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();t.apply(this,arguments);const c=this.getSenders().filter(r=>a.indexOf(r)===-1);this._shimmedLocalStreams[o.id]=[o].concat(c)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],i.apply(this,arguments)};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(o);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),s.apply(this,arguments)}}function ba(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return ma(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(d=>this._reverseStreams[d.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(d=>{if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const d=new n.MediaStream(l.getTracks());this._streams[l.id]=d,this._reverseStreams[d.id]=l,l=d}i.apply(this,[l])};const s=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},n.RTCPeerConnection.prototype.addTrack=function(l,d){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const h=[].slice.call(arguments,1);if(h.length!==1||!h[0].getTracks().find(p=>p===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const u=this._streams[d.id];if(u)u.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([l]);this._streams[d.id]=p,this._reverseStreams[p.id]=d,this.addStream(p)}return this.getSenders().find(p=>p.track===l)};function o(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(m.id,"g"),p.id)}),new RTCSessionDescription({type:d.type,sdp:h})}function a(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(p.id,"g"),m.id)}),new RTCSessionDescription({type:d.type,sdp:h})}["createOffer","createAnswer"].forEach(function(l){const d=n.RTCPeerConnection.prototype[l],h={[l](){const u=arguments;return arguments.length&&typeof arguments[0]=="function"?d.apply(this,[p=>{const m=o(this,p);u[0].apply(null,[m])},p=>{u[1]&&u[1].apply(null,p)},arguments[2]]):d.apply(this,arguments).then(p=>o(this,p))}};n.RTCPeerConnection.prototype[l]=h[l]});const c=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=a(this,arguments[0]),c.apply(this,arguments))};const r=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=r.get.apply(this);return l.type===""?l:o(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(l._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(u=>l.track===u)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ys(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],s={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=s[t]})}function ya(n,e){_t(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const Ga=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:ya,shimAddTrackRemoveTrack:ba,shimAddTrackRemoveTrackWithNative:ma,shimGetDisplayMedia:Al,shimGetSendersWithDtmf:ha,shimGetStats:ua,shimGetUserMedia:la,shimMediaStream:ca,shimOnTrack:da,shimPeerConnection:Ys,shimSenderReceiverGetStats:pa},Symbol.toStringTag,{value:"Module"}));function ql(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let s=i.urls||i.url;i.url&&!i.urls&&zn("RTCIceServer.url","RTCIceServer.urls");const o=typeof s=="string";return o&&(s=[s]),s=s.filter(a=>{if(a.indexOf("stun:")===0)return!1;const c=a.startsWith("turn")&&!a.startsWith("turn:[")&&a.includes("transport=udp");return c&&!t?(t=!0,!0):c&&!t}),delete i.url,i.urls=o?s[0]:s,!!s.length}})}var Za={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
1
+ import{P as Jo,a9 as Rl,bc as we,V as K,L as xn,q as xs,D as Ss,b6 as Uo,O as fs,c0 as Yt,cM as Ve,cI as Ll,U as Fe,j as Ws,B as Ot,I as be,M as Sn,d as xl,b1 as Sl,f as De,Y as Po,b5 as rt,S as wo,b as Te,c as fe,bC as Fo,ax as fl,aq as Qo,r as Wl,X as gl,b0 as Cl,R as zl,ac as gs,al as Dt,bB as yi,cN as fn,bG as Gi,b2 as Bo,cO as vl,cP as Eo,cQ as Kl,ad as Wn,cR as Cs,bP as Ml,bO as Tl,cS as jo,cT as Yl,o as Hl,g as zs}from"./three.min.js";const se={Handedness:Object.freeze({NONE:"none",LEFT:"left",RIGHT:"right"}),ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function Oo(n){const e=await fetch(n);if(e.ok)return e.json();throw new Error(e.statusText)}async function kl(n){if(!n)throw new Error("No basePath supplied");return await Oo(`${n}/profilesList.json`)}async function Nl(n,e,t=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const s=await kl(e);let o;if(n.profiles.some(r=>{const l=s[r];return l&&(o={profileId:r,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}),!!o}),!o){if(!t)throw new Error("No matching profile name found");const r=s[t];if(!r)throw new Error(`No matching profile name found and default profile "${t}" missing.`);o={profileId:t,profilePath:`${e}/${r.path}`,deprecated:!!r.deprecated}}const a=await Oo(o.profilePath);let c;if(i){let r;if(n.handedness==="any"?r=a.layouts[Object.keys(a.layouts)[0]]:r=a.layouts[n.handedness],!r)throw new Error(`No matching handedness, ${n.handedness}, in profile ${o.profileId}`);r.assetPath&&(c=o.profilePath.replace("profile.json",r.assetPath))}return{profile:a,assetPath:c}}const Il={xAxis:0,yAxis:0,button:0,state:se.ComponentState.DEFAULT};function Jl(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const s=Math.atan2(e,n);t=Math.cos(s),i=Math.sin(s)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class Ul{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===se.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Il)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:s}){const{normalizedXAxis:o,normalizedYAxis:a}=Jl(e,t);switch(this.componentProperty){case se.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?o:.5;break;case se.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?a:.5;break;case se.ComponentProperty.BUTTON:this.value=this.states.includes(s)?i:0;break;case se.ComponentProperty.STATE:this.valueNodeProperty===se.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class Pl{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const s=new Ul(t.visualResponses[i]);this.visualResponses[i]=s}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:se.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=se.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=se.ComponentState.PRESSED:(t.touched||this.values.button>se.ButtonTouchThreshold)&&(this.values.state=se.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===se.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>se.AxisTouchThreshold&&(this.values.state=se.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class wl{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(s=>{const o=this.layoutDescription.components[s];this.components[s]=new Pl(s,o)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const vs=2,_e=4,lt=4,Do=4,bt=new Int32Array(2),_o=new Float32Array(bt.buffer),Ao=new Float64Array(bt.buffer),gn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class pt{constructor(e,t){this.low=e|0,this.high=t|0}static create(e,t){return e==0&&t==0?pt.ZERO:new pt(e,t)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(e){return this.low==e.low&&this.high==e.high}}pt.ZERO=new pt(0,0);var Ks;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Ks||(Ks={}));class Bi{constructor(e){this.bytes_=e,this.position_=0}static allocate(e){return new Bi(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return new pt(this.readInt32(e),this.readInt32(e+4))}readUint64(e){return new pt(this.readUint32(e),this.readUint32(e+4))}readFloat32(e){return bt[0]=this.readInt32(e),_o[0]}readFloat64(e){return bt[gn?0:1]=this.readInt32(e),bt[gn?1:0]=this.readInt32(e+4),Ao[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)}writeUint64(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)}writeFloat32(e,t){_o[0]=t,this.writeInt32(e,bt[0])}writeFloat64(e,t){Ao[0]=t,this.writeInt32(e,bt[gn?0:1]),this.writeInt32(e+4,bt[gn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+_e+lt)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<lt;t++)e+=String.fromCharCode(this.readInt8(this.position_+_e+t));return e}__offset(e,t){const i=e-this.readInt32(e);return t<this.readInt16(i)?this.readInt16(i+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const i=this.readInt32(e);let s="",o=0;if(e+=_e,t===Ks.UTF8_BYTES)return this.bytes_.subarray(e,e+i);for(;o<i;){let a;const c=this.readUint8(e+o++);if(c<192)a=c;else{const r=this.readUint8(e+o++);if(c<224)a=(c&31)<<6|r&63;else{const l=this.readUint8(e+o++);if(c<240)a=(c&15)<<12|(r&63)<<6|l&63;else{const d=this.readUint8(e+o++);a=(c&7)<<18|(r&63)<<12|(l&63)<<6|d&63}}}a<65536?s+=String.fromCharCode(a):(a-=65536,s+=String.fromCharCode((a>>10)+55296,(a&1024-1)+56320))}return s}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+_e}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let t=0;t<lt;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+_e+t))return!1;return!0}createLong(e,t){return pt.create(e,t)}createScalarList(e,t){const i=[];for(let s=0;s<t;++s)e(s)!==null&&i.push(e(s));return i}createObjList(e,t){const i=[];for(let s=0;s<t;++s){const o=e(s);o!==null&&i.push(o.unpack())}return i}}class ko{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null;let t;e?t=e:t=1024,this.bb=Bi.allocate(t),this.space=t}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const i=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<i+e+t;){const s=this.bb.capacity();this.bb=ko.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,i){(this.force_defaults||t!=i)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,i){(this.force_defaults||t!=i)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,i){(this.force_defaults||t!=i)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,i){(this.force_defaults||!t.equals(i))&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,i){(this.force_defaults||t!=i)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,i){(this.force_defaults||t!=i)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,i){t!=i&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=t<<1,s=Bi.allocate(i);return s.setPosition(i-t),s.bytes().set(e.bytes(),i-t),s}addOffset(e){this.prep(_e,0),this.writeInt32(this.offset()-e+_e)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const i=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const s=2;this.addInt16(e-this.object_start);const o=(i+s)*vs;this.addInt16(o);let a=0;const c=this.space;e:for(t=0;t<this.vtables.length;t++){const r=this.bb.capacity()-this.vtables[t];if(o==this.bb.readInt16(r)){for(let l=vs;l<o;l+=vs)if(this.bb.readInt16(c+l)!=this.bb.readInt16(r+l))continue e;a=this.vtables[t];break}}return a?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,a-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,i){const s=i?Do:0;if(t){const o=t;if(this.prep(this.minalign,_e+lt+s),o.length!=lt)throw new Error("FlatBuffers: file identifier must be length "+lt);for(let a=lt-1;a>=0;a--)this.writeInt8(o.charCodeAt(a))}this.prep(this.minalign,_e+s),this.addOffset(e),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const i=this.bb.capacity()-e,s=i-this.bb.readInt32(i);if(this.bb.readInt16(s+t)==0)throw new Error("FlatBuffers: field "+t+" must be set")}startVector(e,t,i){this.notNested(),this.vector_num_elems=t,this.prep(_e,e*t),this.prep(i,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(!e)return 0;let t;if(e instanceof Uint8Array)t=e;else{t=[];let i=0;for(;i<e.length;){let s;const o=e.charCodeAt(i++);if(o<55296||o>=56320)s=o;else{const a=e.charCodeAt(i++);s=(o<<10)+a+(65536-56623104-56320)}s<128?t.push(s):(s<2048?t.push(s>>6&31|192):(s<65536?t.push(s>>12&15|224):t.push(s>>18&7|240,s>>12&63|128),t.push(s>>6&63|128)),t.push(s&63|128))}}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let i=0,s=this.space,o=this.bb.bytes();i<t.length;i++)o[s++]=t[i];return this.endVector()}createLong(e,t){return pt.create(e,t)}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let i=0;i<e.length;++i){const s=e[i];if(s!==null)t.push(this.createObjectOffset(s));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e),this.endVector()}}function Cn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var qo={exports:{}};(function(n){var e={};e.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),e.useArrayBufferView=!e.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=e;var t=n.exports.BlobBuilder;typeof window<"u"&&(t=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(s){typeof s=="number"?this._pieces.push(s):(this.flush(),this._parts.push(s))},i.prototype.flush=function(){if(this._pieces.length>0){var s=new Uint8Array(this._pieces);e.useArrayBufferView||(s=s.buffer),this._parts.push(s),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),e.useBlobBuilder){for(var s=new t,o=0,a=this._parts.length;o<a;o++)s.append(this._parts[o]);return s.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i})(qo);var $o=qo.exports,Fl=$o.BufferBuilder,ea=$o.binaryFeatures,Ql={unpack:function(n){var e=new re(n);return e.unpack()},pack:function(n){var e=new le;e.pack(n);var t=e.getBuffer();return t}},Bl=Ql;function re(n){this.index=0,this.dataBuffer=n,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}re.prototype.unpack=function(){var n=this.unpack_uint8();if(n<128)return n;if((n^224)<32)return(n^224)-32;var e;if((e=n^160)<=15)return this.unpack_raw(e);if((e=n^176)<=15)return this.unpack_string(e);if((e=n^144)<=15)return this.unpack_array(e);if((e=n^128)<=15)return this.unpack_map(e);switch(n){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:return;case 213:return;case 214:return;case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},re.prototype.unpack_uint8=function(){var n=this.dataView[this.index]&255;return this.index++,n},re.prototype.unpack_uint16=function(){var n=this.read(2),e=(n[0]&255)*256+(n[1]&255);return this.index+=2,e},re.prototype.unpack_uint32=function(){var n=this.read(4),e=((n[0]*256+n[1])*256+n[2])*256+n[3];return this.index+=4,e},re.prototype.unpack_uint64=function(){var n=this.read(8),e=((((((n[0]*256+n[1])*256+n[2])*256+n[3])*256+n[4])*256+n[5])*256+n[6])*256+n[7];return this.index+=8,e},re.prototype.unpack_int8=function(){var n=this.unpack_uint8();return n<128?n:n-256},re.prototype.unpack_int16=function(){var n=this.unpack_uint16();return n<32768?n:n-65536},re.prototype.unpack_int32=function(){var n=this.unpack_uint32();return n<Math.pow(2,31)?n:n-Math.pow(2,32)},re.prototype.unpack_int64=function(){var n=this.unpack_uint64();return n<Math.pow(2,63)?n:n-Math.pow(2,64)},re.prototype.unpack_raw=function(n){if(this.length<this.index+n)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+n+" "+this.length);var e=this.dataBuffer.slice(this.index,this.index+n);return this.index+=n,e},re.prototype.unpack_string=function(n){for(var e=this.read(n),t=0,i="",s,o;t<n;)s=e[t],s<128?(i+=String.fromCharCode(s),t++):(s^192)<32?(o=(s^192)<<6|e[t+1]&63,i+=String.fromCharCode(o),t+=2):(o=(s&15)<<12|(e[t+1]&63)<<6|e[t+2]&63,i+=String.fromCharCode(o),t+=3);return this.index+=n,i},re.prototype.unpack_array=function(n){for(var e=new Array(n),t=0;t<n;t++)e[t]=this.unpack();return e},re.prototype.unpack_map=function(n){for(var e={},t=0;t<n;t++){var i=this.unpack(),s=this.unpack();e[i]=s}return e},re.prototype.unpack_float=function(){var n=this.unpack_uint32(),e=n>>31,t=(n>>23&255)-127,i=n&8388607|8388608;return(e===0?1:-1)*i*Math.pow(2,t-23)},re.prototype.unpack_double=function(){var n=this.unpack_uint32(),e=this.unpack_uint32(),t=n>>31,i=(n>>20&2047)-1023,s=n&1048575|1048576,o=s*Math.pow(2,i-20)+e*Math.pow(2,i-52);return(t===0?1:-1)*o},re.prototype.read=function(n){var e=this.index;if(e+n<=this.length)return this.dataView.subarray(e,e+n);throw new Error("BinaryPackFailure: read index out of range")};function le(){this.bufferBuilder=new Fl}le.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},le.prototype.pack=function(n){var e=typeof n;if(e==="string")this.pack_string(n);else if(e==="number")Math.floor(n)===n?this.pack_integer(n):this.pack_double(n);else if(e==="boolean")n===!0?this.bufferBuilder.append(195):n===!1&&this.bufferBuilder.append(194);else if(e==="undefined")this.bufferBuilder.append(192);else if(e==="object")if(n===null)this.bufferBuilder.append(192);else{var t=n.constructor;if(t==Array)this.pack_array(n);else if(t==Blob||t==File||n instanceof Blob||n instanceof File)this.pack_bin(n);else if(t==ArrayBuffer)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n)):this.pack_bin(n);else if("BYTES_PER_ELEMENT"in n)ea.useArrayBufferView?this.pack_bin(new Uint8Array(n.buffer)):this.pack_bin(n.buffer);else if(t==Object||t.toString().startsWith("class"))this.pack_object(n);else if(t==Date)this.pack_string(n.toString());else if(typeof n.toBinaryPack=="function")this.bufferBuilder.append(n.toBinaryPack());else throw new Error('Type "'+t.toString()+'" not yet supported')}else throw new Error('Type "'+e+'" not yet supported');this.bufferBuilder.flush()},le.prototype.pack_bin=function(n){var e=n.length||n.byteLength||n.size;if(e<=15)this.pack_uint8(160+e);else if(e<=65535)this.bufferBuilder.append(218),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_string=function(n){var e=jl(n);if(e<=15)this.pack_uint8(176+e);else if(e<=65535)this.bufferBuilder.append(216),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(e);else throw new Error("Invalid length");this.bufferBuilder.append(n)},le.prototype.pack_array=function(n){var e=n.length;if(e<=15)this.pack_uint8(144+e);else if(e<=65535)this.bufferBuilder.append(220),this.pack_uint16(e);else if(e<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(e);else throw new Error("Invalid length");for(var t=0;t<e;t++)this.pack(n[t])},le.prototype.pack_integer=function(n){if(n>=-32&&n<=127)this.bufferBuilder.append(n&255);else if(n>=0&&n<=255)this.bufferBuilder.append(204),this.pack_uint8(n);else if(n>=-128&&n<=127)this.bufferBuilder.append(208),this.pack_int8(n);else if(n>=0&&n<=65535)this.bufferBuilder.append(205),this.pack_uint16(n);else if(n>=-32768&&n<=32767)this.bufferBuilder.append(209),this.pack_int16(n);else if(n>=0&&n<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(n);else if(n>=-2147483648&&n<=2147483647)this.bufferBuilder.append(210),this.pack_int32(n);else if(n>=-9223372036854776e3&&n<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(n);else if(n>=0&&n<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(n);else throw new Error("Invalid integer")},le.prototype.pack_double=function(n){var e=0;n<0&&(e=1,n=-n);var t=Math.floor(Math.log(n)/Math.LN2),i=n/Math.pow(2,t)-1,s=Math.floor(i*Math.pow(2,52)),o=Math.pow(2,32),a=e<<31|t+1023<<20|s/o&1048575,c=s%o;this.bufferBuilder.append(203),this.pack_int32(a),this.pack_int32(c)},le.prototype.pack_object=function(n){var e=Object.keys(n),t=e.length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else if(t<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(t);else throw new Error("Invalid length");for(var i in n)n.hasOwnProperty(i)&&(this.pack(i),this.pack(n[i]))},le.prototype.pack_uint8=function(n){this.bufferBuilder.append(n)},le.prototype.pack_uint16=function(n){this.bufferBuilder.append(n>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_uint32=function(n){var e=n&4294967295;this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255)},le.prototype.pack_uint64=function(n){var e=n/Math.pow(2,32),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)},le.prototype.pack_int8=function(n){this.bufferBuilder.append(n&255)},le.prototype.pack_int16=function(n){this.bufferBuilder.append((n&65280)>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int32=function(n){this.bufferBuilder.append(n>>>24&255),this.bufferBuilder.append((n&16711680)>>>16),this.bufferBuilder.append((n&65280)>>>8),this.bufferBuilder.append(n&255)},le.prototype.pack_int64=function(n){var e=Math.floor(n/Math.pow(2,32)),t=n%Math.pow(2,32);this.bufferBuilder.append((e&4278190080)>>>24),this.bufferBuilder.append((e&16711680)>>>16),this.bufferBuilder.append((e&65280)>>>8),this.bufferBuilder.append(e&255),this.bufferBuilder.append((t&4278190080)>>>24),this.bufferBuilder.append((t&16711680)>>>16),this.bufferBuilder.append((t&65280)>>>8),this.bufferBuilder.append(t&255)};function El(n){var e=n.charCodeAt(0);return e<=2047?"00":e<=65535?"000":e<=2097151?"0000":e<=67108863?"00000":"000000"}function jl(n){return n.length>600?new Blob([n]).size:n.replace(/[^\u0000-\u007F]/g,El).length}const ta=Cn(Bl);let ia=!0,na=!0;function Zi(n,e,t){const i=n.match(e);return i&&i.length>=t&&parseInt(i[t],10)}function _t(n,e,t){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,s=i.addEventListener;i.addEventListener=function(a,c){if(a!==e)return s.apply(this,arguments);const r=l=>{const d=t(l);d&&(c.handleEvent?c.handleEvent(d):c(d))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,r),s.apply(this,[a,r])};const o=i.removeEventListener;i.removeEventListener=function(a,c){if(a!==e||!this._eventMap||!this._eventMap[e])return o.apply(this,arguments);if(!this._eventMap[e].has(c))return o.apply(this,arguments);const r=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,o.apply(this,[a,r])},Object.defineProperty(i,"on"+e,{get(){return this["_on"+e]},set(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}function Ol(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(ia=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function Dl(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(na=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Ms(){if(typeof window=="object"){if(ia)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function zn(n,e){na&&console.warn(n+" is deprecated, please use "+e+" instead.")}function _l(n){const e={browser:null,version:null};if(typeof n>"u"||!n.navigator)return e.browser="Not a browser.",e;const{navigator:t}=n;if(t.mozGetUserMedia)e.browser="firefox",e.version=Zi(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)e.browser="chrome",e.version=Zi(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))e.browser="edge",e.version=Zi(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=Zi(t.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function sa(n){return Object.prototype.toString.call(n)==="[object Object]"}function oa(n){return sa(n)?Object.keys(n).reduce(function(e,t){const i=sa(n[t]),s=i?oa(n[t]):n[t],o=i&&!Object.keys(s).length;return s===void 0||o?e:Object.assign(e,{[t]:s})},{}):n}function Ts(n,e,t){!e||t.has(e.id)||(t.set(e.id,e),Object.keys(e).forEach(i=>{i.endsWith("Id")?Ts(n,n.get(e[i]),t):i.endsWith("Ids")&&e[i].forEach(s=>{Ts(n,n.get(s),t)})}))}function aa(n,e,t){const i=t?"outbound-rtp":"inbound-rtp",s=new Map;if(e===null)return s;const o=[];return n.forEach(a=>{a.type==="track"&&a.trackIdentifier===e.id&&o.push(a)}),o.forEach(a=>{n.forEach(c=>{c.type===i&&c.trackId===a.id&&Ts(n,c,s)})}),s}const ra=Ms;function la(n,e){const t=n&&n.navigator;if(!t.mediaDevices)return;const i=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const r={};return Object.keys(c).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const d=typeof c[l]=="object"?c[l]:{ideal:c[l]};d.exact!==void 0&&typeof d.exact=="number"&&(d.min=d.max=d.exact);const h=function(u,p){return u?u+p.charAt(0).toUpperCase()+p.slice(1):p==="deviceId"?"sourceId":p};if(d.ideal!==void 0){r.optional=r.optional||[];let u={};typeof d.ideal=="number"?(u[h("min",l)]=d.ideal,r.optional.push(u),u={},u[h("max",l)]=d.ideal,r.optional.push(u)):(u[h("",l)]=d.ideal,r.optional.push(u))}d.exact!==void 0&&typeof d.exact!="number"?(r.mandatory=r.mandatory||{},r.mandatory[h("",l)]=d.exact):["min","max"].forEach(u=>{d[u]!==void 0&&(r.mandatory=r.mandatory||{},r.mandatory[h(u,l)]=d[u])})}),c.advanced&&(r.optional=(r.optional||[]).concat(c.advanced)),r},s=function(c,r){if(e.version>=61)return r(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const l=function(d,h,u){h in d&&!(u in d)&&(d[u]=d[h],delete d[h])};c=JSON.parse(JSON.stringify(c)),l(c.audio,"autoGainControl","googAutoGainControl"),l(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=i(c.audio)}if(c&&typeof c.video=="object"){let l=c.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const d=e.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(t.mediaDevices.getSupportedConstraints&&t.mediaDevices.getSupportedConstraints().facingMode&&!d)){delete c.video.facingMode;let h;if(l.exact==="environment"||l.ideal==="environment"?h=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(h=["front"]),h)return t.mediaDevices.enumerateDevices().then(u=>{u=u.filter(m=>m.kind==="videoinput");let p=u.find(m=>h.some(b=>m.label.toLowerCase().includes(b)));return!p&&u.length&&h.includes("back")&&(p=u[u.length-1]),p&&(c.video.deviceId=l.exact?{exact:p.deviceId}:{ideal:p.deviceId}),c.video=i(c.video),ra("chrome: "+JSON.stringify(c)),r(c)})}c.video=i(c.video)}return ra("chrome: "+JSON.stringify(c)),r(c)},o=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(c,r,l){s(c,d=>{t.webkitGetUserMedia(d,r,h=>{l&&l(o(h))})})};if(t.getUserMedia=a.bind(t),t.mediaDevices.getUserMedia){const c=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(r){return s(r,l=>c(l).then(d=>{if(l.audio&&!d.getAudioTracks().length||l.video&&!d.getVideoTracks().length)throw d.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return d},d=>Promise.reject(o(d))))}}}function Al(n,e){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof e!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(t){return e(t).then(i=>{const s=t.video&&t.video.width,o=t.video&&t.video.height,a=t.video&&t.video.frameRate;return t.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:a||3}},s&&(t.video.mandatory.maxWidth=s),o&&(t.video.mandatory.maxHeight=o),n.navigator.mediaDevices.getUserMedia(t)})}}}function ca(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function da(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const e=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):s={track:i.track};const o=new Event("track");o.track=i.track,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)}),t.stream.getTracks().forEach(i=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(a=>a.track&&a.track.id===i.id):s={track:i};const o=new Event("track");o.track=i,o.receiver=s,o.transceiver={receiver:s},o.streams=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else _t(n,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ha(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const e=function(s,o){return{track:o,get dtmf(){return this._dtmf===void 0&&(o.kind==="audio"?this._dtmf=s.createDTMFSender(o):this._dtmf=null),this._dtmf},_pc:s}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const s=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(a,c){let r=s.apply(this,arguments);return r||(r=e(this,a),this._senders.push(r)),r};const o=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(a){o.apply(this,arguments);const c=this._senders.indexOf(a);c!==-1&&this._senders.splice(c,1)}}const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],t.apply(this,[s]),s.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(o=>{const a=this._senders.find(c=>c.track===o);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof n=="object"&&n.RTCPeerConnection&&"getSenders"in n.RTCPeerConnection.prototype&&"createDTMFSender"in n.RTCPeerConnection.prototype&&n.RTCRtpSender&&!("dtmf"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const t=e.apply(this,[]);return t.forEach(i=>i._pc=this),t},Object.defineProperty(n.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function ua(n){if(!n.RTCPeerConnection)return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[t,i,s]=arguments;if(arguments.length>0&&typeof t=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof t!="function"))return e.apply(this,[]);const o=function(c){const r={};return c.result().forEach(l=>{const d={id:l.id,timestamp:l.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[l.type]||l.type};l.names().forEach(h=>{d[h]=l.stat(h)}),r[d.id]=d}),r},a=function(c){return new Map(Object.keys(c).map(r=>[r,c[r]]))};if(arguments.length>=2){const c=function(r){i(a(o(r)))};return e.apply(this,[c,t])}return new Promise((c,r)=>{e.apply(this,[function(l){c(a(o(l)))},r])}).then(i,s)}}function pa(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const t=n.RTCPeerConnection.prototype.getSenders;t&&(n.RTCPeerConnection.prototype.getSenders=function(){const s=t.apply(this,[]);return s.forEach(o=>o._pc=this),s});const i=n.RTCPeerConnection.prototype.addTrack;i&&(n.RTCPeerConnection.prototype.addTrack=function(){const s=i.apply(this,arguments);return s._pc=this,s}),n.RTCRtpSender.prototype.getStats=function(){const s=this;return this._pc.getStats().then(o=>aa(o,s.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const t=n.RTCPeerConnection.prototype.getReceivers;t&&(n.RTCPeerConnection.prototype.getReceivers=function(){const i=t.apply(this,[]);return i.forEach(s=>s._pc=this),i}),_t(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(s=>aa(s,i.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const e=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const t=arguments[0];let i,s,o;return this.getSenders().forEach(a=>{a.track===t&&(i?o=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===t&&(s?o=!0:s=a),a.track===t)),o||i&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function ma(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(c)===-1&&this._shimmedLocalStreams[a.id].push(c):this._shimmedLocalStreams[a.id]=[a,c],c};const t=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(r=>{if(this.getSenders().find(l=>l.track===r))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();t.apply(this,arguments);const c=this.getSenders().filter(r=>a.indexOf(r)===-1);this._shimmedLocalStreams[o.id]=[o].concat(c)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],i.apply(this,arguments)};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const c=this._shimmedLocalStreams[a].indexOf(o);c!==-1&&this._shimmedLocalStreams[a].splice(c,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),s.apply(this,arguments)}}function ba(n,e){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&e.version>=65)return ma(n);const t=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const l=t.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(d=>this._reverseStreams[d.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(d=>{if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const d=new n.MediaStream(l.getTracks());this._streams[l.id]=d,this._reverseStreams[d.id]=l,l=d}i.apply(this,[l])};const s=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},n.RTCPeerConnection.prototype.addTrack=function(l,d){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const h=[].slice.call(arguments,1);if(h.length!==1||!h[0].getTracks().find(p=>p===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const u=this._streams[d.id];if(u)u.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const p=new n.MediaStream([l]);this._streams[d.id]=p,this._reverseStreams[p.id]=d,this.addStream(p)}return this.getSenders().find(p=>p.track===l)};function o(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(m.id,"g"),p.id)}),new RTCSessionDescription({type:d.type,sdp:h})}function a(l,d){let h=d.sdp;return Object.keys(l._reverseStreams||[]).forEach(u=>{const p=l._reverseStreams[u],m=l._streams[p.id];h=h.replace(new RegExp(p.id,"g"),m.id)}),new RTCSessionDescription({type:d.type,sdp:h})}["createOffer","createAnswer"].forEach(function(l){const d=n.RTCPeerConnection.prototype[l],h={[l](){const u=arguments;return arguments.length&&typeof arguments[0]=="function"?d.apply(this,[p=>{const m=o(this,p);u[0].apply(null,[m])},p=>{u[1]&&u[1].apply(null,p)},arguments[2]]):d.apply(this,arguments).then(p=>o(this,p))}};n.RTCPeerConnection.prototype[l]=h[l]});const c=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=a(this,arguments[0]),c.apply(this,arguments))};const r=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=r.get.apply(this);return l.type===""?l:o(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(l._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(u=>l.track===u)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function Ys(n,e){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const i=n.RTCPeerConnection.prototype[t],s={[t](){return arguments[0]=new(t==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[t]=s[t]})}function ya(n,e){_t(n,"negotiationneeded",t=>{const i=t.target;if(!((e.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return t})}const Ga=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:ya,shimAddTrackRemoveTrack:ba,shimAddTrackRemoveTrackWithNative:ma,shimGetDisplayMedia:Al,shimGetSendersWithDtmf:ha,shimGetStats:ua,shimGetUserMedia:la,shimMediaStream:ca,shimOnTrack:da,shimPeerConnection:Ys,shimSenderReceiverGetStats:pa},Symbol.toStringTag,{value:"Module"}));function ql(n,e){let t=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let s=i.urls||i.url;i.url&&!i.urls&&zn("RTCIceServer.url","RTCIceServer.urls");const o=typeof s=="string";return o&&(s=[s]),s=s.filter(a=>{if(a.indexOf("stun:")===0)return!1;const c=a.startsWith("turn")&&!a.startsWith("turn:[")&&a.includes("transport=udp");return c&&!t?(t=!0,!0):c&&!t}),delete i.url,i.urls=o?s[0]:s,!!s.length}})}var Za={exports:{}};(function(n){var e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(t){return t.trim().split(`
2
2
  `).map(function(i){return i.trim()})},e.splitSections=function(t){var i=t.split(`
3
3
  m=`);return i.map(function(s,o){return(o>0?"m="+s:s).trim()+`\r
4
4
  `})},e.getDescription=function(t){var i=e.splitSections(t);return i&&i[0]},e.getMediaSections=function(t){var i=e.splitSections(t);return i.shift(),i},e.matchPrefix=function(t,i){return e.splitLines(t).filter(function(s){return s.indexOf(i)===0})},e.parseCandidate=function(t){var i;t.indexOf("a=candidate:")===0?i=t.substring(12).split(" "):i=t.substring(10).split(" ");for(var s={foundation:i[0],component:parseInt(i[1],10),protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]},o=8;o<i.length;o+=2)switch(i[o]){case"raddr":s.relatedAddress=i[o+1];break;case"rport":s.relatedPort=parseInt(i[o+1],10);break;case"tcptype":s.tcpType=i[o+1];break;case"ufrag":s.ufrag=i[o+1],s.usernameFragment=i[o+1];break;default:s[i[o]]=i[o+1];break}return s},e.writeCandidate=function(t){var i=[];i.push(t.foundation),i.push(t.component),i.push(t.protocol.toUpperCase()),i.push(t.priority),i.push(t.address||t.ip),i.push(t.port);var s=t.type;return i.push("typ"),i.push(s),s!=="host"&&t.relatedAddress&&t.relatedPort&&(i.push("raddr"),i.push(t.relatedAddress),i.push("rport"),i.push(t.relatedPort)),t.tcpType&&t.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(i.push("ufrag"),i.push(t.usernameFragment||t.ufrag)),"candidate:"+i.join(" ")},e.parseIceOptions=function(t){return t.substr(14).split(" ")},e.parseRtpMap=function(t){var i=t.substr(9).split(" "),s={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),s.name=i[0],s.clockRate=parseInt(i[1],10),s.channels=i.length===3?parseInt(i[2],10):1,s.numChannels=s.channels,s},e.writeRtpMap=function(t){var i=t.payloadType;t.preferredPayloadType!==void 0&&(i=t.preferredPayloadType);var s=t.channels||t.numChannels||1;return"a=rtpmap:"+i+" "+t.name+"/"+t.clockRate+(s!==1?"/"+s:"")+`\r
@@ -2,18 +2,6 @@ import { Object3D, Quaternion, Vector3 } from "three";
2
2
  import { type AssetReference } from "./engine_addressables.js";
3
3
  import { Context } from "./engine_setup.js";
4
4
  import { type Constructor, type IComponent as Component, type IComponent, type IGameObject as GameObject, type UIDProvider } from "./engine_types.js";
5
- /** @internal */
6
- export declare enum HideFlags {
7
- None = 0,
8
- HideInHierarchy = 1,
9
- HideInInspector = 2,
10
- DontSaveInEditor = 4,
11
- NotEditable = 8,
12
- DontSaveInBuild = 16,
13
- DontUnloadUnusedAsset = 32,
14
- DontSave = 52,
15
- HideAndDontSave = 61
16
- }
17
5
  export type IInstantiateOptions = {
18
6
  idProvider?: UIDProvider;
19
7
  parent?: string | Object3D;
@@ -12,19 +12,6 @@ import { getParam, tryFindObject } from "./engine_utils.js";
12
12
  import { apply } from "./js-extensions/index.js";
13
13
  const debug = getParam("debuggetcomponent");
14
14
  const debugInstantiate = getParam("debuginstantiate");
15
- /** @internal */
16
- export var HideFlags;
17
- (function (HideFlags) {
18
- HideFlags[HideFlags["None"] = 0] = "None";
19
- HideFlags[HideFlags["HideInHierarchy"] = 1] = "HideInHierarchy";
20
- HideFlags[HideFlags["HideInInspector"] = 2] = "HideInInspector";
21
- HideFlags[HideFlags["DontSaveInEditor"] = 4] = "DontSaveInEditor";
22
- HideFlags[HideFlags["NotEditable"] = 8] = "NotEditable";
23
- HideFlags[HideFlags["DontSaveInBuild"] = 16] = "DontSaveInBuild";
24
- HideFlags[HideFlags["DontUnloadUnusedAsset"] = 32] = "DontUnloadUnusedAsset";
25
- HideFlags[HideFlags["DontSave"] = 52] = "DontSave";
26
- HideFlags[HideFlags["HideAndDontSave"] = 61] = "HideAndDontSave";
27
- })(HideFlags || (HideFlags = {}));
28
15
  /**
29
16
  * Instantiation options for {@link syncInstantiate}
30
17
  */