@rr0/ufoathome 0.197.0 → 0.198.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/rr0-scene.mjs +122 -122
- package/dist-embed-sighting/{CaseReportExport-CCjvTS2q.js → CaseReportExport-BetcYOov.js} +1 -1
- package/dist-embed-sighting/rr0-sighting.mjs +300 -286
- package/dist-embed-sighting-editor/{CaseEditorMessages_en-u4MyW2Ah.js → CaseEditorMessages_en-CpJLWbJD.js} +1 -1
- package/{dist-embed-ufoathome/CaseEditorMessages_es-BuLTG_5Q.js → dist-embed-sighting-editor/CaseEditorMessages_es-C5YOqVpF.js} +1 -1
- package/{dist-embed-ufoathome/CaseEditorMessages_fr-Car1_lOm.js → dist-embed-sighting-editor/CaseEditorMessages_fr-rMlMgrqV.js} +1 -1
- package/{dist-embed-ufoathome/CaseEditorMessages_it-DAHTKU_c.js → dist-embed-sighting-editor/CaseEditorMessages_it-Bkiv2Hun.js} +1 -1
- package/dist-embed-sighting-editor/CaseElement-IzaexO7n.js +121 -0
- package/dist-embed-sighting-editor/{CaseReportExport-CAEcShgX.js → CaseReportExport-U-dk4A7z.js} +1 -1
- package/dist-embed-sighting-editor/{SightingElement-Ddf6hzfp.js → SightingElement-BhyoU_gg.js} +3 -3
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +214 -192
- package/dist-embed-ufoathome/{AdsbLolArchiveProvider-B-IiOm3p.js → AdsbLolArchiveProvider-CUkfGJbL.js} +1 -1
- package/dist-embed-ufoathome/{BallesterGuaspAssessor-CKFQRcfa.js → BallesterGuaspAssessor-CB2F8A6P.js} +1 -1
- package/dist-embed-ufoathome/{BeamEditor-BWkQrCPy.js → BeamEditor-Q_m3KK0S.js} +1 -1
- package/dist-embed-ufoathome/{BeamSystem-D6XsTULo.js → BeamSystem-CVMU5DeE.js} +1 -1
- package/dist-embed-ufoathome/{BirdEditor-6vr7bLHy.js → BirdEditor-07sg3Pt0.js} +1 -1
- package/dist-embed-ufoathome/{BodyEditor-D1odTty_.js → BodyEditor-BwsMj37A.js} +1 -1
- package/dist-embed-ufoathome/{CaseEditorElement-3g_c6R7G.js → CaseEditorElement-BrcX9sp0.js} +130 -113
- package/dist-embed-ufoathome/{CaseEditorMessages_en-u4MyW2Ah.js → CaseEditorMessages_en-CpJLWbJD.js} +1 -1
- package/{dist-embed-sighting-editor/CaseEditorMessages_es-BuLTG_5Q.js → dist-embed-ufoathome/CaseEditorMessages_es-C5YOqVpF.js} +1 -1
- package/{dist-embed-sighting-editor/CaseEditorMessages_fr-Car1_lOm.js → dist-embed-ufoathome/CaseEditorMessages_fr-rMlMgrqV.js} +1 -1
- package/{dist-embed-sighting-editor/CaseEditorMessages_it-DAHTKU_c.js → dist-embed-ufoathome/CaseEditorMessages_it-Bkiv2Hun.js} +1 -1
- package/dist-embed-ufoathome/CaseElement-Ca8ctACA.js +121 -0
- package/dist-embed-ufoathome/{CaseReportExport-ZNhCiJjJ.js → CaseReportExport--IhmS67e.js} +3 -3
- package/dist-embed-ufoathome/{ColumnResize-UnDz8hFM.js → ColumnResize-CMfGWQHi.js} +20 -15
- package/dist-embed-ufoathome/{ContrailSystem-1Y9tarlk.js → ContrailSystem-CuFduINP.js} +1 -1
- package/dist-embed-ufoathome/{ControlPasses-CNOyd9SV.js → ControlPasses-BS7yyZOR.js} +1 -1
- package/dist-embed-ufoathome/{CoverageAssessor-BDtOq9aQ.js → CoverageAssessor-BwXJv4OD.js} +1 -1
- package/dist-embed-ufoathome/{DroneEditor-C3SH8yYq.js → DroneEditor-ByVlCauS.js} +1 -1
- package/dist-embed-ufoathome/{Flightradar24Provider-2yiCbULq.js → Flightradar24Provider-Cd4o260r.js} +1 -1
- package/dist-embed-ufoathome/{GLTFLoader-BTxAZ2H9.js → GLTFLoader-BegH9SUA.js} +1 -1
- package/dist-embed-ufoathome/{GeoJsonExport-taSDSkPz.js → GeoJsonExport-Czm1iAIW.js} +1 -1
- package/dist-embed-ufoathome/{GeographicFigures-BTNgtesN.js → GeographicFigures-CKg7JYgf.js} +1 -1
- package/dist-embed-ufoathome/{HeadlightSystem-DrcLjLtQ.js → HeadlightSystem-DIk-C7_5.js} +1 -1
- package/dist-embed-ufoathome/{HynekAssessor-B29m-sN8.js → HynekAssessor-BybLMdda.js} +1 -1
- package/dist-embed-ufoathome/{InterviewEditorElement-2QYSmoHm.js → InterviewEditorElement-CbTakhyi.js} +1 -1
- package/dist-embed-ufoathome/{InterviewElement-dtYF5S-4.js → InterviewElement-fI19BieO.js} +1 -1
- package/dist-embed-ufoathome/{KmlExport-BmpKnlBj.js → KmlExport-De-2dnYz.js} +1 -1
- package/dist-embed-ufoathome/{LanternEditor-BaRDgTw-.js → LanternEditor-BRqgj1S6.js} +1 -1
- package/dist-embed-ufoathome/{LaserBeam-ejbRCvnX.js → LaserBeam-CouNB7Pe.js} +1 -1
- package/dist-embed-ufoathome/{LaunchEditor-DlL4ZqRi.js → LaunchEditor-BNInX90c.js} +1 -1
- package/dist-embed-ufoathome/{LaunchPlume-oAya2eEa.js → LaunchPlume-DVxzb0wy.js} +1 -1
- package/dist-embed-ufoathome/{LaunchSimulation-DkwJLwOo.js → LaunchSimulation-CCvSd6qD.js} +1 -1
- package/dist-embed-ufoathome/{ModelSource-B_nU_FPQ.js → ModelSource-BZ1U1VU1.js} +1 -1
- package/dist-embed-ufoathome/{ModelThumbnails-DaDiyuM2.js → ModelThumbnails-Ckdb3qoW.js} +1 -1
- package/dist-embed-ufoathome/{ModelViewer-iv0GdyTZ.js → ModelViewer-B9PZN5c7.js} +1 -1
- package/dist-embed-ufoathome/{ModuleConformance-BDZbbpPz.js → ModuleConformance-8JN5JVgE.js} +2 -2
- package/dist-embed-ufoathome/{ModuleSession-DbiU7Mg7.js → ModuleSession-ClSpEZMn.js} +3 -3
- package/dist-embed-ufoathome/{ModuleThree-CLOnw_DZ.js → ModuleThree-CRG8PTLA.js} +1 -1
- package/dist-embed-ufoathome/{ModulesPanelElement-CMyuCril.js → ModulesPanelElement-D4Hos-mF.js} +3 -3
- package/dist-embed-ufoathome/{NearestApproach-DM8py_qI.js → NearestApproach-DrJN7h_1.js} +1 -1
- package/dist-embed-ufoathome/{ParameterForm-DfpJQGku.js → ParameterForm-DcVFxrcO.js} +1 -1
- package/dist-embed-ufoathome/{PictureRegistration-rU4sVWnY.js → PictureRegistration-LxhNTA4v.js} +1 -1
- package/dist-embed-ufoathome/{PoherAssessor-DXsufNSL.js → PoherAssessor-RyKMyps7.js} +1 -1
- package/dist-embed-ufoathome/{RailwaySystem-DZ1rEPSL.js → RailwaySystem-BOQvJ2r4.js} +1 -1
- package/dist-embed-ufoathome/{ReentryEditor-BVDyVhGo.js → ReentryEditor-B1H_TUMf.js} +1 -1
- package/dist-embed-ufoathome/{ReentrySimulation-DFisNsmn.js → ReentrySimulation-C7XZlAED.js} +1 -1
- package/dist-embed-ufoathome/{ReferenceSystem-DnHhAxWO.js → ReferenceSystem-BcsjHgaw.js} +1 -1
- package/dist-embed-ufoathome/{RoadMarkings-BsN3rh0W.js → RoadMarkings-DDRxawvf.js} +1 -1
- package/dist-embed-ufoathome/SaidPosition-CXZLm-ck.js +4 -0
- package/dist-embed-ufoathome/{ShareDialogElement-C5QkyK7i.js → ShareDialogElement-DHlxoHWP.js} +13 -13
- package/dist-embed-ufoathome/{Sighting-CBpJpdm9.js → Sighting-Ch4eiBNK.js} +1 -1
- package/dist-embed-ufoathome/{SightingElement-cd7C-Ge-.js → SightingElement-COJwKNNg.js} +3 -3
- package/dist-embed-ufoathome/{TimelineTracks-X_GEZi12.js → TimelineTracks-BgZmkKhn.js} +1 -1
- package/dist-embed-ufoathome/{TraceSystem-CM4QYSkU.js → TraceSystem-BBCpq8-v.js} +1 -1
- package/dist-embed-ufoathome/{VideoButton-CZlR9Bk0.js → VideoButton-CGQI7iUA.js} +1 -1
- package/dist-embed-ufoathome/{WaterSystem-C8MrXEEk.js → WaterSystem-BrIS0Wzy.js} +1 -1
- package/dist-embed-ufoathome/rr0-ufoathome.mjs +3 -3
- package/dist-embed-ufoathome/{surroundingsSources-CKDz9k9A.js → surroundingsSources-Dg6vMWL7.js} +1 -1
- package/dist-embed-ufoathome/{trafficRuntime-AtbE4bAN.js → trafficRuntime-BT5Ol_v5.js} +1 -1
- package/package.json +1 -1
- package/dist-embed-sighting-editor/CaseElement-DYeBpKhp.js +0 -112
- package/dist-embed-ufoathome/CaseElement-CZzC4Bj8.js +0 -112
- package/dist-embed-ufoathome/SaidPosition-CWiVNaNW.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as Y,V as q}from"./VisualAids-DI-hEL46.js";import{P as Z}from"./rr0-ufoathome.mjs";import{L as Q,c as ee}from"./SaidPosition-CWiVNaNW.js";class E{static ISO=/^P(?:(\d+(?:[.,]\d+)?)W)?(?:(\d+(?:[.,]\d+)?)D)?(?:T(?:(\d+(?:[.,]\d+)?)H)?(?:(\d+(?:[.,]\d+)?)M)?(?:(\d+(?:[.,]\d+)?)S)?)?$/;static seconds(e){const t=e.trim().toUpperCase(),s=E.ISO.exec(t);if(!s||t==="P"||t.endsWith("T"))return;const[,n,i,o,a,c]=s,d=u=>u===void 0?0:Number(u.replace(",",".")),h=d(n)*604800+d(i)*86400+d(o)*3600+d(a)*60+d(c);return Number.isFinite(h)?h:void 0}static parse(e){let t=e.trim();if(t==="")return;const s=t.slice(-1),n="?~%".includes(s)?s:"";n!==""&&(t=t.slice(0,-1).trim());const i=t.split("/");if(i.length>2)return;const o=i.map(u=>E.seconds(u));if(o.some(u=>u===void 0))return;const[a,c]=o,d=Math.min(a,c??a),h=Math.max(a,c??a);return{doubt:n,minSeconds:d,maxSeconds:h,chosenSeconds:(d+h)/2}}static isExact(e){const t=E.parse(e);return t!==void 0&&t.doubt===""&&t.minSeconds===t.maxSeconds}static format(e){const t=Math.max(0,Math.round(e*10)/10),s=Math.floor(t/3600),n=Math.floor(t%3600/60),i=Math.round(t%60*10)/10;return`PT${`${s>0?`${s}H`:""}${n>0?`${n}M`:""}${i>0||s===0&&n===0?`${i}S`:""}`}`}static say(e){const t=Math.round(e*10)/10;if(t<60)return`${t} s`;const s=Math.floor(t/3600),n=Math.floor(t%3600/60),i=Math.round(t%60*10)/10,o=[];return s>0&&o.push(`${s} h`),n>0&&o.push(`${n} min`),i>0&&o.push(`${i} s`),o.join(" ")}}class L{static MOON_ANGULAR_WIDTH_DEG=.5237;static CANVAS_WIDTH_PX=640;static CANVAS_HEIGHT_PX=360;static angularWidthDeg(e){return 2*Math.atan(e.sizeM/(2*e.distanceM))*180/Math.PI}static inMoons(e){return e/L.MOON_ANGULAR_WIDTH_DEG}static lerpAngular(e,t,s){if(!(!e||!t))return{widthDeg:e.widthDeg+(t.widthDeg-e.widthDeg)*s,heightDeg:e.heightDeg+(t.heightDeg-e.heightDeg)*s}}static sizeMAt(e,t){return 2*e*Math.tan(t*Math.PI/360)}static distanceMAt(e,t){return e/(2*Math.tan(t*Math.PI/360))}}function te(r,e,t){if(!r||!e)return t<1?r:e;const s=((e.azimuthDeg-r.azimuthDeg)%360+540)%360-180;return{azimuthDeg:((r.azimuthDeg+s*t)%360+360)%360,altitudeDeg:r.altitudeDeg+(e.altitudeDeg-r.altitudeDeg)*t}}function se(r,e="#39ff14"){return{kind:"oval",bounds:r,color:e,angle:0,transparency:0,haloScale:0,selected:!1}}function ne(r,e,t="#39ff14"){return{kind:"polygon",bounds:r,points:e,color:t,angle:0,transparency:0,haloScale:0,selected:!1}}function re(r,e="#39ff14"){const{width:t,height:s}=r;return ne(r,[{x:0,y:0},{x:t,y:0},{x:t,y:s},{x:0,y:s}],e)}const ie={oval:se,polygon:re};function Ne(r,e){return{...ie[e.presetId](r,e.color),transparency:e.transparency,haloScale:e.haloScale,blur:e.blur,brightness:e.brightness}}function oe(r,e,t){const{bounds:s}=r;return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function Le(r,e,t){const s=r.bounds.width,n=r.bounds.height;return{...r,bounds:{x:e-s/2,y:t-n/2,width:s,height:n}}}function v(r,e,t){return r+(e-r)*t}function G(r){const e=/^#([0-9a-f]{6})$/i.exec(r);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function ae(r){return`#${r.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function de(r,e,t){const s=G(r),n=G(e);return!s||!n?t<1?r:e:ae([v(s[0],n[0],t),v(s[1],n[1],t),v(s[2],n[2],t)])}function ce(r,e,t){const s={x:v(r.bounds.x,e.bounds.x,t),y:v(r.bounds.y,e.bounds.y,t),width:v(r.bounds.width,e.bounds.width,t),height:v(r.bounds.height,e.bounds.height,t)},n=v(r.angle,e.angle,t),i=v(r.transparency,e.transparency,t),o=v(r.haloScale,e.haloScale,t),a=v(r.blur??0,e.blur??0,t),c=v(r.brightness??0,e.brightness??0,t),d=de(r.color,e.color,t),h=L.lerpAngular(r.angular,e.angular,t),u=te(r.aim,e.aim,t);return r.kind==="polygon"&&e.kind==="polygon"&&r.points.length===e.points.length?{...r,bounds:s,angle:n,transparency:i,haloScale:o,blur:a,brightness:c,color:d,angular:h,aim:u,points:r.points.map((p,m)=>({x:v(p.x,e.points[m].x,t),y:v(p.y,e.points[m].y,t)}))}:{...t<1?r:e,bounds:s,angle:n,transparency:i,haloScale:o,blur:a,brightness:c,color:d,angular:h,aim:u}}class w{static DEFAULT_COLOR="#e8e6df";static complete(e,t=[]){const s=new Map;return e.map((n,i)=>({keyframe:n,index:i})).sort((n,i)=>n.keyframe.t-i.keyframe.t).map(({keyframe:n,index:i})=>({t:n.t,shapes:(n.shapes??[]).map((o,a)=>{const c=`timeline.keyframes.${i}.shapes.${a}.shape`,d=w.completed(o,s.get(o.sourceId),c,t);return s.set(o.sourceId,d),{sourceId:o.sourceId,shape:d}})}))}static thin(e,t){const s=new Map,n=new Set;return e.map((i,o)=>({t:i.t,shapes:i.shapes.map(a=>{const c=s.get(a.sourceId);if(s.set(a.sourceId,a.shape),!c)return{sourceId:a.sourceId,shape:a.shape};const d=w.thinned(a.shape,c);if(t){const h=d;t(o,a.sourceId)?(delete h.bounds,delete h.points,n.add(a.sourceId)):n.delete(a.sourceId)&&(h.bounds=a.shape.bounds,a.shape.kind==="polygon"&&(h.points=a.shape.points),a.shape.aim&&(h.aim=a.shape.aim),a.shape.angular&&(h.angular=a.shape.angular))}return{sourceId:a.sourceId,shape:d}})}))}static thinned(e,t){const s=t,n={};for(const[i,o]of Object.entries(e))(typeof o=="object"&&o!==null&&!Array.isArray(o)&&"value"in o||o!==s[i]&&JSON.stringify(o)!==JSON.stringify(s[i]))&&(n[i]=o);return"bounds"in n&&(e.aim&&(n.aim=e.aim),e.angular&&(n.angular=e.angular)),n}static completed(e,t,s,n){const i=e.shape??{},o=t??w.firstAppearance(i,s,n),a={...o};i.bounds&&t&&(t.aim||t.angular)&&!i.aim&&!i.angular&&n.push({kind:"pixels-over-angles",path:s}),i.bounds&&(i.aim||delete a.aim,i.angular||delete a.angular);const c=i.kind??o.kind??"oval",d={...a,...i,kind:c};if(c==="polygon"&&!d.points){n.push({kind:"defaulted",path:`${s}.points`,expected:"rectangle"});const{width:h,height:u}=d.bounds;return{...d,points:[{x:0,y:0},{x:h,y:0},{x:h,y:u},{x:0,y:u}]}}return d}static firstAppearance(e,t,s){return e.kind||s.push({kind:"defaulted",path:`${t}.kind`,expected:'"oval"'}),e.color||s.push({kind:"defaulted",path:`${t}.color`,expected:`"${w.DEFAULT_COLOR}"`}),!e.bounds&&!e.aim&&s.push({kind:"unplaced",path:t}),!e.bounds&&!e.angular&&s.push({kind:"unsized",path:t}),{kind:e.kind??"oval",bounds:{...w.NEUTRAL_BOUNDS},color:w.DEFAULT_COLOR,angle:0,transparency:0,haloScale:0,selected:!1}}static NEUTRAL_BOUNDS={x:L.CANVAS_WIDTH_PX/2,y:L.CANVAS_HEIGHT_PX/2,width:1,height:1}}class B{keyframes=[];order=[];groups=[];span=0;addKeyframe(e,t){const s=this.findInsertIndex(e);if(this.keyframes[s]?.t===e){const n=new Set(t.map(i=>i.sourceId));this.keyframes[s]={t:e,shapes:[...this.keyframes[s].shapes.filter(i=>!n.has(i.sourceId)),...t]}}else this.keyframes.splice(s,0,{t:e,shapes:[...t]});for(const n of t)this.order.includes(n.sourceId)||this.order.push(n.sourceId)}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t];return s?.t===e?s:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(s=>s.sourceId===t)?.shape}getLatestShapeAt(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const n=this.keyframes[s].shapes.find(i=>i.sourceId===t);if(n)return n.shape}}getInterpolatedShapeAt(e,t){const s=this.findShapeAtOrBefore(e,t);if(s?.t===e)return s.shape;const n=this.findShapeAtOrAfter(e,t);return s?n?ce(s.shape,n.shape,(e-s.t)/(n.t-s.t)):s.shape:n?.shape}findShapeAtOrBefore(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const n=this.keyframes[s].shapes.find(i=>i.sourceId===t);if(n)return{t:this.keyframes[s].t,shape:n.shape}}}findShapeAtOrAfter(e,t){for(let s=this.findInsertIndex(e);s<this.keyframes.length;s++){const n=this.keyframes[s].shapes.find(i=>i.sourceId===t);if(n)return{t:this.keyframes[s].t,shape:n.shape}}}hitTest(e,t,s,n){const i=this.sourceIds;for(let o=i.length-1;o>=0;o--){if(n?.has(i[o]))continue;const a=this.getInterpolatedShapeAt(e,i[o]);if(a&&oe(a,t,s))return{sourceId:i[o],shape:a}}}removeSource(e){for(let t=this.keyframes.length-1;t>=0;t--){const s=this.keyframes[t].shapes.filter(n=>n.sourceId!==e);s.length===0?this.keyframes.splice(t,1):s.length!==this.keyframes[t].shapes.length&&(this.keyframes[t]={t:this.keyframes[t].t,shapes:s})}this.order=this.order.filter(t=>t!==e),this.removeFromGroup(e)}removeShapeAt(e,t){const s=this.findInsertIndex(e),n=this.keyframes[s];if(n?.t!==e)return;const i=n.shapes.filter(o=>o.sourceId!==t);i.length===0?this.keyframes.splice(s,1):i.length!==n.shapes.length&&(this.keyframes[s]={t:e,shapes:i})}group(e,t){const s=new Set(e),n=[];for(const o of e){const a=this.topOf(o),c=a!==o&&this.leavesOf(a).every(d=>s.has(d))?a:o;c===o&&a!==o&&this.removeFromGroup(o),n.includes(c)||n.push(c)}if(n.length<2)return;const i=t??this.freshGroupId();return this.groups.push({id:i,members:n}),i}ungroup(e){const t=this.topOf(e);t!==e&&(this.groups=this.groups.filter(s=>s.id!==t))}groupMembers(e){const t=this.topOf(e);return t===e?void 0:this.leavesOf(t)}get allGroups(){return this.groups}setGroups(e,t=!0){this.groups=e.map(s=>({...s,members:[...s.members]})),t&&this.pruneGroups()}groupOf(e){return this.groups.find(t=>t.id===e)}leavesOf(e,t=new Set){const s=this.groupOf(e);return s?t.has(e)?[]:(t.add(e),s.members.flatMap(n=>this.leavesOf(n,t))):[e]}parentOf(e){return this.groups.find(t=>t.members.includes(e))}topOf(e){let t=e;for(let s=this.parentOf(t),n=0;s&&n<100;s=this.parentOf(t),n++)t=s.id;return t}freshGroupId(){for(let e=this.groups.length+1;;e++){const t=`group-${e}`;if(!this.groupOf(t)&&!this.order.includes(t))return t}}removeFromGroup(e){const t=this.parentOf(e);t&&(t.members=t.members.filter(s=>s!==e),this.collapse())}pruneGroups(){const e=t=>this.order.includes(t)||this.groupOf(t)!==void 0;for(const t of this.groups)t.members=t.members.filter(e);this.collapse()}collapse(){for(let e=this.groups.find(t=>t.members.length<2);e;e=this.groups.find(t=>t.members.length<2)){const t=e;this.groups=this.groups.filter(s=>s!==t);for(const s of this.groups)s.members=s.members.flatMap(n=>n===t.id?t.members:[n])}}bringToFront(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.push(e))}sendToBack(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.unshift(e))}get duration(){const e=this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t;return Math.max(e,this.span)}get hasSpan(){return this.span>0}setSpan(e){this.span=Math.max(0,e)}get sourceIds(){return[...this.order]}get allKeyframes(){return this.keyframes}toJSON(){return this.span>0?{keyframes:this.keyframes,order:this.order,groups:this.groupsJson(),span:this.span}:{keyframes:this.keyframes,order:this.order,groups:this.groupsJson()}}groupsJson(){return this.groups.map(e=>({...e,members:[...e.members]}))}static fromJSON(e,t,s=!0){const n=new B;for(const i of w.complete(e.keyframes??[],t))n.addKeyframe(i.t,i.shapes);if(e.span!==void 0&&e.span>0&&(n.span=e.span),e.order){const i=n.order.filter(o=>!e.order.includes(o));n.order=[...e.order,...i]}return e.groups&&(n.groups=e.groups.filter(i=>typeof i?.id=="string"&&Array.isArray(i.members)).map(i=>({...i,members:[...i.members]})),s&&n.pruneGroups()),n}}function he(r,e,t){return Math.max(e,Math.min(t,r))}function ue(r,e,t){const s=((e-r)%360+540)%360-180;return((r+s*t)%360+360)%360}function b(r,e,t){return r+(e-r)*t}function le(r,e,t){return{lat:r.lat===void 0||e.lat===void 0?void 0:b(r.lat,e.lat,t),lng:r.lng===void 0||e.lng===void 0?void 0:b(r.lng,e.lng,t),elevationM:b(r.elevationM,e.elevationM,t),...r.altitudeM!==void 0&&e.altitudeM!==void 0?{altitudeM:b(r.altitudeM,e.altitudeM,t)}:{},headingDeg:r.headingDeg===void 0||e.headingDeg===void 0?void 0:ue(r.headingDeg,e.headingDeg,t),pitchDeg:b(r.pitchDeg,e.pitchDeg,t),rollDeg:b(r.rollDeg??0,e.rollDeg??0,t),fovDeg:b(r.fovDeg,e.fovDeg,t),fNumber:r.fNumber,focusDistanceM:r.focusDistanceM,filter:r.filter}}class y{static at(e,t,s,n,i){const o=e[s],c=e[s+1]-o;if(c<=0)return t[s];const d=y.tangent(e,t,s,i),h=y.tangent(e,t,s+1,i),u=(n-o)/c,p=u*u,m=p*u;return(2*m-3*p+1)*t[s]+(m-2*p+u)*c*d+(-2*m+3*p)*t[s+1]+(m-p)*c*h}static SETTLE_MS=120;static ARRIVAL=.5;static gaze(e,t,s,n){const i=e[s],a=e[s+1]-i;if(a<=0)return t[s];const c=h=>h+1<t.length?t[h+1]===t[h]:!0,d=t[s+1]!==t[s];if(d&&c(s+1)){const h=y.tangent(e,t,s,!0),u=y.ARRIVAL*(t[s+1]-t[s])/a;return y.hermite(t[s],h,t[s+1],u,a,(n-i)/a)}return!d&&s>0&&t[s-1]!==t[s]?t[s]+y.settle(e,t,s,n-i,a):y.at(e,t,s,n,!0)}static settle(e,t,s,n,i){const o=e[s]-e[s-1];if(o<=0||n<=0)return 0;const a=y.ARRIVAL*(t[s]-t[s-1])/o,c=Math.min(y.SETTLE_MS,.4*o),d=Number.isFinite(i)?(1-Math.min(1,n/i))**2:1;return a*n*Math.exp(-n/c)*d}static hermite(e,t,s,n,i,o){const a=o*o,c=a*o;return(2*c-3*a+1)*e+(c-2*a+o)*i*t+(-2*c+3*a)*s+(c-a)*i*n}static BRAKE_S=.8;static paced(e,t,s,n){if(!s&&!n)return e;const i=t>0?Math.min(.5,y.BRAKE_S/t):.5;if(s&&n){const a=1/(1-i);return e<=i?a*e*e/(2*i):e>=1-i?1-a*(1-e)*(1-e)/(2*i):a*(e-i/2)}const o=a=>{const c=1/(1-i/2);if(a<=1-i)return c*a;const d=a-(1-i);return c*(1-i)+c*(d-d*d/(2*i))};return n?o(e):1-o(1-e)}static tangent(e,t,s,n){const i=e.length-1,o=m=>(t[m+1]-t[m])/(e[m+1]-e[m]||1);if(s===0)return n?0:o(0);if(s===i)return n?0:o(i-1);const a=o(s-1),c=o(s);if(a*c<=0)return 0;const d=e[s]-e[s-1],h=e[s+1]-e[s],u=2*h+d,p=h+2*d;return(u+p)/(u/a+p/c)}}class U{keyframes=[];addKeyframe(e,t,s){const n=this.findInsertIndex(e),i=this.keyframes[n]?.t===e?this.keyframes[n]:void 0,a=s??i?.viewOnly?{t:e,pose:t,viewOnly:!0}:{t:e,pose:t};i?this.keyframes[n]=a:this.keyframes.splice(n,0,a)}setViewOnly(e,t){const s=this.findInsertIndex(e),n=this.keyframes[s];n?.t===e&&(this.keyframes[s]=t?{...n,viewOnly:!0}:{t:n.t,pose:n.pose})}turnIsViewOnly(e,t){if(this.keyframes.length===0)return!1;const s=Math.max(0,this.findInsertIndex(e)-(this.keyframes[this.findInsertIndex(e)]?.t===e?0:1));for(let n=s;n<this.keyframes.length;n++){const i=this.keyframes[n];if(i.viewOnly)return!0;if(i.t>=t)break}return!1}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.pose;const n=this.keyframes[t]?.t===e?void 0:this.keyframes[t];if(!s)return n?.pose;if(!n)return this.settledAfterEnd(t-1,e);const i=le(s.pose,n.pose,he((e-s.t)/(n.t-s.t),0,1));return this.humanly(t-1,e,i)}settledAfterEnd(e,t){const s=this.keyframes[e];if(e<1)return s.pose;const n=this.keyframes[e-1],i=[n.t,s.t],o=(h,u)=>h===void 0||u===void 0?0:y.settle(i,[h,u],1,t-s.t,1/0),a=n.pose.headingDeg===void 0||s.pose.headingDeg===void 0?void 0:((s.pose.headingDeg-n.pose.headingDeg)%360+540)%360-180,c=s.pose.headingDeg===void 0||a===void 0?s.pose.headingDeg:((s.pose.headingDeg+o(0,a))%360+360)%360,d=s.pose.pitchDeg+o(n.pose.pitchDeg,s.pose.pitchDeg);return c===s.pose.headingDeg&&d===s.pose.pitchDeg?s.pose:{...s.pose,headingDeg:c,pitchDeg:d}}humanly(e,t,s){const n=Math.max(0,e-1),i=Math.min(this.keyframes.length-1,e+2),o=this.keyframes.slice(n,i+1),a=e-n,c=o.map(l=>l.t),d=(l,g)=>{const S=o.map(C=>l(C.pose));if(!S.some(C=>C===void 0))return y.at(c,S,a,t,g)},h=l=>{const g=o.map(S=>l(S.pose));if(!g.some(S=>S===void 0))return y.gaze(c,g,a,t)},u=o.map(l=>l.pose.headingDeg);let p;if(u.every(l=>l!==void 0)){const l=[u[0]];for(let g=1;g<u.length;g++)l.push(l[g-1]+((u[g]-u[g-1])%360+540)%360-180);p=(y.gaze(c,l,a,t)%360+360)%360}const m=this.keyframes[e],k=this.keyframes[e+1],I=(l,g)=>l.lat===g.lat&&l.lng===g.lng&&l.elevationM===g.elevationM,x=!I(m.pose,k.pose),R=x&&e>0&&I(this.keyframes[e-1].pose,m.pose),O=x&&e+2<this.keyframes.length&&I(k.pose,this.keyframes[e+2].pose);let M;if(R||O){const l=y.paced((t-m.t)/(k.t-m.t),(k.t-m.t)/1e3,R,O),g=(S,C)=>S===void 0||C===void 0?void 0:S+(C-S)*l;M={lat:g(m.pose.lat,k.pose.lat),lng:g(m.pose.lng,k.pose.lng),elevationM:g(m.pose.elevationM,k.pose.elevationM)}}return{...s,lat:M?M.lat:d(l=>l.lat,!1)??s.lat,lng:M?M.lng:d(l=>l.lng,!1)??s.lng,elevationM:M?M.elevationM:d(l=>l.elevationM,!1)??s.elevationM,headingDeg:p??s.headingDeg,pitchDeg:h(l=>l.pitchDeg)??s.pitchDeg,rollDeg:d(l=>l.rollDeg??0,!0)??s.rollDeg,fovDeg:d(l=>l.fovDeg,!0)??s.fovDeg}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new U;for(const s of e.keyframes)t.addKeyframe(s.t,s.pose,s.viewOnly);return t}}class A{static MAX_CHANGE_PER_S=.05;points;followed;constructor(e){let t="none",s=0;this.points=e.map(({t:n,weather:i})=>(i.precipitationType!=="none"&&(t=i.precipitationType,s=i.precipitationIntensity),{t:n,lastFalling:t,lastFallingIntensity:s,intensity:i.precipitationType==="none"?0:i.precipitationIntensity,type:i.precipitationType})),this.followed=[];for(let n=0;n<this.points.length;n++){if(n===0){this.followed.push(this.points[0].intensity);continue}const i=this.points[n-1],o=this.points[n];this.followed.push(A.follow(this.followed[n-1],i.intensity,o.intensity,(o.t-i.t)/1e3,(o.t-i.t)/1e3))}}at(e){if(this.points.length===0||e<this.points[0].t)return;let t=this.points.length-1;for(;t>0&&this.points[t].t>e;)t--;const s=this.points[t],n=this.points[t+1],i=n?A.follow(this.followed[t],s.intensity,n.intensity,(n.t-s.t)/1e3,(e-s.t)/1e3):A.follow(this.followed[t],s.intensity,s.intensity,1,(e-s.t)/1e3);return{type:A.typeBetween(s,n,e,i),intensity:i,character:A.characterBetween(s,n,e)}}static characterBetween(e,t,s){return e.type==="none"?t&&t.type!=="none"?t.intensity:e.lastFallingIntensity:!t||t.type==="none"?e.intensity:e.intensity+(t.intensity-e.intensity)*(s-e.t)/(t.t-e.t||1)}static typeBetween(e,t,s,n){return e.type==="none"?t&&t.type!=="none"&&s>e.t?t.type:n>0?e.lastFalling:"none":t&&t.type==="none"&&n<=0?"none":e.type}static follow(e,t,s,n,i){const o=A.MAX_CHANGE_PER_S,a=n>0?(s-t)/n:0,c=u=>t+a*Math.min(Math.max(u,0),n);let d=e,h=0;for(let u=0;u<8&&h<i;u++){const p=c(h)-d;if(Math.abs(p)<1e-9){const M=h<n?a:0;if(Math.abs(M)<=o){const g=h<n?Math.min(i,n):i;d=c(g),h=g;continue}const l=Math.min(i,n);d+=Math.sign(M)*o*(l-h),h=l;continue}const m=Math.sign(p),k=h<n?a:0,I=o-m*k,x=I>0?h+Math.abs(p)/I:1/0,R=h<n?n:1/0,O=Math.min(i,x,R);d+=m*o*(O-h),h=O,O===x&&(d=c(h))}return Math.min(1,Math.max(0,d))}}const fe=1e3,Re=.65,Pe=.05,$={cloudCover:0,cloudDarkness:0,precipitationType:"none",precipitationIntensity:0,windDirectionDeg:0,windSpeed:0,storm:!1};function H(r){if(r.cloudLayers!==void 0)return r.cloudLayers;const e=[],t=r.lowerCloudCover??r.cloudCover;return t>0&&e.push({id:"lower",type:"cumulus",baseM:r.cloudBaseM??fe,thicknessM:650,coverage:t,sizeM:1400,density:1,darkness:r.cloudDarkness}),(r.highCloudCover??0)>0&&e.push({id:"cirrus",type:"cirrus",baseM:8e3,thicknessM:400,coverage:r.highCloudCover,sizeM:2200,density:.35,darkness:r.cloudDarkness,iceCrystalAlignment:r.iceCrystalAlignment}),e}function f(r,e,t){return r+(e-r)*t}function _(r,e,t){const s=((e-r)%360+540)%360-180;return((r+s*t)%360+360)%360}function me(r,e,t){return Math.max(e,Math.min(t,r))}function pe(r=[],e=[],t){if(!(!r.length&&!e.length))return[...new Set([...r.map(s=>s.id),...e.map(s=>s.id)])].map(s=>{const n=r.find(c=>c.id===s),i=e.find(c=>c.id===s),o=n??{...i,density:0},a=i??{...n,density:0};return{...o,eastM:f(o.eastM,a.eastM,t),northM:f(o.northM,a.northM,t),baseM:f(o.baseM,a.baseM,t),thicknessM:f(o.thicknessM,a.thicknessM,t),widthM:f(o.widthM,a.widthM,t),depthM:f(o.depthM,a.depthM,t),rotationDeg:_(o.rotationDeg,a.rotationDeg,t),density:f(o.density,a.density,t),darkness:f(o.darkness??0,a.darkness??0,t)}})}function ge(r,e,t){if(r.cloudLayers===void 0&&e.cloudLayers===void 0)return;const s=H(r),n=H(e);return t>=1?n.map(o=>({...o})):[...new Set([...s.map(o=>o.id),...n.map(o=>o.id)])].map(o=>{const a=s.find(u=>u.id===o),c=n.find(u=>u.id===o),d=a??{...c,coverage:0},h=c??{...a,coverage:0};return{...d,instances:pe(a?.instances,c?.instances,t),baseM:f(d.baseM,h.baseM,t),thicknessM:f(d.thicknessM,h.thicknessM,t),coverage:f(d.coverage,h.coverage,t),sizeM:f(d.sizeM,h.sizeM,t),density:f(d.density,h.density,t),darkness:f(d.darkness??r.cloudDarkness,h.darkness??e.cloudDarkness,t),iceCrystalAlignment:d.iceCrystalAlignment===void 0||h.iceCrystalAlignment===void 0?void 0:f(d.iceCrystalAlignment,h.iceCrystalAlignment,t),windSpeed:d.windSpeed===void 0&&h.windSpeed===void 0?void 0:f(d.windSpeed??r.windSpeed,h.windSpeed??e.windSpeed,t),windDirectionDeg:d.windDirectionDeg===void 0&&h.windDirectionDeg===void 0?void 0:_(d.windDirectionDeg??r.windDirectionDeg,h.windDirectionDeg??e.windDirectionDeg,t)}})}function ye(r,e,t){return{cloudLayers:ge(r,e,t),cloudCover:f(r.cloudCover,e.cloudCover,t),cloudDarkness:f(r.cloudDarkness,e.cloudDarkness,t),highCloudCover:r.highCloudCover===void 0||e.highCloudCover===void 0?void 0:f(r.highCloudCover,e.highCloudCover,t),iceCrystalAlignment:r.iceCrystalAlignment===void 0||e.iceCrystalAlignment===void 0?void 0:f(r.iceCrystalAlignment,e.iceCrystalAlignment,t),rareIceCrystals:r.rareIceCrystals===void 0||e.rareIceCrystals===void 0?void 0:f(r.rareIceCrystals,e.rareIceCrystals,t),lowerCloudCover:r.lowerCloudCover===void 0||e.lowerCloudCover===void 0?void 0:f(r.lowerCloudCover,e.lowerCloudCover,t),cloudBaseM:r.cloudBaseM===void 0||e.cloudBaseM===void 0?void 0:f(r.cloudBaseM,e.cloudBaseM,t),relativeHumidity:r.relativeHumidity===void 0||e.relativeHumidity===void 0?void 0:f(r.relativeHumidity,e.relativeHumidity,t),visibilityKm:r.visibilityKm===void 0||e.visibilityKm===void 0?void 0:f(r.visibilityKm,e.visibilityKm,t),precipitationType:t<1?r.precipitationType:e.precipitationType,precipitationIntensity:f(r.precipitationIntensity,e.precipitationIntensity,t),windDirectionDeg:_(r.windDirectionDeg,e.windDirectionDeg,t),windSpeed:f(r.windSpeed,e.windSpeed,t),storm:t<1?r.storm:e.storm}}class K{keyframes=[];ramp;addKeyframe(e,t){this.ramp=void 0;const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,weather:t}:this.keyframes.splice(s,0,{t:e,weather:t})}clear(){this.ramp=void 0,this.keyframes.length=0}removeKeyframeAt(e){this.ramp=void 0;const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}getLatestWeatherAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].weather:void 0}getInterpolatedWeatherAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.weather;const n=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return s?n?ye(s.weather,n.weather,me((e-s.t)/(n.t-s.t),0,1)):s.weather:n?.weather}getActualWeatherAt(e){const t=this.getInterpolatedWeatherAt(e);if(!t)return;const s=(this.ramp??=new A(this.keyframes)).at(e);if(!s)return t;const{type:n,intensity:i,character:o}=s,a=o>0?Math.min(1,i/o):n==="none"?0:1;return{...t,precipitationType:n,precipitationIntensity:o,precipitationAmount:a}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new K;for(const s of e.keyframes)t.addKeyframe(s.t,{...$,...s.weather});return t}}class z{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,sound:t}:this.keyframes.splice(s,0,{t:e,sound:t})}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}getLatestSoundAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].sound:void 0}getInterpolatedSoundAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.sound;const n=this.keyframes[t]?.t===e?void 0:this.keyframes[t];if(!s)return n?.sound;if(!n)return s.sound;const i=(e-s.t)/(n.t-s.t);return this.lerp(s.sound,n.sound,Math.max(0,Math.min(1,i)))}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new z;for(const s of e.keyframes)t.addKeyframe(s.t,s.sound);return t}lerp(e,t,s){return{kind:s<1?e.kind:t.kind,volume:e.volume+(t.volume-e.volume)*s,pitchHz:e.pitchHz+(t.pitchHz-e.pitchHz)*s,src:s<1?e.src:t.src}}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}}const Fe=["none","hum","whistle","rumble","crackle"],ve=100,ke={kind:"none",volume:0,pitchHz:ve};class N{static MAX_SPECKS=4;static BROADCAST_35MM={framesPerSecond:24,contrast:1.6,tint:[.99,.98,.92],softness:1.6/480,specksPerFrame:1.15,speckRadius:1.6/480,speckRadiusMax:4.5/480,weave:[.25/640,.6/480],grain:.008};static hash(e,t){const s=Math.sin(e*127.1+t*311.7)*43758.5453;return s-Math.floor(s)}static frameAt(e,t){return Math.floor(t*e.framesPerSecond/1e3)}static frame(e,t){const s=a=>N.hash(t,a),n=a=>(s(a)+s(a+1)+s(a+2)-1.5)*2,i=Math.min(1,e.specksPerFrame/N.MAX_SPECKS),o=[];for(let a=0;a<N.MAX_SPECKS;a++){const c=10+a*6;if(s(c)>=i)continue;const d=s(c+3)**3;o.push({u:s(c+1),v:s(c+2),radius:e.speckRadius*.6+d*(e.speckRadiusMax-e.speckRadius*.6),kept:.25+.4*s(c+4)})}return{weave:[n(1)*e.weave[0],n(4)*e.weave[1]],specks:o,seed:s(7)}}}const P=[{id:"eye",category:"eye",name:"Naked eye",projection:"equidistant",stabilization:.97},{id:"rectilinear-lens",category:"camera",name:"Camera, unknown device",projection:"rectilinear",fNumber:8,fNumberRange:{min:2,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:8},apertureBlades:6},{id:"roamer-1-120",filmFormat:"120",category:"camera",name:"Roamer 1, 120 film",projection:"rectilinear",frame:{widthMm:74,heightMm:60,focalLengthMm:100},fNumber:11,exposureSeconds:1/50,years:{from:1930,to:1965},detailUm:40,medium:{kind:"negative",iso:125}},{id:"instamatic-126",filmFormat:"126",category:"camera",name:"Instamatic, 126 film",projection:"rectilinear",frame:{widthMm:28,heightMm:28,focalLengthMm:43},fNumber:11,exposureSeconds:1/90,years:{from:1963,to:1988},apertureBlades:5,detailUm:20,medium:{kind:"negative",iso:64}},{id:"slr-35mm-50",filmFormat:"135",category:"camera",name:"35 mm SLR, 50 mm lens",projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:50},fNumber:8,fNumberRange:{min:2,max:16},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},years:{from:1959},apertureBlades:6,detailUm:20,medium:{kind:"negative",iso:100}},{id:"cine-35mm-broadcast",filmFormat:"35mm-cine",category:"camera",name:"35 mm film camera, seen on television",projection:"rectilinear",frame:{widthMm:21.3,heightMm:16,focalLengthMm:50,focalRangeMm:{minMm:18,maxMm:300}},fNumber:11,fNumberRange:{min:2,max:22},exposureSeconds:1/48,exposureRangeSeconds:{min:1/96,max:1/24},years:{from:1950,to:1995},apertureBlades:6,detailUm:15,medium:{kind:"negative",iso:100,print:N.BROADCAST_35MM}},{id:"slr-35mm-zoom",filmFormat:"135",category:"camera",name:"35 mm SLR, 70-210 mm zoom",projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:135,focalRangeMm:{minMm:70,maxMm:210}},fNumber:8,fNumberRange:{min:4,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},apertureBlades:8,years:{from:1975},detailUm:20,medium:{kind:"negative",iso:100}},{id:"phone-landscape",category:"phone",name:"Phone, held sideways",projection:"rectilinear",frame:{widthMm:7.6,heightMm:5.7,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:3200,metering:"highlights",development:"computational"}},{id:"phone-portrait",category:"phone",name:"Phone, held upright",projection:"rectilinear",frame:{widthMm:5.7,heightMm:7.6,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:3200,metering:"highlights",development:"computational"}},{id:"dashcam",mounted:!0,category:"video",name:"Dashcam",projection:"equidistant",frame:{widthMm:5.76,heightMm:3.24,focalLengthMm:3.2},fNumber:2,exposureSeconds:1/30,exposureRangeSeconds:{min:1/1e4,max:1/30},years:{from:2008},apertureBlades:void 0,detailUm:3,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:1600,metering:"average",exposureFollowMs:500}},{id:"cctv",mounted:!0,category:"video",name:"Security camera",projection:"rectilinear",frame:{widthMm:4.8,heightMm:3.6,focalLengthMm:3.6},fNumber:2,exposureSeconds:1/50,exposureRangeSeconds:{min:1/1e5,max:1/50},years:{from:1990},apertureBlades:void 0,detailUm:6,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:1600,metering:"average",exposureFollowMs:500}},...Y.instruments(),...q.instruments()];class D{static get default(){return P[0]}static byId(e){return P.find(t=>t.id===e)??this.default}static UNAIDED_FIELD_DEG=60;static UNAIDED_ASPECT=16/9;static fieldOfViewDeg(e){const t=e.frame;return t?D.fieldOf(e.projection,t.heightMm,t.focalLengthMm):e.visualAid?.trueFieldDeg??D.UNAIDED_FIELD_DEG}static fieldOf(e,t,s){return(e==="equidistant"?t/s:2*Math.atan(t/(2*s)))*180/Math.PI}static aspectOf(e){const t=e.frame;return t?t.widthMm/t.heightMm:D.UNAIDED_ASPECT}static frameWidthPx(e,t){return Math.round(t*D.aspectOf(e))}static CATEGORIES=["eye","camera","dslr","phone","video","binoculars","telescope"];static unavailability(e,t){const s=e.years;if(!(t===void 0||!s)){if(t<s.from)return{kind:"before",from:s.from};if(s.to!==void 0&&t>s.to)return{kind:"after",to:s.to}}}static availableAt(e){return e===void 0?P:P.filter(t=>!t.years||e>=t.years.from&&(t.years.to===void 0||e<=t.years.to))}static fieldOfViewDegAt(e,t){const s=e.frame;if(!(!s||t<=0))return D.fieldOf(e.projection,s.heightMm,t)}static focalLengthMmFor(e,t){const s=e.frame;if(!(!s||t<=0||t>=180))return e.projection==="equidistant"?s.heightMm/(t*Math.PI/180):s.heightMm/(2*Math.tan(t*Math.PI/360))}static bladesShowing(e,t){if(e.apertureBlades===void 0)return 0;const s=t??e.fNumber,n=e.fNumberRange?.min;if(s===void 0||n===void 0)return 1;const i=Math.max(0,Math.min(1,(s/n-1)/.3));return i*i*(3-2*i)}static starPointsOf(e,t){const s=e.apertureBlades;return s===void 0||s<3||D.bladesShowing(e,t)<.5?0:s%2===0?s:s*2}}const V=["spring","summer","autumn","winter"],F=21,Me=32,Se=/^(?<hour>[01]?\d|2[0-3]):(?<minute>[0-5]\d)(?::(?<second>[0-5]\d))?[?~%]?$/;let De;function Ie(){return De??=new ee}function T(r){return typeof r?.value=="number"?r.value:void 0}function Be(r){const e=r.trim();if(/^\d{1,2}:/.test(e)){const o=Se.exec(e)?.groups;return o?{year:void 0,month:void 0,day:void 0,hour:Number(o.hour),minute:Number(o.minute),second:o.second?Number(o.second):void 0,raw:e}:void 0}let t;try{t=Q.fromString(e,Ie())}catch{return}const s=T(t.year),n=T(t.month),i=n!==void 0&&n>=F&&n<=Me;if(!(t.timeshift||s!==void 0&&Math.abs(s)>9999)&&!(n!==void 0&&n>12&&!i)&&!(i&&(t.day||t.hour)))return{year:s,month:i?void 0:n,...i?{season:V[(n-F)%4]}:{},day:T(t.day),hour:T(t.hour),minute:T(t.minute),second:T(t.second),raw:e}}function Ue(r){if(r.raw!==void 0)return r.raw;if(r.year===void 0){if(r.hour===void 0)return"";let t=`${String(r.hour).padStart(2,"0")}:${String(r.minute??0).padStart(2,"0")}`;return r.second!==void 0&&(t+=`:${String(r.second).padStart(2,"0")}`),t}let e=String(r.year).padStart(4,"0");return r.season!==void 0?`${e}-${F+V.indexOf(r.season)}`:(r.month===void 0||(e+=`-${String(r.month).padStart(2,"0")}`,r.day===void 0)||(e+=`-${String(r.day).padStart(2,"0")}`,r.hour===void 0)||(e+=`T${String(r.hour).padStart(2,"0")}:${String(r.minute??0).padStart(2,"0")}`,r.second!==void 0&&(e+=`:${String(r.second).padStart(2,"0")}`)),e)}function W(r){if(r.year!==void 0)return Date.UTC(r.year,(r.month??1)-1,r.day??1,r.hour??0,r.minute??0,r.second??0)}function J(r){return(((r.day??0)*24+(r.hour??0))*60+(r.minute??0))*6e4+(r.second??0)*1e3}const we=["year","month","day","hour","minute"],Ae=["day","hour","minute"];function j(r,e){return e.filter(t=>r[t]!==void 0).join(",")}function xe(r){if(r.durationSeconds!==void 0)return r.durationSeconds*1e3;const e=r.durationText===void 0?void 0:E.parse(r.durationText);if(e)return e.chosenSeconds*1e3;if(!r.time||!r.endTime)return;const t=r.time.year!==void 0&&r.endTime.year!==void 0,s=t?we:Ae,n=j(r.time,s);if(!(n===""||n!==j(r.endTime,s)))return t?W(r.endTime)-W(r.time):J(r.endTime)-J(r.time)}function $e(r){if(r.durationSeconds===void 0&&!(!r.time||!r.endTime))return xe(r)===void 0?"imprecise":void 0}class X{constructor(e,t,s,n,i,o,a,c,d=[],h,u,p,m=[],k=[],I=[],x=[]){this.event=e,this.timeline=t,this.observerTrack=s,this.weatherTrack=n,this.soundTrack=i,this.observer=o,this.id=a,this.weather=c,this.decor=d,this.weatherSource=h,this.instrumentId=u,this.exposureSeconds=p,this.milestones=m,this.references=k,this.roads=I,this.traces=x}provenance=Z.empty();loadIssues=[];account;sources;interpretation;variants=[];skyEvents;skySources;snapshots;modules;sway;lightPollution;around;observerMap;iso;film;metering;lens;lighting;vehicle;events;eventsExpansion;sampleMs;get observerCount(){return 1+this.decor.filter(e=>e.kind==="observer").length}get exposure(){return this.exposureSeconds??this.instrument.exposureSeconds}get instrument(){return D.byId(this.instrumentId)}static create(e,t,s){return new X({eventType:"sighting",time:e,place:t},new B,new U,new K,new z,s)}}const be=0,Oe=0;function _e(r,e){const t=r.observerTrack.getInterpolatedPoseAt(e);if(t)return t;const s=r.event.place?.[0];if(s)return{lat:s.lat,lng:s.lng,elevationM:be,headingDeg:void 0,pitchDeg:Oe,fovDeg:D.fieldOfViewDeg(r.instrument)}}function Ke(r,e){return r.weatherTrack.getInterpolatedWeatherAt(e)??r.weather??$}function ze(r,e){return r.weatherTrack.getActualWeatherAt(e)??r.weather??$}function Ge(r,e){return r.soundTrack.getInterpolatedSoundAt(e)??ke}export{L as A,E as D,N as F,y as H,D as I,w as K,U as O,Fe as S,B as T,K as W,Re as a,Ke as b,_e as c,ne as d,se as e,Ge as f,$e as g,Pe as h,Ne as i,P as j,Ue as k,X as l,Le as m,z as n,W as o,Be as p,$ as q,H as r,xe as s,fe as t,ze as u};
|
|
1
|
+
import{D as Y,V as q}from"./VisualAids-DI-hEL46.js";import{P as Z}from"./rr0-ufoathome.mjs";import{L as Q,c as ee}from"./SaidPosition-CXZLm-ck.js";class E{static ISO=/^P(?:(\d+(?:[.,]\d+)?)W)?(?:(\d+(?:[.,]\d+)?)D)?(?:T(?:(\d+(?:[.,]\d+)?)H)?(?:(\d+(?:[.,]\d+)?)M)?(?:(\d+(?:[.,]\d+)?)S)?)?$/;static seconds(e){const t=e.trim().toUpperCase(),s=E.ISO.exec(t);if(!s||t==="P"||t.endsWith("T"))return;const[,n,i,o,a,c]=s,d=u=>u===void 0?0:Number(u.replace(",",".")),h=d(n)*604800+d(i)*86400+d(o)*3600+d(a)*60+d(c);return Number.isFinite(h)?h:void 0}static parse(e){let t=e.trim();if(t==="")return;const s=t.slice(-1),n="?~%".includes(s)?s:"";n!==""&&(t=t.slice(0,-1).trim());const i=t.split("/");if(i.length>2)return;const o=i.map(u=>E.seconds(u));if(o.some(u=>u===void 0))return;const[a,c]=o,d=Math.min(a,c??a),h=Math.max(a,c??a);return{doubt:n,minSeconds:d,maxSeconds:h,chosenSeconds:(d+h)/2}}static isExact(e){const t=E.parse(e);return t!==void 0&&t.doubt===""&&t.minSeconds===t.maxSeconds}static format(e){const t=Math.max(0,Math.round(e*10)/10),s=Math.floor(t/3600),n=Math.floor(t%3600/60),i=Math.round(t%60*10)/10;return`PT${`${s>0?`${s}H`:""}${n>0?`${n}M`:""}${i>0||s===0&&n===0?`${i}S`:""}`}`}static say(e){const t=Math.round(e*10)/10;if(t<60)return`${t} s`;const s=Math.floor(t/3600),n=Math.floor(t%3600/60),i=Math.round(t%60*10)/10,o=[];return s>0&&o.push(`${s} h`),n>0&&o.push(`${n} min`),i>0&&o.push(`${i} s`),o.join(" ")}}class L{static MOON_ANGULAR_WIDTH_DEG=.5237;static CANVAS_WIDTH_PX=640;static CANVAS_HEIGHT_PX=360;static angularWidthDeg(e){return 2*Math.atan(e.sizeM/(2*e.distanceM))*180/Math.PI}static inMoons(e){return e/L.MOON_ANGULAR_WIDTH_DEG}static lerpAngular(e,t,s){if(!(!e||!t))return{widthDeg:e.widthDeg+(t.widthDeg-e.widthDeg)*s,heightDeg:e.heightDeg+(t.heightDeg-e.heightDeg)*s}}static sizeMAt(e,t){return 2*e*Math.tan(t*Math.PI/360)}static distanceMAt(e,t){return e/(2*Math.tan(t*Math.PI/360))}}function te(r,e,t){if(!r||!e)return t<1?r:e;const s=((e.azimuthDeg-r.azimuthDeg)%360+540)%360-180;return{azimuthDeg:((r.azimuthDeg+s*t)%360+360)%360,altitudeDeg:r.altitudeDeg+(e.altitudeDeg-r.altitudeDeg)*t}}function se(r,e="#39ff14"){return{kind:"oval",bounds:r,color:e,angle:0,transparency:0,haloScale:0,selected:!1}}function ne(r,e,t="#39ff14"){return{kind:"polygon",bounds:r,points:e,color:t,angle:0,transparency:0,haloScale:0,selected:!1}}function re(r,e="#39ff14"){const{width:t,height:s}=r;return ne(r,[{x:0,y:0},{x:t,y:0},{x:t,y:s},{x:0,y:s}],e)}const ie={oval:se,polygon:re};function Ne(r,e){return{...ie[e.presetId](r,e.color),transparency:e.transparency,haloScale:e.haloScale,blur:e.blur,brightness:e.brightness}}function oe(r,e,t){const{bounds:s}=r;return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function Le(r,e,t){const s=r.bounds.width,n=r.bounds.height;return{...r,bounds:{x:e-s/2,y:t-n/2,width:s,height:n}}}function v(r,e,t){return r+(e-r)*t}function G(r){const e=/^#([0-9a-f]{6})$/i.exec(r);if(!e)return;const t=parseInt(e[1],16);return[t>>16&255,t>>8&255,t&255]}function ae(r){return`#${r.map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}`}function de(r,e,t){const s=G(r),n=G(e);return!s||!n?t<1?r:e:ae([v(s[0],n[0],t),v(s[1],n[1],t),v(s[2],n[2],t)])}function ce(r,e,t){const s={x:v(r.bounds.x,e.bounds.x,t),y:v(r.bounds.y,e.bounds.y,t),width:v(r.bounds.width,e.bounds.width,t),height:v(r.bounds.height,e.bounds.height,t)},n=v(r.angle,e.angle,t),i=v(r.transparency,e.transparency,t),o=v(r.haloScale,e.haloScale,t),a=v(r.blur??0,e.blur??0,t),c=v(r.brightness??0,e.brightness??0,t),d=de(r.color,e.color,t),h=L.lerpAngular(r.angular,e.angular,t),u=te(r.aim,e.aim,t);return r.kind==="polygon"&&e.kind==="polygon"&&r.points.length===e.points.length?{...r,bounds:s,angle:n,transparency:i,haloScale:o,blur:a,brightness:c,color:d,angular:h,aim:u,points:r.points.map((p,m)=>({x:v(p.x,e.points[m].x,t),y:v(p.y,e.points[m].y,t)}))}:{...t<1?r:e,bounds:s,angle:n,transparency:i,haloScale:o,blur:a,brightness:c,color:d,angular:h,aim:u}}class w{static DEFAULT_COLOR="#e8e6df";static complete(e,t=[]){const s=new Map;return e.map((n,i)=>({keyframe:n,index:i})).sort((n,i)=>n.keyframe.t-i.keyframe.t).map(({keyframe:n,index:i})=>({t:n.t,shapes:(n.shapes??[]).map((o,a)=>{const c=`timeline.keyframes.${i}.shapes.${a}.shape`,d=w.completed(o,s.get(o.sourceId),c,t);return s.set(o.sourceId,d),{sourceId:o.sourceId,shape:d}})}))}static thin(e,t){const s=new Map,n=new Set;return e.map((i,o)=>({t:i.t,shapes:i.shapes.map(a=>{const c=s.get(a.sourceId);if(s.set(a.sourceId,a.shape),!c)return{sourceId:a.sourceId,shape:a.shape};const d=w.thinned(a.shape,c);if(t){const h=d;t(o,a.sourceId)?(delete h.bounds,delete h.points,n.add(a.sourceId)):n.delete(a.sourceId)&&(h.bounds=a.shape.bounds,a.shape.kind==="polygon"&&(h.points=a.shape.points),a.shape.aim&&(h.aim=a.shape.aim),a.shape.angular&&(h.angular=a.shape.angular))}return{sourceId:a.sourceId,shape:d}})}))}static thinned(e,t){const s=t,n={};for(const[i,o]of Object.entries(e))(typeof o=="object"&&o!==null&&!Array.isArray(o)&&"value"in o||o!==s[i]&&JSON.stringify(o)!==JSON.stringify(s[i]))&&(n[i]=o);return"bounds"in n&&(e.aim&&(n.aim=e.aim),e.angular&&(n.angular=e.angular)),n}static completed(e,t,s,n){const i=e.shape??{},o=t??w.firstAppearance(i,s,n),a={...o};i.bounds&&t&&(t.aim||t.angular)&&!i.aim&&!i.angular&&n.push({kind:"pixels-over-angles",path:s}),i.bounds&&(i.aim||delete a.aim,i.angular||delete a.angular);const c=i.kind??o.kind??"oval",d={...a,...i,kind:c};if(c==="polygon"&&!d.points){n.push({kind:"defaulted",path:`${s}.points`,expected:"rectangle"});const{width:h,height:u}=d.bounds;return{...d,points:[{x:0,y:0},{x:h,y:0},{x:h,y:u},{x:0,y:u}]}}return d}static firstAppearance(e,t,s){return e.kind||s.push({kind:"defaulted",path:`${t}.kind`,expected:'"oval"'}),e.color||s.push({kind:"defaulted",path:`${t}.color`,expected:`"${w.DEFAULT_COLOR}"`}),!e.bounds&&!e.aim&&s.push({kind:"unplaced",path:t}),!e.bounds&&!e.angular&&s.push({kind:"unsized",path:t}),{kind:e.kind??"oval",bounds:{...w.NEUTRAL_BOUNDS},color:w.DEFAULT_COLOR,angle:0,transparency:0,haloScale:0,selected:!1}}static NEUTRAL_BOUNDS={x:L.CANVAS_WIDTH_PX/2,y:L.CANVAS_HEIGHT_PX/2,width:1,height:1}}class B{keyframes=[];order=[];groups=[];span=0;addKeyframe(e,t){const s=this.findInsertIndex(e);if(this.keyframes[s]?.t===e){const n=new Set(t.map(i=>i.sourceId));this.keyframes[s]={t:e,shapes:[...this.keyframes[s].shapes.filter(i=>!n.has(i.sourceId)),...t]}}else this.keyframes.splice(s,0,{t:e,shapes:[...t]});for(const n of t)this.order.includes(n.sourceId)||this.order.push(n.sourceId)}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}getKeyframeAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t];return s?.t===e?s:void 0}getShapeAt(e,t){return this.getKeyframeAt(e)?.shapes.find(s=>s.sourceId===t)?.shape}getLatestShapeAt(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const n=this.keyframes[s].shapes.find(i=>i.sourceId===t);if(n)return n.shape}}getInterpolatedShapeAt(e,t){const s=this.findShapeAtOrBefore(e,t);if(s?.t===e)return s.shape;const n=this.findShapeAtOrAfter(e,t);return s?n?ce(s.shape,n.shape,(e-s.t)/(n.t-s.t)):s.shape:n?.shape}findShapeAtOrBefore(e,t){let s=this.findInsertIndex(e);for(this.keyframes[s]?.t!==e&&(s-=1);s>=0;s--){const n=this.keyframes[s].shapes.find(i=>i.sourceId===t);if(n)return{t:this.keyframes[s].t,shape:n.shape}}}findShapeAtOrAfter(e,t){for(let s=this.findInsertIndex(e);s<this.keyframes.length;s++){const n=this.keyframes[s].shapes.find(i=>i.sourceId===t);if(n)return{t:this.keyframes[s].t,shape:n.shape}}}hitTest(e,t,s,n){const i=this.sourceIds;for(let o=i.length-1;o>=0;o--){if(n?.has(i[o]))continue;const a=this.getInterpolatedShapeAt(e,i[o]);if(a&&oe(a,t,s))return{sourceId:i[o],shape:a}}}removeSource(e){for(let t=this.keyframes.length-1;t>=0;t--){const s=this.keyframes[t].shapes.filter(n=>n.sourceId!==e);s.length===0?this.keyframes.splice(t,1):s.length!==this.keyframes[t].shapes.length&&(this.keyframes[t]={t:this.keyframes[t].t,shapes:s})}this.order=this.order.filter(t=>t!==e),this.removeFromGroup(e)}removeShapeAt(e,t){const s=this.findInsertIndex(e),n=this.keyframes[s];if(n?.t!==e)return;const i=n.shapes.filter(o=>o.sourceId!==t);i.length===0?this.keyframes.splice(s,1):i.length!==n.shapes.length&&(this.keyframes[s]={t:e,shapes:i})}group(e,t){const s=new Set(e),n=[];for(const o of e){const a=this.topOf(o),c=a!==o&&this.leavesOf(a).every(d=>s.has(d))?a:o;c===o&&a!==o&&this.removeFromGroup(o),n.includes(c)||n.push(c)}if(n.length<2)return;const i=t??this.freshGroupId();return this.groups.push({id:i,members:n}),i}ungroup(e){const t=this.topOf(e);t!==e&&(this.groups=this.groups.filter(s=>s.id!==t))}groupMembers(e){const t=this.topOf(e);return t===e?void 0:this.leavesOf(t)}get allGroups(){return this.groups}setGroups(e,t=!0){this.groups=e.map(s=>({...s,members:[...s.members]})),t&&this.pruneGroups()}groupOf(e){return this.groups.find(t=>t.id===e)}leavesOf(e,t=new Set){const s=this.groupOf(e);return s?t.has(e)?[]:(t.add(e),s.members.flatMap(n=>this.leavesOf(n,t))):[e]}parentOf(e){return this.groups.find(t=>t.members.includes(e))}topOf(e){let t=e;for(let s=this.parentOf(t),n=0;s&&n<100;s=this.parentOf(t),n++)t=s.id;return t}freshGroupId(){for(let e=this.groups.length+1;;e++){const t=`group-${e}`;if(!this.groupOf(t)&&!this.order.includes(t))return t}}removeFromGroup(e){const t=this.parentOf(e);t&&(t.members=t.members.filter(s=>s!==e),this.collapse())}pruneGroups(){const e=t=>this.order.includes(t)||this.groupOf(t)!==void 0;for(const t of this.groups)t.members=t.members.filter(e);this.collapse()}collapse(){for(let e=this.groups.find(t=>t.members.length<2);e;e=this.groups.find(t=>t.members.length<2)){const t=e;this.groups=this.groups.filter(s=>s!==t);for(const s of this.groups)s.members=s.members.flatMap(n=>n===t.id?t.members:[n])}}bringToFront(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.push(e))}sendToBack(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.order.unshift(e))}get duration(){const e=this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t;return Math.max(e,this.span)}get hasSpan(){return this.span>0}setSpan(e){this.span=Math.max(0,e)}get sourceIds(){return[...this.order]}get allKeyframes(){return this.keyframes}toJSON(){return this.span>0?{keyframes:this.keyframes,order:this.order,groups:this.groupsJson(),span:this.span}:{keyframes:this.keyframes,order:this.order,groups:this.groupsJson()}}groupsJson(){return this.groups.map(e=>({...e,members:[...e.members]}))}static fromJSON(e,t,s=!0){const n=new B;for(const i of w.complete(e.keyframes??[],t))n.addKeyframe(i.t,i.shapes);if(e.span!==void 0&&e.span>0&&(n.span=e.span),e.order){const i=n.order.filter(o=>!e.order.includes(o));n.order=[...e.order,...i]}return e.groups&&(n.groups=e.groups.filter(i=>typeof i?.id=="string"&&Array.isArray(i.members)).map(i=>({...i,members:[...i.members]})),s&&n.pruneGroups()),n}}function he(r,e,t){return Math.max(e,Math.min(t,r))}function ue(r,e,t){const s=((e-r)%360+540)%360-180;return((r+s*t)%360+360)%360}function b(r,e,t){return r+(e-r)*t}function le(r,e,t){return{lat:r.lat===void 0||e.lat===void 0?void 0:b(r.lat,e.lat,t),lng:r.lng===void 0||e.lng===void 0?void 0:b(r.lng,e.lng,t),elevationM:b(r.elevationM,e.elevationM,t),...r.altitudeM!==void 0&&e.altitudeM!==void 0?{altitudeM:b(r.altitudeM,e.altitudeM,t)}:{},headingDeg:r.headingDeg===void 0||e.headingDeg===void 0?void 0:ue(r.headingDeg,e.headingDeg,t),pitchDeg:b(r.pitchDeg,e.pitchDeg,t),rollDeg:b(r.rollDeg??0,e.rollDeg??0,t),fovDeg:b(r.fovDeg,e.fovDeg,t),fNumber:r.fNumber,focusDistanceM:r.focusDistanceM,filter:r.filter}}class y{static at(e,t,s,n,i){const o=e[s],c=e[s+1]-o;if(c<=0)return t[s];const d=y.tangent(e,t,s,i),h=y.tangent(e,t,s+1,i),u=(n-o)/c,p=u*u,m=p*u;return(2*m-3*p+1)*t[s]+(m-2*p+u)*c*d+(-2*m+3*p)*t[s+1]+(m-p)*c*h}static SETTLE_MS=120;static ARRIVAL=.5;static gaze(e,t,s,n){const i=e[s],a=e[s+1]-i;if(a<=0)return t[s];const c=h=>h+1<t.length?t[h+1]===t[h]:!0,d=t[s+1]!==t[s];if(d&&c(s+1)){const h=y.tangent(e,t,s,!0),u=y.ARRIVAL*(t[s+1]-t[s])/a;return y.hermite(t[s],h,t[s+1],u,a,(n-i)/a)}return!d&&s>0&&t[s-1]!==t[s]?t[s]+y.settle(e,t,s,n-i,a):y.at(e,t,s,n,!0)}static settle(e,t,s,n,i){const o=e[s]-e[s-1];if(o<=0||n<=0)return 0;const a=y.ARRIVAL*(t[s]-t[s-1])/o,c=Math.min(y.SETTLE_MS,.4*o),d=Number.isFinite(i)?(1-Math.min(1,n/i))**2:1;return a*n*Math.exp(-n/c)*d}static hermite(e,t,s,n,i,o){const a=o*o,c=a*o;return(2*c-3*a+1)*e+(c-2*a+o)*i*t+(-2*c+3*a)*s+(c-a)*i*n}static BRAKE_S=.8;static paced(e,t,s,n){if(!s&&!n)return e;const i=t>0?Math.min(.5,y.BRAKE_S/t):.5;if(s&&n){const a=1/(1-i);return e<=i?a*e*e/(2*i):e>=1-i?1-a*(1-e)*(1-e)/(2*i):a*(e-i/2)}const o=a=>{const c=1/(1-i/2);if(a<=1-i)return c*a;const d=a-(1-i);return c*(1-i)+c*(d-d*d/(2*i))};return n?o(e):1-o(1-e)}static tangent(e,t,s,n){const i=e.length-1,o=m=>(t[m+1]-t[m])/(e[m+1]-e[m]||1);if(s===0)return n?0:o(0);if(s===i)return n?0:o(i-1);const a=o(s-1),c=o(s);if(a*c<=0)return 0;const d=e[s]-e[s-1],h=e[s+1]-e[s],u=2*h+d,p=h+2*d;return(u+p)/(u/a+p/c)}}class U{keyframes=[];addKeyframe(e,t,s){const n=this.findInsertIndex(e),i=this.keyframes[n]?.t===e?this.keyframes[n]:void 0,a=s??i?.viewOnly?{t:e,pose:t,viewOnly:!0}:{t:e,pose:t};i?this.keyframes[n]=a:this.keyframes.splice(n,0,a)}setViewOnly(e,t){const s=this.findInsertIndex(e),n=this.keyframes[s];n?.t===e&&(this.keyframes[s]=t?{...n,viewOnly:!0}:{t:n.t,pose:n.pose})}turnIsViewOnly(e,t){if(this.keyframes.length===0)return!1;const s=Math.max(0,this.findInsertIndex(e)-(this.keyframes[this.findInsertIndex(e)]?.t===e?0:1));for(let n=s;n<this.keyframes.length;n++){const i=this.keyframes[n];if(i.viewOnly)return!0;if(i.t>=t)break}return!1}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}getLatestPoseAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].pose:void 0}getInterpolatedPoseAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.pose;const n=this.keyframes[t]?.t===e?void 0:this.keyframes[t];if(!s)return n?.pose;if(!n)return this.settledAfterEnd(t-1,e);const i=le(s.pose,n.pose,he((e-s.t)/(n.t-s.t),0,1));return this.humanly(t-1,e,i)}settledAfterEnd(e,t){const s=this.keyframes[e];if(e<1)return s.pose;const n=this.keyframes[e-1],i=[n.t,s.t],o=(h,u)=>h===void 0||u===void 0?0:y.settle(i,[h,u],1,t-s.t,1/0),a=n.pose.headingDeg===void 0||s.pose.headingDeg===void 0?void 0:((s.pose.headingDeg-n.pose.headingDeg)%360+540)%360-180,c=s.pose.headingDeg===void 0||a===void 0?s.pose.headingDeg:((s.pose.headingDeg+o(0,a))%360+360)%360,d=s.pose.pitchDeg+o(n.pose.pitchDeg,s.pose.pitchDeg);return c===s.pose.headingDeg&&d===s.pose.pitchDeg?s.pose:{...s.pose,headingDeg:c,pitchDeg:d}}humanly(e,t,s){const n=Math.max(0,e-1),i=Math.min(this.keyframes.length-1,e+2),o=this.keyframes.slice(n,i+1),a=e-n,c=o.map(l=>l.t),d=(l,g)=>{const S=o.map(C=>l(C.pose));if(!S.some(C=>C===void 0))return y.at(c,S,a,t,g)},h=l=>{const g=o.map(S=>l(S.pose));if(!g.some(S=>S===void 0))return y.gaze(c,g,a,t)},u=o.map(l=>l.pose.headingDeg);let p;if(u.every(l=>l!==void 0)){const l=[u[0]];for(let g=1;g<u.length;g++)l.push(l[g-1]+((u[g]-u[g-1])%360+540)%360-180);p=(y.gaze(c,l,a,t)%360+360)%360}const m=this.keyframes[e],k=this.keyframes[e+1],I=(l,g)=>l.lat===g.lat&&l.lng===g.lng&&l.elevationM===g.elevationM,x=!I(m.pose,k.pose),R=x&&e>0&&I(this.keyframes[e-1].pose,m.pose),O=x&&e+2<this.keyframes.length&&I(k.pose,this.keyframes[e+2].pose);let M;if(R||O){const l=y.paced((t-m.t)/(k.t-m.t),(k.t-m.t)/1e3,R,O),g=(S,C)=>S===void 0||C===void 0?void 0:S+(C-S)*l;M={lat:g(m.pose.lat,k.pose.lat),lng:g(m.pose.lng,k.pose.lng),elevationM:g(m.pose.elevationM,k.pose.elevationM)}}return{...s,lat:M?M.lat:d(l=>l.lat,!1)??s.lat,lng:M?M.lng:d(l=>l.lng,!1)??s.lng,elevationM:M?M.elevationM:d(l=>l.elevationM,!1)??s.elevationM,headingDeg:p??s.headingDeg,pitchDeg:h(l=>l.pitchDeg)??s.pitchDeg,rollDeg:d(l=>l.rollDeg??0,!0)??s.rollDeg,fovDeg:d(l=>l.fovDeg,!0)??s.fovDeg}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new U;for(const s of e.keyframes)t.addKeyframe(s.t,s.pose,s.viewOnly);return t}}class A{static MAX_CHANGE_PER_S=.05;points;followed;constructor(e){let t="none",s=0;this.points=e.map(({t:n,weather:i})=>(i.precipitationType!=="none"&&(t=i.precipitationType,s=i.precipitationIntensity),{t:n,lastFalling:t,lastFallingIntensity:s,intensity:i.precipitationType==="none"?0:i.precipitationIntensity,type:i.precipitationType})),this.followed=[];for(let n=0;n<this.points.length;n++){if(n===0){this.followed.push(this.points[0].intensity);continue}const i=this.points[n-1],o=this.points[n];this.followed.push(A.follow(this.followed[n-1],i.intensity,o.intensity,(o.t-i.t)/1e3,(o.t-i.t)/1e3))}}at(e){if(this.points.length===0||e<this.points[0].t)return;let t=this.points.length-1;for(;t>0&&this.points[t].t>e;)t--;const s=this.points[t],n=this.points[t+1],i=n?A.follow(this.followed[t],s.intensity,n.intensity,(n.t-s.t)/1e3,(e-s.t)/1e3):A.follow(this.followed[t],s.intensity,s.intensity,1,(e-s.t)/1e3);return{type:A.typeBetween(s,n,e,i),intensity:i,character:A.characterBetween(s,n,e)}}static characterBetween(e,t,s){return e.type==="none"?t&&t.type!=="none"?t.intensity:e.lastFallingIntensity:!t||t.type==="none"?e.intensity:e.intensity+(t.intensity-e.intensity)*(s-e.t)/(t.t-e.t||1)}static typeBetween(e,t,s,n){return e.type==="none"?t&&t.type!=="none"&&s>e.t?t.type:n>0?e.lastFalling:"none":t&&t.type==="none"&&n<=0?"none":e.type}static follow(e,t,s,n,i){const o=A.MAX_CHANGE_PER_S,a=n>0?(s-t)/n:0,c=u=>t+a*Math.min(Math.max(u,0),n);let d=e,h=0;for(let u=0;u<8&&h<i;u++){const p=c(h)-d;if(Math.abs(p)<1e-9){const M=h<n?a:0;if(Math.abs(M)<=o){const g=h<n?Math.min(i,n):i;d=c(g),h=g;continue}const l=Math.min(i,n);d+=Math.sign(M)*o*(l-h),h=l;continue}const m=Math.sign(p),k=h<n?a:0,I=o-m*k,x=I>0?h+Math.abs(p)/I:1/0,R=h<n?n:1/0,O=Math.min(i,x,R);d+=m*o*(O-h),h=O,O===x&&(d=c(h))}return Math.min(1,Math.max(0,d))}}const fe=1e3,Re=.65,Pe=.05,$={cloudCover:0,cloudDarkness:0,precipitationType:"none",precipitationIntensity:0,windDirectionDeg:0,windSpeed:0,storm:!1};function H(r){if(r.cloudLayers!==void 0)return r.cloudLayers;const e=[],t=r.lowerCloudCover??r.cloudCover;return t>0&&e.push({id:"lower",type:"cumulus",baseM:r.cloudBaseM??fe,thicknessM:650,coverage:t,sizeM:1400,density:1,darkness:r.cloudDarkness}),(r.highCloudCover??0)>0&&e.push({id:"cirrus",type:"cirrus",baseM:8e3,thicknessM:400,coverage:r.highCloudCover,sizeM:2200,density:.35,darkness:r.cloudDarkness,iceCrystalAlignment:r.iceCrystalAlignment}),e}function f(r,e,t){return r+(e-r)*t}function _(r,e,t){const s=((e-r)%360+540)%360-180;return((r+s*t)%360+360)%360}function me(r,e,t){return Math.max(e,Math.min(t,r))}function pe(r=[],e=[],t){if(!(!r.length&&!e.length))return[...new Set([...r.map(s=>s.id),...e.map(s=>s.id)])].map(s=>{const n=r.find(c=>c.id===s),i=e.find(c=>c.id===s),o=n??{...i,density:0},a=i??{...n,density:0};return{...o,eastM:f(o.eastM,a.eastM,t),northM:f(o.northM,a.northM,t),baseM:f(o.baseM,a.baseM,t),thicknessM:f(o.thicknessM,a.thicknessM,t),widthM:f(o.widthM,a.widthM,t),depthM:f(o.depthM,a.depthM,t),rotationDeg:_(o.rotationDeg,a.rotationDeg,t),density:f(o.density,a.density,t),darkness:f(o.darkness??0,a.darkness??0,t)}})}function ge(r,e,t){if(r.cloudLayers===void 0&&e.cloudLayers===void 0)return;const s=H(r),n=H(e);return t>=1?n.map(o=>({...o})):[...new Set([...s.map(o=>o.id),...n.map(o=>o.id)])].map(o=>{const a=s.find(u=>u.id===o),c=n.find(u=>u.id===o),d=a??{...c,coverage:0},h=c??{...a,coverage:0};return{...d,instances:pe(a?.instances,c?.instances,t),baseM:f(d.baseM,h.baseM,t),thicknessM:f(d.thicknessM,h.thicknessM,t),coverage:f(d.coverage,h.coverage,t),sizeM:f(d.sizeM,h.sizeM,t),density:f(d.density,h.density,t),darkness:f(d.darkness??r.cloudDarkness,h.darkness??e.cloudDarkness,t),iceCrystalAlignment:d.iceCrystalAlignment===void 0||h.iceCrystalAlignment===void 0?void 0:f(d.iceCrystalAlignment,h.iceCrystalAlignment,t),windSpeed:d.windSpeed===void 0&&h.windSpeed===void 0?void 0:f(d.windSpeed??r.windSpeed,h.windSpeed??e.windSpeed,t),windDirectionDeg:d.windDirectionDeg===void 0&&h.windDirectionDeg===void 0?void 0:_(d.windDirectionDeg??r.windDirectionDeg,h.windDirectionDeg??e.windDirectionDeg,t)}})}function ye(r,e,t){return{cloudLayers:ge(r,e,t),cloudCover:f(r.cloudCover,e.cloudCover,t),cloudDarkness:f(r.cloudDarkness,e.cloudDarkness,t),highCloudCover:r.highCloudCover===void 0||e.highCloudCover===void 0?void 0:f(r.highCloudCover,e.highCloudCover,t),iceCrystalAlignment:r.iceCrystalAlignment===void 0||e.iceCrystalAlignment===void 0?void 0:f(r.iceCrystalAlignment,e.iceCrystalAlignment,t),rareIceCrystals:r.rareIceCrystals===void 0||e.rareIceCrystals===void 0?void 0:f(r.rareIceCrystals,e.rareIceCrystals,t),lowerCloudCover:r.lowerCloudCover===void 0||e.lowerCloudCover===void 0?void 0:f(r.lowerCloudCover,e.lowerCloudCover,t),cloudBaseM:r.cloudBaseM===void 0||e.cloudBaseM===void 0?void 0:f(r.cloudBaseM,e.cloudBaseM,t),relativeHumidity:r.relativeHumidity===void 0||e.relativeHumidity===void 0?void 0:f(r.relativeHumidity,e.relativeHumidity,t),visibilityKm:r.visibilityKm===void 0||e.visibilityKm===void 0?void 0:f(r.visibilityKm,e.visibilityKm,t),precipitationType:t<1?r.precipitationType:e.precipitationType,precipitationIntensity:f(r.precipitationIntensity,e.precipitationIntensity,t),windDirectionDeg:_(r.windDirectionDeg,e.windDirectionDeg,t),windSpeed:f(r.windSpeed,e.windSpeed,t),storm:t<1?r.storm:e.storm}}class K{keyframes=[];ramp;addKeyframe(e,t){this.ramp=void 0;const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,weather:t}:this.keyframes.splice(s,0,{t:e,weather:t})}clear(){this.ramp=void 0,this.keyframes.length=0}removeKeyframeAt(e){this.ramp=void 0;const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}getLatestWeatherAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].weather:void 0}getInterpolatedWeatherAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.weather;const n=this.keyframes[t]?.t===e?void 0:this.keyframes[t];return s?n?ye(s.weather,n.weather,me((e-s.t)/(n.t-s.t),0,1)):s.weather:n?.weather}getActualWeatherAt(e){const t=this.getInterpolatedWeatherAt(e);if(!t)return;const s=(this.ramp??=new A(this.keyframes)).at(e);if(!s)return t;const{type:n,intensity:i,character:o}=s,a=o>0?Math.min(1,i/o):n==="none"?0:1;return{...t,precipitationType:n,precipitationIntensity:o,precipitationAmount:a}}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new K;for(const s of e.keyframes)t.addKeyframe(s.t,{...$,...s.weather});return t}}class z{keyframes=[];addKeyframe(e,t){const s=this.findInsertIndex(e);this.keyframes[s]?.t===e?this.keyframes[s]={t:e,sound:t}:this.keyframes.splice(s,0,{t:e,sound:t})}clear(){this.keyframes.length=0}removeKeyframeAt(e){const t=this.findInsertIndex(e);this.keyframes[t]?.t===e&&this.keyframes.splice(t,1)}getLatestSoundAt(e){let t=this.findInsertIndex(e);return this.keyframes[t]?.t!==e&&(t-=1),t>=0?this.keyframes[t].sound:void 0}getInterpolatedSoundAt(e){const t=this.findInsertIndex(e),s=this.keyframes[t]?.t===e?this.keyframes[t]:this.keyframes[t-1];if(s?.t===e)return s.sound;const n=this.keyframes[t]?.t===e?void 0:this.keyframes[t];if(!s)return n?.sound;if(!n)return s.sound;const i=(e-s.t)/(n.t-s.t);return this.lerp(s.sound,n.sound,Math.max(0,Math.min(1,i)))}get duration(){return this.keyframes.length===0?0:this.keyframes[this.keyframes.length-1].t}get allKeyframes(){return this.keyframes}toJSON(){return{keyframes:this.keyframes}}static fromJSON(e){const t=new z;for(const s of e.keyframes)t.addKeyframe(s.t,s.sound);return t}lerp(e,t,s){return{kind:s<1?e.kind:t.kind,volume:e.volume+(t.volume-e.volume)*s,pitchHz:e.pitchHz+(t.pitchHz-e.pitchHz)*s,src:s<1?e.src:t.src}}findInsertIndex(e){let t=0,s=this.keyframes.length;for(;t<s;){const n=t+s>>>1;this.keyframes[n].t<e?t=n+1:s=n}return t}}const Fe=["none","hum","whistle","rumble","crackle"],ve=100,ke={kind:"none",volume:0,pitchHz:ve};class N{static MAX_SPECKS=4;static BROADCAST_35MM={framesPerSecond:24,contrast:1.6,tint:[.99,.98,.92],softness:1.6/480,specksPerFrame:1.15,speckRadius:1.6/480,speckRadiusMax:4.5/480,weave:[.25/640,.6/480],grain:.008};static hash(e,t){const s=Math.sin(e*127.1+t*311.7)*43758.5453;return s-Math.floor(s)}static frameAt(e,t){return Math.floor(t*e.framesPerSecond/1e3)}static frame(e,t){const s=a=>N.hash(t,a),n=a=>(s(a)+s(a+1)+s(a+2)-1.5)*2,i=Math.min(1,e.specksPerFrame/N.MAX_SPECKS),o=[];for(let a=0;a<N.MAX_SPECKS;a++){const c=10+a*6;if(s(c)>=i)continue;const d=s(c+3)**3;o.push({u:s(c+1),v:s(c+2),radius:e.speckRadius*.6+d*(e.speckRadiusMax-e.speckRadius*.6),kept:.25+.4*s(c+4)})}return{weave:[n(1)*e.weave[0],n(4)*e.weave[1]],specks:o,seed:s(7)}}}const P=[{id:"eye",category:"eye",name:"Naked eye",projection:"equidistant",stabilization:.97},{id:"rectilinear-lens",category:"camera",name:"Camera, unknown device",projection:"rectilinear",fNumber:8,fNumberRange:{min:2,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:8},apertureBlades:6},{id:"roamer-1-120",filmFormat:"120",category:"camera",name:"Roamer 1, 120 film",projection:"rectilinear",frame:{widthMm:74,heightMm:60,focalLengthMm:100},fNumber:11,exposureSeconds:1/50,years:{from:1930,to:1965},detailUm:40,medium:{kind:"negative",iso:125}},{id:"instamatic-126",filmFormat:"126",category:"camera",name:"Instamatic, 126 film",projection:"rectilinear",frame:{widthMm:28,heightMm:28,focalLengthMm:43},fNumber:11,exposureSeconds:1/90,years:{from:1963,to:1988},apertureBlades:5,detailUm:20,medium:{kind:"negative",iso:64}},{id:"slr-35mm-50",filmFormat:"135",category:"camera",name:"35 mm SLR, 50 mm lens",projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:50},fNumber:8,fNumberRange:{min:2,max:16},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},years:{from:1959},apertureBlades:6,detailUm:20,medium:{kind:"negative",iso:100}},{id:"cine-35mm-broadcast",filmFormat:"35mm-cine",category:"camera",name:"35 mm film camera, seen on television",projection:"rectilinear",frame:{widthMm:21.3,heightMm:16,focalLengthMm:50,focalRangeMm:{minMm:18,maxMm:300}},fNumber:11,fNumberRange:{min:2,max:22},exposureSeconds:1/48,exposureRangeSeconds:{min:1/96,max:1/24},years:{from:1950,to:1995},apertureBlades:6,detailUm:15,medium:{kind:"negative",iso:100,print:N.BROADCAST_35MM}},{id:"slr-35mm-zoom",filmFormat:"135",category:"camera",name:"35 mm SLR, 70-210 mm zoom",projection:"rectilinear",frame:{widthMm:36,heightMm:24,focalLengthMm:135,focalRangeMm:{minMm:70,maxMm:210}},fNumber:8,fNumberRange:{min:4,max:22},exposureSeconds:1/250,exposureRangeSeconds:{min:1/1e3,max:3600},apertureBlades:8,years:{from:1975},detailUm:20,medium:{kind:"negative",iso:100}},{id:"phone-landscape",category:"phone",name:"Phone, held sideways",projection:"rectilinear",frame:{widthMm:7.6,heightMm:5.7,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:3200,metering:"highlights",development:"computational"}},{id:"phone-portrait",category:"phone",name:"Phone, held upright",projection:"rectilinear",frame:{widthMm:5.7,heightMm:7.6,focalLengthMm:5.7},fNumber:1.8,exposureSeconds:1/120,exposureRangeSeconds:{min:1/8e3,max:10},years:{from:2007},apertureBlades:void 0,detailUm:1.4,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:3200,metering:"highlights",development:"computational"}},{id:"dashcam",mounted:!0,category:"video",name:"Dashcam",projection:"equidistant",frame:{widthMm:5.76,heightMm:3.24,focalLengthMm:3.2},fNumber:2,exposureSeconds:1/30,exposureRangeSeconds:{min:1/1e4,max:1/30},years:{from:2008},apertureBlades:void 0,detailUm:3,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:1600,metering:"average",exposureFollowMs:500}},{id:"cctv",mounted:!0,category:"video",name:"Security camera",projection:"rectilinear",frame:{widthMm:4.8,heightMm:3.6,focalLengthMm:3.6},fNumber:2,exposureSeconds:1/50,exposureRangeSeconds:{min:1/1e5,max:1/50},years:{from:1990},apertureBlades:void 0,detailUm:6,medium:{kind:"sensor",iso:100,autoExposure:!0,maxIso:1600,metering:"average",exposureFollowMs:500}},...Y.instruments(),...q.instruments()];class D{static get default(){return P[0]}static byId(e){return P.find(t=>t.id===e)??this.default}static UNAIDED_FIELD_DEG=60;static UNAIDED_ASPECT=16/9;static fieldOfViewDeg(e){const t=e.frame;return t?D.fieldOf(e.projection,t.heightMm,t.focalLengthMm):e.visualAid?.trueFieldDeg??D.UNAIDED_FIELD_DEG}static fieldOf(e,t,s){return(e==="equidistant"?t/s:2*Math.atan(t/(2*s)))*180/Math.PI}static aspectOf(e){const t=e.frame;return t?t.widthMm/t.heightMm:D.UNAIDED_ASPECT}static frameWidthPx(e,t){return Math.round(t*D.aspectOf(e))}static CATEGORIES=["eye","camera","dslr","phone","video","binoculars","telescope"];static unavailability(e,t){const s=e.years;if(!(t===void 0||!s)){if(t<s.from)return{kind:"before",from:s.from};if(s.to!==void 0&&t>s.to)return{kind:"after",to:s.to}}}static availableAt(e){return e===void 0?P:P.filter(t=>!t.years||e>=t.years.from&&(t.years.to===void 0||e<=t.years.to))}static fieldOfViewDegAt(e,t){const s=e.frame;if(!(!s||t<=0))return D.fieldOf(e.projection,s.heightMm,t)}static focalLengthMmFor(e,t){const s=e.frame;if(!(!s||t<=0||t>=180))return e.projection==="equidistant"?s.heightMm/(t*Math.PI/180):s.heightMm/(2*Math.tan(t*Math.PI/360))}static bladesShowing(e,t){if(e.apertureBlades===void 0)return 0;const s=t??e.fNumber,n=e.fNumberRange?.min;if(s===void 0||n===void 0)return 1;const i=Math.max(0,Math.min(1,(s/n-1)/.3));return i*i*(3-2*i)}static starPointsOf(e,t){const s=e.apertureBlades;return s===void 0||s<3||D.bladesShowing(e,t)<.5?0:s%2===0?s:s*2}}const V=["spring","summer","autumn","winter"],F=21,Me=32,Se=/^(?<hour>[01]?\d|2[0-3]):(?<minute>[0-5]\d)(?::(?<second>[0-5]\d))?[?~%]?$/;let De;function Ie(){return De??=new ee}function T(r){return typeof r?.value=="number"?r.value:void 0}function Be(r){const e=r.trim();if(/^\d{1,2}:/.test(e)){const o=Se.exec(e)?.groups;return o?{year:void 0,month:void 0,day:void 0,hour:Number(o.hour),minute:Number(o.minute),second:o.second?Number(o.second):void 0,raw:e}:void 0}let t;try{t=Q.fromString(e,Ie())}catch{return}const s=T(t.year),n=T(t.month),i=n!==void 0&&n>=F&&n<=Me;if(!(t.timeshift||s!==void 0&&Math.abs(s)>9999)&&!(n!==void 0&&n>12&&!i)&&!(i&&(t.day||t.hour)))return{year:s,month:i?void 0:n,...i?{season:V[(n-F)%4]}:{},day:T(t.day),hour:T(t.hour),minute:T(t.minute),second:T(t.second),raw:e}}function Ue(r){if(r.raw!==void 0)return r.raw;if(r.year===void 0){if(r.hour===void 0)return"";let t=`${String(r.hour).padStart(2,"0")}:${String(r.minute??0).padStart(2,"0")}`;return r.second!==void 0&&(t+=`:${String(r.second).padStart(2,"0")}`),t}let e=String(r.year).padStart(4,"0");return r.season!==void 0?`${e}-${F+V.indexOf(r.season)}`:(r.month===void 0||(e+=`-${String(r.month).padStart(2,"0")}`,r.day===void 0)||(e+=`-${String(r.day).padStart(2,"0")}`,r.hour===void 0)||(e+=`T${String(r.hour).padStart(2,"0")}:${String(r.minute??0).padStart(2,"0")}`,r.second!==void 0&&(e+=`:${String(r.second).padStart(2,"0")}`)),e)}function W(r){if(r.year!==void 0)return Date.UTC(r.year,(r.month??1)-1,r.day??1,r.hour??0,r.minute??0,r.second??0)}function J(r){return(((r.day??0)*24+(r.hour??0))*60+(r.minute??0))*6e4+(r.second??0)*1e3}const we=["year","month","day","hour","minute"],Ae=["day","hour","minute"];function j(r,e){return e.filter(t=>r[t]!==void 0).join(",")}function xe(r){if(r.durationSeconds!==void 0)return r.durationSeconds*1e3;const e=r.durationText===void 0?void 0:E.parse(r.durationText);if(e)return e.chosenSeconds*1e3;if(!r.time||!r.endTime)return;const t=r.time.year!==void 0&&r.endTime.year!==void 0,s=t?we:Ae,n=j(r.time,s);if(!(n===""||n!==j(r.endTime,s)))return t?W(r.endTime)-W(r.time):J(r.endTime)-J(r.time)}function $e(r){if(r.durationSeconds===void 0&&!(!r.time||!r.endTime))return xe(r)===void 0?"imprecise":void 0}class X{constructor(e,t,s,n,i,o,a,c,d=[],h,u,p,m=[],k=[],I=[],x=[]){this.event=e,this.timeline=t,this.observerTrack=s,this.weatherTrack=n,this.soundTrack=i,this.observer=o,this.id=a,this.weather=c,this.decor=d,this.weatherSource=h,this.instrumentId=u,this.exposureSeconds=p,this.milestones=m,this.references=k,this.roads=I,this.traces=x}provenance=Z.empty();loadIssues=[];account;sources;interpretation;variants=[];skyEvents;skySources;snapshots;modules;sway;lightPollution;around;observerMap;iso;film;metering;lens;lighting;vehicle;events;eventsExpansion;sampleMs;get observerCount(){return 1+this.decor.filter(e=>e.kind==="observer").length}get exposure(){return this.exposureSeconds??this.instrument.exposureSeconds}get instrument(){return D.byId(this.instrumentId)}static create(e,t,s){return new X({eventType:"sighting",time:e,place:t},new B,new U,new K,new z,s)}}const be=0,Oe=0;function _e(r,e){const t=r.observerTrack.getInterpolatedPoseAt(e);if(t)return t;const s=r.event.place?.[0];if(s)return{lat:s.lat,lng:s.lng,elevationM:be,headingDeg:void 0,pitchDeg:Oe,fovDeg:D.fieldOfViewDeg(r.instrument)}}function Ke(r,e){return r.weatherTrack.getInterpolatedWeatherAt(e)??r.weather??$}function ze(r,e){return r.weatherTrack.getActualWeatherAt(e)??r.weather??$}function Ge(r,e){return r.soundTrack.getInterpolatedSoundAt(e)??ke}export{L as A,E as D,N as F,y as H,D as I,w as K,U as O,Fe as S,B as T,K as W,Re as a,Ke as b,_e as c,ne as d,se as e,Ge as f,$e as g,Pe as h,Ne as i,P as j,Ue as k,X as l,Le as m,z as n,W as o,Be as p,$ as q,H as r,xe as s,fe as t,ze as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as G,E as q,H as N,s as W,U as K,a as Z,b as J,c as Q,S as y,C as m,F as U,O as $,P as X}from"./rr0-ufoathome.mjs";import{a as _,O as E,M as S,b as Y,P as ee,R as D,C as te,c as se,d as ie,B as ne,e as P,f as oe,g as ae,h as re,i as he,s as le,j as
|
|
1
|
+
import{R as G,E as q,H as N,s as W,U as K,a as Z,b as J,c as Q,S as y,C as m,F as U,O as $,P as X}from"./rr0-ufoathome.mjs";import{a as _,O as E,M as S,b as Y,P as ee,R as D,C as te,c as se,d as ie,B as ne,e as P,f as oe,g as ae,h as re,i as he,s as le,j as ce,r as V,S as z,A as de}from"./ShareDialogElement-DHlxoHWP.js";import{S as M}from"./SaidPosition-CXZLm-ck.js";import{D as pe,p as j}from"./Sighting-Ch4eiBNK.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./Obstacles-v9SkfBD7.js";import"./VisualAids-DI-hEL46.js";const ue=`
|
|
2
2
|
<div class="toolbar" id="toolbar" hidden>
|
|
3
3
|
<!-- The case this account belongs to, when it was read from one: an observation of a case is shown in its frame, not as a lone
|
|
4
4
|
recording (the info panel also lists it, but behind a button nobody opens to find out where they are). -->
|
|
@@ -688,6 +688,6 @@ ${_.CSS}
|
|
|
688
688
|
margin: 0.4em 0 0;
|
|
689
689
|
padding-left: 1.2em;
|
|
690
690
|
}
|
|
691
|
-
`;class u{static PLAIN=/^\d+(?:[.,]\d+)?$/;static COLONS=/^(?:(\d+):)?(\d{1,2}):(\d{1,2}(?:[.,]\d+)?)$/;static UNITS=/^(?:(\d+(?:[.,]\d+)?)h)?(?:(\d+(?:[.,]\d+)?)m)?(?:(\d+(?:[.,]\d+)?)s)?$/i;static CLOCK=/^(?:(\d{4})-(\d{2})-(\d{2})[T ])?T?(\d{1,2}):(\d{2})(?::(\d{2}(?:[.,]\d+)?))?$/;static num(e){return e===void 0?0:Number(e.replace(",","."))}static delta(e){const t=(e??"").trim();if(t==="")return;if(u.PLAIN.test(t))return u.num(t);const i=u.COLONS.exec(t);if(i){const[,n,o,a]=i;return Number(o)>=60||u.num(a)>=60?void 0:u.num(n)*3600+Number(o)*60+u.num(a)}const s=u.UNITS.exec(t);return s&&(s[1]!==void 0||s[2]!==void 0||s[3]!==void 0)?u.num(s[1])*3600+u.num(s[2])*60+u.num(s[3]):/^P/i.test(t)?pe.seconds(t.toUpperCase()):void 0}static isClock(e){return u.clock(e)!==void 0}static clock(e){const t=u.CLOCK.exec((e??"").trim());if(!t)return;const[,i,s,n,o,a,r]=t,h={hour:Number(o),minute:Number(a),second:u.num(r)};if(!(h.hour>=24||h.minute>=60||h.second>=60)){if(i!==void 0){const c={year:Number(i),month:Number(s),day:Number(n)};if(c.month<1||c.month>12||c.day<1||c.day>31)return;h.date=c}return h}}static elapsedSince(e,t){if(!e||e.hour===void 0||e.minute===void 0)return;const i=e.hour*3600+e.minute*60+(e.second??0),s=t.hour*3600+t.minute*60+t.second;if(t.date){if(e.year===void 0||e.month===void 0||e.day===void 0)return;const o=Date.UTC(t.date.year,t.date.month-1,t.date.day)/1e3+s,a=Date.UTC(e.year,e.month-1,e.day)/1e3+i;return Math.max(0,o-a)}let n=s-i;return n<=-43200&&(n+=86400),Math.max(0,n)}}V();z.register();const T=ce.home(),k="compare-account",I="start-time",H="start-clock",w="observer",A="case-named",L="show-info",B="interpretation",x="hide-pickers",C="case",g="account",O="variant-",R=`${T}/edit/`;class v extends HTMLElement{static get observedAttributes(){return["src","show-labels",L,x,B,A,I,H,w,E,S,k]}shadow;sceneElement;toolbarElement;accountElement;accountPrefix;caseOfElement;observerText;observerSelect;infoButton;infoPanel;infoAppLink;editLink;readingFindingsElement;readingSensible=!1;readingCheck;bestCases;readingScene=!1;readingEntry;static VERDICT_COLOURS={incompatible:"#e04848",unsettled:"#e08a2c",compatible:"#2e9d5b"};infoObservationHeading;infoObservationList;infoCreditsToggle;infoCreditsList;infoCloseButton;shareButton;shareMessages;shareDialog;shareStartOn;shareStart;shareScopeRow;shareScopeLabel;shareScope;shareOpensRow;shareOpensLabel;shareOpens;shareStartLabel;shareOptions;labelsToggle;paramSummary;summaryBuilder;summarySignature="";assessmentEntries=[];assessmentToken=0;supportsPopover=typeof HTMLElement.prototype.showPopover=="function";entries=[];caseSource;interpretationChoice;interpretationLabel;interpretationSelect;confrontationElement;confrontationHeading;confrontationList;compareButton;variantChips;variantMoved;interpretationLoaders=new Map;interpretationToken=0;shownInterpretation;offeredFor;currentSrc;infoOpen=!1;creditsOpen=!1;labelsShown=!1;language="en";messages;ready=Promise.resolve();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${me}</style>${ue}`,this.shadow.appendChild(e.content.cloneNode(!0)),customElements.upgrade(this.shadow),this.sceneElement=document.createElement(Y),this.forwardPlayerAttributes(),this.sceneElement.ufoElement.creditShownExternally=!0,this.sceneElement.ownCredits=!1,this.shadow.getElementById("ufo-slot").replaceWith(this.sceneElement),this.toolbarElement=this.shadow.getElementById("toolbar"),this.accountElement=this.shadow.getElementById("account"),this.accountPrefix=this.shadow.getElementById("account-prefix"),this.caseOfElement=this.shadow.getElementById("case-of"),this.observerText=this.shadow.getElementById("observer-text"),this.observerSelect=this.shadow.getElementById("observer"),this.infoButton=this.shadow.getElementById("info-button"),this.infoPanel=this.shadow.getElementById("info-panel"),this.infoAppLink=this.shadow.getElementById("info-app-link"),this.editLink=this.shadow.getElementById("edit-link"),this.infoObservationHeading=this.shadow.getElementById("info-observation-heading"),this.infoObservationList=this.shadow.getElementById("info-observation-list"),this.infoCreditsToggle=this.shadow.getElementById("info-credits-toggle"),this.infoCreditsList=this.shadow.getElementById("info-credits-list"),this.infoCloseButton=this.shadow.getElementById("info-close"),this.labelsToggle=this.shadow.getElementById("labels-button"),this.paramSummary=this.shadow.getElementById("param-summary"),this.labelsToggle.addEventListener("click",()=>{this.showLabels=!this.showLabels}),this.shareButton=document.createElement("button"),this.shareButton.type="button",this.shareButton.id="share-button",this.shareButton.setAttribute("aria-haspopup","dialog"),this.shareButton.innerHTML=ee.SHARE,this.sceneElement.ufoElement.addControl(this.shareButton),this.shareDialog=this.shadow.getElementById("share-dialog"),this.shareDialog.subject=this.shareSubject,this.shareStartOn=this.shadow.getElementById("share-start-on"),this.shareStart=this.shadow.getElementById("share-start"),this.shareStartLabel=this.shadow.getElementById("share-start-label"),this.shareScopeRow=this.shadow.getElementById("share-scope-row"),this.shareScopeLabel=this.shadow.getElementById("share-scope-label"),this.shareScope=this.shadow.getElementById("share-scope"),this.shareOpensRow=this.shadow.getElementById("share-opens-row"),this.shareOpensLabel=this.shadow.getElementById("share-opens-label"),this.shareOpens=this.shadow.getElementById("share-opens");const t=s=>({input:this.shadow.getElementById(`share-opt-${s}`),label:this.shadow.getElementById(`share-opt-${s}-label`)});this.shareOptions={labels:t("labels"),map:t("map"),milestones:t("milestones"),compare:t("compare")},this.interpretationChoice=this.shadow.getElementById("interpretation-choice"),this.interpretationLabel=this.shadow.getElementById("interpretation-label"),this.interpretationSelect=this.shadow.getElementById("interpretation"),this.confrontationElement=this.shadow.getElementById("confrontation"),this.confrontationHeading=this.shadow.getElementById("confrontation-heading"),this.confrontationList=this.shadow.getElementById("confrontation-list"),D.register(),this.readingFindingsElement=this.shadow.getElementById("reading-findings");const i=this.shadow.getElementById("reading-chip");i.addEventListener("click",()=>{const s=i.getAttribute("aria-expanded")!=="true";i.setAttribute("aria-expanded",String(s)),this.shadow.getElementById("reading-findings-list").hidden=!s}),this.compareButton=this.shadow.getElementById("compare-account"),this.variantChips=this.shadow.getElementById("variant-chips"),this.variantMoved=this.shadow.getElementById("variant-moved"),this.compareButton.addEventListener("click",()=>this.setComparing(!this.sceneElement.compareAccount)),this.observerSelect.addEventListener("change",()=>this.selectObserver(this.observerSelect.value)),this.interpretationSelect.addEventListener("change",()=>void this.chooseInterpretation(this.interpretationSelect.value)),this.sceneElement.addEventListener(te,s=>this.showConfrontation(s.detail)),this.sceneElement.ufoElement.addEventListener("timeupdate",()=>this.refreshParamSummary()),this.supportsPopover?(this.infoPanel.setAttribute("popover","auto"),this.infoPanel.removeAttribute("hidden"),this.infoButton.setAttribute("popovertarget","info-panel"),this.infoPanel.addEventListener("beforetoggle",s=>{s.newState==="open"&&(this.populateInfoPanel(),this.bringInfoButtonIntoView())}),this.infoPanel.addEventListener("toggle",s=>this.syncInfoOpen(s.newState==="open"))):this.infoButton.addEventListener("click",()=>this.toggleInfoPanel()),this.infoCloseButton.addEventListener("click",()=>this.toggleInfoPanel()),this.infoCreditsToggle.addEventListener("click",()=>this.toggleCredits()),this.shareButton.addEventListener("click",()=>this.openShare()),this.editLink.addEventListener("click",s=>{const n=this.editDetail();n&&G.ask(this,q,n)&&s.preventDefault()});for(const s of[this.shareStartOn,this.shareStart,...Object.values(this.shareOptions).map(n=>n.input)])s.addEventListener("input",()=>this.refreshShareLinks());for(const s of[this.shareScope,this.shareOpens])s.addEventListener("change",()=>this.refreshShareLinks());this.isConnected&&(this.ready=this.loadLocaleMessages())}get scene(){return this.sceneElement}async loadLocaleMessages(){const e=++this.localeToken,t=N.preferencesFor(this);this.preferences=t;const i=W(t,K),[s,n,o,a]=await Promise.all([Z.load(i),J(i),Q(i),se.load(i)]);if(e!==this.localeToken)return;const r=i!==this.language||this.messages===void 0;this.language=i,this.messages=s,this.readingCheck=new ie(a),this.bestCases=new ne(a),this.tags=new P(n),this.said=new M(t),this.summaryBuilder=new oe(this.messages,new ae(o),this.said,this.tags,{messages:this.messages,locale:i}),this.accountPrefix.textContent=this.messages?.accountBy??"",this.interpretationLabel.textContent=this.messages?.interpretation??"",this.confrontationHeading.textContent=this.messages?.confrontation??"";const h=this.entries.find(c=>c.src===this.currentSrc);h&&this.offerInterpretations(h),this.updateCompareButton(),this.infoButton.title=this.messages?.about??"",this.infoButton.setAttribute("aria-label",this.messages?.about??""),this.editLink.title=this.messages?.editThisObservation??"",this.editLink.setAttribute("aria-label",this.messages?.editThisObservation??""),this.infoCloseButton.setAttribute("aria-label",this.messages?.close??""),this.infoObservationHeading.textContent=this.messages?.observation??"",this.infoCreditsToggle.textContent=this.messages?.credits??"",this.syncLabelsToggle(),this.refreshParamSummary(),r&&this.currentSrc&&this.runAssessments(),this.shareButton.title=this.messages?.share??"",this.shareButton.setAttribute("aria-label",this.messages?.share??""),this.shareStartLabel.textContent=this.messages?.shareStartAt??"",this.shareScopeLabel.textContent=this.messages?.shareScope??"",this.shareOpensLabel.textContent=this.messages?.shareOpensOn??"",this.shareOptions.labels.label.textContent=this.messages?.shareOptionLabels??"",this.shareOptions.map.label.textContent=this.messages?.shareOptionMap??"",this.shareOptions.milestones.label.textContent=this.messages?.shareOptionMilestones??"",this.shareOptions.compare.label.textContent=this.messages?.shareOptionCompare??"",this.shareStart.setAttribute("aria-label",this.messages?.shareStartAt??""),this.shareDialog.useLanguage(i).then(c=>{c&&(this.shareMessages=c)}),this.infoOpen&&this.populateInfoPanel(),this.updateAccountLine()}preferences=[];localeToken=0;said=new M(["en"]);tags=new P({});connectedCallback(){N.preferencesFor(this).join()!==this.preferences.join()&&(this.ready=this.loadLocaleMessages()),this.applyAskedInfo();const e=this.getAttribute("src");e&&this.loadFromSrc(e)}applyAskedInfo(){this.isConnected&&this.hasAttribute(L)!==this.infoOpen&&this.toggleInfoPanel()}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick)}attributeChangedCallback(e,t,i){if(e==="src"&&i&&i!==t&&this.isConnected&&this.loadFromSrc(i),e===B){const s=this.entries.find(n=>n.src===this.currentSrc);s&&i===null&&t!==null&&this.interpretationSelect.value!==g?(this.interpretationSelect.value=g,this.chooseInterpretation(g)):s&&this.offerInterpretations(s)}if(e===x){const s=this.entries.find(n=>n.src===this.currentSrc);this.setEntries(this.entries,this.caseSource),s&&this.offerInterpretations(s)}if(e===L&&this.applyAskedInfo(),e==="show-labels"&&this.applyLabels(this.hasAttribute("show-labels")),(e===E||e===S)&&this.forwardPlayerAttributes(),e===w&&this.entries.length>1){const s=this.entryAsked(this.entries);s&&s.src!==this.currentSrc&&this.selectObserver(s.src)}e===k&&this.setComparing(this.hasAttribute(k))}forwardPlayerAttributes(){for(const e of[E,S]){const t=this.getAttribute(e);t===null?this.sceneElement.removeAttribute(e):this.sceneElement.setAttribute(e,t)}}get loaded(){return this.loading??Promise.resolve()}loading;loadFromSrc(e){const t=this.readFromSrc(e);return this.loading=t.catch(()=>{}),t}async readFromSrc(e){this.startPending=!0;const t=y.recording(e);this.sceneElement.holdForNewScene(t);const i=await t;if(Array.isArray(i))throw new Error(`${e} is a bare list of recordings, which is no longer read: list them as the sighting events of a case.json`);if(m.isCase(i)){m.check(i);const s=m.sightingUrls(i,new URL(e,location.href).href);if(s.length===0)throw new Error(`${e} is a case with no sighting event: no recording to show`);await this.loadObserverUrls(s,{json:i,url:new URL(e,location.href).href})}else this.setEntries([{src:e,sighting:i}],void 0)}get sightingData(){return this.entries.find(e=>e.src===this.currentSrc)?.sighting}set sightingData(e){const t=U.recording(e);this.startPending=!0,this.currentSrc="",this.setEntries([{src:"",sighting:t}],void 0)}seekTo(e,t){const i=this.caseSource,s=t===void 0?void 0:this.entries.find(n=>{const o=this.plain(n).id;return(i?m.accountIds(i.json,i.url,n.src,o):[o]).includes(t)});s&&s.src!==this.currentSrc&&this.selectObserver(s.src),this.sceneElement.ufoElement.currentTime=Math.max(0,e)*1e3}set citedMoments(e){this.sceneElement.ufoElement.citedMoments=e}get playedSeconds(){return this.sceneElement.ufoElement.currentTime/1e3}get observerUrls(){return this.entries.map(e=>e.src)}set observerUrls(e){this.loadObserverUrls(e)}async loadObserverUrls(e,t){const i=await Promise.all(e.map(async s=>({src:s,sighting:await y.recording(s)})));this.setEntries(i,t)}reportCaseProblems(e,t){const{duplicateIds:i,unresolved:s}=m.problems(e,t.map(n=>this.plain(n).id).filter(n=>n!==void 0));for(const n of i)console.warn(`The case ${e.id??""} gives the id "${n}" to more than one event: a reference to it is ambiguous.`);for(const{reading:n,reference:o}of s)console.warn(`The reading ${n} of the case ${e.id??""} is "interpretationOf" "${o}", which no event of the case has as its id, nor any recording it lists.`)}setEntries(e,t){this.entries=e.map(o=>({...o,sighting:U.recording(o.sighting)})),this.caseSource=t,t&&this.reportCaseProblems(t.json,e),this.toolbarElement.hidden=e.length===0;const i=e.length>1&&!this.hasAttribute(x);this.observerSelect.hidden=!i,this.observerText.hidden=i,this.observerSelect.innerHTML="";const s=e.map((o,a)=>this.observerDisplayName(this.plain(o).observer)??this.caseTitleOf(o)??(this.messages?.unnamedObserver??"").replace("{n}",String(a+1)));for(const[o,a]of e.entries()){const r=document.createElement("option");r.value=a.src;const h=s.filter(c=>c===s[o]).length>1;r.textContent=(h?this.caseTitleOf(a):void 0)??s[o],this.observerSelect.appendChild(r)}const n=e.find(o=>o.src===this.currentSrc)??this.entryAsked(e)??e[0];n?this.selectObserver(n.src):this.updateAccountLine()}entryAsked(e){const t=this.getAttribute(w)?.trim();if(!t)return;const i=e.find(o=>this.plain(o).observer?.id===t);if(i)return i;const s=this.caseSource;if(s){const o=e.find(a=>m.accountIds(s.json,s.url,a.src,this.plain(a).id).includes(t));if(o)return o}const n=e.find(o=>o.src.split("/").pop()===t.split("/").pop());return n||(/^\d+$/.test(t)?e[Number(t)-1]:void 0)}observerKeyOf(e){return this.plain(e).observer?.id??String(this.entries.indexOf(e)+1)}sharedEntry(){const e=this.shareScope.value;if(!(!this.caseSource||e===C))return this.entries.find(t=>t.src===e)}get sharesCase(){return this.caseSource!==void 0&&!this.shareScopeRow.hidden&&this.shareScope.value===C}editorUrl(){if(!this.currentSrc)return R;const e=new URL(this.currentSrc,location.href),t=this.caseSource;return t?`${R}?file=${encodeURIComponent(t.url)}&track=${encodeURIComponent(this.shownTrackUrl()??e.href)}`:`${R}?file=${encodeURIComponent(e.href)}`}editDetail(){if(!this.currentSrc)return;const e=new URL(this.currentSrc,location.href).href,t=this.caseSource;return t?{src:t.url,track:this.shownTrackUrl()??e}:{src:e}}get editorHref(){return this.editorUrl()}get shownRecordingUrl(){return this.currentSrc?new URL(this.currentSrc,location.href).href:void 0}get shownReadingUrl(){return this.shownTrackUrl()}shownTrackUrl(){return this.readingUrlOf(this.interpretationSelect.value)}shareSubject={module:"rr0-sighting",link:()=>this.playUrl(),element:()=>this.replayElement()};replayElement(){const e=this.sharedAddress(),i=[...e.observer?[[w,e.observer]]:[],...this.replayAttributes()].map(([s,n])=>n===""?` ${s}`:` ${s}="${n}"`).join("");return`<rr0-sighting src="${e.src}"${i}></rr0-sighting>`}playUrl(){const e=this.sharedAddress(),t=[...e.observer?[`${w}=${encodeURIComponent(e.observer)}`]:[],...this.replayQuery()].join("&");return e.src?`${T}/play/?file=${encodeURIComponent(e.src)}${t&&"&"+t}`:`${T}/play/${t&&"?"+t}`}sharedAddress(){const e=t=>t?new URL(t,location.href).href:"";if(this.sharesCase){const t=this.entries.find(i=>i.src===this.shareOpens.value)??this.entries.find(i=>i.src===this.currentSrc);return{src:e(this.caseSource.url),observer:t?this.observerKeyOf(t):void 0}}return{src:e(this.sharedEntry()?.src??this.currentSrc??"")}}replayAttributes(){const e=this.shareOptions,t=[];return this.shareStartSeconds!==void 0&&t.push([I,String(this.shareStartSeconds)]),e.labels.input.checked&&t.push(["show-labels",""]),e.map.input.checked&&t.push([E,""]),e.milestones.input.checked||t.push([S,""]),e.compare.input.checked&&t.push([k,""]),t}replayQuery(){const e=this.shareOptions,t=[];return this.shareStartSeconds!==void 0&&t.push(`d=${this.shareStartSeconds}`),e.labels.input.checked||t.push("labels=0"),e.map.input.checked&&t.push("map=1"),e.milestones.input.checked||t.push("moments=0"),e.compare.input.checked&&t.push("compare=1"),t}get shareStartSeconds(){const e=Math.floor(Number(this.shareStart.value));return this.shareStartOn.checked&&Number.isFinite(e)&&e>=0?e:void 0}refreshShareLinks(){this.shareOpensRow.hidden=!this.sharesCase,this.shareDialog.refresh()}openShare(){const e=this.sceneElement.ufoElement;this.shareStart.max=String(Math.floor(e.seekableDuration/1e3)),this.shareStart.value=String(Math.floor(e.currentTime/1e3)),this.shareStartOn.checked=!1,this.shareOptions.labels.input.checked=this.labelsShown,this.shareOptions.map.input.checked=e.observerMapOpen,this.shareOptions.milestones.input.checked=e.milestonesVisible,this.shareOptions.compare.input.checked=this.sceneElement.compareAccount,this.offerShareScope(),this.shareOpensRow.hidden=!this.sharesCase;const t=[this.caseSource?.url,this.currentSrc,this.shownTrackUrl(),...this.entries.map(i=>i.src)];this.shareDialog.note=$.changed(...t)?this.shareMessages?.unsaved:void 0,this.shareDialog.open()}offerShareScope(){const e=this.caseSource!==void 0&&this.entries.length>1&&!this.hasAttribute(A);if(this.shareScopeRow.hidden=!e,this.shareScope.innerHTML="",this.shareOpens.innerHTML="",!e)return;const t=(i,s,n)=>{const o=document.createElement("option");o.value=s,o.textContent=n,i.appendChild(o)};t(this.shareScope,C,this.messages?.shareScopeCase??"");for(const i of this.entries){const s=this.observerDisplayName(this.plain(i).observer)??this.caseTitleOf(i)??(this.messages?.unnamedObserver??"").replace("{n}",String(this.entries.indexOf(i)+1));t(this.shareScope,i.src,s),t(this.shareOpens,i.src,s)}this.shareScope.value=C,this.shareOpens.value=this.currentSrc??this.entries[0].src}offerInterpretations(e){const t=this.offeredFor===e.sighting,i=this.interpretationSelect.value;this.offeredFor=e.sighting,this.interpretationToken++,this.interpretationLoaders=new Map,this.interpretationSelect.innerHTML="";const s=(d,l,p)=>{const f=document.createElement("option");f.value=d,f.textContent=l,this.interpretationSelect.appendChild(f),this.interpretationLoaders.set(d,p)},n=e===this.entries.find(d=>d.src===this.currentSrc),o=n?this.sceneElement.ufoElement.sighting.interpretation:void 0;s(g,this.messages?.account??"",()=>Promise.resolve(o));const a=this.caseSource;a&&m.interpretationEvents(a.json,m.accountIds(a.json,a.url,e.src,this.plain(e).id)).forEach((d,l)=>{const p=this.said.read(d.title)??`#${l+1}`,f=(d.by??[]).map(b=>this.agentName(b)).filter(Boolean).join(", ");s(`case-${l}`,f?(this.messages?.interpretationBy??"").replace("{title}",p).replace("{by}",f):p,()=>m.interpretationOf(d,a.url,b=>y.recording(b)))});const r=n?this.keptVariants(e):[];for(const{index:d,kept:l}of r)s(`${O}${d}`,`${this.variantLabel(l)} (${this.messages?.verdicts[l.variant.verdict]??""})`,()=>Promise.resolve(l.bodies.length>0?l:void 0));const h=t&&[...this.interpretationSelect.options].some(d=>d.value===i),c=this.askedInterpretation()??(h?i:g);this.interpretationSelect.value=c,c===g?(this.sceneElement.interpretation!==o&&(this.sceneElement.interpretation=o),this.shownInterpretation=g):(!this.sceneElement.interpretation||this.shownInterpretation!==c)&&this.chooseInterpretation(c),this.interpretationChoice.hidden=this.interpretationSelect.options.length<2||this.hasAttribute(x),this.showConfrontation(this.sceneElement.confrontation),this.updateCompareButton(),this.showVariants(r)}keptVariants(e){const t={consolidated:0,contested:1,incompatible:2};return(e.sighting.variants??[]).map((i,s)=>({index:s,kept:i})).filter(({kept:i})=>i.variant).sort((i,s)=>t[i.kept.variant.verdict]-t[s.kept.variant.verdict]||i.kept.variant.cost-s.kept.variant.cost)}variantLabel(e){return(this.messages?.variant??"").replace("{name}",e.variant.label??e.variant.candidate)}showVariants(e){if(!this.messages)return;if(this.variantChips.innerHTML="",this.variantChips.hidden=e.length===0,e.length===0){this.showVariantMoved();return}const t=(i,s,n)=>{const o=document.createElement("button");o.type="button",o.dataset.value=i,n&&(o.dataset.verdict=n,o.title=this.messages.verdicts[n],o.append(Object.assign(document.createElement("span"),{className:"dot"}))),o.append(s),o.addEventListener("click",()=>{this.interpretationSelect.value!==i&&(this.interpretationSelect.value=i,this.chooseInterpretation(i))}),this.variantChips.append(o)};t(g,this.messages?.account??"");for(const{index:i,kept:s}of e)t(`${O}${i}`,s.variant.label??s.variant.candidate,s.variant.verdict);this.showVariantMoved()}showVariantMoved(){if(!this.messages)return;const e=this.interpretationSelect.value;for(const n of this.variantChips.querySelectorAll("button"))n.setAttribute("aria-pressed",String(n.dataset.value===e));this.variantMoved.innerHTML="";const t=e.startsWith(O)?Number(e.slice(O.length)):-1,i=this.sceneElement.ufoElement.sighting.variants?.[t]?.variant;if(this.variantMoved.hidden=!i||i.moved.length+(i.readings?.length??0)===0,!i)return;const s=new Intl.NumberFormat(this.language,{maximumFractionDigits:1});for(const n of i.moved){const[o,a]=n.field==="time"?["0 min",`${n.variant>0?"+":""}${s.format(n.variant)} min`]:n.field==="duration"?[`${s.format(n.stated)} s`,`${s.format(n.variant)} s`]:[`${s.format(n.stated)}°`,`${s.format(n.variant)}°`],r=document.createElement("span");r.append(`${this.messages.variantFields[n.field]}${this.colon}`,Object.assign(document.createElement("s"),{textContent:o})," → ",Object.assign(document.createElement("b"),{textContent:a})),this.variantMoved.append(r)}for(const n of i.readings??[]){const o=this.messages.variantReadings[n.reading];o&&this.variantMoved.append(Object.assign(document.createElement("span"),{className:"reading",textContent:o}))}}setComparing(e){this.sceneElement.compareAccount=e,this.updateCompareButton(),this.showConfrontation(this.sceneElement.confrontation)}updateCompareButton(){const e=this.sceneElement.compareAccount;this.compareButton.hidden=!this.sceneElement.interpretation,this.compareButton.setAttribute("aria-pressed",String(e));const t=e?this.messages?.hideComparison??"":this.messages?.showComparison??"";this.compareButton.title=t,this.compareButton.setAttribute("aria-label",t)}get colon(){return this.language==="fr"?" : ":": "}askedInterpretation(){const e=this.getAttribute(B)?.trim(),t=this.caseSource;if(!e||!t)return;const i=this.entries.find(o=>o.src===this.currentSrc);if(!i)return;const n=m.interpretationEvents(t.json,m.accountIds(t.json,t.url,i.src,this.plain(i).id)).findIndex(o=>o.id===e||typeof o.url=="string"&&new URL(o.url,t.url).href===new URL(e,location.href).href);return n>=0?`case-${n}`:void 0}async chooseInterpretation(e){const t=++this.interpretationToken,i=this.interpretationLoaders.get(e),s=i?await i().catch(l=>{console.warn(`<rr0-sighting>: could not read interpretation "${e}":`,l)}):void 0,n=this.readingUrlOf(e),o=n?await y.recording(n).catch(()=>{}):void 0;if(t!==this.interpretationToken)return;const a=this.entries.find(l=>l.src===this.currentSrc),r=a&&o&&"timeline"in o?this.bestCases?.bestSceneOf(a.sighting,o):void 0,h=r??o,c=r?.interpretation&&s?{...s,bodies:[...s.bodies.map(l=>{const p=r.interpretation.bodies.find(f=>f.id===l.id);return p?{...l,track:p.track}:l}),...r.interpretation.bodies.filter(l=>!s.bodies.some(p=>p.id===l.id))]}:s,d=a&&h&&"timeline"in h&&v.changesTheScene(a.sighting,h)?{...h,timeline:h.timeline.keyframes?.length?h.timeline:a.sighting.timeline}:void 0;if(d&&n)this.showScene(d,n);else if(this.readingScene&&a)this.showScene(a.sighting,a.src,!0);else if(a){const l=!this.sceneElement.ufoElement.playRequested;n?this.sceneElement.showPoster(o?.image,n,l):a.sighting.image?this.sceneElement.showPoster(a.sighting.image,a.src?new URL(a.src,location.href).href:void 0,l):this.sceneElement.showPoster(this.caseSource?.json.image,this.caseSource?.url,l)}this.readingScene=d!==void 0,this.sceneElement.interpretation=c,this.shownInterpretation=e,this.showReadingFindings(a,h),this.editLink.href=this.editorUrl(),this.dispatchEvent(new CustomEvent(ge,{detail:{track:this.shownTrackUrl()}})),this.updateCompareButton(),this.showConfrontation(this.sceneElement.confrontation),this.showVariantMoved()}readingUrlOf(e){const t=this.caseSource,i=this.entries.find(o=>o.src===this.currentSrc),s=/^case-(\d+)$/.exec(e);if(!t||!i||!s)return;const n=m.interpretationEvents(t.json,m.accountIds(t.json,t.url,i.src,this.plain(i).id))[Number(s[1])];return n?.url?new URL(n.url,t.url).href:void 0}static SCENE_FIELDS=["time","utcOffsetHours","place","observerTrack","weatherTrack","decor","instrument","lens","film","exposureSeconds","iso","references","lighting","lightPollution","vehicle"];static changesTheScene(e,t){const i=s=>JSON.stringify(v.SCENE_FIELDS.map(n=>s[n]));return i(e)!==i(t)}showScene(e,t,i=!1){const s=this.sceneElement.ufoElement.currentTime;this.sceneElement.documentUrl=t?new URL(t,location.href).href:void 0;const n=!this.sceneElement.ufoElement.playRequested,o=t?new URL(t,location.href).href:void 0;e.image?this.sceneElement.showPoster(e.image,o,n):i?this.sceneElement.showPoster(this.caseSource?.json.image,this.caseSource?.url,n):this.sceneElement.showPoster(void 0,void 0,n),this.sceneElement.sightingData=e,this.sceneElement.ufoElement.currentTime=s}showReadingFindings(e,t){const i=this.readingFindingsElement,s=this.messages,n=t?.interpretation?.findings??[],o=e&&t&&this.readingCheck?this.readingCheck.findingsOf(e.sighting,t):[],a=[...n,...o],r=re.of(a);this.readingEntry=s&&r?{group:"summary",field:"reading",label:s.readingLabel,unit:"",fromSource:!1,value:(a.length===1?s.readingChipOne:s.readingChip).replace("{verdict}",s.readingVerdict[r]).replace("{n}",String(a.length)),color:v.VERDICT_COLOURS[r],full:a.map(d=>`${{holds:"✓",fails:"✗",untested:"?"}[d.outcome]} ${this.said.read(d.text)??""}`+(d.outcome==="fails"?` (${s.findingAgainst[d.against??"established"]})`:"")).join(`
|
|
692
|
-
`)}:void 0,this.summarySignature="\0",this.refreshParamSummary();const h=i.querySelector("#reading-sensitivity");if(this.readingSensible=e&&t?D.resultOf(e.sighting,t)!==void 0:!1,h.show(e?.sighting,t),this.showReadingBox(),!s||!r){i.querySelector("#reading-findings-list").hidden=!0,delete i.dataset.verdict;return}i.dataset.verdict=r,i.querySelector("#reading-verdict").textContent=(a.length===1?s.readingChipOne:s.readingChip).replace("{verdict}",s.readingVerdict[r]).replace("{n}",String(a.length));const c=i.querySelector("#reading-findings-list");i.querySelector("#reading-chip").setAttribute("aria-expanded","false"),c.hidden=!0,c.replaceChildren(...a.map(d=>{const l=document.createElement("li");l.dataset.outcome=d.outcome;const p=document.createElement("span");p.className="finding-mark",p.textContent={holds:"✓",fails:"✗",untested:"?"}[d.outcome],p.title=s.findingOutcome[d.outcome],p.setAttribute("aria-label",s.findingOutcome[d.outcome]);const f=document.createElement("span");if(f.textContent=this.said.read(d.text)??"",l.append(p,f),d.outcome==="fails"){const b=document.createElement("span");b.className="finding-against",b.textContent=`(${s.findingAgainst[d.against??"established"]})`,l.append(b)}return l}))}agentName(e){if("people"in e){const[t,...i]=e.people.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ");return[...i,t].join(" ")}return"org"in e?e.org.replace(/([a-z])([A-Z])/g,"$1 $2"):this.observerDisplayName(e)??""}showConfrontation(e){this.confrontationList.innerHTML="",this.confrontationElement.hidden=!this.sceneElement.interpretation||!this.sceneElement.compareAccount;const t=new Intl.NumberFormat(this.language,{maximumFractionDigits:1,minimumFractionDigits:1}),i=new Intl.NumberFormat(this.language,{maximumFractionDigits:2,minimumFractionDigits:2});for(const s of e){const n=document.createElement("li");n.append(`${this.said.read(s.title)??s.sourceId}${this.colon}`);const o=[];s.separationDeg!==void 0&&o.push([(this.messages?.confrontationDirection??"").replace("{deg}",t.format(s.separationDeg)),s.disagreements.includes("direction")]),s.widthRatio!==void 0&&o.push([(this.messages?.confrontationWidth??"").replace("{ratio}",i.format(s.widthRatio)),s.disagreements.includes("width")]),s.heightRatio!==void 0&&o.push([(this.messages?.confrontationHeight??"").replace("{ratio}",i.format(s.heightRatio)),s.disagreements.includes("height")]),o.forEach(([a,r],h)=>{h>0&&n.append(" · ");const c=document.createElement("span");c.textContent=a,r&&(c.className="disagrees"),n.append(c)}),this.confrontationList.appendChild(n)}}startPending=!1;startSeconds(e){const t=u.clock(this.getAttribute(H)),i=this.plain(e).time;return(t?u.elapsedSince(i===void 0?void 0:j(i),t):void 0)??u.delta(this.getAttribute(I))}selectObserver(e){const t=this.entries.find(s=>s.src===e);if(!t)return;this.currentSrc=e,this.observerSelect.value=e,this.sceneElement.documentUrl=t.src?new URL(t.src,location.href).href:void 0;const i=!this.sceneElement.ufoElement.playRequested;if(this.askedInterpretation()||(t.sighting.image?this.sceneElement.showPoster(t.sighting.image,t.src?new URL(t.src,location.href).href:void 0,i):this.sceneElement.showPoster(this.caseSource?.json.image,this.caseSource?.url,i)),this.sceneElement.holdForNewScene(),this.sceneElement.sightingData=t.sighting,this.readingScene=!1,this.startPending){this.startPending=!1;const s=this.startSeconds(t);s!==void 0&&(this.sceneElement.ufoElement.currentTime=Math.max(0,s)*1e3)}this.offerInterpretations(t),this.updateAccountLine(),this.refreshParamSummary(),this.runAssessments(),this.infoOpen&&this.populateInfoPanel(),this.dispatchEvent(new CustomEvent(fe,{detail:{src:e}}))}async runAssessments(){if(!this.messages)return;const e=++this.assessmentToken,t=await new he(this.messages).read(this.sceneElement.ufoElement.sighting);e===this.assessmentToken&&(this.assessmentEntries=t.entries,this.refreshParamSummary())}updateAccountLine(){const e=this.entries.find(a=>a.src===this.currentSrc),t=e?this.observerDisplayName(this.plain(e).observer):void 0,i=t!==void 0||this.entries.length>1;this.accountElement.hidden=!i,this.observerText.textContent=t??"";const n=!this.hasAttribute(A)&&this.caseSource&&(this.said.read(this.caseSource.json.title)??this.caseSource.json.id);this.caseOfElement.hidden=!n,this.caseOfElement.textContent=n?`${this.messages?.case??""} ${n}`:"";const o=t!==void 0?`${this.messages?.accountBy??""} ${t}`.trim():void 0;this.sceneElement.filmName=[n||void 0,o].filter(Boolean).join(" - ")||void 0,this.editLink.hidden=!this.currentSrc,this.editLink.href=this.editorUrl(),this.shareButton.hidden=$.local(this.caseSource?.url??this.currentSrc),this.editLink.title=this.messages?.editThisObservation??"",this.editLink.setAttribute("aria-label",this.messages?.editThisObservation??"")}caseTitleOf(e){const t=this.caseSource;if(!t)return;const i=t.json.events?.find(s=>s.url!==void 0&&!s.interpretationOf&&new URL(s.url,t.url).href===new URL(e.src,location.href).href);return i?this.said.read(i.title):void 0}observerDisplayName(e){if(!e)return;const t=[...e.firstNames??[],e.lastName].filter(Boolean).join(" ");return this.said.read(e.title)||t||e.id}plainRecordings=new WeakMap;plain(e){return this.stripped(e).recording}stripped(e){let t=this.plainRecordings.get(e.sighting);return t||(t=X.strip(e.sighting),this.plainRecordings.set(e.sighting,t)),t}basisOf(e,t){const i=this.stripped(e).provenance,s={established:-2,measured:-1,stated:0,derived:1,assumed:2,fitted:3},n=i.paths().filter(r=>t.some(h=>r===h||r.startsWith(`${h}.`))).map(r=>i.at(r)),o=n.reduce((r,h)=>s[h.basis]>s[r]?h.basis:r,"stated"),a=n.filter(r=>r.basis===o&&r.rationale).map(r=>this.said.read(r.rationale)??"").filter(r=>r!=="");return{basis:o,rationales:a}}formatDate(e){const t=e.place?.locations?.[0],i=le((e.time?j(e.time):void 0)??{},t?.lng??0,e.utcOffsetHours);if(!i)return;const s=i.getTime()+this.utcOffsetHoursOf(e,t?.lng??0)*36e5;if(Number.isFinite(s))return new Intl.DateTimeFormat(this.language,{dateStyle:"long",timeStyle:"short",timeZone:"UTC"}).format(new Date(s))}utcOffsetHoursOf(e,t){return e.utcOffsetHours??Math.round(t/15)}formatLocation(e){const t=e.place?.locations?.[0];if(t)return`${t.lat.toFixed(4)}, ${t.lng.toFixed(4)}`}toggleInfoPanel(){const e=!this.infoOpen;if(this.supportsPopover){const t=this.infoPanel.matches(":popover-open");e&&!t?this.infoPanel.showPopover():!e&&t&&this.infoPanel.hidePopover();return}e&&this.bringInfoButtonIntoView(),this.syncInfoOpen(e),this.infoPanel.hidden=!e,e?document.addEventListener("click",this.handleOutsideClick):document.removeEventListener("click",this.handleOutsideClick)}bringInfoButtonIntoView(){const e=this.infoButton.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;e.top>=0&&e.bottom<=t||this.infoButton.scrollIntoView({block:"center"})}syncInfoOpen(e){e!==this.infoOpen&&(this.infoOpen=e,this.infoButton.setAttribute("aria-expanded",String(e)),e?this.supportsPopover||this.populateInfoPanel():(this.creditsOpen=!1,this.infoCreditsList.hidden=!0,this.infoCreditsToggle.setAttribute("aria-expanded","false")))}handleOutsideClick=e=>{const t=e.composedPath();!t.includes(this.infoPanel)&&!t.includes(this.infoButton)&&this.toggleInfoPanel()};toggleCredits(){this.creditsOpen=!this.creditsOpen,this.infoCreditsList.hidden=!this.creditsOpen,this.infoCreditsToggle.setAttribute("aria-expanded",String(this.creditsOpen)),this.creditsOpen&&this.revealInPanel(this.infoCreditsList)}revealInPanel(e){e.scrollIntoView?.({block:"nearest"})}get showLabels(){return this.labelsShown}set showLabels(e){this.toggleAttribute("show-labels",e)}applyLabels(e){this.labelsShown=e,this.syncLabelsToggle(),this.refreshParamSummary(),this.populateInfoPanel()}syncLabelsToggle(){const e=this.labelsShown?this.messages?.hideLabels??"":this.messages?.showLabels??"";this.labelsToggle.title=e,this.labelsToggle.setAttribute("aria-label",e),this.labelsToggle.setAttribute("aria-pressed",String(this.labelsShown))}showReadingBox(){const e=this.readingFindingsElement,t=this.readingEntry!==void 0&&!this.labelsShown;e.hidden=!t&&!this.readingSensible,e.querySelector("#reading-chip").hidden=!t,t||(e.querySelector("#reading-findings-list").hidden=!0)}refreshParamSummary(){if(this.paramSummary.hidden=!this.labelsShown,this.showReadingBox(),!this.labelsShown){this.paramSummary.replaceChildren(),this.summarySignature="";return}const e=this.sceneElement.ufoElement.sighting,t=this.summaryBuilder?.entriesFor(e,this.sceneElement.ufoElement.currentTime,{roadGradeDeg:this.sceneElement.roadGradeDeg})??[],i=t.map(h=>h.group).lastIndexOf("summary"),s=this.readingEntry?[this.readingEntry]:[],n=[...t.slice(0,i+1),...s,...t.slice(i+1),...this.assessmentEntries],o=n.map(h=>`${h.field}=${h.label}=${h.value}${h.unit}${h.full??""}${h.fromSource?"*":""}`).join("|");if(o===this.summarySignature)return;this.summarySignature=o;const a=[];let r;for(const h of n){r&&r.group!==h.group&&(r=void 0);const c=h.group==="summary"?this.messages?.summaryGroup??"":h.group==="observer"?this.messages?.observerGroup??"":this.messages&&h.group in this.messages.summaryGroups?this.messages.summaryGroups[h.group]:h.group==="assessment"?this.messages?.assessmentGroup??"":void 0;if(c!==void 0&&!r){const l=document.createElement("span");l.className="param-nest";const p=document.createElement("span");p.className="param-nest-label",p.textContent=c,l.append(p),r={group:h.group,element:l},a.push(l)}const d=this.paramItem(h);r?r.element.append(d):a.push(d)}this.paramSummary.replaceChildren(...a),this.syncDescription(n)}openDescription;openDescriptionTitle;syncDescription(e){this.openDescription!==void 0&&!e.some(t=>t.full===this.openDescription)&&(this.openDescription=void 0),_.sync(this.paramSummary,this.openDescription,this.openDescriptionTitle??this.messages?.summaryDescription??"",this.messages?.closeDescription??"",()=>{this.openDescription=void 0,this.syncDescription(e)})}paramItem(e){const t=document.createElement("span");if(t.className=e.fromSource?"param-label from-source":"param-label",e.detail&&(t.title=e.detail),e.full!==void 0){t.classList.add("describable"),t.tabIndex=0,t.setAttribute("role","button");const n=()=>{this.openDescription=e.full,this.openDescriptionTitle=e.label,this.syncDescription([e])};t.addEventListener("click",n),t.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n())})}const i=document.createElement("span");if(i.className="param-label-label",i.textContent=`${e.label} `,t.append(i),e.color!==void 0){const n=document.createElement("span");n.className="param-label-swatch",n.style.background=e.color,t.append(n)}const s=document.createElement("span");return s.className="param-label-value",s.textContent=e.unit===""?e.value:`${e.value} ${e.unit}`,t.append(s),t}populateInfoPanel(){const e=this.entries.find(t=>t.src===this.currentSrc);if(this.infoObservationList.innerHTML="",e){const t=this.caseSource&&(this.caseSource.json.title??this.caseSource.json.id);if(t&&this.appendInfoRow(this.infoObservationList,this.messages?.case??"",t),!this.labelsShown){const n=this.formatDate(this.plain(e));n&&this.appendInfoRow(this.infoObservationList,this.messages?.date??"",n,this.basisOf(e,v.DATE_PATHS));const o=this.formatLocation(this.plain(e));o&&this.appendInfoRow(this.infoObservationList,this.messages?.location??"",o,this.basisOf(e,v.PLACE_PATHS))}const i=this.said.read(this.plain(e).description);i&&!this.labelsShown&&this.appendInfoRow(this.infoObservationList,this.messages?.description??"",i);for(const n of this.plain(e).sources??[])this.appendInfoSource(this.infoObservationList,this.messages?.source??"",n);const s=this.plain(e).tags;!this.labelsShown&&s&&s.length>0&&this.appendInfoRow(this.infoObservationList,this.messages?.tags??"",s.map(n=>this.tags.name(n)).join(", "))}this.infoAppLink.href=T,this.infoAppLink.textContent="UFO@home v0.197.0",de.fill(this.infoCreditsList,this.sceneElement)}appendInfoSource(e,t,i){const s=document.createElement("dt");s.textContent=t;const n=document.createElement("dd"),o=this.said.read(i.title)??i.url??"";if(i.url&&/^https?:\/\//i.test(i.url)){const r=document.createElement("a");r.href=i.url,r.target="_blank",r.rel="noopener noreferrer",r.textContent=o,n.appendChild(r)}else n.append(o);const a=[i.authors?.join(", "),i.publication?.publisher,i.publication?.time,i.index].filter(Boolean);a.length>0&&n.append(`, ${a.join(", ")}`),e.append(s,n)}static DATE_PATHS=["time","utcOffsetHours","timeZone"];static PLACE_PATHS=["place"];appendInfoRow(e,t,i,s){if(!this.messages)return;const n=document.createElement("dt");n.textContent=t;const o=document.createElement("dd");if(o.textContent=i,s){const a=document.createElement("span");a.className=`basis basis-${s.basis}`,a.textContent=this.messages.basis[s.basis],s.rationales.length>0&&(a.title=s.rationales.join(`
|
|
691
|
+
`;class u{static PLAIN=/^\d+(?:[.,]\d+)?$/;static COLONS=/^(?:(\d+):)?(\d{1,2}):(\d{1,2}(?:[.,]\d+)?)$/;static UNITS=/^(?:(\d+(?:[.,]\d+)?)h)?(?:(\d+(?:[.,]\d+)?)m)?(?:(\d+(?:[.,]\d+)?)s)?$/i;static CLOCK=/^(?:(\d{4})-(\d{2})-(\d{2})[T ])?T?(\d{1,2}):(\d{2})(?::(\d{2}(?:[.,]\d+)?))?$/;static num(e){return e===void 0?0:Number(e.replace(",","."))}static delta(e){const t=(e??"").trim();if(t==="")return;if(u.PLAIN.test(t))return u.num(t);const i=u.COLONS.exec(t);if(i){const[,n,o,a]=i;return Number(o)>=60||u.num(a)>=60?void 0:u.num(n)*3600+Number(o)*60+u.num(a)}const s=u.UNITS.exec(t);return s&&(s[1]!==void 0||s[2]!==void 0||s[3]!==void 0)?u.num(s[1])*3600+u.num(s[2])*60+u.num(s[3]):/^P/i.test(t)?pe.seconds(t.toUpperCase()):void 0}static isClock(e){return u.clock(e)!==void 0}static clock(e){const t=u.CLOCK.exec((e??"").trim());if(!t)return;const[,i,s,n,o,a,r]=t,h={hour:Number(o),minute:Number(a),second:u.num(r)};if(!(h.hour>=24||h.minute>=60||h.second>=60)){if(i!==void 0){const d={year:Number(i),month:Number(s),day:Number(n)};if(d.month<1||d.month>12||d.day<1||d.day>31)return;h.date=d}return h}}static elapsedSince(e,t){if(!e||e.hour===void 0||e.minute===void 0)return;const i=e.hour*3600+e.minute*60+(e.second??0),s=t.hour*3600+t.minute*60+t.second;if(t.date){if(e.year===void 0||e.month===void 0||e.day===void 0)return;const o=Date.UTC(t.date.year,t.date.month-1,t.date.day)/1e3+s,a=Date.UTC(e.year,e.month-1,e.day)/1e3+i;return Math.max(0,o-a)}let n=s-i;return n<=-43200&&(n+=86400),Math.max(0,n)}}V();z.register();const T=de.home(),k="compare-account",I="start-time",H="start-clock",w="observer",A="case-named",L="show-info",B="interpretation",x="hide-pickers",C="case",g="account",O="variant-",R=`${T}/edit/`;class v extends HTMLElement{static get observedAttributes(){return["src","show-labels",L,x,B,A,I,H,w,E,S,k]}shadow;sceneElement;toolbarElement;accountElement;accountPrefix;caseOfElement;observerText;observerSelect;infoButton;infoPanel;infoAppLink;editLink;readingFindingsElement;readingSensible=!1;readingCheck;bestCases;readingScene=!1;readingEntry;static VERDICT_COLOURS={incompatible:"#e04848",unsettled:"#e08a2c",compatible:"#2e9d5b"};infoObservationHeading;infoObservationList;infoCreditsToggle;infoCreditsList;infoCloseButton;shareButton;shareMessages;shareDialog;shareStartOn;shareStart;shareScopeRow;shareScopeLabel;shareScope;shareOpensRow;shareOpensLabel;shareOpens;shareStartLabel;shareOptions;labelsToggle;paramSummary;summaryBuilder;summarySignature="";assessmentEntries=[];assessmentToken=0;supportsPopover=typeof HTMLElement.prototype.showPopover=="function";entries=[];caseSource;interpretationChoice;interpretationLabel;interpretationSelect;confrontationElement;confrontationHeading;confrontationList;compareButton;variantChips;variantMoved;interpretationLoaders=new Map;interpretationToken=0;shownInterpretation;offeredFor;currentSrc;infoOpen=!1;creditsOpen=!1;labelsShown=!1;language="en";messages;ready=Promise.resolve();constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${me}</style>${ue}`,this.shadow.appendChild(e.content.cloneNode(!0)),customElements.upgrade(this.shadow),this.sceneElement=document.createElement(Y),this.forwardPlayerAttributes(),this.sceneElement.ufoElement.creditShownExternally=!0,this.sceneElement.ownCredits=!1,this.shadow.getElementById("ufo-slot").replaceWith(this.sceneElement),this.toolbarElement=this.shadow.getElementById("toolbar"),this.accountElement=this.shadow.getElementById("account"),this.accountPrefix=this.shadow.getElementById("account-prefix"),this.caseOfElement=this.shadow.getElementById("case-of"),this.observerText=this.shadow.getElementById("observer-text"),this.observerSelect=this.shadow.getElementById("observer"),this.infoButton=this.shadow.getElementById("info-button"),this.infoPanel=this.shadow.getElementById("info-panel"),this.infoAppLink=this.shadow.getElementById("info-app-link"),this.editLink=this.shadow.getElementById("edit-link"),this.infoObservationHeading=this.shadow.getElementById("info-observation-heading"),this.infoObservationList=this.shadow.getElementById("info-observation-list"),this.infoCreditsToggle=this.shadow.getElementById("info-credits-toggle"),this.infoCreditsList=this.shadow.getElementById("info-credits-list"),this.infoCloseButton=this.shadow.getElementById("info-close"),this.labelsToggle=this.shadow.getElementById("labels-button"),this.paramSummary=this.shadow.getElementById("param-summary"),this.labelsToggle.addEventListener("click",()=>{this.showLabels=!this.showLabels}),this.shareButton=document.createElement("button"),this.shareButton.type="button",this.shareButton.id="share-button",this.shareButton.setAttribute("aria-haspopup","dialog"),this.shareButton.innerHTML=ee.SHARE,this.sceneElement.ufoElement.addControl(this.shareButton),this.shareDialog=this.shadow.getElementById("share-dialog"),this.shareDialog.subject=this.shareSubject,this.shareStartOn=this.shadow.getElementById("share-start-on"),this.shareStart=this.shadow.getElementById("share-start"),this.shareStartLabel=this.shadow.getElementById("share-start-label"),this.shareScopeRow=this.shadow.getElementById("share-scope-row"),this.shareScopeLabel=this.shadow.getElementById("share-scope-label"),this.shareScope=this.shadow.getElementById("share-scope"),this.shareOpensRow=this.shadow.getElementById("share-opens-row"),this.shareOpensLabel=this.shadow.getElementById("share-opens-label"),this.shareOpens=this.shadow.getElementById("share-opens");const t=s=>({input:this.shadow.getElementById(`share-opt-${s}`),label:this.shadow.getElementById(`share-opt-${s}-label`)});this.shareOptions={labels:t("labels"),map:t("map"),milestones:t("milestones"),compare:t("compare")},this.interpretationChoice=this.shadow.getElementById("interpretation-choice"),this.interpretationLabel=this.shadow.getElementById("interpretation-label"),this.interpretationSelect=this.shadow.getElementById("interpretation"),this.confrontationElement=this.shadow.getElementById("confrontation"),this.confrontationHeading=this.shadow.getElementById("confrontation-heading"),this.confrontationList=this.shadow.getElementById("confrontation-list"),D.register(),this.readingFindingsElement=this.shadow.getElementById("reading-findings");const i=this.shadow.getElementById("reading-chip");i.addEventListener("click",()=>{const s=i.getAttribute("aria-expanded")!=="true";i.setAttribute("aria-expanded",String(s)),this.shadow.getElementById("reading-findings-list").hidden=!s}),this.compareButton=this.shadow.getElementById("compare-account"),this.variantChips=this.shadow.getElementById("variant-chips"),this.variantMoved=this.shadow.getElementById("variant-moved"),this.compareButton.addEventListener("click",()=>this.setComparing(!this.sceneElement.compareAccount)),this.observerSelect.addEventListener("change",()=>this.selectObserver(this.observerSelect.value)),this.interpretationSelect.addEventListener("change",()=>void this.chooseInterpretation(this.interpretationSelect.value)),this.sceneElement.addEventListener(te,s=>this.showConfrontation(s.detail)),this.sceneElement.ufoElement.addEventListener("timeupdate",()=>this.refreshParamSummary()),this.supportsPopover?(this.infoPanel.setAttribute("popover","auto"),this.infoPanel.removeAttribute("hidden"),this.infoButton.setAttribute("popovertarget","info-panel"),this.infoPanel.addEventListener("beforetoggle",s=>{s.newState==="open"&&(this.populateInfoPanel(),this.bringInfoButtonIntoView())}),this.infoPanel.addEventListener("toggle",s=>this.syncInfoOpen(s.newState==="open"))):this.infoButton.addEventListener("click",()=>this.toggleInfoPanel()),this.infoCloseButton.addEventListener("click",()=>this.toggleInfoPanel()),this.infoCreditsToggle.addEventListener("click",()=>this.toggleCredits()),this.shareButton.addEventListener("click",()=>this.openShare()),this.editLink.addEventListener("click",s=>{const n=this.editDetail();n&&G.ask(this,q,n)&&s.preventDefault()});for(const s of[this.shareStartOn,this.shareStart,...Object.values(this.shareOptions).map(n=>n.input)])s.addEventListener("input",()=>this.refreshShareLinks());for(const s of[this.shareScope,this.shareOpens])s.addEventListener("change",()=>this.refreshShareLinks());this.isConnected&&(this.ready=this.loadLocaleMessages())}get scene(){return this.sceneElement}async loadLocaleMessages(){const e=++this.localeToken,t=N.preferencesFor(this);this.preferences=t;const i=W(t,K),[s,n,o,a]=await Promise.all([Z.load(i),J(i),Q(i),se.load(i)]);if(e!==this.localeToken)return;const r=i!==this.language||this.messages===void 0;this.language=i,this.messages=s,this.readingCheck=new ie(a),this.bestCases=new ne(a),this.tags=new P(n),this.said=new M(t),this.summaryBuilder=new oe(this.messages,new ae(o),this.said,this.tags,{messages:this.messages,locale:i}),this.accountPrefix.textContent=this.messages?.accountBy??"",this.interpretationLabel.textContent=this.messages?.interpretation??"",this.confrontationHeading.textContent=this.messages?.confrontation??"";const h=this.entries.find(d=>d.src===this.currentSrc);h&&this.offerInterpretations(h),this.updateCompareButton(),this.infoButton.title=this.messages?.about??"",this.infoButton.setAttribute("aria-label",this.messages?.about??""),this.editLink.title=this.messages?.editThisObservation??"",this.editLink.setAttribute("aria-label",this.messages?.editThisObservation??""),this.infoCloseButton.setAttribute("aria-label",this.messages?.close??""),this.infoObservationHeading.textContent=this.messages?.observation??"",this.infoCreditsToggle.textContent=this.messages?.credits??"",this.syncLabelsToggle(),this.refreshParamSummary(),r&&this.currentSrc&&this.runAssessments(),this.shareButton.title=this.messages?.share??"",this.shareButton.setAttribute("aria-label",this.messages?.share??""),this.shareStartLabel.textContent=this.messages?.shareStartAt??"",this.shareScopeLabel.textContent=this.messages?.shareScope??"",this.shareOpensLabel.textContent=this.messages?.shareOpensOn??"",this.shareOptions.labels.label.textContent=this.messages?.shareOptionLabels??"",this.shareOptions.map.label.textContent=this.messages?.shareOptionMap??"",this.shareOptions.milestones.label.textContent=this.messages?.shareOptionMilestones??"",this.shareOptions.compare.label.textContent=this.messages?.shareOptionCompare??"",this.shareStart.setAttribute("aria-label",this.messages?.shareStartAt??""),this.shareDialog.useLanguage(i).then(d=>{d&&(this.shareMessages=d)}),this.infoOpen&&this.populateInfoPanel(),this.updateAccountLine()}preferences=[];localeToken=0;said=new M(["en"]);tags=new P({});connectedCallback(){N.preferencesFor(this).join()!==this.preferences.join()&&(this.ready=this.loadLocaleMessages()),this.applyAskedInfo();const e=this.getAttribute("src");e&&this.loadFromSrc(e)}applyAskedInfo(){this.isConnected&&this.hasAttribute(L)!==this.infoOpen&&this.toggleInfoPanel()}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick)}attributeChangedCallback(e,t,i){if(e==="src"&&i&&i!==t&&this.isConnected&&this.loadFromSrc(i),e===B){const s=this.entries.find(n=>n.src===this.currentSrc);s&&i===null&&t!==null&&this.interpretationSelect.value!==g?(this.interpretationSelect.value=g,this.chooseInterpretation(g)):s&&this.offerInterpretations(s)}if(e===x){const s=this.entries.find(n=>n.src===this.currentSrc);this.setEntries(this.entries,this.caseSource),s&&this.offerInterpretations(s)}if(e===L&&this.applyAskedInfo(),e==="show-labels"&&this.applyLabels(this.hasAttribute("show-labels")),(e===E||e===S)&&this.forwardPlayerAttributes(),e===w&&this.entries.length>1){const s=this.entryAsked(this.entries);s&&s.src!==this.currentSrc&&this.selectObserver(s.src)}e===k&&this.setComparing(this.hasAttribute(k))}forwardPlayerAttributes(){for(const e of[E,S]){const t=this.getAttribute(e);t===null?this.sceneElement.removeAttribute(e):this.sceneElement.setAttribute(e,t)}}get loaded(){return this.loading??Promise.resolve()}loading;loadFromSrc(e){const t=this.readFromSrc(e);return this.loading=t.catch(()=>{}),t}async readFromSrc(e){this.startPending=!0;const t=y.recording(e);this.sceneElement.holdForNewScene(t);const i=await t;if(Array.isArray(i))throw new Error(`${e} is a bare list of recordings, which is no longer read: list them as the sighting events of a case.json`);if(m.isCase(i)){m.check(i);const s=m.sightingUrls(i,new URL(e,location.href).href);if(s.length===0)throw new Error(`${e} is a case with no sighting event: no recording to show`);await this.loadObserverUrls(s,{json:i,url:new URL(e,location.href).href})}else this.setEntries([{src:e,sighting:i}],void 0)}get sightingData(){return this.entries.find(e=>e.src===this.currentSrc)?.sighting}set sightingData(e){const t=U.recording(e);this.startPending=!0,this.currentSrc="",this.setEntries([{src:"",sighting:t}],void 0)}seekTo(e,t){const i=this.caseSource,s=t===void 0?void 0:this.entries.find(n=>{const o=this.plain(n).id;return(i?m.accountIds(i.json,i.url,n.src,o):[o]).includes(t)});s&&s.src!==this.currentSrc&&this.selectObserver(s.src),this.sceneElement.ufoElement.currentTime=Math.max(0,e)*1e3}set citedMoments(e){this.sceneElement.ufoElement.citedMoments=e}get playedSeconds(){return this.sceneElement.ufoElement.currentTime/1e3}get observerUrls(){return this.entries.map(e=>e.src)}set observerUrls(e){this.loadObserverUrls(e)}async loadObserverUrls(e,t){const i=await Promise.all(e.map(async s=>({src:s,sighting:await y.recording(s)})));this.setEntries(i,t)}reportCaseProblems(e,t){const{duplicateIds:i,unresolved:s}=m.problems(e,t.map(n=>this.plain(n).id).filter(n=>n!==void 0));for(const n of i)console.warn(`The case ${e.id??""} gives the id "${n}" to more than one event: a reference to it is ambiguous.`);for(const{reading:n,reference:o}of s)console.warn(`The reading ${n} of the case ${e.id??""} is "interpretationOf" "${o}", which no event of the case has as its id, nor any recording it lists.`)}setEntries(e,t){this.entries=e.map(o=>({...o,sighting:U.recording(o.sighting)})),this.caseSource=t,t&&this.reportCaseProblems(t.json,e),this.toolbarElement.hidden=e.length===0;const i=e.length>1&&!this.hasAttribute(x);this.observerSelect.hidden=!i,this.observerText.hidden=i,this.observerSelect.innerHTML="";const s=e.map((o,a)=>this.observerDisplayName(this.plain(o).observer)??this.caseTitleOf(o)??(this.messages?.unnamedObserver??"").replace("{n}",String(a+1)));for(const[o,a]of e.entries()){const r=document.createElement("option");r.value=a.src;const h=s.filter(d=>d===s[o]).length>1;r.textContent=(h?this.caseTitleOf(a):void 0)??s[o],this.observerSelect.appendChild(r)}const n=e.find(o=>o.src===this.currentSrc)??this.entryAsked(e)??e[0];n?this.selectObserver(n.src):this.updateAccountLine()}entryAsked(e){const t=this.getAttribute(w)?.trim();if(!t)return;const i=e.find(o=>this.plain(o).observer?.id===t);if(i)return i;const s=this.caseSource;if(s){const o=e.find(a=>m.accountIds(s.json,s.url,a.src,this.plain(a).id).includes(t));if(o)return o}const n=e.find(o=>o.src.split("/").pop()===t.split("/").pop());return n||(/^\d+$/.test(t)?e[Number(t)-1]:void 0)}observerKeyOf(e){return this.plain(e).observer?.id??String(this.entries.indexOf(e)+1)}sharedEntry(){const e=this.shareScope.value;if(!(!this.caseSource||e===C))return this.entries.find(t=>t.src===e)}get sharesCase(){return this.caseSource!==void 0&&!this.shareScopeRow.hidden&&this.shareScope.value===C}editorUrl(){if(!this.currentSrc)return R;const e=new URL(this.currentSrc,location.href),t=this.caseSource;return t?`${R}?file=${encodeURIComponent(t.url)}&track=${encodeURIComponent(this.shownTrackUrl()??e.href)}`:`${R}?file=${encodeURIComponent(e.href)}`}editDetail(){if(!this.currentSrc)return;const e=new URL(this.currentSrc,location.href).href,t=this.caseSource;return t?{src:t.url,track:this.shownTrackUrl()??e}:{src:e}}get editorHref(){return this.editorUrl()}get shownRecordingUrl(){return this.currentSrc?new URL(this.currentSrc,location.href).href:void 0}get shownReadingUrl(){return this.shownTrackUrl()}shownTrackUrl(){return this.readingUrlOf(this.interpretationSelect.value)}shareSubject={module:"rr0-sighting",link:()=>this.playUrl(),element:()=>this.replayElement()};replayElement(){const e=this.sharedAddress(),i=[...e.observer?[[w,e.observer]]:[],...this.replayAttributes()].map(([s,n])=>n===""?` ${s}`:` ${s}="${n}"`).join("");return`<rr0-sighting src="${e.src}"${i}></rr0-sighting>`}playUrl(){const e=this.sharedAddress(),t=[...e.observer?[`${w}=${encodeURIComponent(e.observer)}`]:[],...this.replayQuery()].join("&");return e.src?`${T}/play/?file=${encodeURIComponent(e.src)}${t&&"&"+t}`:`${T}/play/${t&&"?"+t}`}sharedAddress(){const e=t=>t?new URL(t,location.href).href:"";if(this.sharesCase){const t=this.entries.find(i=>i.src===this.shareOpens.value)??this.entries.find(i=>i.src===this.currentSrc);return{src:e(this.caseSource.url),observer:t?this.observerKeyOf(t):void 0}}return{src:e(this.sharedEntry()?.src??this.currentSrc??"")}}replayAttributes(){const e=this.shareOptions,t=[];return this.shareStartSeconds!==void 0&&t.push([I,String(this.shareStartSeconds)]),e.labels.input.checked&&t.push(["show-labels",""]),e.map.input.checked&&t.push([E,""]),e.milestones.input.checked||t.push([S,""]),e.compare.input.checked&&t.push([k,""]),t}replayQuery(){const e=this.shareOptions,t=[];return this.shareStartSeconds!==void 0&&t.push(`d=${this.shareStartSeconds}`),e.labels.input.checked||t.push("labels=0"),e.map.input.checked&&t.push("map=1"),e.milestones.input.checked||t.push("moments=0"),e.compare.input.checked&&t.push("compare=1"),t}get shareStartSeconds(){const e=Math.floor(Number(this.shareStart.value));return this.shareStartOn.checked&&Number.isFinite(e)&&e>=0?e:void 0}refreshShareLinks(){this.shareOpensRow.hidden=!this.sharesCase,this.shareDialog.refresh()}openShare(){const e=this.sceneElement.ufoElement;this.shareStart.max=String(Math.floor(e.seekableDuration/1e3)),this.shareStart.value=String(Math.floor(e.currentTime/1e3)),this.shareStartOn.checked=!1,this.shareOptions.labels.input.checked=this.labelsShown,this.shareOptions.map.input.checked=e.observerMapOpen,this.shareOptions.milestones.input.checked=e.milestonesVisible,this.shareOptions.compare.input.checked=this.sceneElement.compareAccount,this.offerShareScope(),this.shareOpensRow.hidden=!this.sharesCase;const t=[this.caseSource?.url,this.currentSrc,this.shownTrackUrl(),...this.entries.map(i=>i.src)];this.shareDialog.note=$.changed(...t)?this.shareMessages?.unsaved:void 0,this.shareDialog.open()}offerShareScope(){const e=this.caseSource!==void 0&&this.entries.length>1&&!this.hasAttribute(A);if(this.shareScopeRow.hidden=!e,this.shareScope.innerHTML="",this.shareOpens.innerHTML="",!e)return;const t=(i,s,n)=>{const o=document.createElement("option");o.value=s,o.textContent=n,i.appendChild(o)};t(this.shareScope,C,this.messages?.shareScopeCase??"");for(const i of this.entries){const s=this.observerDisplayName(this.plain(i).observer)??this.caseTitleOf(i)??(this.messages?.unnamedObserver??"").replace("{n}",String(this.entries.indexOf(i)+1));t(this.shareScope,i.src,s),t(this.shareOpens,i.src,s)}this.shareScope.value=C,this.shareOpens.value=this.currentSrc??this.entries[0].src}offerInterpretations(e){const t=this.offeredFor===e.sighting,i=this.interpretationSelect.value;this.offeredFor=e.sighting,this.interpretationToken++,this.interpretationLoaders=new Map,this.interpretationSelect.innerHTML="";const s=(c,l,p)=>{const f=document.createElement("option");f.value=c,f.textContent=l,this.interpretationSelect.appendChild(f),this.interpretationLoaders.set(c,p)},n=e===this.entries.find(c=>c.src===this.currentSrc),o=n?this.sceneElement.ufoElement.sighting.interpretation:void 0;s(g,this.messages?.account??"",()=>Promise.resolve(o));const a=this.caseSource;a&&m.interpretationEvents(a.json,m.accountIds(a.json,a.url,e.src,this.plain(e).id)).forEach((c,l)=>{const p=this.said.read(c.title)??`#${l+1}`,f=(c.by??[]).map(b=>this.agentName(b)).filter(Boolean).join(", ");s(`case-${l}`,f?(this.messages?.interpretationBy??"").replace("{title}",p).replace("{by}",f):p,()=>m.interpretationOf(c,a.url,b=>y.recording(b)))});const r=n?this.keptVariants(e):[];for(const{index:c,kept:l}of r)s(`${O}${c}`,`${this.variantLabel(l)} (${this.messages?.verdicts[l.variant.verdict]??""})`,()=>Promise.resolve(l.bodies.length>0?l:void 0));const h=t&&[...this.interpretationSelect.options].some(c=>c.value===i),d=this.askedInterpretation()??(h?i:g);this.interpretationSelect.value=d,d===g?(this.sceneElement.interpretation!==o&&(this.sceneElement.interpretation=o),this.shownInterpretation=g):(!this.sceneElement.interpretation||this.shownInterpretation!==d)&&this.chooseInterpretation(d),this.interpretationChoice.hidden=this.interpretationSelect.options.length<2||this.hasAttribute(x),this.showConfrontation(this.sceneElement.confrontation),this.updateCompareButton(),this.showVariants(r)}keptVariants(e){const t={consolidated:0,contested:1,incompatible:2};return(e.sighting.variants??[]).map((i,s)=>({index:s,kept:i})).filter(({kept:i})=>i.variant).sort((i,s)=>t[i.kept.variant.verdict]-t[s.kept.variant.verdict]||i.kept.variant.cost-s.kept.variant.cost)}variantLabel(e){return(this.messages?.variant??"").replace("{name}",e.variant.label??e.variant.candidate)}showVariants(e){if(!this.messages)return;if(this.variantChips.innerHTML="",this.variantChips.hidden=e.length===0,e.length===0){this.showVariantMoved();return}const t=(i,s,n)=>{const o=document.createElement("button");o.type="button",o.dataset.value=i,n&&(o.dataset.verdict=n,o.title=this.messages.verdicts[n],o.append(Object.assign(document.createElement("span"),{className:"dot"}))),o.append(s),o.addEventListener("click",()=>{this.interpretationSelect.value!==i&&(this.interpretationSelect.value=i,this.chooseInterpretation(i))}),this.variantChips.append(o)};t(g,this.messages?.account??"");for(const{index:i,kept:s}of e)t(`${O}${i}`,s.variant.label??s.variant.candidate,s.variant.verdict);this.showVariantMoved()}showVariantMoved(){if(!this.messages)return;const e=this.interpretationSelect.value;for(const n of this.variantChips.querySelectorAll("button"))n.setAttribute("aria-pressed",String(n.dataset.value===e));this.variantMoved.innerHTML="";const t=e.startsWith(O)?Number(e.slice(O.length)):-1,i=this.sceneElement.ufoElement.sighting.variants?.[t]?.variant;if(this.variantMoved.hidden=!i||i.moved.length+(i.readings?.length??0)===0,!i)return;const s=new Intl.NumberFormat(this.language,{maximumFractionDigits:1});for(const n of i.moved){const[o,a]=n.field==="time"?["0 min",`${n.variant>0?"+":""}${s.format(n.variant)} min`]:n.field==="duration"?[`${s.format(n.stated)} s`,`${s.format(n.variant)} s`]:[`${s.format(n.stated)}°`,`${s.format(n.variant)}°`],r=document.createElement("span");r.append(`${this.messages.variantFields[n.field]}${this.colon}`,Object.assign(document.createElement("s"),{textContent:o})," → ",Object.assign(document.createElement("b"),{textContent:a})),this.variantMoved.append(r)}for(const n of i.readings??[]){const o=this.messages.variantReadings[n.reading];o&&this.variantMoved.append(Object.assign(document.createElement("span"),{className:"reading",textContent:o}))}}setComparing(e){this.sceneElement.compareAccount=e,this.updateCompareButton(),this.showConfrontation(this.sceneElement.confrontation)}updateCompareButton(){const e=this.sceneElement.compareAccount;this.compareButton.hidden=!this.sceneElement.interpretation,this.compareButton.setAttribute("aria-pressed",String(e));const t=e?this.messages?.hideComparison??"":this.messages?.showComparison??"";this.compareButton.title=t,this.compareButton.setAttribute("aria-label",t)}get colon(){return this.language==="fr"?" : ":": "}askedInterpretation(){const e=this.getAttribute(B)?.trim(),t=this.caseSource;if(!e||!t)return;const i=this.entries.find(o=>o.src===this.currentSrc);if(!i)return;const n=m.interpretationEvents(t.json,m.accountIds(t.json,t.url,i.src,this.plain(i).id)).findIndex(o=>o.id===e||typeof o.url=="string"&&new URL(o.url,t.url).href===new URL(e,location.href).href);return n>=0?`case-${n}`:void 0}async chooseInterpretation(e){const t=++this.interpretationToken,i=this.interpretationLoaders.get(e),s=i?await i().catch(l=>{console.warn(`<rr0-sighting>: could not read interpretation "${e}":`,l)}):void 0,n=this.readingUrlOf(e),o=n?await y.recording(n).catch(()=>{}):void 0;if(t!==this.interpretationToken)return;const a=this.entries.find(l=>l.src===this.currentSrc),r=a&&o&&"timeline"in o?this.bestCases?.bestSceneOf(a.sighting,o):void 0,h=r??o,d=r?.interpretation&&s?{...s,bodies:[...s.bodies.map(l=>{const p=r.interpretation.bodies.find(f=>f.id===l.id);return p?{...l,track:p.track}:l}),...r.interpretation.bodies.filter(l=>!s.bodies.some(p=>p.id===l.id))]}:s,c=a&&h&&"timeline"in h&&v.changesTheScene(a.sighting,h)?{...h,timeline:h.timeline.keyframes?.length?h.timeline:a.sighting.timeline}:void 0;if(c&&n)this.showScene(c,n);else if(this.readingScene&&a)this.showScene(a.sighting,a.src,!0);else if(a){const l=!this.sceneElement.ufoElement.playRequested;n?this.sceneElement.showPoster(this.ownCover(o?.image,n),n,l):a.sighting.image?this.sceneElement.showPoster(a.sighting.image,a.src?new URL(a.src,location.href).href:void 0,l):this.sceneElement.showPoster(this.caseSource?.json.image,this.caseSource?.url,l)}this.readingScene=c!==void 0,this.sceneElement.interpretation=d,this.shownInterpretation=e,this.showReadingFindings(a,h),this.editLink.href=this.editorUrl(),this.dispatchEvent(new CustomEvent(ge,{detail:{track:this.shownTrackUrl()}})),this.updateCompareButton(),this.showConfrontation(this.sceneElement.confrontation),this.showVariantMoved()}readingUrlOf(e){const t=this.caseSource,i=this.entries.find(o=>o.src===this.currentSrc),s=/^case-(\d+)$/.exec(e);if(!t||!i||!s)return;const n=m.interpretationEvents(t.json,m.accountIds(t.json,t.url,i.src,this.plain(i).id))[Number(s[1])];return n?.url?new URL(n.url,t.url).href:void 0}static SCENE_FIELDS=["time","utcOffsetHours","place","observerTrack","weatherTrack","decor","instrument","lens","film","exposureSeconds","iso","references","lighting","lightPollution","vehicle"];static changesTheScene(e,t){const i=s=>JSON.stringify(v.SCENE_FIELDS.map(n=>s[n]));return i(e)!==i(t)}ownCover(e,t){const i=this.entries.find(a=>a.src===this.currentSrc),s=i?.sighting.image;if(!e||!s)return e;const n=(a,r)=>{try{return new URL(a,r??location.href).href}catch{return a}},o=i.src?new URL(i.src,location.href).href:void 0;return n(e,t)===n(s,o)?void 0:e}showScene(e,t,i=!1){const s=this.sceneElement.ufoElement.currentTime;this.sceneElement.documentUrl=t?new URL(t,location.href).href:void 0;const n=!this.sceneElement.ufoElement.playRequested,o=t?new URL(t,location.href).href:void 0,a=i?e.image:this.ownCover(e.image,o);a?this.sceneElement.showPoster(a,o,n):i?this.sceneElement.showPoster(this.caseSource?.json.image,this.caseSource?.url,n):this.sceneElement.showPoster(void 0,void 0,n),this.sceneElement.sightingData=e,this.sceneElement.ufoElement.currentTime=s}showReadingFindings(e,t){const i=this.readingFindingsElement,s=this.messages,n=t?.interpretation?.findings??[],o=e&&t&&this.readingCheck?this.readingCheck.findingsOf(e.sighting,t):[],a=[...n,...o],r=re.of(a);this.readingEntry=s&&r?{group:"summary",field:"reading",label:s.readingLabel,unit:"",fromSource:!1,value:(a.length===1?s.readingChipOne:s.readingChip).replace("{verdict}",s.readingVerdict[r]).replace("{n}",String(a.length)),color:v.VERDICT_COLOURS[r],full:a.map(c=>`${{holds:"✓",fails:"✗",untested:"?"}[c.outcome]} ${this.said.read(c.text)??""}`+(c.outcome==="fails"?` (${s.findingAgainst[c.against??"established"]})`:"")).join(`
|
|
692
|
+
`)}:void 0,this.summarySignature="\0",this.refreshParamSummary();const h=i.querySelector("#reading-sensitivity");if(this.readingSensible=e&&t?D.resultOf(e.sighting,t)!==void 0:!1,h.show(e?.sighting,t),this.showReadingBox(),!s||!r){i.querySelector("#reading-findings-list").hidden=!0,delete i.dataset.verdict;return}i.dataset.verdict=r,i.querySelector("#reading-verdict").textContent=(a.length===1?s.readingChipOne:s.readingChip).replace("{verdict}",s.readingVerdict[r]).replace("{n}",String(a.length));const d=i.querySelector("#reading-findings-list");i.querySelector("#reading-chip").setAttribute("aria-expanded","false"),d.hidden=!0,d.replaceChildren(...a.map(c=>{const l=document.createElement("li");l.dataset.outcome=c.outcome;const p=document.createElement("span");p.className="finding-mark",p.textContent={holds:"✓",fails:"✗",untested:"?"}[c.outcome],p.title=s.findingOutcome[c.outcome],p.setAttribute("aria-label",s.findingOutcome[c.outcome]);const f=document.createElement("span");if(f.textContent=this.said.read(c.text)??"",l.append(p,f),c.outcome==="fails"){const b=document.createElement("span");b.className="finding-against",b.textContent=`(${s.findingAgainst[c.against??"established"]})`,l.append(b)}return l}))}agentName(e){if("people"in e){const[t,...i]=e.people.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ");return[...i,t].join(" ")}return"org"in e?e.org.replace(/([a-z])([A-Z])/g,"$1 $2"):this.observerDisplayName(e)??""}showConfrontation(e){this.confrontationList.innerHTML="",this.confrontationElement.hidden=!this.sceneElement.interpretation||!this.sceneElement.compareAccount;const t=new Intl.NumberFormat(this.language,{maximumFractionDigits:1,minimumFractionDigits:1}),i=new Intl.NumberFormat(this.language,{maximumFractionDigits:2,minimumFractionDigits:2});for(const s of e){const n=document.createElement("li");n.append(`${this.said.read(s.title)??s.sourceId}${this.colon}`);const o=[];s.separationDeg!==void 0&&o.push([(this.messages?.confrontationDirection??"").replace("{deg}",t.format(s.separationDeg)),s.disagreements.includes("direction")]),s.widthRatio!==void 0&&o.push([(this.messages?.confrontationWidth??"").replace("{ratio}",i.format(s.widthRatio)),s.disagreements.includes("width")]),s.heightRatio!==void 0&&o.push([(this.messages?.confrontationHeight??"").replace("{ratio}",i.format(s.heightRatio)),s.disagreements.includes("height")]),o.forEach(([a,r],h)=>{h>0&&n.append(" · ");const d=document.createElement("span");d.textContent=a,r&&(d.className="disagrees"),n.append(d)}),this.confrontationList.appendChild(n)}}startPending=!1;startSeconds(e){const t=u.clock(this.getAttribute(H)),i=this.plain(e).time;return(t?u.elapsedSince(i===void 0?void 0:j(i),t):void 0)??u.delta(this.getAttribute(I))}selectObserver(e){const t=this.entries.find(s=>s.src===e);if(!t)return;this.currentSrc=e,this.observerSelect.value=e,this.sceneElement.documentUrl=t.src?new URL(t.src,location.href).href:void 0;const i=!this.sceneElement.ufoElement.playRequested;if(this.askedInterpretation()||(t.sighting.image?this.sceneElement.showPoster(t.sighting.image,t.src?new URL(t.src,location.href).href:void 0,i):this.sceneElement.showPoster(this.caseSource?.json.image,this.caseSource?.url,i)),this.sceneElement.holdForNewScene(),this.sceneElement.sightingData=t.sighting,this.readingScene=!1,this.startPending){this.startPending=!1;const s=this.startSeconds(t);s!==void 0&&(this.sceneElement.ufoElement.currentTime=Math.max(0,s)*1e3)}this.offerInterpretations(t),this.updateAccountLine(),this.refreshParamSummary(),this.runAssessments(),this.infoOpen&&this.populateInfoPanel(),this.dispatchEvent(new CustomEvent(fe,{detail:{src:e}}))}async runAssessments(){if(!this.messages)return;const e=++this.assessmentToken,t=await new he(this.messages).read(this.sceneElement.ufoElement.sighting);e===this.assessmentToken&&(this.assessmentEntries=t.entries,this.refreshParamSummary())}updateAccountLine(){const e=this.entries.find(a=>a.src===this.currentSrc),t=e?this.observerDisplayName(this.plain(e).observer):void 0,i=t!==void 0||this.entries.length>1;this.accountElement.hidden=!i,this.observerText.textContent=t??"";const n=!this.hasAttribute(A)&&this.caseSource&&(this.said.read(this.caseSource.json.title)??this.caseSource.json.id);this.caseOfElement.hidden=!n,this.caseOfElement.textContent=n?`${this.messages?.case??""} ${n}`:"";const o=t!==void 0?`${this.messages?.accountBy??""} ${t}`.trim():void 0;this.sceneElement.filmName=[n||void 0,o].filter(Boolean).join(" - ")||void 0,this.editLink.hidden=!this.currentSrc,this.editLink.href=this.editorUrl(),this.shareButton.hidden=$.local(this.caseSource?.url??this.currentSrc),this.editLink.title=this.messages?.editThisObservation??"",this.editLink.setAttribute("aria-label",this.messages?.editThisObservation??"")}caseTitleOf(e){const t=this.caseSource;if(!t)return;const i=t.json.events?.find(s=>s.url!==void 0&&!s.interpretationOf&&new URL(s.url,t.url).href===new URL(e.src,location.href).href);return i?this.said.read(i.title):void 0}observerDisplayName(e){if(!e)return;const t=[...e.firstNames??[],e.lastName].filter(Boolean).join(" ");return this.said.read(e.title)||t||e.id}plainRecordings=new WeakMap;plain(e){return this.stripped(e).recording}stripped(e){let t=this.plainRecordings.get(e.sighting);return t||(t=X.strip(e.sighting),this.plainRecordings.set(e.sighting,t)),t}basisOf(e,t){const i=this.stripped(e).provenance,s={established:-2,measured:-1,stated:0,derived:1,assumed:2,fitted:3},n=i.paths().filter(r=>t.some(h=>r===h||r.startsWith(`${h}.`))).map(r=>i.at(r)),o=n.reduce((r,h)=>s[h.basis]>s[r]?h.basis:r,"stated"),a=n.filter(r=>r.basis===o&&r.rationale).map(r=>this.said.read(r.rationale)??"").filter(r=>r!=="");return{basis:o,rationales:a}}formatDate(e){const t=e.place?.locations?.[0],i=le((e.time?j(e.time):void 0)??{},t?.lng??0,e.utcOffsetHours);if(!i)return;const s=i.getTime()+this.utcOffsetHoursOf(e,t?.lng??0)*36e5;if(Number.isFinite(s))return new Intl.DateTimeFormat(this.language,{dateStyle:"long",timeStyle:"short",timeZone:"UTC"}).format(new Date(s))}utcOffsetHoursOf(e,t){return e.utcOffsetHours??Math.round(t/15)}formatLocation(e){const t=e.place?.locations?.[0];if(t)return`${t.lat.toFixed(4)}, ${t.lng.toFixed(4)}`}toggleInfoPanel(){const e=!this.infoOpen;if(this.supportsPopover){const t=this.infoPanel.matches(":popover-open");e&&!t?this.infoPanel.showPopover():!e&&t&&this.infoPanel.hidePopover();return}e&&this.bringInfoButtonIntoView(),this.syncInfoOpen(e),this.infoPanel.hidden=!e,e?document.addEventListener("click",this.handleOutsideClick):document.removeEventListener("click",this.handleOutsideClick)}bringInfoButtonIntoView(){const e=this.infoButton.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight;e.top>=0&&e.bottom<=t||this.infoButton.scrollIntoView({block:"center"})}syncInfoOpen(e){e!==this.infoOpen&&(this.infoOpen=e,this.infoButton.setAttribute("aria-expanded",String(e)),e?this.supportsPopover||this.populateInfoPanel():(this.creditsOpen=!1,this.infoCreditsList.hidden=!0,this.infoCreditsToggle.setAttribute("aria-expanded","false")))}handleOutsideClick=e=>{const t=e.composedPath();!t.includes(this.infoPanel)&&!t.includes(this.infoButton)&&this.toggleInfoPanel()};toggleCredits(){this.creditsOpen=!this.creditsOpen,this.infoCreditsList.hidden=!this.creditsOpen,this.infoCreditsToggle.setAttribute("aria-expanded",String(this.creditsOpen)),this.creditsOpen&&this.revealInPanel(this.infoCreditsList)}revealInPanel(e){e.scrollIntoView?.({block:"nearest"})}get showLabels(){return this.labelsShown}set showLabels(e){this.toggleAttribute("show-labels",e)}applyLabels(e){this.labelsShown=e,this.syncLabelsToggle(),this.refreshParamSummary(),this.populateInfoPanel()}syncLabelsToggle(){const e=this.labelsShown?this.messages?.hideLabels??"":this.messages?.showLabels??"";this.labelsToggle.title=e,this.labelsToggle.setAttribute("aria-label",e),this.labelsToggle.setAttribute("aria-pressed",String(this.labelsShown))}showReadingBox(){const e=this.readingFindingsElement,t=this.readingEntry!==void 0&&!this.labelsShown;e.hidden=!t&&!this.readingSensible,e.querySelector("#reading-chip").hidden=!t,t||(e.querySelector("#reading-findings-list").hidden=!0)}refreshParamSummary(){if(this.paramSummary.hidden=!this.labelsShown,this.showReadingBox(),!this.labelsShown){this.paramSummary.replaceChildren(),this.summarySignature="";return}const e=this.sceneElement.ufoElement.sighting,t=this.summaryBuilder?.entriesFor(e,this.sceneElement.ufoElement.currentTime,{roadGradeDeg:this.sceneElement.roadGradeDeg})??[],i=t.map(h=>h.group).lastIndexOf("summary"),s=this.readingEntry?[this.readingEntry]:[],n=[...t.slice(0,i+1),...s,...t.slice(i+1),...this.assessmentEntries],o=n.map(h=>`${h.field}=${h.label}=${h.value}${h.unit}${h.full??""}${h.fromSource?"*":""}`).join("|");if(o===this.summarySignature)return;this.summarySignature=o;const a=[];let r;for(const h of n){r&&r.group!==h.group&&(r=void 0);const d=h.group==="summary"?this.messages?.summaryGroup??"":h.group==="observer"?this.messages?.observerGroup??"":this.messages&&h.group in this.messages.summaryGroups?this.messages.summaryGroups[h.group]:h.group==="assessment"?this.messages?.assessmentGroup??"":void 0;if(d!==void 0&&!r){const l=document.createElement("span");l.className="param-nest";const p=document.createElement("span");p.className="param-nest-label",p.textContent=d,l.append(p),r={group:h.group,element:l},a.push(l)}const c=this.paramItem(h);r?r.element.append(c):a.push(c)}this.paramSummary.replaceChildren(...a),this.syncDescription(n)}openDescription;openDescriptionTitle;syncDescription(e){this.openDescription!==void 0&&!e.some(t=>t.full===this.openDescription)&&(this.openDescription=void 0),_.sync(this.paramSummary,this.openDescription,this.openDescriptionTitle??this.messages?.summaryDescription??"",this.messages?.closeDescription??"",()=>{this.openDescription=void 0,this.syncDescription(e)})}paramItem(e){const t=document.createElement("span");if(t.className=e.fromSource?"param-label from-source":"param-label",e.detail&&(t.title=e.detail),e.full!==void 0){t.classList.add("describable"),t.tabIndex=0,t.setAttribute("role","button");const n=()=>{this.openDescription=e.full,this.openDescriptionTitle=e.label,this.syncDescription([e])};t.addEventListener("click",n),t.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n())})}const i=document.createElement("span");if(i.className="param-label-label",i.textContent=`${e.label} `,t.append(i),e.color!==void 0){const n=document.createElement("span");n.className="param-label-swatch",n.style.background=e.color,t.append(n)}const s=document.createElement("span");return s.className="param-label-value",s.textContent=e.unit===""?e.value:`${e.value} ${e.unit}`,t.append(s),t}populateInfoPanel(){const e=this.entries.find(t=>t.src===this.currentSrc);if(this.infoObservationList.innerHTML="",e){const t=this.caseSource&&(this.caseSource.json.title??this.caseSource.json.id);if(t&&this.appendInfoRow(this.infoObservationList,this.messages?.case??"",t),!this.labelsShown){const n=this.formatDate(this.plain(e));n&&this.appendInfoRow(this.infoObservationList,this.messages?.date??"",n,this.basisOf(e,v.DATE_PATHS));const o=this.formatLocation(this.plain(e));o&&this.appendInfoRow(this.infoObservationList,this.messages?.location??"",o,this.basisOf(e,v.PLACE_PATHS))}const i=this.said.read(this.plain(e).description);i&&!this.labelsShown&&this.appendInfoRow(this.infoObservationList,this.messages?.description??"",i);for(const n of this.plain(e).sources??[])this.appendInfoSource(this.infoObservationList,this.messages?.source??"",n);const s=this.plain(e).tags;!this.labelsShown&&s&&s.length>0&&this.appendInfoRow(this.infoObservationList,this.messages?.tags??"",s.map(n=>this.tags.name(n)).join(", "))}this.infoAppLink.href=T,this.infoAppLink.textContent="UFO@home v0.198.1",ce.fill(this.infoCreditsList,this.sceneElement)}appendInfoSource(e,t,i){const s=document.createElement("dt");s.textContent=t;const n=document.createElement("dd"),o=this.said.read(i.title)??i.url??"";if(i.url&&/^https?:\/\//i.test(i.url)){const r=document.createElement("a");r.href=i.url,r.target="_blank",r.rel="noopener noreferrer",r.textContent=o,n.appendChild(r)}else n.append(o);const a=[i.authors?.join(", "),i.publication?.publisher,i.publication?.time,i.index].filter(Boolean);a.length>0&&n.append(`, ${a.join(", ")}`),e.append(s,n)}static DATE_PATHS=["time","utcOffsetHours","timeZone"];static PLACE_PATHS=["place"];appendInfoRow(e,t,i,s){if(!this.messages)return;const n=document.createElement("dt");n.textContent=t;const o=document.createElement("dd");if(o.textContent=i,s){const a=document.createElement("span");a.className=`basis basis-${s.basis}`,a.textContent=this.messages.basis[s.basis],s.rationales.length>0&&(a.title=s.rationales.join(`
|
|
693
693
|
`)),o.append(" ",a)}e.appendChild(n),e.appendChild(o)}}const F="rr0-sighting",fe="observerchange",ge="interpretationchange";function Ce(){V(),z.register(),customElements.get(F)||customElements.define(F,v)}export{A as CASE_NAMED_ATTRIBUTE,k as COMPARE_ACCOUNT_ATTRIBUTE,x as HIDE_PICKERS_ATTRIBUTE,B as INTERPRETATION_ATTRIBUTE,ge as INTERPRETATION_CHANGE_EVENT,w as OBSERVER_ATTRIBUTE,fe as OBSERVER_CHANGE_EVENT,L as SHOW_INFO_ATTRIBUTE,F as SIGHTING_ELEMENT_NAME,H as START_CLOCK_ATTRIBUTE,I as START_TIME_ATTRIBUTE,v as SightingElement,Ce as registerSighting};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as u}from"./SaidPosition-
|
|
1
|
+
import{I as u}from"./SaidPosition-CXZLm-ck.js";class p{constructor(t,a,e){this.host=t,this.seek=a,this.messages=e,t.classList.add("timeline-tracks"),this.scroll=document.createElement("div"),this.scroll.className="track-scroll",this.scroll.hidden=!0,this.thumb=document.createElement("div"),this.thumb.className="thumb",this.scroll.append(this.thumb),this.scroll.addEventListener("pointerdown",s=>this.dragWindow(s)),t.addEventListener("wheel",s=>this.wheel(s),{passive:!1})}static CSS=`
|
|
2
2
|
.timeline-tracks { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 10px 14px 12px; }
|
|
3
3
|
.timeline-tracks[hidden] { display: none; }
|
|
4
4
|
.track-name { display: inline-block; justify-self: start; min-height: 0; padding: 2px 0; border: 0; background: none; color: var(--ink-dim, inherit); font: 600 12px/1.3 var(--sans, inherit); cursor: pointer; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bl as ee,bh as F,bm as G,bn as M,bo as te,bp as j,bq as $,b7 as E,br as ie,bs as O,bt as J,ba as ne,bu as I,bb as se,b9 as B,bv as oe,b5 as ae,bw as re,b2 as le,b4 as ce,bx as de,bg as fe,by as ue,bz as pe,bA as he,bB as me,bC as V}from"./ShareDialogElement-
|
|
1
|
+
import{bl as ee,bh as F,bm as G,bn as M,bo as te,bp as j,bq as $,b7 as E,br as ie,bs as O,bt as J,ba as ne,bu as I,bb as se,b9 as B,bv as oe,b5 as ae,bw as re,b2 as le,b4 as ce,bx as de,bg as fe,by as ue,bz as pe,bA as he,bB as me,bC as V}from"./ShareDialogElement-DHlxoHWP.js";import{g as ge}from"./SaidPosition-CXZLm-ck.js";import"./rr0-ufoathome.mjs";import"./Sighting-Ch4eiBNK.js";import"./VisualAids-DI-hEL46.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./Obstacles-v9SkfBD7.js";const k=new j,P=new E;class Q extends ee{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new F(e,3)),this.setAttribute("uv",new F(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceStart",new M(i,3,0)),this.setAttribute("instanceEnd",new M(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceColorStart",new M(i,3,0)),this.setAttribute("instanceColorEnd",new M(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new te(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new j);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),k.setFromBufferAttribute(n),this.boundingBox.union(k))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new $),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let t=0;for(let o=0,l=e.count;o<l;o++)P.fromBufferAttribute(e,o),t=Math.max(t,i.distanceToSquared(P)),P.fromBufferAttribute(n,o),t=Math.max(t,i.distanceToSquared(P));this.boundingSphere.radius=Math.sqrt(t),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}I.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ne},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};O.line={uniforms:J.merge([I.common,I.fog,I.line]),vertexShader:`
|
|
2
2
|
#include <common>
|
|
3
3
|
#include <color_pars_vertex>
|
|
4
4
|
#include <fog_pars_vertex>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as d}from"./ShareDialogElement-
|
|
1
|
+
import{P as d}from"./ShareDialogElement-DHlxoHWP.js";import"./rr0-ufoathome.mjs";import"./SaidPosition-CXZLm-ck.js";import"./Sighting-Ch4eiBNK.js";import"./VisualAids-DI-hEL46.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./Obstacles-v9SkfBD7.js";class c{constructor(e,t){this.filmer=e,this.element=t??document.createElement("button"),this.element.type="button",this.element.id="video-button",this.element.setAttribute("aria-haspopup","true"),this.element.addEventListener("click",n=>{n.stopPropagation(),this.filming?this.filming.abort():this.toggleOptions()}),this.panel=document.createElement("div"),this.panel.className="video-options",this.panel.hidden=!0;for(const n of["click","pointerdown","pointerup","dblclick"])this.panel.addEventListener(n,o=>o.stopPropagation());this.panel.addEventListener("keydown",n=>{n.key==="Escape"&&(this.closeOptions(),this.element.focus())});const s=document.createElement("label");s.className="video-size",this.sizeLabel=document.createElement("span"),this.sizeSelect=document.createElement("select"),s.append(this.sizeLabel,this.sizeSelect),this.panel.append(s);const i=()=>{const n=document.createElement("div");n.className="video-bound";const o=document.createElement("label"),l=document.createElement("span"),r=document.createElement("input");r.type="text",r.inputMode="numeric",r.size=7,r.addEventListener("input",()=>this.checkBounds()),o.append(l,r);const h=document.createElement("button");return h.type="button",h.className="video-here",h.addEventListener("click",()=>{r.value=c.formatSeconds(this.filmer.positionS()),this.checkBounds()}),n.append(o,h),this.panel.append(n),{label:l,input:r,here:h}};this.bounds={from:i(),to:i()};const a=()=>{const n=document.createElement("label"),o=document.createElement("input");o.type="checkbox";const l=document.createElement("span");return n.append(o,l),this.panel.append(n),{input:o,label:l}};this.checks={caption:a(),time:a(),map:a()},this.startButton=document.createElement("button"),this.startButton.type="button",this.startButton.className="video-start",this.startButton.addEventListener("click",()=>void this.film(this.options(),!1)),this.panel.append(this.startButton),this.kitButton=document.createElement("button"),this.kitButton.type="button",this.kitButton.className="video-kit",this.kitButton.hidden=!this.filmer.generativeKit,this.kitButton.addEventListener("click",()=>void this.film(this.options(),!0)),this.panel.append(this.kitButton),this.restoreOptions(),this.update()}static HEIGHTS=[720,1080,2160];static STORAGE_KEY="rr0-video-options";element;panel;sizeLabel;sizeSelect;checks;bounds;startButton;kitButton;texts;filming;share=0;failure;set messages(e){this.texts=e,this.update()}open(){this.panel.hidden&&this.openOptions()}toggleOptions(){this.panel.hidden?this.openOptions():this.closeOptions()}openOptions(){this.fillSizes(),this.fillBounds(),this.panel.hidden=!1,this.element.setAttribute("aria-expanded","true"),this.startButton.focus(),document.addEventListener("pointerdown",this.closeOnOutside,!0)}closeOptions(){this.panel.hidden=!0,this.element.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",this.closeOnOutside,!0)}closeOnOutside=e=>{const t=e.composedPath();!t.includes(this.panel)&&!t.includes(this.element)&&this.closeOptions()};fillSizes(){const e=this.filmer.pictureSize(),t=e.height>0?e.width/e.height:16/9,s=this.sizeSelect.value,i=`${e.width} × ${e.height}`,a=[{value:"",text:(this.texts?.videoSizeScreen??"").replace("{size}",i)}];for(const o of c.HEIGHTS)a.push({value:String(o),text:`${Math.round(o*t/2)*2} × ${o}`});this.sizeSelect.replaceChildren(...a.map(({value:o,text:l})=>{const r=document.createElement("option");return r.value=o,r.textContent=l,r})),this.sizeSelect.value=a.some(o=>o.value===s)?s:"";const n=this.checks.map;n.input.disabled=!this.filmer.hasMap(),n.label.parentElement.classList.toggle("disabled",n.input.disabled)}fillBounds(){this.bounds.from.input.placeholder=c.formatSeconds(0),this.bounds.to.input.placeholder=c.formatSeconds(this.filmer.durationS()),this.checkBounds()}boundsS(){const e=this.filmer.durationS(),t=s=>{const i=c.secondsOf(s);return i===void 0||i>=0&&i<=e+.001?i:NaN};return{fromS:t(this.bounds.from.input.value),toS:t(this.bounds.to.input.value)}}checkBounds(){const{fromS:e,toS:t}=this.boundsS(),s=(e??0)>=(t??this.filmer.durationS()),i=Number.isNaN(e)||s&&e!==void 0,a=Number.isNaN(t)||s&&t!==void 0;this.bounds.from.input.setAttribute("aria-invalid",String(i)),this.bounds.to.input.setAttribute("aria-invalid",String(a)),this.startButton.disabled=i||a||s,this.kitButton.disabled=this.startButton.disabled}static formatSeconds(e){const t=Math.max(0,Math.round(e)),s=Math.floor(t/3600),i=Math.floor(t/60)%60,a=String(t%60).padStart(2,"0");return s>0?`${s}:${String(i).padStart(2,"0")}:${a}`:`${i}:${a}`}static secondsOf(e){const t=e.trim().replace(",",".");if(t!=="")return/^\d+(\.\d+)?$|^\d+(:\d{1,2}){1,2}(\.\d+)?$/.test(t)?t.split(":").reduce((s,i)=>s*60+Number(i),0):NaN}options(){const e=Number(this.sizeSelect.value),{fromS:t,toS:s}=this.boundsS();return{...e>0?{height:e}:{},...t!==void 0&&!Number.isNaN(t)?{fromS:t}:{},...s!==void 0&&!Number.isNaN(s)?{toS:s}:{},caption:this.checks.caption.input.checked,time:this.checks.time.input.checked,map:this.checks.map.input.checked&&!this.checks.map.input.disabled}}restoreOptions(){let e={};try{e=JSON.parse(localStorage.getItem(c.STORAGE_KEY)??"{}")}catch{}this.checks.caption.input.checked=e.caption??!0,this.checks.time.input.checked=e.time??!0,this.checks.map.input.checked=e.map??!1,this.sizeSelect.replaceChildren(new Option("",e.height?String(e.height):"")),this.sizeSelect.value=e.height?String(e.height):""}keepOptions(e){try{const{fromS:t,toS:s,...i}=e;localStorage.setItem(c.STORAGE_KEY,JSON.stringify(i))}catch{}}async film(e,t){this.closeOptions(),this.keepOptions(e);const s=new AbortController;this.filming=s,this.share=0,this.failure=void 0,this.update();try{const i=a=>{this.share=a,this.update()};t&&this.filmer.generativeKit?this.save(await this.filmer.generativeKit(e,i,s.signal),this.filmer.kitFileName?.()??"kit.zip"):this.save(await this.filmer.film(e,i,s.signal),this.filmer.fileName())}catch(i){s.signal.aborted||(this.failure=i instanceof Error?i.message:String(i),console.error(i))}finally{this.filming=void 0,this.update()}}save(e,t){const s=URL.createObjectURL(e),i=document.createElement("a");i.href=s,i.download=t,i.click(),setTimeout(()=>URL.revokeObjectURL(s),6e4)}update(){const e=Math.floor(this.share*100);this.filming?(this.element.textContent=`${e} %`,this.element.classList.add("filming")):(this.element.innerHTML=d.VIDEO,this.element.classList.remove("filming"));const t=this.texts,s=t?this.filming?t.recordingVideo.replace("{percent}",String(e)):this.failure?`${t.recordVideo}. ${t.videoFailed.replace("{reason}",this.failure)}`:t.recordVideo:"";this.element.title=s,this.element.setAttribute("aria-label",s),this.sizeLabel.textContent=t?.videoSize??"",this.checks.caption.label.textContent=t?.videoCaption??"",this.checks.time.label.textContent=t?.videoTime??"",this.checks.map.label.textContent=t?.videoMap??"",this.startButton.textContent=t?.videoStart??"",this.kitButton.textContent=t?.videoKit??"",this.kitButton.title=t?.videoKitHint??"",this.bounds.from.label.textContent=t?.videoFrom??"",this.bounds.to.label.textContent=t?.videoTo??"";for(const{here:i}of Object.values(this.bounds))i.textContent=t?.videoHere??"",i.title=t?.videoHereHint??"";this.panel.hidden||this.fillSizes()}}export{c as VideoButton};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b2 as A,b3 as F,b4 as y,b5 as E,b6 as D,b7 as M,b8 as I,b9 as L,ba as z,bb as N,bc as C,bd as U,be as T,bf as P,bg as B,bh as O}from"./ShareDialogElement-
|
|
1
|
+
import{b2 as A,b3 as F,b4 as y,b5 as E,b6 as D,b7 as M,b8 as I,b9 as L,ba as z,bb as N,bc as C,bd as U,be as T,bf as P,bg as B,bh as O}from"./ShareDialogElement-DHlxoHWP.js";import{g as V}from"./SaidPosition-CXZLm-ck.js";import"./rr0-ufoathome.mjs";import"./Sighting-Ch4eiBNK.js";import"./VisualAids-DI-hEL46.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./Obstacles-v9SkfBD7.js";class r{static LIFT_M=.05;static RENDER_ORDER=1.04;static LEVEL_QUANTILE=.2;static BODY_ALBEDO=[.035,.045,.04];static IOR=1.33;static ROUGHNESS=.08;static MAX_SAMPLES=48;static REFLECTION_SCALE=.5;group=new A;material=new F({color:new y(...r.BODY_ALBEDO),roughness:r.ROUGHNESS,metalness:0,ior:r.IOR,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});levels=new Map;reflectionTarget;reflectionUniforms={uWaterReflection:{value:null},uWaterReflectionMatrix:{value:new E},uWaterReflectionOn:{value:0}};mirrorCamera=new D;eye=new M;ahead=new M;up=new M;plane=new I;clip=new L;q=new L;size=new z;bias=new E().set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);constructor(){this.group.name="water",this.material.onBeforeCompile=t=>{Object.assign(t.uniforms,this.reflectionUniforms),t.vertexShader=t.vertexShader.replace("#include <common>",`#include <common>
|
|
2
2
|
varying vec3 vWaterWorld;`).replace("#include <project_vertex>",`#include <project_vertex>
|
|
3
3
|
vWaterWorld = (modelMatrix * vec4(transformed, 1.0)).xyz;`),t.fragmentShader=t.fragmentShader.replace("#include <common>",`#include <common>
|
|
4
4
|
varying vec3 vWaterWorld;
|