@rr0/ufoathome 0.202.0 → 0.203.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.
- package/dist-embed-interview/InterviewMessages_en-Ikx6GjEd.js +3 -0
- package/dist-embed-interview/InterviewMessages_es-DKWWyrnb.js +3 -0
- package/dist-embed-interview/InterviewMessages_fr-DT0gXAKD.js +3 -0
- package/dist-embed-interview/InterviewMessages_it-CF_9MYPt.js +3 -0
- package/dist-embed-interview/rr0-interview.mjs +1 -1
- package/dist-embed-scene/{AirshipEditor-BnRmKeVs.js → AirshipEditor-guE_ib3z.js} +1 -1
- package/dist-embed-scene/{AirshipFlight-C9DSPGwk.js → AirshipFlight-DzW0313e.js} +1 -1
- package/dist-embed-scene/{BalloonEditor-BehJs6H-.js → BalloonEditor-BIsCy_y4.js} +2 -2
- package/dist-embed-scene/{BalloonFlight-BYn4diw1.js → BalloonFlight-gunghgAq.js} +1 -1
- package/dist-embed-scene/{BirdEditor-dOp1sGsz.js → BirdEditor-CuLv4Ij5.js} +1 -1
- package/dist-embed-scene/{BirdFlock-CfJeXvWu.js → BirdFlock-L3dYU2K_.js} +1 -1
- package/dist-embed-scene/{DroneEditor-CBoR4fJ_.js → DroneEditor-BQWPhTyf.js} +1 -1
- package/dist-embed-scene/{DroneFlight-DSE1OXqh.js → DroneFlight-ERYah68l.js} +1 -1
- package/dist-embed-scene/{DroneParameters-D3EOg4oe.js → DroneParameters-CoWQympS.js} +1 -1
- package/dist-embed-scene/{LanternEditor-CbcA7K8y.js → LanternEditor-BpCyb79i.js} +1 -1
- package/dist-embed-scene/ModuleSession-Bh6KaOGK.js +3 -0
- package/dist-embed-scene/ModuleThree-DRsA8rtL.js +1 -0
- package/dist-embed-scene/SearchlightSystem-Ddws2hQY.js +1 -0
- package/dist-embed-scene/{SkyLantern-Dp_B40X0.js → SkyLantern-C3BSxHtq.js} +1 -1
- package/dist-embed-scene/rr0-scene.mjs +113 -92
- package/dist-embed-sighting/{CaseReportExport-CkWf0HNx.js → CaseReportExport--iqqhu1e.js} +1 -1
- package/dist-embed-sighting/HvsMessages_en-BiLhEAxJ.js +1 -0
- package/dist-embed-sighting/HvsMessages_es-Cbj_6eFs.js +1 -0
- package/dist-embed-sighting/HvsMessages_fr-DkvE2qm1.js +1 -0
- package/dist-embed-sighting/HvsMessages_it-BIJ87Uyb.js +1 -0
- package/dist-embed-sighting/InterviewMessages_en-Ikx6GjEd.js +3 -0
- package/dist-embed-sighting/InterviewMessages_es-DKWWyrnb.js +3 -0
- package/dist-embed-sighting/InterviewMessages_fr-DT0gXAKD.js +3 -0
- package/dist-embed-sighting/InterviewMessages_it-CF_9MYPt.js +3 -0
- package/dist-embed-sighting/ModuleSession-_kHZ7Tx3.js +3 -0
- package/dist-embed-sighting/{ModuleThree-whEZoXYF.js → ModuleThree-BLNSm2eY.js} +1 -1
- package/dist-embed-sighting/ReadingCheckTexts_en-C5qzU8K7.js +1 -0
- package/dist-embed-sighting/ReadingCheckTexts_es-DdhtmSew.js +1 -0
- package/dist-embed-sighting/ReadingCheckTexts_fr-COtovvqc.js +1 -0
- package/dist-embed-sighting/ReadingCheckTexts_it-Bz32XGh6.js +1 -0
- package/dist-embed-sighting/SearchlightSystem-PEMBDW1s.js +1 -0
- package/dist-embed-sighting/rr0-sighting.mjs +432 -366
- package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-Bz1OjSjY.js → AdsbLolArchiveProvider-DNYpHE9t.js} +1 -1
- package/dist-embed-sighting-editor/{AirshipEditor-BlJXyxlr.js → AirshipEditor-B_TQEcNk.js} +1 -1
- package/dist-embed-sighting-editor/{AirshipFlight-Cx40Y8JT.js → AirshipFlight-zrtPXNvX.js} +1 -1
- package/dist-embed-sighting-editor/{Aurora-Ldk66p1A.js → Aurora-wHi_XgNK.js} +1 -1
- package/dist-embed-sighting-editor/{AuroraEditor-CGSomAFk.js → AuroraEditor-CHAo9LbG.js} +1 -1
- package/dist-embed-sighting-editor/{AuroraSimulation-vKcv2Hue.js → AuroraSimulation-CMoKbd0k.js} +2 -2
- package/dist-embed-sighting-editor/{BalloonEditor-CgO4LaWn.js → BalloonEditor-DOmOj25v.js} +1 -1
- package/dist-embed-sighting-editor/{BalloonFlight-hLr_4TFU.js → BalloonFlight-DkhpbdZV.js} +1 -1
- package/dist-embed-sighting-editor/{BeamEditor-B8qreA3j.js → BeamEditor-CwC6pRPq.js} +1 -1
- package/dist-embed-sighting-editor/{BeamSystem-D0hrju5J.js → BeamSystem-Zsq9zuJa.js} +1 -1
- package/dist-embed-sighting-editor/{BirdEditor-BNzrfSqX.js → BirdEditor-DslUOI4x.js} +1 -1
- package/dist-embed-sighting-editor/{BirdFlock-iSovVEZd.js → BirdFlock-BoXaV-S_.js} +1 -1
- package/dist-embed-sighting-editor/{CaseElement-DPlro-7S.js → CaseElement-DFnjs2AU.js} +6 -5
- package/dist-embed-sighting-editor/{CaseReportExport-C1g5C8hi.js → CaseReportExport-CX87uNr9.js} +1 -1
- package/dist-embed-sighting-editor/{ContrailSystem-D3tXAg2r.js → ContrailSystem-hUtlCEq-.js} +1 -1
- package/dist-embed-sighting-editor/{ControlPasses-BMEmppip.js → ControlPasses-C8qq_tSL.js} +1 -1
- package/dist-embed-sighting-editor/{DroneEditor-BFsArPKi.js → DroneEditor-M2V3FKbS.js} +1 -1
- package/dist-embed-sighting-editor/{DroneFlight-B96pVrY1.js → DroneFlight-C1bur42A.js} +1 -1
- package/dist-embed-sighting-editor/{DroneParameters-DW-enQUo.js → DroneParameters-DRfoxMx8.js} +1 -1
- package/dist-embed-sighting-editor/{Flightradar24Provider-CBGkjw03.js → Flightradar24Provider-BJDB9e9p.js} +1 -1
- package/dist-embed-sighting-editor/{GLTFLoader-2Zbfb3kh.js → GLTFLoader-CQrldtm5.js} +1 -1
- package/dist-embed-sighting-editor/{HeadlightSystem-CBmEcC9f.js → HeadlightSystem-BzXjwGDi.js} +1 -1
- package/dist-embed-sighting-editor/HvsMessages_en-BiLhEAxJ.js +1 -0
- package/dist-embed-sighting-editor/HvsMessages_es-Cbj_6eFs.js +1 -0
- package/dist-embed-sighting-editor/HvsMessages_fr-DkvE2qm1.js +1 -0
- package/dist-embed-sighting-editor/HvsMessages_it-BIJ87Uyb.js +1 -0
- package/dist-embed-sighting-editor/{HynekAssessor-uub2VxTi.js → HynekAssessor-Bpze0IeH.js} +1 -1
- package/dist-embed-sighting-editor/{InterviewEditorElement-_1fa2bG7.js → InterviewEditorElement-C6y-8Wze.js} +6 -6
- package/dist-embed-sighting-editor/InterviewMessages_en-Ikx6GjEd.js +3 -0
- package/dist-embed-sighting-editor/InterviewMessages_es-DKWWyrnb.js +3 -0
- package/dist-embed-sighting-editor/InterviewMessages_fr-DT0gXAKD.js +3 -0
- package/dist-embed-sighting-editor/InterviewMessages_it-CF_9MYPt.js +3 -0
- package/dist-embed-sighting-editor/{LanternEditor-CjQVFowY.js → LanternEditor-6fXL9oHW.js} +1 -1
- package/dist-embed-sighting-editor/{LaserBeam-BVc8Mvhr.js → LaserBeam-Cl4c8oJt.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchEditor-Cz8Mzo4a.js → LaunchEditor-C9swLaSJ.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchPlume-CvBhTPgN.js → LaunchPlume-CPBS4JLE.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchSimulation-CkZIG-3P.js → LaunchSimulation-zjImyFHC.js} +1 -1
- package/dist-embed-sighting-editor/{ModelSource-B153oeTu.js → ModelSource-ZiTya13j.js} +1 -1
- package/dist-embed-sighting-editor/{ModelThumbnails-BUL_OLFv.js → ModelThumbnails-BKl0Wk33.js} +1 -1
- package/dist-embed-sighting-editor/{ModelViewer-BzBLcY9s.js → ModelViewer-ZZnOiYz4.js} +1 -1
- package/dist-embed-sighting-editor/{ModuleConformance-Cr6fM28A.js → ModuleConformance-CYQ-Mn8w.js} +2 -2
- package/dist-embed-sighting-editor/ModuleSession-BklqVucx.js +3 -0
- package/dist-embed-sighting-editor/ModuleThree-jNUgMjnf.js +1 -0
- package/dist-embed-sighting-editor/ModulesPanelElement-MEFltyZr.js +26 -0
- package/dist-embed-sighting-editor/ModulesPanelMessages_en-CXQhQMyu.js +1 -0
- package/dist-embed-sighting-editor/ModulesPanelMessages_es-Bj-cT3f4.js +1 -0
- package/dist-embed-sighting-editor/ModulesPanelMessages_fr-B-eaMXQz.js +1 -0
- package/dist-embed-sighting-editor/ModulesPanelMessages_it-C3fS8UFN.js +1 -0
- package/dist-embed-sighting-editor/{RailwaySystem-6bwbv8UB.js → RailwaySystem-Dn-v2OAb.js} +1 -1
- package/dist-embed-sighting-editor/ReadingCheckTexts_en-C5qzU8K7.js +1 -0
- package/dist-embed-sighting-editor/ReadingCheckTexts_es-DdhtmSew.js +1 -0
- package/dist-embed-sighting-editor/ReadingCheckTexts_fr-COtovvqc.js +1 -0
- package/dist-embed-sighting-editor/ReadingCheckTexts_it-Bz32XGh6.js +1 -0
- package/dist-embed-sighting-editor/{ReentryEditor-BWCK2g_s.js → ReentryEditor-DPt4At81.js} +1 -1
- package/dist-embed-sighting-editor/{ReentrySimulation-B09JXMu5.js → ReentrySimulation-DwaQrNN5.js} +1 -1
- package/dist-embed-sighting-editor/{ReferenceSystem-8QgwbbAG.js → ReferenceSystem-DlaF5KWz.js} +1 -1
- package/dist-embed-sighting-editor/{SearchlightEditor-BpwPOhJ6.js → SearchlightEditor-CdTMwgER.js} +1 -1
- package/dist-embed-sighting-editor/SearchlightSystem-jipCae7J.js +1 -0
- package/dist-embed-sighting-editor/SightingEditorMessages_en-BmqJK2u_.js +12 -0
- package/dist-embed-sighting-editor/SightingEditorMessages_es-avQMqPMq.js +12 -0
- package/dist-embed-sighting-editor/SightingEditorMessages_fr-ClEadK1E.js +12 -0
- package/dist-embed-sighting-editor/SightingEditorMessages_it-Co5behaA.js +12 -0
- package/dist-embed-sighting-editor/{SightingElement-BQdiez39.js → SightingElement-C6CT6DBZ.js} +2 -2
- package/dist-embed-sighting-editor/{SkyLantern-D6bru_e_.js → SkyLantern-CYhqKOnv.js} +1 -1
- package/dist-embed-sighting-editor/{TraceSystem-DZMUxSn-.js → TraceSystem-Bj0G3fL7.js} +1 -1
- package/dist-embed-sighting-editor/{WaterSystem-CB5jE7qB.js → WaterSystem-Cv4v7PXz.js} +2 -2
- package/{dist-embed-ufoathome/caseSchema-BEJTs2Ld.js → dist-embed-sighting-editor/caseSchema-Cukbjeex.js} +1 -1
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +521 -452
- package/dist-embed-sighting-editor/{trafficRuntime-Bu3my6S4.js → trafficRuntime-BdBceXei.js} +1 -1
- package/dist-embed-ufoathome/{AdsbLolArchiveProvider-KbJPyJ97.js → AdsbLolArchiveProvider-D169IKdZ.js} +1 -1
- package/dist-embed-ufoathome/{AirshipEditor-CBSrQM3J.js → AirshipEditor-EBfUtSiB.js} +1 -1
- package/dist-embed-ufoathome/{AirshipFlight-Dzpw8HRM.js → AirshipFlight-6yYGIRn8.js} +1 -1
- package/dist-embed-ufoathome/{Aurora-C_mCH4JM.js → Aurora-CP_Xi-9o.js} +1 -1
- package/dist-embed-ufoathome/{AuroraEditor-Dzvgh6e0.js → AuroraEditor-B_Rxo_6I.js} +1 -1
- package/dist-embed-ufoathome/{AuroraSimulation-BRUnHmlp.js → AuroraSimulation-KHkJyuus.js} +1 -1
- package/dist-embed-ufoathome/{BallesterGuaspAssessor-DurdUgbG.js → BallesterGuaspAssessor-58lmGHUw.js} +1 -1
- package/dist-embed-ufoathome/{BalloonEditor-dCIjTsIz.js → BalloonEditor-CAKXO8DQ.js} +2 -2
- package/dist-embed-ufoathome/{BalloonFlight-CztT6ddg.js → BalloonFlight-CvE7AHlm.js} +1 -1
- package/dist-embed-ufoathome/{BeamEditor-Ccvx7l7x.js → BeamEditor-BOsTgbHL.js} +1 -1
- package/dist-embed-ufoathome/{BeamSystem-CPM8m17q.js → BeamSystem-C7OL1VWr.js} +1 -1
- package/dist-embed-ufoathome/{BirdEditor-Dk3huwHa.js → BirdEditor-CBVGyUnK.js} +1 -1
- package/dist-embed-ufoathome/{BodyEditor-BG--NjnZ.js → BodyEditor-DZ9-YBfo.js} +1 -1
- package/dist-embed-ufoathome/{CaseEditorElement-0J_TCeiq.js → CaseEditorElement-BgT6HnpX.js} +73 -69
- package/dist-embed-ufoathome/CaseElement-DVXLO8mr.js +132 -0
- package/dist-embed-ufoathome/{CaseReportExport-DKrBXPgZ.js → CaseReportExport-Dui5KDc5.js} +3 -3
- package/dist-embed-ufoathome/ColumnResize-CO4e1m-q.js +208 -0
- package/dist-embed-ufoathome/ConsentMessages_en-DBKCeDAn.js +1 -0
- package/dist-embed-ufoathome/ConsentMessages_es-Dby74lUq.js +1 -0
- package/dist-embed-ufoathome/ConsentMessages_fr-FGSpqzMc.js +1 -0
- package/dist-embed-ufoathome/ConsentMessages_it-BJWfXH6I.js +1 -0
- package/dist-embed-ufoathome/{ControlPasses-CKvTCqTI.js → ControlPasses-CJ2jMdlf.js} +1 -1
- package/dist-embed-ufoathome/{CoverageAssessor-MeOMUjkZ.js → CoverageAssessor-CzhOt6fv.js} +1 -1
- package/dist-embed-ufoathome/{DroneEditor-D60uhSHO.js → DroneEditor-7X9CM_3H.js} +1 -1
- package/dist-embed-ufoathome/{Flightradar24Provider-DxTfswSh.js → Flightradar24Provider-TCNh_VXc.js} +1 -1
- package/dist-embed-ufoathome/{GLTFLoader-pi-JKaNa.js → GLTFLoader-BaIfBICM.js} +1 -1
- package/dist-embed-ufoathome/{GeoJsonExport-iyhoKOUU.js → GeoJsonExport-B5AFUVEM.js} +1 -1
- package/dist-embed-ufoathome/GeographicFigures-DrlbDt4f.js +1 -0
- package/dist-embed-ufoathome/HvsMessages_en-BiLhEAxJ.js +1 -0
- package/dist-embed-ufoathome/HvsMessages_es-Cbj_6eFs.js +1 -0
- package/dist-embed-ufoathome/HvsMessages_fr-DkvE2qm1.js +1 -0
- package/dist-embed-ufoathome/HvsMessages_it-BIJ87Uyb.js +1 -0
- package/dist-embed-ufoathome/{HynekAssessor-Bda6csgM.js → HynekAssessor-DaCcWwTH.js} +1 -1
- package/dist-embed-ufoathome/{InterviewEditorElement-BA060rqJ.js → InterviewEditorElement-o21YUvNz.js} +6 -6
- package/dist-embed-ufoathome/{InterviewElement-DvqsCA3I.js → InterviewElement-K_oIXneA.js} +2 -2
- package/dist-embed-ufoathome/InterviewMessages_en-Ikx6GjEd.js +3 -0
- package/dist-embed-ufoathome/InterviewMessages_es-DKWWyrnb.js +3 -0
- package/dist-embed-ufoathome/InterviewMessages_fr-DT0gXAKD.js +3 -0
- package/dist-embed-ufoathome/InterviewMessages_it-CF_9MYPt.js +3 -0
- package/dist-embed-ufoathome/{KmlExport-DEPgRRWe.js → KmlExport-BfiqE1s2.js} +1 -1
- package/dist-embed-ufoathome/{LanternEditor-BapUZdog.js → LanternEditor-CepeoImr.js} +1 -1
- package/dist-embed-ufoathome/{LaserBeam--dquPX_h.js → LaserBeam-IRXmv6wc.js} +1 -1
- package/dist-embed-ufoathome/{LaunchEditor-D3P0GkLr.js → LaunchEditor-C4hq0VUw.js} +1 -1
- package/dist-embed-ufoathome/{LaunchPlume-w4l4TR4A.js → LaunchPlume-CujlF3wZ.js} +1 -1
- package/dist-embed-ufoathome/{LaunchSimulation-BpZd-Nov.js → LaunchSimulation-58_ZZy8q.js} +1 -1
- package/dist-embed-ufoathome/{ModelSource-Csnm3RH_.js → ModelSource-Bz25TN6e.js} +1 -1
- package/dist-embed-ufoathome/{ModelThumbnails-Cnt2GxTb.js → ModelThumbnails-CcYlw6gA.js} +1 -1
- package/dist-embed-ufoathome/{ModelViewer-DOfAkPgK.js → ModelViewer-CD90RTYi.js} +1 -1
- package/dist-embed-ufoathome/ModuleSession-Dac4fD0X.js +3 -0
- package/dist-embed-ufoathome/ModulesPanelElement-DZxFsuuG.js +18 -0
- package/dist-embed-ufoathome/ModulesPanelMessages_en-Dir0ADQe.js +1 -0
- package/dist-embed-ufoathome/ModulesPanelMessages_es-B_ITNG5N.js +1 -0
- package/dist-embed-ufoathome/ModulesPanelMessages_fr-DbKLtD8s.js +1 -0
- package/dist-embed-ufoathome/ModulesPanelMessages_it-CE0q7D2c.js +1 -0
- package/dist-embed-ufoathome/NearestApproach-DsszB5Rd.js +1 -0
- package/dist-embed-ufoathome/{PoherAssessor-4zSdFnFp.js → PoherAssessor-BkCJ1UTQ.js} +1 -1
- package/dist-embed-ufoathome/QuestionnaireFeed-DmyYcwwf.js +1 -0
- package/dist-embed-ufoathome/QuestionnaireForm-vT3C3qXt.js +1 -0
- package/dist-embed-ufoathome/QuestionnaireImport-BlTDOHWj.js +5 -0
- package/dist-embed-ufoathome/ReadingCheckTexts_en-C5qzU8K7.js +1 -0
- package/dist-embed-ufoathome/ReadingCheckTexts_es-DdhtmSew.js +1 -0
- package/dist-embed-ufoathome/ReadingCheckTexts_fr-COtovvqc.js +1 -0
- package/dist-embed-ufoathome/ReadingCheckTexts_it-Bz32XGh6.js +1 -0
- package/dist-embed-ufoathome/{ReentryEditor-DEi9nT0z.js → ReentryEditor-BjyUUZGU.js} +1 -1
- package/dist-embed-ufoathome/{ReentrySimulation-CSO1vgro.js → ReentrySimulation-5VI9Dla4.js} +1 -1
- package/dist-embed-ufoathome/{ReferenceSystem--tiMGm4e.js → ReferenceSystem-C0ZXvatV.js} +1 -1
- package/dist-embed-ufoathome/ScenarioReadings-CBWjF8TY.js +1 -0
- package/dist-embed-ufoathome/ScenarioSweep-MaryBOLs.js +1 -0
- package/dist-embed-ufoathome/{SearchlightEditor--1uL8bTa.js → SearchlightEditor-DPU1PgfT.js} +1 -1
- package/dist-embed-ufoathome/SearchlightSystem-m0a11CEu.js +1 -0
- package/dist-embed-ufoathome/{ShareDialogElement-Dlfy9NCE.js → ShareDialogElement-DqCoQwtn.js} +97 -76
- package/dist-embed-ufoathome/{Sighting-B7bsiTIQ.js → Sighting-D-_IYi9n.js} +1 -1
- package/dist-embed-ufoathome/SightingEditorMessages_en-BmqJK2u_.js +12 -0
- package/dist-embed-ufoathome/SightingEditorMessages_es-avQMqPMq.js +12 -0
- package/dist-embed-ufoathome/SightingEditorMessages_fr-ClEadK1E.js +12 -0
- package/dist-embed-ufoathome/SightingEditorMessages_it-Co5behaA.js +12 -0
- package/dist-embed-ufoathome/{SightingElement-BJSNmFM6.js → SightingElement-CUrYpWRD.js} +2 -2
- package/dist-embed-ufoathome/{TraceSystem-Cq2TgP-u.js → TraceSystem-BLumvnJD.js} +1 -1
- package/dist-embed-ufoathome/UfoAtHomeMessages_en-ByVu39KF.js +1 -0
- package/dist-embed-ufoathome/UfoAtHomeMessages_es-D9bLboxq.js +1 -0
- package/dist-embed-ufoathome/UfoAtHomeMessages_fr-nTqRf0ZK.js +1 -0
- package/dist-embed-ufoathome/UfoAtHomeMessages_it-4cZC5-y5.js +1 -0
- package/dist-embed-ufoathome/{VideoButton-MRJlVNm_.js → VideoButton-hYfTEunC.js} +1 -1
- package/{dist-embed-sighting-editor/caseSchema-BEJTs2Ld.js → dist-embed-ufoathome/caseSchema-Cukbjeex.js} +1 -1
- package/dist-embed-ufoathome/rr0-ufoathome.mjs +35 -17
- package/dist-embed-ufoathome/{surroundingsSources--qffL_nJ.js → surroundingsSources-BWHnZ_qg.js} +1 -1
- package/dist-embed-ufoathome/{trafficRuntime-CTCGr90P.js → trafficRuntime-Xpncp71U.js} +2 -2
- package/package.json +1 -1
- package/dist-embed-interview/InterviewMessages_en-BrnxG2rl.js +0 -3
- package/dist-embed-interview/InterviewMessages_es-Dxfjqrte.js +0 -3
- package/dist-embed-interview/InterviewMessages_fr-DIA-1qu8.js +0 -3
- package/dist-embed-interview/InterviewMessages_it-CYBEIKX-.js +0 -3
- package/dist-embed-scene/ModuleSession-XnOI5Mcr.js +0 -3
- package/dist-embed-scene/ModuleThree-BTQgimAj.js +0 -1
- package/dist-embed-scene/SearchlightSystem-CX1_nBkz.js +0 -1
- package/dist-embed-sighting/InterviewMessages_en-BrnxG2rl.js +0 -3
- package/dist-embed-sighting/InterviewMessages_es-Dxfjqrte.js +0 -3
- package/dist-embed-sighting/InterviewMessages_fr-DIA-1qu8.js +0 -3
- package/dist-embed-sighting/InterviewMessages_it-CYBEIKX-.js +0 -3
- package/dist-embed-sighting/ModuleSession-ChJsGuTn.js +0 -3
- package/dist-embed-sighting/ReadingCheckTexts_en-eq6teExJ.js +0 -1
- package/dist-embed-sighting/ReadingCheckTexts_es-CR_JJZMV.js +0 -1
- package/dist-embed-sighting/ReadingCheckTexts_fr-pcDleIvY.js +0 -1
- package/dist-embed-sighting/ReadingCheckTexts_it-MFKeoXnq.js +0 -1
- package/dist-embed-sighting/SearchlightSystem-B2-MzG4x.js +0 -1
- package/dist-embed-sighting-editor/InterviewMessages_en-BrnxG2rl.js +0 -3
- package/dist-embed-sighting-editor/InterviewMessages_es-Dxfjqrte.js +0 -3
- package/dist-embed-sighting-editor/InterviewMessages_fr-DIA-1qu8.js +0 -3
- package/dist-embed-sighting-editor/InterviewMessages_it-CYBEIKX-.js +0 -3
- package/dist-embed-sighting-editor/ModuleSession-WA6lqfV6.js +0 -3
- package/dist-embed-sighting-editor/ModuleThree-CB_EjTOI.js +0 -1
- package/dist-embed-sighting-editor/ModulesPanelElement-BsRg3mzl.js +0 -15
- package/dist-embed-sighting-editor/ModulesPanelMessages_en-DuwrY3Pm.js +0 -1
- package/dist-embed-sighting-editor/ModulesPanelMessages_es-Bq5X-XuT.js +0 -1
- package/dist-embed-sighting-editor/ModulesPanelMessages_fr-B8cSDc6o.js +0 -1
- package/dist-embed-sighting-editor/ModulesPanelMessages_it-BdC626aJ.js +0 -1
- package/dist-embed-sighting-editor/ReadingCheckTexts_en-eq6teExJ.js +0 -1
- package/dist-embed-sighting-editor/ReadingCheckTexts_es-CR_JJZMV.js +0 -1
- package/dist-embed-sighting-editor/ReadingCheckTexts_fr-pcDleIvY.js +0 -1
- package/dist-embed-sighting-editor/ReadingCheckTexts_it-MFKeoXnq.js +0 -1
- package/dist-embed-sighting-editor/SearchlightSystem-CEG52QDx.js +0 -1
- package/dist-embed-sighting-editor/SightingEditorMessages_en-k7_ua2OM.js +0 -12
- package/dist-embed-sighting-editor/SightingEditorMessages_es-Drqbbr5_.js +0 -12
- package/dist-embed-sighting-editor/SightingEditorMessages_fr-B_K5hsuV.js +0 -12
- package/dist-embed-sighting-editor/SightingEditorMessages_it-QCLg1d7x.js +0 -12
- package/dist-embed-sighting-editor/angular-size-CxoysZle.png +0 -0
- package/dist-embed-sighting-editor/azimuth-CvjiPmz0.png +0 -0
- package/dist-embed-sighting-editor/elevation-DPr5S6Jt.png +0 -0
- package/dist-embed-sighting-editor/geipan-qt-2025-B_RUiH8B.js +0 -7
- package/dist-embed-sighting-editor/protractor-DyE30B87.png +0 -0
- package/dist-embed-ufoathome/CaseElement-CRXPyMMR.js +0 -131
- package/dist-embed-ufoathome/ColumnResize-DV-byvDt.js +0 -164
- package/dist-embed-ufoathome/GeographicFigures-DBmuFlvH.js +0 -1
- package/dist-embed-ufoathome/InterviewAttachments-BP6Prvdu.js +0 -1
- package/dist-embed-ufoathome/InterviewMessages_en-BrnxG2rl.js +0 -3
- package/dist-embed-ufoathome/InterviewMessages_es-Dxfjqrte.js +0 -3
- package/dist-embed-ufoathome/InterviewMessages_fr-DIA-1qu8.js +0 -3
- package/dist-embed-ufoathome/InterviewMessages_it-CYBEIKX-.js +0 -3
- package/dist-embed-ufoathome/ModuleSession-BKDWGSEo.js +0 -3
- package/dist-embed-ufoathome/ModulesPanelElement-DH1oroWm.js +0 -15
- package/dist-embed-ufoathome/ModulesPanelMessages_en-DuwrY3Pm.js +0 -1
- package/dist-embed-ufoathome/ModulesPanelMessages_es-Bq5X-XuT.js +0 -1
- package/dist-embed-ufoathome/ModulesPanelMessages_fr-B8cSDc6o.js +0 -1
- package/dist-embed-ufoathome/ModulesPanelMessages_it-BdC626aJ.js +0 -1
- package/dist-embed-ufoathome/NearestApproach-DJ98M81-.js +0 -1
- package/dist-embed-ufoathome/QuestionnaireFeed-W69udpmT.js +0 -1
- package/dist-embed-ufoathome/QuestionnaireForm-U78nFPn5.js +0 -1
- package/dist-embed-ufoathome/QuestionnaireImport-Q5uHxQwU.js +0 -5
- package/dist-embed-ufoathome/ReadingCheckTexts_en-eq6teExJ.js +0 -1
- package/dist-embed-ufoathome/ReadingCheckTexts_es-CR_JJZMV.js +0 -1
- package/dist-embed-ufoathome/ReadingCheckTexts_fr-pcDleIvY.js +0 -1
- package/dist-embed-ufoathome/ReadingCheckTexts_it-MFKeoXnq.js +0 -1
- package/dist-embed-ufoathome/ScenarioReadings-Dzdgopl3.js +0 -1
- package/dist-embed-ufoathome/ScenarioSweep-CMcleprC.js +0 -1
- package/dist-embed-ufoathome/SearchlightSystem-7bntVtp_.js +0 -1
- package/dist-embed-ufoathome/SightingEditorMessages_en-k7_ua2OM.js +0 -12
- package/dist-embed-ufoathome/SightingEditorMessages_es-Drqbbr5_.js +0 -12
- package/dist-embed-ufoathome/SightingEditorMessages_fr-B_K5hsuV.js +0 -12
- package/dist-embed-ufoathome/SightingEditorMessages_it-QCLg1d7x.js +0 -12
- package/dist-embed-ufoathome/UfoAtHomeMessages_en-BK2qJyZN.js +0 -1
- package/dist-embed-ufoathome/UfoAtHomeMessages_es-B1-NDCau.js +0 -1
- package/dist-embed-ufoathome/UfoAtHomeMessages_fr-BTG047qo.js +0 -1
- package/dist-embed-ufoathome/UfoAtHomeMessages_it-Ryxv4HNU.js +0 -1
- package/dist-embed-ufoathome/angular-size-CxoysZle.png +0 -0
- package/dist-embed-ufoathome/azimuth-CvjiPmz0.png +0 -0
- package/dist-embed-ufoathome/elevation-DPr5S6Jt.png +0 -0
- package/dist-embed-ufoathome/geipan-qt-2025-B_RUiH8B.js +0 -7
- package/dist-embed-ufoathome/protractor-DyE30B87.png +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bH as X}from"./rr0-scene.mjs";class a{static SAMPLE_MS=1e3;static MAX_KEYFRAMES=6e3;static STEP_S=.05;static G=9.80665;static R=8.314462;static AIR_KG_MOL=.0289644;static R_AIR=a.R/a.AIR_KG_MOL;static TURBULENCE={horizontalMS:.8,verticalMS:.3,timescaleS:30};static GUST_GROUND_M=2;static MAX_FLAMES=9;static TETHER_M=30;static CRUISE_M=300;static PILOT_MS=2;static TITLES={"hot-air":{en:"Hot-air balloon",fr:"Montgolfière",es:"Globo aerostático",it:"Mongolfiera"},party:{en:"Party balloon",fr:"Ballon de baudruche",es:"Globo de fiesta",it:"Palloncino"},led:{en:"LED balloon",fr:"Ballon lumineux à LED",es:"Globo de LED",it:"Palloncino a LED"},foil:{en:"Foil balloon",fr:"Ballon métallisé",es:"Globo metalizado",it:"Palloncino metallizzato"},pilot:{en:"Pilot balloon",fr:"Ballon pilote",es:"Globo piloto",it:"Pallone pilota"},weather:{en:"Weather balloon",fr:"Ballon-sonde",es:"Globo sonda",it:"Pallone sonda"},stratospheric:{en:"Stratospheric balloon",fr:"Ballon stratosphérique",es:"Globo estratosférico",it:"Pallone stratosferico"},"stratospheric-large":{en:"Large stratospheric balloon",fr:"Grand ballon stratosphérique",es:"Gran globo estratosférico",it:"Grande pallone stratosferico"},superpressure:{en:"Superpressure balloon",fr:"Ballon pressurisé",es:"Globo presurizado",it:"Pallone pressurizzato"},infrared:{en:"Infrared hot-air balloon",fr:"Montgolfière infrarouge",es:"Globo infrarrojo",it:"Mongolfiera infrarossa"},"prank-candles":{en:"Prank balloon",fr:"Ballon farceur",es:"Globo de broma",it:"Pallone scherzo"},"prank-flares":{en:"Prank balloon with a flare",fr:"Ballon farceur à feu de détresse",es:"Globo de broma con bengala",it:"Pallone scherzo con razzo"},"anti-hail":{en:"Anti-hail balloon",fr:"Ballon anti-grêle",es:"Globo antigranizo",it:"Pallone antigrandine"},solar:{en:"Solar balloon",fr:"Ballon solaire",es:"Globo solar",it:"Pallone solare"},captive:{en:"Captive balloon",fr:"Ballon captif",es:"Globo cautivo",it:"Pallone frenato"}};static computed=new Map;static bodiesOf(e){const n=JSON.stringify(e);let r=a.computed.get(n);if(!r){const t=a.releasesOf(e);r=t.flatMap((c,o)=>a.balloonBodies(e,c,o,t.length)),a.computed.set(n,r),a.computed.size>16&&a.computed.delete(a.computed.keys().next().value)}return r}static typeOf(e){const n=e.balloon,r=typeof n=="string"?n:n?.id,t=X.byId(r)??X.ALL[0],c=t.shapes?t.shapes[e.shape??"round"]??Object.values(t.shapes)[0]:void 0,o=c?{...t,...c}:t;return typeof n=="string"?o:{...o,...n,id:o.id}}static flamesOf(e,n){return n.flames?Math.max(1,Math.min(9,Math.round(e.flames??n.flames.count))):0}static flameShare(e,n){const r=e.flames?.burnS;if(r===void 0||n<0||n>=r)return 0;const t=r*.75;return n<=t?1:(r-n)/(r-t)}static releasesOf(e){const n=[...e.releases??[]],r=e.group;if(r&&r.count>0){const t=a.randomFrom(r.seed??1),c=r.count>1?(r.untilT-r.fromT)/(r.count-1):0,o=r.radiusM??10,d=r.fillSpread??.1;for(let i=0;i<r.count;i++){const f=r.fromT+c*i+(t()-.5)*c,p=o*Math.sqrt(t()),u=2*Math.PI*t();n.push({t:Math.round(Math.min(r.untilT,Math.max(r.fromT,f))),eastM:Math.round(p*Math.sin(u)*10)/10,northM:Math.round(p*Math.cos(u)*10)/10,fill:Math.round((2*t()-1)*d*1e3)/1e3,...r.colors?.length?{color:r.colors[i%r.colors.length]}:{},seed:Math.floor(t()*4294967296)})}}return n.length>0?n:[{t:0}]}static airAt(e,n=0,r=0){const t=a.LAYERS,c=Math.max(-500,Math.min(a.EARTH_RADIUS_M*e/(a.EARTH_RADIUS_M+e),47e3));let o=t[0];for(const M of t)c>=M.fromM&&(o=M);const d=c-o.fromM,i=o.baseK+o.lapseKM*d,f=a.G*a.AIR_KG_MOL/a.R,p=o.lapseKM===0?o.basePa*Math.exp(-f*d/o.baseK):o.basePa*Math.pow(o.baseK/i,f/o.lapseKM),u=Math.max(0,1-Math.max(0,e-r)/11e3);return{pressurePa:p,temperatureK:i+n*u}}static EARTH_RADIUS_M=6356766;static LAYERS=[{fromM:0,baseK:288.15,basePa:101325,lapseKM:-.0065},{fromM:11e3,baseK:216.65,basePa:22632.06,lapseKM:0},{fromM:2e4,baseK:216.65,basePa:5474.889,lapseKM:.001},{fromM:32e3,baseK:228.65,basePa:868.0187,lapseKM:.0028}];static windAt(e,n){const r=[{atM:0,...e.wind??{towardDeg:0,speedMS:0}},...[...e.windsAloft??[]].sort((c,o)=>c.atM-o.atM)],t=c=>({x:Math.sin(c.towardDeg*Math.PI/180)*c.speedMS,y:Math.cos(c.towardDeg*Math.PI/180)*c.speedMS});if(n<=r[0].atM||r.length===1)return t(r[0]);for(let c=1;c<r.length;c++){if(n>r[c].atM)continue;const o=t(r[c-1]),d=t(r[c]),i=(n-r[c-1].atM)/Math.max(1e-6,r[c].atM-r[c-1].atM);return{x:o.x+(d.x-o.x)*i,y:o.y+(d.y-o.y)*i}}return t(r[r.length-1])}static planAt(e,n){const r=[...e.plan??[]].sort((c,o)=>c.t-o.t);if(r.length===0)return a.CRUISE_M;let t=r[0].altitudeM;for(const c of r)c.t<=n&&(t=c.altitudeM);return t}static widthOf(e,n){return e.widthM!==void 0?e.widthM:Math.cbrt(6*n/Math.PI)}static trajectory(e,n,r=a.SAMPLE_MS){const t=a.typeOf(e),c=e.site,o=c.altitudeM??0,d=c.originElevationM??0,i=d+o,f=(e.airTemperatureC??15)+273.15-a.airAt(i).temperatureK,p=t.gasMolarMassKgMol??X.HELIUM_KG_MOL,u=e.durationS??t.durationS,M=a.STEP_S,v=Math.ceil(u/M);r=Math.max(r,Math.ceil(u*1e3/a.MAX_KEYFRAMES/500)*500);const x=Math.max(1,Math.round(r/1e3/M)),K={x:c.eastM+(n.eastM??0),y:c.northM+(n.northM??0)},E=t.tethered?e.tetherM??a.TETHER_M:void 0,T=a.flamesOf(e,t),O=t.flames?(t.insideExcessK??0)*T/t.flames.count:0,A=l=>{const{pressurePa:m,temperatureK:b}=a.airAt(l+d,f,i);return{p:m,T:b,rho:m/(a.R_AIR*b)}},D=1+(n.fill??0),V=t.launchVolumeM3*D*101325*p/(a.R*288.15),z=n.altitudeM??o,s={x:K.x,y:K.y,z,vx:0,vy:0,vz:0,gasKg:V,excessK:0,burnUntilS:-1,ballastKg:t.ballastKg??0,floated:!1};if(t.envelope==="open"){const l=A(z);s.excessK=t.burner?Math.max(0,l.T*t.massKg/(l.rho*t.maxVolumeM3-t.massKg)):t.flames?O*a.flameShare(t,0):t.insideExcessK??0}const S=l=>{if(t.envelope==="sealed")return t.maxVolumeM3;if(t.envelope==="open")return t.launchVolumeM3>=t.maxVolumeM3?t.maxVolumeM3:Math.min(t.maxVolumeM3,t.launchVolumeM3*D*(101325/288.15)/(l.p/l.T));const m=s.gasKg*a.R*l.T/(l.p*p);return t.envelope==="elastic"?m:Math.min(m,t.maxVolumeM3)},P=A(z),y=[{t:n.t,x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,S(P)),burning:!1,flame:a.flameShare(t,0)}],k=a.gusts(e.turbulence??a.TURBULENCE,a.seedOf(n),M);let w="time",q=0,Y=-1/0;for(let l=1;l<=v;l++){const m=l*M,b=A(s.z);let R=S(b);if(t.torch&&s.z-o>=(e.triggerM??t.torch.aboveM)){w="lit",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,R),burning:!1,flame:0});break}if(t.envelope==="elastic"&&R>=t.maxVolumeM3){w="burst",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,t.maxVolumeM3),burning:!1,flame:0});break}if(t.envelope==="vented"){const h=t.maxVolumeM3*b.p*p/(a.R*b.T);s.gasKg>=h&&(s.gasKg=h,s.floated=!0),R=S(b)}const G=t.burner;let I=!1;if(G){const h=a.planAt(e,n.t+m*1e3),F=h<=0?-Math.min(1,Math.max(.5,(s.z-o)/40))*a.PILOT_MS/2:Math.max(-a.PILOT_MS,Math.min(a.PILOT_MS,(h+o-s.z)/40)),ee=h<=0,ce=ee?-2.5:F-.3,ie=ee?-.3:F+.8;m>=s.burnUntilS&&s.vz<ce&&m-Y>2&&s.excessK<G.maxExcessK&&(s.burnUntilS=m+G.blastS),I=m<s.burnUntilS,!I&&s.burnUntilS>0&&m-M<s.burnUntilS&&(Y=m),I&&(s.excessK=Math.min(G.maxExcessK,s.excessK+G.heatingKS*M)),s.excessK-=s.excessK/G.coolingS*M,!I&&s.vz>ie&&(s.excessK-=.5*M),s.excessK=Math.max(0,s.excessK)}const j=a.flameShare(t,m);t.flames&&(s.excessK+=(O*j-s.excessK)*Math.min(1,M/t.flames.coolingS));const Z=t.envelope==="open"?b.p*R/(a.R_AIR*(b.T+s.excessK)):s.gasKg,N=(b.rho*R-Z)*a.G;let U=t.massKg-((t.ballastKg??0)-s.ballastKg);if(s.floated&&s.ballastKg>0&&N<U*a.G){const h=Math.min(s.ballastKg,U-N/a.G);s.ballastKg-=h,U-=h}const te=U*a.G,W=U+Z+.5*b.rho*R,H=a.widthOf(t,R),se=Math.PI*H*H/4*(t.depthRatio!==void 0?(1+t.depthRatio)/2:1),J=s.z-o,Q=a.windAt(e,J),$=k(),ae=Math.max(0,Math.min(1,J/a.GUST_GROUND_M)),C={x:Q.x+$.x,y:Q.y+$.y,z:$.z*ae},re=s.vx-C.x,oe=s.vy-C.y,ne=s.vz-C.z,L=.5*b.rho*t.dragCoefficient*se*Math.hypot(re,oe,ne)/W;s.vx=(s.vx+L*M*C.x)/(1+L*M),s.vy=(s.vy+L*M*C.y)/(1+L*M),s.vz=(s.vz+L*M*C.z+(N-te)/W*M)/(1+L*M);const g=s.z<=o+1e-6&&s.vz<=0;g&&(s.vx=0,s.vy=0,s.vz=0),s.x+=s.vx*M,s.y+=s.vy*M,s.z=Math.max(o,s.z+s.vz*M),E!==void 0&&a.heldBy(s,K,o,E),q=g&&m>10?q+M:0;const _=q>30&&!t.tethered,B=y.length>0&&y[y.length-1].burning!==I;if(l%x===0||l===v||B||_){const h=n.t+Math.round(m*1e3);B&&y.push({t:h-1,x:s.x,y:s.y,z:s.z,widthM:H,burning:!I,flame:j}),y.push({t:h,x:s.x,y:s.y,z:s.z,widthM:H,burning:I,flame:j})}if(_){w="landed";break}}return{samples:y,end:w}}static heldBy(e,n,r,t){const c=e.x-n.x,o=e.y-n.y,d=e.z-r,i=Math.hypot(c,o,d);if(i<=t||i===0)return;const f=c/i,p=o/i,u=d/i;e.x=n.x+f*t,e.y=n.y+p*t,e.z=r+u*t;const M=e.vx*f+e.vy*p+e.vz*u;M>0&&(e.vx-=M*f,e.vy-=M*p,e.vz-=M*u)}static balloonBodies(e,n,r,t){const{samples:c,end:o}=a.trajectory(e,n),d=a.balloonBody(e,n,r,t,c),i=a.typeOf(e);return o==="lit"&&i.torch?[d,a.torchBody(e,n,d.id,c[c.length-1],i.torch)]:[d]}static torchBody(e,n,r,t,c){const o=e.site.altitudeM??0,d=a.TORCH_FLAME_M/2,i=[];let f=t.x,p=t.y,u=t.z;const M=a.randomFrom(a.seedOf(n)^1374496523),v={degrees:4+4*M(),periodS:2+2*M(),phase:2*Math.PI*M()};for(let x=0;;x++){const K=x<c.burnS*.9?1:x<c.burnS?(c.burnS-x)/(c.burnS*.1):0,E=2*Math.PI*x/v.periodS+v.phase;if(i.push({t:t.t+x*1e3,eastM:a.round(f),northM:a.round(p),altitudeM:a.round(u),...x===0?{sizeM:a.TORCH_SIZE,present:!0,appearance:{color:"#d8d2c4",albedo:.6}}:{},attitude:{pitchDeg:a.round(v.degrees*Math.sin(E),10),rollDeg:a.round(v.degrees*Math.cos(E),10)},lights:{"light-flame":a.round(c.candela*K/(Math.PI*d*d),1)}}),u<=o)break;const T=a.windAt(e,u-o);f+=T.x,p+=T.y,u=Math.max(o,u-c.fallMS)}return i.push({t:i[i.length-1].t+1,present:!1}),{id:`${r}-torch`,title:a.TORCH_TITLE,...e.explains?{explains:e.explains}:{},model:{id:"ufoathome-balloon-torch"},modelParameters:{flameColor:c.color},track:i}}static TORCH_SIZE={widthM:1.2,lengthM:1.2,heightM:1.6};static TORCH_FLAME_M=.2;static TORCH_TITLE={en:"Hygroscopic torch",fr:"Torche hygroscopique",es:"Antorcha higroscópica",it:"Torcia igroscopica"};static balloonBody(e,n,r,t,c){const o=a.typeOf(e),d=n.color??e.color??(o.glow?o.glow.color:o.color),i=o.depthRatio??1,f=e.lit&&o.lamp?o.lamp:void 0,p=s=>o.glow?o.glow.candela/(Math.PI*s*s/4):0,u=a.randomFrom(a.seedOf(n)^2654435769),M=o.spins?(5+15*u())*(u()<.5?-1:1):0,v=360*u(),x=o.sways?{degrees:3+4*u(),periodS:3+3*u(),phase:2*Math.PI*u()}:void 0,K=s=>{if(M===0&&!x)return;const S=(s-n.t)/1e3,P=x?2*Math.PI*S/x.periodS+x.phase:0;return{...M!==0?{headingDeg:a.round(((v+M*S)%360+360)%360,10)}:{},...x?{pitchDeg:a.round(x.degrees*Math.sin(P),10),rollDeg:a.round(x.degrees*Math.cos(P*.83),10)}:{}}},E=a.flamesOf(e,o),T=e.partColors?.flame??o.flames?.color;let O=-1;const A=c.map((s,S)=>{const P=Math.abs(s.widthM-O)>O*.005;P&&(O=s.widthM);const y={widthM:a.round(s.widthM,1e3),lengthM:a.round(s.widthM*i,1e3),heightM:a.round(s.widthM*o.aspect,1e3)},k={t:s.t,eastM:a.round(s.x),northM:a.round(s.y),altitudeM:a.round(s.z),...S===0?{present:!0}:{},...P?{sizeM:y}:{},...K(s.t)?{attitude:K(s.t)}:{},...S===0?{appearance:{color:d,albedo:o.albedo,...o.finish?{finish:o.finish}:{},...o.glow?{luminanceCdM2:p(s.widthM)}:{}}}:o.glow&&P?{appearance:{color:d,luminanceCdM2:a.round(p(s.widthM),100)}}:{}},w=a.lightsOf(o,s.burning,f,s.widthM,E,s.flame);return w&&(k.lights=w),k});A.push({t:c[c.length-1].t+1,present:!1});const D=e.title??a.TITLES[o.id],V=e.explainsEach?e.explainsEach[r]!==void 0?{explains:[e.explainsEach[r]]}:{}:{...e.explains?{explains:e.explains}:{},...t>1?{ensemble:e.id}:{}},z={envelopeColor:d};o.stripeColor&&(z.stripeColor=o.stripeColor),f&&(z.lampColor=f.color),T&&(z.flameColor=T);for(const[s,S]of Object.entries(e.partColors??{}))z[`${s}Color`]=S;return{id:t>1?`${e.id}-${r+1}`:e.id,title:D,...V,model:{id:o.modelId},modelParameters:z,...o.id==="hot-air"?{sound:{kind:"balloon"}}:{},altitudeFrom:{eastM:c[0].x,northM:c[0].y},track:A}}static lightsOf(e,n,r,t,c=0,o=0){if(e.flames){const d=t/50,i={};for(let f=1;f<=a.MAX_FLAMES;f++)i[`light-flame-${f}`]=f<=c?a.round(e.flames.candela*o/(Math.PI*d*d),1):0;return i.envelope=a.round(e.flames.candela*c*o*.5/(Math.PI*t/2*t*e.aspect/2),1e3),i}if(e.burner){const d=n?e.burner.envelopeCdM2:0;return{flame:n?e.burner.flameCdM2:0,envelope:d,"envelope-stripe":d}}if(e.modelId==="ufoathome-balloon-latex"){const d=t/40;return{"light-lamp":r?a.round(r.candela/(Math.PI*d*d),1):0}}}static seedOf(e){return e.seed!==void 0?e.seed:Math.round(e.t)*2654435761+Math.round((e.eastM??0)*100)*40503+Math.round((e.northM??0)*100)>>>0}static gusts(e,n,r){const t=a.randomFrom(n),c=()=>Math.sqrt(-2*Math.log(Math.max(1e-12,t())))*Math.cos(2*Math.PI*t()),o=e.timescaleS>0?Math.exp(-r/e.timescaleS):0,d=Math.sqrt(1-o*o),i={x:e.horizontalMS*c(),y:e.horizontalMS*c(),z:e.verticalMS*c()};return()=>(i.x=o*i.x+d*e.horizontalMS*c(),i.y=o*i.y+d*e.horizontalMS*c(),i.z=o*i.z+d*e.verticalMS*c(),i)}static randomFrom(e){let n=e>>>0;return()=>{n=n+1831565813>>>0;let r=n;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}static round(e,n=100){return Math.round(e*n)/n}}export{a as BalloonFlight};
|
|
1
|
+
import{bG as X}from"./rr0-scene.mjs";class a{static SAMPLE_MS=1e3;static MAX_KEYFRAMES=6e3;static STEP_S=.05;static G=9.80665;static R=8.314462;static AIR_KG_MOL=.0289644;static R_AIR=a.R/a.AIR_KG_MOL;static TURBULENCE={horizontalMS:.8,verticalMS:.3,timescaleS:30};static GUST_GROUND_M=2;static MAX_FLAMES=9;static TETHER_M=30;static CRUISE_M=300;static PILOT_MS=2;static TITLES={"hot-air":{en:"Hot-air balloon",fr:"Montgolfière",es:"Globo aerostático",it:"Mongolfiera"},party:{en:"Party balloon",fr:"Ballon de baudruche",es:"Globo de fiesta",it:"Palloncino"},led:{en:"LED balloon",fr:"Ballon lumineux à LED",es:"Globo de LED",it:"Palloncino a LED"},foil:{en:"Foil balloon",fr:"Ballon métallisé",es:"Globo metalizado",it:"Palloncino metallizzato"},pilot:{en:"Pilot balloon",fr:"Ballon pilote",es:"Globo piloto",it:"Pallone pilota"},weather:{en:"Weather balloon",fr:"Ballon-sonde",es:"Globo sonda",it:"Pallone sonda"},stratospheric:{en:"Stratospheric balloon",fr:"Ballon stratosphérique",es:"Globo estratosférico",it:"Pallone stratosferico"},"stratospheric-large":{en:"Large stratospheric balloon",fr:"Grand ballon stratosphérique",es:"Gran globo estratosférico",it:"Grande pallone stratosferico"},superpressure:{en:"Superpressure balloon",fr:"Ballon pressurisé",es:"Globo presurizado",it:"Pallone pressurizzato"},infrared:{en:"Infrared hot-air balloon",fr:"Montgolfière infrarouge",es:"Globo infrarrojo",it:"Mongolfiera infrarossa"},"prank-candles":{en:"Prank balloon",fr:"Ballon farceur",es:"Globo de broma",it:"Pallone scherzo"},"prank-flares":{en:"Prank balloon with a flare",fr:"Ballon farceur à feu de détresse",es:"Globo de broma con bengala",it:"Pallone scherzo con razzo"},"anti-hail":{en:"Anti-hail balloon",fr:"Ballon anti-grêle",es:"Globo antigranizo",it:"Pallone antigrandine"},solar:{en:"Solar balloon",fr:"Ballon solaire",es:"Globo solar",it:"Pallone solare"},captive:{en:"Captive balloon",fr:"Ballon captif",es:"Globo cautivo",it:"Pallone frenato"}};static computed=new Map;static bodiesOf(e){const n=JSON.stringify(e);let r=a.computed.get(n);if(!r){const t=a.releasesOf(e);r=t.flatMap((c,o)=>a.balloonBodies(e,c,o,t.length)),a.computed.set(n,r),a.computed.size>16&&a.computed.delete(a.computed.keys().next().value)}return r}static typeOf(e){const n=e.balloon,r=typeof n=="string"?n:n?.id,t=X.byId(r)??X.ALL[0],c=t.shapes?t.shapes[e.shape??"round"]??Object.values(t.shapes)[0]:void 0,o=c?{...t,...c}:t;return typeof n=="string"?o:{...o,...n,id:o.id}}static flamesOf(e,n){return n.flames?Math.max(1,Math.min(9,Math.round(e.flames??n.flames.count))):0}static flameShare(e,n){const r=e.flames?.burnS;if(r===void 0||n<0||n>=r)return 0;const t=r*.75;return n<=t?1:(r-n)/(r-t)}static releasesOf(e){const n=[...e.releases??[]],r=e.group;if(r&&r.count>0){const t=a.randomFrom(r.seed??1),c=r.count>1?(r.untilT-r.fromT)/(r.count-1):0,o=r.radiusM??10,d=r.fillSpread??.1;for(let i=0;i<r.count;i++){const f=r.fromT+c*i+(t()-.5)*c,p=o*Math.sqrt(t()),u=2*Math.PI*t();n.push({t:Math.round(Math.min(r.untilT,Math.max(r.fromT,f))),eastM:Math.round(p*Math.sin(u)*10)/10,northM:Math.round(p*Math.cos(u)*10)/10,fill:Math.round((2*t()-1)*d*1e3)/1e3,...r.colors?.length?{color:r.colors[i%r.colors.length]}:{},seed:Math.floor(t()*4294967296)})}}return n.length>0?n:[{t:0}]}static airAt(e,n=0,r=0){const t=a.LAYERS,c=Math.max(-500,Math.min(a.EARTH_RADIUS_M*e/(a.EARTH_RADIUS_M+e),47e3));let o=t[0];for(const M of t)c>=M.fromM&&(o=M);const d=c-o.fromM,i=o.baseK+o.lapseKM*d,f=a.G*a.AIR_KG_MOL/a.R,p=o.lapseKM===0?o.basePa*Math.exp(-f*d/o.baseK):o.basePa*Math.pow(o.baseK/i,f/o.lapseKM),u=Math.max(0,1-Math.max(0,e-r)/11e3);return{pressurePa:p,temperatureK:i+n*u}}static EARTH_RADIUS_M=6356766;static LAYERS=[{fromM:0,baseK:288.15,basePa:101325,lapseKM:-.0065},{fromM:11e3,baseK:216.65,basePa:22632.06,lapseKM:0},{fromM:2e4,baseK:216.65,basePa:5474.889,lapseKM:.001},{fromM:32e3,baseK:228.65,basePa:868.0187,lapseKM:.0028}];static windAt(e,n){const r=[{atM:0,...e.wind??{towardDeg:0,speedMS:0}},...[...e.windsAloft??[]].sort((c,o)=>c.atM-o.atM)],t=c=>({x:Math.sin(c.towardDeg*Math.PI/180)*c.speedMS,y:Math.cos(c.towardDeg*Math.PI/180)*c.speedMS});if(n<=r[0].atM||r.length===1)return t(r[0]);for(let c=1;c<r.length;c++){if(n>r[c].atM)continue;const o=t(r[c-1]),d=t(r[c]),i=(n-r[c-1].atM)/Math.max(1e-6,r[c].atM-r[c-1].atM);return{x:o.x+(d.x-o.x)*i,y:o.y+(d.y-o.y)*i}}return t(r[r.length-1])}static planAt(e,n){const r=[...e.plan??[]].sort((c,o)=>c.t-o.t);if(r.length===0)return a.CRUISE_M;let t=r[0].altitudeM;for(const c of r)c.t<=n&&(t=c.altitudeM);return t}static widthOf(e,n){return e.widthM!==void 0?e.widthM:Math.cbrt(6*n/Math.PI)}static trajectory(e,n,r=a.SAMPLE_MS){const t=a.typeOf(e),c=e.site,o=c.altitudeM??0,d=c.originElevationM??0,i=d+o,f=(e.airTemperatureC??15)+273.15-a.airAt(i).temperatureK,p=t.gasMolarMassKgMol??X.HELIUM_KG_MOL,u=e.durationS??t.durationS,M=a.STEP_S,v=Math.ceil(u/M);r=Math.max(r,Math.ceil(u*1e3/a.MAX_KEYFRAMES/500)*500);const x=Math.max(1,Math.round(r/1e3/M)),K={x:c.eastM+(n.eastM??0),y:c.northM+(n.northM??0)},E=t.tethered?e.tetherM??a.TETHER_M:void 0,T=a.flamesOf(e,t),O=t.flames?(t.insideExcessK??0)*T/t.flames.count:0,A=l=>{const{pressurePa:m,temperatureK:b}=a.airAt(l+d,f,i);return{p:m,T:b,rho:m/(a.R_AIR*b)}},D=1+(n.fill??0),V=t.launchVolumeM3*D*101325*p/(a.R*288.15),z=n.altitudeM??o,s={x:K.x,y:K.y,z,vx:0,vy:0,vz:0,gasKg:V,excessK:0,burnUntilS:-1,ballastKg:t.ballastKg??0,floated:!1};if(t.envelope==="open"){const l=A(z);s.excessK=t.burner?Math.max(0,l.T*t.massKg/(l.rho*t.maxVolumeM3-t.massKg)):t.flames?O*a.flameShare(t,0):t.insideExcessK??0}const S=l=>{if(t.envelope==="sealed")return t.maxVolumeM3;if(t.envelope==="open")return t.launchVolumeM3>=t.maxVolumeM3?t.maxVolumeM3:Math.min(t.maxVolumeM3,t.launchVolumeM3*D*(101325/288.15)/(l.p/l.T));const m=s.gasKg*a.R*l.T/(l.p*p);return t.envelope==="elastic"?m:Math.min(m,t.maxVolumeM3)},P=A(z),y=[{t:n.t,x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,S(P)),burning:!1,flame:a.flameShare(t,0)}],k=a.gusts(e.turbulence??a.TURBULENCE,a.seedOf(n),M);let w="time",q=0,Y=-1/0;for(let l=1;l<=v;l++){const m=l*M,b=A(s.z);let R=S(b);if(t.torch&&s.z-o>=(e.triggerM??t.torch.aboveM)){w="lit",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,R),burning:!1,flame:0});break}if(t.envelope==="elastic"&&R>=t.maxVolumeM3){w="burst",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,t.maxVolumeM3),burning:!1,flame:0});break}if(t.envelope==="vented"){const h=t.maxVolumeM3*b.p*p/(a.R*b.T);s.gasKg>=h&&(s.gasKg=h,s.floated=!0),R=S(b)}const G=t.burner;let I=!1;if(G){const h=a.planAt(e,n.t+m*1e3),F=h<=0?-Math.min(1,Math.max(.5,(s.z-o)/40))*a.PILOT_MS/2:Math.max(-a.PILOT_MS,Math.min(a.PILOT_MS,(h+o-s.z)/40)),ee=h<=0,ce=ee?-2.5:F-.3,ie=ee?-.3:F+.8;m>=s.burnUntilS&&s.vz<ce&&m-Y>2&&s.excessK<G.maxExcessK&&(s.burnUntilS=m+G.blastS),I=m<s.burnUntilS,!I&&s.burnUntilS>0&&m-M<s.burnUntilS&&(Y=m),I&&(s.excessK=Math.min(G.maxExcessK,s.excessK+G.heatingKS*M)),s.excessK-=s.excessK/G.coolingS*M,!I&&s.vz>ie&&(s.excessK-=.5*M),s.excessK=Math.max(0,s.excessK)}const j=a.flameShare(t,m);t.flames&&(s.excessK+=(O*j-s.excessK)*Math.min(1,M/t.flames.coolingS));const Z=t.envelope==="open"?b.p*R/(a.R_AIR*(b.T+s.excessK)):s.gasKg,N=(b.rho*R-Z)*a.G;let U=t.massKg-((t.ballastKg??0)-s.ballastKg);if(s.floated&&s.ballastKg>0&&N<U*a.G){const h=Math.min(s.ballastKg,U-N/a.G);s.ballastKg-=h,U-=h}const te=U*a.G,W=U+Z+.5*b.rho*R,H=a.widthOf(t,R),se=Math.PI*H*H/4*(t.depthRatio!==void 0?(1+t.depthRatio)/2:1),J=s.z-o,Q=a.windAt(e,J),$=k(),ae=Math.max(0,Math.min(1,J/a.GUST_GROUND_M)),C={x:Q.x+$.x,y:Q.y+$.y,z:$.z*ae},re=s.vx-C.x,oe=s.vy-C.y,ne=s.vz-C.z,L=.5*b.rho*t.dragCoefficient*se*Math.hypot(re,oe,ne)/W;s.vx=(s.vx+L*M*C.x)/(1+L*M),s.vy=(s.vy+L*M*C.y)/(1+L*M),s.vz=(s.vz+L*M*C.z+(N-te)/W*M)/(1+L*M);const g=s.z<=o+1e-6&&s.vz<=0;g&&(s.vx=0,s.vy=0,s.vz=0),s.x+=s.vx*M,s.y+=s.vy*M,s.z=Math.max(o,s.z+s.vz*M),E!==void 0&&a.heldBy(s,K,o,E),q=g&&m>10?q+M:0;const _=q>30&&!t.tethered,B=y.length>0&&y[y.length-1].burning!==I;if(l%x===0||l===v||B||_){const h=n.t+Math.round(m*1e3);B&&y.push({t:h-1,x:s.x,y:s.y,z:s.z,widthM:H,burning:!I,flame:j}),y.push({t:h,x:s.x,y:s.y,z:s.z,widthM:H,burning:I,flame:j})}if(_){w="landed";break}}return{samples:y,end:w}}static heldBy(e,n,r,t){const c=e.x-n.x,o=e.y-n.y,d=e.z-r,i=Math.hypot(c,o,d);if(i<=t||i===0)return;const f=c/i,p=o/i,u=d/i;e.x=n.x+f*t,e.y=n.y+p*t,e.z=r+u*t;const M=e.vx*f+e.vy*p+e.vz*u;M>0&&(e.vx-=M*f,e.vy-=M*p,e.vz-=M*u)}static balloonBodies(e,n,r,t){const{samples:c,end:o}=a.trajectory(e,n),d=a.balloonBody(e,n,r,t,c),i=a.typeOf(e);return o==="lit"&&i.torch?[d,a.torchBody(e,n,d.id,c[c.length-1],i.torch)]:[d]}static torchBody(e,n,r,t,c){const o=e.site.altitudeM??0,d=a.TORCH_FLAME_M/2,i=[];let f=t.x,p=t.y,u=t.z;const M=a.randomFrom(a.seedOf(n)^1374496523),v={degrees:4+4*M(),periodS:2+2*M(),phase:2*Math.PI*M()};for(let x=0;;x++){const K=x<c.burnS*.9?1:x<c.burnS?(c.burnS-x)/(c.burnS*.1):0,E=2*Math.PI*x/v.periodS+v.phase;if(i.push({t:t.t+x*1e3,eastM:a.round(f),northM:a.round(p),altitudeM:a.round(u),...x===0?{sizeM:a.TORCH_SIZE,present:!0,appearance:{color:"#d8d2c4",albedo:.6}}:{},attitude:{pitchDeg:a.round(v.degrees*Math.sin(E),10),rollDeg:a.round(v.degrees*Math.cos(E),10)},lights:{"light-flame":a.round(c.candela*K/(Math.PI*d*d),1)}}),u<=o)break;const T=a.windAt(e,u-o);f+=T.x,p+=T.y,u=Math.max(o,u-c.fallMS)}return i.push({t:i[i.length-1].t+1,present:!1}),{id:`${r}-torch`,title:a.TORCH_TITLE,...e.explains?{explains:e.explains}:{},model:{id:"ufoathome-balloon-torch"},modelParameters:{flameColor:c.color},track:i}}static TORCH_SIZE={widthM:1.2,lengthM:1.2,heightM:1.6};static TORCH_FLAME_M=.2;static TORCH_TITLE={en:"Hygroscopic torch",fr:"Torche hygroscopique",es:"Antorcha higroscópica",it:"Torcia igroscopica"};static balloonBody(e,n,r,t,c){const o=a.typeOf(e),d=n.color??e.color??(o.glow?o.glow.color:o.color),i=o.depthRatio??1,f=e.lit&&o.lamp?o.lamp:void 0,p=s=>o.glow?o.glow.candela/(Math.PI*s*s/4):0,u=a.randomFrom(a.seedOf(n)^2654435769),M=o.spins?(5+15*u())*(u()<.5?-1:1):0,v=360*u(),x=o.sways?{degrees:3+4*u(),periodS:3+3*u(),phase:2*Math.PI*u()}:void 0,K=s=>{if(M===0&&!x)return;const S=(s-n.t)/1e3,P=x?2*Math.PI*S/x.periodS+x.phase:0;return{...M!==0?{headingDeg:a.round(((v+M*S)%360+360)%360,10)}:{},...x?{pitchDeg:a.round(x.degrees*Math.sin(P),10),rollDeg:a.round(x.degrees*Math.cos(P*.83),10)}:{}}},E=a.flamesOf(e,o),T=e.partColors?.flame??o.flames?.color;let O=-1;const A=c.map((s,S)=>{const P=Math.abs(s.widthM-O)>O*.005;P&&(O=s.widthM);const y={widthM:a.round(s.widthM,1e3),lengthM:a.round(s.widthM*i,1e3),heightM:a.round(s.widthM*o.aspect,1e3)},k={t:s.t,eastM:a.round(s.x),northM:a.round(s.y),altitudeM:a.round(s.z),...S===0?{present:!0}:{},...P?{sizeM:y}:{},...K(s.t)?{attitude:K(s.t)}:{},...S===0?{appearance:{color:d,albedo:o.albedo,...o.finish?{finish:o.finish}:{},...o.glow?{luminanceCdM2:p(s.widthM)}:{}}}:o.glow&&P?{appearance:{color:d,luminanceCdM2:a.round(p(s.widthM),100)}}:{}},w=a.lightsOf(o,s.burning,f,s.widthM,E,s.flame);return w&&(k.lights=w),k});A.push({t:c[c.length-1].t+1,present:!1});const D=e.title??a.TITLES[o.id],V=e.explainsEach?e.explainsEach[r]!==void 0?{explains:[e.explainsEach[r]]}:{}:{...e.explains?{explains:e.explains}:{},...t>1?{ensemble:e.id}:{}},z={envelopeColor:d};o.stripeColor&&(z.stripeColor=o.stripeColor),f&&(z.lampColor=f.color),T&&(z.flameColor=T);for(const[s,S]of Object.entries(e.partColors??{}))z[`${s}Color`]=S;return{id:t>1?`${e.id}-${r+1}`:e.id,title:D,...V,model:{id:o.modelId},modelParameters:z,...o.id==="hot-air"?{sound:{kind:"balloon"}}:{},altitudeFrom:{eastM:c[0].x,northM:c[0].y},track:A}}static lightsOf(e,n,r,t,c=0,o=0){if(e.flames){const d=t/50,i={};for(let f=1;f<=a.MAX_FLAMES;f++)i[`light-flame-${f}`]=f<=c?a.round(e.flames.candela*o/(Math.PI*d*d),1):0;return i.envelope=a.round(e.flames.candela*c*o*.5/(Math.PI*t/2*t*e.aspect/2),1e3),i}if(e.burner){const d=n?e.burner.envelopeCdM2:0;return{flame:n?e.burner.flameCdM2:0,envelope:d,"envelope-stripe":d}}if(e.modelId==="ufoathome-balloon-latex"){const d=t/40;return{"light-lamp":r?a.round(r.candela/(Math.PI*d*d),1):0}}}static seedOf(e){return e.seed!==void 0?e.seed:Math.round(e.t)*2654435761+Math.round((e.eastM??0)*100)*40503+Math.round((e.northM??0)*100)>>>0}static gusts(e,n,r){const t=a.randomFrom(n),c=()=>Math.sqrt(-2*Math.log(Math.max(1e-12,t())))*Math.cos(2*Math.PI*t()),o=e.timescaleS>0?Math.exp(-r/e.timescaleS):0,d=Math.sqrt(1-o*o),i={x:e.horizontalMS*c(),y:e.horizontalMS*c(),z:e.verticalMS*c()};return()=>(i.x=o*i.x+d*e.horizontalMS*c(),i.y=o*i.y+d*e.horizontalMS*c(),i.z=o*i.z+d*e.verticalMS*c(),i)}static randomFrom(e){let n=e>>>0;return()=>{n=n+1831565813>>>0;let r=n;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}static round(e,n=100){return Math.round(e*n)/n}}export{a as BalloonFlight};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as k,_ as c,b6 as T,bE as w,bF as M}from"./rr0-scene.mjs";import{d as u,P as y,S as I,a as O,c as x,b as F,E as A}from"./ParameterForm-CRC9iA-m.js";import{B as v,a as m,F as S}from"./BirdFlock-CfJeXvWu.js";import{T as E}from"./TimelineTracks-iym9uOfD.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(r=>r.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:()=>S.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),[r,a]=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||a.t===r.t?0:(e-r.t)/(a.t-r.t),d=h??r,b=h??a;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,I.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 F.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{e as k,_ as c,b6 as T,bD as w,bE as M}from"./rr0-scene.mjs";import{d as u,P as y,S as I,a as O,c as x,b as F,E as A}from"./ParameterForm-CRC9iA-m.js";import{B as v,a as m,F as S}from"./BirdFlock-L3dYU2K_.js";import{T as E}from"./TimelineTracks-iym9uOfD.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(r=>r.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:()=>S.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),[r,a]=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||a.t===r.t?0:(e-r.t)/(a.t-r.t),d=h??r,b=h??a;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,I.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 F.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">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bB as jt}from"./rr0-scene.mjs";class V{static G=9.81;static BUILDS={gull:{lengthM:.6,wingspanM:1.4,restM:{widthM:1.4,heightM:.14,lengthM:.653},colours:{upperColor:"#a9b1b9",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e6bd35"}},pelican:{lengthM:1.2,wingspanM:2.1,restM:{widthM:2.147,heightM:.281,lengthM:1.299},colours:{upperColor:"#7d7468",underColor:"#4f4840",tipColor:"#3b3631",headColor:"#e9dfb5",neckColor:"#5a3a2a",billColor:"#8d8778"}},goose:{lengthM:.95,wingspanM:1.6,restM:{widthM:1.6,heightM:.22,lengthM:1.003},colours:{upperColor:"#6b5d4f",underColor:"#cfc6b8",tipColor:"#3a332c",headColor:"#1d1c1b",neckColor:"#1d1c1b",billColor:"#1d1c1b"}},duck:{lengthM:.58,wingspanM:.9,restM:{widthM:.9,heightM:.15,lengthM:.633},colours:{upperColor:"#6d6457",underColor:"#b9b2a6",tipColor:"#4d463d",headColor:"#1f5a35",neckColor:"#ece9e1",billColor:"#d9b23a"}},plover:{lengthM:.27,wingspanM:.68,restM:{widthM:.68,heightM:.07,lengthM:.291},colours:{upperColor:"#6f6650",underColor:"#e8e4da",tipColor:"#3b362c",headColor:"#6f6650",neckColor:"#e8e4da",billColor:"#1d1c1b"}}};static ALL=[{id:"herring-gull",name:"Herring gull",build:"gull",lengthM:.6,wingspanM:1.4,massKg:1,wingAreaM2:.2,flight:{kind:"flapping"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"ring-billed-gull",name:"Ring-billed gull",build:"gull",lengthM:.48,wingspanM:1.2,massKg:.5,wingAreaM2:.14,flight:{kind:"flapping"},colours:{upperColor:"#b3bbc3"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"black-headed-gull",name:"Black-headed gull",build:"gull",lengthM:.37,wingspanM:1,massKg:.28,wingAreaM2:.1,flight:{kind:"flapping"},colours:{upperColor:"#c3c9cf",headColor:"#3d2b24",billColor:"#8f1d1d"},plumage:{color:"#e8eaec",albedo:.6}},{id:"brown-pelican",name:"Brown pelican",build:"pelican",lengthM:1.2,wingspanM:2.1,massKg:3.5,wingAreaM2:.55,flight:{kind:"bursts",beats:5,glideS:3},plumage:{color:"#7d7468",albedo:.25}},{id:"american-white-pelican",name:"American white pelican",build:"pelican",lengthM:1.5,wingspanM:2.7,massKg:7,wingAreaM2:.9,flight:{kind:"bursts",beats:6,glideS:3},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e89a3c"}},{id:"canada-goose",name:"Canada goose",build:"goose",lengthM:.95,wingspanM:1.6,massKg:4,wingAreaM2:.3,flight:{kind:"flapping"},plumage:{color:"#8a7c6c",albedo:.25}},{id:"snow-goose",name:"Snow goose",build:"goose",lengthM:.75,wingspanM:1.45,massKg:2.6,wingAreaM2:.25,flight:{kind:"flapping"},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#d9898a"}},{id:"mallard",name:"Mallard",build:"duck",lengthM:.58,wingspanM:.9,massKg:1.1,wingAreaM2:.095,flight:{kind:"flapping"},plumage:{color:"#8a8074",albedo:.3}},{id:"american-golden-plover",name:"American golden plover",build:"plover",lengthM:.26,wingspanM:.68,massKg:.145,wingAreaM2:.038,flight:{kind:"flapping"},plumage:{color:"#8a8070",albedo:.3}},{id:"killdeer",name:"Killdeer",build:"plover",lengthM:.25,wingspanM:.6,massKg:.09,wingAreaM2:.03,flight:{kind:"flapping"},colours:{upperColor:"#7a6249",headColor:"#7a6249"},plumage:{color:"#9a8a72",albedo:.3}}];static byId(t){return V.ALL.find(a=>a.id===t)}static wingbeatHz(t,a=1.225){return t.massKg**(3/8)*Math.sqrt(V.G)*t.wingspanM**(-23/24)*t.wingAreaM2**(-1/3)*a**(-3/8)}static airDensityAt(t){return 1.225*((288.15-.0065*t)/288.15)**4.2559}static colourOf(t,a){return t.colours?.[a]??V.BUILDS[t.build].colours[a]}static sizeOf(t){const a=V.BUILDS[t.build],e=t.wingspanM/a.wingspanM,o=t.lengthM/a.lengthM;return{widthM:a.restM.widthM*e,lengthM:a.restM.lengthM*o,heightM:a.restM.heightM*o}}}class l{static STEP_S=.05;static NEIGHBOURS=7;static MAX_BANK_DEG=60;static INFORMED_SHARE=.2;static BLIND_HALF_DEG=30;static TURN_LAG_S=.25;static SEPARATION=4;static ALIGNMENT=1;static TURN_FOLLOWING=.8;static COHESION=.6;static EDGE_COHESION=1;static VERTICAL_COHESION=.1;static LEAD=.6;static FOLLOWER_LEAD=.3;static LOOK_AHEAD_S=3;static SPEED_RATE=1.5;static SPEED_COHESION=.5;static STEERING=2;static NOISE=1.5;static OWN_SPEED=.5;static AVOIDANCE=6;static AVOID_AHEAD_S=1;static OVER_WITHIN_M=6;static MAX_RINGS=6;static run(t){const{path:a,count:e,species:o,random:n,sampleMs:r}=t,h=t.obstacles?.empty===!1?t.obstacles:void 0,f=new It(a),g=a[0].t,A=a[a.length-1].t,u=D=>{const S=f.velocityAt(D);return Math.max(Math.hypot(S.east,S.north,S.up),10)},c=t.spacing*o.wingspanM,d=p.slotsOf({kind:"cluster",spacing:t.spacing},e,o.wingspanM,n),w=f.velocityAt(g),M=Math.atan2(w.east,w.north),b=f.at(g),i=e,m=new Float64Array(i),y=new Float64Array(i),E=new Float64Array(i),O=new Float64Array(i),N=new Float64Array(i),I=new Float64Array(i),z=new Float64Array(i),T=new Float64Array(i),P=new Float64Array(i),v=new Float64Array(i),et=new Float64Array(i),at=new Float64Array(i),nt=new Float64Array(i),Ct=new Float64Array(i),Mt=new Uint8Array(i);d.forEach((D,S)=>{m[S]=b.eastM+Math.sin(M)*D.forwardM+Math.cos(M)*D.rightM,y[S]=b.northM+Math.cos(M)*D.forwardM-Math.sin(M)*D.rightM,E[S]=b.upM+D.upM,nt[S]=1+(n()-.5)*.08,O[S]=Math.sin(M)*u(g)*nt[S],N[S]=Math.cos(M)*u(g)*nt[S]});const Ut=Math.max(0,Math.min(1,t.informedShare??l.INFORMED_SHARE)),Vt=i===1?1:Math.min(i,Math.max(2,Math.round(i*Ut)));for(let D=0;D<Vt;){const S=Math.floor(n()*i);Mt[S]||(Mt[S]=1,D++)}const xt=d.map(()=>[]),Wt=d.map(()=>({x:0,y:0,z:0})),Dt=new Yt(i,Math.max(c*1.5,.1)),lt=Math.min(l.NEIGHBOURS,i-1),Nt=new Int32Array(Math.max(lt,1)),st=9.81*Math.tan(l.MAX_BANK_DEG*Math.PI/180),Xt=-Math.cos(l.BLIND_HALF_DEG*Math.PI/180),U=l.STEP_S,ct=Math.min(1,U/l.TURN_LAG_S);let gt=g;for(let D=g;D<=A+1e-6;D+=U*1e3){if(D>=gt-1e-6){for(let s=0;s<i;s++)xt[s].push({t:gt,eastM:m[s],northM:y[s],upM:E[s],headingDeg:0,pitchDeg:0,rollDeg:0});gt+=r}const S=f.at(D),dt=f.velocityAt(D),pt=u(D);Dt.fill(m,y,E);for(let s=0;s<i;s++){const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=lt>0?Dt.nearest(s,m,y,E,lt,l.MAX_RINGS,Nt,(C,x,K,G)=>(C*X+x*j+K*Y)/G>Xt):0;let Q=0,H=0,ut=0,St=0,Lt=0,zt=0,ft=0,At=0,wt=0,vt=0,Tt=0,Rt=0,Pt=0,Gt=0,Ht=0;for(let C=0;C<L;C++){const x=Nt[C],K=m[x]-m[s],G=y[x]-y[s],q=E[x]-E[s],R=Math.max(Math.hypot(K,G,q),.001);if(R<c){const J=(1-R/c)/R;Q-=K*J,H-=G*J,ut-=q*J}St+=m[x],Lt+=y[x],zt+=E[x],ft+=O[x],At+=N[x],wt+=I[x],vt+=z[x],Tt+=T[x],Rt+=P[x],Pt+=K/R,Gt+=G/R,Ht+=q/R}let _=0,B=0,Z=0,F=nt[s]*pt;const tt=Math.hypot(Q,H,ut);if(tt>0){const C=Math.min(1,tt*c);_+=Q/tt*l.SEPARATION*C,B+=H/tt*l.SEPARATION*C,Z+=ut/tt*l.SEPARATION*C}if(L>0){const C=St/L-m[s],x=Lt/L-y[s],K=zt/L-E[s],G=Math.max(Math.hypot(C,x,K),.001),q=Math.hypot(Pt,Gt,Ht)/L,R=(Math.min(1,G/(2*c))+l.EDGE_COHESION*q)*l.COHESION;_+=C/G*R,B+=x/G*R,Z+=K/G*R;const J=Math.max(Math.hypot(ft,At,wt)/L,.001);Z*=l.VERTICAL_COHESION,_+=ft/L/J*l.ALIGNMENT,B+=At/L/J*l.ALIGNMENT,Z+=wt/L/J*l.ALIGNMENT,F=J+(F-J)*l.OWN_SPEED,F+=(C*X+x*j+K*Y)*l.SPEED_COHESION}if(h){const C=h.inside(m[s]+O[s]*l.AVOID_AHEAD_S,y[s]+N[s]*l.AVOID_AHEAD_S,E[s]+I[s]*l.AVOID_AHEAD_S,c)??h.inside(m[s],y[s],E[s],c);C&&(_+=C.nx*l.AVOIDANCE,B+=C.ny*l.AVOIDANCE,C.belowTopM<l.OVER_WITHIN_M&&(Z+=l.AVOIDANCE))}{const C=l.LOOK_AHEAD_S,x=S.eastM+dt.east*C-m[s],K=S.northM+dt.north*C-y[s],G=S.upM+dt.up*C-E[s],q=Math.max(Math.hypot(x,K,G),.001),R=Mt[s]||L===0?l.LEAD:l.FOLLOWER_LEAD;_+=x/q*R,B+=K/q*R,Z+=G/q*R}const k=Math.hypot(_,B,Z);F=Math.max(.7*pt,Math.min(1.4*pt,F));const bt=l.STEERING*W;let ot=k>1e-6?(_/k-X)*bt:0,rt=k>1e-6?(B/k-j)*bt:0,ht=k>1e-6?(Z/k-Y)*bt:0;L>0&&(ot+=(vt/L-z[s])*l.TURN_FOLLOWING,rt+=(Tt/L-T[s])*l.TURN_FOLLOWING,ht+=(Rt/L-P[s])*l.TURN_FOLLOWING);const $=Wt[s];$.x+=((n()-.5)*2*l.NOISE-$.x)*U,$.y+=((n()-.5)*2*l.NOISE-$.y)*U,$.z+=((n()-.5)*l.NOISE-$.z)*U,ot+=$.x,rt+=$.y,ht+=$.z;const mt=ot*X+rt*j+ht*Y;let Et=ot-mt*X,yt=rt-mt*j,Ot=ht-mt*Y;const it=Math.hypot(Et,yt,Ot);it>st&&(Et*=st/it,yt*=st/it,Ot*=st/it),v[s]=Et,et[s]=yt,at[s]=Ot,Ct[s]=Math.max(-3,Math.min(3,(F-W)*l.SPEED_RATE))}for(let s=0;s<i;s++){z[s]+=(v[s]-z[s])*ct,T[s]+=(et[s]-T[s])*ct,P[s]+=(at[s]-P[s])*ct;const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=z[s]*X+T[s]*j+P[s]*Y;z[s]-=L*X,T[s]-=L*j,P[s]-=L*Y;const Q=Ct[s];if(O[s]+=(z[s]+X*Q)*U,N[s]+=(T[s]+j*Q)*U,I[s]+=(P[s]+Y*Q)*U,m[s]+=O[s]*U,y[s]+=N[s]*U,E[s]+=I[s]*U,h){const H=h.inside(m[s],y[s],E[s]);H&&(H.belowTopM<H.depthM?E[s]+=H.belowTopM:(m[s]+=H.nx*H.depthM,y[s]+=H.ny*H.depthM))}}}return xt.map(D=>(p.attitudes(D),{samples:D,delayS:0}))}}class Yt{constructor(t,a){this.n=t,this.cellM=a;let e=16;for(;e<t*2;)e*=2;this.size=e,this.start=new Int32Array(e+1),this.counts=new Int32Array(e),this.members=new Int32Array(t),this.slotOf=new Int32Array(t),this.seen=new Int32Array(e),this.distances=new Float64Array(t)}size;start;counts;members;slotOf;seen;search=0;distances;cell(t){return Math.floor(t/this.cellM)}slot(t,a,e){return(Math.imul(t,73856093)^Math.imul(a,19349663)^Math.imul(e,83492791))&this.size-1}fill(t,a,e){this.counts.fill(0);for(let n=0;n<this.n;n++){const r=this.slot(this.cell(t[n]),this.cell(a[n]),this.cell(e[n]));this.slotOf[n]=r,this.counts[r]++}this.start[0]=0;for(let n=0;n<this.size;n++)this.start[n+1]=this.start[n]+this.counts[n];const o=this.start.slice(0,this.size);for(let n=0;n<this.n;n++)this.members[o[this.slotOf[n]]++]=n}nearest(t,a,e,o,n,r,h,f){const g=++this.search,A=this.cell(a[t]),u=this.cell(e[t]),c=this.cell(o[t]);let d=0;const w=this.distances;for(let M=0;M<=r;M++){for(let b=A-M;b<=A+M;b++)for(let i=u-M;i<=u+M;i++)for(let m=c-M;m<=c+M;m++){if(Math.max(Math.abs(b-A),Math.abs(i-u),Math.abs(m-c))!==M)continue;const y=this.slot(b,i,m);if(this.seen[y]!==g){this.seen[y]=g;for(let E=this.start[y];E<this.start[y+1];E++){const O=this.members[E];if(O===t)continue;const N=a[O]-a[t],I=e[O]-e[t],z=o[O]-o[t],T=N*N+I*I+z*z;if(d===n&&T>=w[n-1])continue;const P=Math.sqrt(T);if(P>0&&!f(N,I,z,P))continue;let v=Math.min(d,n-1);for(;v>0&&w[v-1]>T;)w[v]=w[v-1],h[v]=h[v-1],v--;w[v]=T,h[v]=O,d<n&&d++}}}if(d===n&&w[n-1]<=(M*this.cellM)**2)break}return d}}class p{static SAMPLE_MS=100;static MAX_KEYFRAMES=6e4;static computed=new Map;static bodiesOf(t,a=jt.NONE){const e=JSON.stringify(t)+a.signature;let o=p.computed.get(e);return o||(o=p.compute(t,a),p.computed.set(e,o),p.computed.size>16&&p.computed.delete(p.computed.keys().next().value)),o}static speciesOf(t){return V.byId(t.species)??V.ALL[0]}static compute(t,a){const e=p.pathOf(t);if(e.length===0)return[];const o=p.speciesOf(t),n=Math.max(1,Math.floor(t.count??1)),r=p.randomFrom(t.seed??1),h=t.wingbeatHz??V.wingbeatHz(o,V.airDensityAt((t.originElevationM??0)+e[0].upM)),f=t.flight??o.flight,g=e[0].t,A=e[e.length-1].t,u=p.sampleMs(n,A-g),c=t.formation?.kind==="flock"?l.run({path:e,count:n,species:o,spacing:t.formation.spacing??1.5,informedShare:t.formation.informed,obstacles:a,random:r,sampleMs:u}):p.arranged(t,e,o,n,r,u),d=V.sizeOf(o),w={...o.colours,...t.colours};return c.map((M,b)=>{const i=h*(1+(r()-.5)*.06),m=r(),y=M.delayS,E=f.kind==="path"?p.flapsAlong(M.samples,i,f,m):void 0,O=M.samples.map((I,z)=>({t:Math.round(I.t),eastM:p.round(I.eastM),northM:p.round(I.northM),altitudeM:p.round(I.upM-d.heightM/2),...z===0?{sizeM:d,appearance:{color:o.plumage.color,albedo:o.plumage.albedo}}:{},attitude:{headingDeg:p.round(I.headingDeg),pitchDeg:p.round(I.pitchDeg),rollDeg:p.round(I.rollDeg)},motions:{flap:p.round(E?E[z]:p.beatsAt((I.t-g)/1e3-y,i,f,m),1e3)}}));return{id:n>1?`${t.id}-${b+1}`:t.id,...t.title?{title:t.title}:{},...t.explainsEach?t.explainsEach[b]!==void 0?{explains:[t.explainsEach[b]]}:{}:{...t.explains?{explains:t.explains}:{},...n>1?{ensemble:t.id}:{}},model:{id:`ufoathome-bird-${o.build}`},shadow:!1,...Object.keys(w).length>0?{modelParameters:w}:{},...t.lightFromBelow?{lightFromBelow:t.lightFromBelow}:{},track:O}})}static beatsAt(t,a,e,o){if(e.kind==="flapping")return Math.max(0,t*a+o);const r=e.beats/a+e.glideS,h=Math.max(0,t+o*r),f=Math.floor(h/r),g=h-f*r;return f*e.beats+Math.min(e.beats,g*a)}static CLIMB_FLAPS_MS=.3;static DESCENT_GLIDES_MS=-.8;static flapsAlong(t,a,e,o){let n=o,r=!0,h=Math.floor(n),f=0;return t.map((g,A)=>{if(A===0)return n;const u=t[A-1],c=(g.t-u.t)/1e3;if(c<=0)return n;const d=(g.upM-u.upM)/c,w=r?n-h<e.beats:(g.t-f)/1e3>=e.glideS,M=d>p.CLIMB_FLAPS_MS?!0:d<p.DESCENT_GLIDES_MS?!1:w;if(r){const b=n+a*c;!M&&Math.floor(b)>Math.floor(n)?(n=Math.floor(b),r=!1,f=g.t):n=b}else M&&(r=!0,h=n);return n})}static sampleMs(t,a){const e=t*(a/p.SAMPLE_MS+1);return e<=p.MAX_KEYFRAMES?p.SAMPLE_MS:Math.ceil(p.SAMPLE_MS*e/p.MAX_KEYFRAMES/50)*50}static pathOf(t){return[...t.path].sort((a,e)=>a.t-e.t).map(a=>{if("eastM"in a)return{t:a.t,eastM:a.eastM,northM:a.northM,upM:a.altitudeM};const e=a.azimuthDeg*Math.PI/180,o=a.altitudeDeg*Math.PI/180,n=a.distanceM*Math.cos(o);return{t:a.t,eastM:n*Math.sin(e),northM:n*Math.cos(e),upM:(a.eyeHeightM??1.6)+a.distanceM*Math.sin(o)}})}static arranged(t,a,e,o,n,r){const h=t.formation??{kind:o>1?"cluster":"single"},f=p.slotsOf(h,o,e.wingspanM,n),g=h.kind==="v"||h.kind==="j"||h.kind==="echelon"||h.kind==="column",A=(h.wander??(g?.15:.4))*e.wingspanM,u=new It(a),c=Math.max(u.meanSpeedMS(),1);return f.map(d=>{const w=g?Math.max(0,-d.forwardM)/c:0,M=p.swayFrom(n,A),b=[];for(let i=a[0].t;i<=a[a.length-1].t+1e-6;i+=r){const m=(i-a[0].t)/1e3,y=i-w*1e3,E=u.at(y),O=u.velocityAt(y),N=Math.atan2(O.east,O.north),[I,z,T]=M(m),P=g?I:d.forwardM+I,v=d.rightM+z,et=E.eastM+Math.sin(N)*P+Math.cos(N)*v,at=E.northM+Math.cos(N)*P-Math.sin(N)*v;b.push({t:i,eastM:et,northM:at,upM:E.upM+d.upM+T,headingDeg:0,pitchDeg:0,rollDeg:0})}return p.attitudes(b),{samples:b,delayS:w}})}static slotsOf(t,a,e,o){const n=[],r=t.kind;if(r==="single"||a===1)return[{forwardM:0,rightM:0,upM:0}];if(r==="v"||r==="j"||r==="echelon"||r==="column"){const c=(t.spacing??1)*e*(r==="column"?0:1),d=(t.angleDeg??70)/2*Math.PI/180,w=r==="column"?(t.spacing??1)*e:c/Math.tan(d),M=r==="v"?.5:r==="echelon"||r==="column"?1:t.asymmetry??.7;n.push({forwardM:0,rightM:0,upM:0});const b=Math.round(M*(a-1));let i=0,m=0;for(let y=1;y<a;y++){const E=m>=a-1-b||i<b&&i/Math.max(b,1)<=m/Math.max(a-1-b,1),O=E?++i:++m;n.push({forwardM:-w*O,rightM:(E?1:-1)*c*O,upM:-.05*e*O*o()})}return n}const h=(t.spacing??1.5)*e;if(r==="front"){for(let c=0;c<a;c++)n.push({forwardM:(o()-.5)*h*1.2,rightM:(c-(a-1)/2)*h,upM:(o()-.5)*h*.4});return n}const f=a*h**3,g=Math.cbrt(f/(4/3*Math.PI*1*2.8*5.6)),A={up:g,across:2.8*g,along:5.6*g};let u=0;for(;n.length<a&&u<a*200;){u++;const c=2*o()-1,d=2*o()-1,w=2*o()-1;if(c*c+d*d+w*w>1)continue;const M={forwardM:c*A.along,rightM:d*A.across,upM:w*A.up};n.some(b=>(b.forwardM-M.forwardM)**2+(b.rightM-M.rightM)**2+(b.upM-M.upM)**2<(h/2)**2)||n.push(M)}for(;n.length<a;)n.push({forwardM:(o()-.5)*A.along,rightM:(o()-.5)*A.across,upM:0});return n}static swayFrom(t,a){const e=[0,1,2].map(o=>[0,1].map(()=>({period:3+t()*7,phase:t()*2*Math.PI,share:(o===2?.4:o===1?.7:1)*(.4+.6*t())})));return o=>e.map(n=>n.reduce((r,h)=>r+a*h.share*.5*Math.sin(2*Math.PI*o/h.period+h.phase),0))}static attitudes(t){const a=t.length;if(!(a<2)){for(let e=0;e<a;e++){const o=t[Math.max(0,e-1)],n=t[Math.min(a-1,e+1)],r=(n.t-o.t)/1e3,h=(n.eastM-o.eastM)/r,f=(n.northM-o.northM)/r,g=(n.upM-o.upM)/r,A=Math.hypot(h,f),u=t[e];u.headingDeg=A>.05?(Math.atan2(h,f)*180/Math.PI+360)%360:e>0?t[e-1].headingDeg:0,u.pitchDeg=Math.atan2(g,Math.max(A,.5))*180/Math.PI}for(let e=0;e<a;e++){const o=t[Math.max(0,e-2)],n=t[Math.min(a-1,e+2)],r=(n.t-o.t)/1e3;let h=n.headingDeg-o.headingDeg;h=(h+540)%360-180;const f=t[e],g=t[Math.max(0,e-1)],A=t[Math.min(a-1,e+1)],u=Math.hypot(A.eastM-g.eastM,A.northM-g.northM)/Math.max((A.t-g.t)/1e3,.001),c=r>0?h*Math.PI/180/r:0,d=Math.atan(u*c/V.G)*180/Math.PI;f.rollDeg=Math.max(-70,Math.min(70,d))}}}static randomFrom(t){let a=t>>>0;return()=>{a=a+1831565813>>>0;let e=a;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}static round(t,a=100){return Math.round(t*a)/a}}class It{constructor(t){this.points=t}at(t){const a=this.points;if(a.length===1||t<=a[0].t)return this.extrapolated(t,0);if(t>=a[a.length-1].t)return this.extrapolated(t,a.length-1);let e=0;for(;e<a.length-2&&t>a[e+1].t;)e++;const o=a[Math.max(0,e-1)],n=a[e],r=a[e+1],h=a[Math.min(a.length-1,e+2)],f=(t-n.t)/(r.t-n.t),g=(u,c,d)=>(c[d]-u[d])/Math.max(c.t-u.t,1)*(r.t-n.t),A=u=>{const c=g(o,r,u),d=g(n,h,u),w=f*f,M=w*f;return(2*M-3*w+1)*n[u]+(M-2*w+f)*c+(-2*M+3*w)*r[u]+(M-w)*d};return{t,eastM:A("eastM"),northM:A("northM"),upM:A("upM")}}extrapolated(t,a){const e=this.points,o=e[a];if(e.length<2)return{...o,t};const n=a===0?e[0]:e[e.length-2],r=a===0?e[1]:e[e.length-1],h=(t-o.t)/Math.max(r.t-n.t,1);return{t,eastM:o.eastM+(r.eastM-n.eastM)*h,northM:o.northM+(r.northM-n.northM)*h,upM:o.upM+(r.upM-n.upM)*h}}velocityAt(t){const a=this.at(t-50),e=this.at(t+50);return{east:(e.eastM-a.eastM)/.1,north:(e.northM-a.northM)/.1,up:(e.upM-a.upM)/.1}}meanSpeedMS(){const t=this.points;if(t.length<2)return 0;let a=0;for(let e=1;e<t.length;e++)a+=Math.hypot(t[e].eastM-t[e-1].eastM,t[e].northM-t[e-1].northM,t[e].upM-t[e-1].upM);return a/Math.max((t[t.length-1].t-t[0].t)/1e3,.001)}}const qt=Object.freeze(Object.defineProperty({__proto__:null,BirdFlock:p,FlightPath:It},Symbol.toStringTag,{value:"Module"}));export{p as B,l as F,V as a,qt as b};
|
|
1
|
+
import{bA as jt}from"./rr0-scene.mjs";class V{static G=9.81;static BUILDS={gull:{lengthM:.6,wingspanM:1.4,restM:{widthM:1.4,heightM:.14,lengthM:.653},colours:{upperColor:"#a9b1b9",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e6bd35"}},pelican:{lengthM:1.2,wingspanM:2.1,restM:{widthM:2.147,heightM:.281,lengthM:1.299},colours:{upperColor:"#7d7468",underColor:"#4f4840",tipColor:"#3b3631",headColor:"#e9dfb5",neckColor:"#5a3a2a",billColor:"#8d8778"}},goose:{lengthM:.95,wingspanM:1.6,restM:{widthM:1.6,heightM:.22,lengthM:1.003},colours:{upperColor:"#6b5d4f",underColor:"#cfc6b8",tipColor:"#3a332c",headColor:"#1d1c1b",neckColor:"#1d1c1b",billColor:"#1d1c1b"}},duck:{lengthM:.58,wingspanM:.9,restM:{widthM:.9,heightM:.15,lengthM:.633},colours:{upperColor:"#6d6457",underColor:"#b9b2a6",tipColor:"#4d463d",headColor:"#1f5a35",neckColor:"#ece9e1",billColor:"#d9b23a"}},plover:{lengthM:.27,wingspanM:.68,restM:{widthM:.68,heightM:.07,lengthM:.291},colours:{upperColor:"#6f6650",underColor:"#e8e4da",tipColor:"#3b362c",headColor:"#6f6650",neckColor:"#e8e4da",billColor:"#1d1c1b"}}};static ALL=[{id:"herring-gull",name:"Herring gull",build:"gull",lengthM:.6,wingspanM:1.4,massKg:1,wingAreaM2:.2,flight:{kind:"flapping"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"ring-billed-gull",name:"Ring-billed gull",build:"gull",lengthM:.48,wingspanM:1.2,massKg:.5,wingAreaM2:.14,flight:{kind:"flapping"},colours:{upperColor:"#b3bbc3"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"black-headed-gull",name:"Black-headed gull",build:"gull",lengthM:.37,wingspanM:1,massKg:.28,wingAreaM2:.1,flight:{kind:"flapping"},colours:{upperColor:"#c3c9cf",headColor:"#3d2b24",billColor:"#8f1d1d"},plumage:{color:"#e8eaec",albedo:.6}},{id:"brown-pelican",name:"Brown pelican",build:"pelican",lengthM:1.2,wingspanM:2.1,massKg:3.5,wingAreaM2:.55,flight:{kind:"bursts",beats:5,glideS:3},plumage:{color:"#7d7468",albedo:.25}},{id:"american-white-pelican",name:"American white pelican",build:"pelican",lengthM:1.5,wingspanM:2.7,massKg:7,wingAreaM2:.9,flight:{kind:"bursts",beats:6,glideS:3},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e89a3c"}},{id:"canada-goose",name:"Canada goose",build:"goose",lengthM:.95,wingspanM:1.6,massKg:4,wingAreaM2:.3,flight:{kind:"flapping"},plumage:{color:"#8a7c6c",albedo:.25}},{id:"snow-goose",name:"Snow goose",build:"goose",lengthM:.75,wingspanM:1.45,massKg:2.6,wingAreaM2:.25,flight:{kind:"flapping"},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#d9898a"}},{id:"mallard",name:"Mallard",build:"duck",lengthM:.58,wingspanM:.9,massKg:1.1,wingAreaM2:.095,flight:{kind:"flapping"},plumage:{color:"#8a8074",albedo:.3}},{id:"american-golden-plover",name:"American golden plover",build:"plover",lengthM:.26,wingspanM:.68,massKg:.145,wingAreaM2:.038,flight:{kind:"flapping"},plumage:{color:"#8a8070",albedo:.3}},{id:"killdeer",name:"Killdeer",build:"plover",lengthM:.25,wingspanM:.6,massKg:.09,wingAreaM2:.03,flight:{kind:"flapping"},colours:{upperColor:"#7a6249",headColor:"#7a6249"},plumage:{color:"#9a8a72",albedo:.3}}];static byId(t){return V.ALL.find(a=>a.id===t)}static wingbeatHz(t,a=1.225){return t.massKg**(3/8)*Math.sqrt(V.G)*t.wingspanM**(-23/24)*t.wingAreaM2**(-1/3)*a**(-3/8)}static airDensityAt(t){return 1.225*((288.15-.0065*t)/288.15)**4.2559}static colourOf(t,a){return t.colours?.[a]??V.BUILDS[t.build].colours[a]}static sizeOf(t){const a=V.BUILDS[t.build],e=t.wingspanM/a.wingspanM,o=t.lengthM/a.lengthM;return{widthM:a.restM.widthM*e,lengthM:a.restM.lengthM*o,heightM:a.restM.heightM*o}}}class l{static STEP_S=.05;static NEIGHBOURS=7;static MAX_BANK_DEG=60;static INFORMED_SHARE=.2;static BLIND_HALF_DEG=30;static TURN_LAG_S=.25;static SEPARATION=4;static ALIGNMENT=1;static TURN_FOLLOWING=.8;static COHESION=.6;static EDGE_COHESION=1;static VERTICAL_COHESION=.1;static LEAD=.6;static FOLLOWER_LEAD=.3;static LOOK_AHEAD_S=3;static SPEED_RATE=1.5;static SPEED_COHESION=.5;static STEERING=2;static NOISE=1.5;static OWN_SPEED=.5;static AVOIDANCE=6;static AVOID_AHEAD_S=1;static OVER_WITHIN_M=6;static MAX_RINGS=6;static run(t){const{path:a,count:e,species:o,random:n,sampleMs:r}=t,h=t.obstacles?.empty===!1?t.obstacles:void 0,f=new It(a),g=a[0].t,A=a[a.length-1].t,u=D=>{const S=f.velocityAt(D);return Math.max(Math.hypot(S.east,S.north,S.up),10)},c=t.spacing*o.wingspanM,d=p.slotsOf({kind:"cluster",spacing:t.spacing},e,o.wingspanM,n),w=f.velocityAt(g),M=Math.atan2(w.east,w.north),b=f.at(g),i=e,m=new Float64Array(i),y=new Float64Array(i),E=new Float64Array(i),O=new Float64Array(i),N=new Float64Array(i),I=new Float64Array(i),z=new Float64Array(i),T=new Float64Array(i),P=new Float64Array(i),v=new Float64Array(i),et=new Float64Array(i),at=new Float64Array(i),nt=new Float64Array(i),Ct=new Float64Array(i),Mt=new Uint8Array(i);d.forEach((D,S)=>{m[S]=b.eastM+Math.sin(M)*D.forwardM+Math.cos(M)*D.rightM,y[S]=b.northM+Math.cos(M)*D.forwardM-Math.sin(M)*D.rightM,E[S]=b.upM+D.upM,nt[S]=1+(n()-.5)*.08,O[S]=Math.sin(M)*u(g)*nt[S],N[S]=Math.cos(M)*u(g)*nt[S]});const Ut=Math.max(0,Math.min(1,t.informedShare??l.INFORMED_SHARE)),Vt=i===1?1:Math.min(i,Math.max(2,Math.round(i*Ut)));for(let D=0;D<Vt;){const S=Math.floor(n()*i);Mt[S]||(Mt[S]=1,D++)}const xt=d.map(()=>[]),Wt=d.map(()=>({x:0,y:0,z:0})),Dt=new Yt(i,Math.max(c*1.5,.1)),lt=Math.min(l.NEIGHBOURS,i-1),Nt=new Int32Array(Math.max(lt,1)),st=9.81*Math.tan(l.MAX_BANK_DEG*Math.PI/180),Xt=-Math.cos(l.BLIND_HALF_DEG*Math.PI/180),U=l.STEP_S,ct=Math.min(1,U/l.TURN_LAG_S);let gt=g;for(let D=g;D<=A+1e-6;D+=U*1e3){if(D>=gt-1e-6){for(let s=0;s<i;s++)xt[s].push({t:gt,eastM:m[s],northM:y[s],upM:E[s],headingDeg:0,pitchDeg:0,rollDeg:0});gt+=r}const S=f.at(D),dt=f.velocityAt(D),pt=u(D);Dt.fill(m,y,E);for(let s=0;s<i;s++){const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=lt>0?Dt.nearest(s,m,y,E,lt,l.MAX_RINGS,Nt,(C,x,K,G)=>(C*X+x*j+K*Y)/G>Xt):0;let Q=0,H=0,ut=0,St=0,Lt=0,zt=0,ft=0,At=0,wt=0,vt=0,Tt=0,Rt=0,Pt=0,Gt=0,Ht=0;for(let C=0;C<L;C++){const x=Nt[C],K=m[x]-m[s],G=y[x]-y[s],q=E[x]-E[s],R=Math.max(Math.hypot(K,G,q),.001);if(R<c){const J=(1-R/c)/R;Q-=K*J,H-=G*J,ut-=q*J}St+=m[x],Lt+=y[x],zt+=E[x],ft+=O[x],At+=N[x],wt+=I[x],vt+=z[x],Tt+=T[x],Rt+=P[x],Pt+=K/R,Gt+=G/R,Ht+=q/R}let _=0,B=0,Z=0,F=nt[s]*pt;const tt=Math.hypot(Q,H,ut);if(tt>0){const C=Math.min(1,tt*c);_+=Q/tt*l.SEPARATION*C,B+=H/tt*l.SEPARATION*C,Z+=ut/tt*l.SEPARATION*C}if(L>0){const C=St/L-m[s],x=Lt/L-y[s],K=zt/L-E[s],G=Math.max(Math.hypot(C,x,K),.001),q=Math.hypot(Pt,Gt,Ht)/L,R=(Math.min(1,G/(2*c))+l.EDGE_COHESION*q)*l.COHESION;_+=C/G*R,B+=x/G*R,Z+=K/G*R;const J=Math.max(Math.hypot(ft,At,wt)/L,.001);Z*=l.VERTICAL_COHESION,_+=ft/L/J*l.ALIGNMENT,B+=At/L/J*l.ALIGNMENT,Z+=wt/L/J*l.ALIGNMENT,F=J+(F-J)*l.OWN_SPEED,F+=(C*X+x*j+K*Y)*l.SPEED_COHESION}if(h){const C=h.inside(m[s]+O[s]*l.AVOID_AHEAD_S,y[s]+N[s]*l.AVOID_AHEAD_S,E[s]+I[s]*l.AVOID_AHEAD_S,c)??h.inside(m[s],y[s],E[s],c);C&&(_+=C.nx*l.AVOIDANCE,B+=C.ny*l.AVOIDANCE,C.belowTopM<l.OVER_WITHIN_M&&(Z+=l.AVOIDANCE))}{const C=l.LOOK_AHEAD_S,x=S.eastM+dt.east*C-m[s],K=S.northM+dt.north*C-y[s],G=S.upM+dt.up*C-E[s],q=Math.max(Math.hypot(x,K,G),.001),R=Mt[s]||L===0?l.LEAD:l.FOLLOWER_LEAD;_+=x/q*R,B+=K/q*R,Z+=G/q*R}const k=Math.hypot(_,B,Z);F=Math.max(.7*pt,Math.min(1.4*pt,F));const bt=l.STEERING*W;let ot=k>1e-6?(_/k-X)*bt:0,rt=k>1e-6?(B/k-j)*bt:0,ht=k>1e-6?(Z/k-Y)*bt:0;L>0&&(ot+=(vt/L-z[s])*l.TURN_FOLLOWING,rt+=(Tt/L-T[s])*l.TURN_FOLLOWING,ht+=(Rt/L-P[s])*l.TURN_FOLLOWING);const $=Wt[s];$.x+=((n()-.5)*2*l.NOISE-$.x)*U,$.y+=((n()-.5)*2*l.NOISE-$.y)*U,$.z+=((n()-.5)*l.NOISE-$.z)*U,ot+=$.x,rt+=$.y,ht+=$.z;const mt=ot*X+rt*j+ht*Y;let Et=ot-mt*X,yt=rt-mt*j,Ot=ht-mt*Y;const it=Math.hypot(Et,yt,Ot);it>st&&(Et*=st/it,yt*=st/it,Ot*=st/it),v[s]=Et,et[s]=yt,at[s]=Ot,Ct[s]=Math.max(-3,Math.min(3,(F-W)*l.SPEED_RATE))}for(let s=0;s<i;s++){z[s]+=(v[s]-z[s])*ct,T[s]+=(et[s]-T[s])*ct,P[s]+=(at[s]-P[s])*ct;const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=z[s]*X+T[s]*j+P[s]*Y;z[s]-=L*X,T[s]-=L*j,P[s]-=L*Y;const Q=Ct[s];if(O[s]+=(z[s]+X*Q)*U,N[s]+=(T[s]+j*Q)*U,I[s]+=(P[s]+Y*Q)*U,m[s]+=O[s]*U,y[s]+=N[s]*U,E[s]+=I[s]*U,h){const H=h.inside(m[s],y[s],E[s]);H&&(H.belowTopM<H.depthM?E[s]+=H.belowTopM:(m[s]+=H.nx*H.depthM,y[s]+=H.ny*H.depthM))}}}return xt.map(D=>(p.attitudes(D),{samples:D,delayS:0}))}}class Yt{constructor(t,a){this.n=t,this.cellM=a;let e=16;for(;e<t*2;)e*=2;this.size=e,this.start=new Int32Array(e+1),this.counts=new Int32Array(e),this.members=new Int32Array(t),this.slotOf=new Int32Array(t),this.seen=new Int32Array(e),this.distances=new Float64Array(t)}size;start;counts;members;slotOf;seen;search=0;distances;cell(t){return Math.floor(t/this.cellM)}slot(t,a,e){return(Math.imul(t,73856093)^Math.imul(a,19349663)^Math.imul(e,83492791))&this.size-1}fill(t,a,e){this.counts.fill(0);for(let n=0;n<this.n;n++){const r=this.slot(this.cell(t[n]),this.cell(a[n]),this.cell(e[n]));this.slotOf[n]=r,this.counts[r]++}this.start[0]=0;for(let n=0;n<this.size;n++)this.start[n+1]=this.start[n]+this.counts[n];const o=this.start.slice(0,this.size);for(let n=0;n<this.n;n++)this.members[o[this.slotOf[n]]++]=n}nearest(t,a,e,o,n,r,h,f){const g=++this.search,A=this.cell(a[t]),u=this.cell(e[t]),c=this.cell(o[t]);let d=0;const w=this.distances;for(let M=0;M<=r;M++){for(let b=A-M;b<=A+M;b++)for(let i=u-M;i<=u+M;i++)for(let m=c-M;m<=c+M;m++){if(Math.max(Math.abs(b-A),Math.abs(i-u),Math.abs(m-c))!==M)continue;const y=this.slot(b,i,m);if(this.seen[y]!==g){this.seen[y]=g;for(let E=this.start[y];E<this.start[y+1];E++){const O=this.members[E];if(O===t)continue;const N=a[O]-a[t],I=e[O]-e[t],z=o[O]-o[t],T=N*N+I*I+z*z;if(d===n&&T>=w[n-1])continue;const P=Math.sqrt(T);if(P>0&&!f(N,I,z,P))continue;let v=Math.min(d,n-1);for(;v>0&&w[v-1]>T;)w[v]=w[v-1],h[v]=h[v-1],v--;w[v]=T,h[v]=O,d<n&&d++}}}if(d===n&&w[n-1]<=(M*this.cellM)**2)break}return d}}class p{static SAMPLE_MS=100;static MAX_KEYFRAMES=6e4;static computed=new Map;static bodiesOf(t,a=jt.NONE){const e=JSON.stringify(t)+a.signature;let o=p.computed.get(e);return o||(o=p.compute(t,a),p.computed.set(e,o),p.computed.size>16&&p.computed.delete(p.computed.keys().next().value)),o}static speciesOf(t){return V.byId(t.species)??V.ALL[0]}static compute(t,a){const e=p.pathOf(t);if(e.length===0)return[];const o=p.speciesOf(t),n=Math.max(1,Math.floor(t.count??1)),r=p.randomFrom(t.seed??1),h=t.wingbeatHz??V.wingbeatHz(o,V.airDensityAt((t.originElevationM??0)+e[0].upM)),f=t.flight??o.flight,g=e[0].t,A=e[e.length-1].t,u=p.sampleMs(n,A-g),c=t.formation?.kind==="flock"?l.run({path:e,count:n,species:o,spacing:t.formation.spacing??1.5,informedShare:t.formation.informed,obstacles:a,random:r,sampleMs:u}):p.arranged(t,e,o,n,r,u),d=V.sizeOf(o),w={...o.colours,...t.colours};return c.map((M,b)=>{const i=h*(1+(r()-.5)*.06),m=r(),y=M.delayS,E=f.kind==="path"?p.flapsAlong(M.samples,i,f,m):void 0,O=M.samples.map((I,z)=>({t:Math.round(I.t),eastM:p.round(I.eastM),northM:p.round(I.northM),altitudeM:p.round(I.upM-d.heightM/2),...z===0?{sizeM:d,appearance:{color:o.plumage.color,albedo:o.plumage.albedo}}:{},attitude:{headingDeg:p.round(I.headingDeg),pitchDeg:p.round(I.pitchDeg),rollDeg:p.round(I.rollDeg)},motions:{flap:p.round(E?E[z]:p.beatsAt((I.t-g)/1e3-y,i,f,m),1e3)}}));return{id:n>1?`${t.id}-${b+1}`:t.id,...t.title?{title:t.title}:{},...t.explainsEach?t.explainsEach[b]!==void 0?{explains:[t.explainsEach[b]]}:{}:{...t.explains?{explains:t.explains}:{},...n>1?{ensemble:t.id}:{}},model:{id:`ufoathome-bird-${o.build}`},shadow:!1,...Object.keys(w).length>0?{modelParameters:w}:{},...t.lightFromBelow?{lightFromBelow:t.lightFromBelow}:{},track:O}})}static beatsAt(t,a,e,o){if(e.kind==="flapping")return Math.max(0,t*a+o);const r=e.beats/a+e.glideS,h=Math.max(0,t+o*r),f=Math.floor(h/r),g=h-f*r;return f*e.beats+Math.min(e.beats,g*a)}static CLIMB_FLAPS_MS=.3;static DESCENT_GLIDES_MS=-.8;static flapsAlong(t,a,e,o){let n=o,r=!0,h=Math.floor(n),f=0;return t.map((g,A)=>{if(A===0)return n;const u=t[A-1],c=(g.t-u.t)/1e3;if(c<=0)return n;const d=(g.upM-u.upM)/c,w=r?n-h<e.beats:(g.t-f)/1e3>=e.glideS,M=d>p.CLIMB_FLAPS_MS?!0:d<p.DESCENT_GLIDES_MS?!1:w;if(r){const b=n+a*c;!M&&Math.floor(b)>Math.floor(n)?(n=Math.floor(b),r=!1,f=g.t):n=b}else M&&(r=!0,h=n);return n})}static sampleMs(t,a){const e=t*(a/p.SAMPLE_MS+1);return e<=p.MAX_KEYFRAMES?p.SAMPLE_MS:Math.ceil(p.SAMPLE_MS*e/p.MAX_KEYFRAMES/50)*50}static pathOf(t){return[...t.path].sort((a,e)=>a.t-e.t).map(a=>{if("eastM"in a)return{t:a.t,eastM:a.eastM,northM:a.northM,upM:a.altitudeM};const e=a.azimuthDeg*Math.PI/180,o=a.altitudeDeg*Math.PI/180,n=a.distanceM*Math.cos(o);return{t:a.t,eastM:n*Math.sin(e),northM:n*Math.cos(e),upM:(a.eyeHeightM??1.6)+a.distanceM*Math.sin(o)}})}static arranged(t,a,e,o,n,r){const h=t.formation??{kind:o>1?"cluster":"single"},f=p.slotsOf(h,o,e.wingspanM,n),g=h.kind==="v"||h.kind==="j"||h.kind==="echelon"||h.kind==="column",A=(h.wander??(g?.15:.4))*e.wingspanM,u=new It(a),c=Math.max(u.meanSpeedMS(),1);return f.map(d=>{const w=g?Math.max(0,-d.forwardM)/c:0,M=p.swayFrom(n,A),b=[];for(let i=a[0].t;i<=a[a.length-1].t+1e-6;i+=r){const m=(i-a[0].t)/1e3,y=i-w*1e3,E=u.at(y),O=u.velocityAt(y),N=Math.atan2(O.east,O.north),[I,z,T]=M(m),P=g?I:d.forwardM+I,v=d.rightM+z,et=E.eastM+Math.sin(N)*P+Math.cos(N)*v,at=E.northM+Math.cos(N)*P-Math.sin(N)*v;b.push({t:i,eastM:et,northM:at,upM:E.upM+d.upM+T,headingDeg:0,pitchDeg:0,rollDeg:0})}return p.attitudes(b),{samples:b,delayS:w}})}static slotsOf(t,a,e,o){const n=[],r=t.kind;if(r==="single"||a===1)return[{forwardM:0,rightM:0,upM:0}];if(r==="v"||r==="j"||r==="echelon"||r==="column"){const c=(t.spacing??1)*e*(r==="column"?0:1),d=(t.angleDeg??70)/2*Math.PI/180,w=r==="column"?(t.spacing??1)*e:c/Math.tan(d),M=r==="v"?.5:r==="echelon"||r==="column"?1:t.asymmetry??.7;n.push({forwardM:0,rightM:0,upM:0});const b=Math.round(M*(a-1));let i=0,m=0;for(let y=1;y<a;y++){const E=m>=a-1-b||i<b&&i/Math.max(b,1)<=m/Math.max(a-1-b,1),O=E?++i:++m;n.push({forwardM:-w*O,rightM:(E?1:-1)*c*O,upM:-.05*e*O*o()})}return n}const h=(t.spacing??1.5)*e;if(r==="front"){for(let c=0;c<a;c++)n.push({forwardM:(o()-.5)*h*1.2,rightM:(c-(a-1)/2)*h,upM:(o()-.5)*h*.4});return n}const f=a*h**3,g=Math.cbrt(f/(4/3*Math.PI*1*2.8*5.6)),A={up:g,across:2.8*g,along:5.6*g};let u=0;for(;n.length<a&&u<a*200;){u++;const c=2*o()-1,d=2*o()-1,w=2*o()-1;if(c*c+d*d+w*w>1)continue;const M={forwardM:c*A.along,rightM:d*A.across,upM:w*A.up};n.some(b=>(b.forwardM-M.forwardM)**2+(b.rightM-M.rightM)**2+(b.upM-M.upM)**2<(h/2)**2)||n.push(M)}for(;n.length<a;)n.push({forwardM:(o()-.5)*A.along,rightM:(o()-.5)*A.across,upM:0});return n}static swayFrom(t,a){const e=[0,1,2].map(o=>[0,1].map(()=>({period:3+t()*7,phase:t()*2*Math.PI,share:(o===2?.4:o===1?.7:1)*(.4+.6*t())})));return o=>e.map(n=>n.reduce((r,h)=>r+a*h.share*.5*Math.sin(2*Math.PI*o/h.period+h.phase),0))}static attitudes(t){const a=t.length;if(!(a<2)){for(let e=0;e<a;e++){const o=t[Math.max(0,e-1)],n=t[Math.min(a-1,e+1)],r=(n.t-o.t)/1e3,h=(n.eastM-o.eastM)/r,f=(n.northM-o.northM)/r,g=(n.upM-o.upM)/r,A=Math.hypot(h,f),u=t[e];u.headingDeg=A>.05?(Math.atan2(h,f)*180/Math.PI+360)%360:e>0?t[e-1].headingDeg:0,u.pitchDeg=Math.atan2(g,Math.max(A,.5))*180/Math.PI}for(let e=0;e<a;e++){const o=t[Math.max(0,e-2)],n=t[Math.min(a-1,e+2)],r=(n.t-o.t)/1e3;let h=n.headingDeg-o.headingDeg;h=(h+540)%360-180;const f=t[e],g=t[Math.max(0,e-1)],A=t[Math.min(a-1,e+1)],u=Math.hypot(A.eastM-g.eastM,A.northM-g.northM)/Math.max((A.t-g.t)/1e3,.001),c=r>0?h*Math.PI/180/r:0,d=Math.atan(u*c/V.G)*180/Math.PI;f.rollDeg=Math.max(-70,Math.min(70,d))}}}static randomFrom(t){let a=t>>>0;return()=>{a=a+1831565813>>>0;let e=a;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}static round(t,a=100){return Math.round(t*a)/a}}class It{constructor(t){this.points=t}at(t){const a=this.points;if(a.length===1||t<=a[0].t)return this.extrapolated(t,0);if(t>=a[a.length-1].t)return this.extrapolated(t,a.length-1);let e=0;for(;e<a.length-2&&t>a[e+1].t;)e++;const o=a[Math.max(0,e-1)],n=a[e],r=a[e+1],h=a[Math.min(a.length-1,e+2)],f=(t-n.t)/(r.t-n.t),g=(u,c,d)=>(c[d]-u[d])/Math.max(c.t-u.t,1)*(r.t-n.t),A=u=>{const c=g(o,r,u),d=g(n,h,u),w=f*f,M=w*f;return(2*M-3*w+1)*n[u]+(M-2*w+f)*c+(-2*M+3*w)*r[u]+(M-w)*d};return{t,eastM:A("eastM"),northM:A("northM"),upM:A("upM")}}extrapolated(t,a){const e=this.points,o=e[a];if(e.length<2)return{...o,t};const n=a===0?e[0]:e[e.length-2],r=a===0?e[1]:e[e.length-1],h=(t-o.t)/Math.max(r.t-n.t,1);return{t,eastM:o.eastM+(r.eastM-n.eastM)*h,northM:o.northM+(r.northM-n.northM)*h,upM:o.upM+(r.upM-n.upM)*h}}velocityAt(t){const a=this.at(t-50),e=this.at(t+50);return{east:(e.eastM-a.eastM)/.1,north:(e.northM-a.northM)/.1,up:(e.upM-a.upM)/.1}}meanSpeedMS(){const t=this.points;if(t.length<2)return 0;let a=0;for(let e=1;e<t.length;e++)a+=Math.hypot(t[e].eastM-t[e-1].eastM,t[e].northM-t[e-1].northM,t[e].upM-t[e-1].upM);return a/Math.max((t[t.length-1].t-t[0].t)/1e3,.001)}}const qt=Object.freeze(Object.defineProperty({__proto__:null,BirdFlock:p,FlightPath:It},Symbol.toStringTag,{value:"Module"}));export{p as B,l as F,V as a,qt as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as g,_ as h,b6 as x,
|
|
1
|
+
import{e as g,_ as h,b6 as x,bD as v,bE as P}from"./rr0-scene.mjs";import{S as _,P as w,a as m,c as f,b as T,E as b}from"./ParameterForm-CRC9iA-m.js";import{D as p}from"./DroneParameters-CoWQympS.js";import{T as O}from"./TimelineTracks-iym9uOfD.js";import"./DroneFlight-ERYah68l.js";const I=g.catalog({en:()=>h(()=>import("./DroneParameterTexts_en-sL1dR2RG.js"),[],import.meta.url).then(o=>o.droneParameterTexts_en),fr:()=>h(()=>import("./DroneParameterTexts_fr-B8Ym7Yz6.js"),[],import.meta.url).then(o=>o.droneParameterTexts_fr),es:()=>h(()=>import("./DroneParameterTexts_es-Bg8_8XVE.js"),[],import.meta.url).then(o=>o.droneParameterTexts_es),it:()=>h(()=>import("./DroneParameterTexts_it-DfvWjvoc.js"),[],import.meta.url).then(o=>o.droneParameterTexts_it)}),y=g.catalog({en:()=>h(()=>import("./DroneEditorMessages_en-BViHK30c.js"),[],import.meta.url).then(o=>o.droneEditorMessages_en),fr:()=>h(()=>import("./DroneEditorMessages_fr-CvV0RyOT.js"),[],import.meta.url).then(o=>o.droneEditorMessages_fr),es:()=>h(()=>import("./DroneEditorMessages_es-D6bhIOAa.js"),[],import.meta.url).then(o=>o.droneEditorMessages_es),it:()=>h(()=>import("./DroneEditorMessages_it-CYi-jmVN.js"),[],import.meta.url).then(o=>o.droneEditorMessages_it)});class d{constructor(t,i,e){this.container=t,this.host=i,_.attach(t,"drone-editor-part",d.STYLE),this.language=e,w.of("drones")||p.publish(),this.ready=this.setLanguage(e)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;pointForm;pointIndex=0;language;shown=[];static STYLE='.drone-editor-part { flex-basis: 100%; min-width: 0; } .drone-editor-part #drone-list, .drone-editor-part #drone-timeline { flex-basis: 100%; min-width: 0; } .drone-editor-part #drone-timeline { padding: 4px 0; } .drone-editor-part #drone-path > .icon-btn { align-self: flex-end; } .drone-editor-part .launch-editor, .drone-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .drone-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .drone-editor-part [hidden] { display: none !important; } .drone-editor-part select { min-width: 0; width: 100%; } .drone-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .drone-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .drone-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; } .drone-editor-part input, .drone-editor-part select { max-width: 100%; box-sizing: border-box; } .drone-editor-part input[type="text"] { width: 12em; } .drone-editor-part label { min-width: 0; max-width: 100%; } .drone-editor-part input.parameter-derived::placeholder { opacity: .65; } .drone-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 i=++this.languageToken;this.language=t;const[e,s]=await Promise.all([y.load(t),I.load(t)]);i===this.languageToken&&(this.messages=e,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.flights;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 i=this.current;if(this.element("drone-fields").hidden=i===void 0,!i)return;const e=this.element("drone-each");e.hidden=i.explainsEach===void 0,e.textContent=this.messages.explainsEachNote.replace("{n}",String(i.explainsEach?.length??0)),this.form??=new m(this.element("drone-parameters"),this.language,"drones.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(p.SET),new f(()=>this.current,s=>this.editFlight(n=>s(n)),()=>({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.flights;if(t.length===this.shown.length&&t.every((i,e)=>i.id===this.shown[e].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.flights.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="drone-list"></div>
|
|
4
4
|
<div id="drone-fields" class="launch-fields">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bG as T}from"./rr0-scene.mjs";class O{static G=9.81;static ALL=[{id:"quadcopter",modelId:"ufoathome-drone-quadcopter",sizeM:{widthM:.508,lengthM:.493,heightM:.093},hovers:!0,maxSpeedMS:21,maxTiltDeg:35,holdM:{horizontalM:.5,verticalM:.5},yawRateDegS:120,bodyColor:"#5b5f63",lights:{front:{color:"#ff2a1a",candela:1,leds:[{at:[-.125,-.03,-.14],radiusM:.004},{at:[.125,-.03,-.14],radiusM:.004}]},rear:{color:"#2aff5a",candela:1,hz:.5,leds:[{at:[0,.005,.135],radiusM:.004}]},strobe:{color:"#ffffff",candela:40,hz:1.25,flashS:.06,leds:[{at:[0,-.034,.05],radiusM:.006}]}}},{id:"saucer",modelId:"ufoathome-drone-saucer",sizeM:{widthM:.8,lengthM:.8,heightM:.206},hovers:!0,maxSpeedMS:12,maxTiltDeg:25,holdM:{horizontalM:.5,verticalM:.5},yawRateDegS:90,bodyColor:"#c9ccd0",lights:{rim:{color:"#4fd2ff",candela:1,leds:O.ring(12,.388,0,.012)},under:{color:"#ffffff",candela:3,leds:[{at:[0,-.094,0],radiusM:.02}]},strobe:{color:"#ffffff",candela:40,hz:1.25,flashS:.06,off:!0,leds:[{at:[0,.1,0],radiusM:.006}]}}},{id:"fixed-wing",modelId:"ufoathome-drone-fixed-wing",sizeM:{widthM:3.596,lengthM:1.848,heightM:.53},hovers:!1,maxSpeedMS:33,maxTiltDeg:0,holdM:{horizontalM:1,verticalM:.5},yawRateDegS:0,bodyColor:"#6f7568",lights:{"nav-left":{color:"#ff2a1a",candela:2,leds:[{at:[-1.79,.02,.05],radiusM:.008}]},"nav-right":{color:"#2aff5a",candela:2,leds:[{at:[1.79,.02,.05],radiusM:.008}]},tail:{color:"#ffffff",candela:1,leds:[{at:[0,.05,.94],radiusM:.008}]},strobe:{color:"#ffffff",candela:40,hz:1,flashS:.06,leds:[{at:[0,-.1,.1],radiusM:.008}]}}}];static byId(t){return O.ALL.find(a=>a.id===t)}static materialOf(t,a,e){return e>1?`light-${t}-${a+1}`:`light-${t}`}static colourKeyOf(t){return t.replace(/-([a-z])/g,(a,e)=>e.toUpperCase())+"Color"}static ring(t,a,e,n){return Array.from({length:t},(s,M)=>{const r=M/t*2*Math.PI;return{at:[Math.round(a*Math.sin(r)*1e4)/1e4,e,Math.round(-a*Math.cos(r)*1e4)/1e4],radiusM:n}})}}class i{static SAMPLE_MS=100;static MAX_KEYFRAMES=6e4;static computed=new Map;static bodiesOf(t){const a=JSON.stringify(t);let e=i.computed.get(a);return e||(e=i.compute(t),i.computed.set(a,e),i.computed.size>16&&i.computed.delete(i.computed.keys().next().value)),e}static airframeOf(t){return O.byId(t.airframe)??O.ALL[0]}static lightsOf(t){const a=i.airframeOf(t),e={};for(const[n,s]of Object.entries(a.lights)){const M=t.lights?.[n];if(M===!1)continue;const r={...s,...M??{}};r.off||(e[n]=r)}return e}static compute(t){const a=i.pathOf(t);if(a.length===0)return[];const e=i.airframeOf(t),n=new j(a,e.hovers),s=Math.max(1,Math.floor(t.count??1)),M=i.randomFrom(t.seed??1),r=a[0].t,c=Math.max(a[a.length-1].t,r),d=i.sampleMs(s,c-r),u=i.offsetsOf(t.formation??{kind:s>1?"cluster":"single"},s,M),f=i.lightsOf(t),y={bodyColor:t.bodyColor??e.bodyColor};for(const[m,o]of Object.entries(f))y[O.colourKeyOf(m)]=o.color;const S=t.formation?.kind==="line";return u.map((m,o)=>{const h=i.swayFrom(M,e.holdM),p=Object.fromEntries(Object.entries(f).map(([l,b])=>[l,b.phase??(s>1?M():0)])),g=l=>{const b=n.at(l),[z,I,N]=h((l-r)/1e3);let k=m.eastM,C=m.northM;if(S){const D=n.velocityAt(l),R=Math.hypot(D.east,D.north)>.3?Math.atan2(D.east,D.north):n.headingAtRest(l);k=Math.cos(R)*m.rightM,C=-Math.sin(R)*m.rightM}return{eastM:b.eastM+k+z,northM:b.northM+C+I,upM:b.upM+m.upM+N}},w=[];for(let l=r;l<=c+1e-6;l+=d)w.push(l);w[w.length-1]<c&&w.push(c);const x=i.attitudes(w.map(l=>({t:l,...g(l),headingDeg:0,pitchDeg:0,rollDeg:0})),e,t),P=i.switchesOf(f,p,r,c),E=[...new Set([...w.map(l=>Math.round(l)),...P])].filter(l=>l>=r&&l<=c).sort((l,b)=>l-b);let v=0;const A=E.map((l,b)=>{for(;v<x.length-2&&x[v+1].t<=l;)v++;const z=i.between(x[v],x[Math.min(x.length-1,v+1)],l,g);return{t:l,eastM:i.round(z.eastM),northM:i.round(z.northM),altitudeM:i.round(z.upM-e.sizeM.heightM/2),...b===0?{sizeM:e.sizeM}:{},attitude:{headingDeg:i.round(z.headingDeg,10),pitchDeg:i.round(z.pitchDeg,10),rollDeg:i.round(z.rollDeg,10)},lights:i.luminancesAt(f,p,l,E[b+1]===l+1)}});return{id:s>1?`${t.id}-${o+1}`:t.id,...t.title?{title:t.title}:{},...t.explainsEach?t.explainsEach[o]!==void 0?{explains:[t.explainsEach[o]]}:{}:{...t.explains?{explains:t.explains}:{},...s>1?{ensemble:t.id}:{}},model:{id:e.modelId},modelParameters:y,lamps:i.lampsOf(f,p),...t.silent?{}:{sound:{kind:"unmanned",...t.quieterDb?{quieterDb:t.quieterDb}:{}}},track:A}})}static lampsOf(t,a){return Object.entries(t).flatMap(([e,n])=>n.leds.map((s,M)=>{const r=n.hz>0,c=r?1/n.hz:0;return{id:O.materialOf(e,M,n.leds.length),offsetM:{x:s.at[0],y:s.at[1],z:-s.at[2]},color:n.color,intensity:n.candela/T,pattern:r?{kind:"flash",perMinute:n.hz*60,dutyCycle:Math.min(1,(n.flashS??.5*c)/c),phase:((1-(a[e]??0))%1+1)%1}:{kind:"steady"}}}))}static luminancesAt(t,a,e,n=!1){const s={};for(const[M,r]of Object.entries(t)){const c=i.isOn(r,a[M]??0,n?e-1:e+.5);r.leds.forEach((d,u)=>{s[O.materialOf(M,u,r.leds.length)]=c?i.round(r.candela/(Math.PI*d.radiusM**2),1):0})}return s}static isOn(t,a,e){if(!(t.hz>0))return!0;const n=1e3/t.hz,s=Math.min(n,(t.flashS??.5/t.hz)*1e3);return((e/n-a)%1+1)%1*n<s}static switchesOf(t,a,e,n){const s=[];for(const[M,r]of Object.entries(t)){if(!(r.hz>0))continue;const c=1e3/r.hz,d=Math.min(c,(r.flashS??.5/r.hz)*1e3);if(d>=c)continue;const u=(a[M]??0)*c;for(let f=Math.floor((e-u)/c)*c+u;f<=n;f+=c)for(const y of[f,f+d]){const S=Math.round(y);S>=e&&S<n&&s.push(S,S+1)}}return s}static sampleMs(t,a){const e=t*(a/i.SAMPLE_MS+1);return e<=i.MAX_KEYFRAMES?i.SAMPLE_MS:Math.ceil(i.SAMPLE_MS*e/i.MAX_KEYFRAMES/50)*50}static pathOf(t){return[...t.path].sort((a,e)=>a.t-e.t).map(a=>{if("eastM"in a)return{t:a.t,eastM:a.eastM,northM:a.northM,upM:a.altitudeM};const e=a.azimuthDeg*Math.PI/180,n=a.altitudeDeg*Math.PI/180,s=a.distanceM*Math.cos(n);return{t:a.t,eastM:s*Math.sin(e),northM:s*Math.cos(e),upM:(a.eyeHeightM??1.6)+a.distanceM*Math.sin(n)}})}static offsetsOf(t,a,e){if(t.kind==="single"||a===1)return[{eastM:0,northM:0,upM:0,rightM:0}];if(t.kind==="line"){const c=t.spacingM??5;return Array.from({length:a},(d,u)=>({eastM:0,northM:0,upM:(e()-.5)*c*.2,rightM:(u-(a-1)/2)*c}))}const n=t.spacingM??10,s=Math.cbrt(a*n**3/(4/3*Math.PI*2*2*1)),M=[];let r=0;for(;M.length<a&&r<a*200;){r++;const c=2*e()-1,d=2*e()-1,u=2*e()-1;if(c*c+d*d+u*u>1)continue;const f={eastM:c*2*s,northM:d*2*s,upM:u*s,rightM:0};M.some(y=>(y.eastM-f.eastM)**2+(y.northM-f.northM)**2+(y.upM-f.upM)**2<(n/2)**2)||M.push(f)}for(;M.length<a;)M.push({eastM:(e()-.5)*4*s,northM:(e()-.5)*4*s,upM:0,rightM:0});return M}static swayFrom(t,a){const e=[a.horizontalM,a.horizontalM,a.verticalM].map(n=>[0,1].map(()=>({period:4+t()*10,phase:t()*2*Math.PI,amplitude:n*.5*(.5+.5*t())})));return n=>e.map(s=>s.reduce((M,r)=>M+r.amplitude*Math.sin(2*Math.PI*n/r.period+r.phase),0))}static attitudes(t,a,e){const n=t.length;if(n===0)return t;const s=O.G,M=(e.wind?.fromDeg??0)*Math.PI/180,r=-(e.wind?.speedMS??0)*Math.sin(M),c=-(e.wind?.speedMS??0)*Math.cos(M),d=o=>{const h=t[Math.max(0,o-1)],p=t[Math.min(n-1,o+1)],g=Math.max((p.t-h.t)/1e3,.001);return{e:(p.eastM-h.eastM)/g,n:(p.northM-h.northM)/g,u:(p.upM-h.upM)/g}},u=t.map((o,h)=>d(h)),f=o=>{const h=u[Math.max(0,o-1)],p=u[Math.min(n-1,o+1)],g=Math.max((t[Math.min(n-1,o+1)].t-t[Math.max(0,o-1)].t)/1e3,.001);return{e:(p.e-h.e)/g,n:(p.n-h.n)/g,u:(p.u-h.u)/g}};if(!a.hovers){for(let o=0;o<n;o++){const h=u[o],p=h.e-r,g=h.n-c,w=Math.hypot(h.e,h.n);t[o].headingDeg=Math.hypot(p,g)>.5?(Math.atan2(p,g)*180/Math.PI+360)%360:o>0?t[o-1].headingDeg:0,t[o].pitchDeg=Math.atan2(h.u,Math.max(w,1))*180/Math.PI+2;const x=f(o),P=w>.5?(x.e*h.n-x.n*h.e)/w:0;t[o].rollDeg=Math.max(-45,Math.min(45,Math.atan(P/s)*180/Math.PI))}return t}const y=s*Math.tan(a.maxTiltDeg*Math.PI/180)/a.maxSpeedMS**2,S=a.yawRateDegS*i.SAMPLE_MS/1e3;let m=e.headingDeg;if(m===void 0){const o=u.find(h=>Math.hypot(h.e,h.n)>1);m=o?(Math.atan2(o.e,o.n)*180/Math.PI+360)%360:0}for(let o=0;o<n;o++){const h=u[o];if(e.headingDeg===void 0&&Math.hypot(h.e,h.n)>1){const z=((Math.atan2(h.e,h.n)*180/Math.PI+360)%360-m+540)%360-180,I=o>0?(t[o].t-t[o-1].t)/i.SAMPLE_MS:1;m=(m+Math.max(-S*I,Math.min(S*I,z))+360)%360}const p=f(o),g=h.e-r,w=h.n-c,x=Math.hypot(g,w),P=p.e+y*x*g,E=p.n+y*x*w,v=Math.max(s+p.u,.2*s),A=m*Math.PI/180,L=P*Math.sin(A)+E*Math.cos(A),l=P*Math.cos(A)-E*Math.sin(A);t[o].headingDeg=m,t[o].pitchDeg=-Math.atan(L/v)*180/Math.PI,t[o].rollDeg=Math.atan(l/v)*180/Math.PI}return t}static between(t,a,e,n){if(e===t.t)return t;if(e===a.t)return a;const s=a.t===t.t?0:Math.min(1,Math.max(0,(e-t.t)/(a.t-t.t))),M=(a.headingDeg-t.headingDeg+540)%360-180;return{t:e,...n(e),headingDeg:(t.headingDeg+M*s+360)%360,pitchDeg:t.pitchDeg+(a.pitchDeg-t.pitchDeg)*s,rollDeg:t.rollDeg+(a.rollDeg-t.rollDeg)*s}}static randomFrom(t){let a=t>>>0;return()=>{a=a+1831565813>>>0;let e=a;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}static round(t,a=100){return Math.round(t*a)/a}}class j{constructor(t,a){this.points=t,this.hovers=a;const e=t;this.speeds=e.map((n,s)=>{const M=e[s-1],r=e[s+1],c=(h,p)=>{const g=Math.max((p.t-h.t)/1e3,.001);return{e:(p.eastM-h.eastM)/g,n:(p.northM-h.northM)/g,u:(p.upM-h.upM)/g}};if(!M||!r)return a||e.length<2?{e:0,n:0,u:0}:M?c(M,n):c(n,r);const d=c(M,n),u=c(n,r),f=Math.hypot(d.e,d.n,d.u),y=Math.hypot(u.e,u.n,u.u);if(a&&(f<.05||y<.05||d.e*u.e+d.n*u.n+d.u*u.u<0))return{e:0,n:0,u:0};const S=n.t-M.t,m=r.t-n.t,o=S/Math.max(S+m,1);return{e:d.e*(1-o)+u.e*o,n:d.n*(1-o)+u.n*o,u:d.u*(1-o)+u.u*o}})}speeds;at(t){const a=this.points;if(a.length===1)return{...a[0],t};if(t<=a[0].t)return this.outside(t,0);if(t>=a[a.length-1].t)return this.outside(t,a.length-1);let e=0;for(;e<a.length-2&&t>a[e+1].t;)e++;const n=a[e],s=a[e+1],M=Math.max((s.t-n.t)/1e3,.001),r=(t-n.t)/(s.t-n.t),c=r*r,d=c*r,u=2*d-3*c+1,f=d-2*c+r,y=-2*d+3*c,S=d-c,m=this.speeds[e],o=this.speeds[e+1];return{t,eastM:u*n.eastM+f*m.e*M+y*s.eastM+S*o.e*M,northM:u*n.northM+f*m.n*M+y*s.northM+S*o.n*M,upM:u*n.upM+f*m.u*M+y*s.upM+S*o.u*M}}velocityAt(t){const a=this.at(t-50),e=this.at(t+50);return{east:(e.eastM-a.eastM)/.1,north:(e.northM-a.northM)/.1,up:(e.upM-a.upM)/.1}}headingAtRest(t){const a=this.points;for(let e=a.length-1;e>0;e--){if(a[e].t>t&&e>1)continue;const n=a[e].eastM-a[e-1].eastM,s=a[e].northM-a[e-1].northM;if(Math.hypot(n,s)>.1)return Math.atan2(n,s)}for(let e=1;e<a.length;e++){const n=a[e].eastM-a[e-1].eastM,s=a[e].northM-a[e-1].northM;if(Math.hypot(n,s)>.1)return Math.atan2(n,s)}return 0}outside(t,a){const e=this.points[a];if(this.hovers)return{...e,t};const n=this.speeds[a],s=(t-e.t)/1e3;return{t,eastM:e.eastM+n.e*s,northM:e.northM+n.n*s,upM:e.upM+n.u*s}}}const K=Object.freeze(Object.defineProperty({__proto__:null,DroneFlight:i,DronePath:j},Symbol.toStringTag,{value:"Module"}));export{O as D,i as a,j as b,K as c};
|
|
1
|
+
import{bF as T}from"./rr0-scene.mjs";class O{static G=9.81;static ALL=[{id:"quadcopter",modelId:"ufoathome-drone-quadcopter",sizeM:{widthM:.508,lengthM:.493,heightM:.093},hovers:!0,maxSpeedMS:21,maxTiltDeg:35,holdM:{horizontalM:.5,verticalM:.5},yawRateDegS:120,bodyColor:"#5b5f63",lights:{front:{color:"#ff2a1a",candela:1,leds:[{at:[-.125,-.03,-.14],radiusM:.004},{at:[.125,-.03,-.14],radiusM:.004}]},rear:{color:"#2aff5a",candela:1,hz:.5,leds:[{at:[0,.005,.135],radiusM:.004}]},strobe:{color:"#ffffff",candela:40,hz:1.25,flashS:.06,leds:[{at:[0,-.034,.05],radiusM:.006}]}}},{id:"saucer",modelId:"ufoathome-drone-saucer",sizeM:{widthM:.8,lengthM:.8,heightM:.206},hovers:!0,maxSpeedMS:12,maxTiltDeg:25,holdM:{horizontalM:.5,verticalM:.5},yawRateDegS:90,bodyColor:"#c9ccd0",lights:{rim:{color:"#4fd2ff",candela:1,leds:O.ring(12,.388,0,.012)},under:{color:"#ffffff",candela:3,leds:[{at:[0,-.094,0],radiusM:.02}]},strobe:{color:"#ffffff",candela:40,hz:1.25,flashS:.06,off:!0,leds:[{at:[0,.1,0],radiusM:.006}]}}},{id:"fixed-wing",modelId:"ufoathome-drone-fixed-wing",sizeM:{widthM:3.596,lengthM:1.848,heightM:.53},hovers:!1,maxSpeedMS:33,maxTiltDeg:0,holdM:{horizontalM:1,verticalM:.5},yawRateDegS:0,bodyColor:"#6f7568",lights:{"nav-left":{color:"#ff2a1a",candela:2,leds:[{at:[-1.79,.02,.05],radiusM:.008}]},"nav-right":{color:"#2aff5a",candela:2,leds:[{at:[1.79,.02,.05],radiusM:.008}]},tail:{color:"#ffffff",candela:1,leds:[{at:[0,.05,.94],radiusM:.008}]},strobe:{color:"#ffffff",candela:40,hz:1,flashS:.06,leds:[{at:[0,-.1,.1],radiusM:.008}]}}}];static byId(t){return O.ALL.find(a=>a.id===t)}static materialOf(t,a,e){return e>1?`light-${t}-${a+1}`:`light-${t}`}static colourKeyOf(t){return t.replace(/-([a-z])/g,(a,e)=>e.toUpperCase())+"Color"}static ring(t,a,e,n){return Array.from({length:t},(s,M)=>{const r=M/t*2*Math.PI;return{at:[Math.round(a*Math.sin(r)*1e4)/1e4,e,Math.round(-a*Math.cos(r)*1e4)/1e4],radiusM:n}})}}class i{static SAMPLE_MS=100;static MAX_KEYFRAMES=6e4;static computed=new Map;static bodiesOf(t){const a=JSON.stringify(t);let e=i.computed.get(a);return e||(e=i.compute(t),i.computed.set(a,e),i.computed.size>16&&i.computed.delete(i.computed.keys().next().value)),e}static airframeOf(t){return O.byId(t.airframe)??O.ALL[0]}static lightsOf(t){const a=i.airframeOf(t),e={};for(const[n,s]of Object.entries(a.lights)){const M=t.lights?.[n];if(M===!1)continue;const r={...s,...M??{}};r.off||(e[n]=r)}return e}static compute(t){const a=i.pathOf(t);if(a.length===0)return[];const e=i.airframeOf(t),n=new j(a,e.hovers),s=Math.max(1,Math.floor(t.count??1)),M=i.randomFrom(t.seed??1),r=a[0].t,c=Math.max(a[a.length-1].t,r),d=i.sampleMs(s,c-r),u=i.offsetsOf(t.formation??{kind:s>1?"cluster":"single"},s,M),f=i.lightsOf(t),y={bodyColor:t.bodyColor??e.bodyColor};for(const[m,o]of Object.entries(f))y[O.colourKeyOf(m)]=o.color;const S=t.formation?.kind==="line";return u.map((m,o)=>{const h=i.swayFrom(M,e.holdM),p=Object.fromEntries(Object.entries(f).map(([l,b])=>[l,b.phase??(s>1?M():0)])),g=l=>{const b=n.at(l),[z,I,N]=h((l-r)/1e3);let k=m.eastM,C=m.northM;if(S){const D=n.velocityAt(l),R=Math.hypot(D.east,D.north)>.3?Math.atan2(D.east,D.north):n.headingAtRest(l);k=Math.cos(R)*m.rightM,C=-Math.sin(R)*m.rightM}return{eastM:b.eastM+k+z,northM:b.northM+C+I,upM:b.upM+m.upM+N}},w=[];for(let l=r;l<=c+1e-6;l+=d)w.push(l);w[w.length-1]<c&&w.push(c);const x=i.attitudes(w.map(l=>({t:l,...g(l),headingDeg:0,pitchDeg:0,rollDeg:0})),e,t),P=i.switchesOf(f,p,r,c),E=[...new Set([...w.map(l=>Math.round(l)),...P])].filter(l=>l>=r&&l<=c).sort((l,b)=>l-b);let v=0;const A=E.map((l,b)=>{for(;v<x.length-2&&x[v+1].t<=l;)v++;const z=i.between(x[v],x[Math.min(x.length-1,v+1)],l,g);return{t:l,eastM:i.round(z.eastM),northM:i.round(z.northM),altitudeM:i.round(z.upM-e.sizeM.heightM/2),...b===0?{sizeM:e.sizeM}:{},attitude:{headingDeg:i.round(z.headingDeg,10),pitchDeg:i.round(z.pitchDeg,10),rollDeg:i.round(z.rollDeg,10)},lights:i.luminancesAt(f,p,l,E[b+1]===l+1)}});return{id:s>1?`${t.id}-${o+1}`:t.id,...t.title?{title:t.title}:{},...t.explainsEach?t.explainsEach[o]!==void 0?{explains:[t.explainsEach[o]]}:{}:{...t.explains?{explains:t.explains}:{},...s>1?{ensemble:t.id}:{}},model:{id:e.modelId},modelParameters:y,lamps:i.lampsOf(f,p),...t.silent?{}:{sound:{kind:"unmanned",...t.quieterDb?{quieterDb:t.quieterDb}:{}}},track:A}})}static lampsOf(t,a){return Object.entries(t).flatMap(([e,n])=>n.leds.map((s,M)=>{const r=n.hz>0,c=r?1/n.hz:0;return{id:O.materialOf(e,M,n.leds.length),offsetM:{x:s.at[0],y:s.at[1],z:-s.at[2]},color:n.color,intensity:n.candela/T,pattern:r?{kind:"flash",perMinute:n.hz*60,dutyCycle:Math.min(1,(n.flashS??.5*c)/c),phase:((1-(a[e]??0))%1+1)%1}:{kind:"steady"}}}))}static luminancesAt(t,a,e,n=!1){const s={};for(const[M,r]of Object.entries(t)){const c=i.isOn(r,a[M]??0,n?e-1:e+.5);r.leds.forEach((d,u)=>{s[O.materialOf(M,u,r.leds.length)]=c?i.round(r.candela/(Math.PI*d.radiusM**2),1):0})}return s}static isOn(t,a,e){if(!(t.hz>0))return!0;const n=1e3/t.hz,s=Math.min(n,(t.flashS??.5/t.hz)*1e3);return((e/n-a)%1+1)%1*n<s}static switchesOf(t,a,e,n){const s=[];for(const[M,r]of Object.entries(t)){if(!(r.hz>0))continue;const c=1e3/r.hz,d=Math.min(c,(r.flashS??.5/r.hz)*1e3);if(d>=c)continue;const u=(a[M]??0)*c;for(let f=Math.floor((e-u)/c)*c+u;f<=n;f+=c)for(const y of[f,f+d]){const S=Math.round(y);S>=e&&S<n&&s.push(S,S+1)}}return s}static sampleMs(t,a){const e=t*(a/i.SAMPLE_MS+1);return e<=i.MAX_KEYFRAMES?i.SAMPLE_MS:Math.ceil(i.SAMPLE_MS*e/i.MAX_KEYFRAMES/50)*50}static pathOf(t){return[...t.path].sort((a,e)=>a.t-e.t).map(a=>{if("eastM"in a)return{t:a.t,eastM:a.eastM,northM:a.northM,upM:a.altitudeM};const e=a.azimuthDeg*Math.PI/180,n=a.altitudeDeg*Math.PI/180,s=a.distanceM*Math.cos(n);return{t:a.t,eastM:s*Math.sin(e),northM:s*Math.cos(e),upM:(a.eyeHeightM??1.6)+a.distanceM*Math.sin(n)}})}static offsetsOf(t,a,e){if(t.kind==="single"||a===1)return[{eastM:0,northM:0,upM:0,rightM:0}];if(t.kind==="line"){const c=t.spacingM??5;return Array.from({length:a},(d,u)=>({eastM:0,northM:0,upM:(e()-.5)*c*.2,rightM:(u-(a-1)/2)*c}))}const n=t.spacingM??10,s=Math.cbrt(a*n**3/(4/3*Math.PI*2*2*1)),M=[];let r=0;for(;M.length<a&&r<a*200;){r++;const c=2*e()-1,d=2*e()-1,u=2*e()-1;if(c*c+d*d+u*u>1)continue;const f={eastM:c*2*s,northM:d*2*s,upM:u*s,rightM:0};M.some(y=>(y.eastM-f.eastM)**2+(y.northM-f.northM)**2+(y.upM-f.upM)**2<(n/2)**2)||M.push(f)}for(;M.length<a;)M.push({eastM:(e()-.5)*4*s,northM:(e()-.5)*4*s,upM:0,rightM:0});return M}static swayFrom(t,a){const e=[a.horizontalM,a.horizontalM,a.verticalM].map(n=>[0,1].map(()=>({period:4+t()*10,phase:t()*2*Math.PI,amplitude:n*.5*(.5+.5*t())})));return n=>e.map(s=>s.reduce((M,r)=>M+r.amplitude*Math.sin(2*Math.PI*n/r.period+r.phase),0))}static attitudes(t,a,e){const n=t.length;if(n===0)return t;const s=O.G,M=(e.wind?.fromDeg??0)*Math.PI/180,r=-(e.wind?.speedMS??0)*Math.sin(M),c=-(e.wind?.speedMS??0)*Math.cos(M),d=o=>{const h=t[Math.max(0,o-1)],p=t[Math.min(n-1,o+1)],g=Math.max((p.t-h.t)/1e3,.001);return{e:(p.eastM-h.eastM)/g,n:(p.northM-h.northM)/g,u:(p.upM-h.upM)/g}},u=t.map((o,h)=>d(h)),f=o=>{const h=u[Math.max(0,o-1)],p=u[Math.min(n-1,o+1)],g=Math.max((t[Math.min(n-1,o+1)].t-t[Math.max(0,o-1)].t)/1e3,.001);return{e:(p.e-h.e)/g,n:(p.n-h.n)/g,u:(p.u-h.u)/g}};if(!a.hovers){for(let o=0;o<n;o++){const h=u[o],p=h.e-r,g=h.n-c,w=Math.hypot(h.e,h.n);t[o].headingDeg=Math.hypot(p,g)>.5?(Math.atan2(p,g)*180/Math.PI+360)%360:o>0?t[o-1].headingDeg:0,t[o].pitchDeg=Math.atan2(h.u,Math.max(w,1))*180/Math.PI+2;const x=f(o),P=w>.5?(x.e*h.n-x.n*h.e)/w:0;t[o].rollDeg=Math.max(-45,Math.min(45,Math.atan(P/s)*180/Math.PI))}return t}const y=s*Math.tan(a.maxTiltDeg*Math.PI/180)/a.maxSpeedMS**2,S=a.yawRateDegS*i.SAMPLE_MS/1e3;let m=e.headingDeg;if(m===void 0){const o=u.find(h=>Math.hypot(h.e,h.n)>1);m=o?(Math.atan2(o.e,o.n)*180/Math.PI+360)%360:0}for(let o=0;o<n;o++){const h=u[o];if(e.headingDeg===void 0&&Math.hypot(h.e,h.n)>1){const z=((Math.atan2(h.e,h.n)*180/Math.PI+360)%360-m+540)%360-180,I=o>0?(t[o].t-t[o-1].t)/i.SAMPLE_MS:1;m=(m+Math.max(-S*I,Math.min(S*I,z))+360)%360}const p=f(o),g=h.e-r,w=h.n-c,x=Math.hypot(g,w),P=p.e+y*x*g,E=p.n+y*x*w,v=Math.max(s+p.u,.2*s),A=m*Math.PI/180,L=P*Math.sin(A)+E*Math.cos(A),l=P*Math.cos(A)-E*Math.sin(A);t[o].headingDeg=m,t[o].pitchDeg=-Math.atan(L/v)*180/Math.PI,t[o].rollDeg=Math.atan(l/v)*180/Math.PI}return t}static between(t,a,e,n){if(e===t.t)return t;if(e===a.t)return a;const s=a.t===t.t?0:Math.min(1,Math.max(0,(e-t.t)/(a.t-t.t))),M=(a.headingDeg-t.headingDeg+540)%360-180;return{t:e,...n(e),headingDeg:(t.headingDeg+M*s+360)%360,pitchDeg:t.pitchDeg+(a.pitchDeg-t.pitchDeg)*s,rollDeg:t.rollDeg+(a.rollDeg-t.rollDeg)*s}}static randomFrom(t){let a=t>>>0;return()=>{a=a+1831565813>>>0;let e=a;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}static round(t,a=100){return Math.round(t*a)/a}}class j{constructor(t,a){this.points=t,this.hovers=a;const e=t;this.speeds=e.map((n,s)=>{const M=e[s-1],r=e[s+1],c=(h,p)=>{const g=Math.max((p.t-h.t)/1e3,.001);return{e:(p.eastM-h.eastM)/g,n:(p.northM-h.northM)/g,u:(p.upM-h.upM)/g}};if(!M||!r)return a||e.length<2?{e:0,n:0,u:0}:M?c(M,n):c(n,r);const d=c(M,n),u=c(n,r),f=Math.hypot(d.e,d.n,d.u),y=Math.hypot(u.e,u.n,u.u);if(a&&(f<.05||y<.05||d.e*u.e+d.n*u.n+d.u*u.u<0))return{e:0,n:0,u:0};const S=n.t-M.t,m=r.t-n.t,o=S/Math.max(S+m,1);return{e:d.e*(1-o)+u.e*o,n:d.n*(1-o)+u.n*o,u:d.u*(1-o)+u.u*o}})}speeds;at(t){const a=this.points;if(a.length===1)return{...a[0],t};if(t<=a[0].t)return this.outside(t,0);if(t>=a[a.length-1].t)return this.outside(t,a.length-1);let e=0;for(;e<a.length-2&&t>a[e+1].t;)e++;const n=a[e],s=a[e+1],M=Math.max((s.t-n.t)/1e3,.001),r=(t-n.t)/(s.t-n.t),c=r*r,d=c*r,u=2*d-3*c+1,f=d-2*c+r,y=-2*d+3*c,S=d-c,m=this.speeds[e],o=this.speeds[e+1];return{t,eastM:u*n.eastM+f*m.e*M+y*s.eastM+S*o.e*M,northM:u*n.northM+f*m.n*M+y*s.northM+S*o.n*M,upM:u*n.upM+f*m.u*M+y*s.upM+S*o.u*M}}velocityAt(t){const a=this.at(t-50),e=this.at(t+50);return{east:(e.eastM-a.eastM)/.1,north:(e.northM-a.northM)/.1,up:(e.upM-a.upM)/.1}}headingAtRest(t){const a=this.points;for(let e=a.length-1;e>0;e--){if(a[e].t>t&&e>1)continue;const n=a[e].eastM-a[e-1].eastM,s=a[e].northM-a[e-1].northM;if(Math.hypot(n,s)>.1)return Math.atan2(n,s)}for(let e=1;e<a.length;e++){const n=a[e].eastM-a[e-1].eastM,s=a[e].northM-a[e-1].northM;if(Math.hypot(n,s)>.1)return Math.atan2(n,s)}return 0}outside(t,a){const e=this.points[a];if(this.hovers)return{...e,t};const n=this.speeds[a],s=(t-e.t)/1e3;return{t,eastM:e.eastM+n.e*s,northM:e.northM+n.n*s,upM:e.upM+n.u*s}}}const K=Object.freeze(Object.defineProperty({__proto__:null,DroneFlight:i,DronePath:j},Symbol.toStringTag,{value:"Module"}));export{O as D,i as a,j as b,K as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as o,P as f}from"./ParameterForm-CRC9iA-m.js";import{D as c,a,b}from"./DroneFlight-
|
|
1
|
+
import{d as o,P as f}from"./ParameterForm-CRC9iA-m.js";import{D as c,a,b}from"./DroneFlight-ERYah68l.js";class e{static DRONE="drone";static FLIGHT="flight";static LOOK="look";static LIGHT_NAMES=[...new Set(c.ALL.flatMap(t=>Object.keys(t.lights)))];static textKey(t){return t.replace(/-([a-z])/g,(l,s)=>s.toUpperCase())}static flightOf(t){return t}static ownLight(t,l){return a.airframeOf(e.flightOf(t)).lights[l]}static formationUnstated(t){return(o.read(t,"count")??1)>1?"cluster":"single"}static formationOf(t){const l=o.read(t,"formation.kind");return typeof l=="string"?l:e.formationUnstated(t)}static hovers(t){return a.airframeOf(e.flightOf(t)).hovers}static light(t){const l=e.textKey(t),s=i=>e.ownLight(i,t)!==void 0,h=i=>{const u=e.flightOf(i).lights?.[t];return u===!1?!0:typeof u?.off=="boolean"?u.off:e.ownLight(i,t)?.off===!0},n=i=>s(i)&&!h(i);return[{type:"boolean",key:`lights.${t}.off`,group:l,label:"switchedOff",visibleWhen:s,effective:i=>e.flightOf(i).lights?.[t]===!1||e.ownLight(i,t)?.off===!0},{type:"colour",key:`lights.${t}.color`,group:l,label:"colour",visibleWhen:n,effective:i=>e.ownLight(i,t)?.color},{type:"number",key:`lights.${t}.candela`,min:0,max:1e5,step:.1,unit:"cd",group:l,label:"intensity",hint:"eachLed",visibleWhen:n,effective:i=>e.ownLight(i,t)?.candela},{type:"number",key:`lights.${t}.hz`,min:0,max:50,step:.05,unit:"Hz",group:l,label:"flashesASecond",hint:"steadyAtNought",visibleWhen:n,effective:i=>e.ownLight(i,t)?.hz??0},{type:"number",key:`lights.${t}.flashS`,min:.001,max:60,step:.001,unit:"s",group:l,label:"eachFlashLasts",visibleWhen:i=>n(i)&&(o.read(i,`lights.${t}.hz`)??e.ownLight(i,t)?.hz??0)>0,effective:i=>{const u=e.ownLight(i,t),p=o.read(i,`lights.${t}.hz`)??u?.hz??0;return u?.flashS??(p>0?Math.round(500/p)/1e3:void 0)}}]}static SET={kind:"drones",title:"drones",parameters:[{type:"said",key:"title",label:"name",group:e.DRONE},{type:"choice",key:"airframe",required:!0,group:e.DRONE,label:"airframe",choices:c.ALL.map(t=>({value:t.id,label:e.textKey(t.id)}))},{type:"number",key:"count",min:1,max:2e3,step:1,group:e.DRONE,effective:()=>1,label:"howMany"},{type:"set",key:"explains",group:e.DRONE,label:"standForTheShapes",hint:"theWholeGroupTakenForOne",visibleWhen:t=>e.flightOf(t).explainsEach===void 0,options:(t,l)=>{const s=l?.shapes??[],h=(e.flightOf(t).explains??[]).filter(n=>!s.some(i=>i.value===n));return[...s,...h.map(n=>({value:n,label:n}))]},empty:"noShape"},{type:"number",key:"seed",min:0,max:4294967295,step:1,group:e.DRONE,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFrom"},{type:"choice",key:"formation.kind",group:e.FLIGHT,label:"pattern",effective:t=>e.formationUnstated(t),choices:[{value:"single",label:"oneDrone"},{value:"cluster",label:"aLooseGroup"},{value:"line",label:"abreast"}],visibleWhen:t=>(o.read(t,"count")??1)>1},{type:"number",key:"formation.spacingM",min:.5,max:1e3,step:.5,unit:"m",group:e.FLIGHT,effective:t=>e.formationOf(t)==="line"?5:10,label:"spacing",hint:"betweenNeighbours",visibleWhen:t=>(o.read(t,"count")??1)>1&&e.formationOf(t)!=="single"},{type:"number",key:"headingDeg",min:0,max:360,step:1,unit:"°",group:e.FLIGHT,label:"noseTowards",hint:"emptyItFacesWhereItGoes",placeholder:"whereItGoes",visibleWhen:e.hovers},{type:"number",key:"wind.fromDeg",min:0,max:360,step:1,unit:"°",group:e.FLIGHT,label:"windFrom",effective:()=>0,hint:"whatItLeansInto"},{type:"number",key:"wind.speedMS",min:0,max:60,step:.1,unit:"m/s",group:e.FLIGHT,label:"windSpeed",effective:()=>0},{type:"boolean",key:"silent",group:e.FLIGHT,label:"silent",hint:"notEvenItsRotors"},{type:"number",key:"quieterDb",min:0,max:60,step:1,unit:"dB",group:e.FLIGHT,label:"quieter",hint:"thanItsClass",effective:()=>0,visibleWhen:t=>o.read(t,"silent")!==!0},{type:"colour",key:"bodyColor",group:e.LOOK,label:"hull",effective:t=>a.airframeOf(e.flightOf(t)).bodyColor},...e.LIGHT_NAMES.flatMap(t=>e.light(t))]};static angular(t){return typeof t.azimuthDeg=="number"}static WAYPOINT={kind:"drones-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=>!e.angular(t)},{type:"number",key:"altitudeM",min:-500,max:2e4,step:.1,unit:"m",required:!0,label:"height",hint:"aboveTheGroundOfThePlace",visibleWhen:t=>!e.angular(t)},{type:"number",key:"azimuthDeg",min:0,max:360,step:.1,unit:"°",required:!0,label:"azimuth",visibleWhen:t=>e.angular(t)},{type:"number",key:"altitudeDeg",min:-90,max:90,step:.1,unit:"°",required:!0,label:"elevation",visibleWhen:t=>e.angular(t)},{type:"number",key:"distanceM",min:0,max:1e5,step:1,unit:"m",required:!0,label:"distance",visibleWhen:t=>e.angular(t)},{type:"number",key:"eyeHeightM",min:0,max:1e4,step:.1,unit:"m",effective:()=>1.6,label:"eyeHeight",visibleWhen:t=>e.angular(t)}]};static waypointAt(t,l){const s=a.pathOf(t);if(s.length===0)return{t:Math.round(l),eastM:0,northM:0,altitudeM:0};const h=new b(s,a.airframeOf(t).hovers).at(l),n=i=>Math.round(i*10)/10;return{t:Math.round(l),eastM:n(h.eastM),northM:n(h.northM),altitudeM:n(h.upM)}}static publish(){f.publish(e.SET),f.publish(e.WAYPOINT)}}export{e as D};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as u,_ as h,
|
|
1
|
+
import{e as u,_ as h,bB as g,bC as f,bD as y,bE as b}from"./rr0-scene.mjs";import{P as p,S as T,a as w,c as A,b as E,E as v}from"./ParameterForm-CRC9iA-m.js";import{SkyLantern as o}from"./SkyLantern-C3BSxHtq.js";const x=u.catalog({en:()=>h(()=>import("./LanternParameterTexts_en-CcnGd8UH.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_en),fr:()=>h(()=>import("./LanternParameterTexts_fr-P2JwYOUy.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_fr),es:()=>h(()=>import("./LanternParameterTexts_es-CUTgNutZ.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_es),it:()=>h(()=>import("./LanternParameterTexts_it-CzNnIUrX.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_it)});class i{static RELEASE="letGo";static LANTERNS="lanterns";static AIR="air";static LANTERN="eachLantern";static instant(e,t,n){return{type:"number",key:e,min:-36e3,max:36e3,step:1,unit:"s",scale:.001,required:!0,label:t,hint:n,group:i.LANTERNS}}static wind(e,t,n,s){return[{type:"number",key:`${e}.towardDeg`,min:0,max:360,step:1,unit:"°",group:i.AIR,hint:s,label:t},{type:"number",key:`${e}.speedMS`,min:0,max:60,step:.1,unit:"m/s",group:i.AIR,label:n}]}static SET={kind:"lantern",title:"skyLanterns",parameters:[{type:"said",key:"title",label:"name",group:i.RELEASE},{type:"position",key:"site.eastM",secondKey:"site.northM",saidKey:"site.saidPosition",native:"local",step:1,rangeM:1e5,group:i.RELEASE,label:"whereTheyAreLetGo",hint:"whereTheyAreLetGoFrom"},{type:"number",key:"site.altitudeM",min:-1e3,max:5e3,step:.1,unit:"m",group:i.RELEASE,effective:()=>0,label:"heightAboveThePlaceSGround",hint:"aGardenOnAHillAbove"},{type:"number",key:"site.originElevationM",min:-500,max:6e3,step:1,unit:"m",group:i.RELEASE,effective:()=>0,label:"thePlaceSGroundAboveThe",hint:"whatSetsHowThinTheAir"},{type:"number",key:"group.count",min:1,max:200,step:1,required:!0,group:i.LANTERNS,label:"howMany"},i.instant("group.fromT","firstLetGoAt","secondsOfTheRecordingBeforeIts"),i.instant("group.untilT","lastLetGoAt","secondsOfTheRecordingTheOthers"),{type:"number",key:"group.radiusM",min:0,max:5e3,step:1,unit:"m",group:i.LANTERNS,effective:()=>20,label:"letGoWithin",hint:"aCrowdLetsThemGoA"},{type:"number",key:"group.burnS.min",min:10,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>480,label:"burnsAtLeast",hint:"howLongEachBurnsFromWhen"},{type:"number",key:"group.burnS.max",min:10,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>900,label:"burnsAtMost"},{type:"number",key:"group.insideExcessK.min",min:10,max:400,step:1,unit:"K",group:i.LANTERNS,effective:()=>125,label:"hotterThanTheAirAtLeast",hint:"howMuchHotterThanTheAir"},{type:"number",key:"group.insideExcessK.max",min:10,max:400,step:1,unit:"K",group:i.LANTERNS,effective:()=>175,label:"hotterThanTheAirAtMost"},{type:"number",key:"group.burnedS",min:0,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>0,label:"alreadyBurntWhenLetGo",hint:"forLanternsTheAccountOnlyHas"},{type:"number",key:"group.seed",min:0,max:4294967295,step:1,group:i.LANTERNS,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFromAnother"},{type:"set",key:"group.explains",group:i.LANTERNS,label:"standForTheShapes",options:(e,t)=>{const n=t?.shapes??[],s=(e.group?.explains??[]).filter(r=>!n.some(l=>l.value===r));return[...n,...s.map(r=>({value:r,label:r}))]},empty:"noShape"},...i.wind("wind","windAtTheGroundTowards","windAtTheGroundSpeed","whereItBlowsTowardsWhichIs"),...i.wind("windAloft","windAloftTowards","windAloftSpeed","theWindHigherUpBlendedWith"),{type:"number",key:"windAloft.atM",min:10,max:1e4,step:10,unit:"m",group:i.AIR,label:"windAloftAt",hint:"metresAboveWhereTheyAreLet"},{type:"number",key:"airTemperatureC",min:-60,max:50,step:.5,unit:"°C",group:i.AIR,effective:()=>10,label:"airTemperature",hint:"atTheGroundFallingBy6"},{type:"number",key:"turbulence.horizontalMS",min:0,max:10,step:.1,unit:"m/s",group:i.AIR,effective:()=>o.TURBULENCE.horizontalMS,label:"gustsAcross",hint:"howFarTheAirSSpeed"},{type:"number",key:"turbulence.verticalMS",min:0,max:10,step:.1,unit:"m/s",group:i.AIR,effective:()=>o.TURBULENCE.verticalMS,label:"gustsUpAndDown"},{type:"number",key:"turbulence.timescaleS",min:1,max:600,step:1,unit:"s",group:i.AIR,effective:()=>o.TURBULENCE.timescaleS,label:"aGustLasts"},{type:"number",key:"lantern.luminousIntensityCd",min:.1,max:1e3,step:.1,unit:"cd",group:i.LANTERN,effective:()=>o.COMMON.luminousIntensityCd,label:"light",hint:"itsFlameSLightThroughThe"},{type:"choice",key:"lantern.shape",group:i.LANTERN,effective:()=>o.COMMON.shape,label:"shape",choices:[{value:"classic",label:"roundAtTheMouthSquareAt"},{value:"balloon",label:"balloonLobedTop"}]},{type:"colour",key:"lantern.paperColor",group:i.LANTERN,fallback:o.COMMON.paperColor,label:"paperColour",hint:"whatItLooksLikeByDay"},{type:"colour",key:"lantern.color",group:i.LANTERN,fallback:o.COMMON.color,label:"flameLight",hint:"itsFlameSLightThroughWhite"},{type:"number",key:"lantern.envelopeVolumeM3",min:.01,max:10,step:.01,unit:"m³",group:i.LANTERN,effective:()=>o.COMMON.envelopeVolumeM3,label:"airItHolds"},{type:"number",key:"lantern.massKg",min:.005,max:5,step:.001,unit:"kg",group:i.LANTERN,effective:()=>o.COMMON.massKg,label:"weightWhenLetGo"}]};static publish(){p.publish(i.SET)}}const S=u.catalog({en:()=>h(()=>import("./LanternEditorMessages_en-DaT3UNfD.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_en),fr:()=>h(()=>import("./LanternEditorMessages_fr-9mByTFMG.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_fr),es:()=>h(()=>import("./LanternEditorMessages_es-TDV5lKeJ.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_es),it:()=>h(()=>import("./LanternEditorMessages_it-MRkJnDQp.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_it)});class c{constructor(e,t,n){this.container=e,this.host=t,T.attach(e,"lantern-editor-part",c.STYLE),this.language=n,p.of("lantern")||i.publish(),this.ready=this.setLanguage(n)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;language;shown=[];static STYLE=`
|
|
2
2
|
.lantern-editor-part, .lantern-editor-part #lantern-list, .lantern-editor-part .launch-fields { flex-basis: 100%; min-width: 0; }
|
|
3
3
|
.lantern-editor-part .launch-editor, .lantern-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
|
|
4
4
|
.lantern-editor-part [hidden] { display: none !important; }
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-DRsA8rtL.js","./rr0-scene.mjs"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{f as w,d as b,_ as v,M as g}from"./rr0-scene.mjs";class c{static STORAGE_KEY="ufoathome.modules";static FORMAT=1;static empty(){return{format:1,modules:[]}}static read(t=c.storage()){try{const e=t?.getItem(c.STORAGE_KEY);return e?c.parse(e):c.empty()}catch{return c.empty()}}static write(t,e=c.storage()){try{return e?(t.modules.length===0?e.removeItem(c.STORAGE_KEY):e.setItem(c.STORAGE_KEY,c.text(t)),!0):!1}catch{return!1}}static parse(t){const e=JSON.parse(t);if(e===null||typeof e!="object"||!Array.isArray(e.modules))throw new Error("not a UFO@home module list");if(typeof e.format=="number"&&e.format>c.FORMAT)throw new Error(`format ${e.format} is newer than ${c.FORMAT}`);const r=new Set,i=[];for(const s of e.modules)typeof s?.url!="string"||r.has(s.url)||(r.add(s.url),i.push({url:s.url,enabled:s.enabled!==!1}));return{format:1,modules:i}}static text(t){return JSON.stringify({format:c.FORMAT,modules:t.modules},null,2)+`
|
|
3
|
+
`}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class E{constructor(t,e){this.attribution=t,this.models=e}async entries(t){return t?this.models.filter(e=>[e.kind].flat().includes(t)):[...this.models]}async entry(t){return this.models.find(e=>e.id===t)}}class u{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return w(t,e,r=>u.tileUrl(this.tileUrlTemplate,r),this.fetchImpl)}static tileUrl(t,e){return t.replaceAll("{z}",String(e.z)).replaceAll("{x}",String(e.x)).replaceAll("{y}",String(e.y))}}class A extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class f{static FORMAT=1;static check(t,e){const r=o=>{throw new A(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const i=t;typeof i.format!="number"&&r('no "format"'),i.format>f.FORMAT&&r(`format ${i.format} is newer than ${f.FORMAT}, which this version reads`),(typeof i.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(i.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof i.name!="string"||i.name.trim()==="")&&r('no "name"'),i.script!==void 0&&typeof i.script!="string"&&r('"script" must be an address');const s=i.contributes??{};for(const o of["imagery","elevation"]){const l=s[o];l!==void 0&&(Array.isArray(l)||r(`"contributes.${o}" must be a list`),l.forEach((d,m)=>{for(const h of["id","name","credit","creditUrl","tiles"])(typeof d?.[h]!="string"||d[h]==="")&&r(`"contributes.${o}[${m}].${h}" is missing`);["{z}","{x}","{y}"].every(h=>d.tiles.includes(h))||r(`"contributes.${o}[${m}].tiles" must hold {z}, {x} and {y}`)}))}const a=s.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,l)=>{for(const d of["id","name","file"])(typeof o?.[d]!="string"||o[d]==="")&&r(`"contributes.models[${l}].${d}" is missing`);o.kind===void 0&&r(`"contributes.models[${l}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${l}].credit" is missing: a model is shown with its author and licence`)})),i}static contributions(t,e){const r=t.contributes??{},i={};if(r.imagery?.length&&(i.imagery=r.imagery.map(s=>({id:s.id,name:s.name,credit:s.credit,creditUrl:s.creditUrl,create:a=>new u({tileUrlTemplate:f.absoluteTemplate(s.tiles,e),attribution:s.credit,fetchImpl:a})}))),r.elevation?.length&&(i.elevation=r.elevation.map(s=>({id:s.id,name:s.name,credit:s.credit,creditUrl:s.creditUrl,create:a=>new b({tileUrlTemplate:f.absoluteTemplate(s.tiles,e),fetchImpl:a})}))),r.models?.length){const s=r.models.map(({file:o,...l})=>({...l,url:new URL(o,e).href})),a=t.credit??t.name;i.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,s)}]}return i}static module(t,e,r={}){const i=f.contributions(t,e);for(const[s,a]of Object.entries(r))Array.isArray(a)&&(i[s]=[...i[s]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:i}}static absoluteTemplate(t,e){const r=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(r,e).href.replaceAll("__Z__","{z}").replaceAll("__X__","{x}").replaceAll("__Y__","{y}")}}class T{fetchImpl;importImpl;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.importImpl=t.importImpl??(e=>import(e))}async load(t,e){const r=await this.fetchImpl(t);if(!r.ok)throw new Error(`${t}: HTTP ${r.status}`);const i=f.check(await r.json(),t),s=i.script!==void 0;let a={};if(s&&e.runScript){const o=new URL(i.script,t).href,l=await this.importImpl(o);if(typeof l.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:d}=await v(async()=>{const{MODULE_THREE:m}=await import("./ModuleThree-DRsA8rtL.js");return{MODULE_THREE:m}},__vite__mapDeps([0,1]),import.meta.url);a=await l.default({manifestUrl:t,three:d})??{}}return{url:t,manifest:i,module:f.module(i,t,a),hasScript:s,scriptRun:s&&e.runScript}}}class n{static KEY="rr0-module-consent";static originOf(t){try{return new URL(t,typeof location>"u"?void 0:location.href).origin}catch{return t}}static granted(t,e=n.storage()){const r=n.originOf(t);return typeof location<"u"&&r===location.origin?!0:n.list(e).includes(r)}static list(t=n.storage()){try{const e=JSON.parse(t?.getItem(n.KEY)??"[]");return Array.isArray(e)?e.filter(r=>typeof r=="string"):[]}catch{return[]}}static grant(t,e=n.storage()){const r=[...new Set([...n.list(e),...t.map(i=>n.originOf(i))])];try{e?.setItem(n.KEY,JSON.stringify(r))}catch{}}static revoke(t,e=n.storage()){const r=n.originOf(t);try{e?.setItem(n.KEY,JSON.stringify(n.list(e).filter(i=>i!==r)))}catch{}}static revokeUnused(t,e,r=n.storage()){const i=new Set(e.map(s=>n.originOf(s)));for(const s of t)i.has(n.originOf(s))||n.revoke(s,r)}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class y{constructor(t=new T,e){this.loader=t,this.storage=e}static shared=new y;changes=new EventTarget;states=new Map;config=c.empty();started;list(){const t=[...this.states.values()];return[...t.filter(e=>e.addedByPerson),...t.filter(e=>!e.addedByPerson)]}state(t){return this.states.get(t)}start(){return this.started??=this.applyConfig(c.read(this.storage)),this.started}async add(t){await this.start();const e=new URL(t,typeof location>"u"?void 0:location.href).href;return this.config.modules.some(r=>r.url===e)||(this.config={...this.config,modules:[...this.config.modules,{url:e,enabled:!0}]},this.save()),this.reload(e)}async remove(t){this.config={...this.config,modules:this.config.modules.filter(e=>e.url!==t)},this.save(),n.revokeUnused([t],[...this.config.modules.map(e=>e.url),...this.named]),await this.reload(t)}refresh(t){return this.reload(t)}async setEnabled(t,e){this.config={...this.config,modules:this.config.modules.map(r=>r.url===t?{...r,enabled:e}:r)},this.save(),await this.reload(t)}exportText(){return c.text(this.config)}async importText(t){const e=c.parse(t);await this.start();const r=this.config.modules.map(i=>i.url);this.config=e,this.save(),await Promise.all([...new Set([...r,...e.modules.map(i=>i.url)])].map(i=>this.reload(i)))}async require(t,e,r=!1){t?.length&&(await this.start(),await Promise.all(t.map(async i=>{let s;try{s=new URL(i,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const a=this.states.get(s),o=r&&!this.trusted.has(s);if(r&&this.trusted.add(s),this.named.add(s),a&&a.status!=="off"&&!(o&&a.loaded&&!a.loaded.scriptRun))return a.status==="loading"?this.pending.get(s):void 0;await this.reload(s)})))}named=new Set;trusted=new Set;pending=new Map;async applyConfig(t){this.config=t,await Promise.all(t.modules.map(e=>this.reload(e.url)))}reload(t){const e=this.reloadNow(t);return this.pending.set(t,e),e}async reloadNow(t){const e=this.config.modules.find(a=>a.url===t),r=this.states.get(t);r?.loaded&&g.uninstall(r.loaded.module.id);const i=e!==void 0,s=e?.enabled??!0;if(!i&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:i,enabled:s,status:"off"};if(i&&!s&&!this.named.has(t))return this.set({url:t,addedByPerson:i,enabled:s,status:"off"});this.set({url:t,addedByPerson:i,enabled:s,status:"loading"});try{const a=await this.loader.load(t,{runScript:i&&s&&n.granted(t)||this.trusted.has(t)});return g.install(a.module),this.set({url:t,addedByPerson:i,enabled:s,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:i,enabled:s,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){c.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as a,m as e,bJ as s,$ as t,a1 as r,ai as i,E as o,ad as n,Y as l,Z as b,ay as d,aj as m,ak as u,bK as M,s as B,a2 as y,o as G,h as S,aQ as h,aN as c,aR as f,G as p,b2 as L,F as x,bL as C,a3 as E,bM as P,bN as g,bO as D,C as T,a0 as A,B as F,t as N,bP as O,ah as V,a6 as j}from"./rr0-scene.mjs";const v={AdditiveBlending:j,BackSide:V,BoxGeometry:O,BufferAttribute:N,BufferGeometry:F,CanvasTexture:A,Color:T,ConeGeometry:D,CylinderGeometry:g,DataTexture:P,DoubleSide:E,Euler:C,Float32BufferAttribute:x,FrontSide:L,Group:p,Line:f,LineBasicMaterial:c,LineSegments:h,Matrix4:S,Mesh:G,MeshBasicMaterial:y,MeshStandardMaterial:B,NormalBlending:M,Object3D:u,PlaneGeometry:m,PointLight:d,Points:b,PointsMaterial:l,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{v as MODULE_THREE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BeamSystem as C}from"./BeamSystem-DtRwoKHP.js";import{L}from"./LaserBeam-AjgGxDIq.js";import{bx as N,by as M,bz as U,R as D}from"./rr0-scene.mjs";class E{static APERTURE_M=.6;static NEAR_STEP_M=10;static FAR_STEP_M=250;static STEP_SHARE=.05;static CLOUD_STEP_M=25;static SPENT=.003;beams=new C;placed;lineOwners=[];constructor(){this.beams.group.name="searchlights"}get object(){return this.beams.group}get drawnCount(){return this.beams.drawnCount}update(a,o,t){const c=[],r=[];this.lineOwners=[];const i=t.clouds;i?i.dim(this.beams.material):N.apply(this.beams.material,[]);const l=t.wind??{eastMS:0,northMS:0};for(const s of M.onAt(a,o)){const b=this.whereOf(s,t.reference),g=t.origin.x+b.eastM*t.eastScale,u=t.origin.z-b.northM,p=t.groundYAt(g,u)+(s.heightM??M.DEFAULT_HEIGHT_M),e=s.intensityCd??M.DEFAULT_INTENSITY_CD,m=s.divergenceDeg??M.DEFAULT_DIVERGENCE_DEG,S=m*Math.PI/180,w=M.fluxLm(e,m),n=U.ofTemperature(s.colourTemperatureK??M.DEFAULT_TEMPERATURE_K),T=C.white(n);M.aimsAt(s,o).forEach((A,_)=>{const d=M.axisOf(A),h={x:d.east,y:d.up,z:-d.north},R={windAlongMS:l.eastMS*d.east+l.northMS*d.north,windAcrossMS:l.eastMS*d.north-l.northMS*d.east},{points:y,throughBelow:I}=this.walk({x:g,y:p,z:u},h,S,w,o,t,R);if(c.push({id:s.id,points:y,spectrum:T}),this.lineOwners.push({id:s.id,beam:_}),i&&h.y>.02&&i.bottomY>p){const v=(i.bottomY-p)/h.y,P=t.air.transmittance(t.siteElevationM+p,t.siteElevationM+i.bottomY,v),x=e*t.relativeScale;r.push({x:g,y:p,z:u,axis:h,fwhmRad:S,rgb:[x*n[0]*P[0],x*n[1]*P[1],x*n[2]*P[2]],throughCloudsBelow:I})}})}this.beams.drawLines(c,t),t.lightClouds?.(r)}walk(a,o,t,c,r,i,l){const s=i.clouds,b=[],g=[],u=[],p=i.siteElevationM+a.y;let e=0,m=0;for(;;){const w=a.x+o.x*e,n=a.y+o.y*e,T=a.z+o.z*e,A=s!==void 0&&n>=s.bottomY&&n<=s.topY,_=Math.exp(-m),d=e>0?i.air.transmittance(p,i.siteElevationM+n,e)[1]:1;if(b.push({x:w,y:n,z:T,altitudeM:i.siteElevationM+n,widthM:E.APERTURE_M+t*e,powerW:c*d*_,haze:L.patchAt(e,r,{...l,patchiness:L.DEFAULT_PATCHINESS})}),g.push(n),u.push(_),e>=M.RANGE_M||n>=M.CEILING_M||_<E.SPENT)break;const h=A?E.CLOUD_STEP_M:Math.min(E.FAR_STEP_M,Math.max(E.NEAR_STEP_M,e*E.STEP_SHARE));if(s&&(A||n<s.bottomY&&n+o.y*h>s.bottomY)){const R=A?h:Math.max(0,(s.bottomY-n)/Math.max(o.y,1e-6));if(!A){e+=Math.max(1,R);continue}m+=s.extinctionAt(w+o.x*h/2,n+o.y*h/2,T+o.z*h/2)*h}e+=h}return{points:b,throughBelow:w=>{const n=g.findIndex(T=>T>=w);return n<0?u[u.length-1]:u[n]}}}whereOf(a,o){(!this.placed||this.placed.lat!==o.lat||this.placed.lng!==o.lng)&&(this.placed={...o,at:new Map});let t=this.placed.at.get(a);if(!t){const c=D.ecef({lat:o.lat,lng:o.lng,heightM:0}),r=D.ecef({lat:a.lat,lng:a.lng,heightM:0}),i=o.lat*Math.PI/180,l=o.lng*Math.PI/180,s=[r[0]-c[0],r[1]-c[1],r[2]-c[2]];t={eastM:-Math.sin(l)*s[0]+Math.cos(l)*s[1],northM:-Math.sin(i)*Math.cos(l)*s[0]-Math.sin(i)*Math.sin(l)*s[1]+Math.cos(i)*s[2]},this.placed.at.set(a,t)}return t}pick(a,o,t){const c=this.beams.pickAt(a,o,t.toleranceRad);if(c)return{id:c.id,distanceM:c.distanceM,detail:{beam:(this.lineOwners[c.line]?.beam??0)+1}}}dispose(){this.beams.dispose()}}export{E as SearchlightSystem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bA as w}from"./rr0-scene.mjs";class i{static COMMON={envelopeVolumeM3:.19,massKg:.065,fuelKg:.03,burnS:600,insideExcessK:150,dragAreaM2:.25,luminousIntensityCd:10,widthM:.6,heightM:1,color:"#ff8a24",shape:"classic",paperColor:"#ffffff"};static FLAME_CDM2=5e3;static TITLE={en:"Sky lantern",fr:"Lanterne céleste",es:"Farolillo volador",it:"Lanterna volante"};static FLICKER=.15;static INSIDE_SHARE=2;static PAPER_FULL_CDM2=i.COMMON.luminousIntensityCd/(Math.PI*i.COMMON.widthM/2*i.COMMON.heightM/2);static SAMPLE_MS=1e3;static STEP_S=.05;static COOLING_S=20;static GUST_GROUND_M=2;static TURBULENCE={horizontalMS:.8,verticalMS:.3,timescaleS:30};static G=9.81;static R_AIR=287.05;static LAPSE=.0065;static expand(t){const e=t?.lanterns;return!t||!e||e.length===0?t:{...t,bodies:[...t.bodies,...e.flatMap(s=>i.bodiesOf(s))]}}static bodiesOf(t,e=w.NONE){return i.releasesOf(t).map((s,r)=>i.lanternBody(t,s,r,e))}static releasesOf(t){const e=[...t.releases??[]],s=t.group;if(!s||!(s.count>0))return e;const r=i.randomFrom(s.seed??1),o=n=>n.min+(n.max-n.min)*r(),M=s.count>1?(s.untilT-s.fromT)/(s.count-1):0,c=s.radiusM??20;for(let n=0;n<s.count;n++){const d=s.fromT+M*n+(r()-.5)*M,u=c*Math.sqrt(r()),a=2*Math.PI*r();e.push({t:Math.round(Math.min(s.untilT,Math.max(s.fromT,d))),explains:s.explains,eastM:Math.round(u*Math.sin(a)*10)/10,northM:Math.round(u*Math.cos(a)*10)/10,burnedS:s.burnedS,seed:Math.floor(r()*4294967296),lantern:{burnS:Math.round(o(s.burnS??{min:480,max:900})),insideExcessK:Math.round(o(s.insideExcessK??{min:125,max:175}))}})}return e}static randomFrom(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}static typeOf(t,e){return{...i.COMMON,...t.lantern,...e.lantern}}static heatShare(t,e){if(e<0||e>=t.burnS)return 0;const s=t.burnS*.75;return e<=s?1:(t.burnS-e)/(t.burnS-s)}static windAt(t,e){const s=i.componentsOf(t.wind),r=t.windAloft;if(!r)return s;const o=i.componentsOf(r),M=Math.max(0,Math.min(1,e/r.atM));return{x:s.x+(o.x-s.x)*M,y:s.y+(o.y-s.y)*M}}static trajectory(t,e,s=i.SAMPLE_MS,r=w.NONE){const o=i.typeOf(t,e),M=t.site,c=M.altitudeM??0,n=Math.max(0,e.burnedS??0),d=M.originElevationM??0,u=(t.airTemperatureC??10)+273.15,a={x:M.eastM+(e.eastM??0),y:M.northM+(e.northM??0),z:e.altitudeM??c,vx:0,vy:0,vz:0,excessK:o.insideExcessK*i.heatShare(o,n)},h=i.STEP_S,y=Math.max(1,Math.round(s/1e3/h)),E=Math.ceil(Math.max(0,o.burnS-n)/h),I=[{t:e.t,x:a.x,y:a.y,z:a.z,light:i.heatShare(o,n),tiltDeg:0,tiltTowardDeg:0}],S=i.gusts(t.turbulence??i.TURBULENCE,i.seedOf(e),h);for(let x=1;x<=E;x++){const A=x*h,C=n+A,P=i.heatShare(o,C);a.excessK+=(o.insideExcessK*P-a.excessK)*Math.min(1,h/i.COOLING_S);const p=a.z-c,T=u-i.LAPSE*Math.max(0,p),b=101325*Math.exp(-(a.z+d)/8400),f=b/(i.R_AIR*T),D=b/(i.R_AIR*(T+a.excessK)),g=o.massKg-o.fuelKg*Math.min(1,C/o.burnS),F=(f-D)*o.envelopeVolumeM3*i.G,K=g+D*o.envelopeVolumeM3+.5*f*o.envelopeVolumeM3,N=i.windAt(t,p),z=S(),G=Math.max(0,Math.min(1,p/i.GUST_GROUND_M)),l={x:N.x+z.x,y:N.y+z.y,z:z.z*G},U=a.vx-l.x,B=a.vy-l.y,V=a.vz-l.z,m=.5*f*o.dragAreaM2*Math.hypot(U,B,V)/K;a.vx=(a.vx+m*h*l.x)/(1+m*h),a.vy=(a.vy+m*h*l.y)/(1+m*h),a.vz=(a.vz+m*h*l.z+(F-g*i.G)/K*h)/(1+m*h);const R=a.z<=c&&a.vz<=0;R&&(a.vx=0,a.vy=0,a.vz=0);const j=a.z;if(a.x+=a.vx*h,a.y+=a.vy*h,a.z=Math.max(c,a.z+a.vz*h),r.empty||i.keptOut(a,j,o.widthM/2,r),x%y===0||x===E){const v=l.x-a.vx,O=l.y-a.vy,q=.5*f*o.dragAreaM2*Math.hypot(v,O,l.z-a.vz)*Math.hypot(v,O);I.push({t:e.t+Math.round(A*1e3),x:a.x,y:a.y,z:a.z,light:P,tiltDeg:R?0:Math.atan2(q,g*i.G)*180/Math.PI,tiltTowardDeg:(Math.atan2(v,O)*180/Math.PI+360)%360})}}return I}static keptOut(t,e,s,r){const o=r.inside(t.x,t.y,t.z,s);if(!o)return;const M=o.box.topM;if(e>=M-1e-6||t.z>=M-1e-6){t.z<M&&(t.z=M,t.vz<0&&(t.vz=0));return}t.x+=o.nx*o.depthM,t.y+=o.ny*o.depthM;const c=t.vx*o.nx+t.vy*o.ny;c<0&&(t.vx-=c*o.nx,t.vy-=c*o.ny)}static seedOf(t){return t.seed!==void 0?t.seed:Math.round(t.t)*2654435761+Math.round((t.eastM??0)*100)*40503+Math.round((t.northM??0)*100)>>>0}static gusts(t,e,s){const r=i.randomFrom(e),o=()=>Math.sqrt(-2*Math.log(Math.max(1e-12,r())))*Math.cos(2*Math.PI*r()),M=t.timescaleS>0?Math.exp(-s/t.timescaleS):0,c=Math.sqrt(1-M*M),n={x:t.horizontalMS*o(),y:t.horizontalMS*o(),z:t.verticalMS*o()};return()=>(n.x=M*n.x+c*t.horizontalMS*o(),n.y=M*n.y+c*t.horizontalMS*o(),n.z=M*n.z+c*t.verticalMS*o(),n)}static componentsOf(t){if(!t)return{x:0,y:0};const e=t.towardDeg*Math.PI/180;return{x:Math.sin(e)*t.speedMS,y:Math.cos(e)*t.speedMS}}static lanternBody(t,e,s,r){const o=i.typeOf(t,e),M=o.luminousIntensityCd/(Math.PI*o.widthM/2*o.heightM/2),c=i.trajectory(t,e,i.SAMPLE_MS,r),n={widthM:o.widthM,lengthM:o.widthM,heightM:o.heightM},d=i.through(o.color,o.paperColor),u=c.map((a,h)=>({t:a.t,eastM:a.x,northM:a.y,altitudeM:a.z,...h===0?{sizeM:n,present:!0}:{},attitude:{headingDeg:Math.round(a.tiltTowardDeg),pitchDeg:-Math.round(a.tiltDeg*10)/10},appearance:{color:d,luminanceCdM2:M*a.light,...h===0?{albedo:.6,haloScale:1}:{}},lights:i.lightsOf(M*a.light)}));return u.push({t:c[c.length-1].t+1,present:!1}),{id:`${t.id}-lantern-${s+1}`,title:i.TITLE,explains:e.explains,model:{id:`ufoathome-sky-lantern-${o.shape}`},modelParameters:{paperColor:o.paperColor},flicker:i.FLICKER,altitudeFrom:{eastM:c[0].x,northM:c[0].y},track:u}}static lightsOf(t){return{paper:t,"paper-inside":t*i.INSIDE_SHARE,flame:t>0?i.FLAME_CDM2*t/i.PAPER_FULL_CDM2:0}}static through(t,e){const s=n=>[1,3,5].map(d=>parseInt(n.slice(d,d+2),16)/255),r=s(t),o=s(e),M=r.map((n,d)=>n*o[d]),c=Math.max(...r)/(Math.max(...M)||1);return"#"+M.map(n=>Math.round(Math.min(1,n*c)*255).toString(16).padStart(2,"0")).join("")}}export{i as SkyLantern};
|