@rr0/ufoathome 0.185.1 → 0.185.2
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/{AdsbLolArchiveProvider-B0Yi081_.js → AdsbLolArchiveProvider-CzTJVwX_.js} +1 -1
- package/dist-embed-scene/{BeamEditor-DXIKipID.js → BeamEditor-B1rrWZ8t.js} +1 -1
- package/dist-embed-scene/{BeamSystem-ebEMoYD3.js → BeamSystem-BxfhSMvb.js} +1 -1
- package/dist-embed-scene/ControlPasses-X_kTXa-p.js +29 -0
- package/dist-embed-scene/{Flightradar24Provider-CpwhYfIE.js → Flightradar24Provider-ae0_oe2g.js} +1 -1
- package/dist-embed-scene/{GLTFLoader-BxToReDu.js → GLTFLoader-CZ-8eVJ4.js} +1 -1
- package/dist-embed-scene/{LanternEditor-JvQQ8GOQ.js → LanternEditor-DbaHa2ey.js} +1 -1
- package/dist-embed-scene/{LaserBeam-B48FKTrt.js → LaserBeam-DW1f0LPn.js} +1 -1
- package/dist-embed-scene/{LaunchEditor-DIxYPs4d.js → LaunchEditor-M8G5W83U.js} +2 -2
- package/dist-embed-scene/{LaunchPlume-FP3Yk-8B.js → LaunchPlume-BtEO63Vx.js} +1 -1
- package/dist-embed-scene/{LaunchSimulation-v4khqz4r.js → LaunchSimulation-xgRnC8OK.js} +1 -1
- package/dist-embed-scene/{ModuleSession-CLUE46BO.js → ModuleSession-BGUJHOk9.js} +2 -2
- package/dist-embed-scene/ModuleThree-BljKXj42.js +1 -0
- package/dist-embed-scene/{ParameterForm-BFp5BoHL.js → ParameterForm-DMplRkcQ.js} +6 -6
- package/dist-embed-scene/{ReentryEditor-ByVtt--5.js → ReentryEditor-FFxrv4q7.js} +1 -1
- package/dist-embed-scene/{ReentrySimulation-nzg5V3kJ.js → ReentrySimulation-xFQ_R53U.js} +1 -1
- package/dist-embed-scene/{ReferenceSystem-D9IdSvFM.js → ReferenceSystem-Dyc08-lR.js} +1 -1
- package/dist-embed-scene/{SceneNames_en-BSE4vlLT.js → SceneNames_en-CIzANCLW.js} +1 -1
- package/dist-embed-scene/{SceneNames_es-CZyu8Wnr.js → SceneNames_es-DntR6o9V.js} +1 -1
- package/dist-embed-scene/{SceneNames_fr-CphfTjGw.js → SceneNames_fr-7wmERMPd.js} +1 -1
- package/dist-embed-scene/{SceneNames_it-DQ_cY7aP.js → SceneNames_it-Bxtenoxp.js} +1 -1
- package/dist-embed-scene/{TimelineTracks-BOjTfdGu.js → TimelineTracks-CZBILU3f.js} +2 -2
- package/dist-embed-scene/{UfoMessages_en-CXQNZd8v.js → UfoMessages_en-AS8tBKJW.js} +1 -1
- package/dist-embed-scene/rr0-scene.mjs +241 -241
- package/dist-embed-sighting/{AdsbLolArchiveProvider-BqLvFUVC.js → AdsbLolArchiveProvider-D9EKDsic.js} +1 -1
- package/dist-embed-sighting/{BeamEditor-CcOf6lNz.js → BeamEditor-Cod7HUNj.js} +2 -2
- package/dist-embed-sighting/{BeamSystem-B5d0Ymn5.js → BeamSystem-BZ2f4hh1.js} +1 -1
- package/dist-embed-sighting/{CaseReportExport-TKaz2rai.js → CaseReportExport-Drb2dd78.js} +1 -1
- package/dist-embed-sighting/ControlPasses-BnlLorfW.js +29 -0
- package/dist-embed-sighting/{Flightradar24Provider-DQtEJ3tX.js → Flightradar24Provider-DQ-bvlMM.js} +1 -1
- package/dist-embed-sighting/{GLTFLoader-VIIHsteW.js → GLTFLoader-DPrksej_.js} +1 -1
- package/dist-embed-sighting/{LanternEditor-D1BA5pRP.js → LanternEditor-9zPknaGj.js} +1 -1
- package/dist-embed-sighting/{LaserBeam-BjjC_CzP.js → LaserBeam-CFUYJu2F.js} +1 -1
- package/dist-embed-sighting/{LaunchEditor-TTSgWqbE.js → LaunchEditor-GiZERDOz.js} +1 -1
- package/dist-embed-sighting/{LaunchPlume-B2Fjd2_C.js → LaunchPlume-CuDQMA8K.js} +1 -1
- package/dist-embed-sighting/{LaunchSimulation-BcmPicEe.js → LaunchSimulation-Fpwvzpf1.js} +1 -1
- package/dist-embed-sighting/{ModuleSession-CY9_UusZ.js → ModuleSession-CY6DsJx0.js} +2 -2
- package/dist-embed-sighting/ModuleThree-EigESy50.js +1 -0
- package/dist-embed-sighting/{ParameterForm-BaUeWd7v.js → ParameterForm-BHITM-mQ.js} +1 -1
- package/dist-embed-sighting/{ReentryEditor-CGN3ewTE.js → ReentryEditor-C_AN8aTr.js} +1 -1
- package/dist-embed-sighting/{ReentrySimulation-C2kIulZ6.js → ReentrySimulation-sBnymskP.js} +1 -1
- package/dist-embed-sighting/{ReferenceSystem-BRTCOQHk.js → ReferenceSystem-Cn6gWxGT.js} +1 -1
- package/dist-embed-sighting/{TimelineTracks-Ddv5sZHp.js → TimelineTracks-B7EcGLEf.js} +1 -1
- package/dist-embed-sighting/rr0-sighting.mjs +273 -273
- package/dist-embed-sighting-editor/{CaseReportExport-7rLVAHxs.js → CaseReportExport-COqBs7VN.js} +1 -1
- package/dist-embed-sighting-editor/ControlPasses-BsZQ-_CW.js +29 -0
- package/dist-embed-sighting-editor/{GLTFLoader-CJy8wjmO.js → GLTFLoader-D7spTlJl.js} +1 -1
- package/dist-embed-sighting-editor/{ModuleConformance-B8OYKQop.js → ModuleConformance-D7QNv2-c.js} +2 -2
- package/dist-embed-sighting-editor/{ModuleSession-BQSTCqob.js → ModuleSession-DTZs4At5.js} +2 -2
- package/dist-embed-sighting-editor/ModuleThree-COSQVAvF.js +1 -0
- package/dist-embed-sighting-editor/{ModulesPanelElement-CZcbo6lq.js → ModulesPanelElement-9x7kP_Tx.js} +3 -3
- package/dist-embed-sighting-editor/{ReferenceSystem-BxKEbMVI.js → ReferenceSystem-ZQRGSWgC.js} +1 -1
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +278 -278
- package/package.json +1 -1
- package/dist-embed-scene/ControlPasses-BMma2JRm.js +0 -29
- package/dist-embed-scene/ModuleThree-DQfMGMDy.js +0 -1
- package/dist-embed-sighting/ControlPasses-BxgSO3B9.js +0 -29
- package/dist-embed-sighting/ModuleThree-BhryLUjX.js +0 -1
- package/dist-embed-sighting-editor/ControlPasses-oqSnNDq6.js +0 -29
- package/dist-embed-sighting-editor/ModuleThree-DwGM2nF4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as O,
|
|
1
|
+
import{R as O,br as D,bs 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,aF as b,aG as E,aK as g,bs as w}from"./rr0-sighting.mjs";import{S as j,P as x,E as k,a as v}from"./ParameterForm-BaUeWd7v.js";import{L as T}from"./LaunchPlume-B2Fjd2_C.js";import{T as I}from"./TimelineTracks-Ddv5sZHp.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,aG as b,aH as E,aL as g,bt as w}from"./rr0-sighting.mjs";import{S as j,P as x,E as k,a as v}from"./ParameterForm-BHITM-mQ.js";import{L as T}from"./LaunchPlume-CuDQMA8K.js";import{T as I}from"./TimelineTracks-B7EcGLEf.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{bw as k,bx as F,by as v,bz 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 k(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(w=>w/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-CuDQMA8K.js";import{G as T,E as z,N as f,x as C,bu as w,bv 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-EigESy50.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-EigESy50.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{a2 as a,y as e,bF as s,ae as t,ag as r,az as i,a3 as o,at as n,ac as b,ad as l,aV as d,aA as u,aB as m,bG as M,K as y,ah as B,x as G,a9 as c,bb as S,b8 as f,bc as h,G as p,bp as x,J as L,bH as g,ai as C,bI as E,bJ as A,bK as D,C as P,af as T,E as F,N as V,bL as v,ay as H,al as J}from"./rr0-sighting.mjs";const N={AdditiveBlending:J,BackSide:H,BoxGeometry:v,BufferAttribute:V,BufferGeometry:F,CanvasTexture:T,Color:P,ConeGeometry:D,CylinderGeometry:A,DataTexture:E,DoubleSide:C,Euler:g,Float32BufferAttribute:L,FrontSide:x,Group:p,Line:h,LineBasicMaterial:f,LineSegments:S,Matrix4:c,Mesh:G,MeshBasicMaterial:B,MeshStandardMaterial:y,NormalBlending:M,Object3D:m,PlaneGeometry:u,PointLight:d,Points:l,PointsMaterial:b,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{N as MODULE_THREE};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aL as q,S as R,H as D,s as V,i as j,U,aM as f,aN as g}from"./rr0-sighting.mjs";class X{static attach(e,t,i){e.classList.add(t);const s=`${t}-style`;if(e.parentElement?.querySelector(`:scope > style.${s}`))return;const n=e.ownerDocument.createElement("style");n.className=s,n.textContent=i,e.before(n)}}class I{constructor(e,t,i,s){this.button=e,this.onPick=i,this.idOf=s;const n=this.panel=e.ownerDocument.createElement("div");n.id=t,n.className="add-menu",n.setAttribute("popover",""),n.setAttribute("role","menu");const o=`--add-menu-${t}`;e.style.setProperty("anchor-name",o),n.style.setProperty("position-anchor",o),e.setAttribute("popovertarget",t),e.setAttribute("aria-haspopup","menu"),e.after(n)}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) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as w,_ as u,R as v,
|
|
1
|
+
import{e as w,_ as u,R as v,aH as P,aL as b,bt as M}from"./rr0-sighting.mjs";import{S as C,P as x,a as T,E as F}from"./ParameterForm-BHITM-mQ.js";import{T as _}from"./TimelineTracks-B7EcGLEf.js";const A=w.catalog({en:()=>u(()=>import("./ReentryParameterTexts_en-BH1tGP5C.js"),[],import.meta.url).then(h=>h.reentryParameterTexts_en),fr:()=>u(()=>import("./ReentryParameterTexts_fr-C8ROK57p.js"),[],import.meta.url).then(h=>h.reentryParameterTexts_fr),es:()=>u(()=>import("./ReentryParameterTexts_es-BDMJ4K1g.js"),[],import.meta.url).then(h=>h.reentryParameterTexts_es),it:()=>u(()=>import("./ReentryParameterTexts_it-CwC8vNTI.js"),[],import.meta.url).then(h=>h.reentryParameterTexts_it)});class a{static NAME="name";static OBJECT="object";static LIGHT="light";static WHEN="when";static placeAt(e,t){const r=v.leadAt(e,t);if(r)return{t,lat:r.lat,lng:r.lng,altitudeKm:r.heightM/1e3};const i=e.track,[n,s]=t<(i[0]?.t??0)?[i[0],i[1]]:[i[i.length-2],i[i.length-1]];if(!n||!s||s.t===n.t){const d=n??s??{lat:0,lng:0,altitudeKm:80};return{t,lat:d.lat,lng:d.lng,altitudeKm:d.altitudeKm}}const l=(t-n.t)/(s.t-n.t);return{t,lat:n.lat+(s.lat-n.lat)*l,lng:n.lng+(s.lng-n.lng)*l,altitudeKm:Math.max(0,n.altitudeKm+(s.altitudeKm-n.altitudeKm)*l)}}static curvePointAt(e,t){return{t,absoluteMagnitude:Math.round(v.absoluteMagnitudeAt(e,t)*10)/10}}static instantsOf(e){return[...e.track.map(t=>t.t),...e.fragments.flatMap(t=>[...t.fromT===void 0?[]:[t.fromT],...t.untilT===void 0?[]:[t.untilT],...(t.lightCurve??[]).map(r=>r.t)])]}static instant(e,t,r,i={}){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t,hint:r,...i}}static SET={kind:"reentry",title:"fireballOrReEntry",parameters:[{type:"said",key:"title",label:a.NAME},{type:"text",key:"object.name",group:a.OBJECT,label:"catalogueName",hint:"forAReEntryThePiece"},{type:"text",key:"object.cosparId",group:a.OBJECT,label:"cosparId",placeholder:"t1968013c"},{type:"number",key:"object.norad",min:1,max:999999,step:1,group:a.OBJECT,label:"noradNumber"}]};static PLACE={kind:"reentry-place",title:"pointOfThePath",parameters:[a.instant("t","time","secondsOfTheRecordingNegativeBefore",{required:!0}),{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:1,rangeM:2e6,label:"position"},{type:"number",key:"altitudeKm",min:0,max:300,step:.1,unit:"km",required:!0,label:"altitude",hint:"aboveTheEllipsoidAMeteorBegins"}]};static trackEnd(e,t){const r=e?.track;if(r?.length)return t==="first"?r[0].t:r[r.length-1].t}static FRAGMENT={kind:"reentry-fragment",title:"piece",parameters:[{type:"text",key:"id",label:"id",validate:(e,t,r)=>!r?.fragments.some(i=>i!==t&&i.id===e)},{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,group:a.LIGHT,label:"absoluteMagnitude",hint:"itsBrightnessSeenFrom100Km"},{type:"colour",key:"color",group:a.LIGHT,fallback:v.DEFAULT_COLOR,label:"colour"},{type:"number",key:"trainS",min:0,max:600,step:.1,unit:"s",group:a.LIGHT,effective:()=>v.DEFAULT_TRAIN_S,label:"train",hint:"howLongAStretchOfIts"},{type:"number",key:"lagS",min:0,max:600,step:.1,unit:"s",group:a.WHEN,effective:()=>0,label:"behindTheLead",hint:"secondsBehindTheLeadingPointAlong"},a.instant("fromT","seenFrom","whenItBreaksOffOrBegins",{group:a.WHEN,effective:(e,t)=>a.trackEnd(t,"first")}),a.instant("untilT","outAt","whenItHasBurnedUpOr",{group:a.WHEN,effective:(e,t)=>a.trackEnd(t,"last")})]};static CURVE_POINT={kind:"reentry-curve-point",title:"pointOfTheLightCurve",parameters:[a.instant("t","time","secondsOfTheRecording",{required:!0}),{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,label:"absoluteMagnitude"}]}}const L=w.catalog({en:()=>u(()=>import("./ReentryEditorMessages_en-O-YSmHxv.js"),[],import.meta.url).then(h=>h.reentryEditorMessages_en),fr:()=>u(()=>import("./ReentryEditorMessages_fr-xuC-qZ6M.js"),[],import.meta.url).then(h=>h.reentryEditorMessages_fr),es:()=>u(()=>import("./ReentryEditorMessages_es-CvO9Jwz5.js"),[],import.meta.url).then(h=>h.reentryEditorMessages_es),it:()=>u(()=>import("./ReentryEditorMessages_it-B7vyCX9o.js"),[],import.meta.url).then(h=>h.reentryEditorMessages_it)});class m{constructor(e,t,r){this.container=e,this.host=t,C.attach(e,"reentry-editor-part",m.STYLE),this.language=r,this.ready=this.setLanguage(r)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;placeForm;placeIndex=0;row="path";fragmentForm;fragmentIndex=0;curveForm;curveIndex=0;language;shown=[];static STYLE='.reentry-editor-part { flex-basis: 100%; min-width: 0; } .reentry-editor-part #reentry-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .reentry-editor-part #reentry-path > .icon-btn, .reentry-editor-part #reentry-curve > .icon-btn { align-self: flex-end; } .reentry-editor-part #reentry-list, .reentry-editor-part #reentry-places, .reentry-editor-part #reentry-fragment-list, .reentry-editor-part #reentry-curve-list { flex-basis: 100%; min-width: 0; } .reentry-editor-part .launch-editor, .reentry-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .reentry-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .reentry-editor-part [hidden] { display: none !important; } .reentry-editor-part select { min-width: 0; width: 100%; } .reentry-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .reentry-editor-part .launch-track { flex-basis: 100%; margin: 0; } .reentry-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .reentry-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; } .reentry-editor-part input, .reentry-editor-part select { max-width: 100%; box-sizing: border-box; } .reentry-editor-part input[type="text"] { width: 12em; } .reentry-editor-part input[data-key="title"] { width: 18em; } .reentry-editor-part label { min-width: 0; max-width: 100%; } .reentry-editor-part input.parameter-derived::placeholder { opacity: .65; } .reentry-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[r,i]=await Promise.all([L.load(e),A.load(e)]);t===this.languageToken&&(this.messages=r,this.parameterTexts=i,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.reentries;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;this.element("reentry-fields").hidden=t===void 0,t&&(this.syncPlace(!0),this.syncFragments(t,!0),this.form??=new x(this.element("reentry-parameters"),this.language,"reentry.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(a.SET),new T(()=>this.current,r=>this.editReentry(i=>{i.object&&(i.object={...i.object}),r(i),i.object&&Object.values(i.object).every(n=>n===void 0||n==="")&&delete i.object})),()=>this.written()))}refresh(){if(!this.messages)return;this.syncAddState();const e=this.reentries;if(e.length===this.shown.length&&e.every((t,r)=>t.id===this.shown[r].id)){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.origin()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addNowhere)}get current(){return this.reentries.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="path",this.placeIndex=0,this.fragmentIndex=0,this.curveIndex=0,this.sync())}resolved(e){return P.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="reentry-list"></div>
|
|
4
4
|
<div id="reentry-fields" class="launch-fields">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G,
|
|
1
|
+
import{G,bA as S,ad as _,E as M,bB as R,N as w,x as F,bu as f,bv as I,a2 as N,C as y,bC as C,bD as H,bE as B,R as L}from"./rr0-sighting.mjs";class h{static RADIUS=840;static MAX_SEGMENTS=1024;static VERTICES_PER_SEGMENT=12;static MIN_HALF_WIDTH_DEG=.1;static BRIGHT_HALF_WIDTH_DEG=.22;static TRAIN_SHARE=.9;static TRAIN_FALLOFF=1.2;object=new G;tiers;trains;positions;colors;shown=0;drawn=[];constructor(){this.object.name="reentries",this.tiers=S.map(i=>{const o=new _(new M,R.material(i.size,!1));return R.track(o),o.frustumCulled=!1,this.object.add(o),o});const s=h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT;this.positions=new Float32Array(s*3),this.colors=new Float32Array(s*3);const t=new M;t.setAttribute("position",new w(this.positions,3)),t.setAttribute("color",new w(this.colors,3)),t.setDrawRange(0,0),this.trains=new F(t,f.material()),this.trains.frustumCulled=!1,f.track(this.trains),this.object.add(this.trains)}nearest(s,t){let i,o=t;for(const e of this.drawn){const n=e.direction.dot(s);(n>o||i&&n===o&&e.magnitude<i.magnitude)&&(o=n,i=e)}return i}static directionOf(s){const{x:t,y:i,z:o}=I(s.altitudeDeg,s.azimuthDeg,1);return new N(t,i,o)}get count(){return this.shown}set(s,t,i,o){const e=this.tiers.map(()=>[]);let n=0,E=0;const r=new y;this.drawn=[];for(const a of s){const u=i(a.head);if(u<=0)continue;const c=a.magnitude-2.5*Math.log10(u);if(c>t)continue;E++,this.drawn.push({direction:h.directionOf(a.head),view:a,magnitude:c}),r.set(a.color);const d=C(c,t)*a.fade,{x:b,y:A,z:p}=I(a.head.altitudeDeg,a.head.azimuthDeg,h.RADIUS),[l,m,T]=o(a.head,c),z=a.fade,D=Math.max(r.r,r.g,r.b)||1;e[H(d)].push({x:b,y:A,z:p,r:l*r.r*z/D,g:m*r.g*z/D,b:T*r.b*z/D}),n=this.pushTrain(n,a.train,d,r)}this.shown=E,this.tiers.forEach((a,u)=>{const c=e[u],d=new Float32Array(c.length*3),b=new Float32Array(c.length*3);c.forEach((p,l)=>{d.set([p.x,p.y,p.z],l*3),b.set([p.r,p.g,p.b],l*3)}),a.geometry.dispose();const A=new M;A.setAttribute("position",new w(d,3)),A.setAttribute("color",new w(b,3)),a.geometry=A});const g=this.trains.geometry;g.setDrawRange(0,n),g.getAttribute("position").needsUpdate=!0,g.getAttribute("color").needsUpdate=!0}pushTrain(s,t,i,o){const e=t.length-1;for(let n=0;n<e;n++){if(s+h.VERTICES_PER_SEGMENT>h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT)return s;const E=1-n/e,r=1-(n+1)/e,g=I(t[n].altitudeDeg,t[n].azimuthDeg,h.RADIUS),a=I(t[n+1].altitudeDeg,t[n+1].azimuthDeg,h.RADIUS),u=d=>h.RADIUS*((h.MIN_HALF_WIDTH_DEG+h.BRIGHT_HALF_WIDTH_DEG*i*d)*Math.PI/180),c=d=>h.TRAIN_SHARE*i*d**h.TRAIN_FALLOFF;s=this.pushRibbon(s,g,a,u(E),u(r),c(E),c(r),o)}return s}pushRibbon(s,t,i,o,e,n,E,r){const g={x:i.x-t.x,y:i.y-t.y,z:i.z-t.z};if(Math.hypot(g.x,g.y,g.z)<1e-9)return s;const a=this.normalise(this.cross(this.normalise(t),this.normalise(g)));for(const[u,c]of[[-1,0],[0,1]]){const d=this.across(t,a,o,u),b=this.across(i,a,e,u),A=this.across(t,a,o,c),p=this.across(i,a,e,c),l=(m,T)=>m===0?T:0;s=this.push(s,d,l(u,n),r),s=this.push(s,b,l(u,E),r),s=this.push(s,A,l(c,n),r),s=this.push(s,b,l(u,E),r),s=this.push(s,p,l(c,E),r),s=this.push(s,A,l(c,n),r)}return s}across(s,t,i,o){return{x:s.x+t.x*i*o,y:s.y+t.y*i*o,z:s.z+t.z*i*o}}push(s,t,i,o){const e=s*3;this.positions[e]=t.x,this.positions[e+1]=t.y,this.positions[e+2]=t.z;const n=B.relativeOfResponse(Math.max(0,Math.min(1,i)));return this.colors[e]=n*o.r,this.colors[e+1]=n*o.g,this.colors[e+2]=n*o.b,s+1}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){for(const s of this.tiers)s.geometry.dispose(),s.material.dispose();this.trains.geometry.dispose(),this.trains.material.dispose(),this.object.removeFromParent()}}class k{inSky=!0;hiddenFromEye=!0;pieces=new h;get object(){return this.pieces.object}get drawnCount(){return this.pieces.count}update(s,t,i){const o=s.length===0?[]:L.viewsAt(s,t,i.observer);o.length===0&&this.pieces.count===0||(this.pieces.set(o,i.magnitudeLimit,e=>i.cloudTransmission(e),(e,n)=>i.arrivingIlluminance(e,n,1)),i.lightFrom(o.map(e=>({position:e.head,magnitude:e.magnitude}))),i.glareFrom(o.map(e=>({key:`${e.reentryId}:${e.fragmentId}`,position:e.head,magnitude:e.magnitude,fade:e.fade}))))}pick(s,t,i){const o=this.pieces.nearest(t,i.nearestCos);return o&&{id:o.view.reentryId,detail:o}}dispose(){this.pieces.dispose()}}export{k as ReentrySimulation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as D,as as A,at as b,au as M,av as p,aw as O,x as I,ah as x,ax as T,ay as S,az as N,aA as F}from"./rr0-sighting.mjs";class h{static SEEK_BEYOND_S=.25;static SAME_FRAME_S=1/60;static CATCH_UP_SHARE=.1;static MIN_RATE=.0625;static MAX_RATE=16;static rollOfPicture(t){return t&&-t}static kindOfSource(t){if(t.type?.startsWith("video/"))return"video";if(t.type?.startsWith("image/"))return"photo";const i=t.url??"";if(i.startsWith("data:video/")||/\.(mp4|m4v|webm|ogv|mov)(?:[?#].*)?$/i.test(i))return"video";if(i.startsWith("data:image/")||/\.(jpe?g|png|gif|webp|avif)(?:[?#].*)?$/i.test(i))return"photo"}static mediaSecondsAt(t,i,s,a){const e=t.video?.fromS??0,o=t.video?.toS??a??Number.POSITIVE_INFINITY,n=i-(t.t??0);if(n<0)return;const r=e+n/(h.positive(s)*1e3)*h.rateOf(t);return r<=o?r:void 0}static rateOf(t){return h.positive(t.video?.rate??1)}static registrationAt(t,i){const s=t.registration,a=t.registrationTrack;if(!a||a.length===0)return s;let e=a.findIndex(E=>E.t>i);e===-1&&(e=a.length);const o=a[Math.max(e-1,0)],n=a[Math.min(e,a.length-1)],r=n.t>o.t?Math.min(Math.max((i-o.t)/(n.t-o.t),0),1):0,c=((n.headingDeg-o.headingDeg)%360+540)%360-180,f=o.rollDeg??0,y=n.rollDeg??0,v=f+(y-f)*r,w=o.fovDeg??s.fovDeg;return{headingDeg:((o.headingDeg+c*r)%360+360)%360,pitchDeg:o.pitchDeg+(n.pitchDeg-o.pitchDeg)*r,rollDeg:v===0?void 0:v,fovDeg:w+((n.fovDeg??s.fovDeg)-w)*r}}static keyIndexAt(t,i){return(t.registrationTrack??[]).findIndex(s=>Math.abs(s.t-i)<20)}static withKey(t,i,s){const a={t:i,...s},e=h.keyIndexAt(t,i),n=[...(t.registrationTrack??[]).filter((r,c)=>c!==e),e>=0?{...a,t:t.registrationTrack[e].t}:a].sort((r,c)=>r.t-c.t);return{...t,registrationTrack:n,registration:h.plainOf(n[0],t.registration)}}static withoutKey(t,i){const s=h.keyIndexAt(t,i);if(s<0)return t;const a=t.registrationTrack.filter((e,o)=>o!==s);return a.length===0?{...t,registrationTrack:void 0}:{...t,registrationTrack:a,registration:h.plainOf(a[0],t.registration)}}static plainOf(t,i){return{headingDeg:t.headingDeg,pitchDeg:t.pitchDeg,rollDeg:t.rollDeg,fovDeg:t.fovDeg??i.fovDeg}}static command(t,i,s,a){const e=Math.min(Math.max(a,h.MIN_RATE),h.MAX_RATE),o=i-t;if(!s)return{seekS:Math.abs(o)>h.SAME_FRAME_S?i:void 0,play:!1,rate:e};if(Math.abs(o)>h.SEEK_BEYOND_S)return{seekS:i,play:!0,rate:e};const n=Math.min(Math.max(o/h.SEEK_BEYOND_S,-1),1)*h.CATCH_UP_SHARE;return{play:!0,rate:Math.min(Math.max(e*(1+n),h.MIN_RATE),h.MAX_RATE)}}static positive(t){return t>0?t:1}}class u extends Error{constructor(t,i){super(`${t}: ${i.kind==="status"?i.status:i.kind}`),this.src=t,this.failure=i}}class g{static async blob(t){let i;try{i=await fetch(t)}catch{throw new u(t,await g.whyUnread(t))}if(!i.ok)throw new u(t,{kind:"status",status:i.status});const s=await i.blob();if(s.type&&!s.type.startsWith("image/"))throw new u(t,{kind:"notPicture"});return s}static failureOf(t){return t instanceof u?t.failure:{kind:"notPicture"}}static async whyVideoUnread(t){if(t.startsWith("data:")||t.startsWith("blob:"))return{kind:"notVideo"};let i;try{i=await fetch(t,{method:"HEAD"})}catch{return g.whyUnread(t)}return i.ok?{kind:"notVideo"}:{kind:"status",status:i.status}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const k=3,m=800,l=Math.PI/180;class d{constructor(t,i,s=d.fetchImage,a=d.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=a}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=D(i.lat,i.lng,t.from.lat,t.from.lng),e=(Math.hypot(s.x,s.z)-d.PRESENT_WITHIN_M)/(d.GONE_BEYOND_M-d.PRESENT_WITHIN_M),o=Math.min(Math.max(e,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const a=new Set(t.map(e=>e.id));for(const[e,o]of this.meshes)a.has(e)||(this.dispose(o),this.meshes.delete(e),this.signatures.delete(e));for(const[e,o]of this.images){const n=t.find(c=>c.id===e);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;d.release(o),this.images.delete(e);const r=this.meshes.get(e);r&&(this.dispose(r),this.meshes.delete(e),this.signatures.delete(e))}for(const e of t){const o=this.images.get(e.id);if(!o){this.load(e);continue}this.build(e,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=k;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const a=i?.get(s);a&&s.quaternion.copy(this.cameraTurn).multiply(a),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new A;get furthestM(){return this.meshes.size>0?m:0}directionOfPixel(t,i,s,a){const e=this.images.get(t.id),o=e?e.width/e.height:1,n=h.registrationAt(t,this.clock.t),r=Math.tan(n.fovDeg/2*l),c=r*o;return a.set((i*2-1)*c,(1-s*2)*r,-1).normalize(),a.applyQuaternion(d.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&d.point(i,t,h.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const a=h.command(i.currentTime,s,this.clock.playing,h.rateOf(t));i.playbackRate=a.rate,a.seekS!==void 0&&!i.seeking&&(i.currentTime=a.seekS),a.play&&i.paused&&i.play().catch(()=>{}),!a.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",e=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(r=>r.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){d.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,g.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,e)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,a)=>{const e=document.createElement("video");e.crossOrigin="anonymous",e.muted=!0,e.playsInline=!0,e.preload="auto",e.addEventListener("loadeddata",()=>{const o=new b(e);o.colorSpace=M,o.minFilter=p,o.magFilter=p,o.generateMipmaps=!1,e.addEventListener("seeked",i);const n=()=>{e.paused&&i(),e.src&&e.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(n),s({texture:o,width:e.videoWidth,height:e.videoHeight,video:e})},{once:!0}),e.addEventListener("error",()=>{g.whyVideoUnread(t).then(o=>a(new u(t,o)))},{once:!0}),e.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await g.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new u(t,{kind:"notPicture"})}),a=new O(s);return a.flipY=!1,a.colorSpace=M,a.minFilter=p,a.magFilter=p,a.generateMipmaps=!1,a.needsUpdate=!0,{texture:a,width:s.width,height:s.height}}build(t,i){const s=d.signatureOf(t,i);let a=this.meshes.get(t.id);if(a&&this.signatures.get(t.id)===s){this.applyOpacity(a,t.id);return}a&&(this.dispose(a),this.meshes.delete(t.id)),a=new I(d.geometryOf(t,i),new x({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(a.material.side=T),a.frustumCulled=!1,a.layers.set(k),a.userData.id=t.id,d.point(a,t,h.registrationAt(t,this.clock.t)),this.scene.add(a),this.meshes.set(t.id,a),this.signatures.set(t.id,s),this.applyOpacity(a,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new S(m,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let r=0;r<n.count;r++)n.setX(r,1-n.getX(r));return n.needsUpdate=!0,o}const s=2*m*Math.tan(t.registration.fovDeg/2*l),a=s*(i.width/Math.max(i.height,1)),e=new N(a,s);return e.translate(0,0,-m),e}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const a=new F;return a.rotation.set(i*l,-t*l,-(s??0)*l,"YXZ"),a.quaternion}static point(t,i,s){if(t.quaternion.copy(d.orientation(s)),i.kind==="panorama")return;const a=Math.tan(s.fovDeg/2*l)/Math.tan(i.registration.fovDeg/2*l);t.scale.set(a,a,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(e=>e.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),a=i?d.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*a}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:a,rollDeg:e,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,a,e??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())d.release(t);this.images.clear()}}export{k as REFERENCE_LAYER,d as ReferenceSystem};
|
|
1
|
+
import{m as D,at as A,au as b,av as M,aw as p,ax as O,x as I,ah as x,ay as T,az as S,aA as N,aB as F}from"./rr0-sighting.mjs";class h{static SEEK_BEYOND_S=.25;static SAME_FRAME_S=1/60;static CATCH_UP_SHARE=.1;static MIN_RATE=.0625;static MAX_RATE=16;static rollOfPicture(t){return t&&-t}static kindOfSource(t){if(t.type?.startsWith("video/"))return"video";if(t.type?.startsWith("image/"))return"photo";const i=t.url??"";if(i.startsWith("data:video/")||/\.(mp4|m4v|webm|ogv|mov)(?:[?#].*)?$/i.test(i))return"video";if(i.startsWith("data:image/")||/\.(jpe?g|png|gif|webp|avif)(?:[?#].*)?$/i.test(i))return"photo"}static mediaSecondsAt(t,i,s,a){const e=t.video?.fromS??0,o=t.video?.toS??a??Number.POSITIVE_INFINITY,n=i-(t.t??0);if(n<0)return;const r=e+n/(h.positive(s)*1e3)*h.rateOf(t);return r<=o?r:void 0}static rateOf(t){return h.positive(t.video?.rate??1)}static registrationAt(t,i){const s=t.registration,a=t.registrationTrack;if(!a||a.length===0)return s;let e=a.findIndex(E=>E.t>i);e===-1&&(e=a.length);const o=a[Math.max(e-1,0)],n=a[Math.min(e,a.length-1)],r=n.t>o.t?Math.min(Math.max((i-o.t)/(n.t-o.t),0),1):0,c=((n.headingDeg-o.headingDeg)%360+540)%360-180,f=o.rollDeg??0,y=n.rollDeg??0,v=f+(y-f)*r,w=o.fovDeg??s.fovDeg;return{headingDeg:((o.headingDeg+c*r)%360+360)%360,pitchDeg:o.pitchDeg+(n.pitchDeg-o.pitchDeg)*r,rollDeg:v===0?void 0:v,fovDeg:w+((n.fovDeg??s.fovDeg)-w)*r}}static keyIndexAt(t,i){return(t.registrationTrack??[]).findIndex(s=>Math.abs(s.t-i)<20)}static withKey(t,i,s){const a={t:i,...s},e=h.keyIndexAt(t,i),n=[...(t.registrationTrack??[]).filter((r,c)=>c!==e),e>=0?{...a,t:t.registrationTrack[e].t}:a].sort((r,c)=>r.t-c.t);return{...t,registrationTrack:n,registration:h.plainOf(n[0],t.registration)}}static withoutKey(t,i){const s=h.keyIndexAt(t,i);if(s<0)return t;const a=t.registrationTrack.filter((e,o)=>o!==s);return a.length===0?{...t,registrationTrack:void 0}:{...t,registrationTrack:a,registration:h.plainOf(a[0],t.registration)}}static plainOf(t,i){return{headingDeg:t.headingDeg,pitchDeg:t.pitchDeg,rollDeg:t.rollDeg,fovDeg:t.fovDeg??i.fovDeg}}static command(t,i,s,a){const e=Math.min(Math.max(a,h.MIN_RATE),h.MAX_RATE),o=i-t;if(!s)return{seekS:Math.abs(o)>h.SAME_FRAME_S?i:void 0,play:!1,rate:e};if(Math.abs(o)>h.SEEK_BEYOND_S)return{seekS:i,play:!0,rate:e};const n=Math.min(Math.max(o/h.SEEK_BEYOND_S,-1),1)*h.CATCH_UP_SHARE;return{play:!0,rate:Math.min(Math.max(e*(1+n),h.MIN_RATE),h.MAX_RATE)}}static positive(t){return t>0?t:1}}class u extends Error{constructor(t,i){super(`${t}: ${i.kind==="status"?i.status:i.kind}`),this.src=t,this.failure=i}}class g{static async blob(t){let i;try{i=await fetch(t)}catch{throw new u(t,await g.whyUnread(t))}if(!i.ok)throw new u(t,{kind:"status",status:i.status});const s=await i.blob();if(s.type&&!s.type.startsWith("image/"))throw new u(t,{kind:"notPicture"});return s}static failureOf(t){return t instanceof u?t.failure:{kind:"notPicture"}}static async whyVideoUnread(t){if(t.startsWith("data:")||t.startsWith("blob:"))return{kind:"notVideo"};let i;try{i=await fetch(t,{method:"HEAD"})}catch{return g.whyUnread(t)}return i.ok?{kind:"notVideo"}:{kind:"status",status:i.status}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const k=3,m=800,l=Math.PI/180;class d{constructor(t,i,s=d.fetchImage,a=d.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=a}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=D(i.lat,i.lng,t.from.lat,t.from.lng),e=(Math.hypot(s.x,s.z)-d.PRESENT_WITHIN_M)/(d.GONE_BEYOND_M-d.PRESENT_WITHIN_M),o=Math.min(Math.max(e,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const a=new Set(t.map(e=>e.id));for(const[e,o]of this.meshes)a.has(e)||(this.dispose(o),this.meshes.delete(e),this.signatures.delete(e));for(const[e,o]of this.images){const n=t.find(c=>c.id===e);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;d.release(o),this.images.delete(e);const r=this.meshes.get(e);r&&(this.dispose(r),this.meshes.delete(e),this.signatures.delete(e))}for(const e of t){const o=this.images.get(e.id);if(!o){this.load(e);continue}this.build(e,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=k;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const a=i?.get(s);a&&s.quaternion.copy(this.cameraTurn).multiply(a),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new A;get furthestM(){return this.meshes.size>0?m:0}directionOfPixel(t,i,s,a){const e=this.images.get(t.id),o=e?e.width/e.height:1,n=h.registrationAt(t,this.clock.t),r=Math.tan(n.fovDeg/2*l),c=r*o;return a.set((i*2-1)*c,(1-s*2)*r,-1).normalize(),a.applyQuaternion(d.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&d.point(i,t,h.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const a=h.command(i.currentTime,s,this.clock.playing,h.rateOf(t));i.playbackRate=a.rate,a.seekS!==void 0&&!i.seeking&&(i.currentTime=a.seekS),a.play&&i.paused&&i.play().catch(()=>{}),!a.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",e=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(r=>r.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){d.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,g.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,e)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,a)=>{const e=document.createElement("video");e.crossOrigin="anonymous",e.muted=!0,e.playsInline=!0,e.preload="auto",e.addEventListener("loadeddata",()=>{const o=new b(e);o.colorSpace=M,o.minFilter=p,o.magFilter=p,o.generateMipmaps=!1,e.addEventListener("seeked",i);const n=()=>{e.paused&&i(),e.src&&e.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(n),s({texture:o,width:e.videoWidth,height:e.videoHeight,video:e})},{once:!0}),e.addEventListener("error",()=>{g.whyVideoUnread(t).then(o=>a(new u(t,o)))},{once:!0}),e.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await g.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new u(t,{kind:"notPicture"})}),a=new O(s);return a.flipY=!1,a.colorSpace=M,a.minFilter=p,a.magFilter=p,a.generateMipmaps=!1,a.needsUpdate=!0,{texture:a,width:s.width,height:s.height}}build(t,i){const s=d.signatureOf(t,i);let a=this.meshes.get(t.id);if(a&&this.signatures.get(t.id)===s){this.applyOpacity(a,t.id);return}a&&(this.dispose(a),this.meshes.delete(t.id)),a=new I(d.geometryOf(t,i),new x({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(a.material.side=T),a.frustumCulled=!1,a.layers.set(k),a.userData.id=t.id,d.point(a,t,h.registrationAt(t,this.clock.t)),this.scene.add(a),this.meshes.set(t.id,a),this.signatures.set(t.id,s),this.applyOpacity(a,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new S(m,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let r=0;r<n.count;r++)n.setX(r,1-n.getX(r));return n.needsUpdate=!0,o}const s=2*m*Math.tan(t.registration.fovDeg/2*l),a=s*(i.width/Math.max(i.height,1)),e=new N(a,s);return e.translate(0,0,-m),e}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const a=new F;return a.rotation.set(i*l,-t*l,-(s??0)*l,"YXZ"),a.quaternion}static point(t,i,s){if(t.quaternion.copy(d.orientation(s)),i.kind==="panorama")return;const a=Math.tan(s.fovDeg/2*l)/Math.tan(i.registration.fovDeg/2*l);t.scale.set(a,a,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(e=>e.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),a=i?d.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*a}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:a,rollDeg:e,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,a,e??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())d.release(t);this.images.clear()}}export{k as REFERENCE_LAYER,d as ReferenceSystem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aL as u}from"./rr0-sighting.mjs";class p{constructor(t,i,e){this.host=t,this.seek=i,this.messages=e,t.classList.add("timeline-tracks"),this.scroll=document.createElement("div"),this.scroll.className="track-scroll",this.scroll.hidden=!0,this.thumb=document.createElement("div"),this.thumb.className="thumb",this.scroll.append(this.thumb),this.scroll.addEventListener("pointerdown",s=>this.dragWindow(s)),t.addEventListener("wheel",s=>this.wheel(s),{passive:!1})}static CSS=`
|
|
2
2
|
.timeline-tracks { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 10px 14px 12px; }
|
|
3
3
|
.timeline-tracks[hidden] { display: none; }
|
|
4
4
|
.track-name { display: inline-block; justify-self: start; min-height: 0; padding: 2px 0; border: 0; background: none; color: var(--ink-dim, inherit); font: 600 12px/1.3 var(--sans, inherit); cursor: pointer; }
|