@rr0/ufoathome 0.189.0 → 0.190.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed-scene/{BeamEditor-Cu6NLBA7.js → BeamEditor-BLtQJ7dq.js} +1 -1
- package/dist-embed-scene/{BirdEditor-BxlHc4L5.js → BirdEditor-C6dn5_wS.js} +1 -1
- package/dist-embed-scene/DroneEditor-iXr-XzB2.js +16 -0
- package/dist-embed-scene/DroneEditorMessages_en-BViHK30c.js +1 -0
- package/dist-embed-scene/DroneEditorMessages_es-D6bhIOAa.js +1 -0
- package/dist-embed-scene/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
- package/dist-embed-scene/DroneEditorMessages_it-CYi-jmVN.js +1 -0
- package/dist-embed-scene/DroneFlight-D0-Y_wej.js +1 -0
- package/dist-embed-scene/DroneKindMessages_en-CLygXcsv.js +1 -0
- package/dist-embed-scene/DroneKindMessages_es-B9XFRYnQ.js +1 -0
- package/dist-embed-scene/DroneKindMessages_fr-CAX15_pk.js +1 -0
- package/dist-embed-scene/DroneKindMessages_it-CSGsCaJQ.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_en-sL1dR2RG.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_it-DfvWjvoc.js +1 -0
- package/dist-embed-scene/{LanternEditor-CpNWWMyY.js → LanternEditor-CHkp6fvG.js} +1 -1
- package/dist-embed-scene/{LaunchEditor-fuFCnkV4.js → LaunchEditor-C2XidkVF.js} +1 -1
- package/dist-embed-scene/{ModuleSession-Dd9RVc7I.js → ModuleSession-CnHhUFre.js} +2 -2
- package/dist-embed-scene/ModuleThree-BzKlu4H2.js +1 -0
- package/dist-embed-scene/{ParameterForm-DP2rnIe1.js → ParameterForm-liNpnZ93.js} +11 -11
- package/dist-embed-scene/{ReentryEditor-DGLg57vB.js → ReentryEditor-DqSDU-se.js} +1 -1
- package/dist-embed-scene/rr0-scene.mjs +314 -314
- package/dist-embed-scene/sightingSchema-CLXF9VE3.js +1 -0
- package/dist-embed-sighting/{BeamEditor-B1s17C_I.js → BeamEditor-Bl_2xUBv.js} +1 -1
- package/dist-embed-sighting/{BeamSystem-DTraCa17.js → BeamSystem-BdJfIbJy.js} +1 -1
- package/dist-embed-sighting/{BirdEditor-B__-UnpK.js → BirdEditor-DAw14Ex2.js} +1 -1
- package/dist-embed-sighting/{CaseReportExport-Dq8QfB_9.js → CaseReportExport-pqKd-0cF.js} +1 -1
- package/dist-embed-sighting/DroneEditor-C6uGwJCK.js +16 -0
- package/dist-embed-sighting/DroneEditorMessages_en-BViHK30c.js +1 -0
- package/dist-embed-sighting/DroneEditorMessages_es-D6bhIOAa.js +1 -0
- package/dist-embed-sighting/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
- package/dist-embed-sighting/DroneEditorMessages_it-CYi-jmVN.js +1 -0
- package/dist-embed-sighting/DroneFlight-BPuws32_.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_en-CLygXcsv.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_es-B9XFRYnQ.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_fr-CAX15_pk.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_it-CSGsCaJQ.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_en-sL1dR2RG.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_it-DfvWjvoc.js +1 -0
- package/dist-embed-sighting/{GLTFLoader-61IhKnLS.js → GLTFLoader-BPxbcVGH.js} +1 -1
- package/dist-embed-sighting/{LanternEditor-C6tHr2lo.js → LanternEditor-2qGw33iQ.js} +1 -1
- package/dist-embed-sighting/{LaserBeam-R7ItI6m-.js → LaserBeam-DotCCB1U.js} +1 -1
- package/dist-embed-sighting/{LaunchEditor-CbQXmqaL.js → LaunchEditor-QW4_Sx3j.js} +1 -1
- package/dist-embed-sighting/{LaunchPlume-uRfBKA0Y.js → LaunchPlume-CNTwnOG6.js} +1 -1
- package/dist-embed-sighting/{LaunchSimulation-DgsYJUKz.js → LaunchSimulation-CoJIQGLm.js} +1 -1
- package/dist-embed-sighting/{ModuleSession-YoBCzrOV.js → ModuleSession-CQnRKmzR.js} +2 -2
- package/dist-embed-sighting/ModuleThree-FBgB1-pu.js +1 -0
- package/dist-embed-sighting/{ParameterForm-CkZQ1FlH.js → ParameterForm-DviNoiD5.js} +1 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_en-ChQHFyxb.js +1 -0
- package/dist-embed-sighting/ReadingSensitivityMessages_es-BbFqHsvR.js +1 -0
- package/dist-embed-sighting/ReadingSensitivityMessages_fr-Dl4a8udu.js +1 -0
- package/dist-embed-sighting/ReadingSensitivityMessages_it-CwiJfUo_.js +1 -0
- package/dist-embed-sighting/{ReentryEditor-BzOyu6AB.js → ReentryEditor-MgbKtSa4.js} +1 -1
- package/dist-embed-sighting/{ReentrySimulation-BDnSb3zB.js → ReentrySimulation-BR0KO3U0.js} +1 -1
- package/dist-embed-sighting/rr0-sighting.mjs +369 -367
- package/dist-embed-sighting/sightingSchema-CLXF9VE3.js +1 -0
- package/dist-embed-sighting-editor/{BallesterGuaspAssessor-CeyXntPc.js → BallesterGuaspAssessor-CapyLOHE.js} +1 -1
- package/dist-embed-sighting-editor/{BeamEditor-DQcdww5w.js → BeamEditor-8960brcL.js} +1 -1
- package/dist-embed-sighting-editor/{BeamSystem-d2pPAwht.js → BeamSystem-BoMHmOf3.js} +1 -1
- package/dist-embed-sighting-editor/{CaseReportExport-DQEJL9zL.js → CaseReportExport-CYUM0gPZ.js} +1 -1
- package/dist-embed-sighting-editor/{ContrailSystem-B4tXvQXF.js → ContrailSystem-teTrI30G.js} +1 -1
- package/dist-embed-sighting-editor/{ControlPasses-C2E5CKcL.js → ControlPasses-PiJOqNOu.js} +1 -1
- package/dist-embed-sighting-editor/{CoverageAssessor-DvVcSmz6.js → CoverageAssessor-Zh8Hw6yp.js} +1 -1
- package/dist-embed-sighting-editor/DroneEditor-CnlkmY64.js +16 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_en-BViHK30c.js +1 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_es-D6bhIOAa.js +1 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_it-CYi-jmVN.js +1 -0
- package/dist-embed-sighting-editor/DroneFlight-D4RRsn4m.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_en-CLygXcsv.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_es-B9XFRYnQ.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_fr-CAX15_pk.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_it-CSGsCaJQ.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_en-sL1dR2RG.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_it-DfvWjvoc.js +1 -0
- package/dist-embed-sighting-editor/{GLTFLoader-fTZft-Zt.js → GLTFLoader-DWambWcY.js} +1 -1
- package/dist-embed-sighting-editor/{HeadlightSystem-uWB_oNGK.js → HeadlightSystem-LL1DHYBg.js} +1 -1
- package/dist-embed-sighting-editor/{HynekAssessor-D-u8nJfp.js → HynekAssessor-wtavw_WK.js} +1 -1
- package/dist-embed-sighting-editor/{InterviewEditorElement-MBuptUl8.js → InterviewEditorElement-46F4WJC9.js} +2 -2
- package/dist-embed-sighting-editor/{LaserBeam-DOGz1dOz.js → LaserBeam-BcOjgC8-.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchEditor-0BCDGChg.js → LaunchEditor-CUw-IXhX.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchPlume-DdX9-Rlw.js → LaunchPlume-By8E1xvy.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchSimulation-BkdI45NE.js → LaunchSimulation-gytH8ZVf.js} +1 -1
- package/dist-embed-sighting-editor/{ModuleConformance-_3-3Kbbt.js → ModuleConformance-DRVG5aJw.js} +2 -2
- package/dist-embed-sighting-editor/{ModuleSession-mVLpd6IE.js → ModuleSession-o0MYjWCQ.js} +2 -2
- package/dist-embed-sighting-editor/ModuleThree-D1RGQ8X2.js +1 -0
- package/dist-embed-sighting-editor/{ModulesPanelElement-DZ7dkdsm.js → ModulesPanelElement-Uk66Ixvl.js} +3 -3
- package/dist-embed-sighting-editor/{NearestApproach-BDjtUet2.js → NearestApproach-CgC-W_0w.js} +1 -1
- package/dist-embed-sighting-editor/{PoherAssessor-DrseSHg-.js → PoherAssessor-C0PuGZ7E.js} +1 -1
- package/dist-embed-sighting-editor/{RailwaySystem-De5BYxNx.js → RailwaySystem-CzCL0bVV.js} +1 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_en-ChQHFyxb.js +1 -0
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_es-BbFqHsvR.js +1 -0
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_fr-Dl4a8udu.js +1 -0
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_it-CwiJfUo_.js +1 -0
- package/dist-embed-sighting-editor/{ReentryEditor-DWqXWztK.js → ReentryEditor-v66u2mvZ.js} +1 -1
- package/dist-embed-sighting-editor/{ReentrySimulation-DpIG9b07.js → ReentrySimulation-CLu3E046.js} +1 -1
- package/dist-embed-sighting-editor/{ReferenceSystem-BoCM4vB1.js → ReferenceSystem-BWEFysoI.js} +1 -1
- package/dist-embed-sighting-editor/{SightingEditorMessages_en-Bt9dhchY.js → SightingEditorMessages_en-BgJRl09G.js} +2 -2
- package/dist-embed-sighting-editor/{SightingEditorMessages_es-BnoHmcFj.js → SightingEditorMessages_es-CK8yosal.js} +2 -2
- package/dist-embed-sighting-editor/{SightingEditorMessages_fr-CE7C8gk2.js → SightingEditorMessages_fr-CcBrcUd-.js} +2 -2
- package/dist-embed-sighting-editor/{SightingEditorMessages_it-lqZ7QCHn.js → SightingEditorMessages_it-Dvnh7lnI.js} +2 -2
- package/dist-embed-sighting-editor/{SightingFileEditor-Dtz8Azd2.js → SightingFileEditor-CQtQqTVl.js} +1 -1
- package/dist-embed-sighting-editor/{TraceSystem-DdEd9Z5I.js → TraceSystem-DrdYmWMC.js} +2 -2
- package/dist-embed-sighting-editor/{WaterSystem-DntD2XIE.js → WaterSystem-DJVs_drg.js} +2 -2
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +381 -374
- package/dist-embed-sighting-editor/sightingSchema-CLXF9VE3.js +1 -0
- package/package.json +1 -1
- package/dist-embed-scene/ModuleThree-q18pyqmA.js +0 -1
- package/dist-embed-scene/sightingSchema-DjI7FV42.js +0 -1
- package/dist-embed-sighting/ModuleThree-BHRi7HrA.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_en-CF6XauSj.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_es-Ca-13TTT.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_fr-Djdd6Hdq.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_it-CPUXxMqD.js +0 -1
- package/dist-embed-sighting/sightingSchema-DjI7FV42.js +0 -1
- package/dist-embed-sighting-editor/ModuleThree-cXvmWIn4.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_en-CF6XauSj.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_es-Ca-13TTT.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_fr-Djdd6Hdq.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_it-CPUXxMqD.js +0 -1
- package/dist-embed-sighting-editor/sightingSchema-DjI7FV42.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b2 as K,b4 as N,b5 as j,b6 as U,b7 as W,b8 as z,b9 as f}from"./rr0-scene.mjs";class v{static read(t,e){let i=t;for(const
|
|
1
|
+
import{b2 as K,b4 as N,b5 as j,b6 as U,b7 as W,b8 as z,b9 as f}from"./rr0-scene.mjs";class v{static read(t,e){let i=t;for(const o of e.split(".")){if(i=v.bare(i),i===null||typeof i!="object")return;i=i[o]}return v.bare(i)}static write(t,e,i){const o=e.split("."),s=[];let n=t;for(let r=0;r<o.length-1;r++){let a=v.bare(n[o[r]]);if(a===null||typeof a!="object"||Array.isArray(a)){if(i===void 0)return;a={}}n[o[r]]=a,s.push({owner:n,part:o[r]}),n=a}const d=o[o.length-1];i===void 0?delete n[d]:n[d]=i;for(let r=s.length-1;r>=0;r--){const a=s[r].owner[s[r].part];if(Object.keys(a).length>0)break;delete s[r].owner[s[r].part]}}static stated(t,e){return v.read(t,e)!==void 0}static bare(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)&&"value"in t&&"basis"in t?t.value:t}}class M{static sets=new Map;static publish(t){M.sets.set(t.kind,t)}static of(t){return M.sets.get(t)}static kinds(){return[...M.sets.keys()]}}class ${static resolved=new WeakMap;static resolve(t,e){let i=$.resolved.get(t);i||$.resolved.set(t,i=new WeakMap);let o=i.get(e);if(!o){const s=e,n=r=>{if(typeof r!="string")return r;if(typeof s[r]=="string")return s[r];const a=r.split(" ");return a.length>1&&a.every(c=>typeof s[c]=="string")?a.map(c=>s[c]).join(" "):r},d=r=>r.map(a=>({...a,label:n(a.label)}));o={...t,title:n(t.title),parameters:t.parameters.map(r=>{const a={...r,label:n(r.label),hint:n(r.hint),summary:n(r.summary),group:n(r.group),..."placeholder"in r?{placeholder:n(r.placeholder)}:{},..."empty"in r?{empty:n(r.empty)}:{}};if(a.type==="choice"){const c=a.optionsOf;return{...a,choices:d(a.choices),...c?{optionsOf:(l,h)=>d(c(l,h))}:{}}}if(a.type==="set"){const c=a.options;return{...a,options:(l,h)=>d(c(l,h))}}return a})},i.set(e,o)}return o}static missing(t,e){const i=e,o=new Set,s=n=>{if(typeof n=="string")for(const d of n.split(" "))/^[a-z][A-Za-z0-9]*$/.test(d)&&i[d]===void 0&&o.add(d)};s(t.title);for(const n of t.parameters)if(s(n.label),s(n.hint),s(n.summary),s(n.group),"placeholder"in n&&s(n.placeholder),"empty"in n&&s(n.empty),n.type==="choice")for(const d of n.choices)s(d.label);return[...o]}}class Q{static attach(t,e,i){t.classList.add(e);const o=`${e}-style`;if(t.parentElement?.querySelector(`:scope > style.${o}`))return;const s=t.ownerDocument.createElement("style");s.className=o,s.textContent=i,t.before(s)}}class G{constructor(t,e,i,o){this.button=t,this.onPick=i,this.idOf=o;const s=this.panel=t.ownerDocument.createElement("div");s.id=e,s.className="add-menu",s.setAttribute("popover",""),s.setAttribute("role","menu");const n=`--add-menu-${e}`;t.style.setProperty("anchor-name",n),s.style.setProperty("position-anchor",n),t.setAttribute("popovertarget",e),t.setAttribute("aria-haspopup","menu"),t.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{b2 as K,b4 as N,b5 as j,b6 as U,b7 as W,b8 as z,b9 as f}from"./rr0-scene.
|
|
|
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(t){this.kinds=t;const e=this.button.ownerDocument;this.panel.replaceChildren(...t.map(i=>{const
|
|
12
|
+
`;panel;kinds=[];last;setKinds(t){this.kinds=t;const e=this.button.ownerDocument;this.panel.replaceChildren(...t.map(i=>{const o=e.createElement("button");return o.type="button",o.className="add-menu-choice",o.setAttribute("role","menuitem"),this.idOf&&(o.id=this.idOf(i.value)),o.dataset.value=i.value,o.textContent=i.label,o.hidden=i.hidden===!0,i.disabledReason&&(o.setAttribute("aria-disabled","true"),o.title=i.disabledReason),o.addEventListener("click",()=>{o.getAttribute("aria-disabled")!=="true"&&(this.close(),this.last=i.value,this.onPick(i.value))}),o}))}setDisabled(t,e){this.kinds=this.kinds.map(o=>o.value===t?{...o,disabledReason:e}:o);const i=[...this.panel.children].find(o=>o.dataset.value===t);i&&(e?(i.setAttribute("aria-disabled","true"),i.title=e):(i.removeAttribute("aria-disabled"),i.title=""))}labelOf(t){return this.kinds.find(e=>e.value===t)?.label??t}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(t){this.options=t,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=t.ids.list,this.select.addEventListener("change",()=>t.onSelect(this.select.value)),this.pickerRow.append(this.select),t.header.append(this.row),this.row.append(this.pickerRow);const e=t.navigation;e&&(this.previousButton=this.iconButton(`${t.ids.list}-previous`,"▲"),this.nextButton=this.iconButton(`${t.ids.list}-next`,"▼"),this.previousButton.addEventListener("click",()=>e.onStep(-1)),this.nextButton.addEventListener("click",()=>e.onStep(1)),this.row.append(this.previousButton,this.nextButton),e.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 o=i.key==="ArrowUp"?this.previousButton:this.nextButton;o&&!o.disabled&&e.onStep(i.key==="ArrowUp"?-1:1)}));for(const i of t.actions??[]){const o=this.iconButton(i.id,i.glyph);o.addEventListener("click",()=>i.onClick()),this.actionButtons.set(i.id,o),this.row.append(o)}this.removeButton=this.iconButton(t.ids.remove,"🗑"),this.removeButton.addEventListener("click",()=>t.onRemove()),this.emptyText=document.createElement("span"),this.emptyText.className="element-list-empty",this.addButton=this.iconButton(t.ids.add,"+"),this.addButton.classList.add("element-list-add"),this.row.append(this.removeButton,this.emptyText,this.addButton),t.ids.kinds?this.kindMenu=new G(this.addButton,t.ids.kinds,i=>t.onAdd(i),t.ids.kind):this.addButton.addEventListener("click",()=>t.onAdd(void 0)),t.body&&t.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{b2 as K,b4 as N,b5 as j,b6 as U,b7 as W,b8 as z,b9 as f}from"./rr0-scene.
|
|
|
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
|
-
${G.CSS}`;static showPresence(t,e,i,
|
|
25
|
+
${G.CSS}`;static showPresence(t,e,i,o=!1){for(const s of t.children)if(!s.matches(".element-list-add, .add-menu, .add-reason")){if(s.matches(".element-list-empty")){s.hidden=i||o;continue}if(s.matches(".element-list-picker")){s.hidden=!i&&!o;continue}s.hidden=!i&&!o,s instanceof HTMLButtonElement&&!i&&(s.disabled=!0)}e&&(e.hidden=!i,i&&!A.glued.has(e)&&A.glue(e))}static glued=new WeakSet;static glue(t){const e=t.parentElement,i=t.ownerDocument.defaultView;if(!e||!i)return;const o=i.getComputedStyle(e),s=/flex|grid/.test(o.display)&&parseFloat(o.rowGap)||0;t.style.marginTop=`${-s}px`,o.display!=="none"&&A.glued.add(t)}select;row;pickerRow;emptyText;removeButton;addButton;addReason;kindMenu;previousButton;nextButton;actionButtons=new Map;items=[];noneLabel="—";addLabel="";removeEnabled=!0;actionEnabled=new Map;iconButton(t,e){const i=document.createElement("button");return i.type="button",i.className="icon-btn",i.id=t,K.show(i,e),i}setLabels(t){if(this.previousButton&&this.nextButton)for(const[e,i,o]of[[this.previousButton,t.previous??"","Alt+↑"],[this.nextButton,t.next??"","Alt+↓"]]){const s=i===""?o:`${i} (${o})`;e.title=s,e.setAttribute("aria-label",i||s),e.setAttribute("aria-keyshortcuts",o.replace("↑","ArrowUp").replace("↓","ArrowDown"))}this.select.setAttribute("aria-label",t.list),this.emptyText.textContent=t.empty??"",this.noneLabel=t.none??this.noneLabel,this.addLabel=t.add,this.kindMenu?.panel.setAttribute("aria-label",t.add),this.options.optional&&this.listed(this.items,this.select.value);for(const[e,i]of[[this.removeButton,t.remove],[this.addButton,t.add],...[...this.actionButtons].map(([o,s])=>[s,t.actions?.[o]??""])])e.title=i,e.setAttribute("aria-label",i)}setKinds(t){this.kindMenu?.setKinds(t)}kindLabel(t){return this.kindMenu?.labelOf(t)??t}get pickedKind(){return this.kindMenu?.lastPicked}setItems(t,e){this.items=t,this.listed(t,e)}listed(t,e){this.select.replaceChildren(...this.options.optional?[new Option(this.noneLabel,"")]:[],...t.map(i=>new Option(i.label,i.id))),e!==void 0&&(this.select.value=e),this.select.selectedIndex<0&&(this.select.selectedIndex=0),this.setPresent(this.options.optional?this.select.value!=="":t.length>0)}setStepState(t,e){this.previousButton&&(this.previousButton.disabled=!t),this.nextButton&&(this.nextButton.disabled=!e)}setActionEnabled(t,e){const i=this.actionButtons.get(t);i&&(i.disabled=!e||this.select.disabled),this.actionEnabled.set(t,e)}setRemoveEnabled(t){this.removeEnabled=t,this.removeButton.disabled=!t||this.select.value===""&&this.options.optional===!0}get value(){return this.select.value}setAddState(t,e){this.addButton.disabled=!t;const i=e??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=!t&&e?e:"",this.addReason.hidden=t||!e}rename(t,e){const i=[...this.select.options].find(o=>o.value===t);i&&(i.textContent=e)}show(t){this.select.value=t,this.options.optional&&this.setPresent(this.select.value!=="")}setPresent(t){const e=this.options.optional===!0;if(A.showPresence(this.row,this.options.body,t,e),this.select.disabled=!t&&!e,!!t){this.removeButton.disabled=!this.removeEnabled;for(const[i,o]of this.actionButtons)o.disabled=this.actionEnabled.get(i)===!1}}focus(){this.select.focus()}}class b{static CHROME="2.6em";static UNBOUNDED=9999;static fit(t){const e=[...t.querySelectorAll('input[type="number"]')];for(const i of e)i.style.width=`calc(${b.charsFor(i)}ch + ${b.CHROME})`,b.hold(i,!b.isFocused(i)),i.dataset.held!==""&&(i.dataset.held="",i.addEventListener("input",()=>b.hold(i)),i.addEventListener("change",()=>b.hold(i,!0)));return e.length}static hold(t,e=!1){const i=b.heldValue(t.value,t,e);i!==t.value&&(t.value=i,t.dispatchEvent(new Event("input",{bubbles:!0})))}static isFocused(t){return t.getRootNode().activeElement===t}static heldValue(t,e,i=!1){if(t===""||!/^-?\d+(\.\d+)?$/.test(t))return t;const o=b.wholeOnly(e.step)?0:b.decimalsOf(e.step),s=t.indexOf("."),n=s>=0&&t.length-s-1>o?o===0?t.slice(0,s):t.slice(0,s+o+1):t,d=Number(n),r=e.min===""?void 0:Number(e.min),a=e.max===""?void 0:Number(e.max);return a!==void 0&&d>a?String(a):i&&r!==void 0&&d<r?String(r):n}static charsFor(t){const e=d=>d===""?void 0:Math.abs(Number(d)),i=Math.max(e(t.max)??b.UNBOUNDED,e(t.min)??0),o=String(Math.floor(Number.isFinite(i)?i:b.UNBOUNDED)).length,s=t.min!==""&&Number(t.min)<0?1:0,n=b.wholeOnly(t.step)?0:b.decimalsOf(t.step);return o+s+(n>0?n+1:0)}static decimalsOf(t){if(t===""||t==="any")return 2;const e=t.indexOf(".");return Math.max(2,e<0?0:t.length-e-1)}static wholeOnly(t){return t!==""&&t!=="any"&&!t.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 @@ ${G.CSS}`;static showPresence(t,e,i,n=!1){for(const s of t.children)if(!s.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(t,e,i){const
|
|
35
|
+
`;static button(t,e,i){const o=t.querySelector(":scope > .window-close");if(o)return E.label(o,e),o;const s=document.createElement("button");return s.type="button",s.className="window-close",s.innerHTML=K.CLOSE,E.label(s,e),s.addEventListener("click",n=>{n.stopPropagation(),i()}),t.prepend(s),s}static popover(t,e){return E.button(t,e,()=>{typeof t.hidePopover=="function"&&t.matches(":popover-open")&&t.hidePopover()})}static dialog(t,e,i){if(!t.dataset.closesBeside){t.dataset.closesBeside="true";let o=!1;t.addEventListener("pointerdown",s=>o=s.target===t),t.addEventListener("click",s=>{s.target===t&&o&&E.outside(t,s)&&i()})}return E.button(t,e,i)}static outside(t,e){const i=t.getBoundingClientRect();return e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom}static label(t,e){t.title=e,t.setAttribute("aria-label",e)}}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(t){this.anchor=`--rr0-basis-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`,this.mark?.style.setProperty("anchor-name",this.anchor)}build(){if(this.mark)return;const t=document.createElement("span");t.className="basis-mark",t.setAttribute("role","button"),t.tabIndex=0,t.style.setProperty("anchor-name",this.anchor);const e=i=>{i.preventDefault(),i.stopPropagation(),this.open()};t.addEventListener("click",e),t.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&e(i)}),this.append(t),this.mark=t,this.say()}connectedCallback(){this.build()}set messages(t){this.wording=t,this.say()}set sourceMessages(t){this.sourceWording=t}get entry(){return this.shown}set entry(t){this.shown=t&&(t.basis!=="stated"||t.how!==void 0||t.rationale!==void 0||t.source!==void 0)?{...t}:void 0,this.say()}get pill(){return this.build(),this.mark}say(){const t=this.mark,e=this.wording;if(!t||!e)return;const i=this.shown?.basis??"stated";t.dataset.basis=i,this.dataset.basis=i,t.textContent!==e.basis[i]&&(t.textContent=e.basis[i]),this.shown?.source?t.dataset.sourced="yes":delete t.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(t){this.anchor=`--rr0-basis-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`,this.mark?.style.setProperty("anchor-name",this.anchor)}build(){if(this.mark)return;const t=document.createElement("span");t.className="basis-mark",t.setAttribute("role","button"),t.tabIndex=0,t.style.setProperty("anchor-name",this.anchor);const e=i=>{i.preventDefault(),i.stopPropagation(),this.open()};t.addEventListener("click",e),t.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&e(i)}),this.append(t),this.mark=t,this.say()}connectedCallback(){this.build()}set messages(t){this.wording=t,this.say()}set sourceMessages(t){this.sourceWording=t}get entry(){return this.shown}set entry(t){this.shown=t&&(t.basis!=="stated"||t.how!==void 0||t.rationale!==void 0||t.source!==void 0)?{...t}:void 0,this.say()}get pill(){return this.build(),this.mark}say(){const t=this.mark,e=this.wording;if(!t||!e)return;const i=this.shown?.basis??"stated";t.dataset.basis=i,this.dataset.basis=i,t.textContent!==e.basis[i]&&(t.textContent=e.basis[i]),this.shown?.source?t.dataset.sourced="yes":delete t.dataset.sourced;const o=this.rationaleRead();t.title=o?`${e.title} : ${o}`:e.title,t.setAttribute("aria-label",`${e.title} : ${e.basis[i]}`)}rationaleRead(){return new N(j.preferencesFor(this)).read(this.shown?.rationale)}rationaleLanguage(){return U(j.preferencesFor(this),z)}static rationaleWritten(t,e,i){if(t===void 0||typeof t=="string")return e?{rationale:e}:{};const o=Object.fromEntries(Object.entries(t).filter(([n])=>n!==i)),s=e?{...o,[i]:e}:o;return Object.keys(s).length>0?{rationale:s}:{}}open(){const t=this.wording;if(!t)return;const e=Object.assign(document.createElement("h3"),{textContent:t.title}),i=document.createElement("select");for(const u of["established","measured","stated","derived","assumed","fitted"])i.append(new Option(t.basis[u],u));i.value=this.shown?.basis??"stated";const o=document.createElement("select");o.append(new Option("—",""));for(const u of this.hows)o.append(new Option(u.label,u.value));o.value=this.shown?.how??"";const s=document.createElement("textarea");s.value=this.rationaleRead()??"";const n=(u,p)=>{const m=document.createElement("label");return m.append(Object.assign(document.createElement("span"),{textContent:u}),p),m};let d=()=>this.shown?.source;const r=()=>{const u=i.value,p=d();this.entry={basis:u,...o.value?{how:o.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}))};o.addEventListener("change",r),s.addEventListener("change",r);const a=document.createElement("div");a.className="basis-source";const c=()=>{d=this.drawSource(a,i.value,n,()=>r())};i.addEventListener("change",()=>{c(),r()});const l=this.windowElement(),h=this.sourceKept&&this.sourceWording!==void 0;h&&c(),l.replaceChildren(e,n(t.basisField,i),...this.hows.length>0?[n(t.howField,o)]:[],...this.rationaleKept?[n(t.rationaleField,s)]:[],...h?[a]:[]),E.popover(l,t.title),typeof l.showPopover=="function"&&l.isConnected?l.showPopover():l.hidden=!1}static kindOf(t){return t?.said?"said":t?.picture?"picture":t?.document!==void 0||t?.at||t?.url?"document":t?.tool?"tool":"none"}drawSource(t,e,i,o){const s=this.sourceWording;if(!s)return t.replaceChildren(),()=>{};if(W.free({basis:e}))return t.replaceChildren(Object.assign(document.createElement("p"),{className:"basis-source-free",textContent:s.free})),()=>{};const n=this.choices.interviews??[],d=this.choices.pictures??[],r=["none",...n.length>0?["said"]:[],"document",...d.length>0?["picture"]:[],"tool"],a=document.createElement("select");for(const m of r)a.append(new Option(s.kinds[m],m));const c=this.shown?.source,l=w.kindOf(c);a.value=r.includes(l)?l:"none";const h=document.createElement("div");let u=()=>{};const p=()=>{u=this.drawSourceFields(h,a.value,c,i,o)};return a.addEventListener("change",()=>{p(),o()}),p(),t.replaceChildren(i(s.field,a),h),()=>u()}drawSourceFields(t,e,i,o,s){const n=this.sourceWording,d=(e===w.kindOf(i)?i:void 0)??{},r=c=>{const l=document.createElement("input");return l.type="text",l.value=c??"",l.addEventListener("change",s),l},a=c=>c.value.trim()||void 0;if(e==="said"){const c=this.choices.interviews??[],l=document.createElement("select");for(const p of c)l.append(new Option(p.id===void 0?n.interviewOnly:p.label,p.id??""));l.value=d.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||n.segmentUnnamed.replace("{n}",String(m.index+1)),String(m.index)))),d.said&&h.querySelector(`option[value="${d.said.segment}"]`)&&(h.value=String(d.said.segment))};return u(),l.addEventListener("change",()=>{u(),s()}),h.addEventListener("change",s),t.replaceChildren(o(n.interviewField,l),o(n.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),...d.said?.range?{range:d.said.range}:{}}}}}if(e==="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=d.picture??"",l.addEventListener("change",s),t.replaceChildren(o(n.pictureField,l)),()=>l.value?{picture:l.value}:void 0}if(e==="tool"){const c=r(d.tool);return t.replaceChildren(o(n.toolField,c)),()=>a(c)?{tool:a(c)}:void 0}if(e==="document"){const c=r(typeof d.document=="string"?d.document:void 0),l=r(d.at),h=r(d.url);return t.replaceChildren(o(n.documentField,c),o(n.atField,l),o(n.urlField,h)),()=>{const u={...a(c)?{document:a(c)}:{},...a(l)?{at:a(l)}:{},...a(h)?{url:a(h)}:{}};return typeof d.document=="object"&&d.document!==null&&a(c)===void 0?Object.keys(u).length>0||d.document?{...u,document:d.document}:void 0:Object.keys(u).length>0?u:void 0}}return t.replaceChildren(),()=>{}}windowElement(){if(this.window)return this.window;const t=document.createElement("div");t.className="basis-window",t.setAttribute("popover",""),t.setAttribute("role","dialog"),t.style.setProperty("position-anchor",this.anchor),t.addEventListener("toggle",i=>{i.newState==="closed"&&(t.remove(),this.window=void 0)});const e=this.getRootNode();return e instanceof ShadowRoot?e.append(t):(e instanceof Document?e.body:this).append(t),this.window=t,t}get openWindow(){return this.window}}function H(){customElements.get(w.TAG)||customElements.define(w.TAG,w)}const q="rr0-input-position",Y={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"},J=`${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=Y;shownFrame={references:[]};shownValue;shownBasis;relativeShown=!0;referenceId;build(){if(this.modeButton)return;const t=this.getAttribute("name")??"position",e=this.ownerDocument,i=e.createElement("style");i.textContent=J;const
|
|
84
|
-
`)!==
|
|
83
|
+
`;class x extends HTMLElement{modeButton;fromRow;fromSelect;localRow;geoRow;eastField;northField;latField;lngField;basisSelect;eastLabel;northLabel;latLabel;lngLabel;wording=Y;shownFrame={references:[]};shownValue;shownBasis;relativeShown=!0;referenceId;build(){if(this.modeButton)return;const t=this.getAttribute("name")??"position",e=this.ownerDocument,i=e.createElement("style");i.textContent=J;const o=e.createElement("button");o.type="button",o.className="position-mode",o.addEventListener("click",()=>this.setRelative(!this.relativeShown));const s=e.createElement("span");s.className="position-from";const n=e.createElement("span");n.className="position-from-text";const d=e.createElement("select");d.id=`${t}-from`,d.addEventListener("input",()=>this.pickReference(d.value)),s.append(n,d);const r=this.getAttribute("step")??"0.1",a=(g,S,B,F)=>{const k=e.createElement("input");return k.type="number",k.id=g,k.min=String(S),k.max=String(B),k.step=F,k.autocomplete="off",k},c=(g,S)=>{const B=e.createElement("label");B.className="position-axis";const F=e.createElement("span");return B.append(F,g,S),{row:B,label:F}},l=Number(this.getAttribute("range")??3e4),h=a(this.getAttribute("east-id")??`${t}-east`,-l,l,r),u=a(this.getAttribute("north-id")??`${t}-north`,-l,l,r),p=a(this.getAttribute("lat-id")??`${t}-lat`,-90,90,"0.000001"),m=a(this.getAttribute("lng-id")??`${t}-lng`,-180,180,"0.000001"),O=e.createElement("span");O.className="position-local";const P=c(h,"m"),T=c(u,"m");O.append(P.row,T.row);const C=e.createElement("span");C.className="position-geo";const D=c(p,"°"),I=c(m,"°");C.append(D.row,I.row);for(const g of[h,u])g.addEventListener("input",()=>this.typedLocal());for(const g of[p,m])g.addEventListener("input",()=>this.typedGeo());H();const y=e.createElement(w.TAG);y.id=`${t}-basis`,y.className="position-basis",y.rationaleKept=!1,y.sourceKept=!1,y.anchorKey=`${t}-basis`,y.addEventListener("basischange",g=>{g.stopPropagation();const S=g.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,o,s,O,C,y),this.modeButton=o,this.fromRow=s,this.fromSelect=d,this.localRow=O,this.geoRow=C,this.eastField=h,this.northField=u,this.latField=p,this.lngField=m,this.basisSelect=y,this.eastLabel=P.label,this.northLabel=T.label,this.latLabel=D.label,this.lngLabel=I.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(t){this.shownFrame=t,this.build(),this.pullDegrees(),this.show()}get value(){return this.shownValue}set value(t){if(this.shownValue=t,this.build(),this.isGeo){const e=t;this.latField.value=e?String(f.degrees(e.lat)):"",this.lngField.value=e?String(f.degrees(e.lng)):""}this.show()}set said(t){this.build(),this.pullDegrees(),f.isRelative(t)?(this.relativeShown=!0,this.referenceId=t.relativeTo):f.isAbsolute(t)?this.relativeShown=!1:(this.relativeShown=!this.isGeo,this.referenceId=void 0),this.show()}get said(){const t=this.localValue();if(t)return f.restated(this.relativeShown?f.relative(0,0,this.referenceId):{lat:0,lng:0},t,this.shownFrame)}get relative(){return this.relativeShown}get basis(){return this.shownBasis}set basis(t){this.shownBasis=t==="stated"?void 0:t,this.build(),this.markBasis()}set basisShown(t){this.build(),this.basisSelect.hidden=!t}set messages(t){this.wording=t,this.modeButton&&(this.word(),this.show())}setRelative(t){!this.shownFrame.origin||this.references().length===0||(this.pullDegrees(),this.relativeShown=t,this.show())}pullDegrees(){if(!this.isGeo||!this.latField)return;const t=x.typed(this.latField),e=x.typed(this.lngField);this.shownValue=t!==void 0&&e!==void 0?{lat:t,lng:e}:this.latField.value===""&&this.lngField.value===""?void 0:this.shownValue}word(){const t=this.wording;this.eastLabel.textContent=t.positionEast,this.northLabel.textContent=t.positionNorth,this.latLabel.textContent=t.positionLatitude,this.lngLabel.textContent=t.positionLongitude,this.fromRow.querySelector(".position-from-text").textContent=t.positionFrom,this.basisSelect.messages={title:t.positionBasisHint,basisField:t.positionBasisField,howField:"",rationaleField:"",basis:{established:t.positionBasisEstablished,stated:t.positionBasisStated,measured:t.positionBasisMeasured,derived:t.positionBasisDerived,assumed:t.positionBasisAssumed,fitted:t.positionBasisFitted}},this.markBasis()}markBasis(){this.basisSelect&&(this.basisSelect.entry=this.shownBasis?{basis:this.shownBasis}:void 0)}references(){const t=this.shownFrame.references;return t.length>0||this.isGeo?t:[{label:this.wording.positionObserver,eastM:0,northM:0}]}reference(){const t=this.references();return t.find(e=>e.id===this.referenceId)??t[0]??{label:"",eastM:0,northM:0}}localValue(){const t=this.shownValue;if(!t)return;if(!this.isGeo)return t;const e=this.shownFrame.origin;return e?f.toLocal(t,e):void 0}geoValue(){const t=this.shownValue;if(!t)return;if(this.isGeo)return t;const e=this.shownFrame.origin;return e?f.toGeo(t,e):void 0}show(){if(!this.modeButton)return;const t=this.wording,e=this.shownFrame.origin!==void 0&&this.references().length>0;e||(this.relativeShown=!this.isGeo);const i=this.modeButton;i.textContent=this.relativeShown?t.positionRelative:t.positionAbsolute,i.disabled=!e,i.title=e?t.positionModeHint:t.positionNoPlace;const o=this.references(),s=this.fromSelect,n=o.map(h=>h.id??"");([...s.options].map(h=>h.value).join(`
|
|
84
|
+
`)!==n.join(`
|
|
85
85
|
`)||[...s.options].map(h=>h.text).join(`
|
|
86
|
-
`)!==
|
|
87
|
-
`))&&s.replaceChildren(...
|
|
86
|
+
`)!==o.map(h=>h.label).join(`
|
|
87
|
+
`))&&s.replaceChildren(...o.map(h=>new Option(h.label,h.id??""))),this.referenceId!==void 0&&!o.some(h=>h.id===this.referenceId)&&(this.referenceId=void 0),s.value=this.referenceId??n[0]??"",this.fromRow.hidden=!this.relativeShown,this.localRow.hidden=!this.relativeShown,this.geoRow.hidden=this.relativeShown;const d=this.getRootNode().activeElement,r=(h,u)=>{h!==d&&(h.value=u===void 0?"":String(u))},a=this.localValue(),c=this.reference();if(r(this.eastField,a?f.metres(a.eastM-c.eastM):void 0),r(this.northField,a?f.metres(a.northM-c.northM):void 0),this.isGeo&&!this.relativeShown)return;const l=this.geoValue();r(this.latField,l?f.degrees(l.lat):void 0),r(this.lngField,l?f.degrees(l.lng):void 0)}pickReference(t){this.pullDegrees(),this.referenceId=t===""?void 0:t,this.show();const e=this.said;e&&this.shownValue&&this.tell(this.shownValue,e)}static typed(t){const e=t.value.trim(),i=e===""?NaN:Number(e);return Number.isFinite(i)?i:void 0}typedLocal(){const t=x.typed(this.eastField),e=x.typed(this.northField);if(t===void 0||e===void 0)return;const i=this.reference(),o={eastM:i.eastM+t,northM:i.northM+e};let s=o;if(this.isGeo){const n=this.shownFrame.origin;if(!n)return;s=f.toGeo(o,n)}this.shownValue=s,this.tell(s,f.relative(t,e,this.referenceId))}typedGeo(){const t=x.typed(this.latField),e=x.typed(this.lngField);if(t===void 0||e===void 0)return;let i={lat:t,lng:e};if(!this.isGeo){const o=this.shownFrame.origin;if(!o)return;i=f.toLocal({lat:t,lng:e},o)}this.shownValue=i,this.tell(i,{lat:t,lng:e})}tell(t,e){this.show();const i=this.isGeo?f.isAbsolute(e):f.isRelative(e)&&e.relativeTo===void 0;this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,said:i?void 0:e},bubbles:!0,composed:!0}))}}function X(){customElements.get(q)||customElements.define(q,x)}class R{constructor(t,e,i=()=>{},o){this.read=t,this.edit=e,this.context=i,this.place=o}static inPlace(t){return new R(()=>t,e=>e(t))}}class L{constructor(t,e,i="",o,s){this.container=t,this.idPrefix=i,this.values=o,this.enhance=s,this.said=new N([e,"en"])}set;target;changed=()=>{};said;setLanguage(t){this.said=new N([t,"en"]),this.set&&this.target&&this.show(this.set,this.target,this.changed)}show(t,e,i){this.set=t,this.target=e instanceof R?e:R.inPlace(e),this.changed=i,this.container.replaceChildren();const o=new Map;for(const s of t.parameters){const n=this.read(s.group)??"";let d=o.get(n);if(!d){if(d=document.createElement("fieldset"),d.className="parameter-group",n!==""){const r=document.createElement("legend");r.textContent=n,d.append(r)}else d.classList.add("parameter-group-untitled"),d.style.border="0",d.style.padding="0",d.style.marginInline="0";o.set(n,d),this.container.append(d)}d.append(this.fieldOf(s))}b.fit(this.container),this.sync()}clear(){this.set=void 0,this.target=void 0,this.container.replaceChildren()}field(t){return this.container.querySelector(`[data-key="${t}"]`)??void 0}sync(t=!1){const e=this.target?.read();if(!this.set||!e)return;const i=this.target.context(),o=t?null:this.container.getRootNode().activeElement;for(const s of this.set.parameters){const n=s.type==="position"?this.positionOf(s):this.field(s.key);if(!n)continue;const d=n.closest("label, .parameter-row")??n;d.hidden=s.visibleWhen!==void 0&&!s.visibleWhen(e,i);const r=v.read(e,s.key);if(s.type==="number"){const a=n;a!==o&&(a.value=typeof r=="number"?L.shown(r,s):"");const c=L.boundsOf(s,e,i);a.min=String(c.min),a.max=String(c.max);const l=s.effective?.(e,i);a.placeholder=l!==void 0?L.shown(l,s):this.read(s.placeholder)??"",a.classList.toggle("parameter-derived",r===void 0)}else if(s.type==="choice"){const a=n,c=s.optionsOf?.(e,i)??s.choices;if([...a.options].filter(l=>l.value!=="").map(l=>l.value).join(`
|
|
88
88
|
`)!==c.map(l=>l.value).join(`
|
|
89
|
-
`)&&a.replaceChildren(...s.required?[]:[new Option("—","")],...c.map(l=>new Option(this.read(l.label)??l.value,l.value))),a!==
|
|
89
|
+
`)&&a.replaceChildren(...s.required?[]:[new Option("—","")],...c.map(l=>new Option(this.read(l.label)??l.value,l.value))),a!==o&&(a.value=typeof r=="string"&&c.some(l=>l.value===r)?r:s.required?a.options[0]?.value??"":""),!s.required){const l=s.effective?.(e,i),h=c.find(u=>u.value===l);a.options[0].textContent=h?this.read(h.label)??h.value:this.read(s.empty)??"—"}}else if(s.type==="boolean"){const a=n;a.checked=typeof r=="boolean"?r:s.effective?.(e,i)===!0}else if(s.type==="colour"){const a=n;a!==o&&(a.value=L.swatchOf(r,s.effective?.(e,i)??s.fallback??"#808080"))}else if(s.type==="set")this.syncSet(s,n,e,i);else if(s.type==="position")this.syncPosition(s,n,e);else if(s.type==="said"){const a=n;a!==o&&(a.value=this.values?.said().read(v.read(e,s.key))??""),this.markMissing(s,a)}else{const a=n;a!==o&&(a.value=typeof r=="string"?r:"",a.classList.remove("invalid"),a.removeAttribute("aria-invalid"))}}for(const s of this.container.querySelectorAll("fieldset.parameter-group"))s.hidden=[...s.querySelectorAll("label, .parameter-row")].filter(n=>n.parentElement===s).every(n=>n.hidden)}fieldOf(t){const e=document.createElement("label"),i=this.read(t.hint);i&&(e.title=i);const o=document.createElement("span");o.textContent=this.read(t.label)??t.key,e.append(o," ");let s;if(t.type==="choice"){const n=document.createElement("select");this.identify(n,t),t.required||n.append(new Option("—","")),n.append(...t.choices.map(d=>new Option(this.read(d.label)??d.value,d.value))),n.addEventListener("input",()=>this.write(t,n.value===""?void 0:n.value)),e.append(n),this.enhance?.(t,n)}else{if(t.type==="position")return this.setRow(t,this.positionFieldOf(t));if(t.type==="set"){const n=document.createElement("div");return this.identify(n,t),n.className="parameter-set",n.addEventListener("input",()=>{const d=[...n.querySelectorAll("input:checked")].map(r=>r.value);this.write(t,d.length>0?d:void 0)}),this.setRow(t,n)}else if(t.type==="boolean"){const n=document.createElement("input");n.type="checkbox",this.identify(n,t),n.addEventListener("input",()=>{if(t.effective){const d=this.target?.read(),r=d?t.effective(d,this.target?.context())===!0:!1;this.write(t,n.checked===r?void 0:n.checked)}else this.write(t,n.checked?!0:t.required?!1:void 0)}),e.prepend(n),e.append(" ")}else{const n=document.createElement("input");this.identify(n,t),n.autocomplete="off",t.type==="number"?(n.type="number",n.min=String(t.min),n.max=String(t.max),n.step=String(t.step),s=t.unit,n.addEventListener("input",()=>{const d=n.value.trim();if(d==="")return t.required?void 0:this.write(t,void 0);const r=Number(d);Number.isFinite(r)&&this.write(t,r)})):t.type==="colour"?(n.type="color",n.addEventListener("input",()=>this.write(t,n.value))):t.type==="said"?(n.type="text",n.placeholder=this.read(t.placeholder)??"",n.style.setProperty("field-sizing","content"),n.style.minWidth="10em",n.style.maxWidth="100%",n.addEventListener("input",()=>{const d=this.target?.read(),r=this.values;!d||!r||(this.write(t,r.said().write(v.read(d,t.key),n.value,r.writingLanguage())),this.markMissing(t,n))})):(n.type="text",n.placeholder=this.read(t.placeholder)??"",n.addEventListener("input",()=>{const d=t.required||t.validate?n.value.trim():n.value,r=this.target?.read(),a=r!==void 0&&(t.required===!0&&d===""||d!==""&&t.validate?.(d,r,this.target.context())===!1);n.classList.toggle("invalid",a),a?n.setAttribute("aria-invalid","true"):n.removeAttribute("aria-invalid"),!a&&this.write(t,d===""?void 0:d)}),n.addEventListener("change",()=>{if(!n.classList.contains("invalid"))return;n.classList.remove("invalid"),n.removeAttribute("aria-invalid");const d=this.target?.read(),r=d===void 0?void 0:v.read(d,t.key);n.value=typeof r=="string"?r:""})),e.append(n)}}return s&&e.append(` ${s}`),e}markMissing(t,e){t.type!=="said"||!t.required||(e.classList.toggle("invalid",e.value===""),e.setAttribute("aria-invalid",String(e.value==="")))}positionFieldOf(t){X();const e=document.createElement("rr0-input-position"),i=`${this.idPrefix}${t.key}`;e.setAttribute("name",i),t.native==="geo"&&e.setAttribute("native","geo"),t.step!==void 0&&e.setAttribute("step",String(t.step)),t.rangeM!==void 0&&e.setAttribute("range",String(t.rangeM));const o=t.native==="geo"?["lat-id","lng-id"]:["east-id","north-id"];this.idPrefix!==""&&(e.setAttribute(o[0],`${this.idPrefix}${t.key}`),e.setAttribute(o[1],`${this.idPrefix}${t.secondKey}`)),e.dataset.position=t.key,e.build();const[s,n]=t.native==="geo"?[e.latInput,e.lngInput]:[e.eastInput,e.northInput];s.dataset.key=t.key,n.dataset.key=t.secondKey;const d=this.target?.place;return d&&(e.messages=d.messages()),e.basisShown=d?.basis!==void 0,e.addEventListener("positionchange",r=>{const{value:a,said:c}=r.detail;this.writePosition(t,a,c)}),e.addEventListener("basischange",r=>this.target?.place?.basis?.write(t,r.detail.basis)),e}positionOf(t){return this.container.querySelector(`rr0-input-position[data-position="${t.key}"]`)??void 0}syncPosition(t,e,i){const o=this.target?.place;o&&(e.messages=o.messages(),e.frame=o.frame());const s=v.read(i,t.key),n=v.read(i,t.secondKey),d=typeof s=="number"&&typeof n=="number";e.value=d?t.native==="geo"?{lat:s,lng:n}:{eastM:s,northM:n}:void 0;const r=v.read(i,t.saidKey),a=JSON.stringify(r??null);e.dataset.said!==a&&(e.dataset.said=a,e.said=r),e.basis=o?.basis?.read(t)}writePosition(t,e,i){const o=this.target;if(!o)return;const[s,n]="lat"in e?[e.lat,e.lng]:[e.eastM,e.northM],d=t.native==="geo"?r=>Math.round(r*1e7)/1e7:r=>Math.round(r*1e3)/1e3;this.positionOf(t)?.setAttribute("data-said",JSON.stringify(i??null)),o.edit(r=>{v.write(r,t.key,d(s)),v.write(r,t.secondKey,d(n)),v.write(r,t.saidKey,i)},t),this.changed(),this.sync()}setRow(t,e){const i=document.createElement("div");i.className="parameter-row";const o=this.read(t.hint);o&&(i.title=o);const s=document.createElement("span");return s.textContent=this.read(t.label)??t.key,i.append(s," ",e),i}syncSet(t,e,i,o){if(t.type!=="set")return;const s=v.read(i,t.key),n=new Set(Array.isArray(s)?s:[]),d=t.options(i,o);if(d.length===0){e.textContent=this.read(t.empty)??"";return}[...e.querySelectorAll("input")].map(a=>a.value).join(`
|
|
90
90
|
`)===d.map(a=>a.value).join(`
|
|
91
|
-
`)||e.replaceChildren(...d.map(a=>{const c=document.createElement("label"),l=document.createElement("input");return l.type="checkbox",l.value=a.value,c.append(l," ",a.label),c}));for(const a of e.querySelectorAll("input"))a.checked=
|
|
91
|
+
`)||e.replaceChildren(...d.map(a=>{const c=document.createElement("label"),l=document.createElement("input");return l.type="checkbox",l.value=a.value,c.append(l," ",a.label),c}));for(const a of e.querySelectorAll("input"))a.checked=n.has(a.value)}identify(t,e){t.dataset.key=e.key,this.idPrefix!==""&&(t.id=`${this.idPrefix}${e.key}`)}write(t,e){const i=this.target;if(!i)return;let o=e;if(t.type==="number"&&typeof e=="number"){const s=i.read();if(s){const n=L.boundsOf(t,s,i.context());o=Math.max(n.min,Math.min(n.max,e))/(t.scale??1)}}i.edit(s=>v.write(s,t.key,o),t),this.changed(),this.sync()}read(t){return this.said.read(t)}static boundsOf(t,e,i){const o=t.bounds?.(e,i);return{min:o?.min??t.min,max:o?.max??t.max}}static swatchOf(t,e){if(typeof t!="string")return e;const i=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);return i?`#${i[1]}${i[1]}${i[2]}${i[2]}${i[3]}${i[3]}`.toLowerCase():/^#[0-9a-f]{6}$/i.test(t)?t.toLowerCase():e}static shown(t,e){const i=Math.max(2,Math.min(6,(String(e.step).split(".")[1]??"").length));return String(Number((t*(e.scale??1)).toFixed(i)))}static choicesOf(t){return t.choices.map(e=>e.value)}}export{A as E,M as P,Q as S,L as a,$ as b,R as c,v as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as S,_ as x,R as T,bl as b,bm as w,bn as O,bo as F,bp as N,b2 as A,bq as _,br as L,b3 as P}from"./rr0-scene.mjs";import{S as K,a as E,c as k,b as H,E as G}from"./ParameterForm-DP2rnIe1.js";import{T as U}from"./TimelineTracks-B73gWzRB.js";const z=S.catalog({en:()=>x(()=>import("./ReentryParameterTexts_en-5BOfwCsS.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_en),fr:()=>x(()=>import("./ReentryParameterTexts_fr-BgUJROXF.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_fr),es:()=>x(()=>import("./ReentryParameterTexts_es-ze1-U4jB.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_es),it:()=>x(()=>import("./ReentryParameterTexts_it-MTb9Vuq0.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_it)});class g{static NAME="name";static OBJECT="object";static LIGHT="light";static WHEN="when";static SEEN="seenByTheWitness";static EARTH_KM=6371;static placeSeen(t,e,n,i){const s=Math.PI/180,o=g.EARTH_KM,r=n*s,a=-o*Math.sin(r)+Math.sqrt((o*Math.sin(r))**2+(o+i)**2-o**2),l=Math.atan2(a*Math.cos(r),o+a*Math.sin(r)),c=t.lat*s,h=e*s,d=Math.asin(Math.sin(c)*Math.cos(l)+Math.cos(c)*Math.sin(l)*Math.cos(h)),m=t.lng*s+Math.atan2(Math.sin(h)*Math.sin(l)*Math.cos(c),Math.cos(l)-Math.sin(c)*Math.sin(d));return{lat:d/s,lng:(m/s+540)%360-180}}static trackFromSeen(t,e){const n=t.seen,{fromAzimuthDeg:i,fromAltitudeDeg:s,toAzimuthDeg:o,toAltitudeDeg:r,durationS:a}=n??{};if(i===void 0||s===void 0||o===void 0||r===void 0||!a)return;const l=t.track[0],c=t.track[t.track.length-1],h=l?.t??0,d=l?.altitudeKm??100,m=c?.altitudeKm??d;return[{t:h,...g.placeSeen(e,i,s,d),altitudeKm:d},{t:h+Math.round(a*1e3),...g.placeSeen(e,o,r,m),altitudeKm:m}]}static placeAt(t,e){const n=T.leadAt(t,e);if(n)return{t:e,lat:n.lat,lng:n.lng,altitudeKm:n.heightM/1e3};const i=t.track,[s,o]=e<(i[0]?.t??0)?[i[0],i[1]]:[i[i.length-2],i[i.length-1]];if(!s||!o||o.t===s.t){const a=s??o??{lat:0,lng:0,altitudeKm:80};return{t:e,lat:a.lat,lng:a.lng,altitudeKm:a.altitudeKm}}const r=(e-s.t)/(o.t-s.t);return{t:e,lat:s.lat+(o.lat-s.lat)*r,lng:s.lng+(o.lng-s.lng)*r,altitudeKm:Math.max(0,s.altitudeKm+(o.altitudeKm-s.altitudeKm)*r)}}static curvePointAt(t,e){return{t:e,absoluteMagnitude:Math.round(T.absoluteMagnitudeAt(t,e)*10)/10}}static instantsOf(t){return[...t.track.map(e=>e.t),...t.fragments.flatMap(e=>[...e.fromT===void 0?[]:[e.fromT],...e.untilT===void 0?[]:[e.untilT],...(e.lightCurve??[]).map(n=>n.t)])]}static instant(t,e,n,i={}){return{type:"number",key:t,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:e,hint:n,...i}}static mayBeCatalogued(t){return b.of(t.type)?.nature!=="natural"}static SET={kind:"reentry",title:"fireballOrReEntry",parameters:[{type:"said",key:"title",label:g.NAME},{type:"choice",key:"type",label:"type",hint:"whatCameInNaturalOrPut",empty:"notKnown",choices:[],optionsOf:t=>{const e=t.type,n=b.all().map(i=>({value:i.key,label:b.nameOf(i.key)}));return e===void 0||n.some(i=>i.value===e)?n:[...n,{value:e,label:e}]}},{type:"text",key:"object.name",group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"catalogueName",hint:"forAReEntryThePiece"},{type:"text",key:"object.cosparId",group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"cosparId",placeholder:"t1968013c"},{type:"number",key:"object.norad",min:1,max:999999,step:1,group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"noradNumber"},{type:"number",key:"seen.fromAzimuthDeg",min:0,max:360,step:1,unit:"°",group:g.SEEN,label:"appearedAzimuth",hint:"fromTheNorthTowardsTheEast"},{type:"number",key:"seen.fromAltitudeDeg",min:-5,max:90,step:1,unit:"°",group:g.SEEN,label:"appearedHeight",hint:"aboveTheHorizon"},{type:"number",key:"seen.toAzimuthDeg",min:0,max:360,step:1,unit:"°",group:g.SEEN,label:"wentOutAzimuth",hint:"fromTheNorthTowardsTheEast"},{type:"number",key:"seen.toAltitudeDeg",min:-5,max:90,step:1,unit:"°",group:g.SEEN,label:"wentOutHeight",hint:"aboveTheHorizon"},{type:"number",key:"seen.durationS",min:.1,max:3600,step:.1,unit:"s",group:g.SEEN,label:"seenFor",hint:"allSaidThePathIsWorkedOut"}]};static PLACE={kind:"reentry-place",title:"pointOfThePath",parameters:[g.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(t,e){const n=t?.track;if(n?.length)return e==="first"?n[0].t:n[n.length-1].t}static FRAGMENT={kind:"reentry-fragment",title:"piece",parameters:[{type:"text",key:"id",label:"id",validate:(t,e,n)=>!n?.fragments.some(i=>i!==e&&i.id===t)},{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,group:g.LIGHT,label:"absoluteMagnitude",hint:"itsBrightnessSeenFrom100Km"},{type:"colour",key:"color",group:g.LIGHT,fallback:T.DEFAULT_COLOR,label:"colour"},{type:"number",key:"trainS",min:0,max:600,step:.1,unit:"s",group:g.LIGHT,effective:()=>T.DEFAULT_TRAIN_S,label:"train",hint:"howLongAStretchOfIts"},{type:"number",key:"lagS",min:0,max:600,step:.1,unit:"s",group:g.WHEN,effective:()=>0,label:"behindTheLead",hint:"secondsBehindTheLeadingPointAlong"},g.instant("fromT","seenFrom","whenItBreaksOffOrBegins",{group:g.WHEN,effective:(t,e)=>g.trackEnd(e,"first")}),g.instant("untilT","outAt","whenItHasBurnedUpOr",{group:g.WHEN,effective:(t,e)=>g.trackEnd(e,"last")})]};static CURVE_POINT={kind:"reentry-curve-point",title:"pointOfTheLightCurve",parameters:[g.instant("t","time","secondsOfTheRecording",{required:!0}),{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,label:"absoluteMagnitude"}]}}const $=S.catalog({en:()=>x(()=>import("./ReentryEditorMessages_en-BmTZMr-m.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_en),fr:()=>x(()=>import("./ReentryEditorMessages_fr-DHbcY0tN.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_fr),es:()=>x(()=>import("./ReentryEditorMessages_es-edid__Jo.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_es),it:()=>x(()=>import("./ReentryEditorMessages_it-CIzkIU4G.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_it)}),C="https://ufoathome.org/reentries/index.json";class M{static MINUTE_SLACK_MS=60*6e4;static WINDOW_SLACK_MS=60*6e4;static VISIBLE_KM=1500;static VISIBLE_DEG=M.VISIBLE_KM/111.2;static EARTH_RADIUS_KM=6371;fetchImpl;indexUrls;index;years=new Map;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.indexUrls=t.indexUrls??M.defaultIndexUrls()}static defaultIndexUrls(){const t=[];return typeof location<"u"&&/^https?:$/.test(location.protocol)&&t.push(new URL("/reentries/index.json",location.href).href),t.includes(C)||t.push(C),t}async credit(){return(await this.loadIndex())?.index.credit}async candidates(t,e,n){const i=await this.loadIndex();if(!i)return;const s=new Set;for(const r of[t-M.DAY_MS,e+M.DAY_MS])s.add(String(new Date(r).getUTCFullYear()));const o=(await Promise.all([...s].filter(r=>i.index.years.includes(r)).map(r=>this.yearOf(r,i.base)))).flat();return M.match(o,t,e,n)}static DAY_MS=864e5;static match(t,e,n,i){const s=[];for(const r of t){if(r.inclinationDeg!==void 0&&Math.abs(i.lat)>r.inclinationDeg+M.VISIBLE_DEG)continue;const a=Date.parse(r.precision==="day"?`${r.time}T00:00Z`:r.time);if(Number.isFinite(a))if(r.precision==="minute"){const l=a<e?e-a:a>n?a-n:0;if(l>M.MINUTE_SLACK_MS)continue;let c;if(r.seenLat!==void 0&&r.seenLng!==void 0&&(c=M.distanceKm(i.lat,i.lng,r.seenLat,r.seenLng),c>M.VISIBLE_KM))continue;s.push({record:r,timeMs:a,offsetMinutes:Math.round(l/6e4),seenKm:c})}else{const l=r.precision==="day"?M.DAY_MS/2:(r.uncertaintyHours??0)*36e5,c=r.precision==="day"?a+l:a,h=M.WINDOW_SLACK_MS;if(c+l+h<e||c-l-h>n)continue;s.push({record:r,timeMs:c})}}const o={minute:0,hours:1,day:2};return s.sort((r,a)=>o[r.record.precision]-o[a.record.precision]||(r.record.uncertaintyHours??0)-(a.record.uncertaintyHours??0)||r.timeMs-a.timeMs)}static distanceKm(t,e,n,i){const s=Math.PI/180,o=Math.sin(t*s)*Math.sin(n*s)+Math.cos(t*s)*Math.cos(n*s)*Math.cos((i-e)*s);return M.EARTH_RADIUS_KM*Math.acos(Math.max(-1,Math.min(1,o)))}loadIndex(){return this.index??=(async()=>{for(const t of this.indexUrls)try{const e=await this.fetchImpl(t);if(e.ok)return{index:await e.json(),base:t}}catch{}})(),this.index}yearOf(t,e){let n=this.years.get(t);return n||(n=this.fetchImpl(new URL(`${t}.json`,e).href).then(i=>i.ok?i.json():[]).catch(()=>[]),this.years.set(t,n)),n}}class u{static TIME_MARGIN_MIN=6;static HEADING_MARGIN_DEG=45;static ELEVATION_LOW_FACTOR=.3;static ELEVATION_SLACK_DEG=5;static DURATION_FACTOR=3;static ARCHIVED_MAGNITUDE=-3;static WATCHED_KM=600;static WATCHED_COUNT=5;static NIGHT_SUN_DEG=-12;static SHOWER_MARGIN_DEG=20;static RADIANT_BELOW_DEG=-10;static FIRST_ORBIT_MS=Date.UTC(1957,9,4);static shared={fireballs:new w,reentries:new M};static viewOf(t,e,n){const i=t.track;if(i.length<2)return;const s=i[0],o=i[i.length-1],r=t.seen,a=m=>T.seenFrom(n,{lat:m.lat,lng:m.lng,heightM:m.altitudeKm*1e3}),l=r?.fromAzimuthDeg!==void 0&&r.fromAltitudeDeg!==void 0?{azimuthDeg:r.fromAzimuthDeg,altitudeDeg:r.fromAltitudeDeg}:a(s),c=r?.toAzimuthDeg!==void 0&&r.toAltitudeDeg!==void 0?{azimuthDeg:r.toAzimuthDeg,altitudeDeg:r.toAltitudeDeg}:a(o),h=r?.durationS??(o.t-s.t)/1e3,d=Math.min(...t.fragments.flatMap(m=>[m.absoluteMagnitude,...(m.lightCurve??[]).map(f=>f.absoluteMagnitude)]));return{startMs:e.getTime()+s.t,durationS:h,from:{azimuthDeg:l.azimuthDeg,altitudeDeg:l.altitudeDeg},to:{azimuthDeg:c.azimuthDeg,altitudeDeg:c.altitudeDeg},peakAbsoluteMagnitude:d}}static azimuthOff(t,e){const n=Math.abs(((t-e)%360+360)%360);return Math.min(n,360-n)}static elevationOff(t,e){const n=Math.max(0,t*u.ELEVATION_LOW_FACTOR)-u.ELEVATION_SLACK_DEG,i=t+u.ELEVATION_SLACK_DEG;return e<n?n-e:e>i?e-i:0}static matchFireball(t,e,n){const i=e.t<t.startMs?t.startMs-e.t:0,s=e.t>t.startMs?e.t-t.startMs:0;if(Math.max(i,s)>u.TIME_MARGIN_MIN*6e4)return;const o=T.seenFrom(n,{lat:e.from[0],lng:e.from[1],heightM:e.from[2]*1e3}),r=T.seenFrom(n,{lat:e.to[0],lng:e.to[1],heightM:e.to[2]*1e3});if(o.altitudeDeg<0&&r.altitudeDeg<0)return;const a=Math.max(u.azimuthOff(t.from.azimuthDeg,o.azimuthDeg),u.azimuthOff(t.to.azimuthDeg,r.azimuthDeg));if(a>u.HEADING_MARGIN_DEG||Math.max(u.elevationOff(t.from.altitudeDeg,o.altitudeDeg),u.elevationOff(t.to.altitudeDeg,r.altitudeDeg))>0)return;const c=u.DURATION_FACTOR;if(!(e.durationS>0&&(t.durationS<e.durationS/c||t.durationS>e.durationS*c)))return{record:e,offsetMinutes:Math.round((i+s)/6e4),headingOffDeg:Math.round(a),altitudeOffDeg:Math.round(Math.abs(r.altitudeDeg-t.to.altitudeDeg))}}static async check(t,e,n,i=u.shared){if(!e||!n)return[{verdict:"unchecked",source:"none",reason:"noDateOrPlace"}];const s=u.viewOf(t,e,n);if(!s)return[{verdict:"unchecked",source:"none",reason:"noDateOrPlace"}];const o=b.of(t.type)?.nature,r=[];if(o!=="artificial"&&r.push(...await u.checkFireballs(s,n,o==="natural",i)),o!=="artificial"){const a=u.showerOf(s,n);a&&(a.verdict==="compatible"||o==="natural")&&r.push(a)}return o!=="natural"&&r.push(...await u.checkCatalogue(t,s,n,o==="artificial",i)),o===void 0&&!r.some(a=>a.verdict==="known"||a.verdict==="possible"||a.verdict==="compatible")?[...r.filter(a=>a.verdict==="unchecked"),{verdict:"uninformative",source:"none",reason:"typeUnknown"}]:r}static vectorOf(t,e){const n=Math.PI/180,i=e*n,s=t*n;return[Math.cos(i)*Math.sin(s),Math.cos(i)*Math.cos(s),Math.sin(i)]}static angleDeg(t,e){return Math.acos(Math.max(-1,Math.min(1,t[0]*e[0]+t[1]*e[1]+t[2]*e[2])))*180/Math.PI}static showerOf(t,e){const n=u.vectorOf(t.from.azimuthDeg,t.from.altitudeDeg),i=u.vectorOf(t.to.azimuthDeg,t.to.altitudeDeg),s=u.angleDeg(n,i);if(s<1)return;const o=[n[1]*i[2]-n[2]*i[1],n[2]*i[0]-n[0]*i[2],n[0]*i[1]-n[1]*i[0]],r=Math.hypot(o[0],o[1],o[2]),a=new Date(t.startMs),l=O.activeAt(a);let c;for(const{shower:h,zhr:d}of l){const m=O.radiantPosition(h,a,{lat:e.lat,lng:e.lng,elevationM:e.heightM});if(m.altitudeDeg<u.RADIANT_BELOW_DEG)continue;const f=u.vectorOf(m.azimuthDeg,m.altitudeDeg),p=Math.asin(Math.min(1,Math.abs((f[0]*o[0]+f[1]*o[1]+f[2]*o[2])/r)))*180/Math.PI,y=u.angleDeg(f,n),D=u.angleDeg(f,i);y>=D||D<=s||p<=u.SHOWER_MARGIN_DEG&&(!c||p<c.offDeg)&&(c={showerId:h.id,offDeg:Math.round(p),zhr:Math.round(d)})}return c?{verdict:"compatible",source:"showers",...c}:{verdict:"sporadic",source:"showers",active:l.length}}static async checkFireballs(t,e,n,i){const s=u.TIME_MARGIN_MIN*6e4;if(!w.mayCover(t.startMs))return n?[{verdict:"uninformative",source:"gmn",reason:"beforeArchive"}]:[];const o=await i.fireballs.between(t.startMs-s,t.startMs+s+t.durationS*1e3);if(o===void 0)return n?[{verdict:"unchecked",source:"gmn",reason:"unreachable"}]:[];const r=o.map(m=>u.matchFireball(t,m,e)).filter(m=>m!==void 0).sort((m,f)=>m.offsetMinutes-f.offsetMinutes||m.headingOffDeg-f.headingOffDeg);if(r.length>0)return[{verdict:"known",source:"gmn",match:r[0]}];if(!n)return[];if(t.peakAbsoluteMagnitude>u.ARCHIVED_MAGNITUDE)return[{verdict:"uninformative",source:"gmn",reason:"faint"}];if(F("Sun",new Date(t.startMs),{lat:e.lat,lng:e.lng,elevationM:0}).altitudeDeg>u.NIGHT_SUN_DEG)return[{verdict:"uninformative",source:"gmn",reason:"daylight"}];const a=new Date(t.startMs),l=Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1),c=Date.UTC(a.getUTCFullYear(),a.getUTCMonth()+1,1)-1,d=(await i.fireballs.between(l,c)??[]).filter(m=>M.distanceKm(e.lat,e.lng,m.from[0],m.from[1])<=u.WATCHED_KM).length;return d<u.WATCHED_COUNT?[{verdict:"uninformative",source:"gmn",reason:"unwatched"}]:[{verdict:"expectedAbsent",source:"gmn",absoluteMagnitude:t.peakAbsoluteMagnitude,watchedCount:d}]}static async checkCatalogue(t,e,n,i,s){if(e.startMs<u.FIRST_ORBIT_MS)return i?[{verdict:"impossible",source:"catalogue"}]:[];const o=u.TIME_MARGIN_MIN*6e4,r=await s.reentries.candidates(e.startMs-o,e.startMs+o+e.durationS*1e3,n);if(r===void 0)return i?[{verdict:"unchecked",source:"catalogue",reason:"unreachable"}]:[];const a=t.object,l=a&&r.find(h=>a.cosparId&&h.record.cosparId===a.cosparId||a.norad!==void 0&&h.record.norad===a.norad);if(l)return[{verdict:"known",source:"catalogue",candidate:l,by:"object"}];const c=r.find(h=>h.record.precision==="minute"&&h.seenKm!==void 0&&(h.offsetMinutes??0)<=u.TIME_MARGIN_MIN);return c?[{verdict:"known",source:"catalogue",candidate:c,by:"seen"}]:r.length>0?r.slice(0,3).map(h=>({verdict:"possible",source:"catalogue",candidate:h})):i?[{verdict:"expectedAbsent",source:"catalogue"}]:[]}}class I{constructor(t,e,n){this.container=t,this.host=e,K.attach(t,"reentry-editor-part",I.STYLE),this.language=n,this.ready=this.setLanguage(n)}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 .reentry-evidence { flex-basis: 100%; } .reentry-editor-part .evidence-known, .reentry-editor-part .evidence-impossible, .reentry-editor-part .evidence-expectedAbsent { font-weight: 600; } .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(t){const e=++this.languageToken;this.language=t;const[n,i,,s]=await Promise.all([$.load(t),z.load(t),b.load(t),N(t).catch(()=>{})]);e===this.languageToken&&(this.sceneNames=s,this.messages=n,this.parameterTexts=i,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.reentries;this.shown=[...t],t.some(n=>n.id===this.currentId)||(this.currentId=t[0]?.id),this.list?.setItems(t.map(n=>({id:n.id,label:this.labelOf(n)})),this.currentId),this.list?.setKinds(b.all().map(n=>({value:n.key,label:b.nameOf(n.key)}))),this.syncAddState();const e=this.current;this.element("reentry-fields").hidden=e===void 0,e&&(this.syncPlace(!0),this.syncFragments(e,!0),this.syncEvidence(),this.form??=new E(this.element("reentry-parameters"),this.language,"reentry.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(g.SET),new k(()=>this.current,n=>this.editReentry(i=>{i.object&&(i.object={...i.object}),i.seen&&(i.seen={...i.seen}),n(i),i.object&&Object.values(i.object).every(r=>r===void 0||r==="")&&delete i.object;const s=this.origin(),o=s&&g.trackFromSeen(i,s);o&&(i.track=o)})),()=>this.written()))}refresh(){if(!this.messages)return;this.syncAddState();const t=this.reentries;if(t.length===this.shown.length&&t.every((e,n)=>e.id===this.shown[n].id)){this.syncTimeline();return}this.sync()}setTime(t){this.messages&&this.timeline?.setTime(t)}syncAddState(){const t=this.origin()!==void 0;this.list?.setAddState(t,t?void 0:this.messages.addNowhere)}get current(){return this.reentries.find(t=>t.id===this.currentId)}show(t){this.messages&&(this.currentId=t,this.row="path",this.placeIndex=0,this.fragmentIndex=0,this.curveIndex=0,this.sync())}resolved(t){return H.resolve(t,this.parameterTexts)}render(){if(!this.messages)return;const t=this.messages;this.form=void 0,this.evidenceFor=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
1
|
+
import{c as S,_ as x,R as T,bl as b,bm as w,bn as O,bo as F,bp as N,b2 as A,bq as _,br as L,b3 as P}from"./rr0-scene.mjs";import{S as K,a as E,c as k,b as H,E as G}from"./ParameterForm-liNpnZ93.js";import{T as U}from"./TimelineTracks-B73gWzRB.js";const z=S.catalog({en:()=>x(()=>import("./ReentryParameterTexts_en-5BOfwCsS.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_en),fr:()=>x(()=>import("./ReentryParameterTexts_fr-BgUJROXF.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_fr),es:()=>x(()=>import("./ReentryParameterTexts_es-ze1-U4jB.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_es),it:()=>x(()=>import("./ReentryParameterTexts_it-MTb9Vuq0.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_it)});class g{static NAME="name";static OBJECT="object";static LIGHT="light";static WHEN="when";static SEEN="seenByTheWitness";static EARTH_KM=6371;static placeSeen(t,e,n,i){const s=Math.PI/180,o=g.EARTH_KM,r=n*s,a=-o*Math.sin(r)+Math.sqrt((o*Math.sin(r))**2+(o+i)**2-o**2),l=Math.atan2(a*Math.cos(r),o+a*Math.sin(r)),c=t.lat*s,h=e*s,d=Math.asin(Math.sin(c)*Math.cos(l)+Math.cos(c)*Math.sin(l)*Math.cos(h)),m=t.lng*s+Math.atan2(Math.sin(h)*Math.sin(l)*Math.cos(c),Math.cos(l)-Math.sin(c)*Math.sin(d));return{lat:d/s,lng:(m/s+540)%360-180}}static trackFromSeen(t,e){const n=t.seen,{fromAzimuthDeg:i,fromAltitudeDeg:s,toAzimuthDeg:o,toAltitudeDeg:r,durationS:a}=n??{};if(i===void 0||s===void 0||o===void 0||r===void 0||!a)return;const l=t.track[0],c=t.track[t.track.length-1],h=l?.t??0,d=l?.altitudeKm??100,m=c?.altitudeKm??d;return[{t:h,...g.placeSeen(e,i,s,d),altitudeKm:d},{t:h+Math.round(a*1e3),...g.placeSeen(e,o,r,m),altitudeKm:m}]}static placeAt(t,e){const n=T.leadAt(t,e);if(n)return{t:e,lat:n.lat,lng:n.lng,altitudeKm:n.heightM/1e3};const i=t.track,[s,o]=e<(i[0]?.t??0)?[i[0],i[1]]:[i[i.length-2],i[i.length-1]];if(!s||!o||o.t===s.t){const a=s??o??{lat:0,lng:0,altitudeKm:80};return{t:e,lat:a.lat,lng:a.lng,altitudeKm:a.altitudeKm}}const r=(e-s.t)/(o.t-s.t);return{t:e,lat:s.lat+(o.lat-s.lat)*r,lng:s.lng+(o.lng-s.lng)*r,altitudeKm:Math.max(0,s.altitudeKm+(o.altitudeKm-s.altitudeKm)*r)}}static curvePointAt(t,e){return{t:e,absoluteMagnitude:Math.round(T.absoluteMagnitudeAt(t,e)*10)/10}}static instantsOf(t){return[...t.track.map(e=>e.t),...t.fragments.flatMap(e=>[...e.fromT===void 0?[]:[e.fromT],...e.untilT===void 0?[]:[e.untilT],...(e.lightCurve??[]).map(n=>n.t)])]}static instant(t,e,n,i={}){return{type:"number",key:t,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:e,hint:n,...i}}static mayBeCatalogued(t){return b.of(t.type)?.nature!=="natural"}static SET={kind:"reentry",title:"fireballOrReEntry",parameters:[{type:"said",key:"title",label:g.NAME},{type:"choice",key:"type",label:"type",hint:"whatCameInNaturalOrPut",empty:"notKnown",choices:[],optionsOf:t=>{const e=t.type,n=b.all().map(i=>({value:i.key,label:b.nameOf(i.key)}));return e===void 0||n.some(i=>i.value===e)?n:[...n,{value:e,label:e}]}},{type:"text",key:"object.name",group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"catalogueName",hint:"forAReEntryThePiece"},{type:"text",key:"object.cosparId",group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"cosparId",placeholder:"t1968013c"},{type:"number",key:"object.norad",min:1,max:999999,step:1,group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"noradNumber"},{type:"number",key:"seen.fromAzimuthDeg",min:0,max:360,step:1,unit:"°",group:g.SEEN,label:"appearedAzimuth",hint:"fromTheNorthTowardsTheEast"},{type:"number",key:"seen.fromAltitudeDeg",min:-5,max:90,step:1,unit:"°",group:g.SEEN,label:"appearedHeight",hint:"aboveTheHorizon"},{type:"number",key:"seen.toAzimuthDeg",min:0,max:360,step:1,unit:"°",group:g.SEEN,label:"wentOutAzimuth",hint:"fromTheNorthTowardsTheEast"},{type:"number",key:"seen.toAltitudeDeg",min:-5,max:90,step:1,unit:"°",group:g.SEEN,label:"wentOutHeight",hint:"aboveTheHorizon"},{type:"number",key:"seen.durationS",min:.1,max:3600,step:.1,unit:"s",group:g.SEEN,label:"seenFor",hint:"allSaidThePathIsWorkedOut"}]};static PLACE={kind:"reentry-place",title:"pointOfThePath",parameters:[g.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(t,e){const n=t?.track;if(n?.length)return e==="first"?n[0].t:n[n.length-1].t}static FRAGMENT={kind:"reentry-fragment",title:"piece",parameters:[{type:"text",key:"id",label:"id",validate:(t,e,n)=>!n?.fragments.some(i=>i!==e&&i.id===t)},{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,group:g.LIGHT,label:"absoluteMagnitude",hint:"itsBrightnessSeenFrom100Km"},{type:"colour",key:"color",group:g.LIGHT,fallback:T.DEFAULT_COLOR,label:"colour"},{type:"number",key:"trainS",min:0,max:600,step:.1,unit:"s",group:g.LIGHT,effective:()=>T.DEFAULT_TRAIN_S,label:"train",hint:"howLongAStretchOfIts"},{type:"number",key:"lagS",min:0,max:600,step:.1,unit:"s",group:g.WHEN,effective:()=>0,label:"behindTheLead",hint:"secondsBehindTheLeadingPointAlong"},g.instant("fromT","seenFrom","whenItBreaksOffOrBegins",{group:g.WHEN,effective:(t,e)=>g.trackEnd(e,"first")}),g.instant("untilT","outAt","whenItHasBurnedUpOr",{group:g.WHEN,effective:(t,e)=>g.trackEnd(e,"last")})]};static CURVE_POINT={kind:"reentry-curve-point",title:"pointOfTheLightCurve",parameters:[g.instant("t","time","secondsOfTheRecording",{required:!0}),{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,label:"absoluteMagnitude"}]}}const $=S.catalog({en:()=>x(()=>import("./ReentryEditorMessages_en-BmTZMr-m.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_en),fr:()=>x(()=>import("./ReentryEditorMessages_fr-DHbcY0tN.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_fr),es:()=>x(()=>import("./ReentryEditorMessages_es-edid__Jo.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_es),it:()=>x(()=>import("./ReentryEditorMessages_it-CIzkIU4G.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_it)}),C="https://ufoathome.org/reentries/index.json";class M{static MINUTE_SLACK_MS=60*6e4;static WINDOW_SLACK_MS=60*6e4;static VISIBLE_KM=1500;static VISIBLE_DEG=M.VISIBLE_KM/111.2;static EARTH_RADIUS_KM=6371;fetchImpl;indexUrls;index;years=new Map;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.indexUrls=t.indexUrls??M.defaultIndexUrls()}static defaultIndexUrls(){const t=[];return typeof location<"u"&&/^https?:$/.test(location.protocol)&&t.push(new URL("/reentries/index.json",location.href).href),t.includes(C)||t.push(C),t}async credit(){return(await this.loadIndex())?.index.credit}async candidates(t,e,n){const i=await this.loadIndex();if(!i)return;const s=new Set;for(const r of[t-M.DAY_MS,e+M.DAY_MS])s.add(String(new Date(r).getUTCFullYear()));const o=(await Promise.all([...s].filter(r=>i.index.years.includes(r)).map(r=>this.yearOf(r,i.base)))).flat();return M.match(o,t,e,n)}static DAY_MS=864e5;static match(t,e,n,i){const s=[];for(const r of t){if(r.inclinationDeg!==void 0&&Math.abs(i.lat)>r.inclinationDeg+M.VISIBLE_DEG)continue;const a=Date.parse(r.precision==="day"?`${r.time}T00:00Z`:r.time);if(Number.isFinite(a))if(r.precision==="minute"){const l=a<e?e-a:a>n?a-n:0;if(l>M.MINUTE_SLACK_MS)continue;let c;if(r.seenLat!==void 0&&r.seenLng!==void 0&&(c=M.distanceKm(i.lat,i.lng,r.seenLat,r.seenLng),c>M.VISIBLE_KM))continue;s.push({record:r,timeMs:a,offsetMinutes:Math.round(l/6e4),seenKm:c})}else{const l=r.precision==="day"?M.DAY_MS/2:(r.uncertaintyHours??0)*36e5,c=r.precision==="day"?a+l:a,h=M.WINDOW_SLACK_MS;if(c+l+h<e||c-l-h>n)continue;s.push({record:r,timeMs:c})}}const o={minute:0,hours:1,day:2};return s.sort((r,a)=>o[r.record.precision]-o[a.record.precision]||(r.record.uncertaintyHours??0)-(a.record.uncertaintyHours??0)||r.timeMs-a.timeMs)}static distanceKm(t,e,n,i){const s=Math.PI/180,o=Math.sin(t*s)*Math.sin(n*s)+Math.cos(t*s)*Math.cos(n*s)*Math.cos((i-e)*s);return M.EARTH_RADIUS_KM*Math.acos(Math.max(-1,Math.min(1,o)))}loadIndex(){return this.index??=(async()=>{for(const t of this.indexUrls)try{const e=await this.fetchImpl(t);if(e.ok)return{index:await e.json(),base:t}}catch{}})(),this.index}yearOf(t,e){let n=this.years.get(t);return n||(n=this.fetchImpl(new URL(`${t}.json`,e).href).then(i=>i.ok?i.json():[]).catch(()=>[]),this.years.set(t,n)),n}}class u{static TIME_MARGIN_MIN=6;static HEADING_MARGIN_DEG=45;static ELEVATION_LOW_FACTOR=.3;static ELEVATION_SLACK_DEG=5;static DURATION_FACTOR=3;static ARCHIVED_MAGNITUDE=-3;static WATCHED_KM=600;static WATCHED_COUNT=5;static NIGHT_SUN_DEG=-12;static SHOWER_MARGIN_DEG=20;static RADIANT_BELOW_DEG=-10;static FIRST_ORBIT_MS=Date.UTC(1957,9,4);static shared={fireballs:new w,reentries:new M};static viewOf(t,e,n){const i=t.track;if(i.length<2)return;const s=i[0],o=i[i.length-1],r=t.seen,a=m=>T.seenFrom(n,{lat:m.lat,lng:m.lng,heightM:m.altitudeKm*1e3}),l=r?.fromAzimuthDeg!==void 0&&r.fromAltitudeDeg!==void 0?{azimuthDeg:r.fromAzimuthDeg,altitudeDeg:r.fromAltitudeDeg}:a(s),c=r?.toAzimuthDeg!==void 0&&r.toAltitudeDeg!==void 0?{azimuthDeg:r.toAzimuthDeg,altitudeDeg:r.toAltitudeDeg}:a(o),h=r?.durationS??(o.t-s.t)/1e3,d=Math.min(...t.fragments.flatMap(m=>[m.absoluteMagnitude,...(m.lightCurve??[]).map(f=>f.absoluteMagnitude)]));return{startMs:e.getTime()+s.t,durationS:h,from:{azimuthDeg:l.azimuthDeg,altitudeDeg:l.altitudeDeg},to:{azimuthDeg:c.azimuthDeg,altitudeDeg:c.altitudeDeg},peakAbsoluteMagnitude:d}}static azimuthOff(t,e){const n=Math.abs(((t-e)%360+360)%360);return Math.min(n,360-n)}static elevationOff(t,e){const n=Math.max(0,t*u.ELEVATION_LOW_FACTOR)-u.ELEVATION_SLACK_DEG,i=t+u.ELEVATION_SLACK_DEG;return e<n?n-e:e>i?e-i:0}static matchFireball(t,e,n){const i=e.t<t.startMs?t.startMs-e.t:0,s=e.t>t.startMs?e.t-t.startMs:0;if(Math.max(i,s)>u.TIME_MARGIN_MIN*6e4)return;const o=T.seenFrom(n,{lat:e.from[0],lng:e.from[1],heightM:e.from[2]*1e3}),r=T.seenFrom(n,{lat:e.to[0],lng:e.to[1],heightM:e.to[2]*1e3});if(o.altitudeDeg<0&&r.altitudeDeg<0)return;const a=Math.max(u.azimuthOff(t.from.azimuthDeg,o.azimuthDeg),u.azimuthOff(t.to.azimuthDeg,r.azimuthDeg));if(a>u.HEADING_MARGIN_DEG||Math.max(u.elevationOff(t.from.altitudeDeg,o.altitudeDeg),u.elevationOff(t.to.altitudeDeg,r.altitudeDeg))>0)return;const c=u.DURATION_FACTOR;if(!(e.durationS>0&&(t.durationS<e.durationS/c||t.durationS>e.durationS*c)))return{record:e,offsetMinutes:Math.round((i+s)/6e4),headingOffDeg:Math.round(a),altitudeOffDeg:Math.round(Math.abs(r.altitudeDeg-t.to.altitudeDeg))}}static async check(t,e,n,i=u.shared){if(!e||!n)return[{verdict:"unchecked",source:"none",reason:"noDateOrPlace"}];const s=u.viewOf(t,e,n);if(!s)return[{verdict:"unchecked",source:"none",reason:"noDateOrPlace"}];const o=b.of(t.type)?.nature,r=[];if(o!=="artificial"&&r.push(...await u.checkFireballs(s,n,o==="natural",i)),o!=="artificial"){const a=u.showerOf(s,n);a&&(a.verdict==="compatible"||o==="natural")&&r.push(a)}return o!=="natural"&&r.push(...await u.checkCatalogue(t,s,n,o==="artificial",i)),o===void 0&&!r.some(a=>a.verdict==="known"||a.verdict==="possible"||a.verdict==="compatible")?[...r.filter(a=>a.verdict==="unchecked"),{verdict:"uninformative",source:"none",reason:"typeUnknown"}]:r}static vectorOf(t,e){const n=Math.PI/180,i=e*n,s=t*n;return[Math.cos(i)*Math.sin(s),Math.cos(i)*Math.cos(s),Math.sin(i)]}static angleDeg(t,e){return Math.acos(Math.max(-1,Math.min(1,t[0]*e[0]+t[1]*e[1]+t[2]*e[2])))*180/Math.PI}static showerOf(t,e){const n=u.vectorOf(t.from.azimuthDeg,t.from.altitudeDeg),i=u.vectorOf(t.to.azimuthDeg,t.to.altitudeDeg),s=u.angleDeg(n,i);if(s<1)return;const o=[n[1]*i[2]-n[2]*i[1],n[2]*i[0]-n[0]*i[2],n[0]*i[1]-n[1]*i[0]],r=Math.hypot(o[0],o[1],o[2]),a=new Date(t.startMs),l=O.activeAt(a);let c;for(const{shower:h,zhr:d}of l){const m=O.radiantPosition(h,a,{lat:e.lat,lng:e.lng,elevationM:e.heightM});if(m.altitudeDeg<u.RADIANT_BELOW_DEG)continue;const f=u.vectorOf(m.azimuthDeg,m.altitudeDeg),p=Math.asin(Math.min(1,Math.abs((f[0]*o[0]+f[1]*o[1]+f[2]*o[2])/r)))*180/Math.PI,y=u.angleDeg(f,n),D=u.angleDeg(f,i);y>=D||D<=s||p<=u.SHOWER_MARGIN_DEG&&(!c||p<c.offDeg)&&(c={showerId:h.id,offDeg:Math.round(p),zhr:Math.round(d)})}return c?{verdict:"compatible",source:"showers",...c}:{verdict:"sporadic",source:"showers",active:l.length}}static async checkFireballs(t,e,n,i){const s=u.TIME_MARGIN_MIN*6e4;if(!w.mayCover(t.startMs))return n?[{verdict:"uninformative",source:"gmn",reason:"beforeArchive"}]:[];const o=await i.fireballs.between(t.startMs-s,t.startMs+s+t.durationS*1e3);if(o===void 0)return n?[{verdict:"unchecked",source:"gmn",reason:"unreachable"}]:[];const r=o.map(m=>u.matchFireball(t,m,e)).filter(m=>m!==void 0).sort((m,f)=>m.offsetMinutes-f.offsetMinutes||m.headingOffDeg-f.headingOffDeg);if(r.length>0)return[{verdict:"known",source:"gmn",match:r[0]}];if(!n)return[];if(t.peakAbsoluteMagnitude>u.ARCHIVED_MAGNITUDE)return[{verdict:"uninformative",source:"gmn",reason:"faint"}];if(F("Sun",new Date(t.startMs),{lat:e.lat,lng:e.lng,elevationM:0}).altitudeDeg>u.NIGHT_SUN_DEG)return[{verdict:"uninformative",source:"gmn",reason:"daylight"}];const a=new Date(t.startMs),l=Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),1),c=Date.UTC(a.getUTCFullYear(),a.getUTCMonth()+1,1)-1,d=(await i.fireballs.between(l,c)??[]).filter(m=>M.distanceKm(e.lat,e.lng,m.from[0],m.from[1])<=u.WATCHED_KM).length;return d<u.WATCHED_COUNT?[{verdict:"uninformative",source:"gmn",reason:"unwatched"}]:[{verdict:"expectedAbsent",source:"gmn",absoluteMagnitude:t.peakAbsoluteMagnitude,watchedCount:d}]}static async checkCatalogue(t,e,n,i,s){if(e.startMs<u.FIRST_ORBIT_MS)return i?[{verdict:"impossible",source:"catalogue"}]:[];const o=u.TIME_MARGIN_MIN*6e4,r=await s.reentries.candidates(e.startMs-o,e.startMs+o+e.durationS*1e3,n);if(r===void 0)return i?[{verdict:"unchecked",source:"catalogue",reason:"unreachable"}]:[];const a=t.object,l=a&&r.find(h=>a.cosparId&&h.record.cosparId===a.cosparId||a.norad!==void 0&&h.record.norad===a.norad);if(l)return[{verdict:"known",source:"catalogue",candidate:l,by:"object"}];const c=r.find(h=>h.record.precision==="minute"&&h.seenKm!==void 0&&(h.offsetMinutes??0)<=u.TIME_MARGIN_MIN);return c?[{verdict:"known",source:"catalogue",candidate:c,by:"seen"}]:r.length>0?r.slice(0,3).map(h=>({verdict:"possible",source:"catalogue",candidate:h})):i?[{verdict:"expectedAbsent",source:"catalogue"}]:[]}}class I{constructor(t,e,n){this.container=t,this.host=e,K.attach(t,"reentry-editor-part",I.STYLE),this.language=n,this.ready=this.setLanguage(n)}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 .reentry-evidence { flex-basis: 100%; } .reentry-editor-part .evidence-known, .reentry-editor-part .evidence-impossible, .reentry-editor-part .evidence-expectedAbsent { font-weight: 600; } .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(t){const e=++this.languageToken;this.language=t;const[n,i,,s]=await Promise.all([$.load(t),z.load(t),b.load(t),N(t).catch(()=>{})]);e===this.languageToken&&(this.sceneNames=s,this.messages=n,this.parameterTexts=i,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.reentries;this.shown=[...t],t.some(n=>n.id===this.currentId)||(this.currentId=t[0]?.id),this.list?.setItems(t.map(n=>({id:n.id,label:this.labelOf(n)})),this.currentId),this.list?.setKinds(b.all().map(n=>({value:n.key,label:b.nameOf(n.key)}))),this.syncAddState();const e=this.current;this.element("reentry-fields").hidden=e===void 0,e&&(this.syncPlace(!0),this.syncFragments(e,!0),this.syncEvidence(),this.form??=new E(this.element("reentry-parameters"),this.language,"reentry.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(g.SET),new k(()=>this.current,n=>this.editReentry(i=>{i.object&&(i.object={...i.object}),i.seen&&(i.seen={...i.seen}),n(i),i.object&&Object.values(i.object).every(r=>r===void 0||r==="")&&delete i.object;const s=this.origin(),o=s&&g.trackFromSeen(i,s);o&&(i.track=o)})),()=>this.written()))}refresh(){if(!this.messages)return;this.syncAddState();const t=this.reentries;if(t.length===this.shown.length&&t.every((e,n)=>e.id===this.shown[n].id)){this.syncTimeline();return}this.sync()}setTime(t){this.messages&&this.timeline?.setTime(t)}syncAddState(){const t=this.origin()!==void 0;this.list?.setAddState(t,t?void 0:this.messages.addNowhere)}get current(){return this.reentries.find(t=>t.id===this.currentId)}show(t){this.messages&&(this.currentId=t,this.row="path",this.placeIndex=0,this.fragmentIndex=0,this.curveIndex=0,this.sync())}resolved(t){return H.resolve(t,this.parameterTexts)}render(){if(!this.messages)return;const t=this.messages;this.form=void 0,this.evidenceFor=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
2
2
|
<p class="launch-intro">${t.intro}</p>
|
|
3
3
|
<div id="reentry-list"></div>
|
|
4
4
|
<div id="reentry-fields" class="launch-fields">
|