@rr0/ufoathome 0.164.0 → 0.165.0

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 (188) hide show
  1. package/dist-embed-scene/{AdsbLolArchiveProvider-CO4IRthj.js → AdsbLolArchiveProvider-Cea0LAnZ.js} +1 -1
  2. package/dist-embed-scene/BeamEditor-DcUBLvPh.js +30 -0
  3. package/dist-embed-scene/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  4. package/dist-embed-scene/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  5. package/dist-embed-scene/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  6. package/dist-embed-scene/BeamEditorMessages_it-DVweRQFi.js +1 -0
  7. package/dist-embed-scene/BeamSystem-B80EaJKx.js +1 -0
  8. package/dist-embed-scene/{ContrailSystem-GO0Hkyj3.js → ContrailSystem-CcDlnjiD.js} +1 -1
  9. package/dist-embed-scene/GLTFLoader-YecOnQON.js +1 -0
  10. package/dist-embed-scene/{HeadlightSystem-DNMtQJ-Z.js → HeadlightSystem-B0Ubhwxs.js} +1 -1
  11. package/dist-embed-scene/LanternEditor-DQ9Y_eBl.js +9 -0
  12. package/dist-embed-scene/LanternEditorMessages_en-DaT3UNfD.js +1 -0
  13. package/dist-embed-scene/LanternEditorMessages_es-TDV5lKeJ.js +1 -0
  14. package/dist-embed-scene/LanternEditorMessages_fr-9mByTFMG.js +1 -0
  15. package/dist-embed-scene/LanternEditorMessages_it-MRkJnDQp.js +1 -0
  16. package/dist-embed-scene/LaserBeam-DXzWB-xk.js +1 -0
  17. package/dist-embed-scene/LaunchEditor-Csb2Pfq3.js +22 -0
  18. package/dist-embed-scene/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  19. package/dist-embed-scene/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  20. package/dist-embed-scene/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  21. package/dist-embed-scene/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  22. package/dist-embed-scene/LaunchPlume-DwOSrKP_.js +1 -0
  23. package/dist-embed-scene/LaunchSimulation-ClGdZJHr.js +1 -0
  24. package/dist-embed-scene/ModuleSession-DAQNvnRi.js +3 -0
  25. package/dist-embed-scene/ModuleThree-Cozd8KlK.js +1 -0
  26. package/dist-embed-scene/ParameterForm-D0GvLmqx.js +85 -0
  27. package/dist-embed-scene/{RailwaySystem-1yA_UYdB.js → RailwaySystem-DZQr_rS_.js} +1 -1
  28. package/dist-embed-scene/ReentryEditor-AsKtWLMw.js +27 -0
  29. package/dist-embed-scene/ReentryEditorMessages_en-O-YSmHxv.js +1 -0
  30. package/dist-embed-scene/ReentryEditorMessages_es-CvO9Jwz5.js +1 -0
  31. package/dist-embed-scene/ReentryEditorMessages_fr-xuC-qZ6M.js +1 -0
  32. package/dist-embed-scene/ReentryEditorMessages_it-B7vyCX9o.js +1 -0
  33. package/dist-embed-scene/ReentrySimulation-rnJU2x1Y.js +1 -0
  34. package/dist-embed-scene/ReferenceSystem-BgT1nVgA.js +1 -0
  35. package/dist-embed-scene/{SceneNames_es-xcbww_vR.js → SceneNames_es-DL0IWHOw.js} +1 -1
  36. package/dist-embed-scene/{SceneNames_fr-COj1rUw_.js → SceneNames_fr-B2NX5JJO.js} +1 -1
  37. package/dist-embed-scene/{SceneNames_it-BiqZMsLB.js → SceneNames_it-wq6fqU10.js} +1 -1
  38. package/dist-embed-scene/TimelineTracks-Bv2FX3_W.js +35 -0
  39. package/dist-embed-scene/{TraceSystem-B9WBM9ut.js → TraceSystem-D7pxye9d.js} +1 -1
  40. package/dist-embed-scene/WaterSystem-DI_NBDfH.js +1 -0
  41. package/dist-embed-scene/rr0-scene.mjs +345 -345
  42. package/dist-embed-scene/{sightingSchema-CnDwuCov.js → sightingSchema-CKUYrwgu.js} +1 -1
  43. package/dist-embed-scene/trafficRuntime-C3sA3Jg_.js +2 -0
  44. package/dist-embed-sighting/{AdsbLolArchiveProvider-CX1R8zJF.js → AdsbLolArchiveProvider-BGg8e-TS.js} +1 -1
  45. package/dist-embed-sighting/{BallesterGuaspAssessor-CCjRjJck.js → BallesterGuaspAssessor-DHpHbF6s.js} +1 -1
  46. package/dist-embed-sighting/BeamEditor-KLBjeTRU.js +30 -0
  47. package/dist-embed-sighting/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  48. package/dist-embed-sighting/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  49. package/dist-embed-sighting/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  50. package/dist-embed-sighting/BeamEditorMessages_it-DVweRQFi.js +1 -0
  51. package/dist-embed-sighting/BeamSystem-C6YXI9Da.js +1 -0
  52. package/dist-embed-sighting/ContrailSystem-BUKo3qVd.js +1 -0
  53. package/dist-embed-sighting/GLTFLoader-BYMKgQLE.js +1 -0
  54. package/dist-embed-sighting/HeadlightSystem-CXPE3feA.js +34 -0
  55. package/dist-embed-sighting/{HynekAssessor-B8Iw0Cbz.js → HynekAssessor-Cc8hHe3R.js} +1 -1
  56. package/dist-embed-sighting/LanternEditor-J_d2le0V.js +9 -0
  57. package/dist-embed-sighting/LanternEditorMessages_en-DaT3UNfD.js +1 -0
  58. package/dist-embed-sighting/LanternEditorMessages_es-TDV5lKeJ.js +1 -0
  59. package/dist-embed-sighting/LanternEditorMessages_fr-9mByTFMG.js +1 -0
  60. package/dist-embed-sighting/LanternEditorMessages_it-MRkJnDQp.js +1 -0
  61. package/dist-embed-sighting/LaserBeam-CovzRtac.js +1 -0
  62. package/dist-embed-sighting/LaunchEditor-DuVZmb3n.js +22 -0
  63. package/dist-embed-sighting/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  64. package/dist-embed-sighting/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  65. package/dist-embed-sighting/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  66. package/dist-embed-sighting/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  67. package/dist-embed-sighting/LaunchPlume-DONCQxUE.js +1 -0
  68. package/dist-embed-sighting/LaunchSimulation-C0cSHpLE.js +1 -0
  69. package/dist-embed-sighting/ModuleSession-CRVX-5Br.js +3 -0
  70. package/dist-embed-sighting/ModuleThree-YgLqKZM9.js +1 -0
  71. package/dist-embed-sighting/NearestApproach-BOWntoKZ.js +1 -0
  72. package/dist-embed-sighting/ParameterForm-BMfViRUv.js +85 -0
  73. package/dist-embed-sighting/{PoherAssessor-CwQN9pB1.js → PoherAssessor-CM7oCyEk.js} +1 -1
  74. package/dist-embed-sighting/{RailwaySystem-9blFcIdg.js → RailwaySystem-D8yJRUc8.js} +1 -1
  75. package/dist-embed-sighting/ReentryEditor-DCDavAGw.js +27 -0
  76. package/dist-embed-sighting/ReentryEditorMessages_en-O-YSmHxv.js +1 -0
  77. package/dist-embed-sighting/ReentryEditorMessages_es-CvO9Jwz5.js +1 -0
  78. package/dist-embed-sighting/ReentryEditorMessages_fr-xuC-qZ6M.js +1 -0
  79. package/dist-embed-sighting/ReentryEditorMessages_it-B7vyCX9o.js +1 -0
  80. package/dist-embed-sighting/ReentrySimulation-BzMMTqck.js +1 -0
  81. package/dist-embed-sighting/{ReferenceSystem-DFM_jZ-Q.js → ReferenceSystem-Dt28-Egu.js} +1 -1
  82. package/dist-embed-sighting/{RoadMarkings-DKxgMzE-.js → RoadMarkings-BC76NPX4.js} +1 -1
  83. package/dist-embed-sighting/TimelineTracks-C7uTt9N5.js +35 -0
  84. package/dist-embed-sighting/{TraceSystem-CLYZFxAf.js → TraceSystem-Cd2FqhcV.js} +2 -2
  85. package/dist-embed-sighting/{WaterSystem-BulddAwi.js → WaterSystem-S81tdPno.js} +1 -1
  86. package/dist-embed-sighting/rr0-sighting.mjs +345 -345
  87. package/dist-embed-sighting/{sightingSchema-CnDwuCov.js → sightingSchema-CKUYrwgu.js} +1 -1
  88. package/dist-embed-sighting/trafficRuntime-DL5Zul8z.js +2 -0
  89. package/dist-embed-sighting-editor/AdsbLolArchiveProvider-k2xqWyaR.js +1 -0
  90. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-gX_y6kL8.js → BallesterGuaspAssessor-CRfTg7iA.js} +1 -1
  91. package/dist-embed-sighting-editor/BeamEditor-DTkjy61A.js +30 -0
  92. package/dist-embed-sighting-editor/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  93. package/dist-embed-sighting-editor/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  94. package/dist-embed-sighting-editor/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  95. package/dist-embed-sighting-editor/BeamEditorMessages_it-DVweRQFi.js +1 -0
  96. package/dist-embed-sighting-editor/BeamSystem-BQbLn-3t.js +1 -0
  97. package/dist-embed-sighting-editor/BodyEditor-D5PfqEg2.js +28 -0
  98. package/dist-embed-sighting-editor/BodyEditorMessages_en-zfy3BJb5.js +1 -0
  99. package/dist-embed-sighting-editor/BodyEditorMessages_es-w95anMnI.js +1 -0
  100. package/dist-embed-sighting-editor/BodyEditorMessages_fr-ixsDgTbt.js +1 -0
  101. package/dist-embed-sighting-editor/BodyEditorMessages_it-B3oQzqHE.js +1 -0
  102. package/dist-embed-sighting-editor/{ContrailSystem-BXARgrR4.js → ContrailSystem-BQXLg_WA.js} +1 -1
  103. package/dist-embed-sighting-editor/{CoverageAssessor-mvpHgNx3.js → CoverageAssessor-D3HBwZuC.js} +1 -1
  104. package/dist-embed-sighting-editor/{GLTFLoader-BVRuOnnK.js → GLTFLoader-CQeR3NC8.js} +1 -1
  105. package/dist-embed-sighting-editor/{HeadlightSystem-9ywZKJNB.js → HeadlightSystem-Cy4jSEsq.js} +1 -1
  106. package/dist-embed-sighting-editor/{HynekAssessor-B9lO770Q.js → HynekAssessor-Covu9I3x.js} +1 -1
  107. package/dist-embed-sighting-editor/{InterviewEditorElement-1brfxXM5.js → InterviewEditorElement-IBABfqta.js} +2 -2
  108. package/dist-embed-sighting-editor/LanternEditor-BoxxG443.js +9 -0
  109. package/dist-embed-sighting-editor/LaserBeam-j5Z4tIOw.js +1 -0
  110. package/dist-embed-sighting-editor/LaunchEditor-rJud4C3y.js +22 -0
  111. package/dist-embed-sighting-editor/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  112. package/dist-embed-sighting-editor/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  113. package/dist-embed-sighting-editor/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  114. package/dist-embed-sighting-editor/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  115. package/dist-embed-sighting-editor/LaunchPlume-Dm1YdsZp.js +1 -0
  116. package/dist-embed-sighting-editor/LaunchSimulation-4f9-9d7Z.js +1 -0
  117. package/dist-embed-sighting-editor/{ModelSource-D0ZuOymh.js → ModelSource-CYfSBTeB.js} +1 -1
  118. package/dist-embed-sighting-editor/{ModelThumbnails-BA3zFrn5.js → ModelThumbnails-DYWQQdaZ.js} +1 -1
  119. package/dist-embed-sighting-editor/{ModelViewer-BDorZEms.js → ModelViewer-BjIOswb8.js} +1 -1
  120. package/dist-embed-sighting-editor/ModuleSession-D3GrBJ3j.js +3 -0
  121. package/dist-embed-sighting-editor/ModuleThree-CkOgRXM2.js +1 -0
  122. package/dist-embed-sighting-editor/ModulesPanelElement-Uz0lPYwu.js +13 -0
  123. package/dist-embed-sighting-editor/ModulesPanelMessages_en-D97Nh2yy.js +1 -0
  124. package/dist-embed-sighting-editor/ModulesPanelMessages_es-CE9Ajw2-.js +1 -0
  125. package/dist-embed-sighting-editor/ModulesPanelMessages_fr-BWsj-7_t.js +1 -0
  126. package/dist-embed-sighting-editor/ModulesPanelMessages_it-CtKrboEg.js +1 -0
  127. package/dist-embed-sighting-editor/{NearestApproach-DCFh8vV6.js → NearestApproach-DCUW8bB4.js} +1 -1
  128. package/dist-embed-sighting-editor/{PictureRegistration-cp0utyhJ.js → PictureRegistration-ZyvGfReK.js} +1 -1
  129. package/dist-embed-sighting-editor/{PoherAssessor-CzLQhAxP.js → PoherAssessor-BoGGdasd.js} +1 -1
  130. package/dist-embed-sighting-editor/{RailwaySystem-BfDjza60.js → RailwaySystem-C8Dby19B.js} +1 -1
  131. package/dist-embed-sighting-editor/ReentryEditor-8sfHq7hY.js +27 -0
  132. package/dist-embed-sighting-editor/ReentryEditorMessages_en-O-YSmHxv.js +1 -0
  133. package/dist-embed-sighting-editor/ReentryEditorMessages_es-CvO9Jwz5.js +1 -0
  134. package/dist-embed-sighting-editor/ReentryEditorMessages_fr-xuC-qZ6M.js +1 -0
  135. package/dist-embed-sighting-editor/ReentryEditorMessages_it-B7vyCX9o.js +1 -0
  136. package/dist-embed-sighting-editor/ReentrySimulation-KMMVK82G.js +1 -0
  137. package/dist-embed-sighting-editor/{ReferenceSystem-DHPnvAXN.js → ReferenceSystem-PYF540r7.js} +1 -1
  138. package/dist-embed-sighting-editor/{RoadMarkings-HF9xJtTp.js → RoadMarkings-VqRLMg59.js} +1 -1
  139. package/dist-embed-sighting-editor/{SceneNames_es-DFcAoDph.js → SceneNames_es-CLvEspFd.js} +1 -1
  140. package/dist-embed-sighting-editor/{SceneNames_fr-Cf8NgtIe.js → SceneNames_fr-oYQgZ-TZ.js} +1 -1
  141. package/dist-embed-sighting-editor/{SceneNames_it-CLLu_NHU.js → SceneNames_it-CDTw3VAX.js} +1 -1
  142. package/dist-embed-sighting-editor/SightingEditorMessages_es-CQU200Hj.js +12 -0
  143. package/dist-embed-sighting-editor/SightingEditorMessages_fr-Bd4Ht-jW.js +12 -0
  144. package/dist-embed-sighting-editor/SightingEditorMessages_it-CSnPiCy2.js +12 -0
  145. package/dist-embed-sighting-editor/{SightingFileEditor-BekK-f3R.js → SightingFileEditor-DB3jyBzw.js} +1 -1
  146. package/dist-embed-sighting-editor/SkyEventEditorStyle-CvY_AhbI.js +1 -0
  147. package/dist-embed-sighting-editor/{TraceSystem-C1HaC0DX.js → TraceSystem-BX0FwUB1.js} +2 -2
  148. package/dist-embed-sighting-editor/{WaterSystem-BDkfNF8C.js → WaterSystem-uWnkivpP.js} +1 -1
  149. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +433 -435
  150. package/dist-embed-sighting-editor/{sightingSchema-CnDwuCov.js → sightingSchema-CKUYrwgu.js} +1 -1
  151. package/dist-embed-sighting-editor/surroundingsSources-DXpzMDPy.js +1 -0
  152. package/dist-embed-sighting-editor/trafficRuntime-BeMCM4Ap.js +2 -0
  153. package/package.json +1 -1
  154. package/dist-embed-scene/BeamSystem-Dp1WU1Zx.js +0 -1
  155. package/dist-embed-scene/GLTFLoader-wJ0bjCoG.js +0 -1
  156. package/dist-embed-scene/ReferenceSystem-DOCydyPG.js +0 -1
  157. package/dist-embed-scene/WaterSystem-yC8sKIc5.js +0 -1
  158. package/dist-embed-scene/trafficRuntime-BPEJW9KZ.js +0 -2
  159. package/dist-embed-sighting/BeamSystem-B0H346X_.js +0 -1
  160. package/dist-embed-sighting/ContrailSystem-BeK11Jxe.js +0 -1
  161. package/dist-embed-sighting/GLTFLoader-B_T3zy3i.js +0 -1
  162. package/dist-embed-sighting/HeadlightSystem-DjtbpwEp.js +0 -34
  163. package/dist-embed-sighting/NearestApproach-B5s-b6tU.js +0 -1
  164. package/dist-embed-sighting/trafficRuntime-CfPqH9j0.js +0 -2
  165. package/dist-embed-sighting-editor/AdsbLolArchiveProvider-DS9ev-HU.js +0 -1
  166. package/dist-embed-sighting-editor/BeamEditor-DDNul0KE.js +0 -13
  167. package/dist-embed-sighting-editor/BeamEditorMessages_en-SQumGyrS.js +0 -1
  168. package/dist-embed-sighting-editor/BeamEditorMessages_es-BrR6Pk6G.js +0 -1
  169. package/dist-embed-sighting-editor/BeamEditorMessages_fr-CT24bHfq.js +0 -1
  170. package/dist-embed-sighting-editor/BeamEditorMessages_it-BgwwRjlh.js +0 -1
  171. package/dist-embed-sighting-editor/BeamSystem-BBonCZQ1.js +0 -1
  172. package/dist-embed-sighting-editor/BodyEditor-Br-GYDsy.js +0 -27
  173. package/dist-embed-sighting-editor/BodyEditorMessages_en-esgrRKGZ.js +0 -1
  174. package/dist-embed-sighting-editor/BodyEditorMessages_es-C1ZvwV-v.js +0 -1
  175. package/dist-embed-sighting-editor/BodyEditorMessages_fr-B_exFt_Q.js +0 -1
  176. package/dist-embed-sighting-editor/BodyEditorMessages_it-AJ_KrzkS.js +0 -1
  177. package/dist-embed-sighting-editor/LanternEditor-DpZQqBGL.js +0 -9
  178. package/dist-embed-sighting-editor/LaserBeam-DZ6ILkZ8.js +0 -1
  179. package/dist-embed-sighting-editor/LaunchEditor-BvnOtPyj.js +0 -18
  180. package/dist-embed-sighting-editor/LaunchEditorMessages_en-9lV7bQZy.js +0 -1
  181. package/dist-embed-sighting-editor/LaunchEditorMessages_es-D-Kz7fI5.js +0 -1
  182. package/dist-embed-sighting-editor/LaunchEditorMessages_fr-VEZBh9Ky.js +0 -1
  183. package/dist-embed-sighting-editor/LaunchEditorMessages_it-B0MeP7ki.js +0 -1
  184. package/dist-embed-sighting-editor/SightingEditorMessages_es-oZAu3CCU.js +0 -12
  185. package/dist-embed-sighting-editor/SightingEditorMessages_fr-ycaYW34j.js +0 -12
  186. package/dist-embed-sighting-editor/SightingEditorMessages_it-Chlr7U2v.js +0 -12
  187. package/dist-embed-sighting-editor/surroundingsSources-Bq5A0HA5.js +0 -1
  188. package/dist-embed-sighting-editor/trafficRuntime-DVOOnJGD.js +0 -2
