@rr0/ufoathome 0.190.0 → 0.191.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist-embed-scene/{AdsbLolArchiveProvider-DdUpO-EA.js → AdsbLolArchiveProvider-BtF4baVw.js} +1 -1
  2. package/dist-embed-scene/{BeamEditor-BLtQJ7dq.js → BeamEditor-Dj1Wt50v.js} +1 -1
  3. package/dist-embed-scene/BeamSystem-CaNus1WN.js +1 -0
  4. package/dist-embed-scene/{BirdEditor-C6dn5_wS.js → BirdEditor-CKpe681e.js} +1 -1
  5. package/dist-embed-scene/{BirdFlock-DGC3adr7.js → BirdFlock-B2SbkMme.js} +1 -1
  6. package/dist-embed-scene/ContrailSystem-ChG1viIv.js +1 -0
  7. package/dist-embed-scene/{ControlPasses-BZIhjZfW.js → ControlPasses-Cls4RMwd.js} +1 -1
  8. package/dist-embed-scene/{DroneEditor-iXr-XzB2.js → DroneEditor-BDDLiZPp.js} +1 -1
  9. package/dist-embed-scene/{DroneFlight-D0-Y_wej.js → DroneFlight-BTFHGVWd.js} +1 -1
  10. package/dist-embed-scene/{Flightradar24Provider-DnJbUJ3f.js → Flightradar24Provider-BBj_wixV.js} +1 -1
  11. package/dist-embed-scene/GLTFLoader-CKDxld-A.js +1 -0
  12. package/dist-embed-scene/{GenerativeKitMessages-7-3kT9Ef.js → GenerativeKitMessages-BhHcmiXg.js} +1 -1
  13. package/dist-embed-scene/{HeadlightSystem-DOQSyusn.js → HeadlightSystem-Di3CUtA1.js} +1 -1
  14. package/dist-embed-scene/{LanternEditor-CHkp6fvG.js → LanternEditor-iByq1q3j.js} +1 -1
  15. package/dist-embed-scene/{LaserBeam-BS0xtrAx.js → LaserBeam-BQWS_xWa.js} +1 -1
  16. package/dist-embed-scene/{LaunchEditor-C2XidkVF.js → LaunchEditor-CjpESdIe.js} +1 -1
  17. package/dist-embed-scene/{LaunchPlume-GdjoMQQa.js → LaunchPlume-DVsshxQE.js} +1 -1
  18. package/dist-embed-scene/{LaunchSimulation-C_x89oL_.js → LaunchSimulation-BU7X_C8t.js} +1 -1
  19. package/dist-embed-scene/{ModuleSession-CnHhUFre.js → ModuleSession-Hj3QwLuw.js} +3 -3
  20. package/dist-embed-scene/ModuleThree-D1uz5JiH.js +1 -0
  21. package/dist-embed-scene/{ParameterForm-liNpnZ93.js → ParameterForm-BHRESNZ4.js} +1 -1
  22. package/dist-embed-scene/{RailwaySystem-8h9OGJkr.js → RailwaySystem-DBYCLMyL.js} +1 -1
  23. package/dist-embed-scene/{ReentryEditor-DqSDU-se.js → ReentryEditor-DpNPIxOG.js} +1 -1
  24. package/dist-embed-scene/{ReentrySimulation-DCNhQGDE.js → ReentrySimulation-m-TICP2i.js} +1 -1
  25. package/dist-embed-scene/ReferenceSystem-B6FHr1Pb.js +1 -0
  26. package/dist-embed-scene/{RoadMarkings-DAs6evab.js → RoadMarkings-DzCQFpjf.js} +1 -1
  27. package/dist-embed-scene/{SceneNames_en-BLm2h3zy.js → SceneNames_en-Dn90NisJ.js} +1 -1
  28. package/dist-embed-scene/{SceneNames_es-DrJ24RvP.js → SceneNames_es-DH6GZWja.js} +1 -1
  29. package/dist-embed-scene/{SceneNames_fr-CddH0oWD.js → SceneNames_fr-rltu5c_j.js} +1 -1
  30. package/dist-embed-scene/{SceneNames_it-DL3AbXlk.js → SceneNames_it-DsNshdIp.js} +1 -1
  31. package/dist-embed-scene/{SkyLantern-dInLqzN4.js → SkyLantern-BKxwl7Po.js} +1 -1
  32. package/dist-embed-scene/{TimelineTracks-B73gWzRB.js → TimelineTracks-Cjt0OHJS.js} +1 -1
  33. package/dist-embed-scene/{TraceSystem-vEBDgerB.js → TraceSystem-CwBlzmXK.js} +2 -2
  34. package/dist-embed-scene/{UfoMessages_en-BzK4iS9N.js → UfoMessages_en-A8Ku1B0Y.js} +1 -1
  35. package/dist-embed-scene/{WaterSystem-QZGlpcQ7.js → WaterSystem-BOnTlD7m.js} +2 -2
  36. package/dist-embed-scene/rr0-scene.mjs +331 -331
  37. package/dist-embed-scene/sightingSchema-CgwoRMl-.js +1 -0
  38. package/dist-embed-scene/trafficRuntime-DRDMbo2X.js +2 -0
  39. package/dist-embed-sighting/{AdsbLolArchiveProvider-BYOz5Wdl.js → AdsbLolArchiveProvider-BfWrS1jn.js} +1 -1
  40. package/dist-embed-sighting/{BallesterGuaspAssessor-CLQvJKlm.js → BallesterGuaspAssessor-BPaiHWd9.js} +1 -1
  41. package/dist-embed-sighting/{BeamEditor-Bl_2xUBv.js → BeamEditor--mMu1zwv.js} +2 -2
  42. package/dist-embed-sighting/BeamSystem-Cqe7QaN4.js +1 -0
  43. package/dist-embed-sighting/{BirdEditor-DAw14Ex2.js → BirdEditor-DZ1Ybqeu.js} +1 -1
  44. package/dist-embed-sighting/{BirdFlock-BbObIeXW.js → BirdFlock-BZScQXfR.js} +1 -1
  45. package/dist-embed-sighting/{CaseReportExport-pqKd-0cF.js → CaseReportExport-Jt3sfR-8.js} +3 -3
  46. package/dist-embed-sighting/ContrailSystem-Di5w5IVi.js +1 -0
  47. package/dist-embed-sighting/{ControlPasses-B78JMfGN.js → ControlPasses-Dr6eP2Mq.js} +1 -1
  48. package/dist-embed-sighting/{CoverageAssessor-BSoRnjHD.js → CoverageAssessor-Cu9wP4ZB.js} +1 -1
  49. package/dist-embed-sighting/{DroneEditor-C6uGwJCK.js → DroneEditor-Bo19kUte.js} +2 -2
  50. package/dist-embed-sighting/{DroneFlight-BPuws32_.js → DroneFlight-WxqILFs6.js} +1 -1
  51. package/dist-embed-sighting/{Flightradar24Provider-RjrQ963H.js → Flightradar24Provider-DJmvd2AL.js} +1 -1
  52. package/dist-embed-sighting/GLTFLoader-FWVFviG5.js +1 -0
  53. package/dist-embed-sighting/GenerativeKitMessages-NbyGMKAR.js +1 -0
  54. package/dist-embed-sighting/HeadlightSystem-Ce7sHylX.js +34 -0
  55. package/dist-embed-sighting/{HynekAssessor-CJ9APziM.js → HynekAssessor-DWDZGeLY.js} +1 -1
  56. package/dist-embed-sighting/{LanternEditor-2qGw33iQ.js → LanternEditor-Do0kggi8.js} +1 -1
  57. package/dist-embed-sighting/{LaserBeam-DotCCB1U.js → LaserBeam-CMO6tMze.js} +1 -1
  58. package/dist-embed-sighting/{LaunchEditor-QW4_Sx3j.js → LaunchEditor-CZri7DN4.js} +1 -1
  59. package/dist-embed-sighting/{LaunchPlume-CNTwnOG6.js → LaunchPlume-DxDfUSlS.js} +1 -1
  60. package/dist-embed-sighting/LaunchSimulation-CTxbrEJw.js +1 -0
  61. package/dist-embed-sighting/{ModuleSession-CQnRKmzR.js → ModuleSession-BCtFMDJY.js} +3 -3
  62. package/dist-embed-sighting/ModuleThree-DPVHqcup.js +1 -0
  63. package/dist-embed-sighting/{NearestApproach-iBLl7o1g.js → NearestApproach-CONyx4c5.js} +1 -1
  64. package/dist-embed-sighting/{ParameterForm-DviNoiD5.js → ParameterForm-B8nX9qW-.js} +1 -1
  65. package/dist-embed-sighting/{PoherAssessor-DDRUgnRW.js → PoherAssessor-DI86qOCu.js} +1 -1
  66. package/dist-embed-sighting/RailwaySystem-DcJr9BY_.js +41 -0
  67. package/dist-embed-sighting/{ReentryEditor-MgbKtSa4.js → ReentryEditor-BbhQfIPi.js} +1 -1
  68. package/dist-embed-sighting/ReentrySimulation-BHbW9YNO.js +1 -0
  69. package/dist-embed-sighting/ReferenceSystem-DCSdp9Bq.js +1 -0
  70. package/dist-embed-sighting/{RoadMarkings-CNLt-BEg.js → RoadMarkings-DvWjbrSf.js} +1 -1
  71. package/dist-embed-sighting/{SceneNames_en-Dz2a5iRk.js → SceneNames_en-BlRTU7Hq.js} +1 -1
  72. package/dist-embed-sighting/{SceneNames_es-CKgCl71G.js → SceneNames_es-DMNd9trd.js} +1 -1
  73. package/dist-embed-sighting/{SceneNames_fr-BjpaWmul.js → SceneNames_fr-DlMcv9D0.js} +1 -1
  74. package/dist-embed-sighting/{SceneNames_it-TidFZnkk.js → SceneNames_it-DqlWMlOE.js} +1 -1
  75. package/dist-embed-sighting/{SkyLantern-BdVGIBoq.js → SkyLantern-COmog7pF.js} +1 -1
  76. package/dist-embed-sighting/{TimelineTracks-CvGxdpGb.js → TimelineTracks-CYIJdyPF.js} +1 -1
  77. package/dist-embed-sighting/{TraceSystem-ZNrHrAPL.js → TraceSystem-1K0WblAK.js} +2 -2
  78. package/dist-embed-sighting/{UfoMessages_en-cLvtpfIC.js → UfoMessages_en-CwRXodRE.js} +1 -1
  79. package/dist-embed-sighting/WaterSystem-1VlNXZnO.js +19 -0
  80. package/dist-embed-sighting/rr0-sighting.mjs +350 -350
  81. package/dist-embed-sighting/sightingSchema-CgwoRMl-.js +1 -0
  82. package/dist-embed-sighting/trafficRuntime-CuYrKvX9.js +2 -0
  83. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-DEqEth50.js → AdsbLolArchiveProvider-BrZzIuec.js} +1 -1
  84. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-CapyLOHE.js → BallesterGuaspAssessor-CXvIvYxV.js} +1 -1
  85. package/dist-embed-sighting-editor/{BeamEditor-8960brcL.js → BeamEditor-5-OlhNfL.js} +1 -1
  86. package/dist-embed-sighting-editor/{BeamSystem-BoMHmOf3.js → BeamSystem-BGdR-Xez.js} +1 -1
  87. package/dist-embed-sighting-editor/{BirdEditor-CsyXenUx.js → BirdEditor-ESUliJEN.js} +1 -1
  88. package/dist-embed-sighting-editor/{BirdFlock-CSw6ge15.js → BirdFlock-DtshFXGT.js} +1 -1
  89. package/dist-embed-sighting-editor/{CaseReportExport-CYUM0gPZ.js → CaseReportExport-CKuvpQqy.js} +1 -1
  90. package/dist-embed-sighting-editor/{ContrailSystem-teTrI30G.js → ContrailSystem-BTVyJpmn.js} +1 -1
  91. package/dist-embed-sighting-editor/{ControlPasses-PiJOqNOu.js → ControlPasses-DiQAXMzD.js} +1 -1
  92. package/dist-embed-sighting-editor/{CoverageAssessor-Zh8Hw6yp.js → CoverageAssessor-CJQzNdyr.js} +1 -1
  93. package/dist-embed-sighting-editor/{DecorParameterTexts_en-C5dEeI_C.js → DecorParameterTexts_en-idbdHsFG.js} +1 -1
  94. package/dist-embed-sighting-editor/{DecorParameterTexts_es-BysMOaxT.js → DecorParameterTexts_es-CIkkLQc2.js} +1 -1
  95. package/dist-embed-sighting-editor/{DecorParameterTexts_fr-CThgxosI.js → DecorParameterTexts_fr-D9GeuW_Y.js} +1 -1
  96. package/dist-embed-sighting-editor/{DecorParameterTexts_it-D0ZsTK16.js → DecorParameterTexts_it-v7TBrnsr.js} +1 -1
  97. package/dist-embed-sighting-editor/{DroneEditor-CnlkmY64.js → DroneEditor-DDaJO8FS.js} +1 -1
  98. package/dist-embed-sighting-editor/{DroneFlight-D4RRsn4m.js → DroneFlight-tXCk1Tg1.js} +1 -1
  99. package/dist-embed-sighting-editor/{Flightradar24Provider-D3bM2ckV.js → Flightradar24Provider-DUVcPAF2.js} +1 -1
  100. package/dist-embed-sighting-editor/{GLTFLoader-DWambWcY.js → GLTFLoader-DdijxzcI.js} +1 -1
  101. package/dist-embed-sighting-editor/{HeadlightSystem-LL1DHYBg.js → HeadlightSystem-DRq40K7R.js} +1 -1
  102. package/dist-embed-sighting-editor/{HynekAssessor-wtavw_WK.js → HynekAssessor-PxE7JR1h.js} +1 -1
  103. package/dist-embed-sighting-editor/{InterviewEditorElement-46F4WJC9.js → InterviewEditorElement-D-UDHU0L.js} +2 -2
  104. package/dist-embed-sighting-editor/{LanternEditor-DIew0BrY.js → LanternEditor-DDcI5Kv1.js} +2 -2
  105. package/dist-embed-sighting-editor/{LaserBeam-BcOjgC8-.js → LaserBeam-CadJcSMd.js} +1 -1
  106. package/dist-embed-sighting-editor/{LaunchEditor-CUw-IXhX.js → LaunchEditor-Pkk0K648.js} +1 -1
  107. package/dist-embed-sighting-editor/{LaunchPlume-By8E1xvy.js → LaunchPlume-C7My5ccR.js} +1 -1
  108. package/dist-embed-sighting-editor/{LaunchSimulation-gytH8ZVf.js → LaunchSimulation-45Z9GUBF.js} +1 -1
  109. package/dist-embed-sighting-editor/{ModelSource-BQm0eN7H.js → ModelSource-CzGHu4XS.js} +1 -1
  110. package/dist-embed-sighting-editor/{ModelThumbnails-Bwh2px6A.js → ModelThumbnails-CNO_j-KM.js} +1 -1
  111. package/dist-embed-sighting-editor/{ModelViewer-Dl5ichWV.js → ModelViewer-yfIxofpG.js} +1 -1
  112. package/dist-embed-sighting-editor/{ModuleConformance-DRVG5aJw.js → ModuleConformance-C9DED8Lk.js} +2 -2
  113. package/dist-embed-sighting-editor/{ModuleSession-o0MYjWCQ.js → ModuleSession-Cxe0BJue.js} +2 -2
  114. package/dist-embed-sighting-editor/ModuleThree-DSghL4fp.js +1 -0
  115. package/dist-embed-sighting-editor/{ModulesPanelElement-Uk66Ixvl.js → ModulesPanelElement-DgbOYqaS.js} +3 -3
  116. package/dist-embed-sighting-editor/{NearestApproach-CgC-W_0w.js → NearestApproach-EbQIYGTt.js} +1 -1
  117. package/dist-embed-sighting-editor/{PoherAssessor-C0PuGZ7E.js → PoherAssessor-BisQ5ybV.js} +1 -1
  118. package/dist-embed-sighting-editor/{RailwaySystem-CzCL0bVV.js → RailwaySystem-CIAIBvLT.js} +1 -1
  119. package/dist-embed-sighting-editor/{ReentryEditor-v66u2mvZ.js → ReentryEditor-NE8z5aZT.js} +1 -1
  120. package/dist-embed-sighting-editor/{ReentrySimulation-CLu3E046.js → ReentrySimulation-Crd-CW_o.js} +1 -1
  121. package/dist-embed-sighting-editor/{ReferenceSystem-BWEFysoI.js → ReferenceSystem-DUIJceGg.js} +1 -1
  122. package/dist-embed-sighting-editor/SightingEditorMessages_en-DSPvgYFi.js +12 -0
  123. package/dist-embed-sighting-editor/SightingEditorMessages_es-Bl3DipHr.js +12 -0
  124. package/dist-embed-sighting-editor/SightingEditorMessages_fr-BTmWQX0n.js +12 -0
  125. package/dist-embed-sighting-editor/SightingEditorMessages_it-lzbDsHjx.js +12 -0
  126. package/dist-embed-sighting-editor/{SightingFileEditor-CQtQqTVl.js → SightingFileEditor-0VZmtiOX.js} +1 -1
  127. package/dist-embed-sighting-editor/{SkyLantern-CaRiiIZX.js → SkyLantern-De_MXfQz.js} +1 -1
  128. package/dist-embed-sighting-editor/{TraceSystem-DrdYmWMC.js → TraceSystem-Ba5H90GB.js} +2 -2
  129. package/dist-embed-sighting-editor/{WaterSystem-DJVs_drg.js → WaterSystem-Dpdw46hF.js} +2 -2
  130. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +431 -422
  131. package/dist-embed-sighting-editor/sightingSchema-CgwoRMl-.js +1 -0
  132. package/dist-embed-sighting-editor/trafficRuntime-Cqj3IpvH.js +2 -0
  133. package/package.json +2 -1
  134. package/dist-embed-scene/BeamSystem-Ab_wCPf_.js +0 -1
  135. package/dist-embed-scene/ContrailSystem-BYqjhyyF.js +0 -1
  136. package/dist-embed-scene/GLTFLoader-BmUyASZK.js +0 -1
  137. package/dist-embed-scene/ModuleThree-BzKlu4H2.js +0 -1
  138. package/dist-embed-scene/ReferenceSystem-BTDpVH4u.js +0 -1
  139. package/dist-embed-scene/sightingSchema-CLXF9VE3.js +0 -1
  140. package/dist-embed-scene/trafficRuntime-CJIPy2oO.js +0 -2
  141. package/dist-embed-sighting/BeamSystem-BdJfIbJy.js +0 -1
  142. package/dist-embed-sighting/ContrailSystem-C1pCwq7H.js +0 -1
  143. package/dist-embed-sighting/GLTFLoader-BPxbcVGH.js +0 -1
  144. package/dist-embed-sighting/GenerativeKitMessages-CRj85mnY.js +0 -1
  145. package/dist-embed-sighting/HeadlightSystem-LMaOhpkj.js +0 -34
  146. package/dist-embed-sighting/LaunchSimulation-CoJIQGLm.js +0 -1
  147. package/dist-embed-sighting/ModuleThree-FBgB1-pu.js +0 -1
  148. package/dist-embed-sighting/RailwaySystem-m2A18WjN.js +0 -41
  149. package/dist-embed-sighting/ReentrySimulation-BR0KO3U0.js +0 -1
  150. package/dist-embed-sighting/ReferenceSystem-C1iPC-1U.js +0 -1
  151. package/dist-embed-sighting/WaterSystem-BtEY0XLc.js +0 -19
  152. package/dist-embed-sighting/sightingSchema-CLXF9VE3.js +0 -1
  153. package/dist-embed-sighting/trafficRuntime-CFgDqQz4.js +0 -2
  154. package/dist-embed-sighting-editor/ModuleThree-D1RGQ8X2.js +0 -1
  155. package/dist-embed-sighting-editor/SightingEditorMessages_en-BgJRl09G.js +0 -12
  156. package/dist-embed-sighting-editor/SightingEditorMessages_es-CK8yosal.js +0 -12
  157. package/dist-embed-sighting-editor/SightingEditorMessages_fr-CcBrcUd-.js +0 -12
  158. package/dist-embed-sighting-editor/SightingEditorMessages_it-Dvnh7lnI.js +0 -12
  159. package/dist-embed-sighting-editor/sightingSchema-CLXF9VE3.js +0 -1
  160. package/dist-embed-sighting-editor/trafficRuntime-j8tnHTec.js +0 -2
