@needle-tools/engine 4.5.8 → 4.6.0-next.3088402

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 (58) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{gltf-progressive-Bx_ZJgfQ.min.js → gltf-progressive-Bm9eEfgu.min.js} +1 -1
  3. package/dist/{gltf-progressive-Ccf3INjK.umd.cjs → gltf-progressive-Dn6o99rH.umd.cjs} +1 -1
  4. package/dist/{gltf-progressive-D8GP6sjZ.js → gltf-progressive-GjIqwSG3.js} +2 -2
  5. package/dist/{needle-engine.bundle-A-KGqR38.js → needle-engine.bundle-B1JFnMRs.js} +4046 -4029
  6. package/dist/{needle-engine.bundle-DsPSVnUc.min.js → needle-engine.bundle-CLbeONlI.min.js} +123 -123
  7. package/dist/{needle-engine.bundle-2--i65ba.umd.cjs → needle-engine.bundle-CpQAQ_2N.umd.cjs} +126 -126
  8. package/dist/needle-engine.js +4 -4
  9. package/dist/needle-engine.min.js +1 -1
  10. package/dist/needle-engine.umd.cjs +1 -1
  11. package/dist/{postprocessing-CLwnKusi.umd.cjs → postprocessing-CRQa6Qxn.umd.cjs} +177 -97
  12. package/dist/{postprocessing-DS5I4Iim.js → postprocessing-D6W1EyZ-.js} +1095 -1001
  13. package/dist/{postprocessing-CdIScgB8.min.js → postprocessing-DF8AlRgW.min.js} +178 -98
  14. package/dist/{three-CFtLGNtV.min.js → three-Boa-jOq-.min.js} +18 -18
  15. package/dist/{three-1JG7vpNC.js → three-Bz6X1mrw.js} +0 -1
  16. package/dist/{three-f-JuZtOs.umd.cjs → three-DMrv-4ar.umd.cjs} +20 -20
  17. package/dist/{three-examples-BeoqFh8m.umd.cjs → three-examples-C7ryg8vN.umd.cjs} +1 -1
  18. package/dist/{three-examples-CPlN41GO.min.js → three-examples-DuVhxqft.min.js} +1 -1
  19. package/dist/{three-examples-CyWe9wwo.js → three-examples-GggCDHv0.js} +1 -1
  20. package/dist/{three-mesh-ui-B18kdQmk.js → three-mesh-ui-CLNOfsWn.js} +1 -1
  21. package/dist/{three-mesh-ui-BMeLuYD5.min.js → three-mesh-ui-CY6Izc7C.min.js} +1 -1
  22. package/dist/{three-mesh-ui-DMdtSVhY.umd.cjs → three-mesh-ui-CwlN0FUC.umd.cjs} +1 -1
  23. package/dist/{vendor-BbM-oI6p.js → vendor-BSD1RQIh.js} +1 -1
  24. package/dist/{vendor-CJFfVMoq.umd.cjs → vendor-DHr4aqIZ.umd.cjs} +1 -1
  25. package/dist/{vendor-CTtGKiDe.min.js → vendor-zxXa3Dmr.min.js} +1 -1
  26. package/lib/engine/engine_assetdatabase.js +3 -1
  27. package/lib/engine/engine_assetdatabase.js.map +1 -1
  28. package/lib/engine/engine_context.d.ts +2 -2
  29. package/lib/engine/engine_context.js +11 -10
  30. package/lib/engine/engine_context.js.map +1 -1
  31. package/lib/engine/engine_utils.js +1 -1
  32. package/lib/engine/engine_utils.js.map +1 -1
  33. package/lib/engine-components/AudioSource.d.ts +1 -1
  34. package/lib/engine-components/AudioSource.js +5 -4
  35. package/lib/engine-components/AudioSource.js.map +1 -1
  36. package/lib/engine-components/ReflectionProbe.d.ts +2 -1
  37. package/lib/engine-components/ReflectionProbe.js +4 -1
  38. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  39. package/lib/engine-components/Renderer.js +9 -5
  40. package/lib/engine-components/Renderer.js.map +1 -1
  41. package/lib/engine-components/Skybox.d.ts +7 -1
  42. package/lib/engine-components/Skybox.js +30 -9
  43. package/lib/engine-components/Skybox.js.map +1 -1
  44. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +10 -6
  45. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  46. package/package.json +2 -2
  47. package/plugins/types/userconfig.d.ts +1 -1
  48. package/plugins/vite/asap.js +26 -20
  49. package/plugins/vite/dependency-watcher.js +8 -2
  50. package/plugins/vite/local-files.js +268 -59
  51. package/src/engine/engine_assetdatabase.ts +3 -1
  52. package/src/engine/engine_context.ts +14 -11
  53. package/src/engine/engine_utils.ts +1 -1
  54. package/src/engine-components/AudioSource.ts +5 -5
  55. package/src/engine-components/ReflectionProbe.ts +5 -1
  56. package/src/engine-components/Renderer.ts +10 -7
  57. package/src/engine-components/Skybox.ts +30 -10
  58. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +9 -7
