@rr0/ufoathome 0.188.0 → 0.189.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 (163) hide show
  1. package/dist-embed-scene/{BirdEditor-B76KBLOl.js → BirdEditor-BxlHc4L5.js} +1 -1
  2. package/dist-embed-scene/{BirdFlock-DOjnGqqt.js → BirdFlock-DGC3adr7.js} +1 -1
  3. package/dist-embed-scene/LanternEditor-CpNWWMyY.js +24 -0
  4. package/dist-embed-scene/{ModuleSession-CwJVkcpn.js → ModuleSession-Dd9RVc7I.js} +2 -2
  5. package/dist-embed-scene/ModuleThree-q18pyqmA.js +1 -0
  6. package/dist-embed-scene/ReentryEditor-DGLg57vB.js +28 -0
  7. package/dist-embed-scene/ReentryEditorMessages_en-BmTZMr-m.js +1 -0
  8. package/dist-embed-scene/ReentryEditorMessages_es-edid__Jo.js +1 -0
  9. package/dist-embed-scene/ReentryEditorMessages_fr-DHbcY0tN.js +1 -0
  10. package/dist-embed-scene/ReentryEditorMessages_it-CIzkIU4G.js +1 -0
  11. package/dist-embed-scene/ReentryKindMessages_en-BGZgya17.js +1 -0
  12. package/dist-embed-scene/ReentryKindMessages_es--UxzPNfj.js +1 -0
  13. package/dist-embed-scene/ReentryKindMessages_fr-7mer-cdj.js +1 -0
  14. package/dist-embed-scene/ReentryKindMessages_it-BBVQXE1M.js +1 -0
  15. package/dist-embed-scene/ReentryParameterTexts_en-5BOfwCsS.js +1 -0
  16. package/dist-embed-scene/ReentryParameterTexts_es-ze1-U4jB.js +1 -0
  17. package/dist-embed-scene/ReentryParameterTexts_fr-BgUJROXF.js +1 -0
  18. package/dist-embed-scene/ReentryParameterTexts_it-MTb9Vuq0.js +1 -0
  19. package/dist-embed-scene/ReentryTypeNames_en-CBu890Bd.js +1 -0
  20. package/dist-embed-scene/ReentryTypeNames_es-_LnketjJ.js +1 -0
  21. package/dist-embed-scene/ReentryTypeNames_fr-BXq89mrz.js +1 -0
  22. package/dist-embed-scene/ReentryTypeNames_it-Yfq-TDip.js +1 -0
  23. package/dist-embed-scene/SkyLantern-dInLqzN4.js +1 -0
  24. package/dist-embed-scene/rr0-scene.mjs +305 -305
  25. package/dist-embed-scene/{sightingSchema-Dk010uUD.js → sightingSchema-DjI7FV42.js} +1 -1
  26. package/dist-embed-sighting/{BeamEditor-DBOpFVUB.js → BeamEditor-B1s17C_I.js} +1 -1
  27. package/dist-embed-sighting/{BeamSystem-5WJWP1Ad.js → BeamSystem-DTraCa17.js} +1 -1
  28. package/dist-embed-sighting/{BirdEditor-mGkxSXV0.js → BirdEditor-B__-UnpK.js} +1 -1
  29. package/dist-embed-sighting/{CaseReportExport-Bq5fbuEj.js → CaseReportExport-Dq8QfB_9.js} +1 -1
  30. package/dist-embed-sighting/{GLTFLoader-BrNCkGT3.js → GLTFLoader-61IhKnLS.js} +1 -1
  31. package/dist-embed-sighting/LanternEditor-C6tHr2lo.js +24 -0
  32. package/dist-embed-sighting/{LaserBeam-BuVmy_0s.js → LaserBeam-R7ItI6m-.js} +1 -1
  33. package/dist-embed-sighting/{LaunchEditor-CTMGimHR.js → LaunchEditor-CbQXmqaL.js} +1 -1
  34. package/dist-embed-sighting/{LaunchPlume-Quo7JzI8.js → LaunchPlume-uRfBKA0Y.js} +1 -1
  35. package/dist-embed-sighting/{LaunchSimulation-DZ4pDnrh.js → LaunchSimulation-DgsYJUKz.js} +1 -1
  36. package/dist-embed-sighting/{ModuleSession-xCJtw_IT.js → ModuleSession-YoBCzrOV.js} +2 -2
  37. package/dist-embed-sighting/ModuleThree-BHRi7HrA.js +1 -0
  38. package/dist-embed-sighting/{ParameterForm-D4tIZ54J.js → ParameterForm-CkZQ1FlH.js} +1 -1
  39. package/dist-embed-sighting/ReentryEditor-BzOyu6AB.js +28 -0
  40. package/dist-embed-sighting/ReentryEditorMessages_en-BmTZMr-m.js +1 -0
  41. package/dist-embed-sighting/ReentryEditorMessages_es-edid__Jo.js +1 -0
  42. package/dist-embed-sighting/ReentryEditorMessages_fr-DHbcY0tN.js +1 -0
  43. package/dist-embed-sighting/ReentryEditorMessages_it-CIzkIU4G.js +1 -0
  44. package/dist-embed-sighting/ReentryKindMessages_en-BGZgya17.js +1 -0
  45. package/dist-embed-sighting/ReentryKindMessages_es--UxzPNfj.js +1 -0
  46. package/dist-embed-sighting/ReentryKindMessages_fr-7mer-cdj.js +1 -0
  47. package/dist-embed-sighting/ReentryKindMessages_it-BBVQXE1M.js +1 -0
  48. package/dist-embed-sighting/ReentryParameterTexts_en-5BOfwCsS.js +1 -0
  49. package/dist-embed-sighting/ReentryParameterTexts_es-ze1-U4jB.js +1 -0
  50. package/dist-embed-sighting/ReentryParameterTexts_fr-BgUJROXF.js +1 -0
  51. package/dist-embed-sighting/ReentryParameterTexts_it-MTb9Vuq0.js +1 -0
  52. package/dist-embed-sighting/{ReentrySimulation-BnYP6UwW.js → ReentrySimulation-BDnSb3zB.js} +1 -1
  53. package/dist-embed-sighting/ReentryTypeNames_en-CBu890Bd.js +1 -0
  54. package/dist-embed-sighting/ReentryTypeNames_es-_LnketjJ.js +1 -0
  55. package/dist-embed-sighting/ReentryTypeNames_fr-BXq89mrz.js +1 -0
  56. package/dist-embed-sighting/ReentryTypeNames_it-Yfq-TDip.js +1 -0
  57. package/dist-embed-sighting/SkyLantern-BdVGIBoq.js +1 -0
  58. package/dist-embed-sighting/{TimelineTracks-BjJwL-DC.js → TimelineTracks-CvGxdpGb.js} +1 -1
  59. package/dist-embed-sighting/rr0-sighting.mjs +320 -320
  60. package/dist-embed-sighting/{sightingSchema-Dk010uUD.js → sightingSchema-DjI7FV42.js} +1 -1
  61. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-BpmT6OKS.js → BallesterGuaspAssessor-CeyXntPc.js} +1 -1
  62. package/dist-embed-sighting-editor/{BeamEditor-BawKO8H-.js → BeamEditor-DQcdww5w.js} +1 -1
  63. package/dist-embed-sighting-editor/{BeamSystem-BA8EOscq.js → BeamSystem-d2pPAwht.js} +1 -1
  64. package/dist-embed-sighting-editor/{BirdEditor-BDOoYRVO.js → BirdEditor-CsyXenUx.js} +1 -1
  65. package/dist-embed-sighting-editor/{CaseReportExport-B_eY0L0k.js → CaseReportExport-DQEJL9zL.js} +1 -1
  66. package/dist-embed-sighting-editor/{ContrailSystem-expk-hcJ.js → ContrailSystem-B4tXvQXF.js} +1 -1
  67. package/dist-embed-sighting-editor/{ControlPasses-DjuFMJPj.js → ControlPasses-C2E5CKcL.js} +1 -1
  68. package/dist-embed-sighting-editor/{CoverageAssessor-OL8FwC51.js → CoverageAssessor-DvVcSmz6.js} +1 -1
  69. package/dist-embed-sighting-editor/{GLTFLoader-BLDypTtN.js → GLTFLoader-fTZft-Zt.js} +1 -1
  70. package/dist-embed-sighting-editor/{HeadlightSystem-Dm_TsC1R.js → HeadlightSystem-uWB_oNGK.js} +1 -1
  71. package/dist-embed-sighting-editor/{HynekAssessor-DAYUme2x.js → HynekAssessor-D-u8nJfp.js} +1 -1
  72. package/dist-embed-sighting-editor/{InterviewEditorElement-ByXtSShu.js → InterviewEditorElement-MBuptUl8.js} +2 -2
  73. package/dist-embed-sighting-editor/LanternEditor-DIew0BrY.js +24 -0
  74. package/dist-embed-sighting-editor/{LaserBeam-D5ZQPR6m.js → LaserBeam-DOGz1dOz.js} +1 -1
  75. package/dist-embed-sighting-editor/{LaunchEditor-DAq_SFrv.js → LaunchEditor-0BCDGChg.js} +1 -1
  76. package/dist-embed-sighting-editor/{LaunchPlume-DUxOB50r.js → LaunchPlume-DdX9-Rlw.js} +1 -1
  77. package/dist-embed-sighting-editor/{LaunchSimulation-DIzy0Xw3.js → LaunchSimulation-BkdI45NE.js} +1 -1
  78. package/dist-embed-sighting-editor/ModuleConformance-_3-3Kbbt.js +2 -0
  79. package/dist-embed-sighting-editor/{ModuleSession-BBUcHOq4.js → ModuleSession-mVLpd6IE.js} +2 -2
  80. package/dist-embed-sighting-editor/ModuleThree-cXvmWIn4.js +1 -0
  81. package/dist-embed-sighting-editor/{ModulesPanelElement-SCFylxD6.js → ModulesPanelElement-DZ7dkdsm.js} +3 -3
  82. package/dist-embed-sighting-editor/{NearestApproach-Bubj_A1N.js → NearestApproach-BDjtUet2.js} +1 -1
  83. package/dist-embed-sighting-editor/{PoherAssessor-0QbtKuaf.js → PoherAssessor-DrseSHg-.js} +1 -1
  84. package/dist-embed-sighting-editor/{RailwaySystem-BdEv3g84.js → RailwaySystem-De5BYxNx.js} +1 -1
  85. package/dist-embed-sighting-editor/ReentryEditor-DWqXWztK.js +28 -0
  86. package/dist-embed-sighting-editor/ReentryEditorMessages_en-BmTZMr-m.js +1 -0
  87. package/dist-embed-sighting-editor/ReentryEditorMessages_es-edid__Jo.js +1 -0
  88. package/dist-embed-sighting-editor/ReentryEditorMessages_fr-DHbcY0tN.js +1 -0
  89. package/dist-embed-sighting-editor/ReentryEditorMessages_it-CIzkIU4G.js +1 -0
  90. package/dist-embed-sighting-editor/ReentryKindMessages_en-BGZgya17.js +1 -0
  91. package/dist-embed-sighting-editor/ReentryKindMessages_es--UxzPNfj.js +1 -0
  92. package/dist-embed-sighting-editor/ReentryKindMessages_fr-7mer-cdj.js +1 -0
  93. package/dist-embed-sighting-editor/ReentryKindMessages_it-BBVQXE1M.js +1 -0
  94. package/dist-embed-sighting-editor/ReentryParameterTexts_en-5BOfwCsS.js +1 -0
  95. package/dist-embed-sighting-editor/ReentryParameterTexts_es-ze1-U4jB.js +1 -0
  96. package/dist-embed-sighting-editor/ReentryParameterTexts_fr-BgUJROXF.js +1 -0
  97. package/dist-embed-sighting-editor/ReentryParameterTexts_it-MTb9Vuq0.js +1 -0
  98. package/dist-embed-sighting-editor/{ReentrySimulation-CFa2_NSJ.js → ReentrySimulation-DpIG9b07.js} +1 -1
  99. package/dist-embed-sighting-editor/ReentryTypeNames_en-CBu890Bd.js +1 -0
  100. package/dist-embed-sighting-editor/ReentryTypeNames_es-_LnketjJ.js +1 -0
  101. package/dist-embed-sighting-editor/ReentryTypeNames_fr-BXq89mrz.js +1 -0
  102. package/dist-embed-sighting-editor/ReentryTypeNames_it-Yfq-TDip.js +1 -0
  103. package/dist-embed-sighting-editor/{ReferenceSystem-Bm9Javlm.js → ReferenceSystem-BoCM4vB1.js} +1 -1
  104. package/dist-embed-sighting-editor/{SightingEditorMessages_en-Lx3C0BAS.js → SightingEditorMessages_en-Bt9dhchY.js} +1 -1
  105. package/dist-embed-sighting-editor/{SightingEditorMessages_es-Dh01a5sk.js → SightingEditorMessages_es-BnoHmcFj.js} +1 -1
  106. package/dist-embed-sighting-editor/{SightingEditorMessages_fr-CUfrDDiv.js → SightingEditorMessages_fr-CE7C8gk2.js} +1 -1
  107. package/dist-embed-sighting-editor/{SightingEditorMessages_it-C0Werz3D.js → SightingEditorMessages_it-lqZ7QCHn.js} +1 -1
  108. package/dist-embed-sighting-editor/{SightingFileEditor-Wx9tn4bw.js → SightingFileEditor-Dtz8Azd2.js} +1 -1
  109. package/dist-embed-sighting-editor/SkyLantern-CaRiiIZX.js +1 -0
  110. package/dist-embed-sighting-editor/{TraceSystem-DfSwlqhV.js → TraceSystem-DdEd9Z5I.js} +2 -2
  111. package/dist-embed-sighting-editor/{WaterSystem-D3WEELlK.js → WaterSystem-DntD2XIE.js} +2 -2
  112. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +374 -368
  113. package/dist-embed-sighting-editor/{sightingSchema-Dk010uUD.js → sightingSchema-DjI7FV42.js} +1 -1
  114. package/package.json +1 -1
  115. package/dist-embed-scene/LanternEditor-BRH4wcQ9.js +0 -9
  116. package/dist-embed-scene/ModuleThree-BHjFJ_bC.js +0 -1
  117. package/dist-embed-scene/ReentryEditor-BR99W168.js +0 -27
  118. package/dist-embed-scene/ReentryEditorMessages_en-O-YSmHxv.js +0 -1
  119. package/dist-embed-scene/ReentryEditorMessages_es-CvO9Jwz5.js +0 -1
  120. package/dist-embed-scene/ReentryEditorMessages_fr-xuC-qZ6M.js +0 -1
  121. package/dist-embed-scene/ReentryEditorMessages_it-B7vyCX9o.js +0 -1
  122. package/dist-embed-scene/ReentryKindMessages_en-Cbgk3paQ.js +0 -1
  123. package/dist-embed-scene/ReentryKindMessages_es-DwgJQanC.js +0 -1
  124. package/dist-embed-scene/ReentryKindMessages_fr-D9r9x2bK.js +0 -1
  125. package/dist-embed-scene/ReentryKindMessages_it-DQ-J5YpD.js +0 -1
  126. package/dist-embed-scene/ReentryParameterTexts_en-BH1tGP5C.js +0 -1
  127. package/dist-embed-scene/ReentryParameterTexts_es-BDMJ4K1g.js +0 -1
  128. package/dist-embed-scene/ReentryParameterTexts_fr-C8ROK57p.js +0 -1
  129. package/dist-embed-scene/ReentryParameterTexts_it-CwC8vNTI.js +0 -1
  130. package/dist-embed-scene/SkyLantern-CIoY8lu4.js +0 -1
  131. package/dist-embed-sighting/LanternEditor-F5ApaFs3.js +0 -9
  132. package/dist-embed-sighting/ModuleThree-D1QGUDll.js +0 -1
  133. package/dist-embed-sighting/ReentryEditor-gT2NnDI5.js +0 -27
  134. package/dist-embed-sighting/ReentryEditorMessages_en-O-YSmHxv.js +0 -1
  135. package/dist-embed-sighting/ReentryEditorMessages_es-CvO9Jwz5.js +0 -1
  136. package/dist-embed-sighting/ReentryEditorMessages_fr-xuC-qZ6M.js +0 -1
  137. package/dist-embed-sighting/ReentryEditorMessages_it-B7vyCX9o.js +0 -1
  138. package/dist-embed-sighting/ReentryKindMessages_en-Cbgk3paQ.js +0 -1
  139. package/dist-embed-sighting/ReentryKindMessages_es-DwgJQanC.js +0 -1
  140. package/dist-embed-sighting/ReentryKindMessages_fr-D9r9x2bK.js +0 -1
  141. package/dist-embed-sighting/ReentryKindMessages_it-DQ-J5YpD.js +0 -1
  142. package/dist-embed-sighting/ReentryParameterTexts_en-BH1tGP5C.js +0 -1
  143. package/dist-embed-sighting/ReentryParameterTexts_es-BDMJ4K1g.js +0 -1
  144. package/dist-embed-sighting/ReentryParameterTexts_fr-C8ROK57p.js +0 -1
  145. package/dist-embed-sighting/ReentryParameterTexts_it-CwC8vNTI.js +0 -1
  146. package/dist-embed-sighting/SkyLantern--RJZtEMU.js +0 -1
  147. package/dist-embed-sighting-editor/LanternEditor-Bi-khJJw.js +0 -9
  148. package/dist-embed-sighting-editor/ModuleConformance-DuH_TuHw.js +0 -2
  149. package/dist-embed-sighting-editor/ModuleThree-C9HnaBjO.js +0 -1
  150. package/dist-embed-sighting-editor/ReentryEditor-DWR69i5W.js +0 -27
  151. package/dist-embed-sighting-editor/ReentryEditorMessages_en-O-YSmHxv.js +0 -1
  152. package/dist-embed-sighting-editor/ReentryEditorMessages_es-CvO9Jwz5.js +0 -1
  153. package/dist-embed-sighting-editor/ReentryEditorMessages_fr-xuC-qZ6M.js +0 -1
  154. package/dist-embed-sighting-editor/ReentryEditorMessages_it-B7vyCX9o.js +0 -1
  155. package/dist-embed-sighting-editor/ReentryKindMessages_en-Cbgk3paQ.js +0 -1
  156. package/dist-embed-sighting-editor/ReentryKindMessages_es-DwgJQanC.js +0 -1
  157. package/dist-embed-sighting-editor/ReentryKindMessages_fr-D9r9x2bK.js +0 -1
  158. package/dist-embed-sighting-editor/ReentryKindMessages_it-DQ-J5YpD.js +0 -1
  159. package/dist-embed-sighting-editor/ReentryParameterTexts_en-BH1tGP5C.js +0 -1
  160. package/dist-embed-sighting-editor/ReentryParameterTexts_es-BDMJ4K1g.js +0 -1
  161. package/dist-embed-sighting-editor/ReentryParameterTexts_fr-C8ROK57p.js +0 -1
  162. package/dist-embed-sighting-editor/ReentryParameterTexts_it-CwC8vNTI.js +0 -1
  163. package/dist-embed-sighting-editor/SkyLantern-B0V58mct.js +0 -1