@@ -1 +0,0 @@
1
- import{ab as Le,ac as Q,ad as he,ae as Me,af as v,ag as de,M as w,f as pe,C as F,ah as N,a3 as U,a0 as Se,ai as ye,aj as we,E as K,ak as Ne,u as C,al as me,am as be,a8 as ge,an as Ie,ao as Oe,k as V,ap as Ce,aq as Te,ar as Fe,as as Pe,at as He,a4 as J,au as Re,av as Z,aw as ke,ax as De,P as Ge,ay as X,az as ve,j as Ee,Y as Ue,X as G,aA as Ke,i as Be,aB as je,e as Ve,aC as Xe,aD as ze,aE as qe,K as We,G as z,aF as Ye,H as Qe,aG as Je,aH as Ze,aI as $e,aJ as en,aK as nn,aL as tn,aM as xe,o as sn,a2 as ne,aN as te,aO as se,aP as ie,aQ as re,aR as rn,aS as on,q as an,t as cn}from"./rr0-sighting.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 K,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 K;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=Ke.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 Be,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 K;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 B=s._createAnimationTracks(L,b,S,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[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 K;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 Kn(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),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{jn as GLTFLoader};
@@ -1,34 +0,0 @@
1
- import{a0 as b,e as g,u as P,a1 as m,i as C,k as E,v as L,C as x,Y as R,$ as I}from"./rr0-sighting.mjs";class i{constructor(e){this.scene=e}static REAL_BEAMS=4;static LAMPS=2;static DISTANCE_M=500;static AIR_LENGTH_M=90;static CLEAR_AIR_SCATTER_PER_M=2e-4;static SHADOW_MAP_PX=1024;beams=new Map;static airGeometry;has(e){return this.beams.has(e)}get size(){return this.beams.size}lamps(e){return this.beams.get(e)?.lamps??[]}airMeshes(e){return this.beams.get(e)?.air??[]}add(e){if(this.beams.has(e))return!0;if(this.beams.size>=i.REAL_BEAMS)return!1;const t=[],r=[];for(let n=0;n<i.LAMPS;n++){const a=new b(16777215,0,i.DISTANCE_M,Math.PI/8,.5,2);a.castShadow=e==="observer",a.shadow.mapSize.set(i.SHADOW_MAP_PX,i.SHADOW_MAP_PX),a.shadow.camera.near=.4,a.shadow.camera.far=110,a.shadow.bias=-4e-4,a.shadow.normalBias=.04,a.shadow.radius=2,this.scene.add(a),this.scene.add(a.target),t.push(a);const o=new g(i.airCone(),i.airMaterial());o.visible=!1,o.frustumCulled=!1,o.renderOrder=8,o.castShadow=!1,o.receiveShadow=!1,o.name="headlight air",this.scene.add(o),r.push(o)}return this.beams.set(e,{lamps:t,air:r}),!0}remove(e){const t=this.beams.get(e);if(t){for(const r of t.lamps)r.removeFromParent(),r.target.removeFromParent(),r.dispose();for(const r of t.air)r.removeFromParent(),r.material.dispose();this.beams.delete(e)}}clear(e){for(const t of[...this.beams.keys()])e&&t==="observer"||this.remove(t)}dispose(){this.clear(!1),i.airGeometry?.dispose(),i.airGeometry=void 0}aim(e,t,r,n,a,o,l){const c=this.beams.get(e),w=Math.max(l,i.CLEAR_AIR_SCATTER_PER_M);if(!c)return;const u=m.BEAMS[t],v=new P(-n.z,0,n.x),A=e==="observer"&&u!==void 0;c.lamps.forEach((s,d)=>{if(!u){s.intensity=0,c.air[d].visible=!1,s.shadow.autoUpdate=!1;return}const f=d===0?-1:1,h=u.pitchDeg*Math.PI/180,p=u.candela*m.DISPLAY_GAIN*o/c.lamps.length;s.color.set(u.color),s.intensity=p,s.angle=u.halfAngleDeg*Math.PI/180,s.penumbra=u.penumbra,A?(s.shadow.autoUpdate||(s.shadow.needsUpdate=!0),s.shadow.autoUpdate=!0):s.shadow.autoUpdate=!1,s.position.copy(r).addScaledVector(v,f*a);const M=n.clone().addScaledVector(v,-f*Math.tan(m.TOE_IN_DEG*Math.PI/180)).normalize();s.target.position.set(s.position.x+M.x*Math.cos(h)*50,s.position.y-Math.sin(h)*50,s.position.z+M.z*Math.cos(h)*50),s.target.updateMatrixWorld(),this.aimAir(c.air[d],s,u.color,p,w)})}aimAir(e,t,r,n,a){if(e.visible=a*n>1e-4,!e.visible)return;const o=i.AIR_LENGTH_M,l=o*Math.tan(t.angle);e.position.copy(t.position),e.scale.set(l,l,o),e.lookAt(t.target.position),e.updateMatrixWorld();const c=e.material.uniforms;c.uColor.value.set(r),c.uCandela.value=n,c.uScatter.value=a,c.uLength.value=o,c.uRadius.value=l}static airCone(){if(i.airGeometry)return i.airGeometry;const e=24,t=new Float32Array((e+1)*3);for(let a=0;a<e;a++){const o=a/e*Math.PI*2;t.set([Math.cos(o),Math.sin(o),1],(a+1)*3)}const r=[];for(let a=0;a<e;a++)r.push(0,1+a,1+(a+1)%e);const n=new C;return n.setAttribute("position",new E(t,3)),n.setIndex(r),i.airGeometry=n,n}static airMaterial(){return new L({transparent:!0,depthWrite:!1,depthTest:!0,blending:I,side:R,uniforms:{uColor:{value:new x(1,1,1)},uCandela:{value:0},uScatter:{value:0},uLength:{value:90},uRadius:{value:20}},vertexShader:`
2
- varying vec3 vLocal;
3
- varying vec3 vNormalView;
4
- varying vec3 vViewDir;
5
- void main() {
6
- vLocal = position;
7
- vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);
8
- // The side's normal, out of the axis: the apex has none (its length is nought), and a normal of nought there would spread NaN over the whole cone.
9
- float ring = length(position.xy);
10
- vec3 outward = ring > 1e-5 ? vec3(position.xy / ring, 0.0) : vec3(0.0, 0.0, 1.0);
11
- vNormalView = normalize(normalMatrix * outward);
12
- vViewDir = -viewPosition.xyz;
13
- gl_Position = projectionMatrix * viewPosition;
14
- }`,fragmentShader:`
15
- uniform vec3 uColor;
16
- uniform float uCandela;
17
- uniform float uScatter;
18
- uniform float uLength;
19
- uniform float uRadius;
20
- varying vec3 vLocal;
21
- varying vec3 vNormalView;
22
- varying vec3 vViewDir;
23
- void main() {
24
- float t = clamp(vLocal.z, 0.0, 1.0);
25
- float distanceM = max(t * uLength, 1.5);
26
- // The chord a ray makes through a cone of this thickness: long going along the beam, short going across its edge.
27
- float facing = abs(dot(normalize(vNormalView), normalize(vViewDir + vec3(0.0, 0.0, 1e-4))));
28
- float chord = 2.0 * uRadius * t * (0.25 + 0.75 * facing);
29
- // The beam's own profile averaged over the chord: strongest on the axis, none at the edge of the cone.
30
- float profile = 0.55;
31
- float radiance = uScatter * uCandela * chord * profile / (distanceM * distanceM + 9.0);
32
- float ends = (1.0 - smoothstep(0.75, 1.0, t)) * smoothstep(0.0, 0.04, t);
33
- gl_FragColor = vec4(uColor * radiance * ends, 1.0);
34
- }`})}}export{i as HeadlightSystem};
@@ -1 +0,0 @@
1
- import{b,B as h}from"./rr0-sighting.mjs";class c{static FLAT={heightAt:()=>0};static of(e){const s=e.timeline.sourceIds.map(n=>b.of(e,n)?.nearestM).filter(n=>n!==void 0);return s.length>0?{m:Math.min(...s),basis:"derived",paths:["timeline","observerTrack"]}:c.interpreted(e)}static interpreted(e){const s=(e.interpretation?.bodies??[]).map((t,i)=>({body:t,index:i})).filter(({body:t})=>Array.isArray(t.track)),n=s.filter(({body:t})=>(t.explains?.length??0)>0),u=n.length>0?n:s,d=c.FLAT,l=t=>h.eyeOf(e,t,d);let o;const p=[];for(const{body:t,index:i}of u){const M=new h(t,d,l);for(const{t:f}of t.track){const r=M.at(f),a=l(f);if(!r||!a)continue;const m=Math.hypot(r.eastM-a.eastM,r.northM-a.northM,r.upM-a.upM);(o===void 0||m<o)&&(o=m)}p.push(`interpretation.bodies.${i}`)}return o===void 0?void 0:{m:o,basis:"assumed",paths:p}}}export{c as N};
@@ -1,2 +0,0 @@
1
- import{A as ut,L as dt,T as z,R as L,a as F,r as pt,l as $}from"./rr0-sighting.mjs";import{C as Z}from"./ContrailGrowth-DwHS8If9.js";class E{static OCTAVES=[63,125,250,500,1e3,2e3,4e3,8e3];static STANDARD={temperatureC:15,relativeHumidity:.7,pressureKPa:101.325};static REFERENCE_PRESSURE_KPA=101.325;static REFERENCE_TEMPERATURE_K=293.15;static TRIPLE_POINT_K=273.16;static speedOfSound(t){return 20.0468*Math.sqrt(t+273.15)}static absorptionDbPerKm(t,e=E.STANDARD){const a=e.temperatureC+273.15,n=E.REFERENCE_TEMPERATURE_K,i=e.pressureKPa/E.REFERENCE_PRESSURE_KPA,o=10**(-6.8346*(E.TRIPLE_POINT_K/a)**1.261+4.6151),s=e.relativeHumidity*100*o/i,r=i*(24+40400*s*(.02+s)/(.391+s)),h=i*(a/n)**-.5*(9+280*s*Math.exp(-4.17*((a/n)**(-1/3)-1))),c=t*t;return 8.686*c*(184e-13*(1/i)*Math.sqrt(a/n)+(a/n)**-2.5*(.01275*Math.exp(-2239.1/a)/(r+c/r)+.1068*Math.exp(-3352/a)/(h+c/h)))*1e3}static aWeightingDb(t){const e=t*t,a=12194**2*e*e/((e+20.6**2)*Math.sqrt((e+107.7**2)*(e+737.9**2))*(e+12194**2));return 20*Math.log10(a)+2}static sumDb(t){return 10*Math.log10(t.reduce((e,a)=>e+10**(a/10),0))}}const mt=.25,x=.4,Q=6,K=12,gt=3,tt=.2,Et=.2,Mt=24,At=3,ft=12,et=1,bt=.7,St=1.5,Dt=.8,Rt=1.3,at=.9,nt=5,Ot=25,vt=.5,It=.12,it=[.13,.31],Tt=.16,Bt=1.6,_t=3.6,st=1.1,Nt=.3,Ct=1e3,rt=.7;class q{context;noiseBuffer;roughBuffers=new Map;voices=new Map;bus;reverb;reverbOut;level=1;master;paused=!0;requested=[];headingDeg=0;resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(t){console.warn("AircraftAudio: Web Audio unavailable, aircraft stay silent:",t);return}}ut.unlock(this.context),this.apply()}setLevel(t){this.level=t,this.master&&(this.master.gain.value=t)}setPaused(t){t!==this.paused&&(this.paused=t,this.apply())}setVoices(t,e=0){this.requested=t,this.headingDeg=e,this.apply()}dispose(){for(const t of[...this.voices.keys()])this.release(t);this.context?.close(),this.context=void 0,this.master=void 0,this.bus=void 0}apply(){const t=this.context;if(!t)return;const e=this.paused?[]:this.requested,a=new Set(e.map(n=>n.id));for(const n of[...this.voices.keys()])a.has(n)||this.release(n);for(const n of e){const i=this.voices.get(n.id)??this.build(t,n);this.retarget(t,i,n)}}build(t,e){const a=t.createGain();a.gain.value=0;let n;const i=this.busOf(t);typeof t.createStereoPanner=="function"?(n=t.createStereoPanner(),a.connect(n).connect(i)):a.connect(i);const o=t.createGain(),s=e.character?.modulationDepth??0;o.gain.value=1-s/2;const r=t.createOscillator();r.type="sine";const h=t.createGain();h.gain.value=s/2,r.connect(h).connect(o.gain),o.connect(a);const c=t.createBufferSource();c.buffer=this.noise(t),c.loop=!0,c.loopStart=Math.random()*Q*.5;const d=[],l=[],u=[];for(const v of E.OCTAVES){const T=t.createBiquadFilter();T.type="bandpass",T.frequency.value=v,T.Q.value=et;const N=t.createBiquadFilter();N.type="bandpass",N.frequency.value=v,N.Q.value=et;const k=t.createGain();k.gain.value=0,c.connect(T).connect(N).connect(k).connect(o),d.push(T),l.push(N),u.push(k)}const p=[];for(const[v,T]of[[e.character?.toneHz,e.character?.toneShare],[e.character?.humHz,e.character?.humShare]])if(v!==void 0)for(let N=1;N<=At;N++){const k=t.createOscillator();k.type="sine",k.frequency.value=v*N;const X=t.createGain();X.gain.value=0,k.connect(X).connect(a),p.push({oscillator:k,gain:X,harmonic:N,baseHz:v,share:T??0})}const m=t.createGain();m.gain.value=0,m.connect(a.gain);const A=it.map(v=>{const T=t.createOscillator();return T.type="sine",T.frequency.value=v,T.connect(m),T}),b=t.createGain();b.gain.value=e.character?.roughness??tt;const R=t.createBufferSource();R.buffer=this.roughTable(t,gt),R.loop=!0,R.loopStart=Math.random()*K*.5,R.connect(b).connect(o.gain);const S=t.createGain();S.gain.value=(e.character?.roughness??tt)*Et;const f=t.createBufferSource();f.buffer=this.roughTable(t,Mt),f.loop=!0,f.loopStart=Math.random()*K*.5,f.connect(S).connect(o.gain);let B;const j=this.busOf(t)&&this.reverb;j&&(B=t.createGain(),B.gain.value=0,a.connect(B).connect(j));const V=[c,R,f,r,...p.map(v=>v.oscillator),...A];for(const v of V)v.start();const J={nodes:[a,o,h,b,S,m,...p.map(v=>v.gain),...d,...l,...u,...B?[B]:[],...n?[n]:[],...V],sources:V,filters:d,seconds:l,gains:u,tones:p,lfo:r,lfoDepth:h,wander:A,wanderDepth:m,roughDepth:b,crackleDepth:S,beat:o,output:a,panner:n,send:B};return this.voices.set(e.id,J),J}retarget(t,e,a){const n=t.currentTime,i=(p,m)=>p.setTargetAtTime(m,n,mt),o=Math.min(St,Math.max(bt,a.dopplerRatio)),s=Math.min(Rt,Math.max(Dt,Math.sqrt(a.dopplerRatio))),r=t.sampleRate*.45,h=a.bandAmplitudes.map((p,m)=>p*q.unweighting(E.OCTAVES[m])),c=Math.sqrt(h.reduce((p,m)=>p+m*m,0)),d=Math.min(1,Math.max(0,(a.distanceKm-nt)/(Ot-nt)));E.OCTAVES.forEach((p,m)=>{i(e.filters[m].frequency,Math.min(r,p*s)),i(e.seconds[m].frequency,Math.min(r,p*s)),i(e.gains[m].gain,h[m]*Math.sqrt(Ct/p))});const l=a.character;for(const{oscillator:p,gain:m,harmonic:A,baseHz:b,share:R}of e.tones){const S=b*A;i(p.frequency,S*o);const f=S*o;i(m.gain,f<r?R*Tt*h[q.bandOf(f)]/A:0)}l?.modulationHz!==void 0&&i(e.lfo.frequency,l.modulationHz*o);const u=c>0?rt*(1-Math.exp(-c/rt))/c:1;if(i(e.output.gain,u*(1-Nt*d)),i(e.wanderDepth.gain,u*It*d/it.length),e.send&&i(e.send.gain,Bt*d),e.panner){const p=(a.azimuthDeg-this.headingDeg)*Math.PI/180;i(e.panner.pan,Math.max(-at,Math.min(at,Math.sin(p)))*(1-vt*d))}}static unweighting(t){return 10**(Math.min(ft,Math.max(0,-E.aWeightingDb(t)))/20)}static bandOf(t){let e=0;return E.OCTAVES.forEach((a,n)=>{Math.abs(Math.log(t/a))<Math.abs(Math.log(t/E.OCTAVES[e]))&&(e=n)}),e}roughTable(t,e){const a=this.roughBuffers.get(e);if(a)return a;const n=Math.floor(t.sampleRate*K),i=t.createBuffer(1,n,t.sampleRate),o=i.getChannelData(0),s=Array.from({length:K*e},()=>(Math.random()*2-1)**3),r=t.sampleRate/e;for(let h=0;h<o.length;h++){const c=h/r,d=Math.floor(c),l=c-d,u=l*l*(3-2*l);o[h]=s[d%s.length]*(1-u)+s[(d+1)%s.length]*u}return this.roughBuffers.set(e,i),i}roomImpulse(t){const e=Math.floor(t.sampleRate*_t),a=t.createBuffer(2,e,t.sampleRate);for(let n=0;n<2;n++){const i=a.getChannelData(n);let o=0;for(let s=0;s<e;s++){const r=s/t.sampleRate,h=.6*Math.exp(-r/(st*2))+.04;o+=h*(Math.random()*2-1-o),i[s]=o*Math.exp(-r/st)}}return a}busOf(t){if(this.bus)return this.bus;const e=t.createGain();if(e.gain.value=this.level,e.connect(t.destination),this.master=e,typeof t.createConvolver=="function"){const a=t.createConvolver();a.buffer=this.roomImpulse(t);const n=t.createGain();n.gain.value=.9,a.connect(n),this.reverb=a,this.reverbOut=n}if(typeof t.createDynamicsCompressor=="function"){const a=t.createDynamicsCompressor();a.threshold.value=-6,a.knee.value=3,a.ratio.value=4,a.attack.value=.005,a.release.value=.25,a.connect(e),this.bus=a}else this.bus=e;return this.reverbOut?.connect(this.bus),this.bus}release(t){const e=this.voices.get(t);if(!e)return;this.voices.delete(t);const a=this.context;a&&(e.output.gain.setTargetAtTime(0,a.currentTime,x/3),setTimeout(()=>{for(const n of e.sources)try{n.stop()}catch{}for(const n of e.nodes)n.disconnect()},x*1e3*3))}noise(t){if(this.noiseBuffer)return this.noiseBuffer;const e=t.createBuffer(1,t.sampleRate*Q,t.sampleRate),a=e.getChannelData(0);for(let n=0;n<a.length;n++)a[n]=Math.random()*2-1;return this.noiseBuffer=e,e}}class _{static BASE_DB_A=30;static WIND_DB_A=[[0,10],[1,28],[2,36],[3,40],[5,46],[8,52],[12,58],[20,66]];static RAIN_DB_A=[[0,0],[.1,42],[.3,50],[.6,58],[1,65]];static BED_RMS=.2;static MINIMUM_REFERENCE=.008;static WIND_BED_MIN_MS=1;static WIND_BED_FULL_MS=20;static dbA(t){const e=[_.BASE_DB_A,_.along(_.WIND_DB_A,t.windSpeed)];return(t.precipitationType==="rain"||t.precipitationType==="hail")&&e.push(_.along(_.RAIN_DB_A,t.precipitationIntensity)),10*Math.log10(e.filter(a=>a>0).reduce((a,n)=>a+10**(n/10),0))}static bedVolume(t){const e=t.windSpeed>_.WIND_BED_MIN_MS?Math.min(t.windSpeed/_.WIND_BED_FULL_MS,1):0,a=t.precipitationType==="hail"?Math.min(1,t.precipitationIntensity*1.3+.2):t.precipitationType==="rain"?t.precipitationIntensity:0;return Math.hypot(e,a)}static referenceAmplitude(t){return Math.max(_.BED_RMS*_.bedVolume(t),_.MINIMUM_REFERENCE)}static along(t,e){if(e<=t[0][0])return t[0][1];for(let a=1;a<t.length;a++)if(e<=t[a][0]){const[n,i]=t[a-1],[o,s]=t[a];return i+(s-i)*(e-n)/(o-n)}return t[t.length-1][1]}}class y{static TYPES={A318:["Airbus A318","airliner-narrow",34.1,31.4],A319:["Airbus A319","airliner-narrow",34.1,33.8],A320:["Airbus A320","airliner-narrow",34.1,37.6],A321:["Airbus A321","airliner-narrow",34.1,44.5],A19N:["Airbus A319neo","airliner-narrow",35.8,33.8],A20N:["Airbus A320neo","airliner-narrow",35.8,37.6],A21N:["Airbus A321neo","airliner-narrow",35.8,44.5],B737:["Boeing 737-700","airliner-narrow",34.3,33.6],B738:["Boeing 737-800","airliner-narrow",35.8,39.5],B739:["Boeing 737-900","airliner-narrow",35.8,42.1],B38M:["Boeing 737 MAX 8","airliner-narrow",35.9,39.5],B39M:["Boeing 737 MAX 9","airliner-narrow",35.9,42.2],B752:["Boeing 757-200","airliner-narrow",38,47.3],B753:["Boeing 757-300","airliner-narrow",38,54.4],B762:["Boeing 767-200","airliner-wide",47.6,48.5],B763:["Boeing 767-300","airliner-wide",47.6,54.9],B764:["Boeing 767-400","airliner-wide",51.9,61.4],B772:["Boeing 777-200","airliner-wide",60.9,63.7],B77L:["Boeing 777-200LR","airliner-wide",64.8,63.7],B77W:["Boeing 777-300ER","airliner-wide",64.8,73.9],B788:["Boeing 787-8","airliner-wide",60.1,56.7],B789:["Boeing 787-9","airliner-wide",60.1,62.8],B78X:["Boeing 787-10","airliner-wide",60.1,68.3],B744:["Boeing 747-400","airliner-wide",64.4,70.7],B748:["Boeing 747-8","airliner-wide",68.4,76.3],A306:["Airbus A300-600","airliner-wide",44.8,54.1],A310:["Airbus A310","airliner-wide",43.9,46.7],A332:["Airbus A330-200","airliner-wide",60.3,58.8],A333:["Airbus A330-300","airliner-wide",60.3,63.7],A338:["Airbus A330-800","airliner-wide",64,58.8],A339:["Airbus A330-900","airliner-wide",64,63.7],A343:["Airbus A340-300","airliner-wide",60.3,63.7],A346:["Airbus A340-600","airliner-wide",63.5,75.4],A359:["Airbus A350-900","airliner-wide",64.8,66.8],A35K:["Airbus A350-1000","airliner-wide",64.8,73.8],A388:["Airbus A380-800","airliner-wide",79.8,72.7],E170:["Embraer 170","regional-jet",26,29.9],E75L:["Embraer 175","regional-jet",26,31.7],E75S:["Embraer 175","regional-jet",26,31.7],E190:["Embraer 190","regional-jet",28.7,36.2],E195:["Embraer 195","regional-jet",28.7,38.7],E290:["Embraer 190-E2","regional-jet",33.7,36.2],E295:["Embraer 195-E2","regional-jet",33.7,41.5],CRJ2:["Bombardier CRJ200","regional-jet",21.2,26.8],CRJ7:["Bombardier CRJ700","regional-jet",23.2,32.3],CRJ9:["Bombardier CRJ900","regional-jet",24.9,36.2],CRJX:["Bombardier CRJ1000","regional-jet",26.2,39.1],AT72:["ATR 72","regional-turboprop",27.1,27.2],AT76:["ATR 72-600","regional-turboprop",27.1,27.2],AT45:["ATR 42","regional-turboprop",24.6,22.7],DH8D:["Dash 8 Q400","regional-turboprop",28.4,32.8],DH8C:["Dash 8-300","regional-turboprop",27.4,25.7],SF34:["Saab 340","regional-turboprop",21.4,19.7],B190:["Beechcraft 1900","regional-turboprop",17.7,17.6],C25A:["Cessna CitationJet CJ2","business-jet",14.3,14.4],C56X:["Cessna Citation Excel","business-jet",17.2,16],C68A:["Cessna Citation Latitude","business-jet",22,18.9],C550:["Cessna Citation II","business-jet",15.8,14.4],E55P:["Embraer Phenom 300","business-jet",15.9,15.6],E50P:["Embraer Phenom 100","business-jet",12.3,12.8],GLF5:["Gulfstream G550","business-jet",28.5,29.4],FA7X:["Dassault Falcon 7X","business-jet",26.2,23.4],CL60:["Bombardier Challenger 600","business-jet",19.6,20.9],LJ45:["Learjet 45","business-jet",14.6,17.7],H25B:["Hawker 800","business-jet",15.7,15.6],C172:["Cessna 172","light-piston",11,8.3],C152:["Cessna 152","light-piston",10.2,7.3],C182:["Cessna 182","light-piston",10.9,8.8],P28A:["Piper Cherokee","light-piston",10.7,7.2],PA34:["Piper Seneca","light-piston",11.8,8.7],SR20:["Cirrus SR20","light-piston",10.9,7.9],SR22:["Cirrus SR22","light-piston",11.7,7.9],S22T:["Cirrus SR22T","light-piston",11.7,7.9],DA40:["Diamond DA40","light-piston",11.6,8.1],DA42:["Diamond DA42","light-piston",13.4,8.6],BE20:["Beechcraft King Air 200","turboprop-light",16.6,13.3],BE58:["Beechcraft Baron","light-piston",11.5,9.1],C208:["Cessna Caravan","turboprop-light",15.9,11.5],PC12:["Pilatus PC-12","turboprop-light",16.3,14.4],TBM9:["Daher TBM 900","turboprop-light",12.8,10.7],EC35:["Airbus H135","helicopter-light",10.2,12.1],EC45:["Airbus H145","helicopter-medium",11,13.6],AS50:["Airbus H125","helicopter-light",10.7,12.9],EC30:["Airbus H130","helicopter-light",10.7,12.6],B407:["Bell 407","helicopter-light",10.7,12.7],B06:["Bell 206","helicopter-light",10.2,12],B429:["Bell 429","helicopter-medium",10.9,13],B505:["Bell 505","helicopter-light",10.4,11.9],R44:["Robinson R44","helicopter-light",10.1,11.7],R22:["Robinson R22","helicopter-light",7.7,8.8],A109:["Agusta A109","helicopter-medium",11,13],A139:["Leonardo AW139","helicopter-medium",13.8,16.7],S92:["Sikorsky S-92","helicopter-heavy",17.2,20.9],H60:["Sikorsky UH-60 Black Hawk","helicopter-heavy",16.4,19.8],T38:["Northrop T-38 Talon","military-jet",7.7,14.1],HAWK:["BAE Hawk","military-jet",9.4,11.9],GLID:["Glider","glider",17,7],BALL:["Balloon","balloon",15,20],ULAC:["Ultralight","ultralight",9.5,6],C42:["Ikarus C42","ultralight",9.4,6.3],DRON:["Drone","unmanned",1,.6]};static CATEGORIES={A1:["Light aircraft","light-piston",11,8.3],A2:["Small aircraft","business-jet",15,15],A3:["Large aircraft","airliner-narrow",34.1,37.6],A4:["High-vortex large aircraft","airliner-narrow",38,47.3],A5:["Heavy aircraft","airliner-wide",60.3,63.7],A6:["High-performance aircraft","military-jet",8,14],A7:["Rotorcraft","helicopter-medium",10.7,12.7],B1:["Glider","glider",17,7],B2:["Lighter-than-air","balloon",15,20],B4:["Ultralight","ultralight",9.5,6],B6:["Unmanned aircraft","unmanned",1.5,1]};static GENERIC={name:"Airliner",kind:"airliner-narrow",spanM:34.1,lengthM:37.6,basis:"nothing"};static of(t){const e=t?.type?.toUpperCase(),a=e?y.TYPES[e]:void 0;if(a)return{code:e,name:a[0],kind:a[1],spanM:a[2],lengthM:a[3],basis:"type"};const n=t?.category?y.CATEGORIES[t.category]:void 0;return n?{name:n[0],kind:n[1],spanM:n[2],lengthM:n[3],basis:"category"}:{...y.GENERIC}}static isHelicopter(t){return t.kind.startsWith("helicopter")}}class P{static DUSK_SUN_ELEVATION_DEG=-.83;static ALWAYS=new Set(["airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet"]);static NONE=new Set(["glider","balloon"]);static BRIGHTNESS={"light-piston":[.5,.2,.5],"turboprop-light":[.7,.4,.8],ultralight:[.4,.2,.4],unmanned:[0,.05,0],"helicopter-light":[1,1,1],"helicopter-medium":[1,1,1],"helicopter-heavy":[1,1,1],"military-jet":[1,1,1]};static lampsOn(t,e){if(P.NONE.has(t))return{navigation:!1,beacon:!1,strobes:!1};if(P.ALWAYS.has(t))return{navigation:!0,beacon:!0,strobes:!0};const a=e<P.DUSK_SUN_ELEVATION_DEG;return t==="unmanned"?{navigation:!1,beacon:!1,strobes:a}:{navigation:a,beacon:a,strobes:a}}static lights(t,e){const a=P.lampsOn(t.kind,e),n=t.kind.startsWith("helicopter"),i=dt.find(u=>u.id===(n?"helicopter":"airliner")).create(),[o,s]=n?[5,7]:[17,18],r=t.spanM/2/o,h=t.lengthM/2/s,[c,d,l]=P.BRIGHTNESS[t.kind]??[1,1,1];return i.filter(u=>u.id.startsWith("nav")?a.navigation:u.id.startsWith("strobe")?a.strobes:u.id.startsWith("beacon")?a.beacon:!0).filter(u=>!(u.id.startsWith("beacon")&&!a.beacon)).map(u=>{const p=u.id.startsWith("nav")?c:u.id.startsWith("strobe")?d:l;return{...u,offsetM:{x:u.offsetM.x*r,y:u.offsetM.y,z:u.offsetM.z*h},intensity:(u.intensity??1)*p}}).filter(u=>(u.intensity??1)>0)}static bodyColor(t){return t.kind==="military-jet"?"#8a8e94":t.kind.startsWith("helicopter")?"#c8ccd1":t.kind==="unmanned"?"#2c2e33":"#dde0e4"}}class U{static FAMILIES={"amvlab-a320":["A318","A319","A320","A321","A19N","A20N","A21N"],"amvlab-b737":["B732","B733","B734","B735","B736","B737","B738","B739","B37M","B38M","B39M","B3XM"],"amvlab-a350":["A359","A35K"],"amvlab-a380":["A388"],"amvlab-b787":["B788","B789","B78X"]};static BY_TYPE=new Map(Object.entries(U.FAMILIES).flatMap(([t,e])=>e.map(a=>[a,t])));static idOf(t){return t?U.BY_TYPE.get(t.toUpperCase()):void 0}}class D{static ID_PREFIX=z.ID_PREFIX;static MAX_OBJECTS=40;static FT_TO_M=.3048;static DEG=Math.PI/180;static from(t,e,a,n=D.MAX_OBJECTS,i={}){return new wt(t,e,a,n,i).build()}static idOf(t,e){return z.idOf(t,e)}static keyOf(t){return z.keyOf(t)}static HEIGHT_OVER_LENGTH=.29;static sizeOf(t){return{widthM:t.spanM,lengthM:t.lengthM,heightM:t.lengthM*D.HEIGHT_OVER_LENGTH}}static offsetOf(t,e){const a=L.seenFrom(t,{lat:e.lat,lng:e.lng,heightM:e.altitudeFt*D.FT_TO_M}),n=a.distanceKm*1e3,i=n*Math.cos(a.altitudeDeg*D.DEG);return{eastM:i*Math.sin(a.azimuthDeg*D.DEG),northM:i*Math.cos(a.azimuthDeg*D.DEG),upM:n*Math.sin(a.altitudeDeg*D.DEG),altitudeDeg:a.altitudeDeg,distanceKm:a.distanceKm}}static segments(t){const e=[];let a=[];for(const n of t.points){const i=a[a.length-1];i&&n.t-i.t>F.MAX_GAP_S*1e3&&(e.push(a),a=[]),a.push(n)}return e.push(a),e.filter(n=>n.length>=2)}static bearingDeg(t,e){return(Math.atan2(e.eastM-t.eastM,e.northM-t.northM)/D.DEG+360)%360}}class wt{constructor(t,e,a,n,i){this.tracks=t,this.observer=e,this.startMs=a,this.maxObjects=n,this.options=i}build(){const t=[];for(const a of this.tracks){const n=D.keyOf(a),i=this.options.models?.get(n)??y.of(void 0);D.segments(a).forEach((o,s)=>{const r=o.map(u=>({point:u,at:D.offsetOf(this.observer,u)}));if(!r.some(u=>u.at.altitudeDeg>=0))return;const h=r.map((u,p)=>({t:u.point.t-this.startMs,eastM:u.at.eastM,northM:u.at.northM,altitudeM:u.at.upM,headingDeg:u.point.trackDeg??(p+1<r.length?D.bearingDeg(u.at,r[p+1].at):D.bearingDeg(r[p-1].at,u.at))})),c=D.idOf(a,s),d=r[Math.floor(r.length/2)].point,l=this.options.sunElevationAt?.(d)??90;t.push({object:{id:c,kind:"aircraft",eastM:h[0].eastM,northM:h[0].northM,headingDeg:h[0].headingDeg,sizeM:D.sizeOf(i),model:U.idOf(i.code)?{id:U.idOf(i.code)}:void 0,color:P.bodyColor(i),lights:P.lights(i,l),track:h},presence:{fromMs:h[0].t,untilMs:h[h.length-1].t},flight:{icao:a.icao,nonIcao:a.nonIcao,points:o},closestKm:Math.min(...r.map(u=>u.at.distanceKm))})})}t.sort((a,n)=>a.closestKm-n.closestKm);const e=t.slice(0,this.maxObjects);return{objects:e.map(a=>a.object),presence:new Map(e.map(a=>[a.object.id,a.presence])),flights:new Map(e.map(a=>[a.object.id,a.flight])),total:t.length,shown:e.length}}}const ht=[{id:"turbofan-narrow-body",name:"Turbofan airliner, narrow-body",kinds:["airliner-narrow"],totalDbA:148,shapeDb:[-32,-17,-9,-6,-5,-7,-12,-22],character:{toneHz:1800,toneShare:.3,humHz:90,humShare:.7}},{id:"turbofan-wide-body",name:"Turbofan airliner, wide-body",kinds:["airliner-wide"],totalDbA:151,shapeDb:[-28,-14,-7,-4,-3,-6,-12,-22],character:{toneHz:1200,toneShare:.3,humHz:70,humShare:.7}},{id:"regional-jet",name:"Regional jet",kinds:["regional-jet"],totalDbA:144,shapeDb:[-32,-17,-9,-5,-4,-6,-11,-21],character:{toneHz:1900,toneShare:.3,humHz:95,humShare:.7}},{id:"business-jet",name:"Business jet",kinds:["business-jet"],totalDbA:141,shapeDb:[-30,-15,-8,-4,-3,-4,-9,-19],character:{toneHz:2500,toneShare:.25,humHz:110,humShare:.7}},{id:"turboprop",name:"Turboprop",kinds:["regional-turboprop","turboprop-light"],totalDbA:138,shapeDb:[-14,-9,-8,-6,-8,-13,-20,-28],character:{toneHz:80,toneShare:.5}},{id:"light-piston",name:"Light piston aircraft",kinds:["light-piston"],totalDbA:130,shapeDb:[-18,-9,-5,-4,-8,-14,-22,-30],character:{toneHz:80,toneShare:.4}},{id:"ultralight",name:"Ultralight",kinds:["ultralight"],totalDbA:124,shapeDb:[-16,-8,-5,-4,-9,-15,-23,-31],character:{toneHz:140,toneShare:.4}},{id:"helicopter-light",name:"Light helicopter",kinds:["helicopter-light"],totalDbA:134,shapeDb:[-15,-8,-4,-3,-6,-10,-16,-24],character:{modulationHz:20,modulationDepth:.5}},{id:"helicopter-medium",name:"Medium helicopter",kinds:["helicopter-medium"],totalDbA:138,shapeDb:[-14,-7,-4,-3,-6,-10,-16,-24],character:{modulationHz:22,modulationDepth:.5}},{id:"helicopter-heavy",name:"Heavy helicopter",kinds:["helicopter-heavy"],totalDbA:144,shapeDb:[-12,-6,-4,-4,-7,-11,-17,-25],character:{modulationHz:17,modulationDepth:.5}},{id:"military-jet",name:"Military jet",kinds:["military-jet"],totalDbA:152,shapeDb:[-26,-12,-6,-3,-2,-3,-7,-15]},{id:"glider",name:"Glider",kinds:["glider"],totalDbA:85,shapeDb:[-30,-22,-15,-10,-8,-8,-14,-22]},{id:"balloon",name:"Hot-air balloon",kinds:["balloon"],totalDbA:100,shapeDb:[-25,-15,-9,-5,-3,-6,-12,-20]},{id:"unmanned",name:"Unmanned aircraft",kinds:["unmanned"],totalDbA:88,shapeDb:[-40,-30,-20,-12,-6,-3,-3,-8],character:{toneHz:450,toneShare:1}}],ot=ht.map(C=>({id:C.id,name:C.name,soundPowerA:C.shapeDb.map(t=>t+C.totalDbA-E.sumDb(C.shapeDb)),character:C.character}));class g{static DEFAULT_AMBIENT_DB_A=35;static DETECTION_MARGIN_DB=3;static AMBIENT_SHAPE_DB=[-12,-7,-5,-5,-7,-11,-17,-25];static HEARING_FLOOR_DB_A=0;static ITERATIONS=30;static CONVERGED_MS=.5;static VELOCITY_STEP_MS=500;static noiseOfKind(t){const e=ht.find(a=>a.kinds.includes(t));return ot.find(a=>a.id===(e?.id??"turbofan-narrow-body"))}static bandsAt(t,e,a=E.STANDARD){const n=20*Math.log10(Math.max(e*1e3,1))+11;return E.OCTAVES.map((i,o)=>t.soundPowerA[o]-n-E.absorptionDbPerKm(i,a)*e)}static couldBeHeard(t,e,a=g.DEFAULT_AMBIENT_DB_A,n=E.STANDARD){const i=g.ambientBands(a);return g.bandsAt(t,e,n).some((o,s)=>o>=Math.max(i[s]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A))}static ambientBands(t){const e=g.AMBIENT_SHAPE_DB,a=E.sumDb(e);return e.map(n=>t+n-a)}static heardAt(t,e,a,n={}){const i=n.air??E.STANDARD,o=E.speedOfSound(i.temperatureC),s=t.points[t.points.length-1]?.t;if(s===void 0)return;let r=Math.min(a,s),h=F.positionAt(t,r);if(!h)return;let c=L.seenFrom(e,h.geo);for(let f=0;f<g.ITERATIONS;f++){const B=a-c.distanceKm*1e3*1e3/o,j=Math.abs(B-r);if(r=B,h=F.positionAt(t,r),!h)return;if(c=L.seenFrom(e,h.geo),j<g.CONVERGED_MS)break}const d=F.positionAt(t,a),l=d?L.seenFrom(e,d.geo):c,u=n.noise??ot[0],p=n.ambientDbA??g.DEFAULT_AMBIENT_DB_A,m=g.ambientBands(p),A=g.bandsAt(u,c.distanceKm,i),b=A.map((f,B)=>f>=Math.max(m[B]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A)),R=A.indexOf(Math.max(...A)),S=b.lastIndexOf(!0);return{track:t,audible:b.some(Boolean),levelDbA:E.sumDb(A),bandsDbA:A,ambientDbA:p,delayS:(a-r)/1e3,emittedAtMs:r,sound:c,seen:l,lagDeg:g.angleBetween(c,l),dopplerRatio:g.doppler(t,e,r,o),dominantHz:E.OCTAVES[R],cutoffHz:S<0?void 0:E.OCTAVES[S]}}static profile(t,e,a,n,i=2e3,o={}){const s=[];let r,h,c=a;for(let d=a;d<=n;d+=i){const l=g.heardAt(t,e,d,o);l&&(!h||l.levelDbA>h.levelDbA)&&(h=l,c=d),l?.audible?r?r.untilMs=d:s.push(r={fromMs:d,untilMs:d}):r=void 0}return{track:t,audible:s,peakDbA:h?.levelDbA??-1/0,peakAtMs:c,peakDelayS:h?.delayS??0}}static angleBetween(t,e){const a=c=>{const d=c.altitudeDeg*Math.PI/180,l=c.azimuthDeg*Math.PI/180;return[Math.cos(d)*Math.sin(l),Math.cos(d)*Math.cos(l),Math.sin(d)]},[n,i,o]=a(t),[s,r,h]=a(e);return Math.acos(Math.min(1,Math.max(-1,n*s+i*r+o*h)))*180/Math.PI}static doppler(t,e,a,n){const i=g.VELOCITY_STEP_MS,o=F.positionAt(t,a-i),s=F.positionAt(t,a+i);if(!o||!s)return 1;const r=L.seenFrom(e,o.geo).distanceKm*1e3,h=L.seenFrom(e,s.geo).distanceKm*1e3;return 1/(1-(r-h)/(2*i/1e3)/n)}}class Ft{static at(t,e,a,n,i={}){const o=F.seenFrom(t,a,n);if(!o)return;const s=y.of(e),r=g.heardAt(t,a,n,{noise:g.noiseOfKind(s.kind),...i});return{hex:`${t.nonIcao?"~":""}${t.icao.toString(16).padStart(6,"0")}`,registration:e?.registration,typeCode:s.code??e?.type,name:s.basis==="nothing"?void 0:s.name,kind:s.kind,basis:s.basis,military:e?.military===!0,restricted:e?.restricted===!0,altitudeFt:o.altitudeFt,groundSpeedKt:o.groundSpeedKt,trackDeg:o.trackDeg,sky:o.sky,angularRateDegPerS:o.angularRateDegPerS,hearing:r&&{audible:r.audible,levelDbA:r.levelDbA,ambientDbA:r.ambientDbA,delayS:r.delayS,lagDeg:r.lagDeg,dopplerRatio:r.dopplerRatio,cutoffHz:r.cutoffHz,dominantHz:r.dominantHz}}}}class O{static REFERENCE_AMPLITUDE=.02;static MASKING_RANGE_DB=6;static KNEE_DB=20;static COMPRESSION_RATIO=1.5;static EXPANSION_RATIO=1.8;static DEFAULT_MAX_VOICES=4;static candidates(t,e,a,n,i={}){const o=new Set;for(const[s,r]of t){const h=g.noiseOfKind(y.of(e.get(a(r))).kind);let c=1/0;for(const d of r.points)c=Math.min(c,L.seenFrom(n,{lat:d.lat,lng:d.lng,heightM:d.altitudeFt*.3048}).distanceKm);g.couldBeHeard(h,c,i.ambientDbA,i.air)&&o.add(s)}return o}static voices(t,e,a,n,i,o,s={}){const r=[];for(const h of t){const c=e.get(h);if(!c||s.only?.(h)===!1)continue;const d=s.kindOf?.(h)??y.of(a.get(n(c))).kind,l=s.noiseOf?.(h)??g.noiseOfKind(d),u=g.heardAt(c,i,o,{...s,noise:l});u?.audible&&r.push({id:h,kind:d,bandAmplitudes:O.bandAmplitudes(u.bandsDbA,u.ambientDbA,s.referenceAmplitude),levelDbA:u.levelDbA,distanceKm:u.sound.distanceKm,dopplerRatio:u.dopplerRatio,azimuthDeg:u.sound.azimuthDeg,elevationDeg:u.sound.altitudeDeg,character:l.character})}return r.sort((h,c)=>c.levelDbA-h.levelDbA).slice(0,s.maxVoices??O.DEFAULT_MAX_VOICES)}static bandAmplitudes(t,e,a=O.REFERENCE_AMPLITUDE){const n=g.ambientBands(e),i=g.DETECTION_MARGIN_DB,o=E.sumDb(t),s=o-e,r=s>=O.KNEE_DB?O.KNEE_DB+(s-O.KNEE_DB)/O.COMPRESSION_RATIO:O.KNEE_DB-(O.KNEE_DB-s)*O.EXPANSION_RATIO,h=a*10**(r/20);return t.map((c,d)=>{const l=Math.min(1,Math.max(0,(c-n[d]-i+O.MASKING_RANGE_DB)/(2*O.MASKING_RANGE_DB)));return l*l*(3-2*l)*h*10**((c-o)/20)})}static BANDS_HZ=E.OCTAVES}class W{static ENGLISH={unnamed:"Aircraft {hex}",altitude:"{value} ft",speed:"{value} kt",heading:"heading {value}°",position:"{distance} km away, {elevation}° above the horizon, {bearing}",heard:"Heard at {level} dB(A), left the aircraft {delay} s ago, {lag}° behind it: {character}{pitch}",rumble:"a low rumble, nothing above {cutoff} Hz",muffled:"a dull noise, nothing above {cutoff} Hz",broad:"a broad roar",pitchHigher:", pitch {percent} % higher",pitchLower:", pitch {percent} % lower",inaudible:"Not audible here: {level} dB(A) against {ambient} dB(A) of ambient noise",soundUnknown:"Its sound cannot be worked out: the aircraft was not recorded yet when it left",contrailPersistent:"Leaves a trail that lasts: the air is supersaturated over ice ({rhi} % over ice)",contrailShort:"Leaves a short-lived trail: the air is dry over ice ({rhi} % over ice)",military:"military",restricted:"identity withheld by its owner",candidate:"A compatible candidate, not an identification"};static RUMBLE_BELOW_HZ=500;static DULL_BELOW_HZ=2e3;static PITCH_NOTICED=.03;static text(t,e,a,n){const i=(l,u=0)=>l.toLocaleString(n,{maximumFractionDigits:u}),o=(l,u)=>l.replace(/\{(\w+)\}/g,(p,m)=>u[m]??`{${m}}`),s=[],r=[t.registration,t.name].filter(Boolean).join(" · ");s.push(r||o(e.unnamed,{hex:t.hex}));const h=[o(e.altitude,{value:i(Math.round(t.altitudeFt/100)*100)}),t.groundSpeedKt===void 0?void 0:o(e.speed,{value:i(Math.round(t.groundSpeedKt))}),t.trackDeg===void 0?void 0:o(e.heading,{value:i(Math.round(t.trackDeg))})].filter(Boolean);s.push(h.join(" · ")),s.push(o(e.position,{distance:i(t.sky.distanceKm,t.sky.distanceKm<10?1:0),elevation:i(Math.round(t.sky.altitudeDeg)),bearing:a(t.sky.azimuthDeg)}));const c=t.hearing;if(!c)s.push(e.soundUnknown);else if(!c.audible)s.push(o(e.inaudible,{level:i(Math.round(c.levelDbA)),ambient:i(Math.round(c.ambientDbA))}));else{const l=c.cutoffHz??0,u=l<=W.RUMBLE_BELOW_HZ?e.rumble:l<=W.DULL_BELOW_HZ?e.muffled:e.broad,p=c.dopplerRatio-1,m=Math.abs(p)<W.PITCH_NOTICED?"":o(p>0?e.pitchHigher:e.pitchLower,{percent:i(Math.round(Math.abs(p)*100))});s.push(o(e.heard,{level:i(Math.round(c.levelDbA)),delay:i(Math.round(c.delayS)),lag:i(Math.round(c.lagDeg)),character:o(u,{cutoff:i(l)}),pitch:m}))}t.contrail&&s.push(o(t.contrail.persistent?e.contrailPersistent:e.contrailShort,{rhi:i(Math.round(t.contrail.iceRelativeHumidity*100))}));const d=[t.military?e.military:void 0,t.restricted?e.restricted:void 0].filter(Boolean);return d.length>0&&s.push(d.join(" · ")),s.push(e.candidate),s.join(`
2
- `)}}class Y{static EFFICIENCY={"airliner-narrow":.34,"airliner-wide":.38,"regional-jet":.32,"business-jet":.3,"military-jet":.22,unknown:.34};static efficiencyOf(t){return Y.EFFICIENCY[t]}}class M{static EMISSION_INDEX_WATER=1.25;static COMBUSTION_HEAT=432e5;static AIR_HEAT_CAPACITY=1004;static MOLAR_MASS_RATIO=.622;static FT_TO_M=.3048;static TROPOPAUSE_M=11e3;static TROPOPAUSE_HPA=226.32;static ISOTHERMAL_SCALE_HEIGHT_M=6341.62;static pressureAtAltitudeFt(t){const e=t*M.FT_TO_M;return e<=M.TROPOPAUSE_M?1013.25*(1-225577e-10*e)**5.25588:M.TROPOPAUSE_HPA*Math.exp(-(e-M.TROPOPAUSE_M)/M.ISOTHERMAL_SCALE_HEIGHT_M)}static saturationOverWaterPa(t){const e=t+273.15;return Math.exp(54.842763-6763.22/e-4.21*Math.log(e)+367e-6*e+Math.tanh(.0415*(e-218.8))*(53.878-1331.22/e-9.44523*Math.log(e)+.014025*e))}static saturationOverIcePa(t){const e=t+273.15;return Math.exp(9.550426-5723.265/e+3.53068*Math.log(e)-.00728332*e)}static iceRelativeHumidity(t,e){return e*M.saturationOverWaterPa(t)/M.saturationOverIcePa(t)}static mixingSlope(t,e){return M.EMISSION_INDEX_WATER*M.AIR_HEAT_CAPACITY*t*100/(M.MOLAR_MASS_RATIO*M.COMBUSTION_HEAT*(1-e))}static criticalTemperatureC(t,e){const a=Math.log(M.mixingSlope(t,e)-.053);return-46.46+9.43*a+.72*a*a}static requiredHumidity(t,e,a){const n=M.criticalTemperatureC(t,e);return(M.mixingSlope(t,e)*(a-n)+M.saturationOverWaterPa(n))/M.saturationOverWaterPa(a)}static evaluate(t,e){const a=M.criticalTemperatureC(t.pressureHpa,e),n=M.requiredHumidity(t.pressureHpa,e,t.temperatureC),i=M.iceRelativeHumidity(t.temperatureC,t.relativeHumidity),o=t.temperatureC<a&&t.relativeHumidity>=n;return{forms:o,persistent:o&&i>=1,criticalTemperatureC:a,requiredHumidity:n,iceRelativeHumidity:i}}}class w{static HOLD_MS=36e5;static DEG=Math.PI/180;static GAS_CONSTANT_OVER_GRAVITY=287.05/9.80665;static at(t,e,a){if(t.length===0)return;const n=t[0],i=t[t.length-1];if(e<n.t-w.HOLD_MS||e>i.t+w.HOLD_MS)return;const o=t.findIndex(u=>u.t>e),s=o===0?t[0]:t[(o===-1?t.length:o)-1],r=o===-1||o===0?s:t[o],h=w.atLevel(s,a),c=w.atLevel(r,a);if(!h||!c)return;const d=r.t>s.t?Math.min(1,Math.max(0,(e-s.t)/(r.t-s.t))):0,l=(u,p)=>u+(p-u)*d;return{pressureHpa:a,temperatureC:l(h.temperatureC,c.temperatureC),relativeHumidity:l(h.relativeHumidity,c.relativeHumidity),driftEastMs:l(h.driftEastMs,c.driftEastMs),driftNorthMs:l(h.driftNorthMs,c.driftNorthMs),shearPerS:l(h.shearPerS,c.shearPerS)}}static atLevel(t,e){const a=t.levels;for(let n=0;n+1<a.length;n++){const i=a[n],o=a[n+1];if(e>i.pressureHpa||e<o.pressureHpa)continue;const s=(Math.log(i.pressureHpa)-Math.log(e))/(Math.log(i.pressureHpa)-Math.log(o.pressureHpa)),r=(u,p)=>u+(p-u)*s,h=u=>{const p=u.windFromDeg*w.DEG;return{east:-u.windSpeedMs*Math.sin(p),north:-u.windSpeedMs*Math.cos(p)}},c=h(i),d=h(o),l=w.GAS_CONSTANT_OVER_GRAVITY*((i.temperatureC+o.temperatureC)/2+273.15)*Math.log(i.pressureHpa/o.pressureHpa);return{pressureHpa:e,temperatureC:r(i.temperatureC,o.temperatureC),relativeHumidity:r(i.relativeHumidity,o.relativeHumidity),driftEastMs:r(c.east,d.east),driftNorthMs:r(c.north,d.north),shearPerS:Math.hypot(d.east-c.east,d.north-c.north)/l}}}}class H{static MIN_ALTITUDE_FT=2e4;static DENSE_MS=3e5;static SPARSE_STEP_MS=6e4;static SATURATION_HORIZON_MS=3*36e5;static SATURATION_STEP_MS=6e5;static PRESSURE_STEP_HPA=5;static plan(t,e,a,n){if(a.length===0)return[];const i=[],o=new Map,s=(r,h,c)=>{const d=Math.round(h/H.PRESSURE_STEP_HPA)*H.PRESSURE_STEP_HPA,l=H.SATURATION_STEP_MS,u=Math.floor(r/l)*l,p=`${d}|${u}`,m=o.get(p);if(m!==void 0)return m+(u-r)/1e3;let A=1/0;for(let b=l;b<=H.SATURATION_HORIZON_MS;b+=l){const R=w.at(a,u+b,d);if(!R)break;if(M.evaluate(R,c).iceRelativeHumidity<1){A=b/1e3;break}}return o.set(p,A),A+(u-r)/1e3};for(const r of t.objects){const h=t.flights.get(r.id),c=r.track;if(!h||!c||c.length!==h.points.length)continue;const d=e?.get(z.keyOf(h))??y.of(void 0),l=Y.efficiencyOf(d.kind);if(l===void 0)continue;const u=[];let p=-1/0;c.forEach((m,A)=>{if(m.t<-H.DENSE_MS&&A+1<c.length&&m.t-p<H.SPARSE_STEP_MS)return;p=m.t;const b=h.points[A],R=M.pressureAtAltitudeFt(b.altitudeFt),S=w.at(a,n+m.t,R),f=S&&M.evaluate(S,l);u.push({tMs:m.t,eastM:m.eastM,northM:m.northM,upM:m.altitudeM??0,forms:f?.forms??!1,persistent:f?.persistent??!1,lifetimeS:f?Z.lifetimeS(f.iceRelativeHumidity):0,driftEastMs:S?.driftEastMs??0,driftNorthMs:S?.driftNorthMs??0,shearPerS:S?.shearPerS??Z.TYPICAL_SHEAR_PER_S,iceRelativeHumidity:f?.iceRelativeHumidity??0,saturatedForS:f?.persistent?s(n+m.t,R,l):0})}),u.some((m,A)=>m.forms&&u[A+1]?.forms)&&i.push({id:r.id,spanM:d.spanM,points:u})}return i}}const ct=[500,400,300,250,200,150],yt=["temperature","relative_humidity","wind_speed","wind_direction"],kt="2022-01-01",lt=.25;class Pt{fetchImpl;baseUrl;cache=new Map;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.baseUrl=t.baseUrl??"https://historical-forecast-api.open-meteo.com/v1/forecast"}between(t,e,a){const n=new Date(e).toISOString().slice(0,10);if(n<kt)return Promise.resolve({status:"outside"});const i=new Date(a).toISOString().slice(0,10),s=`${`${Math.round(t.lat/lt)},${Math.round(t.lng/lt)}`}|${n}|${i}`;let r=this.cache.get(s);return r||(r=this.read(t,n,i),this.cache.set(s,r),r.then(h=>{h.status==="failed"&&this.cache.delete(s)})),r}async read(t,e,a){const n=ct.flatMap(s=>yt.map(r=>`${r}_${s}hPa`)),i=new URLSearchParams({latitude:String(t.lat),longitude:String(t.lng),start_date:e,end_date:a,hourly:n.join(","),wind_speed_unit:"ms",timezone:"UTC"}),o=`${this.baseUrl}?${i}`;try{const s=await this.fetchImpl(o);if(!s.ok)return{status:"failed"};const r=await s.json();return this.decode(r,{id:"open-meteo-forecast",name:"Open-Meteo (historical forecast)",url:o})}catch{return{status:"failed"}}}decode(t,e){const a=t.hourly;if(!a?.time)return{status:"outside"};const n=[];return a.time.forEach((i,o)=>{const s=[];for(const r of ct){const h=p=>a[`${p}_${r}hPa`]?.[o],c=h("temperature"),d=h("relative_humidity"),l=h("wind_speed"),u=h("wind_direction");if([c,d,l,u].some(p=>p==null))return;s.push({pressureHpa:r,temperatureC:c,relativeHumidity:d/100,windSpeedMs:l,windFromDeg:u})}n.push({t:Date.parse(`${i}Z`),levels:s})}),n.length>0?{status:"found",samples:n,source:e}:{status:"outside"}}}const Gt=[{id:"open-meteo-forecast",name:"Open-Meteo (historical forecast)",credit:"Weather data by Open-Meteo.com, CC BY 4.0",creditUrl:"https://open-meteo.com/en/docs/historical-forecast-api",create:()=>new Pt}];class I{static DEFAULT_KIND="airliner-narrow";static STEP_MS=1e3;static LEAD_MS=12e4;static FT_PER_M=1/.3048;static ID_PREFIX="decor:";tracks=new Map;static kindOf(t,e){if(t.kind!=="aircraft"||!I.flies(t))return;const a=t.aircraftSound??e??I.DEFAULT_KIND;return a==="silent"?void 0:a}static flies(t){return(t.track??[]).some(e=>(e.altitudeM??0)>0)}voices(t,e,a,n={},i=()=>{}){const o=t.event.place?.[0];if(!o)return[];const s=new Map,r=new Map,h=Math.max(t.observerTrack.duration,(t.event.durationSeconds??0)*1e3);for(const c of t.decor){const d=I.kindOf(c,i(c));if(!d)continue;const l=`${I.ID_PREFIX}${c.id}`;s.set(l,this.trackOf(c,l,o,h)),r.set(l,d)}for(const c of this.tracks.keys())s.has(c)||this.tracks.delete(c);return s.size===0?[]:O.voices(new Set(s.keys()),s,new Map,c=>String(c.icao),a,e,{...n,kindOf:c=>r.get(c)})}trackOf(t,e,a,n){const i=JSON.stringify([t.track,t.eastM,t.northM,t.headingDeg,a.lat,a.lng,n]),o=this.tracks.get(e);if(o?.key===i)return o.track;const s=[];for(let l=0;l<=n;l+=I.STEP_MS)s.push(I.pointAt(t,l,a));(s.length===0||s[s.length-1].t<n)&&s.push(I.pointAt(t,n,a));const r=s[0],h=s[1]??r,c=l=>(h[l]-r[l])/(h.t-r.t||1);for(let l=I.STEP_MS*10;l<=I.LEAD_MS;l+=I.STEP_MS*10)s.unshift({t:-l,lat:r.lat-c("lat")*l,lng:r.lng-c("lng")*l,altitudeFt:Math.max(0,r.altitudeFt-c("altitudeFt")*l)});const d={icao:I.hash(e),nonIcao:!0,points:s};return this.tracks.set(e,{key:i,track:d}),d}static pointAt(t,e,a){const n=pt(t,e),i=$(n.eastM,-n.northM,a.lat,a.lng);return{t:e,lat:i.lat,lng:i.lng,altitudeFt:n.altitudeM*I.FT_PER_M}}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}class G{static STEP_MS=250;static FT_PER_M=1/.3048;static ID_PREFIX="body:";tracks=new Map;static noiseOf(t){const e=g.noiseOfKind(t.kind),a=t.quieterDb??0;return a===0?e:{...e,id:`${e.id}-${a}dB`,soundPowerA:e.soundPowerA.map(n=>n-a)}}voices(t,e,a,n,i,o,s={}){const r=new Map,h=new Map,c=new Map;for(const l of t){if(!l.sound)continue;const u=`${G.ID_PREFIX}${l.id}`,p=this.trackOf(l,u,e,n,o);p&&(r.set(u,p),h.set(u,l.sound.kind),c.set(u,G.noiseOf(l.sound)))}for(const l of this.tracks.keys())r.has(l)||this.tracks.delete(l);if(r.size===0)return[];const d=$(a.eastM,-a.northM,n.lat,n.lng);return O.voices(new Set(r.keys()),r,new Map,l=>String(l.icao),{lat:d.lat,lng:d.lng,heightM:a.upM},i,{...s,kindOf:l=>h.get(l),noiseOf:l=>c.get(l)})}trackOf(t,e,a,n,i){const o=`${n.lat},${n.lng},${i}`,s=this.tracks.get(e);if(s&&s.body===t&&s.origin===o)return s.track;const r=[];for(let c=-12e4;c<=i;c+=G.STEP_MS){const d=a(t,c);if(!d)continue;const l=$(d.eastM,-d.northM,n.lat,n.lng);r.push({t:c,lat:l.lat,lng:l.lng,altitudeFt:d.upM*G.FT_PER_M})}if(r.length<2)return;const h={icao:G.hash(e),nonIcao:!0,points:r};return this.tracks.set(e,{body:t,origin:o,track:h}),h}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}export{q as AircraftAudio,H as AircraftContrails,y as AircraftModels,_ as AmbientNoise,G as BodyHearing,I as DecorAircraftHearing,D as TrafficDecor,Ft as TrafficInfos,O as TrafficSound,W as TrafficTooltip,Gt as UPPER_AIR_SOURCES};
@@ -1 +0,0 @@
1
- import{a4 as M,a5 as y,a1 as I}from"./rr0-sighting-editor.mjs";class d{static RECORD_BYTES=20;static NON_ICAO_FLAG=1<<24;static UNKNOWN=65535;static MAX_DT=35999;static decode(t){if(t.length%d.RECORD_BYTES!==0)throw new Error(`An aircraft tile is a multiple of ${d.RECORD_BYTES} bytes, not ${t.length}`);const e=new DataView(t.buffer,t.byteOffset,t.byteLength),c=[];for(let n=0;n<t.length;n+=d.RECORD_BYTES){const s=e.getUint32(n,!0),a=e.getUint16(n+16,!0),r=e.getUint16(n+18,!0);c.push({icao:s&16777215,nonIcao:(s&d.NON_ICAO_FLAG)!==0,secondsInHour:e.getUint16(n+4,!0)/10,lat:e.getInt32(n+6,!0)/1e5,lng:e.getInt32(n+10,!0)/1e5,altitudeFt:e.getInt16(n+14,!0)*25,groundSpeedKt:a===d.UNKNOWN?void 0:a/10,trackDeg:r===d.UNKNOWN?void 0:r/10})}return c}}const w="https://ufoathome.org/aircraft/index.json";class f{citation=M;static DEFAULT_RADIUS_KM=150;static FLAG_MILITARY=1;static FLAG_PIA=4;static FLAG_LADD=8;static KM_PER_DEG=111.32;static HOUR_MS=36e5;fetchImpl;indexUrls;index;hours=new Map;tiles=new Map;shards=new Map;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.indexUrls=t.indexUrls??f.defaultIndexUrls()}static defaultIndexUrls(){const t=[];return typeof location<"u"&&/^https?:$/.test(location.protocol)&&t.push(new URL("/aircraft/index.json",location.href).href),t.includes(w)||t.push(w),t}mayCover(t){return y.mayCover(t)}async between(t,e,c,n=f.DEFAULT_RADIUS_KM){const s=await this.loadIndex();if(!s)return{status:"failed"};const a=[];for(let o=Math.floor(e/f.HOUR_MS);o<=Math.floor(c/f.HOUR_MS);o++)a.push(o);if(!a.every(o=>s.index.days.includes(f.dayOf(o))))return{status:"outside"};const r=f.tilesAround(t,n);try{const o=(await Promise.all(a.flatMap(u=>r.map(i=>this.tileOf(s.base,u,i))))).flat();return{status:"found",tracks:f.merge(o,t,e,c,n)}}catch{return{status:"failed"}}}async describe(t,e){const c=await this.loadIndex();if(!c)return;const n=t.icao.toString(16).padStart(6,"0"),s=t.nonIcao?"non-icao":n.slice(0,2),a=`${e}/${s}`;let r=this.shards.get(a);r||(r=this.fetchImpl(new URL(`${e}/aircraft/${s}.json`,c.base).href).then(g=>g.ok?g.json():{}).catch(()=>({})),this.shards.set(a,r));const o=(await r)[t.nonIcao?`~${n}`:n];if(!o)return;const[u,i,l,h=0]=o,p={registration:u||void 0,type:i||void 0,category:l||void 0,military:(h&f.FLAG_MILITARY)!==0||void 0,restricted:(h&(f.FLAG_PIA|f.FLAG_LADD))!==0||void 0};return Object.values(p).some(g=>g!==void 0)?p:void 0}static tilesAround(t,e){const c=e/f.KM_PER_DEG,n=Math.max(-90,t.lat-c),s=Math.min(90,t.lat+c),a=Math.cos(Math.max(Math.abs(n),Math.abs(s))*Math.PI/180),r=a<1e-6?180:e/(f.KM_PER_DEG*a),o=new Set;if(r>=180)for(let i=-180;i<180;i++)o.add(i);else for(let i=Math.floor(t.lng-r);i<=Math.floor(t.lng+r);i++)o.add(I.wrapLongitude(i));const u=[];for(let i=Math.floor(n);i<=Math.min(89,Math.floor(s));i++)for(const l of o)u.push(`${i}_${l}`);return u}static dayOf(t){return new Date(t*f.HOUR_MS).toISOString().slice(0,10)}static merge(t,e,c,n,s){const a=new Map;for(const o of t){const u=o.points.filter(h=>h.t>=c&&h.t<=n&&I.groundDistanceKm(e,h)<=s);if(u.length===0)continue;const i=`${o.nonIcao?"~":""}${o.icao}`,l=a.get(i);l?l.points.push(...u):a.set(i,{icao:o.icao,nonIcao:o.nonIcao,points:u})}const r=[...a.values()];for(const o of r)o.points.sort((u,i)=>u.t-i.t);return r.sort((o,u)=>o.icao-u.icao)}loadIndex(){return this.index??=(async()=>{for(const t of this.indexUrls)try{const e=await this.fetchImpl(t);if(e.ok)return{index:await e.json(),base:t}}catch{}})(),this.index}tileOf(t,e,c){const n=f.dayOf(e),s=String(e%24).padStart(2,"0"),a=`${n}/${s}/${c}`;let r=this.tiles.get(a);return r||(r=this.hourIndex(t,n,s).then(async o=>{const u=o[c];if(!u)return[];const[i,l]=u,h=await this.fetchImpl(new URL(`${n}/${s}.pack`,t).href,{headers:{Range:`bytes=${i}-${i+l-1}`}});if(!h.ok)throw new Error(`The pack of ${n} ${s} h answered ${h.status}`);const p=new Uint8Array(await h.arrayBuffer()),g=h.status===206?p:p.subarray(i,i+l);return f.tracksOf(await f.gunzip(g),e)}),r.catch(()=>this.tiles.delete(a)),this.tiles.set(a,r)),r}hourIndex(t,e,c){const n=`${e}/${c}`;let s=this.hours.get(n);return s||(s=this.fetchImpl(new URL(`${e}/${c}.json`,t).href).then(a=>{if(a.status===404)return{};if(!a.ok)throw new Error(`The index of ${e} ${c} h answered ${a.status}`);return a.json()}),s.catch(()=>this.hours.delete(n)),this.hours.set(n,s)),s}static async gunzip(t){const e=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));return new Uint8Array(await new Response(e).arrayBuffer())}static tracksOf(t,e){const c=new Map;for(const n of d.decode(t)){const s=`${n.nonIcao?"~":""}${n.icao}`;let a=c.get(s);a||c.set(s,a={icao:n.icao,nonIcao:n.nonIcao,points:[]}),a.points.push({t:e*f.HOUR_MS+n.secondsInHour*1e3,lat:n.lat,lng:n.lng,altitudeFt:n.altitudeFt,groundSpeedKt:n.groundSpeedKt,trackDeg:n.trackDeg})}return[...c.values()]}}export{f as AdsbLolArchiveProvider,w as UFOATHOME_AIRCRAFT_INDEX_URL};
@@ -1,13 +0,0 @@
1
- import{L as o}from"./LaserBeam-DZ6ILkZ8.js";import{y as m,U as f,D as b,v as d,w as h,u,G as v}from"./rr0-sighting-editor.mjs";import{beamEditorMessages_en as c}from"./BeamEditorMessages_en-SQumGyrS.js";class i{static LIGHT={en:"Light",fr:"Lumière",es:"Luz",it:"Luce"};static WHEN={en:"When",fr:"Quand",es:"Cuándo",it:"Quando"};static nextPlace(e){const t=e[e.length-1]??{lat:0,lng:0,altitudeM:0},s=e[e.length-2];return s?{lat:2*t.lat-s.lat,lng:2*t.lng-s.lng,altitudeM:2*t.altitudeM-s.altitudeM}:{lat:t.lat,lng:t.lng+500/(111320*Math.max(.05,Math.cos(t.lat*Math.PI/180))),altitudeM:t.altitudeM}}static instant(e,t,s){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t,hint:s,group:i.WHEN}}static SET={kind:"beam",title:{en:"Beam",fr:"Faisceau",es:"Haz",it:"Fascio"},parameters:[{type:"said",key:"title",label:{en:"Name",fr:"Nom",es:"Nombre",it:"Nome"},group:i.LIGHT},{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",required:!0,group:i.LIGHT,label:{en:"Wavelength",fr:"Longueur d'onde",es:"Longitud de onda",it:"Lunghezza d'onda"},hint:{en:"Its colour: 532 for the green of a frequency-doubled laser, 520 for a green diode, 638 for a red one, 450 for a blue one.",fr:"Sa couleur : 532 pour le vert d'un laser doublé en fréquence, 520 pour une diode verte, 638 pour une rouge, 450 pour une bleue.",es:"Su color: 532 para el verde de un láser doblado en frecuencia, 520 para un diodo verde, 638 para uno rojo, 450 para uno azul.",it:"Il suo colore: 532 per il verde di un laser a frequenza raddoppiata, 520 per un diodo verde, 638 per uno rosso, 450 per uno blu."}},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",required:!0,group:i.LIGHT,label:{en:"Power",fr:"Puissance",es:"Potencia",it:"Potenza"},hint:{en:"The optical power it carries, its mean for a pulsed laser, whose pulses no eye tells apart. What is seen of it is what the air scatters.",fr:"La puissance optique qu'il porte, sa moyenne pour un laser pulsé, dont aucun œil ne distingue les impulsions. Ce qui s'en voit est ce que l'air en diffuse.",es:"La potencia óptica que lleva, su media para un láser pulsado, cuyos pulsos ningún ojo distingue. Lo que se ve de él es lo que el aire difunde.",it:"La potenza ottica che porta, la sua media per un laser pulsato, i cui impulsi nessun occhio distingue. Ciò che se ne vede è ciò che l'aria diffonde."}},{type:"number",key:"divergenceMrad",min:.001,max:1e3,step:.001,unit:"mrad",group:i.LIGHT,effective:()=>o.DEFAULT_DIVERGENCE_MRAD,label:{en:"Divergence",fr:"Divergence",es:"Divergencia",it:"Divergenza"},hint:{en:"How fast it widens, full angle: 0.1 mrad is a metre wide at 10 km.",fr:"À quelle vitesse il s'élargit, angle total : 0,1 mrad fait un mètre de large à 10 km.",es:"Lo rápido que se ensancha, ángulo total: 0,1 mrad es un metro de ancho a 10 km.",it:"Quanto in fretta si allarga, angolo totale: 0,1 mrad è un metro di larghezza a 10 km."}},{type:"number",key:"apertureM",min:.001,max:10,step:.001,unit:"m",group:i.LIGHT,effective:()=>o.DEFAULT_APERTURE_M,label:{en:"Width at the emitter",fr:"Largeur à l'émetteur",es:"Anchura en el emisor",it:"Larghezza all'emettitore"}},i.instant("fromT",{en:"On from",fr:"Allumé à",es:"Encendido a",it:"Acceso a"},{en:"Seconds of the recording; empty, from its start.",fr:"Secondes de l'enregistrement ; vide, dès son début.",es:"Segundos de la grabación; vacío, desde su inicio.",it:"Secondi della registrazione; vuoto, dal suo inizio."}),i.instant("untilT",{en:"Off at",fr:"Éteint à",es:"Apagado a",it:"Spento a"},{en:"Seconds of the recording; empty, until its end.",fr:"Secondes de l'enregistrement ; vide, jusqu'à sa fin.",es:"Segundos de la grabación; vacío, hasta su final.",it:"Secondi della registrazione; vuoto, fino alla sua fine."})]};static PLACE={kind:"beam-place",title:{en:"Point of the path",fr:"Point du trajet",es:"Punto del trayecto",it:"Punto del percorso"},parameters:[{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:.1,label:{en:"Position",fr:"Position",es:"Posición",it:"Posizione"}},{type:"number",key:"altitudeM",min:-500,max:1e5,step:.1,unit:"m",required:!0,label:{en:"Altitude",fr:"Altitude",es:"Altitud",it:"Altitudine"},hint:{en:"Above the sea, not the ground: an emitter at a window twelve metres up a building on ground at 160 m is at 172 m.",fr:"Au-dessus de la mer, pas du sol : un émetteur à une fenêtre à douze mètres de haut, sur un sol à 160 m, est à 172 m.",es:"Sobre el mar, no sobre el suelo: un emisor en una ventana a doce metros de altura, sobre un suelo a 160 m, está a 172 m.",it:"Sul mare, non sul suolo: un emettitore a una finestra a dodici metri d'altezza, su un suolo a 160 m, è a 172 m."}}]};static publish(){m.publish(i.SET)}}class r{constructor(e,t,s){this.container=e,this.host=t,this.language=s,m.of("beam")||i.publish(),this.render(),this.setLanguage(s)}messages=c;languageToken=0;currentId;form;list;places;placeForm;placeIndex=0;language;shown=[];async setLanguage(e){const t=++this.languageToken;this.language=e;const s=f.includes(e)?e:"en",a=s==="en"?c:await b(s);t===this.languageToken&&(this.messages=a,this.render(),this.sync())}sync(){const e=this.beams;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;this.element("beam-fields").hidden=t===void 0,t&&(this.syncPlaces(t),this.form??=new d(this.element("beam-parameters"),this.language,"beam.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i.SET,new h(()=>this.current,s=>this.editBeam(a=>s(a))),()=>this.written()))}refresh(){this.syncAddState();const e=this.beams;e.length===this.shown.length&&e.every((t,s)=>t.id===this.shown[s].id)||this.sync()}syncAddState(){const e=this.pathOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addBeamNowhere)}get current(){return this.beams.find(e=>e.id===this.currentId)}show(e){this.currentId=e,this.placeIndex=0,this.sync()}render(){const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
2
- <p class="launch-intro">${e.intro}</p>
3
- <div id="beam-list"></div>
4
- <div id="beam-fields" class="launch-fields">
5
- <fieldset id="beam-path" class="launch-path">
6
- <legend>${e.path}</legend>
7
- <div id="beam-places"></div>
8
- <div id="beam-place-parameters" class="launch-parameters"></div>
9
- </fieldset>
10
- <div id="beam-parameters" class="launch-parameters"></div>
11
- <p class="launch-intro">${e.derivedNote}</p>
12
- </div>
13
- </div>`,this.list=new u({header:this.element("beam-list"),body:this.element("beam-fields"),ids:{list:"beam-select",remove:"beam-delete",add:"beam-add"},onSelect:t=>{this.currentId=t,this.placeIndex=0,this.sync()},onAdd:()=>this.addBeam(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.beam,remove:e.deleteBeam,add:e.addBeam,empty:e.none}),this.places=new u({header:this.element("beam-places"),body:this.element("beam-place-parameters"),ids:{list:"beam-place",remove:"beam-place-delete",add:"beam-place-add"},navigation:{scope:this.container,onStep:t=>this.selectPlace(this.placeIndex+t)},onSelect:t=>this.selectPlace(Number(t)),onAdd:()=>this.addPlace(),onRemove:()=>this.removePlace()}),this.places.setLabels({list:e.place,remove:e.deletePlace,add:e.addPlace,previous:e.previousPlace,next:e.nextPlace}),this.placeForm=void 0}written(){const e=this.current;e&&this.list?.rename(e.id,this.labelOf(e))}syncPlaces(e,t=!1){const s=e.path;this.placeIndex=Math.max(0,Math.min(this.placeIndex,s.length-1)),this.places?.setItems(s.map((a,n)=>({id:String(n),label:this.placeLabel(n,s.length)})),String(this.placeIndex)),this.places?.setStepState(this.placeIndex>0,this.placeIndex<s.length-1),this.places?.setRemoveEnabled(s.length>r.MIN_PLACES),this.placeForm?this.placeForm.sync(t):(this.placeForm=new d(this.element("beam-place-parameters"),this.language,"beamPlace."),this.placeForm.show(i.PLACE,new h(()=>this.current?.path[this.placeIndex],a=>this.editBeam(n=>{const l={...n.path[this.placeIndex]};a(l),n.path=n.path.map((p,g)=>g===this.placeIndex?l:p)}),void 0,this.host.positionPlace?.()),()=>{}))}placeLabel(e,t){return`${e+1}/${t}`}static MIN_PLACES=2;selectPlace(e){const t=this.current?.path??[];e<0||e>=t.length||(this.placeIndex=e,this.syncPlaces(this.current,!0))}editBeam(e){const t=this.current;if(!t)return;const s={...t,path:[...t.path]};e(s),this.writeBeams(this.beams.map(a=>a===t?s:a)),this.host.changed()}addPlace(){this.editBeam(e=>{e.path=[...e.path,i.nextPlace(e.path)]}),this.placeIndex=(this.current?.path.length??1)-1,this.syncPlaces(this.current,!0)}removePlace(){if((this.current?.path.length??0)<=r.MIN_PLACES)return;const e=this.placeIndex;this.editBeam(t=>{t.path=t.path.filter((s,a)=>a!==e)}),this.syncPlaces(this.current,!0)}pathOfNew(){const e=this.host.sighting(),t=e.event?.place?.[0];if(t?.lat===void 0||t.lng===void 0)return;const s=(e.observerTrack?.getInterpolatedPoseAt(0)?.headingDeg??0)*Math.PI/180,a=111320;return[{lat:t.lat,lng:t.lng,altitudeM:0},{lat:t.lat+2e3*Math.cos(s)/a,lng:t.lng+2e3*Math.sin(s)/(a*Math.max(.05,Math.cos(t.lat*Math.PI/180))),altitudeM:100}]}addBeam(){const e=this.pathOfNew();if(!e)return;let t=this.beams.length+1;for(;this.beams.some(a=>a.id===`beam-${t}`);)t++;const s={id:`beam-${t}`,path:e,wavelengthNm:532,powerW:5};this.writeBeams([...this.beams,s]),this.currentId=s.id,this.placeIndex=0,this.host.changed(),this.sync()}deleteCurrent(){const e=this.current;e&&(this.currentId=void 0,this.writeBeams(this.beams.filter(t=>t!==e)),this.host.changed(),this.sync())}writeBeams(e){const t=this.host.sighting();t.skyEvents=v.written({...t.skyEvents,beams:e})}labelOf(e){const t=this.host.said().read(e.title);return t?`${t} (${e.id})`:e.id}get beams(){return this.host.sighting().skyEvents?.beams??[]}element(e){return this.container.querySelector(`#${e}`)}}export{r as BeamEditor};
@@ -1 +0,0 @@
1
- const e={intro:"A beam of light sent through the air from the ground while the recording runs: a laser shot, a searchlight. A fact of the sky, not a reading of the account. Its path goes from the emitter through any mirror to where it ends; how bright it shows is what the air scatters of it, computed.",none:"No beam in this recording",beam:"Beam",deleteBeam:"Delete the beam",addBeam:"Add a beam",path:"Path",place:"Point of the path",addPlace:"Add a point to the path, going on as it goes",deletePlace:"Remove this point",previousPlace:"Previous point",nextPlace:"Next point",addBeamNowhere:"Give the recording a place first: a beam is put in front of the witness",derivedNote:"An empty field shows, greyed, the value in use. Clear a field to go back to it."};export{e as beamEditorMessages_en};
@@ -1 +0,0 @@
1
- const e={intro:"Un haz de luz enviado por el aire desde el suelo durante la grabación: un disparo láser, un reflector. Un hecho del cielo, no una lectura del relato. Su trayecto va del emisor, por posibles espejos, hasta donde termina; su brillo es lo que el aire difunde de él, calculado.",none:"Ningún haz en esta grabación",beam:"Haz",deleteBeam:"Eliminar el haz",addBeam:"Añadir un haz",path:"Trayecto",place:"Punto del trayecto",addPlace:"Añadir un punto al trayecto, en su continuidad",deletePlace:"Quitar este punto",previousPlace:"Punto anterior",nextPlace:"Punto siguiente",addBeamNowhere:"Dé primero un lugar a la grabación: un haz se coloca delante del testigo",derivedNote:"Un campo vacío muestra, en gris, el valor usado. Vacíe un campo para volver a él."};export{e as beamEditorMessages_es};
@@ -1 +0,0 @@
1
- const e={intro:"Un faisceau de lumière envoyé dans l'air depuis le sol pendant l'enregistrement : un tir laser, un projecteur. Un fait du ciel, pas une lecture du compte rendu. Son trajet va de l'émetteur, par d'éventuels miroirs, jusqu'à là où il finit ; son éclat est ce que l'air en diffuse, calculé.",none:"Aucun faisceau dans cet enregistrement",beam:"Faisceau",deleteBeam:"Supprimer le faisceau",addBeam:"Ajouter un faisceau",path:"Trajet",place:"Point du trajet",addPlace:"Ajouter un point au trajet, dans la continuité",deletePlace:"Retirer ce point",previousPlace:"Point précédent",nextPlace:"Point suivant",addBeamNowhere:"Donnez d'abord un lieu à l'enregistrement : un faisceau est placé devant le témoin",derivedNote:"Un champ vide montre, en grisé, la valeur utilisée. Videz un champ pour y revenir."};export{e as beamEditorMessages_fr};
@@ -1 +0,0 @@
1
- const e={intro:"Un fascio di luce inviato nell'aria dal suolo durante la registrazione: un tiro laser, un proiettore. Un fatto del cielo, non una lettura del resoconto. Il suo percorso va dall'emettitore, attraverso eventuali specchi, fin dove finisce; la sua luminosità è ciò che l'aria ne diffonde, calcolata.",none:"Nessun fascio in questa registrazione",beam:"Fascio",deleteBeam:"Elimina il fascio",addBeam:"Aggiungi un fascio",path:"Percorso",place:"Punto del percorso",addPlace:"Aggiungi un punto al percorso, in continuità",deletePlace:"Togli questo punto",previousPlace:"Punto precedente",nextPlace:"Punto successivo",addBeamNowhere:"Dai prima un luogo alla registrazione: un fascio è posto davanti al testimone",derivedNote:"Un campo vuoto mostra, in grigio, il valore usato. Svuota un campo per tornarci."};export{e as beamEditorMessages_it};
@@ -1 +0,0 @@
1
- import{a7 as P,av as V,ax as N,aa as W,aQ as X,aR as D,aS as k}from"./rr0-sighting-editor.mjs";import{L as f}from"./LaserBeam-DZ6ILkZ8.js";class M{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 P;mesh;positions=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);colors=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new V;s.setAttribute("position",new N(this.positions,3)),s.setAttribute("color",new N(this.colors,3)),s.setDrawRange(0,0),this.mesh=new W(s,new X({vertexColors:!0,transparent:!0,blending:k,depthWrite:!1,fog:!1,side:D})),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}update(s,t,o){const c=this.viewsOf(s,t,o);let r=0;this.segments=0,this.drawn=[];for(const i of c){const l=f.colourOf(i.wavelengthNm),h=this.place(i,o);this.drawn.push({id:i.id,points:h});for(let u=0;u+1<h.length&&!(this.segments>=M.MAX_SEGMENTS);u++){const A=this.pushSegment(r,h[u],h[u+1],i.wavelengthNm,l,o);A>r&&this.segments++,r=A}}const n=this.mesh.geometry;n.setDrawRange(0,r);for(const i of["position","color"]){const l=n.getAttribute(i);l.clearUpdateRanges(),r>0&&l.addUpdateRange(0,r*3),l.needsUpdate=!0}}viewsOf(s,t,o){const{lat:c,lng:r}=o.reference;(!this.cut||this.cut.lat!==c||this.cut.lng!==r||this.cut.air!==o.air)&&(this.cut={lat:c,lng:r,air:o.air,views:new Map});const n=this.cut.views;return f.onAt(s,t).map(i=>{let l=n.get(i);return l||n.set(i,l={id:i.id,wavelengthNm:i.wavelengthNm,samples:f.samplesOf(i,o.reference,o.air)}),l})}place(s,t){const o=[];for(const c of s.samples){const r=t.origin.x+c.eastM*t.eastScale,n=t.origin.z-c.northM,i=c.upM-t.siteElevationM;if(o.length>0&&i<t.groundYAt(r,n))break;o.push({x:r,y:i,z:n,altitudeM:c.altitudeM,widthM:c.widthM,powerW:c.powerW})}return o}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,o,c,r,n,i=0){const l={x:o.x-t.x,y:o.y-t.y,z:o.z-t.z},h=Math.hypot(l.x,l.y,l.z);if(h<1e-6)return s;const u={x:l.x/h,y:l.y/h,z:l.z/h};if(Math.hypot((t.x+o.x)/2-n.eye.x,(t.y+o.y)/2-n.eye.y,(t.z+o.z)/2-n.eye.z)<.001)return s;const A=e=>{const y={x:n.eye.x-e.x,y:n.eye.y-e.y,z:n.eye.z-e.z},z=Math.hypot(y.x,y.y,y.z)||.001,p=(u.x*y.x+u.y*y.y+u.z*y.z)/z,a=Math.sqrt(Math.max(0,1-p*p)),w=f.phasedScattering(f.coefficientsAt(n.air,c,e.altitudeM),p);return{sinTurn:a,scattered:w,through:n.transmittanceTo(e.x,e.y,e.z)}},S=e=>M.MIN_PIXELS*n.pixelRad*Math.hypot(e.x-n.eye.x,e.y-n.eye.y,e.z-n.eye.z),m=e=>Math.hypot(e.x-n.eye.x,e.y-n.eye.y,e.z-n.eye.z),R=e=>Math.max(e.widthM,M.HALO_RAD*m(e)),g=e=>{const y=R(e)/S(e),z=Math.min(1,Math.max(0,y-1));return M.HALO_SHARE*z*z*(3-2*z)},I=new Map([t,o].map(e=>[e,A(e)])),x=(e,y,z)=>{const p=Math.max(y,S(e)),{sinTurn:a,scattered:w,through:E}=I.get(e),O=2*z*f.luminanceCdM2(e.powerW,c,w,p,a),H=r.map((v,C)=>Math.min(M.BRIGHTEST_RELATIVE,O*n.relativeScale*v*E[C])),L={x:n.eye.x-e.x,y:n.eye.y-e.y,z:n.eye.z-e.z},_=this.normalise(this.cross(u,L));return{point:e,half:p/2,level:H,across:_}},d=[[x(t,t.widthM,1-g(t)),x(o,o.widthM,1-g(o))],[x(t,R(t),g(t)),x(o,R(o),g(o))]],[G,T]=d[0].map(e=>Math.max(...e.level));if(i<M.MAX_HALVINGS&&Math.max(G,T)>M.SMOOTH_RATIO*Math.max(Math.min(G,T),1e-12)){const e={x:(t.x+o.x)/2,y:(t.y+o.y)/2,z:(t.z+o.z)/2,altitudeM:(t.altitudeM+o.altitudeM)/2,widthM:(t.widthM+o.widthM)/2,powerW:Math.sqrt(t.powerW*o.powerW)};return this.pushSegment(this.pushSegment(s,t,e,c,r,n,i+1),e,o,c,r,n,i+1)}if((s+M.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const e of d){if(e.every(a=>Math.max(...a.level)<=0))continue;const y=(a,w)=>{const E=s*3;this.positions[E]=a.point.x+a.across.x*a.half*w,this.positions[E+1]=a.point.y+a.across.y*a.half*w,this.positions[E+2]=a.point.z+a.across.z*a.half*w;const O=w===0?1:0;this.colors[E]=a.level[0]*O,this.colors[E+1]=a.level[1]*O,this.colors[E+2]=a.level[2]*O,s++},[z,p]=e;for(const a of[-1,1])y(z,a),y(z,0),y(p,a),y(z,0),y(p,0),y(p,a)}return s}pickAt(s,t,o){let c;for(const r of this.drawn)for(let n=0;n+1<r.points.length;n++){const i=r.points[n],l=r.points[n+1],h={x:l.x-i.x,y:l.y-i.y,z:l.z-i.z},u={x:i.x-s.x,y:i.y-s.y,z:i.z-s.z},A=h.x*h.x+h.y*h.y+h.z*h.z,S=h.x*t.x+h.y*t.y+h.z*t.z,m=h.x*u.x+h.y*u.y+h.z*u.z,R=t.x*u.x+t.y*u.y+t.z*u.z,g=A-S*S,I=g>1e-9?Math.min(1,Math.max(0,(S*R-m)/g)):0,x={x:i.x+h.x*I,y:i.y+h.y*I,z:i.z+h.z*I},d=(x.x-s.x)*t.x+(x.y-s.y)*t.y+(x.z-s.z)*t.z;if(d<=0)continue;const G=Math.hypot(x.x-s.x-t.x*d,x.y-s.y-t.y*d,x.z-s.z-t.z*d),T=Math.atan2(G,d);T<=o&&(!c||T<c.angle)&&(c={id:r.id,distanceM:Math.hypot(x.x-s.x,x.y-s.y,x.z-s.z),angle:T})}return c&&{id:c.id,distanceM:c.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{M as BeamSystem};
@@ -1,27 +0,0 @@
1
- import{U as A,t as O,B as u,u as M,v,w as k}from"./rr0-sighting-editor.mjs";import{bodyEditorMessages_en as w}from"./BodyEditorMessages_en-esgrRKGZ.js";class p{static before(e,i){const t=[...e.track].sort((s,o)=>s.t-o.t);return[...t].reverse().find(s=>s.t<=i)??t[0]}static viewOf(e,i,t){const s=p.before(e,i),o=n=>Number(n.toFixed(2));return{mode:s?.eastM!==void 0&&s.northM!==void 0?"world":"observer",azimuthDeg:o(t.azimuthDeg),elevationDeg:o(t.altitudeDeg),distanceM:o(t.distanceM),eastM:o(t.eastM),northM:o(t.northM),saidPosition:e.track.find(n=>n.t===i)?.saidPosition,aboveGroundM:o(t.aboveGroundM),onGround:s?.onGround===!0,widthM:o(t.sizeM.widthM),lengthM:o(t.sizeM.lengthM),heightM:o(t.sizeM.heightM),headingDeg:o(t.attitude.headingDeg),pitchDeg:o(t.attitude.pitchDeg),rollDeg:o(t.attitude.rollDeg),color:t.appearance.color,albedo:o(t.appearance.albedo),luminanceCdM2:o(t.appearance.luminanceCdM2),transparency:o(t.appearance.transparency??0),haloScale:o(t.appearance.haloScale??1)}}static keyframeOf(e,i,t,s){const o=r=>Number.isFinite(r)?r:0,n=e.mode==="world"?{t:i,eastM:o(e.eastM),northM:o(e.northM),...e.saidPosition?{saidPosition:e.saidPosition}:{},...e.onGround?{onGround:!0}:{altitudeAboveGroundM:o(e.aboveGroundM)}}:{t:i,azimuthDeg:o(e.azimuthDeg),altitudeDeg:o(e.elevationDeg),distanceM:Math.max(.1,o(e.distanceM)),...e.onGround?{onGround:!0}:{}},d=s?{color:e.color,albedo:Math.max(0,Math.min(1,o(e.albedo))),luminanceCdM2:Math.max(0,o(e.luminanceCdM2)),transparency:Math.max(0,Math.min(1,o(e.transparency))),haloScale:Math.max(0,o(e.haloScale))}:t?.appearance;return{...p.withoutPlacement(t),...n,sizeM:{widthM:Math.max(.01,o(e.widthM)),lengthM:Math.max(.01,o(e.lengthM)),heightM:Math.max(.01,o(e.heightM))},attitude:{headingDeg:o(e.headingDeg),pitchDeg:o(e.pitchDeg),rollDeg:o(e.rollDeg)},...d?{appearance:d}:{}}}static withoutPlacement(e){if(!e)return{};const{eastM:i,northM:t,saidPosition:s,azimuthDeg:o,altitudeDeg:n,distanceM:d,onGround:r,altitudeAboveGroundM:a,sizeM:l,attitude:c,appearance:m,...y}=e;return y}}class h{static number(e,i,t,s,o,n,d={}){return{type:"number",key:e,label:i,min:t,max:s,step:o,unit:n,required:!0,...d}}static BODY={kind:"body",title:{en:"Body",fr:"Corps",es:"Cuerpo",it:"Corpo"},parameters:[{type:"text",key:"id",required:!0,label:{en:"ID",fr:"Identifiant",es:"Identificador",it:"Identificativo"},validate:(e,i,t)=>!(t?.ids??[]).some(s=>s===e&&s!==i.id)},{type:"said",key:"title",label:{en:"Name",fr:"Nom",es:"Nombre",it:"Nome"}},{type:"set",key:"explains",label:{en:"Stands for the shapes",fr:"Représente les formes",es:"Representa las formas",it:"Rappresenta le forme"},options:(e,i)=>{const t=i?.shapes??[],s=(e.explains??[]).filter(o=>!t.some(n=>n.value===o));return[...t,...s.map(o=>({value:o,label:o}))]},empty:{en:"No shape",fr:"Aucune forme",es:"Ninguna forma",it:"Nessuna forma"}},{type:"text",key:"outlineNode",label:{en:"Part drawn by the witness",fr:"Partie dessinée par le témoin",es:"Parte dibujada por el testigo",it:"Parte disegnata dal testimone"},placeholder:{en:"Node of the model, e.g. hull",fr:"Nœud du modèle, par ex. hull",es:"Nodo del modelo, p. ej. hull",it:"Nodo del modello, ad es. hull"}}]};static KEYFRAME={kind:"body-keyframe",title:{en:"At the playhead",fr:"À l'instant courant",es:"En el instante actual",it:"All'istante corrente"},parameters:[{type:"choice",key:"mode",required:!0,label:{en:"Position",fr:"Position",es:"Posición",it:"Posizione"},choices:[{value:"observer",label:{en:"From the witness",fr:"Depuis le témoin",es:"Desde el testigo",it:"Dal testimone"}},{value:"world",label:{en:"In the world",fr:"Dans le monde",es:"En el mundo",it:"Nel mondo"}}]},h.number("azimuthDeg",{en:"Azimuth",fr:"Azimut",es:"Acimut",it:"Azimut"},0,360,.01,"°",{visibleWhen:e=>e.mode==="observer"}),h.number("elevationDeg",{en:"Elevation",fr:"Hauteur",es:"Elevación",it:"Elevazione"},-90,90,.01,"°",{visibleWhen:e=>e.mode==="observer"}),h.number("distanceM",{en:"Distance",fr:"Distance",es:"Distancia",it:"Distanza"},.1,3e4,.1,"m",{visibleWhen:e=>e.mode==="observer"}),{type:"position",key:"eastM",secondKey:"northM",saidKey:"saidPosition",native:"local",step:.1,label:{en:"In the world",fr:"Dans le monde",es:"En el mundo",it:"Nel mondo"},visibleWhen:e=>e.mode==="world"},{type:"boolean",key:"onGround",label:{en:"On the ground",fr:"Au sol",es:"En el suelo",it:"A terra"}},h.number("aboveGroundM",{en:"Above the ground",fr:"Au-dessus du sol",es:"Sobre el suelo",it:"Sopra il suolo"},0,3e4,.1,"m",{visibleWhen:e=>e.mode==="world"&&e.onGround!==!0}),h.number("widthM",{en:"Width",fr:"Largeur",es:"Ancho",it:"Larghezza"},.01,1e3,.01,"m"),h.number("lengthM",{en:"Length",fr:"Longueur",es:"Largo",it:"Lunghezza"},.01,1e3,.01,"m"),h.number("heightM",{en:"Height",fr:"Hauteur",es:"Alto",it:"Altezza"},.01,1e3,.01,"m"),h.number("headingDeg",{en:"Heading",fr:"Cap",es:"Rumbo",it:"Rotta"},0,360,.1,"°"),h.number("pitchDeg",{en:"Pitch",fr:"Tangage",es:"Cabeceo",it:"Beccheggio"},-90,90,.1,"°"),h.number("rollDeg",{en:"Roll",fr:"Roulis",es:"Alabeo",it:"Rollio"},-180,180,.1,"°"),{type:"colour",key:"color",label:{en:"Colour",fr:"Couleur",es:"Color",it:"Colore"},fallback:"#c8c8c8",visibleWhen:(e,i)=>i?.drawnFromModel!==!0},h.number("albedo",{en:"Albedo",fr:"Albédo",es:"Albedo",it:"Albedo"},0,1,.01,void 0),h.number("luminanceCdM2",{en:"Light of its own",fr:"Lumière propre",es:"Luz propia",it:"Luce propria"},0,1e10,.1,"cd/m²"),h.number("transparency",{en:"Transparency",fr:"Transparence",es:"Transparencia",it:"Trasparenza"},0,1,.01,void 0),h.number("haloScale",{en:"Halo",fr:"Halo",es:"Halo",it:"Alone"},0,20,.1,"×")]}}class b{constructor(e,i,t){this.container=e,this.host=i,this.language=t,this.render(),this.setLanguage(t)}static APPEARANCE_KEYS=["color","albedo","luminanceCdM2","transparency","haloScale"];messages=w;languageToken=0;currentId;catalogueToken=0;shownEntry;syncedId;bodyForm;keyForm;async setLanguage(e){const i=++this.languageToken;this.language=e;const t=A.includes(e)?e:"en",s=t==="en"?w:await O(t);i===this.languageToken&&s!==this.messages&&(this.messages=s,this.render())}get selectedId(){return this.currentId}sync(){const e=this.bodies;e.some(n=>n.id===this.currentId)||(this.currentId=e[0]?.id),this.input("body-interpretation-title").value=this.host.said().read(this.interpretation?.title)??"",this.list?.setItems(e.map(n=>({id:n.id,label:this.labelOf(n)})),this.currentId),this.host.bodySelected?.(this.currentId);const i=this.host.newBodyStart();this.list?.setAddState(i!==void 0,i?i.label!==void 0?this.messages.addBodyHint.replace("{shape}",i.label):this.messages.addBodyHintView:void 0),this.input("body-interpretation-title").closest("label").hidden=!1;const t=this.current;if(this.element("body-fields").hidden=t===void 0,!t)return;this.bodyForm?.sync(),this.syncModelOptions(t);const s=t.model;this.input("body-model-url").value=s.url??"",this.input("body-model-title").value=s.credit?.title??"",this.input("body-model-author").value=s.credit?.author??"",this.input("body-model-license").value=s.credit?.license??"",this.input("body-model-source").value=s.credit?.sourceUrl??"";const o=this.element("body-model-advanced");o.open=s.url!==void 0||o.open&&t.id===this.syncedId,this.syncedId=t.id,this.element("body-model-incomplete").hidden=s.url===void 0||s.credit?.title!==void 0&&s.credit.license!==void 0,this.syncKeyframe()}syncKeyframe(e=!1){const i=this.current;if(!i)return;const t=this.host.currentTime(),s=this.messages,o=this.host.readingOf(i,t),n=i.track.find(r=>r.t===t),d=this.element("body-key-legend");d.textContent=s.atPlayhead.replace("{t}",b.seconds(t)),d.hidden=n!==void 0,this.element("body-key-note").textContent=o?n?s.keyframeHere:s.keyframeAdded:s.notPlaced,this.keyList?.setItems(i.track.map(r=>({id:String(r.t),label:b.seconds(r.t)})),n?String(n.t):""),this.keyList?.setAddState(o!==void 0&&n===void 0),this.keyList?.setStepState(i.track.some(r=>r.t<t),i.track.some(r=>r.t>t)),this.element("body-key-parameters").hidden=!o,o&&this.keyForm?.sync(e)}stepKeyframe(e){const i=this.current;if(!i)return;const t=this.host.currentTime(),s=i.track.map(o=>o.t).filter(o=>e<0?o<t:o>t);s.length!==0&&(this.host.seekTo(e<0?Math.max(...s):Math.min(...s)),this.syncKeyframe(!0))}keyframeContext(){const e=this.current?.model;return{drawnFromModel:e===void 0||e.url!==void 0||!u.includes(e.id??"")}}keyframeView(){const e=this.current;if(!e)return;const i=this.host.currentTime(),t=this.host.readingOf(e,i);return t?p.viewOf(e,i,t):void 0}render(){const e=this.messages,i=(d,r,a="text",l="",c="",m="")=>`<label><span>${r}</span> <input id="${d}" type="${a}" placeholder="${l}" ${m} autocomplete="off"/>${c?` ${c}`:""}</label>`;this.container.innerHTML=`<div class="body-editor">
2
- <p class="body-intro">${e.intro}</p>
3
- ${i("body-interpretation-title",e.interpretationTitle)}
4
- <div id="body-list" class="body-list"></div>
5
- <div id="body-fields" class="body-fields">
6
- <div id="body-parameters" class="body-parameters"></div>
7
- <label><span>${e.model}</span> <select id="body-model"></select></label>
8
- <details id="body-model-advanced" class="decor-model-advanced" hidden>
9
- <summary>${e.modelAdvanced}</summary>
10
- ${i("body-model-url",e.modelUrl,"text",e.modelUrlHint)}
11
- ${i("body-model-title",e.modelTitle)}
12
- ${i("body-model-author",e.modelAuthor)}
13
- ${i("body-model-license",e.modelLicense,"text","CC0 1.0")}
14
- ${i("body-model-source",e.modelSource,"url","https://…")}
15
- <p id="body-model-incomplete" class="body-intro" hidden>${e.modelIncomplete}</p>
16
- <p id="body-model-catalogue" class="body-intro" hidden>${e.modelFromCatalogue}</p>
17
- </details>
18
- <div id="body-keys" class="body-keys"></div>
19
- <fieldset class="body-key">
20
- <legend id="body-key-legend"></legend>
21
- <p id="body-key-note" class="body-intro"></p>
22
- <div id="body-key-parameters" class="body-parameters"></div>
23
- <p class="body-intro">${e.appearanceNote}</p>
24
- <p class="body-intro">${e.pictureHint}</p>
25
- </fieldset>
26
- </div>
27
- </div>`;const t=this.element("body-list");this.list=new M({header:t,body:this.element("body-fields"),ids:{list:"body-select",remove:"body-delete",add:"body-add"},actions:[{id:"body-look",glyph:"🎯",onClick:()=>{const d=this.current;d&&this.host.lookAt(d)}}],onSelect:d=>{this.currentId=d,this.sync()},onAdd:()=>void this.addBody(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.body,remove:e.deleteBody,add:e.addBody,empty:e.none,actions:{"body-look":e.lookAtBody}}),this.input("body-interpretation-title").addEventListener("change",()=>this.updateInterpretationTitle());for(const d of["body-model-url","body-model-title","body-model-author","body-model-license","body-model-source"])this.input(d).addEventListener("change",()=>this.updateCurrent());this.select("body-model").addEventListener("change",()=>{const d=this.select("body-model").value;d!==""&&(this.input("body-model-url").value=""),this.updateCurrent(),this.syncModelOptions(this.current),d!==""&&this.adoptCatalogueSize(d),this.element("body-model-advanced").open=d!==""&&!u.includes(d)});const s=this.element("body-keys");this.keyList=new M({header:s,optional:!0,ids:{list:"body-key",remove:"body-key-delete",add:"body-key-add"},navigation:{scope:this.container,onStep:d=>this.stepKeyframe(d)},onSelect:d=>{d!==""&&this.host.seekTo(Number(d)),this.syncKeyframe(!0)},onAdd:()=>this.keyframeHere(),onRemove:()=>this.deleteKeyframe()}),this.keyList.setLabels({list:e.keyframes,remove:e.deleteKeyframe,add:e.addKeyframe,none:e.noKeyframeHere,previous:e.previousKeyframe,next:e.nextKeyframe}),this.host.modelPicker().enhance(this.select("body-model"),d=>this.modelSourceOf(d),{current:()=>{const d=this.current?.model;return d?.url===void 0?void 0:{url:d.url,title:d.credit?.title??"",author:d.credit?.author??"",license:d.credit?.license??"",source:d.credit?.sourceUrl??""}},apply:d=>{this.input("body-model-url").value=d.url,this.input("body-model-title").value=d.title,this.input("body-model-author").value=d.author,this.input("body-model-license").value=d.license,this.input("body-model-source").value=d.source,this.shownEntry=void 0,this.select("body-model").value="",this.updateCurrent(),this.syncModelOptions(this.current)}});const o=this.select("body-model").nextElementSibling;o&&(o.disabled=!0,o.title=e.modelFixed),this.input("body-model-url").readOnly=!0;const n={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.bodyForm=new v(this.element("body-parameters"),this.language,"body.",n),this.bodyForm.show(h.BODY,new k(()=>this.current,d=>this.editBody(d),()=>({ids:this.bodies.map(d=>d.id),shapes:this.host.shapes().map(d=>({value:d.id,label:d.label}))})),()=>{}),this.keyForm=new v(this.element("body-key-parameters"),this.language,"bodyKey."),this.keyForm.show(h.KEYFRAME,new k(()=>this.keyframeView(),(d,r)=>this.editView(d,b.APPEARANCE_KEYS.includes(r.key)),()=>this.keyframeContext(),this.host.positionPlace?.()),()=>{}),this.sync()}async syncModelOptions(e){const i=++this.catalogueToken,t=await this.host.modelProvider().entries().catch(()=>[]);if(i!==this.catalogueToken)return;const s=this.messages,o=this.select("body-model"),n=e.model.url===void 0?e.model.id:void 0,d=n===void 0||u.includes(n)||t.some(a=>a.id===n),r=[s.primitives,s.catalogue,t.map(a=>`${a.id}:${a.name}`).join(),e.model.url!==void 0,d?"":n].join("|");if(o.dataset.signature!==r){o.dataset.signature=r;const a=document.createElement("optgroup");a.label=s.primitives,a.append(...u.map(c=>new Option(s.primitive[c],c)));const l=document.createElement("optgroup");l.label=s.catalogue,l.append(...t.map(c=>new Option(c.name,c.id))),o.replaceChildren(a,l),e.model.url!==void 0&&o.prepend(new Option(s.modelAdvanced,"")),d||o.append(new Option(n,n))}o.value=n??"",this.showCatalogueModel(e.model.url===void 0?t.find(a=>a.id===e.model.id):void 0)}showCatalogueModel(e){const i=this.current;if(!i||i.model.url!==void 0){this.shownEntry=void 0,this.element("body-model-catalogue").hidden=!0;return}this.shownEntry=e;const t=this.container.getRootNode().activeElement,s=[["body-model-url",e?.url],["body-model-title",e?.credit.title],["body-model-author",e?.credit.author],["body-model-license",e?.credit.license],["body-model-source",e?.credit.sourceUrl]];for(const[o,n]of s)this.input(o)!==t&&(this.input(o).value=n??"");this.element("body-model-catalogue").hidden=e===void 0,this.element("body-model-incomplete").hidden=!0}updateInterpretationTitle(){const e=this.interpretation??{bodies:[]},i=this.host.said().write(e.title,this.input("body-interpretation-title").value,this.host.writingLanguage());this.write({...e,title:i})}updateCurrent(){const e=this.current;e&&this.write({...this.interpretation,bodies:this.bodies.map(i=>i===e?{...e,model:this.statedModel(e.model)}:i)})}editBody(e){const i=this.current;if(!i)return;const t=structuredClone(i);e(t),this.currentId=t.id,this.write({...this.interpretation,bodies:this.bodies.map(s=>s===i?t:s)})}editView(e,i=!1){const t=this.current,s=this.keyframeView();if(!t||!s)return;const o=this.host.currentTime();e(s);const n=p.keyframeOf(s,o,t.track.find(r=>r.t===o),i),d=[...t.track.filter(r=>r.t!==o),n].sort((r,a)=>r.t-a.t);this.write({...this.interpretation,bodies:this.bodies.map(r=>r===t?{...t,track:d}:r)}),this.syncKeyframe()}async addBody(){if(!this.host.newBodyStart())return;const e=this.messages,i=await this.host.modelProvider().entries().catch(()=>[]),t=document.createElement("select"),s=document.createElement("optgroup");s.label=e.primitives,s.append(...u.map(n=>new Option(e.primitive[n],n)));const o=document.createElement("optgroup");o.label=e.catalogue,o.append(...i.map(n=>new Option(n.name,n.id))),t.append(s,o),this.host.modelPicker().chooseFrom(t,n=>this.modelSourceOf(n),n=>{this.createBody({id:n}),u.includes(n)||this.adoptCatalogueSize(n)},{current:()=>{},apply:n=>this.createBody({url:n.url,credit:n.title!==""&&n.license!==""?{title:n.title,license:n.license,author:n.author||void 0,sourceUrl:n.source||void 0}:void 0})})}createBody(e){const i=this.host.newBodyStart();if(!i)return;const t=new Set(this.bodies.map(d=>d.id));let s=t.size+1;for(;t.has(`body-${s}`);)s++;const o={id:`body-${s}`,explains:i.sourceId!==void 0?[i.sourceId]:void 0,model:e,track:[i.keyframe]};this.currentId=o.id;const n=this.interpretation??{bodies:[]};this.write({...n,bodies:[...this.bodies,o]},!0)}modelSourceOf(e){return u.includes(e)?Promise.resolve({shape:e}):this.host.modelProvider().entry(e).then(i=>i&&{url:i.url,headingOffsetDeg:i.headingOffsetDeg})}async adoptCatalogueSize(e){const t=(await this.host.modelProvider().entry(e).catch(()=>{}))?.sizeM,s=this.current;if(!t||!s||s.model.id!==e)return;if(!s.track.some(n=>n.sizeM)&&s.track.length>0){const[n,...d]=[...s.track].sort((l,c)=>l.t-c.t),r={widthM:t.widthM??1,lengthM:t.lengthM??t.widthM??1,heightM:t.heightM??1},a=[{...n,sizeM:r},...d];this.write({...this.interpretation,bodies:this.bodies.map(l=>l===s?{...s,track:a}:l)},!0);return}const o=s.track.map(n=>{const d=n.sizeM?.widthM,r=t.widthM??d;if(!n.sizeM||d===void 0||r===void 0||d<=0)return n;const a=r/d,l={widthM:t.widthM??n.sizeM.widthM*a,lengthM:t.lengthM??n.sizeM.lengthM*a,heightM:t.heightM??n.sizeM.heightM*a};return n.distanceM!==void 0&&n.azimuthDeg!==void 0?{...n,sizeM:l,distanceM:Number((n.distanceM*a).toFixed(1))}:{...n,sizeM:l}});this.write({...this.interpretation,bodies:this.bodies.map(n=>n===s?{...s,track:o}:n)},!0)}keyframeHere(){this.editView(()=>{})}get currentBodyId(){return this.current?.id}resize(e){const i=t=>Number(Math.max(.01,t).toFixed(2));this.editView(t=>Object.assign(t,{widthM:i(e.widthM),lengthM:i(e.lengthM),heightM:i(e.heightM)}))}turnTo(e){const i=t=>((t+180)%360+360)%360-180;this.editView(t=>Object.assign(t,{headingDeg:Number(((e.headingDeg%360+360)%360).toFixed(1)),pitchDeg:Number(Math.max(-90,Math.min(90,e.pitchDeg)).toFixed(1)),rollDeg:Number(i(e.rollDeg).toFixed(1))}))}show(e){!this.bodies.some(i=>i.id===e)||e===this.currentId||(this.currentId=e,this.sync())}readingNow(){const e=this.current;return e&&this.host.readingOf(e,this.host.currentTime())}dragTo(e,i){const t=this.readingNow();if(!t)return;const s=this.host.currentTime(),o=Math.PI/180,n=d=>Number(d.toFixed(2));this.editView(d=>{const r=d,a=r.onGround?this.host.groundAlong(e,i,s):void 0;if(r.mode==="world"){const l=Math.cos(t.altitudeDeg*o),c=t.eastM-Math.sin(t.azimuthDeg*o)*l*t.distanceM,m=t.northM-Math.cos(t.azimuthDeg*o)*l*t.distanceM,y=Math.hypot(t.eastM-c,t.northM-m),g=a!==void 0?a*Math.cos(i*o):y;if(r.eastM=n(c+Math.sin(e*o)*g),r.northM=n(m+Math.cos(e*o)*g),!r.onGround){const f=D=>Math.max(-89,Math.min(89,D))*o;r.aboveGroundM=n(Math.max(0,t.aboveGroundM+g*(Math.tan(f(i))-Math.tan(f(t.altitudeDeg)))))}}else r.azimuthDeg=n((e%360+360)%360),r.elevationDeg=n(Math.max(-90,Math.min(90,i))),a!==void 0&&(r.distanceM=n(a))})}scaleDistance(e){const i=this.readingNow();if(!i)return;const t=s=>Number(s.toFixed(2));this.editView(s=>{const o=s;if(o.mode==="world"){const n=Math.PI/180,d=Math.cos(i.altitudeDeg*n),r=i.eastM-Math.sin(i.azimuthDeg*n)*d*i.distanceM,a=i.northM-Math.cos(i.azimuthDeg*n)*d*i.distanceM;o.eastM=t(r+(i.eastM-r)*e),o.northM=t(a+(i.northM-a)*e)}else o.distanceM=t(Math.max(.1,i.distanceM*e))})}deleteKeyframe(){const e=this.current;if(!e)return;const i=this.host.currentTime(),t=e.track.filter(s=>s.t!==i);t.length!==e.track.length&&this.write({...this.interpretation,bodies:this.bodies.map(s=>s===e?{...e,track:t}:s)},!0)}static seconds(e){return`${Math.round(e/100)/10} s`}deleteCurrent(){const e=this.current;e&&(this.currentId=void 0,this.write({...this.interpretation,bodies:this.bodies.filter(i=>i!==e)},!0))}statedModel(e){const i=this.stringOrUndefined(this.input("body-model-url").value),t=this.shownEntry,s=n=>this.stringOrUndefined(this.input(n).value);if(t&&i===t.url&&s("body-model-title")===t.credit.title&&s("body-model-author")===t.credit.author&&s("body-model-license")===t.credit.license&&s("body-model-source")===t.credit.sourceUrl)return{id:t.id};if(i){const n=this.stringOrUndefined(this.input("body-model-title").value),d=this.stringOrUndefined(this.input("body-model-license").value);return{url:i,headingOffsetDeg:e.url!==void 0?e.headingOffsetDeg:void 0,credit:n!==void 0&&d!==void 0?{title:n,license:d,author:this.stringOrUndefined(this.input("body-model-author").value),sourceUrl:this.stringOrUndefined(this.input("body-model-source").value)}:void 0}}return{id:this.stringOrUndefined(this.select("body-model").value)??e.id??"ellipsoid"}}write(e,i=!1){const t=e.bodies.length===0&&e.title===void 0&&e.smoke===void 0&&e.flares===void 0&&e.lanterns===void 0;if(this.host.sighting().interpretation=t?void 0:e,this.host.changed(),i){this.sync();return}this.list?.setItems(this.bodies.map(o=>({id:o.id,label:this.labelOf(o)})),this.currentId);const s=this.current;s&&(this.element("body-model-incomplete").hidden=s.model.url===void 0||s.model.credit!==void 0,this.syncModelOptions(s))}labelOf(e){const i=this.host.said().read(e.title);return i?`${i} (${e.id})`:e.id}get interpretation(){return this.host.sighting().interpretation}get bodies(){return this.interpretation?.bodies??[]}get current(){return this.bodies.find(e=>e.id===this.currentId)}stringOrUndefined(e){const i=e.trim();return i===""?void 0:i}list;keyList;element(e){return this.container.querySelector("#"+e)}input(e){return this.element(e)}select(e){return this.element(e)}}export{b as BodyEditor};
@@ -1 +0,0 @@
1
- const e={intro:"What the witness said the phenomenon was, in 3D: each body stands for one or more of the shapes drawn. Its movement comes from the file.",interpretationTitle:"Interpretation title",body:"Body",none:"No body yet: the witness said nothing of what it was, or it is still to be entered",deleteBody:"Delete body",addBody:"Add a body",addBodyHintView:"Where the witness is looking now",lookAtBody:"Look at it",addBodyHint:'Standing for the shape "{shape}", where the scene draws it now',model:"3D model",primitives:"Built-in shapes",catalogue:"Catalogue",modelAdvanced:"Model from an address",modelUrl:"glTF/GLB address",modelUrlHint:"Absolute, or relative to this sighting.json",modelTitle:"Model name",modelAuthor:"Author",modelLicense:"Licence",modelSource:"Where it came from",modelIncomplete:"Not drawn until the model's name and licence are given",modelFromCatalogue:"From the catalogue, which the recording names it by. Change a field and it becomes this recording's own address.",keyframes:"Keyframes",addKeyframe:"Add a keyframe at this instant",noKeyframeHere:"No keyframe at this instant",previousKeyframe:"Previous keyframe",nextKeyframe:"Next keyframe",atPlayhead:"At {t}",modelFixed:"The model is chosen when the body is added: for another one, delete this body and add one with it",keyframeHere:"A keyframe stands here: editing changes it",keyframeAdded:"Editing adds a keyframe here",appearanceNote:"The colour and the albedo paint the built-in shapes; a model of its own keeps its materials. Light of its own is what it gives out, lit or not.",deleteKeyframe:"Delete this keyframe",pictureHint:"On the picture: drag the body to move it, the wheel takes it nearer or further, the corners and sides size it, the stem turns it (with Shift: up and down pitches it, sideways rolls it).",notPlaced:"Not in the scene at this instant",primitive:{ellipsoid:"Ellipsoid",sphere:"Sphere",disc:"Disc",cylinder:"Cylinder",cone:"Cone",box:"Box",torus:"Torus",figure:"Human figure"}};export{e as bodyEditorMessages_en};
@@ -1 +0,0 @@
1
- const e={intro:"Lo que el testigo dijo que era el fenómeno, en 3D: cada cuerpo representa una o varias de las formas dibujadas. Su movimiento viene del archivo.",interpretationTitle:"Título de la interpretación",body:"Cuerpo",none:"Aún no hay ningún cuerpo: el testigo no dijo nada de lo que era, o falta introducirlo",deleteBody:"Eliminar el cuerpo",addBody:"Añadir un cuerpo",addBodyHintView:"Donde mira el testigo en este momento",lookAtBody:"Mirarlo",addBodyHint:"Representando la forma «{shape}», donde la escena la dibuja en este momento",model:"Modelo 3D",primitives:"Formas básicas",catalogue:"Catálogo",modelAdvanced:"Modelo desde una dirección",modelUrl:"Dirección glTF/GLB",modelUrlHint:"Absoluta, o relativa a este sighting.json",modelTitle:"Nombre del modelo",modelAuthor:"Autor",modelLicense:"Licencia",modelSource:"Procedencia",modelIncomplete:"No se dibuja mientras falten el nombre y la licencia del modelo",modelFromCatalogue:"Del catálogo, por el que la grabación lo nombra. Cambia un campo y pasa a ser la dirección propia de esta grabación.",keyframes:"Fotogramas clave",addKeyframe:"Añadir un fotograma clave en este instante",noKeyframeHere:"Ningún fotograma clave en este instante",previousKeyframe:"Fotograma clave anterior",nextKeyframe:"Fotograma clave siguiente",atPlayhead:"En {t}",modelFixed:"El modelo se elige al añadir el cuerpo: para cambiarlo, elimine este cuerpo y añada otro con el nuevo modelo",keyframeHere:"Aquí hay un fotograma clave: editar lo modifica",keyframeAdded:"Editar añade aquí un fotograma clave",appearanceNote:"El color y el albedo pintan las formas básicas; un modelo propio conserva sus materiales. La luz propia es la que emite, esté iluminado o no.",deleteKeyframe:"Eliminar este fotograma clave",pictureHint:"En la imagen: arrastrar el cuerpo lo desplaza, la rueda lo acerca o lo aleja, las esquinas y los lados lo dimensionan, el vástago lo gira (con Mayús: arriba y abajo lo cabecean, los lados lo hacen alabear).",notPlaced:"No está en la escena en este instante",primitive:{ellipsoid:"Elipsoide",sphere:"Esfera",disc:"Disco",cylinder:"Cilindro",cone:"Cono",box:"Caja",torus:"Toro",figure:"Silueta humana"}};export{e as bodyEditorMessages_es};
@@ -1 +0,0 @@
1
- const e={intro:"Ce que le témoin a dit que le phénomène était, en 3D : chaque corps représente une ou plusieurs des formes dessinées. Son mouvement vient du fichier.",interpretationTitle:"Titre de l'interprétation",body:"Corps",none:"Aucun corps pour l'instant : le témoin n'a rien dit de ce que c'était, ou c'est encore à saisir",deleteBody:"Supprimer le corps",addBody:"Ajouter un corps",addBodyHintView:"Là où le témoin regarde à cet instant",lookAtBody:"Le regarder",addBodyHint:"Représentant la forme « {shape} », là où la scène la dessine à cet instant",model:"Modèle 3D",primitives:"Formes de base",catalogue:"Catalogue",modelAdvanced:"Modèle depuis une adresse",modelUrl:"Adresse glTF/GLB",modelUrlHint:"Absolue, ou relative à ce sighting.json",modelTitle:"Nom du modèle",modelAuthor:"Auteur",modelLicense:"Licence",modelSource:"Provenance",modelIncomplete:"Pas dessiné tant que le nom et la licence du modèle manquent",modelFromCatalogue:"Du catalogue, par lequel l'enregistrement le nomme. Modifiez un champ et il devient l'adresse propre à cet enregistrement.",keyframes:"Images clés",addKeyframe:"Ajouter une image clé à cet instant",noKeyframeHere:"Aucune image clé à cet instant",previousKeyframe:"Image clé précédente",nextKeyframe:"Image clé suivante",atPlayhead:"À {t}",modelFixed:"Le modèle se choisit à l'ajout du corps : pour en changer, supprimez ce corps et ajoutez-en un avec l'autre modèle",keyframeHere:"Une image clé est ici : l'éditer la modifie",keyframeAdded:"Éditer ajoute une image clé ici",appearanceNote:"La couleur et l'albédo peignent les formes de base ; un modèle garde ses propres matériaux. La lumière propre est ce qu'il émet, éclairé ou non.",deleteKeyframe:"Supprimer cette image clé",pictureHint:"Sur l'image : glisser le corps le déplace, la molette le rapproche ou l'éloigne, les coins et les côtés le dimensionnent, la tige le tourne (avec Maj : haut et bas le cabrent, les côtés le font rouler).",notPlaced:"Pas dans la scène à cet instant",primitive:{ellipsoid:"Ellipsoïde",sphere:"Sphère",disc:"Disque",cylinder:"Cylindre",cone:"Cône",box:"Boîte",torus:"Tore",figure:"Silhouette humaine"}};export{e as bodyEditorMessages_fr};
@@ -1 +0,0 @@
1
- const e={intro:"Ciò che il testimone ha detto che era il fenomeno, in 3D: ogni corpo rappresenta una o più delle forme disegnate. Il suo movimento viene dal file.",interpretationTitle:"Titolo dell'interpretazione",body:"Corpo",none:"Ancora nessun corpo: il testimone non ha detto nulla di ciò che era, o è ancora da inserire",deleteBody:"Elimina il corpo",addBody:"Aggiungi un corpo",addBodyHintView:"Dove guarda il testimone in questo momento",lookAtBody:"Guardalo",addBodyHint:"In rappresentanza della forma «{shape}», dove la scena la disegna in questo momento",model:"Modello 3D",primitives:"Forme di base",catalogue:"Catalogo",modelAdvanced:"Modello da un indirizzo",modelUrl:"Indirizzo glTF/GLB",modelUrlHint:"Assoluto, o relativo a questo sighting.json",modelTitle:"Nome del modello",modelAuthor:"Autore",modelLicense:"Licenza",modelSource:"Provenienza",modelIncomplete:"Non disegnato finché mancano il nome e la licenza del modello",modelFromCatalogue:"Dal catalogo, con cui la registrazione lo nomina. Modifica un campo e diventa l'indirizzo proprio di questa registrazione.",keyframes:"Fotogrammi chiave",addKeyframe:"Aggiungi un fotogramma chiave a questo istante",noKeyframeHere:"Nessun fotogramma chiave a questo istante",previousKeyframe:"Fotogramma chiave precedente",nextKeyframe:"Fotogramma chiave successivo",atPlayhead:"A {t}",modelFixed:"Il modello si sceglie quando si aggiunge il corpo: per cambiarlo, elimina questo corpo e aggiungine uno con l'altro modello",keyframeHere:"Qui c'è un fotogramma chiave: modificarlo lo cambia",keyframeAdded:"Modificare aggiunge qui un fotogramma chiave",appearanceNote:"Il colore e l'albedo dipingono le forme di base; un modello proprio conserva i suoi materiali. La luce propria è quella che emette, illuminato o no.",deleteKeyframe:"Elimina questo fotogramma chiave",pictureHint:"Sull'immagine: trascinare il corpo lo sposta, la rotellina lo avvicina o lo allontana, gli angoli e i lati lo dimensionano, lo stelo lo ruota (con Maiusc: su e giù lo fanno beccheggiare, i lati lo fanno rollare).",notPlaced:"Non è nella scena in questo istante",primitive:{ellipsoid:"Ellissoide",sphere:"Sfera",disc:"Disco",cylinder:"Cilindro",cone:"Cono",box:"Scatola",torus:"Toro",figure:"Sagoma umana"}};export{e as bodyEditorMessages_it};
@@ -1,9 +0,0 @@
1
- import{x as o,y as u,U as h,z as c,v as m,w as p,u as f,C as g}from"./rr0-sighting-editor.mjs";import{lanternEditorMessages_en as r}from"./LanternEditorMessages_en-DaT3UNfD.js";class n{static RELEASE={en:"Let go",fr:"Lâcher",es:"Suelta",it:"Lancio"};static LANTERNS={en:"Lanterns",fr:"Lanternes",es:"Farolillos",it:"Lanterne"};static AIR={en:"Air",fr:"Air",es:"Aire",it:"Aria"};static LANTERN={en:"Each lantern",fr:"Chaque lanterne",es:"Cada farolillo",it:"Ogni lanterna"};static instant(e,t,a){return{type:"number",key:e,min:-36e3,max:36e3,step:1,unit:"s",scale:.001,required:!0,label:t,hint:a,group:n.LANTERNS}}static wind(e,t,a){return[{type:"number",key:`${e}.towardDeg`,min:0,max:360,step:1,unit:"°",group:n.AIR,hint:a,label:{en:`${t.en}, towards`,fr:`${t.fr}, vers`,es:`${t.es}, hacia`,it:`${t.it}, verso`}},{type:"number",key:`${e}.speedMS`,min:0,max:60,step:.1,unit:"m/s",group:n.AIR,label:{en:`${t.en}, speed`,fr:`${t.fr}, vitesse`,es:`${t.es}, velocidad`,it:`${t.it}, velocità`}}]}static SET={kind:"lantern",title:{en:"Sky lanterns",fr:"Lanternes célestes",es:"Farolillos voladores",it:"Lanterne volanti"},parameters:[{type:"said",key:"title",label:{en:"Name",fr:"Nom",es:"Nombre",it:"Nome"},group:n.RELEASE},{type:"position",key:"site.eastM",secondKey:"site.northM",saidKey:"site.saidPosition",native:"local",step:1,rangeM:1e5,group:n.RELEASE,label:{en:"Where they are let go",fr:"Lieu du lâcher",es:"Lugar de la suelta",it:"Luogo del rilascio"},hint:{en:"Where they are let go: from the witness, from something else in the scene, or as a latitude and a longitude.",fr:"D'où elles sont lâchées : par rapport au témoin, à autre chose dans la scène, ou en latitude et longitude.",es:"Desde dónde se sueltan: respecto al testigo, a otra cosa de la escena, o en latitud y longitud.",it:"Da dove vengono lasciate andare: rispetto al testimone, a qualcos'altro nella scena, o in latitudine e longitudine."}},{type:"number",key:"site.altitudeM",min:-1e3,max:5e3,step:.1,unit:"m",group:n.RELEASE,effective:()=>0,label:{en:"Height above the place's ground",fr:"Hauteur au-dessus du sol du lieu",es:"Altura sobre el suelo del lugar",it:"Altezza sul suolo del luogo"},hint:{en:"A garden on a hill above the place, a roof.",fr:"Un jardin sur une colline au-dessus du lieu, un toit.",es:"Un jardín en una colina sobre el lugar, un tejado.",it:"Un giardino su una collina sopra il luogo, un tetto."}},{type:"number",key:"site.originElevationM",min:-500,max:6e3,step:1,unit:"m",group:n.RELEASE,effective:()=>0,label:{en:"The place's ground above the sea",fr:"Sol du lieu au-dessus de la mer",es:"Suelo del lugar sobre el mar",it:"Suolo del luogo sul mare"},hint:{en:"What sets how thin the air they climb into is: a lantern climbs less high from a mountain town.",fr:"Ce qui règle la raréfaction de l'air où elles montent : une lanterne monte moins haut depuis une ville de montagne.",es:"Lo que fija lo enrarecido del aire en que suben: un farolillo sube menos desde un pueblo de montaña.",it:"Ciò che fissa la rarefazione dell'aria in cui salgono: una lanterna sale meno in alto da un paese di montagna."}},{type:"number",key:"group.count",min:1,max:200,step:1,required:!0,group:n.LANTERNS,label:{en:"How many",fr:"Combien",es:"Cuántos",it:"Quante"}},n.instant("group.fromT",{en:"First let go at",fr:"Première lâchée à",es:"Primero soltado a",it:"Prima lasciata a"},{en:"Seconds of the recording: before its start (negative) for lanterns already up when it begins.",fr:"Secondes de l'enregistrement : avant son début (négatif) pour des lanternes déjà en l'air quand il commence.",es:"Segundos de la grabación: antes de su inicio (negativo) para farolillos ya en el aire cuando empieza.",it:"Secondi della registrazione: prima del suo inizio (negativo) per lanterne già in aria quando inizia."}),n.instant("group.untilT",{en:"Last let go at",fr:"Dernière lâchée à",es:"Último soltado a",it:"Ultima lasciata a"},{en:"Seconds of the recording; the others in between, about evenly.",fr:"Secondes de l'enregistrement ; les autres entre les deux, à peu près régulièrement.",es:"Segundos de la grabación; los demás entre ambos, más o menos regularmente.",it:"Secondi della registrazione; le altre in mezzo, più o meno regolarmente."}),{type:"number",key:"group.radiusM",min:0,max:5e3,step:1,unit:"m",group:n.LANTERNS,effective:()=>20,label:{en:"Let go within",fr:"Lâchées dans un rayon de",es:"Soltados en un radio de",it:"Lasciate entro"},hint:{en:"A crowd lets them go a few metres apart.",fr:"Une foule les lâche à quelques mètres les unes des autres.",es:"Una multitud los suelta a pocos metros unos de otros.",it:"Una folla le lascia andare a pochi metri l'una dall'altra."}},{type:"number",key:"group.burnS.min",min:10,max:3600,step:1,unit:"s",group:n.LANTERNS,effective:()=>480,label:{en:"Burns at least",fr:"Brûle au moins",es:"Arde al menos",it:"Brucia almeno"},hint:{en:"How long each burns from when it is let go, drawn between the two: 8 to 15 minutes by the sellers. It vanishes when it goes out.",fr:"Combien de temps chacune brûle après son lâcher, tiré entre les deux : 8 à 15 minutes selon les vendeurs. Elle disparaît en s'éteignant.",es:"Cuánto arde cada uno desde que se suelta, sorteado entre ambos: de 8 a 15 minutos según los vendedores. Desaparece al apagarse.",it:"Quanto brucia ciascuna da quando è lasciata andare, estratto tra i due: da 8 a 15 minuti secondo i venditori. Scompare spegnendosi."}},{type:"number",key:"group.burnS.max",min:10,max:3600,step:1,unit:"s",group:n.LANTERNS,effective:()=>900,label:{en:"Burns at most",fr:"Brûle au plus",es:"Arde como mucho",it:"Brucia al massimo"}},{type:"number",key:"group.insideExcessK.min",min:10,max:400,step:1,unit:"K",group:n.LANTERNS,effective:()=>125,label:{en:"Hotter than the air, at least",fr:"Plus chaude que l'air, au moins",es:"Más caliente que el aire, al menos",it:"Più calda dell'aria, almeno"},hint:{en:"How much hotter than the air its air is at full burn, drawn between the two: what sets how fast it climbs, and so how high it gets.",fr:"De combien son air est plus chaud que l'air autour à plein feu, tiré entre les deux : ce qui règle à quelle vitesse elle monte, et donc jusqu'où.",es:"Cuánto más caliente que el aire está su aire a pleno fuego, sorteado entre ambos: lo que fija lo rápido que sube, y por tanto hasta dónde.",it:"Di quanto la sua aria è più calda dell'aria intorno a piena fiamma, estratto tra i due: ciò che fissa quanto in fretta sale, e quindi fin dove."}},{type:"number",key:"group.insideExcessK.max",min:10,max:400,step:1,unit:"K",group:n.LANTERNS,effective:()=>175,label:{en:"Hotter than the air, at most",fr:"Plus chaude que l'air, au plus",es:"Más caliente que el aire, como mucho",it:"Più calda dell'aria, al massimo"}},{type:"number",key:"group.burnedS",min:0,max:3600,step:1,unit:"s",group:n.LANTERNS,effective:()=>0,label:{en:"Already burnt when let go",fr:"Déjà brûlé au lâcher",es:"Ya ardido al soltarlo",it:"Già bruciato al lancio"},hint:{en:"For lanterns the account only has from where they were first seen, already up and partly burnt.",fr:"Pour des lanternes que le compte rendu n'a que depuis là où elles ont été vues la première fois, déjà en l'air et en partie consumées.",es:"Para farolillos que el relato solo tiene desde donde se vieron por primera vez, ya en el aire y en parte consumidos.",it:"Per lanterne che il resoconto ha solo da dove sono state viste la prima volta, già in aria e in parte consumate."}},{type:"number",key:"group.seed",min:0,max:4294967295,step:1,group:n.LANTERNS,effective:()=>1,label:{en:"Draw",fr:"Tirage",es:"Sorteo",it:"Estrazione"},hint:{en:"What the draws start from: another number, other lanterns within the same bounds, the same each time for the same number.",fr:"Ce dont partent les tirages : un autre nombre, d'autres lanternes dans les mêmes bornes, les mêmes à chaque fois pour le même nombre.",es:"De qué parten los sorteos: otro número, otros farolillos dentro de los mismos límites, los mismos cada vez para el mismo número.",it:"Da cosa partono le estrazioni: un altro numero, altre lanterne negli stessi limiti, le stesse ogni volta per lo stesso numero."}},{type:"set",key:"group.explains",group:n.LANTERNS,label:{en:"Stand for the shapes",fr:"Représentent les formes",es:"Representan las formas",it:"Rappresentano le forme"},options:(e,t)=>{const a=t?.shapes??[],i=(e.group?.explains??[]).filter(s=>!a.some(l=>l.value===s));return[...a,...i.map(s=>({value:s,label:s}))]},empty:{en:"No shape",fr:"Aucune forme",es:"Ninguna forma",it:"Nessuna forma"}},...n.wind("wind",{en:"Wind at the ground",fr:"Vent au sol",es:"Viento en el suelo",it:"Vento al suolo"},{en:"Where it blows TOWARDS, which is where the lanterns go: the opposite of where a weather report says it comes from.",fr:"Là où il souffle, VERS où, qui est où vont les lanternes : l'inverse d'où un bulletin météo dit qu'il vient.",es:"Hacia DÓNDE sopla, que es adonde van los farolillos: lo contrario de donde un parte dice que viene.",it:"VERSO dove soffia, che è dove vanno le lanterne: l'opposto di da dove un bollettino dice che viene."}),...n.wind("windAloft",{en:"Wind aloft",fr:"Vent en altitude",es:"Viento en altura",it:"Vento in quota"},{en:"The wind higher up, blended with the ground's in between: what makes lanterns let go at one spot part ways as they climb.",fr:"Le vent plus haut, mêlé à celui du sol entre les deux : ce qui fait se séparer en montant des lanternes lâchées au même endroit.",es:"El viento más arriba, mezclado con el del suelo en medio: lo que separa al subir farolillos soltados en el mismo sitio.",it:"Il vento più in alto, mescolato a quello al suolo nel mezzo: ciò che separa salendo lanterne lasciate andare nello stesso punto."}),{type:"number",key:"windAloft.atM",min:10,max:1e4,step:10,unit:"m",group:n.AIR,label:{en:"Wind aloft, at",fr:"Vent en altitude, à",es:"Viento en altura, a",it:"Vento in quota, a"},hint:{en:"Metres above where they are let go.",fr:"Mètres au-dessus d'où elles sont lâchées.",es:"Metros sobre donde se sueltan.",it:"Metri sopra dove vengono lasciate andare."}},{type:"number",key:"airTemperatureC",min:-60,max:50,step:.5,unit:"°C",group:n.AIR,effective:()=>10,label:{en:"Air temperature",fr:"Température de l'air",es:"Temperatura del aire",it:"Temperatura dell'aria"},hint:{en:"At the ground, falling by 6.5 °C a kilometre above: what their hot air is lighter than. A cold night lifts them higher.",fr:"Au sol, baissant de 6,5 °C par kilomètre au-dessus : ce dont leur air chaud est plus léger. Une nuit froide les porte plus haut.",es:"En el suelo, bajando 6,5 °C por kilómetro: de lo que su aire caliente es más ligero. Una noche fría los sube más.",it:"Al suolo, calando di 6,5 °C per chilometro: ciò di cui la loro aria calda è più leggera. Una notte fredda le porta più in alto."}},{type:"number",key:"turbulence.horizontalMS",min:0,max:10,step:.1,unit:"m/s",group:n.AIR,effective:()=>o.TURBULENCE.horizontalMS,label:{en:"Gusts, across",fr:"Rafales, à l'horizontale",es:"Ráfagas, en horizontal",it:"Raffiche, in orizzontale"},hint:{en:"How far the air's speed strays from the wind's, each lantern meeting its own gusts: what stretches a group into a shifting string. 0 for a still air.",fr:"De combien la vitesse de l'air s'écarte de celle du vent, chaque lanterne prise dans ses propres rafales : ce qui étire un groupe en une file mouvante. 0 pour un air immobile.",es:"Cuánto se aparta la velocidad del aire de la del viento, cada farolillo en sus propias ráfagas: lo que estira un grupo en una fila cambiante. 0 para un aire quieto.",it:"Di quanto la velocità dell'aria si scosta da quella del vento, ogni lanterna nelle proprie raffiche: ciò che allunga un gruppo in una fila mutevole. 0 per un'aria ferma."}},{type:"number",key:"turbulence.verticalMS",min:0,max:10,step:.1,unit:"m/s",group:n.AIR,effective:()=>o.TURBULENCE.verticalMS,label:{en:"Gusts, up and down",fr:"Rafales, de haut en bas",es:"Ráfagas, arriba y abajo",it:"Raffiche, in su e in giù"}},{type:"number",key:"turbulence.timescaleS",min:1,max:600,step:1,unit:"s",group:n.AIR,effective:()=>o.TURBULENCE.timescaleS,label:{en:"A gust lasts",fr:"Une rafale dure",es:"Una ráfaga dura",it:"Una raffica dura"}},{type:"number",key:"lantern.luminousIntensityCd",min:.1,max:1e3,step:.1,unit:"cd",group:n.LANTERN,effective:()=>o.COMMON.luminousIntensityCd,label:{en:"Light",fr:"Lumière",es:"Luz",it:"Luce"},hint:{en:"Its flame's light through the paper, at full burn.",fr:"La lumière de sa flamme à travers le papier, à plein feu.",es:"La luz de su llama a través del papel, a pleno fuego.",it:"La luce della sua fiamma attraverso la carta, a piena fiamma."}},{type:"choice",key:"lantern.shape",group:n.LANTERN,effective:()=>o.COMMON.shape,label:{en:"Shape",fr:"Forme",es:"Forma",it:"Forma"},choices:[{value:"classic",label:{en:"Round at the mouth, square at the top",fr:"Ronde à la base, carrée au sommet",es:"Redonda en la base, cuadrada arriba",it:"Rotonda alla base, quadrata in cima"}},{value:"balloon",label:{en:"Balloon, lobed top",fr:"Montgolfière, sommet en lobes",es:"Globo, cima lobulada",it:"Mongolfiera, cima a lobi"}}]},{type:"colour",key:"lantern.paperColor",group:n.LANTERN,fallback:o.COMMON.paperColor,label:{en:"Paper colour",fr:"Couleur du papier",es:"Color del papel",it:"Colore della carta"},hint:{en:"What it looks like by day; by night, what its flame's light comes through.",fr:"Son aspect de jour ; de nuit, ce que traverse la lumière de sa flamme.",es:"Su aspecto de día; de noche, lo que atraviesa la luz de su llama.",it:"Il suo aspetto di giorno; di notte, ciò che attraversa la luce della sua fiamma."}},{type:"colour",key:"lantern.color",group:n.LANTERN,fallback:o.COMMON.color,label:{en:"Flame light",fr:"Lumière de la flamme",es:"Luz de la llama",it:"Luce della fiamma"},hint:{en:"Its flame's light through white paper.",fr:"La lumière de sa flamme à travers un papier blanc.",es:"La luz de su llama a través de un papel blanco.",it:"La luce della sua fiamma attraverso una carta bianca."}},{type:"number",key:"lantern.envelopeVolumeM3",min:.01,max:10,step:.01,unit:"m³",group:n.LANTERN,effective:()=>o.COMMON.envelopeVolumeM3,label:{en:"Air it holds",fr:"Air qu'elle contient",es:"Aire que contiene",it:"Aria che contiene"}},{type:"number",key:"lantern.massKg",min:.005,max:5,step:.001,unit:"kg",group:n.LANTERN,effective:()=>o.COMMON.massKg,label:{en:"Weight when let go",fr:"Poids au lâcher",es:"Peso al soltarlo",it:"Peso al lancio"}}]};static publish(){u.publish(n.SET)}}class w{constructor(e,t,a){this.container=e,this.host=t,this.language=a,u.of("lantern")||n.publish(),this.render(),this.setLanguage(a)}messages=r;languageToken=0;currentId;form;list;language;shown=[];async setLanguage(e){const t=++this.languageToken;this.language=e;const a=h.includes(e)?e:"en",i=a==="en"?r:await c(a);t===this.languageToken&&(this.messages=i,this.render(),this.sync())}sync(){const e=this.launches;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("lantern-fields").hidden=t===void 0,!t)return;const a=t.releases?.length??0,i=this.element("lantern-releases");i.hidden=a===0,i.textContent=this.messages.releasesNote.replace("{n}",String(a)),this.form??=new m(this.element("lantern-parameters"),this.language,"lantern.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(n.SET,new p(()=>this.current,s=>this.editLaunch(l=>s(l)),()=>({shapes:this.host.shapes().map(s=>({value:s.id,label:s.label}))}),this.host.positionPlace?.()),()=>this.written())}refresh(){this.syncAddState();const e=this.launches;e.length===this.shown.length&&e.every((t,a)=>t.id===this.shown[a].id)||this.sync()}syncAddState(){const e=this.siteOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}render(){const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
2
- <p class="launch-intro">${e.intro}</p>
3
- <div id="lantern-list"></div>
4
- <div id="lantern-fields" class="launch-fields">
5
- <div id="lantern-parameters" class="launch-parameters"></div>
6
- <p id="lantern-releases" class="launch-intro" hidden></p>
7
- <p class="launch-intro">${e.derivedNote}</p>
8
- </div>
9
- </div>`,this.list=new f({header:this.element("lantern-list"),body:this.element("lantern-fields"),ids:{list:"lantern-select",remove:"lantern-delete",add:"lantern-add"},onSelect:t=>{this.currentId=t,this.sync()},onAdd:()=>this.addLaunch(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.launch,remove:e.deleteLaunch,add:e.addLaunch,empty:e.none})}written(){const e=this.current;e&&this.list?.rename(e.id,this.labelOf(e))}editLaunch(e){const t=this.current;if(!t)return;const a=structuredClone(t);e(a),this.writeLaunches(this.launches.map(i=>i===t?a:i)),this.host.changed()}siteOfNew(){const e=this.host.sighting(),t=e.event?.place?.[0];if(t?.lat===void 0||t.lng===void 0)return;const a=e.observerTrack?.getInterpolatedPoseAt(0),i=(a?.headingDeg??0)*Math.PI/180,s=111320,l=a?.lng!==void 0?(a.lng-t.lng)*s*Math.cos(t.lat*Math.PI/180):0,d=a?.lat!==void 0?(a.lat-t.lat)*s:0;return{eastM:Math.round(l+1500*Math.sin(i)),northM:Math.round(d+1500*Math.cos(i))}}addLaunch(){const e=this.siteOfNew();if(!e)return;let t=this.launches.length+1;for(;this.launches.some(s=>s.id===`lanterns-${t}`);)t++;const a=g(this.host.sighting(),0),i={id:`lanterns-${t}`,site:e,group:{count:12,fromT:0,untilT:12e4,seed:t},wind:{towardDeg:Math.round((a.windDirectionDeg+180)%360),speedMS:Math.round(a.windSpeed*10)/10}};this.writeLaunches([...this.launches,i]),this.currentId=i.id,this.host.changed(),this.sync()}deleteCurrent(){const e=this.current;e&&(this.currentId=void 0,this.writeLaunches(this.launches.filter(t=>t!==e)),this.host.changed(),this.sync())}writeLaunches(e){const t=this.host.sighting(),a={...t.interpretation??{bodies:[]},lanterns:e.length>0?e:void 0};a.lanterns===void 0&&delete a.lanterns;const i=a.bodies.length===0&&a.title===void 0&&a.smoke===void 0&&a.flares===void 0&&a.lanterns===void 0;t.interpretation=i?void 0:a}labelOf(e){const t=this.host.said().read(e.title);return t?`${t} (${e.id})`:e.id}get launches(){return this.host.sighting().interpretation?.lanterns??[]}element(e){return this.container.querySelector(`#${e}`)}}export{w as LanternEditor};
@@ -1 +0,0 @@
1
- import{R as g,K as T,N as y}from"./rr0-sighting-editor.mjs";class s{static DEFAULT_DIVERGENCE_MRAD=.1;static DEFAULT_APERTURE_M=.01;static AEROSOL_SINGLE_SCATTERING_ALBEDO=.9;static AEROSOL_ASYMMETRY=.7;static STEP_M=25;static MAX_SAMPLES=2e3;static viewsAt(t,c,n,e){return s.onAt(t,c).map(o=>({id:o.id,wavelengthNm:o.wavelengthNm,samples:s.samplesOf(o,n,e)}))}static onAt(t,c){return t.filter(n=>n.path.length>=2&&(n.fromT===void 0||c>=n.fromT)&&(n.untilT===void 0||c<=n.untilT))}static samplesOf(t,c,n){const e=g.ecef({lat:c.lat,lng:c.lng,heightM:0}),o=c.lat*Math.PI/180,M=c.lng*Math.PI/180,u=a=>{const l=a[0]-e[0],r=a[1]-e[1],i=a[2]-e[2];return[-Math.sin(M)*l+Math.cos(M)*r,-Math.sin(o)*Math.cos(M)*l-Math.sin(o)*Math.sin(M)*r+Math.cos(o)*i,Math.cos(o)*Math.cos(M)*l+Math.cos(o)*Math.sin(M)*r+Math.sin(o)*i]},x=(t.divergenceMrad??s.DEFAULT_DIVERGENCE_MRAD)/1e3,N=t.apertureM??s.DEFAULT_APERTURE_M,p=[];let A=0,O=t.powerW,D=0;for(let a=0;a+1<t.path.length;a++){const l=t.path[a],r=t.path[a+1],i=g.ecef({lat:l.lat,lng:l.lng,heightM:l.altitudeM}),E=g.ecef({lat:r.lat,lng:r.lng,heightM:r.altitudeM}),f=Math.hypot(E[0]-i[0],E[1]-i[1],E[2]-i[2]),S=Math.max(1,Math.min(s.MAX_SAMPLES,Math.ceil(f/s.STEP_M)));for(let d=a===0?0:1;d<=S;d++){const P=d/S,w=[0,1,2].map(h=>i[h]+(E[h]-i[h])*P),R=P*f,I=l.altitudeM+(r.altitudeM-l.altitudeM)*P+s.bulgeM(R,f);if(d>0){const h=p[p.length-1],v=R+A-h.fromSourceM,C=s.extinctionAt(n,t.wavelengthNm,(h.altitudeM+I)/2);D+=C*v,O=t.powerW*Math.exp(-D)}const[_,G,U]=u(w);p.push({eastM:_,northM:G,upM:U,altitudeM:I,fromSourceM:A+R,widthM:N+x*(A+R),powerW:O})}A+=f}return p}static bulgeM(t,c){return t*(c-t)/(2*6371e3)}static extinctionAt(t,c,n){const{rayleighPerM:e,aerosolPerM:o}=s.coefficientsAt(t,c,n);return e+o}static coefficientsAt(t,c,n){const e=T.rayleighAt(c)*T.rayleighDensity(n),o=t.aerosol[1]*(c/550)**-1.3*T.aerosolDensity(n);return{rayleighPerM:e,aerosolPerM:o}}static phasedScattering(t,c){const n=3/(16*Math.PI)*(1+c*c),e=s.AEROSOL_ASYMMETRY,o=(1-e*e)/(4*Math.PI*(1+e*e-2*e*c)**1.5);return t.rayleighPerM*n+t.aerosolPerM*s.AEROSOL_SINGLE_SCATTERING_ALBEDO*o}static efficacy(t){return 683*Math.max(0,y.colourMatching(t)[1])}static colourOf(t){const[c,n,e]=y.colourMatching(t);if(n<=0)return[0,0,0];const o=y.linearSrgbOf([c/n,1,e/n]).map(u=>Math.max(0,u)),M=.2126*o[0]+.7152*o[1]+.0722*o[2];return o.map(u=>u/M)}static luminanceCdM2(t,c,n,e,o){return s.efficacy(c)*t*n/(e*Math.max(o,.001))}}export{s as L};