@@ -1,4 +1,4 @@
1
- "use strict";const a=require("./three-f-JuZtOs.umd.cjs");class Qo extends a.Mesh{constructor(e,t,s,n=128){if(t<=0||s<=0||n<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const i=new a.SphereGeometry(s,2*n,n);i.scale(1,1,-1);const o=i.getAttribute("position"),r=new a.Vector3;for(let A=0;A<o.count;++A)if(r.fromBufferAttribute(o,A),r.y<0){const l=-t*3/2,h=r.y<l?-t/r.y:1-r.y*r.y/(3*l*l);r.multiplyScalar(h),r.toArray(o.array,3*A)}o.needsUpdate=!0,super(i,new a.MeshBasicMaterial({map:e,depthWrite:!1}))}}class Ie extends a.Node{constructor(e){super(e.nodeType),this.node=null,this.source=null,this.target=null,this.inclusionType="replace",Object.assign(this,e)}generate(e){return this.node.build(e,this.getNodeType(e))}}const Ue=new a.NodeFrame;Ue.camera=new a.PerspectiveCamera;const ds={LineBasicNodeMaterial:a.ShaderLib.basic,MeshBasicNodeMaterial:a.ShaderLib.basic,PointsNodeMaterial:a.ShaderLib.points,MeshStandardNodeMaterial:a.ShaderLib.standard,MeshPhysicalNodeMaterial:a.ShaderLib.physical,MeshPhongNodeMaterial:a.ShaderLib.phong},xo={atan2:"atan"},So={low:"lowp",medium:"mediump",high:"highp"};function dt(c){return`#include <${c}>`}function Lt(c){return`${c}Shader`}class To extends a.NodeBuilder{constructor(e,t,s,n=null){super(e,t,new a.GLSLNodeParser,null,n),this.shader=s,this.slots={vertex:[],fragment:[]},this._parseShaderLib(),this._parseInclude("fragment","lights_physical_fragment","clearcoat_normal_fragment_begin","transmission_fragment"),this._parseObject(),this._sortSlotsToFlow(),this.useComparisonMethod=!0}getMethod(e){return xo[e]||e}addSlot(e,t){this.slots[e].push(t)}_parseShaderLib(){const e=this.material;let t=e.type;if(e.isMeshPhysicalNodeMaterial?t="MeshPhysicalNodeMaterial":e.isMeshStandardNodeMaterial?t="MeshStandardNodeMaterial":e.isMeshPhongNodeMaterial?t="MeshPhongNodeMaterial":e.isMeshBasicNodeMaterial?t="MeshBasicNodeMaterial":e.isPointsNodeMaterial?t="PointsNodeMaterial":e.isLineBasicNodeMaterial&&(t="LineBasicNodeMaterial"),ds[t]!==void 0){const s=ds[t],n=this.shader;n.vertexShader=s.vertexShader,n.fragmentShader=s.fragmentShader,n.uniforms=a.UniformsUtils.merge([s.uniforms,a.UniformsLib.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new Ie({node:a.normalView,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new Ie({node:e.colorNode,nodeType:"vec4",source:dt("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new Ie({node:e.colorNode,nodeType:"vec4",source:"vec4 diffuseColor = vec4( diffuse, opacity );",target:"vec4 diffuseColor = %RESULT%; diffuseColor.a *= opacity;"})),e.opacityNode&&e.opacityNode.isNode&&this.addSlot("fragment",new Ie({node:e.opacityNode,nodeType:"float",source:dt("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new Ie({node:e.normalNode,nodeType:"vec3",source:dt("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new Ie({node:e.emissiveNode,nodeType:"vec3",source:dt("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.metalnessNode,nodeType:"float",source:dt("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.roughnessNode,nodeType:"float",source:dt("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new Ie({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new Ie({node:e.clearcoatNormalNode,nodeType:"vec3",source:"vec3 clearcoatNormal = nonPerturbedNormal;",target:"vec3 clearcoatNormal = %RESULT%;"})),e.defines.USE_CLEARCOAT=""):delete e.defines.USE_CLEARCOAT,e.sheenNode&&e.sheenNode.isNode?(this.addSlot("fragment",new Ie({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.sheenRoughnessNode,nodeType:"float",source:"material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );",target:"material.sheenRoughness = clamp( %RESULT%, 0.07, 1.0 );"})),e.defines.USE_SHEEN=""):delete e.defines.USE_SHEEN,e.iridescenceNode&&e.iridescenceNode.isNode?(this.addSlot("fragment",new Ie({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new Ie({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new Ie({node:e.iridescenceThicknessNode,nodeType:"float",source:"material.iridescenceThickness = iridescenceThicknessMaximum;",target:"material.iridescenceThickness = %RESULT%;"})),e.defines.USE_IRIDESCENCE=""):delete e.defines.USE_IRIDESCENCE,e.iorNode&&e.iorNode.isNode&&this.addSlot("fragment",new Ie({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new Ie({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new Ie({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new Ie({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new Ie({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new Ie({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new Ie({node:e.attenuationColorNode,nodeType:"vec3",source:"material.attenuationColor = attenuationColor;",target:"material.attenuationColor = %RESULT%;"})),e.transmission=1,e.defines.USE_TRANSMISSION=""):(e.transmission=0,delete e.defines.USE_TRANSMISSION))),e.positionNode&&e.positionNode.isNode&&this.addSlot("vertex",new Ie({node:e.positionNode,nodeType:"vec3",source:dt("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new Ie({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,s){return e.isTextureCube?`textureCube( ${t}, ${s} )`:`texture2D( ${t}, ${s} )`}generateTextureLevel(e,t,s,n){return`textureLod( ${t}, ${s}, ${n} )`}buildFunctionCode(e){const t=e.layout,s=this.flowShaderNode(e),n=[];for(const o of t.inputs)n.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${n.join(", ")} ) {
1
+ "use strict";const a=require("./three-DMrv-4ar.umd.cjs");class Qo extends a.Mesh{constructor(e,t,s,n=128){if(t<=0||s<=0||n<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const i=new a.SphereGeometry(s,2*n,n);i.scale(1,1,-1);const o=i.getAttribute("position"),r=new a.Vector3;for(let A=0;A<o.count;++A)if(r.fromBufferAttribute(o,A),r.y<0){const l=-t*3/2,h=r.y<l?-t/r.y:1-r.y*r.y/(3*l*l);r.multiplyScalar(h),r.toArray(o.array,3*A)}o.needsUpdate=!0,super(i,new a.MeshBasicMaterial({map:e,depthWrite:!1}))}}class Ie extends a.Node{constructor(e){super(e.nodeType),this.node=null,this.source=null,this.target=null,this.inclusionType="replace",Object.assign(this,e)}generate(e){return this.node.build(e,this.getNodeType(e))}}const Ue=new a.NodeFrame;Ue.camera=new a.PerspectiveCamera;const ds={LineBasicNodeMaterial:a.ShaderLib.basic,MeshBasicNodeMaterial:a.ShaderLib.basic,PointsNodeMaterial:a.ShaderLib.points,MeshStandardNodeMaterial:a.ShaderLib.standard,MeshPhysicalNodeMaterial:a.ShaderLib.physical,MeshPhongNodeMaterial:a.ShaderLib.phong},xo={atan2:"atan"},So={low:"lowp",medium:"mediump",high:"highp"};function dt(c){return`#include <${c}>`}function Lt(c){return`${c}Shader`}class To extends a.NodeBuilder{constructor(e,t,s,n=null){super(e,t,new a.GLSLNodeParser,null,n),this.shader=s,this.slots={vertex:[],fragment:[]},this._parseShaderLib(),this._parseInclude("fragment","lights_physical_fragment","clearcoat_normal_fragment_begin","transmission_fragment"),this._parseObject(),this._sortSlotsToFlow(),this.useComparisonMethod=!0}getMethod(e){return xo[e]||e}addSlot(e,t){this.slots[e].push(t)}_parseShaderLib(){const e=this.material;let t=e.type;if(e.isMeshPhysicalNodeMaterial?t="MeshPhysicalNodeMaterial":e.isMeshStandardNodeMaterial?t="MeshStandardNodeMaterial":e.isMeshPhongNodeMaterial?t="MeshPhongNodeMaterial":e.isMeshBasicNodeMaterial?t="MeshBasicNodeMaterial":e.isPointsNodeMaterial?t="PointsNodeMaterial":e.isLineBasicNodeMaterial&&(t="LineBasicNodeMaterial"),ds[t]!==void 0){const s=ds[t],n=this.shader;n.vertexShader=s.vertexShader,n.fragmentShader=s.fragmentShader,n.uniforms=a.UniformsUtils.merge([s.uniforms,a.UniformsLib.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new Ie({node:a.normalView,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new Ie({node:e.colorNode,nodeType:"vec4",source:dt("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new Ie({node:e.colorNode,nodeType:"vec4",source:"vec4 diffuseColor = vec4( diffuse, opacity );",target:"vec4 diffuseColor = %RESULT%; diffuseColor.a *= opacity;"})),e.opacityNode&&e.opacityNode.isNode&&this.addSlot("fragment",new Ie({node:e.opacityNode,nodeType:"float",source:dt("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new Ie({node:e.normalNode,nodeType:"vec3",source:dt("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new Ie({node:e.emissiveNode,nodeType:"vec3",source:dt("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.metalnessNode,nodeType:"float",source:dt("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.roughnessNode,nodeType:"float",source:dt("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new Ie({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new Ie({node:e.clearcoatNormalNode,nodeType:"vec3",source:"vec3 clearcoatNormal = nonPerturbedNormal;",target:"vec3 clearcoatNormal = %RESULT%;"})),e.defines.USE_CLEARCOAT=""):delete e.defines.USE_CLEARCOAT,e.sheenNode&&e.sheenNode.isNode?(this.addSlot("fragment",new Ie({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.sheenRoughnessNode,nodeType:"float",source:"material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );",target:"material.sheenRoughness = clamp( %RESULT%, 0.07, 1.0 );"})),e.defines.USE_SHEEN=""):delete e.defines.USE_SHEEN,e.iridescenceNode&&e.iridescenceNode.isNode?(this.addSlot("fragment",new Ie({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new Ie({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new Ie({node:e.iridescenceThicknessNode,nodeType:"float",source:"material.iridescenceThickness = iridescenceThicknessMaximum;",target:"material.iridescenceThickness = %RESULT%;"})),e.defines.USE_IRIDESCENCE=""):delete e.defines.USE_IRIDESCENCE,e.iorNode&&e.iorNode.isNode&&this.addSlot("fragment",new Ie({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new Ie({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new Ie({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new Ie({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new Ie({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new Ie({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new Ie({node:e.attenuationColorNode,nodeType:"vec3",source:"material.attenuationColor = attenuationColor;",target:"material.attenuationColor = %RESULT%;"})),e.transmission=1,e.defines.USE_TRANSMISSION=""):(e.transmission=0,delete e.defines.USE_TRANSMISSION))),e.positionNode&&e.positionNode.isNode&&this.addSlot("vertex",new Ie({node:e.positionNode,nodeType:"vec3",source:dt("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new Ie({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,s){return e.isTextureCube?`textureCube( ${t}, ${s} )`:`texture2D( ${t}, ${s} )`}generateTextureLevel(e,t,s,n){return`textureLod( ${t}, ${s}, ${n} )`}buildFunctionCode(e){const t=e.layout,s=this.flowShaderNode(e),n=[];for(const o of t.inputs)n.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${n.join(", ")} ) {
2
2
 
3
3
  ${s.vars}
4
4
 
@@ -1,4 +1,4 @@
1
- import{Mesh as H,SphereGeometry as pn,Vector3 as N,MeshBasicMaterial as It,Node as Ho,PerspectiveCamera as Os,NodeFrame as jo,NodeBuilder as qo,GLSLNodeParser as zo,ShaderLib as Et,UniformsUtils as un,UniformsLib as fs,normalView as Ko,defaultShaderStages as Hs,ShaderChunk as Yo,Material as Jt,TrianglesDrawMode as Jo,TriangleFanDrawMode as fn,TriangleStripDrawMode as yi,Matrix4 as oe,Loader as Dt,LoaderUtils as Vt,FileLoader as gt,MeshPhysicalMaterial as Ct,Vector2 as Fe,Color as Be,LinearSRGBColorSpace as We,SRGBColorSpace as re,SpotLight as Qi,PointLight as mn,DirectionalLight as vi,InstancedMesh as Vo,Quaternion as we,InstancedBufferAttribute as Wo,Object3D as Bt,TextureLoader as bn,ImageBitmapLoader as Xo,BufferAttribute as nt,InterleavedBuffer as Zo,LinearMipmapLinearFilter as js,NearestMipmapLinearFilter as xi,LinearMipmapNearestFilter as Si,NearestMipmapNearestFilter as Ti,LinearFilter as dt,NearestFilter as Ri,RepeatWrapping as Wt,MirroredRepeatWrapping as Di,ClampToEdgeWrapping as qs,PointsMaterial as ms,LineBasicMaterial as kt,MeshStandardMaterial as In,DoubleSide as En,PropertyBinding as pt,BufferGeometry as At,SkinnedMesh as Cn,LineSegments as zs,Line as ut,LineLoop as $o,Points as Ks,Group as Xt,MathUtils as Ee,OrthographicCamera as ki,Skeleton as Mi,AnimationClip as Bn,Bone as wn,InterpolateDiscrete as yn,InterpolateLinear as bs,InterleavedBufferAttribute as Zt,Texture as Qn,VectorKeyframeTrack as Ys,NumberKeyframeTrack as Js,QuaternionKeyframeTrack as Vs,ColorManagement as Xe,FrontSide as _i,Interpolant as er,Box3 as Ws,Sphere as vn,RGBA_S3TC_DXT1_Format as tr,RGB_PVRTC_4BPPV1_Format as sr,RGB_ETC2_Format as nr,RGB_ETC1_Format as ir,RGBA_S3TC_DXT5_Format as ar,RGBA_PVRTC_4BPPV1_Format as or,RGBA_ETC2_EAC_Format as rr,RGBA_BPTC_Format as Ar,RGBA_ASTC_4x4_Format as Fi,RGBAFormat as Pt,CompressedCubeTexture as cr,UnsignedByteType as ft,CompressedArrayTexture as lr,CompressedTexture as Is,DisplayP3ColorSpace as hr,LinearDisplayP3ColorSpace as gr,NoColorSpace as Xs,RGBA_ASTC_6x6_Format as Li,RedFormat as os,RGFormat as Es,HalfFloatType as it,FloatType as wt,DataTexture as dr,Data3DTexture as pr,ExtrudeGeometry as ur,ShapePath as fr,Raycaster as xn,CylinderGeometry as Ze,BoxGeometry as Ye,Float32BufferAttribute as Te,OctahedronGeometry as Zs,TorusGeometry as Cs,Euler as Ot,Controls as Ni,PlaneGeometry as Sn,DataTextureLoader as Ui,DataUtils as rs,Vector4 as Mt,Curve as mr,MeshPhongMaterial as Bs,MeshLambertMaterial as br,EquirectangularReflectionMapping as Ir,AmbientLight as Er,Uint16BufferAttribute as Cr,Matrix3 as Gi,ShapeUtils as Br,DefaultLoadingManager as wr,Ray as yr,Plane as Qr,MOUSE as As,TOUCH as cs,Spherical as Pi,ShaderMaterial as Oi,Uniform$1 as vr,Scene as Tn,WebGLRenderer as xr,CanvasTexture as Hi,REVISION as Sr,Source as Tr,InstancedBufferGeometry as Rr,InstancedInterleavedBuffer as Rn,WireframeGeometry as Dr,Line3 as kr,ColorKeyframeTrack as Mr}from"./three-CFtLGNtV.min.js";class _r extends H{constructor(e,t,n,s=128){if(t<=0||n<=0||s<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const i=new pn(n,2*s,s);i.scale(1,1,-1);const a=i.getAttribute("position"),r=new N;for(let A=0;A<a.count;++A)if(r.fromBufferAttribute(a,A),r.y<0){const c=-t*3/2,l=r.y<c?-t/r.y:1-r.y*r.y/(3*c*c);r.multiplyScalar(l),r.toArray(a.array,3*A)}a.needsUpdate=!0,super(i,new It({map:e,depthWrite:!1}))}}class fe extends Ho{constructor(e){super(e.nodeType),this.node=null,this.source=null,this.target=null,this.inclusionType="replace",Object.assign(this,e)}generate(e){return this.node.build(e,this.getNodeType(e))}}const $e=new jo;$e.camera=new Os;const ji={LineBasicNodeMaterial:Et.basic,MeshBasicNodeMaterial:Et.basic,PointsNodeMaterial:Et.points,MeshStandardNodeMaterial:Et.standard,MeshPhysicalNodeMaterial:Et.physical,MeshPhongNodeMaterial:Et.phong},Fr={atan2:"atan"},Lr={low:"lowp",medium:"mediump",high:"highp"};function Ht(o){return`#include <${o}>`}function ws(o){return`${o}Shader`}class Nr extends qo{constructor(e,t,n,s=null){super(e,t,new zo,null,s),this.shader=n,this.slots={vertex:[],fragment:[]},this._parseShaderLib(),this._parseInclude("fragment","lights_physical_fragment","clearcoat_normal_fragment_begin","transmission_fragment"),this._parseObject(),this._sortSlotsToFlow(),this.useComparisonMethod=!0}getMethod(e){return Fr[e]||e}addSlot(e,t){this.slots[e].push(t)}_parseShaderLib(){const e=this.material;let t=e.type;if(e.isMeshPhysicalNodeMaterial?t="MeshPhysicalNodeMaterial":e.isMeshStandardNodeMaterial?t="MeshStandardNodeMaterial":e.isMeshPhongNodeMaterial?t="MeshPhongNodeMaterial":e.isMeshBasicNodeMaterial?t="MeshBasicNodeMaterial":e.isPointsNodeMaterial?t="PointsNodeMaterial":e.isLineBasicNodeMaterial&&(t="LineBasicNodeMaterial"),ji[t]!==void 0){const n=ji[t],s=this.shader;s.vertexShader=n.vertexShader,s.fragmentShader=n.fragmentShader,s.uniforms=un.merge([n.uniforms,fs.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new fe({node:Ko,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new fe({node:e.colorNode,nodeType:"vec4",source:Ht("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new fe({node:e.colorNode,nodeType:"vec4",source:"vec4 diffuseColor = vec4( diffuse, opacity );",target:"vec4 diffuseColor = %RESULT%; diffuseColor.a *= opacity;"})),e.opacityNode&&e.opacityNode.isNode&&this.addSlot("fragment",new fe({node:e.opacityNode,nodeType:"float",source:Ht("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new fe({node:e.normalNode,nodeType:"vec3",source:Ht("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new fe({node:e.emissiveNode,nodeType:"vec3",source:Ht("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new fe({node:e.metalnessNode,nodeType:"float",source:Ht("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new fe({node:e.roughnessNode,nodeType:"float",source:Ht("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new fe({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new fe({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new fe({node:e.clearcoatNormalNode,nodeType:"vec3",source:"vec3 clearcoatNormal = nonPerturbedNormal;",target:"vec3 clearcoatNormal = %RESULT%;"})),e.defines.USE_CLEARCOAT=""):delete e.defines.USE_CLEARCOAT,e.sheenNode&&e.sheenNode.isNode?(this.addSlot("fragment",new fe({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new fe({node:e.sheenRoughnessNode,nodeType:"float",source:"material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );",target:"material.sheenRoughness = clamp( %RESULT%, 0.07, 1.0 );"})),e.defines.USE_SHEEN=""):delete e.defines.USE_SHEEN,e.iridescenceNode&&e.iridescenceNode.isNode?(this.addSlot("fragment",new fe({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new fe({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new fe({node:e.iridescenceThicknessNode,nodeType:"float",source:"material.iridescenceThickness = iridescenceThicknessMaximum;",target:"material.iridescenceThickness = %RESULT%;"})),e.defines.USE_IRIDESCENCE=""):delete e.defines.USE_IRIDESCENCE,e.iorNode&&e.iorNode.isNode&&this.addSlot("fragment",new fe({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new fe({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new fe({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new fe({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new fe({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new fe({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new fe({node:e.attenuationColorNode,nodeType:"vec3",source:"material.attenuationColor = attenuationColor;",target:"material.attenuationColor = %RESULT%;"})),e.transmission=1,e.defines.USE_TRANSMISSION=""):(e.transmission=0,delete e.defines.USE_TRANSMISSION))),e.positionNode&&e.positionNode.isNode&&this.addSlot("vertex",new fe({node:e.positionNode,nodeType:"vec3",source:Ht("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new fe({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,n){return e.isTextureCube?`textureCube( ${t}, ${n} )`:`texture2D( ${t}, ${n} )`}generateTextureLevel(e,t,n,s){return`textureLod( ${t}, ${n}, ${s} )`}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),s=[];for(const i of t.inputs)s.push(this.getType(i.type)+" "+i.name);return`${this.getType(t.type)} ${t.name}( ${s.join(", ")} ) {
1
+ import{Mesh as H,SphereGeometry as pn,Vector3 as N,MeshBasicMaterial as It,Node as Ho,PerspectiveCamera as Os,NodeFrame as jo,NodeBuilder as qo,GLSLNodeParser as zo,ShaderLib as Et,UniformsUtils as un,UniformsLib as fs,normalView as Ko,defaultShaderStages as Hs,ShaderChunk as Yo,Material as Jt,TrianglesDrawMode as Jo,TriangleFanDrawMode as fn,TriangleStripDrawMode as yi,Matrix4 as oe,Loader as Dt,LoaderUtils as Vt,FileLoader as gt,MeshPhysicalMaterial as Ct,Vector2 as Fe,Color as Be,LinearSRGBColorSpace as We,SRGBColorSpace as re,SpotLight as Qi,PointLight as mn,DirectionalLight as vi,InstancedMesh as Vo,Quaternion as we,InstancedBufferAttribute as Wo,Object3D as Bt,TextureLoader as bn,ImageBitmapLoader as Xo,BufferAttribute as nt,InterleavedBuffer as Zo,LinearMipmapLinearFilter as js,NearestMipmapLinearFilter as xi,LinearMipmapNearestFilter as Si,NearestMipmapNearestFilter as Ti,LinearFilter as dt,NearestFilter as Ri,RepeatWrapping as Wt,MirroredRepeatWrapping as Di,ClampToEdgeWrapping as qs,PointsMaterial as ms,LineBasicMaterial as kt,MeshStandardMaterial as In,DoubleSide as En,PropertyBinding as pt,BufferGeometry as At,SkinnedMesh as Cn,LineSegments as zs,Line as ut,LineLoop as $o,Points as Ks,Group as Xt,MathUtils as Ee,OrthographicCamera as ki,Skeleton as Mi,AnimationClip as Bn,Bone as wn,InterpolateDiscrete as yn,InterpolateLinear as bs,InterleavedBufferAttribute as Zt,Texture as Qn,VectorKeyframeTrack as Ys,NumberKeyframeTrack as Js,QuaternionKeyframeTrack as Vs,ColorManagement as Xe,FrontSide as _i,Interpolant as er,Box3 as Ws,Sphere as vn,RGBA_S3TC_DXT1_Format as tr,RGB_PVRTC_4BPPV1_Format as sr,RGB_ETC2_Format as nr,RGB_ETC1_Format as ir,RGBA_S3TC_DXT5_Format as ar,RGBA_PVRTC_4BPPV1_Format as or,RGBA_ETC2_EAC_Format as rr,RGBA_BPTC_Format as Ar,RGBA_ASTC_4x4_Format as Fi,RGBAFormat as Pt,CompressedCubeTexture as cr,UnsignedByteType as ft,CompressedArrayTexture as lr,CompressedTexture as Is,DisplayP3ColorSpace as hr,LinearDisplayP3ColorSpace as gr,NoColorSpace as Xs,RGBA_ASTC_6x6_Format as Li,RedFormat as os,RGFormat as Es,HalfFloatType as it,FloatType as wt,DataTexture as dr,Data3DTexture as pr,ExtrudeGeometry as ur,ShapePath as fr,Raycaster as xn,CylinderGeometry as Ze,BoxGeometry as Ye,Float32BufferAttribute as Te,OctahedronGeometry as Zs,TorusGeometry as Cs,Euler as Ot,Controls as Ni,PlaneGeometry as Sn,DataTextureLoader as Ui,DataUtils as rs,Vector4 as Mt,Curve as mr,MeshPhongMaterial as Bs,MeshLambertMaterial as br,EquirectangularReflectionMapping as Ir,AmbientLight as Er,Uint16BufferAttribute as Cr,Matrix3 as Gi,ShapeUtils as Br,DefaultLoadingManager as wr,Ray as yr,Plane as Qr,MOUSE as As,TOUCH as cs,Spherical as Pi,ShaderMaterial as Oi,Uniform$1 as vr,Scene as Tn,WebGLRenderer as xr,CanvasTexture as Hi,REVISION as Sr,Source as Tr,InstancedBufferGeometry as Rr,InstancedInterleavedBuffer as Rn,WireframeGeometry as Dr,Line3 as kr,ColorKeyframeTrack as Mr}from"./three-Boa-jOq-.min.js";class _r extends H{constructor(e,t,n,s=128){if(t<=0||n<=0||s<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const i=new pn(n,2*s,s);i.scale(1,1,-1);const a=i.getAttribute("position"),r=new N;for(let A=0;A<a.count;++A)if(r.fromBufferAttribute(a,A),r.y<0){const c=-t*3/2,l=r.y<c?-t/r.y:1-r.y*r.y/(3*c*c);r.multiplyScalar(l),r.toArray(a.array,3*A)}a.needsUpdate=!0,super(i,new It({map:e,depthWrite:!1}))}}class fe extends Ho{constructor(e){super(e.nodeType),this.node=null,this.source=null,this.target=null,this.inclusionType="replace",Object.assign(this,e)}generate(e){return this.node.build(e,this.getNodeType(e))}}const $e=new jo;$e.camera=new Os;const ji={LineBasicNodeMaterial:Et.basic,MeshBasicNodeMaterial:Et.basic,PointsNodeMaterial:Et.points,MeshStandardNodeMaterial:Et.standard,MeshPhysicalNodeMaterial:Et.physical,MeshPhongNodeMaterial:Et.phong},Fr={atan2:"atan"},Lr={low:"lowp",medium:"mediump",high:"highp"};function Ht(o){return`#include <${o}>`}function ws(o){return`${o}Shader`}class Nr extends qo{constructor(e,t,n,s=null){super(e,t,new zo,null,s),this.shader=n,this.slots={vertex:[],fragment:[]},this._parseShaderLib(),this._parseInclude("fragment","lights_physical_fragment","clearcoat_normal_fragment_begin","transmission_fragment"),this._parseObject(),this._sortSlotsToFlow(),this.useComparisonMethod=!0}getMethod(e){return Fr[e]||e}addSlot(e,t){this.slots[e].push(t)}_parseShaderLib(){const e=this.material;let t=e.type;if(e.isMeshPhysicalNodeMaterial?t="MeshPhysicalNodeMaterial":e.isMeshStandardNodeMaterial?t="MeshStandardNodeMaterial":e.isMeshPhongNodeMaterial?t="MeshPhongNodeMaterial":e.isMeshBasicNodeMaterial?t="MeshBasicNodeMaterial":e.isPointsNodeMaterial?t="PointsNodeMaterial":e.isLineBasicNodeMaterial&&(t="LineBasicNodeMaterial"),ji[t]!==void 0){const n=ji[t],s=this.shader;s.vertexShader=n.vertexShader,s.fragmentShader=n.fragmentShader,s.uniforms=un.merge([n.uniforms,fs.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new fe({node:Ko,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new fe({node:e.colorNode,nodeType:"vec4",source:Ht("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new fe({node:e.colorNode,nodeType:"vec4",source:"vec4 diffuseColor = vec4( diffuse, opacity );",target:"vec4 diffuseColor = %RESULT%; diffuseColor.a *= opacity;"})),e.opacityNode&&e.opacityNode.isNode&&this.addSlot("fragment",new fe({node:e.opacityNode,nodeType:"float",source:Ht("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new fe({node:e.normalNode,nodeType:"vec3",source:Ht("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new fe({node:e.emissiveNode,nodeType:"vec3",source:Ht("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new fe({node:e.metalnessNode,nodeType:"float",source:Ht("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new fe({node:e.roughnessNode,nodeType:"float",source:Ht("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new fe({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new fe({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new fe({node:e.clearcoatNormalNode,nodeType:"vec3",source:"vec3 clearcoatNormal = nonPerturbedNormal;",target:"vec3 clearcoatNormal = %RESULT%;"})),e.defines.USE_CLEARCOAT=""):delete e.defines.USE_CLEARCOAT,e.sheenNode&&e.sheenNode.isNode?(this.addSlot("fragment",new fe({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new fe({node:e.sheenRoughnessNode,nodeType:"float",source:"material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );",target:"material.sheenRoughness = clamp( %RESULT%, 0.07, 1.0 );"})),e.defines.USE_SHEEN=""):delete e.defines.USE_SHEEN,e.iridescenceNode&&e.iridescenceNode.isNode?(this.addSlot("fragment",new fe({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new fe({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new fe({node:e.iridescenceThicknessNode,nodeType:"float",source:"material.iridescenceThickness = iridescenceThicknessMaximum;",target:"material.iridescenceThickness = %RESULT%;"})),e.defines.USE_IRIDESCENCE=""):delete e.defines.USE_IRIDESCENCE,e.iorNode&&e.iorNode.isNode&&this.addSlot("fragment",new fe({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new fe({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new fe({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new fe({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new fe({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new fe({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new fe({node:e.attenuationColorNode,nodeType:"vec3",source:"material.attenuationColor = attenuationColor;",target:"material.attenuationColor = %RESULT%;"})),e.transmission=1,e.defines.USE_TRANSMISSION=""):(e.transmission=0,delete e.defines.USE_TRANSMISSION))),e.positionNode&&e.positionNode.isNode&&this.addSlot("vertex",new fe({node:e.positionNode,nodeType:"vec3",source:Ht("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new fe({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,n){return e.isTextureCube?`textureCube( ${t}, ${n} )`:`texture2D( ${t}, ${n} )`}generateTextureLevel(e,t,n,s){return`textureLod( ${t}, ${n}, ${s} )`}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),s=[];for(const i of t.inputs)s.push(this.getType(i.type)+" "+i.name);return`${this.getType(t.type)} ${t.name}( ${s.join(", ")} ) {
2
2
 
3
3
  ${n.vars}
4
4
 
@@ -1,4 +1,4 @@
1
- import { Mesh as z, SphereGeometry as ci, Vector3 as P, MeshBasicMaterial as Qt, Node as ra, PerspectiveCamera as ds, NodeFrame as aa, NodeBuilder as Aa, GLSLNodeParser as ca, ShaderLib as wt, UniformsUtils as li, UniformsLib as Un, normalView as la, defaultShaderStages as Kn, ShaderChunk as ha, Material as tn, TrianglesDrawMode as ua, TriangleFanDrawMode as Js, TriangleStripDrawMode as So, Matrix4 as ue, Loader as Nt, LoaderUtils as nn, FileLoader as ft, MeshPhysicalMaterial as Tt, Vector2 as Le, Color as Se, LinearSRGBColorSpace as Ve, SRGBColorSpace as ge, SpotLight as vo, PointLight as Ws, DirectionalLight as To, InstancedMesh as ga, Quaternion as ve, InstancedBufferAttribute as da, Object3D as xt, TextureLoader as hi, ImageBitmapLoader as pa, BufferAttribute as nt, InterleavedBuffer as fa, LinearMipmapLinearFilter as ps, NearestMipmapLinearFilter as Ro, LinearMipmapNearestFilter as _o, NearestMipmapNearestFilter as Do, LinearFilter as mt, NearestFilter as Mo, RepeatWrapping as rn, MirroredRepeatWrapping as ko, ClampToEdgeWrapping as As, PointsMaterial as Dn, LineBasicMaterial as Lt, MeshStandardMaterial as ui, DoubleSide as gi, PropertyBinding as It, BufferGeometry as ut, SkinnedMesh as di, LineSegments as cs, Line as dt, LineLoop as ma, Points as is, Group as sn, MathUtils as ye, OrthographicCamera as Fo, Skeleton as Lo, AnimationClip as pi, Bone as Vs, InterpolateDiscrete as fi, InterpolateLinear as jn, InterleavedBufferAttribute as en, Texture as Xs, VectorKeyframeTrack as ls, NumberKeyframeTrack as hs, QuaternionKeyframeTrack as us, ColorManagement as We, FrontSide as No, Interpolant as Ia, Box3 as fs, Sphere as mi, RGBA_S3TC_DXT1_Format as ba, RGB_PVRTC_4BPPV1_Format as Ea, RGB_ETC2_Format as Ca, RGB_ETC1_Format as Ba, RGBA_S3TC_DXT5_Format as wa, RGBA_PVRTC_4BPPV1_Format as ya, RGBA_ETC2_EAC_Format as Qa, RGBA_BPTC_Format as xa, RGBA_ASTC_4x4_Format as Uo, RGBAFormat as Kt, CompressedCubeTexture as Sa, UnsignedByteType as pt, CompressedArrayTexture as va, CompressedTexture as Gn, DisplayP3ColorSpace as Ta, LinearDisplayP3ColorSpace as Ra, NoColorSpace as gs, RGBA_ASTC_6x6_Format as Ri, RedFormat as dn, RGFormat as Mn, HalfFloatType as st, FloatType as St, DataTexture as _a, Data3DTexture as Da, ExtrudeGeometry as Ma, ShapePath as ka, Raycaster as Ii, CylinderGeometry as Ke, BoxGeometry as je, Float32BufferAttribute as ke, OctahedronGeometry as Yn, TorusGeometry as Cn, Euler as zt, Controls as Go, PlaneGeometry as bi, DataTextureLoader as Po, DataUtils as pn, Vector4 as Ut, Curve as Fa, MeshPhongMaterial as Pn, MeshLambertMaterial as La, EquirectangularReflectionMapping as Na, AmbientLight as Ua, Uint16BufferAttribute as Ga, Matrix3 as Oo, ShapeUtils as Pa, DefaultLoadingManager as Oa, Ray as Ha, Plane as ja, MOUSE as mn, TOUCH as fn, Spherical as _i, ShaderMaterial as Ho, Uniform$1 as qa, Scene as Zs, WebGLRenderer as za, CanvasTexture as jo, REVISION as Ka, Source as Ya, InstancedBufferGeometry as Ja, InstancedInterleavedBuffer as $s, WireframeGeometry as Wa, Line3 as Va, ColorKeyframeTrack as Xa } from "./three-1JG7vpNC.js";
1
+ import { Mesh as z, SphereGeometry as ci, Vector3 as P, MeshBasicMaterial as Qt, Node as ra, PerspectiveCamera as ds, NodeFrame as aa, NodeBuilder as Aa, GLSLNodeParser as ca, ShaderLib as wt, UniformsUtils as li, UniformsLib as Un, normalView as la, defaultShaderStages as Kn, ShaderChunk as ha, Material as tn, TrianglesDrawMode as ua, TriangleFanDrawMode as Js, TriangleStripDrawMode as So, Matrix4 as ue, Loader as Nt, LoaderUtils as nn, FileLoader as ft, MeshPhysicalMaterial as Tt, Vector2 as Le, Color as Se, LinearSRGBColorSpace as Ve, SRGBColorSpace as ge, SpotLight as vo, PointLight as Ws, DirectionalLight as To, InstancedMesh as ga, Quaternion as ve, InstancedBufferAttribute as da, Object3D as xt, TextureLoader as hi, ImageBitmapLoader as pa, BufferAttribute as nt, InterleavedBuffer as fa, LinearMipmapLinearFilter as ps, NearestMipmapLinearFilter as Ro, LinearMipmapNearestFilter as _o, NearestMipmapNearestFilter as Do, LinearFilter as mt, NearestFilter as Mo, RepeatWrapping as rn, MirroredRepeatWrapping as ko, ClampToEdgeWrapping as As, PointsMaterial as Dn, LineBasicMaterial as Lt, MeshStandardMaterial as ui, DoubleSide as gi, PropertyBinding as It, BufferGeometry as ut, SkinnedMesh as di, LineSegments as cs, Line as dt, LineLoop as ma, Points as is, Group as sn, MathUtils as ye, OrthographicCamera as Fo, Skeleton as Lo, AnimationClip as pi, Bone as Vs, InterpolateDiscrete as fi, InterpolateLinear as jn, InterleavedBufferAttribute as en, Texture as Xs, VectorKeyframeTrack as ls, NumberKeyframeTrack as hs, QuaternionKeyframeTrack as us, ColorManagement as We, FrontSide as No, Interpolant as Ia, Box3 as fs, Sphere as mi, RGBA_S3TC_DXT1_Format as ba, RGB_PVRTC_4BPPV1_Format as Ea, RGB_ETC2_Format as Ca, RGB_ETC1_Format as Ba, RGBA_S3TC_DXT5_Format as wa, RGBA_PVRTC_4BPPV1_Format as ya, RGBA_ETC2_EAC_Format as Qa, RGBA_BPTC_Format as xa, RGBA_ASTC_4x4_Format as Uo, RGBAFormat as Kt, CompressedCubeTexture as Sa, UnsignedByteType as pt, CompressedArrayTexture as va, CompressedTexture as Gn, DisplayP3ColorSpace as Ta, LinearDisplayP3ColorSpace as Ra, NoColorSpace as gs, RGBA_ASTC_6x6_Format as Ri, RedFormat as dn, RGFormat as Mn, HalfFloatType as st, FloatType as St, DataTexture as _a, Data3DTexture as Da, ExtrudeGeometry as Ma, ShapePath as ka, Raycaster as Ii, CylinderGeometry as Ke, BoxGeometry as je, Float32BufferAttribute as ke, OctahedronGeometry as Yn, TorusGeometry as Cn, Euler as zt, Controls as Go, PlaneGeometry as bi, DataTextureLoader as Po, DataUtils as pn, Vector4 as Ut, Curve as Fa, MeshPhongMaterial as Pn, MeshLambertMaterial as La, EquirectangularReflectionMapping as Na, AmbientLight as Ua, Uint16BufferAttribute as Ga, Matrix3 as Oo, ShapeUtils as Pa, DefaultLoadingManager as Oa, Ray as Ha, Plane as ja, MOUSE as mn, TOUCH as fn, Spherical as _i, ShaderMaterial as Ho, Uniform$1 as qa, Scene as Zs, WebGLRenderer as za, CanvasTexture as jo, REVISION as Ka, Source as Ya, InstancedBufferGeometry as Ja, InstancedInterleavedBuffer as $s, WireframeGeometry as Wa, Line3 as Va, ColorKeyframeTrack as Xa } from "./three-Bz6X1mrw.js";
2
2
  class eh extends z {
3
3
  constructor(e, t, s, n = 128) {
4
4
  if (t <= 0 || s <= 0 || n <= 0)
@@ -1,7 +1,7 @@
1
1
  var It = Object.defineProperty;
2
2
  var Ct = (i, e, t) => e in i ? It(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var I = (i, e, t) => Ct(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { Vector4 as Rt, Vector3 as Bt, Vector2 as Ut, TextureLoader as At, Texture as Tt, ShaderMaterial as Mt, PlaneGeometry as Ft, Plane as Ot, Object3D as Lt, MeshBasicMaterial as zt, Mesh as Wt, LinearFilter as Et, FrontSide as Dt, FileLoader as Ht, EventDispatcher as Gt, DoubleSide as $t, Color as Nt, BufferGeometry as Xt, BufferAttribute as jt, BackSide as Yt } from "./three-1JG7vpNC.js";
4
+ import { Vector4 as Rt, Vector3 as Bt, Vector2 as Ut, TextureLoader as At, Texture as Tt, ShaderMaterial as Mt, PlaneGeometry as Ft, Plane as Ot, Object3D as Lt, MeshBasicMaterial as zt, Mesh as Wt, LinearFilter as Et, FrontSide as Dt, FileLoader as Ht, EventDispatcher as Gt, DoubleSide as $t, Color as Nt, BufferGeometry as Xt, BufferAttribute as jt, BackSide as Yt } from "./three-Bz6X1mrw.js";
5
5
  var V = {};
6
6
  V.d = (i, e) => {
7
7
  for (var t in e)
@@ -1,4 +1,4 @@
1
- var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>Ft(s,typeof e!="symbol"?e+"":e,t);import{Vector4 as Ot,Vector3 as zt,Vector2 as At,TextureLoader as Wt,Texture as Dt,ShaderMaterial as Et,PlaneGeometry as Lt,Plane as Ht,Object3D as Gt,MeshBasicMaterial as $t,Mesh as jt,LinearFilter as Xt,FrontSide as Yt,FileLoader as Nt,EventDispatcher as Kt,DoubleSide as qt,Color as Jt,BufferGeometry as Qt,BufferAttribute as Zt,BackSide as es}from"./three-CFtLGNtV.min.js";var k={};k.d=(s,e)=>{for(var t in e)k.o(e,t)&&!k.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},k.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),k.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var m={};k.d(m,{ti:()=>p,nS:()=>yt,eB:()=>z,Yp:()=>Z,VB:()=>C,BC:()=>I,zN:()=>R,cV:()=>P,hW:()=>W,k2:()=>Fe,K6:()=>w,M7:()=>ee,ls:()=>F,Hi:()=>Qe,EY:()=>A,MR:()=>Ge,zf:()=>Te,Ay:()=>gn,yo:()=>xt});var Z={};k.r(Z),k.d(Z,{get:()=>Ce,set:()=>ts});var ee={};k.r(ee),k.d(ee,{alphaTestTransformer:()=>G,asPreprocessorValueTransformer:()=>$e,toPreprocessorTriggerTransformer:()=>pe,toUserDataTransformer:()=>di,uniformOrUserDataTransformer:()=>x});const te={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
1
+ var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>Ft(s,typeof e!="symbol"?e+"":e,t);import{Vector4 as Ot,Vector3 as zt,Vector2 as At,TextureLoader as Wt,Texture as Dt,ShaderMaterial as Et,PlaneGeometry as Lt,Plane as Ht,Object3D as Gt,MeshBasicMaterial as $t,Mesh as jt,LinearFilter as Xt,FrontSide as Yt,FileLoader as Nt,EventDispatcher as Kt,DoubleSide as qt,Color as Jt,BufferGeometry as Qt,BufferAttribute as Zt,BackSide as es}from"./three-Boa-jOq-.min.js";var k={};k.d=(s,e)=>{for(var t in e)k.o(e,t)&&!k.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},k.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),k.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var m={};k.d(m,{ti:()=>p,nS:()=>yt,eB:()=>z,Yp:()=>Z,VB:()=>C,BC:()=>I,zN:()=>R,cV:()=>P,hW:()=>W,k2:()=>Fe,K6:()=>w,M7:()=>ee,ls:()=>F,Hi:()=>Qe,EY:()=>A,MR:()=>Ge,zf:()=>Te,Ay:()=>gn,yo:()=>xt});var Z={};k.r(Z),k.d(Z,{get:()=>Ce,set:()=>ts});var ee={};k.r(ee),k.d(ee,{alphaTestTransformer:()=>G,asPreprocessorValueTransformer:()=>$e,toPreprocessorTriggerTransformer:()=>pe,toUserDataTransformer:()=>di,uniformOrUserDataTransformer:()=>x});const te={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
2
2
  `,whiteSpace:"pre-line",flexDirection:"column",justifyContent:"start",alignItems:"start",backgroundImage:null,textAlign:"left",boxSizing:"content-box",position:"static",color:16777215,fontColor:16777215,fontOpacity:1,opacity:1,fontPXRange:4,fontSupersampling:!0,fontSmooth:"antialiased",borderRadius:0,borderWidth:0,borderColor:"black",borderOpacity:1,backgroundSize:"cover",backgroundColor:0,backgroundOpacity:0,overflow:"visible",letterSpacing:0,invertAlpha:!1,segments:1},ts=function(s){for(const e in s)te[e]=s[e]},Ce=function(s){return Object.prototype.hasOwnProperty.call(te,s)||console.warn(`ThreeMeshUI::DefaultValues is trying to retrieve non-existing property '${s}'`),te[s]};class p{constructor(e,t=null,i=!0){this._id=e,this._value=t,this._needsUpdate=!0,this._needsProcess=!1,this._needsRender=!1,this._isPrimitive=i}get id(){return this._id}get value(){return this._value}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this.output(t)}output(e){}_outputValue(e){e[this._id]=this._value}process(e){}render(e){}getInheritedInput(e){if(this._value!=="inherit")return this._value;const t=e._parent._value;return t&&t[`_${this._id}`]?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return Ce(this._id)}isValid(e){return!0}emptyStrategyLogic(){throw new Error(`ThreeMeshUI::${this.constructor.name} has empty strategy. Update has not been processed.`)}requestUpdate(){this._needsUpdate=!0}requestProcess(){this._needsProcess=!1}requestRender(){this._needsRender=!1}}class ss extends p{constructor(){super("renderOrder","auto",!0),this.output=this._outputValue,this._actualValue=0}set value(e){this.isValid(e)&&(this._value=e,this._needsUpdate=!0)}update(e,t){if(this._value!=="auto")this._actualValue=this._value;else{const i=e._parent._value;if(i!==null){const r=i._renderOrder._actualValue,n=1+i._children._uis.indexOf(e);this._actualValue=r+n}}for(const i of e._children._uis)i._renderOrder._value==="auto"&&(i._renderOrder._needsUpdate=!0);this._outputValue(t)}_outputValue(e){e[this._id]=this._actualValue}get value(){return this._value}}class R extends p{constructor(e,t=null,i=!0){super(e,t,i),this.output=this._outputValue,this._notInheritedValue=null}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),this.propagate(e),this._outputValue(t)}propagate(e){for(const t of e._children._uis){const i=t[`_${this._id}`];i!==void 0&&i._value==="inherit"&&(t[`_${this._id}`]._needsUpdate=!0)}}_outputValue(e){e[this._id]=this._notInheritedValue}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class is extends R{constructor(){super("offset","inherit",!1)}update(e,t){super.update(e,t),e._parent._value!==null&&(e.position.z=this._notInheritedValue)}}class rs extends R{constructor(){super("fontSmooth","inherit",!0),this._needsUpdate=!1,this.isValid=os,this.output=this._outputValue}}const ns=["inherit","none","antialiased"];function os(s){return ns.indexOf(s)===-1?(console.warn(`.fontSmoothing value '${s}' is not valid. Aborted`),!1):!0}var as=s=>{var e={};return k.d(e,s),e};const a=as({BackSide:()=>es,BufferAttribute:()=>Zt,BufferGeometry:()=>Qt,Color:()=>Jt,DoubleSide:()=>qt,EventDispatcher:()=>Kt,FileLoader:()=>Nt,FrontSide:()=>Yt,LinearFilter:()=>Xt,Mesh:()=>jt,MeshBasicMaterial:()=>$t,Object3D:()=>Gt,Plane:()=>Ht,PlaneGeometry:()=>Lt,ShaderMaterial:()=>Et,Texture:()=>Dt,TextureLoader:()=>Wt,Vector2:()=>At,Vector3:()=>zt,Vector4:()=>Ot});class g extends p{constructor(e,t,i=!0){super(e,"unset",i),this._input="inherit",this._allowsInherit=!0,this._inheritedInput=void 0,this._inline=void 0}update(e,t){this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis){const r=i[`_${this._id}`];(r._input?r._input:r._value)==="inherit"&&(i[`_${this._id}`]._needsUpdate=!0)}this.output(t)}computeOutputValue(e){this._value=this._input}_computeFromInherited(e){this._value=this._inheritedInput}set value(e){console.warn(".(style) sub-property cannot be directly set. It must comes from inline or computed setter.")}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._input=this._inline=e,this._needsUpdate=!0)}get inline(){return this._inline}isValidValue(e){return!0}getInheritedInput(e){if(this._input!=="inherit")return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}}class D extends g{constructor(e,t){super(e,t,!1),this._input=new a.Vector4(0,0,0,0),this._inline=null,this._value=new a.Vector4(0,0,0,0)}get value(){return this._value}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input)}set inline(e){this._vector4ValueSetter(this._input,e),!this._input.equals(this._value)&&(this._needsUpdate=!0)}set top(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get top(){return this._input.x}set right(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get right(){return this._input.y}set bottom(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottom(){return this._input.z}set left(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get left(){return this._input.w}dispose(){this._computed=null,this._inline=null,this._input=null,this._output=null}_vector4ValueSetter(e,t){if(t instanceof a.Vector4){e.copy(t);return}if((typeof t=="string"||t instanceof String)&&(t=t.split(" ")),Array.isArray(t))switch(t=t.map(i=>parseFloat(i)),t.length){case 1:e.setScalar(t[0]);return;case 2:e.x=e.z=t[0],e.y=e.w=t[1];return;case 3:e.x=t[0],e.y=t[1],e.z=t[2];return;case 4:e.x=t[0],e.y=t[1],e.z=t[2],e.w=t[3];return;default:console.error("StyleVector4Property::set() Four Dimension property had more than four values");return}isNaN(t)||e.setScalar(t)}}class ls extends D{constructor(){super("padding",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._bounds._needsUpdate=!0,e._bounds._needsRender=!0,e._layouter._needsProcess=!0,e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}class hs extends D{constructor(){super("margin",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._flexDirection._needsProcess=!0)}}const Me=function(s,e,t){s[e]=t},us=function(s,e,t){t!==null&&(s[e]=t)};class E{constructor(e){this._definition=e}set definition(e){this._definition=e}mediate(e,t,i,r=null){for(const n in this._definition){const o=this._definition[n];if(i[n]!==void 0){const h=o.t?o.t:Me;h(t,o.m,i[n]),r&&h(r,o.m,i[n])}}}static mediate(e,t,i,r,n=null){if(t)for(const o in r){const h=r[o];if(i[o]!==void 0){const c=h.t?h.t:Me;c(t,h.m,i[o]),n&&c(n,h.m,i[o])}}}}class cs extends p{constructor(){super("parent",null,!1)}update(e,t){e.parent&&e.parent.isUI?this._value=e.parent:this._value=null}set value(e){console.warn("ParentProperty is readonly")}get value(){return this._value}find(e){return this._value?e(this._value)?this._value:this._value._parent.find(e):null}dispose(){this._value=null}}const se=function(s,e,t=6){return s.toFixed(t)===e.toFixed(t)};class Be extends p{constructor(e,t){super(e,t,!0),this.output=this._outputValue}set value(e){this.isValid(e)&&(se(this._value,e)||(this._value=e,this._needsUpdate=!0))}get value(){return this._value}}class Pe extends R{constructor(e){super(e,"inherit",!0),this.isValid=_s}}const ds=[a.FrontSide,a.BackSide,a.DoubleSide];function _s(s){return ds.indexOf(s)===-1?(console.warn(`SideProperty value '${s}' is not valid. Abort`),!1):!0}class Ie{constructor(){this._offsetX=0,this._offsetY=0,this._lineBreak=null,this._kerning=0,this._fontFactor=1,this._fontSize=0,this._cumulativeWidth=0,this._paddingLeft=0,this._paddingRight=0,this._marginLeft=0,this._marginRight=0}resetOffsets(){this._offsetX=this._offsetY=0,this._cumulativeWidth=0}get xadvance(){return 0}get xoffset(){return 0}get yoffset(){return 0}get width(){return 0}get height(){return 0}set lineBreak(e){this._lineBreak=e}get lineBreak(){return this._lineBreak}get anchor(){return 0}get kerning(){return this._kerning*this._fontFactor}set kerning(e){this._kerning=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get lineHeight(){return 0}get offsetX(){return this._offsetX}set offsetX(e){this._offsetX=e}get offsetY(){return this._offsetY}set offsetY(e){this._offsetY=e}get cumulativeWidth(){return this._cumulativeWidth}set cumulativeWidth(e){this._cumulativeWidth=e}get marginLeft(){return this._marginLeft}set marginLeft(e){this._marginLeft=e}get marginRight(){return this._marginRight}set marginRight(e){this._marginRight=e}get paddingLeft(){return this._paddingLeft}set paddingLeft(e){this._paddingLeft=e}get paddingRight(){return this._paddingRight}set paddingRight(e){this._paddingRight=e}get lineBase(){return 0}set fontFactor(e){this._fontFactor=e}get fontFactor(){return this._fontFactor}}class Te{constructor(e){this._char="",this._width=1,this._heigth=1,this._xadvance=1,this._xoffset=0,this._yoffset=0,this._font=e}get font(){return this._font}get char(){return this._char}get width(){return this._width}get height(){return this._heigth}get xadvance(){return this._xadvance}get xoffset(){return this._xoffset}get yoffset(){return this._yoffset}set yoffset(e){this._yoffset=e}clone(e){throw new Error("Abstract... Need to be implemented")}asInlineGlyph(){throw new Error("Abstract... Need to be implemented")}}class Fe extends Ie{constructor(e){super(),this._typographic=e}get typographic(){return this._typographic}get xadvance(){return this._typographic.xadvance*this._fontFactor}get xoffset(){return this._typographic.xoffset*this._fontFactor}get yoffset(){return this._typographic.yoffset*this._fontFactor}get width(){return this._typographic.width*this._fontFactor}get height(){return this._typographic.height*this._fontFactor}get char(){return this._typographic.char}get anchor(){return this.yoffset}get lineHeight(){return this._typographic.font.lineHeight*this._fontFactor}get lineBase(){return this._typographic.font.lineBase*this._fontFactor}}const ps={light:"100",normal:"400",bold:"700",bolder:"900"};function ie(s){return isNaN(s)?ps[s]||s:s.toString()}class fs extends a.EventDispatcher{constructor(e,t){super(),this._isReady=!1,this._weight=ie(e),this._style=t,this._size=42,this._lineHeight=42,this._lineBase=42,this._font=null}get typographic(){return this._font}get isReady(){return this._isReady}get weight(){return this._weight}get style(){return this._style}get texture(){return this._texture}set fontMaterial(e){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get fontMaterial(){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get id(){return`${this._name}(w:${this.weight},s:${this.style})`}getTypographicGlyph(e){let t=this._chars[e];if(t)return t;if(e.match(/\s/))return this._chars[" "];const i=this._getFallbackCharacter(e);if(i&&(t=this._chars[i],t))return t;throw Error(`FontVariant('${this.id}')::getTypographicGlyph() - character('${e}') and/or fallback character were not found in provided msdf charset.`)}_getFallbackCharacter(e){throw new Error(`FontVariant(${typeof this})::_getFallbackCharacter() is abstract and should therefore be overridden.`)}getGeometricGlyph(e,t){throw new Error(`FontVariant(${typeof this})::getGeometryCharacter() is abstract and should therefore be overridden.`)}getKerningAmount(e){return this._kernings[e]?this._kernings[e]:0}adjustTypographicGlyphs(e){for(const t in e){const i=this.getTypographicGlyph(t),r=e[t];for(const n in r)i["_"+n]=e[t][n]}}_checkReadiness(){this._readyCondition()&&ms(this)}_alterElementProperties(e){throw new Error(`FontVariant(${typeof this})::_alterElementProperties() is abstract and should therefore be overridden.`)}_readyCondition(){throw new Error(`FontVariant(${typeof this})::_readyCondition() is abstract and should therefore be overridden.`)}}const gs={type:"ready"};function ms(s){s._isReady=!0,s.dispatchEvent(gs)}const I=fs;class vs extends p{constructor(e=null){super("font",e,!1),this._needsUpdate=!1,this._fontVariant=null,this._handleFontReadyClosure=null,this.isValid=bs}output(e){e[this._id]=this._fontVariant}update(e,t){if(this._fontVariant&&!this._fontVariant.isReady&&this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._value&&this._value instanceof I)this._fontVariant=this._value;else{const i=e._fontFamily._value;i&&(this._fontVariant=i.getVariant(e._fontWeight._value,e._fontStyle._value))}this._fontVariant&&(this._fontVariant._alterElementProperties(e),this._handleFontReadyClosure=ys(e,this),this._fontVariant.isReady?this._handleFontReadyClosure():this._fontVariant.addEventListener("ready",this._handleFontReadyClosure),(!e._fontMaterial._defaultMaterial||!(e._fontMaterial._defaultMaterial instanceof this._fontVariant.fontMaterial))&&(e._fontMaterial._defaultMaterial=new this._fontVariant.fontMaterial,e._fontMaterial._needsUpdate=!0))}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}get fontVariant(){return this._fontVariant}dispose(){this._handleFontReadyClosure&&(this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._handleFontReadyClosure=null),this._value=null,this._fontVariant=null}}function bs(s){return s instanceof I?!0:(console.warn(`.font value '${s}' is not valid. It requires a FontVariant instance. Aborted`),!1)}function ys(s,e){return function(){e._needsUpdate=!0,s._glyphs._needsProcess=!0,e._fontVariant.removeEventListener("ready",e._handleFontReadyClosure),e._handleFontReadyClosure=null}}class xs extends g{constructor(e){super("display",e),this._value="flex",this._allowsInherit=!1,this._needsUpdate=!1,this.isValidValue=Ss}computeOutputValue(e){e._visible._value=this._output!=="none"}}const ws=["none","flex"];function Ss(s){return ws.indexOf(s)===-1?(console.warn(`(.style) display value '${s}' is not valid. Aborted`),!1):!0}class ks extends g{constructor(e){super("boxSizing",e),this._allowsInherit=!1,this.isValidValue=Us}computeOutputValue(e){this._value=this._inheritedInput,e._bounds._needsUpdate=!0}}const Vs=["border-box","content-box"];function Us(s){return Vs.indexOf(s)===-1?(console.warn(`(.style) boxSizing value '${s}' is not valid. Aborted`),!1):!0}class T extends g{constructor(e,t){super(e,t,!1),this._value=new a.Color,this.output=this._outputValue}computeOutputValue(e){this._input!=="inherit"&&this._value.set(this._input)}set inline(e){this._input=this._inline=e,this._needsUpdate=!0}}class re extends g{constructor(e,t){super(e,t,!0),this.isValidValue=Rs,this._allowsInherit=!1,this._input=t,this._value=t,this.output=this._outputValue,this.computeOutputValue=this._computeFromInherited}_outputValue(e){e[this._id]=this._inheritedInput}}function Rs(s){return s<0&&s>1?(console.warn(`(.style) styleFactorProperty('${this.id}') value '${s}' is not valid)`),!1):!0}class Cs extends g{constructor(e){super("backgroundImage",e,!0),this._input=null,this._allowsInherit=!1,this._textureSize=new a.Vector2(1,1),this.isValidValue=Ms}get value(){return this._value}output(e){e[this._id]=this._value,e.tSize=this._textureSize}computeOutputValue(e){if(this._value=this._inheritedInput,this._value instanceof a.Texture&&!this._value.image){console.warn("ThreeMeshUI - .backgroundImage :: Please provide preloaded texture in order to have accurate sizing.");return}this._needsProcess=!0}process(e){this._value?this._textureSize.set(this._value.image.width,this._value.image.height):this._textureSize.set(1,1)}}function Ms(s){return!0}class Bs extends g{constructor(e){super("backgroundSize",e,!0),this.isValidValue=Is,this.output=this._outputValue}}const Ps=["cover","contain","stretch"];function Is(s){return Ps.indexOf(s)===-1?(console.warn(`(.style) backgroundSize value '${s}' is not valid. Aborted`),!1):!0}class Ts extends g{constructor(e){super("overflow",e,!0),this.isValidValue=Os,this._clippingPlanes=null,this._renderStrategy=this._emptyRender}update(e,t){this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0&&(this._input=this._computed),this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i._overflow._needsUpdate=!0;this.output(t)}output(e){e.clippingPlanes=this._clippingPlanes}computeOutputValue(e){super.computeOutputValue(e),this._value==="hidden"?this._renderStrategy=this._propagateRender:(this._renderStrategy=this._emptyRender,this._clippingPlanes=null);const t=e._parent._value;if(t!==null){const i=t._overflow;if((i._value==="hidden"||i._clippingPlanes!==null)&&!this._clippingPlanes){this._clippingPlanes=[new a.Plane(new a.Vector3(0,-1,0),1),new a.Plane(new a.Vector3(-1,0,0),1),new a.Plane(new a.Vector3(0,1,0),1),new a.Plane(new a.Vector3(1,0,0),1)];for(let r=0;r<this._clippingPlanes.length;r++)this._clippingPlanes[r].parent=t;i._clippingPlanes!==null&&this._clippingPlanes.push(...i._clippingPlanes),this._renderStrategy=this._hiddenRender,this._needsRender=!0}else(i._value==="visible"||i._clippingPlanes===null)&&this._clippingPlanes!==null&&(this._clippingPlanes=null,this._renderStrategy=this._emptyRender,this._needsRender=!0)}}render(e){this._renderStrategy(e)}_emptyRender(e){}_hiddenRender(e){const t=e._parent._value,i=t._bounds._offsetHeight,r=t._bounds._offsetWidth,n=t._padding._value,o=t._borderWidth._value;for(let h=0;h<4&&h<this._clippingPlanes.length;h++){const c=this._clippingPlanes[h];switch(h%4){case 0:c.constant=i/2-(n.x+o.x);break;case 1:c.constant=r/2-(n.y+o.y);break;case 2:c.constant=i/2-(n.z+o.z);break;case 3:c.constant=r/2-(n.w+o.w);break}c.applyMatrix4(t.matrixWorld)}for(let h=0;h<e._children._uis.length;h++){const c=e._children._uis[h];c._overflow._needsRender=!0}}_propagateRender(e){for(let t=0;t<e._children._uis.length;t++){const i=e._children._uis[t];i._overflow._needsRender=!0}}}const Fs=["visible","hidden"];function Os(s){return Fs.indexOf(s)===-1?(console.warn(`(.style) overflow value '${s}' is not valid. Aborted`),!1):!0}const B="rem",Oe="em",L="%",zs=[B,Oe,L],ze=function(s){return zs.indexOf(s)===-1?B:s};class As extends D{constructor(e){super("borderRadius",e),this._valueUV=this._value.clone(),this._input=new a.Vector4(0,0,0,0),this._mediation=!0,this._cornerTL=new a.Vector2(0,1),this._cornerTR=new a.Vector2(1,1),this._cornerBR=new a.Vector2(1,0),this._cornerBL=new a.Vector2(0,0);const t=new H(this._valueUV,["x","y"]),i=new H(this._valueUV,["z","w"]),r=new H(this._valueUV,["x","w"]),n=new H(this._valueUV,["y","z"]);t.complementaryMediation=i,i.complementaryMediation=t,r.complementaryMediation=n,n.complementaryMediation=r,this._sideMediators=[t,i,r,n],this._units=B}set units(e){this._units=ze(e),this._needsProcess=!0}get units(){return this._units}set mediation(e){e!==this._mediation&&(this._mediation=e,this._needsUpdate=!0)}get mediation(){return this._mediation}output(e){e.cornerTL=this._cornerTL,e.cornerTR=this._cornerTR,e.cornerBR=this._cornerBR,e.cornerBL=this._cornerBL}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0}process(e){this._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&this._valueUV.divideScalar(100),this._units===B&&this._valueUV.divideScalar(Math.min(t,i)),this._mediation)do this._sideMediators.forEach(o=>o.computeValue()),this._sideMediators.sort((o,h)=>o.value<h.value?1:-1),this._sideMediators[0].value>1&&this._sideMediators[0].mediate();while(this._sideMediators[0].value>1);let r=t>i?i/t:1,n=t<i?t/i:1;this._units===L&&(r=n=1),this._cornerTL.x=this._valueUV.x*r,this._cornerTL.y=1-this._valueUV.x*n,this._cornerTR.x=1-this._valueUV.y*r,this._cornerTR.y=1-this._valueUV.y*n,this._cornerBR.x=1-this._valueUV.z*r,this._cornerBR.y=this._valueUV.z*n,this._cornerBL.x=this._valueUV.w*r,this._cornerBL.y=this._valueUV.w*n}dispose(){for(const e of this._sideMediators)e.dispose();this._sideMediators=null,this._cornerTL=null,this._cornerTR=null,this._cornerBR=null,this._cornerBL=null,super.dispose()}set topLeft(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get topLeft(){return this._input.x}set topRight(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get topRight(){return this._input.y}set bottomRight(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottomRight(){return this._input.z}set bottomLeft(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get bottomLeft(){return this._input.w}set top(e){this._input.x===e&&this._input.y===e||(this._input.x=this._input.y=e,this._needsUpdate=!0)}get top(){return(this._input.x+this._input.y)/2}set right(e){this._input.y===e&&this._input.z===e||(this._input.y=this._input.z=e,this._needsUpdate=!0)}get right(){return(this._input.y+this._input.z)/2}set bottom(e){this._input.z===e&&this._input.w===e||(this._input.z=this._input.w=e,this._needsUpdate=!0)}get bottom(){return(this._input.z+this._input.w)/2}set left(e){this._input.w===e&&this._input.x===e||(this._input.w=this._input.x=e,this._needsUpdate=!0)}get left(){return(this._input.w+this._input.x)/2}}class H{constructor(e,t){this._borderRadiuses=e,this._sideProperties=t,this._complementaryMediation=null,this._value=0}get value(){return this._value}set complementaryMediation(e){this._complementaryMediation=e}computeValue(){let e=0;for(const t of this._sideProperties)e+=this._borderRadiuses[t];this._value=e}mediate(e=!0){if(!(this._value<1)){for(const t of this._sideProperties)this._borderRadiuses[t]/=this._value;e&&this._complementaryMediation.mediate(!1)}}dispose(){this._complementaryMediation=null,this._borderRadiuses=null}}class Ws extends D{constructor(e){super("borderWidth",e,!1),this._valueUV=this._value.clone(),this.output=this._outputValue,this._units=B}set units(e){this._units=ze(e),this._needsUpdate=!0}get units(){return this._units}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0,e._bounds._needsUpdate=!0,e._layouter._needsUpdate=!0}_outputValue(e){e[this._id]=this._valueUV}process(e){this._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&(console.log("Percent"),console.log(this._valueUV)),this._units===B)t!==0&&(this._valueUV.w/=t,this._valueUV.y/=t),i!==0&&(this._valueUV.x/=i,this._valueUV.z/=i);else if(this._units===Oe){if(t!==0){const r=t>i?i/t:1;this._valueUV.y*=r,this._valueUV.w*=r}if(i!==0){const r=t<i?t/i:1;this._valueUV.x*=r,this._valueUV.z*=r}}}}class Ds extends p{constructor(e,t=!0){super("visible",t,!0),this._needsUpdate=!1}update(e,t){e.visible=this._value,e._parent._value&&(e._parent._value._children._needsUpdate=!0)}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}}class Ae extends T{constructor(e){super("backgroundColor",e,!1),this._input="transparent",this._allowsInherit=!1}computeOutputValue(e){e._backgroundMesh.visible=!(this._input==="none"||this._input==="transparent"),this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._input==="transparent"||this._input==="none"||this._value.set(this._input)}}class V extends p{constructor(e="untitled"){super(e,void 0,!1)}update(e,t){}output(e){}}class Es extends p{constructor(){super("inlineJustificator",null,!1),this._value=null}update(e,t){}process(e){const t=e._bounds._innerHeight,i=e._layouter._value,r=Math.abs(i.height);let n=(()=>{switch(e._alignItems._value){case"inherit":case"start":return t/2;case"end":return r-t/2;case"stretch":case"center":return r/2}})();const o=e._padding._value,h=e._borderWidth._value;n+=(-o.x+o.z)/2+(-h.x+h.z)/2,i.forEach(c=>{c.y+=n,c.forEach(d=>{d.offsetY+=n})})}}const Ls=["start","center","end","stretch"],Hs=function(s){return Ls.indexOf(s)===-1?(console.warn(`(.style) alignItems value '${s}' is not valid. Aborted`),!1):!0};class ne extends g{constructor(){super("alignItems","inherit",!0),this.isValidValue=Hs}}class oe extends g{constructor(){super("textAlign","inherit",!0),this.isValidValue=$s}}const Gs=["left","right","center","justify","justify-left","justify-right","justify-center"],$s=function(s){return Gs.indexOf(s)===-1?(console.warn(`(.style) textAlign value '${s}' is not valid. Aborted`),!1):!0};class ae extends g{constructor(){super("flexDirection","inherit",!0),this.isValid=Xs}}const js=["row","row-reverse","column","column-reverse"];function Xs(s){return js.indexOf(s)===-1?(console.warn(`(.style) flexDirection value '${s}' is not valid. Aborted`),!1):!0}class le extends g{constructor(){super("justifyContent","inherit",!0),this.isValidValue=Ns}}const Ys=["start","center","end","space-between","space-around","space-evenly"];function Ns(s){return Ys.indexOf(s)===-1?(console.warn(`(.style) justifyContent value '${s}' is not valid. Aborted`),!1):!0}class Ks extends g{constructor(){super("order",0,!0),this._value=0,this._input=0,this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._parent._value&&(e._parent._value._children._needsProcess=!0)}}class We extends g{constructor(){super("position","static",!0),this._allowsInherit=!1,this._value="static",this._needsUpdate=!1,this.computeOutputValue=this._computeFromInherited,this.isValidValue=Js}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value&&(e._parent._value._children._needsProcess=!0)}}const qs=["static","absolute"];function Js(s){return qs.indexOf(s)===-1?(console.warn(`(.style) position value '${s}' is not valid. Aborted`),!1):!0}class De extends g{constructor(e,t=null){super(e,t,!0),this._input="auto",this._auto=!0,this._relative=!1,this._updateRequired=!0}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._inline=e,this._input!==this._inline&&this._parseInput())}get inline(){return this._inline}_parseInput(){let e=!0;if(this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0?(this._computed===this._input&&(e=!1),this._input=this._computed):e=this._input==="inherit",e){if(this._auto=!this._input||this._input==="auto",this._auto)this._relative=!1;else if((typeof this._input=="string"||this._input instanceof String)&&this._input.endsWith("%")){this._relative=!0,this._value=0;const t=parseFloat(this._input.replace("%","").trim());isNaN(t)||(this._value=t/100)}else this._relative=!1,this._value=this._input;this._needsUpdate=this._updateRequired=e}}update(e,t){if(this._updateRequired){this._updateRequired=!1,this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i[`_${this._id}`]._needsUpdate=!0;this.output(t),e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}computeOutputValue(e){e._bounds._needsUpdate=!0,e._renderer._needsRender=!0}getInheritedInput(e){if(this._input!=="inherit"&&!this._auto)return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return 0}get value(){return this._value}}class Qs extends De{constructor(){super("width")}}class Zs extends De{constructor(){super("height")}computeOutputValue(e){super.computeOutputValue(e)}}class Ee extends V{constructor(){super("textContent"),this._needsUpdate=!1}set value(e){}process(e){let t="";for(let i=0;i<e.children.length;i++){const r=e.children[i];r.isUI&&(t+=r.textContent)}this._value=t}}class Le extends g{constructor(e){super("fontStyle",e,!0),this.isValidValue=ti}}const ei=["normal","italic"];function ti(s){return ei.indexOf(s)===-1?(console.warn(`(.style) fontStyle value '${s}' is not valid. Aborted`),!1):!0}class He extends g{constructor(){super("fontWeight","inherit",!0),this.isValid=ii}}const si=["100","200","300","400","500","600","700","800","900","light","normal","bold","bolder"];function ii(s){return si.indexOf(s.toString())===-1?(console.warn(`(.style) fontWeight value '${s}' is not valid. Aborted`),!1):!0}class Ge{constructor(){this._size=42,this._lineHeight=42,this._lineBase=38,this._name="-",this._charset=""}get size(){return this._size}get lineHeight(){return this._lineHeight}get lineBase(){return this._lineBase}get name(){return this._name}get charset(){return this._charset}}class ri extends Ge{constructor(e){super(),this._size=e.info.size,this._lineHeight=e.common.lineHeight,this._lineBase=e.common.base,this._name=e.info.face,this._textureWidth=e.common.scaleW,this._textureHeight=e.common.scaleH,this._charset=e.chars.map(t=>t.char).join("")}get textureWidth(){return this._textureWidth}get textureHeight(){return this._textureHeight}}class ni extends Fe{constructor(e){super(e)}get uv(){return this.typographic.uv}}class q extends Te{constructor(e,t){super(e),this._char=t.char,this._width=t.width,this._heigth=t.height,this._xadvance=t.xadvance?t.xadvance:this._width,this._xoffset=t.xoffset?t.xoffset:0,this._yoffset=t.yoffset?t.yoffset:0,this._uv=t.uv?t.uv:null,isNaN(t.x)||(this._uv={left:t.x/e.textureWidth,right:(t.x+t.width)/e.textureWidth,top:1-(t.y+t.height)/e.textureHeight,bottom:1-t.y/e.textureHeight})}get uv(){return this._uv}clone(e){return new q(this._font,{char:e,width:this._width,height:this._heigth,xadvance:this._xadvance,xoffset:this._xoffset,yoffset:this._yoffset,uv:null})}asInlineGlyph(){return new ni(this)}}class oi extends a.PlaneGeometry{constructor(e,t){let i=1,r=1;const n=e.typographic.font.size,o=t._segments.value;i=Math.ceil(e.typographic.width/n*o),r=Math.ceil(e.typographic.height/n*o),super(e.width,e.height,i,r),e.uv?(this._mapUVs(e),this._transformGeometry(e)):(this._nullifyUVs(),this.scale(0,0,1),this.translate(0,e.fontSize/2,0)),this.name="GlyphGeometry"}_mapUVs(e){const t=e.uv.right-e.uv.left,i=e.uv.bottom-e.uv.top,r=this.getAttribute("uv").array.slice(),n=[];for(let o=0;o<r.length;o+=2){const h=r[o],c=r[o+1];n.push(e.uv.left+t*h),n.push(e.uv.top+i*c)}this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(n),2))}_nullifyUVs(){const e=[],t=this.getAttribute("uv").array.length;for(let i=0;i<t;i++)e.push(0);this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(e),2))}_transformGeometry(e){this.translate(e.width/2,-e.height/2,0)}}const ai=`
3
3
  attribute vec2 uvG;
4
4
  varying vec2 vUvG;
@@ -1,4 +1,4 @@
1
- "use strict";var Mt=Object.defineProperty;var Ft=(i,e,t)=>e in i?Mt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var C=(i,e,t)=>Ft(i,typeof e!="symbol"?e+"":e,t);const m=require("./three-f-JuZtOs.umd.cjs");var k={};k.d=(i,e)=>{for(var t in e)k.o(e,t)&&!k.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:e[t]})};k.o=(i,e)=>Object.prototype.hasOwnProperty.call(i,e);k.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var v={};k.d(v,{ti:()=>p,nS:()=>xt,eB:()=>F,Yp:()=>ae,VB:()=>R,BC:()=>z,zN:()=>B,cV:()=>A,hW:()=>L,k2:()=>Ee,K6:()=>S,M7:()=>ue,ls:()=>W,Hi:()=>st,EY:()=>O,MR:()=>Ke,zf:()=>We,Ay:()=>qr,yo:()=>wt});var ae={};k.r(ae);k.d(ae,{get:()=>Le,set:()=>Ot});var ue={};k.r(ue);k.d(ue,{alphaTestTransformer:()=>q,asPreprocessorValueTransformer:()=>qe,toPreprocessorTriggerTransformer:()=>ye,toUserDataTransformer:()=>ji,uniformOrUserDataTransformer:()=>w});const ne={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
1
+ "use strict";var Mt=Object.defineProperty;var Ft=(i,e,t)=>e in i?Mt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var C=(i,e,t)=>Ft(i,typeof e!="symbol"?e+"":e,t);const m=require("./three-DMrv-4ar.umd.cjs");var k={};k.d=(i,e)=>{for(var t in e)k.o(e,t)&&!k.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:e[t]})};k.o=(i,e)=>Object.prototype.hasOwnProperty.call(i,e);k.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var v={};k.d(v,{ti:()=>p,nS:()=>xt,eB:()=>F,Yp:()=>ae,VB:()=>R,BC:()=>z,zN:()=>B,cV:()=>A,hW:()=>L,k2:()=>Ee,K6:()=>S,M7:()=>ue,ls:()=>W,Hi:()=>st,EY:()=>O,MR:()=>Ke,zf:()=>We,Ay:()=>qr,yo:()=>wt});var ae={};k.r(ae);k.d(ae,{get:()=>Le,set:()=>Ot});var ue={};k.r(ue);k.d(ue,{alphaTestTransformer:()=>q,asPreprocessorValueTransformer:()=>qe,toPreprocessorTriggerTransformer:()=>ye,toUserDataTransformer:()=>ji,uniformOrUserDataTransformer:()=>w});const ne={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
2
2
  `,whiteSpace:"pre-line",flexDirection:"column",justifyContent:"start",alignItems:"start",backgroundImage:null,textAlign:"left",boxSizing:"content-box",position:"static",color:16777215,fontColor:16777215,fontOpacity:1,opacity:1,fontPXRange:4,fontSupersampling:!0,fontSmooth:"antialiased",borderRadius:0,borderWidth:0,borderColor:"black",borderOpacity:1,backgroundSize:"cover",backgroundColor:0,backgroundOpacity:0,overflow:"visible",letterSpacing:0,invertAlpha:!1,segments:1},Ot=function(i){for(const e in i)ne[e]=i[e]},Le=function(i){return Object.prototype.hasOwnProperty.call(ne,i)||console.warn(`ThreeMeshUI::DefaultValues is trying to retrieve non-existing property '${i}'`),ne[i]};class p{constructor(e,t=null,s=!0){this._id=e,this._value=t,this._needsUpdate=!0,this._needsProcess=!1,this._needsRender=!1,this._isPrimitive=s}get id(){return this._id}get value(){return this._value}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this.output(t)}output(e){}_outputValue(e){e[this._id]=this._value}process(e){}render(e){}getInheritedInput(e){if(this._value!=="inherit")return this._value;const t=e._parent._value;return t&&t[`_${this._id}`]?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return Le(this._id)}isValid(e){return!0}emptyStrategyLogic(){throw new Error(`ThreeMeshUI::${this.constructor.name} has empty strategy. Update has not been processed.`)}requestUpdate(){this._needsUpdate=!0}requestProcess(){this._needsProcess=!1}requestRender(){this._needsRender=!1}}class Lt extends p{constructor(){super("renderOrder","auto",!0),this.output=this._outputValue,this._actualValue=0}set value(e){this.isValid(e)&&(this._value=e,this._needsUpdate=!0)}update(e,t){if(this._value!=="auto")this._actualValue=this._value;else{const s=e._parent._value;if(s!==null){const r=s._renderOrder._actualValue,n=1+s._children._uis.indexOf(e);this._actualValue=r+n}}for(const s of e._children._uis)s._renderOrder._value==="auto"&&(s._renderOrder._needsUpdate=!0);this._outputValue(t)}_outputValue(e){e[this._id]=this._actualValue}get value(){return this._value}}class B extends p{constructor(e,t=null,s=!0){super(e,t,s),this.output=this._outputValue,this._notInheritedValue=null}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),this.propagate(e),this._outputValue(t)}propagate(e){for(const t of e._children._uis){const s=t[`_${this._id}`];s!==void 0&&s._value==="inherit"&&(t[`_${this._id}`]._needsUpdate=!0)}}_outputValue(e){e[this._id]=this._notInheritedValue}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class zt extends B{constructor(){super("offset","inherit",!1)}update(e,t){super.update(e,t),e._parent._value!==null&&(e.position.z=this._notInheritedValue)}}class Wt extends B{constructor(){super("fontSmooth","inherit",!0),this._needsUpdate=!1,this.isValid=Dt,this.output=this._outputValue}}const Et=["inherit","none","antialiased"];function Dt(i){return Et.indexOf(i)===-1?(console.warn(`.fontSmoothing value '${i}' is not valid. Aborted`),!1):!0}var Ht=i=>{var e={};return k.d(e,i),e};const u=Ht({BackSide:()=>m.BackSide,BufferAttribute:()=>m.BufferAttribute,BufferGeometry:()=>m.BufferGeometry,Color:()=>m.Color,DoubleSide:()=>m.DoubleSide,EventDispatcher:()=>m.EventDispatcher,FileLoader:()=>m.FileLoader,FrontSide:()=>m.FrontSide,LinearFilter:()=>m.LinearFilter,Mesh:()=>m.Mesh,MeshBasicMaterial:()=>m.MeshBasicMaterial,Object3D:()=>m.Object3D,Plane:()=>m.Plane,PlaneGeometry:()=>m.PlaneGeometry,ShaderMaterial:()=>m.ShaderMaterial,Texture:()=>m.Texture,TextureLoader:()=>m.TextureLoader,Vector2:()=>m.Vector2,Vector3:()=>m.Vector3,Vector4:()=>m.Vector4});class g extends p{constructor(e,t,s=!0){super(e,"unset",s),this._input="inherit",this._allowsInherit=!0,this._inheritedInput=void 0,this._inline=void 0}update(e,t){this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const s of e._children._uis){const r=s[`_${this._id}`];(r._input?r._input:r._value)==="inherit"&&(s[`_${this._id}`]._needsUpdate=!0)}this.output(t)}computeOutputValue(e){this._value=this._input}_computeFromInherited(e){this._value=this._inheritedInput}set value(e){console.warn(".(style) sub-property cannot be directly set. It must comes from inline or computed setter.")}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._input=this._inline=e,this._needsUpdate=!0)}get inline(){return this._inline}isValidValue(e){return!0}getInheritedInput(e){if(this._input!=="inherit")return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}}class K extends g{constructor(e,t){super(e,t,!1),this._input=new u.Vector4(0,0,0,0),this._inline=null,this._value=new u.Vector4(0,0,0,0)}get value(){return this._value}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input)}set inline(e){this._vector4ValueSetter(this._input,e),!this._input.equals(this._value)&&(this._needsUpdate=!0)}set top(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get top(){return this._input.x}set right(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get right(){return this._input.y}set bottom(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottom(){return this._input.z}set left(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get left(){return this._input.w}dispose(){this._computed=null,this._inline=null,this._input=null,this._output=null}_vector4ValueSetter(e,t){if(t instanceof u.Vector4){e.copy(t);return}if((typeof t=="string"||t instanceof String)&&(t=t.split(" ")),Array.isArray(t))switch(t=t.map(s=>parseFloat(s)),t.length){case 1:e.setScalar(t[0]);return;case 2:e.x=e.z=t[0],e.y=e.w=t[1];return;case 3:e.x=t[0],e.y=t[1],e.z=t[2];return;case 4:e.x=t[0],e.y=t[1],e.z=t[2],e.w=t[3];return;default:console.error("StyleVector4Property::set() Four Dimension property had more than four values");return}isNaN(t)||e.setScalar(t)}}class Gt extends K{constructor(){super("padding",new u.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._bounds._needsUpdate=!0,e._bounds._needsRender=!0,e._layouter._needsProcess=!0,e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}class $t extends K{constructor(){super("margin",new u.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._flexDirection._needsProcess=!0)}}const Re=function(i,e,t){i[e]=t},Nt=function(i,e,t){t!==null&&(i[e]=t)};class E{constructor(e){this._definition=e}set definition(e){this._definition=e}mediate(e,t,s,r=null){for(const n in this._definition){const o=this._definition[n];if(s[n]!==void 0){const a=o.t?o.t:Re;a(t,o.m,s[n]),r&&a(r,o.m,s[n])}}}static mediate(e,t,s,r,n=null){if(t)for(const o in r){const a=r[o];if(s[o]!==void 0){const l=a.t?a.t:Re;l(t,a.m,s[o]),n&&l(n,a.m,s[o])}}}}class Xt extends p{constructor(){super("parent",null,!1)}update(e,t){e.parent&&e.parent.isUI?this._value=e.parent:this._value=null}set value(e){console.warn("ParentProperty is readonly")}get value(){return this._value}find(e){return this._value?e(this._value)?this._value:this._value._parent.find(e):null}dispose(){this._value=null}}const oe=function(i,e,t=6){return i.toFixed(t)===e.toFixed(t)};class Be extends p{constructor(e,t){super(e,t,!0),this.output=this._outputValue}set value(e){this.isValid(e)&&(oe(this._value,e)||(this._value=e,this._needsUpdate=!0))}get value(){return this._value}}class Ue extends B{constructor(e){super(e,"inherit",!0),this.isValid=Yt}}const jt=[u.FrontSide,u.BackSide,u.DoubleSide];function Yt(i){return jt.indexOf(i)===-1?(console.warn(`SideProperty value '${i}' is not valid. Abort`),!1):!0}class ze{constructor(){this._offsetX=0,this._offsetY=0,this._lineBreak=null,this._kerning=0,this._fontFactor=1,this._fontSize=0,this._cumulativeWidth=0,this._paddingLeft=0,this._paddingRight=0,this._marginLeft=0,this._marginRight=0}resetOffsets(){this._offsetX=this._offsetY=0,this._cumulativeWidth=0}get xadvance(){return 0}get xoffset(){return 0}get yoffset(){return 0}get width(){return 0}get height(){return 0}set lineBreak(e){this._lineBreak=e}get lineBreak(){return this._lineBreak}get anchor(){return 0}get kerning(){return this._kerning*this._fontFactor}set kerning(e){this._kerning=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get lineHeight(){return 0}get offsetX(){return this._offsetX}set offsetX(e){this._offsetX=e}get offsetY(){return this._offsetY}set offsetY(e){this._offsetY=e}get cumulativeWidth(){return this._cumulativeWidth}set cumulativeWidth(e){this._cumulativeWidth=e}get marginLeft(){return this._marginLeft}set marginLeft(e){this._marginLeft=e}get marginRight(){return this._marginRight}set marginRight(e){this._marginRight=e}get paddingLeft(){return this._paddingLeft}set paddingLeft(e){this._paddingLeft=e}get paddingRight(){return this._paddingRight}set paddingRight(e){this._paddingRight=e}get lineBase(){return 0}set fontFactor(e){this._fontFactor=e}get fontFactor(){return this._fontFactor}}class We{constructor(e){this._char="",this._width=1,this._heigth=1,this._xadvance=1,this._xoffset=0,this._yoffset=0,this._font=e}get font(){return this._font}get char(){return this._char}get width(){return this._width}get height(){return this._heigth}get xadvance(){return this._xadvance}get xoffset(){return this._xoffset}get yoffset(){return this._yoffset}set yoffset(e){this._yoffset=e}clone(e){throw new Error("Abstract... Need to be implemented")}asInlineGlyph(){throw new Error("Abstract... Need to be implemented")}}class Ee extends ze{constructor(e){super(),this._typographic=e}get typographic(){return this._typographic}get xadvance(){return this._typographic.xadvance*this._fontFactor}get xoffset(){return this._typographic.xoffset*this._fontFactor}get yoffset(){return this._typographic.yoffset*this._fontFactor}get width(){return this._typographic.width*this._fontFactor}get height(){return this._typographic.height*this._fontFactor}get char(){return this._typographic.char}get anchor(){return this.yoffset}get lineHeight(){return this._typographic.font.lineHeight*this._fontFactor}get lineBase(){return this._typographic.font.lineBase*this._fontFactor}}const Kt={light:"100",normal:"400",bold:"700",bolder:"900"};function he(i){if(!isNaN(i))return i.toString();const e=Kt[i];return e||i}class qt extends u.EventDispatcher{constructor(e,t){super(),this._isReady=!1,this._weight=he(e),this._style=t,this._size=42,this._lineHeight=42,this._lineBase=42,this._font=null}get typographic(){return this._font}get isReady(){return this._isReady}get weight(){return this._weight}get style(){return this._style}get texture(){return this._texture}set fontMaterial(e){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get fontMaterial(){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get id(){return`${this._name}(w:${this.weight},s:${this.style})`}getTypographicGlyph(e){let t=this._chars[e];if(t)return t;if(e.match(/\s/))return this._chars[" "];const s=this._getFallbackCharacter(e);if(s&&(t=this._chars[s],t))return t;throw Error(`FontVariant('${this.id}')::getTypographicGlyph() - character('${e}') and/or fallback character were not found in provided msdf charset.`)}_getFallbackCharacter(e){throw new Error(`FontVariant(${typeof this})::_getFallbackCharacter() is abstract and should therefore be overridden.`)}getGeometricGlyph(e,t){throw new Error(`FontVariant(${typeof this})::getGeometryCharacter() is abstract and should therefore be overridden.`)}getKerningAmount(e){return this._kernings[e]?this._kernings[e]:0}adjustTypographicGlyphs(e){for(const t in e){const s=this.getTypographicGlyph(t),r=e[t];for(const n in r)s["_"+n]=e[t][n]}}_checkReadiness(){this._readyCondition()&&Zt(this)}_alterElementProperties(e){throw new Error(`FontVariant(${typeof this})::_alterElementProperties() is abstract and should therefore be overridden.`)}_readyCondition(){throw new Error(`FontVariant(${typeof this})::_readyCondition() is abstract and should therefore be overridden.`)}}const Jt={type:"ready"};function Zt(i){i._isReady=!0,i.dispatchEvent(Jt)}const z=qt;class Qt extends p{constructor(e=null){super("font",e,!1),this._needsUpdate=!1,this._fontVariant=null,this._handleFontReadyClosure=null,this.isValid=ei}output(e){e[this._id]=this._fontVariant}update(e,t){if(this._fontVariant&&!this._fontVariant.isReady&&this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._value&&this._value instanceof z)this._fontVariant=this._value;else{const s=e._fontFamily._value;s&&(this._fontVariant=s.getVariant(e._fontWeight._value,e._fontStyle._value))}this._fontVariant&&(this._fontVariant._alterElementProperties(e),this._handleFontReadyClosure=ti(e,this),this._fontVariant.isReady?this._handleFontReadyClosure():this._fontVariant.addEventListener("ready",this._handleFontReadyClosure),(!e._fontMaterial._defaultMaterial||!(e._fontMaterial._defaultMaterial instanceof this._fontVariant.fontMaterial))&&(e._fontMaterial._defaultMaterial=new this._fontVariant.fontMaterial,e._fontMaterial._needsUpdate=!0))}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}get fontVariant(){return this._fontVariant}dispose(){this._handleFontReadyClosure&&(this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._handleFontReadyClosure=null),this._value=null,this._fontVariant=null}}function ei(i){return i instanceof z?!0:(console.warn(`.font value '${i}' is not valid. It requires a FontVariant instance. Aborted`),!1)}function ti(i,e){return function(){e._needsUpdate=!0,i._glyphs._needsProcess=!0,e._fontVariant.removeEventListener("ready",e._handleFontReadyClosure),e._handleFontReadyClosure=null}}class ii extends g{constructor(e){super("display",e),this._value="flex",this._allowsInherit=!1,this._needsUpdate=!1,this.isValidValue=ri}computeOutputValue(e){e._visible._value=this._output!=="none"}}const si=["none","flex"];function ri(i){return si.indexOf(i)===-1?(console.warn(`(.style) display value '${i}' is not valid. Aborted`),!1):!0}class ni extends g{constructor(e){super("boxSizing",e),this._allowsInherit=!1,this.isValidValue=ai}computeOutputValue(e){this._value=this._inheritedInput,e._bounds._needsUpdate=!0}}const oi=["border-box","content-box"];function ai(i){return oi.indexOf(i)===-1?(console.warn(`(.style) boxSizing value '${i}' is not valid. Aborted`),!1):!0}class T extends g{constructor(e,t){super(e,t,!1),this._value=new u.Color,this.output=this._outputValue}computeOutputValue(e){this._input!=="inherit"&&this._value.set(this._input)}set inline(e){this._input=this._inline=e,this._needsUpdate=!0}}class ee extends g{constructor(e,t){super(e,t,!0),this.isValidValue=ui,this._allowsInherit=!1,this._input=t,this._value=t,this.output=this._outputValue,this.computeOutputValue=this._computeFromInherited}_outputValue(e){e[this._id]=this._inheritedInput}}function ui(i){return i<0&&i>1?(console.warn(`(.style) styleFactorProperty('${this.id}') value '${i}' is not valid)`),!1):!0}class hi extends g{constructor(e){super("backgroundImage",e,!0),this._input=null,this._allowsInherit=!1,this._textureSize=new u.Vector2(1,1),this.isValidValue=li}get value(){return this._value}output(e){e[this._id]=this._value,e.tSize=this._textureSize}computeOutputValue(e){if(this._value=this._inheritedInput,this._value instanceof u.Texture&&!this._value.image){console.warn("ThreeMeshUI - .backgroundImage :: Please provide preloaded texture in order to have accurate sizing.");return}this._needsProcess=!0}process(e){this._value?this._textureSize.set(this._value.image.width,this._value.image.height):this._textureSize.set(1,1)}}function li(i){return!0}class ci extends g{constructor(e){super("backgroundSize",e,!0),this.isValidValue=_i,this.output=this._outputValue}}const di=["cover","contain","stretch"];function _i(i){return di.indexOf(i)===-1?(console.warn(`(.style) backgroundSize value '${i}' is not valid. Aborted`),!1):!0}class fi extends g{constructor(e){super("overflow",e,!0),this.isValidValue=gi,this._clippingPlanes=null,this._renderStrategy=this._emptyRender}update(e,t){this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0&&(this._input=this._computed),this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const s of e._children._uis)s._overflow._needsUpdate=!0;this.output(t)}output(e){e.clippingPlanes=this._clippingPlanes}computeOutputValue(e){super.computeOutputValue(e),this._value==="hidden"?this._renderStrategy=this._propagateRender:(this._renderStrategy=this._emptyRender,this._clippingPlanes=null);const t=e._parent._value;if(t!==null){const s=t._overflow;if((s._value==="hidden"||s._clippingPlanes!==null)&&!this._clippingPlanes){this._clippingPlanes=[new u.Plane(new u.Vector3(0,-1,0),1),new u.Plane(new u.Vector3(-1,0,0),1),new u.Plane(new u.Vector3(0,1,0),1),new u.Plane(new u.Vector3(1,0,0),1)];for(let r=0;r<this._clippingPlanes.length;r++)this._clippingPlanes[r].parent=t;s._clippingPlanes!==null&&this._clippingPlanes.push(...s._clippingPlanes),this._renderStrategy=this._hiddenRender,this._needsRender=!0}else(s._value==="visible"||s._clippingPlanes===null)&&this._clippingPlanes!==null&&(this._clippingPlanes=null,this._renderStrategy=this._emptyRender,this._needsRender=!0)}}render(e){this._renderStrategy(e)}_emptyRender(e){}_hiddenRender(e){const t=e._parent._value,s=t._bounds._offsetHeight,r=t._bounds._offsetWidth,n=t._padding._value,o=t._borderWidth._value;for(let a=0;a<4&&a<this._clippingPlanes.length;a++){const l=this._clippingPlanes[a];switch(a%4){case 0:l.constant=s/2-(n.x+o.x);break;case 1:l.constant=r/2-(n.y+o.y);break;case 2:l.constant=s/2-(n.z+o.z);break;case 3:l.constant=r/2-(n.w+o.w);break}l.applyMatrix4(t.matrixWorld)}for(let a=0;a<e._children._uis.length;a++){const l=e._children._uis[a];l._overflow._needsRender=!0}}_propagateRender(e){for(let t=0;t<e._children._uis.length;t++){const s=e._children._uis[t];s._overflow._needsRender=!0}}}const pi=["visible","hidden"];function gi(i){return pi.indexOf(i)===-1?(console.warn(`(.style) overflow value '${i}' is not valid. Aborted`),!1):!0}const U="rem",De="em",N="%",mi=[U,De,N],He=function(i){return mi.indexOf(i)===-1?U:i};class vi extends K{constructor(e){super("borderRadius",e),this._valueUV=this._value.clone(),this._input=new u.Vector4(0,0,0,0),this._mediation=!0,this._cornerTL=new u.Vector2(0,1),this._cornerTR=new u.Vector2(1,1),this._cornerBR=new u.Vector2(1,0),this._cornerBL=new u.Vector2(0,0);const t=new D(this._valueUV,["x","y"]),s=new D(this._valueUV,["z","w"]),r=new D(this._valueUV,["x","w"]),n=new D(this._valueUV,["y","z"]);t.complementaryMediation=s,s.complementaryMediation=t,r.complementaryMediation=n,n.complementaryMediation=r,this._sideMediators=[t,s,r,n],this._units=U}set units(e){this._units=He(e),this._needsProcess=!0}get units(){return this._units}set mediation(e){e!==this._mediation&&(this._mediation=e,this._needsUpdate=!0)}get mediation(){return this._mediation}output(e){e.cornerTL=this._cornerTL,e.cornerTR=this._cornerTR,e.cornerBR=this._cornerBR,e.cornerBL=this._cornerBL}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0}process(e){this._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,s=e._bounds._offsetHeight;if(this._units===N&&this._valueUV.divideScalar(100),this._units===U&&this._valueUV.divideScalar(Math.min(t,s)),this._mediation)do this._sideMediators.forEach(o=>o.computeValue()),this._sideMediators.sort((o,a)=>o.value<a.value?1:-1),this._sideMediators[0].value>1&&this._sideMediators[0].mediate();while(this._sideMediators[0].value>1);let r=t>s?s/t:1,n=t<s?t/s:1;this._units===N&&(r=n=1),this._cornerTL.x=this._valueUV.x*r,this._cornerTL.y=1-this._valueUV.x*n,this._cornerTR.x=1-this._valueUV.y*r,this._cornerTR.y=1-this._valueUV.y*n,this._cornerBR.x=1-this._valueUV.z*r,this._cornerBR.y=this._valueUV.z*n,this._cornerBL.x=this._valueUV.w*r,this._cornerBL.y=this._valueUV.w*n}dispose(){for(const e of this._sideMediators)e.dispose();this._sideMediators=null,this._cornerTL=null,this._cornerTR=null,this._cornerBR=null,this._cornerBL=null,super.dispose()}set topLeft(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get topLeft(){return this._input.x}set topRight(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get topRight(){return this._input.y}set bottomRight(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottomRight(){return this._input.z}set bottomLeft(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get bottomLeft(){return this._input.w}set top(e){this._input.x===e&&this._input.y===e||(this._input.x=this._input.y=e,this._needsUpdate=!0)}get top(){return(this._input.x+this._input.y)/2}set right(e){this._input.y===e&&this._input.z===e||(this._input.y=this._input.z=e,this._needsUpdate=!0)}get right(){return(this._input.y+this._input.z)/2}set bottom(e){this._input.z===e&&this._input.w===e||(this._input.z=this._input.w=e,this._needsUpdate=!0)}get bottom(){return(this._input.z+this._input.w)/2}set left(e){this._input.w===e&&this._input.x===e||(this._input.w=this._input.x=e,this._needsUpdate=!0)}get left(){return(this._input.w+this._input.x)/2}}class D{constructor(e,t){this._borderRadiuses=e,this._sideProperties=t,this._complementaryMediation=null,this._value=0}get value(){return this._value}set complementaryMediation(e){this._complementaryMediation=e}computeValue(){let e=0;for(const t of this._sideProperties)e+=this._borderRadiuses[t];this._value=e}mediate(e=!0){if(!(this._value<1)){for(const t of this._sideProperties)this._borderRadiuses[t]/=this._value;e&&this._complementaryMediation.mediate(!1)}}dispose(){this._complementaryMediation=null,this._borderRadiuses=null}}class yi extends K{constructor(e){super("borderWidth",e,!1),this._valueUV=this._value.clone(),this.output=this._outputValue,this._units=U}set units(e){this._units=He(e),this._needsUpdate=!0}get units(){return this._units}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0,e._bounds._needsUpdate=!0,e._layouter._needsUpdate=!0}_outputValue(e){e[this._id]=this._valueUV}process(e){this._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,s=e._bounds._offsetHeight;if(this._units===N&&(console.log("Percent"),console.log(this._valueUV)),this._units===U)t!==0&&(this._valueUV.w/=t,this._valueUV.y/=t),s!==0&&(this._valueUV.x/=s,this._valueUV.z/=s);else if(this._units===De){if(t!==0){const r=t>s?s/t:1;this._valueUV.y*=r,this._valueUV.w*=r}if(s!==0){const r=t<s?t/s:1;this._valueUV.x*=r,this._valueUV.z*=r}}}}class bi extends p{constructor(e,t=!0){super("visible",t,!0),this._needsUpdate=!1}update(e,t){e.visible=this._value,e._parent._value&&(e._parent._value._children._needsUpdate=!0)}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}}class Ge extends T{constructor(e){super("backgroundColor",e,!1),this._input="transparent",this._allowsInherit=!1}computeOutputValue(e){e._backgroundMesh.visible=!(this._input==="none"||this._input==="transparent"),this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._input==="transparent"||this._input==="none"||this._value.set(this._input)}}class I extends p{constructor(e="untitled"){super(e,void 0,!1)}update(e,t){}output(e){}}class xi extends p{constructor(){super("inlineJustificator",null,!1),this._value=null}update(e,t){}process(e){const t=e._bounds._innerHeight,s=e._layouter._value,r=Math.abs(s.height);let n=(()=>{switch(e._alignItems._value){case"inherit":case"start":return t/2;case"end":return r-t/2;case"stretch":case"center":return r/2}})();const o=e._padding._value,a=e._borderWidth._value;n+=(-o.x+o.z)/2+(-a.x+a.z)/2,s.forEach(l=>{l.y+=n,l.forEach(d=>{d.offsetY+=n})})}}const wi=["start","center","end","stretch"],Si=function(i){return wi.indexOf(i)===-1?(console.warn(`(.style) alignItems value '${i}' is not valid. Aborted`),!1):!0};class le extends g{constructor(){super("alignItems","inherit",!0),this.isValidValue=Si}}class ce extends g{constructor(){super("textAlign","inherit",!0),this.isValidValue=ki}}const Vi=["left","right","center","justify","justify-left","justify-right","justify-center"],ki=function(i){return Vi.indexOf(i)===-1?(console.warn(`(.style) textAlign value '${i}' is not valid. Aborted`),!1):!0};class de extends g{constructor(){super("flexDirection","inherit",!0),this.isValid=Ii}}const Pi=["row","row-reverse","column","column-reverse"];function Ii(i){return Pi.indexOf(i)===-1?(console.warn(`(.style) flexDirection value '${i}' is not valid. Aborted`),!1):!0}class _e extends g{constructor(){super("justifyContent","inherit",!0),this.isValidValue=Ri}}const Ci=["start","center","end","space-between","space-around","space-evenly"];function Ri(i){return Ci.indexOf(i)===-1?(console.warn(`(.style) justifyContent value '${i}' is not valid. Aborted`),!1):!0}class Bi extends g{constructor(){super("order",0,!0),this._value=0,this._input=0,this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._parent._value&&(e._parent._value._children._needsProcess=!0)}}class $e extends g{constructor(){super("position","static",!0),this._allowsInherit=!1,this._value="static",this._needsUpdate=!1,this.computeOutputValue=this._computeFromInherited,this.isValidValue=Ai}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value&&(e._parent._value._children._needsProcess=!0)}}const Ui=["static","absolute"];function Ai(i){return Ui.indexOf(i)===-1?(console.warn(`(.style) position value '${i}' is not valid. Aborted`),!1):!0}class Ne extends g{constructor(e,t=null){super(e,t,!0),this._input="auto",this._auto=!0,this._relative=!1,this._updateRequired=!0}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._inline=e,this._input!==this._inline&&this._parseInput())}get inline(){return this._inline}_parseInput(){let e=!0;if(this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0?(this._computed===this._input&&(e=!1),this._input=this._computed):e=this._input==="inherit",e){if(this._auto=!this._input||this._input==="auto",this._auto)this._relative=!1;else if((typeof this._input=="string"||this._input instanceof String)&&this._input.endsWith("%")){this._relative=!0,this._value=0;const t=parseFloat(this._input.replace("%","").trim());isNaN(t)||(this._value=t/100)}else this._relative=!1,this._value=this._input;this._needsUpdate=this._updateRequired=e}}update(e,t){if(this._updateRequired){this._updateRequired=!1,this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const s of e._children._uis)s[`_${this._id}`]._needsUpdate=!0;this.output(t),e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}computeOutputValue(e){e._bounds._needsUpdate=!0,e._renderer._needsRender=!0}getInheritedInput(e){if(this._input!=="inherit"&&!this._auto)return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return 0}get value(){return this._value}}class Ti extends Ne{constructor(){super("width")}}class Mi extends Ne{constructor(){super("height")}computeOutputValue(e){super.computeOutputValue(e)}}class Xe extends I{constructor(){super("textContent"),this._needsUpdate=!1}set value(e){}process(e){let t="";for(let s=0;s<e.children.length;s++){const r=e.children[s];r.isUI&&(t+=r.textContent)}this._value=t}}class je extends g{constructor(e){super("fontStyle",e,!0),this.isValidValue=Oi}}const Fi=["normal","italic"];function Oi(i){return Fi.indexOf(i)===-1?(console.warn(`(.style) fontStyle value '${i}' is not valid. Aborted`),!1):!0}class Ye extends g{constructor(){super("fontWeight","inherit",!0),this.isValid=zi}}const Li=["100","200","300","400","500","600","700","800","900","light","normal","bold","bolder"];function zi(i){return Li.indexOf(i.toString())===-1?(console.warn(`(.style) fontWeight value '${i}' is not valid. Aborted`),!1):!0}class Ke{constructor(){this._size=42,this._lineHeight=42,this._lineBase=38,this._name="-",this._charset=""}get size(){return this._size}get lineHeight(){return this._lineHeight}get lineBase(){return this._lineBase}get name(){return this._name}get charset(){return this._charset}}class Wi extends Ke{constructor(e){super(),this._size=e.info.size,this._lineHeight=e.common.lineHeight,this._lineBase=e.common.base,this._name=e.info.face,this._textureWidth=e.common.scaleW,this._textureHeight=e.common.scaleH,this._charset=e.chars.map(t=>t.char).join("")}get textureWidth(){return this._textureWidth}get textureHeight(){return this._textureHeight}}class Ei extends Ee{constructor(e){super(e)}get uv(){return this.typographic.uv}}class X extends We{constructor(e,t){super(e),this._char=t.char,this._width=t.width,this._heigth=t.height,this._xadvance=t.xadvance?t.xadvance:this._width,this._xoffset=t.xoffset?t.xoffset:0,this._yoffset=t.yoffset?t.yoffset:0,this._uv=t.uv?t.uv:null,isNaN(t.x)||(this._uv={left:t.x/e.textureWidth,right:(t.x+t.width)/e.textureWidth,top:1-(t.y+t.height)/e.textureHeight,bottom:1-t.y/e.textureHeight})}get uv(){return this._uv}clone(e){return new X(this._font,{char:e,width:this._width,height:this._heigth,xadvance:this._xadvance,xoffset:this._xoffset,yoffset:this._yoffset,uv:null})}asInlineGlyph(){return new Ei(this)}}class Di extends u.PlaneGeometry{constructor(e,t){let s=1,r=1;const n=e.typographic.font.size,o=t._segments.value;s=Math.ceil(e.typographic.width/n*o),r=Math.ceil(e.typographic.height/n*o),super(e.width,e.height,s,r),e.uv?(this._mapUVs(e),this._transformGeometry(e)):(this._nullifyUVs(),this.scale(0,0,1),this.translate(0,e.fontSize/2,0)),this.name="GlyphGeometry"}_mapUVs(e){const t=e.uv.right-e.uv.left,s=e.uv.bottom-e.uv.top,r=this.getAttribute("uv").array.slice(),n=[];for(let o=0;o<r.length;o+=2){const a=r[o],l=r[o+1];n.push(e.uv.left+t*a),n.push(e.uv.top+s*l)}this.setAttribute("uvG",new u.BufferAttribute(new Float32Array(n),2))}_nullifyUVs(){const e=[],t=this.getAttribute("uv").array.length;for(let s=0;s<t;s++)e.push(0);this.setAttribute("uvG",new u.BufferAttribute(new Float32Array(e),2))}_transformGeometry(e){this.translate(e.width/2,-e.height/2,0)}}const Hi=`
3
3
  attribute vec2 uvG;
4
4
  varying vec2 vUvG;
@@ -1,4 +1,4 @@
1
- import { PlaneGeometry as Eo, ShaderChunk as Fa, Object3D as ko, Layers as Ir, MeshBasicMaterial as Ss, DoubleSide as Nn, AdditiveBlending as Ao, InstancedBufferAttribute as Pe, DynamicDrawUsage as gt, InstancedBufferGeometry as Da, Uniform$1 as Lt, ShaderMaterial as Un, BufferGeometry as Ci, BufferAttribute as Mt, Mesh as cs, MeshStandardMaterial as La, MeshPhysicalMaterial as Va, Triangle as Ie, Vector3 as N, Plane as Ro, Line3 as pe, Vector2 as Ye, Sphere as zo, Matrix4 as Jt, Box3 as Kt, BackSide as Ja, REVISION as Ga, FrontSide as bs, BatchedMesh as ja, Ray as $a, Matrix3 as qa, Vector4 as ls } from "./three-1JG7vpNC.js";
1
+ import { PlaneGeometry as Eo, ShaderChunk as Fa, Object3D as ko, Layers as Ir, MeshBasicMaterial as Ss, DoubleSide as Nn, AdditiveBlending as Ao, InstancedBufferAttribute as Pe, DynamicDrawUsage as gt, InstancedBufferGeometry as Da, Uniform$1 as Lt, ShaderMaterial as Un, BufferGeometry as Ci, BufferAttribute as Mt, Mesh as cs, MeshStandardMaterial as La, MeshPhysicalMaterial as Va, Triangle as Ie, Vector3 as N, Plane as Ro, Line3 as pe, Vector2 as Ye, Sphere as zo, Matrix4 as Jt, Box3 as Kt, BackSide as Ja, REVISION as Ga, FrontSide as bs, BatchedMesh as ja, Ray as $a, Matrix3 as qa, Vector4 as ls } from "./three-Bz6X1mrw.js";
2
2
  const ot = {
3
3
  ComponentState: Object.freeze({
4
4
  DEFAULT: "default",
@@ -1,4 +1,4 @@
1
- "use strict";const M=require("./three-f-JuZtOs.umd.cjs"),st={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function uo(n){const t=await fetch(n);if(t.ok)return t.json();throw new Error(t.statusText)}async function ga(n){return await uo(`${n}/profilesList.json`)}async function va(n,t,e=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");const r=await ga(t);let s;if(n.profiles.some(c=>{const l=r[c];return l&&(s={profileId:c,profilePath:`${t}/${l.path}`,deprecated:!!l.deprecated}),!!s}),!s){if(!e)throw new Error("No matching profile name found");const c=r[e];if(!c)throw new Error(`No matching profile name found and default profile "${e}" missing.`);s={profileId:e,profilePath:`${t}/${c.path}`,deprecated:!!c.deprecated}}const a=await uo(s.profilePath);let o;if(i){let c;if(n.handedness==="any"?c=a.layouts[Object.keys(a.layouts)[0]]:c=a.layouts[n.handedness],!c)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);c.assetPath&&(o=s.profilePath.replace("profile.json",c.assetPath))}return{profile:a,assetPath:o}}const _a={xAxis:0,yAxis:0,button:0,state:st.ComponentState.DEFAULT};function xa(n=0,t=0){let e=n,i=t;if(Math.sqrt(n*n+t*t)>1){const a=Math.atan2(t,n);e=Math.cos(a),i=Math.sin(a)}return{normalizedXAxis:e*.5+.5,normalizedYAxis:i*.5+.5}}class Sa{constructor(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===st.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(_a)}updateFromComponent({xAxis:t,yAxis:e,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:a}=xa(t,e);switch(this.componentProperty){case st.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case st.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case st.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case st.ComponentProperty.STATE:this.valueNodeProperty===st.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class ba{constructor(t,e){if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(i=>{const r=new Sa(e.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:st.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(t){if(this.values.state=st.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){const e=t.buttons[this.gamepadIndices.button];this.values.button=e.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,e.pressed||this.values.button===1?this.values.state=st.ComponentState.PRESSED:(e.touched||this.values.button>st.ButtonTouchThreshold)&&(this.values.state=st.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.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===st.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>st.AxisTouchThreshold&&(this.values.state=st.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.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===st.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>st.AxisTouchThreshold&&(this.values.state=st.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}}class Ta{constructor(t,e,i){if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=i,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new ba(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const t=[];return Object.values(this.components).forEach(e=>{t.push(e.data)}),t}updateFromGamepad(){Object.values(this.components).forEach(t=>{t.updateFromGamepad(this.xrInputSource.gamepad)})}}const Xr=2,qt=4,oe=4,ho=4,de=new Int32Array(2),os=new Float32Array(de.buffer),as=new Float64Array(de.buffer),tr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class ce{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?ce.ZERO:new ce(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}}ce.ZERO=new ce(0,0);var Pn;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Pn||(Pn={}));class gi{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new gi(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return new ce(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new ce(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return de[0]=this.readInt32(t),os[0]}readFloat64(t){return de[tr?0:1]=this.readInt32(t),de[tr?1:0]=this.readInt32(t+4),as[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){os[0]=e,this.writeInt32(t,de[0])}writeFloat64(t,e){as[0]=e,this.writeInt32(t,de[tr?0:1]),this.writeInt32(t+4,de[tr?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+qt+oe)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<oe;e++)t+=String.fromCharCode(this.readInt8(this.position_+qt+e));return t}__offset(t,e){const i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const i=this.readInt32(t);let r="",s=0;if(t+=qt,e===Pn.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;s<i;){let a;const o=this.readUint8(t+s++);if(o<192)a=o;else{const c=this.readUint8(t+s++);if(o<224)a=(o&31)<<6|c&63;else{const l=this.readUint8(t+s++);if(o<240)a=(o&15)<<12|(c&63)<<6|l&63;else{const u=this.readUint8(t+s++);a=(o&7)<<18|(c&63)<<12|(l&63)<<6|u&63}}}a<65536?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode((a>>10)+55296,(a&1023)+56320))}return r}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+qt}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=oe)throw new Error("FlatBuffers: file identifier must be length "+oe);for(let e=0;e<oe;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+qt+e))return!1;return!0}createLong(t,e){return ce.create(t,e)}createScalarList(t,e){const i=[];for(let r=0;r<e;++r)t(r)!==null&&i.push(t(r));return i}createObjList(t,e){const i=[];for(let r=0;r<e;++r){const s=t(r);s!==null&&i.push(s.unpack())}return i}}class Wn{constructor(t){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 e;t?e=t:e=1024,this.bb=gi.allocate(e),this.space=e}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(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);const i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){const r=this.bb.capacity();this.bb=Wn.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||!e.equals(i))&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=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(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=e<<1,r=gi.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r}addOffset(t){this.prep(qt,0),this.writeInt32(this.offset()-t+qt)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=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 t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const r=2;this.addInt16(t-this.object_start);const s=(i+r)*Xr;this.addInt16(s);let a=0;const o=this.space;t:for(e=0;e<this.vtables.length;e++){const c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=Xr;l<s;l+=Xr)if(this.bb.readInt16(o+l)!=this.bb.readInt16(c+l))continue t;a=this.vtables[e];break}}return a?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,a-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){const r=i?ho:0;if(e){const s=e;if(this.prep(this.minalign,qt+oe+r),s.length!=oe)throw new Error("FlatBuffers: file identifier must be length "+oe);for(let a=oe-1;a>=0;a--)this.writeInt8(s.charCodeAt(a))}this.prep(this.minalign,qt+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(this.bb.readInt16(r+e)!=0))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(qt,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let i=0;for(;i<t.length;){let r;const s=t.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const a=t.charCodeAt(i++);r=(s<<10)+a+-56613888}r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(r&63|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let i=0,r=this.space,s=this.bb.bytes();i<e.length;i++)s[r++]=e[i];return this.endVector()}createLong(t,e){return ce.create(t,e)}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let i=0;i<t.length;++i){const r=t[i];if(r!==null)e.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}}function Vr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Wr={exports:{}},cs;function ls(){return cs||(cs=1,function(n){var t={};t.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),t.useArrayBufferView=!t.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=t;var e=n.exports.BlobBuilder;typeof window<"u"&&(e=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(r){typeof r=="number"?this._pieces.push(r):(this.flush(),this._parts.push(r))},i.prototype.flush=function(){if(this._pieces.length>0){var r=new Uint8Array(this._pieces);t.useArrayBufferView||(r=r.buffer),this._parts.push(r),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),t.useBlobBuilder){for(var r=new e,s=0,a=this._parts.length;s<a;s++)r.append(this._parts[s]);return r.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i}(Wr)),Wr.exports}var Hr,us;function Ma(){if(us)return Hr;us=1;var n=ls().BufferBuilder,t=ls().binaryFeatures,e={unpack:function(o){var c=new i(o);return c.unpack()},pack:function(o){var c=new r;c.pack(o);var l=c.getBuffer();return l}};Hr=e;function i(o){this.index=0,this.dataBuffer=o,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}i.prototype.unpack=function(){var o=this.unpack_uint8();if(o<128)return o;if((o^224)<32)return(o^224)-32;var c;if((c=o^160)<=15)return this.unpack_raw(c);if((c=o^176)<=15)return this.unpack_string(c);if((c=o^144)<=15)return this.unpack_array(c);if((c=o^128)<=15)return this.unpack_map(c);switch(o){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 c=this.unpack_uint16(),this.unpack_string(c);case 217:return c=this.unpack_uint32(),this.unpack_string(c);case 218:return c=this.unpack_uint16(),this.unpack_raw(c);case 219:return c=this.unpack_uint32(),this.unpack_raw(c);case 220:return c=this.unpack_uint16(),this.unpack_array(c);case 221:return c=this.unpack_uint32(),this.unpack_array(c);case 222:return c=this.unpack_uint16(),this.unpack_map(c);case 223:return c=this.unpack_uint32(),this.unpack_map(c)}},i.prototype.unpack_uint8=function(){var o=this.dataView[this.index]&255;return this.index++,o},i.prototype.unpack_uint16=function(){var o=this.read(2),c=(o[0]&255)*256+(o[1]&255);return this.index+=2,c},i.prototype.unpack_uint32=function(){var o=this.read(4),c=((o[0]*256+o[1])*256+o[2])*256+o[3];return this.index+=4,c},i.prototype.unpack_uint64=function(){var o=this.read(8),c=((((((o[0]*256+o[1])*256+o[2])*256+o[3])*256+o[4])*256+o[5])*256+o[6])*256+o[7];return this.index+=8,c},i.prototype.unpack_int8=function(){var o=this.unpack_uint8();return o<128?o:o-256},i.prototype.unpack_int16=function(){var o=this.unpack_uint16();return o<32768?o:o-65536},i.prototype.unpack_int32=function(){var o=this.unpack_uint32();return o<Math.pow(2,31)?o:o-Math.pow(2,32)},i.prototype.unpack_int64=function(){var o=this.unpack_uint64();return o<Math.pow(2,63)?o:o-Math.pow(2,64)},i.prototype.unpack_raw=function(o){if(this.length<this.index+o)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+o+" "+this.length);var c=this.dataBuffer.slice(this.index,this.index+o);return this.index+=o,c},i.prototype.unpack_string=function(o){for(var c=this.read(o),l=0,u="",h,f;l<o;)h=c[l],h<128?(u+=String.fromCharCode(h),l++):(h^192)<32?(f=(h^192)<<6|c[l+1]&63,u+=String.fromCharCode(f),l+=2):(f=(h&15)<<12|(c[l+1]&63)<<6|c[l+2]&63,u+=String.fromCharCode(f),l+=3);return this.index+=o,u},i.prototype.unpack_array=function(o){for(var c=new Array(o),l=0;l<o;l++)c[l]=this.unpack();return c},i.prototype.unpack_map=function(o){for(var c={},l=0;l<o;l++){var u=this.unpack(),h=this.unpack();c[u]=h}return c},i.prototype.unpack_float=function(){var o=this.unpack_uint32(),c=o>>31,l=(o>>23&255)-127,u=o&8388607|8388608;return(c===0?1:-1)*u*Math.pow(2,l-23)},i.prototype.unpack_double=function(){var o=this.unpack_uint32(),c=this.unpack_uint32(),l=o>>31,u=(o>>20&2047)-1023,h=o&1048575|1048576,f=h*Math.pow(2,u-20)+c*Math.pow(2,u-52);return(l===0?1:-1)*f},i.prototype.read=function(o){var c=this.index;if(c+o<=this.length)return this.dataView.subarray(c,c+o);throw new Error("BinaryPackFailure: read index out of range")};function r(){this.bufferBuilder=new n}r.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},r.prototype.pack=function(o){var c=typeof o;if(c==="string")this.pack_string(o);else if(c==="number")Math.floor(o)===o?this.pack_integer(o):this.pack_double(o);else if(c==="boolean")o===!0?this.bufferBuilder.append(195):o===!1&&this.bufferBuilder.append(194);else if(c==="undefined")this.bufferBuilder.append(192);else if(c==="object")if(o===null)this.bufferBuilder.append(192);else{var l=o.constructor;if(l==Array)this.pack_array(o);else if(l==Blob||l==File||o instanceof Blob||o instanceof File)this.pack_bin(o);else if(l==ArrayBuffer)t.useArrayBufferView?this.pack_bin(new Uint8Array(o)):this.pack_bin(o);else if("BYTES_PER_ELEMENT"in o)t.useArrayBufferView?this.pack_bin(new Uint8Array(o.buffer)):this.pack_bin(o.buffer);else if(l==Object||l.toString().startsWith("class"))this.pack_object(o);else if(l==Date)this.pack_string(o.toString());else if(typeof o.toBinaryPack=="function")this.bufferBuilder.append(o.toBinaryPack());else throw new Error('Type "'+l.toString()+'" not yet supported')}else throw new Error('Type "'+c+'" not yet supported');this.bufferBuilder.flush()},r.prototype.pack_bin=function(o){var c=o.length||o.byteLength||o.size;if(c<=15)this.pack_uint8(160+c);else if(c<=65535)this.bufferBuilder.append(218),this.pack_uint16(c);else if(c<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(c);else throw new Error("Invalid length");this.bufferBuilder.append(o)},r.prototype.pack_string=function(o){var c=a(o);if(c<=15)this.pack_uint8(176+c);else if(c<=65535)this.bufferBuilder.append(216),this.pack_uint16(c);else if(c<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(c);else throw new Error("Invalid length");this.bufferBuilder.append(o)},r.prototype.pack_array=function(o){var c=o.length;if(c<=15)this.pack_uint8(144+c);else if(c<=65535)this.bufferBuilder.append(220),this.pack_uint16(c);else if(c<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(c);else throw new Error("Invalid length");for(var l=0;l<c;l++)this.pack(o[l])},r.prototype.pack_integer=function(o){if(o>=-32&&o<=127)this.bufferBuilder.append(o&255);else if(o>=0&&o<=255)this.bufferBuilder.append(204),this.pack_uint8(o);else if(o>=-128&&o<=127)this.bufferBuilder.append(208),this.pack_int8(o);else if(o>=0&&o<=65535)this.bufferBuilder.append(205),this.pack_uint16(o);else if(o>=-32768&&o<=32767)this.bufferBuilder.append(209),this.pack_int16(o);else if(o>=0&&o<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(o);else if(o>=-2147483648&&o<=2147483647)this.bufferBuilder.append(210),this.pack_int32(o);else if(o>=-9223372036854776e3&&o<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(o);else if(o>=0&&o<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(o);else throw new Error("Invalid integer")},r.prototype.pack_double=function(o){var c=0;o<0&&(c=1,o=-o);var l=Math.floor(Math.log(o)/Math.LN2),u=o/Math.pow(2,l)-1,h=Math.floor(u*Math.pow(2,52)),f=Math.pow(2,32),d=c<<31|l+1023<<20|h/f&1048575,y=h%f;this.bufferBuilder.append(203),this.pack_int32(d),this.pack_int32(y)},r.prototype.pack_object=function(o){var c=Object.keys(o),l=c.length;if(l<=15)this.pack_uint8(128+l);else if(l<=65535)this.bufferBuilder.append(222),this.pack_uint16(l);else if(l<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(l);else throw new Error("Invalid length");for(var u in o)o.hasOwnProperty(u)&&(this.pack(u),this.pack(o[u]))},r.prototype.pack_uint8=function(o){this.bufferBuilder.append(o)},r.prototype.pack_uint16=function(o){this.bufferBuilder.append(o>>8),this.bufferBuilder.append(o&255)},r.prototype.pack_uint32=function(o){var c=o&4294967295;this.bufferBuilder.append((c&4278190080)>>>24),this.bufferBuilder.append((c&16711680)>>>16),this.bufferBuilder.append((c&65280)>>>8),this.bufferBuilder.append(c&255)},r.prototype.pack_uint64=function(o){var c=o/Math.pow(2,32),l=o%Math.pow(2,32);this.bufferBuilder.append((c&4278190080)>>>24),this.bufferBuilder.append((c&16711680)>>>16),this.bufferBuilder.append((c&65280)>>>8),this.bufferBuilder.append(c&255),this.bufferBuilder.append((l&4278190080)>>>24),this.bufferBuilder.append((l&16711680)>>>16),this.bufferBuilder.append((l&65280)>>>8),this.bufferBuilder.append(l&255)},r.prototype.pack_int8=function(o){this.bufferBuilder.append(o&255)},r.prototype.pack_int16=function(o){this.bufferBuilder.append((o&65280)>>8),this.bufferBuilder.append(o&255)},r.prototype.pack_int32=function(o){this.bufferBuilder.append(o>>>24&255),this.bufferBuilder.append((o&16711680)>>>16),this.bufferBuilder.append((o&65280)>>>8),this.bufferBuilder.append(o&255)},r.prototype.pack_int64=function(o){var c=Math.floor(o/Math.pow(2,32)),l=o%Math.pow(2,32);this.bufferBuilder.append((c&4278190080)>>>24),this.bufferBuilder.append((c&16711680)>>>16),this.bufferBuilder.append((c&65280)>>>8),this.bufferBuilder.append(c&255),this.bufferBuilder.append((l&4278190080)>>>24),this.bufferBuilder.append((l&16711680)>>>16),this.bufferBuilder.append((l&65280)>>>8),this.bufferBuilder.append(l&255)};function s(o){var c=o.charCodeAt(0);return c<=2047?"00":c<=65535?"000":c<=2097151?"0000":c<=67108863?"00000":"000000"}function a(o){return o.length>600?new Blob([o]).size:o.replace(/[^\u0000-\u007F]/g,s).length}return Hr}var Ca=Ma();const hs=Vr(Ca);let fo=!0,po=!0;function li(n,t,e){const i=n.match(t);return i&&i.length>=e&&parseInt(i[e],10)}function $e(n,t,e){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(a,o){if(a!==t)return r.apply(this,arguments);const c=l=>{const u=e(l);u&&(o.handleEvent?o.handleEvent(u):o(u))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(o,c),r.apply(this,[a,c])};const s=i.removeEventListener;i.removeEventListener=function(a,o){if(a!==t||!this._eventMap||!this._eventMap[t])return s.apply(this,arguments);if(!this._eventMap[t].has(o))return s.apply(this,arguments);const c=this._eventMap[t].get(o);return this._eventMap[t].delete(o),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[a,c])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(a){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),a&&this.addEventListener(t,this["_on"+t]=a)},enumerable:!0,configurable:!0})}function Pa(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(fo=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function wa(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(po=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Hn(){if(typeof window=="object"){if(fo)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Jr(n,t){po&&console.warn(n+" is deprecated, please use "+t+" instead.")}function Ea(n){const t={browser:null,version:null};if(typeof n>"u"||!n.navigator)return t.browser="Not a browser.",t;const{navigator:e}=n;if(e.mozGetUserMedia)t.browser="firefox",t.version=li(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)t.browser="chrome",t.version=li(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(e.mediaDevices&&e.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=li(e.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&e.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser="safari",t.version=li(e.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return t.browser="Not a supported browser.",t;return t}function fs(n){return Object.prototype.toString.call(n)==="[object Object]"}function mo(n){return fs(n)?Object.keys(n).reduce(function(t,e){const i=fs(n[e]),r=i?mo(n[e]):n[e],s=i&&!Object.keys(r).length;return r===void 0||s?t:Object.assign(t,{[e]:r})},{}):n}function wn(n,t,e){!t||e.has(t.id)||(e.set(t.id,t),Object.keys(t).forEach(i=>{i.endsWith("Id")?wn(n,n.get(t[i]),e):i.endsWith("Ids")&&t[i].forEach(r=>{wn(n,n.get(r),e)})}))}function ds(n,t,e){const i=e?"outbound-rtp":"inbound-rtp",r=new Map;if(t===null)return r;const s=[];return n.forEach(a=>{a.type==="track"&&a.trackIdentifier===t.id&&s.push(a)}),s.forEach(a=>{n.forEach(o=>{o.type===i&&o.trackId===a.id&&wn(n,o,r)})}),r}const ps=Hn;function yo(n,t){const e=n&&n.navigator;if(!e.mediaDevices)return;const i=function(o){if(typeof o!="object"||o.mandatory||o.optional)return o;const c={};return Object.keys(o).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const u=typeof o[l]=="object"?o[l]:{ideal:o[l]};u.exact!==void 0&&typeof u.exact=="number"&&(u.min=u.max=u.exact);const h=function(f,d){return f?f+d.charAt(0).toUpperCase()+d.slice(1):d==="deviceId"?"sourceId":d};if(u.ideal!==void 0){c.optional=c.optional||[];let f={};typeof u.ideal=="number"?(f[h("min",l)]=u.ideal,c.optional.push(f),f={},f[h("max",l)]=u.ideal,c.optional.push(f)):(f[h("",l)]=u.ideal,c.optional.push(f))}u.exact!==void 0&&typeof u.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[h("",l)]=u.exact):["min","max"].forEach(f=>{u[f]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[h(f,l)]=u[f])})}),o.advanced&&(c.optional=(c.optional||[]).concat(o.advanced)),c},r=function(o,c){if(t.version>=61)return c(o);if(o=JSON.parse(JSON.stringify(o)),o&&typeof o.audio=="object"){const l=function(u,h,f){h in u&&!(f in u)&&(u[f]=u[h],delete u[h])};o=JSON.parse(JSON.stringify(o)),l(o.audio,"autoGainControl","googAutoGainControl"),l(o.audio,"noiseSuppression","googNoiseSuppression"),o.audio=i(o.audio)}if(o&&typeof o.video=="object"){let l=o.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const u=t.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(e.mediaDevices.getSupportedConstraints&&e.mediaDevices.getSupportedConstraints().facingMode&&!u)){delete o.video.facingMode;let h;if(l.exact==="environment"||l.ideal==="environment"?h=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(h=["front"]),h)return e.mediaDevices.enumerateDevices().then(f=>{f=f.filter(y=>y.kind==="videoinput");let d=f.find(y=>h.some(_=>y.label.toLowerCase().includes(_)));return!d&&f.length&&h.includes("back")&&(d=f[f.length-1]),d&&(o.video.deviceId=l.exact?{exact:d.deviceId}:{ideal:d.deviceId}),o.video=i(o.video),ps("chrome: "+JSON.stringify(o)),c(o)})}o.video=i(o.video)}return ps("chrome: "+JSON.stringify(o)),c(o)},s=function(o){return t.version>=64?o:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[o.name]||o.name,message:o.message,constraint:o.constraint||o.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(o,c,l){r(o,u=>{e.webkitGetUserMedia(u,c,h=>{l&&l(s(h))})})};if(e.getUserMedia=a.bind(e),e.mediaDevices.getUserMedia){const o=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(c){return r(c,l=>o(l).then(u=>{if(l.audio&&!u.getAudioTracks().length||l.video&&!u.getVideoTracks().length)throw u.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return u},u=>Promise.reject(s(u))))}}}function Ra(n,t){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof t!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then(r=>{const s=i.video&&i.video.width,a=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:r,maxFrameRate:o||3}},s&&(i.video.mandatory.maxWidth=s),a&&(i.video.mandatory.maxHeight=a),n.navigator.mediaDevices.getUserMedia(i)})}}}function go(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function vo(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=i=>{i.stream.addEventListener("addtrack",r=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(o=>o.track&&o.track.id===r.track.id):s={track:r.track};const a=new Event("track");a.track=r.track,a.receiver=s,a.transceiver={receiver:s},a.streams=[i.stream],this.dispatchEvent(a)}),i.stream.getTracks().forEach(r=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(o=>o.track&&o.track.id===r.id):s={track:r};const a=new Event("track");a.track=r,a.receiver=s,a.transceiver={receiver:s},a.streams=[i.stream],this.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else $e(n,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function _o(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const t=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,c){let l=r.apply(this,arguments);return l||(l=t(this,o),this._senders.push(l)),l};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){s.apply(this,arguments);const c=this._senders.indexOf(o);c!==-1&&this._senders.splice(c,1)}}const e=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],e.apply(this,[s]),s.getTracks().forEach(a=>{this._senders.push(t(this,a))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(a=>{const o=this._senders.find(c=>c.track===a);o&&this._senders.splice(this._senders.indexOf(o),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 t=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i},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 xo(n){if(!n.RTCPeerConnection)return;const t=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[i,r,s]=arguments;if(arguments.length>0&&typeof i=="function")return t.apply(this,arguments);if(t.length===0&&(arguments.length===0||typeof i!="function"))return t.apply(this,[]);const a=function(c){const l={};return c.result().forEach(h=>{const f={id:h.id,timestamp:h.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[h.type]||h.type};h.names().forEach(d=>{f[d]=h.stat(d)}),l[f.id]=f}),l},o=function(c){return new Map(Object.keys(c).map(l=>[l,c[l]]))};if(arguments.length>=2){const c=function(l){r(o(a(l)))};return t.apply(this,[c,i])}return new Promise((c,l)=>{t.apply(this,[function(u){c(o(a(u)))},l])}).then(r,s)}}function So(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;e&&(n.RTCPeerConnection.prototype.getSenders=function(){const s=e.apply(this,[]);return s.forEach(a=>a._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(a=>ds(a,s.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const e=n.RTCPeerConnection.prototype.getReceivers;e&&(n.RTCPeerConnection.prototype.getReceivers=function(){const r=e.apply(this,[]);return r.forEach(s=>s._pc=this),r}),$e(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>ds(s,r.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const t=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const i=arguments[0];let r,s,a;return this.getSenders().forEach(o=>{o.track===i&&(r?a=!0:r=o)}),this.getReceivers().forEach(o=>(o.track===i&&(s?a=!0:s=o),o.track===i)),a||r&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function bo(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(a=>this._shimmedLocalStreams[a][0])};const t=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(a,o){if(!o)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=t.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(c)===-1&&this._shimmedLocalStreams[o.id].push(c):this._shimmedLocalStreams[o.id]=[o,c],c};const e=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(a){this._shimmedLocalStreams=this._shimmedLocalStreams||{},a.getTracks().forEach(l=>{if(this.getSenders().find(h=>h.track===l))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();e.apply(this,arguments);const c=this.getSenders().filter(l=>o.indexOf(l)===-1);this._shimmedLocalStreams[a.id]=[a].concat(c)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[a.id],i.apply(this,arguments)};const r=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},a&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const c=this._shimmedLocalStreams[o].indexOf(a);c!==-1&&this._shimmedLocalStreams[o].splice(c,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),r.apply(this,arguments)}}function To(n,t){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&t.version>=65)return bo(n);const e=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const u=e.apply(this);return this._reverseStreams=this._reverseStreams||{},u.map(h=>this._reverseStreams[h.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(u){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},u.getTracks().forEach(h=>{if(this.getSenders().find(d=>d.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[u.id]){const h=new n.MediaStream(u.getTracks());this._streams[u.id]=h,this._reverseStreams[h.id]=u,u=h}i.apply(this,[u])};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(u){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[u.id]||u]),delete this._reverseStreams[this._streams[u.id]?this._streams[u.id].id:u.id],delete this._streams[u.id]},n.RTCPeerConnection.prototype.addTrack=function(u,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const f=[].slice.call(arguments,1);if(f.length!==1||!f[0].getTracks().find(_=>_===u))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(_=>_.track===u))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const y=this._streams[h.id];if(y)y.addTrack(u),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const _=new n.MediaStream([u]);this._streams[h.id]=_,this._reverseStreams[_.id]=h,this.addStream(_)}return this.getSenders().find(_=>_.track===u)};function s(l,u){let h=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(f=>{const d=l._reverseStreams[f],y=l._streams[d.id];h=h.replace(new RegExp(y.id,"g"),d.id)}),new RTCSessionDescription({type:u.type,sdp:h})}function a(l,u){let h=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(f=>{const d=l._reverseStreams[f],y=l._streams[d.id];h=h.replace(new RegExp(d.id,"g"),y.id)}),new RTCSessionDescription({type:u.type,sdp:h})}["createOffer","createAnswer"].forEach(function(l){const u=n.RTCPeerConnection.prototype[l],h={[l](){const f=arguments;return arguments.length&&typeof arguments[0]=="function"?u.apply(this,[y=>{const _=s(this,y);f[0].apply(null,[_])},y=>{f[1]&&f[1].apply(null,y)},arguments[2]]):u.apply(this,arguments).then(y=>s(this,y))}};n.RTCPeerConnection.prototype[l]=h[l]});const o=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?o.apply(this,arguments):(arguments[0]=a(this,arguments[0]),o.apply(this,arguments))};const c=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=c.get.apply(this);return l.type===""?l:s(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!u._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(u._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let f;Object.keys(this._streams).forEach(d=>{this._streams[d].getTracks().find(_=>u.track===_)&&(f=this._streams[d])}),f&&(f.getTracks().length===1?this.removeStream(this._reverseStreams[f.id]):f.removeTrack(u.track),this.dispatchEvent(new Event("negotiationneeded")))}}function En(n,t){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){const i=n.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new(e==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[e]=r[e]})}function Mo(n,t){$e(n,"negotiationneeded",e=>{const i=e.target;if(!((t.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return e})}const ms=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:Mo,shimAddTrackRemoveTrack:To,shimAddTrackRemoveTrackWithNative:bo,shimGetDisplayMedia:Ra,shimGetSendersWithDtmf:_o,shimGetStats:xo,shimGetUserMedia:yo,shimMediaStream:go,shimOnTrack:vo,shimPeerConnection:En,shimSenderReceiverGetStats:So},Symbol.toStringTag,{value:"Module"}));function Aa(n,t){let e=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let r=i.urls||i.url;i.url&&!i.urls&&Jr("RTCIceServer.url","RTCIceServer.urls");const s=typeof r=="string";return s&&(r=[r]),r=r.filter(a=>{if(a.indexOf("stun:")===0)return!1;const o=a.startsWith("turn")&&!a.startsWith("turn:[")&&a.includes("transport=udp");return o&&!e?(e=!0,!0):o&&!e}),delete i.url,i.urls=s?r[0]:r,!!r.length}})}var Yr={exports:{}},ys;function Co(){return ys||(ys=1,function(n){var t={};t.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split(`
1
+ "use strict";const M=require("./three-DMrv-4ar.umd.cjs"),st={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function uo(n){const t=await fetch(n);if(t.ok)return t.json();throw new Error(t.statusText)}async function ga(n){return await uo(`${n}/profilesList.json`)}async function va(n,t,e=null,i=!0){if(!n)throw new Error("No xrInputSource supplied");const r=await ga(t);let s;if(n.profiles.some(c=>{const l=r[c];return l&&(s={profileId:c,profilePath:`${t}/${l.path}`,deprecated:!!l.deprecated}),!!s}),!s){if(!e)throw new Error("No matching profile name found");const c=r[e];if(!c)throw new Error(`No matching profile name found and default profile "${e}" missing.`);s={profileId:e,profilePath:`${t}/${c.path}`,deprecated:!!c.deprecated}}const a=await uo(s.profilePath);let o;if(i){let c;if(n.handedness==="any"?c=a.layouts[Object.keys(a.layouts)[0]]:c=a.layouts[n.handedness],!c)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);c.assetPath&&(o=s.profilePath.replace("profile.json",c.assetPath))}return{profile:a,assetPath:o}}const _a={xAxis:0,yAxis:0,button:0,state:st.ComponentState.DEFAULT};function xa(n=0,t=0){let e=n,i=t;if(Math.sqrt(n*n+t*t)>1){const a=Math.atan2(t,n);e=Math.cos(a),i=Math.sin(a)}return{normalizedXAxis:e*.5+.5,normalizedYAxis:i*.5+.5}}class Sa{constructor(t){this.componentProperty=t.componentProperty,this.states=t.states,this.valueNodeName=t.valueNodeName,this.valueNodeProperty=t.valueNodeProperty,this.valueNodeProperty===st.VisualResponseProperty.TRANSFORM&&(this.minNodeName=t.minNodeName,this.maxNodeName=t.maxNodeName),this.value=0,this.updateFromComponent(_a)}updateFromComponent({xAxis:t,yAxis:e,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:a}=xa(t,e);switch(this.componentProperty){case st.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case st.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case st.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case st.ComponentProperty.STATE:this.valueNodeProperty===st.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class ba{constructor(t,e){if(!t||!e||!e.visualResponses||!e.gamepadIndices||Object.keys(e.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=t,this.type=e.type,this.rootNodeName=e.rootNodeName,this.touchPointNodeName=e.touchPointNodeName,this.visualResponses={},Object.keys(e.visualResponses).forEach(i=>{const r=new Sa(e.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},e.gamepadIndices),this.values={state:st.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(t){if(this.values.state=st.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&t.buttons.length>this.gamepadIndices.button){const e=t.buttons[this.gamepadIndices.button];this.values.button=e.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,e.pressed||this.values.button===1?this.values.state=st.ComponentState.PRESSED:(e.touched||this.values.button>st.ButtonTouchThreshold)&&(this.values.state=st.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&t.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=t.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===st.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>st.AxisTouchThreshold&&(this.values.state=st.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&t.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=t.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===st.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>st.AxisTouchThreshold&&(this.values.state=st.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}}class Ta{constructor(t,e,i){if(!t)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No profile supplied");this.xrInputSource=t,this.assetUrl=i,this.id=e.profileId,this.layoutDescription=e.layouts[t.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new ba(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const t=[];return Object.values(this.components).forEach(e=>{t.push(e.data)}),t}updateFromGamepad(){Object.values(this.components).forEach(t=>{t.updateFromGamepad(this.xrInputSource.gamepad)})}}const Xr=2,qt=4,oe=4,ho=4,de=new Int32Array(2),os=new Float32Array(de.buffer),as=new Float64Array(de.buffer),tr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;class ce{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?ce.ZERO:new ce(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}}ce.ZERO=new ce(0,0);var Pn;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Pn||(Pn={}));class gi{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new gi(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return new ce(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new ce(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return de[0]=this.readInt32(t),os[0]}readFloat64(t){return de[tr?0:1]=this.readInt32(t),de[tr?1:0]=this.readInt32(t+4),as[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){os[0]=e,this.writeInt32(t,de[0])}writeFloat64(t,e){as[0]=e,this.writeInt32(t,de[tr?0:1]),this.writeInt32(t+4,de[tr?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+qt+oe)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<oe;e++)t+=String.fromCharCode(this.readInt8(this.position_+qt+e));return t}__offset(t,e){const i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const i=this.readInt32(t);let r="",s=0;if(t+=qt,e===Pn.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;s<i;){let a;const o=this.readUint8(t+s++);if(o<192)a=o;else{const c=this.readUint8(t+s++);if(o<224)a=(o&31)<<6|c&63;else{const l=this.readUint8(t+s++);if(o<240)a=(o&15)<<12|(c&63)<<6|l&63;else{const u=this.readUint8(t+s++);a=(o&7)<<18|(c&63)<<12|(l&63)<<6|u&63}}}a<65536?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode((a>>10)+55296,(a&1023)+56320))}return r}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+qt}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=oe)throw new Error("FlatBuffers: file identifier must be length "+oe);for(let e=0;e<oe;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+qt+e))return!1;return!0}createLong(t,e){return ce.create(t,e)}createScalarList(t,e){const i=[];for(let r=0;r<e;++r)t(r)!==null&&i.push(t(r));return i}createObjList(t,e){const i=[];for(let r=0;r<e;++r){const s=t(r);s!==null&&i.push(s.unpack())}return i}}class Wn{constructor(t){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 e;t?e=t:e=1024,this.bb=gi.allocate(e),this.space=e}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(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);const i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){const r=this.bb.capacity();this.bb=Wn.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||!e.equals(i))&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=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(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=e<<1,r=gi.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r}addOffset(t){this.prep(qt,0),this.writeInt32(this.offset()-t+qt)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=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 t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const r=2;this.addInt16(t-this.object_start);const s=(i+r)*Xr;this.addInt16(s);let a=0;const o=this.space;t:for(e=0;e<this.vtables.length;e++){const c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=Xr;l<s;l+=Xr)if(this.bb.readInt16(o+l)!=this.bb.readInt16(c+l))continue t;a=this.vtables[e];break}}return a?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,a-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){const r=i?ho:0;if(e){const s=e;if(this.prep(this.minalign,qt+oe+r),s.length!=oe)throw new Error("FlatBuffers: file identifier must be length "+oe);for(let a=oe-1;a>=0;a--)this.writeInt8(s.charCodeAt(a))}this.prep(this.minalign,qt+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(this.bb.readInt16(r+e)!=0))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(qt,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let i=0;for(;i<t.length;){let r;const s=t.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const a=t.charCodeAt(i++);r=(s<<10)+a+-56613888}r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(r&63|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let i=0,r=this.space,s=this.bb.bytes();i<e.length;i++)s[r++]=e[i];return this.endVector()}createLong(t,e){return ce.create(t,e)}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let i=0;i<t.length;++i){const r=t[i];if(r!==null)e.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}}function Vr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Wr={exports:{}},cs;function ls(){return cs||(cs=1,function(n){var t={};t.useBlobBuilder=function(){try{return new Blob([]),!1}catch{return!0}}(),t.useArrayBufferView=!t.useBlobBuilder&&function(){try{return new Blob([new Uint8Array([])]).size===0}catch{return!0}}(),n.exports.binaryFeatures=t;var e=n.exports.BlobBuilder;typeof window<"u"&&(e=n.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder);function i(){this._pieces=[],this._parts=[]}i.prototype.append=function(r){typeof r=="number"?this._pieces.push(r):(this.flush(),this._parts.push(r))},i.prototype.flush=function(){if(this._pieces.length>0){var r=new Uint8Array(this._pieces);t.useArrayBufferView||(r=r.buffer),this._parts.push(r),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),t.useBlobBuilder){for(var r=new e,s=0,a=this._parts.length;s<a;s++)r.append(this._parts[s]);return r.getBlob()}else return new Blob(this._parts)},n.exports.BufferBuilder=i}(Wr)),Wr.exports}var Hr,us;function Ma(){if(us)return Hr;us=1;var n=ls().BufferBuilder,t=ls().binaryFeatures,e={unpack:function(o){var c=new i(o);return c.unpack()},pack:function(o){var c=new r;c.pack(o);var l=c.getBuffer();return l}};Hr=e;function i(o){this.index=0,this.dataBuffer=o,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}i.prototype.unpack=function(){var o=this.unpack_uint8();if(o<128)return o;if((o^224)<32)return(o^224)-32;var c;if((c=o^160)<=15)return this.unpack_raw(c);if((c=o^176)<=15)return this.unpack_string(c);if((c=o^144)<=15)return this.unpack_array(c);if((c=o^128)<=15)return this.unpack_map(c);switch(o){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 c=this.unpack_uint16(),this.unpack_string(c);case 217:return c=this.unpack_uint32(),this.unpack_string(c);case 218:return c=this.unpack_uint16(),this.unpack_raw(c);case 219:return c=this.unpack_uint32(),this.unpack_raw(c);case 220:return c=this.unpack_uint16(),this.unpack_array(c);case 221:return c=this.unpack_uint32(),this.unpack_array(c);case 222:return c=this.unpack_uint16(),this.unpack_map(c);case 223:return c=this.unpack_uint32(),this.unpack_map(c)}},i.prototype.unpack_uint8=function(){var o=this.dataView[this.index]&255;return this.index++,o},i.prototype.unpack_uint16=function(){var o=this.read(2),c=(o[0]&255)*256+(o[1]&255);return this.index+=2,c},i.prototype.unpack_uint32=function(){var o=this.read(4),c=((o[0]*256+o[1])*256+o[2])*256+o[3];return this.index+=4,c},i.prototype.unpack_uint64=function(){var o=this.read(8),c=((((((o[0]*256+o[1])*256+o[2])*256+o[3])*256+o[4])*256+o[5])*256+o[6])*256+o[7];return this.index+=8,c},i.prototype.unpack_int8=function(){var o=this.unpack_uint8();return o<128?o:o-256},i.prototype.unpack_int16=function(){var o=this.unpack_uint16();return o<32768?o:o-65536},i.prototype.unpack_int32=function(){var o=this.unpack_uint32();return o<Math.pow(2,31)?o:o-Math.pow(2,32)},i.prototype.unpack_int64=function(){var o=this.unpack_uint64();return o<Math.pow(2,63)?o:o-Math.pow(2,64)},i.prototype.unpack_raw=function(o){if(this.length<this.index+o)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+o+" "+this.length);var c=this.dataBuffer.slice(this.index,this.index+o);return this.index+=o,c},i.prototype.unpack_string=function(o){for(var c=this.read(o),l=0,u="",h,f;l<o;)h=c[l],h<128?(u+=String.fromCharCode(h),l++):(h^192)<32?(f=(h^192)<<6|c[l+1]&63,u+=String.fromCharCode(f),l+=2):(f=(h&15)<<12|(c[l+1]&63)<<6|c[l+2]&63,u+=String.fromCharCode(f),l+=3);return this.index+=o,u},i.prototype.unpack_array=function(o){for(var c=new Array(o),l=0;l<o;l++)c[l]=this.unpack();return c},i.prototype.unpack_map=function(o){for(var c={},l=0;l<o;l++){var u=this.unpack(),h=this.unpack();c[u]=h}return c},i.prototype.unpack_float=function(){var o=this.unpack_uint32(),c=o>>31,l=(o>>23&255)-127,u=o&8388607|8388608;return(c===0?1:-1)*u*Math.pow(2,l-23)},i.prototype.unpack_double=function(){var o=this.unpack_uint32(),c=this.unpack_uint32(),l=o>>31,u=(o>>20&2047)-1023,h=o&1048575|1048576,f=h*Math.pow(2,u-20)+c*Math.pow(2,u-52);return(l===0?1:-1)*f},i.prototype.read=function(o){var c=this.index;if(c+o<=this.length)return this.dataView.subarray(c,c+o);throw new Error("BinaryPackFailure: read index out of range")};function r(){this.bufferBuilder=new n}r.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},r.prototype.pack=function(o){var c=typeof o;if(c==="string")this.pack_string(o);else if(c==="number")Math.floor(o)===o?this.pack_integer(o):this.pack_double(o);else if(c==="boolean")o===!0?this.bufferBuilder.append(195):o===!1&&this.bufferBuilder.append(194);else if(c==="undefined")this.bufferBuilder.append(192);else if(c==="object")if(o===null)this.bufferBuilder.append(192);else{var l=o.constructor;if(l==Array)this.pack_array(o);else if(l==Blob||l==File||o instanceof Blob||o instanceof File)this.pack_bin(o);else if(l==ArrayBuffer)t.useArrayBufferView?this.pack_bin(new Uint8Array(o)):this.pack_bin(o);else if("BYTES_PER_ELEMENT"in o)t.useArrayBufferView?this.pack_bin(new Uint8Array(o.buffer)):this.pack_bin(o.buffer);else if(l==Object||l.toString().startsWith("class"))this.pack_object(o);else if(l==Date)this.pack_string(o.toString());else if(typeof o.toBinaryPack=="function")this.bufferBuilder.append(o.toBinaryPack());else throw new Error('Type "'+l.toString()+'" not yet supported')}else throw new Error('Type "'+c+'" not yet supported');this.bufferBuilder.flush()},r.prototype.pack_bin=function(o){var c=o.length||o.byteLength||o.size;if(c<=15)this.pack_uint8(160+c);else if(c<=65535)this.bufferBuilder.append(218),this.pack_uint16(c);else if(c<=4294967295)this.bufferBuilder.append(219),this.pack_uint32(c);else throw new Error("Invalid length");this.bufferBuilder.append(o)},r.prototype.pack_string=function(o){var c=a(o);if(c<=15)this.pack_uint8(176+c);else if(c<=65535)this.bufferBuilder.append(216),this.pack_uint16(c);else if(c<=4294967295)this.bufferBuilder.append(217),this.pack_uint32(c);else throw new Error("Invalid length");this.bufferBuilder.append(o)},r.prototype.pack_array=function(o){var c=o.length;if(c<=15)this.pack_uint8(144+c);else if(c<=65535)this.bufferBuilder.append(220),this.pack_uint16(c);else if(c<=4294967295)this.bufferBuilder.append(221),this.pack_uint32(c);else throw new Error("Invalid length");for(var l=0;l<c;l++)this.pack(o[l])},r.prototype.pack_integer=function(o){if(o>=-32&&o<=127)this.bufferBuilder.append(o&255);else if(o>=0&&o<=255)this.bufferBuilder.append(204),this.pack_uint8(o);else if(o>=-128&&o<=127)this.bufferBuilder.append(208),this.pack_int8(o);else if(o>=0&&o<=65535)this.bufferBuilder.append(205),this.pack_uint16(o);else if(o>=-32768&&o<=32767)this.bufferBuilder.append(209),this.pack_int16(o);else if(o>=0&&o<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(o);else if(o>=-2147483648&&o<=2147483647)this.bufferBuilder.append(210),this.pack_int32(o);else if(o>=-9223372036854776e3&&o<=9223372036854776e3)this.bufferBuilder.append(211),this.pack_int64(o);else if(o>=0&&o<=18446744073709552e3)this.bufferBuilder.append(207),this.pack_uint64(o);else throw new Error("Invalid integer")},r.prototype.pack_double=function(o){var c=0;o<0&&(c=1,o=-o);var l=Math.floor(Math.log(o)/Math.LN2),u=o/Math.pow(2,l)-1,h=Math.floor(u*Math.pow(2,52)),f=Math.pow(2,32),d=c<<31|l+1023<<20|h/f&1048575,y=h%f;this.bufferBuilder.append(203),this.pack_int32(d),this.pack_int32(y)},r.prototype.pack_object=function(o){var c=Object.keys(o),l=c.length;if(l<=15)this.pack_uint8(128+l);else if(l<=65535)this.bufferBuilder.append(222),this.pack_uint16(l);else if(l<=4294967295)this.bufferBuilder.append(223),this.pack_uint32(l);else throw new Error("Invalid length");for(var u in o)o.hasOwnProperty(u)&&(this.pack(u),this.pack(o[u]))},r.prototype.pack_uint8=function(o){this.bufferBuilder.append(o)},r.prototype.pack_uint16=function(o){this.bufferBuilder.append(o>>8),this.bufferBuilder.append(o&255)},r.prototype.pack_uint32=function(o){var c=o&4294967295;this.bufferBuilder.append((c&4278190080)>>>24),this.bufferBuilder.append((c&16711680)>>>16),this.bufferBuilder.append((c&65280)>>>8),this.bufferBuilder.append(c&255)},r.prototype.pack_uint64=function(o){var c=o/Math.pow(2,32),l=o%Math.pow(2,32);this.bufferBuilder.append((c&4278190080)>>>24),this.bufferBuilder.append((c&16711680)>>>16),this.bufferBuilder.append((c&65280)>>>8),this.bufferBuilder.append(c&255),this.bufferBuilder.append((l&4278190080)>>>24),this.bufferBuilder.append((l&16711680)>>>16),this.bufferBuilder.append((l&65280)>>>8),this.bufferBuilder.append(l&255)},r.prototype.pack_int8=function(o){this.bufferBuilder.append(o&255)},r.prototype.pack_int16=function(o){this.bufferBuilder.append((o&65280)>>8),this.bufferBuilder.append(o&255)},r.prototype.pack_int32=function(o){this.bufferBuilder.append(o>>>24&255),this.bufferBuilder.append((o&16711680)>>>16),this.bufferBuilder.append((o&65280)>>>8),this.bufferBuilder.append(o&255)},r.prototype.pack_int64=function(o){var c=Math.floor(o/Math.pow(2,32)),l=o%Math.pow(2,32);this.bufferBuilder.append((c&4278190080)>>>24),this.bufferBuilder.append((c&16711680)>>>16),this.bufferBuilder.append((c&65280)>>>8),this.bufferBuilder.append(c&255),this.bufferBuilder.append((l&4278190080)>>>24),this.bufferBuilder.append((l&16711680)>>>16),this.bufferBuilder.append((l&65280)>>>8),this.bufferBuilder.append(l&255)};function s(o){var c=o.charCodeAt(0);return c<=2047?"00":c<=65535?"000":c<=2097151?"0000":c<=67108863?"00000":"000000"}function a(o){return o.length>600?new Blob([o]).size:o.replace(/[^\u0000-\u007F]/g,s).length}return Hr}var Ca=Ma();const hs=Vr(Ca);let fo=!0,po=!0;function li(n,t,e){const i=n.match(t);return i&&i.length>=e&&parseInt(i[e],10)}function $e(n,t,e){if(!n.RTCPeerConnection)return;const i=n.RTCPeerConnection.prototype,r=i.addEventListener;i.addEventListener=function(a,o){if(a!==t)return r.apply(this,arguments);const c=l=>{const u=e(l);u&&(o.handleEvent?o.handleEvent(u):o(u))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(o,c),r.apply(this,[a,c])};const s=i.removeEventListener;i.removeEventListener=function(a,o){if(a!==t||!this._eventMap||!this._eventMap[t])return s.apply(this,arguments);if(!this._eventMap[t].has(o))return s.apply(this,arguments);const c=this._eventMap[t].get(o);return this._eventMap[t].delete(o),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[a,c])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(a){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),a&&this.addEventListener(t,this["_on"+t]=a)},enumerable:!0,configurable:!0})}function Pa(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(fo=n,n?"adapter.js logging disabled":"adapter.js logging enabled")}function wa(n){return typeof n!="boolean"?new Error("Argument type: "+typeof n+". Please use a boolean."):(po=!n,"adapter.js deprecation warnings "+(n?"disabled":"enabled"))}function Hn(){if(typeof window=="object"){if(fo)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Jr(n,t){po&&console.warn(n+" is deprecated, please use "+t+" instead.")}function Ea(n){const t={browser:null,version:null};if(typeof n>"u"||!n.navigator)return t.browser="Not a browser.",t;const{navigator:e}=n;if(e.mozGetUserMedia)t.browser="firefox",t.version=li(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia||n.isSecureContext===!1&&n.webkitRTCPeerConnection&&!n.RTCIceGatherer)t.browser="chrome",t.version=li(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(e.mediaDevices&&e.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=li(e.userAgent,/Edge\/(\d+).(\d+)$/,2);else if(n.RTCPeerConnection&&e.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser="safari",t.version=li(e.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=n.RTCRtpTransceiver&&"currentDirection"in n.RTCRtpTransceiver.prototype;else return t.browser="Not a supported browser.",t;return t}function fs(n){return Object.prototype.toString.call(n)==="[object Object]"}function mo(n){return fs(n)?Object.keys(n).reduce(function(t,e){const i=fs(n[e]),r=i?mo(n[e]):n[e],s=i&&!Object.keys(r).length;return r===void 0||s?t:Object.assign(t,{[e]:r})},{}):n}function wn(n,t,e){!t||e.has(t.id)||(e.set(t.id,t),Object.keys(t).forEach(i=>{i.endsWith("Id")?wn(n,n.get(t[i]),e):i.endsWith("Ids")&&t[i].forEach(r=>{wn(n,n.get(r),e)})}))}function ds(n,t,e){const i=e?"outbound-rtp":"inbound-rtp",r=new Map;if(t===null)return r;const s=[];return n.forEach(a=>{a.type==="track"&&a.trackIdentifier===t.id&&s.push(a)}),s.forEach(a=>{n.forEach(o=>{o.type===i&&o.trackId===a.id&&wn(n,o,r)})}),r}const ps=Hn;function yo(n,t){const e=n&&n.navigator;if(!e.mediaDevices)return;const i=function(o){if(typeof o!="object"||o.mandatory||o.optional)return o;const c={};return Object.keys(o).forEach(l=>{if(l==="require"||l==="advanced"||l==="mediaSource")return;const u=typeof o[l]=="object"?o[l]:{ideal:o[l]};u.exact!==void 0&&typeof u.exact=="number"&&(u.min=u.max=u.exact);const h=function(f,d){return f?f+d.charAt(0).toUpperCase()+d.slice(1):d==="deviceId"?"sourceId":d};if(u.ideal!==void 0){c.optional=c.optional||[];let f={};typeof u.ideal=="number"?(f[h("min",l)]=u.ideal,c.optional.push(f),f={},f[h("max",l)]=u.ideal,c.optional.push(f)):(f[h("",l)]=u.ideal,c.optional.push(f))}u.exact!==void 0&&typeof u.exact!="number"?(c.mandatory=c.mandatory||{},c.mandatory[h("",l)]=u.exact):["min","max"].forEach(f=>{u[f]!==void 0&&(c.mandatory=c.mandatory||{},c.mandatory[h(f,l)]=u[f])})}),o.advanced&&(c.optional=(c.optional||[]).concat(o.advanced)),c},r=function(o,c){if(t.version>=61)return c(o);if(o=JSON.parse(JSON.stringify(o)),o&&typeof o.audio=="object"){const l=function(u,h,f){h in u&&!(f in u)&&(u[f]=u[h],delete u[h])};o=JSON.parse(JSON.stringify(o)),l(o.audio,"autoGainControl","googAutoGainControl"),l(o.audio,"noiseSuppression","googNoiseSuppression"),o.audio=i(o.audio)}if(o&&typeof o.video=="object"){let l=o.video.facingMode;l=l&&(typeof l=="object"?l:{ideal:l});const u=t.version<66;if(l&&(l.exact==="user"||l.exact==="environment"||l.ideal==="user"||l.ideal==="environment")&&!(e.mediaDevices.getSupportedConstraints&&e.mediaDevices.getSupportedConstraints().facingMode&&!u)){delete o.video.facingMode;let h;if(l.exact==="environment"||l.ideal==="environment"?h=["back","rear"]:(l.exact==="user"||l.ideal==="user")&&(h=["front"]),h)return e.mediaDevices.enumerateDevices().then(f=>{f=f.filter(y=>y.kind==="videoinput");let d=f.find(y=>h.some(_=>y.label.toLowerCase().includes(_)));return!d&&f.length&&h.includes("back")&&(d=f[f.length-1]),d&&(o.video.deviceId=l.exact?{exact:d.deviceId}:{ideal:d.deviceId}),o.video=i(o.video),ps("chrome: "+JSON.stringify(o)),c(o)})}o.video=i(o.video)}return ps("chrome: "+JSON.stringify(o)),c(o)},s=function(o){return t.version>=64?o:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[o.name]||o.name,message:o.message,constraint:o.constraint||o.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},a=function(o,c,l){r(o,u=>{e.webkitGetUserMedia(u,c,h=>{l&&l(s(h))})})};if(e.getUserMedia=a.bind(e),e.mediaDevices.getUserMedia){const o=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(c){return r(c,l=>o(l).then(u=>{if(l.audio&&!u.getAudioTracks().length||l.video&&!u.getVideoTracks().length)throw u.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return u},u=>Promise.reject(s(u))))}}}function Ra(n,t){if(!(n.navigator.mediaDevices&&"getDisplayMedia"in n.navigator.mediaDevices)&&n.navigator.mediaDevices){if(typeof t!="function"){console.error("shimGetDisplayMedia: getSourceId argument is not a function");return}n.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then(r=>{const s=i.video&&i.video.width,a=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:r,maxFrameRate:o||3}},s&&(i.video.mandatory.maxWidth=s),a&&(i.video.mandatory.maxHeight=a),n.navigator.mediaDevices.getUserMedia(i)})}}}function go(n){n.MediaStream=n.MediaStream||n.webkitMediaStream}function vo(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("ontrack"in n.RTCPeerConnection.prototype)){Object.defineProperty(n.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=n.RTCPeerConnection.prototype.setRemoteDescription;n.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=i=>{i.stream.addEventListener("addtrack",r=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(o=>o.track&&o.track.id===r.track.id):s={track:r.track};const a=new Event("track");a.track=r.track,a.receiver=s,a.transceiver={receiver:s},a.streams=[i.stream],this.dispatchEvent(a)}),i.stream.getTracks().forEach(r=>{let s;n.RTCPeerConnection.prototype.getReceivers?s=this.getReceivers().find(o=>o.track&&o.track.id===r.id):s={track:r};const a=new Event("track");a.track=r,a.receiver=s,a.transceiver={receiver:s},a.streams=[i.stream],this.dispatchEvent(a)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else $e(n,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function _o(n){if(typeof n=="object"&&n.RTCPeerConnection&&!("getSenders"in n.RTCPeerConnection.prototype)&&"createDTMFSender"in n.RTCPeerConnection.prototype){const t=function(r,s){return{track:s,get dtmf(){return this._dtmf===void 0&&(s.kind==="audio"?this._dtmf=r.createDTMFSender(s):this._dtmf=null),this._dtmf},_pc:r}};if(!n.RTCPeerConnection.prototype.getSenders){n.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(o,c){let l=r.apply(this,arguments);return l||(l=t(this,o),this._senders.push(l)),l};const s=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(o){s.apply(this,arguments);const c=this._senders.indexOf(o);c!==-1&&this._senders.splice(c,1)}}const e=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(s){this._senders=this._senders||[],e.apply(this,[s]),s.getTracks().forEach(a=>{this._senders.push(t(this,a))})};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(s){this._senders=this._senders||[],i.apply(this,[s]),s.getTracks().forEach(a=>{const o=this._senders.find(c=>c.track===a);o&&this._senders.splice(this._senders.indexOf(o),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 t=n.RTCPeerConnection.prototype.getSenders;n.RTCPeerConnection.prototype.getSenders=function(){const i=t.apply(this,[]);return i.forEach(r=>r._pc=this),i},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 xo(n){if(!n.RTCPeerConnection)return;const t=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){const[i,r,s]=arguments;if(arguments.length>0&&typeof i=="function")return t.apply(this,arguments);if(t.length===0&&(arguments.length===0||typeof i!="function"))return t.apply(this,[]);const a=function(c){const l={};return c.result().forEach(h=>{const f={id:h.id,timestamp:h.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[h.type]||h.type};h.names().forEach(d=>{f[d]=h.stat(d)}),l[f.id]=f}),l},o=function(c){return new Map(Object.keys(c).map(l=>[l,c[l]]))};if(arguments.length>=2){const c=function(l){r(o(a(l)))};return t.apply(this,[c,i])}return new Promise((c,l)=>{t.apply(this,[function(u){c(o(a(u)))},l])}).then(r,s)}}function So(n){if(!(typeof n=="object"&&n.RTCPeerConnection&&n.RTCRtpSender&&n.RTCRtpReceiver))return;if(!("getStats"in n.RTCRtpSender.prototype)){const e=n.RTCPeerConnection.prototype.getSenders;e&&(n.RTCPeerConnection.prototype.getSenders=function(){const s=e.apply(this,[]);return s.forEach(a=>a._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(a=>ds(a,s.track,!0))}}if(!("getStats"in n.RTCRtpReceiver.prototype)){const e=n.RTCPeerConnection.prototype.getReceivers;e&&(n.RTCPeerConnection.prototype.getReceivers=function(){const r=e.apply(this,[]);return r.forEach(s=>s._pc=this),r}),$e(n,"track",i=>(i.receiver._pc=i.srcElement,i)),n.RTCRtpReceiver.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>ds(s,r.track,!1))}}if(!("getStats"in n.RTCRtpSender.prototype&&"getStats"in n.RTCRtpReceiver.prototype))return;const t=n.RTCPeerConnection.prototype.getStats;n.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof n.MediaStreamTrack){const i=arguments[0];let r,s,a;return this.getSenders().forEach(o=>{o.track===i&&(r?a=!0:r=o)}),this.getReceivers().forEach(o=>(o.track===i&&(s?a=!0:s=o),o.track===i)),a||r&&s?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():s?s.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function bo(n){n.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(a=>this._shimmedLocalStreams[a][0])};const t=n.RTCPeerConnection.prototype.addTrack;n.RTCPeerConnection.prototype.addTrack=function(a,o){if(!o)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const c=t.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(c)===-1&&this._shimmedLocalStreams[o.id].push(c):this._shimmedLocalStreams[o.id]=[o,c],c};const e=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(a){this._shimmedLocalStreams=this._shimmedLocalStreams||{},a.getTracks().forEach(l=>{if(this.getSenders().find(h=>h.track===l))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();e.apply(this,arguments);const c=this.getSenders().filter(l=>o.indexOf(l)===-1);this._shimmedLocalStreams[a.id]=[a].concat(c)};const i=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[a.id],i.apply(this,arguments)};const r=n.RTCPeerConnection.prototype.removeTrack;n.RTCPeerConnection.prototype.removeTrack=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},a&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const c=this._shimmedLocalStreams[o].indexOf(a);c!==-1&&this._shimmedLocalStreams[o].splice(c,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),r.apply(this,arguments)}}function To(n,t){if(!n.RTCPeerConnection)return;if(n.RTCPeerConnection.prototype.addTrack&&t.version>=65)return bo(n);const e=n.RTCPeerConnection.prototype.getLocalStreams;n.RTCPeerConnection.prototype.getLocalStreams=function(){const u=e.apply(this);return this._reverseStreams=this._reverseStreams||{},u.map(h=>this._reverseStreams[h.id])};const i=n.RTCPeerConnection.prototype.addStream;n.RTCPeerConnection.prototype.addStream=function(u){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},u.getTracks().forEach(h=>{if(this.getSenders().find(d=>d.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[u.id]){const h=new n.MediaStream(u.getTracks());this._streams[u.id]=h,this._reverseStreams[h.id]=u,u=h}i.apply(this,[u])};const r=n.RTCPeerConnection.prototype.removeStream;n.RTCPeerConnection.prototype.removeStream=function(u){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},r.apply(this,[this._streams[u.id]||u]),delete this._reverseStreams[this._streams[u.id]?this._streams[u.id].id:u.id],delete this._streams[u.id]},n.RTCPeerConnection.prototype.addTrack=function(u,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const f=[].slice.call(arguments,1);if(f.length!==1||!f[0].getTracks().find(_=>_===u))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(_=>_.track===u))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const y=this._streams[h.id];if(y)y.addTrack(u),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const _=new n.MediaStream([u]);this._streams[h.id]=_,this._reverseStreams[_.id]=h,this.addStream(_)}return this.getSenders().find(_=>_.track===u)};function s(l,u){let h=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(f=>{const d=l._reverseStreams[f],y=l._streams[d.id];h=h.replace(new RegExp(y.id,"g"),d.id)}),new RTCSessionDescription({type:u.type,sdp:h})}function a(l,u){let h=u.sdp;return Object.keys(l._reverseStreams||[]).forEach(f=>{const d=l._reverseStreams[f],y=l._streams[d.id];h=h.replace(new RegExp(d.id,"g"),y.id)}),new RTCSessionDescription({type:u.type,sdp:h})}["createOffer","createAnswer"].forEach(function(l){const u=n.RTCPeerConnection.prototype[l],h={[l](){const f=arguments;return arguments.length&&typeof arguments[0]=="function"?u.apply(this,[y=>{const _=s(this,y);f[0].apply(null,[_])},y=>{f[1]&&f[1].apply(null,y)},arguments[2]]):u.apply(this,arguments).then(y=>s(this,y))}};n.RTCPeerConnection.prototype[l]=h[l]});const o=n.RTCPeerConnection.prototype.setLocalDescription;n.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?o.apply(this,arguments):(arguments[0]=a(this,arguments[0]),o.apply(this,arguments))};const c=Object.getOwnPropertyDescriptor(n.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(n.RTCPeerConnection.prototype,"localDescription",{get(){const l=c.get.apply(this);return l.type===""?l:s(this,l)}}),n.RTCPeerConnection.prototype.removeTrack=function(u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!u._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(u._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let f;Object.keys(this._streams).forEach(d=>{this._streams[d].getTracks().find(_=>u.track===_)&&(f=this._streams[d])}),f&&(f.getTracks().length===1?this.removeStream(this._reverseStreams[f.id]):f.removeTrack(u.track),this.dispatchEvent(new Event("negotiationneeded")))}}function En(n,t){!n.RTCPeerConnection&&n.webkitRTCPeerConnection&&(n.RTCPeerConnection=n.webkitRTCPeerConnection),n.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){const i=n.RTCPeerConnection.prototype[e],r={[e](){return arguments[0]=new(e==="addIceCandidate"?n.RTCIceCandidate:n.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};n.RTCPeerConnection.prototype[e]=r[e]})}function Mo(n,t){$e(n,"negotiationneeded",e=>{const i=e.target;if(!((t.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return e})}const ms=Object.freeze(Object.defineProperty({__proto__:null,fixNegotiationNeeded:Mo,shimAddTrackRemoveTrack:To,shimAddTrackRemoveTrackWithNative:bo,shimGetDisplayMedia:Ra,shimGetSendersWithDtmf:_o,shimGetStats:xo,shimGetUserMedia:yo,shimMediaStream:go,shimOnTrack:vo,shimPeerConnection:En,shimSenderReceiverGetStats:So},Symbol.toStringTag,{value:"Module"}));function Aa(n,t){let e=!1;return n=JSON.parse(JSON.stringify(n)),n.filter(i=>{if(i&&(i.urls||i.url)){let r=i.urls||i.url;i.url&&!i.urls&&Jr("RTCIceServer.url","RTCIceServer.urls");const s=typeof r=="string";return s&&(r=[r]),r=r.filter(a=>{if(a.indexOf("stun:")===0)return!1;const o=a.startsWith("turn")&&!a.startsWith("turn:[")&&a.includes("transport=udp");return o&&!e?(e=!0,!0):o&&!e}),delete i.url,i.urls=s?r[0]:r,!!r.length}})}var Yr={exports:{}},ys;function Co(){return ys||(ys=1,function(n){var t={};t.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split(`
2
2
  `).map(function(i){return i.trim()})},t.splitSections=function(e){var i=e.split(`
3
3
  m=`);return i.map(function(r,s){return(s>0?"m="+r:r).trim()+`\r
4
4
  `})},t.getDescription=function(e){var i=t.splitSections(e);return i&&i[0]},t.getMediaSections=function(e){var i=t.splitSections(e);return i.shift(),i},t.matchPrefix=function(e,i){return t.splitLines(e).filter(function(r){return r.indexOf(i)===0})},t.parseCandidate=function(e){var i;e.indexOf("a=candidate:")===0?i=e.substring(12).split(" "):i=e.substring(10).split(" ");for(var r={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]},s=8;s<i.length;s+=2)switch(i[s]){case"raddr":r.relatedAddress=i[s+1];break;case"rport":r.relatedPort=parseInt(i[s+1],10);break;case"tcptype":r.tcpType=i[s+1];break;case"ufrag":r.ufrag=i[s+1],r.usernameFragment=i[s+1];break;default:r[i[s]]=i[s+1];break}return r},t.writeCandidate=function(e){var i=[];i.push(e.foundation),i.push(e.component),i.push(e.protocol.toUpperCase()),i.push(e.priority),i.push(e.address||e.ip),i.push(e.port);var r=e.type;return i.push("typ"),i.push(r),r!=="host"&&e.relatedAddress&&e.relatedPort&&(i.push("raddr"),i.push(e.relatedAddress),i.push("rport"),i.push(e.relatedPort)),e.tcpType&&e.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(i.push("ufrag"),i.push(e.usernameFragment||e.ufrag)),"candidate:"+i.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var i=e.substr(9).split(" "),r={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),r.name=i[0],r.clockRate=parseInt(i[1],10),r.channels=i.length===3?parseInt(i[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var i=e.payloadType;e.preferredPayloadType!==void 0&&(i=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+i+" "+e.name+"/"+e.clockRate+(r!==1?"/"+r:"")+`\r