@@ -1 +1 @@
1
- import{a$ as h,S as p}from"./rr0-sighting-editor.mjs";import{N as m}from"./NearestApproach-Bubj_A1N.js";import{CoverageAssessor as S}from"./CoverageAssessor-OL8FwC51.js";class s{about="observer";static PAGE_WORDS=250;static ARTICLE_WORDS=500;static CLOSE_M=150;static WEIGHTS={witnesses:.25,occupation:.2,relation:.15,geography:.15,activity:.15,age:.1};static OCCUPATIONS={student:.3,worker:.5,farmer:.5,homemaker:.5,merchant:.7,business:.7,employee:.7,artist:.7,technician:.9,police:.9,pilot:.9,military:1};static RELATIONS={friends:.3,family:.6,professional:.8,none:1};static ACTIVITIES={leisure:.3,travelling:.6,cultural:.8,working:1};static FACTORS=h;static PENDING="pending";static WEAKEST_FIRST=["fitted","assumed","derived","stated","measured","established"];async assess(t){const e=t.account??{},i=this.information(t,e),n=this.strangeness(t,e),u=this.reliability(t,e),v=i.value,r=n.filter(d=>d.value>0).length/s.FACTORS.length,c=s.WEIGHTS,a=Object.keys(c).reduce((d,l)=>d+c[l]*u[l].value,0),o=[this.criterion("bg-information",i),...s.FACTORS.map((d,l)=>this.criterion(`bg-${d}`,n[l])),...Object.keys(c).map(d=>this.criterion(`bg-${d}`,u[d]))],b=Object.values(e.strangeness??{}).some(d=>d!==void 0);return e.source===void 0||!b?{verdict:s.PENDING,factors:{q:v,sigma:r,pi:a},criteria:o}:{score:v*r*a,factors:{q:v,sigma:r,pi:a},criteria:o}}criterion(t,e){return{id:t,value:e.value,basis:e.basis,paths:e.basis===void 0?[]:e.paths}}information(t,e){const i=e.source;if(i===void 0)return{value:0,paths:[]};const n=this.basis(t,"account.source"),u=e.enquiryMinutes,v=(a,o,b)=>u===void 0?{value:b,basis:this.weakest(n,"assumed"),paths:["account.source"]}:{value:u>=a?o:b,basis:this.weakest(n,this.basis(t,"account.enquiryMinutes")),paths:["account.source","account.enquiryMinutes"]},r=this.words(t),c=(a,o,b)=>({value:r>=a?o:b,basis:this.weakest(n,"derived"),paths:["account.source","event.description"]});switch(i){case"on-site":return v(120,1,.9);case"interview":return v(60,.9,.8);case"telephone":return v(30,.7,.6);case"questionnaire":return e.followedUp?c(s.PAGE_WORDS,.7,.6):{value:.6,basis:n,paths:["account.source"]};case"letter":case"social-media":return e.followedUp?c(s.PAGE_WORDS,.6,.5):c(s.PAGE_WORDS,.4,.3);case"press":return c(s.ARTICLE_WORDS,.2,.1)}}words(t){return(p.any.read(t.event.description)??"").split(/\s+/).filter(i=>i!=="").length}strangeness(t,e){const i=e.strangeness??{},n=s.FACTORS.map(r=>{const c=i[r];if(c!==void 0){const a=`account.strangeness.${r}`;return{value:c?1:0,basis:this.basis(t,a),paths:[a]}}switch(r){case"detection":{const a=t.instrument.category;return{value:a==="eye"||a==="binoculars"?0:1,basis:"derived",paths:["instrumentId"]}}case"close":{const a=m.of(t);return a===void 0?{value:0,paths:[]}:{value:a.m<=s.CLOSE_M?1:0,basis:a.basis,paths:a.paths}}case"beings":{const a=t.decor.map((o,b)=>({object:o,index:b})).filter(({object:o})=>o.kind==="entity");return a.length>0?{value:1,basis:"stated",paths:a.map(({index:o})=>`decor.${o}`)}:{value:0,basis:"derived",paths:["decor"]}}default:return{value:0,paths:[]}}}),u=s.FACTORS.indexOf("beings");return!["appearance","movement","incongruity"].some(r=>n[s.FACTORS.indexOf(r)].value>0)&&n[u].value>0&&(n[u]={...n[u],value:0}),n}reliability(t,e){const i=t.observerCount,n=i===1,u=i===1?.3:i===2?.5:i<=5?.7:i<=10?.9:1,v=e.observerGraduate?{value:1,basis:this.basis(t,"account.observerGraduate"),paths:["account.observerGraduate"]}:e.observerOccupationKind===void 0?{value:0,paths:[]}:{value:s.OCCUPATIONS[e.observerOccupationKind],basis:this.basis(t,"account.observerOccupationKind"),paths:["account.observerOccupationKind"]},r=n?{value:.6,basis:"derived",paths:["decor"]}:e.observersRelation===void 0?{value:0,paths:[]}:{value:s.RELATIONS[e.observersRelation],basis:this.basis(t,"account.observersRelation"),paths:["account.observersRelation"]},c=e.activity!==void 0?{value:s.ACTIVITIES[e.activity],basis:this.basis(t,"account.activity"),paths:["account.activity"]}:t.vehicle!==void 0?{value:s.ACTIVITIES.travelling,basis:"derived",paths:["vehicle"]}:{value:0,paths:[]},a=e.observerAgeYears,o=a===void 0?{value:0,paths:[]}:{value:a<10||a>75?.2:a<18?.4:a<35?.6:a<65?1:.8,basis:this.basis(t,"account.observerAgeYears"),paths:["account.observerAgeYears"]};return{witnesses:{value:u,basis:"derived",paths:["decor"]},occupation:v,relation:r,geography:{value:.5,basis:"derived",paths:["decor"]},activity:c,age:o}}basis(t,e){return S.basisAt(e,t)??"stated"}weakest(...t){return s.WEAKEST_FIRST.find(e=>t.includes(e))}}export{s as BallesterGuaspAssessor};
1
+ import{b5 as h,S as p}from"./rr0-sighting-editor.mjs";import{N as m}from"./NearestApproach-BDjtUet2.js";import{CoverageAssessor as S}from"./CoverageAssessor-DvVcSmz6.js";class s{about="observer";static PAGE_WORDS=250;static ARTICLE_WORDS=500;static CLOSE_M=150;static WEIGHTS={witnesses:.25,occupation:.2,relation:.15,geography:.15,activity:.15,age:.1};static OCCUPATIONS={student:.3,worker:.5,farmer:.5,homemaker:.5,merchant:.7,business:.7,employee:.7,artist:.7,technician:.9,police:.9,pilot:.9,military:1};static RELATIONS={friends:.3,family:.6,professional:.8,none:1};static ACTIVITIES={leisure:.3,travelling:.6,cultural:.8,working:1};static FACTORS=h;static PENDING="pending";static WEAKEST_FIRST=["fitted","assumed","derived","stated","measured","established"];async assess(t){const e=t.account??{},i=this.information(t,e),n=this.strangeness(t,e),u=this.reliability(t,e),v=i.value,r=n.filter(d=>d.value>0).length/s.FACTORS.length,c=s.WEIGHTS,a=Object.keys(c).reduce((d,l)=>d+c[l]*u[l].value,0),o=[this.criterion("bg-information",i),...s.FACTORS.map((d,l)=>this.criterion(`bg-${d}`,n[l])),...Object.keys(c).map(d=>this.criterion(`bg-${d}`,u[d]))],b=Object.values(e.strangeness??{}).some(d=>d!==void 0);return e.source===void 0||!b?{verdict:s.PENDING,factors:{q:v,sigma:r,pi:a},criteria:o}:{score:v*r*a,factors:{q:v,sigma:r,pi:a},criteria:o}}criterion(t,e){return{id:t,value:e.value,basis:e.basis,paths:e.basis===void 0?[]:e.paths}}information(t,e){const i=e.source;if(i===void 0)return{value:0,paths:[]};const n=this.basis(t,"account.source"),u=e.enquiryMinutes,v=(a,o,b)=>u===void 0?{value:b,basis:this.weakest(n,"assumed"),paths:["account.source"]}:{value:u>=a?o:b,basis:this.weakest(n,this.basis(t,"account.enquiryMinutes")),paths:["account.source","account.enquiryMinutes"]},r=this.words(t),c=(a,o,b)=>({value:r>=a?o:b,basis:this.weakest(n,"derived"),paths:["account.source","event.description"]});switch(i){case"on-site":return v(120,1,.9);case"interview":return v(60,.9,.8);case"telephone":return v(30,.7,.6);case"questionnaire":return e.followedUp?c(s.PAGE_WORDS,.7,.6):{value:.6,basis:n,paths:["account.source"]};case"letter":case"social-media":return e.followedUp?c(s.PAGE_WORDS,.6,.5):c(s.PAGE_WORDS,.4,.3);case"press":return c(s.ARTICLE_WORDS,.2,.1)}}words(t){return(p.any.read(t.event.description)??"").split(/\s+/).filter(i=>i!=="").length}strangeness(t,e){const i=e.strangeness??{},n=s.FACTORS.map(r=>{const c=i[r];if(c!==void 0){const a=`account.strangeness.${r}`;return{value:c?1:0,basis:this.basis(t,a),paths:[a]}}switch(r){case"detection":{const a=t.instrument.category;return{value:a==="eye"||a==="binoculars"?0:1,basis:"derived",paths:["instrumentId"]}}case"close":{const a=m.of(t);return a===void 0?{value:0,paths:[]}:{value:a.m<=s.CLOSE_M?1:0,basis:a.basis,paths:a.paths}}case"beings":{const a=t.decor.map((o,b)=>({object:o,index:b})).filter(({object:o})=>o.kind==="entity");return a.length>0?{value:1,basis:"stated",paths:a.map(({index:o})=>`decor.${o}`)}:{value:0,basis:"derived",paths:["decor"]}}default:return{value:0,paths:[]}}}),u=s.FACTORS.indexOf("beings");return!["appearance","movement","incongruity"].some(r=>n[s.FACTORS.indexOf(r)].value>0)&&n[u].value>0&&(n[u]={...n[u],value:0}),n}reliability(t,e){const i=t.observerCount,n=i===1,u=i===1?.3:i===2?.5:i<=5?.7:i<=10?.9:1,v=e.observerGraduate?{value:1,basis:this.basis(t,"account.observerGraduate"),paths:["account.observerGraduate"]}:e.observerOccupationKind===void 0?{value:0,paths:[]}:{value:s.OCCUPATIONS[e.observerOccupationKind],basis:this.basis(t,"account.observerOccupationKind"),paths:["account.observerOccupationKind"]},r=n?{value:.6,basis:"derived",paths:["decor"]}:e.observersRelation===void 0?{value:0,paths:[]}:{value:s.RELATIONS[e.observersRelation],basis:this.basis(t,"account.observersRelation"),paths:["account.observersRelation"]},c=e.activity!==void 0?{value:s.ACTIVITIES[e.activity],basis:this.basis(t,"account.activity"),paths:["account.activity"]}:t.vehicle!==void 0?{value:s.ACTIVITIES.travelling,basis:"derived",paths:["vehicle"]}:{value:0,paths:[]},a=e.observerAgeYears,o=a===void 0?{value:0,paths:[]}:{value:a<10||a>75?.2:a<18?.4:a<35?.6:a<65?1:.8,basis:this.basis(t,"account.observerAgeYears"),paths:["account.observerAgeYears"]};return{witnesses:{value:u,basis:"derived",paths:["decor"]},occupation:v,relation:r,geography:{value:.5,basis:"derived",paths:["decor"]},activity:c,age:o}}basis(t,e){return S.basisAt(e,t)??"stated"}weakest(...t){return s.WEAKEST_FIRST.find(e=>t.includes(e))}}export{s as BallesterGuaspAssessor};
@@ -1,4 +1,4 @@
1
- import{o as T,_ as c,az as I,a1 as p,a2 as L,c as x,$ as w,a0 as E,a3 as f,aJ as M}from"./rr0-sighting-editor.mjs";import{L as u}from"./LaserBeam-D5ZQPR6m.js";import{S as _}from"./SkyEventEditorStyle-CvY_AhbI.js";const O=T.catalog({en:()=>c(()=>import("./BeamParameterTexts_en-DZB75ouZ.js"),[],import.meta.url).then(l=>l.beamParameterTexts_en),fr:()=>c(()=>import("./BeamParameterTexts_fr-BHG3fW40.js"),[],import.meta.url).then(l=>l.beamParameterTexts_fr),es:()=>c(()=>import("./BeamParameterTexts_es-AeZmsufG.js"),[],import.meta.url).then(l=>l.beamParameterTexts_es),it:()=>c(()=>import("./BeamParameterTexts_it-CPwmQX-g.js"),[],import.meta.url).then(l=>l.beamParameterTexts_it)});class h{static LIGHT_TITLE="light";static BEAM="beam";static WHEN="when";static nextPlace(e){const t=e[e.length-1]??{lat:0,lng:0,altitudeM:0},i=e[e.length-2];return i?{lat:2*t.lat-i.lat,lng:2*t.lng-i.lng,altitudeM:2*t.altitudeM-i.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,i,s=!1){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t,hint:i,...s?{required:s}:{}}}static SET={kind:"beam",title:"beam",parameters:[{type:"said",key:"title",label:"name",group:h.BEAM},{type:"number",key:"divergenceMrad",min:.001,max:1e3,step:.001,unit:"mrad",group:h.BEAM,effective:()=>u.DEFAULT_DIVERGENCE_MRAD,label:"divergence",hint:"howFastItWidensFullAngle"},{type:"number",key:"apertureM",min:.001,max:10,step:.001,unit:"m",group:h.BEAM,effective:()=>u.DEFAULT_APERTURE_M,label:"widthAtTheEmitter"},{type:"number",key:"patchiness",min:0,max:100,step:1,unit:"%",scale:100,group:h.BEAM,effective:()=>u.DEFAULT_PATCHINESS,label:"unevenHaze",hint:"howUnevenlyTheHazeItCrosses"}]};static WAVELENGTH_HINT="itsColour532ForTheGreen";static POWER_HINT="theOpticalPowerItCarriesIts";static WAVELENGTH_LABEL="wavelength";static POWER_LABEL="power";static LIGHT={kind:"beam-light",title:h.LIGHT_TITLE,parameters:[{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",required:!0,label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",required:!0,label:h.POWER_LABEL,hint:h.POWER_HINT}]};static LIGHT_KEY={kind:"beam-light-key",title:h.LIGHT_TITLE,parameters:[h.instant("t","time","secondsOfTheRecording",!0),{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT,effective:(e,t)=>t?.wavelengthNm},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",label:h.POWER_LABEL,hint:h.POWER_HINT,effective:(e,t)=>t?.powerW}]};static ON={kind:"beam-on",title:h.WHEN,parameters:[h.instant("fromT","onFrom","secondsOfTheRecordingEmptyFrom"),h.instant("untilT","offAt","secondsOfTheRecordingEmptyUntil")]};static MOVE_KEY={kind:"beam-move-key",title:"pathAtAnInstant",parameters:[h.instant("t","time","secondsOfTheRecording",!0)]};static hexOf(e){const t=u.colourOf(e),i=Math.max(...t,1e-9),s=n=>{const o=Math.min(1,Math.max(0,n/i)),a=o<=.0031308?12.92*o:1.055*o**(1/2.4)-.055;return Math.round(a*255).toString(16).padStart(2,"0")};return`#${t.map(s).join("")}`}static wavelengthOf(e){const t=h.hueOf(e);let i=532,s=1/0;for(let n=400;n<=700;n++){const o=Math.abs((h.hueOf(h.hexOf(n))-t+540)%360-180);o<s&&(s=o,i=n)}return i}static hueOf(e){const t=Number.parseInt(e.replace("#",""),16),[i,s,n]=[t>>16&255,t>>8&255,t&255].map(b=>b/255),o=Math.max(i,s,n),a=Math.min(i,s,n);if(o===a)return 0;const r=o-a;return((o===i?(s-n)/r%6:o===s?(n-i)/r+2:(i-s)/r+4)*60+360)%360}static PLACE={kind:"beam-place",title:"pointOfThePath",parameters:[{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:.1,label:"position"},{type:"number",key:"altitudeM",min:-500,max:1e5,step:.1,unit:"m",required:!0,label:"altitude",hint:"aboveTheSeaNotTheGround"}]};static publish(){I.publish(h.SET)}}const A=T.catalog({en:()=>c(()=>import("./BeamEditorMessages_en-DDvPWAdd.js"),[],import.meta.url).then(l=>l.beamEditorMessages_en),fr:()=>c(()=>import("./BeamEditorMessages_fr-CtX6uP-x.js"),[],import.meta.url).then(l=>l.beamEditorMessages_fr),es:()=>c(()=>import("./BeamEditorMessages_es-BhCkhUkN.js"),[],import.meta.url).then(l=>l.beamEditorMessages_es),it:()=>c(()=>import("./BeamEditorMessages_it-DVweRQFi.js"),[],import.meta.url).then(l=>l.beamEditorMessages_it)});class g{constructor(e,t,i){this.container=e,this.host=t,this.language=i,_.attach(e,"beam-editor",g.STYLE),I.of("beam")||h.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="on";onForm;lightForm;lightKeyForm;lightIndex;moveKeyForm;moveIndex;places;placeForm;placeIndex=0;language;shown=[];static STYLE='.beam-editor { flex-basis: 100%; min-width: 0; } .beam-editor #beam-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .beam-editor #beam-list, .beam-editor #beam-places { flex-basis: 100%; min-width: 0; } .beam-editor .launch-editor, .beam-editor .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .beam-editor .launch-fields { flex-basis: 100%; min-width: 0; } .beam-editor [hidden] { display: none !important; } .beam-editor select { min-width: 0; width: 100%; } .beam-editor .launch-intro { flex-basis: 100%; margin: 0; } .beam-editor .launch-track { flex-basis: 100%; margin: 0; } .beam-editor .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .beam-editor .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .beam-editor input, .beam-editor select { max-width: 100%; box-sizing: border-box; } .beam-editor input[type="text"] { width: 12em; } .beam-editor #launch-title { width: 18em; } .beam-editor label { min-width: 0; max-width: 100%; } .beam-editor input.parameter-derived::placeholder { opacity: .65; } .beam-editor .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([A.load(e),O.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;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;if(this.element("beam-fields").hidden=t===void 0,!t)return;const i={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.form??=new p(this.element("beam-parameters"),this.language,"beam.",i),this.form.show(this.resolved(h.SET),this.targetOfBeam(),()=>this.written()),this.syncDetail(!0)}refresh(){if(!this.messages)return;this.syncAddState();const e=this.beams;if(e.length===this.shown.length&&e.every((t,i)=>t.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}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.messages&&(this.currentId=e,this.row="on",this.lightIndex=void 0,this.moveIndex=void 0,this.placeIndex=0,this.sync())}resolved(e){return L.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
1
+ import{o as T,_ as c,az as I,a1 as p,a2 as L,c as x,$ as w,a0 as E,a3 as f,aK as M}from"./rr0-sighting-editor.mjs";import{L as u}from"./LaserBeam-DOGz1dOz.js";import{S as _}from"./SkyEventEditorStyle-CvY_AhbI.js";const O=T.catalog({en:()=>c(()=>import("./BeamParameterTexts_en-DZB75ouZ.js"),[],import.meta.url).then(l=>l.beamParameterTexts_en),fr:()=>c(()=>import("./BeamParameterTexts_fr-BHG3fW40.js"),[],import.meta.url).then(l=>l.beamParameterTexts_fr),es:()=>c(()=>import("./BeamParameterTexts_es-AeZmsufG.js"),[],import.meta.url).then(l=>l.beamParameterTexts_es),it:()=>c(()=>import("./BeamParameterTexts_it-CPwmQX-g.js"),[],import.meta.url).then(l=>l.beamParameterTexts_it)});class h{static LIGHT_TITLE="light";static BEAM="beam";static WHEN="when";static nextPlace(e){const t=e[e.length-1]??{lat:0,lng:0,altitudeM:0},i=e[e.length-2];return i?{lat:2*t.lat-i.lat,lng:2*t.lng-i.lng,altitudeM:2*t.altitudeM-i.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,i,s=!1){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t,hint:i,...s?{required:s}:{}}}static SET={kind:"beam",title:"beam",parameters:[{type:"said",key:"title",label:"name",group:h.BEAM},{type:"number",key:"divergenceMrad",min:.001,max:1e3,step:.001,unit:"mrad",group:h.BEAM,effective:()=>u.DEFAULT_DIVERGENCE_MRAD,label:"divergence",hint:"howFastItWidensFullAngle"},{type:"number",key:"apertureM",min:.001,max:10,step:.001,unit:"m",group:h.BEAM,effective:()=>u.DEFAULT_APERTURE_M,label:"widthAtTheEmitter"},{type:"number",key:"patchiness",min:0,max:100,step:1,unit:"%",scale:100,group:h.BEAM,effective:()=>u.DEFAULT_PATCHINESS,label:"unevenHaze",hint:"howUnevenlyTheHazeItCrosses"}]};static WAVELENGTH_HINT="itsColour532ForTheGreen";static POWER_HINT="theOpticalPowerItCarriesIts";static WAVELENGTH_LABEL="wavelength";static POWER_LABEL="power";static LIGHT={kind:"beam-light",title:h.LIGHT_TITLE,parameters:[{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",required:!0,label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",required:!0,label:h.POWER_LABEL,hint:h.POWER_HINT}]};static LIGHT_KEY={kind:"beam-light-key",title:h.LIGHT_TITLE,parameters:[h.instant("t","time","secondsOfTheRecording",!0),{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT,effective:(e,t)=>t?.wavelengthNm},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",label:h.POWER_LABEL,hint:h.POWER_HINT,effective:(e,t)=>t?.powerW}]};static ON={kind:"beam-on",title:h.WHEN,parameters:[h.instant("fromT","onFrom","secondsOfTheRecordingEmptyFrom"),h.instant("untilT","offAt","secondsOfTheRecordingEmptyUntil")]};static MOVE_KEY={kind:"beam-move-key",title:"pathAtAnInstant",parameters:[h.instant("t","time","secondsOfTheRecording",!0)]};static hexOf(e){const t=u.colourOf(e),i=Math.max(...t,1e-9),s=n=>{const o=Math.min(1,Math.max(0,n/i)),a=o<=.0031308?12.92*o:1.055*o**(1/2.4)-.055;return Math.round(a*255).toString(16).padStart(2,"0")};return`#${t.map(s).join("")}`}static wavelengthOf(e){const t=h.hueOf(e);let i=532,s=1/0;for(let n=400;n<=700;n++){const o=Math.abs((h.hueOf(h.hexOf(n))-t+540)%360-180);o<s&&(s=o,i=n)}return i}static hueOf(e){const t=Number.parseInt(e.replace("#",""),16),[i,s,n]=[t>>16&255,t>>8&255,t&255].map(b=>b/255),o=Math.max(i,s,n),a=Math.min(i,s,n);if(o===a)return 0;const r=o-a;return((o===i?(s-n)/r%6:o===s?(n-i)/r+2:(i-s)/r+4)*60+360)%360}static PLACE={kind:"beam-place",title:"pointOfThePath",parameters:[{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:.1,label:"position"},{type:"number",key:"altitudeM",min:-500,max:1e5,step:.1,unit:"m",required:!0,label:"altitude",hint:"aboveTheSeaNotTheGround"}]};static publish(){I.publish(h.SET)}}const A=T.catalog({en:()=>c(()=>import("./BeamEditorMessages_en-DDvPWAdd.js"),[],import.meta.url).then(l=>l.beamEditorMessages_en),fr:()=>c(()=>import("./BeamEditorMessages_fr-CtX6uP-x.js"),[],import.meta.url).then(l=>l.beamEditorMessages_fr),es:()=>c(()=>import("./BeamEditorMessages_es-BhCkhUkN.js"),[],import.meta.url).then(l=>l.beamEditorMessages_es),it:()=>c(()=>import("./BeamEditorMessages_it-DVweRQFi.js"),[],import.meta.url).then(l=>l.beamEditorMessages_it)});class g{constructor(e,t,i){this.container=e,this.host=t,this.language=i,_.attach(e,"beam-editor",g.STYLE),I.of("beam")||h.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="on";onForm;lightForm;lightKeyForm;lightIndex;moveKeyForm;moveIndex;places;placeForm;placeIndex=0;language;shown=[];static STYLE='.beam-editor { flex-basis: 100%; min-width: 0; } .beam-editor #beam-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .beam-editor #beam-list, .beam-editor #beam-places { flex-basis: 100%; min-width: 0; } .beam-editor .launch-editor, .beam-editor .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .beam-editor .launch-fields { flex-basis: 100%; min-width: 0; } .beam-editor [hidden] { display: none !important; } .beam-editor select { min-width: 0; width: 100%; } .beam-editor .launch-intro { flex-basis: 100%; margin: 0; } .beam-editor .launch-track { flex-basis: 100%; margin: 0; } .beam-editor .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .beam-editor .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .beam-editor input, .beam-editor select { max-width: 100%; box-sizing: border-box; } .beam-editor input[type="text"] { width: 12em; } .beam-editor #launch-title { width: 18em; } .beam-editor label { min-width: 0; max-width: 100%; } .beam-editor input.parameter-derived::placeholder { opacity: .65; } .beam-editor .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([A.load(e),O.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;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;if(this.element("beam-fields").hidden=t===void 0,!t)return;const i={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.form??=new p(this.element("beam-parameters"),this.language,"beam.",i),this.form.show(this.resolved(h.SET),this.targetOfBeam(),()=>this.written()),this.syncDetail(!0)}refresh(){if(!this.messages)return;this.syncAddState();const e=this.beams;if(e.length===this.shown.length&&e.every((t,i)=>t.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}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.messages&&(this.currentId=e,this.row="on",this.lightIndex=void 0,this.moveIndex=void 0,this.placeIndex=0,this.sync())}resolved(e){return L.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
2
2
  <p class="launch-intro">${e.intro}</p>
3
3
  <div id="beam-list"></div>
4
4
  <div id="beam-fields" class="launch-fields">
@@ -1 +1 @@
1
- import{am as V,aC as W,aD as H,ap as X,aE as v,aF as D,aG as k}from"./rr0-sighting-editor.mjs";import{L as S}from"./LaserBeam-D5ZQPR6m.js";class x{static MAX_SEGMENTS=12e3;static MIN_PIXELS=2;static VERTICES_PER_SEGMENT=24;static HALO_RAD=.002;static HALO_SHARE=.15;static BRIGHTEST_RELATIVE=6e4;group=new V;mesh;positions=new Float32Array(x.MAX_SEGMENTS*x.VERTICES_PER_SEGMENT*3);colors=new Float32Array(x.MAX_SEGMENTS*x.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new W;s.setAttribute("position",new H(this.positions,3)),s.setAttribute("color",new H(this.colors,3)),s.setDrawRange(0,0),this.mesh=new X(s,new v({vertexColors:!0,transparent:!0,blending: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}get object(){return this.group}get drawnCount(){return this.segments}pick(s,t,e){return this.pickAt(s,t,e.toleranceRad)}update(s,t,e){const l=this.viewsOf(s,t,e);let r=0;this.segments=0,this.drawn=[];for(const h of l){const c=S.colourOf(h.wavelengthNm),i=this.place(h,t,e);this.drawn.push({id:h.id,points:i});for(let y=0;y+1<i.length&&!(this.segments>=x.MAX_SEGMENTS);y++){const E=this.pushSegment(r,i[y],i[y+1],h.wavelengthNm,c,e);E>r&&this.segments++,r=E}}const o=this.mesh.geometry;o.setDrawRange(0,r);for(const h of["position","color"]){const c=o.getAttribute(h);c.clearUpdateRanges(),r>0&&c.addUpdateRange(0,r*3),c.needsUpdate=!0}}viewsOf(s,t,e){const{lat:l,lng:r}=e.reference;(!this.cut||this.cut.lat!==l||this.cut.lng!==r||this.cut.air!==e.air)&&(this.cut={lat:l,lng:r,air:e.air,views:new Map});const o=this.cut.views,h=new Set(s);return S.onAt(s,t).map(c=>{if(!h.has(c))return S.viewOf(c,e.reference,e.air);let i=o.get(c);return i||o.set(c,i=S.viewOf(c,e.reference,e.air)),i})}place(s,t,e){const l=[],r=e.wind??{eastMS:0,northMS:0};for(const o of s.samples){const h=e.origin.x+o.eastM*e.eastScale,c=e.origin.z-o.northM,i=o.upM-e.siteElevationM;if(l.length>0&&i<e.groundYAt(h,c))break;const y=r.eastMS*o.dirEast+r.northMS*o.dirNorth,E=r.eastMS*o.dirNorth-r.northMS*o.dirEast,g=S.patchAt(o.fromSourceM,t,{windAlongMS:y,windAcrossMS:E,patchiness:s.patchiness});l.push({x:h,y:i,z:c,altitudeM:o.altitudeM,widthM:o.widthM,powerW:o.powerW,haze:g})}return l}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,e,l,r,o,h=0){const c={x:e.x-t.x,y:e.y-t.y,z:e.z-t.z},i=Math.hypot(c.x,c.y,c.z);if(i<1e-6)return s;const y={x:c.x/i,y:c.y/i,z:c.z/i};if(Math.hypot((t.x+e.x)/2-o.eye.x,(t.y+e.y)/2-o.eye.y,(t.z+e.z)/2-o.eye.z)<.001)return s;const E=n=>{const u={x:o.eye.x-n.x,y:o.eye.y-n.y,z:o.eye.z-n.z},z=Math.hypot(u.x,u.y,u.z)||.001,p=(y.x*u.x+y.y*u.y+y.z*u.z)/z,a=Math.sqrt(Math.max(0,1-p*p)),w=S.coefficientsAt(o.air,l,n.altitudeM),d=S.phasedScattering({...w,aerosolPerM:w.aerosolPerM*n.haze},p);return{sinTurn:a,scattered:d,through:o.transmittanceTo(n.x,n.y,n.z)}},g=n=>x.MIN_PIXELS*o.pixelRad*Math.hypot(n.x-o.eye.x,n.y-o.eye.y,n.z-o.eye.z),N=n=>Math.hypot(n.x-o.eye.x,n.y-o.eye.y,n.z-o.eye.z),R=n=>Math.max(n.widthM,x.HALO_RAD*N(n)),f=n=>{const u=R(n)/g(n),z=Math.min(1,Math.max(0,u-1));return x.HALO_SHARE*z*z*(3-2*z)},O=new Map([t,e].map(n=>[n,E(n)])),M=(n,u,z)=>{const p=Math.max(u,g(n)),{sinTurn:a,scattered:w,through:d}=O.get(n),I=2*z*S.luminanceCdM2(n.powerW,l,w,p,a),L=r.map((P,m)=>Math.min(x.BRIGHTEST_RELATIVE,I*o.relativeScale*P*d[m])),_={x:o.eye.x-n.x,y:o.eye.y-n.y,z:o.eye.z-n.z},C=this.normalise(this.cross(y,_));return{point:n,half:p/2,level:L,across:C}},A=[[M(t,t.widthM,1-f(t)),M(e,e.widthM,1-f(e))],[M(t,R(t),f(t)),M(e,R(e),f(e))]],[G,T]=A[0].map(n=>Math.max(...n.level));if(h<x.MAX_HALVINGS&&Math.max(G,T)>x.SMOOTH_RATIO*Math.max(Math.min(G,T),1e-12)){const n={x:(t.x+e.x)/2,y:(t.y+e.y)/2,z:(t.z+e.z)/2,altitudeM:(t.altitudeM+e.altitudeM)/2,widthM:(t.widthM+e.widthM)/2,powerW:Math.sqrt(t.powerW*e.powerW),haze:(t.haze+e.haze)/2};return this.pushSegment(this.pushSegment(s,t,n,l,r,o,h+1),n,e,l,r,o,h+1)}if((s+x.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const n of A){if(n.every(a=>Math.max(...a.level)<=0))continue;const u=(a,w)=>{const d=s*3;this.positions[d]=a.point.x+a.across.x*a.half*w,this.positions[d+1]=a.point.y+a.across.y*a.half*w,this.positions[d+2]=a.point.z+a.across.z*a.half*w;const I=w===0?1:0;this.colors[d]=a.level[0]*I,this.colors[d+1]=a.level[1]*I,this.colors[d+2]=a.level[2]*I,s++},[z,p]=n;for(const a of[-1,1])u(z,a),u(z,0),u(p,a),u(z,0),u(p,0),u(p,a)}return s}pickAt(s,t,e){let l;for(const r of this.drawn)for(let o=0;o+1<r.points.length;o++){const h=r.points[o],c=r.points[o+1],i={x:c.x-h.x,y:c.y-h.y,z:c.z-h.z},y={x:h.x-s.x,y:h.y-s.y,z:h.z-s.z},E=i.x*i.x+i.y*i.y+i.z*i.z,g=i.x*t.x+i.y*t.y+i.z*t.z,N=i.x*y.x+i.y*y.y+i.z*y.z,R=t.x*y.x+t.y*y.y+t.z*y.z,f=E-g*g,O=f>1e-9?Math.min(1,Math.max(0,(g*R-N)/f)):0,M={x:h.x+i.x*O,y:h.y+i.y*O,z:h.z+i.z*O},A=(M.x-s.x)*t.x+(M.y-s.y)*t.y+(M.z-s.z)*t.z;if(A<=0)continue;const G=Math.hypot(M.x-s.x-t.x*A,M.y-s.y-t.y*A,M.z-s.z-t.z*A),T=Math.atan2(G,A);T<=e&&(!l||T<l.angle)&&(l={id:r.id,distanceM:Math.hypot(M.x-s.x,M.y-s.y,M.z-s.z),angle:T})}return l&&{id:l.id,distanceM:l.distanceM}}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.group.removeFromParent()}}export{x as BeamSystem};
1
+ import{am as V,aD as W,aE as N,ap as X,aF as v,aG as D,aH as k}from"./rr0-sighting-editor.mjs";import{L as S}from"./LaserBeam-DOGz1dOz.js";class x{static MAX_SEGMENTS=12e3;static MIN_PIXELS=2;static VERTICES_PER_SEGMENT=24;static HALO_RAD=.002;static HALO_SHARE=.15;static BRIGHTEST_RELATIVE=6e4;group=new V;mesh;positions=new Float32Array(x.MAX_SEGMENTS*x.VERTICES_PER_SEGMENT*3);colors=new Float32Array(x.MAX_SEGMENTS*x.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new W;s.setAttribute("position",new N(this.positions,3)),s.setAttribute("color",new N(this.colors,3)),s.setDrawRange(0,0),this.mesh=new X(s,new v({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}get object(){return this.group}get drawnCount(){return this.segments}pick(s,t,e){return this.pickAt(s,t,e.toleranceRad)}update(s,t,e){const l=this.viewsOf(s,t,e);let r=0;this.segments=0,this.drawn=[];for(const h of l){const c=S.colourOf(h.wavelengthNm),i=this.place(h,t,e);this.drawn.push({id:h.id,points:i});for(let y=0;y+1<i.length&&!(this.segments>=x.MAX_SEGMENTS);y++){const E=this.pushSegment(r,i[y],i[y+1],h.wavelengthNm,c,e);E>r&&this.segments++,r=E}}const o=this.mesh.geometry;o.setDrawRange(0,r);for(const h of["position","color"]){const c=o.getAttribute(h);c.clearUpdateRanges(),r>0&&c.addUpdateRange(0,r*3),c.needsUpdate=!0}}viewsOf(s,t,e){const{lat:l,lng:r}=e.reference;(!this.cut||this.cut.lat!==l||this.cut.lng!==r||this.cut.air!==e.air)&&(this.cut={lat:l,lng:r,air:e.air,views:new Map});const o=this.cut.views,h=new Set(s);return S.onAt(s,t).map(c=>{if(!h.has(c))return S.viewOf(c,e.reference,e.air);let i=o.get(c);return i||o.set(c,i=S.viewOf(c,e.reference,e.air)),i})}place(s,t,e){const l=[],r=e.wind??{eastMS:0,northMS:0};for(const o of s.samples){const h=e.origin.x+o.eastM*e.eastScale,c=e.origin.z-o.northM,i=o.upM-e.siteElevationM;if(l.length>0&&i<e.groundYAt(h,c))break;const y=r.eastMS*o.dirEast+r.northMS*o.dirNorth,E=r.eastMS*o.dirNorth-r.northMS*o.dirEast,g=S.patchAt(o.fromSourceM,t,{windAlongMS:y,windAcrossMS:E,patchiness:s.patchiness});l.push({x:h,y:i,z:c,altitudeM:o.altitudeM,widthM:o.widthM,powerW:o.powerW,haze:g})}return l}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,e,l,r,o,h=0){const c={x:e.x-t.x,y:e.y-t.y,z:e.z-t.z},i=Math.hypot(c.x,c.y,c.z);if(i<1e-6)return s;const y={x:c.x/i,y:c.y/i,z:c.z/i};if(Math.hypot((t.x+e.x)/2-o.eye.x,(t.y+e.y)/2-o.eye.y,(t.z+e.z)/2-o.eye.z)<.001)return s;const E=n=>{const u={x:o.eye.x-n.x,y:o.eye.y-n.y,z:o.eye.z-n.z},z=Math.hypot(u.x,u.y,u.z)||.001,p=(y.x*u.x+y.y*u.y+y.z*u.z)/z,a=Math.sqrt(Math.max(0,1-p*p)),w=S.coefficientsAt(o.air,l,n.altitudeM),d=S.phasedScattering({...w,aerosolPerM:w.aerosolPerM*n.haze},p);return{sinTurn:a,scattered:d,through:o.transmittanceTo(n.x,n.y,n.z)}},g=n=>x.MIN_PIXELS*o.pixelRad*Math.hypot(n.x-o.eye.x,n.y-o.eye.y,n.z-o.eye.z),H=n=>Math.hypot(n.x-o.eye.x,n.y-o.eye.y,n.z-o.eye.z),R=n=>Math.max(n.widthM,x.HALO_RAD*H(n)),f=n=>{const u=R(n)/g(n),z=Math.min(1,Math.max(0,u-1));return x.HALO_SHARE*z*z*(3-2*z)},O=new Map([t,e].map(n=>[n,E(n)])),M=(n,u,z)=>{const p=Math.max(u,g(n)),{sinTurn:a,scattered:w,through:d}=O.get(n),I=2*z*S.luminanceCdM2(n.powerW,l,w,p,a),L=r.map((C,m)=>Math.min(x.BRIGHTEST_RELATIVE,I*o.relativeScale*C*d[m])),_={x:o.eye.x-n.x,y:o.eye.y-n.y,z:o.eye.z-n.z},P=this.normalise(this.cross(y,_));return{point:n,half:p/2,level:L,across:P}},A=[[M(t,t.widthM,1-f(t)),M(e,e.widthM,1-f(e))],[M(t,R(t),f(t)),M(e,R(e),f(e))]],[G,T]=A[0].map(n=>Math.max(...n.level));if(h<x.MAX_HALVINGS&&Math.max(G,T)>x.SMOOTH_RATIO*Math.max(Math.min(G,T),1e-12)){const n={x:(t.x+e.x)/2,y:(t.y+e.y)/2,z:(t.z+e.z)/2,altitudeM:(t.altitudeM+e.altitudeM)/2,widthM:(t.widthM+e.widthM)/2,powerW:Math.sqrt(t.powerW*e.powerW),haze:(t.haze+e.haze)/2};return this.pushSegment(this.pushSegment(s,t,n,l,r,o,h+1),n,e,l,r,o,h+1)}if((s+x.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const n of A){if(n.every(a=>Math.max(...a.level)<=0))continue;const u=(a,w)=>{const d=s*3;this.positions[d]=a.point.x+a.across.x*a.half*w,this.positions[d+1]=a.point.y+a.across.y*a.half*w,this.positions[d+2]=a.point.z+a.across.z*a.half*w;const I=w===0?1:0;this.colors[d]=a.level[0]*I,this.colors[d+1]=a.level[1]*I,this.colors[d+2]=a.level[2]*I,s++},[z,p]=n;for(const a of[-1,1])u(z,a),u(z,0),u(p,a),u(z,0),u(p,0),u(p,a)}return s}pickAt(s,t,e){let l;for(const r of this.drawn)for(let o=0;o+1<r.points.length;o++){const h=r.points[o],c=r.points[o+1],i={x:c.x-h.x,y:c.y-h.y,z:c.z-h.z},y={x:h.x-s.x,y:h.y-s.y,z:h.z-s.z},E=i.x*i.x+i.y*i.y+i.z*i.z,g=i.x*t.x+i.y*t.y+i.z*t.z,H=i.x*y.x+i.y*y.y+i.z*y.z,R=t.x*y.x+t.y*y.y+t.z*y.z,f=E-g*g,O=f>1e-9?Math.min(1,Math.max(0,(g*R-H)/f)):0,M={x:h.x+i.x*O,y:h.y+i.y*O,z:h.z+i.z*O},A=(M.x-s.x)*t.x+(M.y-s.y)*t.y+(M.z-s.z)*t.z;if(A<=0)continue;const G=Math.hypot(M.x-s.x-t.x*A,M.y-s.y-t.y*A,M.z-s.z-t.z*A),T=Math.atan2(G,A);T<=e&&(!l||T<l.angle)&&(l={id:r.id,distanceM:Math.hypot(M.x-s.x,M.y-s.y,M.z-s.z),angle:T})}return l&&{id:l.id,distanceM:l.distanceM}}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.group.removeFromParent()}}export{x as BeamSystem};
@@ -1,4 +1,4 @@
1
- import{o as k,_ as c,aB as u,az as y,a1 as O,a3 as x,a2 as T,c as w,$ as M,a0 as I,a4 as F,a5 as A}from"./rr0-sighting-editor.mjs";import{S}from"./SkyEventEditorStyle-CvY_AhbI.js";import{B as v,a as m,F as E}from"./BirdFlock-CSw6ge15.js";const L=k.catalog({en:()=>c(()=>import("./BirdParameterTexts_en-C6FkYUww.js"),[],import.meta.url).then(l=>l.birdParameterTexts_en),fr:()=>c(()=>import("./BirdParameterTexts_fr-BiTR-olu.js"),[],import.meta.url).then(l=>l.birdParameterTexts_fr),es:()=>c(()=>import("./BirdParameterTexts_es-T8JyeNlI.js"),[],import.meta.url).then(l=>l.birdParameterTexts_es),it:()=>c(()=>import("./BirdParameterTexts_it-oQY4DX6B.js"),[],import.meta.url).then(l=>l.birdParameterTexts_it)});class n{static FLOCK="flock";static FORMATION="formation";static FLIGHT="flight";static LOOK="look";static speciesOf(t){return v.speciesOf(t)}static speciesLabel(t){return t.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}static formationOf(t){const e=u.read(t,"formation.kind");return typeof e=="string"?e:n.formationUnstated(t)}static formationUnstated(t){return(u.read(t,"count")??1)>1?"cluster":"single"}static flightOf(t){const e=u.read(t,"flight.kind");return typeof e=="string"?e:n.speciesOf(t).flight.kind}static burstOf(t,e){const i=u.read(t,`flight.${e}`);if(typeof i=="number")return i;const s=n.speciesOf(t).flight;return s.kind==="flapping"?n.BURST[e]:s[e]}static BURST={beats:4,glideS:2};static colour(t,e,i){return{type:"colour",key:`colours.${t}`,group:n.LOOK,label:e,...i?{hint:i}:{},effective:s=>m.colourOf(n.speciesOf(s),t)}}static SET={kind:"birds",title:"birds",parameters:[{type:"said",key:"title",label:"name",group:n.FLOCK},{type:"choice",key:"species",required:!0,group:n.FLOCK,label:"species",choices:m.ALL.map(t=>({value:t.id,label:n.speciesLabel(t.id)}))},{type:"number",key:"count",min:1,max:2e3,step:1,group:n.FLOCK,effective:()=>1,label:"howMany"},{type:"set",key:"explains",group:n.FLOCK,label:"standForTheShapes",hint:"theWholeFlockTakenForOne",visibleWhen:t=>t.explainsEach===void 0,options:(t,e)=>{const i=e?.shapes??[],s=(t.explains??[]).filter(o=>!i.some(a=>a.value===o));return[...i,...s.map(o=>({value:o,label:o}))]},empty:"noShape"},{type:"number",key:"seed",min:0,max:4294967295,step:1,group:n.FLOCK,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFrom"},{type:"choice",key:"formation.kind",group:n.FORMATION,label:"pattern",effective:t=>n.formationUnstated(t),choices:[{value:"single",label:"oneBird"},{value:"v",label:"inAV"},{value:"j",label:"inAJ"},{value:"echelon",label:"inEchelon"},{value:"column",label:"inAColumn"},{value:"front",label:"abreast"},{value:"cluster",label:"aLooseCrowd"},{value:"flock",label:"aFlockThatFliesItself"}]},{type:"number",key:"formation.angleDeg",min:5,max:180,step:1,unit:"°",group:n.FORMATION,effective:()=>70,label:"angleBetweenTheArms",hint:"aGooseVMeasures",visibleWhen:t=>["v","j"].includes(n.formationOf(t))},{type:"number",key:"formation.asymmetry",min:0,max:100,step:5,unit:"%",scale:100,group:n.FORMATION,effective:()=>.7,label:"onTheRightArm",visibleWhen:t=>n.formationOf(t)==="j"},{type:"number",key:"formation.spacing",min:.2,max:20,step:.1,group:n.FORMATION,effective:t=>["v","j","echelon","column"].includes(n.formationOf(t))?1:1.5,label:"spacingInWingspans",hint:"betweenNeighbours",visibleWhen:t=>n.formationOf(t)!=="single"},{type:"number",key:"formation.wander",min:0,max:5,step:.05,group:n.FORMATION,effective:t=>["v","j","echelon","column"].includes(n.formationOf(t))?.15:.4,label:"strayInWingspans",hint:"howMuchEachBirdStrays",visibleWhen:t=>!["single","flock"].includes(n.formationOf(t))},{type:"number",key:"formation.informed",min:0,max:100,step:1,unit:"%",scale:100,group:n.FORMATION,effective:()=>E.INFORMED_SHARE,label:"informed",hint:"aFewKnowWhereTheFlockIsGoing",visibleWhen:t=>n.formationOf(t)==="flock"},{type:"number",key:"wingbeatHz",min:.5,max:30,step:.01,unit:"Hz",group:n.FLIGHT,effective:t=>{const e=t,i=v.pathOf(e)[0]?.upM??0;return Math.round(m.wingbeatHz(n.speciesOf(t),m.airDensityAt((e.originElevationM??0)+i))*100)/100},label:"wingbeat",hint:"predictedFromItsSpecies"},{type:"choice",key:"flight.kind",group:n.FLIGHT,label:"howTheyFly",effective:t=>n.speciesOf(t).flight.kind,choices:[{value:"flapping",label:"flappingAllTheTime"},{value:"bursts",label:"inBurstsAndGlides"},{value:"path",label:"asTheirPathAsks"}]},{type:"number",key:"flight.beats",min:1,max:50,step:1,group:n.FLIGHT,label:"wingbeatsABurst",effective:t=>n.burstOf(t,"beats"),visibleWhen:t=>n.flightOf(t)!=="flapping"},{type:"number",key:"flight.glideS",min:0,max:60,step:.1,unit:"s",group:n.FLIGHT,label:"glideBetween",effective:t=>n.burstOf(t,"glideS"),visibleWhen:t=>n.flightOf(t)!=="flapping"},{type:"number",key:"originElevationM",min:-500,max:6e3,step:1,unit:"m",group:n.FLIGHT,effective:()=>0,label:"thePlaceSGroundAboveTheSea",hint:"whatSetsHowThinTheAir"},n.colour("upperColor","upperSide","theBackAndTheUpperSide"),n.colour("underColor","underSide","theBellyAndTheUnderSide"),n.colour("tipColor","wingTips"),n.colour("headColor","head"),n.colour("neckColor","neck"),n.colour("billColor","bill"),{type:"number",key:"lightFromBelow.lux",min:0,max:1e4,step:.1,unit:"lx",group:n.LOOK,effective:()=>0,label:"litFromBelow",hint:"theLampsOfATown"},{type:"colour",key:"lightFromBelow.color",group:n.LOOK,fallback:"#ffd7a0",label:"lightFromBelowColour",visibleWhen:t=>typeof u.read(t,"lightFromBelow.lux")=="number"}]};static angular(t){return typeof t.azimuthDeg=="number"}static WAYPOINT={kind:"birds-waypoint",title:"pointOfThePath",parameters:[{type:"number",key:"t",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecording"},{type:"position",key:"eastM",secondKey:"northM",saidKey:"saidPosition",native:"local",step:1,rangeM:1e5,label:"position",visibleWhen:t=>!n.angular(t)},{type:"number",key:"altitudeM",min:-500,max:1e4,step:.1,unit:"m",required:!0,label:"height",hint:"aboveTheGroundOfThePlace",visibleWhen:t=>!n.angular(t)},{type:"number",key:"azimuthDeg",min:0,max:360,step:.1,unit:"°",required:!0,label:"azimuth",visibleWhen:t=>n.angular(t)},{type:"number",key:"altitudeDeg",min:-90,max:90,step:.1,unit:"°",required:!0,label:"elevation",visibleWhen:t=>n.angular(t)},{type:"number",key:"distanceM",min:0,max:1e5,step:1,unit:"m",required:!0,label:"distance",visibleWhen:t=>n.angular(t)},{type:"number",key:"eyeHeightM",min:0,max:1e4,step:.1,unit:"m",effective:()=>1.6,label:"eyeHeight",visibleWhen:t=>n.angular(t)}]};static waypointAt(t,e){const i=v.pathOf(t),s=g=>Math.round(g*10)/10;if(i.length===0)return{t:e,eastM:0,northM:0,altitudeM:0};const o=i.findIndex(g=>g.t>=e),[a,r]=o<=0?[i[Math.max(o,0)],i[Math.max(o,0)]]:[i[o-1],i[o]],h=o<0?i[i.length-1]:void 0,p=h||r.t===a.t?0:(e-a.t)/(r.t-a.t),d=h??a,b=h??r;return{t:Math.round(e),eastM:s(d.eastM+(b.eastM-d.eastM)*p),northM:s(d.northM+(b.northM-d.northM)*p),altitudeM:s(d.upM+(b.upM-d.upM)*p)}}static publish(){y.publish(n.SET),y.publish(n.WAYPOINT)}}const R=k.catalog({en:()=>c(()=>import("./BirdEditorMessages_en-CN1OJud9.js"),[],import.meta.url).then(l=>l.birdEditorMessages_en),fr:()=>c(()=>import("./BirdEditorMessages_fr-hL72V8wm.js"),[],import.meta.url).then(l=>l.birdEditorMessages_fr),es:()=>c(()=>import("./BirdEditorMessages_es-DDEnjRrz.js"),[],import.meta.url).then(l=>l.birdEditorMessages_es),it:()=>c(()=>import("./BirdEditorMessages_it-BmLyiPYp.js"),[],import.meta.url).then(l=>l.birdEditorMessages_it)});class f{constructor(t,e,i){this.container=t,this.host=e,S.attach(t,"bird-editor-part",f.STYLE),this.language=i,y.of("birds")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;pointForm;pointIndex=0;language;shown=[];static STYLE='.bird-editor-part { flex-basis: 100%; min-width: 0; } .bird-editor-part #bird-list, .bird-editor-part #bird-timeline { flex-basis: 100%; min-width: 0; } .bird-editor-part #bird-timeline { padding: 4px 0; } .bird-editor-part #bird-path > .icon-btn { align-self: flex-end; } .bird-editor-part .launch-editor, .bird-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .bird-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .bird-editor-part [hidden] { display: none !important; } .bird-editor-part select { min-width: 0; width: 100%; } .bird-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .bird-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .bird-editor-part .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .bird-editor-part input, .bird-editor-part select { max-width: 100%; box-sizing: border-box; } .bird-editor-part input[type="text"] { width: 12em; } .bird-editor-part label { min-width: 0; max-width: 100%; } .bird-editor-part input.parameter-derived::placeholder { opacity: .65; } .bird-editor-part .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';static PATH_COLOR="#3b82c4";async setLanguage(t){const e=++this.languageToken;this.language=t;const[i,s]=await Promise.all([R.load(t),L.load(t)]);e===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.flocks;this.shown=[...t],t.some(s=>s.id===this.currentId)||(this.currentId=t[0]?.id),this.list?.setItems(t.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const e=this.current;if(this.element("bird-fields").hidden=e===void 0,!e)return;const i=this.element("bird-each");i.hidden=e.explainsEach===void 0,i.textContent=this.messages.explainsEachNote.replace("{n}",String(e.explainsEach?.length??0)),this.form??=new O(this.element("bird-parameters"),this.language,"birds.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(n.SET),new x(()=>this.current,s=>this.editFlock(o=>s(o)),()=>({shapes:this.host.shapes().map(s=>({value:s.id,label:s.label}))}),this.host.positionPlace?.()),()=>this.written()),this.syncPoint(!0)}refresh(){if(!this.messages)return;this.syncAddState();const t=this.flocks;if(t.length===this.shown.length&&t.every((e,i)=>e.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(t){this.messages&&this.timeline?.setTime(t)}syncAddState(){const t=this.frontOfObserver()!==void 0;this.list?.setAddState(t,t?void 0:this.messages.addNowhere)}get current(){return this.flocks.find(t=>t.id===this.currentId)}resolved(t){return T.resolve(t,this.parameterTexts)}render(){if(!this.messages)return;const t=this.messages;this.form=void 0,this.pointForm=void 0,this.container.innerHTML=`<div class="launch-editor">
1
+ import{o as k,_ as c,aC as u,az as y,a1 as O,a3 as x,a2 as T,c as w,$ as M,a0 as I,a4 as F,a5 as A}from"./rr0-sighting-editor.mjs";import{S}from"./SkyEventEditorStyle-CvY_AhbI.js";import{B as v,a as m,F as E}from"./BirdFlock-CSw6ge15.js";const L=k.catalog({en:()=>c(()=>import("./BirdParameterTexts_en-C6FkYUww.js"),[],import.meta.url).then(l=>l.birdParameterTexts_en),fr:()=>c(()=>import("./BirdParameterTexts_fr-BiTR-olu.js"),[],import.meta.url).then(l=>l.birdParameterTexts_fr),es:()=>c(()=>import("./BirdParameterTexts_es-T8JyeNlI.js"),[],import.meta.url).then(l=>l.birdParameterTexts_es),it:()=>c(()=>import("./BirdParameterTexts_it-oQY4DX6B.js"),[],import.meta.url).then(l=>l.birdParameterTexts_it)});class n{static FLOCK="flock";static FORMATION="formation";static FLIGHT="flight";static LOOK="look";static speciesOf(t){return v.speciesOf(t)}static speciesLabel(t){return t.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}static formationOf(t){const e=u.read(t,"formation.kind");return typeof e=="string"?e:n.formationUnstated(t)}static formationUnstated(t){return(u.read(t,"count")??1)>1?"cluster":"single"}static flightOf(t){const e=u.read(t,"flight.kind");return typeof e=="string"?e:n.speciesOf(t).flight.kind}static burstOf(t,e){const i=u.read(t,`flight.${e}`);if(typeof i=="number")return i;const s=n.speciesOf(t).flight;return s.kind==="flapping"?n.BURST[e]:s[e]}static BURST={beats:4,glideS:2};static colour(t,e,i){return{type:"colour",key:`colours.${t}`,group:n.LOOK,label:e,...i?{hint:i}:{},effective:s=>m.colourOf(n.speciesOf(s),t)}}static SET={kind:"birds",title:"birds",parameters:[{type:"said",key:"title",label:"name",group:n.FLOCK},{type:"choice",key:"species",required:!0,group:n.FLOCK,label:"species",choices:m.ALL.map(t=>({value:t.id,label:n.speciesLabel(t.id)}))},{type:"number",key:"count",min:1,max:2e3,step:1,group:n.FLOCK,effective:()=>1,label:"howMany"},{type:"set",key:"explains",group:n.FLOCK,label:"standForTheShapes",hint:"theWholeFlockTakenForOne",visibleWhen:t=>t.explainsEach===void 0,options:(t,e)=>{const i=e?.shapes??[],s=(t.explains??[]).filter(o=>!i.some(a=>a.value===o));return[...i,...s.map(o=>({value:o,label:o}))]},empty:"noShape"},{type:"number",key:"seed",min:0,max:4294967295,step:1,group:n.FLOCK,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFrom"},{type:"choice",key:"formation.kind",group:n.FORMATION,label:"pattern",effective:t=>n.formationUnstated(t),choices:[{value:"single",label:"oneBird"},{value:"v",label:"inAV"},{value:"j",label:"inAJ"},{value:"echelon",label:"inEchelon"},{value:"column",label:"inAColumn"},{value:"front",label:"abreast"},{value:"cluster",label:"aLooseCrowd"},{value:"flock",label:"aFlockThatFliesItself"}]},{type:"number",key:"formation.angleDeg",min:5,max:180,step:1,unit:"°",group:n.FORMATION,effective:()=>70,label:"angleBetweenTheArms",hint:"aGooseVMeasures",visibleWhen:t=>["v","j"].includes(n.formationOf(t))},{type:"number",key:"formation.asymmetry",min:0,max:100,step:5,unit:"%",scale:100,group:n.FORMATION,effective:()=>.7,label:"onTheRightArm",visibleWhen:t=>n.formationOf(t)==="j"},{type:"number",key:"formation.spacing",min:.2,max:20,step:.1,group:n.FORMATION,effective:t=>["v","j","echelon","column"].includes(n.formationOf(t))?1:1.5,label:"spacingInWingspans",hint:"betweenNeighbours",visibleWhen:t=>n.formationOf(t)!=="single"},{type:"number",key:"formation.wander",min:0,max:5,step:.05,group:n.FORMATION,effective:t=>["v","j","echelon","column"].includes(n.formationOf(t))?.15:.4,label:"strayInWingspans",hint:"howMuchEachBirdStrays",visibleWhen:t=>!["single","flock"].includes(n.formationOf(t))},{type:"number",key:"formation.informed",min:0,max:100,step:1,unit:"%",scale:100,group:n.FORMATION,effective:()=>E.INFORMED_SHARE,label:"informed",hint:"aFewKnowWhereTheFlockIsGoing",visibleWhen:t=>n.formationOf(t)==="flock"},{type:"number",key:"wingbeatHz",min:.5,max:30,step:.01,unit:"Hz",group:n.FLIGHT,effective:t=>{const e=t,i=v.pathOf(e)[0]?.upM??0;return Math.round(m.wingbeatHz(n.speciesOf(t),m.airDensityAt((e.originElevationM??0)+i))*100)/100},label:"wingbeat",hint:"predictedFromItsSpecies"},{type:"choice",key:"flight.kind",group:n.FLIGHT,label:"howTheyFly",effective:t=>n.speciesOf(t).flight.kind,choices:[{value:"flapping",label:"flappingAllTheTime"},{value:"bursts",label:"inBurstsAndGlides"},{value:"path",label:"asTheirPathAsks"}]},{type:"number",key:"flight.beats",min:1,max:50,step:1,group:n.FLIGHT,label:"wingbeatsABurst",effective:t=>n.burstOf(t,"beats"),visibleWhen:t=>n.flightOf(t)!=="flapping"},{type:"number",key:"flight.glideS",min:0,max:60,step:.1,unit:"s",group:n.FLIGHT,label:"glideBetween",effective:t=>n.burstOf(t,"glideS"),visibleWhen:t=>n.flightOf(t)!=="flapping"},{type:"number",key:"originElevationM",min:-500,max:6e3,step:1,unit:"m",group:n.FLIGHT,effective:()=>0,label:"thePlaceSGroundAboveTheSea",hint:"whatSetsHowThinTheAir"},n.colour("upperColor","upperSide","theBackAndTheUpperSide"),n.colour("underColor","underSide","theBellyAndTheUnderSide"),n.colour("tipColor","wingTips"),n.colour("headColor","head"),n.colour("neckColor","neck"),n.colour("billColor","bill"),{type:"number",key:"lightFromBelow.lux",min:0,max:1e4,step:.1,unit:"lx",group:n.LOOK,effective:()=>0,label:"litFromBelow",hint:"theLampsOfATown"},{type:"colour",key:"lightFromBelow.color",group:n.LOOK,fallback:"#ffd7a0",label:"lightFromBelowColour",visibleWhen:t=>typeof u.read(t,"lightFromBelow.lux")=="number"}]};static angular(t){return typeof t.azimuthDeg=="number"}static WAYPOINT={kind:"birds-waypoint",title:"pointOfThePath",parameters:[{type:"number",key:"t",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecording"},{type:"position",key:"eastM",secondKey:"northM",saidKey:"saidPosition",native:"local",step:1,rangeM:1e5,label:"position",visibleWhen:t=>!n.angular(t)},{type:"number",key:"altitudeM",min:-500,max:1e4,step:.1,unit:"m",required:!0,label:"height",hint:"aboveTheGroundOfThePlace",visibleWhen:t=>!n.angular(t)},{type:"number",key:"azimuthDeg",min:0,max:360,step:.1,unit:"°",required:!0,label:"azimuth",visibleWhen:t=>n.angular(t)},{type:"number",key:"altitudeDeg",min:-90,max:90,step:.1,unit:"°",required:!0,label:"elevation",visibleWhen:t=>n.angular(t)},{type:"number",key:"distanceM",min:0,max:1e5,step:1,unit:"m",required:!0,label:"distance",visibleWhen:t=>n.angular(t)},{type:"number",key:"eyeHeightM",min:0,max:1e4,step:.1,unit:"m",effective:()=>1.6,label:"eyeHeight",visibleWhen:t=>n.angular(t)}]};static waypointAt(t,e){const i=v.pathOf(t),s=g=>Math.round(g*10)/10;if(i.length===0)return{t:e,eastM:0,northM:0,altitudeM:0};const o=i.findIndex(g=>g.t>=e),[a,r]=o<=0?[i[Math.max(o,0)],i[Math.max(o,0)]]:[i[o-1],i[o]],h=o<0?i[i.length-1]:void 0,p=h||r.t===a.t?0:(e-a.t)/(r.t-a.t),d=h??a,b=h??r;return{t:Math.round(e),eastM:s(d.eastM+(b.eastM-d.eastM)*p),northM:s(d.northM+(b.northM-d.northM)*p),altitudeM:s(d.upM+(b.upM-d.upM)*p)}}static publish(){y.publish(n.SET),y.publish(n.WAYPOINT)}}const R=k.catalog({en:()=>c(()=>import("./BirdEditorMessages_en-CN1OJud9.js"),[],import.meta.url).then(l=>l.birdEditorMessages_en),fr:()=>c(()=>import("./BirdEditorMessages_fr-hL72V8wm.js"),[],import.meta.url).then(l=>l.birdEditorMessages_fr),es:()=>c(()=>import("./BirdEditorMessages_es-DDEnjRrz.js"),[],import.meta.url).then(l=>l.birdEditorMessages_es),it:()=>c(()=>import("./BirdEditorMessages_it-BmLyiPYp.js"),[],import.meta.url).then(l=>l.birdEditorMessages_it)});class f{constructor(t,e,i){this.container=t,this.host=e,S.attach(t,"bird-editor-part",f.STYLE),this.language=i,y.of("birds")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;pointForm;pointIndex=0;language;shown=[];static STYLE='.bird-editor-part { flex-basis: 100%; min-width: 0; } .bird-editor-part #bird-list, .bird-editor-part #bird-timeline { flex-basis: 100%; min-width: 0; } .bird-editor-part #bird-timeline { padding: 4px 0; } .bird-editor-part #bird-path > .icon-btn { align-self: flex-end; } .bird-editor-part .launch-editor, .bird-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .bird-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .bird-editor-part [hidden] { display: none !important; } .bird-editor-part select { min-width: 0; width: 100%; } .bird-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .bird-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .bird-editor-part .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .bird-editor-part input, .bird-editor-part select { max-width: 100%; box-sizing: border-box; } .bird-editor-part input[type="text"] { width: 12em; } .bird-editor-part label { min-width: 0; max-width: 100%; } .bird-editor-part input.parameter-derived::placeholder { opacity: .65; } .bird-editor-part .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';static PATH_COLOR="#3b82c4";async setLanguage(t){const e=++this.languageToken;this.language=t;const[i,s]=await Promise.all([R.load(t),L.load(t)]);e===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.flocks;this.shown=[...t],t.some(s=>s.id===this.currentId)||(this.currentId=t[0]?.id),this.list?.setItems(t.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const e=this.current;if(this.element("bird-fields").hidden=e===void 0,!e)return;const i=this.element("bird-each");i.hidden=e.explainsEach===void 0,i.textContent=this.messages.explainsEachNote.replace("{n}",String(e.explainsEach?.length??0)),this.form??=new O(this.element("bird-parameters"),this.language,"birds.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(n.SET),new x(()=>this.current,s=>this.editFlock(o=>s(o)),()=>({shapes:this.host.shapes().map(s=>({value:s.id,label:s.label}))}),this.host.positionPlace?.()),()=>this.written()),this.syncPoint(!0)}refresh(){if(!this.messages)return;this.syncAddState();const t=this.flocks;if(t.length===this.shown.length&&t.every((e,i)=>e.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(t){this.messages&&this.timeline?.setTime(t)}syncAddState(){const t=this.frontOfObserver()!==void 0;this.list?.setAddState(t,t?void 0:this.messages.addNowhere)}get current(){return this.flocks.find(t=>t.id===this.currentId)}resolved(t){return T.resolve(t,this.parameterTexts)}render(){if(!this.messages)return;const t=this.messages;this.form=void 0,this.pointForm=void 0,this.container.innerHTML=`<div class="launch-editor">
2
2
  <p class="launch-intro">${t.intro}</p>
3
3
  <div id="bird-list"></div>
4
4
  <div id="bird-fields" class="launch-fields">
@@ -62,4 +62,4 @@ ${o.join(`
62
62
  `)}
63
63
  </body>
64
64
  </html>
65
- `}static comparedTable(t,n){const a=n.texts.columns,s=z.escape;return z.table([a.reading,a.reads,a.reproduced,a.gap,a.robustness,a.supposedCount],t.readings.map(i=>{const e=n.robustness(i.sensitivity);return[s(i.title),s(i.reads),`<span class="n">${n.reproduced(i.sensitivity)}</span>`,n.degrees(i.sensitivity?.medianSeparationDeg),`<span class="${e.kind}">${s(e.text)}</span>`,String(i.supposed.length)]}),[2,3,5])}static witness(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h3>${e(a.fill(s.witnessHeading,{witness:t.title}))}</h3>`],o=[[s.columns.time,t.time??""],[s.place,t.place??""],[s.duration,t.durationSeconds!==void 0?a.instant(t.durationSeconds*1e3):""],[s.instrument,t.instrument??""]].filter(([,m])=>m!=="");o.length&&r.push(`<dl class="facts">${o.map(([m,d])=>`<dt>${e(m)}</dt><dd>${e(d)}</dd>`).join("")}</dl>`),t.description&&r.push(`<h4>${e(s.account)}</h4>`,`<blockquote>${e(t.description)}</blockquote>`),t.sources.length&&r.push(`<h4>${e(s.sources)}</h4>`,`<ul class="sources">${t.sources.map(m=>`<li>${[m.authors?.join(", "),m.title?`<em>${e(m.title)}</em>`:"",m.publisher,m.time,m.index].filter(Boolean).map(g=>g.startsWith("<em>")?g:e(g)).join(", ")}${m.url?` <a href="${e(m.url)}">${e(m.url)}</a>`:""}</li>`).join("")}</ul>`);const u=S.svg(t,a);u&&r.push(`<figure>${u}<figcaption>${e(s.timelineCaption)}</figcaption></figure>`),n=n.filter(m=>m.comparisons.length>0);const p=D.svg(t,n,a);if(p){const m=[`<li><svg viewBox="0 0 14 14" width="14" height="14" aria-hidden="true"><circle cx="7" cy="7" r="4" fill="#111827"/></svg>${e(s.saidLegend)}</li>`,...n.map((d,g)=>`<li>${D.legendMark(g)}${e(d.title)}</li>`)];r.push(`<figure>${p}<ul class="legend">${m.join("")}</ul><figcaption>${e(s.figureCaption)}</figcaption></figure>`)}if(t.pictures?.length){const m=t.pictures[0].views.map(d=>d.label);r.push(`<h4>${e(s.pictures)}</h4>`,`<div class="scroll"><table class="pictures"><thead><tr><th scope="col">${e(s.columns.instant)}</th>${m.map(d=>`<th scope="col">${e(d)}</th>`).join("")}</tr></thead><tbody>${t.pictures.map(d=>`<tr><td class="n">${a.instant(d.t)}</td>${d.views.map(g=>`<td>${g.image?`<img src="${g.image}" alt="${e(g.label)}, ${a.instant(d.t)}">`:`<span class="nothing">${e(s.noPicture)}</span>`}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`,`<p class="caption">${e(s.picturesCaption)}</p>`)}r.push(`<h4>${e(s.indications)}</h4>`),t.indications.length===0?r.push(`<p>${e(s.noIndication)}</p>`):r.push(z.table([i.instant,i.phenomenon,i.azimuth,i.altitude,i.uncertainty,i.size,i.basis,i.rests],t.indications.map(m=>{const d=m.uncertainty;return[a.instant(m.t),e(m.phenomenon??m.sourceId),m.directionSaid?a.azimuth(m.aim?.azimuthDeg):"",m.directionSaid?a.degrees(m.aim?.altitudeDeg):"",d?`${a.azimuth(d.azimuthDeg[0])} … ${a.azimuth(d.azimuthDeg[1])} ; ${a.degrees(d.altitudeDeg[0])} … ${a.degrees(d.altitudeDeg[1])}`:"",m.sizeSaid?a.degrees(m.angular?.widthDeg):"",m.basis?e(s.bases[m.basis]):"",e(a.rests(m))]}),[0,2,3,5]));const l=t.values.filter(m=>!/^timeline\.keyframes\.\d+\.shapes\.\d+\.shape\.(aim|angular)/.test(m.path));return l.length>0&&r.push(`<h4>${e(s.values)}</h4>`,z.valuesTable(l,a)),r}static reading(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h2>${e(a.fill(s.readingHeading,{title:t.title,witness:t.reads}))}</h2>`],c=[t.by.length?a.fill(s.by,{names:t.by.join(", ")}):"",t.time?a.fill(s.made,{time:t.time}):""].filter(Boolean).join(" ");c&&r.push(`<p class="meta">${e(c)}</p>`),t.description&&r.push(`<blockquote>${e(t.description)}</blockquote>`),r.push(`<h4>${e(s.supposed)}</h4>`,t.supposed.length?z.valuesTable(t.supposed,a):`<p>${e(s.noneSupposed)}</p>`),r.push(`<h4>${e(s.findings)}</h4>`),r.push(t.findings.length?z.table([i.finding,i.outcome,i.against,i.origin],t.findings.map(u=>[e(u.text),`<span class="${u.outcome}">${e(s.outcomes[u.outcome])}</span>`,u.outcome==="fails"?e(s.grounds[u.against??"established"]):"",e(s.origins[u.written?"written":"computed"])])):`<p>${e(s.noFinding)}</p>`);const o=t.sensitivity;if(o){const u=a.robustness(o);if(r.push(`<h4>${e(s.sensitivity)}</h4>`,`<p>${e(i.reproduced)} : ${a.reproduced(o)||"–"} · ${e(i.gap)} : ${a.degrees(o.medianSeparationDeg)||"–"} · <span class="${u.kind}">${e(u.text)}</span></p>`),u.kind!=="too-few"&&u.kind!=="nothing"&&o.margins.length>0&&r.push(z.table([i.knob,i.from,i.to,i.reference,i.covered],o.margins.map(p=>{const l=a.ends(p),m=p.reference?`${a.amount(p.knob,p.reference.lower)} … ${a.amount(p.knob,p.reference.upper)}`:s.noLaw;return[e(s.knobs[p.knob]),l.from,l.to,e(m),p.coverage===void 0?"":`${Math.round(p.coverage*100)} %`]}),[1,2,4])),o.better){const{knob:p,amount:l,agreement:m}=o.better;r.push(`<p class="fine-tuned">${e(a.fill(s.better,{knob:s.knobs[p],amount:a.amount(p,l),agreed:String(Math.round(m*o.compared)),compared:String(o.compared)}))}</p>`)}}return t.comparisons.length>0&&r.push(`<h4>${e(s.comparisons)}</h4>`,z.table([i.instant,i.phenomenon,`${i.said} (${i.azimuth}, ${i.altitude})`,`${i.read} (${i.azimuth}, ${i.altitude})`,i.separation,i.agrees],t.comparisons.map(u=>[a.instant(u.t),e(n?.phenomena?.[u.sourceId]??u.sourceId),u.said?`${a.azimuth(u.said.azimuthDeg)}, ${a.degrees(u.said.altitudeDeg)}`:"",`${a.azimuth(u.predicted.azimuthDeg)}, ${a.degrees(u.predicted.altitudeDeg)}`,a.degrees(u.separationDeg),`<span class="${u.agrees?"holds":"fails"}">${e(u.agrees?s.yes:s.no)}</span>`]),[0,4])),r}static valuesTable(t,n){const a=n.texts,s=a.columns,i=z.escape;return z.table([s.path,s.value,s.basis,s.rests],t.map(e=>[`<code>${i(e.path)}</code>`,i(n.value(e)),i(a.bases[e.basis]),i(n.rests(e))]))}static table(t,n,a=[]){const s=z.escape,i=`<tr>${t.map(r=>`<th scope="col">${s(r)}</th>`).join("")}</tr>`,e=n.map(r=>`<tr>${r.map((c,o)=>`<td${a.includes(o)?' class="n"':""}>${c}</td>`).join("")}</tr>`);return`<div class="scroll"><table><thead>${i}</thead><tbody>${e.join("")}</tbody></table></div>`}static escape(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}const _=P.catalog({en:()=>B(()=>import("./CaseReportTexts_en-DlN7p1pC.js"),[],import.meta.url).then(N=>N.caseReportTexts_en),fr:()=>B(()=>import("./CaseReportTexts_fr-B5nP6RlP.js"),[],import.meta.url).then(N=>N.caseReportTexts_fr),es:()=>B(()=>import("./CaseReportTexts_es-CncAEaey.js"),[],import.meta.url).then(N=>N.caseReportTexts_es),it:()=>B(()=>import("./CaseReportTexts_it-Dc-oPmXB.js"),[],import.meta.url).then(N=>N.caseReportTexts_it)});class U{static async make(t,n,a,s,i=!1,e){const[r,c]=await Promise.all([_.load(a),J.load(a)]),o=j.of(n.caseJson,n.caseUrl,n.recordings,new C([...s]),new F(c));i&&t!=="csv"&&await U.pictures(o,n,r,e);const u=`${n.caseJson.id??"case"}-report`;switch(t){case"html":U.download(new Blob([z.of(o,r,a,"0.188.0")],{type:"text/html"}),`${u}.html`);return;case"print":U.print(z.of(o,r,a,"0.188.0"));return;case"json":U.download(new Blob([T.json(o,"0.188.0")],{type:"application/json"}),`${u}.json`);return;case"csv":{const{zipSync:p,strToU8:l}=await B(async()=>{const{zipSync:d,strToU8:g}=await import("./browser-CltifEM0.js");return{zipSync:d,strToU8:g}},[],import.meta.url),m=Object.fromEntries(Object.entries(T.csv(o,r,a)).map(([d,g])=>[d,l(`\uFEFF${g}`)]));U.download(new Blob([p(m)],{type:"application/zip"}),`${u}-tables.zip`)}}}static PICTURED_INSTANTS=3;static async pictures(t,n,a,s){const{registerScene:i,SCENE_ELEMENT_NAME:e}=await B(async()=>{const{registerScene:p,SCENE_ELEMENT_NAME:l}=await import("./rr0-sighting-editor.mjs").then(m=>m.cm);return{registerScene:p,SCENE_ELEMENT_NAME:l}},[],import.meta.url);i();const r=t.witnesses.map(p=>{const l=p.indications.filter(f=>f.directionSaid).map(f=>f.t),m=l.length<=U.PICTURED_INSTANTS?l:[l[0],l[Math.floor(l.length/2)],l[l.length-1]],d=t.readings.filter(f=>f.reads===p.title&&f.comparisons.length>0),g=[{label:a.accountView,url:p.url,reading:void 0},...d.map(f=>({label:f.title,url:p.url,reading:f.url}))];return{witness:p,instants:[...new Set(m)],recordings:g}}).filter(p=>p.instants.length>0),c=r.reduce((p,l)=>p+l.instants.length*l.recordings.length,0);if(c===0)return;const o=document.createElement(e);o.setAttribute("max-pixel-ratio","1"),o.setAttribute("always-live",""),Object.assign(o.style,{position:"fixed",left:"-10000px",top:"0",width:"640px",height:"360px",visibility:"hidden",pointerEvents:"none"}),document.body.appendChild(o);let u=0;s?.(u,c);try{for(const p of r){const l=p.instants.map(d=>({t:d,views:[]})),m=n.recordings.get(p.witness.url);m&&(o.documentUrl=p.witness.url,o.sightingData=m);for(const d of p.recordings){const g=m,f=d.reading?n.recordings.get(d.reading):void 0;for(const w of l){let b;g&&(!d.reading||f)&&(w===l[0]&&(o.interpretation=U.bodiesOf(f??g,d.reading??p.witness.url)),b=await o.pictureAt(w.t,480).catch(()=>{})),w.views.push({label:d.label,...b?{image:b}:{}}),s?.(++u,c)}}p.witness.pictures=l}}finally{o.remove()}}static bodiesOf(t,n){const a=W.strip(t).recording.interpretation;if(a)return{...a,bodies:a.bodies.map(s=>s.model?.url?{...s,model:{...s.model,url:new URL(s.model.url,n).href}}:s)}}static print(t){const n=document.createElement("iframe");n.setAttribute("aria-hidden","true"),n.style.cssText="position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0",n.addEventListener("load",()=>{const a=n.contentWindow;a&&(a.addEventListener("afterprint",()=>n.remove()),a.focus(),a.print(),window.setTimeout(()=>n.remove(),6e4))},{once:!0}),n.srcdoc=t,document.body.append(n)}static download(t,n){const a=URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download=n,s.click(),window.setTimeout(()=>URL.revokeObjectURL(a),1e3)}}export{U as CaseReportExport};
65
+ `}static comparedTable(t,n){const a=n.texts.columns,s=z.escape;return z.table([a.reading,a.reads,a.reproduced,a.gap,a.robustness,a.supposedCount],t.readings.map(i=>{const e=n.robustness(i.sensitivity);return[s(i.title),s(i.reads),`<span class="n">${n.reproduced(i.sensitivity)}</span>`,n.degrees(i.sensitivity?.medianSeparationDeg),`<span class="${e.kind}">${s(e.text)}</span>`,String(i.supposed.length)]}),[2,3,5])}static witness(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h3>${e(a.fill(s.witnessHeading,{witness:t.title}))}</h3>`],o=[[s.columns.time,t.time??""],[s.place,t.place??""],[s.duration,t.durationSeconds!==void 0?a.instant(t.durationSeconds*1e3):""],[s.instrument,t.instrument??""]].filter(([,m])=>m!=="");o.length&&r.push(`<dl class="facts">${o.map(([m,d])=>`<dt>${e(m)}</dt><dd>${e(d)}</dd>`).join("")}</dl>`),t.description&&r.push(`<h4>${e(s.account)}</h4>`,`<blockquote>${e(t.description)}</blockquote>`),t.sources.length&&r.push(`<h4>${e(s.sources)}</h4>`,`<ul class="sources">${t.sources.map(m=>`<li>${[m.authors?.join(", "),m.title?`<em>${e(m.title)}</em>`:"",m.publisher,m.time,m.index].filter(Boolean).map(g=>g.startsWith("<em>")?g:e(g)).join(", ")}${m.url?` <a href="${e(m.url)}">${e(m.url)}</a>`:""}</li>`).join("")}</ul>`);const u=S.svg(t,a);u&&r.push(`<figure>${u}<figcaption>${e(s.timelineCaption)}</figcaption></figure>`),n=n.filter(m=>m.comparisons.length>0);const p=D.svg(t,n,a);if(p){const m=[`<li><svg viewBox="0 0 14 14" width="14" height="14" aria-hidden="true"><circle cx="7" cy="7" r="4" fill="#111827"/></svg>${e(s.saidLegend)}</li>`,...n.map((d,g)=>`<li>${D.legendMark(g)}${e(d.title)}</li>`)];r.push(`<figure>${p}<ul class="legend">${m.join("")}</ul><figcaption>${e(s.figureCaption)}</figcaption></figure>`)}if(t.pictures?.length){const m=t.pictures[0].views.map(d=>d.label);r.push(`<h4>${e(s.pictures)}</h4>`,`<div class="scroll"><table class="pictures"><thead><tr><th scope="col">${e(s.columns.instant)}</th>${m.map(d=>`<th scope="col">${e(d)}</th>`).join("")}</tr></thead><tbody>${t.pictures.map(d=>`<tr><td class="n">${a.instant(d.t)}</td>${d.views.map(g=>`<td>${g.image?`<img src="${g.image}" alt="${e(g.label)}, ${a.instant(d.t)}">`:`<span class="nothing">${e(s.noPicture)}</span>`}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`,`<p class="caption">${e(s.picturesCaption)}</p>`)}r.push(`<h4>${e(s.indications)}</h4>`),t.indications.length===0?r.push(`<p>${e(s.noIndication)}</p>`):r.push(z.table([i.instant,i.phenomenon,i.azimuth,i.altitude,i.uncertainty,i.size,i.basis,i.rests],t.indications.map(m=>{const d=m.uncertainty;return[a.instant(m.t),e(m.phenomenon??m.sourceId),m.directionSaid?a.azimuth(m.aim?.azimuthDeg):"",m.directionSaid?a.degrees(m.aim?.altitudeDeg):"",d?`${a.azimuth(d.azimuthDeg[0])} … ${a.azimuth(d.azimuthDeg[1])} ; ${a.degrees(d.altitudeDeg[0])} … ${a.degrees(d.altitudeDeg[1])}`:"",m.sizeSaid?a.degrees(m.angular?.widthDeg):"",m.basis?e(s.bases[m.basis]):"",e(a.rests(m))]}),[0,2,3,5]));const l=t.values.filter(m=>!/^timeline\.keyframes\.\d+\.shapes\.\d+\.shape\.(aim|angular)/.test(m.path));return l.length>0&&r.push(`<h4>${e(s.values)}</h4>`,z.valuesTable(l,a)),r}static reading(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h2>${e(a.fill(s.readingHeading,{title:t.title,witness:t.reads}))}</h2>`],c=[t.by.length?a.fill(s.by,{names:t.by.join(", ")}):"",t.time?a.fill(s.made,{time:t.time}):""].filter(Boolean).join(" ");c&&r.push(`<p class="meta">${e(c)}</p>`),t.description&&r.push(`<blockquote>${e(t.description)}</blockquote>`),r.push(`<h4>${e(s.supposed)}</h4>`,t.supposed.length?z.valuesTable(t.supposed,a):`<p>${e(s.noneSupposed)}</p>`),r.push(`<h4>${e(s.findings)}</h4>`),r.push(t.findings.length?z.table([i.finding,i.outcome,i.against,i.origin],t.findings.map(u=>[e(u.text),`<span class="${u.outcome}">${e(s.outcomes[u.outcome])}</span>`,u.outcome==="fails"?e(s.grounds[u.against??"established"]):"",e(s.origins[u.written?"written":"computed"])])):`<p>${e(s.noFinding)}</p>`);const o=t.sensitivity;if(o){const u=a.robustness(o);if(r.push(`<h4>${e(s.sensitivity)}</h4>`,`<p>${e(i.reproduced)} : ${a.reproduced(o)||"–"} · ${e(i.gap)} : ${a.degrees(o.medianSeparationDeg)||"–"} · <span class="${u.kind}">${e(u.text)}</span></p>`),u.kind!=="too-few"&&u.kind!=="nothing"&&o.margins.length>0&&r.push(z.table([i.knob,i.from,i.to,i.reference,i.covered],o.margins.map(p=>{const l=a.ends(p),m=p.reference?`${a.amount(p.knob,p.reference.lower)} … ${a.amount(p.knob,p.reference.upper)}`:s.noLaw;return[e(s.knobs[p.knob]),l.from,l.to,e(m),p.coverage===void 0?"":`${Math.round(p.coverage*100)} %`]}),[1,2,4])),o.better){const{knob:p,amount:l,agreement:m}=o.better;r.push(`<p class="fine-tuned">${e(a.fill(s.better,{knob:s.knobs[p],amount:a.amount(p,l),agreed:String(Math.round(m*o.compared)),compared:String(o.compared)}))}</p>`)}}return t.comparisons.length>0&&r.push(`<h4>${e(s.comparisons)}</h4>`,z.table([i.instant,i.phenomenon,`${i.said} (${i.azimuth}, ${i.altitude})`,`${i.read} (${i.azimuth}, ${i.altitude})`,i.separation,i.agrees],t.comparisons.map(u=>[a.instant(u.t),e(n?.phenomena?.[u.sourceId]??u.sourceId),u.said?`${a.azimuth(u.said.azimuthDeg)}, ${a.degrees(u.said.altitudeDeg)}`:"",`${a.azimuth(u.predicted.azimuthDeg)}, ${a.degrees(u.predicted.altitudeDeg)}`,a.degrees(u.separationDeg),`<span class="${u.agrees?"holds":"fails"}">${e(u.agrees?s.yes:s.no)}</span>`]),[0,4])),r}static valuesTable(t,n){const a=n.texts,s=a.columns,i=z.escape;return z.table([s.path,s.value,s.basis,s.rests],t.map(e=>[`<code>${i(e.path)}</code>`,i(n.value(e)),i(a.bases[e.basis]),i(n.rests(e))]))}static table(t,n,a=[]){const s=z.escape,i=`<tr>${t.map(r=>`<th scope="col">${s(r)}</th>`).join("")}</tr>`,e=n.map(r=>`<tr>${r.map((c,o)=>`<td${a.includes(o)?' class="n"':""}>${c}</td>`).join("")}</tr>`);return`<div class="scroll"><table><thead>${i}</thead><tbody>${e.join("")}</tbody></table></div>`}static escape(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}const _=P.catalog({en:()=>B(()=>import("./CaseReportTexts_en-DlN7p1pC.js"),[],import.meta.url).then(N=>N.caseReportTexts_en),fr:()=>B(()=>import("./CaseReportTexts_fr-B5nP6RlP.js"),[],import.meta.url).then(N=>N.caseReportTexts_fr),es:()=>B(()=>import("./CaseReportTexts_es-CncAEaey.js"),[],import.meta.url).then(N=>N.caseReportTexts_es),it:()=>B(()=>import("./CaseReportTexts_it-Dc-oPmXB.js"),[],import.meta.url).then(N=>N.caseReportTexts_it)});class U{static async make(t,n,a,s,i=!1,e){const[r,c]=await Promise.all([_.load(a),J.load(a)]),o=j.of(n.caseJson,n.caseUrl,n.recordings,new C([...s]),new F(c));i&&t!=="csv"&&await U.pictures(o,n,r,e);const u=`${n.caseJson.id??"case"}-report`;switch(t){case"html":U.download(new Blob([z.of(o,r,a,"0.189.0")],{type:"text/html"}),`${u}.html`);return;case"print":U.print(z.of(o,r,a,"0.189.0"));return;case"json":U.download(new Blob([T.json(o,"0.189.0")],{type:"application/json"}),`${u}.json`);return;case"csv":{const{zipSync:p,strToU8:l}=await B(async()=>{const{zipSync:d,strToU8:g}=await import("./browser-CltifEM0.js");return{zipSync:d,strToU8:g}},[],import.meta.url),m=Object.fromEntries(Object.entries(T.csv(o,r,a)).map(([d,g])=>[d,l(`\uFEFF${g}`)]));U.download(new Blob([p(m)],{type:"application/zip"}),`${u}-tables.zip`)}}}static PICTURED_INSTANTS=3;static async pictures(t,n,a,s){const{registerScene:i,SCENE_ELEMENT_NAME:e}=await B(async()=>{const{registerScene:p,SCENE_ELEMENT_NAME:l}=await import("./rr0-sighting-editor.mjs").then(m=>m.cs);return{registerScene:p,SCENE_ELEMENT_NAME:l}},[],import.meta.url);i();const r=t.witnesses.map(p=>{const l=p.indications.filter(f=>f.directionSaid).map(f=>f.t),m=l.length<=U.PICTURED_INSTANTS?l:[l[0],l[Math.floor(l.length/2)],l[l.length-1]],d=t.readings.filter(f=>f.reads===p.title&&f.comparisons.length>0),g=[{label:a.accountView,url:p.url,reading:void 0},...d.map(f=>({label:f.title,url:p.url,reading:f.url}))];return{witness:p,instants:[...new Set(m)],recordings:g}}).filter(p=>p.instants.length>0),c=r.reduce((p,l)=>p+l.instants.length*l.recordings.length,0);if(c===0)return;const o=document.createElement(e);o.setAttribute("max-pixel-ratio","1"),o.setAttribute("always-live",""),Object.assign(o.style,{position:"fixed",left:"-10000px",top:"0",width:"640px",height:"360px",visibility:"hidden",pointerEvents:"none"}),document.body.appendChild(o);let u=0;s?.(u,c);try{for(const p of r){const l=p.instants.map(d=>({t:d,views:[]})),m=n.recordings.get(p.witness.url);m&&(o.documentUrl=p.witness.url,o.sightingData=m);for(const d of p.recordings){const g=m,f=d.reading?n.recordings.get(d.reading):void 0;for(const w of l){let b;g&&(!d.reading||f)&&(w===l[0]&&(o.interpretation=U.bodiesOf(f??g,d.reading??p.witness.url)),b=await o.pictureAt(w.t,480).catch(()=>{})),w.views.push({label:d.label,...b?{image:b}:{}}),s?.(++u,c)}}p.witness.pictures=l}}finally{o.remove()}}static bodiesOf(t,n){const a=W.strip(t).recording.interpretation;if(a)return{...a,bodies:a.bodies.map(s=>s.model?.url?{...s,model:{...s.model,url:new URL(s.model.url,n).href}}:s)}}static print(t){const n=document.createElement("iframe");n.setAttribute("aria-hidden","true"),n.style.cssText="position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0",n.addEventListener("load",()=>{const a=n.contentWindow;a&&(a.addEventListener("afterprint",()=>n.remove()),a.focus(),a.print(),window.setTimeout(()=>n.remove(),6e4))},{once:!0}),n.srcdoc=t,document.body.append(n)}static download(t,n){const a=URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download=n,s.click(),window.setTimeout(()=>URL.revokeObjectURL(a),1e3)}}export{U as CaseReportExport};
@@ -1 +1 @@
1
- import{am as F,aC as m,aD as I,ap as D,aE as X,aF as L}from"./rr0-sighting-editor.mjs";import{C as x}from"./ContrailGrowth-DwHS8If9.js";class h{static MAX_SEGMENTS=8e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static STATIONS=[0,.5,1,1.5,2.25];static VERTICES_PER_SEGMENT=12*(h.STATIONS.length-1);static ICE_ASYMMETRY=.75;static phase(t){const s=h.ICE_ASYMMETRY;return(1-s*s)/(1+s*s-2*s*t)**1.5}object;group=new F;trails=[];positions=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*3);colors=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new m;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,4)),t.setDrawRange(0,0),this.object=new D(t,new X({vertexColors:!0,transparent:!0,depthWrite:!1,side:L})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,c){let p=0;this.segments=0;for(const o of this.trails){const u=this.samplesOf(o,t,s),i=c(o.id);for(let a=0;a+1<u.length;a++){const n=u[a],M=u[a+1];if(!n.forms||!M.forms)continue;if(this.segments>=h.MAX_SEGMENTS)break;const d=this.pushSegment(p,n,M,o.spanM,i,s);d>p&&this.segments++,p=d}}const y=this.object.geometry;y.setDrawRange(0,p);for(const[o,u]of[["position",3],["color",4]]){const i=y.getAttribute(o);i.clearUpdateRanges(),p>0&&i.addUpdateRange(0,p*u),i.needsUpdate=!0}}samplesOf(t,s,c){const p=s-x.FORMATION_S*1e3,y=[],o=(n,M,d,T,l,N)=>({x:M+n.driftEastMs*l+c.origin.x,y:T,z:-(d+n.driftNorthMs*l)+c.origin.z,age:l,forms:N,point:n});let u=-1;t.points.forEach((n,M)=>{n.tMs>p||(u=M,y.push(o(n,n.eastM,n.northM,n.upM,(s-n.tMs)/1e3,n.forms)))});const i=t.points[u],a=t.points[u+1];if(i&&a){const n=(p-i.tMs)/(a.tMs-i.tMs),M=(d,T)=>d+(T-d)*n;y.push(o(i,M(i.eastM,a.eastM),M(i.northM,a.northM),M(i.upM,a.upM),x.FORMATION_S,i.forms&&a.forms))}return y}pushSegment(t,s,c,p,y,o){const u=e=>({persistent:e.point.persistent,lifetimeS:e.point.lifetimeS,spanM:p,shearPerS:e.point.shearPerS,saturatedForS:e.point.saturatedForS}),i=x.opacity(s.age,u(s)),a=x.opacity(c.age,u(c));if(i<=0&&a<=0)return t;const n={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z};if(Math.hypot(n.x,n.y,n.z)<1e-6)return t;const M={x:(s.x+c.x)/2-o.eye.x,y:(s.y+c.y)/2-o.eye.y,z:(s.z+c.z)/2-o.eye.z},d=this.normalise(this.cross(n,M)),T=e=>{if(!o.sun)return y;const r={x:e.x-o.eye.x,y:e.y-o.eye.y,z:e.z-o.eye.z},E=h.phase((o.sun.x*r.x+o.sun.y*r.y+o.sun.z*r.z)/(Math.hypot(r.x,r.y,r.z)||1));return[y[0]*E,y[1]*E,y[2]*E]},l=(e,r)=>{const E=Math.hypot(e.x-o.eye.x,e.y-o.eye.y,e.z-o.eye.z),A=x.widthM(p,e.age,e.point.shearPerS),g=Math.max(A,h.MIN_PIXELS*o.pixelRad*E),z=r*(A/g)**h.UNRESOLVED_CONTRAST,S=x.profileExponent(e.age),G=h.STATIONS.map((j,P)=>P===h.STATIONS.length-1?0:z*Math.exp(-Math.LN2*j**S));return{half:g/2,profile:G,scattered:T(e)}},N=[{sample:s,...l(s,i)},{sample:c,...l(c,a)}],w=h.STATIONS.length-1,f=(e,r,E)=>{const A=h.STATIONS[r],g=e.half*A*E,z=t*3;this.positions[z]=e.sample.x+d.x*g,this.positions[z+1]=e.sample.y+d.y*g,this.positions[z+2]=e.sample.z+d.z*g;const S=t*4;this.colors[S]=e.scattered[0],this.colors[S+1]=e.scattered[1],this.colors[S+2]=e.scattered[2],this.colors[S+3]=e.profile[r],t++},[R,O]=N;for(const e of[-1,1])for(let r=0;r<w;r++)f(R,r+1,e),f(R,r,e),f(O,r+1,e),f(R,r,e),f(O,r,e),f(O,r+1,e);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{h as ContrailSystem};
1
+ import{am as F,aD as m,aE as I,ap as D,aF as X,aG as L}from"./rr0-sighting-editor.mjs";import{C as x}from"./ContrailGrowth-DwHS8If9.js";class h{static MAX_SEGMENTS=8e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static STATIONS=[0,.5,1,1.5,2.25];static VERTICES_PER_SEGMENT=12*(h.STATIONS.length-1);static ICE_ASYMMETRY=.75;static phase(t){const s=h.ICE_ASYMMETRY;return(1-s*s)/(1+s*s-2*s*t)**1.5}object;group=new F;trails=[];positions=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*3);colors=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new m;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,4)),t.setDrawRange(0,0),this.object=new D(t,new X({vertexColors:!0,transparent:!0,depthWrite:!1,side:L})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,c){let p=0;this.segments=0;for(const o of this.trails){const u=this.samplesOf(o,t,s),i=c(o.id);for(let a=0;a+1<u.length;a++){const n=u[a],M=u[a+1];if(!n.forms||!M.forms)continue;if(this.segments>=h.MAX_SEGMENTS)break;const d=this.pushSegment(p,n,M,o.spanM,i,s);d>p&&this.segments++,p=d}}const y=this.object.geometry;y.setDrawRange(0,p);for(const[o,u]of[["position",3],["color",4]]){const i=y.getAttribute(o);i.clearUpdateRanges(),p>0&&i.addUpdateRange(0,p*u),i.needsUpdate=!0}}samplesOf(t,s,c){const p=s-x.FORMATION_S*1e3,y=[],o=(n,M,d,T,l,N)=>({x:M+n.driftEastMs*l+c.origin.x,y:T,z:-(d+n.driftNorthMs*l)+c.origin.z,age:l,forms:N,point:n});let u=-1;t.points.forEach((n,M)=>{n.tMs>p||(u=M,y.push(o(n,n.eastM,n.northM,n.upM,(s-n.tMs)/1e3,n.forms)))});const i=t.points[u],a=t.points[u+1];if(i&&a){const n=(p-i.tMs)/(a.tMs-i.tMs),M=(d,T)=>d+(T-d)*n;y.push(o(i,M(i.eastM,a.eastM),M(i.northM,a.northM),M(i.upM,a.upM),x.FORMATION_S,i.forms&&a.forms))}return y}pushSegment(t,s,c,p,y,o){const u=e=>({persistent:e.point.persistent,lifetimeS:e.point.lifetimeS,spanM:p,shearPerS:e.point.shearPerS,saturatedForS:e.point.saturatedForS}),i=x.opacity(s.age,u(s)),a=x.opacity(c.age,u(c));if(i<=0&&a<=0)return t;const n={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z};if(Math.hypot(n.x,n.y,n.z)<1e-6)return t;const M={x:(s.x+c.x)/2-o.eye.x,y:(s.y+c.y)/2-o.eye.y,z:(s.z+c.z)/2-o.eye.z},d=this.normalise(this.cross(n,M)),T=e=>{if(!o.sun)return y;const r={x:e.x-o.eye.x,y:e.y-o.eye.y,z:e.z-o.eye.z},E=h.phase((o.sun.x*r.x+o.sun.y*r.y+o.sun.z*r.z)/(Math.hypot(r.x,r.y,r.z)||1));return[y[0]*E,y[1]*E,y[2]*E]},l=(e,r)=>{const E=Math.hypot(e.x-o.eye.x,e.y-o.eye.y,e.z-o.eye.z),A=x.widthM(p,e.age,e.point.shearPerS),g=Math.max(A,h.MIN_PIXELS*o.pixelRad*E),z=r*(A/g)**h.UNRESOLVED_CONTRAST,S=x.profileExponent(e.age),G=h.STATIONS.map((j,P)=>P===h.STATIONS.length-1?0:z*Math.exp(-Math.LN2*j**S));return{half:g/2,profile:G,scattered:T(e)}},N=[{sample:s,...l(s,i)},{sample:c,...l(c,a)}],w=h.STATIONS.length-1,f=(e,r,E)=>{const A=h.STATIONS[r],g=e.half*A*E,z=t*3;this.positions[z]=e.sample.x+d.x*g,this.positions[z+1]=e.sample.y+d.y*g,this.positions[z+2]=e.sample.z+d.z*g;const S=t*4;this.colors[S]=e.scattered[0],this.colors[S+1]=e.scattered[1],this.colors[S+2]=e.scattered[2],this.colors[S+3]=e.profile[r],t++},[R,O]=N;for(const e of[-1,1])for(let r=0;r<w;r++)f(R,r+1,e),f(R,r,e),f(O,r+1,e),f(R,r,e),f(O,r,e),f(O,r+1,e);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{h as ContrailSystem};
@@ -1,4 +1,4 @@
1
- import{ax as b,b4 as A,bs as D,b6 as F,bt as M,bu as R,bv as E,ap as P,aT as U,bw as k,bf as S}from"./rr0-sighting-editor.mjs";class w{target;wideCamera=new b;materials=new Map;draw(t){const{renderer:s,camera:r,equidistant:a}=t,i=s.getDrawingBufferSize(new A),n=i.x,o=i.y,e=n/o;if(a&&!D.supports(r.fov,e))throw new Error(`A field of ${r.fov}° is drawn through a cube, which the control passes do not follow yet: export through a narrower field.`);const c=this.sourceCamera(r,a?a.sourceFovDeg(r.fov,e):r.fov),d=this.usableTarget(n,o),l=this.drawDistance(t,c,d),u=this.drawPhenomenon(t,c,d),f=Math.tan(c.fov*Math.PI/360),p=new Float32Array(n*o),h=new Uint8Array(n*o);for(let v=0;v<o;v++)for(let g=0;g<n;g++){const m=this.sourcePixel(g,v,n,o,r.fov,e,f,a);if(m<0)continue;const x=v*n+g;p[x]=l[m*4];const y=u[m*4],T=u[m*4+1],C=u[m*4+2],_=u[m*4+3];h[x]=Math.max(y,T,C,_)>w.LIGHT_THRESHOLD?255:0}return{width:n,height:o,distanceM:p,phenomenon:h}}dispose(){this.target?.dispose();for(const t of this.materials.values())t.dispose();this.materials.clear()}static LIGHT_THRESHOLD=1e-6;sourcePixel(t,s,r,a,i,n,o,e){if(!e)return(a-1-s)*r+t;const c=(t+.5)/r*2-1,d=1-(s+.5)/a*2,l=e.directionFor(c,d,i);if(l.z>=0)return-1;const u=l.x/-l.z/(o*n),f=l.y/-l.z/o,p=Math.floor((u+1)/2*r),h=Math.floor((f+1)/2*a);return p<0||p>=r||h<0||h>=a?-1:h*r+p}sourceCamera(t,s){const r=this.wideCamera.copy(t);return r.fov=s,r.clearViewOffset(),r.updateProjectionMatrix(),r.updateMatrixWorld(),r}usableTarget(t,s){return this.target?(this.target.width!==t||this.target.height!==s)&&this.target.setSize(t,s):this.target=new F(t,s,{type:E,format:R,minFilter:M,magFilter:M,depthBuffer:!0}),this.target}drawDistance(t,s,r){const{renderer:a,scene:i}=t,n=[],o=[];for(const e of t.sky)e.visible&&(e.visible=!1,n.push(e));i.traverseVisible(e=>{if(e instanceof P){if(t.isSolid(e)){o.push({mesh:e,material:e.material}),e.material=Array.isArray(e.material)?e.material.map(c=>this.distanceMaterial(c)):this.distanceMaterial(e.material);return}}else if(!e.isPoints&&!e.isLine&&!e.isSprite)return;n.push(e)});for(const e of n)e.visible=!1;try{return this.drawInto(t,r,()=>a.render(i,s))}finally{for(const e of n)e.visible=!0;for(const{mesh:e,material:c}of o)e.material=c}}drawPhenomenon(t,s,r){return this.drawInto(t,r,()=>t.drawPhenomena(s))}drawInto(t,s,r){const{renderer:a,scene:i}=t,n=a.getRenderTarget(),o=a.autoClear,e=a.shadowMap.autoUpdate,c=i.fog,d=i.background,l=a.getClearAlpha(),u=a.getClearColor(new U);i.fog=null,i.background=null,a.shadowMap.autoUpdate=!1,a.setRenderTarget(s),a.setClearColor(0,0),a.clear(!0,!0,!0),a.autoClear=!1;try{r();const f=new Float32Array(s.width*s.height*4);return k.now(a,s,0,0,s.width,s.height,f),f}finally{a.autoClear=o,a.shadowMap.autoUpdate=e,a.setRenderTarget(n),a.setClearColor(u,l),i.fog=c,i.background=d}}distanceMaterial(t){const s=t.alphaTest??0,r=t.map??t.alphaMap??null,a=s>0&&r!==null,i=`${t.side}:${a?`${r.uuid}:${s}`:"-"}`;let n=this.materials.get(i);return n||(n=new S({defines:a?{CUTOUT:"",USE_UV:""}:{},uniforms:{cutoutMap:{value:r},cutoutAlpha:{value:s}},vertexShader:w.VERTEX,fragmentShader:w.FRAGMENT,side:t.side}),this.materials.set(i,n)),n}static VERTEX=`
1
+ import{ax as b,ba as A,by as D,bc as F,bz as y,bA as R,bB as U,ap as E,aU as P,bC as k,bl as S}from"./rr0-sighting-editor.mjs";class w{target;wideCamera=new b;materials=new Map;draw(t){const{renderer:s,camera:r,equidistant:a}=t,i=s.getDrawingBufferSize(new A),n=i.x,o=i.y,e=n/o;if(a&&!D.supports(r.fov,e))throw new Error(`A field of ${r.fov}° is drawn through a cube, which the control passes do not follow yet: export through a narrower field.`);const c=this.sourceCamera(r,a?a.sourceFovDeg(r.fov,e):r.fov),d=this.usableTarget(n,o),l=this.drawDistance(t,c,d),u=this.drawPhenomenon(t,c,d),f=Math.tan(c.fov*Math.PI/360),p=new Float32Array(n*o),h=new Uint8Array(n*o);for(let v=0;v<o;v++)for(let g=0;g<n;g++){const m=this.sourcePixel(g,v,n,o,r.fov,e,f,a);if(m<0)continue;const x=v*n+g;p[x]=l[m*4];const M=u[m*4],C=u[m*4+1],T=u[m*4+2],_=u[m*4+3];h[x]=Math.max(M,C,T,_)>w.LIGHT_THRESHOLD?255:0}return{width:n,height:o,distanceM:p,phenomenon:h}}dispose(){this.target?.dispose();for(const t of this.materials.values())t.dispose();this.materials.clear()}static LIGHT_THRESHOLD=1e-6;sourcePixel(t,s,r,a,i,n,o,e){if(!e)return(a-1-s)*r+t;const c=(t+.5)/r*2-1,d=1-(s+.5)/a*2,l=e.directionFor(c,d,i);if(l.z>=0)return-1;const u=l.x/-l.z/(o*n),f=l.y/-l.z/o,p=Math.floor((u+1)/2*r),h=Math.floor((f+1)/2*a);return p<0||p>=r||h<0||h>=a?-1:h*r+p}sourceCamera(t,s){const r=this.wideCamera.copy(t);return r.fov=s,r.clearViewOffset(),r.updateProjectionMatrix(),r.updateMatrixWorld(),r}usableTarget(t,s){return this.target?(this.target.width!==t||this.target.height!==s)&&this.target.setSize(t,s):this.target=new F(t,s,{type:U,format:R,minFilter:y,magFilter:y,depthBuffer:!0}),this.target}drawDistance(t,s,r){const{renderer:a,scene:i}=t,n=[],o=[];for(const e of t.sky)e.visible&&(e.visible=!1,n.push(e));i.traverseVisible(e=>{if(e instanceof E){if(t.isSolid(e)){o.push({mesh:e,material:e.material}),e.material=Array.isArray(e.material)?e.material.map(c=>this.distanceMaterial(c)):this.distanceMaterial(e.material);return}}else if(!e.isPoints&&!e.isLine&&!e.isSprite)return;n.push(e)});for(const e of n)e.visible=!1;try{return this.drawInto(t,r,()=>a.render(i,s))}finally{for(const e of n)e.visible=!0;for(const{mesh:e,material:c}of o)e.material=c}}drawPhenomenon(t,s,r){return this.drawInto(t,r,()=>t.drawPhenomena(s))}drawInto(t,s,r){const{renderer:a,scene:i}=t,n=a.getRenderTarget(),o=a.autoClear,e=a.shadowMap.autoUpdate,c=i.fog,d=i.background,l=a.getClearAlpha(),u=a.getClearColor(new P);i.fog=null,i.background=null,a.shadowMap.autoUpdate=!1,a.setRenderTarget(s),a.setClearColor(0,0),a.clear(!0,!0,!0),a.autoClear=!1;try{r();const f=new Float32Array(s.width*s.height*4);return k.now(a,s,0,0,s.width,s.height,f),f}finally{a.autoClear=o,a.shadowMap.autoUpdate=e,a.setRenderTarget(n),a.setClearColor(u,l),i.fog=c,i.background=d}}distanceMaterial(t){const s=t.alphaTest??0,r=t.map??t.alphaMap??null,a=s>0&&r!==null,i=`${t.side}:${a?`${r.uuid}:${s}`:"-"}`;let n=this.materials.get(i);return n||(n=new S({defines:a?{CUTOUT:"",USE_UV:""}:{},uniforms:{cutoutMap:{value:r},cutoutAlpha:{value:s}},vertexShader:w.VERTEX,fragmentShader:w.FRAGMENT,side:t.side}),this.materials.set(i,n)),n}static VERTEX=`
2
2
  #include <common>
3
3
  #include <uv_pars_vertex>
4
4
  #include <batching_pars_vertex>
@@ -1 +1 @@
1
- import{aX as o}from"./rr0-sighting-editor.mjs";const l=[{id:"when",paths:["time"]},{id:"where",paths:["place.locations.*.lat","place.locations.*.lng","observerTrack.keyframes.*.pose.lat","observerTrack.keyframes.*.pose.lng"]},{id:"facing",paths:["observerTrack.keyframes.*.pose.headingDeg"]},{id:"apparent-size",paths:["timeline.keyframes.*.shapes.*.shape.angular.widthDeg","timeline.keyframes.*.shapes.*.shape.angular.heightDeg"]},{id:"sky-position",paths:["timeline.keyframes.*.shapes.*.shape.aim.azimuthDeg","timeline.keyframes.*.shapes.*.shape.aim.altitudeDeg"]},{id:"how-long",paths:["durationSeconds","endTime"]},{id:"appearance",paths:["timeline.keyframes.*.shapes.*.shape.kind","timeline.keyframes.*.shapes.*.shape.title","timeline.keyframes.*.shapes.*.shape.color","timeline.keyframes.*.shapes.*.shape.brightness"]},{id:"movement",paths:["timeline.keyframes.1.t","observerTrack.keyframes.1.t"]},{id:"sound",paths:["soundTrack.keyframes.*.sound.kind"]},{id:"conditions",paths:["weatherTrack.keyframes.*.weather.*","weather.*"]}],d=["fitted","assumed","derived","stated","measured","established"];class p{about="observer";async assess(a){const i=o(a,!0),s=l.map(e=>p.answer(e,i,a));return{score:s.filter(e=>e.basis==="stated").length/s.length,criteria:s}}static answer(a,i,s){const e=a.paths.flatMap(t=>p.resolve(t,i));if(e.length===0)return{id:a.id,paths:[]};const r=e.map(t=>p.basisAt(t,s)??"stated");return{id:a.id,basis:d.find(t=>r.includes(t)),paths:e}}static basisAt(a,i){const s=a.split(".");for(let e=s.length;e>0;e--){const r=i.provenance.at(s.slice(0,e).join("."))?.basis;if(r)return r}}static resolve(a,i){let s=[{path:[],value:i}];for(const e of a.split("."))s=s.flatMap(({path:r,value:t})=>{if(typeof t!="object"||t===null)return[];if(e!=="*"){const n=t[e];return n===void 0?[]:[{path:[...r,e],value:n}]}return Object.entries(t).filter(([,n])=>n!==void 0).map(([n,h])=>({path:[...r,n],value:h}))});return s.filter(({value:e})=>e!==null&&e!==""&&!(Array.isArray(e)&&e.length===0)).map(({path:e})=>e.join("."))}}export{p as CoverageAssessor};
1
+ import{b3 as o}from"./rr0-sighting-editor.mjs";const l=[{id:"when",paths:["time"]},{id:"where",paths:["place.locations.*.lat","place.locations.*.lng","observerTrack.keyframes.*.pose.lat","observerTrack.keyframes.*.pose.lng"]},{id:"facing",paths:["observerTrack.keyframes.*.pose.headingDeg"]},{id:"apparent-size",paths:["timeline.keyframes.*.shapes.*.shape.angular.widthDeg","timeline.keyframes.*.shapes.*.shape.angular.heightDeg"]},{id:"sky-position",paths:["timeline.keyframes.*.shapes.*.shape.aim.azimuthDeg","timeline.keyframes.*.shapes.*.shape.aim.altitudeDeg"]},{id:"how-long",paths:["durationSeconds","endTime"]},{id:"appearance",paths:["timeline.keyframes.*.shapes.*.shape.kind","timeline.keyframes.*.shapes.*.shape.title","timeline.keyframes.*.shapes.*.shape.color","timeline.keyframes.*.shapes.*.shape.brightness"]},{id:"movement",paths:["timeline.keyframes.1.t","observerTrack.keyframes.1.t"]},{id:"sound",paths:["soundTrack.keyframes.*.sound.kind"]},{id:"conditions",paths:["weatherTrack.keyframes.*.weather.*","weather.*"]}],d=["fitted","assumed","derived","stated","measured","established"];class p{about="observer";async assess(a){const i=o(a,!0),s=l.map(e=>p.answer(e,i,a));return{score:s.filter(e=>e.basis==="stated").length/s.length,criteria:s}}static answer(a,i,s){const e=a.paths.flatMap(t=>p.resolve(t,i));if(e.length===0)return{id:a.id,paths:[]};const r=e.map(t=>p.basisAt(t,s)??"stated");return{id:a.id,basis:d.find(t=>r.includes(t)),paths:e}}static basisAt(a,i){const s=a.split(".");for(let e=s.length;e>0;e--){const r=i.provenance.at(s.slice(0,e).join("."))?.basis;if(r)return r}}static resolve(a,i){let s=[{path:[],value:i}];for(const e of a.split("."))s=s.flatMap(({path:r,value:t})=>{if(typeof t!="object"||t===null)return[];if(e!=="*"){const n=t[e];return n===void 0?[]:[{path:[...r,e],value:n}]}return Object.entries(t).filter(([,n])=>n!==void 0).map(([n,h])=>({path:[...r,n],value:h}))});return s.filter(({value:e})=>e!==null&&e!==""&&!(Array.isArray(e)&&e.length===0)).map(({path:e})=>e.join("."))}}export{p as CoverageAssessor};
@@ -1 +1 @@
1
- import{bE as Le,bF as Q,bG as he,bH as Me,bI as v,bJ as de,b1 as y,b4 as pe,aT as F,bK as w,bz as U,bq as be,bL as Se,aw as ye,K,bM as we,V as C,Q as me,bN as Ne,G as ge,bO as Ie,bP as Oe,aD as V,bQ as Ce,bR as Te,bS as Fe,bT as Pe,bU as He,b7 as J,bt as Re,bV as Z,bW as ke,bX as De,bm as Ge,bY as X,bZ as ve,ar as Ee,aF as Ue,aE as G,b_ as Ke,aC as Be,b$ as je,ap as Ve,c0 as Xe,c1 as ze,c2 as qe,aR as We,am as z,ax as Ye,bk as Qe,c3 as Je,c4 as Ze,c5 as $e,c6 as en,c7 as nn,c8 as tn,c9 as xe,bd as sn,bA as ne,ca as te,cb as se,cc as ie,cd as re,ce as rn,cf as on,as as an,at as cn}from"./rr0-sighting-editor.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 bn(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 Sn(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 yn(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 wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;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],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new ye(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Se(u),c.distance=l;break;case"spot":c=new be(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),S(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],w),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?y: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?y: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?y: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?y: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],w)}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?y: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?y: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],w),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?y: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?y: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],w),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?y: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?y: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 bn{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 Sn{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 we(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 Ne(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 yn{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 wn{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,w,h)})})}}class Nn{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],N=r[R+E+o]*u,b=r[p+E+a],k=r[p+E]*u;i[E]=A*L+x*N+m*b+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 S(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),S(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),N=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 b=0,k=L.length;b<k;b++){const P=L[b];if(m.setX(P,N[b*o]),o>=2&&m.setY(P,N[b*o+1]),o>=3&&m.setZ(P,N[b*o+2]),o>=4&&m.setW(P,N[b*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),S(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],w),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],w)}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),S(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),S(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)),S(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],N=d[x],b=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const B=s._createAnimationTracks(L,N,b,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 S(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),S(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)),S(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!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),S(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
+ import{bK as Le,bL as Q,bM as he,bN as Me,bO as v,bP as de,b7 as y,ba as pe,aU as F,bQ as w,bF as U,bw as Se,bR as be,aw as ye,K,bS as we,V as C,Q as me,bT as Ne,G as ge,bU as Ie,bV as Oe,aE as V,bW as Ce,bX as Te,bY as Fe,bZ as Pe,b_ as He,bd as J,bz as Re,b$ as Z,c0 as ke,c1 as De,bs as Ge,c2 as X,c3 as ve,ar as Ee,aG as Ue,aF as G,c4 as Ke,aD as Be,c5 as je,ap as Ve,c6 as Xe,c7 as ze,c8 as qe,aS as We,am as z,ax as Ye,bq as Qe,c9 as Je,ca as Ze,cb as $e,cc as en,cd as nn,ce as tn,cf as xe,bj as sn,bG as ne,cg as te,ch as se,ci as ie,cj as re,ck as rn,cl as on,as as an,at as cn}from"./rr0-sighting-editor.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 An(e)}),this.register(function(e){return new _n(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 bn(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))===_e){try{r[g.KHR_BINARY_GLTF]=new yn(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 wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;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 A(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],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new ye(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new be(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),b(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],w),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=A(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 A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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 A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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 A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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 A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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],w)}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 A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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 A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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],w),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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 A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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],w),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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 An{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return A(this.parser,n,this.name)!==null?y:null}extendMaterialParams(n,e){const s=A(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 bn{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,_=new C(1,1,1),x=new we(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&&_.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,_));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new Ne(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 _e="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class yn{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!==_e)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 wn{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,w,h)})})}}class Nn{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 Ae 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,_=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],N=r[R+E+o]*u,S=r[p+E+a],k=r[p+E]*u;i[E]=_*L+x*N+m*S+T*k}return i}}const On=new me;class Cn extends Ae{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 b(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),b(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),_="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(_);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(_,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,_=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new _(r[1],x,t.sparse.count*T),N=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,N[S*o]),o>=2&&m.setY(P,N[S*o+1]),o>=3&&m.setZ(P,N[S*o+2]),o>=4&&m.setW(P,N[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),b(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],w),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],w)}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),b(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 _=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,_):new Ve(R,_),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,_);else if(m.mode===M.LINE_STRIP)T=new ze(R,_);else if(m.mode===M.LINE_LOOP)T=new qe(R,_);else if(m.mode===M.POINTS)T=new We(R,_);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),b(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)),b(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,_=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",_)),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],N=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,N,S,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const _=new $e(i,void 0,T);return b(_,t),_})}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),b(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)),b(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:Ae;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!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),b(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,4 +1,4 @@
1
- import{bq as A,ap as g,V as P,br as m,aC as C,aD as E,bf as L,aT as x,aF as R,aG as D}from"./rr0-sighting-editor.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 A(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,u){const c=this.beams.get(e),w=Math.max(u,i.CLEAR_AIR_SCATTER_PER_M);if(!c)return;const l=m.BEAMS[t],f=new P(-n.z,0,n.x),b=e==="observer"&&l!==void 0;c.lamps.forEach((s,d)=>{if(!l){s.intensity=0,c.air[d].visible=!1,s.shadow.autoUpdate=!1;return}const v=d===0?-1:1,h=l.pitchDeg*Math.PI/180,p=l.candela*m.DISPLAY_GAIN*o/c.lamps.length;s.color.set(l.color),s.intensity=p,s.angle=l.halfAngleDeg*Math.PI/180,s.penumbra=l.penumbra,b?(s.shadow.autoUpdate||(s.shadow.needsUpdate=!0),s.shadow.autoUpdate=!0):s.shadow.autoUpdate=!1,s.position.copy(r).addScaledVector(f,v*a);const M=n.clone().addScaledVector(f,-v*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,l.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,u=o*Math.tan(t.angle);e.position.copy(t.position),e.scale.set(u,u,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=u}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:D,side:R,uniforms:{uColor:{value:new x(1,1,1)},uCandela:{value:0},uScatter:{value:0},uLength:{value:90},uRadius:{value:20}},vertexShader:`
1
+ import{bw as A,ap as g,V as P,bx as m,aD as C,aE as E,bl as x,aU as L,aG as R,aH as D}from"./rr0-sighting-editor.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 A(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,u){const c=this.beams.get(e),w=Math.max(u,i.CLEAR_AIR_SCATTER_PER_M);if(!c)return;const l=m.BEAMS[t],v=new P(-n.z,0,n.x),b=e==="observer"&&l!==void 0;c.lamps.forEach((s,d)=>{if(!l){s.intensity=0,c.air[d].visible=!1,s.shadow.autoUpdate=!1;return}const f=d===0?-1:1,h=l.pitchDeg*Math.PI/180,p=l.candela*m.DISPLAY_GAIN*o/c.lamps.length;s.color.set(l.color),s.intensity=p,s.angle=l.halfAngleDeg*Math.PI/180,s.penumbra=l.penumbra,b?(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,l.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,u=o*Math.tan(t.angle);e.position.copy(t.position),e.scale.set(u,u,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=u}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 x({transparent:!0,depthWrite:!1,depthTest:!0,blending:D,side:R,uniforms:{uColor:{value:new L(1,1,1)},uCandela:{value:0},uScatter:{value:0},uLength:{value:90},uRadius:{value:20}},vertexShader:`
2
2
  varying vec3 vLocal;
3
3
  varying vec3 vNormalView;
4
4
  varying vec3 vViewDir;
@@ -1 +1 @@
1
- import{aY as n,aZ as c}from"./rr0-sighting-editor.mjs";import{N as p}from"./NearestApproach-Bubj_A1N.js";const l=-6,u=150;class o{about="temporal";async assess(e){const t=o.daylight(e),i=e.decor.map((s,r)=>({object:s,index:r})).filter(({object:s})=>s.kind==="entity"),a=p.of(e),d=a!==void 0&&a.m<=u;return{verdict:i.length>0?"ce3":d?"ce1":t===void 0?void 0:t?"dd":"nl",criteria:[{id:"entities",basis:i.length>0?"stated":void 0,paths:i.map(({index:s})=>`decor.${s}`)},{id:"traces",paths:[],unsupported:!0},{id:"proximity",basis:a?.basis,paths:a?.paths??[]},{id:"radar",paths:[],unsupported:!0},{id:"daylight",basis:t===void 0?void 0:"derived",paths:t===void 0?[]:["time","place"]}]}}static daylight(e){const t=e.event.place?.[0],i=e.event.time;if(!t||!i)return;const a=n(i,t.lng,e.event.utcOffsetHours);if(a)return c("Sun",a,{lat:t.lat,lng:t.lng,elevationM:0}).altitudeDeg>l}}export{o as HynekAssessor};
1
+ import{b2 as n,b0 as c}from"./rr0-sighting-editor.mjs";import{N as p}from"./NearestApproach-BDjtUet2.js";const l=-6,u=150;class o{about="temporal";async assess(e){const t=o.daylight(e),i=e.decor.map((s,r)=>({object:s,index:r})).filter(({object:s})=>s.kind==="entity"),a=p.of(e),d=a!==void 0&&a.m<=u;return{verdict:i.length>0?"ce3":d?"ce1":t===void 0?void 0:t?"dd":"nl",criteria:[{id:"entities",basis:i.length>0?"stated":void 0,paths:i.map(({index:s})=>`decor.${s}`)},{id:"traces",paths:[],unsupported:!0},{id:"proximity",basis:a?.basis,paths:a?.paths??[]},{id:"radar",paths:[],unsupported:!0},{id:"daylight",basis:t===void 0?void 0:"derived",paths:t===void 0?[]:["time","place"]}]}}static daylight(e){const t=e.event.place?.[0],i=e.event.time;if(!t||!i)return;const a=n(i,t.lng,e.event.utcOffsetHours);if(a)return c("Sun",a,{lat:t.lat,lng:t.lng,elevationM:0}).altitudeDeg>l}}export{o as HynekAssessor};