@@ -1 +0,0 @@
1
- import{G as V,B as W,p as H,m as X,$ as v,a0 as k,a3 as D}from"./rr0-scene.mjs";import{L as S}from"./LaserBeam-BS0xtrAx.js";class x{static MAX_SEGMENTS=12e3;static MIN_PIXELS=2;static VERTICES_PER_SEGMENT=24;static HALO_RAD=.002;static HALO_SHARE=.15;static BRIGHTEST_RELATIVE=6e4;group=new V;mesh;positions=new Float32Array(x.MAX_SEGMENTS*x.VERTICES_PER_SEGMENT*3);colors=new Float32Array(x.MAX_SEGMENTS*x.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new W;s.setAttribute("position",new H(this.positions,3)),s.setAttribute("color",new H(this.colors,3)),s.setDrawRange(0,0),this.mesh=new X(s,new v({vertexColors:!0,transparent:!0,blending:D,depthWrite:!1,fog:!1,side:k})),this.mesh.frustumCulled=!1,this.mesh.renderOrder=8,this.mesh.name="beams",this.group.name="beams",this.group.add(this.mesh)}get segmentCount(){return this.segments}get object(){return this.group}get drawnCount(){return this.segments}pick(s,t,e){return this.pickAt(s,t,e.toleranceRad)}update(s,t,e){const l=this.viewsOf(s,t,e);let r=0;this.segments=0,this.drawn=[];for(const h of l){const c=S.colourOf(h.wavelengthNm),i=this.place(h,t,e);this.drawn.push({id:h.id,points:i});for(let y=0;y+1<i.length&&!(this.segments>=x.MAX_SEGMENTS);y++){const E=this.pushSegment(r,i[y],i[y+1],h.wavelengthNm,c,e);E>r&&this.segments++,r=E}}const o=this.mesh.geometry;o.setDrawRange(0,r);for(const h of["position","color"]){const c=o.getAttribute(h);c.clearUpdateRanges(),r>0&&c.addUpdateRange(0,r*3),c.needsUpdate=!0}}viewsOf(s,t,e){const{lat:l,lng:r}=e.reference;(!this.cut||this.cut.lat!==l||this.cut.lng!==r||this.cut.air!==e.air)&&(this.cut={lat:l,lng:r,air:e.air,views:new Map});const o=this.cut.views,h=new Set(s);return S.onAt(s,t).map(c=>{if(!h.has(c))return S.viewOf(c,e.reference,e.air);let i=o.get(c);return i||o.set(c,i=S.viewOf(c,e.reference,e.air)),i})}place(s,t,e){const l=[],r=e.wind??{eastMS:0,northMS:0};for(const o of s.samples){const h=e.origin.x+o.eastM*e.eastScale,c=e.origin.z-o.northM,i=o.upM-e.siteElevationM;if(l.length>0&&i<e.groundYAt(h,c))break;const y=r.eastMS*o.dirEast+r.northMS*o.dirNorth,E=r.eastMS*o.dirNorth-r.northMS*o.dirEast,g=S.patchAt(o.fromSourceM,t,{windAlongMS:y,windAcrossMS:E,patchiness:s.patchiness});l.push({x:h,y:i,z:c,altitudeM:o.altitudeM,widthM:o.widthM,powerW:o.powerW,haze:g})}return l}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,e,l,r,o,h=0){const c={x:e.x-t.x,y:e.y-t.y,z:e.z-t.z},i=Math.hypot(c.x,c.y,c.z);if(i<1e-6)return s;const y={x:c.x/i,y:c.y/i,z:c.z/i};if(Math.hypot((t.x+e.x)/2-o.eye.x,(t.y+e.y)/2-o.eye.y,(t.z+e.z)/2-o.eye.z)<.001)return s;const E=n=>{const u={x:o.eye.x-n.x,y:o.eye.y-n.y,z:o.eye.z-n.z},z=Math.hypot(u.x,u.y,u.z)||.001,p=(y.x*u.x+y.y*u.y+y.z*u.z)/z,a=Math.sqrt(Math.max(0,1-p*p)),w=S.coefficientsAt(o.air,l,n.altitudeM),d=S.phasedScattering({...w,aerosolPerM:w.aerosolPerM*n.haze},p);return{sinTurn:a,scattered:d,through:o.transmittanceTo(n.x,n.y,n.z)}},g=n=>x.MIN_PIXELS*o.pixelRad*Math.hypot(n.x-o.eye.x,n.y-o.eye.y,n.z-o.eye.z),N=n=>Math.hypot(n.x-o.eye.x,n.y-o.eye.y,n.z-o.eye.z),R=n=>Math.max(n.widthM,x.HALO_RAD*N(n)),f=n=>{const u=R(n)/g(n),z=Math.min(1,Math.max(0,u-1));return x.HALO_SHARE*z*z*(3-2*z)},O=new Map([t,e].map(n=>[n,E(n)])),M=(n,u,z)=>{const p=Math.max(u,g(n)),{sinTurn:a,scattered:w,through:d}=O.get(n),I=2*z*S.luminanceCdM2(n.powerW,l,w,p,a),L=r.map((C,m)=>Math.min(x.BRIGHTEST_RELATIVE,I*o.relativeScale*C*d[m])),_={x:o.eye.x-n.x,y:o.eye.y-n.y,z:o.eye.z-n.z},P=this.normalise(this.cross(y,_));return{point:n,half:p/2,level:L,across:P}},A=[[M(t,t.widthM,1-f(t)),M(e,e.widthM,1-f(e))],[M(t,R(t),f(t)),M(e,R(e),f(e))]],[G,T]=A[0].map(n=>Math.max(...n.level));if(h<x.MAX_HALVINGS&&Math.max(G,T)>x.SMOOTH_RATIO*Math.max(Math.min(G,T),1e-12)){const n={x:(t.x+e.x)/2,y:(t.y+e.y)/2,z:(t.z+e.z)/2,altitudeM:(t.altitudeM+e.altitudeM)/2,widthM:(t.widthM+e.widthM)/2,powerW:Math.sqrt(t.powerW*e.powerW),haze:(t.haze+e.haze)/2};return this.pushSegment(this.pushSegment(s,t,n,l,r,o,h+1),n,e,l,r,o,h+1)}if((s+x.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const n of A){if(n.every(a=>Math.max(...a.level)<=0))continue;const u=(a,w)=>{const d=s*3;this.positions[d]=a.point.x+a.across.x*a.half*w,this.positions[d+1]=a.point.y+a.across.y*a.half*w,this.positions[d+2]=a.point.z+a.across.z*a.half*w;const I=w===0?1:0;this.colors[d]=a.level[0]*I,this.colors[d+1]=a.level[1]*I,this.colors[d+2]=a.level[2]*I,s++},[z,p]=n;for(const a of[-1,1])u(z,a),u(z,0),u(p,a),u(z,0),u(p,0),u(p,a)}return s}pickAt(s,t,e){let l;for(const r of this.drawn)for(let o=0;o+1<r.points.length;o++){const h=r.points[o],c=r.points[o+1],i={x:c.x-h.x,y:c.y-h.y,z:c.z-h.z},y={x:h.x-s.x,y:h.y-s.y,z:h.z-s.z},E=i.x*i.x+i.y*i.y+i.z*i.z,g=i.x*t.x+i.y*t.y+i.z*t.z,N=i.x*y.x+i.y*y.y+i.z*y.z,R=t.x*y.x+t.y*y.y+t.z*y.z,f=E-g*g,O=f>1e-9?Math.min(1,Math.max(0,(g*R-N)/f)):0,M={x:h.x+i.x*O,y:h.y+i.y*O,z:h.z+i.z*O},A=(M.x-s.x)*t.x+(M.y-s.y)*t.y+(M.z-s.z)*t.z;if(A<=0)continue;const G=Math.hypot(M.x-s.x-t.x*A,M.y-s.y-t.y*A,M.z-s.z-t.z*A),T=Math.atan2(G,A);T<=e&&(!l||T<l.angle)&&(l={id:r.id,distanceM:Math.hypot(M.x-s.x,M.y-s.y,M.z-s.z),angle:T})}return l&&{id:l.id,distanceM:l.distanceM}}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.group.removeFromParent()}}export{x as BeamSystem};
@@ -1 +0,0 @@
1
- import{G as m,B as F,p as I,m as X,$ as B,a0 as D}from"./rr0-scene.mjs";import{C as x}from"./ContrailGrowth-DwHS8If9.js";class h{static MAX_SEGMENTS=8e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static STATIONS=[0,.5,1,1.5,2.25];static VERTICES_PER_SEGMENT=12*(h.STATIONS.length-1);static ICE_ASYMMETRY=.75;static phase(t){const s=h.ICE_ASYMMETRY;return(1-s*s)/(1+s*s-2*s*t)**1.5}object;group=new m;trails=[];positions=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*3);colors=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new F;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,4)),t.setDrawRange(0,0),this.object=new X(t,new B({vertexColors:!0,transparent:!0,depthWrite:!1,side:D})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,c){let p=0;this.segments=0;for(const o of this.trails){const u=this.samplesOf(o,t,s),i=c(o.id);for(let a=0;a+1<u.length;a++){const n=u[a],M=u[a+1];if(!n.forms||!M.forms)continue;if(this.segments>=h.MAX_SEGMENTS)break;const d=this.pushSegment(p,n,M,o.spanM,i,s);d>p&&this.segments++,p=d}}const y=this.object.geometry;y.setDrawRange(0,p);for(const[o,u]of[["position",3],["color",4]]){const i=y.getAttribute(o);i.clearUpdateRanges(),p>0&&i.addUpdateRange(0,p*u),i.needsUpdate=!0}}samplesOf(t,s,c){const p=s-x.FORMATION_S*1e3,y=[],o=(n,M,d,T,l,N)=>({x:M+n.driftEastMs*l+c.origin.x,y:T,z:-(d+n.driftNorthMs*l)+c.origin.z,age:l,forms:N,point:n});let u=-1;t.points.forEach((n,M)=>{n.tMs>p||(u=M,y.push(o(n,n.eastM,n.northM,n.upM,(s-n.tMs)/1e3,n.forms)))});const i=t.points[u],a=t.points[u+1];if(i&&a){const n=(p-i.tMs)/(a.tMs-i.tMs),M=(d,T)=>d+(T-d)*n;y.push(o(i,M(i.eastM,a.eastM),M(i.northM,a.northM),M(i.upM,a.upM),x.FORMATION_S,i.forms&&a.forms))}return y}pushSegment(t,s,c,p,y,o){const u=e=>({persistent:e.point.persistent,lifetimeS:e.point.lifetimeS,spanM:p,shearPerS:e.point.shearPerS,saturatedForS:e.point.saturatedForS}),i=x.opacity(s.age,u(s)),a=x.opacity(c.age,u(c));if(i<=0&&a<=0)return t;const n={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z};if(Math.hypot(n.x,n.y,n.z)<1e-6)return t;const M={x:(s.x+c.x)/2-o.eye.x,y:(s.y+c.y)/2-o.eye.y,z:(s.z+c.z)/2-o.eye.z},d=this.normalise(this.cross(n,M)),T=e=>{if(!o.sun)return y;const r={x:e.x-o.eye.x,y:e.y-o.eye.y,z:e.z-o.eye.z},E=h.phase((o.sun.x*r.x+o.sun.y*r.y+o.sun.z*r.z)/(Math.hypot(r.x,r.y,r.z)||1));return[y[0]*E,y[1]*E,y[2]*E]},l=(e,r)=>{const E=Math.hypot(e.x-o.eye.x,e.y-o.eye.y,e.z-o.eye.z),A=x.widthM(p,e.age,e.point.shearPerS),g=Math.max(A,h.MIN_PIXELS*o.pixelRad*E),z=r*(A/g)**h.UNRESOLVED_CONTRAST,S=x.profileExponent(e.age),G=h.STATIONS.map((j,P)=>P===h.STATIONS.length-1?0:z*Math.exp(-Math.LN2*j**S));return{half:g/2,profile:G,scattered:T(e)}},N=[{sample:s,...l(s,i)},{sample:c,...l(c,a)}],w=h.STATIONS.length-1,f=(e,r,E)=>{const A=h.STATIONS[r],g=e.half*A*E,z=t*3;this.positions[z]=e.sample.x+d.x*g,this.positions[z+1]=e.sample.y+d.y*g,this.positions[z+2]=e.sample.z+d.z*g;const S=t*4;this.colors[S]=e.scattered[0],this.colors[S+1]=e.scattered[1],this.colors[S+2]=e.scattered[2],this.colors[S+3]=e.profile[r],t++},[R,O]=N;for(const e of[-1,1])for(let r=0;r<w;r++)f(R,r+1,e),f(R,r,e),f(O,r+1,e),f(R,r,e),f(O,r,e),f(O,r+1,e);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{h as ContrailSystem};
@@ -1 +0,0 @@
1
- import{an as Le,ao as Q,ap as he,aq as Me,ar as v,as as de,d as w,j as pe,C as F,at as N,ab as U,a1 as Se,au as ye,av as we,e as B,aw as Ne,V as C,a9 as me,ax as be,ag as ge,ay as Ie,az as Oe,p as V,aA as Ce,aB as Te,aC as Fe,aD as Pe,aE as He,n as J,a5 as Re,aF as Z,aG as ke,aH as De,N as Ge,aI as X,aJ as ve,o as Ee,a0 as Ue,$ as G,aK as Be,B as Ke,aL as je,m as Ve,aM as Xe,aN as ze,aO as qe,Q as We,G as z,g as Ye,J as Qe,aP as Je,aQ as Ze,aR as $e,aS as en,aT as nn,aU as tn,aV as xe,t as sn,ac as ne,aW as te,aX as se,aY as ie,aZ as re,a_ as rn,a$ as on,v as an,w as cn}from"./rr0-scene.mjs";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class jn extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new Sn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new yn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===Ae){try{r[g.KHR_BINARY_GLTF]=new wn(n)}catch(l){t&&t(l);return}i=JSON.parse(r[g.KHR_BINARY_GLTF].content)}else i=JSON.parse(o.decode(n));else i=n;if(i.asset===void 0||i.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Un(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const l=i.extensionsUsed[u],h=i.extensionsRequired||[];switch(l){case g.KHR_MATERIALS_UNLIT:r[l]=new fn;break;case g.KHR_DRACO_MESH_COMPRESSION:r[l]=new Nn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new bn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function _(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],N);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new we(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ye(u),c.distance=l;break;case"spot":c=new Se(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),y(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+n),t=Promise.resolve(c),e.cache.add(s,t),t}getDependency(n,e){if(n==="light")return this._loadLight(e)}createNodeAttachment(n){const e=this,s=this.parser,i=s.json.nodes[n],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(e.cache,a,o)})}}class fn{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return G}extendParams(n,e,s){const t=[];n.color=new F(1,1,1),n.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;n.color.setRGB(r[0],r[1],r[2],N),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],N)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],N),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],N),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class Sn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class yn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new B,m=new C,T=new me,A=new C(1,1,1),x=new Ne(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&A.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,A));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new be(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const Ae="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class wn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ae)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Nn{constructor(n,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=n,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(n,e){const s=this.json,t=this.dracoLoader,i=n.extensions[this.name].bufferView,r=n.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=$[u]||u.toLowerCase();a[l]=r[u]}for(const u in n.attributes){const l=$[u]||u.toLowerCase();if(r[u]!==void 0){const h=s.accessors[n.attributes[u]],d=H[h.componentType];c[l]=d.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",i).then(function(u){return new Promise(function(l,h){t.decodeDracoFile(u,function(d){for(const p in d.attributes){const R=d.attributes[p],m=o[p];m!==void 0&&(R.normalized=m)}l(d)},a,c,N,h)})})}}class bn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class _e extends on{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,A=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],b=r[R+E+o]*u,S=r[p+E+a],k=r[p+E]*u;i[E]=A*L+x*b+m*S+T*k}return i}}const On=new me;class Cn extends _e{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:tn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:rn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function y(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new B;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),y(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),A="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(A);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(A,x)),m=new sn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,A=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new A(r[1],x,t.sparse.count*T),b=new c(r[2],E,t.sparse.count*o);a!==null&&(m=new V(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let S=0,k=L.length;S<k;S++){const P=L[S];if(m.setX(P,b[S*o]),o>=2&&m.setY(P,b[S*o+1]),o>=3&&m.setZ(P,b[S*o+2]),o>=4&&m.setW(P,b[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(n){const e=this.json,s=this.options,i=e.textures[n].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const o=s.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(n,i,a)}loadTextureImage(n,e,s){const t=this,i=this.json,r=i.textures[n],a=i.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(i.samplers||{})[r.sampler]||{};return u.magFilter=ue[h.magFilter]||J,u.minFilter=ue[h.minFilter]||Te,u.wrapS=le[h.wrapS]||Z,u.wrapT=le[h.wrapT]||Z,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Re&&u.minFilter!==J,t.associations.set(u,{textures:n}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(n,e){const s=this,t=this.json,i=this.options;if(this.sourceCache[n]!==void 0)return this.sourceCache[n].then(l=>l.clone());const r=t.images[n],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=s.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,d){let p=h;e.isImageBitmapLoader===!0&&(p=function(R){const m=new ne(R);m.needsUpdate=!0,h(m)}),e.load(v.resolveURL(l,i.path),p,void 0,d)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),y(l,r),l.userData.mimeType=r.mimeType||Gn(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[n]=u,u}assignTexture(n,e,s,t){const i=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),i.extensions[g.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=i.associations.get(r);r=i.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,o)}}return t!==void 0&&(r.colorSpace=t),n[e]=r,r})}assignFinalMaterial(n){const e=n.geometry;let s=n.material;const t=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(n.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(n.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new ve,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(t||i||r){let a="ClonedMaterial:"+s.uuid+":";t&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),i&&(o.vertexColors=!0),r&&(o.flatShading=!0),t&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}n.material=s}getMaterialType(){return Ee}loadMaterial(n){const e=this,s=this.json,t=this.extensions,i=s.materials[n];let r;const a={},o=i.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){const l=t[g.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,i,e))}else{const l=i.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],N),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(n)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(n,a)})))}i.doubleSided===!0&&(a.side=Ue);const u=i.alphaMode||W.OPAQUE;if(u===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new pe(1,1),i.normalTexture.scale!==void 0)){const l=i.normalTexture.scale;a.normalScale.set(l,l)}if(i.occlusionTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==G){const l=i.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],N)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),y(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Be.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Ke,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const A=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,A):new Ve(R,A),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,A);else if(m.mode===M.LINE_STRIP)T=new ze(R,A);else if(m.mode===M.LINE_LOOP)T=new qe(R,A);else if(m.mode===M.POINTS)T=new We(R,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),y(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),y(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new B;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,A=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",A)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],b=d[x],S=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const K=s._createAnimationTracks(L,b,S,k,P);if(K)for(let j=0;j<K.length;j++)T.push(K[j])}const A=new $e(i,void 0,T);return y(A,t),A})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),y(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new B;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),y(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(nn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:_e;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Bn(f,n,e){const s=n.attributes,t=new an;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new cn;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==N&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),y(f,n),Bn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{jn as GLTFLoader};
@@ -1 +0,0 @@
1
- import{V as a,j as e,by as s,X as t,Z as r,ae as i,x as o,a9 as n,N as l,Q as u,au as d,af as m,ag as M,bz as b,o as B,$ as y,m as G,e as S,aM as f,aJ as c,aN as p,G as h,a_ as x,F as C,bA as g,a0 as D,bB as E,bC as L,bD as A,C as P,Y as T,B as F,p as N,bE as V,ad as j,a3 as v}from"./rr0-scene.mjs";const Q={AdditiveBlending:v,BackSide:j,BoxGeometry:V,BufferAttribute:N,BufferGeometry:F,CanvasTexture:T,Color:P,ConeGeometry:A,CylinderGeometry:L,DataTexture:E,DoubleSide:D,Euler:g,Float32BufferAttribute:C,FrontSide:x,Group:h,Line:p,LineBasicMaterial:c,LineSegments:f,Matrix4:S,Mesh:G,MeshBasicMaterial:y,MeshStandardMaterial:B,NormalBlending:b,Object3D:M,PlaneGeometry:m,PointLight:d,Points:u,PointsMaterial:l,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{Q as MODULE_THREE};
@@ -1 +0,0 @@
1
- import{k as D,a9 as A,aa as b,ab as M,n as p,ac as O,m as I,$ as x,ad as T,ae as S,af as N,ag as F}from"./rr0-scene.mjs";class h{static SEEK_BEYOND_S=.25;static SAME_FRAME_S=1/60;static CATCH_UP_SHARE=.1;static MIN_RATE=.0625;static MAX_RATE=16;static rollOfPicture(t){return t&&-t}static kindOfSource(t){if(t.type?.startsWith("video/"))return"video";if(t.type?.startsWith("image/"))return"photo";const i=t.url??"";if(i.startsWith("data:video/")||/\.(mp4|m4v|webm|ogv|mov)(?:[?#].*)?$/i.test(i))return"video";if(i.startsWith("data:image/")||/\.(jpe?g|png|gif|webp|avif)(?:[?#].*)?$/i.test(i))return"photo"}static mediaSecondsAt(t,i,s,a){const e=t.video?.fromS??0,o=t.video?.toS??a??Number.POSITIVE_INFINITY,n=i-(t.t??0);if(n<0)return;const r=e+n/(h.positive(s)*1e3)*h.rateOf(t);return r<=o?r:void 0}static rateOf(t){return h.positive(t.video?.rate??1)}static registrationAt(t,i){const s=t.registration,a=t.registrationTrack;if(!a||a.length===0)return s;let e=a.findIndex(E=>E.t>i);e===-1&&(e=a.length);const o=a[Math.max(e-1,0)],n=a[Math.min(e,a.length-1)],r=n.t>o.t?Math.min(Math.max((i-o.t)/(n.t-o.t),0),1):0,c=((n.headingDeg-o.headingDeg)%360+540)%360-180,f=o.rollDeg??0,y=n.rollDeg??0,v=f+(y-f)*r,w=o.fovDeg??s.fovDeg;return{headingDeg:((o.headingDeg+c*r)%360+360)%360,pitchDeg:o.pitchDeg+(n.pitchDeg-o.pitchDeg)*r,rollDeg:v===0?void 0:v,fovDeg:w+((n.fovDeg??s.fovDeg)-w)*r}}static keyIndexAt(t,i){return(t.registrationTrack??[]).findIndex(s=>Math.abs(s.t-i)<20)}static withKey(t,i,s){const a={t:i,...s},e=h.keyIndexAt(t,i),n=[...(t.registrationTrack??[]).filter((r,c)=>c!==e),e>=0?{...a,t:t.registrationTrack[e].t}:a].sort((r,c)=>r.t-c.t);return{...t,registrationTrack:n,registration:h.plainOf(n[0],t.registration)}}static withoutKey(t,i){const s=h.keyIndexAt(t,i);if(s<0)return t;const a=t.registrationTrack.filter((e,o)=>o!==s);return a.length===0?{...t,registrationTrack:void 0}:{...t,registrationTrack:a,registration:h.plainOf(a[0],t.registration)}}static plainOf(t,i){return{headingDeg:t.headingDeg,pitchDeg:t.pitchDeg,rollDeg:t.rollDeg,fovDeg:t.fovDeg??i.fovDeg}}static command(t,i,s,a){const e=Math.min(Math.max(a,h.MIN_RATE),h.MAX_RATE),o=i-t;if(!s)return{seekS:Math.abs(o)>h.SAME_FRAME_S?i:void 0,play:!1,rate:e};if(Math.abs(o)>h.SEEK_BEYOND_S)return{seekS:i,play:!0,rate:e};const n=Math.min(Math.max(o/h.SEEK_BEYOND_S,-1),1)*h.CATCH_UP_SHARE;return{play:!0,rate:Math.min(Math.max(e*(1+n),h.MIN_RATE),h.MAX_RATE)}}static positive(t){return t>0?t:1}}class u extends Error{constructor(t,i){super(`${t}: ${i.kind==="status"?i.status:i.kind}`),this.src=t,this.failure=i}}class g{static async blob(t){let i;try{i=await fetch(t)}catch{throw new u(t,await g.whyUnread(t))}if(!i.ok)throw new u(t,{kind:"status",status:i.status});const s=await i.blob();if(s.type&&!s.type.startsWith("image/"))throw new u(t,{kind:"notPicture"});return s}static failureOf(t){return t instanceof u?t.failure:{kind:"notPicture"}}static async whyVideoUnread(t){if(t.startsWith("data:")||t.startsWith("blob:"))return{kind:"notVideo"};let i;try{i=await fetch(t,{method:"HEAD"})}catch{return g.whyUnread(t)}return i.ok?{kind:"notVideo"}:{kind:"status",status:i.status}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const k=3,m=800,l=Math.PI/180;class d{constructor(t,i,s=d.fetchImage,a=d.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=a}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=D(i.lat,i.lng,t.from.lat,t.from.lng),e=(Math.hypot(s.x,s.z)-d.PRESENT_WITHIN_M)/(d.GONE_BEYOND_M-d.PRESENT_WITHIN_M),o=Math.min(Math.max(e,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const a=new Set(t.map(e=>e.id));for(const[e,o]of this.meshes)a.has(e)||(this.dispose(o),this.meshes.delete(e),this.signatures.delete(e));for(const[e,o]of this.images){const n=t.find(c=>c.id===e);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;d.release(o),this.images.delete(e);const r=this.meshes.get(e);r&&(this.dispose(r),this.meshes.delete(e),this.signatures.delete(e))}for(const e of t){const o=this.images.get(e.id);if(!o){this.load(e);continue}this.build(e,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=k;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const a=i?.get(s);a&&s.quaternion.copy(this.cameraTurn).multiply(a),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new A;get furthestM(){return this.meshes.size>0?m:0}directionOfPixel(t,i,s,a){const e=this.images.get(t.id),o=e?e.width/e.height:1,n=h.registrationAt(t,this.clock.t),r=Math.tan(n.fovDeg/2*l),c=r*o;return a.set((i*2-1)*c,(1-s*2)*r,-1).normalize(),a.applyQuaternion(d.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&d.point(i,t,h.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const a=h.command(i.currentTime,s,this.clock.playing,h.rateOf(t));i.playbackRate=a.rate,a.seekS!==void 0&&!i.seeking&&(i.currentTime=a.seekS),a.play&&i.paused&&i.play().catch(()=>{}),!a.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",e=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(r=>r.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){d.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,g.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,e)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,a)=>{const e=document.createElement("video");e.crossOrigin="anonymous",e.muted=!0,e.playsInline=!0,e.preload="auto",e.addEventListener("loadeddata",()=>{const o=new b(e);o.colorSpace=M,o.minFilter=p,o.magFilter=p,o.generateMipmaps=!1,e.addEventListener("seeked",i);const n=()=>{e.paused&&i(),e.src&&e.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(n),s({texture:o,width:e.videoWidth,height:e.videoHeight,video:e})},{once:!0}),e.addEventListener("error",()=>{g.whyVideoUnread(t).then(o=>a(new u(t,o)))},{once:!0}),e.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await g.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new u(t,{kind:"notPicture"})}),a=new O(s);return a.flipY=!1,a.colorSpace=M,a.minFilter=p,a.magFilter=p,a.generateMipmaps=!1,a.needsUpdate=!0,{texture:a,width:s.width,height:s.height}}build(t,i){const s=d.signatureOf(t,i);let a=this.meshes.get(t.id);if(a&&this.signatures.get(t.id)===s){this.applyOpacity(a,t.id);return}a&&(this.dispose(a),this.meshes.delete(t.id)),a=new I(d.geometryOf(t,i),new x({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(a.material.side=T),a.frustumCulled=!1,a.layers.set(k),a.userData.id=t.id,d.point(a,t,h.registrationAt(t,this.clock.t)),this.scene.add(a),this.meshes.set(t.id,a),this.signatures.set(t.id,s),this.applyOpacity(a,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new S(m,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let r=0;r<n.count;r++)n.setX(r,1-n.getX(r));return n.needsUpdate=!0,o}const s=2*m*Math.tan(t.registration.fovDeg/2*l),a=s*(i.width/Math.max(i.height,1)),e=new N(a,s);return e.translate(0,0,-m),e}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const a=new F;return a.rotation.set(i*l,-t*l,-(s??0)*l,"YXZ"),a.quaternion}static point(t,i,s){if(t.quaternion.copy(d.orientation(s)),i.kind==="panorama")return;const a=Math.tan(s.fovDeg/2*l)/Math.tan(i.registration.fovDeg/2*l);t.scale.set(a,a,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(e=>e.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),a=i?d.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*a}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:a,rollDeg:e,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,a,e??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())d.release(t);this.images.clear()}}export{k as REFERENCE_LAYER,d as ReferenceSystem};