@rr0/ufoathome 0.187.0 → 0.188.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed-scene/{BeamEditor-RO5pPyvd.js → BeamEditor-Cu6NLBA7.js} +1 -1
- package/dist-embed-scene/BirdEditor-C7dHFbA6.js +16 -0
- package/dist-embed-scene/BirdEditorMessages_en-CN1OJud9.js +1 -0
- package/dist-embed-scene/BirdEditorMessages_es-DDEnjRrz.js +1 -0
- package/dist-embed-scene/BirdEditorMessages_fr-hL72V8wm.js +1 -0
- package/dist-embed-scene/BirdEditorMessages_it-BmLyiPYp.js +1 -0
- package/dist-embed-scene/BirdFlock-DOjnGqqt.js +1 -0
- package/dist-embed-scene/BirdParameterTexts_en-C6FkYUww.js +1 -0
- package/dist-embed-scene/BirdParameterTexts_es-T8JyeNlI.js +1 -0
- package/dist-embed-scene/BirdParameterTexts_fr-BiTR-olu.js +1 -0
- package/dist-embed-scene/BirdParameterTexts_it-oQY4DX6B.js +1 -0
- package/dist-embed-scene/DecoyFlare-DUt1_LcW.js +1 -0
- package/dist-embed-scene/LanternEditor-D2mmscWP.js +24 -0
- package/dist-embed-scene/{LaunchEditor-C6-Ovt8V.js → LaunchEditor-fuFCnkV4.js} +1 -1
- package/dist-embed-scene/{ModuleSession-CwJVkcpn.js → ModuleSession-BAeWIbSU.js} +2 -2
- package/dist-embed-scene/{ModuleThree-BHjFJ_bC.js → ModuleThree-BLw9W-dX.js} +1 -1
- package/dist-embed-scene/{ParameterForm-BEITBqB0.js → ParameterForm-DP2rnIe1.js} +5 -5
- package/dist-embed-scene/{ReentryEditor-BAC0cNg_.js → ReentryEditor-BR99W168.js} +1 -1
- package/dist-embed-scene/SkyLantern-CIoY8lu4.js +1 -0
- package/dist-embed-scene/rr0-scene.mjs +367 -365
- package/dist-embed-scene/{sightingSchema-Dz2hCtcS.js → sightingSchema-Dk010uUD.js} +1 -1
- package/dist-embed-sighting/{BeamEditor-mDSavUYe.js → BeamEditor-B1s17C_I.js} +1 -1
- package/dist-embed-sighting/{BeamSystem-5WJWP1Ad.js → BeamSystem-DTraCa17.js} +1 -1
- package/dist-embed-sighting/BirdEditor-B__-UnpK.js +16 -0
- package/dist-embed-sighting/BirdEditorMessages_en-CN1OJud9.js +1 -0
- package/dist-embed-sighting/BirdEditorMessages_es-DDEnjRrz.js +1 -0
- package/dist-embed-sighting/BirdEditorMessages_fr-hL72V8wm.js +1 -0
- package/dist-embed-sighting/BirdEditorMessages_it-BmLyiPYp.js +1 -0
- package/dist-embed-sighting/BirdFlock-BbObIeXW.js +1 -0
- package/dist-embed-sighting/BirdParameterTexts_en-C6FkYUww.js +1 -0
- package/dist-embed-sighting/BirdParameterTexts_es-T8JyeNlI.js +1 -0
- package/dist-embed-sighting/BirdParameterTexts_fr-BiTR-olu.js +1 -0
- package/dist-embed-sighting/BirdParameterTexts_it-oQY4DX6B.js +1 -0
- package/dist-embed-sighting/{CaseReportExport-B9N0s2JX.js → CaseReportExport-DbGfu7DP.js} +1 -1
- package/dist-embed-sighting/DecoyFlare-DUt1_LcW.js +1 -0
- package/dist-embed-sighting/{GLTFLoader-BrNCkGT3.js → GLTFLoader-61IhKnLS.js} +1 -1
- package/{dist-embed-scene/LanternEditor-B6YtPdnz.js → dist-embed-sighting/LanternEditor-DIun2igg.js} +17 -2
- package/dist-embed-sighting/{LaserBeam-BuVmy_0s.js → LaserBeam-R7ItI6m-.js} +1 -1
- package/dist-embed-sighting/{LaunchEditor-DZ2V0dHc.js → LaunchEditor-CbQXmqaL.js} +1 -1
- package/dist-embed-sighting/{LaunchPlume-Quo7JzI8.js → LaunchPlume-uRfBKA0Y.js} +1 -1
- package/dist-embed-sighting/{LaunchSimulation-DZ4pDnrh.js → LaunchSimulation-DgsYJUKz.js} +1 -1
- package/dist-embed-sighting/{ModuleSession-xCJtw_IT.js → ModuleSession-CDsk4Atg.js} +2 -2
- package/dist-embed-sighting/ModuleThree-ZXC7TlGn.js +1 -0
- package/dist-embed-sighting/{ParameterForm-GKeZmZAL.js → ParameterForm-CkZQ1FlH.js} +11 -11
- package/dist-embed-sighting/{ReentryEditor-CnYz3Q7Q.js → ReentryEditor-DS0nJdBD.js} +2 -2
- package/dist-embed-sighting/{ReentrySimulation-BnYP6UwW.js → ReentrySimulation-BDnSb3zB.js} +1 -1
- package/dist-embed-sighting/SkyLantern--RJZtEMU.js +1 -0
- package/dist-embed-sighting/{TimelineTracks-BjJwL-DC.js → TimelineTracks-CvGxdpGb.js} +1 -1
- package/dist-embed-sighting/rr0-sighting.mjs +393 -391
- package/dist-embed-sighting/{sightingSchema-Dz2hCtcS.js → sightingSchema-Dk010uUD.js} +1 -1
- package/dist-embed-sighting-editor/{BallesterGuaspAssessor-ClwhCo4B.js → BallesterGuaspAssessor-DysBC5VV.js} +1 -1
- package/dist-embed-sighting-editor/{BeamEditor-vxinYAhV.js → BeamEditor-DQcdww5w.js} +1 -1
- package/dist-embed-sighting-editor/{BeamSystem-BMyP16H9.js → BeamSystem-d2pPAwht.js} +1 -1
- package/dist-embed-sighting-editor/BirdEditor-CsyXenUx.js +16 -0
- package/dist-embed-sighting-editor/BirdEditorMessages_en-CN1OJud9.js +1 -0
- package/dist-embed-sighting-editor/BirdEditorMessages_es-DDEnjRrz.js +1 -0
- package/dist-embed-sighting-editor/BirdEditorMessages_fr-hL72V8wm.js +1 -0
- package/dist-embed-sighting-editor/BirdEditorMessages_it-BmLyiPYp.js +1 -0
- package/dist-embed-sighting-editor/BirdFlock-CSw6ge15.js +1 -0
- package/dist-embed-sighting-editor/BirdParameterTexts_en-C6FkYUww.js +1 -0
- package/dist-embed-sighting-editor/BirdParameterTexts_es-T8JyeNlI.js +1 -0
- package/dist-embed-sighting-editor/BirdParameterTexts_fr-BiTR-olu.js +1 -0
- package/dist-embed-sighting-editor/BirdParameterTexts_it-oQY4DX6B.js +1 -0
- package/dist-embed-sighting-editor/{CaseReportExport-RjSpSvFT.js → CaseReportExport-Cc4W9Lim.js} +1 -1
- package/dist-embed-sighting-editor/{ContrailSystem-Y75rFfLJ.js → ContrailSystem-B4tXvQXF.js} +1 -1
- package/dist-embed-sighting-editor/{ControlPasses-D9A8NPRi.js → ControlPasses-Bo1RUT7-.js} +1 -1
- package/dist-embed-sighting-editor/{CoverageAssessor-CN-3cMS9.js → CoverageAssessor-tRNaBy0f.js} +1 -1
- package/dist-embed-sighting-editor/DecoyFlare-DUt1_LcW.js +1 -0
- package/dist-embed-sighting-editor/{GLTFLoader-GAmboVFk.js → GLTFLoader-B3aYB7cS.js} +1 -1
- package/dist-embed-sighting-editor/{HeadlightSystem-CDAFEIP8.js → HeadlightSystem-YWAhxcbe.js} +1 -1
- package/dist-embed-sighting-editor/{HynekAssessor-CKjvYcVe.js → HynekAssessor-IoHDLJUa.js} +1 -1
- package/dist-embed-sighting-editor/{InterviewEditorElement-Bq8INvJ8.js → InterviewEditorElement-ByXtSShu.js} +2 -2
- package/dist-embed-sighting-editor/LanternEditor-BYeK9kFU.js +24 -0
- package/dist-embed-sighting-editor/{LaserBeam-Ct6opxMs.js → LaserBeam-DOGz1dOz.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchEditor-BfggZKq5.js → LaunchEditor-0BCDGChg.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchPlume-CT777Ivp.js → LaunchPlume-DdX9-Rlw.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchSimulation-BSlF3Uq4.js → LaunchSimulation-BkdI45NE.js} +1 -1
- package/dist-embed-sighting-editor/ModuleConformance-C-KZlNCi.js +2 -0
- package/dist-embed-sighting-editor/{ModuleSession-BZ3xmE8Y.js → ModuleSession-B8U-T57q.js} +2 -2
- package/dist-embed-sighting-editor/ModuleThree-Ce5HhfdG.js +1 -0
- package/dist-embed-sighting-editor/{ModulesPanelElement-DuyRnhEj.js → ModulesPanelElement-BndWwnmX.js} +3 -3
- package/dist-embed-sighting-editor/{ModulesPanelMessages_en-t8LOPRx0.js → ModulesPanelMessages_en-DuwrY3Pm.js} +1 -1
- package/dist-embed-sighting-editor/{ModulesPanelMessages_es-DQFuXaUa.js → ModulesPanelMessages_es-Bq5X-XuT.js} +1 -1
- package/dist-embed-sighting-editor/{ModulesPanelMessages_fr-DZMwqDs0.js → ModulesPanelMessages_fr-B8cSDc6o.js} +1 -1
- package/dist-embed-sighting-editor/{ModulesPanelMessages_it-DfX1ObVK.js → ModulesPanelMessages_it-BdC626aJ.js} +1 -1
- package/dist-embed-sighting-editor/{NearestApproach-DkpM-8sl.js → NearestApproach-C48vgZ_Z.js} +1 -1
- package/dist-embed-sighting-editor/{PoherAssessor-C5-F9VMn.js → PoherAssessor-DRLbEZBS.js} +1 -1
- package/dist-embed-sighting-editor/{RailwaySystem-DG0WQQfc.js → RailwaySystem-SB2r1oRG.js} +1 -1
- package/dist-embed-sighting-editor/{ReentryEditor-BgpCftyc.js → ReentryEditor-JhfAVd18.js} +1 -1
- package/dist-embed-sighting-editor/{ReentrySimulation-BHjJYTL1.js → ReentrySimulation-DpIG9b07.js} +1 -1
- package/dist-embed-sighting-editor/{ReferenceSystem-DMmt1GR2.js → ReferenceSystem-DlpoDXXV.js} +1 -1
- package/dist-embed-sighting-editor/{SightingFileEditor-6F5VGGUe.js → SightingFileEditor-Wx9tn4bw.js} +1 -1
- package/dist-embed-sighting-editor/SkyLantern-B0V58mct.js +1 -0
- package/dist-embed-sighting-editor/{TraceSystem-eEbqZeYs.js → TraceSystem-Cz4lbziC.js} +2 -2
- package/dist-embed-sighting-editor/{WaterSystem-CbmcniYb.js → WaterSystem-C39XDvNY.js} +2 -2
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +480 -476
- package/dist-embed-sighting-editor/{sightingSchema-Dz2hCtcS.js → sightingSchema-Dk010uUD.js} +1 -1
- package/package.json +1 -1
- package/dist-embed-sighting/LanternEditor-Czo3tup9.js +0 -9
- package/dist-embed-sighting/ModuleThree-D1QGUDll.js +0 -1
- package/dist-embed-sighting-editor/LanternEditor-CKKUIplQ.js +0 -9
- package/dist-embed-sighting-editor/ModuleConformance-Qm-EHVoc.js +0 -2
- package/dist-embed-sighting-editor/ModuleThree-BFSbIe18.js +0 -1
package/{dist-embed-scene/LanternEditor-B6YtPdnz.js → dist-embed-sighting/LanternEditor-DIun2igg.js}
RENAMED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as u,_ as h,aI as p,aJ as g,aK as f,aL as y,aM as T,aN as b}from"./rr0-sighting.mjs";import{S as w,P as A,a as E,E as v}from"./ParameterForm-CkZQ1FlH.js";import{SkyLantern as o}from"./SkyLantern--RJZtEMU.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,w.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
|
+
.lantern-editor-part, .lantern-editor-part #lantern-list, .lantern-editor-part .launch-fields { flex-basis: 100%; min-width: 0; }
|
|
3
|
+
.lantern-editor-part .launch-editor, .lantern-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
|
|
4
|
+
.lantern-editor-part [hidden] { display: none !important; }
|
|
5
|
+
.lantern-editor-part .launch-intro { flex-basis: 100%; margin: 0; }
|
|
6
|
+
.lantern-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20em), 1fr)); gap: 12px; align-items: start; }
|
|
7
|
+
.lantern-editor-part .parameter-group { min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
|
|
8
|
+
.lantern-editor-part .parameter-group > label { display: flex; flex-wrap: wrap; align-items: center; gap: .35em .5em; min-width: 0; max-width: 100%; }
|
|
9
|
+
.lantern-editor-part .parameter-group > label > span { flex: 1 1 11em; min-width: 0; overflow-wrap: anywhere; }
|
|
10
|
+
.lantern-editor-part .parameter-row { width: 100%; min-width: 0; }
|
|
11
|
+
.lantern-editor-part rr0-input-position { min-width: 0; max-width: 100%; }
|
|
12
|
+
.lantern-editor-part rr0-input-position .position-from { flex-wrap: wrap; white-space: normal; min-width: 0; max-width: 100%; }
|
|
13
|
+
.lantern-editor-part input, .lantern-editor-part select { min-width: 0; max-width: 100%; box-sizing: border-box; }
|
|
14
|
+
.lantern-editor-part input[type="text"] { width: 12em; }
|
|
15
|
+
.lantern-editor-part input.parameter-derived::placeholder { opacity: .65; }
|
|
16
|
+
`;async setLanguage(e){const t=++this.languageToken;this.language=e;const[n,s]=await Promise.all([S.load(e),x.load(e)]);t===this.languageToken&&(this.messages=n,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.launches;this.shown=[...e],e.some(r=>r.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(r=>({id:r.id,label:this.labelOf(r)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("lantern-fields").hidden=t===void 0,!t)return;const n=t.releases?.length??0,s=this.element("lantern-releases");s.hidden=n===0,s.textContent=this.messages.releasesNote.replace("{n}",String(n)),this.form??=new A(this.element("lantern-parameters"),this.language,"lantern.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(i.SET),new E(()=>this.current,r=>this.editLaunch(l=>r(l)),()=>({shapes:this.host.shapes().map(r=>({value:r.id,label:r.label}))}),this.host.positionPlace?.()),()=>this.written())}refresh(){if(!this.messages)return;this.syncAddState();const e=this.launches;e.length===this.shown.length&&e.every((t,n)=>t.id===this.shown[n].id)||this.sync()}syncAddState(){const e=this.siteOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}resolved(e){return g.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
2
17
|
<p class="launch-intro">${e.intro}</p>
|
|
3
18
|
<div id="lantern-list"></div>
|
|
4
19
|
<div id="lantern-fields" class="launch-fields">
|
|
@@ -6,4 +21,4 @@ import{c as d,_ as l,bl as o,bm as m,bn as g,bo as f}from"./rr0-scene.mjs";impor
|
|
|
6
21
|
<p id="lantern-releases" class="launch-intro" hidden></p>
|
|
7
22
|
<p class="launch-intro">${e.derivedNote}</p>
|
|
8
23
|
</div>
|
|
9
|
-
</div>`,this.list=new
|
|
24
|
+
</div>`,this.list=new v({header:this.element("lantern-list"),body:this.element("lantern-fields"),ids:{list:"lantern-select",remove:"lantern-delete",add:"lantern-add"},onSelect:t=>{this.currentId=t,this.sync()},onAdd:()=>this.addLaunch(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.launch,remove:e.deleteLaunch,add:e.addLaunch,empty:e.none})}written(){const e=this.current;e&&this.list?.rename(e.id,this.labelOf(e))}editLaunch(e){const t=this.current;if(!t)return;const n=structuredClone(t);e(n),this.writeLaunches(this.launches.map(s=>s===t?n:s)),this.host.changed()}siteOfNew(){const e=this.host.sighting(),t=e.event?.place?.[0];if(t?.lat===void 0||t.lng===void 0)return;const n=e.observerTrack?.getInterpolatedPoseAt(0),s=111320,r=n?.lng!==void 0?(n.lng-t.lng)*s*Math.cos(t.lat*Math.PI/180):0,l=n?.lat!==void 0?(n.lat-t.lat)*s:0;return{eastM:Math.round(r),northM:Math.round(l)}}addLaunch(){const e=this.siteOfNew();if(!e)return;let t=this.launches.length+1;for(;this.launches.some(m=>m.id===`lanterns-${t}`);)t++;const n=this.host.sighting(),s=f(n.event)??this.host.duration?.()??n.timeline?.duration,r=s!==void 0&&Number.isFinite(s)&&s>0?Math.min(s,12e4):12e4,l=y(n,0),d={id:`lanterns-${t}`,site:e,group:{count:12,fromT:0,untilT:r,seed:t},wind:{towardDeg:Math.round((l.windDirectionDeg+180)%360),speedMS:Math.round(l.windSpeed*10)/10}};this.writeLaunches([...this.launches,d]),this.currentId=d.id,this.host.changed(),this.sync()}deleteCurrent(){const e=this.current;e&&(this.currentId=void 0,this.writeLaunches(this.launches.filter(t=>t!==e)),this.host.changed(),this.sync())}writeLaunches(e){const t=this.host.sighting(),n={...t.interpretation??{bodies:[]},lanterns:e.length>0?e:void 0};n.lanterns===void 0&&delete n.lanterns;const s=T.saysNothing(n,b.kinds());t.interpretation=s?void 0:n}labelOf(e){const t=this.host.said().read(e.title);return t?`${t} (${e.id})`:e.id}get launches(){return this.host.sighting().interpretation?.lanterns??[]}element(e){return this.container.querySelector(`#${e}`)}}export{c as LanternEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as O,
|
|
1
|
+
import{R as O,bu as D,bv as y}from"./rr0-sighting.mjs";class l{static DEFAULT_DIVERGENCE_MRAD=.1;static DEFAULT_APERTURE_M=.01;static AEROSOL_SINGLE_SCATTERING_ALBEDO=.9;static AEROSOL_ASYMMETRY=.7;static DEFAULT_PATCHINESS=.35;static PATCH_M=120;static STEP_M=25;static MAX_SAMPLES=2e3;static viewsAt(n,o,t,s){return l.onAt(n,o).map(c=>l.viewOf(c,t,s))}static viewOf(n,o,t){return{id:n.id,wavelengthNm:n.wavelengthNm,patchiness:n.patchiness??l.DEFAULT_PATCHINESS,samples:l.samplesOf(n,o,t)}}static onAt(n,o){return n.filter(t=>(t.fromT===void 0||o>=t.fromT)&&(t.untilT===void 0||o<=t.untilT)).map(t=>l.stateAt(t,o)).filter(t=>t.path.length>=2)}static stateAt(n,o){if(!n.light?.length&&!n.moves?.length)return n;const t={...n};if(n.light?.length){const s=l.joined(n.light.filter(e=>e.wavelengthNm!==void 0),o,e=>e.wavelengthNm),c=l.joined(n.light.filter(e=>e.powerW!==void 0),o,e=>e.powerW);s!==void 0&&(t.wavelengthNm=s),c!==void 0&&(t.powerW=c)}return n.moves?.length&&(t.path=l.pathAt(n.moves,o)),t}static joined(n,o,t){if(n.length===0)return;const s=[...n].sort((a,i)=>a.t-i.t);if(o<=s[0].t)return t(s[0]);const c=s[s.length-1];if(o>=c.t)return t(c);const e=s.findIndex(a=>a.t>o),r=s[e-1],h=s[e],M=(o-r.t)/(h.t-r.t);return t(r)+(t(h)-t(r))*M}static pathAt(n,o){const t=[...n].sort((a,i)=>a.t-i.t);if(o<=t[0].t)return t[0].path;const s=t[t.length-1];if(o>=s.t)return s.path;const c=t.findIndex(a=>a.t>o),e=t[c-1],r=t[c];if(e.path.length!==r.path.length)return e.path;const h=(o-e.t)/(r.t-e.t),M=(a,i)=>a+(i-a)*h;return e.path.map((a,i)=>({lat:M(a.lat,r.path[i].lat),lng:M(a.lng,r.path[i].lng),altitudeM:M(a.altitudeM,r.path[i].altitudeM)}))}static patchAt(n,o,t){if(t.patchiness<=0)return 1;const s=o/1e3,c=(r,h)=>{const M=(n-t.windAlongMS*s)/r,a=(Math.abs(t.windAcrossMS)+.3)*s/r+h;return l.valueNoise(M,a)},e=(2*c(l.PATCH_M,0)+c(l.PATCH_M/3,17.3))/3;return 1+t.patchiness*(2*e-1)}static valueNoise(n,o){const t=Math.floor(n),s=Math.floor(o),c=n-t,e=o-s,r=i=>i*i*(3-2*i),h=(i,g)=>{const v=Math.sin(i*127.1+g*311.7)*43758.5453;return v-Math.floor(v)},M=h(t,s)+(h(t+1,s)-h(t,s))*r(c),a=h(t,s+1)+(h(t+1,s+1)-h(t,s+1))*r(c);return M+(a-M)*r(e)}static samplesOf(n,o,t){const s=O.ecef({lat:o.lat,lng:o.lng,heightM:0}),c=o.lat*Math.PI/180,e=o.lng*Math.PI/180,r=u=>{const p=u[0]-s[0],A=u[1]-s[1],f=u[2]-s[2];return[-Math.sin(e)*p+Math.cos(e)*A,-Math.sin(c)*Math.cos(e)*p-Math.sin(c)*Math.sin(e)*A+Math.cos(c)*f,Math.cos(c)*Math.cos(e)*p+Math.cos(c)*Math.sin(e)*A+Math.sin(c)*f]},h=(n.divergenceMrad??l.DEFAULT_DIVERGENCE_MRAD)/1e3,M=n.apertureM??l.DEFAULT_APERTURE_M,a=[];let i=0,g=n.powerW,v=0;for(let u=0;u+1<n.path.length;u++){const p=n.path[u],A=n.path[u+1],f=O.ecef({lat:p.lat,lng:p.lng,heightM:p.altitudeM}),w=O.ecef({lat:A.lat,lng:A.lng,heightM:A.altitudeM}),d=Math.hypot(w[0]-f[0],w[1]-f[1],w[2]-f[2]),[C,S]=(()=>{const[E,R]=r(f),[N,T]=r(w);return[(N-E)/(d||1),(T-R)/(d||1)]})(),I=Math.max(1,Math.min(l.MAX_SAMPLES,Math.ceil(d/l.STEP_M)));for(let E=u===0?0:1;E<=I;E++){const R=E/I,N=[0,1,2].map(P=>f[P]+(w[P]-f[P])*R),T=R*d,x=p.altitudeM+(A.altitudeM-p.altitudeM)*R+l.bulgeM(T,d);if(E>0){const P=a[a.length-1],W=T+i-P.fromSourceM,H=l.extinctionAt(t,n.wavelengthNm,(P.altitudeM+x)/2);v+=H*W,g=n.powerW*Math.exp(-v)}const[U,F,G]=r(N);a.push({eastM:U,northM:F,upM:G,altitudeM:x,fromSourceM:i+T,dirEast:C,dirNorth:S,widthM:M+h*(i+T),powerW:g})}i+=d}return a}static bulgeM(n,o){return n*(o-n)/(2*6371e3)}static extinctionAt(n,o,t){const{rayleighPerM:s,aerosolPerM:c}=l.coefficientsAt(n,o,t);return s+c}static coefficientsAt(n,o,t){const s=D.rayleighAt(o)*D.rayleighDensity(t),c=n.aerosol[1]*(o/550)**-1.3*D.aerosolDensity(t);return{rayleighPerM:s,aerosolPerM:c}}static phasedScattering(n,o){const t=3/(16*Math.PI)*(1+o*o),s=l.AEROSOL_ASYMMETRY,c=(1-s*s)/(4*Math.PI*(1+s*s-2*s*o)**1.5);return n.rayleighPerM*t+n.aerosolPerM*l.AEROSOL_SINGLE_SCATTERING_ALBEDO*c}static efficacy(n){return 683*Math.max(0,y.colourMatching(n)[1])}static colourOf(n){const[o,t,s]=y.colourMatching(n);if(t<=0)return[0,0,0];const c=y.linearSrgbOf([o/t,1,s/t]).map(r=>Math.max(0,r)),e=.2126*c[0]+.7152*c[1]+.0722*c[2];return c.map(r=>r/e)}static luminanceCdM2(n,o,t,s,c){return l.efficacy(o)*n*t/(s*Math.max(c,.001))}}export{l as L};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as y,_ as d,aI as b,aJ as E,aN as g,bv as w}from"./rr0-sighting.mjs";import{S as j,P as x,E as k,a as v}from"./ParameterForm-GKeZmZAL.js";import{L as T}from"./LaunchPlume-Quo7JzI8.js";import{T as I}from"./TimelineTracks-BjJwL-DC.js";const S=y.catalog({en:()=>d(()=>import("./LaunchParameterTexts_en-DvrCwbDM.js"),[],import.meta.url).then(r=>r.launchParameterTexts_en),fr:()=>d(()=>import("./LaunchParameterTexts_fr-Bh_1zVzy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_fr),es:()=>d(()=>import("./LaunchParameterTexts_es--RUAegVp.js"),[],import.meta.url).then(r=>r.launchParameterTexts_es),it:()=>d(()=>import("./LaunchParameterTexts_it-CWDx9nJy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_it)});class n{static plumeValue(e){return t=>T.plumeOf(t)[e]}static plume(e,t){return{type:"number",key:`plume.${e}`,effective:n.plumeValue(e),...t}}static burn(e,t){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t.label,hint:t.hint,group:"engine",effective:i=>t.ends(i.track??[])?.t}}static placeAt(e,t){if(e.length===0)return{t,lat:0,lng:0,altitudeKm:0};if(e.length===1)return{t,lat:e[0].lat,lng:e[0].lng,altitudeKm:e[0].altitudeKm};let i=0;for(;i<e.length-2&&e[i+1].t<t;)i++;const s=e[i],a=e[i+1],l=a.t===s.t?0:(t-s.t)/(a.t-s.t),o=(m,h)=>m+(h-m)*l;return{t,lat:o(s.lat,a.lat),lng:o(s.lng,a.lng),altitudeKm:Math.max(0,o(s.altitudeKm,a.altitudeKm))}}static instantsOf(e){return[...e.track.map(t=>t.t),...[e.burnFromT,e.burnUntilT].filter(t=>t!==void 0),...(e.jets??[]).flatMap(t=>[t.fromT,t.untilT])]}static SET={kind:"launch",title:"launch",parameters:[{type:"said",key:"title",label:"name",group:"vehicle"},{type:"text",key:"vehicle.mission",label:"mission",placeholder:"Starlink Group 10-49",group:"vehicle"},{type:"number",key:"vehicle.engine.thrustKN",min:1,max:1e5,step:1,unit:"kN",label:"thrustVacuum",hint:"merlinVacuum934Rl10110A",group:"engine"},{type:"number",key:"vehicle.engine.specificImpulseS",min:100,max:500,step:1,unit:"s",label:"specificImpulseVacuum",hint:"times981MSIt",group:"engine"},{type:"choice",key:"vehicle.engine.propellant",label:"propellant",hint:"whatTheExhaustIsMadeOf",choices:[{value:"rp1-lox",label:"keroseneAndOxygen"},{value:"methane-lox",label:"methaneAndOxygen"},{value:"hydrogen-lox",label:"hydrogenAndOxygen"},{value:"hypergolic",label:"hypergolic"},{value:"solid",label:"solid"}],group:"engine"},n.burn("burnFromT",{label:"engineStart",hint:"whenTheEngineStartedInSeconds",ends:e=>e[0]}),n.burn("burnUntilT",{label:"engineCutOff",hint:"whenTheEngineStoppedInSeconds",ends:e=>e[e.length-1]}),n.plume("exhaustKgPerS",{min:.1,max:1e5,step:.1,unit:"kg/s",label:"exhaustFlow",hint:"howMuchExhaustLeavesTheEngine",group:"plume"}),n.plume("condensedShare",{min:0,max:1,step:.01,label:"shareThatScatters",hint:"theShareOfTheExhaustThat",group:"plume"}),n.plume("particleRadiusUm",{min:.05,max:5,step:.05,unit:"µm",label:"particleRadius",group:"plume"}),n.plume("lifetimeS",{min:10,max:3600,step:10,unit:"s",label:"trailLifetime",hint:"howLongTheNarrowTrailLasts",group:"plume"}),n.plume("expansionKmPerS",{min:0,max:5,step:.01,unit:"km/s",label:"trailSpreading",group:"plume"}),n.plume("initialRadiusKm",{min:0,max:50,step:.1,unit:"km",label:"radiusAtRelease",group:"plume"}),n.plume("collarShare",{min:0,max:1,step:.01,label:"shareInTheCollar",hint:"theCollarIsTheExhaustJust",group:"collar"}),n.plume("collarExpansionKmPerS",{min:0,max:10,step:.05,unit:"km/s",label:"collarSpreading",hint:"howFastTheCollarWidensThree",group:"collar"}),n.plume("collarLifetimeS",{min:1,max:300,step:1,unit:"s",label:"collarLifetime",group:"collar"})]};static PLACE={kind:"launch-place",title:"placeOfThePath",parameters:[{type:"number",key:"t",min:-3600,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecordingNegativeBefore"},{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:1,label:"position"},{type:"number",key:"altitudeKm",min:0,max:2e3,step:.1,unit:"km",required:!0,label:"altitude"}]};static jetContext(e,t){return{launch:e,index:t}}static jetValue(e){return(t,i)=>{const{launch:s,index:a}=i??{};return s?e(T.releaseOf(s,t,a)):void 0}}static JET_GROUP="jet";static JET={kind:"launch-jet",title:"jet",parameters:[{type:"choice",key:"kind",required:!0,label:"what",choices:[{value:"burn",label:"engineBurn"},{value:"vent",label:"propellantVented"}],group:n.JET_GROUP},{type:"number",key:"fromT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"from",hint:"secondsOfTheRecordingNegativeBefore2",group:n.JET_GROUP},{type:"number",key:"untilT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"until",group:n.JET_GROUP},{type:"number",key:"angleDeg",min:0,max:180,step:1,unit:"°",effective:()=>0,label:"directionFromAft",hint:"t0StraightBackAlongTheStage",group:n.JET_GROUP},{type:"number",key:"azimuthDeg",min:-360,max:360,step:1,unit:"°",effective:()=>0,label:"side",hint:"roundTheLineOfMotionWhich",group:n.JET_GROUP},{type:"number",key:"spinPeriodS",min:-3600,max:3600,step:.1,unit:"s",label:"spinPeriod",hint:"howLongTheStageTakesTo",group:n.JET_GROUP},{type:"number",key:"speedKmPerS",min:0,max:10,step:.01,unit:"km/s",effective:n.jetValue(e=>e.speedKmPerS),label:"speed",hint:"howFastItLeavesTheStage",group:n.JET_GROUP},{type:"number",key:"massKgPerS",min:0,max:1e5,step:.1,unit:"kg/s",effective:n.jetValue(e=>e.massKgPerS),label:"flow",group:n.JET_GROUP},{type:"number",key:"condensedShare",min:0,max:1,step:.01,effective:n.jetValue(e=>e.condensedShare),label:"shareThatScatters",group:n.JET_GROUP},{type:"number",key:"particleRadiusUm",min:.05,max:5,step:.05,unit:"µm",effective:n.jetValue(e=>e.particleRadiusUm),label:"particleRadius",group:n.JET_GROUP},{type:"number",key:"expansionKmPerS",min:0,max:5,step:.01,unit:"km/s",effective:n.jetValue(e=>e.populations[0].expansionKmPerS),label:"spreading",hint:"howFastEachPuffOfIt",group:n.JET_GROUP},{type:"number",key:"initialRadiusKm",min:0,max:50,step:.1,unit:"km",effective:n.jetValue(e=>e.initialRadiusKm),label:"radiusAtRelease",group:n.JET_GROUP},{type:"number",key:"lifetimeS",min:1,max:7200,step:1,unit:"s",effective:n.jetValue(e=>e.populations[0].lifetimeS),label:"lifetime",group:n.JET_GROUP}]};static publish(){b.publish(n.SET)}}const O=y.catalog({en:()=>d(()=>import("./LaunchEditorMessages_en-BnzNAYW9.js"),[],import.meta.url).then(r=>r.launchEditorMessages_en),fr:()=>d(()=>import("./LaunchEditorMessages_fr-Ds_VOB8c.js"),[],import.meta.url).then(r=>r.launchEditorMessages_fr),es:()=>d(()=>import("./LaunchEditorMessages_es-BE0dEl7I.js"),[],import.meta.url).then(r=>r.launchEditorMessages_es),it:()=>d(()=>import("./LaunchEditorMessages_it-DPQaR8HY.js"),[],import.meta.url).then(r=>r.launchEditorMessages_it)});class u{constructor(e,t,i){this.container=e,this.host=t,j.attach(e,"launch-editor-part",u.STYLE),this.language=i,b.of("launch")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="path";placeForm;placeIndex=0;jetForm;jetIndex=0;language;shown=[];static STYLE='.launch-editor-part { flex-basis: 100%; min-width: 0; } .launch-editor-part #launch-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .launch-editor-part .launch-path > .icon-btn { align-self: flex-end; } .launch-editor-part #launch-list, .launch-editor-part #launch-places { flex-basis: 100%; min-width: 0; } .launch-editor-part .launch-editor, .launch-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .launch-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .launch-editor-part [hidden] { display: none !important; } .launch-editor-part select { min-width: 0; width: 100%; } .launch-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-track { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .launch-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; } .launch-editor-part input, .launch-editor-part select { max-width: 100%; box-sizing: border-box; } .launch-editor-part input[type="text"] { width: 12em; } .launch-editor-part #launch-title { width: 18em; } .launch-editor-part label { min-width: 0; max-width: 100%; } .launch-editor-part input.parameter-derived::placeholder { opacity: .65; } .launch-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; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([O.load(e),S.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.launches;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("launch-fields").hidden=t===void 0,!t)return;this.syncPlace(!0),this.syncJet(!0);const i=this.resolved(b.of("launch"));this.form??=new x(this.element("launch-parameters"),this.language,"",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i,t,()=>this.written())}refresh(){if(!this.messages)return;this.syncAddState();const e=this.launches;if(e.length===this.shown.length&&e.every((t,i)=>t===this.shown[i])){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.startOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="path",this.placeIndex=0,this.jetIndex=0,this.sync())}resolved(e){return E.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
1
|
+
import{e as y,_ as d,aI as b,aJ as E,aO as g,bw as w}from"./rr0-sighting.mjs";import{S as j,P as x,E as k,a as v}from"./ParameterForm-CkZQ1FlH.js";import{L as T}from"./LaunchPlume-uRfBKA0Y.js";import{T as I}from"./TimelineTracks-CvGxdpGb.js";const S=y.catalog({en:()=>d(()=>import("./LaunchParameterTexts_en-DvrCwbDM.js"),[],import.meta.url).then(r=>r.launchParameterTexts_en),fr:()=>d(()=>import("./LaunchParameterTexts_fr-Bh_1zVzy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_fr),es:()=>d(()=>import("./LaunchParameterTexts_es--RUAegVp.js"),[],import.meta.url).then(r=>r.launchParameterTexts_es),it:()=>d(()=>import("./LaunchParameterTexts_it-CWDx9nJy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_it)});class n{static plumeValue(e){return t=>T.plumeOf(t)[e]}static plume(e,t){return{type:"number",key:`plume.${e}`,effective:n.plumeValue(e),...t}}static burn(e,t){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t.label,hint:t.hint,group:"engine",effective:i=>t.ends(i.track??[])?.t}}static placeAt(e,t){if(e.length===0)return{t,lat:0,lng:0,altitudeKm:0};if(e.length===1)return{t,lat:e[0].lat,lng:e[0].lng,altitudeKm:e[0].altitudeKm};let i=0;for(;i<e.length-2&&e[i+1].t<t;)i++;const s=e[i],a=e[i+1],l=a.t===s.t?0:(t-s.t)/(a.t-s.t),o=(m,h)=>m+(h-m)*l;return{t,lat:o(s.lat,a.lat),lng:o(s.lng,a.lng),altitudeKm:Math.max(0,o(s.altitudeKm,a.altitudeKm))}}static instantsOf(e){return[...e.track.map(t=>t.t),...[e.burnFromT,e.burnUntilT].filter(t=>t!==void 0),...(e.jets??[]).flatMap(t=>[t.fromT,t.untilT])]}static SET={kind:"launch",title:"launch",parameters:[{type:"said",key:"title",label:"name",group:"vehicle"},{type:"text",key:"vehicle.mission",label:"mission",placeholder:"Starlink Group 10-49",group:"vehicle"},{type:"number",key:"vehicle.engine.thrustKN",min:1,max:1e5,step:1,unit:"kN",label:"thrustVacuum",hint:"merlinVacuum934Rl10110A",group:"engine"},{type:"number",key:"vehicle.engine.specificImpulseS",min:100,max:500,step:1,unit:"s",label:"specificImpulseVacuum",hint:"times981MSIt",group:"engine"},{type:"choice",key:"vehicle.engine.propellant",label:"propellant",hint:"whatTheExhaustIsMadeOf",choices:[{value:"rp1-lox",label:"keroseneAndOxygen"},{value:"methane-lox",label:"methaneAndOxygen"},{value:"hydrogen-lox",label:"hydrogenAndOxygen"},{value:"hypergolic",label:"hypergolic"},{value:"solid",label:"solid"}],group:"engine"},n.burn("burnFromT",{label:"engineStart",hint:"whenTheEngineStartedInSeconds",ends:e=>e[0]}),n.burn("burnUntilT",{label:"engineCutOff",hint:"whenTheEngineStoppedInSeconds",ends:e=>e[e.length-1]}),n.plume("exhaustKgPerS",{min:.1,max:1e5,step:.1,unit:"kg/s",label:"exhaustFlow",hint:"howMuchExhaustLeavesTheEngine",group:"plume"}),n.plume("condensedShare",{min:0,max:1,step:.01,label:"shareThatScatters",hint:"theShareOfTheExhaustThat",group:"plume"}),n.plume("particleRadiusUm",{min:.05,max:5,step:.05,unit:"µm",label:"particleRadius",group:"plume"}),n.plume("lifetimeS",{min:10,max:3600,step:10,unit:"s",label:"trailLifetime",hint:"howLongTheNarrowTrailLasts",group:"plume"}),n.plume("expansionKmPerS",{min:0,max:5,step:.01,unit:"km/s",label:"trailSpreading",group:"plume"}),n.plume("initialRadiusKm",{min:0,max:50,step:.1,unit:"km",label:"radiusAtRelease",group:"plume"}),n.plume("collarShare",{min:0,max:1,step:.01,label:"shareInTheCollar",hint:"theCollarIsTheExhaustJust",group:"collar"}),n.plume("collarExpansionKmPerS",{min:0,max:10,step:.05,unit:"km/s",label:"collarSpreading",hint:"howFastTheCollarWidensThree",group:"collar"}),n.plume("collarLifetimeS",{min:1,max:300,step:1,unit:"s",label:"collarLifetime",group:"collar"})]};static PLACE={kind:"launch-place",title:"placeOfThePath",parameters:[{type:"number",key:"t",min:-3600,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecordingNegativeBefore"},{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:1,label:"position"},{type:"number",key:"altitudeKm",min:0,max:2e3,step:.1,unit:"km",required:!0,label:"altitude"}]};static jetContext(e,t){return{launch:e,index:t}}static jetValue(e){return(t,i)=>{const{launch:s,index:a}=i??{};return s?e(T.releaseOf(s,t,a)):void 0}}static JET_GROUP="jet";static JET={kind:"launch-jet",title:"jet",parameters:[{type:"choice",key:"kind",required:!0,label:"what",choices:[{value:"burn",label:"engineBurn"},{value:"vent",label:"propellantVented"}],group:n.JET_GROUP},{type:"number",key:"fromT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"from",hint:"secondsOfTheRecordingNegativeBefore2",group:n.JET_GROUP},{type:"number",key:"untilT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"until",group:n.JET_GROUP},{type:"number",key:"angleDeg",min:0,max:180,step:1,unit:"°",effective:()=>0,label:"directionFromAft",hint:"t0StraightBackAlongTheStage",group:n.JET_GROUP},{type:"number",key:"azimuthDeg",min:-360,max:360,step:1,unit:"°",effective:()=>0,label:"side",hint:"roundTheLineOfMotionWhich",group:n.JET_GROUP},{type:"number",key:"spinPeriodS",min:-3600,max:3600,step:.1,unit:"s",label:"spinPeriod",hint:"howLongTheStageTakesTo",group:n.JET_GROUP},{type:"number",key:"speedKmPerS",min:0,max:10,step:.01,unit:"km/s",effective:n.jetValue(e=>e.speedKmPerS),label:"speed",hint:"howFastItLeavesTheStage",group:n.JET_GROUP},{type:"number",key:"massKgPerS",min:0,max:1e5,step:.1,unit:"kg/s",effective:n.jetValue(e=>e.massKgPerS),label:"flow",group:n.JET_GROUP},{type:"number",key:"condensedShare",min:0,max:1,step:.01,effective:n.jetValue(e=>e.condensedShare),label:"shareThatScatters",group:n.JET_GROUP},{type:"number",key:"particleRadiusUm",min:.05,max:5,step:.05,unit:"µm",effective:n.jetValue(e=>e.particleRadiusUm),label:"particleRadius",group:n.JET_GROUP},{type:"number",key:"expansionKmPerS",min:0,max:5,step:.01,unit:"km/s",effective:n.jetValue(e=>e.populations[0].expansionKmPerS),label:"spreading",hint:"howFastEachPuffOfIt",group:n.JET_GROUP},{type:"number",key:"initialRadiusKm",min:0,max:50,step:.1,unit:"km",effective:n.jetValue(e=>e.initialRadiusKm),label:"radiusAtRelease",group:n.JET_GROUP},{type:"number",key:"lifetimeS",min:1,max:7200,step:1,unit:"s",effective:n.jetValue(e=>e.populations[0].lifetimeS),label:"lifetime",group:n.JET_GROUP}]};static publish(){b.publish(n.SET)}}const O=y.catalog({en:()=>d(()=>import("./LaunchEditorMessages_en-BnzNAYW9.js"),[],import.meta.url).then(r=>r.launchEditorMessages_en),fr:()=>d(()=>import("./LaunchEditorMessages_fr-Ds_VOB8c.js"),[],import.meta.url).then(r=>r.launchEditorMessages_fr),es:()=>d(()=>import("./LaunchEditorMessages_es-BE0dEl7I.js"),[],import.meta.url).then(r=>r.launchEditorMessages_es),it:()=>d(()=>import("./LaunchEditorMessages_it-DPQaR8HY.js"),[],import.meta.url).then(r=>r.launchEditorMessages_it)});class u{constructor(e,t,i){this.container=e,this.host=t,j.attach(e,"launch-editor-part",u.STYLE),this.language=i,b.of("launch")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="path";placeForm;placeIndex=0;jetForm;jetIndex=0;language;shown=[];static STYLE='.launch-editor-part { flex-basis: 100%; min-width: 0; } .launch-editor-part #launch-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .launch-editor-part .launch-path > .icon-btn { align-self: flex-end; } .launch-editor-part #launch-list, .launch-editor-part #launch-places { flex-basis: 100%; min-width: 0; } .launch-editor-part .launch-editor, .launch-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .launch-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .launch-editor-part [hidden] { display: none !important; } .launch-editor-part select { min-width: 0; width: 100%; } .launch-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-track { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .launch-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; } .launch-editor-part input, .launch-editor-part select { max-width: 100%; box-sizing: border-box; } .launch-editor-part input[type="text"] { width: 12em; } .launch-editor-part #launch-title { width: 18em; } .launch-editor-part label { min-width: 0; max-width: 100%; } .launch-editor-part input.parameter-derived::placeholder { opacity: .65; } .launch-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; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([O.load(e),S.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.launches;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("launch-fields").hidden=t===void 0,!t)return;this.syncPlace(!0),this.syncJet(!0);const i=this.resolved(b.of("launch"));this.form??=new x(this.element("launch-parameters"),this.language,"",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i,t,()=>this.written())}refresh(){if(!this.messages)return;this.syncAddState();const e=this.launches;if(e.length===this.shown.length&&e.every((t,i)=>t===this.shown[i])){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.startOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="path",this.placeIndex=0,this.jetIndex=0,this.sync())}resolved(e){return E.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
2
2
|
<p class="launch-intro">${e.intro}</p>
|
|
3
3
|
<div id="launch-list"></div>
|
|
4
4
|
<div id="launch-fields" class="launch-fields">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bz as w,bA as F,bB as v,bC as Y,R as H}from"./rr0-sighting.mjs";class K{static MU=398600.4418;static OMEGA=72921159e-12;static EARTH_RADIUS_KM=6371;static STEP_S=1;static DENSITY=[[0,1.225],[20,.0889],[40,.004],[60,31e-5],[80,185e-7],[100,56e-8],[120,222e-10],[150,208e-11],[200,254e-12],[250,607e-13],[300,192e-13],[400,28e-13],[500,522e-15],[600,114e-15],[700,307e-16],[800,114e-16],[900,576e-17],[1e3,356e-17]];static FREE_PATH_TIMES_DENSITY=68e-9;static ICE_DENSITY=917;static airDensity(s){const t=K.DENSITY;if(s<=t[0][0])return t[0][1];let e=0;for(;e<t.length-2&&t[e+1][0]<s;)e++;const[a,i]=t[e],[o,n]=t[e+1];return i*Math.exp(Math.log(n/i)*(s-a)/(o-a))}static dragPerKm(s,t,e,a=.5){const i=K.airDensity(s),o=K.FREE_PATH_TIMES_DENSITY/i/1e3,n=Math.exp(-o/t),p=i*1e9*Math.PI*t*t/Math.max(e,1e-9),d=3*i/(4*a*1e-6*K.ICE_DENSITY)*1e3;return n*p+(1-n)*d}static step(s,t,e,a,i){const[o,n,p,d,R,h]=s,m=Math.hypot(o,n,p),T=K.OMEGA,M=-398600.4418/(m*m*m),y=M*o+2*T*R+T*T*o,U=M*n-2*T*d+T*T*n,I=M*p,E=Math.hypot(d,R,h),c=1/(1+K.dragPerKm(m-K.EARTH_RADIUS_KM,e,a,i)*E*t);s[3]=(d+y*t)*c,s[4]=(R+U*t)*c,s[5]=(h+I*t)*c,s[0]=o+s[3]*t,s[1]=n+s[4]*t,s[2]=p+s[5]*t;const f=Math.hypot(s[0],s[1],s[2]);if(f<K.EARTH_RADIUS_KM){const A=K.EARTH_RADIUS_KM/f;s[0]*=A,s[1]*=A,s[2]*=A,s[3]=s[4]=s[5]=0}}}class _{constructor(s,t,e,a,i=.5){this.massKg=e,this.radiusAt=a,this.particleRadiusUm=i,this.state=Float64Array.of(...s,...t),this.positions=new Float64Array(192),this.positions.set(s,0)}positions;steps=0;state;at(s){const t=K.STEP_S,e=Math.max(0,s/t),a=Math.ceil(e);for(;this.steps<a;){if(K.step(this.state,t,this.radiusAt(this.steps*t),this.massKg,this.particleRadiusUm),this.steps++,3*(this.steps+1)>this.positions.length){const p=new Float64Array(this.positions.length*2);p.set(this.positions),this.positions=p}this.positions.set(this.state.subarray(0,3),3*this.steps)}const i=Math.floor(e),o=e-i,n=this.positions;return o===0||i>=this.steps?[n[3*i],n[3*i+1],n[3*i+2]]:[0,1,2].map(p=>n[3*i+p]+(n[3*i+3+p]-n[3*i+p])*o)}}class r{static EARTH_RADIUS_KM=6371;static SHADOW_RADIUS_KM=r.EARTH_RADIUS_KM+15;static PENUMBRA_KM=10;static SUN_ILLUMINANCE_LUX=127e3;static RAYLEIGH_PER_M=[58e-7,135e-7,331e-7];static SCALE_HEIGHT_M=8e3;static OZONE_GRAZING_DEPTH=[2.4,1.8,.24];static ANISOTROPY=.7;static ALBEDO=.99;static WAVELENGTHS_UM=[.61,.55,.465];static ICE_INDEX=1.31;static DEFAULTS={exhaustKgPerS:273,condensedShare:.065,particleRadiusUm:.5,expansionKmPerS:.15,initialRadiusKm:.5,lifetimeS:420,collarShare:.85,collarExpansionKmPerS:2.5,collarLifetimeS:20};static PROPELLANTS={"rp1-lox":{condensedShare:.065,particleRadiusUm:.5},"methane-lox":{condensedShare:.09,particleRadiusUm:.5},"hydrogen-lox":{condensedShare:.13,particleRadiusUm:.5},hypergolic:{condensedShare:.079,particleRadiusUm:.4},solid:{condensedShare:.27,particleRadiusUm:.8}};static G0=9.80665;static COLLAR_SPREAD_OF_EXHAUST_VELOCITY=.735;static plumeOf(s){const t={},e=s.vehicle?.engine;if(e){const a=e.specificImpulseS===void 0?void 0:e.specificImpulseS*r.G0;e.thrustKN!==void 0&&a&&(t.exhaustKgPerS=e.thrustKN*1e3/a),a&&(t.collarExpansionKmPerS=a/1e3*r.COLLAR_SPREAD_OF_EXHAUST_VELOCITY),e.propellant&&Object.assign(t,r.PROPELLANTS[e.propellant])}return{...r.DEFAULTS,...t,...s.plume}}static PUFF_EVERY_S=.5;static SIGMA_OF_RADIUS=.5;static MAX_PUFFS=320;static DEG=Math.PI/180;static EARTH_ROTATION=72921159e-12;static VENT_DEFAULTS={speedKmPerS:.7,massKgPerS:20,condensedShare:.5,particleRadiusUm:.5,expansionKmPerS:.1,initialRadiusKm:.2,lifetimeS:600};static paths=new WeakMap;static exhaustVelocityKmPerS(s){return(s.vehicle?.engine?.specificImpulseS??348)*r.G0/1e3}static releasesOf(s){const t=[],e=s.jets??[];if(e.length===0||s.burnFromT!==void 0||s.burnUntilT!==void 0){const a=s.track[0]?.t??0,i=s.track[s.track.length-1]?.t??0;t.push(r.engineRelease(s,"burn",{fromT:s.burnFromT??a,untilT:s.burnUntilT??i}))}return e.forEach((a,i)=>t.push(r.releaseOf(s,a,i))),t}static releaseOf(s,t,e){const a=`jet:${t.id??e}`;if((t.kind??"burn")==="burn")return r.engineRelease(s,a,t);const i=r.VENT_DEFAULTS;return{key:a,fromT:t.fromT,untilT:t.untilT,angleDeg:t.angleDeg??0,azimuthDeg:t.azimuthDeg??0,spinPeriodS:t.spinPeriodS,speedKmPerS:t.speedKmPerS??i.speedKmPerS,massKgPerS:t.massKgPerS??i.massKgPerS,condensedShare:t.condensedShare??i.condensedShare,particleRadiusUm:t.particleRadiusUm??i.particleRadiusUm,initialRadiusKm:t.initialRadiusKm??i.initialRadiusKm,populations:[{share:1,expansionKmPerS:t.expansionKmPerS??i.expansionKmPerS,lifetimeS:t.lifetimeS??i.lifetimeS}]}}static engineRelease(s,t,e){const a=r.plumeOf(s);return{key:t,fromT:e.fromT,untilT:e.untilT,angleDeg:e.angleDeg??0,azimuthDeg:e.azimuthDeg??0,spinPeriodS:e.spinPeriodS,speedKmPerS:e.speedKmPerS??r.exhaustVelocityKmPerS(s),massKgPerS:e.massKgPerS??a.exhaustKgPerS,condensedShare:e.condensedShare??a.condensedShare,particleRadiusUm:e.particleRadiusUm??a.particleRadiusUm,initialRadiusKm:e.initialRadiusKm??a.initialRadiusKm,populations:[{share:1-a.collarShare,expansionKmPerS:e.expansionKmPerS??a.expansionKmPerS,lifetimeS:e.lifetimeS??a.lifetimeS},{share:a.collarShare,expansionKmPerS:a.collarExpansionKmPerS,lifetimeS:a.collarLifetimeS}]}}static extinctionEfficiency(s,t){const e=2*Math.PI*s/t,a=r.ICE_INDEX**2,i=8/3*e**4*((a-1)/(a+2))**2,o=2*e*(r.ICE_INDEX-1),n=o<.001?o*o/2:2-4/o*Math.sin(o)+4/(o*o)*(1-Math.cos(o));return Math.min(i,n)}static scatteringColour(s){const t=r.extinctionEfficiency(s,r.WAVELENGTHS_UM[1]);return r.WAVELENGTHS_UM.map(e=>r.extinctionEfficiency(s,e)/t)}static sunDirectionAt(s){const t=new w(0,0,-6378137),e=F(v.Sun,s,t,!0,!0),a=(e.ra-Y(s))*15*r.DEG,i=e.dec*r.DEG;return[Math.cos(i)*Math.cos(a),Math.cos(i)*Math.sin(a),Math.sin(i)]}static puffsAt(s,t){const e=[];for(const a of s){let i=r.paths.get(a);i||r.paths.set(a,i=new Map);for(const o of r.releasesOf(a)){const n=Math.min(o.untilT,t);if(n<=o.fromT)continue;const p=Math.max(r.PUFF_EVERY_S*1e3,(o.untilT-o.fromT)/r.MAX_PUFFS),d=[];for(let M=o.fromT;M<n;M+=p)d.push(M);d.push(n);const R=o.massKgPerS*(p/1e3),m=3*r.extinctionEfficiency(o.particleRadiusUm,r.WAVELENGTHS_UM[1])/(4*917*o.particleRadiusUm*1e-6),T=r.scatteringColour(o.particleRadiusUm);o.populations.forEach((M,y)=>{if(M.share<=0)return;const U=E=>o.initialRadiusKm+M.expansionKmPerS*E,I=[];for(const E of d){const D=(t-E)/1e3;if(D>M.lifetimeS)continue;const c=E!==n||n===o.untilT,f=`${o.key}|${y}|${E}`;let A=c?i.get(f):void 0;if(!A){if(A=r.launchPuff(a,o,E,R*M.share,U),!A)continue;c&&i.set(f,A)}I.push({ageS:D,position:A.at(D)})}for(let E=I.length-1;E>=0;E--){const{ageS:D,position:c}=I[E],f=I[E-1]??I[E+1],A=f?Math.hypot(c[0]-f.position[0],c[1]-f.position[1],c[2]-f.position[2]):0,l=U(D)+A/2,O=r.SIGMA_OF_RADIUS*l*1e3,N=R*o.condensedShare*M.share*m/(2*Math.PI*O*O),x=Math.max(0,1-(D/M.lifetimeS)**2);N*x<=0||e.push({launchId:a.id,release:o.key,at:r.geoPoint(c),radiusKm:l,opticalDepth:N*x,colour:T,ageS:D})}})}}return e}static viewsAt(s,t,e,a){const i=[];for(const o of r.puffsAt(s,t)){const n=H.seenFrom(e,o.at);if(n.altitudeDeg<0)continue;const p=r.sunlightAt(o.at,a);if(p.lit<=0)continue;const d=r.scatteringPhase(e,o.at,a),R=r.SUN_ILLUMINANCE_LUX*r.ALBEDO*d*o.opticalDepth*p.lit;R<=0||i.push({launchId:o.launchId,release:o.release,heightKm:o.at.heightM/1e3,centre:n,radiusDeg:Math.atan2(o.radiusKm,n.distanceKm)/r.DEG,luminanceCdM2:R,sunTransmittance:p.transmittance,colour:o.colour,lit:p.lit,ageS:o.ageS})}return i}static launchPuff(s,t,e,a,i){const o={id:s.id,track:s.track,fragments:[]},n=H.leadAt(o,e);if(!n)return;const p=s.track[0].t,d=s.track[s.track.length-1].t,R=Math.max(p,e-500),h=Math.min(d,e+500),m=r.earthCentred(n),T=r.earthCentred(H.leadAt(o,R)),M=r.earthCentred(H.leadAt(o,h)),y=Math.max(.001,(h-R)/1e3),U=[0,1,2].map(S=>(M[S]-T[S])/y),I=r.EARTH_ROTATION,E=[U[0]-I*m[1],U[1]+I*m[0],U[2]],D=S=>{const b=Math.hypot(S[0],S[1],S[2])||1;return S.map(k=>k/b)},c=D(E),f=D(m),A=f[0]*c[0]+f[1]*c[1]+f[2]*c[2];let l=[f[0]-A*c[0],f[1]-A*c[1],f[2]-A*c[2]];Math.hypot(l[0],l[1],l[2])<1e-6&&(l=[-c[2]*c[0],-c[2]*c[1],1-c[2]*c[2]]),l=D(l);const O=[c[1]*l[2]-c[2]*l[1],c[2]*l[0]-c[0]*l[2],c[0]*l[1]-c[1]*l[0]],N=t.spinPeriodS?360*((e-t.fromT)/1e3)/t.spinPeriodS:0,x=(t.azimuthDeg+N)*r.DEG,G=t.angleDeg*r.DEG,C=[0,1,2].map(S=>-c[S]*Math.cos(G)+Math.sin(G)*(Math.cos(x)*l[S]+Math.sin(x)*O[S])),P=[0,1,2].map(S=>U[S]+t.speedKmPerS*C[S]);return new _(m,P,a,i,t.particleRadiusUm)}static geoPoint(s){const t=Math.hypot(s[0],s[1],s[2]);return{lat:Math.asin(s[2]/t)/r.DEG,lng:Math.atan2(s[1],s[0])/r.DEG,heightM:(t-K.EARTH_RADIUS_KM)*1e3}}static sunlightAt(s,t){const e=r.earthCentred(s),a=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];if(a>=0)return{lit:1,transmittance:[1,1,1]};const i=Math.hypot(e[0]-a*t[0],e[1]-a*t[1],e[2]-a*t[2]),o=r.PENUMBRA_KM,n=Math.min(1,Math.max(0,(i-(r.SHADOW_RADIUS_KM-o/2))/o));if(n<=0)return{lit:0,transmittance:[0,0,0]};const p=Math.max(0,(i-r.EARTH_RADIUS_KM)*1e3),d=Math.exp(-p/r.SCALE_HEIGHT_M),R=Math.sqrt(2*Math.PI*r.EARTH_RADIUS_KM*1e3*r.SCALE_HEIGHT_M),h=Math.exp(-(((p/1e3-25)/15)**2)),m=[0,1,2].map(T=>Math.exp(-r.RAYLEIGH_PER_M[T]*d*R-r.OZONE_GRAZING_DEPTH[T]*h));return{lit:n,transmittance:m}}static scatteringPhase(s,t,e){const a=r.earthCentred(s),i=r.earthCentred(t),o=[a[0]-i[0],a[1]-i[1],a[2]-i[2]],n=Math.hypot(o[0],o[1],o[2])||1,p=-(o[0]*e[0]+o[1]*e[1]+o[2]*e[2])/n,d=r.ANISOTROPY;return(1-d*d)/(4*Math.PI*(1+d*d-2*d*p)**1.5)}static earthCentred(s){const t=s.lat*r.DEG,e=s.lng*r.DEG,a=r.EARTH_RADIUS_KM+s.heightM/1e3;return[a*Math.cos(t)*Math.cos(e),a*Math.cos(t)*Math.sin(e),a*Math.sin(t)]}}export{r as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as M}from"./LaunchPlume-
|
|
1
|
+
import{L as M}from"./LaunchPlume-uRfBKA0Y.js";import{G as T,$ as z,a2 as f,N as C,bx as w,by as A}from"./rr0-sighting.mjs";class n{static RADIUS=840;static MAX_PUFFS=1e3;static RINGS=[0,.25,.5,.75,1,1.25];static COLUMN=n.RINGS.map(t=>{const i=o=>Math.exp(-((o/M.SIGMA_OF_RADIUS)**2)/2),s=i(n.RINGS[n.RINGS.length-1]);return Math.max(0,(i(t)-s)/(1-s))});static SECTORS=12;static VERTICES_PER_PUFF=n.SECTORS*(3+6*(n.RINGS.length-2));static BRIGHTEST_RELATIVE=6e4;object=new T;mesh;positions=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);colors=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);shown=0;drawn=[];static VISIBLE_CONTRAST=.1;constructor(){this.object.name="plumes";const t=new z;t.setAttribute("position",new f(this.positions,3)),t.setAttribute("color",new f(this.colors,3)),t.setDrawRange(0,0),this.mesh=new C(t,w.material()),this.mesh.frustumCulled=!1,w.track(this.mesh),this.object.add(this.mesh)}get count(){return this.shown}set(t,i,s,o){let h=0,c=0;this.drawn=[];for(const p of t){if(c>=n.MAX_PUFFS)break;const d=o(p.centre);if(d<=0)continue;const a=s(p.centre),r=[0,1,2].map(g=>Math.min(n.BRIGHTEST_RELATIVE,p.luminanceCdM2*(p.colour?.[g]??1)*i*p.sunTransmittance[g]*a[g]*d));Math.max(...r)<=0||(h=this.pushPuff(h,p,r),this.drawn.push({view:p,direction:this.normalise(A(p.centre.altitudeDeg,p.centre.azimuthDeg,1)),radiusRad:p.radiusDeg*Math.PI/180,luminance:.2126*r[0]+.7152*r[1]+.0722*r[2]}),c++)}this.shown=c;const u=this.mesh.geometry;u.setDrawRange(0,h),u.getAttribute("position").needsUpdate=!0,u.getAttribute("color").needsUpdate=!0}pushPuff(t,i,s){const o=A(i.centre.altitudeDeg,i.centre.azimuthDeg,n.RADIUS),h=this.normalise(o),c=this.normalise(this.cross({x:0,y:1,z:0},h)),u=this.cross(h,c),p=n.RADIUS*Math.tan(i.radiusDeg*Math.PI/180),d=(r,g)=>{const e=g/n.SECTORS*2*Math.PI,I=n.RINGS[r]*p,R=Math.cos(e)*I,l=Math.sin(e)*I;return{x:o.x+c.x*R+u.x*l,y:o.y+c.y*R+u.y*l,z:o.z+c.z*R+u.z*l}},a=r=>n.COLUMN[r];for(let r=0;r<n.SECTORS;r++){const g=(r+1)%n.SECTORS;t=this.push(t,o,s,a(0)),t=this.push(t,d(1,r),s,a(1)),t=this.push(t,d(1,g),s,a(1));for(let e=1;e<n.RINGS.length-1;e++){const I=d(e,r),R=d(e,g),l=d(e+1,r),E=d(e+1,g);t=this.push(t,I,s,a(e)),t=this.push(t,R,s,a(e)),t=this.push(t,l,s,a(e+1)),t=this.push(t,R,s,a(e)),t=this.push(t,E,s,a(e+1)),t=this.push(t,l,s,a(e+1))}}return t}pickAt(t,i,s=0){const o=this.normalise(t);let h=0,c;for(const u of this.drawn){const p=Math.max(-1,Math.min(1,o.x*u.direction.x+o.y*u.direction.y+o.z*u.direction.z)),d=Math.max(0,Math.acos(p)-i)/Math.max(u.radiusRad,1e-9),a=u.luminance*n.profile(d);a<=0||(h+=a,(!c||a>c.light)&&(c={view:u.view,light:a}))}return c&&h>=n.VISIBLE_CONTRAST*s?c.view:void 0}static profile(t){const i=n.RINGS;if(t>=i[i.length-1])return 0;let s=0;for(;t>i[s+1];)s++;const o=(t-i[s])/(i[s+1]-i[s]);return n.COLUMN[s]+(n.COLUMN[s+1]-n.COLUMN[s])*o}push(t,i,s,o){const h=t*3;return this.positions[h]=i.x,this.positions[h+1]=i.y,this.positions[h+2]=i.z,this.colors[h]=s[0]*o,this.colors[h+1]=s[1]*o,this.colors[h+2]=s[2]*o,t+1}cross(t,i){return this.normalise({x:t.y*i.z-t.z*i.y,y:t.z*i.x-t.x*i.z,z:t.x*i.y-t.y*i.x})}normalise(t){const i=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/i,y:t.y/i,z:t.z/i}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.object.removeFromParent()}}class N{inSky=!0;plumes=new n;get object(){return this.plumes.object}get drawnCount(){return this.plumes.count}update(t,i,s){const o=t.length===0||!s.date?[]:M.viewsAt(t,i,s.observer,M.sunDirectionAt(s.date));o.length===0&&this.plumes.count===0||this.plumes.set(o,s.relativeScale,h=>s.transmittanceFromSpace(h),h=>s.cloudTransmission(h))}pick(t,i,s){const o=this.plumes.pickAt(i,s.toleranceRad,s.skyLightTowards(i));return o&&{id:o.launchId,detail:o}}dispose(){this.plumes.dispose()}}export{N as LaunchSimulation};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-ZXC7TlGn.js","./rr0-sighting.mjs"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{f as g,d as w,_ as b,M as p}from"./rr0-sighting.mjs";class n{static STORAGE_KEY="ufoathome.modules";static FORMAT=1;static empty(){return{format:1,modules:[]}}static read(t=n.storage()){try{const e=t?.getItem(n.STORAGE_KEY);return e?n.parse(e):n.empty()}catch{return n.empty()}}static write(t,e=n.storage()){try{return e?(t.modules.length===0?e.removeItem(n.STORAGE_KEY):e.setItem(n.STORAGE_KEY,n.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>n.FORMAT)throw new Error(`format ${e.format} is newer than ${n.FORMAT}`);const r=new Set,s=[];for(const i of e.modules)typeof i?.url!="string"||r.has(i.url)||(r.add(i.url),s.push({url:i.url,enabled:i.enabled!==!1}));return{format:1,modules:s}}static text(t){return JSON.stringify({format:n.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 f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,r=>f.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 v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}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 s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-
|
|
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 f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,r=>f.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 v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}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 s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-ZXC7TlGn.js");return{MODULE_THREE:h}},__vite__mapDeps([0,1]),import.meta.url);a=await c.default({manifestUrl:t,three:l})??{}}return{url:t,manifest:s,module:d.module(s,t,a),hasScript:i,scriptRun:i&&e.runScript}}}class y{constructor(t=new T,e){this.loader=t,this.storage=e}static shared=new y;changes=new EventTarget;states=new Map;config=n.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(n.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(),await 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 n.text(this.config)}async importText(t){const e=n.parse(t);await this.start();const r=this.config.modules.map(s=>s.url);this.config=e,this.save(),await Promise.all([...new Set([...r,...e.modules.map(s=>s.url)])].map(s=>this.reload(s)))}async require(t,e){t?.length&&(await this.start(),await Promise.all(t.map(async r=>{let s;try{s=new URL(r,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const i=this.states.get(s);if(i&&i.status!=="off")return i.status==="loading"?this.pending.get(s):void 0;this.named.add(s),await this.reload(s)})))}named=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&&p.uninstall(r.loaded.module.id);const s=e!==void 0,i=e?.enabled??!0;if(!s&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:s,enabled:i,status:"off"};if(s&&!i&&!this.named.has(t))return this.set({url:t,addedByPerson:s,enabled:i,status:"off"});this.set({url:t,addedByPerson:s,enabled:i,status:"loading"});try{const a=await this.loader.load(t,{runScript:s&&i});return p.install(a.module),this.set({url:t,addedByPerson:s,enabled:i,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:s,enabled:i,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){n.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as a,K as e,bI as s,aj as t,al as r,aB as i,aa as o,aw as n,ah as b,ai as l,aY as m,aC as u,aD as M,bJ as d,a1 as B,am as G,N as S,x as f,be as y,bb as c,bf as h,G as p,bs as x,a0 as C,bK as L,an as D,bL as g,bM as A,bN as E,C as P,ak as T,$ as N,a2 as O,bO as j,aA as k,aq as v}from"./rr0-sighting.mjs";const K={AdditiveBlending:v,BackSide:k,BoxGeometry:j,BufferAttribute:O,BufferGeometry:N,CanvasTexture:T,Color:P,ConeGeometry:E,CylinderGeometry:A,DataTexture:g,DoubleSide:D,Euler:L,Float32BufferAttribute:C,FrontSide:x,Group:p,Line:h,LineBasicMaterial:c,LineSegments:y,Matrix4:f,Mesh:S,MeshBasicMaterial:G,MeshStandardMaterial:B,NormalBlending:d,Object3D:M,PlaneGeometry:u,PointLight:m,Points:l,PointsMaterial:b,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{K as MODULE_THREE};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aO as q,S as M,H as D,s as V,i as j,U,aP as f,aQ as g}from"./rr0-sighting.mjs";class X{static attach(e,t,i){e.classList.add(t);const n=`${t}-style`;if(e.parentElement?.querySelector(`:scope > style.${n}`))return;const s=e.ownerDocument.createElement("style");s.className=n,s.textContent=i,e.before(s)}}class I{constructor(e,t,i,n){this.button=e,this.onPick=i,this.idOf=n;const s=this.panel=e.ownerDocument.createElement("div");s.id=t,s.className="add-menu",s.setAttribute("popover",""),s.setAttribute("role","menu");const o=`--add-menu-${t}`;e.style.setProperty("anchor-name",o),s.style.setProperty("position-anchor",o),e.setAttribute("popovertarget",t),e.setAttribute("aria-haspopup","menu"),e.after(s)}static CSS=`
|
|
2
2
|
.add-menu { padding: .3em 0; border: 1px solid color-mix(in srgb, CanvasText 30%, transparent); border-radius: 4px; background: Canvas; color: CanvasText;
|
|
3
3
|
box-shadow: 0 2px 8px rgba(0, 0, 0, .25); max-height: 60vh; overflow-y: auto; font-size: .9em; }
|
|
4
4
|
@supports (position-area: bottom span-left) {
|
|
@@ -9,7 +9,7 @@ import{aN as q,S as M,H as D,s as V,i as j,U,aO as f,aP as g}from"./rr0-sighting
|
|
|
9
9
|
.add-menu-choice:hover, .add-menu-choice:focus-visible { background: color-mix(in srgb, CanvasText 12%, transparent); }
|
|
10
10
|
.add-menu-choice[aria-disabled="true"] { opacity: .45; cursor: not-allowed; background: none; }
|
|
11
11
|
.add-menu-choice[hidden] { display: none; }
|
|
12
|
-
`;panel;kinds=[];last;setKinds(e){this.kinds=e;const t=this.button.ownerDocument;this.panel.replaceChildren(...e.map(i=>{const
|
|
12
|
+
`;panel;kinds=[];last;setKinds(e){this.kinds=e;const t=this.button.ownerDocument;this.panel.replaceChildren(...e.map(i=>{const n=t.createElement("button");return n.type="button",n.className="add-menu-choice",n.setAttribute("role","menuitem"),this.idOf&&(n.id=this.idOf(i.value)),n.dataset.value=i.value,n.textContent=i.label,n.hidden=i.hidden===!0,i.disabledReason&&(n.setAttribute("aria-disabled","true"),n.title=i.disabledReason),n.addEventListener("click",()=>{n.getAttribute("aria-disabled")!=="true"&&(this.close(),this.last=i.value,this.onPick(i.value))}),n}))}setDisabled(e,t){this.kinds=this.kinds.map(n=>n.value===e?{...n,disabledReason:t}:n);const i=[...this.panel.children].find(n=>n.dataset.value===e);i&&(t?(i.setAttribute("aria-disabled","true"),i.title=t):(i.removeAttribute("aria-disabled"),i.title=""))}labelOf(e){return this.kinds.find(t=>t.value===e)?.label??e}get lastPicked(){return this.last}close(){if(typeof this.panel.hidePopover=="function")try{this.panel.matches(":popover-open")&&this.panel.hidePopover()}catch{}}}class A{constructor(e){this.options=e,this.row=document.createElement("div"),this.row.className="element-list-row",this.pickerRow=document.createElement("label"),this.pickerRow.className="element-list-picker",this.select=document.createElement("select"),this.select.id=e.ids.list,this.select.addEventListener("change",()=>e.onSelect(this.select.value)),this.pickerRow.append(this.select),e.header.append(this.row),this.row.append(this.pickerRow);const t=e.navigation;t&&(this.previousButton=this.iconButton(`${e.ids.list}-previous`,"▲"),this.nextButton=this.iconButton(`${e.ids.list}-next`,"▼"),this.previousButton.addEventListener("click",()=>t.onStep(-1)),this.nextButton.addEventListener("click",()=>t.onStep(1)),this.row.append(this.previousButton,this.nextButton),t.scope.addEventListener("keydown",i=>{if(!i.altKey||i.ctrlKey||i.metaKey||i.shiftKey||i.key!=="ArrowUp"&&i.key!=="ArrowDown"||this.pickerRow.closest("[hidden]")||!this.pickerRow.isConnected)return;i.preventDefault(),i.stopPropagation();const n=i.key==="ArrowUp"?this.previousButton:this.nextButton;n&&!n.disabled&&t.onStep(i.key==="ArrowUp"?-1:1)}));for(const i of e.actions??[]){const n=this.iconButton(i.id,i.glyph);n.addEventListener("click",()=>i.onClick()),this.actionButtons.set(i.id,n),this.row.append(n)}this.removeButton=this.iconButton(e.ids.remove,"🗑"),this.removeButton.addEventListener("click",()=>e.onRemove()),this.emptyText=document.createElement("span"),this.emptyText.className="element-list-empty",this.addButton=this.iconButton(e.ids.add,"+"),this.addButton.classList.add("element-list-add"),this.row.append(this.removeButton,this.emptyText,this.addButton),e.ids.kinds?this.kindMenu=new I(this.addButton,e.ids.kinds,i=>e.onAdd(i),e.ids.kind):this.addButton.addEventListener("click",()=>e.onAdd(void 0)),e.body&&e.body.classList.add("element-list-body")}static CSS=`
|
|
13
13
|
.element-list-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .4em; flex: 1 1 100%; min-width: 0; }
|
|
14
14
|
.element-list-picker { flex: 1 1 10em; min-width: 0; display: flex; }
|
|
15
15
|
.element-list-picker select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
|
|
@@ -22,7 +22,7 @@ import{aN as q,S as M,H as D,s as V,i as j,U,aO as f,aP as g}from"./rr0-sighting
|
|
|
22
22
|
align-items: center; gap: .5em; }
|
|
23
23
|
.element-list-picker select { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
|
|
24
24
|
.element-list-row [hidden], .element-list-body[hidden] { display: none !important; }
|
|
25
|
-
${I.CSS}`;static showPresence(e,t,i,
|
|
25
|
+
${I.CSS}`;static showPresence(e,t,i,n=!1){for(const s of e.children)if(!s.matches(".element-list-add, .add-menu, .add-reason")){if(s.matches(".element-list-empty")){s.hidden=i||n;continue}if(s.matches(".element-list-picker")){s.hidden=!i&&!n;continue}s.hidden=!i&&!n,s instanceof HTMLButtonElement&&!i&&(s.disabled=!0)}t&&(t.hidden=!i,i&&!A.glued.has(t)&&A.glue(t))}static glued=new WeakSet;static glue(e){const t=e.parentElement,i=e.ownerDocument.defaultView;if(!t||!i)return;const n=i.getComputedStyle(t),s=/flex|grid/.test(n.display)&&parseFloat(n.rowGap)||0;e.style.marginTop=`${-s}px`,n.display!=="none"&&A.glued.add(e)}select;row;pickerRow;emptyText;removeButton;addButton;addReason;kindMenu;previousButton;nextButton;actionButtons=new Map;items=[];noneLabel="—";addLabel="";removeEnabled=!0;actionEnabled=new Map;iconButton(e,t){const i=document.createElement("button");return i.type="button",i.className="icon-btn",i.id=e,q.show(i,t),i}setLabels(e){if(this.previousButton&&this.nextButton)for(const[t,i,n]of[[this.previousButton,e.previous??"","Alt+↑"],[this.nextButton,e.next??"","Alt+↓"]]){const s=i===""?n:`${i} (${n})`;t.title=s,t.setAttribute("aria-label",i||s),t.setAttribute("aria-keyshortcuts",n.replace("↑","ArrowUp").replace("↓","ArrowDown"))}this.select.setAttribute("aria-label",e.list),this.emptyText.textContent=e.empty??"",this.noneLabel=e.none??this.noneLabel,this.addLabel=e.add,this.kindMenu?.panel.setAttribute("aria-label",e.add),this.options.optional&&this.listed(this.items,this.select.value);for(const[t,i]of[[this.removeButton,e.remove],[this.addButton,e.add],...[...this.actionButtons].map(([n,s])=>[s,e.actions?.[n]??""])])t.title=i,t.setAttribute("aria-label",i)}setKinds(e){this.kindMenu?.setKinds(e)}kindLabel(e){return this.kindMenu?.labelOf(e)??e}get pickedKind(){return this.kindMenu?.lastPicked}setItems(e,t){this.items=e,this.listed(e,t)}listed(e,t){this.select.replaceChildren(...this.options.optional?[new Option(this.noneLabel,"")]:[],...e.map(i=>new Option(i.label,i.id))),t!==void 0&&(this.select.value=t),this.select.selectedIndex<0&&(this.select.selectedIndex=0),this.setPresent(this.options.optional?this.select.value!=="":e.length>0)}setStepState(e,t){this.previousButton&&(this.previousButton.disabled=!e),this.nextButton&&(this.nextButton.disabled=!t)}setActionEnabled(e,t){const i=this.actionButtons.get(e);i&&(i.disabled=!t||this.select.disabled),this.actionEnabled.set(e,t)}setRemoveEnabled(e){this.removeEnabled=e,this.removeButton.disabled=!e||this.select.value===""&&this.options.optional===!0}get value(){return this.select.value}setAddState(e,t){this.addButton.disabled=!e;const i=t??this.addLabel;this.addButton.title=i,this.addButton.setAttribute("aria-label",i),this.addReason||(this.addReason=this.addButton.ownerDocument.createElement("span"),this.addReason.className="add-reason",this.addReason.style.cssText="font-size: .85em; opacity: .8; align-self: center;",this.row.append(this.addReason)),this.addReason.textContent=!e&&t?t:"",this.addReason.hidden=e||!t}rename(e,t){const i=[...this.select.options].find(n=>n.value===e);i&&(i.textContent=t)}show(e){this.select.value=e,this.options.optional&&this.setPresent(this.select.value!=="")}setPresent(e){const t=this.options.optional===!0;if(A.showPresence(this.row,this.options.body,e,t),this.select.disabled=!e&&!t,!!e){this.removeButton.disabled=!this.removeEnabled;for(const[i,n]of this.actionButtons)n.disabled=this.actionEnabled.get(i)===!1}}focus(){this.select.focus()}}class v{static CHROME="2.6em";static UNBOUNDED=9999;static fit(e){const t=[...e.querySelectorAll('input[type="number"]')];for(const i of t)i.style.width=`calc(${v.charsFor(i)}ch + ${v.CHROME})`,v.hold(i,!v.isFocused(i)),i.dataset.held!==""&&(i.dataset.held="",i.addEventListener("input",()=>v.hold(i)),i.addEventListener("change",()=>v.hold(i,!0)));return t.length}static hold(e,t=!1){const i=v.heldValue(e.value,e,t);i!==e.value&&(e.value=i,e.dispatchEvent(new Event("input",{bubbles:!0})))}static isFocused(e){return e.getRootNode().activeElement===e}static heldValue(e,t,i=!1){if(e===""||!/^-?\d+(\.\d+)?$/.test(e))return e;const n=v.wholeOnly(t.step)?0:v.decimalsOf(t.step),s=e.indexOf("."),o=s>=0&&e.length-s-1>n?n===0?e.slice(0,s):e.slice(0,s+n+1):e,a=Number(o),d=t.min===""?void 0:Number(t.min),r=t.max===""?void 0:Number(t.max);return r!==void 0&&a>r?String(r):i&&d!==void 0&&a<d?String(d):o}static charsFor(e){const t=a=>a===""?void 0:Math.abs(Number(a)),i=Math.max(t(e.max)??v.UNBOUNDED,t(e.min)??0),n=String(Math.floor(Number.isFinite(i)?i:v.UNBOUNDED)).length,s=e.min!==""&&Number(e.min)<0?1:0,o=v.wholeOnly(e.step)?0:v.decimalsOf(e.step);return n+s+(o>0?o+1:0)}static decimalsOf(e){if(e===""||e==="any")return 2;const t=e.indexOf(".");return Math.max(2,t<0?0:e.length-t-1)}static wholeOnly(e){return e!==""&&e!=="any"&&!e.includes(".")}}class E{static CSS=`
|
|
26
26
|
.window-close {
|
|
27
27
|
position: absolute; top: 8px; right: 8px; z-index: 1;
|
|
28
28
|
display: inline-flex; align-items: center; justify-content: center;
|
|
@@ -32,7 +32,7 @@ ${I.CSS}`;static showPresence(e,t,i,s=!1){for(const n of e.children)if(!n.matche
|
|
|
32
32
|
.window-close:hover, .window-close:focus-visible { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }
|
|
33
33
|
:is(dialog, [popover], .context-menu):has(> .window-close) { position: relative; padding-right: 44px; }
|
|
34
34
|
.context-menu:has(> .window-close) { position: fixed; }
|
|
35
|
-
`;static button(e,t,i){const
|
|
35
|
+
`;static button(e,t,i){const n=e.querySelector(":scope > .window-close");if(n)return E.label(n,t),n;const s=document.createElement("button");return s.type="button",s.className="window-close",s.innerHTML=q.CLOSE,E.label(s,t),s.addEventListener("click",o=>{o.stopPropagation(),i()}),e.prepend(s),s}static popover(e,t){return E.button(e,t,()=>{typeof e.hidePopover=="function"&&e.matches(":popover-open")&&e.hidePopover()})}static dialog(e,t,i){if(!e.dataset.closesBeside){e.dataset.closesBeside="true";let n=!1;e.addEventListener("pointerdown",s=>n=s.target===e),e.addEventListener("click",s=>{s.target===e&&n&&E.outside(e,s)&&i()})}return E.button(e,t,i)}static outside(e,t){const i=e.getBoundingClientRect();return t.clientX<i.left||t.clientX>i.right||t.clientY<i.top||t.clientY>i.bottom}static label(e,t){e.title=t,e.setAttribute("aria-label",t)}}class w extends HTMLElement{static TAG="rr0-input-basis";static CSS=`
|
|
36
36
|
rr0-input-basis { display: inline-block; }
|
|
37
37
|
rr0-input-basis[hidden] { display: none; }
|
|
38
38
|
.basis-mark {
|
|
@@ -62,7 +62,7 @@ rr0-input-basis[hidden] { display: none; }
|
|
|
62
62
|
.basis-source h4 { margin: 0 0 10px; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
|
|
63
63
|
.basis-source-free { margin: 0; font: 400 13px/1.45 var(--sans); color: var(--ink-dim); }
|
|
64
64
|
.basis-window input { box-sizing: border-box; width: 100%; font-weight: 400; }
|
|
65
|
-
`;hows=[];rationaleKept=!0;sourceKept=!0;choices={};wording;sourceWording;shown;mark;window;static count=0;anchor=`--rr0-basis-${++w.count}`;set anchorKey(e){this.anchor=`--rr0-basis-${e.replace(/[^a-zA-Z0-9_-]/g,"-")}`,this.mark?.style.setProperty("anchor-name",this.anchor)}build(){if(this.mark)return;const e=document.createElement("span");e.className="basis-mark",e.setAttribute("role","button"),e.tabIndex=0,e.style.setProperty("anchor-name",this.anchor);const t=i=>{i.preventDefault(),i.stopPropagation(),this.open()};e.addEventListener("click",t),e.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&t(i)}),this.append(e),this.mark=e,this.say()}connectedCallback(){this.build()}set messages(e){this.wording=e,this.say()}set sourceMessages(e){this.sourceWording=e}get entry(){return this.shown}set entry(e){this.shown=e&&(e.basis!=="stated"||e.how!==void 0||e.rationale!==void 0||e.source!==void 0)?{...e}:void 0,this.say()}get pill(){return this.build(),this.mark}say(){const e=this.mark,t=this.wording;if(!e||!t)return;const i=this.shown?.basis??"stated";e.dataset.basis=i,this.dataset.basis=i,e.textContent!==t.basis[i]&&(e.textContent=t.basis[i]),this.shown?.source?e.dataset.sourced="yes":delete e.dataset.sourced;const
|
|
65
|
+
`;hows=[];rationaleKept=!0;sourceKept=!0;choices={};wording;sourceWording;shown;mark;window;static count=0;anchor=`--rr0-basis-${++w.count}`;set anchorKey(e){this.anchor=`--rr0-basis-${e.replace(/[^a-zA-Z0-9_-]/g,"-")}`,this.mark?.style.setProperty("anchor-name",this.anchor)}build(){if(this.mark)return;const e=document.createElement("span");e.className="basis-mark",e.setAttribute("role","button"),e.tabIndex=0,e.style.setProperty("anchor-name",this.anchor);const t=i=>{i.preventDefault(),i.stopPropagation(),this.open()};e.addEventListener("click",t),e.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&t(i)}),this.append(e),this.mark=e,this.say()}connectedCallback(){this.build()}set messages(e){this.wording=e,this.say()}set sourceMessages(e){this.sourceWording=e}get entry(){return this.shown}set entry(e){this.shown=e&&(e.basis!=="stated"||e.how!==void 0||e.rationale!==void 0||e.source!==void 0)?{...e}:void 0,this.say()}get pill(){return this.build(),this.mark}say(){const e=this.mark,t=this.wording;if(!e||!t)return;const i=this.shown?.basis??"stated";e.dataset.basis=i,this.dataset.basis=i,e.textContent!==t.basis[i]&&(e.textContent=t.basis[i]),this.shown?.source?e.dataset.sourced="yes":delete e.dataset.sourced;const n=this.rationaleRead();e.title=n?`${t.title} : ${n}`:t.title,e.setAttribute("aria-label",`${t.title} : ${t.basis[i]}`)}rationaleRead(){return new M(D.preferencesFor(this)).read(this.shown?.rationale)}rationaleLanguage(){return V(D.preferencesFor(this),U)}static rationaleWritten(e,t,i){if(e===void 0||typeof e=="string")return t?{rationale:t}:{};const n=Object.fromEntries(Object.entries(e).filter(([o])=>o!==i)),s=t?{...n,[i]:t}:n;return Object.keys(s).length>0?{rationale:s}:{}}open(){const e=this.wording;if(!e)return;const t=Object.assign(document.createElement("h3"),{textContent:e.title}),i=document.createElement("select");for(const u of["established","measured","stated","derived","assumed","fitted"])i.append(new Option(e.basis[u],u));i.value=this.shown?.basis??"stated";const n=document.createElement("select");n.append(new Option("—",""));for(const u of this.hows)n.append(new Option(u.label,u.value));n.value=this.shown?.how??"";const s=document.createElement("textarea");s.value=this.rationaleRead()??"";const o=(u,p)=>{const m=document.createElement("label");return m.append(Object.assign(document.createElement("span"),{textContent:u}),p),m};let a=()=>this.shown?.source;const d=()=>{const u=i.value,p=a();this.entry={basis:u,...n.value?{how:n.value}:{},...w.rationaleWritten(this.shown?.rationale,s.value.trim(),this.rationaleLanguage()),...p?{source:p}:{}},this.dispatchEvent(new CustomEvent("basischange",{detail:{entry:this.shown},bubbles:!0,composed:!0}))};n.addEventListener("change",d),s.addEventListener("change",d);const r=document.createElement("div");r.className="basis-source";const c=()=>{a=this.drawSource(r,i.value,o,()=>d())};i.addEventListener("change",()=>{c(),d()});const l=this.windowElement(),h=this.sourceKept&&this.sourceWording!==void 0;h&&c(),l.replaceChildren(t,o(e.basisField,i),...this.hows.length>0?[o(e.howField,n)]:[],...this.rationaleKept?[o(e.rationaleField,s)]:[],...h?[r]:[]),E.popover(l,e.title),typeof l.showPopover=="function"&&l.isConnected?l.showPopover():l.hidden=!1}static kindOf(e){return e?.said?"said":e?.picture?"picture":e?.document!==void 0||e?.at||e?.url?"document":e?.tool?"tool":"none"}drawSource(e,t,i,n){const s=this.sourceWording;if(!s)return e.replaceChildren(),()=>{};if(j.free({basis:t}))return e.replaceChildren(Object.assign(document.createElement("p"),{className:"basis-source-free",textContent:s.free})),()=>{};const o=this.choices.interviews??[],a=this.choices.pictures??[],d=["none",...o.length>0?["said"]:[],"document",...a.length>0?["picture"]:[],"tool"],r=document.createElement("select");for(const m of d)r.append(new Option(s.kinds[m],m));const c=this.shown?.source,l=w.kindOf(c);r.value=d.includes(l)?l:"none";const h=document.createElement("div");let u=()=>{};const p=()=>{u=this.drawSourceFields(h,r.value,c,i,n)};return r.addEventListener("change",()=>{p(),n()}),p(),e.replaceChildren(i(s.field,r),h),()=>u()}drawSourceFields(e,t,i,n,s){const o=this.sourceWording,a=(t===w.kindOf(i)?i:void 0)??{},d=c=>{const l=document.createElement("input");return l.type="text",l.value=c??"",l.addEventListener("change",s),l},r=c=>c.value.trim()||void 0;if(t==="said"){const c=this.choices.interviews??[],l=document.createElement("select");for(const p of c)l.append(new Option(p.id===void 0?o.interviewOnly:p.label,p.id??""));l.value=a.said?.interview??c[0]?.id??"",l.selectedIndex<0&&c.length===1&&(l.selectedIndex=0);const h=document.createElement("select"),u=()=>{const p=c.find(m=>(m.id??"")===l.value)??c[0];h.replaceChildren(...(p?.segments??[]).map(m=>new Option(m.label||o.segmentUnnamed.replace("{n}",String(m.index+1)),String(m.index)))),a.said&&h.querySelector(`option[value="${a.said.segment}"]`)&&(h.value=String(a.said.segment))};return u(),l.addEventListener("change",()=>{u(),s()}),h.addEventListener("change",s),e.replaceChildren(n(o.interviewField,l),n(o.segmentField,h)),()=>{if(h.value==="")return;const p=c.find(m=>(m.id??"")===l.value);return{said:{...p?.id!==void 0?{interview:p.id}:{},segment:Number(h.value),...a.said?.range?{range:a.said.range}:{}}}}}if(t==="picture"){const c=this.choices.pictures??[],l=document.createElement("select");l.append(new Option("—",""));for(const h of c)l.append(new Option(h.label,h.id));return l.value=a.picture??"",l.addEventListener("change",s),e.replaceChildren(n(o.pictureField,l)),()=>l.value?{picture:l.value}:void 0}if(t==="tool"){const c=d(a.tool);return e.replaceChildren(n(o.toolField,c)),()=>r(c)?{tool:r(c)}:void 0}if(t==="document"){const c=d(typeof a.document=="string"?a.document:void 0),l=d(a.at),h=d(a.url);return e.replaceChildren(n(o.documentField,c),n(o.atField,l),n(o.urlField,h)),()=>{const u={...r(c)?{document:r(c)}:{},...r(l)?{at:r(l)}:{},...r(h)?{url:r(h)}:{}};return typeof a.document=="object"&&a.document!==null&&r(c)===void 0?Object.keys(u).length>0||a.document?{...u,document:a.document}:void 0:Object.keys(u).length>0?u:void 0}}return e.replaceChildren(),()=>{}}windowElement(){if(this.window)return this.window;const e=document.createElement("div");e.className="basis-window",e.setAttribute("popover",""),e.setAttribute("role","dialog"),e.style.setProperty("position-anchor",this.anchor),e.addEventListener("toggle",i=>{i.newState==="closed"&&(e.remove(),this.window=void 0)});const t=this.getRootNode();return t instanceof ShadowRoot?t.append(e):(t instanceof Document?t.body:this).append(e),this.window=e,e}get openWindow(){return this.window}}function H(){customElements.get(w.TAG)||customElements.define(w.TAG,w)}const G="rr0-input-position",W={positionRelative:"relative",positionAbsolute:"absolute",positionModeHint:"Click to say it the other way: from something else, or as a latitude and a longitude",positionNoPlace:"The recording has no place yet: give the observer a latitude and a longitude first",positionFrom:"from",positionObserver:"the observer",positionEast:"East",positionNorth:"North",positionLatitude:"Latitude",positionLongitude:"Longitude",positionLabel:"Position",positionBasisHint:"Where this position comes from",positionBasisStated:"stated",positionBasisEstablished:"established",positionBasisMeasured:"measured",positionBasisDerived:"derived",positionBasisAssumed:"assumed",positionBasisFitted:"fitted",positionBasisField:"Basis"},z=`${w.CSS}
|
|
66
66
|
rr0-input-position { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3em .5em; }
|
|
67
67
|
/* As the date's own switch (see DateInputElement): it reads as part of the label, before the fields. */
|
|
68
68
|
rr0-input-position .position-mode { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-decoration: underline; text-underline-offset: .15em; }
|
|
@@ -80,12 +80,12 @@ rr0-input-position .position-geo input[type="number"] { width: 9.5em; }
|
|
|
80
80
|
rr0-input-position .position-basis { order: -2; }
|
|
81
81
|
rr0-input-position .position-mode { order: -1; }
|
|
82
82
|
rr0-input-position [hidden] { display: none !important; }
|
|
83
|
-
`;class x extends HTMLElement{modeButton;fromRow;fromSelect;localRow;geoRow;eastField;northField;latField;lngField;basisSelect;eastLabel;northLabel;latLabel;lngLabel;wording=W;shownFrame={references:[]};shownValue;shownBasis;relativeShown=!0;referenceId;build(){if(this.modeButton)return;const e=this.getAttribute("name")??"position",t=this.ownerDocument,i=t.createElement("style");i.textContent=z;const
|
|
83
|
+
`;class x extends HTMLElement{modeButton;fromRow;fromSelect;localRow;geoRow;eastField;northField;latField;lngField;basisSelect;eastLabel;northLabel;latLabel;lngLabel;wording=W;shownFrame={references:[]};shownValue;shownBasis;relativeShown=!0;referenceId;build(){if(this.modeButton)return;const e=this.getAttribute("name")??"position",t=this.ownerDocument,i=t.createElement("style");i.textContent=z;const n=t.createElement("button");n.type="button",n.className="position-mode",n.addEventListener("click",()=>this.setRelative(!this.relativeShown));const s=t.createElement("span");s.className="position-from";const o=t.createElement("span");o.className="position-from-text";const a=t.createElement("select");a.id=`${e}-from`,a.addEventListener("input",()=>this.pickReference(a.value)),s.append(o,a);const d=this.getAttribute("step")??"0.1",r=(b,S,B,F)=>{const k=t.createElement("input");return k.type="number",k.id=b,k.min=String(S),k.max=String(B),k.step=F,k.autocomplete="off",k},c=(b,S)=>{const B=t.createElement("label");B.className="position-axis";const F=t.createElement("span");return B.append(F,b,S),{row:B,label:F}},l=Number(this.getAttribute("range")??3e4),h=r(this.getAttribute("east-id")??`${e}-east`,-l,l,d),u=r(this.getAttribute("north-id")??`${e}-north`,-l,l,d),p=r(this.getAttribute("lat-id")??`${e}-lat`,-90,90,"0.000001"),m=r(this.getAttribute("lng-id")??`${e}-lng`,-180,180,"0.000001"),O=t.createElement("span");O.className="position-local";const N=c(h,"m"),$=c(u,"m");O.append(N.row,$.row);const C=t.createElement("span");C.className="position-geo";const P=c(p,"°"),T=c(m,"°");C.append(P.row,T.row);for(const b of[h,u])b.addEventListener("input",()=>this.typedLocal());for(const b of[p,m])b.addEventListener("input",()=>this.typedGeo());H();const y=t.createElement(w.TAG);y.id=`${e}-basis`,y.className="position-basis",y.rationaleKept=!1,y.sourceKept=!1,y.anchorKey=`${e}-basis`,y.addEventListener("basischange",b=>{b.stopPropagation();const S=b.detail.entry;this.shownBasis=S?.basis==="stated"?void 0:S?.basis,this.dispatchEvent(new CustomEvent("basischange",{detail:{basis:this.shownBasis},bubbles:!0,composed:!0}))}),this.append(i,n,s,O,C,y),this.modeButton=n,this.fromRow=s,this.fromSelect=a,this.localRow=O,this.geoRow=C,this.eastField=h,this.northField=u,this.latField=p,this.lngField=m,this.basisSelect=y,this.eastLabel=N.label,this.northLabel=$.label,this.latLabel=P.label,this.lngLabel=T.label,this.relativeShown=!this.isGeo,this.word(),this.show()}connectedCallback(){this.build()}get isGeo(){return this.getAttribute("native")==="geo"}get eastInput(){return this.build(),this.eastField}get northInput(){return this.build(),this.northField}get latInput(){return this.build(),this.latField}get lngInput(){return this.build(),this.lngField}get frame(){return this.shownFrame}set frame(e){this.shownFrame=e,this.build(),this.pullDegrees(),this.show()}get value(){return this.shownValue}set value(e){if(this.shownValue=e,this.build(),this.isGeo){const t=e;this.latField.value=t?String(f.degrees(t.lat)):"",this.lngField.value=t?String(f.degrees(t.lng)):""}this.show()}set said(e){this.build(),this.pullDegrees(),f.isRelative(e)?(this.relativeShown=!0,this.referenceId=e.relativeTo):f.isAbsolute(e)?this.relativeShown=!1:(this.relativeShown=!this.isGeo,this.referenceId=void 0),this.show()}get said(){const e=this.localValue();if(e)return f.restated(this.relativeShown?f.relative(0,0,this.referenceId):{lat:0,lng:0},e,this.shownFrame)}get relative(){return this.relativeShown}get basis(){return this.shownBasis}set basis(e){this.shownBasis=e==="stated"?void 0:e,this.build(),this.markBasis()}set basisShown(e){this.build(),this.basisSelect.hidden=!e}set messages(e){this.wording=e,this.modeButton&&(this.word(),this.show())}setRelative(e){!this.shownFrame.origin||this.references().length===0||(this.pullDegrees(),this.relativeShown=e,this.show())}pullDegrees(){if(!this.isGeo||!this.latField)return;const e=x.typed(this.latField),t=x.typed(this.lngField);this.shownValue=e!==void 0&&t!==void 0?{lat:e,lng:t}:this.latField.value===""&&this.lngField.value===""?void 0:this.shownValue}word(){const e=this.wording;this.eastLabel.textContent=e.positionEast,this.northLabel.textContent=e.positionNorth,this.latLabel.textContent=e.positionLatitude,this.lngLabel.textContent=e.positionLongitude,this.fromRow.querySelector(".position-from-text").textContent=e.positionFrom,this.basisSelect.messages={title:e.positionBasisHint,basisField:e.positionBasisField,howField:"",rationaleField:"",basis:{established:e.positionBasisEstablished,stated:e.positionBasisStated,measured:e.positionBasisMeasured,derived:e.positionBasisDerived,assumed:e.positionBasisAssumed,fitted:e.positionBasisFitted}},this.markBasis()}markBasis(){this.basisSelect&&(this.basisSelect.entry=this.shownBasis?{basis:this.shownBasis}:void 0)}references(){const e=this.shownFrame.references;return e.length>0||this.isGeo?e:[{label:this.wording.positionObserver,eastM:0,northM:0}]}reference(){const e=this.references();return e.find(t=>t.id===this.referenceId)??e[0]??{label:"",eastM:0,northM:0}}localValue(){const e=this.shownValue;if(!e)return;if(!this.isGeo)return e;const t=this.shownFrame.origin;return t?f.toLocal(e,t):void 0}geoValue(){const e=this.shownValue;if(!e)return;if(this.isGeo)return e;const t=this.shownFrame.origin;return t?f.toGeo(e,t):void 0}show(){if(!this.modeButton)return;const e=this.wording,t=this.shownFrame.origin!==void 0&&this.references().length>0;t||(this.relativeShown=!this.isGeo);const i=this.modeButton;i.textContent=this.relativeShown?e.positionRelative:e.positionAbsolute,i.disabled=!t,i.title=t?e.positionModeHint:e.positionNoPlace;const n=this.references(),s=this.fromSelect,o=n.map(h=>h.id??"");([...s.options].map(h=>h.value).join(`
|
|
84
84
|
`)!==o.join(`
|
|
85
|
-
`)||[...
|
|
86
|
-
`)!==
|
|
87
|
-
`))&&
|
|
85
|
+
`)||[...s.options].map(h=>h.text).join(`
|
|
86
|
+
`)!==n.map(h=>h.label).join(`
|
|
87
|
+
`))&&s.replaceChildren(...n.map(h=>new Option(h.label,h.id??""))),this.referenceId!==void 0&&!n.some(h=>h.id===this.referenceId)&&(this.referenceId=void 0),s.value=this.referenceId??o[0]??"",this.fromRow.hidden=!this.relativeShown,this.localRow.hidden=!this.relativeShown,this.geoRow.hidden=this.relativeShown;const a=this.getRootNode().activeElement,d=(h,u)=>{h!==a&&(h.value=u===void 0?"":String(u))},r=this.localValue(),c=this.reference();if(d(this.eastField,r?f.metres(r.eastM-c.eastM):void 0),d(this.northField,r?f.metres(r.northM-c.northM):void 0),this.isGeo&&!this.relativeShown)return;const l=this.geoValue();d(this.latField,l?f.degrees(l.lat):void 0),d(this.lngField,l?f.degrees(l.lng):void 0)}pickReference(e){this.pullDegrees(),this.referenceId=e===""?void 0:e,this.show();const t=this.said;t&&this.shownValue&&this.tell(this.shownValue,t)}static typed(e){const t=e.value.trim(),i=t===""?NaN:Number(t);return Number.isFinite(i)?i:void 0}typedLocal(){const e=x.typed(this.eastField),t=x.typed(this.northField);if(e===void 0||t===void 0)return;const i=this.reference(),n={eastM:i.eastM+e,northM:i.northM+t};let s=n;if(this.isGeo){const o=this.shownFrame.origin;if(!o)return;s=f.toGeo(n,o)}this.shownValue=s,this.tell(s,f.relative(e,t,this.referenceId))}typedGeo(){const e=x.typed(this.latField),t=x.typed(this.lngField);if(e===void 0||t===void 0)return;let i={lat:e,lng:t};if(!this.isGeo){const n=this.shownFrame.origin;if(!n)return;i=f.toLocal({lat:e,lng:t},n)}this.shownValue=i,this.tell(i,{lat:e,lng:t})}tell(e,t){this.show();const i=this.isGeo?f.isAbsolute(t):f.isRelative(t)&&t.relativeTo===void 0;this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:e,said:i?void 0:t},bubbles:!0,composed:!0}))}}function Y(){customElements.get(G)||customElements.define(G,x)}class R{constructor(e,t,i=()=>{},n){this.read=e,this.edit=t,this.context=i,this.place=n}static inPlace(e){return new R(()=>e,t=>t(e))}}class L{constructor(e,t,i="",n,s){this.container=e,this.idPrefix=i,this.values=n,this.enhance=s,this.said=new M([t,"en"])}set;target;changed=()=>{};said;setLanguage(e){this.said=new M([e,"en"]),this.set&&this.target&&this.show(this.set,this.target,this.changed)}show(e,t,i){this.set=e,this.target=t instanceof R?t:R.inPlace(t),this.changed=i,this.container.replaceChildren();const n=new Map;for(const s of e.parameters){const o=this.read(s.group)??"";let a=n.get(o);if(!a){if(a=document.createElement("fieldset"),a.className="parameter-group",o!==""){const d=document.createElement("legend");d.textContent=o,a.append(d)}else a.classList.add("parameter-group-untitled"),a.style.border="0",a.style.padding="0",a.style.marginInline="0";n.set(o,a),this.container.append(a)}a.append(this.fieldOf(s))}v.fit(this.container),this.sync()}clear(){this.set=void 0,this.target=void 0,this.container.replaceChildren()}field(e){return this.container.querySelector(`[data-key="${e}"]`)??void 0}sync(e=!1){const t=this.target?.read();if(!this.set||!t)return;const i=this.target.context(),n=e?null:this.container.getRootNode().activeElement;for(const s of this.set.parameters){const o=s.type==="position"?this.positionOf(s):this.field(s.key);if(!o)continue;const a=o.closest("label, .parameter-row")??o;a.hidden=s.visibleWhen!==void 0&&!s.visibleWhen(t,i);const d=g.read(t,s.key);if(s.type==="number"){const r=o;r!==n&&(r.value=typeof d=="number"?L.shown(d,s):"");const c=L.boundsOf(s,t,i);r.min=String(c.min),r.max=String(c.max);const l=s.effective?.(t,i);r.placeholder=l!==void 0?L.shown(l,s):this.read(s.placeholder)??"",r.classList.toggle("parameter-derived",d===void 0)}else if(s.type==="choice"){const r=o,c=s.optionsOf?.(t,i)??s.choices;if([...r.options].filter(l=>l.value!=="").map(l=>l.value).join(`
|
|
88
88
|
`)!==c.map(l=>l.value).join(`
|
|
89
|
-
`)&&r.replaceChildren(...
|
|
89
|
+
`)&&r.replaceChildren(...s.required?[]:[new Option("—","")],...c.map(l=>new Option(this.read(l.label)??l.value,l.value))),r!==n&&(r.value=typeof d=="string"&&c.some(l=>l.value===d)?d:s.required?r.options[0]?.value??"":""),!s.required){const l=s.effective?.(t,i),h=c.find(u=>u.value===l);r.options[0].textContent=h?this.read(h.label)??h.value:this.read(s.empty)??"—"}}else if(s.type==="boolean"){const r=o;r.checked=d===!0}else if(s.type==="colour"){const r=o;r!==n&&(r.value=L.swatchOf(d,s.effective?.(t,i)??s.fallback??"#808080"))}else if(s.type==="set")this.syncSet(s,o,t,i);else if(s.type==="position")this.syncPosition(s,o,t);else if(s.type==="said"){const r=o;r!==n&&(r.value=this.values?.said().read(g.read(t,s.key))??""),this.markMissing(s,r)}else{const r=o;r!==n&&(r.value=typeof d=="string"?d:"",r.classList.remove("invalid"),r.removeAttribute("aria-invalid"))}}for(const s of this.container.querySelectorAll("fieldset.parameter-group"))s.hidden=[...s.querySelectorAll("label, .parameter-row")].filter(o=>o.parentElement===s).every(o=>o.hidden)}fieldOf(e){const t=document.createElement("label"),i=this.read(e.hint);i&&(t.title=i);const n=document.createElement("span");n.textContent=this.read(e.label)??e.key,t.append(n," ");let s;if(e.type==="choice"){const o=document.createElement("select");this.identify(o,e),e.required||o.append(new Option("—","")),o.append(...e.choices.map(a=>new Option(this.read(a.label)??a.value,a.value))),o.addEventListener("input",()=>this.write(e,o.value===""?void 0:o.value)),t.append(o),this.enhance?.(e,o)}else{if(e.type==="position")return this.setRow(e,this.positionFieldOf(e));if(e.type==="set"){const o=document.createElement("div");return this.identify(o,e),o.className="parameter-set",o.addEventListener("input",()=>{const a=[...o.querySelectorAll("input:checked")].map(d=>d.value);this.write(e,a.length>0?a:void 0)}),this.setRow(e,o)}else if(e.type==="boolean"){const o=document.createElement("input");o.type="checkbox",this.identify(o,e),o.addEventListener("input",()=>this.write(e,o.checked?!0:e.required?!1:void 0)),t.prepend(o),t.append(" ")}else{const o=document.createElement("input");this.identify(o,e),o.autocomplete="off",e.type==="number"?(o.type="number",o.min=String(e.min),o.max=String(e.max),o.step=String(e.step),s=e.unit,o.addEventListener("input",()=>{const a=o.value.trim();if(a==="")return e.required?void 0:this.write(e,void 0);const d=Number(a);Number.isFinite(d)&&this.write(e,d)})):e.type==="colour"?(o.type="color",o.addEventListener("input",()=>this.write(e,o.value))):e.type==="said"?(o.type="text",o.placeholder=this.read(e.placeholder)??"",o.style.setProperty("field-sizing","content"),o.style.minWidth="10em",o.style.maxWidth="100%",o.addEventListener("input",()=>{const a=this.target?.read(),d=this.values;!a||!d||(this.write(e,d.said().write(g.read(a,e.key),o.value,d.writingLanguage())),this.markMissing(e,o))})):(o.type="text",o.placeholder=this.read(e.placeholder)??"",o.addEventListener("input",()=>{const a=e.required||e.validate?o.value.trim():o.value,d=this.target?.read(),r=d!==void 0&&(e.required===!0&&a===""||a!==""&&e.validate?.(a,d,this.target.context())===!1);o.classList.toggle("invalid",r),r?o.setAttribute("aria-invalid","true"):o.removeAttribute("aria-invalid"),!r&&this.write(e,a===""?void 0:a)}),o.addEventListener("change",()=>{if(!o.classList.contains("invalid"))return;o.classList.remove("invalid"),o.removeAttribute("aria-invalid");const a=this.target?.read(),d=a===void 0?void 0:g.read(a,e.key);o.value=typeof d=="string"?d:""})),t.append(o)}}return s&&t.append(` ${s}`),t}markMissing(e,t){e.type!=="said"||!e.required||(t.classList.toggle("invalid",t.value===""),t.setAttribute("aria-invalid",String(t.value==="")))}positionFieldOf(e){Y();const t=document.createElement("rr0-input-position"),i=`${this.idPrefix}${e.key}`;t.setAttribute("name",i),e.native==="geo"&&t.setAttribute("native","geo"),e.step!==void 0&&t.setAttribute("step",String(e.step)),e.rangeM!==void 0&&t.setAttribute("range",String(e.rangeM));const n=e.native==="geo"?["lat-id","lng-id"]:["east-id","north-id"];this.idPrefix!==""&&(t.setAttribute(n[0],`${this.idPrefix}${e.key}`),t.setAttribute(n[1],`${this.idPrefix}${e.secondKey}`)),t.dataset.position=e.key,t.build();const[s,o]=e.native==="geo"?[t.latInput,t.lngInput]:[t.eastInput,t.northInput];s.dataset.key=e.key,o.dataset.key=e.secondKey;const a=this.target?.place;return a&&(t.messages=a.messages()),t.basisShown=a?.basis!==void 0,t.addEventListener("positionchange",d=>{const{value:r,said:c}=d.detail;this.writePosition(e,r,c)}),t.addEventListener("basischange",d=>this.target?.place?.basis?.write(e,d.detail.basis)),t}positionOf(e){return this.container.querySelector(`rr0-input-position[data-position="${e.key}"]`)??void 0}syncPosition(e,t,i){const n=this.target?.place;n&&(t.messages=n.messages(),t.frame=n.frame());const s=g.read(i,e.key),o=g.read(i,e.secondKey),a=typeof s=="number"&&typeof o=="number";t.value=a?e.native==="geo"?{lat:s,lng:o}:{eastM:s,northM:o}:void 0;const d=g.read(i,e.saidKey),r=JSON.stringify(d??null);t.dataset.said!==r&&(t.dataset.said=r,t.said=d),t.basis=n?.basis?.read(e)}writePosition(e,t,i){const n=this.target;if(!n)return;const[s,o]="lat"in t?[t.lat,t.lng]:[t.eastM,t.northM],a=e.native==="geo"?d=>Math.round(d*1e7)/1e7:d=>Math.round(d*1e3)/1e3;this.positionOf(e)?.setAttribute("data-said",JSON.stringify(i??null)),n.edit(d=>{g.write(d,e.key,a(s)),g.write(d,e.secondKey,a(o)),g.write(d,e.saidKey,i)},e),this.changed(),this.sync()}setRow(e,t){const i=document.createElement("div");i.className="parameter-row";const n=this.read(e.hint);n&&(i.title=n);const s=document.createElement("span");return s.textContent=this.read(e.label)??e.key,i.append(s," ",t),i}syncSet(e,t,i,n){if(e.type!=="set")return;const s=g.read(i,e.key),o=new Set(Array.isArray(s)?s:[]),a=e.options(i,n);if(a.length===0){t.textContent=this.read(e.empty)??"";return}[...t.querySelectorAll("input")].map(r=>r.value).join(`
|
|
90
90
|
`)===a.map(r=>r.value).join(`
|
|
91
|
-
`)||t.replaceChildren(...a.map(r=>{const c=document.createElement("label"),l=document.createElement("input");return l.type="checkbox",l.value=r.value,c.append(l," ",r.label),c}));for(const r of t.querySelectorAll("input"))r.checked=o.has(r.value)}identify(e,t){e.dataset.key=t.key,this.idPrefix!==""&&(e.id=`${this.idPrefix}${t.key}`)}write(e,t){const i=this.target;if(!i)return;let
|
|
91
|
+
`)||t.replaceChildren(...a.map(r=>{const c=document.createElement("label"),l=document.createElement("input");return l.type="checkbox",l.value=r.value,c.append(l," ",r.label),c}));for(const r of t.querySelectorAll("input"))r.checked=o.has(r.value)}identify(e,t){e.dataset.key=t.key,this.idPrefix!==""&&(e.id=`${this.idPrefix}${t.key}`)}write(e,t){const i=this.target;if(!i)return;let n=t;if(e.type==="number"&&typeof t=="number"){const s=i.read();if(s){const o=L.boundsOf(e,s,i.context());n=Math.max(o.min,Math.min(o.max,t))/(e.scale??1)}}i.edit(s=>g.write(s,e.key,n),e),this.changed(),this.sync()}read(e){return this.said.read(e)}static boundsOf(e,t,i){const n=e.bounds?.(t,i);return{min:n?.min??e.min,max:n?.max??e.max}}static swatchOf(e,t){if(typeof e!="string")return t;const i=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);return i?`#${i[1]}${i[1]}${i[2]}${i[2]}${i[3]}${i[3]}`.toLowerCase():/^#[0-9a-f]{6}$/i.test(e)?e.toLowerCase():t}static shown(e,t){const i=Math.max(2,Math.min(6,(String(t.step).split(".")[1]??"").length));return String(Number((e*(t.scale??1)).toFixed(i)))}static choicesOf(e){return e.choices.map(t=>t.value)}}export{A as E,L as P,X as S,R as a};
|