@rr0/ufoathome 0.202.0 → 0.202.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed-scene/{AirshipEditor-BnRmKeVs.js → AirshipEditor-guE_ib3z.js} +1 -1
- package/dist-embed-scene/{AirshipFlight-C9DSPGwk.js → AirshipFlight-DzW0313e.js} +1 -1
- package/dist-embed-scene/{BalloonEditor-BehJs6H-.js → BalloonEditor-BIsCy_y4.js} +2 -2
- package/dist-embed-scene/{BalloonFlight-BYn4diw1.js → BalloonFlight-gunghgAq.js} +1 -1
- package/dist-embed-scene/{BirdEditor-dOp1sGsz.js → BirdEditor-CuLv4Ij5.js} +1 -1
- package/dist-embed-scene/{BirdFlock-CfJeXvWu.js → BirdFlock-L3dYU2K_.js} +1 -1
- package/dist-embed-scene/{DroneEditor-CBoR4fJ_.js → DroneEditor-BQWPhTyf.js} +1 -1
- package/dist-embed-scene/{DroneFlight-DSE1OXqh.js → DroneFlight-ERYah68l.js} +1 -1
- package/dist-embed-scene/{DroneParameters-D3EOg4oe.js → DroneParameters-CoWQympS.js} +1 -1
- package/dist-embed-scene/{LanternEditor-CbcA7K8y.js → LanternEditor-BpCyb79i.js} +1 -1
- package/dist-embed-scene/{ModuleSession-XnOI5Mcr.js → ModuleSession-bj7QHWjO.js} +2 -2
- package/dist-embed-scene/ModuleThree-DRsA8rtL.js +1 -0
- package/dist-embed-scene/SearchlightSystem-Ddws2hQY.js +1 -0
- package/dist-embed-scene/{SkyLantern-Dp_B40X0.js → SkyLantern-C3BSxHtq.js} +1 -1
- package/dist-embed-scene/rr0-scene.mjs +85 -64
- package/dist-embed-sighting/{CaseReportExport-CkWf0HNx.js → CaseReportExport-BtGCWD7H.js} +1 -1
- package/dist-embed-sighting/{ModuleSession-ChJsGuTn.js → ModuleSession-DztK084a.js} +2 -2
- package/dist-embed-sighting/{ModuleThree-whEZoXYF.js → ModuleThree-BLNSm2eY.js} +1 -1
- package/dist-embed-sighting/SearchlightSystem-PEMBDW1s.js +1 -0
- package/dist-embed-sighting/rr0-sighting.mjs +90 -69
- package/dist-embed-sighting-editor/{BallesterGuaspAssessor-Bylahnc2.js → BallesterGuaspAssessor-CJyRqwvh.js} +1 -1
- package/dist-embed-sighting-editor/{CaseElement-DPlro-7S.js → CaseElement-D80gHg4r.js} +1 -1
- package/dist-embed-sighting-editor/{CaseReportExport-C1g5C8hi.js → CaseReportExport-Bv6FWPs2.js} +1 -1
- package/dist-embed-sighting-editor/{ControlPasses-BMEmppip.js → ControlPasses-CaVHMhEY.js} +1 -1
- package/dist-embed-sighting-editor/{CoverageAssessor-uzQnTEH8.js → CoverageAssessor-CTfHqAd_.js} +1 -1
- package/dist-embed-sighting-editor/{GLTFLoader-2Zbfb3kh.js → GLTFLoader-CrRPu-Pt.js} +1 -1
- package/dist-embed-sighting-editor/{HeadlightSystem-CBmEcC9f.js → HeadlightSystem-BmPfcHt1.js} +1 -1
- package/dist-embed-sighting-editor/{HynekAssessor-uub2VxTi.js → HynekAssessor-nBidt6QV.js} +1 -1
- package/dist-embed-sighting-editor/{InterviewEditorElement-_1fa2bG7.js → InterviewEditorElement-CQWfYlGL.js} +2 -2
- package/dist-embed-sighting-editor/{ModuleConformance-Cr6fM28A.js → ModuleConformance-CpMYkYgb.js} +2 -2
- package/dist-embed-sighting-editor/{ModuleSession-WA6lqfV6.js → ModuleSession-b_pmjUfP.js} +2 -2
- package/dist-embed-sighting-editor/ModuleThree-B_FZVqsf.js +1 -0
- package/dist-embed-sighting-editor/{ModulesPanelElement-BsRg3mzl.js → ModulesPanelElement-D0gn9Z-y.js} +3 -3
- package/dist-embed-sighting-editor/{NearestApproach-Bnx9Ld5_.js → NearestApproach-Bxo_N7a9.js} +1 -1
- package/dist-embed-sighting-editor/{PoherAssessor-CNj_Nyci.js → PoherAssessor-CEVA26zd.js} +1 -1
- package/dist-embed-sighting-editor/{RailwaySystem-6bwbv8UB.js → RailwaySystem-Ceb0_MVz.js} +1 -1
- package/dist-embed-sighting-editor/{ReferenceSystem-8QgwbbAG.js → ReferenceSystem-B15kw0uH.js} +1 -1
- package/dist-embed-sighting-editor/SearchlightSystem-D7sdsRYn.js +1 -0
- package/dist-embed-sighting-editor/{SightingElement-BQdiez39.js → SightingElement-Bp-t_EAF.js} +1 -1
- package/dist-embed-sighting-editor/{TraceSystem-DZMUxSn-.js → TraceSystem-Bv4kLpie.js} +2 -2
- package/dist-embed-sighting-editor/{WaterSystem-CB5jE7qB.js → WaterSystem-Bbk_RJKg.js} +1 -1
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +193 -172
- package/dist-embed-ufoathome/{AdsbLolArchiveProvider-KbJPyJ97.js → AdsbLolArchiveProvider-v1sSwhN1.js} +1 -1
- package/dist-embed-ufoathome/{Aurora-C_mCH4JM.js → Aurora-Dc4u2vEw.js} +1 -1
- package/dist-embed-ufoathome/{AuroraEditor-Dzvgh6e0.js → AuroraEditor-CeLzRDPj.js} +1 -1
- package/dist-embed-ufoathome/{AuroraSimulation-BRUnHmlp.js → AuroraSimulation-BT1CdWX5.js} +1 -1
- package/dist-embed-ufoathome/{BallesterGuaspAssessor-DurdUgbG.js → BallesterGuaspAssessor-CPW-Omah.js} +1 -1
- package/dist-embed-ufoathome/{BeamEditor-Ccvx7l7x.js → BeamEditor-BS73mBZU.js} +1 -1
- package/dist-embed-ufoathome/{BeamSystem-CPM8m17q.js → BeamSystem-C5EpRhij.js} +1 -1
- package/dist-embed-ufoathome/{BodyEditor-BG--NjnZ.js → BodyEditor-BV8WwzAj.js} +1 -1
- package/dist-embed-ufoathome/{CaseEditorElement-0J_TCeiq.js → CaseEditorElement-HR8RFluQ.js} +6 -6
- package/dist-embed-ufoathome/{CaseElement-CRXPyMMR.js → CaseElement-vCbCfGOv.js} +3 -3
- package/dist-embed-ufoathome/{CaseReportExport-DKrBXPgZ.js → CaseReportExport-XLbFCkPg.js} +3 -3
- package/dist-embed-ufoathome/{ColumnResize-DV-byvDt.js → ColumnResize-CEXrq3KB.js} +3 -3
- package/dist-embed-ufoathome/{ControlPasses-CKvTCqTI.js → ControlPasses-CKOU_3lG.js} +1 -1
- package/dist-embed-ufoathome/{CoverageAssessor-MeOMUjkZ.js → CoverageAssessor-BYMf3Qhv.js} +1 -1
- package/dist-embed-ufoathome/{Flightradar24Provider-DxTfswSh.js → Flightradar24Provider-_QPbhh5s.js} +1 -1
- package/dist-embed-ufoathome/{GLTFLoader-pi-JKaNa.js → GLTFLoader-DQeHB-Bk.js} +1 -1
- package/dist-embed-ufoathome/{GeoJsonExport-iyhoKOUU.js → GeoJsonExport-Pq_pPvjK.js} +1 -1
- package/dist-embed-ufoathome/{GeographicFigures-DBmuFlvH.js → GeographicFigures-KII55iXE.js} +1 -1
- package/dist-embed-ufoathome/{HynekAssessor-Bda6csgM.js → HynekAssessor-wCDhgIB8.js} +1 -1
- package/dist-embed-ufoathome/{InterviewEditorElement-BA060rqJ.js → InterviewEditorElement-BSwkegEp.js} +4 -4
- package/dist-embed-ufoathome/{InterviewElement-DvqsCA3I.js → InterviewElement-CfkDtybc.js} +1 -1
- package/dist-embed-ufoathome/{KmlExport-DEPgRRWe.js → KmlExport-BMNwwys8.js} +1 -1
- package/dist-embed-ufoathome/{LaserBeam--dquPX_h.js → LaserBeam-B-tlAzNB.js} +1 -1
- package/dist-embed-ufoathome/{LaunchEditor-D3P0GkLr.js → LaunchEditor-Cy5D-gwU.js} +1 -1
- package/dist-embed-ufoathome/{LaunchPlume-w4l4TR4A.js → LaunchPlume-D-vSb8tJ.js} +1 -1
- package/dist-embed-ufoathome/{LaunchSimulation-BpZd-Nov.js → LaunchSimulation-CZ8Oba00.js} +1 -1
- package/dist-embed-ufoathome/{ModelSource-Csnm3RH_.js → ModelSource-HSiigkeO.js} +1 -1
- package/dist-embed-ufoathome/{ModelThumbnails-Cnt2GxTb.js → ModelThumbnails-DWvRMmj_.js} +1 -1
- package/dist-embed-ufoathome/{ModelViewer-DOfAkPgK.js → ModelViewer-CM7qTW8F.js} +1 -1
- package/dist-embed-ufoathome/{ModulesPanelElement-DH1oroWm.js → ModulesPanelElement-DsOa2zH0.js} +1 -1
- package/dist-embed-ufoathome/{NearestApproach-DJ98M81-.js → NearestApproach-PAsV5RlG.js} +1 -1
- package/dist-embed-ufoathome/{PoherAssessor-4zSdFnFp.js → PoherAssessor-CniYlhUl.js} +1 -1
- package/dist-embed-ufoathome/{QuestionnaireFeed-W69udpmT.js → QuestionnaireFeed-CpZqkxlt.js} +1 -1
- package/dist-embed-ufoathome/{QuestionnaireForm-U78nFPn5.js → QuestionnaireForm-LkllpNx-.js} +1 -1
- package/dist-embed-ufoathome/{QuestionnaireImport-Q5uHxQwU.js → QuestionnaireImport-CNROmkT2.js} +1 -1
- package/dist-embed-ufoathome/{ReentryEditor-DEi9nT0z.js → ReentryEditor-Qax1sT82.js} +1 -1
- package/dist-embed-ufoathome/{ReentrySimulation-CSO1vgro.js → ReentrySimulation-CTeCaxZl.js} +1 -1
- package/dist-embed-ufoathome/{ReferenceSystem--tiMGm4e.js → ReferenceSystem-CM27OCUo.js} +1 -1
- package/dist-embed-ufoathome/{ScenarioReadings-Dzdgopl3.js → ScenarioReadings-Is3HX0n0.js} +1 -1
- package/dist-embed-ufoathome/{ScenarioSweep-CMcleprC.js → ScenarioSweep-BbtX26Fi.js} +1 -1
- package/dist-embed-ufoathome/{SearchlightEditor--1uL8bTa.js → SearchlightEditor-PuLz84pp.js} +1 -1
- package/dist-embed-ufoathome/SearchlightSystem-B-tHvY1M.js +1 -0
- package/dist-embed-ufoathome/{ShareDialogElement-Dlfy9NCE.js → ShareDialogElement-EzLob2Tz.js} +92 -71
- package/dist-embed-ufoathome/{SightingElement-BJSNmFM6.js → SightingElement--qpGoyxL.js} +2 -2
- package/dist-embed-ufoathome/{TraceSystem-Cq2TgP-u.js → TraceSystem-8XQX03MS.js} +1 -1
- package/dist-embed-ufoathome/{VideoButton-MRJlVNm_.js → VideoButton-WNtEngz-.js} +1 -1
- package/dist-embed-ufoathome/rr0-ufoathome.mjs +2 -2
- package/dist-embed-ufoathome/{surroundingsSources--qffL_nJ.js → surroundingsSources-UHKGesPa.js} +1 -1
- package/dist-embed-ufoathome/{trafficRuntime-CTCGr90P.js → trafficRuntime-CgY_7-NH.js} +1 -1
- package/package.json +1 -1
- package/dist-embed-scene/ModuleThree-BTQgimAj.js +0 -1
- package/dist-embed-scene/SearchlightSystem-CX1_nBkz.js +0 -1
- package/dist-embed-sighting/SearchlightSystem-B2-MzG4x.js +0 -1
- package/dist-embed-sighting-editor/ModuleThree-CB_EjTOI.js +0 -1
- package/dist-embed-sighting-editor/SearchlightSystem-CEG52QDx.js +0 -1
- package/dist-embed-ufoathome/SearchlightSystem-7bntVtp_.js +0 -1
package/dist-embed-ufoathome/{GeographicFigures-DBmuFlvH.js → GeographicFigures-KII55iXE.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p}from"./Sighting-B7bsiTIQ.js";import{S as k}from"./SaidPosition-OJEYhVKN.js";import{aS as v}from"./ShareDialogElement-
|
|
1
|
+
import{c as p}from"./Sighting-B7bsiTIQ.js";import{S as k}from"./SaidPosition-OJEYhVKN.js";import{aS as v}from"./ShareDialogElement-EzLob2Tz.js";const b=Math.PI/180;class l{static SIGHT_LINE_M=5e3;static FLAT={heightAt:()=>0};static of(n,t,e){return[...l.observer(n,t),...l.sightLines(n,t,e),...l.bodies(n,t,e),...l.traces(n,t,e)]}static observer(n,t){const e=[];for(const r of n.observerTrack.allKeyframes){const s=p(n,r.t);if(s?.lat===void 0||s.lng===void 0)continue;const d=s.elevationM??0;e.push({t:r.t,at:{lat:s.lat,lng:s.lng,altM:d+v.EYE_HEIGHT_M},...s.headingDeg===void 0?{}:{headingDeg:s.headingDeg},elevationM:d})}if(e.length===0)return[];const o=e[0],a=[{group:"observer",groupName:t.folderObserver,name:l.fill(t.observerPoint,{s:l.seconds(o.t)}),note:l.fill(t.observerNote,{elevation:l.round(o.elevationM,1),heading:o.headingDeg===void 0?"—":l.round(o.headingDeg,0)}),kind:"point",points:[o.at],heights:"observer-ground"}];return e.some(r=>r.at.lat!==o.at.lat||r.at.lng!==o.at.lng)&&a.push({group:"observer",groupName:t.folderObserver,name:t.observerPath,kind:"line",points:e.map(r=>r.at),heights:"observer-ground"}),a}static sightLines(n,t,e){const o=[];for(const a of n.timeline.allKeyframes){const i=p(n,a.t);if(i?.lat===void 0||i.lng===void 0)continue;const r={lat:i.lat,lng:i.lng,altM:(i.elevationM??0)+v.EYE_HEIGHT_M};for(const s of a.shapes){const d=s.shape.aim;d&&o.push({group:"sight-line",groupName:t.folderSightLines,name:l.fill(t.sightLine,{what:l.nameOf(e.read(s.shape.title),s.sourceId,t),s:l.seconds(a.t)}),note:l.fill(t.sightLineNote,{azimuth:l.round(d.azimuthDeg,1),altitude:l.round(d.altitudeDeg,1),km:l.round(l.SIGHT_LINE_M/1e3,0)}),kind:"line",points:[r,l.along(r,d.azimuthDeg,d.altitudeDeg)],heights:"observer-ground"})}}return o}static along(n,t,e){const o=l.SIGHT_LINE_M*Math.cos(e*b),a=k.toGeo({eastM:Math.sin(t*b)*o,northM:Math.cos(t*b)*o},n);return{lat:a.lat,lng:a.lng,altM:n.altM+l.SIGHT_LINE_M*Math.sin(e*b)}}static bodies(n,t,e){const o=n.interpretation?.bodies??[],a=p(n,0);if(o.length===0||a?.lat===void 0||a.lng===void 0)return[];const i={lat:a.lat,lng:a.lng},r=[];for(const s of o){const d=new v(s,l.FLAT,h=>v.eyeOf(n,h,l.FLAT)),f=[];for(const h of[...s.track].sort((c,m)=>c.t-m.t)){const c=d.at(h.t);if(!c)continue;const m=k.toGeo({eastM:c.eastM,northM:c.northM},i),u={lat:m.lat,lng:m.lng,altM:c.upM},M=f[f.length-1];M&&M.lat===u.lat&&M.lng===u.lng&&M.altM===u.altM||f.push(u)}if(f.length===0)continue;const y=l.nameOf(e.read(s.title),s.id,t);r.push({group:"body",groupName:t.folderBodies,name:l.fill(f.length===1?t.bodyPoint:t.bodyPath,{what:y}),note:t.bodyNote,kind:f.length===1?"point":"line",points:f,heights:"observer-ground"})}return r}static traces(n,t,e){return n.traces.map(o=>({group:"trace",groupName:t.folderTraces,name:e.read(o.title)??o.id,...e.read(o.source)?{note:e.read(o.source)}:{},kind:o.kind,points:o.points.map(a=>({lat:a.lat,lng:a.lng,altM:a.altM??0})),heights:o.altitude??"ground",...o.color?{color:o.color}:{}}))}static nameOf(n,t,e){return n&&n.trim()?n.trim():l.fill(e.unnamed,{id:t})}static seconds(n){return l.round(n/1e3,1)}static round(n,t){const e=10**t;return String(Math.round(n*e)/e)}static fill(n,t){return Object.entries(t).reduce((e,[o,a])=>e.replaceAll(`{${o}}`,a),n)}}export{l as G};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as d,m as n}from"./ShareDialogElement-
|
|
1
|
+
import{s as d,m as n}from"./ShareDialogElement-EzLob2Tz.js";import{N as c}from"./NearestApproach-PAsV5RlG.js";import"./rr0-ufoathome.mjs";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";const m=-6,l=150;class r{about="temporal";async assess(e){const t=r.daylight(e),o=e.decor.map((a,p)=>({object:a,index:p})).filter(({object:a})=>a.kind==="entity"),i=c.of(e),s=i!==void 0&&i.m<=l;return{verdict:o.length>0?"ce3":s?"ce1":t===void 0?void 0:t?"dd":"nl",criteria:[{id:"entities",basis:o.length>0?"stated":void 0,paths:o.map(({index:a})=>`decor.${a}`)},{id:"traces",paths:[],unsupported:!0},{id:"proximity",basis:i?.basis,paths:i?.paths??[]},{id:"radar",paths:[],unsupported:!0},{id:"daylight",basis:t===void 0?void 0:"derived",paths:t===void 0?[]:["time","place"]}]}}static daylight(e){const t=e.event.place?.[0],o=e.event.time;if(!t||!o)return;const i=d(o,t.lng,e.event.utcOffsetHours);if(i)return n("Sun",i,{lat:t.lat,lng:t.lng,elevationM:0}).altitudeDeg>m}}export{r as HynekAssessor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BrowserWhisperProvider-Dn44ZE45.js","./TranscriptionAudio-C_xvRUv2.js","./TranscriptionError-D_TCbYbt.js","./OpenAiTranscriptionProvider-DDW446tK.js","./AssemblyAiTranscriptionProvider-o2kkPD5o.js","./QuestionnaireForm-
|
|
2
|
-
import{g as P,_ as w,r as Q,S as $,h as C,H as z,s as J,U as j,T as G,i as y,a as I,V as K}from"./rr0-ufoathome.mjs";import{an as A,H as O,X as L}from"./ShareDialogElement-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BrowserWhisperProvider-Dn44ZE45.js","./TranscriptionAudio-C_xvRUv2.js","./TranscriptionError-D_TCbYbt.js","./OpenAiTranscriptionProvider-DDW446tK.js","./AssemblyAiTranscriptionProvider-o2kkPD5o.js","./QuestionnaireForm-LkllpNx-.js","./CaseEditorElement-HR8RFluQ.js","./rr0-ufoathome.mjs","./SaidPosition-OJEYhVKN.js","./GeoProjection-DvqDbRIx.js","./ParameterForm-XbqxCLRn.js","./ColumnResize-CEXrq3KB.js","./ShareDialogElement-EzLob2Tz.js","./Sighting-B7bsiTIQ.js","./VisualAids-DI-hEL46.js","./three.module-CbaHqYFq.js","./Decor-Dn-cvniW.js","./RecordingIssue-BlWT8Xsu.js","./xyzImageryRaster-Dhxs0B26.js","./Obstacles-v9SkfBD7.js","./InterviewAttachments-BP6Prvdu.js","./TimelineTracks-Daaqw9ly.js","./ReentryArchive-CeXHrU7L.js","./ReferenceTimeline-2kBldQeG.js","./upperAirSources-BU0pD84c.js","./Account-C4jhsVtN.js","./interviewJson-D-i14LTf.js","./interviewImport-ym5iXO4Z.js","./SightingFileEditor-DS1DRU2p.js","./index-C8cdeM8E.js","./sightingSchema-9MogCcUd.js","./QuestionnaireImport-CNROmkT2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{g as P,_ as w,r as Q,S as $,h as C,H as z,s as J,U as j,T as G,i as y,a as I,V as K}from"./rr0-ufoathome.mjs";import{an as A,H as O,X as L}from"./ShareDialogElement-EzLob2Tz.js";import{InterviewMedia as N}from"./InterviewMedia-CGVsMdje.js";import{c as S,Q as Y,d as X}from"./ColumnResize-CEXrq3KB.js";import{I as Re}from"./ColumnResize-CEXrq3KB.js";import{register as Z}from"./InterviewElement-CfkDtybc.js";import{I as M}from"./InterviewAttachments-BP6Prvdu.js";import{InterviewFile as v}from"./interviewJson-D-i14LTf.js";import{I as x}from"./SaidPosition-OJEYhVKN.js";import{W as B,A as F}from"./ParameterForm-XbqxCLRn.js";import{I as ee}from"./CaseEditorElement-HR8RFluQ.js";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./GeoProjection-DvqDbRIx.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";import"./TimelineTracks-Daaqw9ly.js";import"./ReentryArchive-CeXHrU7L.js";import"./ReferenceTimeline-2kBldQeG.js";import"./upperAirSources-BU0pD84c.js";import"./Account-C4jhsVtN.js";class g{static partsOf(e){return e.parts?e.parts:e.redacted?[]:[{text:e.text??""}]}static shownRanges(e){const t=[];let r="",i=0;return e.forEach((s,n)=>{const a="redacted"in s?"▮":v.plain(s.text);/[\p{L}\p{N}.,;:!?)»”…▮]$/u.test(r)&&/^[\p{L}\p{N}(«“▮]/u.test(a)&&(i+=1);const o="redacted"in s?0:a.length;t.push({part:n,from:i,to:i+o}),i+=o,r=a}),t}static words(e){return e.trim()===""?0:e.trim().split(/\s+/u).length}static redact(e,t,r,i){const s=[...g.partsOf(e)],n=g.shownRanges(s).find(b=>!("redacted"in s[b.part])&&t>=b.from&&r<=b.to);if(!n)return;const a=v.plain(s[n.part].text),o=/[\p{L}\p{N}'’-]/u;let p=t-n.from,d=r-n.from;for(;p>0&&o.test(a[p-1])&&o.test(a[p]);)p--;for(;d<a.length&&o.test(a[d])&&o.test(a[d-1]);)d++;const c=a.slice(p,d);if(c.trim()==="")return;const l=a.slice(0,p).trimEnd(),h=a.slice(d).trimStart(),u=[...l!==""?[{text:l}]:[],{redacted:{reason:i,words:g.words(c)}},...h!==""?[{text:h}]:[]],m=s.slice(0,n.part).filter(b=>"redacted"in b).length;return s.splice(n.part,1,...u),g.setParts(e,s),{text:c.trim(),nth:m}}static redactWhole(e,t){const r=JSON.stringify({text:e.text,parts:e.parts}),i=g.partsOf(e).reduce((s,n)=>s+("redacted"in n?n.redacted.words??0:g.words(v.plain(n.text))),0);if(delete e.text,delete e.parts,e.redacted={reason:t,...i>0?{words:i}:{}},e.refs)for(const s of e.refs)delete s.range;return r}static restoreWhole(e,t){const{text:r,parts:i}=JSON.parse(t);delete e.redacted,i?e.parts=i:e.text=r??""}static restorePart(e,t,r){const i=[...g.partsOf(e)];let s=-1;const n=i.findIndex(a=>"redacted"in a&&++s===t);n!==-1&&(i.splice(n,1,{text:r}),g.setParts(e,i))}static raw(e,t=()=>{}){let r=-1,i="",s="";for(const n of g.partsOf(e)){const a="redacted"in n?`⟦${t(++r)??"…"}⟧`:n.text;i!==""&&!/\s$/u.test(s)&&!/^\s/u.test(a)&&(i+=" "),i+=a,s=a}return i}static fromRaw(e,t,r){const i=g.partsOf(e).filter(o=>"redacted"in o),s=[],n=new Map;let a=-1;return t.split(/⟦([^⟧]*)⟧/u).forEach((o,p)=>{if(p%2===0){o.trim()!==""&&s.push({text:o.trim()});return}a++;const d=o.trim();d===""||d==="…"||d==="..."?s.push({redacted:i[a]?.redacted??{reason:r}}):(s.push({redacted:{reason:r,words:g.words(d)}}),n.set(a,d))}),delete e.redacted,g.setParts(e,s),n}static setParts(e,t){const r=[];for(const i of t){const s=r[r.length-1],n=!("redacted"in i)&&/^[,.;:!?)»”…]/u.test(i.text)?"":" ";s&&!("redacted"in s)&&!("redacted"in i)?r[r.length-1]={text:`${s.text}${n}${i.text}`.replace(/\s+/gu," ").trim()}:r.push(i)}if(r.some(i=>"redacted"in i)){if(e.parts=r,delete e.text,e.refs)for(const i of e.refs)delete i.range}else e.text=r.map(i=>i.text).join(" "),delete e.parts}}class D{constructor(e,t,r){this.host=t,this.messages=r,e.classList.add("player"),e.innerHTML=`<div class="player-video" hidden></div>
|
|
3
3
|
<div class="player-bar">
|
|
4
4
|
<button type="button" class="icon-btn player-play" disabled>${x.PLAY}</button>
|
|
5
5
|
<span class="player-time">0:00</span>
|
|
@@ -288,7 +288,7 @@ import{g as P,_ as w,r as Q,S as $,h as C,H as z,s as J,U as j,T as G,i as y,a a
|
|
|
288
288
|
<div id="file-editor" class="file-editor"></div>
|
|
289
289
|
</section>
|
|
290
290
|
</div>
|
|
291
|
-
`;class f extends HTMLElement{shadow=this.attachShadow({mode:"open"});get importInput(){return this.shadow.getElementById("import")}messages;said=new $(["en"]);language="en";localeToken=0;current;options=[];group="summary";base;text;fileEditor;fileEditorLoading;shownFor;ready=Promise.resolve();player;drawn;takenOut=new Map;redactTarget;exchangesShown=Promise.resolve();lastReason;static transcriptionSourceId=T[0].id;transcribing;constructor(){super(),this.shadow.innerHTML=te,customElements.upgrade(this.shadow),this.importInput.build();for(const r of["title","time","by","url","summary","witness","medium"])this.shadow.getElementById(r).addEventListener(r==="witness"||r==="medium"?"change":"input",()=>this.write(r));for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.addEventListener("click",()=>this.openGroup(f.GROUPS[r.getAttribute("aria-controls")]??"summary"));this.shadow.getElementById("url").addEventListener("change",()=>{this.shownFor=void 0,this.text===void 0&&this.group==="file"&&this.showTranscript()}),this.importInput.addEventListener("filepick",r=>{const i=r.detail;i.file?this.importFromFile(i.file):this.importFromUrl(i.url)}),this.shadow.getElementById("save").addEventListener("click",()=>this.save()),this.shadow.getElementById("form-feed").addEventListener("click",()=>this.feedObservation()),this.shadow.getElementById("form-send").addEventListener("click",()=>this.sendQuestionnaire()),this.shadow.getElementById("transcribe-start").addEventListener("click",()=>void this.transcribe()),this.shadow.getElementById("transcribe-stop").addEventListener("click",()=>this.transcribing?.abort()),this.shadow.getElementById("transcribe-source").addEventListener("change",r=>{f.transcriptionSourceId=r.target.value,this.transcribeOutcome=void 0,this.renderTranscribe()}),this.shadow.getElementById("transcribe-key").addEventListener("input",r=>{A.set(f.transcriptionSourceId,r.target.value),this.renderTranscribeStart()});const e=this.shadow.getElementById("exchanges");e.addEventListener("pointerup",()=>setTimeout(()=>this.selectionMade(),0)),e.addEventListener("keyup",r=>{r.shiftKey&&this.selectionMade()}),e.addEventListener("click",r=>{const i=r.target.closest(".bar.redacted-label");i&&this.openBar(i)}),e.addEventListener("keydown",r=>{const i=r.target.closest(".bar.redacted-label");i&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this.openBar(i))}),this.shadow.getElementById("redact-take").addEventListener("click",()=>void this.redactSelection()),this.shadow.getElementById("redact-restore").addEventListener("click",()=>{const r=this.redactTarget;this.closeRedactPop(),r?.kind==="bar"&&r.restorable&&this.restore(r.restorable)});const t=this.field("redact-reason");t.addEventListener("change",()=>{this.redactTarget?.kind==="bar"&&this.changeReason()}),t.addEventListener("keydown",r=>{r.key==="Escape"&&this.closeRedactPop(),r.key==="Enter"&&(r.preventDefault(),this.redactTarget?.kind==="selection"?this.redactSelection():this.changeReason().then(()=>this.closeRedactPop()))})}static GROUPS={"group-summary":"summary","group-form":"form","group-exchanges":"exchanges","group-transcript":"file"};static get observedAttributes(){return["readonly"]}attributeChangedCallback(){this.applyReadonly()}connectedCallback(){this.ready=this.loadLocale(),document.addEventListener("pointerdown",this.pressedElsewhere,!0)}pressedElsewhere=e=>{const t=this.shadow.getElementById("redact-pop");t&&!t.hidden&&!e.composedPath().includes(t)&&this.closeRedactPop()};disconnectedCallback(){document.removeEventListener("pointerdown",this.pressedElsewhere,!0),queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor&&(this.text=this.fileEditor.text,this.fileEditor.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0,this.shownFor=void 0)}get event(){return this.current}set event(e){const t=e!==this.current;t&&(this.shownFor=void 0),this.current=e,this.render(),t&&this.heldThroughQuestionnaire?this.openGroup("form"):this.group==="form"&&(this.formShown=this.showForm()),this.takenOut.clear(),this.group==="file"&&this.showTranscript(),queueMicrotask(()=>{this.current===e&&this.showExchanges()})}set witnesses(e){this.options=e,this.render()}set documentUrl(e){this.base=e}get transcriptText(){return this.text}set transcriptText(e){this.text=e,this.shownFor=void 0}field(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=z.preferencesFor(this),r=J(t,j),i=await G.load(r);e===this.localeToken&&(this.language=r,this.said=new $(t),this.messages=i,this.player||(this.player=new D(this.shadow.getElementById("player"),{timeChanged:s=>this.markCurrentTurn(s),recordingsChanged:s=>void this.editTranscript(n=>{s.length===0?delete n.recordings:n.recordings=s})},i),this.render()),this.render())}applyReadonly(){const e=this.hasAttribute("readonly");for(const t of["title","time","by","url","summary"])this.field(t).readOnly=e;for(const t of this.shadow.querySelectorAll("#witness input"))t.disabled=e;this.field("medium").disabled=e,this.importInput.disabled=e,this.renderTranscribe()}static byText(e){return(e??[]).map(t=>"people"in t?t.people:"org"in t?t.org:t.title??"").filter(t=>t!=="").join(", ")}render(){const e=this.messages;if(!e)return;const t=(l,h)=>{this.shadow.getElementById(l).textContent=h};t("label-summary-group",e.summaryTab),t("label-file-group",e.fileTab),t("label-exchanges-group",e.exchangesTab),t("label-form-group",e.questionnaireTab),t("form-feed",e.feed),O.say(this.shadow.getElementById("form-feed-hint"),"",e.feedHint);const r=this.shadow.getElementById("form-tab");r.hidden=!this.heldThroughQuestionnaire,!this.heldThroughQuestionnaire&&this.group==="form"&&this.openGroup("summary"),t("label-title",e.title),t("label-witness",e.witness),t("label-medium",e.medium),t("label-time",e.time),t("label-by",e.by),t("label-summary",e.summary),t("label-url",e.transcript),O.say(this.shadow.getElementById("label-import-file"),e.importFile,e.importFileHint),t("redact-take",e.redactSelection),t("redact-restore",e.redactRestore),t("label-redact-reason",e.redactReasonLabel);const i=this.field("redact-reason");i.placeholder=e.redactReason,i.title=e.redactReasonHint,t("transcribe-start",e.transcribe),this.shadow.getElementById("transcribe-hint").replaceChildren(O.of(e.transcribeHint)),t("label-transcribe-with",e.transcribeWith),t("label-transcribe-key",e.transcribeKey),t("transcribe-key-get",e.transcribeKeyGet),t("transcribe-stop",e.transcribeStop),this.field("transcribe-key").title=e.transcribeKeyHint,this.renderTranscribe(),this.player?.setMessages(e),this.importInput.messages=e,t("save",e.saveButton),this.field("url").title=e.transcriptHint,this.field("by").title=e.byHint;const s=this.current,n=this.shadow.activeElement,a=(l,h)=>{this.field(l)!==n&&(this.field(l).value=h)};a("title",this.said.read(s?.title)??""),a("time",s?.time??""),a("by",f.byText(s?.by)),a("url",s?.url??""),a("summary",this.said.read(s?.summary)??"");const o=[s?.interviewOf].flat().filter(l=>typeof l=="string"),p=this.shadow.getElementById("witness"),d=[...this.options,...o.filter(l=>!this.options.some(h=>h.id===l)).map(l=>({id:l,label:l}))];p.replaceChildren(p.querySelector("legend"),...d.map(l=>{const h=document.createElement("label"),u=document.createElement("input");return u.type="checkbox",u.value=l.id,u.checked=o.includes(l.id),h.append(u,l.label),h}));const c=this.shadow.getElementById("medium");if(c.replaceChildren(...N.ALL.map(l=>new Option(N.label(l,this.language),l))),s?.medium!==void 0&&!N.ALL.includes(s.medium)&&c.append(new Option(String(s.medium),String(s.medium))),s?.medium===void 0){const l=new Option(e.witnessNone,"");l.disabled=!0,l.hidden=!0,c.prepend(l)}c.value=s?.medium??"",this.applyReadonly()}write(e){const t=this.current;if(!t)return;const r=e==="witness"?"":this.field(e).value;switch(e){case"title":{const i=this.said.write(t.title,r,this.language);i===void 0?delete t.title:t.title=i;break}case"summary":{const i=this.said.write(t.summary,r,this.language);i===void 0?delete t.summary:t.summary=i;break}case"time":r.trim()===""?delete t.time:t.time=r.trim();break;case"url":r.trim()===""?delete t.url:t.url=r.trim();break;case"by":{const i=r.split(",").map(s=>s.trim()).filter(s=>s!=="");i.length===0?delete t.by:t.by=i.map(s=>({people:s}));break}case"witness":{const i=[...this.shadow.querySelectorAll("#witness input:checked")].map(s=>s.value);if(i.length===0){this.render();return}t.interviewOf=i.length===1?i[0]:i;break}case"medium":r===""?delete t.medium:t.medium=r;break}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:e,event:t}})),e==="medium"&&this.render(),e!=="url"&&this.syncFileFromEvent()}openGroup(e){this.group=e;const t={summary:"group-summary",form:"group-form",exchanges:"group-exchanges",file:"group-transcript"};for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.setAttribute("aria-expanded",String(r.getAttribute("aria-controls")===t[e]));for(const[r,i]of Object.entries(t))this.shadow.getElementById(i).hidden=r!==e;e==="file"&&this.showTranscript(),e==="exchanges"&&this.showExchanges(),e==="form"&&(this.formShown=this.showForm())}form;formToken=0;formShown=Promise.resolve();get heldThroughQuestionnaire(){return this.current?.medium==="questionnaire"}async showForm(){const e=this.current;if(!e||!this.heldThroughQuestionnaire)return;const t=++this.formToken,[{QuestionnaireForm:r},{QuestionnaireTemplates:i},s]=await Promise.all([w(()=>import("./QuestionnaireForm-U78nFPn5.js"),__vite__mapDeps([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]),import.meta.url),w(()=>import("./CaseEditorElement-0J_TCeiq.js").then(u=>u.a),__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url),this.transcriptJson(e)]);await this.ready;const n=s?.questionnaire?.id??i.DEFAULT,a=await i.load(n);if(t!==this.formToken||this.current!==e)return;const o=this.messages,p=this.shadow.getElementById("form-note");y.show(p,a?void 0:o.unknownQuestionnaire.replace("{id}",n),"warning"),this.form??=new r(this.shadow.getElementById("form-fields"),(u,m,b)=>void this.answerField(u,m,b),(u,m,b)=>void this.giveFiles(u,m,b));const d=this.transcriptUrl(e)??new URL(`${e.id??"interview"}.json`,this.base??location.href).href;this.form.show(a??{id:n,title:n,sections:[]},s,o.questionnaire,this.language,this.hasAttribute("readonly"),u=>this.confidentialAnswers.get(this.confidentialKey(e,u)),{add:u=>M.add(u,d),shown:u=>M.shown(u,d),messages:o});const c=this.shadow.getElementById("form-feed");c.disabled=this.hasAttribute("readonly"),this.formRecipient=s?.questionnaire?.recipient,this.formTitle=a?i.text(a.title,this.language):n;const l=this.shadow.getElementById("form-send"),h=this.formRecipient?this.said.read(this.formRecipient.name)??"":void 0;l.textContent=h?o.send.replace("{name}",h):o.sendPrepare,l.disabled=this.hasAttribute("readonly"),O.say(this.shadow.getElementById("form-send-hint"),"",h&&this.formRecipient?.email?o.sendHint.replace("{email}",this.formRecipient.email):o.sendPrepareHint)}async answerField(e,t,r,i){const{QuestionnaireTemplates:s}=await w(async()=>{const{QuestionnaireTemplates:c}=await import("./CaseEditorElement-0J_TCeiq.js").then(l=>l.a);return{QuestionnaireTemplates:c}},__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url),n=this.current;if(!n)return;const a=await this.transcriptJson(n),o=await s.load(a?.questionnaire?.id??s.DEFAULT),p=o?s.field(o,e)?.confidential:void 0;let d;if(p){const c=this.confidentialKey(n,e),l=t.trim();if(l==="")this.confidentialAnswers.delete(c);else{this.confidentialAnswers.set(c,l);const h=a?.questionnaire?.recipient,{QuestionnaireSeal:u}=await w(async()=>{const{QuestionnaireSeal:m}=await import("./QuestionnaireSeal-DpZYUhnf.js");return{QuestionnaireSeal:m}},[],import.meta.url);d={reason:p.reason,...h?{sealed:await u.seal(l,h)}:{}}}}await this.editTranscript(c=>{if(o&&!c.segments.some(l=>l.field!==void 0)){const l=s.interview(o);c.segments=l.segments,c.questionnaire=l.questionnaire,l.language&&!c.language&&(c.language=l.language);for(const[h,u]of Object.entries(l.speakers))c.speakers[h]??=u}c.medium="questionnaire",i?i(c):s.answer(c,e,t,r,d)})}async giveFiles(e,t,r){const{QuestionnaireTemplates:i}=await w(async()=>{const{QuestionnaireTemplates:s}=await import("./CaseEditorElement-0J_TCeiq.js").then(n=>n.a);return{QuestionnaireTemplates:s}},__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url);this.current&&await this.answerField(e,"",r,s=>i.answerFiles(s,e,t,r))}static openers=new Map;static openerFor(e){for(const t of P.point("sealed").sources){let r=f.openers.get(t);if(r||f.openers.set(t,r=t.create()),r.recipient===e)return{source:t,opener:r}}}offerOpening(e,t,r){const i=f.openerFor(r.for),s=this.current;if(!i||!s)return;const n=this.messages,a=t.field!==void 0?this.confidentialKey(s,t.field):void 0,o=document.createElement("div");o.className="sealed-open";const p=c=>{const l=document.createElement("p");l.className="opened",l.textContent=c;const h=document.createElement("p");h.className="opened-note",h.textContent=n.sealOpened.replace("{name}",i.source.name),o.replaceChildren(l,h)},d=a!==void 0?this.confidentialAnswers.get(a):void 0;if(d!==void 0)p(d);else{const c=document.createElement("button");c.type="button",c.className="pill-btn",c.textContent=n.sealOpen.replace("{name}",i.source.name),c.addEventListener("click",()=>{i.opener.open(r).then(h=>{h!==void 0&&(a!==void 0&&this.confidentialAnswers.set(a,h),p(h))},()=>y.show(l,n.sealFailed,"error"))});const l=document.createElement("p");l.className="opened-note",o.replaceChildren(c,l)}e.append(o)}confidentialAnswers=new Map;confidentialKey(e,t){return`${e.id??e.url??""}\0${t}`}formRecipient;formTitle="";sendQuestionnaire(){const e=this.messages,t=this.formRecipient,r=t?this.said.read(t.name)??"":"",i=this.shadow.getElementById("form-sent"),s={...t?.email?{email:t.email}:{},subject:e.sendSubject.replace("{title}",this.formTitle),body:e.sendBody.replace("{title}",this.formTitle)+(t?`
|
|
291
|
+
`;class f extends HTMLElement{shadow=this.attachShadow({mode:"open"});get importInput(){return this.shadow.getElementById("import")}messages;said=new $(["en"]);language="en";localeToken=0;current;options=[];group="summary";base;text;fileEditor;fileEditorLoading;shownFor;ready=Promise.resolve();player;drawn;takenOut=new Map;redactTarget;exchangesShown=Promise.resolve();lastReason;static transcriptionSourceId=T[0].id;transcribing;constructor(){super(),this.shadow.innerHTML=te,customElements.upgrade(this.shadow),this.importInput.build();for(const r of["title","time","by","url","summary","witness","medium"])this.shadow.getElementById(r).addEventListener(r==="witness"||r==="medium"?"change":"input",()=>this.write(r));for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.addEventListener("click",()=>this.openGroup(f.GROUPS[r.getAttribute("aria-controls")]??"summary"));this.shadow.getElementById("url").addEventListener("change",()=>{this.shownFor=void 0,this.text===void 0&&this.group==="file"&&this.showTranscript()}),this.importInput.addEventListener("filepick",r=>{const i=r.detail;i.file?this.importFromFile(i.file):this.importFromUrl(i.url)}),this.shadow.getElementById("save").addEventListener("click",()=>this.save()),this.shadow.getElementById("form-feed").addEventListener("click",()=>this.feedObservation()),this.shadow.getElementById("form-send").addEventListener("click",()=>this.sendQuestionnaire()),this.shadow.getElementById("transcribe-start").addEventListener("click",()=>void this.transcribe()),this.shadow.getElementById("transcribe-stop").addEventListener("click",()=>this.transcribing?.abort()),this.shadow.getElementById("transcribe-source").addEventListener("change",r=>{f.transcriptionSourceId=r.target.value,this.transcribeOutcome=void 0,this.renderTranscribe()}),this.shadow.getElementById("transcribe-key").addEventListener("input",r=>{A.set(f.transcriptionSourceId,r.target.value),this.renderTranscribeStart()});const e=this.shadow.getElementById("exchanges");e.addEventListener("pointerup",()=>setTimeout(()=>this.selectionMade(),0)),e.addEventListener("keyup",r=>{r.shiftKey&&this.selectionMade()}),e.addEventListener("click",r=>{const i=r.target.closest(".bar.redacted-label");i&&this.openBar(i)}),e.addEventListener("keydown",r=>{const i=r.target.closest(".bar.redacted-label");i&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this.openBar(i))}),this.shadow.getElementById("redact-take").addEventListener("click",()=>void this.redactSelection()),this.shadow.getElementById("redact-restore").addEventListener("click",()=>{const r=this.redactTarget;this.closeRedactPop(),r?.kind==="bar"&&r.restorable&&this.restore(r.restorable)});const t=this.field("redact-reason");t.addEventListener("change",()=>{this.redactTarget?.kind==="bar"&&this.changeReason()}),t.addEventListener("keydown",r=>{r.key==="Escape"&&this.closeRedactPop(),r.key==="Enter"&&(r.preventDefault(),this.redactTarget?.kind==="selection"?this.redactSelection():this.changeReason().then(()=>this.closeRedactPop()))})}static GROUPS={"group-summary":"summary","group-form":"form","group-exchanges":"exchanges","group-transcript":"file"};static get observedAttributes(){return["readonly"]}attributeChangedCallback(){this.applyReadonly()}connectedCallback(){this.ready=this.loadLocale(),document.addEventListener("pointerdown",this.pressedElsewhere,!0)}pressedElsewhere=e=>{const t=this.shadow.getElementById("redact-pop");t&&!t.hidden&&!e.composedPath().includes(t)&&this.closeRedactPop()};disconnectedCallback(){document.removeEventListener("pointerdown",this.pressedElsewhere,!0),queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor&&(this.text=this.fileEditor.text,this.fileEditor.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0,this.shownFor=void 0)}get event(){return this.current}set event(e){const t=e!==this.current;t&&(this.shownFor=void 0),this.current=e,this.render(),t&&this.heldThroughQuestionnaire?this.openGroup("form"):this.group==="form"&&(this.formShown=this.showForm()),this.takenOut.clear(),this.group==="file"&&this.showTranscript(),queueMicrotask(()=>{this.current===e&&this.showExchanges()})}set witnesses(e){this.options=e,this.render()}set documentUrl(e){this.base=e}get transcriptText(){return this.text}set transcriptText(e){this.text=e,this.shownFor=void 0}field(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=z.preferencesFor(this),r=J(t,j),i=await G.load(r);e===this.localeToken&&(this.language=r,this.said=new $(t),this.messages=i,this.player||(this.player=new D(this.shadow.getElementById("player"),{timeChanged:s=>this.markCurrentTurn(s),recordingsChanged:s=>void this.editTranscript(n=>{s.length===0?delete n.recordings:n.recordings=s})},i),this.render()),this.render())}applyReadonly(){const e=this.hasAttribute("readonly");for(const t of["title","time","by","url","summary"])this.field(t).readOnly=e;for(const t of this.shadow.querySelectorAll("#witness input"))t.disabled=e;this.field("medium").disabled=e,this.importInput.disabled=e,this.renderTranscribe()}static byText(e){return(e??[]).map(t=>"people"in t?t.people:"org"in t?t.org:t.title??"").filter(t=>t!=="").join(", ")}render(){const e=this.messages;if(!e)return;const t=(l,h)=>{this.shadow.getElementById(l).textContent=h};t("label-summary-group",e.summaryTab),t("label-file-group",e.fileTab),t("label-exchanges-group",e.exchangesTab),t("label-form-group",e.questionnaireTab),t("form-feed",e.feed),O.say(this.shadow.getElementById("form-feed-hint"),"",e.feedHint);const r=this.shadow.getElementById("form-tab");r.hidden=!this.heldThroughQuestionnaire,!this.heldThroughQuestionnaire&&this.group==="form"&&this.openGroup("summary"),t("label-title",e.title),t("label-witness",e.witness),t("label-medium",e.medium),t("label-time",e.time),t("label-by",e.by),t("label-summary",e.summary),t("label-url",e.transcript),O.say(this.shadow.getElementById("label-import-file"),e.importFile,e.importFileHint),t("redact-take",e.redactSelection),t("redact-restore",e.redactRestore),t("label-redact-reason",e.redactReasonLabel);const i=this.field("redact-reason");i.placeholder=e.redactReason,i.title=e.redactReasonHint,t("transcribe-start",e.transcribe),this.shadow.getElementById("transcribe-hint").replaceChildren(O.of(e.transcribeHint)),t("label-transcribe-with",e.transcribeWith),t("label-transcribe-key",e.transcribeKey),t("transcribe-key-get",e.transcribeKeyGet),t("transcribe-stop",e.transcribeStop),this.field("transcribe-key").title=e.transcribeKeyHint,this.renderTranscribe(),this.player?.setMessages(e),this.importInput.messages=e,t("save",e.saveButton),this.field("url").title=e.transcriptHint,this.field("by").title=e.byHint;const s=this.current,n=this.shadow.activeElement,a=(l,h)=>{this.field(l)!==n&&(this.field(l).value=h)};a("title",this.said.read(s?.title)??""),a("time",s?.time??""),a("by",f.byText(s?.by)),a("url",s?.url??""),a("summary",this.said.read(s?.summary)??"");const o=[s?.interviewOf].flat().filter(l=>typeof l=="string"),p=this.shadow.getElementById("witness"),d=[...this.options,...o.filter(l=>!this.options.some(h=>h.id===l)).map(l=>({id:l,label:l}))];p.replaceChildren(p.querySelector("legend"),...d.map(l=>{const h=document.createElement("label"),u=document.createElement("input");return u.type="checkbox",u.value=l.id,u.checked=o.includes(l.id),h.append(u,l.label),h}));const c=this.shadow.getElementById("medium");if(c.replaceChildren(...N.ALL.map(l=>new Option(N.label(l,this.language),l))),s?.medium!==void 0&&!N.ALL.includes(s.medium)&&c.append(new Option(String(s.medium),String(s.medium))),s?.medium===void 0){const l=new Option(e.witnessNone,"");l.disabled=!0,l.hidden=!0,c.prepend(l)}c.value=s?.medium??"",this.applyReadonly()}write(e){const t=this.current;if(!t)return;const r=e==="witness"?"":this.field(e).value;switch(e){case"title":{const i=this.said.write(t.title,r,this.language);i===void 0?delete t.title:t.title=i;break}case"summary":{const i=this.said.write(t.summary,r,this.language);i===void 0?delete t.summary:t.summary=i;break}case"time":r.trim()===""?delete t.time:t.time=r.trim();break;case"url":r.trim()===""?delete t.url:t.url=r.trim();break;case"by":{const i=r.split(",").map(s=>s.trim()).filter(s=>s!=="");i.length===0?delete t.by:t.by=i.map(s=>({people:s}));break}case"witness":{const i=[...this.shadow.querySelectorAll("#witness input:checked")].map(s=>s.value);if(i.length===0){this.render();return}t.interviewOf=i.length===1?i[0]:i;break}case"medium":r===""?delete t.medium:t.medium=r;break}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:e,event:t}})),e==="medium"&&this.render(),e!=="url"&&this.syncFileFromEvent()}openGroup(e){this.group=e;const t={summary:"group-summary",form:"group-form",exchanges:"group-exchanges",file:"group-transcript"};for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.setAttribute("aria-expanded",String(r.getAttribute("aria-controls")===t[e]));for(const[r,i]of Object.entries(t))this.shadow.getElementById(i).hidden=r!==e;e==="file"&&this.showTranscript(),e==="exchanges"&&this.showExchanges(),e==="form"&&(this.formShown=this.showForm())}form;formToken=0;formShown=Promise.resolve();get heldThroughQuestionnaire(){return this.current?.medium==="questionnaire"}async showForm(){const e=this.current;if(!e||!this.heldThroughQuestionnaire)return;const t=++this.formToken,[{QuestionnaireForm:r},{QuestionnaireTemplates:i},s]=await Promise.all([w(()=>import("./QuestionnaireForm-LkllpNx-.js"),__vite__mapDeps([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]),import.meta.url),w(()=>import("./CaseEditorElement-HR8RFluQ.js").then(u=>u.a),__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url),this.transcriptJson(e)]);await this.ready;const n=s?.questionnaire?.id??i.DEFAULT,a=await i.load(n);if(t!==this.formToken||this.current!==e)return;const o=this.messages,p=this.shadow.getElementById("form-note");y.show(p,a?void 0:o.unknownQuestionnaire.replace("{id}",n),"warning"),this.form??=new r(this.shadow.getElementById("form-fields"),(u,m,b)=>void this.answerField(u,m,b),(u,m,b)=>void this.giveFiles(u,m,b));const d=this.transcriptUrl(e)??new URL(`${e.id??"interview"}.json`,this.base??location.href).href;this.form.show(a??{id:n,title:n,sections:[]},s,o.questionnaire,this.language,this.hasAttribute("readonly"),u=>this.confidentialAnswers.get(this.confidentialKey(e,u)),{add:u=>M.add(u,d),shown:u=>M.shown(u,d),messages:o});const c=this.shadow.getElementById("form-feed");c.disabled=this.hasAttribute("readonly"),this.formRecipient=s?.questionnaire?.recipient,this.formTitle=a?i.text(a.title,this.language):n;const l=this.shadow.getElementById("form-send"),h=this.formRecipient?this.said.read(this.formRecipient.name)??"":void 0;l.textContent=h?o.send.replace("{name}",h):o.sendPrepare,l.disabled=this.hasAttribute("readonly"),O.say(this.shadow.getElementById("form-send-hint"),"",h&&this.formRecipient?.email?o.sendHint.replace("{email}",this.formRecipient.email):o.sendPrepareHint)}async answerField(e,t,r,i){const{QuestionnaireTemplates:s}=await w(async()=>{const{QuestionnaireTemplates:c}=await import("./CaseEditorElement-HR8RFluQ.js").then(l=>l.a);return{QuestionnaireTemplates:c}},__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url),n=this.current;if(!n)return;const a=await this.transcriptJson(n),o=await s.load(a?.questionnaire?.id??s.DEFAULT),p=o?s.field(o,e)?.confidential:void 0;let d;if(p){const c=this.confidentialKey(n,e),l=t.trim();if(l==="")this.confidentialAnswers.delete(c);else{this.confidentialAnswers.set(c,l);const h=a?.questionnaire?.recipient,{QuestionnaireSeal:u}=await w(async()=>{const{QuestionnaireSeal:m}=await import("./QuestionnaireSeal-DpZYUhnf.js");return{QuestionnaireSeal:m}},[],import.meta.url);d={reason:p.reason,...h?{sealed:await u.seal(l,h)}:{}}}}await this.editTranscript(c=>{if(o&&!c.segments.some(l=>l.field!==void 0)){const l=s.interview(o);c.segments=l.segments,c.questionnaire=l.questionnaire,l.language&&!c.language&&(c.language=l.language);for(const[h,u]of Object.entries(l.speakers))c.speakers[h]??=u}c.medium="questionnaire",i?i(c):s.answer(c,e,t,r,d)})}async giveFiles(e,t,r){const{QuestionnaireTemplates:i}=await w(async()=>{const{QuestionnaireTemplates:s}=await import("./CaseEditorElement-HR8RFluQ.js").then(n=>n.a);return{QuestionnaireTemplates:s}},__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url);this.current&&await this.answerField(e,"",r,s=>i.answerFiles(s,e,t,r))}static openers=new Map;static openerFor(e){for(const t of P.point("sealed").sources){let r=f.openers.get(t);if(r||f.openers.set(t,r=t.create()),r.recipient===e)return{source:t,opener:r}}}offerOpening(e,t,r){const i=f.openerFor(r.for),s=this.current;if(!i||!s)return;const n=this.messages,a=t.field!==void 0?this.confidentialKey(s,t.field):void 0,o=document.createElement("div");o.className="sealed-open";const p=c=>{const l=document.createElement("p");l.className="opened",l.textContent=c;const h=document.createElement("p");h.className="opened-note",h.textContent=n.sealOpened.replace("{name}",i.source.name),o.replaceChildren(l,h)},d=a!==void 0?this.confidentialAnswers.get(a):void 0;if(d!==void 0)p(d);else{const c=document.createElement("button");c.type="button",c.className="pill-btn",c.textContent=n.sealOpen.replace("{name}",i.source.name),c.addEventListener("click",()=>{i.opener.open(r).then(h=>{h!==void 0&&(a!==void 0&&this.confidentialAnswers.set(a,h),p(h))},()=>y.show(l,n.sealFailed,"error"))});const l=document.createElement("p");l.className="opened-note",o.replaceChildren(c,l)}e.append(o)}confidentialAnswers=new Map;confidentialKey(e,t){return`${e.id??e.url??""}\0${t}`}formRecipient;formTitle="";sendQuestionnaire(){const e=this.messages,t=this.formRecipient,r=t?this.said.read(t.name)??"":"",i=this.shadow.getElementById("form-sent"),s={...t?.email?{email:t.email}:{},subject:e.sendSubject.replace("{title}",this.formTitle),body:e.sendBody.replace("{title}",this.formTitle)+(t?`
|
|
292
292
|
|
|
293
293
|
${e.sendSealed.replace("{name}",r)}`:""),attach:e.sendAttach,report:(n,a)=>y.show(i,(n==="shared"?e.sent:n==="prepared"?e.sendPrepared:e.sendFailed).replace("{file}",a).replace("{error}",a),n==="failed"?"error":"info")};this.dispatchEvent(new CustomEvent(Y,{bubbles:!0,composed:!0,detail:s}))}feedObservation(){const e=this.current;e&&this.transcriptJson(e).then(t=>{const r=this.shadow.getElementById("form-fed"),i=s=>y.show(r,s>0?this.messages.fed.replace("{n}",String(s)):this.messages.fedNothing,s>0?"info":"warning");if(!t){i(0);return}this.dispatchEvent(new CustomEvent(X,{bubbles:!0,composed:!0,detail:{event:e,json:t,report:i}}))})}exchangesToken=0;async transcriptJson(e){try{const t=this.fileEditor?.text??this.text;if(t!==void 0)return v.read(JSON.parse(t));const r=this.transcriptUrl(e);if(r!==void 0)return v.read(await I.json(r))}catch{}}async showExchanges(){const e=this.current;if(!e)return;const t=++this.exchangesToken,r=await this.transcriptJson(e);await this.ready,!(t!==this.exchangesToken||this.current!==e)&&this.drawExchanges(r)}drawExchanges(e){const t=this.shadow.getElementById("exchanges");t.documentUrl=this.current?this.transcriptUrl(this.current):void 0,t.interview=e,this.drawn=e,this.player?.show(e,this.current?this.transcriptUrl(this.current):void 0),this.renderReview(e),this.renderRedactReasons(e),this.decorateExchanges(e),this.renderTranscribe()}async editTranscript(e){const t=this.current;if(!t||this.hasAttribute("readonly"))return;const r=await this.transcriptJson(t)??JSON.parse(this.template(t));Array.isArray(r.segments)||(r.segments=[]),e(r);const i=f.pretty(f.withEventFields(r,t));this.fileEditor?.replaceText(i,!1),this.onEdited(i),await this.exchangesShown}get redactReason(){return this.reasonOf(this.lastReason)}reasonOf(e){e=e?.trim()||this.messages.redactReason;const t=this.givenReasons(this.drawn).find(r=>this.said.read(r)===e);return t!==void 0?typeof t=="string"?t:{...t}:this.said.write(void 0,e,this.language)??e}givenReasons(e){const t=new Map;for(const r of e?.segments??[])for(const i of[r.redacted,...(r.parts??[]).map(s=>"redacted"in s?s.redacted:void 0)]){if(!i)continue;const s=JSON.stringify(i.reason),n=t.get(s);n?n.n++:t.set(s,{reason:i.reason,n:1})}return[...t.values()].sort((r,i)=>i.n-r.n).map(r=>r.reason)}renderRedactReasons(e){const t=this.messages;if(!t)return;const r=this.givenReasons(e).map(n=>this.said.read(n)??"").filter(n=>n!==""),i=t.redactReasons.filter(n=>!r.some(a=>a.toLowerCase().startsWith(n.toLowerCase()))),s=[...new Set([...r,...i])];this.shadow.getElementById("redact-reasons").replaceChildren(...s.map(n=>new Option(n,n)))}speakerLabel(e,t){const r=v.speakerName(e,t),i=e.speakers?.[t]?.role;return i===v.UNATTRIBUTED&&e.speakers[t].title?this.messages.voiceNamed.replace("{name}",r):r===i&&i in this.messages.roles?this.messages.roles[i]:r}renderReview(e){const t=this.shadow.getElementById("review"),r=Object.entries(e?.speakers??{}).filter(([,o])=>o.role!==v.UNATTRIBUTED).map(([o])=>o);if(t.hidden=!e||r.length===0,!e||r.length===0)return;const i=o=>["approved","covered"].includes(e.proofreading?.[o]?.status??""),s=r.filter(o=>!i(o)),n=document.createElement("span");n.textContent=s.length===0?this.messages.proofreadAll:this.messages.proofreadPending.replace("{names}",s.map(o=>this.speakerLabel(e,o)).join(", ")),t.toggleAttribute("data-done",s.length===0);const a=document.createElement("span");a.className="review-boxes";for(const o of r){const p=document.createElement("label"),d=document.createElement("input");d.type="checkbox",d.checked=i(o),d.disabled=this.hasAttribute("readonly"),d.addEventListener("change",()=>void this.editTranscript(c=>{c.proofreading??={},d.checked?c.proofreading[o]={status:"approved",date:new Date().toISOString().slice(0,10)}:c.proofreading[o]={status:"pending"}})),p.append(d,this.messages.reviewedBy.replace("{name}",this.speakerLabel(e,o))),a.append(p)}t.replaceChildren(n,a)}momentsOf(e,t){const r=e.speakers?.[t]?.of??v.sightingsOf(e)[0];return this.options.find(i=>i.id===r)?.moments??this.options.flatMap(i=>i.moments??[])}decorateExchanges(e){if(!e)return;const t=this.messages,r=this.hasAttribute("readonly");for(const i of this.shadow.querySelectorAll("#exchanges .turn[data-segment]")){const s=Number(i.dataset.segment),n=e.segments[s];if(!n)continue;if(n.start!==void 0){const d=document.createElement("button");d.type="button",d.className="turn-time",d.textContent=v.clock(n.start),d.addEventListener("click",()=>this.player?.seek(n.start)),i.prepend(d)}const a=n.redacted?[n.redacted]:g.partsOf(n).flatMap(d=>"redacted"in d?[d.redacted]:[]);i.querySelectorAll(".bar").forEach((d,c)=>{const l=a[c]?.words;d.textContent=l!==void 0?t.redactedWords.replace("{n}",String(l)):t.redacted,d.classList.add("redacted-label");const h=n.redacted?`${s}:all`:`${s}:${c}`;this.takenOut.has(h)&&(d.dataset.restorable=h)});const o=n.redacted?.sealed;o&&this.offerOpening(i,n,o);const p=this.momentsOf(e,n.speaker);i.querySelectorAll(".ref").forEach((d,c)=>{const l=n.refs?.[c];if(!l)return;const h=p.find(m=>Math.abs(m.at-l.at)<.05);if(h){const m=document.createElement("span");m.className="moment-letter",m.textContent=h.label.slice(0,2),d.replaceChildren(m,t.momentLabel.replace("{k}",h.label).replace("{text}",h.note??v.clock(l.at)))}if(r)return;const u=document.createElement("button");u.type="button",u.className="ref-unlink",u.textContent="×",u.title=t.unlinkMoment,u.setAttribute("aria-label",t.unlinkMoment),u.addEventListener("click",()=>void this.editTranscript(m=>{m.segments[s].refs?.splice(c,1),m.segments[s].refs?.length===0&&delete m.segments[s].refs})),d.after(u)}),r||i.append(this.turnTools(e,s,n,p))}}turnTools(e,t,r,i){const s=this.messages,n=document.createElement("div");n.className="turn-tools";const a=(d,c)=>{const l=document.createElement("button");return l.type="button",l.textContent=d,l.addEventListener("click",c),l};if(e.speakers?.[r.speaker]?.role==="witness"&&!r.redacted){const d=a(s.linkMoment,()=>{});n.append(d),new F(d,`moment-menu-${t}`,l=>void this.editTranscript(h=>{const u=h.segments[t].refs??[];u.some(m=>Math.abs(m.at-Number(l))<.05)||u.push({at:Number(l)}),h.segments[t].refs=u}),l=>`moment-${t}-${l}`).setKinds(i.length>0?i.map(l=>({value:String(l.at),label:s.momentLabel.replace("{k}",l.label).replace("{text}",l.note??v.clock(l.at))})):[{value:"",label:s.noMoments,disabledReason:s.noMoments}])}if(r.redacted||n.append(a(s.editTurn,()=>this.editTurn(t))),!r.redacted&&!this.hasAttribute("readonly")){const d=a(s.whoSpeaks,()=>{});n.append(d),new F(d,`speaker-menu-${t}`,l=>void w(async()=>{const{InterviewImport:h}=await import("./interviewImport-ym5iXO4Z.js");return{InterviewImport:h}},__vite__mapDeps([27,26,7]),import.meta.url).then(({InterviewImport:h})=>this.editTranscript(u=>{h.attribute(u,t,l)})),l=>`speaker-${t}-${l}`).setKinds(Object.keys(e.speakers??{}).map(l=>({value:l,label:this.speakerLabel(e,l),...l===r.speaker?{disabledReason:this.speakerLabel(e,l)}:{}})))}const o=this.takenOut.has(`${t}:all`)||[...this.takenOut.keys()].some(d=>d.startsWith(`${t}:`));if(r.redacted||r.parts&&o){const d=a(s.restoreAll,()=>void this.restoreAll(t));d.disabled=!o,n.append(d)}else n.append(a(s.redactAll,()=>void this.editTranscript(d=>{this.forget(t),this.takenOut.set(`${t}:all`,g.redactWhole(d.segments[t],this.redactReason))}).then(()=>{const d=this.shadow.querySelector(`#exchanges .turn[data-segment="${t}"] .bar.redacted-label`);d&&this.openBar(d)})));const p=a("",()=>void this.editTranscript(d=>{d.segments.splice(t,1),this.shiftTakenOut(t)}));return p.className="icon-btn",p.innerHTML=x.TRASH,p.title=s.deleteTurn,p.setAttribute("aria-label",s.deleteTurn),n.append(p),n}selectionMade(){const e=this.messages;if(!e||this.hasAttribute("readonly"))return;const t=this.shadow.getSelection?.()??document.getSelection(),r=t&&t.rangeCount>0?t.getRangeAt(0):void 0,i=this.shadow.getElementById("exchanges");if(!r||r.collapsed||!i.contains(r.startContainer)||!i.contains(r.endContainer))return;const s=l=>l instanceof Element?l:l.parentElement,n=s(r.startContainer)?.closest(".said");if(!n&&!s(r.endContainer)?.closest(".said"))return;const a=n&&s(r.endContainer)?.closest(".said")===n&&!s(r.startContainer)?.closest(".bar")&&!s(r.endContainer)?.closest(".bar"),o=r.getBoundingClientRect();if(!a){this.openRedactPop({kind:"selection",index:-1,from:0,to:0},o,e.selectionOnePassage);return}const p=Number(n.closest(".turn").dataset.segment),d=f.offsetIn(n,r.startContainer,r.startOffset),c=f.offsetIn(n,r.endContainer,r.endOffset);this.openRedactPop({kind:"selection",index:p,from:Math.min(d,c),to:Math.max(d,c)},o),f.markPending(r)}static PENDING="rr0-redact-pending";static markPending(e){const t=globalThis.CSS?.highlights,r=globalThis.Highlight;!t||!r||(e?t.set(f.PENDING,new r(e.cloneRange())):t.delete(f.PENDING))}openBar(e){if(this.hasAttribute("readonly"))return;const t=e.closest(".turn");if(!t)return;const r=Number(t.dataset.segment),i=[...t.querySelectorAll(".bar")].indexOf(e),s=this.drawn?.segments[r];if(!s)return;const n=s.redacted?"all":i,a=`${r}:${n}`;this.openRedactPop({kind:"bar",index:r,nth:n,restorable:this.takenOut.has(a)?a:void 0},e.getBoundingClientRect())}openRedactPop(e,t,r){const i=this.shadow.getElementById("redact-pop"),s=this.field("redact-reason");f.markPending(),this.redactTarget=e;const n=this.shadow.getElementById("redact-take"),a=this.shadow.getElementById("redact-restore");n.hidden=e.kind!=="selection",n.disabled=!!r,a.hidden=e.kind!=="bar"||!e.restorable,s.disabled=!!r,s.value=e.kind==="bar"?this.said.read(this.redactionAt(this.drawn,e.index,e.nth)?.reason)??"":this.lastReason??"";const o=this.shadow.getElementById("redact-note");o.textContent=r??"",o.classList.toggle("error",!!r),i.hidden=!1,typeof i.showPopover=="function"&&i.isConnected&&(i.setAttribute("popover","manual"),i.matches(":popover-open")||i.showPopover());const p=i.offsetWidth||320,d=i.offsetHeight||120,c=t.bottom+6+d<=window.innerHeight;i.style.top=`${Math.max(8,c?t.bottom+6:t.top-6-d)}px`,i.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-p-8))}px`,r||s.focus({preventScroll:!0})}closeRedactPop(){const e=this.shadow.getElementById("redact-pop");this.redactTarget=void 0,f.markPending(),typeof e.hidePopover=="function"&&e.matches?.(":popover-open")&&e.hidePopover(),e.hidden=!0}redactionAt(e,t,r){const i=e?.segments[t];if(i)return r==="all"?i.redacted:g.partsOf(i).flatMap(s=>"redacted"in s?[s.redacted]:[])[r]}async changeReason(){const e=this.redactTarget;if(e?.kind!=="bar")return;const t=this.reasonOf(this.field("redact-reason").value),r=this.redactionAt(this.drawn,e.index,e.nth);!r||JSON.stringify(r.reason)===JSON.stringify(t)||await this.editTranscript(i=>{if(e.nth!=="all"){const n=this.redactionAt(i,e.index,e.nth);n&&(n.reason=t);return}const s=JSON.stringify(i.segments[e.index].redacted?.reason);for(let n=e.index;n<i.segments.length;n++){const a=i.segments[n].redacted;if(!a||n>e.index&&JSON.stringify(a.reason)!==s)break;a.reason=t}})}async redactSelection(){const e=this.messages,t=this.redactTarget;if(t?.kind!=="selection"||t.index<0)return;this.lastReason=this.field("redact-reason").value.trim()||void 0;const r=this.redactReason;let i=!1;if(await this.editTranscript(s=>{const n=g.redact(s.segments[t.index],t.from,t.to,r);n&&(i=!0,this.shiftParts(t.index,n.nth),this.takenOut.set(`${t.index}:${n.nth}`,n.text))}),!i){const s=this.shadow.getElementById("redact-note");s.textContent=e.selectionOnePassage,s.classList.add("error");return}this.closeRedactPop(),(this.shadow.getSelection?.()??document.getSelection())?.removeAllRanges()}static offsetIn(e,t,r){let i=0;const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:n=>n.parentElement?.closest(".bar")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(let n=s.nextNode();n;n=s.nextNode()){if(n===t)return i+r;if(t.contains(n)&&t!==n){const o=[...t.childNodes].slice(0,r);return i+o.reduce((p,d)=>p+(d instanceof Element&&d.closest(".bar")?0:(d.textContent??"").length),0)}i+=(n.textContent??"").length}return i}async restore(e){const t=this.takenOut.get(e);if(t===void 0)return;const[r,i]=e.split(":"),s=Number(r);await this.editTranscript(n=>{i==="all"?g.restoreWhole(n.segments[s],t):(g.restorePart(n.segments[s],Number(i),t),this.shiftParts(s,Number(i),-1)),this.takenOut.delete(e)})}async restoreAll(e){if(this.takenOut.has(`${e}:all`)){await this.restore(`${e}:all`);return}const t=[...this.takenOut.keys()].filter(r=>r.startsWith(`${e}:`)).map(r=>Number(r.split(":")[1])).sort((r,i)=>i-r);for(const r of t)await this.restore(`${e}:${r}`)}editTurn(e){const r=this.drawn?.segments[e],i=this.shadow.querySelector(`#exchanges .turn[data-segment="${e}"] .said`);if(!r||!i)return;const s=this.messages,n=document.createElement("div");n.className="turn-edit";const a=document.createElement("textarea");a.value=g.raw(r,l=>this.takenOut.get(`${e}:${l}`));const o=document.createElement("span");o.className="hint",o.textContent=s.turnEditHint;const p=document.createElement("div");p.className="buttons";const d=document.createElement("button");d.type="button",d.className="pill-btn primary",d.textContent=s.saveTurn,d.addEventListener("click",()=>void this.editTranscript(l=>{const h=g.fromRaw(l.segments[e],a.value,this.redactReason);this.forget(e);for(const[u,m]of h)this.takenOut.set(`${e}:${u}`,m)}));const c=document.createElement("button");c.type="button",c.className="pill-btn",c.textContent=s.cancelTurn,c.addEventListener("click",()=>this.drawExchanges(this.drawn)),p.append(d,c),n.append(a,o,p),i.replaceWith(n),a.focus()}forget(e){for(const t of[...this.takenOut.keys()])t.startsWith(`${e}:`)&&this.takenOut.delete(t)}shiftParts(e,t,r=1){const i=[...this.takenOut].filter(([s])=>s.startsWith(`${e}:`)&&s!==`${e}:all`&&Number(s.split(":")[1])>=t+(r<0?1:0));for(const[s]of i)this.takenOut.delete(s);for(const[s,n]of i)this.takenOut.set(`${e}:${Number(s.split(":")[1])+r}`,n)}shiftTakenOut(e){const t=[...this.takenOut];this.takenOut.clear();for(const[r,i]of t){const[s,n]=r.split(":"),a=Number(s);a<e?this.takenOut.set(r,i):a>e&&this.takenOut.set(`${a-1}:${n}`,i)}}markCurrentTurn(e){const t=this.drawn?.segments??[];let r=-1;t.forEach((n,a)=>{n.start!==void 0&&n.start<=e&&(r=a)});for(const n of this.shadow.querySelectorAll("#exchanges .turn.current"))n.classList.remove("current");const i=this.shadow.querySelector(`#exchanges .turn[data-segment="${r}"]`);if(!i)return;i.classList.add("current");const s=i.closest(".rr0-interview-turns");s&&(i.offsetTop<s.scrollTop||i.offsetTop>s.scrollTop+s.clientHeight-i.offsetHeight)&&s.scrollTo({top:i.offsetTop-s.clientHeight/3,behavior:"smooth"})}async revealSegment(e){this.openGroup("exchanges"),await this.showExchanges(),this.shadow.getElementById("exchanges").revealSegment(e)}transcribeOutcome;renderTranscribe(){this.shadow.getElementById("transcribe").hidden=this.hasAttribute("readonly")||!this.transcribing&&!this.player?.recordingUrl();const e=this.messages;if(!e)return;const t=this.shadow.getElementById("transcribe-source");[...t.options].map(d=>d.value).join()!==T.map(d=>d.id).join()&&t.replaceChildren(...T.map(d=>{const c=new Option(d.name,d.id);return c.title=d.credit,c}));const r=L(T,f.transcriptionSourceId);t.value=r.id;const i=this.shadow.getElementById("transcribe-credit");i.href=r.creditUrl,i.textContent=r.credit,this.shadow.getElementById("transcribe-key-row").hidden=!r.keyUrl,this.shadow.getElementById("transcribe-key-get").href=r.keyUrl??"";const s=this.field("transcribe-key");if(s!==this.shadow.activeElement&&(s.value=A.of(r.id)??""),this.transcribing)return;const n=this.player?.recordingUrl();this.renderTranscribeStart();const a=this.shadow.getElementById("transcribe-note");if(this.transcribeOutcome){y.show(a,this.transcribeOutcome.text,this.transcribeOutcome.kind);return}if(!n){y.show(a,e.transcribeNoRecording);return}const o=r.create(),p=[o.sendsAudio?e.transcribeSends.replace("{name}",r.name):e.transcribeLocal.replace("{mb}",String(Math.round((o.downloadBytes??0)/1e6)))];(this.drawn?.segments?.length??0)>0&&p.push(e.transcribeReplaces),y.show(a,p.join(" "),o.sendsAudio?"warning":"info")}renderTranscribeStart(){if(this.transcribing||!this.messages)return;const e=L(T,f.transcriptionSourceId),t=this.shadow.getElementById("transcribe-start");t.disabled=!!e.keyUrl&&!A.of(e.id),t.title=t.disabled?this.messages.transcribeErrors.noKey:""}showTranscribing(e){this.shadow.getElementById("transcribe-start").disabled=e,this.shadow.getElementById("transcribe-stop").hidden=!e,this.shadow.getElementById("transcribe-source").disabled=e,this.field("transcribe-key").disabled=e,this.shadow.getElementById("transcribe-progress").hidden=!e}showProgress(e){const t=this.messages,r=this.shadow.getElementById("transcribe-note"),i=this.shadow.getElementById("transcribe-progress"),s=n=>String(Math.round(n/1e6));if(e==="reading")i.removeAttribute("value"),y.show(r,t.transcribeReading);else if(e.stage==="loading")e.total?(i.max=e.total,i.value=e.loaded,y.show(r,t.transcribeLoading.replace("{loaded}",s(e.loaded)).replace("{total}",s(e.total)))):(i.removeAttribute("value"),y.show(r,t.transcribeLoadingSoFar.replace("{loaded}",s(e.loaded))));else if(e.stage==="sending"||e.stage==="waiting"){i.removeAttribute("value");const n=L(T,f.transcriptionSourceId).name;y.show(r,(e.stage==="sending"?t.transcribeSending:t.transcribeWaiting).replace("{name}",n))}else i.max=e.total,i.value=e.done,y.show(r,t.transcribeProgress.replace("{done}",v.clock(Math.round(e.done))).replace("{total}",v.clock(Math.round(e.total))))}async transcribe(){const e=this.messages,t=this.current,r=this.player?.recordingUrl();if(!e||!t||this.transcribing||this.hasAttribute("readonly"))return;if(!r){this.player?.showWindow();return}const i=L(T,f.transcriptionSourceId),s=i.create(),n=this.transcribing=new AbortController;this.transcribeOutcome=void 0,this.showTranscribing(!0),this.showProgress("reading");try{const[{TranscriptionAudio:a},{TranscriptionError:o},{InterviewImport:p}]=await Promise.all([w(()=>import("./TranscriptionAudio-C_xvRUv2.js"),[],import.meta.url),w(()=>import("./TranscriptionError-D_TCbYbt.js"),[],import.meta.url),w(()=>import("./interviewImport-ym5iXO4Z.js"),__vite__mapDeps([27,26,7]),import.meta.url)]),d=await fetch(r,{signal:n.signal});if(!d.ok)throw new o("failed",`HTTP ${d.status}`);if(Number(d.headers.get("content-length")??0)>a.MAX_BYTES)throw new o("tooLarge");const c=await d.arrayBuffer();if(c.byteLength>a.MAX_BYTES)throw new o("tooLarge");const l=await a.decode(c).catch(()=>{throw new o("failed",e.loadFailed)}),h=this.drawn?.language??this.language,u=await s.transcribe({samples:l,language:h,signal:n.signal,progress:k=>this.showProgress(k)}),m=[t.interviewOf].flat().filter(k=>typeof k=="string"),b=p.transcribed(u,{by:(t.by??[]).flatMap(k=>"people"in k?[k.people]:[]),witnesses:this.options.filter(k=>m.length===0||m.includes(k.id)).map(({id:k,label:V})=>({id:k,label:V}))});if(!b)throw new o("failed",e.exchangesEmpty);if(n.signal.aborted||this.current!==t)throw new DOMException("Aborted","AbortError");const{anonymization:re,...W}=await this.transcriptJson(t)??{};await this.take({...W,...b,language:h,transcription:{method:"automatic",engine:s.engine,note:`Transcribed in UFO@home by ${s.engine}: whose each voice is was not known, to be attributed, then proofread.`}}),this.transcribeOutcome={text:e.transcribeDone.replace("{engine}",i.name),kind:"info"}}catch(a){const o=a;n.signal.aborted||o?.name==="AbortError"?this.transcribeOutcome={text:e.transcribeStopped,kind:"info"}:o?.name==="TranscriptionError"&&o.code?this.transcribeOutcome={text:e.transcribeErrors[o.code].replace("{detail}",o.detail??""),kind:"error"}:this.transcribeOutcome={text:e.transcribeErrors.failed.replace("{detail}",String(o?.message??a)),kind:"error"}}finally{this.transcribing=void 0,this.showTranscribing(!1),this.renderTranscribe()}}note(e,t="info"){y.show(this.shadow.getElementById("file-note"),e,t)}transcriptUrl(e){return e.url?new URL(e.url,this.base??location.href).href:void 0}static pretty(e){return JSON.stringify(e,null,2)+`
|
|
294
|
-
`}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of f.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const s of f.SHARED)t[s]===void 0?delete r[s]:r[s]=structuredClone(t[s]);const i=r.speakers;if(typeof i=="object"&&i!==null){const s={...i},n=(a,o,p)=>{p.forEach((d,c)=>{const l=c===0?a:`${a}${c+1}`;s[l]?s[l]={...s[l],[o]:d}:c>0&&(s[l]={role:a,[o]:d})})};n("interviewer","by",t.by??[]),n("witness","of",f.witnessesOf(t.interviewOf)),r.speakers=s}return f.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const i=JSON.stringify(f.SHARED.map(a=>r[a])),s=a=>typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a),n={title:s,summary:s,time:a=>typeof a=="string",medium:a=>typeof a=="string",by:a=>Array.isArray(a),interviewOf:a=>typeof a=="string"||Array.isArray(a)};for(const a of f.SHARED){const o=e[a];o!==void 0&&n[a](o)?r[a]=structuredClone(o):t&&delete r[a]}return JSON.stringify(f.SHARED.map(a=>r[a]))!==i}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const i=f.pretty(f.withEventFields(r,e));i!==t&&(this.text=i,this.fileEditor?.replaceText(i,!1),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:i}})))}template(e){return f.pretty(f.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},i]=await Promise.all([w(()=>import("./SightingFileEditor-DS1DRU2p.js"),__vite__mapDeps([28,29,30]),import.meta.url),w(()=>import("./interviewSchema-r5bW7skq.js"),[],import.meta.url),K(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,s=>this.onEdited(s),this.messages.editorLabel,{baseline:e,phrases:i.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const i=await I.json(r);this.current===e&&typeof i=="object"&&i!==null&&!Array.isArray(i)?(this.applyFileToEvent(i,!1)&&this.fileChangedEvent(),t=f.pretty(f.withEventFields(i,e))):t=f.pretty(i)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const i=this.current;if(r&&i&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),i&&!i.url&&e.trim()!==""){const s=i.id??"1";i.url=`${s.startsWith("interview")?s:`interview-${s}`}.json`,this.field("url").value=i.url,this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"url",event:i}}))}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:i,text:e}})),this.exchangesShown=this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=f.pretty(t?f.withEventFields(e,t):e);await this.loadFileEditor(r).then(i=>i.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}const i=this.importHints();if(this.isQuestionnaire(r)){await this.takeQuestionnaire(r??t,e.name);return}if(typeof r!="object"||r===null){const{InterviewImport:s}=await w(async()=>{const{InterviewImport:a}=await import("./interviewImport-ym5iXO4Z.js");return{InterviewImport:a}},__vite__mapDeps([27,26,7]),import.meta.url),n=s.parse(t,i);r=n&&{...n,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}importHints(){const e=this.current,t=[e?.interviewOf].flat().filter(r=>typeof r=="string");return{by:(e?.by??[]).map(r=>f.byText([r])).filter(r=>r!==""),witnesses:this.options.filter(r=>t.length===0||t.includes(r.id))}}isQuestionnaire(e){const t=typeof e=="object"&&e!==null&&Array.isArray(e.segments);return this.current?.medium==="questionnaire"&&!t}async takeQuestionnaire(e,t){const[{QuestionnaireImport:r},{QuestionnaireTemplates:i}]=await Promise.all([w(()=>import("./QuestionnaireImport-
|
|
294
|
+
`}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of f.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const s of f.SHARED)t[s]===void 0?delete r[s]:r[s]=structuredClone(t[s]);const i=r.speakers;if(typeof i=="object"&&i!==null){const s={...i},n=(a,o,p)=>{p.forEach((d,c)=>{const l=c===0?a:`${a}${c+1}`;s[l]?s[l]={...s[l],[o]:d}:c>0&&(s[l]={role:a,[o]:d})})};n("interviewer","by",t.by??[]),n("witness","of",f.witnessesOf(t.interviewOf)),r.speakers=s}return f.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const i=JSON.stringify(f.SHARED.map(a=>r[a])),s=a=>typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a),n={title:s,summary:s,time:a=>typeof a=="string",medium:a=>typeof a=="string",by:a=>Array.isArray(a),interviewOf:a=>typeof a=="string"||Array.isArray(a)};for(const a of f.SHARED){const o=e[a];o!==void 0&&n[a](o)?r[a]=structuredClone(o):t&&delete r[a]}return JSON.stringify(f.SHARED.map(a=>r[a]))!==i}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const i=f.pretty(f.withEventFields(r,e));i!==t&&(this.text=i,this.fileEditor?.replaceText(i,!1),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:i}})))}template(e){return f.pretty(f.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},i]=await Promise.all([w(()=>import("./SightingFileEditor-DS1DRU2p.js"),__vite__mapDeps([28,29,30]),import.meta.url),w(()=>import("./interviewSchema-r5bW7skq.js"),[],import.meta.url),K(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,s=>this.onEdited(s),this.messages.editorLabel,{baseline:e,phrases:i.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const i=await I.json(r);this.current===e&&typeof i=="object"&&i!==null&&!Array.isArray(i)?(this.applyFileToEvent(i,!1)&&this.fileChangedEvent(),t=f.pretty(f.withEventFields(i,e))):t=f.pretty(i)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const i=this.current;if(r&&i&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),i&&!i.url&&e.trim()!==""){const s=i.id??"1";i.url=`${s.startsWith("interview")?s:`interview-${s}`}.json`,this.field("url").value=i.url,this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"url",event:i}}))}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:i,text:e}})),this.exchangesShown=this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=f.pretty(t?f.withEventFields(e,t):e);await this.loadFileEditor(r).then(i=>i.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}const i=this.importHints();if(this.isQuestionnaire(r)){await this.takeQuestionnaire(r??t,e.name);return}if(typeof r!="object"||r===null){const{InterviewImport:s}=await w(async()=>{const{InterviewImport:a}=await import("./interviewImport-ym5iXO4Z.js");return{InterviewImport:a}},__vite__mapDeps([27,26,7]),import.meta.url),n=s.parse(t,i);r=n&&{...n,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}importHints(){const e=this.current,t=[e?.interviewOf].flat().filter(r=>typeof r=="string");return{by:(e?.by??[]).map(r=>f.byText([r])).filter(r=>r!==""),witnesses:this.options.filter(r=>t.length===0||t.includes(r.id))}}isQuestionnaire(e){const t=typeof e=="object"&&e!==null&&Array.isArray(e.segments);return this.current?.medium==="questionnaire"&&!t}async takeQuestionnaire(e,t){const[{QuestionnaireImport:r},{QuestionnaireTemplates:i}]=await Promise.all([w(()=>import("./QuestionnaireImport-CNROmkT2.js"),__vite__mapDeps([31,26,7,6,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url),w(()=>import("./CaseEditorElement-HR8RFluQ.js").then(o=>o.a),__vite__mapDeps([6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]),import.meta.url)]),s=this.current?await this.transcriptJson(this.current):void 0,n=await i.load(s?.questionnaire?.id??i.DEFAULT),a=r.parse(e,this.importHints(),n);if(!a){this.note(this.messages.notAQuestionnaire,"error");return}await this.take({...a,transcription:{method:"manual",note:`Imported from ${t}: one question and its answer per field, as the witness filled it in.`}})}async importFromUrl(e){try{const t=new URL(e,this.base??location.href).href,r=await I.json(t);this.isQuestionnaire(r)?await this.takeQuestionnaire(r,t.split("/").pop()??t):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}save(){const e=this.fileEditor?.text??this.text;if(e===void 0)return;const t=(this.current?.url??"").split("/").pop()||`${this.current?.id??"interview"}.json`,r=URL.createObjectURL(new Blob([e],{type:"application/json"})),i=document.createElement("a");i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}}function Se(){Z(),Q(),customElements.get(H)||customElements.define(H,f)}export{S as INTERVIEW_CHANGE_EVENT,H as INTERVIEW_EDITOR_ELEMENT_NAME,Re as INTERVIEW_SEEK_EVENT,f as InterviewEditorElement,Se as register};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as x,a as T,H as I,s as L,U as S,T as A}from"./rr0-ufoathome.mjs";import{I as j}from"./ColumnResize-
|
|
1
|
+
import{S as x,a as T,H as I,s as L,U as S,T as A}from"./rr0-ufoathome.mjs";import{I as j}from"./ColumnResize-CEXrq3KB.js";import{InterviewFile as p}from"./interviewJson-D-i14LTf.js";import{I as b}from"./InterviewAttachments-BP6Prvdu.js";import{P as C}from"./ShareDialogElement-EzLob2Tz.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";const N="rr0-interview",R=`
|
|
2
2
|
rr0-interview { display: block; --rr0-interview-line: color-mix(in srgb, currentColor 35%, transparent); }
|
|
3
3
|
rr0-interview [hidden] { display: none !important; }
|
|
4
4
|
rr0-interview .rr0-interview-status { font-size: .85em; opacity: .85; margin: 0 0 .5em; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{G as s}from"./GeographicFigures-
|
|
1
|
+
import{G as s}from"./GeographicFigures-KII55iXE.js";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./rr0-ufoathome.mjs";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./ShareDialogElement-EzLob2Tz.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class t{static GROUPS=["observer","sight-line","body","trace"];static of(o,e,i,l){const n=s.of(o,i,l),c=t.GROUPS.map(r=>n.filter(a=>a.group===r)).filter(r=>r.length>0).map(r=>t.folder(r[0].groupName,r.map(a=>t.placemark(a))));return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<kml xmlns="http://www.opengis.net/kml/2.2">
|
|
3
3
|
<Document>
|
|
4
4
|
<name>${t.xml(s.fill(i.document,{name:e}))}</name>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as O,b8 as D,b9 as y}from"./ShareDialogElement-
|
|
1
|
+
import{q as O,b8 as D,b9 as y}from"./ShareDialogElement-EzLob2Tz.js";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{M as y,_ as d}from"./rr0-ufoathome.mjs";import{b,P as E,I as g}from"./SaidPosition-OJEYhVKN.js";import{S as w}from"./SkyEventEditorStyle-CvY_AhbI.js";import{L as v}from"./LaunchPlume-w4l4TR4A.js";import{ba as j}from"./ShareDialogElement-Dlfy9NCE.js";import{P as x,E as k,a as T}from"./ParameterForm-XbqxCLRn.js";import{T as I}from"./TimelineTracks-Daaqw9ly.js";import"./GeoProjection-DvqDbRIx.js";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.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=>v.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),c=(m,h)=>m+(h-m)*l;return{t,lat:c(s.lat,a.lat),lng:c(s.lng,a.lng),altitudeKm:Math.max(0,c(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(v.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 P=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,w.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([P.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{M as y,_ as d}from"./rr0-ufoathome.mjs";import{b,P as E,I as g}from"./SaidPosition-OJEYhVKN.js";import{S as w}from"./SkyEventEditorStyle-CvY_AhbI.js";import{L as v}from"./LaunchPlume-D-vSb8tJ.js";import{ba as j}from"./ShareDialogElement-EzLob2Tz.js";import{P as x,E as k,a as T}from"./ParameterForm-XbqxCLRn.js";import{T as I}from"./TimelineTracks-Daaqw9ly.js";import"./GeoProjection-DvqDbRIx.js";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.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=>v.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),c=(m,h)=>m+(h-m)*l;return{t,lat:c(s.lat,a.lat),lng:c(s.lng,a.lng),altitudeKm:Math.max(0,c(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(v.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 P=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,w.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([P.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{bd as w,be as F,bf as v,bg as Y,q as H}from"./ShareDialogElement-
|
|
1
|
+
import{bd as w,be as F,bf as v,bg as Y,q as H}from"./ShareDialogElement-EzLob2Tz.js";class K{static MU=398600.4418;static OMEGA=72921159e-12;static EARTH_RADIUS_KM=6371;static STEP_S=1;static DENSITY=[[0,1.225],[20,.0889],[40,.004],[60,31e-5],[80,185e-7],[100,56e-8],[120,222e-10],[150,208e-11],[200,254e-12],[250,607e-13],[300,192e-13],[400,28e-13],[500,522e-15],[600,114e-15],[700,307e-16],[800,114e-16],[900,576e-17],[1e3,356e-17]];static FREE_PATH_TIMES_DENSITY=68e-9;static ICE_DENSITY=917;static airDensity(s){const t=K.DENSITY;if(s<=t[0][0])return t[0][1];let e=0;for(;e<t.length-2&&t[e+1][0]<s;)e++;const[a,i]=t[e],[o,n]=t[e+1];return i*Math.exp(Math.log(n/i)*(s-a)/(o-a))}static dragPerKm(s,t,e,a=.5){const i=K.airDensity(s),o=K.FREE_PATH_TIMES_DENSITY/i/1e3,n=Math.exp(-o/t),p=i*1e9*Math.PI*t*t/Math.max(e,1e-9),d=3*i/(4*a*1e-6*K.ICE_DENSITY)*1e3;return n*p+(1-n)*d}static step(s,t,e,a,i){const[o,n,p,d,R,h]=s,m=Math.hypot(o,n,p),T=K.OMEGA,M=-398600.4418/(m*m*m),y=M*o+2*T*R+T*T*o,U=M*n-2*T*d+T*T*n,I=M*p,E=Math.hypot(d,R,h),c=1/(1+K.dragPerKm(m-K.EARTH_RADIUS_KM,e,a,i)*E*t);s[3]=(d+y*t)*c,s[4]=(R+U*t)*c,s[5]=(h+I*t)*c,s[0]=o+s[3]*t,s[1]=n+s[4]*t,s[2]=p+s[5]*t;const f=Math.hypot(s[0],s[1],s[2]);if(f<K.EARTH_RADIUS_KM){const A=K.EARTH_RADIUS_KM/f;s[0]*=A,s[1]*=A,s[2]*=A,s[3]=s[4]=s[5]=0}}}class _{constructor(s,t,e,a,i=.5){this.massKg=e,this.radiusAt=a,this.particleRadiusUm=i,this.state=Float64Array.of(...s,...t),this.positions=new Float64Array(192),this.positions.set(s,0)}positions;steps=0;state;at(s){const t=K.STEP_S,e=Math.max(0,s/t),a=Math.ceil(e);for(;this.steps<a;){if(K.step(this.state,t,this.radiusAt(this.steps*t),this.massKg,this.particleRadiusUm),this.steps++,3*(this.steps+1)>this.positions.length){const p=new Float64Array(this.positions.length*2);p.set(this.positions),this.positions=p}this.positions.set(this.state.subarray(0,3),3*this.steps)}const i=Math.floor(e),o=e-i,n=this.positions;return o===0||i>=this.steps?[n[3*i],n[3*i+1],n[3*i+2]]:[0,1,2].map(p=>n[3*i+p]+(n[3*i+3+p]-n[3*i+p])*o)}}class r{static EARTH_RADIUS_KM=6371;static SHADOW_RADIUS_KM=r.EARTH_RADIUS_KM+15;static PENUMBRA_KM=10;static SUN_ILLUMINANCE_LUX=127e3;static RAYLEIGH_PER_M=[58e-7,135e-7,331e-7];static SCALE_HEIGHT_M=8e3;static OZONE_GRAZING_DEPTH=[2.4,1.8,.24];static ANISOTROPY=.7;static ALBEDO=.99;static WAVELENGTHS_UM=[.61,.55,.465];static ICE_INDEX=1.31;static DEFAULTS={exhaustKgPerS:273,condensedShare:.065,particleRadiusUm:.5,expansionKmPerS:.15,initialRadiusKm:.5,lifetimeS:420,collarShare:.85,collarExpansionKmPerS:2.5,collarLifetimeS:20};static PROPELLANTS={"rp1-lox":{condensedShare:.065,particleRadiusUm:.5},"methane-lox":{condensedShare:.09,particleRadiusUm:.5},"hydrogen-lox":{condensedShare:.13,particleRadiusUm:.5},hypergolic:{condensedShare:.079,particleRadiusUm:.4},solid:{condensedShare:.27,particleRadiusUm:.8}};static G0=9.80665;static COLLAR_SPREAD_OF_EXHAUST_VELOCITY=.735;static plumeOf(s){const t={},e=s.vehicle?.engine;if(e){const a=e.specificImpulseS===void 0?void 0:e.specificImpulseS*r.G0;e.thrustKN!==void 0&&a&&(t.exhaustKgPerS=e.thrustKN*1e3/a),a&&(t.collarExpansionKmPerS=a/1e3*r.COLLAR_SPREAD_OF_EXHAUST_VELOCITY),e.propellant&&Object.assign(t,r.PROPELLANTS[e.propellant])}return{...r.DEFAULTS,...t,...s.plume}}static PUFF_EVERY_S=.5;static SIGMA_OF_RADIUS=.5;static MAX_PUFFS=320;static DEG=Math.PI/180;static EARTH_ROTATION=72921159e-12;static VENT_DEFAULTS={speedKmPerS:.7,massKgPerS:20,condensedShare:.5,particleRadiusUm:.5,expansionKmPerS:.1,initialRadiusKm:.2,lifetimeS:600};static paths=new WeakMap;static exhaustVelocityKmPerS(s){return(s.vehicle?.engine?.specificImpulseS??348)*r.G0/1e3}static releasesOf(s){const t=[],e=s.jets??[];if(e.length===0||s.burnFromT!==void 0||s.burnUntilT!==void 0){const a=s.track[0]?.t??0,i=s.track[s.track.length-1]?.t??0;t.push(r.engineRelease(s,"burn",{fromT:s.burnFromT??a,untilT:s.burnUntilT??i}))}return e.forEach((a,i)=>t.push(r.releaseOf(s,a,i))),t}static releaseOf(s,t,e){const a=`jet:${t.id??e}`;if((t.kind??"burn")==="burn")return r.engineRelease(s,a,t);const i=r.VENT_DEFAULTS;return{key:a,fromT:t.fromT,untilT:t.untilT,angleDeg:t.angleDeg??0,azimuthDeg:t.azimuthDeg??0,spinPeriodS:t.spinPeriodS,speedKmPerS:t.speedKmPerS??i.speedKmPerS,massKgPerS:t.massKgPerS??i.massKgPerS,condensedShare:t.condensedShare??i.condensedShare,particleRadiusUm:t.particleRadiusUm??i.particleRadiusUm,initialRadiusKm:t.initialRadiusKm??i.initialRadiusKm,populations:[{share:1,expansionKmPerS:t.expansionKmPerS??i.expansionKmPerS,lifetimeS:t.lifetimeS??i.lifetimeS}]}}static engineRelease(s,t,e){const a=r.plumeOf(s);return{key:t,fromT:e.fromT,untilT:e.untilT,angleDeg:e.angleDeg??0,azimuthDeg:e.azimuthDeg??0,spinPeriodS:e.spinPeriodS,speedKmPerS:e.speedKmPerS??r.exhaustVelocityKmPerS(s),massKgPerS:e.massKgPerS??a.exhaustKgPerS,condensedShare:e.condensedShare??a.condensedShare,particleRadiusUm:e.particleRadiusUm??a.particleRadiusUm,initialRadiusKm:e.initialRadiusKm??a.initialRadiusKm,populations:[{share:1-a.collarShare,expansionKmPerS:e.expansionKmPerS??a.expansionKmPerS,lifetimeS:e.lifetimeS??a.lifetimeS},{share:a.collarShare,expansionKmPerS:a.collarExpansionKmPerS,lifetimeS:a.collarLifetimeS}]}}static extinctionEfficiency(s,t){const e=2*Math.PI*s/t,a=r.ICE_INDEX**2,i=8/3*e**4*((a-1)/(a+2))**2,o=2*e*(r.ICE_INDEX-1),n=o<.001?o*o/2:2-4/o*Math.sin(o)+4/(o*o)*(1-Math.cos(o));return Math.min(i,n)}static scatteringColour(s){const t=r.extinctionEfficiency(s,r.WAVELENGTHS_UM[1]);return r.WAVELENGTHS_UM.map(e=>r.extinctionEfficiency(s,e)/t)}static sunDirectionAt(s){const t=new w(0,0,-6378137),e=F(v.Sun,s,t,!0,!0),a=(e.ra-Y(s))*15*r.DEG,i=e.dec*r.DEG;return[Math.cos(i)*Math.cos(a),Math.cos(i)*Math.sin(a),Math.sin(i)]}static puffsAt(s,t){const e=[];for(const a of s){let i=r.paths.get(a);i||r.paths.set(a,i=new Map);for(const o of r.releasesOf(a)){const n=Math.min(o.untilT,t);if(n<=o.fromT)continue;const p=Math.max(r.PUFF_EVERY_S*1e3,(o.untilT-o.fromT)/r.MAX_PUFFS),d=[];for(let M=o.fromT;M<n;M+=p)d.push(M);d.push(n);const R=o.massKgPerS*(p/1e3),m=3*r.extinctionEfficiency(o.particleRadiusUm,r.WAVELENGTHS_UM[1])/(4*917*o.particleRadiusUm*1e-6),T=r.scatteringColour(o.particleRadiusUm);o.populations.forEach((M,y)=>{if(M.share<=0)return;const U=E=>o.initialRadiusKm+M.expansionKmPerS*E,I=[];for(const E of d){const D=(t-E)/1e3;if(D>M.lifetimeS)continue;const c=E!==n||n===o.untilT,f=`${o.key}|${y}|${E}`;let A=c?i.get(f):void 0;if(!A){if(A=r.launchPuff(a,o,E,R*M.share,U),!A)continue;c&&i.set(f,A)}I.push({ageS:D,position:A.at(D)})}for(let E=I.length-1;E>=0;E--){const{ageS:D,position:c}=I[E],f=I[E-1]??I[E+1],A=f?Math.hypot(c[0]-f.position[0],c[1]-f.position[1],c[2]-f.position[2]):0,l=U(D)+A/2,O=r.SIGMA_OF_RADIUS*l*1e3,N=R*o.condensedShare*M.share*m/(2*Math.PI*O*O),x=Math.max(0,1-(D/M.lifetimeS)**2);N*x<=0||e.push({launchId:a.id,release:o.key,at:r.geoPoint(c),radiusKm:l,opticalDepth:N*x,colour:T,ageS:D})}})}}return e}static viewsAt(s,t,e,a){const i=[];for(const o of r.puffsAt(s,t)){const n=H.seenFrom(e,o.at);if(n.altitudeDeg<0)continue;const p=r.sunlightAt(o.at,a);if(p.lit<=0)continue;const d=r.scatteringPhase(e,o.at,a),R=r.SUN_ILLUMINANCE_LUX*r.ALBEDO*d*o.opticalDepth*p.lit;R<=0||i.push({launchId:o.launchId,release:o.release,heightKm:o.at.heightM/1e3,centre:n,radiusDeg:Math.atan2(o.radiusKm,n.distanceKm)/r.DEG,luminanceCdM2:R,sunTransmittance:p.transmittance,colour:o.colour,lit:p.lit,ageS:o.ageS})}return i}static launchPuff(s,t,e,a,i){const o={id:s.id,track:s.track,fragments:[]},n=H.leadAt(o,e);if(!n)return;const p=s.track[0].t,d=s.track[s.track.length-1].t,R=Math.max(p,e-500),h=Math.min(d,e+500),m=r.earthCentred(n),T=r.earthCentred(H.leadAt(o,R)),M=r.earthCentred(H.leadAt(o,h)),y=Math.max(.001,(h-R)/1e3),U=[0,1,2].map(S=>(M[S]-T[S])/y),I=r.EARTH_ROTATION,E=[U[0]-I*m[1],U[1]+I*m[0],U[2]],D=S=>{const b=Math.hypot(S[0],S[1],S[2])||1;return S.map(k=>k/b)},c=D(E),f=D(m),A=f[0]*c[0]+f[1]*c[1]+f[2]*c[2];let l=[f[0]-A*c[0],f[1]-A*c[1],f[2]-A*c[2]];Math.hypot(l[0],l[1],l[2])<1e-6&&(l=[-c[2]*c[0],-c[2]*c[1],1-c[2]*c[2]]),l=D(l);const O=[c[1]*l[2]-c[2]*l[1],c[2]*l[0]-c[0]*l[2],c[0]*l[1]-c[1]*l[0]],N=t.spinPeriodS?360*((e-t.fromT)/1e3)/t.spinPeriodS:0,x=(t.azimuthDeg+N)*r.DEG,G=t.angleDeg*r.DEG,C=[0,1,2].map(S=>-c[S]*Math.cos(G)+Math.sin(G)*(Math.cos(x)*l[S]+Math.sin(x)*O[S])),P=[0,1,2].map(S=>U[S]+t.speedKmPerS*C[S]);return new _(m,P,a,i,t.particleRadiusUm)}static geoPoint(s){const t=Math.hypot(s[0],s[1],s[2]);return{lat:Math.asin(s[2]/t)/r.DEG,lng:Math.atan2(s[1],s[0])/r.DEG,heightM:(t-K.EARTH_RADIUS_KM)*1e3}}static sunlightAt(s,t){const e=r.earthCentred(s),a=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];if(a>=0)return{lit:1,transmittance:[1,1,1]};const i=Math.hypot(e[0]-a*t[0],e[1]-a*t[1],e[2]-a*t[2]),o=r.PENUMBRA_KM,n=Math.min(1,Math.max(0,(i-(r.SHADOW_RADIUS_KM-o/2))/o));if(n<=0)return{lit:0,transmittance:[0,0,0]};const p=Math.max(0,(i-r.EARTH_RADIUS_KM)*1e3),d=Math.exp(-p/r.SCALE_HEIGHT_M),R=Math.sqrt(2*Math.PI*r.EARTH_RADIUS_KM*1e3*r.SCALE_HEIGHT_M),h=Math.exp(-(((p/1e3-25)/15)**2)),m=[0,1,2].map(T=>Math.exp(-r.RAYLEIGH_PER_M[T]*d*R-r.OZONE_GRAZING_DEPTH[T]*h));return{lit:n,transmittance:m}}static scatteringPhase(s,t,e){const a=r.earthCentred(s),i=r.earthCentred(t),o=[a[0]-i[0],a[1]-i[1],a[2]-i[2]],n=Math.hypot(o[0],o[1],o[2])||1,p=-(o[0]*e[0]+o[1]*e[1]+o[2]*e[2])/n,d=r.ANISOTROPY;return(1-d*d)/(4*Math.PI*(1+d*d-2*d*p)**1.5)}static earthCentred(s){const t=s.lat*r.DEG,e=s.lng*r.DEG,a=r.EARTH_RADIUS_KM+s.heightM/1e3;return[a*Math.cos(t)*Math.cos(e),a*Math.cos(t)*Math.sin(e),a*Math.sin(t)]}}export{r as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as M}from"./LaunchPlume-
|
|
1
|
+
import{L as M}from"./LaunchPlume-D-vSb8tJ.js";import{I as T,w as z,x as f,M as C}from"./three.module-CbaHqYFq.js";import{bb as w,bc as A}from"./ShareDialogElement-EzLob2Tz.js";import"./rr0-ufoathome.mjs";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";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 u of t){if(c>=n.MAX_PUFFS)break;const d=o(u.centre);if(d<=0)continue;const r=s(u.centre),a=[0,1,2].map(g=>Math.min(n.BRIGHTEST_RELATIVE,u.luminanceCdM2*(u.colour?.[g]??1)*i*u.sunTransmittance[g]*r[g]*d));Math.max(...a)<=0||(h=this.pushPuff(h,u,a),this.drawn.push({view:u,direction:this.normalise(A(u.centre.altitudeDeg,u.centre.azimuthDeg,1)),radiusRad:u.radiusDeg*Math.PI/180,luminance:.2126*a[0]+.7152*a[1]+.0722*a[2]}),c++)}this.shown=c;const p=this.mesh.geometry;p.setDrawRange(0,h),p.getAttribute("position").needsUpdate=!0,p.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)),p=this.cross(h,c),u=n.RADIUS*Math.tan(i.radiusDeg*Math.PI/180),d=(a,g)=>{const e=g/n.SECTORS*2*Math.PI,I=n.RINGS[a]*u,R=Math.cos(e)*I,l=Math.sin(e)*I;return{x:o.x+c.x*R+p.x*l,y:o.y+c.y*R+p.y*l,z:o.z+c.z*R+p.z*l}},r=a=>n.COLUMN[a];for(let a=0;a<n.SECTORS;a++){const g=(a+1)%n.SECTORS;t=this.push(t,o,s,r(0)),t=this.push(t,d(1,a),s,r(1)),t=this.push(t,d(1,g),s,r(1));for(let e=1;e<n.RINGS.length-1;e++){const I=d(e,a),R=d(e,g),l=d(e+1,a),E=d(e+1,g);t=this.push(t,I,s,r(e)),t=this.push(t,R,s,r(e)),t=this.push(t,l,s,r(e+1)),t=this.push(t,R,s,r(e)),t=this.push(t,E,s,r(e+1)),t=this.push(t,l,s,r(e+1))}}return t}pickAt(t,i,s=0){const o=this.normalise(t);let h=0,c;for(const p of this.drawn){const u=Math.max(-1,Math.min(1,o.x*p.direction.x+o.y*p.direction.y+o.z*p.direction.z)),d=Math.max(0,Math.acos(u)-i)/Math.max(p.radiusRad,1e-9),r=p.luminance*n.profile(d);r<=0||(h+=r,(!c||r>c.light)&&(c={view:p.view,light:r}))}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 j{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{j as LaunchSimulation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as d,M as c,ae as f,a8 as m,av as u,m as w,aw as y,u as M,aa as g,V as S}from"./three.module-CbaHqYFq.js";import{
|
|
1
|
+
import{I as d,M as c,ae as f,a8 as m,av as u,m as w,aw as y,u as M,aa as g,V as S}from"./three.module-CbaHqYFq.js";import{bx as b,az as l,by as v}from"./ShareDialogElement-EzLob2Tz.js";class h{static key(e){return"url"in e?`url:${e.url}|${e.headingOffsetDeg??0}`:"shape"in e?`shape:${e.shape}`:`decor:${e.decorKind}`}static async build(e){const a=new d;if("url"in e){const s=await b(e.url);s.rotation.y=-(e.headingOffsetDeg??0)*Math.PI/180,a.add(s)}else"shape"in e?a.add(h.shapeOf(e.shape)):a.add(l.build({id:"preview",kind:e.decorKind,eastM:0,northM:0},!1));return a}static shapeOf(e){if(e==="figure")return l.build({id:"preview",kind:"entity",eastM:0,northM:0},!1);const a=new c(v.unitGeometry(e),new f({color:13158608,roughness:.5,metalness:0}));return e==="ellipsoid"&&a.scale.set(1,.55,1),a}static dispose(e){e.traverse(a=>{const s=a;if(s.isMesh){s.geometry?.dispose();for(const t of[s.material].flat())t.dispose()}})}static stage(e,a){const s=new m().setFromObject(e);if(s.isEmpty())return;const t=s.getBoundingSphere(new u),r=new d;e.position.sub(t.center),r.add(e);const n=new w;n.add(r),n.add(new y(16777215,6715272,1.6));const o=new M(16777215,2.5);o.position.set(1,2,1.5),n.add(o);const i=new g(30,a,t.radius*.05,t.radius*20),p=t.radius/Math.sin(i.fov*Math.PI/360)*1.05;return i.position.copy(new S(.55,.3,-.78).normalize().multiplyScalar(p)),i.lookAt(0,0,0),{scene:n,camera:i,pivot:r}}}export{h as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ax as n}from"./three.module-CbaHqYFq.js";import{M as s}from"./ModelSource-
|
|
1
|
+
import{ax as n}from"./three.module-CbaHqYFq.js";import{M as s}from"./ModelSource-HSiigkeO.js";import"./ShareDialogElement-EzLob2Tz.js";import"./rr0-ufoathome.mjs";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class M{static SIZE_PX={width:192,height:144};static cache=new Map;static queue=Promise.resolve();static pending=0;static renderer;static of(r){const t=s.key(r);let e=this.cache.get(t);return e||(this.pending++,e=this.queue.then(()=>this.draw(r)).catch(()=>{}).finally(()=>{--this.pending===0&&this.release()}),this.queue=e,this.cache.set(t,e)),e}static async draw(r){const t=await s.build(r);try{const{width:e,height:o}=this.SIZE_PX,a=s.stage(t,e/o);if(!a)return;const i=this.renderer??=new n({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});return i.setSize(e,o,!1),i.setClearColor(0,0),i.render(a.scene,a.camera),i.domElement.toDataURL("image/png")}finally{s.dispose(t)}}static release(){this.renderer?.dispose(),this.renderer?.forceContextLoss(),this.renderer=void 0}}export{M as ModelThumbnails};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ax as h}from"./three.module-CbaHqYFq.js";import{M as c}from"./ModelSource-
|
|
1
|
+
import{ax as h}from"./three.module-CbaHqYFq.js";import{M as c}from"./ModelSource-HSiigkeO.js";import"./ShareDialogElement-EzLob2Tz.js";import"./rr0-ufoathome.mjs";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class a{constructor(t,i){this.container=t,this.source=i,this.canvas=document.createElement("canvas"),this.canvas.className="model-live",this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab;display:none",this.canvas.addEventListener("pointerdown",s=>this.press(s)),this.canvas.addEventListener("pointermove",s=>this.move(s)),this.canvas.addEventListener("pointerup",()=>this.release()),this.canvas.addEventListener("pointercancel",()=>this.release())}static renderer;static SPIN_RAD_PER_S=.7;static DRAG_RAD_PER_PX=.012;static CLICK_TOLERANCE_PX=4;static current;object;stage;frame=0;stopped=!1;last=0;dragging;draggedPastClick=!1;canvas;static show(t,i){a.current?.stop();const s=new a(t,i);return a.current=s,s.start(),s}static end(){a.current?.stop(),a.current=void 0,a.renderer?.dispose(),a.renderer?.forceContextLoss(),a.renderer=void 0}consumeDrag(){const t=this.draggedPastClick;return this.draggedPastClick=!1,t}get active(){return!this.stopped}stop(){this.stopped=!0,cancelAnimationFrame(this.frame),this.canvas.remove(),this.object&&c.dispose(this.object),this.object=void 0,a.current===this&&(a.current=void 0)}async start(){try{const t=await c.build(this.source);if(this.stopped){c.dispose(t);return}this.object=t;const{width:i,height:s}=this.container.getBoundingClientRect(),e=i>0&&s>0?i/s:4/3;if(this.stage=c.stage(t,e),!this.stage)return;(a.renderer??=new h({antialias:!0,alpha:!0})).setClearColor(0,0),this.container.append(this.canvas),this.canvas.style.display="block",this.last=performance.now(),this.tick()}catch{}}tick=()=>{if(this.stopped||!this.stage)return;const t=performance.now(),i=Math.min(.1,(t-this.last)/1e3);this.last=t,this.dragging||(this.stage.pivot.rotation.y+=a.SPIN_RAD_PER_S*i);const s=a.renderer,{width:e,height:n}=this.canvas.getBoundingClientRect(),r=Math.min(2,window.devicePixelRatio||1);(this.canvas.width!==Math.round(e*r)||this.canvas.height!==Math.round(n*r))&&(s.setPixelRatio(r),s.setSize(e,n,!1),this.canvas.width=Math.round(e*r),this.canvas.height=Math.round(n*r),this.stage.camera.aspect=e/Math.max(1,n),this.stage.camera.updateProjectionMatrix()),s.render(this.stage.scene,this.stage.camera);const o=this.canvas.getContext("2d");o?.clearRect(0,0,this.canvas.width,this.canvas.height),o?.drawImage(s.domElement,0,0,this.canvas.width,this.canvas.height),this.frame=requestAnimationFrame(this.tick)};press(t){this.dragging={x:t.clientX,y:t.clientY,moved:!1},this.canvas.setPointerCapture(t.pointerId),this.canvas.style.cursor="grabbing"}move(t){const i=this.dragging;if(!i||!this.stage)return;const s=t.clientX-i.x,e=t.clientY-i.y;!i.moved&&Math.hypot(s,e)<a.CLICK_TOLERANCE_PX||(i.moved=!0,this.draggedPastClick=!0,this.stage.pivot.rotation.y+=s*a.DRAG_RAD_PER_PX,this.stage.pivot.rotation.x=Math.max(-1.4,Math.min(1.4,this.stage.pivot.rotation.x-e*a.DRAG_RAD_PER_PX)),i.x=t.clientX,i.y=t.clientY)}release(){this.dragging=void 0,this.canvas.style.cursor="grab"}}export{a as ModelViewer};
|
package/dist-embed-ufoathome/{ModulesPanelElement-DH1oroWm.js → ModulesPanelElement-DsOa2zH0.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleConformance-DYDAaJJQ.js","./rr0-ufoathome.mjs"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{M as _,_ as x,H as y,i as m}from"./rr0-ufoathome.mjs";import{ModuleSession as L}from"./ModuleSession-BKDWGSEo.js";import{M as C}from"./CaseEditorElement-
|
|
2
|
+
import{M as _,_ as x,H as y,i as m}from"./rr0-ufoathome.mjs";import{ModuleSession as L}from"./ModuleSession-BKDWGSEo.js";import{M as C}from"./CaseEditorElement-HR8RFluQ.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./GeoProjection-DvqDbRIx.js";import"./SaidPosition-OJEYhVKN.js";import"./ParameterForm-XbqxCLRn.js";import"./ColumnResize-CEXrq3KB.js";import"./ShareDialogElement-EzLob2Tz.js";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./Obstacles-v9SkfBD7.js";import"./InterviewAttachments-BP6Prvdu.js";import"./TimelineTracks-Daaqw9ly.js";import"./ReentryArchive-CeXHrU7L.js";import"./ReferenceTimeline-2kBldQeG.js";import"./upperAirSources-BU0pD84c.js";import"./Account-C4jhsVtN.js";const M=_.catalog({en:()=>x(()=>import("./ModulesPanelMessages_en-DuwrY3Pm.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_en),fr:()=>x(()=>import("./ModulesPanelMessages_fr-B8cSDc6o.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_fr),es:()=>x(()=>import("./ModulesPanelMessages_es-Bq5X-XuT.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_es),it:()=>x(()=>import("./ModulesPanelMessages_it-BdC626aJ.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_it)}),N="rr0-modules-panel",P=`
|
|
3
3
|
rr0-modules-panel { display: block; }
|
|
4
4
|
rr0-modules-panel .mp-add { display: flex; gap: .4em; align-items: center; margin: .4em 0; }
|
|
5
5
|
rr0-modules-panel .mp-add input { flex: 1 1 16em; min-width: 0; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a$ as y,aS as h}from"./ShareDialogElement-
|
|
1
|
+
import{a$ as y,aS as h}from"./ShareDialogElement-EzLob2Tz.js";class c{static FLAT={heightAt:()=>0};static of(e){const s=e.timeline.sourceIds.map(n=>y.of(e,n)?.nearestM).filter(n=>n!==void 0);return s.length>0?{m:Math.min(...s),basis:"derived",paths:["timeline","observerTrack"]}:c.interpreted(e)}static interpreted(e){const s=(e.interpretation?.bodies??[]).map((t,i)=>({body:t,index:i})).filter(({body:t})=>Array.isArray(t.track)),n=s.filter(({body:t})=>(t.explains?.length??0)>0),u=n.length>0?n:s,d=c.FLAT,l=t=>h.eyeOf(e,t,d);let o;const p=[];for(const{body:t,index:i}of u){const M=new h(t,d,l);for(const{t:f}of t.track){const a=M.at(f),r=l(f);if(!a||!r)continue;const m=Math.hypot(a.eastM-r.eastM,a.northM-r.northM,a.upM-r.upM);(o===void 0||m<o)&&(o=m)}p.push(`interpretation.bodies.${i}`)}return o===void 0?void 0:{m:o,basis:"assumed",paths:p}}}export{c as N};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as u}from"./ShareDialogElement-
|
|
1
|
+
import{w as u}from"./ShareDialogElement-EzLob2Tz.js";import"./rr0-ufoathome.mjs";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class o{about="shape";static STEP_DEG=2;static TURN_DEG=60;static ERRATIC_TURNS=3;static OSCILLATIONS=["vibrate","spiral","roll"];async assess(n){const t=this.trajectory(n),s=this.vanish(n),i=this.oscillation(n),e=this.landing(n),c=this.judged(n,"traces"),r=this.occupants(n),h=e.shown&&r.shown?5:e.shown&&c.shown?4:e.shown||t.value==="erratic"||s.shown||i.shown?3:t.value==="abnormal"?2:t.value==="straight"?1:0,a=[{id:"poher-trajectory",basis:t.basis,paths:t.paths,value:o.TRAJECTORIES.indexOf(t.value)},this.criterion("poher-vanish",s),this.criterion("poher-oscillation",i),{...this.criterion("poher-landing",e),unsupported:e.basis===void 0},this.criterion("poher-traces",c),this.criterion("poher-occupants",r)];return{verdict:String(h),criteria:a}}static TRAJECTORIES=["unknown","still","straight","abnormal","erratic"];criterion(n,t){return{id:n,value:t.shown?1:0,basis:t.basis,paths:t.basis===void 0?[]:t.paths}}trajectory(n){let t="unknown";for(const s of n.timeline.sourceIds){const i=this.seen(n,s).filter(a=>a.aim!==void 0).map(a=>a.aim);if(i.length<2)continue;const e=[o.unit(i[0])];for(const a of i.slice(1)){const l=o.unit(a);o.angleDeg(e[e.length-1],l)>=o.STEP_DEG&&e.push(l)}const c=e.length-1;let r=0;for(let a=1;a<e.length-1;a++){const l=o.cross(e[a-1],e[a]),d=o.cross(e[a],e[a+1]);o.angleDeg(l,d)>=o.TURN_DEG&&r++}const h=c===0?"still":r>=o.ERRATIC_TURNS?"erratic":r>0?"abnormal":"straight";o.TRAJECTORIES.indexOf(h)>o.TRAJECTORIES.indexOf(t)&&(t=h)}return t==="unknown"?{value:t,paths:[]}:{value:t,basis:"derived",paths:["timeline"]}}vanish(n){const t=(n.events??[]).findIndex(s=>s.eventType==="vanish"&&u.isPhenomenon(n,s));return t>=0?{shown:!0,basis:"stated",paths:[`events.${t}`]}:{shown:!1,paths:[]}}oscillation(n){const t=new Set((n.interpretation?.bodies??[]).map(i=>i.id)),s=(n.events??[]).findIndex(i=>o.OSCILLATIONS.includes(i.eventType)&&(u.isPhenomenon(n,i)||t.has(i.who?.split("/")[0]??"")));return s>=0?{shown:!0,basis:"stated",paths:[`events.${s}`]}:{shown:!1,paths:[]}}landing(n){const t=i=>!i.onGround&&((i.altitudeAboveGroundM??0)>0||(i.altitudeM??0)>0),s=(n.interpretation?.bodies??[]).findIndex(i=>Array.isArray(i.track)&&i.track.some(e=>e.onGround)&&i.track.some(t));return s>=0?{shown:!0,basis:"assumed",paths:[`interpretation.bodies.${s}`]}:{shown:!1,paths:[]}}occupants(n){const t=n.decor.findIndex(s=>s.kind==="entity");return t>=0?{shown:!0,basis:"stated",paths:[`decor.${t}`]}:this.judged(n,"beings")}judged(n,t){const s=n.account?.strangeness?.[t];return s===void 0?{shown:!1,paths:[]}:{shown:s,basis:"stated",paths:[`account.strangeness.${t}`]}}instants(n,t){return n.timeline.allKeyframes.map(s=>({t:s.t,shape:s.shapes.find(i=>i.sourceId===t)?.shape})).filter(({shape:s})=>s!==void 0).map(({t:s,shape:i})=>({t:s,aim:i.aim,visible:i.transparency<1})).sort((s,i)=>s.t-i.t)}seen(n,t){return this.instants(n,t).filter(s=>s.visible)}static unit(n){const[t,s]=[n.azimuthDeg*Math.PI/180,n.altitudeDeg*Math.PI/180];return[Math.cos(s)*Math.sin(t),Math.cos(s)*Math.cos(t),Math.sin(s)]}static cross(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}static angleDeg(n,t){const s=Math.hypot(...n)*Math.hypot(...t);if(s===0)return 0;const i=(n[0]*t[0]+n[1]*t[1]+n[2]*t[2])/s;return Math.acos(Math.max(-1,Math.min(1,i)))*180/Math.PI}}export{o as PoherAssessor};
|
package/dist-embed-ufoathome/{QuestionnaireFeed-W69udpmT.js → QuestionnaireFeed-CpZqkxlt.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{QuestionnaireImport as M}from"./QuestionnaireImport-
|
|
1
|
+
import{QuestionnaireImport as M}from"./QuestionnaireImport-CNROmkT2.js";import{Q as C}from"./CaseEditorElement-HR8RFluQ.js";import"./interviewJson-D-i14LTf.js";import"./rr0-ufoathome.mjs";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./ParameterForm-XbqxCLRn.js";import"./ColumnResize-CEXrq3KB.js";import"./ShareDialogElement-EzLob2Tz.js";import"./Sighting-B7bsiTIQ.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";import"./InterviewAttachments-BP6Prvdu.js";import"./TimelineTracks-Daaqw9ly.js";import"./ReentryArchive-CeXHrU7L.js";import"./ReferenceTimeline-2kBldQeG.js";import"./upperAirSources-BU0pD84c.js";import"./Account-C4jhsVtN.js";class d{static PHENOMENON="phenomenon";static apply(s,e,t,o){const m=M.answers(e),i=new Map;for(const r of C.fields(t)){const a=r.feeds?m.get(r.id):void 0;r.feeds&&a&&i.set(r.feeds,{field:r.id,text:a.text,source:{said:{...o!==void 0?{interview:o}:{},segment:a.segment}}})}const l=[],u=(r,a,f)=>({value:r,basis:"stated",rationale:a,source:f}),c=(r,a,f,h)=>{h(),l.push({path:r,value:a,field:f})},n=i.get("narrative");n&&c("description",n.text,n.field,()=>{s.description={[t.language??"fr"]:n.text}});const b=i.get("date"),p=i.get("startTime"),S=b?d.date(b.text):void 0,w=p?d.clock(p.text):void 0;if(S){const r=w!==void 0?`${S}T${d.hms(w)}`:S,a=[b.text,p?.text].filter(f=>f!==void 0).join(", ");c("time",r,p&&w!==void 0?p.field:b.field,()=>{s.time=u(r,a,(w!==void 0?p:b).source)})}const v=i.get("duration"),k=v?d.duration(v.text,w):void 0;v&&k!==void 0&&c("durationSeconds",k,v.field,()=>{s.durationSeconds=u(k,v.text,v.source)});const x=i.get("color"),N=x?d.color(x.text):void 0,g=d.aim(i.get("startAzimuth"),i.get("startElevation")),j=d.aim(i.get("endAzimuth"),i.get("endElevation"));if(N||g||j){const r=(s.timeline??={}).keyframes??=[];let a=r.find(h=>(h.shapes??[]).length>0);a||(a=r.find(h=>h.t===0)??{t:0,shapes:[]},r.includes(a)||r.unshift(a),a.shapes=[{sourceId:d.PHENOMENON,shape:{kind:"oval",color:N??"#ffffff",transparency:0,haloScale:1.5,brightness:.4,angular:{value:{widthDeg:.5,heightDeg:.5},basis:"assumed",rationale:"no size the questionnaire's answers give"}}}]);const f=a.shapes[0];if(N&&c(`timeline.keyframes.${r.indexOf(a)}.shapes.0.shape.color`,N,x.field,()=>{f.shape.color=u(N,x.text,x.source)}),g&&c(`timeline.keyframes.${r.indexOf(a)}.shapes.0.shape.aim`,g.value,g.field,()=>{f.shape.aim=u(g.value,g.said,g.source)}),j){const h=(k??10)*1e3;let $=r.find(O=>O.t===h);$||($={t:h,shapes:[]},r.push($),r.sort((O,L)=>O.t-L.t));const I=$.shapes??=[];let y=I.find(O=>O.sourceId===f.sourceId);y||(y={sourceId:f.sourceId,shape:{}},I.push(y));const z=j;c(`timeline.keyframes.${r.indexOf($)}.shapes.${I.indexOf(y)}.shape.aim`,z.value,z.field,()=>{y.shape.aim=u(z.value,z.said,z.source)})}}return l}static MONTHS={janvier:1,fevrier:2,mars:3,avril:4,mai:5,juin:6,juillet:7,aout:8,septembre:9,octobre:10,novembre:11,decembre:12,january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12,enero:1,febrero:2,marzo:3,abril:4,mayo:5,junio:6,julio:7,agosto:8,septiembre:9,octubre:10,noviembre:11,diciembre:12,gennaio:1,febbraio:2,aprile:4,maggio:5,giugno:6,luglio:7,settembre:9,ottobre:10,dicembre:12};static date(s){const e=c=>String(c).padStart(2,"0"),t=(c,n,b)=>n>=1&&n<=12&&b>=1&&b<=31?`${c}-${e(n)}-${e(b)}`:void 0,o=/(\d{4})-(\d{1,2})-(\d{1,2})/.exec(s);if(o)return t(Number(o[1]),Number(o[2]),Number(o[3]));const m=/(\d{1,2})[/.-](\d{1,2})[/.-](\d{2,4})/.exec(s);if(m){const c=Number(m[3])<100?2e3+Number(m[3]):Number(m[3]);return t(c,Number(m[2]),Number(m[1]))}const i=s.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase(),l=/(\d{1,2})(?:er)?\s+([a-z]+)\s+(\d{4})/.exec(i),u=l?d.MONTHS[l[2]]:void 0;return l&&u?t(Number(l[3]),u,Number(l[1])):void 0}static clock(s){const e=/(\d{1,2})\s*(?:[:h]\s*(\d{2})?(?:\s*[:m]\s*(\d{2}))?|\s*(?=[ap]\.?m))\s*([ap]\.?m\.?)?/i.exec(s);if(!e)return;let t=Number(e[1]);if(e[4]&&(t=t%12+(/^p/i.test(e[4])?12:0)),!(t>23))return t*3600+Number(e[2]??0)*60+Number(e[3]??0)}static hms(s){const e=t=>String(t).padStart(2,"0");return`${e(Math.floor(s/3600))}:${e(Math.floor(s/60)%60)}:${e(s%60)}`}static duration(s,e){const t=s.toLowerCase().replace(",","."),o=/(\d{1,2})\s*[:h]\s*\d{2}/.exec(t);if(o&&e!==void 0&&(/jusqu|until|till|fin\b|end|termin|hasta|fino/.test(t)||/:/.test(o[0])&&Number(o[1])>=10)){const u=d.clock(o[0]);if(u!==void 0)return(u-e+86400)%86400||void 0}const i=[...t.replace(/(\d+)\s*h\s*(\d{2})(?!\s*(?:min|mn|s\b|sec))/g,"$1 h $2 min").matchAll(/(\d+(?:\.\d+)?)\s*(?:(?:-|–|à|a|to|or|ou|o)\s*(\d+(?:\.\d+)?)\s*)?(h(?:eures?|ours?|oras?|ore)?|min\w*|mn|s(?:ec\w*)?|seg\w*)(?![a-z])/g)];if(i.length>0){const u=i.reduce((c,n)=>{const b=n[3].startsWith("h")?3600:n[3].startsWith("m")?60:1,p=n[2]?(Number(n[1])+Number(n[2]))/2:Number(n[1]);return c+p*b},0);return u>0?Math.round(u):void 0}const l=/^\s*(\d{1,2}):(\d{2})\s*$/.exec(t);return l?Number(l[1])*60+Number(l[2]):void 0}static COLORS=[[/orang/,"#ff8a1f"],[/rouge|red|rojo|ross/,"#ff2a14"],[/jaune|yellow|amarill|giall/,"#ffe14a"],[/vert|green|verde/,"#3ad65a"],[/bleu|blue|azul|azzurr|blu/,"#4a8dff"],[/violet|purple|morad|viola/,"#a35bff"],[/rose|pink/,"#ff7ab8"],[/argent|silver|plat/,"#d8dde3"],[/gris|grey|gray|grig/,"#9a9a9a"],[/noir|black|negr|ner/,"#202020"],[/blanc|white|blanco|bianc/,"#ffffff"]];static color(s){const e=s.toLowerCase();let t;for(const[o,m]of d.COLORS){const i=o.exec(e);i&&(!t||i.index<t.at)&&(t={at:i.index,hex:m})}return t?.hex}static POINTS=[[/nord[- ]?nord[- ]?est|north[- ]?north[- ]?east|\bnne\b/,22.5],[/est[- ]?nord[- ]?est|east[- ]?north[- ]?east|\bene\b/,67.5],[/est[- ]?sud[- ]?est|east[- ]?south[- ]?east|\bese\b/,112.5],[/sud[- ]?sud[- ]?est|south[- ]?south[- ]?east|\bsse\b/,157.5],[/sud[- ]?sud[- ]?ouest|south[- ]?south[- ]?west|\bssw\b|\bsso\b/,202.5],[/ouest[- ]?sud[- ]?ouest|west[- ]?south[- ]?west|\bwsw\b|\boso\b/,247.5],[/ouest[- ]?nord[- ]?ouest|west[- ]?north[- ]?west|\bwnw\b|\bono\b/,292.5],[/nord[- ]?nord[- ]?ouest|north[- ]?north[- ]?west|\bnnw\b|\bnno\b/,337.5],[/nord[- ]?est|north[- ]?east|\bne\b/,45],[/sud[- ]?est|south[- ]?east|\bse\b/,135],[/sud[- ]?ouest|south[- ]?west|\bsw\b|\bso\b/,225],[/nord[- ]?ouest|north[- ]?west|\bnw\b|\bno\b/,315],[/\bnord\b|\bnorth\b|^n$/,0],[/\best\b|\beast\b|^e$/,90],[/\bsud\b|\bsouth\b|^s$/,180],[/\bouest\b|\bwest\b|^o$|^w$/,270]];static azimuth(s){const e=s.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().trim(),t=/(\d{1,3}(?:[.,]\d+)?)\s*(?:°|deg|degres?|degrees?)/.exec(e)??/^(?:azimut[h]?\s*)?(\d{1,3}(?:[.,]\d+)?)$/.exec(e);if(t){const o=Number(t[1].replace(",","."));return o>=0&&o<=360?o%360:void 0}return d.POINTS.find(([o])=>o.test(e))?.[1]}static elevation(s){const e=s.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase(),t=/(-?\d{1,2}(?:[.,]\d+)?)\s*(?:°|deg|degres?|degrees?)/.exec(e)??/^\s*(\d{1,2}(?:[.,]\d+)?)\s*$/.exec(e);if(t){const o=Number(t[1].replace(",","."));return o>=-5&&o<=90?o:void 0}if(/zenith|au-dessus de (?:ma|la) tete|overhead/.test(e))return 90;if(/(?:a|sur|on) l'?horizon|at the horizon/.test(e))return 0}static aim(s,e){const t=s?d.azimuth(s.text):void 0,o=e?d.elevation(e.text):void 0;if(!(t===void 0||o===void 0))return{value:{azimuthDeg:t,altitudeDeg:o},field:s.field,said:`${s.text} ; ${e.text}`,source:s.source}}}export{d as QuestionnaireFeed};
|