@rr0/ufoathome 0.178.4 → 0.179.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed-interview/InterviewMessages_en-ru7GkZlQ.js +1 -0
- package/dist-embed-interview/InterviewMessages_es-DkJurNrG.js +1 -0
- package/dist-embed-interview/InterviewMessages_fr-DAYgf8Ms.js +1 -0
- package/dist-embed-interview/InterviewMessages_it-6lenkmSg.js +1 -0
- package/dist-embed-interview/rr0-interview.mjs +2 -2
- package/dist-embed-scene/{BeamEditor-DFGRzRny.js → BeamEditor-DXIKipID.js} +1 -1
- package/dist-embed-scene/{LanternEditor-H8VYYbRn.js → LanternEditor-JvQQ8GOQ.js} +1 -1
- package/dist-embed-scene/LaunchEditor-DIxYPs4d.js +22 -0
- package/dist-embed-scene/{LaunchPlume-eEIp7_hM.js → LaunchPlume-FP3Yk-8B.js} +1 -1
- package/dist-embed-scene/{LaunchSimulation-DNNEzmzs.js → LaunchSimulation-v4khqz4r.js} +1 -1
- package/dist-embed-scene/{ModuleSession-DLoAutYP.js → ModuleSession-CLUE46BO.js} +2 -2
- package/dist-embed-scene/{ModuleThree-R2LhnY95.js → ModuleThree-DQfMGMDy.js} +1 -1
- package/dist-embed-scene/{ParameterForm-ez-n_0Dw.js → ParameterForm-BFp5BoHL.js} +9 -12
- package/dist-embed-scene/{ReentryEditor-CwY4oANp.js → ReentryEditor-ByVtt--5.js} +6 -6
- package/dist-embed-scene/{ReentrySimulation-BDgEPekW.js → ReentrySimulation-nzg5V3kJ.js} +1 -1
- package/dist-embed-scene/{TimelineTracks-BQXJMJaJ.js → TimelineTracks-BOjTfdGu.js} +2 -2
- package/dist-embed-scene/rr0-scene.mjs +333 -322
- package/dist-embed-sighting/{CaseReportExport-DHdgnsTQ.js → CaseReportExport-C30Foqx0.js} +1 -1
- package/dist-embed-sighting/{InterviewElement-Byb_sxbO.js → InterviewElement-BduwyUn5.js} +2 -2
- package/dist-embed-sighting/InterviewMessages_en-ru7GkZlQ.js +1 -0
- package/dist-embed-sighting/InterviewMessages_es-DkJurNrG.js +1 -0
- package/dist-embed-sighting/InterviewMessages_fr-DAYgf8Ms.js +1 -0
- package/dist-embed-sighting/InterviewMessages_it-6lenkmSg.js +1 -0
- package/dist-embed-sighting/rr0-sighting.mjs +36 -28
- package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-fZkxLAHp.js → AdsbLolArchiveProvider-DEqEth50.js} +1 -1
- package/dist-embed-sighting-editor/AssemblyAiTranscriptionProvider-o2kkPD5o.js +1 -0
- package/dist-embed-sighting-editor/{BallesterGuaspAssessor-DASadJjI.js → BallesterGuaspAssessor-ClwhCo4B.js} +1 -1
- package/dist-embed-sighting-editor/{BeamEditor-B2diaX_e.js → BeamEditor-vxinYAhV.js} +1 -1
- package/dist-embed-sighting-editor/{BeamSystem-BfNJfayv.js → BeamSystem-BMyP16H9.js} +1 -1
- package/dist-embed-sighting-editor/{BodyEditor-CCBXFuuL.js → BodyEditor-Dn5HrH2t.js} +1 -1
- package/dist-embed-sighting-editor/BrowserWhisperProvider-Dn44ZE45.js +1 -0
- package/dist-embed-sighting-editor/{CaseReportExport-D_e5Uij7.js → CaseReportExport-Ct_2DUSO.js} +2 -2
- package/dist-embed-sighting-editor/{ContrailSystem-BWvO9taK.js → ContrailSystem-Y75rFfLJ.js} +1 -1
- package/dist-embed-sighting-editor/{ControlPasses-BQ_DUxa_.js → ControlPasses-oqSnNDq6.js} +1 -1
- package/dist-embed-sighting-editor/{CoverageAssessor-CSktyUlP.js → CoverageAssessor-CN-3cMS9.js} +1 -1
- package/dist-embed-sighting-editor/{Flightradar24Provider-OvRZWZWj.js → Flightradar24Provider-D3bM2ckV.js} +1 -1
- package/dist-embed-sighting-editor/GLTFLoader-CJy8wjmO.js +1 -0
- package/dist-embed-sighting-editor/{GenerativeKitMessages-BtNG1usJ.js → GenerativeKitMessages-I8xH2ec9.js} +1 -1
- package/dist-embed-sighting-editor/{GeoExportTexts-DBGGdRnP.js → GeoExportTexts-DAllttgw.js} +1 -1
- package/dist-embed-sighting-editor/{GeoJsonExport-BZ-0v8fM.js → GeoJsonExport-_yjIEd4F.js} +1 -1
- package/dist-embed-sighting-editor/GeographicFigures-DC6Tw3ja.js +1 -0
- package/dist-embed-sighting-editor/{HeadlightSystem-C-8Gl3vu.js → HeadlightSystem-DZN_EX7x.js} +1 -1
- package/dist-embed-sighting-editor/{HynekAssessor-CH2E88xV.js → HynekAssessor-CKjvYcVe.js} +1 -1
- package/dist-embed-sighting-editor/InterviewEditorElement-C7eNBUfn.js +270 -0
- package/dist-embed-sighting-editor/InterviewMessages_en-ru7GkZlQ.js +1 -0
- package/dist-embed-sighting-editor/InterviewMessages_es-DkJurNrG.js +1 -0
- package/dist-embed-sighting-editor/InterviewMessages_fr-DAYgf8Ms.js +1 -0
- package/dist-embed-sighting-editor/InterviewMessages_it-6lenkmSg.js +1 -0
- package/dist-embed-sighting-editor/{KmlExport-Bh4eTycx.js → KmlExport-dpml2tIJ.js} +1 -1
- package/dist-embed-sighting-editor/LanternEditor-CKKUIplQ.js +9 -0
- package/dist-embed-sighting-editor/{LaserBeam-CtogDP38.js → LaserBeam-Ct6opxMs.js} +1 -1
- package/dist-embed-sighting-editor/LaunchEditor-BfggZKq5.js +22 -0
- package/dist-embed-sighting-editor/{LaunchPlume-BtRrJTP9.js → LaunchPlume-CT777Ivp.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchSimulation-xKwguVJt.js → LaunchSimulation-BSlF3Uq4.js} +1 -1
- package/dist-embed-sighting-editor/{ModelSource-CnKzaNDn.js → ModelSource-BQm0eN7H.js} +1 -1
- package/dist-embed-sighting-editor/{ModelThumbnails-UE_Er5EW.js → ModelThumbnails-Bwh2px6A.js} +1 -1
- package/dist-embed-sighting-editor/{ModelViewer-DoCshJc6.js → ModelViewer-Dl5ichWV.js} +1 -1
- package/dist-embed-sighting-editor/ModuleConformance-B8OYKQop.js +2 -0
- package/dist-embed-sighting-editor/{ModuleSession-CJstaNEN.js → ModuleSession-BQSTCqob.js} +3 -3
- package/dist-embed-sighting-editor/ModuleThree-DwGM2nF4.js +1 -0
- package/dist-embed-sighting-editor/{ModulesPanelElement-DdGqqdn4.js → ModulesPanelElement-CZcbo6lq.js} +3 -3
- package/dist-embed-sighting-editor/{NearestApproach-BH3Yw8Qz.js → NearestApproach-DkpM-8sl.js} +1 -1
- package/dist-embed-sighting-editor/OpenAiTranscriptionProvider-DDW446tK.js +1 -0
- package/dist-embed-sighting-editor/{PictureRegistration-B9C6iY17.js → PictureRegistration-CbfytwCX.js} +1 -1
- package/dist-embed-sighting-editor/{PoherAssessor-DWcCWUfa.js → PoherAssessor-C5-F9VMn.js} +1 -1
- package/dist-embed-sighting-editor/{RailwaySystem-D3VBmx1X.js → RailwaySystem-BxHS7Jka.js} +1 -1
- package/dist-embed-sighting-editor/{ReentryEditor-BDyG-48K.js → ReentryEditor-BgpCftyc.js} +2 -2
- package/dist-embed-sighting-editor/{ReentrySimulation-BQj0wWXW.js → ReentrySimulation-BHjJYTL1.js} +1 -1
- package/dist-embed-sighting-editor/{ReferenceSystem-C9NRL7UY.js → ReferenceSystem-BxKEbMVI.js} +1 -1
- package/dist-embed-sighting-editor/{RoadMarkings-ByQL2MTo.js → RoadMarkings-D9-6Cy9S.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_en-BdRB6cjg.js → SceneNames_en-09L_ZfER.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_es-Dk0UmXHp.js → SceneNames_es-C4PEieol.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_fr-_z2iZ8Bm.js → SceneNames_fr-BGTFI_pF.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_it-CE7fanb3.js → SceneNames_it-DHk5C-uS.js} +1 -1
- package/dist-embed-sighting-editor/{TraceSystem-g262KZ3G.js → TraceSystem-DAa5Lzof.js} +2 -2
- package/dist-embed-sighting-editor/TranscriptionAudio-C_xvRUv2.js +5 -0
- package/dist-embed-sighting-editor/TranscriptionError-D_TCbYbt.js +1 -0
- package/dist-embed-sighting-editor/{UfoMessages_en-JeMK-39o.js → UfoMessages_en-FAvzKxmR.js} +1 -1
- package/dist-embed-sighting-editor/{WaterSystem-CIbQPMqE.js → WaterSystem-C7hE-tnY.js} +1 -1
- package/dist-embed-sighting-editor/interviewImport-CgWyTdKb.js +4 -0
- package/dist-embed-sighting-editor/{interviewJson-DXD8FSBX.js → interviewJson-iURHP4Zk.js} +1 -1
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +30 -22
- package/dist-embed-sighting-editor/{surroundingsSources-BExFsNzP.js → surroundingsSources-YIawBCws.js} +1 -1
- package/dist-embed-sighting-editor/{trafficRuntime-CPRQW0Ho.js → trafficRuntime-j8tnHTec.js} +1 -1
- package/package.json +1 -1
- package/dist-embed-interview/InterviewMessages_en-BNau2xU8.js +0 -1
- package/dist-embed-interview/InterviewMessages_es-ypa0EDh9.js +0 -1
- package/dist-embed-interview/InterviewMessages_fr-OCQdwn9j.js +0 -1
- package/dist-embed-interview/InterviewMessages_it-awuOqf5v.js +0 -1
- package/dist-embed-scene/LaunchEditor-CIYcS0Y-.js +0 -22
- package/dist-embed-sighting/InterviewMessages_en-BNau2xU8.js +0 -1
- package/dist-embed-sighting/InterviewMessages_es-ypa0EDh9.js +0 -1
- package/dist-embed-sighting/InterviewMessages_fr-OCQdwn9j.js +0 -1
- package/dist-embed-sighting/InterviewMessages_it-awuOqf5v.js +0 -1
- package/dist-embed-sighting-editor/GLTFLoader-CM7Uk25s.js +0 -1
- package/dist-embed-sighting-editor/GeographicFigures-DqhWddS9.js +0 -1
- package/dist-embed-sighting-editor/InterviewEditorElement-Bz3hyZ-m.js +0 -234
- package/dist-embed-sighting-editor/InterviewMessages_en-BNau2xU8.js +0 -1
- package/dist-embed-sighting-editor/InterviewMessages_es-ypa0EDh9.js +0 -1
- package/dist-embed-sighting-editor/InterviewMessages_fr-OCQdwn9j.js +0 -1
- package/dist-embed-sighting-editor/InterviewMessages_it-awuOqf5v.js +0 -1
- package/dist-embed-sighting-editor/LanternEditor-tTk1vUZm.js +0 -9
- package/dist-embed-sighting-editor/LaunchEditor-CteAalch.js +0 -22
- package/dist-embed-sighting-editor/ModuleConformance-BKvZnuw9.js +0 -2
- package/dist-embed-sighting-editor/ModuleThree-1hxqvWFa.js +0 -1
- package/dist-embed-sighting-editor/interviewImport-C-TiARLK.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as V,O as tt,p as q,T as j,q as C,t as X,u as et,v as st,w as B}from"./rr0-sighting-editor.mjs";class I{constructor(t){this.survey=t}static CACHE_NAME="rr0-surroundings";static MAX_AGE_MS=720*3600*1e3;static FORMAT=8;static MAX_STORED=400;static asked=new Map;get id(){return this.survey.id}get name(){return this.survey.name}get attribution(){return this.survey.attribution}get creditUrl(){return this.survey.creditUrl}get contemporary(){return this.survey.contemporary}covers(t,e){return this.survey.covers(t,e)}async getSurroundings(t,e){const o=I.key(this.survey.id,t,e);let s=I.asked.get(o);return s===void 0&&(s=this.recalled(o,t,e),I.asked.set(o,s),s.catch(()=>I.asked.delete(o))),structuredClone(await s)}later(t,e){const o=this.survey.later?.(t,e);if(!o)return;const s=I.key(this.survey.id,t,e);return o.then(n=>{const a=I.partial.get(s);if(a){I.partial.delete(s);const{incomplete:r,...i}=a,h=[...a.credits??[],...n.credits??[]].filter((l,f,M)=>M.findIndex(d=>d.url===l.url)===f),c={...i,...n,dates:{...a.dates,...n.dates},...h.length>0?{credits:h}:{}};I.asked.set(s,Promise.resolve(c)),I.openCache().then(l=>l&&I.store(l,I.request(s),c))}return structuredClone(n)})}static partial=new Map;static forget(){I.partial.clear(),I.asked.clear()}static key(t,e,o){return`${t}/v${I.FORMAT}/${e.lat.toFixed(5)}/${e.lng.toFixed(5)}/${Math.round(o)}`}async recalled(t,e,o){const s=await I.openCache(),n=I.request(t);if(s)try{const r=await s.match(n);if(r){const{savedAt:i,surroundings:h}=await r.json();if(Date.now()-i<I.MAX_AGE_MS)return h;await s.delete(n)}}catch{}const a=await this.survey.getSurroundings(e,o);return a.incomplete?(I.asked.delete(t),I.partial.set(t,structuredClone(a)),a):(s&&I.store(s,n,a),a)}static async store(t,e,o){try{const s={savedAt:Date.now(),surroundings:o};await t.put(e,new Response(JSON.stringify(s),{headers:{"Content-Type":"application/json"}}));const n=await t.keys();for(const a of n.slice(0,Math.max(0,n.length-I.MAX_STORED)))await t.delete(a)}catch{}}static async openCache(){try{return typeof caches>"u"?void 0:await caches.open(I.CACHE_NAME)}catch{return}}static request(t){const e=typeof location>"u"?"http://localhost":location.origin;return new Request(`${e}/__surroundings__/${encodeURIComponent(t)}`)}}class ot{constructor(t){if(this.candidates=t,t.length===0)throw new Error("A survey needs at least one candidate");this.current=t[0]}current;get id(){return this.current.id}get name(){return this.current.name}get attribution(){return this.current.attribution}get creditUrl(){return this.current.creditUrl}get contemporary(){return this.current.contemporary}covers(t,e){return this.candidates.some(o=>o.covers(t,e))}async getSurroundings(t,e){let o;for(const s of this.candidates)if(s.covers(t.lat,t.lng))try{const n=await s.getSurroundings(t,e);return this.current=s,n}catch(n){if(o??=n,!(n instanceof V))throw n}throw o??new V("no-coverage","No survey reaches this place")}later(t,e){return this.current.later?.(t,e)}}class D{constructor(t,e,o,s){this.heights=t,this.building=e,this.width=o,this.height=s}static ROOF_PERCENTILE=.9;static STEP_M=.9;static RECTANGLE_FILL=.72;static MIN_DEPTH_M=2.5;static MAX_PARTS=24;static MAX_CELLS=640;buildings(t){const e=t.metresPerPixel,o=t.minAreaM2??12,s=new Uint8Array(this.width*this.height),n=[];for(let a=0;a<this.building.length;a++){if(!this.building[a]||s[a])continue;const r=this.patchFrom(a,s);if(!(r.length*e*e<o))for(const i of this.buildingsOf(r,e,o))Math.hypot(i.eastM,i.northM)<=t.radiusM&&n.push(i)}return n.sort((a,r)=>Math.hypot(a.eastM,a.northM)-Math.hypot(r.eastM,r.northM)),n.slice(0,t.maxBuildings??60)}patchFrom(t,e){const o=[],s=[t];for(e[t]=1;s.length>0;){const n=s.pop();o.push(n);const a=n%this.width,r=Math.floor(n/this.width);for(const[i,h]of[[1,0],[-1,0],[0,1],[0,-1]]){const c=a+i,l=r+h;if(c<0||l<0||c>=this.width||l>=this.height)continue;const f=l*this.width+c;this.building[f]&&!e[f]&&Math.abs(this.heights[f]-this.heights[n])<=D.STEP_M&&(e[f]=1,s.push(f))}}return o}buildingsOf(t,e,o){const s=this.width/2,n=this.height/2,a=[],r=[],i=[];for(const h of t){const c=h%this.width,l=Math.floor(h/this.width);a.push((c+.5-s)*e),r.push((n-l-.5)*e),i.push(this.heights[h])}return D.ofPoints(a,r,i,e,o)}static ofPoints(t,e,o,s,n,a=D.RECTANGLE_FILL,r=[]){const i=[];for(let m=0;m<t.length;m++)for(const[E,v]of[[-.5,-.5],[.5,-.5],[-.5,.5],[.5,.5]])i.push([t[m]+E*s,e[m]+v*s]);const h=D.hull(i),{angle:c,rectangle:l}=D.smallestRectangle(h),f=t.length*s*s,M=(l.maxU-l.minU)*(l.maxV-l.minV);if(f/M>=a||f<4*n)return[D.building(l,c,D.roof(o))];const d=h.map((m,E)=>({from:{east:m[0],north:m[1]},to:{east:h[(E+1)%h.length][0],north:h[(E+1)%h.length][1]}})),g=D.dominantAngles([...r,...d]);return D.parts(t,e,o,g.length>0?g:[c],s,n)}static dominantAngles(t,e=3){const o=new Map;for(const s of t){const n=Math.hypot(s.to.east-s.from.east,s.to.north-s.from.north);if(n<1e-6)continue;const a=(Math.atan2(s.to.north-s.from.north,s.to.east-s.from.east)%(Math.PI/2)+Math.PI/2)%(Math.PI/2),r=Math.round(a/(Math.PI/60));o.set(r,(o.get(r)??0)+n)}return[...o.entries()].sort((s,n)=>n[1]-s[1]).slice(0,e).map(([s])=>s*Math.PI/60)}static parts(t,e,o,s,n,a){let r=t.map((h,c)=>c);const i=[];for(let h=0;h<D.MAX_PARTS&&r.length>0;h++){let c;for(const M of s){const d=D.largestIn(t,e,r,M,n);d&&(c===void 0||d.area>c.area)&&(c=d)}if(c===void 0||c.area<a)break;const l=c.covered;Math.min(c.rectangle.maxU-c.rectangle.minU,c.rectangle.maxV-c.rectangle.minV)>=D.MIN_DEPTH_M&&i.push(D.building(c.rectangle,c.angle,D.roof([...l].map(M=>o[M])))),r=r.filter(M=>!l.has(M))}return i}static largestIn(t,e,o,s,n){const a=Math.cos(s),r=Math.sin(s);let i=1/0,h=-1/0,c=1/0,l=-1/0;const f=[],M=[];for(const A of o){const y=t[A]*a+e[A]*r,R=-t[A]*r+e[A]*a;f.push(y),M.push(R),i=Math.min(i,y),h=Math.max(h,y),c=Math.min(c,R),l=Math.max(l,R)}const d=Math.max(n*Math.SQRT2,Math.max(h-i,l-c)/D.MAX_CELLS),g=Math.max(1,Math.ceil((h-i)/d+1e-9)),m=Math.max(1,Math.ceil((l-c)/d+1e-9)),E=new Uint8Array(g*m),v=o.map((A,y)=>{const R=Math.min(g-1,Math.max(0,Math.floor((f[y]-i)/d))),x=Math.min(m-1,Math.max(0,Math.floor((M[y]-c)/d)));return E[x*g+R]=1,x*g+R}),w=D.largestRectangle(E,g,m);if(w===void 0)return;const p=new Set;return o.forEach((A,y)=>{const R=v[y]%g,x=Math.floor(v[y]/g);R>=w.column&&R<w.column+w.columns&&x>=w.row&&x<w.row+w.rows&&p.add(A)}),{area:w.area*d*d,angle:s,covered:p,rectangle:{minU:i+w.column*d,maxU:i+(w.column+w.columns)*d,minV:c+w.row*d,maxV:c+(w.row+w.rows)*d}}}static largestRectangle(t,e,o){const s=new Array(e).fill(0);let n;for(let a=0;a<o;a++){for(let i=0;i<e;i++)s[i]=t[a*e+i]?s[i]+1:0;const r=[];for(let i=0;i<=e;i++){const h=i===e?0:s[i];for(;r.length>0&&s[r[r.length-1]]>=h;){const c=r.pop(),l=r.length===0?i:i-r[r.length-1]-1,f=s[c]*l;(n===void 0||f>n.area)&&(n={column:i-l,row:a-s[c]+1,columns:l,rows:s[c],area:f})}r.push(i)}}return n}static roof(t){const e=[...t].sort((o,s)=>o-s);return Math.max(2,e[Math.min(e.length-1,Math.floor(e.length*D.ROOF_PERCENTILE))])}static building(t,e,o){const s=Math.cos(e),n=Math.sin(e),a=t.maxU-t.minU,r=t.maxV-t.minV,i=(t.minU+t.maxU)/2,h=(t.minV+t.maxV)/2,l=((90-(a<r?e:e+Math.PI/2)*180/Math.PI)%180+180)%180;return{eastM:D.tenth(i*s-h*n),northM:D.tenth(i*n+h*s),widthM:D.tenth(Math.max(a,r)),lengthM:D.tenth(Math.min(a,r)),heightM:D.tenth(o),headingDeg:Math.round(l*10)/10}}static smallestRectangle(t){let e={area:1/0,angle:0,rectangle:{minU:0,maxU:0,minV:0,maxV:0}};for(let o=0;o<Math.max(1,t.length);o++){const[s,n]=t[o]??[0,0],[a,r]=t[(o+1)%t.length]??[1,0],i=Math.atan2(r-n,a-s),h=Math.cos(i),c=Math.sin(i);let l=1/0,f=-1/0,M=1/0,d=-1/0;for(const[m,E]of t){const v=m*h+E*c,w=-m*c+E*h;l=Math.min(l,v),f=Math.max(f,v),M=Math.min(M,w),d=Math.max(d,w)}const g=(f-l)*(d-M);g<e.area&&(e={area:g,angle:i,rectangle:{minU:l,maxU:f,minV:M,maxV:d}})}return e}static hull(t){const e=[...t].sort((r,i)=>r[0]-i[0]||r[1]-i[1]),o=e.filter((r,i)=>i===0||r[0]!==e[i-1][0]||r[1]!==e[i-1][1]);if(o.length<3)return o;const s=(r,i,h)=>(i[0]-r[0])*(h[1]-r[1])-(i[1]-r[1])*(h[0]-r[0]),n=[];for(const r of o){for(;n.length>=2&&s(n[n.length-2],n[n.length-1],r)<=0;)n.pop();n.push(r)}const a=[];for(const r of[...o].reverse()){for(;a.length>=2&&s(a[a.length-2],a[a.length-1],r)<=0;)a.pop();a.push(r)}return[...n.slice(0,-1),...a.slice(0,-1)]}static tenth(t){return Math.round(t*10)/10}}class H{constructor(t,e,o,s){this.heights=t,this.vegetation=e,this.width=o,this.height=s}static SUMMIT_RADIUS_M=2.5;static CROWN_REACH_M=8;static MAX_WIDTH_M=16;static MIN_WIDTH_M=2;static tenth(t){return Math.round(t*10)/10}trees(t){const e=t.metresPerPixel,o=t.minHeightM??4,s=t.eyeM??1.6,n=t.minElevationDeg??2,a=Math.max(1,Math.round(H.SUMMIT_RADIUS_M/e)),r=Math.round(H.CROWN_REACH_M/e),i=this.width/2,h=this.height/2,c=[];for(let l=0;l<this.height;l++)for(let f=0;f<this.width;f++){const M=this.canopy(f,l);if(M<o)continue;const d=(f+.5-i)*e,g=(h-l-.5)*e,m=Math.hypot(d,g);if(m>t.radiusM||!this.isSummit(f,l,M,a))continue;const E=Math.atan2(M-s,Math.max(m,1))*180/Math.PI;E<n||c.push({tree:{eastM:H.tenth(d),northM:H.tenth(g),heightM:H.tenth(M),widthM:H.tenth(this.crownWidth(f,l,M,e,r))},elevation:E})}return c.sort((l,f)=>f.elevation-l.elevation),c.slice(0,t.maxTrees??150).map(l=>l.tree)}canopy(t,e){if(t<0||e<0||t>=this.width||e>=this.height)return 0;const o=e*this.width+t;return this.vegetation[o]?this.heights[o]:0}isSummit(t,e,o,s){for(let n=-s;n<=s;n++)for(let a=-s;a<=s;a++){if(a===0&&n===0)continue;const r=this.canopy(t+a,e+n);if(r>o||r===o&&(n<0||n===0&&a<0))return!1}return!0}crownWidth(t,e,o,s,n){let a=0;for(let i=-n;i<=n;i++)for(let h=-n;h<=n;h++)Math.hypot(h,i)*s<=H.CROWN_REACH_M&&this.canopy(t+h,e+i)>=o*.5&&a++;const r=2*Math.sqrt(a*s*s/Math.PI);return Math.max(H.MIN_WIDTH_M,Math.min(r,H.MAX_WIDTH_M))}}class _{static WALLS={1:"stone",2:"meuliere",3:"concrete",4:"brick",5:"block",6:"wood",9:"other"};static ROOFS={1:"tile",2:"slate",3:"zinc",4:"concrete",9:"other"};static WALL_COLOURS={stone:"#b9ae9b",meuliere:"#b8a78a",concrete:"#b4b2ac",brick:"#a65f48",block:"#d0c6b2",wood:"#7d5c3e",other:"#c9c0ae"};static PLASTER="#d3cab8";static ROOF_COLOURS={tile:"#a0583f",slate:"#4a5059",zinc:"#8d969c",concrete:"#8f8e8a",other:"#7a7872"};static VARIATION=.12;static OLD_ROOF="#7d858c";static OLD_STOREY_M=3.6;static GRAND_STOREY_M=4.5;static MIN_STOREY_M=2.4;static MAX_STOREY_M=6;static of(t,e){const o=String(t??"").trim();if(!/^\d{1,2}$/.test(o))return;const s=Number(o),n=s%10!==0?s%10:Math.floor(s/10);return(e==="wall"?_.WALLS:_.ROOFS)[String(n)]}static roofColor(t){return t?_.ROOF_COLOURS[t]:void 0}static fit(t){return t.map(e=>{const o=e.style,s={...e.facade,color:e.facade?.color??_.wallColor(e)};o==="church"?s.openings="lancet":o==="monument"||o==="works"?s.openings="plain":(o==="old"||o==="grand")&&(s.openings="tall"),e.closedAtNight&&s.openings!=="plain"&&(s.closedAtNight=!0);const n=_.storeyOf(e);n!==void 0&&o!=="church"&&o!=="monument"&&(s.storeyM=n);const a=o==="old"&&e.roof?.color===void 0?{shape:"flat",riseM:0,...e.roof,color:_.OLD_ROOF}:e.roof;return{...e,facade:s,...a?{roof:a}:{}}})}static storeyOf(t){const e=t.heightM-(t.roof?.riseM??0);if(t.floors&&t.floors>0){const o=e/t.floors;if(o>=_.MIN_STOREY_M&&o<=_.MAX_STOREY_M)return Math.round(o*100)/100}return t.style==="old"?_.OLD_STOREY_M:t.style==="grand"?_.GRAND_STOREY_M:void 0}static wallColor(t){const e=t.style==="church"||t.style==="monument"||t.style==="old",o=t.wallMaterial?_.WALL_COLOURS[t.wallMaterial]:e?_.WALL_COLOURS.stone:_.PLASTER,s=Math.sin(t.eastM*12.9898+t.northM*78.233)*43758.5453,n=1+(s-Math.floor(s)-.5)*2*_.VARIATION,a=r=>Math.max(0,Math.min(255,Math.round(parseInt(o.slice(r,r+2),16)*n))).toString(16).padStart(2,"0");return`#${a(1)}${a(3)}${a(5)}`}}class N{static MIN_RISE_M=1.2;static MIN_EAVES_M=2.5;static MIN_SEEN=.35;static NO_DATA=-9999;static BANDS=7;static INSET_M=.9;static LIFT=1.18;static PEAK=.3;static LEVEL=.45;static fit(t,e,o){return!e&&!o&&!t.some(s=>s.roofMaterial)?t:t.map(s=>{const n=e?N.shapeOf(s,e):void 0,a=(o?N.colorOf(s,o):void 0)??_.roofColor(s.roofMaterial);if(!n&&!a)return s;const r={shape:n?.shape??"flat",...n?.ridge==="depth"?{ridge:"depth"}:{},riseM:n?.riseM??0,...a?{color:a}:{}},i=n&&n.shape!=="flat"?n.topM:s.heightM;return{...s,heightM:i,roof:r}})}static world(t,e,o){const s=t.headingDeg*Math.PI/180;return{east:t.eastM+e*Math.cos(s)+o*Math.sin(s),north:t.northM-e*Math.sin(s)+o*Math.cos(s)}}static shapeOf(t,e){const o=N.BANDS,s=Math.max(e.metresPerPixel,.5),n=t.widthM/2-N.INSET_M,a=t.lengthM/2-N.INSET_M;if(n<=0||a<=0)return;const r=[],i=Array.from({length:o},()=>({sum:0,n:0})),h=Array.from({length:o},()=>({sum:0,n:0}));let c=0;for(let y=-n;y<=n;y+=s)for(let R=-a;R<=a;R+=s){c++;const{east:x,north:$}=N.world(t,y,R),z=Math.floor(x/e.metresPerPixel+e.size/2),Y=Math.floor(e.size/2-$/e.metresPerPixel);if(z<0||Y<0||z>=e.size||Y>=e.size)continue;const k=Y*e.size+z,P=e.heights[k];if(e.vegetation[k]||P===N.NO_DATA||!(P>0))continue;r.push(P);const J=i[Math.min(o-1,Math.floor((y+n)/(2*n)*o))],Q=h[Math.min(o-1,Math.floor((R+a)/(2*a)*o))];J.sum+=P,J.n++,Q.sum+=P,Q.n++}if(c===0||r.length/c<N.MIN_SEEN)return;r.sort((y,R)=>y-R);const l=N.percentile(r,.08),f=N.percentile(r,.92),M=f-l;if(l<N.MIN_EAVES_M||M>Math.min(t.widthM,t.lengthM))return;if(M<N.MIN_RISE_M)return{shape:"flat",riseM:0,topM:f};const d=N.profile(i),g=N.profile(h);if(!d||!g)return;const m=N.peak(g)/M,E=N.peak(d)/M,v=N.spread(d)/M,w=N.spread(g)/M,p=m>=N.PEAK&&v<=N.LEVEL,A=E>=N.PEAK&&w<=N.LEVEL;if(p&&(!A||m>=E))return{shape:"gable",ridge:"width",riseM:M,topM:f};if(A)return{shape:"gable",ridge:"depth",riseM:M,topM:f};if(m>=N.PEAK&&E>=N.PEAK/2)return{shape:"hip",ridge:"width",riseM:M,topM:f}}static profile(t){const e=t.map(o=>o.n>0?o.sum/o.n:NaN);return e.filter(Number.isFinite).length>=t.length-1?e.map((o,s)=>Number.isFinite(o)?o:N.neighbour(e,s)):void 0}static neighbour(t,e){return Number.isFinite(t[e-1])?t[e-1]:t[e+1]}static peak(t){const e=Math.max(1,Math.floor(t.length/3)),o=n=>n.reduce((a,r)=>a+r,0)/n.length,s=[...t.slice(0,e),...t.slice(t.length-e)];return o(t.slice(e,t.length-e))-o(s)}static spread(t){return Math.max(...t)-Math.min(...t)}static percentile(t,e){return t[Math.min(t.length-1,Math.floor(t.length*e))]}static colorOf(t,e){const o=Math.max(e.metresPerPixel,.5),s=Math.max(t.widthM/2-N.INSET_M,o),n=Math.max(t.lengthM/2-N.INSET_M,o),a=[],r=[],i=[];for(let l=-s;l<=s;l+=o)for(let f=-n;f<=n;f+=o){const{east:M,north:d}=N.world(t,l,f),g=Math.floor(M/e.metresPerPixel+e.size/2),m=Math.floor(e.size/2-d/e.metresPerPixel);if(g<0||m<0||g>=e.size||m>=e.size)continue;const E=(m*e.size+g)*e.samples,v=e.values[E],w=e.values[E+1],p=e.values[E+2];w>v&&w>p||(a.push(v),r.push(w),i.push(p))}if(a.length===0)return;const h=l=>l.sort((f,M)=>f-M)[Math.floor(l.length/2)],c=l=>Math.min(255,Math.round(l*N.LIFT)).toString(16).padStart(2,"0");return`#${c(h(a))}${c(h(r))}${c(h(i))}`}}class G{static DEFAULT_HEIGHT_M=6;static METRES_PER_DEGREE=111320;static STREET_SPACING_M=35;static KERB_OFFSET_M=1;static DEFAULT_WIDTH_M=5.5;static PATIENCE_MS=15e3;static MAX=150;static lampsFrom(t,e,o){const s=[],n=new Set;for(const r of t.elements??[]){if(r.id!==void 0){const l=`${r.type}/${r.id}`;if(n.has(l))continue;n.add(l)}if(r.type==="way"){r.tags?.lit==="yes"&&G.alongStreet(r,e,s);continue}if(r.tags?.highway!=="street_lamp"||typeof r.lat!="number"||typeof r.lon!="number")continue;const i=(r.lon-e.lng)*G.METRES_PER_DEGREE*Math.cos(e.lat*Math.PI/180),h=(r.lat-e.lat)*G.METRES_PER_DEGREE;if(Math.hypot(i,h)>o)continue;const c=Number.parseFloat(r.tags?.height??"");s.push({eastM:Math.round(i*10)/10,northM:Math.round(h*10)/10,...Number.isFinite(c)&&c>=2&&c<=20?{heightM:c}:{}})}const a=s.filter(r=>Math.hypot(r.eastM,r.northM)<=o);return s.length=0,s.push(...a),s.sort((r,i)=>Math.hypot(r.eastM,r.northM)-Math.hypot(i.eastM,i.northM)),s.slice(0,G.MAX)}static alongStreet(t,e,o){const s=t.geometry;if(!s||s.length<2)return;const n=d=>[(d.lon-e.lng)*G.METRES_PER_DEGREE*Math.cos(e.lat*Math.PI/180),(d.lat-e.lat)*G.METRES_PER_DEGREE],a=s.map(n),r=Number.parseFloat(t.tags?.width??""),i=Number.parseInt(t.tags?.lanes??"",10),c=(Number.isFinite(r)&&r>0?r:Number.isFinite(i)&&i>0?i*3.5:G.DEFAULT_WIDTH_M)/2+G.KERB_OFFSET_M;let l=1,f=G.STREET_SPACING_M/2,M=0;for(let d=1;d<a.length;d++){const[g,m]=a[d-1],[E,v]=a[d],w=Math.hypot(E-g,v-m);if(w===0)continue;const p=(E-g)/w,A=(v-m)/w;for(;f<=M+w;f+=G.STREET_SPACING_M){const y=f-M;o.push({eastM:Math.round((g+p*y+A*c*l)*10)/10,northM:Math.round((m+A*y-p*c*l)*10)/10,supposed:!0}),l=-l}M+=w}}}class u{constructor(t={},e=[],o=[]){this.lampSources=e,this.signalSources=o,this.client=new tt(t)}static METRES_PER_DEGREE=111320;static KERB_OFFSET_M=.6;static SETBACK_M=.5;static MIN_CROSSING_M=3;static MAX_CROSSING_M=30;static SAME_CROSSING_M=5;static SAME_HEAD_M=2.5;static SAME_HEAD_DEG=45;static MAX_SIGNALS=160;static MAX_CROSSINGS=150;static MAX_SIGNS=100;static ROADS=new Set([...q.DRIVABLE,"living_street","busway","road"]);static ON_ROAD="^(traffic_signals|crossing|stop|give_way)$";static CREDIT={name:"OpenStreetMap",url:"https://www.openstreetmap.org/copyright",licence:"ODbL"};client;local(t,e){const o=u.boxOf(t,e),s=(r,i)=>{if(!r)return Promise.resolve(void 0);const h=`${r.credit.url} ${o}`;let c=u.localPending.get(h);return c||(c=i().then(l=>({credit:r.credit,found:l}),()=>{u.localPending.delete(h)}),u.localPending.set(h,c)),c},n=this.lampSources.find(r=>r.covers(t.lat,t.lng)),a=this.signalSources.find(r=>r.covers(t.lat,t.lng));return Promise.all([s(n,()=>n.lampsNear(t,e)),s(a,()=>a.signalsNear(t,e))]).then(([r,i])=>({lamps:r,signals:i}))}static localPending=new Map;static withLocal(t,e){const o=e?.lamps?e.lamps.found:t.lamps,s=e?.signals?e.signals.found:t.signals,a=[...u.found({crossings:t.crossings,signs:t.signs,...e?.lamps?{}:{lamps:o},...e?.signals?{}:{signals:s}})?[u.CREDIT]:[],...e?.lamps&&e.lamps.found.length>0?[e.lamps.credit]:[],...e?.signals&&e.signals.found.length>0?[e.signals.credit]:[]],{lamps:r,signals:i,credits:h,...c}=t;return{...c,...o?.length?{lamps:o}:{},...s?.length?{signals:s}:{},...a.length>0?{credits:a}:{}}}static today(){return new Date().toISOString().slice(0,10)}static later(t,e,o){return t?.answered(e,o).then(s=>({...s,...u.found(s)?{dates:{lamps:u.today()}}:{}}))}static found(t){return!!(t?.lamps?.length||t?.signals?.length||t?.crossings?.length||t?.signs?.length)}static query(t){const e=u.ON_ROAD;return`[out:json][timeout:25];(node["highway"="street_lamp"](${t});way["highway"]["lit"="yes"](${t});node["highway"~"${e}"](${t});node["traffic_sign"](${t});way["footway"="crossing"](${t}););out geom;(node._["highway"~"${e}"];node._["traffic_sign"];)->.kerb;way(bn.kerb)["highway"];out geom;`}static pending=new Map;async near(t,e){const o=this.ask(u.boxOf(t,e)),s=this.local(t,e);let n;const a=Symbol("late"),r=new Promise(i=>{n=setTimeout(()=>i(a),G.PATIENCE_MS)});try{const[i,h]=await Promise.all([Promise.race([o,r]),Promise.race([s,r])]),c=h===a?void 0:h;return i===a||i===void 0?{...u.withLocal({},c),incomplete:!0}:u.withLocal(u.from(i,t,e),c)}finally{clearTimeout(n)}}static RETRY_DELAYS_MS=[15e3,6e4,18e4,6e5];async answered(t,e){const o=u.boxOf(t,e);for(let s=0;;s++){const n=await this.ask(o);if(n)return u.withLocal(u.from(n,t,e),await this.local(t,e));if(s>=u.RETRY_DELAYS_MS.length)throw new Error("Overpass did not answer");await new Promise(a=>setTimeout(a,u.RETRY_DELAYS_MS[s]))}}ask(t){let e=u.pending.get(t);return e||(e=this.client.query(u.query(t)).catch(()=>{u.pending.delete(t)}),u.pending.set(t,e)),e}static boxOf(t,e){const o=e/u.METRES_PER_DEGREE,s=e/(u.METRES_PER_DEGREE*Math.cos(t.lat*Math.PI/180));return[t.lat-o,t.lng-s,t.lat+o,t.lng+s].map(n=>n.toFixed(6)).join(",")}static forget(){u.pending.clear(),u.localPending.clear()}static from(t,e,o){const s=G.lampsFrom(t,e,o),n=Math.cos(e.lat*Math.PI/180),a=(p,A)=>[(A-e.lng)*u.METRES_PER_DEGREE*n,(p-e.lat)*u.METRES_PER_DEGREE],r=(p,A)=>`${p.toFixed(7)},${A.toFixed(7)}`,i=new Map,h=new Set,c=[],l=[];for(const p of t.elements??[]){if(p.type==="node"){typeof p.lat=="number"&&typeof p.lon=="number"&&l.push(p);continue}if(p.type!=="way"||!p.geometry||p.geometry.length<2)continue;if(p.id!==void 0){if(h.has(p.id))continue;h.add(p.id)}const A=p.tags??{};if(A.footway==="crossing"&&c.push(p),!u.ROADS.has(A.highway??""))continue;const y=p.geometry.map(R=>a(R.lat,R.lon));p.geometry.forEach((R,x)=>{const $=r(R.lat,R.lon);i.set($,[...i.get($)??[],{way:p,points:y,index:x}])})}const f=[],M=[],d=[],g=new Set;for(const p of l){if(p.id!==void 0){if(g.has(p.id))continue;g.add(p.id)}const A=p.tags??{},y=a(p.lat,p.lon),R=i.get(r(p.lat,p.lon))??[],x=A.highway;if(x==="traffic_signals")for(const k of u.approaches(R,u.directionOf(A),!1))f.push(u.head(y,k,"vehicles"));if(x==="crossing"||x==="traffic_signals"&&A.crossing!==void 0){const k=R[0];if(k&&u.marked(A)){const P=u.directionAt(k);P&&M.push({eastM:u.round(y[0]),northM:u.round(y[1]),headingDeg:u.heading(P),widthM:q.widthOf(k.way.tags??{})}),P&&(A.crossing==="traffic_signals"||A["crossing:signals"]==="yes")&&f.push(...u.pedestrianHeads(y,P,k))}}if(x==="traffic_signals")continue;const $=x==="stop"?{face:"stop"}:x==="give_way"?{face:"give-way"}:u.faceOf(A);if(!$)continue;const z=A.traffic_sign?{code:A.traffic_sign}:{};if(R.length>0){const k=u.approaches(R,u.directionOf(A),!0)[0];if(k){const P=u.head(y,k,"vehicles");d.push({eastM:P.eastM,northM:P.northM,headingDeg:P.headingDeg,...$,...z})}continue}const Y=u.compassOf(A.direction);Y!==void 0&&d.push({eastM:u.round(y[0]),northM:u.round(y[1]),headingDeg:(Y+180)%360,...$,...z})}for(const p of c){const A=u.crossingAlong(p,a);A&&!M.some(y=>Math.hypot(y.eastM-A.eastM,y.northM-A.northM)<u.SAME_CROSSING_M)&&M.push(A)}const m=f.filter((p,A)=>!f.slice(0,A).some(y=>y.for===p.for&&Math.hypot(y.eastM-p.eastM,y.northM-p.northM)<u.SAME_HEAD_M&&Math.abs((y.headingDeg-p.headingDeg+540)%360-180)<u.SAME_HEAD_DEG)),E=(p,A)=>p.filter(y=>Math.hypot(y.eastM,y.northM)<=o).sort((y,R)=>Math.hypot(y.eastM,y.northM)-Math.hypot(R.eastM,R.northM)).slice(0,A),v={};s.length>0&&(v.lamps=s);const w={signals:E(m,u.MAX_SIGNALS),crossings:E(M,u.MAX_CROSSINGS),signs:E(d,u.MAX_SIGNS)};return w.signals.length>0&&(v.signals=w.signals),w.crossings.length>0&&(v.crossings=w.crossings),w.signs.length>0&&(v.signs=w.signs),v}static approaches(t,e,o){const s=[];for(const a of t){const r=a.way.tags??{},i=r.oneway==="yes"||r.oneway==="true"||r.oneway==="1"||r.junction==="roundabout"||r.highway==="motorway",h=r.oneway==="-1",{points:c,index:l}=a,f=(d,g)=>{let m=0;for(let E=Math.min(d,g);E<Math.max(d,g);E++)m+=Math.hypot(c[E+1][0]-c[E][0],c[E+1][1]-c[E][1]);return m},M=d=>{const g=c[l][0]-c[d][0],m=c[l][1]-c[d][1],E=Math.hypot(g,m);return E>0?[g/E,m/E]:void 0};if(l>0&&!h){const d=M(l-1);d&&s.push({approach:{unit:d,road:a},toEndM:f(l,c.length-1),forward:!0})}if(l<c.length-1&&!i){const d=M(l+1);d&&s.push({approach:{unit:d,road:a},toEndM:f(0,l),forward:!1})}}const n=e!==void 0&&t.length===1?s.filter(a=>a.forward===(e==="forward")):s;return!o||n.length<=1?n.map(a=>a.approach):[n.reduce((a,r)=>r.toEndM<a.toEndM?r:a).approach]}static head(t,e,o){const[s,n]=e.unit,a=q.widthOf(e.road.way.tags??{})/2+u.KERB_OFFSET_M,r=u.SETBACK_M,i=u.heading(e.unit);return{eastM:u.round(t[0]-s*r+n*a),northM:u.round(t[1]-n*r-s*a),headingDeg:(i+180)%360,for:o,phase:j.phaseOf(i)}}static pedestrianHeads(t,e,o){const s=q.widthOf(o.way.tags??{})/2+u.KERB_OFFSET_M,n=u.heading(e),a=j.phaseOf(n);return[1,-1].map(r=>({eastM:u.round(t[0]+e[1]*s*r),northM:u.round(t[1]-e[0]*s*r),headingDeg:(n+(r===1?270:90))%360,for:"pedestrians",phase:a}))}static crossingAlong(t,e){if(!u.marked(t.tags??{}))return;const o=t.geometry.map(h=>e(h.lat,h.lon)),[s,n]=o[0],[a,r]=o[o.length-1],i=Math.hypot(a-s,r-n);if(!(i<u.MIN_CROSSING_M))return{eastM:u.round((s+a)/2),northM:u.round((n+r)/2),headingDeg:(u.heading([(a-s)/i,(r-n)/i])+90)%360,widthM:Math.round(Math.min(i,u.MAX_CROSSING_M)*10)/10}}static marked(t){const e=t.crossing;return e!=="unmarked"&&e!=="no"&&e!=="informal"&&t["crossing:markings"]!=="no"}static directionAt(t){const{points:e,index:o}=t,[s,n]=o<e.length-1?[e[o],e[o+1]]:[e[o-1],e[o]],a=Math.hypot(n[0]-s[0],n[1]-s[1]);return a>0?[(n[0]-s[0])/a,(n[1]-s[1])/a]:void 0}static directionOf(t){const e=t["traffic_signals:direction"]??t["traffic_sign:direction"]??t.direction;return e==="forward"||e==="backward"?e:void 0}static compassOf(t){if(t===void 0)return;const e=Number.parseFloat(t);if(Number.isFinite(e)&&/^\s*-?\d/.test(t))return(e%360+360)%360;const s=["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"].indexOf(t.trim().toUpperCase());return s<0?void 0:s*22.5}static faceOf(t){const e=t.traffic_sign;if(!e||e==="no"||e==="none")return;const o=e.split(/[;,]/).map(s=>s.trim());if(o.some(s=>/stop|:AB4\b|:206\b|:R1-1\b|:B2\b/i.test(s)))return{face:"stop"};if(o.some(s=>/give_way|yield|:AB3a\b|:205\b|:R1-2\b|:B1\b/i.test(s)))return{face:"give-way"};for(const s of o){const n=/maxspeed|:B14\b|:274\b|:C14\b|:R2-1\b/i.test(s)?Number.parseInt(/\[(\d+)\]/.exec(s)?.[1]??t.maxspeed??"",10):Number.NaN;if(Number.isFinite(n)&&n>0)return{face:"speed-limit",value:n}}return{face:"other"}}static heading([t,e]){return Math.round((Math.atan2(t,e)*180/Math.PI+360)%360*10)/10}static round(t){return Math.round(t*10)/10}}class nt{id="ign-lidar-hd";name="IGN LiDAR HD";attribution="Canopy and roofs © IGN, LiDAR HD (Licence Ouverte 2.0), as surveyed on a day the service does not give";creditUrl="https://geoservices.ign.fr/lidarhd";contemporary=!0;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","The LiDAR HD survey covers France only");const o=C.lidarRadius(e),[s,n,a,r,i]=await Promise.all([this.platform.lidar(t,o),this.platform.photo(t,o).catch(()=>{}),this.furniture?.near(t,e),this.platform.laserDate(t),this.platform.photoDate(t)]);return{trees:new H(s.heights,s.vegetation,s.size,s.size).trees({metresPerPixel:s.metresPerPixel,radiusM:o}),buildings:_.fit(N.fit(new D(s.heights,s.building,s.size,s.size).buildings({metresPerPixel:s.metresPerPixel,radiusM:o,maxBuildings:300}),s,n)),bridges:[],lines:[],...a,dates:{...r?{laser:r}:{},...n&&i?{photo:i}:{},...u.found(a)?{lamps:u.today()}:{}}}}}class O{static MAP_NATURES={Eglise:"church",Chapelle:"church",Monument:"monument","Tour, donjon":"monument","Fort, blockhaus, casemate":"monument","Arc de triomphe":"monument","Arène ou théâtre antique":"monument",Château:"old","Industriel, agricole ou commercial":"works",Serre:"works",Silo:"works"};static MAP_WORKS=new Set(["Industriel","Agricole","Annexe"]);static MAP_CLOSED_AT_NIGHT=new Set(["Commercial et services","Sportif"]);static OSM_CLOSED_AT_NIGHT=new Set(["retail","commercial","office","supermarket","kiosk","sports_hall","sports_centre","stadium","school","university","college","kindergarten","public","civic","government","train_station","transportation"]);static OSM_BUILDINGS={cathedral:"church",church:"church",chapel:"church",basilica:"church",temple:"church",mosque:"church",synagogue:"church",shrine:"church",religious:"church",castle:"old",palace:"old",fortress:"monument",bunker:"monument",triumphal_arch:"monument",industrial:"works",warehouse:"works",barn:"works",farm_auxiliary:"works",shed:"works",hangar:"works",garage:"works",garages:"works",greenhouse:"works",silo:"works",storage_tank:"works",cowshed:"works",stable:"works",sty:"works",manufacture:"works"};static OSM_HISTORIC={church:"church",chapel:"church",monastery:"old",castle:"old",manor:"old",fort:"monument",tower:"monument",monument:"monument",memorial:"monument",city_gate:"monument"};static OLD_BEFORE=1900;static GRAND_FROM_M=15;static GRAND_UP_TO_M=40;static TOWER_SLENDERNESS=2;static CHURCH_PITCH=.7;static CHURCH_ROOF_OF_WALLS=.35;static CHURCH_ROOF_COLOUR="#5a6068";static ofMap(t){const e=O.year(t.date_d_apparition),s=O.MAP_NATURES[String(t.nature??"")]??(t.usage_1==="Religieux"?"church":void 0)??(O.MAP_WORKS.has(String(t.usage_1??""))?"works":void 0)??O.ofYear(e)??O.grand(t),n=O.MAP_CLOSED_AT_NIGHT.has(String(t.usage_1??""));return{...s?{style:s}:{},...e!==void 0?{builtYear:e}:{},...n?{closedAtNight:!0}:{}}}static ofOsm(t){const e=O.year(t.start_date),o=t.historic&&t.historic!=="no"?O.OSM_HISTORIC[t.historic]??"old":void 0,s=t.amenity==="place_of_worship"?"church":void 0,n=O.OSM_BUILDINGS[t.building??""]??o??s??O.ofYear(e),a=O.OSM_CLOSED_AT_NIGHT.has(t.building??"")||t.shop!==void 0&&t.shop!=="no";return{...n?{style:n}:{},...e!==void 0?{builtYear:e}:{},...a?{closedAtNight:!0}:{}}}static year(t){const e=Number(/\b(\d{4})\b/.exec(String(t??""))?.[1]);return Number.isFinite(e)&&e>=1e3&&e<=2100?e:void 0}static fit(t){return t.map(e=>e.style==="church"?O.church(e):e)}static isTower(t){return t.heightM>=O.TOWER_SLENDERNESS*Math.max(t.widthM,t.lengthM)}static church(t){const e=t.roof?.color??O.CHURCH_ROOF_COLOUR;if(O.isTower(t))return{...t,roof:{shape:"flat",riseM:0,color:e}};if(t.roof&&t.roof.shape!=="flat")return t;const o=Math.round(Math.min(O.CHURCH_PITCH*t.lengthM,O.CHURCH_ROOF_OF_WALLS*t.heightM)*10)/10,s={shape:"gable",riseM:o,color:e};return{...t,heightM:Math.round((t.heightM+o)*10)/10,roof:s}}static ofYear(t){return t!==void 0&&t<O.OLD_BEFORE?"old":void 0}static grand(t){const e=Number(t.hauteur),o=Number(t.nombre_d_etages);if(!(Number.isFinite(o)&&o>0)&&!(t.usage_1==="Résidentiel"||t.date_d_apparition))return e>=O.GRAND_FROM_M&&e<=O.GRAND_UP_TO_M?"grand":void 0}}class b{static METRES_PER_DEGREE=111320;static NAMED_NATURES={Silo:"Silo"};static DEFAULT_HEIGHT_M=6;static FLOOR_HEIGHT_M=3;static FINE_M=.5;static COARSE_M=1;static MAX_CELLS=4e4;static RECTANGLE_FILL=.9;static buildings(t,e,o,s=12,n=300,a=[]){const r=[];for(const h of b.reached(t,a,e,o)){const c=h.feature,l=Number(c.properties.nombre_d_etages),f=Number(c.properties.hauteur),M=Number.isFinite(f)&&f>0?f:Number.isFinite(l)&&l>0?l*b.FLOOR_HEIGHT_M:b.DEFAULT_HEIGHT_M,{style:d,builtYear:g,closedAtNight:m}=O.ofMap(c.properties);for(const E of b.rectanglesOf(h.rings,M,s)){const v=_.of(c.properties.materiaux_des_murs,"wall"),w=_.of(c.properties.materiaux_de_la_toiture,"roof"),p=b.NAMED_NATURES[String(c.properties.nature??"")];r.push({...E,...p?{name:p}:{},...Number.isFinite(l)&&l>0?{floors:l}:{},...v?{wallMaterial:v}:{},...w?{roofMaterial:w}:{},...d?{style:d}:{},...g!==void 0?{builtYear:g}:{},...m?{closedAtNight:m}:{}})}}const i=h=>Math.hypot(h.eastM,h.northM);if(r.length>n){const h=c=>(c.heightM+6)*Math.sqrt(c.widthM*c.lengthM)/Math.max(i(c),50);r.sort((c,l)=>h(l)-h(c)),r.length=n}return r.sort((h,c)=>i(h)-i(c)),r}static named(t,e,o){const s=e.map(n=>({name:typeof n.properties.toponyme=="string"?n.properties.toponyme:"",rings:b.rings(n,o)})).filter(n=>n.name.length>0&&n.rings.length>0);return s.length===0?t:t.map(n=>{const a=s.find(r=>b.inside(n.eastM,n.northM,r.rings));return a?{...n,name:a.name}:n})}static reached(t,e,o,s){const n=t.map(i=>({feature:i,rings:b.rings(i,o)})).filter(i=>i.rings.length>0),a=n.map(i=>b.reach(i.rings)<=s),r=e.filter(i=>typeof i.properties.toponyme=="string"&&i.properties.toponyme.length>0).map(i=>b.rings(i,o)).filter(i=>i.length>0);if(r.length>0){const i=n.map(c=>{const l=c.rings[0],f=l.reduce((d,g)=>d+g.east,0)/l.length,M=l.reduce((d,g)=>d+g.north,0)/l.length;return r.findIndex(d=>b.inside(f,M,d))}),h=new Set(i.filter((c,l)=>c>=0&&a[l]));i.forEach((c,l)=>{h.has(c)&&(a[l]=!0)})}return n.filter((i,h)=>a[h])}static reach(t){if(b.inside(0,0,t))return 0;let e=1/0;for(const o of t)for(let s=0;s+1<o.length;s++){const n=o[s],a=o[s+1],r=a.east-n.east,i=a.north-n.north,h=r*r+i*i>0?Math.max(0,Math.min(1,-(n.east*r+n.north*i)/(r*r+i*i))):0;e=Math.min(e,Math.hypot(n.east+h*r,n.north+h*i))}return e}static inside(t,e,o){let s=0;for(const n of o)for(let a=0;a+1<n.length;a++){const r=n[a],i=n[a+1];r.north<=e!=i.north<=e&&r.east+(e-r.north)/(i.north-r.north)*(i.east-r.east)>t&&s++}return s%2===1}static rings(t,e){const o=t.geometry,s=o.type==="Polygon"?[o.coordinates]:o.type==="MultiPolygon"?o.coordinates:[],n=Math.cos(e.lat*Math.PI/180),a=[];for(const r of s)for(const i of r)a.push(i.map(([h,c])=>({east:(h-e.lng)*b.METRES_PER_DEGREE*n,north:(c-e.lat)*b.METRES_PER_DEGREE})));return a}static rectanglesOf(t,e,o){let s=1/0,n=-1/0,a=1/0,r=-1/0;for(const f of t)for(const M of f)s=Math.min(s,M.east),n=Math.max(n,M.east),a=Math.min(a,M.north),r=Math.max(r,M.north);let i=b.FINE_M;(n-s)*(r-a)/(i*i)>b.MAX_CELLS&&(i=b.COARSE_M);const h=[],c=[];for(let f=a+i/2;f<r;f+=i){const M=[];for(const d of t)for(let g=0;g+1<d.length;g++){const m=d[g],E=d[g+1];m.north<=f!=E.north<=f&&M.push(m.east+(f-m.north)/(E.north-m.north)*(E.east-m.east))}M.sort((d,g)=>d-g);for(let d=0;d+1<M.length;d+=2)for(let g=Math.ceil((M[d]-i/2)/i)*i+i/2;g<M[d+1];g+=i)h.push(g),c.push(f)}if(h.length*i*i<o)return[];const l=t.flatMap(f=>f.slice(0,-1).map((M,d)=>({from:M,to:f[d+1]})));return D.ofPoints(h,c,new Array(h.length).fill(e),i,o,b.RECTANGLE_FILL,l)}}class F{id="ign-lidar-topo";name="IGN LiDAR HD + BD TOPO";attribution="Canopy © IGN, LiDAR HD; buildings, bridges and lines © IGN, BD TOPO (Licence Ouverte 2.0), as surveyed on days the services do not give";creditUrl="https://geoservices.ign.fr/lidarhd";contemporary=!0;static BRIDGE_MARGIN_M=30;static MAX_BRIDGE_WINDOWS=8;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","The IGN's surveys cover France only");const o=C.radius(e),[s,n,a,r,i,h]=await Promise.allSettled([this.platform.lidar(t,o),this.platform.vectors(t,o,!0),this.platform.photo(t,o),this.furniture?.near(t,e)??Promise.resolve(void 0),this.platform.laserDate(t),this.platform.photoDate(t)]),c=C.lidarRadius(o);if(s.status==="rejected"&&n.status==="rejected")throw s.reason;const l=s.status==="fulfilled"?s.value:void 0,f=n.status==="fulfilled"?n.value:void 0,M=f!==void 0&&f.buildings.length===0&&f.bridges.length===0&&f.lines.length===0;if(s.status==="rejected"&&s.reason instanceof V&&s.reason.reason==="no-coverage"&&M)throw s.reason;return{trees:l?new H(l.heights,l.vegetation,l.size,l.size).trees({metresPerPixel:l.metresPerPixel,radiusM:c}):[],buildings:this.roofed(this.buildings(l,f,t,o),l,a.status==="fulfilled"?a.value:void 0),bridges:f?await this.bridges(f,t,o,l?.structures,c):[],lines:f?X.lines(f,t,o,l?.structures):[],...r.status==="fulfilled"?r.value:{},dates:{...s.status==="fulfilled"&&i.status==="fulfilled"&&i.value?{laser:i.value}:{},...a.status==="fulfilled"&&h.status==="fulfilled"&&h.value?{photo:h.value}:{},...f?.mapDate?{map:f.mapDate}:{},...r.status==="fulfilled"&&u.found(r.value)?{lamps:u.today()}:{}}}}async bridges(t,e,o,s,n){const a=X.bridges(t,e,o,s);let r=0;return Promise.all(a.map(async i=>{if(s!==void 0&&Math.hypot(i.eastM,i.northM)+i.lengthM/2<=n)return i;const h=i.lengthM/2+F.BRIDGE_MARGIN_M;if(r++>=F.MAX_BRIDGE_WINDOWS)return i;const c=et(i.eastM,-i.northM,e.lat,e.lng);try{const l=await this.platform.lidar(c,h),f=X.bridges(t,c,h,l.structures).sort((M,d)=>Math.hypot(M.eastM,M.northM)-Math.hypot(d.eastM,d.northM))[0];return!f||Math.hypot(f.eastM,f.northM)>i.lengthM/2?i:{...f,eastM:X.tenth(f.eastM+i.eastM),northM:X.tenth(f.northM+i.northM)}}catch{return i}}))}roofed(t,e,o){return _.fit(O.fit(N.fit(t,e,o)))}buildings(t,e,o,s){const n=e?b.buildings(e.buildings,o,s,void 0,void 0,e.zones):[],a=n.length>0||t===void 0?n:new D(t.heights,t.building,t.size,t.size).buildings({metresPerPixel:t.metresPerPixel,radiusM:C.lidarRadius(s),maxBuildings:300});return e?b.named(a,e.zones,o):a}}class at{id="ign-bd-topo";name="IGN BD TOPO";attribution="Buildings, bridges and lines © IGN, BD TOPO (Licence Ouverte 2.0), as drawn on a day the service does not give";creditUrl="https://geoservices.ign.fr/bdtopo";contemporary=!0;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","BD TOPO covers France only");const o=C.radius(e),[s,n,a,r]=await Promise.all([this.platform.vectors(t,o,!0),this.platform.photo(t,o).catch(()=>{}),this.furniture?.near(t,e),this.platform.photoDate(t)]);return{trees:[],buildings:_.fit(O.fit(N.fit(b.named(b.buildings(s.buildings,t,o,void 0,void 0,s.zones),s.zones,t),void 0,n))),bridges:X.bridges(s,t,o,void 0),lines:X.lines(s,t,o,void 0),...a,dates:{...s.mapDate?{map:s.mapDate}:{},...n&&r?{photo:r}:{},...u.found(a)?{lamps:u.today()}:{}}}}}class S{static ROOF_SHAPES={flat:"flat",gabled:"gable",gambrel:"gable",saltbox:"gable","half-hipped":"hip",hipped:"hip",pyramidal:"hip",mansard:"hip",round:"gable",dome:"dome",onion:"dome"};static WALL_MATERIALS={brick:"brick",stone:"stone",granite:"stone",sandstone:"stone",limestone:"stone",concrete:"concrete",cement_block:"block",block:"block",wood:"wood",timber_framing:"wood"};static ROOF_MATERIALS={roof_tiles:"tile",tiles:"tile",tile:"tile",slate:"slate",metal:"zinc",zinc:"zinc",tin:"zinc",copper:"zinc",concrete:"concrete",eternit:"other"};static COLOURS={white:"#e8e6e0",grey:"#8c8c8a",gray:"#8c8c8a",black:"#3a3a3a",red:"#a8483a",brown:"#6e4f38",beige:"#d6c9a8",yellow:"#d8c070",orange:"#c9773a",green:"#5f7a52",blue:"#506a8a",tan:"#c0a37a",cream:"#e6dcc0",pink:"#c99a96",silver:"#b4b6b6"};static height(t){const e=Number.parseFloat((t??"").replace(",","."));return Number.isFinite(e)&&e>=2&&e<=500?e:void 0}static levels(t){const e=Number.parseInt(t??"",10);return Number.isFinite(e)&&e>=1&&e<=150?e:void 0}static roofShape(t){return S.ROOF_SHAPES[(t??"").trim().toLowerCase()]}static wallMaterial(t){return S.WALL_MATERIALS[(t??"").trim().toLowerCase()]}static roofMaterial(t){return S.ROOF_MATERIALS[(t??"").trim().toLowerCase()]}static colour(t){const e=(t??"").trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(e)?e:/^#[0-9a-f]{3}$/.test(e)?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:S.COLOURS[e]}}class W{id="osm-buildings";name="OpenStreetMap buildings";attribution="Buildings © OpenStreetMap contributors (ODbL), as drawn on the day of the data, which a recording is not";creditUrl="https://www.openstreetmap.org/copyright";contemporary=!0;static MAX_RADIUS_M=1500;static MIN_AREA_M2=12;static MAX_BUILDINGS=300;client;furniture;constructor(t={},e){this.client=new tt(t),this.furniture=e}covers(){return!0}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){const o=Math.min(e,W.MAX_RADIUS_M);let s;try{s=await this.client.query(`[out:json][timeout:30];(way["building"](around:${o},${t.lat},${t.lng});relation["building"]["type"="multipolygon"](around:${o},${t.lat},${t.lng}););out geom;`)}catch(r){throw new V("unreachable",r instanceof Error?r.message:String(r))}const n=await this.furniture?.near(t,e),a=(s.osm3s?.timestamp_osm_base??"").slice(0,10);return{trees:[],buildings:_.fit(O.fit(W.buildings(s,t,o))),bridges:[],lines:[],...n,dates:{.../^\d{4}-\d{2}-\d{2}$/.test(a)?{map:a}:{},...u.found(n)?{lamps:u.today()}:{}}}}static buildings(t,e,o){const s=[];for(const n of t.elements??[]){const a=W.ringsOf(n);if(a.length===0)continue;const r=n.tags??{},i=S.levels(r["building:levels"]),h=S.height(r.height),c={geometry:{type:"Polygon",coordinates:a},properties:{...h?{hauteur:h}:{},...i?{nombre_d_etages:i}:{}}};for(const l of b.buildings([c],e,o,W.MIN_AREA_M2,50))s.push(W.described(l,r,h!==void 0))}return s.sort((n,a)=>Math.hypot(n.eastM,n.northM)-Math.hypot(a.eastM,a.northM)),s.slice(0,W.MAX_BUILDINGS)}static ringsOf(t){const e=s=>{if(!s||s.length<4)return;const n=s.map(i=>[i.lon,i.lat]),a=n[0],r=n[n.length-1];return a[0]===r[0]&&a[1]===r[1]?n:void 0};if(t.type==="way"){const s=e(t.geometry);return s?[s]:[]}return(t.members??[]).filter(s=>s.role==="outer").map(s=>e(s.geometry)).filter(s=>s!==void 0).slice(0,1)}static described(t,e,o){const s=S.wallMaterial(e["building:material"]),n=S.roofMaterial(e["roof:material"]),a=S.colour(e["building:colour"]),r=S.colour(e["roof:colour"])??_.roofColor(n),i=S.roofShape(e["roof:shape"]),h=a?{color:a}:void 0;let c,l=t.heightM;if(i==="gable"||i==="hip"||i==="dome"){const g=S.height(e["roof:height"]),m=Math.round((g??Math.min(5,Math.max(1.5,.29*Math.min(t.widthM,t.lengthM))))*10)/10;o||(l=Math.round((t.heightM+m)*10)/10),c={shape:i,riseM:m,...e["roof:orientation"]==="across"?{ridge:"depth"}:{},...r?{color:r}:{}}}else(i==="flat"||r)&&(c={shape:"flat",riseM:0,...r?{color:r}:{}});const{style:f,builtYear:M,closedAtNight:d}=O.ofOsm(e);return{...t,heightM:l,...f?{style:f}:{},...M!==void 0?{builtYear:M}:{},...d?{closedAtNight:d}:{},...e.name?{name:e.name}:{},...s?{wallMaterial:s}:{},...n?{roofMaterial:n}:{},...h?{facade:h}:{},...c?{roof:c}:{}}}}class L{credit={name:"Ville de Paris, Éclairage public",url:"https://opendata.paris.fr/explore/dataset/eclairage-public/",licence:"ODbL",of:"lamps"};static BOUNDS={south:48.8156,north:48.9022,west:2.2241,east:2.4698};static ENDPOINT="https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/eclairage-public/records";static PAGE=100;static MAX=150;static MAX_PAGES=4;static METRES_PER_DEGREE=111320;static SAME_COLUMN_M=.5;static MIN_HEIGHT_M=2;fetchImpl;constructor(t){this.fetchImpl=t??fetch.bind(globalThis)}covers(t,e){const o=L.BOUNDS;return t>=o.south&&t<=o.north&&e>=o.west&&e<=o.east}async lampsNear(t,e){const o=[];let s=[];for(let n=0;n<L.MAX_PAGES&&s.length<L.MAX;n++){const a=await this.fetchImpl(L.query(t,e,L.PAGE,n*L.PAGE));if(!a.ok)throw new Error(`opendata.paris.fr refused (${a.status})`);const r=(await a.json()).results??[];if(o.push(...r),s=L.lampsFrom(o,t),r.length<L.PAGE)break}return s.slice(0,L.MAX)}static query(t,e,o,s){const n=`geom'POINT(${t.lng.toFixed(6)} ${t.lat.toFixed(6)})'`,a=new URLSearchParams({select:"geo_point_2d,lib_ouvrag,lampe_temperature_couleur,lampe_flux,support_hauteur",where:`within_distance(geo_point_2d,${n},${Math.round(e)}m)`,order_by:`distance(geo_point_2d,${n})`,limit:String(o),offset:String(s)});return`${L.ENDPOINT}?${a}`}static lampsFrom(t,e){const o=Math.cos(e.lat*Math.PI/180),s=a=>{const r=typeof a=="number"?a:Number.parseFloat(a??"");return Number.isFinite(r)&&r>0?r:void 0},n=[];for(const a of t){const r=a.geo_point_2d;if(!r||a.lib_ouvrag==="Projecteur")continue;const i=Math.round((r.lon-e.lng)*L.METRES_PER_DEGREE*o*10)/10,h=Math.round((r.lat-e.lat)*L.METRES_PER_DEGREE*10)/10,c=s(a.lampe_flux),l=n.find(d=>Math.hypot(d.eastM-i,d.northM-h)<L.SAME_COLUMN_M);if(l){c!==void 0&&(l.lumens=(l.lumens??0)+c);continue}const f=s(a.lampe_temperature_couleur),M=s(a.support_hauteur);n.push({eastM:i,northM:h,...M!==void 0&&M>=L.MIN_HEIGHT_M?{heightM:M}:{},...f!==void 0?{colorTemperatureK:f}:{},...c!==void 0?{lumens:c}:{},...a.lib_ouvrag==="Console"?{mount:"wall"}:{}})}return n}}class T{constructor(t,e){this.roads=t,this.fetchImpl=e??fetch.bind(globalThis)}credit={name:"Ville de Paris, Signalisation lumineuse tricolore",url:"https://opendata.paris.fr/explore/dataset/signalisation-tricolore/",licence:"ODbL",of:"signals"};static BOUNDS={south:48.8156,north:48.9022,west:2.2241,east:2.4698};static ENDPOINT="https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/signalisation-tricolore/records";static PAGE=100;static MAX_PAGES=5;static MAX=160;static METRES_PER_DEGREE=111320;static SAME_POST_M=.8;static SEARCH_M=15;static PEDESTRIAN_ALONG_M=.4;fetchImpl;covers(t,e){const o=T.BOUNDS;return t>=o.south&&t<=o.north&&e>=o.west&&e<=o.east}async signalsNear(t,e){const o=(e+T.SEARCH_M)/T.METRES_PER_DEGREE,s=o/Math.cos(t.lat*Math.PI/180),[n,a]=await Promise.all([this.lenses(t,e),this.roads.getRoads({south:t.lat-o,north:t.lat+o,west:t.lng-s,east:t.lng+s})]);return T.signalsFrom(n,a,t)}async lenses(t,e){const o=[];for(let s=0;s<T.MAX_PAGES;s++){const n=await this.fetchImpl(T.query(t,e,T.PAGE,s*T.PAGE));if(!n.ok)throw new Error(`opendata.paris.fr refused (${n.status})`);const a=(await n.json()).results??[];if(o.push(...a),a.length<T.PAGE)break}return o}static query(t,e,o,s){const n=`geom'POINT(${t.lng.toFixed(6)} ${t.lat.toFixed(6)})'`,a=new URLSearchParams({select:"geo_point_2d,lib_regime",where:`within_distance(geo_point_2d,${n},${Math.round(e)}m)`,order_by:`distance(geo_point_2d,${n})`,limit:String(o),offset:String(s)});return`${T.ENDPOINT}?${a}`}static signalsFrom(t,e,o){const s=Math.cos(o.lat*Math.PI/180),n=(h,c)=>[(c-o.lng)*T.METRES_PER_DEGREE*s,(h-o.lat)*T.METRES_PER_DEGREE],a=[];for(const h of t){if(!h.geo_point_2d)continue;const c=n(h.geo_point_2d.lat,h.geo_point_2d.lon),l=(h.lib_regime??"").toUpperCase(),f=/ROUGE|JAUNE|VERT/.test(l),M=/PASSEZ|ATTENDEZ/.test(l);if(!f&&!M)continue;let d=a.find(g=>Math.hypot(g.at[0]-c[0],g.at[1]-c[1])<T.SAME_POST_M);d||a.push(d={at:c,vehicles:0,pedestrians:0}),f&&d.vehicles++,M&&d.pedestrians++}const r=e.map(h=>({way:h,points:h.points.map(c=>n(c.lat,c.lng))})),i=[];for(const h of a){const c=T.nearestRoad(h.at,r);if(!c)continue;const[l,f]=c.unit,M=T.heading(c.unit),d=(h.at[0]-c.foot[0])*f-(h.at[1]-c.foot[1])*l>=0,g=c.way.direction,m=g==="forward"?M:g==="backward"?(M+180)%360:d?M:(M+180)%360,E=w=>Math.round(w*10)/10,v=w=>E((w%360+360)%360);if(h.vehicles>0&&i.push({eastM:E(h.at[0]),northM:E(h.at[1]),headingDeg:v(m+180),for:"vehicles",phase:j.phaseOf(m)}),h.pedestrians>0){const w=T.heading([c.foot[0]-h.at[0],c.foot[1]-h.at[1]]),p=h.vehicles>0?T.PEDESTRIAN_ALONG_M:0;i.push({eastM:E(h.at[0]+l*p),northM:E(h.at[1]+f*p),headingDeg:v(Number.isNaN(w)?M+90:w),for:"pedestrians",phase:j.phaseOf(M)})}}return i.sort((h,c)=>Math.hypot(h.eastM,h.northM)-Math.hypot(c.eastM,c.northM)).slice(0,T.MAX)}static nearestRoad(t,e){let o;for(const{way:s,points:n}of e)for(let a=1;a<n.length;a++){const[r,i]=n[a-1],[h,c]=n[a],l=Math.hypot(h-r,c-i);if(l===0)continue;const f=[(h-r)/l,(c-i)/l],M=Math.max(0,Math.min(l,(t[0]-r)*f[0]+(t[1]-i)*f[1])),d=[r+f[0]*M,i+f[1]*M],g=Math.hypot(t[0]-d[0],t[1]-d[1]);g<=T.SEARCH_M&&(!o||g<o.distance)&&(o={way:s,unit:f,foot:d,distance:g})}return o}static heading([t,e]){return t===0&&e===0?Number.NaN:Math.round((Math.atan2(t,e)*180/Math.PI+360)%360*10)/10}}const K=B.point("surroundings").provide(B.BUILT_IN,[{id:"ign-lidar-topo",name:"IGN LiDAR HD + BD TOPO",credit:"© IGN, LiDAR HD and BD TOPO, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/lidarhd",create:()=>new I(new F({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"ign-lidar-hd",name:"IGN LiDAR HD",credit:"© IGN, LiDAR HD, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/lidarhd",create:()=>new I(new nt({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"ign-bd-topo",name:"IGN BD TOPO",credit:"© IGN, BD TOPO, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/bdtopo",create:()=>new I(new at({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"osm-buildings",name:"OpenStreetMap buildings",credit:"Buildings and street lamps © OpenStreetMap contributors (ODbL)",creditUrl:"https://www.openstreetmap.org/copyright",create:()=>new I(new W({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))}]);class U{static DEFAULT_ID=K[0].id;static WORLD_ID="osm-buildings";static TOWN_LAMPS=[new L];static TOWN_SIGNALS=[new T(new st)];static NONE="none";static byId(t){return t===U.NONE?void 0:K.find(e=>e.id===t)??K[0]}static providerFor(t,e,o){const s=U.byId(t)?.create();if(t!==void 0&&t!==U.DEFAULT_ID)return s?.covers(e,o)?s:void 0;const n=K.find(r=>r.id===U.WORLD_ID).create(),a=[s,n].filter(r=>r!==void 0&&r.covers(e,o));return a.length>1?new ot(a):a[0]}}export{K as SURROUNDINGS_SOURCES,U as SurroundingsSources};
|
|
1
|
+
import{t as V,O as tt,u as q,T as j,v as C,w as X,x as et,y as st,M as B}from"./rr0-sighting-editor.mjs";class I{constructor(t){this.survey=t}static CACHE_NAME="rr0-surroundings";static MAX_AGE_MS=720*3600*1e3;static FORMAT=8;static MAX_STORED=400;static asked=new Map;get id(){return this.survey.id}get name(){return this.survey.name}get attribution(){return this.survey.attribution}get creditUrl(){return this.survey.creditUrl}get contemporary(){return this.survey.contemporary}covers(t,e){return this.survey.covers(t,e)}async getSurroundings(t,e){const o=I.key(this.survey.id,t,e);let s=I.asked.get(o);return s===void 0&&(s=this.recalled(o,t,e),I.asked.set(o,s),s.catch(()=>I.asked.delete(o))),structuredClone(await s)}later(t,e){const o=this.survey.later?.(t,e);if(!o)return;const s=I.key(this.survey.id,t,e);return o.then(n=>{const a=I.partial.get(s);if(a){I.partial.delete(s);const{incomplete:r,...i}=a,h=[...a.credits??[],...n.credits??[]].filter((l,f,M)=>M.findIndex(d=>d.url===l.url)===f),c={...i,...n,dates:{...a.dates,...n.dates},...h.length>0?{credits:h}:{}};I.asked.set(s,Promise.resolve(c)),I.openCache().then(l=>l&&I.store(l,I.request(s),c))}return structuredClone(n)})}static partial=new Map;static forget(){I.partial.clear(),I.asked.clear()}static key(t,e,o){return`${t}/v${I.FORMAT}/${e.lat.toFixed(5)}/${e.lng.toFixed(5)}/${Math.round(o)}`}async recalled(t,e,o){const s=await I.openCache(),n=I.request(t);if(s)try{const r=await s.match(n);if(r){const{savedAt:i,surroundings:h}=await r.json();if(Date.now()-i<I.MAX_AGE_MS)return h;await s.delete(n)}}catch{}const a=await this.survey.getSurroundings(e,o);return a.incomplete?(I.asked.delete(t),I.partial.set(t,structuredClone(a)),a):(s&&I.store(s,n,a),a)}static async store(t,e,o){try{const s={savedAt:Date.now(),surroundings:o};await t.put(e,new Response(JSON.stringify(s),{headers:{"Content-Type":"application/json"}}));const n=await t.keys();for(const a of n.slice(0,Math.max(0,n.length-I.MAX_STORED)))await t.delete(a)}catch{}}static async openCache(){try{return typeof caches>"u"?void 0:await caches.open(I.CACHE_NAME)}catch{return}}static request(t){const e=typeof location>"u"?"http://localhost":location.origin;return new Request(`${e}/__surroundings__/${encodeURIComponent(t)}`)}}class ot{constructor(t){if(this.candidates=t,t.length===0)throw new Error("A survey needs at least one candidate");this.current=t[0]}current;get id(){return this.current.id}get name(){return this.current.name}get attribution(){return this.current.attribution}get creditUrl(){return this.current.creditUrl}get contemporary(){return this.current.contemporary}covers(t,e){return this.candidates.some(o=>o.covers(t,e))}async getSurroundings(t,e){let o;for(const s of this.candidates)if(s.covers(t.lat,t.lng))try{const n=await s.getSurroundings(t,e);return this.current=s,n}catch(n){if(o??=n,!(n instanceof V))throw n}throw o??new V("no-coverage","No survey reaches this place")}later(t,e){return this.current.later?.(t,e)}}class D{constructor(t,e,o,s){this.heights=t,this.building=e,this.width=o,this.height=s}static ROOF_PERCENTILE=.9;static STEP_M=.9;static RECTANGLE_FILL=.72;static MIN_DEPTH_M=2.5;static MAX_PARTS=24;static MAX_CELLS=640;buildings(t){const e=t.metresPerPixel,o=t.minAreaM2??12,s=new Uint8Array(this.width*this.height),n=[];for(let a=0;a<this.building.length;a++){if(!this.building[a]||s[a])continue;const r=this.patchFrom(a,s);if(!(r.length*e*e<o))for(const i of this.buildingsOf(r,e,o))Math.hypot(i.eastM,i.northM)<=t.radiusM&&n.push(i)}return n.sort((a,r)=>Math.hypot(a.eastM,a.northM)-Math.hypot(r.eastM,r.northM)),n.slice(0,t.maxBuildings??60)}patchFrom(t,e){const o=[],s=[t];for(e[t]=1;s.length>0;){const n=s.pop();o.push(n);const a=n%this.width,r=Math.floor(n/this.width);for(const[i,h]of[[1,0],[-1,0],[0,1],[0,-1]]){const c=a+i,l=r+h;if(c<0||l<0||c>=this.width||l>=this.height)continue;const f=l*this.width+c;this.building[f]&&!e[f]&&Math.abs(this.heights[f]-this.heights[n])<=D.STEP_M&&(e[f]=1,s.push(f))}}return o}buildingsOf(t,e,o){const s=this.width/2,n=this.height/2,a=[],r=[],i=[];for(const h of t){const c=h%this.width,l=Math.floor(h/this.width);a.push((c+.5-s)*e),r.push((n-l-.5)*e),i.push(this.heights[h])}return D.ofPoints(a,r,i,e,o)}static ofPoints(t,e,o,s,n,a=D.RECTANGLE_FILL,r=[]){const i=[];for(let m=0;m<t.length;m++)for(const[E,v]of[[-.5,-.5],[.5,-.5],[-.5,.5],[.5,.5]])i.push([t[m]+E*s,e[m]+v*s]);const h=D.hull(i),{angle:c,rectangle:l}=D.smallestRectangle(h),f=t.length*s*s,M=(l.maxU-l.minU)*(l.maxV-l.minV);if(f/M>=a||f<4*n)return[D.building(l,c,D.roof(o))];const d=h.map((m,E)=>({from:{east:m[0],north:m[1]},to:{east:h[(E+1)%h.length][0],north:h[(E+1)%h.length][1]}})),g=D.dominantAngles([...r,...d]);return D.parts(t,e,o,g.length>0?g:[c],s,n)}static dominantAngles(t,e=3){const o=new Map;for(const s of t){const n=Math.hypot(s.to.east-s.from.east,s.to.north-s.from.north);if(n<1e-6)continue;const a=(Math.atan2(s.to.north-s.from.north,s.to.east-s.from.east)%(Math.PI/2)+Math.PI/2)%(Math.PI/2),r=Math.round(a/(Math.PI/60));o.set(r,(o.get(r)??0)+n)}return[...o.entries()].sort((s,n)=>n[1]-s[1]).slice(0,e).map(([s])=>s*Math.PI/60)}static parts(t,e,o,s,n,a){let r=t.map((h,c)=>c);const i=[];for(let h=0;h<D.MAX_PARTS&&r.length>0;h++){let c;for(const M of s){const d=D.largestIn(t,e,r,M,n);d&&(c===void 0||d.area>c.area)&&(c=d)}if(c===void 0||c.area<a)break;const l=c.covered;Math.min(c.rectangle.maxU-c.rectangle.minU,c.rectangle.maxV-c.rectangle.minV)>=D.MIN_DEPTH_M&&i.push(D.building(c.rectangle,c.angle,D.roof([...l].map(M=>o[M])))),r=r.filter(M=>!l.has(M))}return i}static largestIn(t,e,o,s,n){const a=Math.cos(s),r=Math.sin(s);let i=1/0,h=-1/0,c=1/0,l=-1/0;const f=[],M=[];for(const A of o){const y=t[A]*a+e[A]*r,R=-t[A]*r+e[A]*a;f.push(y),M.push(R),i=Math.min(i,y),h=Math.max(h,y),c=Math.min(c,R),l=Math.max(l,R)}const d=Math.max(n*Math.SQRT2,Math.max(h-i,l-c)/D.MAX_CELLS),g=Math.max(1,Math.ceil((h-i)/d+1e-9)),m=Math.max(1,Math.ceil((l-c)/d+1e-9)),E=new Uint8Array(g*m),v=o.map((A,y)=>{const R=Math.min(g-1,Math.max(0,Math.floor((f[y]-i)/d))),x=Math.min(m-1,Math.max(0,Math.floor((M[y]-c)/d)));return E[x*g+R]=1,x*g+R}),w=D.largestRectangle(E,g,m);if(w===void 0)return;const p=new Set;return o.forEach((A,y)=>{const R=v[y]%g,x=Math.floor(v[y]/g);R>=w.column&&R<w.column+w.columns&&x>=w.row&&x<w.row+w.rows&&p.add(A)}),{area:w.area*d*d,angle:s,covered:p,rectangle:{minU:i+w.column*d,maxU:i+(w.column+w.columns)*d,minV:c+w.row*d,maxV:c+(w.row+w.rows)*d}}}static largestRectangle(t,e,o){const s=new Array(e).fill(0);let n;for(let a=0;a<o;a++){for(let i=0;i<e;i++)s[i]=t[a*e+i]?s[i]+1:0;const r=[];for(let i=0;i<=e;i++){const h=i===e?0:s[i];for(;r.length>0&&s[r[r.length-1]]>=h;){const c=r.pop(),l=r.length===0?i:i-r[r.length-1]-1,f=s[c]*l;(n===void 0||f>n.area)&&(n={column:i-l,row:a-s[c]+1,columns:l,rows:s[c],area:f})}r.push(i)}}return n}static roof(t){const e=[...t].sort((o,s)=>o-s);return Math.max(2,e[Math.min(e.length-1,Math.floor(e.length*D.ROOF_PERCENTILE))])}static building(t,e,o){const s=Math.cos(e),n=Math.sin(e),a=t.maxU-t.minU,r=t.maxV-t.minV,i=(t.minU+t.maxU)/2,h=(t.minV+t.maxV)/2,l=((90-(a<r?e:e+Math.PI/2)*180/Math.PI)%180+180)%180;return{eastM:D.tenth(i*s-h*n),northM:D.tenth(i*n+h*s),widthM:D.tenth(Math.max(a,r)),lengthM:D.tenth(Math.min(a,r)),heightM:D.tenth(o),headingDeg:Math.round(l*10)/10}}static smallestRectangle(t){let e={area:1/0,angle:0,rectangle:{minU:0,maxU:0,minV:0,maxV:0}};for(let o=0;o<Math.max(1,t.length);o++){const[s,n]=t[o]??[0,0],[a,r]=t[(o+1)%t.length]??[1,0],i=Math.atan2(r-n,a-s),h=Math.cos(i),c=Math.sin(i);let l=1/0,f=-1/0,M=1/0,d=-1/0;for(const[m,E]of t){const v=m*h+E*c,w=-m*c+E*h;l=Math.min(l,v),f=Math.max(f,v),M=Math.min(M,w),d=Math.max(d,w)}const g=(f-l)*(d-M);g<e.area&&(e={area:g,angle:i,rectangle:{minU:l,maxU:f,minV:M,maxV:d}})}return e}static hull(t){const e=[...t].sort((r,i)=>r[0]-i[0]||r[1]-i[1]),o=e.filter((r,i)=>i===0||r[0]!==e[i-1][0]||r[1]!==e[i-1][1]);if(o.length<3)return o;const s=(r,i,h)=>(i[0]-r[0])*(h[1]-r[1])-(i[1]-r[1])*(h[0]-r[0]),n=[];for(const r of o){for(;n.length>=2&&s(n[n.length-2],n[n.length-1],r)<=0;)n.pop();n.push(r)}const a=[];for(const r of[...o].reverse()){for(;a.length>=2&&s(a[a.length-2],a[a.length-1],r)<=0;)a.pop();a.push(r)}return[...n.slice(0,-1),...a.slice(0,-1)]}static tenth(t){return Math.round(t*10)/10}}class H{constructor(t,e,o,s){this.heights=t,this.vegetation=e,this.width=o,this.height=s}static SUMMIT_RADIUS_M=2.5;static CROWN_REACH_M=8;static MAX_WIDTH_M=16;static MIN_WIDTH_M=2;static tenth(t){return Math.round(t*10)/10}trees(t){const e=t.metresPerPixel,o=t.minHeightM??4,s=t.eyeM??1.6,n=t.minElevationDeg??2,a=Math.max(1,Math.round(H.SUMMIT_RADIUS_M/e)),r=Math.round(H.CROWN_REACH_M/e),i=this.width/2,h=this.height/2,c=[];for(let l=0;l<this.height;l++)for(let f=0;f<this.width;f++){const M=this.canopy(f,l);if(M<o)continue;const d=(f+.5-i)*e,g=(h-l-.5)*e,m=Math.hypot(d,g);if(m>t.radiusM||!this.isSummit(f,l,M,a))continue;const E=Math.atan2(M-s,Math.max(m,1))*180/Math.PI;E<n||c.push({tree:{eastM:H.tenth(d),northM:H.tenth(g),heightM:H.tenth(M),widthM:H.tenth(this.crownWidth(f,l,M,e,r))},elevation:E})}return c.sort((l,f)=>f.elevation-l.elevation),c.slice(0,t.maxTrees??150).map(l=>l.tree)}canopy(t,e){if(t<0||e<0||t>=this.width||e>=this.height)return 0;const o=e*this.width+t;return this.vegetation[o]?this.heights[o]:0}isSummit(t,e,o,s){for(let n=-s;n<=s;n++)for(let a=-s;a<=s;a++){if(a===0&&n===0)continue;const r=this.canopy(t+a,e+n);if(r>o||r===o&&(n<0||n===0&&a<0))return!1}return!0}crownWidth(t,e,o,s,n){let a=0;for(let i=-n;i<=n;i++)for(let h=-n;h<=n;h++)Math.hypot(h,i)*s<=H.CROWN_REACH_M&&this.canopy(t+h,e+i)>=o*.5&&a++;const r=2*Math.sqrt(a*s*s/Math.PI);return Math.max(H.MIN_WIDTH_M,Math.min(r,H.MAX_WIDTH_M))}}class _{static WALLS={1:"stone",2:"meuliere",3:"concrete",4:"brick",5:"block",6:"wood",9:"other"};static ROOFS={1:"tile",2:"slate",3:"zinc",4:"concrete",9:"other"};static WALL_COLOURS={stone:"#b9ae9b",meuliere:"#b8a78a",concrete:"#b4b2ac",brick:"#a65f48",block:"#d0c6b2",wood:"#7d5c3e",other:"#c9c0ae"};static PLASTER="#d3cab8";static ROOF_COLOURS={tile:"#a0583f",slate:"#4a5059",zinc:"#8d969c",concrete:"#8f8e8a",other:"#7a7872"};static VARIATION=.12;static OLD_ROOF="#7d858c";static OLD_STOREY_M=3.6;static GRAND_STOREY_M=4.5;static MIN_STOREY_M=2.4;static MAX_STOREY_M=6;static of(t,e){const o=String(t??"").trim();if(!/^\d{1,2}$/.test(o))return;const s=Number(o),n=s%10!==0?s%10:Math.floor(s/10);return(e==="wall"?_.WALLS:_.ROOFS)[String(n)]}static roofColor(t){return t?_.ROOF_COLOURS[t]:void 0}static fit(t){return t.map(e=>{const o=e.style,s={...e.facade,color:e.facade?.color??_.wallColor(e)};o==="church"?s.openings="lancet":o==="monument"||o==="works"?s.openings="plain":(o==="old"||o==="grand")&&(s.openings="tall"),e.closedAtNight&&s.openings!=="plain"&&(s.closedAtNight=!0);const n=_.storeyOf(e);n!==void 0&&o!=="church"&&o!=="monument"&&(s.storeyM=n);const a=o==="old"&&e.roof?.color===void 0?{shape:"flat",riseM:0,...e.roof,color:_.OLD_ROOF}:e.roof;return{...e,facade:s,...a?{roof:a}:{}}})}static storeyOf(t){const e=t.heightM-(t.roof?.riseM??0);if(t.floors&&t.floors>0){const o=e/t.floors;if(o>=_.MIN_STOREY_M&&o<=_.MAX_STOREY_M)return Math.round(o*100)/100}return t.style==="old"?_.OLD_STOREY_M:t.style==="grand"?_.GRAND_STOREY_M:void 0}static wallColor(t){const e=t.style==="church"||t.style==="monument"||t.style==="old",o=t.wallMaterial?_.WALL_COLOURS[t.wallMaterial]:e?_.WALL_COLOURS.stone:_.PLASTER,s=Math.sin(t.eastM*12.9898+t.northM*78.233)*43758.5453,n=1+(s-Math.floor(s)-.5)*2*_.VARIATION,a=r=>Math.max(0,Math.min(255,Math.round(parseInt(o.slice(r,r+2),16)*n))).toString(16).padStart(2,"0");return`#${a(1)}${a(3)}${a(5)}`}}class N{static MIN_RISE_M=1.2;static MIN_EAVES_M=2.5;static MIN_SEEN=.35;static NO_DATA=-9999;static BANDS=7;static INSET_M=.9;static LIFT=1.18;static PEAK=.3;static LEVEL=.45;static fit(t,e,o){return!e&&!o&&!t.some(s=>s.roofMaterial)?t:t.map(s=>{const n=e?N.shapeOf(s,e):void 0,a=(o?N.colorOf(s,o):void 0)??_.roofColor(s.roofMaterial);if(!n&&!a)return s;const r={shape:n?.shape??"flat",...n?.ridge==="depth"?{ridge:"depth"}:{},riseM:n?.riseM??0,...a?{color:a}:{}},i=n&&n.shape!=="flat"?n.topM:s.heightM;return{...s,heightM:i,roof:r}})}static world(t,e,o){const s=t.headingDeg*Math.PI/180;return{east:t.eastM+e*Math.cos(s)+o*Math.sin(s),north:t.northM-e*Math.sin(s)+o*Math.cos(s)}}static shapeOf(t,e){const o=N.BANDS,s=Math.max(e.metresPerPixel,.5),n=t.widthM/2-N.INSET_M,a=t.lengthM/2-N.INSET_M;if(n<=0||a<=0)return;const r=[],i=Array.from({length:o},()=>({sum:0,n:0})),h=Array.from({length:o},()=>({sum:0,n:0}));let c=0;for(let y=-n;y<=n;y+=s)for(let R=-a;R<=a;R+=s){c++;const{east:x,north:$}=N.world(t,y,R),z=Math.floor(x/e.metresPerPixel+e.size/2),Y=Math.floor(e.size/2-$/e.metresPerPixel);if(z<0||Y<0||z>=e.size||Y>=e.size)continue;const k=Y*e.size+z,P=e.heights[k];if(e.vegetation[k]||P===N.NO_DATA||!(P>0))continue;r.push(P);const J=i[Math.min(o-1,Math.floor((y+n)/(2*n)*o))],Q=h[Math.min(o-1,Math.floor((R+a)/(2*a)*o))];J.sum+=P,J.n++,Q.sum+=P,Q.n++}if(c===0||r.length/c<N.MIN_SEEN)return;r.sort((y,R)=>y-R);const l=N.percentile(r,.08),f=N.percentile(r,.92),M=f-l;if(l<N.MIN_EAVES_M||M>Math.min(t.widthM,t.lengthM))return;if(M<N.MIN_RISE_M)return{shape:"flat",riseM:0,topM:f};const d=N.profile(i),g=N.profile(h);if(!d||!g)return;const m=N.peak(g)/M,E=N.peak(d)/M,v=N.spread(d)/M,w=N.spread(g)/M,p=m>=N.PEAK&&v<=N.LEVEL,A=E>=N.PEAK&&w<=N.LEVEL;if(p&&(!A||m>=E))return{shape:"gable",ridge:"width",riseM:M,topM:f};if(A)return{shape:"gable",ridge:"depth",riseM:M,topM:f};if(m>=N.PEAK&&E>=N.PEAK/2)return{shape:"hip",ridge:"width",riseM:M,topM:f}}static profile(t){const e=t.map(o=>o.n>0?o.sum/o.n:NaN);return e.filter(Number.isFinite).length>=t.length-1?e.map((o,s)=>Number.isFinite(o)?o:N.neighbour(e,s)):void 0}static neighbour(t,e){return Number.isFinite(t[e-1])?t[e-1]:t[e+1]}static peak(t){const e=Math.max(1,Math.floor(t.length/3)),o=n=>n.reduce((a,r)=>a+r,0)/n.length,s=[...t.slice(0,e),...t.slice(t.length-e)];return o(t.slice(e,t.length-e))-o(s)}static spread(t){return Math.max(...t)-Math.min(...t)}static percentile(t,e){return t[Math.min(t.length-1,Math.floor(t.length*e))]}static colorOf(t,e){const o=Math.max(e.metresPerPixel,.5),s=Math.max(t.widthM/2-N.INSET_M,o),n=Math.max(t.lengthM/2-N.INSET_M,o),a=[],r=[],i=[];for(let l=-s;l<=s;l+=o)for(let f=-n;f<=n;f+=o){const{east:M,north:d}=N.world(t,l,f),g=Math.floor(M/e.metresPerPixel+e.size/2),m=Math.floor(e.size/2-d/e.metresPerPixel);if(g<0||m<0||g>=e.size||m>=e.size)continue;const E=(m*e.size+g)*e.samples,v=e.values[E],w=e.values[E+1],p=e.values[E+2];w>v&&w>p||(a.push(v),r.push(w),i.push(p))}if(a.length===0)return;const h=l=>l.sort((f,M)=>f-M)[Math.floor(l.length/2)],c=l=>Math.min(255,Math.round(l*N.LIFT)).toString(16).padStart(2,"0");return`#${c(h(a))}${c(h(r))}${c(h(i))}`}}class G{static DEFAULT_HEIGHT_M=6;static METRES_PER_DEGREE=111320;static STREET_SPACING_M=35;static KERB_OFFSET_M=1;static DEFAULT_WIDTH_M=5.5;static PATIENCE_MS=15e3;static MAX=150;static lampsFrom(t,e,o){const s=[],n=new Set;for(const r of t.elements??[]){if(r.id!==void 0){const l=`${r.type}/${r.id}`;if(n.has(l))continue;n.add(l)}if(r.type==="way"){r.tags?.lit==="yes"&&G.alongStreet(r,e,s);continue}if(r.tags?.highway!=="street_lamp"||typeof r.lat!="number"||typeof r.lon!="number")continue;const i=(r.lon-e.lng)*G.METRES_PER_DEGREE*Math.cos(e.lat*Math.PI/180),h=(r.lat-e.lat)*G.METRES_PER_DEGREE;if(Math.hypot(i,h)>o)continue;const c=Number.parseFloat(r.tags?.height??"");s.push({eastM:Math.round(i*10)/10,northM:Math.round(h*10)/10,...Number.isFinite(c)&&c>=2&&c<=20?{heightM:c}:{}})}const a=s.filter(r=>Math.hypot(r.eastM,r.northM)<=o);return s.length=0,s.push(...a),s.sort((r,i)=>Math.hypot(r.eastM,r.northM)-Math.hypot(i.eastM,i.northM)),s.slice(0,G.MAX)}static alongStreet(t,e,o){const s=t.geometry;if(!s||s.length<2)return;const n=d=>[(d.lon-e.lng)*G.METRES_PER_DEGREE*Math.cos(e.lat*Math.PI/180),(d.lat-e.lat)*G.METRES_PER_DEGREE],a=s.map(n),r=Number.parseFloat(t.tags?.width??""),i=Number.parseInt(t.tags?.lanes??"",10),c=(Number.isFinite(r)&&r>0?r:Number.isFinite(i)&&i>0?i*3.5:G.DEFAULT_WIDTH_M)/2+G.KERB_OFFSET_M;let l=1,f=G.STREET_SPACING_M/2,M=0;for(let d=1;d<a.length;d++){const[g,m]=a[d-1],[E,v]=a[d],w=Math.hypot(E-g,v-m);if(w===0)continue;const p=(E-g)/w,A=(v-m)/w;for(;f<=M+w;f+=G.STREET_SPACING_M){const y=f-M;o.push({eastM:Math.round((g+p*y+A*c*l)*10)/10,northM:Math.round((m+A*y-p*c*l)*10)/10,supposed:!0}),l=-l}M+=w}}}class u{constructor(t={},e=[],o=[]){this.lampSources=e,this.signalSources=o,this.client=new tt(t)}static METRES_PER_DEGREE=111320;static KERB_OFFSET_M=.6;static SETBACK_M=.5;static MIN_CROSSING_M=3;static MAX_CROSSING_M=30;static SAME_CROSSING_M=5;static SAME_HEAD_M=2.5;static SAME_HEAD_DEG=45;static MAX_SIGNALS=160;static MAX_CROSSINGS=150;static MAX_SIGNS=100;static ROADS=new Set([...q.DRIVABLE,"living_street","busway","road"]);static ON_ROAD="^(traffic_signals|crossing|stop|give_way)$";static CREDIT={name:"OpenStreetMap",url:"https://www.openstreetmap.org/copyright",licence:"ODbL"};client;local(t,e){const o=u.boxOf(t,e),s=(r,i)=>{if(!r)return Promise.resolve(void 0);const h=`${r.credit.url} ${o}`;let c=u.localPending.get(h);return c||(c=i().then(l=>({credit:r.credit,found:l}),()=>{u.localPending.delete(h)}),u.localPending.set(h,c)),c},n=this.lampSources.find(r=>r.covers(t.lat,t.lng)),a=this.signalSources.find(r=>r.covers(t.lat,t.lng));return Promise.all([s(n,()=>n.lampsNear(t,e)),s(a,()=>a.signalsNear(t,e))]).then(([r,i])=>({lamps:r,signals:i}))}static localPending=new Map;static withLocal(t,e){const o=e?.lamps?e.lamps.found:t.lamps,s=e?.signals?e.signals.found:t.signals,a=[...u.found({crossings:t.crossings,signs:t.signs,...e?.lamps?{}:{lamps:o},...e?.signals?{}:{signals:s}})?[u.CREDIT]:[],...e?.lamps&&e.lamps.found.length>0?[e.lamps.credit]:[],...e?.signals&&e.signals.found.length>0?[e.signals.credit]:[]],{lamps:r,signals:i,credits:h,...c}=t;return{...c,...o?.length?{lamps:o}:{},...s?.length?{signals:s}:{},...a.length>0?{credits:a}:{}}}static today(){return new Date().toISOString().slice(0,10)}static later(t,e,o){return t?.answered(e,o).then(s=>({...s,...u.found(s)?{dates:{lamps:u.today()}}:{}}))}static found(t){return!!(t?.lamps?.length||t?.signals?.length||t?.crossings?.length||t?.signs?.length)}static query(t){const e=u.ON_ROAD;return`[out:json][timeout:25];(node["highway"="street_lamp"](${t});way["highway"]["lit"="yes"](${t});node["highway"~"${e}"](${t});node["traffic_sign"](${t});way["footway"="crossing"](${t}););out geom;(node._["highway"~"${e}"];node._["traffic_sign"];)->.kerb;way(bn.kerb)["highway"];out geom;`}static pending=new Map;async near(t,e){const o=this.ask(u.boxOf(t,e)),s=this.local(t,e);let n;const a=Symbol("late"),r=new Promise(i=>{n=setTimeout(()=>i(a),G.PATIENCE_MS)});try{const[i,h]=await Promise.all([Promise.race([o,r]),Promise.race([s,r])]),c=h===a?void 0:h;return i===a||i===void 0?{...u.withLocal({},c),incomplete:!0}:u.withLocal(u.from(i,t,e),c)}finally{clearTimeout(n)}}static RETRY_DELAYS_MS=[15e3,6e4,18e4,6e5];async answered(t,e){const o=u.boxOf(t,e);for(let s=0;;s++){const n=await this.ask(o);if(n)return u.withLocal(u.from(n,t,e),await this.local(t,e));if(s>=u.RETRY_DELAYS_MS.length)throw new Error("Overpass did not answer");await new Promise(a=>setTimeout(a,u.RETRY_DELAYS_MS[s]))}}ask(t){let e=u.pending.get(t);return e||(e=this.client.query(u.query(t)).catch(()=>{u.pending.delete(t)}),u.pending.set(t,e)),e}static boxOf(t,e){const o=e/u.METRES_PER_DEGREE,s=e/(u.METRES_PER_DEGREE*Math.cos(t.lat*Math.PI/180));return[t.lat-o,t.lng-s,t.lat+o,t.lng+s].map(n=>n.toFixed(6)).join(",")}static forget(){u.pending.clear(),u.localPending.clear()}static from(t,e,o){const s=G.lampsFrom(t,e,o),n=Math.cos(e.lat*Math.PI/180),a=(p,A)=>[(A-e.lng)*u.METRES_PER_DEGREE*n,(p-e.lat)*u.METRES_PER_DEGREE],r=(p,A)=>`${p.toFixed(7)},${A.toFixed(7)}`,i=new Map,h=new Set,c=[],l=[];for(const p of t.elements??[]){if(p.type==="node"){typeof p.lat=="number"&&typeof p.lon=="number"&&l.push(p);continue}if(p.type!=="way"||!p.geometry||p.geometry.length<2)continue;if(p.id!==void 0){if(h.has(p.id))continue;h.add(p.id)}const A=p.tags??{};if(A.footway==="crossing"&&c.push(p),!u.ROADS.has(A.highway??""))continue;const y=p.geometry.map(R=>a(R.lat,R.lon));p.geometry.forEach((R,x)=>{const $=r(R.lat,R.lon);i.set($,[...i.get($)??[],{way:p,points:y,index:x}])})}const f=[],M=[],d=[],g=new Set;for(const p of l){if(p.id!==void 0){if(g.has(p.id))continue;g.add(p.id)}const A=p.tags??{},y=a(p.lat,p.lon),R=i.get(r(p.lat,p.lon))??[],x=A.highway;if(x==="traffic_signals")for(const k of u.approaches(R,u.directionOf(A),!1))f.push(u.head(y,k,"vehicles"));if(x==="crossing"||x==="traffic_signals"&&A.crossing!==void 0){const k=R[0];if(k&&u.marked(A)){const P=u.directionAt(k);P&&M.push({eastM:u.round(y[0]),northM:u.round(y[1]),headingDeg:u.heading(P),widthM:q.widthOf(k.way.tags??{})}),P&&(A.crossing==="traffic_signals"||A["crossing:signals"]==="yes")&&f.push(...u.pedestrianHeads(y,P,k))}}if(x==="traffic_signals")continue;const $=x==="stop"?{face:"stop"}:x==="give_way"?{face:"give-way"}:u.faceOf(A);if(!$)continue;const z=A.traffic_sign?{code:A.traffic_sign}:{};if(R.length>0){const k=u.approaches(R,u.directionOf(A),!0)[0];if(k){const P=u.head(y,k,"vehicles");d.push({eastM:P.eastM,northM:P.northM,headingDeg:P.headingDeg,...$,...z})}continue}const Y=u.compassOf(A.direction);Y!==void 0&&d.push({eastM:u.round(y[0]),northM:u.round(y[1]),headingDeg:(Y+180)%360,...$,...z})}for(const p of c){const A=u.crossingAlong(p,a);A&&!M.some(y=>Math.hypot(y.eastM-A.eastM,y.northM-A.northM)<u.SAME_CROSSING_M)&&M.push(A)}const m=f.filter((p,A)=>!f.slice(0,A).some(y=>y.for===p.for&&Math.hypot(y.eastM-p.eastM,y.northM-p.northM)<u.SAME_HEAD_M&&Math.abs((y.headingDeg-p.headingDeg+540)%360-180)<u.SAME_HEAD_DEG)),E=(p,A)=>p.filter(y=>Math.hypot(y.eastM,y.northM)<=o).sort((y,R)=>Math.hypot(y.eastM,y.northM)-Math.hypot(R.eastM,R.northM)).slice(0,A),v={};s.length>0&&(v.lamps=s);const w={signals:E(m,u.MAX_SIGNALS),crossings:E(M,u.MAX_CROSSINGS),signs:E(d,u.MAX_SIGNS)};return w.signals.length>0&&(v.signals=w.signals),w.crossings.length>0&&(v.crossings=w.crossings),w.signs.length>0&&(v.signs=w.signs),v}static approaches(t,e,o){const s=[];for(const a of t){const r=a.way.tags??{},i=r.oneway==="yes"||r.oneway==="true"||r.oneway==="1"||r.junction==="roundabout"||r.highway==="motorway",h=r.oneway==="-1",{points:c,index:l}=a,f=(d,g)=>{let m=0;for(let E=Math.min(d,g);E<Math.max(d,g);E++)m+=Math.hypot(c[E+1][0]-c[E][0],c[E+1][1]-c[E][1]);return m},M=d=>{const g=c[l][0]-c[d][0],m=c[l][1]-c[d][1],E=Math.hypot(g,m);return E>0?[g/E,m/E]:void 0};if(l>0&&!h){const d=M(l-1);d&&s.push({approach:{unit:d,road:a},toEndM:f(l,c.length-1),forward:!0})}if(l<c.length-1&&!i){const d=M(l+1);d&&s.push({approach:{unit:d,road:a},toEndM:f(0,l),forward:!1})}}const n=e!==void 0&&t.length===1?s.filter(a=>a.forward===(e==="forward")):s;return!o||n.length<=1?n.map(a=>a.approach):[n.reduce((a,r)=>r.toEndM<a.toEndM?r:a).approach]}static head(t,e,o){const[s,n]=e.unit,a=q.widthOf(e.road.way.tags??{})/2+u.KERB_OFFSET_M,r=u.SETBACK_M,i=u.heading(e.unit);return{eastM:u.round(t[0]-s*r+n*a),northM:u.round(t[1]-n*r-s*a),headingDeg:(i+180)%360,for:o,phase:j.phaseOf(i)}}static pedestrianHeads(t,e,o){const s=q.widthOf(o.way.tags??{})/2+u.KERB_OFFSET_M,n=u.heading(e),a=j.phaseOf(n);return[1,-1].map(r=>({eastM:u.round(t[0]+e[1]*s*r),northM:u.round(t[1]-e[0]*s*r),headingDeg:(n+(r===1?270:90))%360,for:"pedestrians",phase:a}))}static crossingAlong(t,e){if(!u.marked(t.tags??{}))return;const o=t.geometry.map(h=>e(h.lat,h.lon)),[s,n]=o[0],[a,r]=o[o.length-1],i=Math.hypot(a-s,r-n);if(!(i<u.MIN_CROSSING_M))return{eastM:u.round((s+a)/2),northM:u.round((n+r)/2),headingDeg:(u.heading([(a-s)/i,(r-n)/i])+90)%360,widthM:Math.round(Math.min(i,u.MAX_CROSSING_M)*10)/10}}static marked(t){const e=t.crossing;return e!=="unmarked"&&e!=="no"&&e!=="informal"&&t["crossing:markings"]!=="no"}static directionAt(t){const{points:e,index:o}=t,[s,n]=o<e.length-1?[e[o],e[o+1]]:[e[o-1],e[o]],a=Math.hypot(n[0]-s[0],n[1]-s[1]);return a>0?[(n[0]-s[0])/a,(n[1]-s[1])/a]:void 0}static directionOf(t){const e=t["traffic_signals:direction"]??t["traffic_sign:direction"]??t.direction;return e==="forward"||e==="backward"?e:void 0}static compassOf(t){if(t===void 0)return;const e=Number.parseFloat(t);if(Number.isFinite(e)&&/^\s*-?\d/.test(t))return(e%360+360)%360;const s=["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"].indexOf(t.trim().toUpperCase());return s<0?void 0:s*22.5}static faceOf(t){const e=t.traffic_sign;if(!e||e==="no"||e==="none")return;const o=e.split(/[;,]/).map(s=>s.trim());if(o.some(s=>/stop|:AB4\b|:206\b|:R1-1\b|:B2\b/i.test(s)))return{face:"stop"};if(o.some(s=>/give_way|yield|:AB3a\b|:205\b|:R1-2\b|:B1\b/i.test(s)))return{face:"give-way"};for(const s of o){const n=/maxspeed|:B14\b|:274\b|:C14\b|:R2-1\b/i.test(s)?Number.parseInt(/\[(\d+)\]/.exec(s)?.[1]??t.maxspeed??"",10):Number.NaN;if(Number.isFinite(n)&&n>0)return{face:"speed-limit",value:n}}return{face:"other"}}static heading([t,e]){return Math.round((Math.atan2(t,e)*180/Math.PI+360)%360*10)/10}static round(t){return Math.round(t*10)/10}}class nt{id="ign-lidar-hd";name="IGN LiDAR HD";attribution="Canopy and roofs © IGN, LiDAR HD (Licence Ouverte 2.0), as surveyed on a day the service does not give";creditUrl="https://geoservices.ign.fr/lidarhd";contemporary=!0;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","The LiDAR HD survey covers France only");const o=C.lidarRadius(e),[s,n,a,r,i]=await Promise.all([this.platform.lidar(t,o),this.platform.photo(t,o).catch(()=>{}),this.furniture?.near(t,e),this.platform.laserDate(t),this.platform.photoDate(t)]);return{trees:new H(s.heights,s.vegetation,s.size,s.size).trees({metresPerPixel:s.metresPerPixel,radiusM:o}),buildings:_.fit(N.fit(new D(s.heights,s.building,s.size,s.size).buildings({metresPerPixel:s.metresPerPixel,radiusM:o,maxBuildings:300}),s,n)),bridges:[],lines:[],...a,dates:{...r?{laser:r}:{},...n&&i?{photo:i}:{},...u.found(a)?{lamps:u.today()}:{}}}}}class O{static MAP_NATURES={Eglise:"church",Chapelle:"church",Monument:"monument","Tour, donjon":"monument","Fort, blockhaus, casemate":"monument","Arc de triomphe":"monument","Arène ou théâtre antique":"monument",Château:"old","Industriel, agricole ou commercial":"works",Serre:"works",Silo:"works"};static MAP_WORKS=new Set(["Industriel","Agricole","Annexe"]);static MAP_CLOSED_AT_NIGHT=new Set(["Commercial et services","Sportif"]);static OSM_CLOSED_AT_NIGHT=new Set(["retail","commercial","office","supermarket","kiosk","sports_hall","sports_centre","stadium","school","university","college","kindergarten","public","civic","government","train_station","transportation"]);static OSM_BUILDINGS={cathedral:"church",church:"church",chapel:"church",basilica:"church",temple:"church",mosque:"church",synagogue:"church",shrine:"church",religious:"church",castle:"old",palace:"old",fortress:"monument",bunker:"monument",triumphal_arch:"monument",industrial:"works",warehouse:"works",barn:"works",farm_auxiliary:"works",shed:"works",hangar:"works",garage:"works",garages:"works",greenhouse:"works",silo:"works",storage_tank:"works",cowshed:"works",stable:"works",sty:"works",manufacture:"works"};static OSM_HISTORIC={church:"church",chapel:"church",monastery:"old",castle:"old",manor:"old",fort:"monument",tower:"monument",monument:"monument",memorial:"monument",city_gate:"monument"};static OLD_BEFORE=1900;static GRAND_FROM_M=15;static GRAND_UP_TO_M=40;static TOWER_SLENDERNESS=2;static CHURCH_PITCH=.7;static CHURCH_ROOF_OF_WALLS=.35;static CHURCH_ROOF_COLOUR="#5a6068";static ofMap(t){const e=O.year(t.date_d_apparition),s=O.MAP_NATURES[String(t.nature??"")]??(t.usage_1==="Religieux"?"church":void 0)??(O.MAP_WORKS.has(String(t.usage_1??""))?"works":void 0)??O.ofYear(e)??O.grand(t),n=O.MAP_CLOSED_AT_NIGHT.has(String(t.usage_1??""));return{...s?{style:s}:{},...e!==void 0?{builtYear:e}:{},...n?{closedAtNight:!0}:{}}}static ofOsm(t){const e=O.year(t.start_date),o=t.historic&&t.historic!=="no"?O.OSM_HISTORIC[t.historic]??"old":void 0,s=t.amenity==="place_of_worship"?"church":void 0,n=O.OSM_BUILDINGS[t.building??""]??o??s??O.ofYear(e),a=O.OSM_CLOSED_AT_NIGHT.has(t.building??"")||t.shop!==void 0&&t.shop!=="no";return{...n?{style:n}:{},...e!==void 0?{builtYear:e}:{},...a?{closedAtNight:!0}:{}}}static year(t){const e=Number(/\b(\d{4})\b/.exec(String(t??""))?.[1]);return Number.isFinite(e)&&e>=1e3&&e<=2100?e:void 0}static fit(t){return t.map(e=>e.style==="church"?O.church(e):e)}static isTower(t){return t.heightM>=O.TOWER_SLENDERNESS*Math.max(t.widthM,t.lengthM)}static church(t){const e=t.roof?.color??O.CHURCH_ROOF_COLOUR;if(O.isTower(t))return{...t,roof:{shape:"flat",riseM:0,color:e}};if(t.roof&&t.roof.shape!=="flat")return t;const o=Math.round(Math.min(O.CHURCH_PITCH*t.lengthM,O.CHURCH_ROOF_OF_WALLS*t.heightM)*10)/10,s={shape:"gable",riseM:o,color:e};return{...t,heightM:Math.round((t.heightM+o)*10)/10,roof:s}}static ofYear(t){return t!==void 0&&t<O.OLD_BEFORE?"old":void 0}static grand(t){const e=Number(t.hauteur),o=Number(t.nombre_d_etages);if(!(Number.isFinite(o)&&o>0)&&!(t.usage_1==="Résidentiel"||t.date_d_apparition))return e>=O.GRAND_FROM_M&&e<=O.GRAND_UP_TO_M?"grand":void 0}}class b{static METRES_PER_DEGREE=111320;static NAMED_NATURES={Silo:"Silo"};static DEFAULT_HEIGHT_M=6;static FLOOR_HEIGHT_M=3;static FINE_M=.5;static COARSE_M=1;static MAX_CELLS=4e4;static RECTANGLE_FILL=.9;static buildings(t,e,o,s=12,n=300,a=[]){const r=[];for(const h of b.reached(t,a,e,o)){const c=h.feature,l=Number(c.properties.nombre_d_etages),f=Number(c.properties.hauteur),M=Number.isFinite(f)&&f>0?f:Number.isFinite(l)&&l>0?l*b.FLOOR_HEIGHT_M:b.DEFAULT_HEIGHT_M,{style:d,builtYear:g,closedAtNight:m}=O.ofMap(c.properties);for(const E of b.rectanglesOf(h.rings,M,s)){const v=_.of(c.properties.materiaux_des_murs,"wall"),w=_.of(c.properties.materiaux_de_la_toiture,"roof"),p=b.NAMED_NATURES[String(c.properties.nature??"")];r.push({...E,...p?{name:p}:{},...Number.isFinite(l)&&l>0?{floors:l}:{},...v?{wallMaterial:v}:{},...w?{roofMaterial:w}:{},...d?{style:d}:{},...g!==void 0?{builtYear:g}:{},...m?{closedAtNight:m}:{}})}}const i=h=>Math.hypot(h.eastM,h.northM);if(r.length>n){const h=c=>(c.heightM+6)*Math.sqrt(c.widthM*c.lengthM)/Math.max(i(c),50);r.sort((c,l)=>h(l)-h(c)),r.length=n}return r.sort((h,c)=>i(h)-i(c)),r}static named(t,e,o){const s=e.map(n=>({name:typeof n.properties.toponyme=="string"?n.properties.toponyme:"",rings:b.rings(n,o)})).filter(n=>n.name.length>0&&n.rings.length>0);return s.length===0?t:t.map(n=>{const a=s.find(r=>b.inside(n.eastM,n.northM,r.rings));return a?{...n,name:a.name}:n})}static reached(t,e,o,s){const n=t.map(i=>({feature:i,rings:b.rings(i,o)})).filter(i=>i.rings.length>0),a=n.map(i=>b.reach(i.rings)<=s),r=e.filter(i=>typeof i.properties.toponyme=="string"&&i.properties.toponyme.length>0).map(i=>b.rings(i,o)).filter(i=>i.length>0);if(r.length>0){const i=n.map(c=>{const l=c.rings[0],f=l.reduce((d,g)=>d+g.east,0)/l.length,M=l.reduce((d,g)=>d+g.north,0)/l.length;return r.findIndex(d=>b.inside(f,M,d))}),h=new Set(i.filter((c,l)=>c>=0&&a[l]));i.forEach((c,l)=>{h.has(c)&&(a[l]=!0)})}return n.filter((i,h)=>a[h])}static reach(t){if(b.inside(0,0,t))return 0;let e=1/0;for(const o of t)for(let s=0;s+1<o.length;s++){const n=o[s],a=o[s+1],r=a.east-n.east,i=a.north-n.north,h=r*r+i*i>0?Math.max(0,Math.min(1,-(n.east*r+n.north*i)/(r*r+i*i))):0;e=Math.min(e,Math.hypot(n.east+h*r,n.north+h*i))}return e}static inside(t,e,o){let s=0;for(const n of o)for(let a=0;a+1<n.length;a++){const r=n[a],i=n[a+1];r.north<=e!=i.north<=e&&r.east+(e-r.north)/(i.north-r.north)*(i.east-r.east)>t&&s++}return s%2===1}static rings(t,e){const o=t.geometry,s=o.type==="Polygon"?[o.coordinates]:o.type==="MultiPolygon"?o.coordinates:[],n=Math.cos(e.lat*Math.PI/180),a=[];for(const r of s)for(const i of r)a.push(i.map(([h,c])=>({east:(h-e.lng)*b.METRES_PER_DEGREE*n,north:(c-e.lat)*b.METRES_PER_DEGREE})));return a}static rectanglesOf(t,e,o){let s=1/0,n=-1/0,a=1/0,r=-1/0;for(const f of t)for(const M of f)s=Math.min(s,M.east),n=Math.max(n,M.east),a=Math.min(a,M.north),r=Math.max(r,M.north);let i=b.FINE_M;(n-s)*(r-a)/(i*i)>b.MAX_CELLS&&(i=b.COARSE_M);const h=[],c=[];for(let f=a+i/2;f<r;f+=i){const M=[];for(const d of t)for(let g=0;g+1<d.length;g++){const m=d[g],E=d[g+1];m.north<=f!=E.north<=f&&M.push(m.east+(f-m.north)/(E.north-m.north)*(E.east-m.east))}M.sort((d,g)=>d-g);for(let d=0;d+1<M.length;d+=2)for(let g=Math.ceil((M[d]-i/2)/i)*i+i/2;g<M[d+1];g+=i)h.push(g),c.push(f)}if(h.length*i*i<o)return[];const l=t.flatMap(f=>f.slice(0,-1).map((M,d)=>({from:M,to:f[d+1]})));return D.ofPoints(h,c,new Array(h.length).fill(e),i,o,b.RECTANGLE_FILL,l)}}class F{id="ign-lidar-topo";name="IGN LiDAR HD + BD TOPO";attribution="Canopy © IGN, LiDAR HD; buildings, bridges and lines © IGN, BD TOPO (Licence Ouverte 2.0), as surveyed on days the services do not give";creditUrl="https://geoservices.ign.fr/lidarhd";contemporary=!0;static BRIDGE_MARGIN_M=30;static MAX_BRIDGE_WINDOWS=8;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","The IGN's surveys cover France only");const o=C.radius(e),[s,n,a,r,i,h]=await Promise.allSettled([this.platform.lidar(t,o),this.platform.vectors(t,o,!0),this.platform.photo(t,o),this.furniture?.near(t,e)??Promise.resolve(void 0),this.platform.laserDate(t),this.platform.photoDate(t)]),c=C.lidarRadius(o);if(s.status==="rejected"&&n.status==="rejected")throw s.reason;const l=s.status==="fulfilled"?s.value:void 0,f=n.status==="fulfilled"?n.value:void 0,M=f!==void 0&&f.buildings.length===0&&f.bridges.length===0&&f.lines.length===0;if(s.status==="rejected"&&s.reason instanceof V&&s.reason.reason==="no-coverage"&&M)throw s.reason;return{trees:l?new H(l.heights,l.vegetation,l.size,l.size).trees({metresPerPixel:l.metresPerPixel,radiusM:c}):[],buildings:this.roofed(this.buildings(l,f,t,o),l,a.status==="fulfilled"?a.value:void 0),bridges:f?await this.bridges(f,t,o,l?.structures,c):[],lines:f?X.lines(f,t,o,l?.structures):[],...r.status==="fulfilled"?r.value:{},dates:{...s.status==="fulfilled"&&i.status==="fulfilled"&&i.value?{laser:i.value}:{},...a.status==="fulfilled"&&h.status==="fulfilled"&&h.value?{photo:h.value}:{},...f?.mapDate?{map:f.mapDate}:{},...r.status==="fulfilled"&&u.found(r.value)?{lamps:u.today()}:{}}}}async bridges(t,e,o,s,n){const a=X.bridges(t,e,o,s);let r=0;return Promise.all(a.map(async i=>{if(s!==void 0&&Math.hypot(i.eastM,i.northM)+i.lengthM/2<=n)return i;const h=i.lengthM/2+F.BRIDGE_MARGIN_M;if(r++>=F.MAX_BRIDGE_WINDOWS)return i;const c=et(i.eastM,-i.northM,e.lat,e.lng);try{const l=await this.platform.lidar(c,h),f=X.bridges(t,c,h,l.structures).sort((M,d)=>Math.hypot(M.eastM,M.northM)-Math.hypot(d.eastM,d.northM))[0];return!f||Math.hypot(f.eastM,f.northM)>i.lengthM/2?i:{...f,eastM:X.tenth(f.eastM+i.eastM),northM:X.tenth(f.northM+i.northM)}}catch{return i}}))}roofed(t,e,o){return _.fit(O.fit(N.fit(t,e,o)))}buildings(t,e,o,s){const n=e?b.buildings(e.buildings,o,s,void 0,void 0,e.zones):[],a=n.length>0||t===void 0?n:new D(t.heights,t.building,t.size,t.size).buildings({metresPerPixel:t.metresPerPixel,radiusM:C.lidarRadius(s),maxBuildings:300});return e?b.named(a,e.zones,o):a}}class at{id="ign-bd-topo";name="IGN BD TOPO";attribution="Buildings, bridges and lines © IGN, BD TOPO (Licence Ouverte 2.0), as drawn on a day the service does not give";creditUrl="https://geoservices.ign.fr/bdtopo";contemporary=!0;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","BD TOPO covers France only");const o=C.radius(e),[s,n,a,r]=await Promise.all([this.platform.vectors(t,o,!0),this.platform.photo(t,o).catch(()=>{}),this.furniture?.near(t,e),this.platform.photoDate(t)]);return{trees:[],buildings:_.fit(O.fit(N.fit(b.named(b.buildings(s.buildings,t,o,void 0,void 0,s.zones),s.zones,t),void 0,n))),bridges:X.bridges(s,t,o,void 0),lines:X.lines(s,t,o,void 0),...a,dates:{...s.mapDate?{map:s.mapDate}:{},...n&&r?{photo:r}:{},...u.found(a)?{lamps:u.today()}:{}}}}}class S{static ROOF_SHAPES={flat:"flat",gabled:"gable",gambrel:"gable",saltbox:"gable","half-hipped":"hip",hipped:"hip",pyramidal:"hip",mansard:"hip",round:"gable",dome:"dome",onion:"dome"};static WALL_MATERIALS={brick:"brick",stone:"stone",granite:"stone",sandstone:"stone",limestone:"stone",concrete:"concrete",cement_block:"block",block:"block",wood:"wood",timber_framing:"wood"};static ROOF_MATERIALS={roof_tiles:"tile",tiles:"tile",tile:"tile",slate:"slate",metal:"zinc",zinc:"zinc",tin:"zinc",copper:"zinc",concrete:"concrete",eternit:"other"};static COLOURS={white:"#e8e6e0",grey:"#8c8c8a",gray:"#8c8c8a",black:"#3a3a3a",red:"#a8483a",brown:"#6e4f38",beige:"#d6c9a8",yellow:"#d8c070",orange:"#c9773a",green:"#5f7a52",blue:"#506a8a",tan:"#c0a37a",cream:"#e6dcc0",pink:"#c99a96",silver:"#b4b6b6"};static height(t){const e=Number.parseFloat((t??"").replace(",","."));return Number.isFinite(e)&&e>=2&&e<=500?e:void 0}static levels(t){const e=Number.parseInt(t??"",10);return Number.isFinite(e)&&e>=1&&e<=150?e:void 0}static roofShape(t){return S.ROOF_SHAPES[(t??"").trim().toLowerCase()]}static wallMaterial(t){return S.WALL_MATERIALS[(t??"").trim().toLowerCase()]}static roofMaterial(t){return S.ROOF_MATERIALS[(t??"").trim().toLowerCase()]}static colour(t){const e=(t??"").trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(e)?e:/^#[0-9a-f]{3}$/.test(e)?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:S.COLOURS[e]}}class W{id="osm-buildings";name="OpenStreetMap buildings";attribution="Buildings © OpenStreetMap contributors (ODbL), as drawn on the day of the data, which a recording is not";creditUrl="https://www.openstreetmap.org/copyright";contemporary=!0;static MAX_RADIUS_M=1500;static MIN_AREA_M2=12;static MAX_BUILDINGS=300;client;furniture;constructor(t={},e){this.client=new tt(t),this.furniture=e}covers(){return!0}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){const o=Math.min(e,W.MAX_RADIUS_M);let s;try{s=await this.client.query(`[out:json][timeout:30];(way["building"](around:${o},${t.lat},${t.lng});relation["building"]["type"="multipolygon"](around:${o},${t.lat},${t.lng}););out geom;`)}catch(r){throw new V("unreachable",r instanceof Error?r.message:String(r))}const n=await this.furniture?.near(t,e),a=(s.osm3s?.timestamp_osm_base??"").slice(0,10);return{trees:[],buildings:_.fit(O.fit(W.buildings(s,t,o))),bridges:[],lines:[],...n,dates:{.../^\d{4}-\d{2}-\d{2}$/.test(a)?{map:a}:{},...u.found(n)?{lamps:u.today()}:{}}}}static buildings(t,e,o){const s=[];for(const n of t.elements??[]){const a=W.ringsOf(n);if(a.length===0)continue;const r=n.tags??{},i=S.levels(r["building:levels"]),h=S.height(r.height),c={geometry:{type:"Polygon",coordinates:a},properties:{...h?{hauteur:h}:{},...i?{nombre_d_etages:i}:{}}};for(const l of b.buildings([c],e,o,W.MIN_AREA_M2,50))s.push(W.described(l,r,h!==void 0))}return s.sort((n,a)=>Math.hypot(n.eastM,n.northM)-Math.hypot(a.eastM,a.northM)),s.slice(0,W.MAX_BUILDINGS)}static ringsOf(t){const e=s=>{if(!s||s.length<4)return;const n=s.map(i=>[i.lon,i.lat]),a=n[0],r=n[n.length-1];return a[0]===r[0]&&a[1]===r[1]?n:void 0};if(t.type==="way"){const s=e(t.geometry);return s?[s]:[]}return(t.members??[]).filter(s=>s.role==="outer").map(s=>e(s.geometry)).filter(s=>s!==void 0).slice(0,1)}static described(t,e,o){const s=S.wallMaterial(e["building:material"]),n=S.roofMaterial(e["roof:material"]),a=S.colour(e["building:colour"]),r=S.colour(e["roof:colour"])??_.roofColor(n),i=S.roofShape(e["roof:shape"]),h=a?{color:a}:void 0;let c,l=t.heightM;if(i==="gable"||i==="hip"||i==="dome"){const g=S.height(e["roof:height"]),m=Math.round((g??Math.min(5,Math.max(1.5,.29*Math.min(t.widthM,t.lengthM))))*10)/10;o||(l=Math.round((t.heightM+m)*10)/10),c={shape:i,riseM:m,...e["roof:orientation"]==="across"?{ridge:"depth"}:{},...r?{color:r}:{}}}else(i==="flat"||r)&&(c={shape:"flat",riseM:0,...r?{color:r}:{}});const{style:f,builtYear:M,closedAtNight:d}=O.ofOsm(e);return{...t,heightM:l,...f?{style:f}:{},...M!==void 0?{builtYear:M}:{},...d?{closedAtNight:d}:{},...e.name?{name:e.name}:{},...s?{wallMaterial:s}:{},...n?{roofMaterial:n}:{},...h?{facade:h}:{},...c?{roof:c}:{}}}}class L{credit={name:"Ville de Paris, Éclairage public",url:"https://opendata.paris.fr/explore/dataset/eclairage-public/",licence:"ODbL",of:"lamps"};static BOUNDS={south:48.8156,north:48.9022,west:2.2241,east:2.4698};static ENDPOINT="https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/eclairage-public/records";static PAGE=100;static MAX=150;static MAX_PAGES=4;static METRES_PER_DEGREE=111320;static SAME_COLUMN_M=.5;static MIN_HEIGHT_M=2;fetchImpl;constructor(t){this.fetchImpl=t??fetch.bind(globalThis)}covers(t,e){const o=L.BOUNDS;return t>=o.south&&t<=o.north&&e>=o.west&&e<=o.east}async lampsNear(t,e){const o=[];let s=[];for(let n=0;n<L.MAX_PAGES&&s.length<L.MAX;n++){const a=await this.fetchImpl(L.query(t,e,L.PAGE,n*L.PAGE));if(!a.ok)throw new Error(`opendata.paris.fr refused (${a.status})`);const r=(await a.json()).results??[];if(o.push(...r),s=L.lampsFrom(o,t),r.length<L.PAGE)break}return s.slice(0,L.MAX)}static query(t,e,o,s){const n=`geom'POINT(${t.lng.toFixed(6)} ${t.lat.toFixed(6)})'`,a=new URLSearchParams({select:"geo_point_2d,lib_ouvrag,lampe_temperature_couleur,lampe_flux,support_hauteur",where:`within_distance(geo_point_2d,${n},${Math.round(e)}m)`,order_by:`distance(geo_point_2d,${n})`,limit:String(o),offset:String(s)});return`${L.ENDPOINT}?${a}`}static lampsFrom(t,e){const o=Math.cos(e.lat*Math.PI/180),s=a=>{const r=typeof a=="number"?a:Number.parseFloat(a??"");return Number.isFinite(r)&&r>0?r:void 0},n=[];for(const a of t){const r=a.geo_point_2d;if(!r||a.lib_ouvrag==="Projecteur")continue;const i=Math.round((r.lon-e.lng)*L.METRES_PER_DEGREE*o*10)/10,h=Math.round((r.lat-e.lat)*L.METRES_PER_DEGREE*10)/10,c=s(a.lampe_flux),l=n.find(d=>Math.hypot(d.eastM-i,d.northM-h)<L.SAME_COLUMN_M);if(l){c!==void 0&&(l.lumens=(l.lumens??0)+c);continue}const f=s(a.lampe_temperature_couleur),M=s(a.support_hauteur);n.push({eastM:i,northM:h,...M!==void 0&&M>=L.MIN_HEIGHT_M?{heightM:M}:{},...f!==void 0?{colorTemperatureK:f}:{},...c!==void 0?{lumens:c}:{},...a.lib_ouvrag==="Console"?{mount:"wall"}:{}})}return n}}class T{constructor(t,e){this.roads=t,this.fetchImpl=e??fetch.bind(globalThis)}credit={name:"Ville de Paris, Signalisation lumineuse tricolore",url:"https://opendata.paris.fr/explore/dataset/signalisation-tricolore/",licence:"ODbL",of:"signals"};static BOUNDS={south:48.8156,north:48.9022,west:2.2241,east:2.4698};static ENDPOINT="https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/signalisation-tricolore/records";static PAGE=100;static MAX_PAGES=5;static MAX=160;static METRES_PER_DEGREE=111320;static SAME_POST_M=.8;static SEARCH_M=15;static PEDESTRIAN_ALONG_M=.4;fetchImpl;covers(t,e){const o=T.BOUNDS;return t>=o.south&&t<=o.north&&e>=o.west&&e<=o.east}async signalsNear(t,e){const o=(e+T.SEARCH_M)/T.METRES_PER_DEGREE,s=o/Math.cos(t.lat*Math.PI/180),[n,a]=await Promise.all([this.lenses(t,e),this.roads.getRoads({south:t.lat-o,north:t.lat+o,west:t.lng-s,east:t.lng+s})]);return T.signalsFrom(n,a,t)}async lenses(t,e){const o=[];for(let s=0;s<T.MAX_PAGES;s++){const n=await this.fetchImpl(T.query(t,e,T.PAGE,s*T.PAGE));if(!n.ok)throw new Error(`opendata.paris.fr refused (${n.status})`);const a=(await n.json()).results??[];if(o.push(...a),a.length<T.PAGE)break}return o}static query(t,e,o,s){const n=`geom'POINT(${t.lng.toFixed(6)} ${t.lat.toFixed(6)})'`,a=new URLSearchParams({select:"geo_point_2d,lib_regime",where:`within_distance(geo_point_2d,${n},${Math.round(e)}m)`,order_by:`distance(geo_point_2d,${n})`,limit:String(o),offset:String(s)});return`${T.ENDPOINT}?${a}`}static signalsFrom(t,e,o){const s=Math.cos(o.lat*Math.PI/180),n=(h,c)=>[(c-o.lng)*T.METRES_PER_DEGREE*s,(h-o.lat)*T.METRES_PER_DEGREE],a=[];for(const h of t){if(!h.geo_point_2d)continue;const c=n(h.geo_point_2d.lat,h.geo_point_2d.lon),l=(h.lib_regime??"").toUpperCase(),f=/ROUGE|JAUNE|VERT/.test(l),M=/PASSEZ|ATTENDEZ/.test(l);if(!f&&!M)continue;let d=a.find(g=>Math.hypot(g.at[0]-c[0],g.at[1]-c[1])<T.SAME_POST_M);d||a.push(d={at:c,vehicles:0,pedestrians:0}),f&&d.vehicles++,M&&d.pedestrians++}const r=e.map(h=>({way:h,points:h.points.map(c=>n(c.lat,c.lng))})),i=[];for(const h of a){const c=T.nearestRoad(h.at,r);if(!c)continue;const[l,f]=c.unit,M=T.heading(c.unit),d=(h.at[0]-c.foot[0])*f-(h.at[1]-c.foot[1])*l>=0,g=c.way.direction,m=g==="forward"?M:g==="backward"?(M+180)%360:d?M:(M+180)%360,E=w=>Math.round(w*10)/10,v=w=>E((w%360+360)%360);if(h.vehicles>0&&i.push({eastM:E(h.at[0]),northM:E(h.at[1]),headingDeg:v(m+180),for:"vehicles",phase:j.phaseOf(m)}),h.pedestrians>0){const w=T.heading([c.foot[0]-h.at[0],c.foot[1]-h.at[1]]),p=h.vehicles>0?T.PEDESTRIAN_ALONG_M:0;i.push({eastM:E(h.at[0]+l*p),northM:E(h.at[1]+f*p),headingDeg:v(Number.isNaN(w)?M+90:w),for:"pedestrians",phase:j.phaseOf(M)})}}return i.sort((h,c)=>Math.hypot(h.eastM,h.northM)-Math.hypot(c.eastM,c.northM)).slice(0,T.MAX)}static nearestRoad(t,e){let o;for(const{way:s,points:n}of e)for(let a=1;a<n.length;a++){const[r,i]=n[a-1],[h,c]=n[a],l=Math.hypot(h-r,c-i);if(l===0)continue;const f=[(h-r)/l,(c-i)/l],M=Math.max(0,Math.min(l,(t[0]-r)*f[0]+(t[1]-i)*f[1])),d=[r+f[0]*M,i+f[1]*M],g=Math.hypot(t[0]-d[0],t[1]-d[1]);g<=T.SEARCH_M&&(!o||g<o.distance)&&(o={way:s,unit:f,foot:d,distance:g})}return o}static heading([t,e]){return t===0&&e===0?Number.NaN:Math.round((Math.atan2(t,e)*180/Math.PI+360)%360*10)/10}}const K=B.point("surroundings").provide(B.BUILT_IN,[{id:"ign-lidar-topo",name:"IGN LiDAR HD + BD TOPO",credit:"© IGN, LiDAR HD and BD TOPO, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/lidarhd",create:()=>new I(new F({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"ign-lidar-hd",name:"IGN LiDAR HD",credit:"© IGN, LiDAR HD, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/lidarhd",create:()=>new I(new nt({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"ign-bd-topo",name:"IGN BD TOPO",credit:"© IGN, BD TOPO, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/bdtopo",create:()=>new I(new at({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"osm-buildings",name:"OpenStreetMap buildings",credit:"Buildings and street lamps © OpenStreetMap contributors (ODbL)",creditUrl:"https://www.openstreetmap.org/copyright",create:()=>new I(new W({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))}]);class U{static DEFAULT_ID=K[0].id;static WORLD_ID="osm-buildings";static TOWN_LAMPS=[new L];static TOWN_SIGNALS=[new T(new st)];static NONE="none";static byId(t){return t===U.NONE?void 0:K.find(e=>e.id===t)??K[0]}static providerFor(t,e,o){const s=U.byId(t)?.create();if(t!==void 0&&t!==U.DEFAULT_ID)return s?.covers(e,o)?s:void 0;const n=K.find(r=>r.id===U.WORLD_ID).create(),a=[s,n].filter(r=>r!==void 0&&r.covers(e,o));return a.length>1?new ot(a):a[0]}}export{K as SURROUNDINGS_SOURCES,U as SurroundingsSources};
|
package/dist-embed-sighting-editor/{trafficRuntime-CPRQW0Ho.js → trafficRuntime-j8tnHTec.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a7 as J,a8 as pt,a9 as W,aa as L,ab as F,ac as U,ad as At,u as $,ae as tt}from"./rr0-sighting-editor.mjs";import{af as Gt}from"./rr0-sighting-editor.mjs";import{C as et}from"./ContrailGrowth-DwHS8If9.js";class m{static OCTAVES=[63,125,250,500,1e3,2e3,4e3,8e3];static STANDARD={temperatureC:15,relativeHumidity:.7,pressureKPa:101.325};static REFERENCE_PRESSURE_KPA=101.325;static REFERENCE_TEMPERATURE_K=293.15;static TRIPLE_POINT_K=273.16;static speedOfSound(t){return 20.0468*Math.sqrt(t+273.15)}static absorptionDbPerKm(t,e=m.STANDARD){const a=e.temperatureC+273.15,n=m.REFERENCE_TEMPERATURE_K,i=e.pressureKPa/m.REFERENCE_PRESSURE_KPA,o=10**(-6.8346*(m.TRIPLE_POINT_K/a)**1.261+4.6151),r=e.relativeHumidity*100*o/i,c=i*(24+40400*r*(.02+r)/(.391+r)),h=i*(a/n)**-.5*(9+280*r*Math.exp(-4.17*((a/n)**(-1/3)-1))),s=t*t;return 8.686*s*(184e-13*(1/i)*Math.sqrt(a/n)+(a/n)**-2.5*(.01275*Math.exp(-2239.1/a)/(c+s/c)+.1068*Math.exp(-3352/a)/(h+s/h)))*1e3}static aWeightingDb(t){const e=t*t,a=12194**2*e*e/((e+20.6**2)*Math.sqrt((e+107.7**2)*(e+737.9**2))*(e+12194**2));return 20*Math.log10(a)+2}static sumDb(t){return 10*Math.log10(t.reduce((e,a)=>e+10**(a/10),0))}}const gt=.25,at=.4,nt=6,z=12,mt=3,it=.2,Et=.2,Mt=24,bt=3,ft=12,st=1,Dt=.7,St=1.5,Rt=.8,It=1.3,rt=.9,ot=5,Ot=25,Bt=.5,Tt=.12,ct=[.13,.31],Nt=.16,vt=1.6,_t=3.6,lt=1.1,Ct=.3,kt=1e3,ut=.7;class x{context;constructor(t){this.context=t}noiseBuffer;roughBuffers=new Map;voices=new Map;bus;reverb;reverbOut;level=1;master;paused=!0;requested=[];headingDeg=0;resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(t){console.warn("AircraftAudio: Web Audio unavailable, aircraft stay silent:",t);return}}J.isLive(this.context)&&J.unlock(this.context),this.apply()}setLevel(t){this.level=t,this.master&&(this.master.gain.value=t)}setPaused(t){t!==this.paused&&(this.paused=t,this.apply())}setVoices(t,e=0){this.requested=t,this.headingDeg=e,this.apply()}dispose(){for(const t of[...this.voices.keys()])this.release(t);J.isLive(this.context)&&this.context.close(),this.context=void 0,this.master=void 0,this.bus=void 0}apply(){const t=this.context;if(!t)return;const e=this.paused?[]:this.requested,a=new Set(e.map(n=>n.id));for(const n of[...this.voices.keys()])a.has(n)||this.release(n);for(const n of e){const i=this.voices.get(n.id)??this.build(t,n);this.retarget(t,i,n)}}build(t,e){const a=t.createGain();a.gain.value=0;let n;const i=this.busOf(t);typeof t.createStereoPanner=="function"?(n=t.createStereoPanner(),a.connect(n).connect(i)):a.connect(i);const o=t.createGain(),r=e.character?.modulationDepth??0;o.gain.value=1-r/2;const c=t.createOscillator();c.type="sine";const h=t.createGain();h.gain.value=r/2,c.connect(h).connect(o.gain),o.connect(a);const s=t.createBufferSource();s.buffer=this.noise(t),s.loop=!0,s.loopStart=Math.random()*nt*.5;const d=[],l=[],u=[];for(const B of m.OCTAVES){const T=t.createBiquadFilter();T.type="bandpass",T.frequency.value=B,T.Q.value=st;const _=t.createBiquadFilter();_.type="bandpass",_.frequency.value=B,_.Q.value=st;const P=t.createGain();P.gain.value=0,s.connect(T).connect(_).connect(P).connect(o),d.push(T),l.push(_),u.push(P)}const p=[];for(const[B,T]of[[e.character?.toneHz,e.character?.toneShare],[e.character?.humHz,e.character?.humShare]])if(B!==void 0)for(let _=1;_<=bt;_++){const P=t.createOscillator();P.type="sine",P.frequency.value=B*_;const Y=t.createGain();Y.gain.value=0,P.connect(Y).connect(a),p.push({oscillator:P,gain:Y,harmonic:_,baseHz:B,share:T??0})}const A=t.createGain();A.gain.value=0,A.connect(a.gain);const M=ct.map(B=>{const T=t.createOscillator();return T.type="sine",T.frequency.value=B,T.connect(A),T}),f=t.createGain();f.gain.value=e.character?.roughness??it;const I=t.createBufferSource();I.buffer=this.roughTable(t,mt),I.loop=!0,I.loopStart=Math.random()*z*.5,I.connect(f).connect(o.gain);const S=t.createGain();S.gain.value=(e.character?.roughness??it)*Et;const b=t.createBufferSource();b.buffer=this.roughTable(t,Mt),b.loop=!0,b.loopStart=Math.random()*z*.5,b.connect(S).connect(o.gain);let N;const K=this.busOf(t)&&this.reverb;K&&(N=t.createGain(),N.gain.value=0,a.connect(N).connect(K));const q=[s,I,b,c,...p.map(B=>B.oscillator),...M];for(const B of q)B.start();const Q={nodes:[a,o,h,f,S,A,...p.map(B=>B.gain),...d,...l,...u,...N?[N]:[],...n?[n]:[],...q],sources:q,filters:d,seconds:l,gains:u,tones:p,lfo:c,lfoDepth:h,wander:M,wanderDepth:A,roughDepth:f,crackleDepth:S,beat:o,output:a,panner:n,send:N};return this.voices.set(e.id,Q),Q}retarget(t,e,a){const n=t.currentTime,i=(p,A)=>p.setTargetAtTime(A,n,gt),o=Math.min(St,Math.max(Dt,a.dopplerRatio)),r=Math.min(It,Math.max(Rt,Math.sqrt(a.dopplerRatio))),c=t.sampleRate*.45,h=a.bandAmplitudes.map((p,A)=>p*x.unweighting(m.OCTAVES[A])),s=Math.sqrt(h.reduce((p,A)=>p+A*A,0)),d=Math.min(1,Math.max(0,(a.distanceKm-ot)/(Ot-ot)));m.OCTAVES.forEach((p,A)=>{i(e.filters[A].frequency,Math.min(c,p*r)),i(e.seconds[A].frequency,Math.min(c,p*r)),i(e.gains[A].gain,h[A]*Math.sqrt(kt/p))});const l=a.character;for(const{oscillator:p,gain:A,harmonic:M,baseHz:f,share:I}of e.tones){const S=f*M;i(p.frequency,S*o);const b=S*o;i(A.gain,b<c?I*Nt*h[x.bandOf(b)]/M:0)}l?.modulationHz!==void 0&&i(e.lfo.frequency,l.modulationHz*o);const u=s>0?ut*(1-Math.exp(-s/ut))/s:1;if(i(e.output.gain,u*(1-Ct*d)),i(e.wanderDepth.gain,u*Tt*d/ct.length),e.send&&i(e.send.gain,vt*d),e.panner){const p=(a.azimuthDeg-this.headingDeg)*Math.PI/180,A=a.inside?0:Math.max(-rt,Math.min(rt,Math.sin(p)))*(1-Bt*d);i(e.panner.pan,A)}}static unweighting(t){return 10**(Math.min(ft,Math.max(0,-m.aWeightingDb(t)))/20)}static bandOf(t){let e=0;return m.OCTAVES.forEach((a,n)=>{Math.abs(Math.log(t/a))<Math.abs(Math.log(t/m.OCTAVES[e]))&&(e=n)}),e}roughTable(t,e){const a=this.roughBuffers.get(e);if(a)return a;const n=Math.floor(t.sampleRate*z),i=t.createBuffer(1,n,t.sampleRate),o=i.getChannelData(0),r=Array.from({length:z*e},()=>(Math.random()*2-1)**3),c=t.sampleRate/e;for(let h=0;h<o.length;h++){const s=h/c,d=Math.floor(s),l=s-d,u=l*l*(3-2*l);o[h]=r[d%r.length]*(1-u)+r[(d+1)%r.length]*u}return this.roughBuffers.set(e,i),i}roomImpulse(t){const e=Math.floor(t.sampleRate*_t),a=t.createBuffer(2,e,t.sampleRate);for(let n=0;n<2;n++){const i=a.getChannelData(n);let o=0;for(let r=0;r<e;r++){const c=r/t.sampleRate,h=.6*Math.exp(-c/(lt*2))+.04;o+=h*(Math.random()*2-1-o),i[r]=o*Math.exp(-c/lt)}}return a}busOf(t){if(this.bus)return this.bus;const e=t.createGain();if(e.gain.value=this.level,e.connect(t.destination),this.master=e,typeof t.createConvolver=="function"){const a=t.createConvolver();a.buffer=this.roomImpulse(t);const n=t.createGain();n.gain.value=.9,a.connect(n),this.reverb=a,this.reverbOut=n}if(typeof t.createDynamicsCompressor=="function"){const a=t.createDynamicsCompressor();a.threshold.value=-6,a.knee.value=3,a.ratio.value=4,a.attack.value=.005,a.release.value=.25,a.connect(e),this.bus=a}else this.bus=e;return this.reverbOut?.connect(this.bus),this.bus}release(t){const e=this.voices.get(t);if(!e)return;this.voices.delete(t);const a=this.context;a&&(e.output.gain.setTargetAtTime(0,a.currentTime,at/3),setTimeout(()=>{for(const n of e.sources)try{n.stop()}catch{}for(const n of e.nodes)n.disconnect()},at*1e3*3))}noise(t){if(this.noiseBuffer)return this.noiseBuffer;const e=t.createBuffer(1,t.sampleRate*nt,t.sampleRate),a=e.getChannelData(0);for(let n=0;n<a.length;n++)a[n]=Math.random()*2-1;return this.noiseBuffer=e,e}}class v{static BASE_DB_A=30;static WIND_DB_A=[[0,10],[1,28],[2,36],[3,40],[5,46],[8,52],[12,58],[20,66]];static RAIN_DB_A=[[0,0],[.1,42],[.3,50],[.6,58],[1,65]];static BED_RMS=.2;static MINIMUM_REFERENCE=.008;static WIND_BED_MIN_MS=1;static WIND_BED_FULL_MS=20;static dbA(t){const e=[v.BASE_DB_A,v.along(v.WIND_DB_A,t.windSpeed)];return(t.precipitationType==="rain"||t.precipitationType==="hail")&&e.push(v.along(v.RAIN_DB_A,t.precipitationIntensity)),10*Math.log10(e.filter(a=>a>0).reduce((a,n)=>a+10**(n/10),0))}static bedVolume(t){const e=t.windSpeed>v.WIND_BED_MIN_MS?Math.min(t.windSpeed/v.WIND_BED_FULL_MS,1):0,a=t.precipitationType==="hail"?Math.min(1,t.precipitationIntensity*1.3+.2):t.precipitationType==="rain"?t.precipitationIntensity:0;return Math.hypot(e,a)}static referenceAmplitude(t){return Math.max(v.BED_RMS*v.bedVolume(t),v.MINIMUM_REFERENCE)}static along(t,e){if(e<=t[0][0])return t[0][1];for(let a=1;a<t.length;a++)if(e<=t[a][0]){const[n,i]=t[a-1],[o,r]=t[a];return i+(r-i)*(e-n)/(o-n)}return t[t.length-1][1]}}class y{static TYPES={A318:["Airbus A318","airliner-narrow",34.1,31.4],A319:["Airbus A319","airliner-narrow",34.1,33.8],A320:["Airbus A320","airliner-narrow",34.1,37.6],A321:["Airbus A321","airliner-narrow",34.1,44.5],A19N:["Airbus A319neo","airliner-narrow",35.8,33.8],A20N:["Airbus A320neo","airliner-narrow",35.8,37.6],A21N:["Airbus A321neo","airliner-narrow",35.8,44.5],B737:["Boeing 737-700","airliner-narrow",34.3,33.6],B738:["Boeing 737-800","airliner-narrow",35.8,39.5],B739:["Boeing 737-900","airliner-narrow",35.8,42.1],B38M:["Boeing 737 MAX 8","airliner-narrow",35.9,39.5],B39M:["Boeing 737 MAX 9","airliner-narrow",35.9,42.2],B752:["Boeing 757-200","airliner-narrow",38,47.3],B753:["Boeing 757-300","airliner-narrow",38,54.4],B762:["Boeing 767-200","airliner-wide",47.6,48.5],B763:["Boeing 767-300","airliner-wide",47.6,54.9],B764:["Boeing 767-400","airliner-wide",51.9,61.4],B772:["Boeing 777-200","airliner-wide",60.9,63.7],B77L:["Boeing 777-200LR","airliner-wide",64.8,63.7],B77W:["Boeing 777-300ER","airliner-wide",64.8,73.9],B788:["Boeing 787-8","airliner-wide",60.1,56.7],B789:["Boeing 787-9","airliner-wide",60.1,62.8],B78X:["Boeing 787-10","airliner-wide",60.1,68.3],B744:["Boeing 747-400","airliner-wide",64.4,70.7],B748:["Boeing 747-8","airliner-wide",68.4,76.3],A306:["Airbus A300-600","airliner-wide",44.8,54.1],A310:["Airbus A310","airliner-wide",43.9,46.7],A332:["Airbus A330-200","airliner-wide",60.3,58.8],A333:["Airbus A330-300","airliner-wide",60.3,63.7],A338:["Airbus A330-800","airliner-wide",64,58.8],A339:["Airbus A330-900","airliner-wide",64,63.7],A343:["Airbus A340-300","airliner-wide",60.3,63.7],A346:["Airbus A340-600","airliner-wide",63.5,75.4],A359:["Airbus A350-900","airliner-wide",64.8,66.8],A35K:["Airbus A350-1000","airliner-wide",64.8,73.8],A388:["Airbus A380-800","airliner-wide",79.8,72.7],E170:["Embraer 170","regional-jet",26,29.9],E75L:["Embraer 175","regional-jet",26,31.7],E75S:["Embraer 175","regional-jet",26,31.7],E190:["Embraer 190","regional-jet",28.7,36.2],E195:["Embraer 195","regional-jet",28.7,38.7],E290:["Embraer 190-E2","regional-jet",33.7,36.2],E295:["Embraer 195-E2","regional-jet",33.7,41.5],CRJ2:["Bombardier CRJ200","regional-jet",21.2,26.8],CRJ7:["Bombardier CRJ700","regional-jet",23.2,32.3],CRJ9:["Bombardier CRJ900","regional-jet",24.9,36.2],CRJX:["Bombardier CRJ1000","regional-jet",26.2,39.1],AT72:["ATR 72","regional-turboprop",27.1,27.2],AT76:["ATR 72-600","regional-turboprop",27.1,27.2],AT45:["ATR 42","regional-turboprop",24.6,22.7],DH8D:["Dash 8 Q400","regional-turboprop",28.4,32.8],DH8C:["Dash 8-300","regional-turboprop",27.4,25.7],SF34:["Saab 340","regional-turboprop",21.4,19.7],B190:["Beechcraft 1900","regional-turboprop",17.7,17.6],C25A:["Cessna CitationJet CJ2","business-jet",14.3,14.4],C56X:["Cessna Citation Excel","business-jet",17.2,16],C68A:["Cessna Citation Latitude","business-jet",22,18.9],C550:["Cessna Citation II","business-jet",15.8,14.4],E55P:["Embraer Phenom 300","business-jet",15.9,15.6],E50P:["Embraer Phenom 100","business-jet",12.3,12.8],GLF5:["Gulfstream G550","business-jet",28.5,29.4],FA7X:["Dassault Falcon 7X","business-jet",26.2,23.4],CL60:["Bombardier Challenger 600","business-jet",19.6,20.9],LJ45:["Learjet 45","business-jet",14.6,17.7],H25B:["Hawker 800","business-jet",15.7,15.6],C172:["Cessna 172","light-piston",11,8.3],C152:["Cessna 152","light-piston",10.2,7.3],C182:["Cessna 182","light-piston",10.9,8.8],P28A:["Piper Cherokee","light-piston",10.7,7.2],PA34:["Piper Seneca","light-piston",11.8,8.7],SR20:["Cirrus SR20","light-piston",10.9,7.9],SR22:["Cirrus SR22","light-piston",11.7,7.9],S22T:["Cirrus SR22T","light-piston",11.7,7.9],DA40:["Diamond DA40","light-piston",11.6,8.1],DA42:["Diamond DA42","light-piston",13.4,8.6],BE20:["Beechcraft King Air 200","turboprop-light",16.6,13.3],BE58:["Beechcraft Baron","light-piston",11.5,9.1],C208:["Cessna Caravan","turboprop-light",15.9,11.5],PC12:["Pilatus PC-12","turboprop-light",16.3,14.4],TBM9:["Daher TBM 900","turboprop-light",12.8,10.7],EC35:["Airbus H135","helicopter-light",10.2,12.1],EC45:["Airbus H145","helicopter-medium",11,13.6],AS50:["Airbus H125","helicopter-light",10.7,12.9],EC30:["Airbus H130","helicopter-light",10.7,12.6],B407:["Bell 407","helicopter-light",10.7,12.7],B06:["Bell 206","helicopter-light",10.2,12],B429:["Bell 429","helicopter-medium",10.9,13],B505:["Bell 505","helicopter-light",10.4,11.9],R44:["Robinson R44","helicopter-light",10.1,11.7],R22:["Robinson R22","helicopter-light",7.7,8.8],A109:["Agusta A109","helicopter-medium",11,13],A139:["Leonardo AW139","helicopter-medium",13.8,16.7],S92:["Sikorsky S-92","helicopter-heavy",17.2,20.9],H60:["Sikorsky UH-60 Black Hawk","helicopter-heavy",16.4,19.8],T38:["Northrop T-38 Talon","military-jet",7.7,14.1],HAWK:["BAE Hawk","military-jet",9.4,11.9],GLID:["Glider","glider",17,7],BALL:["Balloon","balloon",15,20],ULAC:["Ultralight","ultralight",9.5,6],C42:["Ikarus C42","ultralight",9.4,6.3],DRON:["Drone","unmanned",1,.6]};static CATEGORIES={A1:["Light aircraft","light-piston",11,8.3],A2:["Small aircraft","business-jet",15,15],A3:["Large aircraft","airliner-narrow",34.1,37.6],A4:["High-vortex large aircraft","airliner-narrow",38,47.3],A5:["Heavy aircraft","airliner-wide",60.3,63.7],A6:["High-performance aircraft","military-jet",8,14],A7:["Rotorcraft","helicopter-medium",10.7,12.7],B1:["Glider","glider",17,7],B2:["Lighter-than-air","balloon",15,20],B4:["Ultralight","ultralight",9.5,6],B6:["Unmanned aircraft","unmanned",1.5,1]};static GENERIC={name:"Airliner",kind:"airliner-narrow",spanM:34.1,lengthM:37.6,basis:"nothing"};static of(t){const e=t?.type?.toUpperCase(),a=e?y.TYPES[e]:void 0;if(a)return{code:e,name:a[0],kind:a[1],spanM:a[2],lengthM:a[3],basis:"type"};const n=t?.category?y.CATEGORIES[t.category]:void 0;return n?{name:n[0],kind:n[1],spanM:n[2],lengthM:n[3],basis:"category"}:{...y.GENERIC}}static isHelicopter(t){return t.kind.startsWith("helicopter")}}class O{static DUSK_SUN_ELEVATION_DEG=-.83;static ALWAYS=new Set(["airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet"]);static NONE=new Set(["glider","balloon"]);static BRIGHTNESS={"light-piston":[.5,.2,.5],"turboprop-light":[.7,.4,.8],ultralight:[.4,.2,.4],unmanned:[0,.05,0],"helicopter-light":[1,1,1],"helicopter-medium":[1,1,1],"helicopter-heavy":[1,1,1],"military-jet":[1,1,1]};static LANDING_LIGHTS_BELOW_FT=1e4;static LANDING_INTENSITY=600;static LANDING_BEAM_DEG=10;static LANDING_COLOR="#fff1dc";static LANDING_BRIGHTNESS={"airliner-narrow":1,"airliner-wide":1,"regional-jet":.6,"regional-turboprop":.6,"business-jet":.4,"turboprop-light":.2,"light-piston":.1,ultralight:.05,"helicopter-light":.1,"helicopter-medium":.2,"helicopter-heavy":.2};static lampsOn(t,e){if(O.NONE.has(t))return{navigation:!1,beacon:!1,strobes:!1};if(O.ALWAYS.has(t))return{navigation:!0,beacon:!0,strobes:!0};const a=e<O.DUSK_SUN_ELEVATION_DEG;return t==="unmanned"?{navigation:!1,beacon:!1,strobes:a}:{navigation:a,beacon:a,strobes:a}}static lights(t,e){const a=O.lampsOn(t.kind,e),n=t.kind.startsWith("helicopter"),i=pt.find(u=>u.id===(n?"helicopter":"airliner")).create(),[o,r]=n?[5,7]:[17,18],c=t.spanM/2/o,h=t.lengthM/2/r,[s,d,l]=O.BRIGHTNESS[t.kind]??[1,1,1];return i.filter(u=>u.id.startsWith("nav")?a.navigation:u.id.startsWith("strobe")?a.strobes:u.id.startsWith("beacon")?a.beacon:!0).filter(u=>!(u.id.startsWith("beacon")&&!a.beacon)).map(u=>{const p=u.id.startsWith("nav")?s:u.id.startsWith("strobe")?d:l;return{...u,offsetM:{x:u.offsetM.x*c,y:u.offsetM.y,z:u.offsetM.z*h},intensity:(u.intensity??1)*p}}).filter(u=>(u.intensity??1)>0)}static landingLights(t,e,a){const n=O.LANDING_BRIGHTNESS[t.kind]??0;if(n===0||!O.lampsOn(t.kind,e).navigation)return[];const i=s=>s<O.LANDING_LIGHTS_BELOW_FT;if(!a.some(s=>i(s.altitudeFt)))return[];const o=O.LANDING_INTENSITY*n,r=a.flatMap((s,d)=>d>0&&i(s.altitudeFt)!==i(a[d-1].altitudeFt)?[{t:s.t,intensity:i(s.altitudeFt)?o:0}]:[]),c=t.spanM/34,h=t.lengthM/36;return[-1,1].map(s=>({id:s<0?"landing-left":"landing-right",offsetM:{x:s*5*c,y:-1,z:3*h},color:O.LANDING_COLOR,intensity:i(a[0].altitudeFt)?o:0,pattern:{kind:"steady"},beamDeg:O.LANDING_BEAM_DEG,keyframes:r}))}static bodyColor(t){return t.kind==="military-jet"?"#8a8e94":t.kind.startsWith("helicopter")?"#c8ccd1":t.kind==="unmanned"?"#2c2e33":"#dde0e4"}}class j{static FAMILIES={"amvlab-a320":["A318","A319","A320","A321","A19N","A20N","A21N"],"amvlab-b737":["B732","B733","B734","B735","B736","B737","B738","B739","B37M","B38M","B39M","B3XM"],"amvlab-a350":["A359","A35K"],"amvlab-a380":["A388"],"amvlab-b787":["B788","B789","B78X"]};static BY_TYPE=new Map(Object.entries(j.FAMILIES).flatMap(([t,e])=>e.map(a=>[a,t])));static idOf(t){return t?j.BY_TYPE.get(t.toUpperCase()):void 0}}class R{static ID_PREFIX=W.ID_PREFIX;static MAX_OBJECTS=40;static FT_TO_M=.3048;static DEG=Math.PI/180;static from(t,e,a,n=R.MAX_OBJECTS,i={}){return new yt(t,e,a,n,i).build()}static idOf(t,e){return W.idOf(t,e)}static keyOf(t){return W.keyOf(t)}static HEIGHT_OVER_LENGTH=.29;static sizeOf(t){return{widthM:t.spanM,lengthM:t.lengthM,heightM:t.lengthM*R.HEIGHT_OVER_LENGTH}}static offsetOf(t,e){const a=L.seenFrom(t,{lat:e.lat,lng:e.lng,heightM:e.altitudeFt*R.FT_TO_M}),n=a.distanceKm*1e3,i=n*Math.cos(a.altitudeDeg*R.DEG);return{eastM:i*Math.sin(a.azimuthDeg*R.DEG),northM:i*Math.cos(a.azimuthDeg*R.DEG),upM:n*Math.sin(a.altitudeDeg*R.DEG),altitudeDeg:a.altitudeDeg,distanceKm:a.distanceKm}}static segments(t){const e=[];let a=[];for(const n of t.points){const i=a[a.length-1];i&&n.t-i.t>F.MAX_GAP_S*1e3&&(e.push(a),a=[]),a.push(n)}return e.push(a),e.filter(n=>n.length>=2)}static bearingDeg(t,e){return(Math.atan2(e.eastM-t.eastM,e.northM-t.northM)/R.DEG+360)%360}}class yt{constructor(t,e,a,n,i){this.tracks=t,this.observer=e,this.startMs=a,this.maxObjects=n,this.options=i}build(){const t=[];for(const a of this.tracks){const n=R.keyOf(a),i=this.options.models?.get(n)??y.of(void 0);R.segments(a).forEach((o,r)=>{const c=o.map(u=>({point:u,at:R.offsetOf(this.observer,u)}));if(!c.some(u=>u.at.altitudeDeg>=0))return;const h=c.map((u,p)=>({t:u.point.t-this.startMs,eastM:u.at.eastM,northM:u.at.northM,altitudeM:u.at.upM,headingDeg:u.point.trackDeg??(p+1<c.length?R.bearingDeg(u.at,c[p+1].at):R.bearingDeg(c[p-1].at,u.at))})),s=R.idOf(a,r),d=c[Math.floor(c.length/2)].point,l=this.options.sunElevationAt?.(d)??90;t.push({object:{id:s,kind:"aircraft",eastM:h[0].eastM,northM:h[0].northM,headingDeg:h[0].headingDeg,sizeM:R.sizeOf(i),model:j.idOf(i.code)?{id:j.idOf(i.code)}:void 0,color:O.bodyColor(i),lights:[...O.lights(i,l),...O.landingLights(i,l,o.map(u=>({t:u.t-this.startMs,altitudeFt:u.altitudeFt})))],track:h},presence:{fromMs:h[0].t,untilMs:h[h.length-1].t},flight:{icao:a.icao,nonIcao:a.nonIcao,points:o},closestKm:Math.min(...c.map(u=>u.at.distanceKm))})})}t.sort((a,n)=>a.closestKm-n.closestKm);const e=t.slice(0,this.maxObjects);return{objects:e.map(a=>a.object),presence:new Map(e.map(a=>[a.object.id,a.presence])),flights:new Map(e.map(a=>[a.object.id,a.flight])),total:t.length,shown:e.length}}}const dt=[{id:"turbofan-narrow-body",name:"Turbofan airliner, narrow-body",kinds:["airliner-narrow"],totalDbA:148,shapeDb:[-32,-17,-9,-6,-5,-7,-12,-22],character:{toneHz:1800,toneShare:.3,humHz:90,humShare:.7}},{id:"turbofan-wide-body",name:"Turbofan airliner, wide-body",kinds:["airliner-wide"],totalDbA:151,shapeDb:[-28,-14,-7,-4,-3,-6,-12,-22],character:{toneHz:1200,toneShare:.3,humHz:70,humShare:.7}},{id:"regional-jet",name:"Regional jet",kinds:["regional-jet"],totalDbA:144,shapeDb:[-32,-17,-9,-5,-4,-6,-11,-21],character:{toneHz:1900,toneShare:.3,humHz:95,humShare:.7}},{id:"business-jet",name:"Business jet",kinds:["business-jet"],totalDbA:141,shapeDb:[-30,-15,-8,-4,-3,-4,-9,-19],character:{toneHz:2500,toneShare:.25,humHz:110,humShare:.7}},{id:"turboprop",name:"Turboprop",kinds:["regional-turboprop","turboprop-light"],totalDbA:138,shapeDb:[-14,-9,-8,-6,-8,-13,-20,-28],character:{toneHz:80,toneShare:.5}},{id:"light-piston",name:"Light piston aircraft",kinds:["light-piston"],totalDbA:130,shapeDb:[-18,-9,-5,-4,-8,-14,-22,-30],character:{toneHz:80,toneShare:.4}},{id:"ultralight",name:"Ultralight",kinds:["ultralight"],totalDbA:124,shapeDb:[-16,-8,-5,-4,-9,-15,-23,-31],character:{toneHz:140,toneShare:.4}},{id:"helicopter-light",name:"Light helicopter",kinds:["helicopter-light"],totalDbA:134,shapeDb:[-15,-8,-4,-3,-6,-10,-16,-24],character:{modulationHz:20,modulationDepth:.5}},{id:"helicopter-medium",name:"Medium helicopter",kinds:["helicopter-medium"],totalDbA:138,shapeDb:[-14,-7,-4,-3,-6,-10,-16,-24],character:{modulationHz:22,modulationDepth:.5}},{id:"helicopter-heavy",name:"Heavy helicopter",kinds:["helicopter-heavy"],totalDbA:144,shapeDb:[-12,-6,-4,-4,-7,-11,-17,-25],character:{modulationHz:17,modulationDepth:.5}},{id:"military-jet",name:"Military jet",kinds:["military-jet"],totalDbA:152,shapeDb:[-26,-12,-6,-3,-2,-3,-7,-15]},{id:"glider",name:"Glider",kinds:["glider"],totalDbA:85,shapeDb:[-30,-22,-15,-10,-8,-8,-14,-22]},{id:"balloon",name:"Hot-air balloon",kinds:["balloon"],totalDbA:100,shapeDb:[-25,-15,-9,-5,-3,-6,-12,-20]},{id:"unmanned",name:"Unmanned aircraft",kinds:["unmanned"],totalDbA:88,shapeDb:[-40,-30,-20,-12,-6,-3,-3,-8],character:{toneHz:450,toneShare:1}}],ht=dt.map(w=>({id:w.id,name:w.name,soundPowerA:w.shapeDb.map(t=>t+w.totalDbA-m.sumDb(w.shapeDb)),character:w.character}));class g{static DEFAULT_AMBIENT_DB_A=35;static DETECTION_MARGIN_DB=3;static AMBIENT_SHAPE_DB=[-12,-7,-5,-5,-7,-11,-17,-25];static HEARING_FLOOR_DB_A=0;static ITERATIONS=30;static CONVERGED_MS=.5;static VELOCITY_STEP_MS=500;static noiseOfKind(t){const e=dt.find(a=>a.kinds.includes(t));return ht.find(a=>a.id===(e?.id??"turbofan-narrow-body"))}static bandsAt(t,e,a=m.STANDARD){const n=20*Math.log10(Math.max(e*1e3,1))+11;return m.OCTAVES.map((i,o)=>t.soundPowerA[o]-n-m.absorptionDbPerKm(i,a)*e)}static couldBeHeard(t,e,a=g.DEFAULT_AMBIENT_DB_A,n=m.STANDARD){const i=g.ambientBands(a);return g.bandsAt(t,e,n).some((o,r)=>o>=Math.max(i[r]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A))}static ambientBands(t){const e=g.AMBIENT_SHAPE_DB,a=m.sumDb(e);return e.map(n=>t+n-a)}static heardAt(t,e,a,n={}){const i=n.air??m.STANDARD,o=m.speedOfSound(i.temperatureC),r=t.points[t.points.length-1]?.t;if(r===void 0)return;let c=Math.min(a,r),h=F.positionAt(t,c);if(!h)return;let s=L.seenFrom(e,h.geo);for(let b=0;b<g.ITERATIONS;b++){const N=a-s.distanceKm*1e3*1e3/o,K=Math.abs(N-c);if(c=N,h=F.positionAt(t,c),!h)return;if(s=L.seenFrom(e,h.geo),K<g.CONVERGED_MS)break}const d=F.positionAt(t,a),l=d?L.seenFrom(e,d.geo):s,u=n.noise??ht[0],p=n.ambientDbA??g.DEFAULT_AMBIENT_DB_A,A=g.ambientBands(p),M=g.bandsAt(u,s.distanceKm,i),f=M.map((b,N)=>b>=Math.max(A[N]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A)),I=M.indexOf(Math.max(...M)),S=f.lastIndexOf(!0);return{track:t,audible:f.some(Boolean),levelDbA:m.sumDb(M),bandsDbA:M,ambientDbA:p,delayS:(a-c)/1e3,emittedAtMs:c,sound:s,seen:l,lagDeg:g.angleBetween(s,l),dopplerRatio:g.doppler(t,e,c,o),dominantHz:m.OCTAVES[I],cutoffHz:S<0?void 0:m.OCTAVES[S]}}static profile(t,e,a,n,i=2e3,o={}){const r=[];let c,h,s=a;for(let d=a;d<=n;d+=i){const l=g.heardAt(t,e,d,o);l&&(!h||l.levelDbA>h.levelDbA)&&(h=l,s=d),l?.audible?c?c.untilMs=d:r.push(c={fromMs:d,untilMs:d}):c=void 0}return{track:t,audible:r,peakDbA:h?.levelDbA??-1/0,peakAtMs:s,peakDelayS:h?.delayS??0}}static angleBetween(t,e){const a=s=>{const d=s.altitudeDeg*Math.PI/180,l=s.azimuthDeg*Math.PI/180;return[Math.cos(d)*Math.sin(l),Math.cos(d)*Math.cos(l),Math.sin(d)]},[n,i,o]=a(t),[r,c,h]=a(e);return Math.acos(Math.min(1,Math.max(-1,n*r+i*c+o*h)))*180/Math.PI}static doppler(t,e,a,n){const i=g.VELOCITY_STEP_MS,o=F.positionAt(t,a-i),r=F.positionAt(t,a+i);if(!o||!r)return 1;const c=L.seenFrom(e,o.geo).distanceKm*1e3,h=L.seenFrom(e,r.geo).distanceKm*1e3;return 1/(1-(c-h)/(2*i/1e3)/n)}}class Ht{static at(t,e,a,n,i={}){const o=F.seenFrom(t,a,n);if(!o)return;const r=y.of(e),c=g.heardAt(t,a,n,{noise:g.noiseOfKind(r.kind),...i});return{hex:`${t.nonIcao?"~":""}${t.icao.toString(16).padStart(6,"0")}`,registration:e?.registration,typeCode:r.code??e?.type,name:r.basis==="nothing"?void 0:r.name,kind:r.kind,basis:r.basis,military:e?.military===!0,restricted:e?.restricted===!0,altitudeFt:o.altitudeFt,groundSpeedKt:o.groundSpeedKt,trackDeg:o.trackDeg,sky:o.sky,angularRateDegPerS:o.angularRateDegPerS,hearing:c&&{audible:c.audible,levelDbA:c.levelDbA,ambientDbA:c.ambientDbA,delayS:c.delayS,lagDeg:c.lagDeg,dopplerRatio:c.dopplerRatio,cutoffHz:c.cutoffHz,dominantHz:c.dominantHz}}}}class D{static REFERENCE_AMPLITUDE=.02;static MASKING_RANGE_DB=6;static KNEE_DB=20;static COMPRESSION_RATIO=1.5;static EXPANSION_RATIO=1.8;static DEFAULT_MAX_VOICES=4;static candidates(t,e,a,n,i={}){const o=new Set;for(const[r,c]of t){const h=g.noiseOfKind(y.of(e.get(a(c))).kind);let s=1/0;for(const d of c.points)s=Math.min(s,L.seenFrom(n,{lat:d.lat,lng:d.lng,heightM:d.altitudeFt*.3048}).distanceKm);g.couldBeHeard(h,s,i.ambientDbA,i.air)&&o.add(r)}return o}static voices(t,e,a,n,i,o,r={}){const c=[];for(const h of t){const s=e.get(h);if(!s||r.only?.(h)===!1)continue;const d=r.kindOf?.(h)??y.of(a.get(n(s))).kind,l=r.noiseOf?.(h)??g.noiseOfKind(d),u=g.heardAt(s,i,o,{...r,noise:l});if(!u?.audible)continue;const p=r.throughDb,A=p?u.bandsDbA.map((M,f)=>M-(p[f]??0)):u.bandsDbA;p&&!D.noticed(A,u.ambientDbA)||c.push({id:h,kind:d,bandAmplitudes:D.bandAmplitudes(A,u.ambientDbA,r.referenceAmplitude),levelDbA:p?m.sumDb(A):u.levelDbA,distanceKm:u.sound.distanceKm,dopplerRatio:u.dopplerRatio,azimuthDeg:u.sound.azimuthDeg,elevationDeg:u.sound.altitudeDeg,character:l.character})}return c.sort((h,s)=>s.levelDbA-h.levelDbA).slice(0,r.maxVoices??D.DEFAULT_MAX_VOICES)}static noticed(t,e){const a=g.ambientBands(e);return t.some((n,i)=>n>=a[i]+g.DETECTION_MARGIN_DB)}static bandAmplitudes(t,e,a=D.REFERENCE_AMPLITUDE){const n=g.ambientBands(e),i=g.DETECTION_MARGIN_DB,o=m.sumDb(t),r=o-e,c=r>=D.KNEE_DB?D.KNEE_DB+(r-D.KNEE_DB)/D.COMPRESSION_RATIO:D.KNEE_DB-(D.KNEE_DB-r)*D.EXPANSION_RATIO,h=a*10**(c/20);return t.map((s,d)=>{const l=Math.min(1,Math.max(0,(s-n[d]-i+D.MASKING_RANGE_DB)/(2*D.MASKING_RANGE_DB)));return l*l*(3-2*l)*h*10**((s-o)/20)})}static BANDS_HZ=m.OCTAVES}class V{static RUMBLE_BELOW_HZ=500;static DULL_BELOW_HZ=2e3;static PITCH_NOTICED=.03;static text(t,e,a,n){const i=(l,u=0)=>l.toLocaleString(n,{maximumFractionDigits:u}),o=(l,u)=>l.replace(/\{(\w+)\}/g,(p,A)=>u[A]??`{${A}}`),r=[],c=[t.registration,t.name].filter(Boolean).join(" · ");r.push(c||o(e.unnamed,{hex:t.hex}));const h=[o(e.altitude,{value:i(Math.round(t.altitudeFt/100)*100)}),t.groundSpeedKt===void 0?void 0:o(e.speed,{value:i(Math.round(t.groundSpeedKt))}),t.trackDeg===void 0?void 0:o(e.heading,{value:i(Math.round(t.trackDeg))})].filter(Boolean);r.push(h.join(" · ")),r.push(o(e.position,{distance:i(t.sky.distanceKm,t.sky.distanceKm<10?1:0),elevation:i(Math.round(t.sky.altitudeDeg)),bearing:a(t.sky.azimuthDeg)}));const s=t.hearing;if(!s)r.push(e.soundUnknown);else if(!s.audible)r.push(o(e.inaudible,{level:i(Math.round(s.levelDbA)),ambient:i(Math.round(s.ambientDbA))}));else{const l=s.cutoffHz??0,u=l<=V.RUMBLE_BELOW_HZ?e.rumble:l<=V.DULL_BELOW_HZ?e.muffled:e.broad,p=s.dopplerRatio-1,A=Math.abs(p)<V.PITCH_NOTICED?"":o(p>0?e.pitchHigher:e.pitchLower,{percent:i(Math.round(Math.abs(p)*100))});r.push(o(e.heard,{level:i(Math.round(s.levelDbA)),delay:i(Math.round(s.delayS)),lag:i(Math.round(s.lagDeg)),character:o(u,{cutoff:i(l)}),pitch:A}))}t.contrail&&r.push(o(t.contrail.persistent?e.contrailPersistent:e.contrailShort,{rhi:i(Math.round(t.contrail.iceRelativeHumidity*100))}));const d=[t.military?e.military:void 0,t.restricted?e.restricted:void 0].filter(Boolean);return d.length>0&&r.push(d.join(" · ")),r.push(e.candidate),r.join(`
|
|
1
|
+
import{a9 as J,aa as pt,ab as W,ac as L,ad as F,ae as U,af as At,x as $,ag as tt}from"./rr0-sighting-editor.mjs";import{ah as Gt}from"./rr0-sighting-editor.mjs";import{C as et}from"./ContrailGrowth-DwHS8If9.js";class m{static OCTAVES=[63,125,250,500,1e3,2e3,4e3,8e3];static STANDARD={temperatureC:15,relativeHumidity:.7,pressureKPa:101.325};static REFERENCE_PRESSURE_KPA=101.325;static REFERENCE_TEMPERATURE_K=293.15;static TRIPLE_POINT_K=273.16;static speedOfSound(t){return 20.0468*Math.sqrt(t+273.15)}static absorptionDbPerKm(t,e=m.STANDARD){const a=e.temperatureC+273.15,n=m.REFERENCE_TEMPERATURE_K,i=e.pressureKPa/m.REFERENCE_PRESSURE_KPA,o=10**(-6.8346*(m.TRIPLE_POINT_K/a)**1.261+4.6151),r=e.relativeHumidity*100*o/i,c=i*(24+40400*r*(.02+r)/(.391+r)),h=i*(a/n)**-.5*(9+280*r*Math.exp(-4.17*((a/n)**(-1/3)-1))),s=t*t;return 8.686*s*(184e-13*(1/i)*Math.sqrt(a/n)+(a/n)**-2.5*(.01275*Math.exp(-2239.1/a)/(c+s/c)+.1068*Math.exp(-3352/a)/(h+s/h)))*1e3}static aWeightingDb(t){const e=t*t,a=12194**2*e*e/((e+20.6**2)*Math.sqrt((e+107.7**2)*(e+737.9**2))*(e+12194**2));return 20*Math.log10(a)+2}static sumDb(t){return 10*Math.log10(t.reduce((e,a)=>e+10**(a/10),0))}}const gt=.25,at=.4,nt=6,z=12,mt=3,it=.2,Et=.2,Mt=24,bt=3,ft=12,st=1,Dt=.7,St=1.5,Rt=.8,It=1.3,rt=.9,ot=5,Ot=25,Bt=.5,Tt=.12,ct=[.13,.31],Nt=.16,vt=1.6,_t=3.6,lt=1.1,Ct=.3,kt=1e3,ut=.7;class x{context;constructor(t){this.context=t}noiseBuffer;roughBuffers=new Map;voices=new Map;bus;reverb;reverbOut;level=1;master;paused=!0;requested=[];headingDeg=0;resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(t){console.warn("AircraftAudio: Web Audio unavailable, aircraft stay silent:",t);return}}J.isLive(this.context)&&J.unlock(this.context),this.apply()}setLevel(t){this.level=t,this.master&&(this.master.gain.value=t)}setPaused(t){t!==this.paused&&(this.paused=t,this.apply())}setVoices(t,e=0){this.requested=t,this.headingDeg=e,this.apply()}dispose(){for(const t of[...this.voices.keys()])this.release(t);J.isLive(this.context)&&this.context.close(),this.context=void 0,this.master=void 0,this.bus=void 0}apply(){const t=this.context;if(!t)return;const e=this.paused?[]:this.requested,a=new Set(e.map(n=>n.id));for(const n of[...this.voices.keys()])a.has(n)||this.release(n);for(const n of e){const i=this.voices.get(n.id)??this.build(t,n);this.retarget(t,i,n)}}build(t,e){const a=t.createGain();a.gain.value=0;let n;const i=this.busOf(t);typeof t.createStereoPanner=="function"?(n=t.createStereoPanner(),a.connect(n).connect(i)):a.connect(i);const o=t.createGain(),r=e.character?.modulationDepth??0;o.gain.value=1-r/2;const c=t.createOscillator();c.type="sine";const h=t.createGain();h.gain.value=r/2,c.connect(h).connect(o.gain),o.connect(a);const s=t.createBufferSource();s.buffer=this.noise(t),s.loop=!0,s.loopStart=Math.random()*nt*.5;const d=[],l=[],u=[];for(const B of m.OCTAVES){const T=t.createBiquadFilter();T.type="bandpass",T.frequency.value=B,T.Q.value=st;const _=t.createBiquadFilter();_.type="bandpass",_.frequency.value=B,_.Q.value=st;const P=t.createGain();P.gain.value=0,s.connect(T).connect(_).connect(P).connect(o),d.push(T),l.push(_),u.push(P)}const p=[];for(const[B,T]of[[e.character?.toneHz,e.character?.toneShare],[e.character?.humHz,e.character?.humShare]])if(B!==void 0)for(let _=1;_<=bt;_++){const P=t.createOscillator();P.type="sine",P.frequency.value=B*_;const Y=t.createGain();Y.gain.value=0,P.connect(Y).connect(a),p.push({oscillator:P,gain:Y,harmonic:_,baseHz:B,share:T??0})}const A=t.createGain();A.gain.value=0,A.connect(a.gain);const M=ct.map(B=>{const T=t.createOscillator();return T.type="sine",T.frequency.value=B,T.connect(A),T}),f=t.createGain();f.gain.value=e.character?.roughness??it;const I=t.createBufferSource();I.buffer=this.roughTable(t,mt),I.loop=!0,I.loopStart=Math.random()*z*.5,I.connect(f).connect(o.gain);const S=t.createGain();S.gain.value=(e.character?.roughness??it)*Et;const b=t.createBufferSource();b.buffer=this.roughTable(t,Mt),b.loop=!0,b.loopStart=Math.random()*z*.5,b.connect(S).connect(o.gain);let N;const K=this.busOf(t)&&this.reverb;K&&(N=t.createGain(),N.gain.value=0,a.connect(N).connect(K));const q=[s,I,b,c,...p.map(B=>B.oscillator),...M];for(const B of q)B.start();const Q={nodes:[a,o,h,f,S,A,...p.map(B=>B.gain),...d,...l,...u,...N?[N]:[],...n?[n]:[],...q],sources:q,filters:d,seconds:l,gains:u,tones:p,lfo:c,lfoDepth:h,wander:M,wanderDepth:A,roughDepth:f,crackleDepth:S,beat:o,output:a,panner:n,send:N};return this.voices.set(e.id,Q),Q}retarget(t,e,a){const n=t.currentTime,i=(p,A)=>p.setTargetAtTime(A,n,gt),o=Math.min(St,Math.max(Dt,a.dopplerRatio)),r=Math.min(It,Math.max(Rt,Math.sqrt(a.dopplerRatio))),c=t.sampleRate*.45,h=a.bandAmplitudes.map((p,A)=>p*x.unweighting(m.OCTAVES[A])),s=Math.sqrt(h.reduce((p,A)=>p+A*A,0)),d=Math.min(1,Math.max(0,(a.distanceKm-ot)/(Ot-ot)));m.OCTAVES.forEach((p,A)=>{i(e.filters[A].frequency,Math.min(c,p*r)),i(e.seconds[A].frequency,Math.min(c,p*r)),i(e.gains[A].gain,h[A]*Math.sqrt(kt/p))});const l=a.character;for(const{oscillator:p,gain:A,harmonic:M,baseHz:f,share:I}of e.tones){const S=f*M;i(p.frequency,S*o);const b=S*o;i(A.gain,b<c?I*Nt*h[x.bandOf(b)]/M:0)}l?.modulationHz!==void 0&&i(e.lfo.frequency,l.modulationHz*o);const u=s>0?ut*(1-Math.exp(-s/ut))/s:1;if(i(e.output.gain,u*(1-Ct*d)),i(e.wanderDepth.gain,u*Tt*d/ct.length),e.send&&i(e.send.gain,vt*d),e.panner){const p=(a.azimuthDeg-this.headingDeg)*Math.PI/180,A=a.inside?0:Math.max(-rt,Math.min(rt,Math.sin(p)))*(1-Bt*d);i(e.panner.pan,A)}}static unweighting(t){return 10**(Math.min(ft,Math.max(0,-m.aWeightingDb(t)))/20)}static bandOf(t){let e=0;return m.OCTAVES.forEach((a,n)=>{Math.abs(Math.log(t/a))<Math.abs(Math.log(t/m.OCTAVES[e]))&&(e=n)}),e}roughTable(t,e){const a=this.roughBuffers.get(e);if(a)return a;const n=Math.floor(t.sampleRate*z),i=t.createBuffer(1,n,t.sampleRate),o=i.getChannelData(0),r=Array.from({length:z*e},()=>(Math.random()*2-1)**3),c=t.sampleRate/e;for(let h=0;h<o.length;h++){const s=h/c,d=Math.floor(s),l=s-d,u=l*l*(3-2*l);o[h]=r[d%r.length]*(1-u)+r[(d+1)%r.length]*u}return this.roughBuffers.set(e,i),i}roomImpulse(t){const e=Math.floor(t.sampleRate*_t),a=t.createBuffer(2,e,t.sampleRate);for(let n=0;n<2;n++){const i=a.getChannelData(n);let o=0;for(let r=0;r<e;r++){const c=r/t.sampleRate,h=.6*Math.exp(-c/(lt*2))+.04;o+=h*(Math.random()*2-1-o),i[r]=o*Math.exp(-c/lt)}}return a}busOf(t){if(this.bus)return this.bus;const e=t.createGain();if(e.gain.value=this.level,e.connect(t.destination),this.master=e,typeof t.createConvolver=="function"){const a=t.createConvolver();a.buffer=this.roomImpulse(t);const n=t.createGain();n.gain.value=.9,a.connect(n),this.reverb=a,this.reverbOut=n}if(typeof t.createDynamicsCompressor=="function"){const a=t.createDynamicsCompressor();a.threshold.value=-6,a.knee.value=3,a.ratio.value=4,a.attack.value=.005,a.release.value=.25,a.connect(e),this.bus=a}else this.bus=e;return this.reverbOut?.connect(this.bus),this.bus}release(t){const e=this.voices.get(t);if(!e)return;this.voices.delete(t);const a=this.context;a&&(e.output.gain.setTargetAtTime(0,a.currentTime,at/3),setTimeout(()=>{for(const n of e.sources)try{n.stop()}catch{}for(const n of e.nodes)n.disconnect()},at*1e3*3))}noise(t){if(this.noiseBuffer)return this.noiseBuffer;const e=t.createBuffer(1,t.sampleRate*nt,t.sampleRate),a=e.getChannelData(0);for(let n=0;n<a.length;n++)a[n]=Math.random()*2-1;return this.noiseBuffer=e,e}}class v{static BASE_DB_A=30;static WIND_DB_A=[[0,10],[1,28],[2,36],[3,40],[5,46],[8,52],[12,58],[20,66]];static RAIN_DB_A=[[0,0],[.1,42],[.3,50],[.6,58],[1,65]];static BED_RMS=.2;static MINIMUM_REFERENCE=.008;static WIND_BED_MIN_MS=1;static WIND_BED_FULL_MS=20;static dbA(t){const e=[v.BASE_DB_A,v.along(v.WIND_DB_A,t.windSpeed)];return(t.precipitationType==="rain"||t.precipitationType==="hail")&&e.push(v.along(v.RAIN_DB_A,t.precipitationIntensity)),10*Math.log10(e.filter(a=>a>0).reduce((a,n)=>a+10**(n/10),0))}static bedVolume(t){const e=t.windSpeed>v.WIND_BED_MIN_MS?Math.min(t.windSpeed/v.WIND_BED_FULL_MS,1):0,a=t.precipitationType==="hail"?Math.min(1,t.precipitationIntensity*1.3+.2):t.precipitationType==="rain"?t.precipitationIntensity:0;return Math.hypot(e,a)}static referenceAmplitude(t){return Math.max(v.BED_RMS*v.bedVolume(t),v.MINIMUM_REFERENCE)}static along(t,e){if(e<=t[0][0])return t[0][1];for(let a=1;a<t.length;a++)if(e<=t[a][0]){const[n,i]=t[a-1],[o,r]=t[a];return i+(r-i)*(e-n)/(o-n)}return t[t.length-1][1]}}class y{static TYPES={A318:["Airbus A318","airliner-narrow",34.1,31.4],A319:["Airbus A319","airliner-narrow",34.1,33.8],A320:["Airbus A320","airliner-narrow",34.1,37.6],A321:["Airbus A321","airliner-narrow",34.1,44.5],A19N:["Airbus A319neo","airliner-narrow",35.8,33.8],A20N:["Airbus A320neo","airliner-narrow",35.8,37.6],A21N:["Airbus A321neo","airliner-narrow",35.8,44.5],B737:["Boeing 737-700","airliner-narrow",34.3,33.6],B738:["Boeing 737-800","airliner-narrow",35.8,39.5],B739:["Boeing 737-900","airliner-narrow",35.8,42.1],B38M:["Boeing 737 MAX 8","airliner-narrow",35.9,39.5],B39M:["Boeing 737 MAX 9","airliner-narrow",35.9,42.2],B752:["Boeing 757-200","airliner-narrow",38,47.3],B753:["Boeing 757-300","airliner-narrow",38,54.4],B762:["Boeing 767-200","airliner-wide",47.6,48.5],B763:["Boeing 767-300","airliner-wide",47.6,54.9],B764:["Boeing 767-400","airliner-wide",51.9,61.4],B772:["Boeing 777-200","airliner-wide",60.9,63.7],B77L:["Boeing 777-200LR","airliner-wide",64.8,63.7],B77W:["Boeing 777-300ER","airliner-wide",64.8,73.9],B788:["Boeing 787-8","airliner-wide",60.1,56.7],B789:["Boeing 787-9","airliner-wide",60.1,62.8],B78X:["Boeing 787-10","airliner-wide",60.1,68.3],B744:["Boeing 747-400","airliner-wide",64.4,70.7],B748:["Boeing 747-8","airliner-wide",68.4,76.3],A306:["Airbus A300-600","airliner-wide",44.8,54.1],A310:["Airbus A310","airliner-wide",43.9,46.7],A332:["Airbus A330-200","airliner-wide",60.3,58.8],A333:["Airbus A330-300","airliner-wide",60.3,63.7],A338:["Airbus A330-800","airliner-wide",64,58.8],A339:["Airbus A330-900","airliner-wide",64,63.7],A343:["Airbus A340-300","airliner-wide",60.3,63.7],A346:["Airbus A340-600","airliner-wide",63.5,75.4],A359:["Airbus A350-900","airliner-wide",64.8,66.8],A35K:["Airbus A350-1000","airliner-wide",64.8,73.8],A388:["Airbus A380-800","airliner-wide",79.8,72.7],E170:["Embraer 170","regional-jet",26,29.9],E75L:["Embraer 175","regional-jet",26,31.7],E75S:["Embraer 175","regional-jet",26,31.7],E190:["Embraer 190","regional-jet",28.7,36.2],E195:["Embraer 195","regional-jet",28.7,38.7],E290:["Embraer 190-E2","regional-jet",33.7,36.2],E295:["Embraer 195-E2","regional-jet",33.7,41.5],CRJ2:["Bombardier CRJ200","regional-jet",21.2,26.8],CRJ7:["Bombardier CRJ700","regional-jet",23.2,32.3],CRJ9:["Bombardier CRJ900","regional-jet",24.9,36.2],CRJX:["Bombardier CRJ1000","regional-jet",26.2,39.1],AT72:["ATR 72","regional-turboprop",27.1,27.2],AT76:["ATR 72-600","regional-turboprop",27.1,27.2],AT45:["ATR 42","regional-turboprop",24.6,22.7],DH8D:["Dash 8 Q400","regional-turboprop",28.4,32.8],DH8C:["Dash 8-300","regional-turboprop",27.4,25.7],SF34:["Saab 340","regional-turboprop",21.4,19.7],B190:["Beechcraft 1900","regional-turboprop",17.7,17.6],C25A:["Cessna CitationJet CJ2","business-jet",14.3,14.4],C56X:["Cessna Citation Excel","business-jet",17.2,16],C68A:["Cessna Citation Latitude","business-jet",22,18.9],C550:["Cessna Citation II","business-jet",15.8,14.4],E55P:["Embraer Phenom 300","business-jet",15.9,15.6],E50P:["Embraer Phenom 100","business-jet",12.3,12.8],GLF5:["Gulfstream G550","business-jet",28.5,29.4],FA7X:["Dassault Falcon 7X","business-jet",26.2,23.4],CL60:["Bombardier Challenger 600","business-jet",19.6,20.9],LJ45:["Learjet 45","business-jet",14.6,17.7],H25B:["Hawker 800","business-jet",15.7,15.6],C172:["Cessna 172","light-piston",11,8.3],C152:["Cessna 152","light-piston",10.2,7.3],C182:["Cessna 182","light-piston",10.9,8.8],P28A:["Piper Cherokee","light-piston",10.7,7.2],PA34:["Piper Seneca","light-piston",11.8,8.7],SR20:["Cirrus SR20","light-piston",10.9,7.9],SR22:["Cirrus SR22","light-piston",11.7,7.9],S22T:["Cirrus SR22T","light-piston",11.7,7.9],DA40:["Diamond DA40","light-piston",11.6,8.1],DA42:["Diamond DA42","light-piston",13.4,8.6],BE20:["Beechcraft King Air 200","turboprop-light",16.6,13.3],BE58:["Beechcraft Baron","light-piston",11.5,9.1],C208:["Cessna Caravan","turboprop-light",15.9,11.5],PC12:["Pilatus PC-12","turboprop-light",16.3,14.4],TBM9:["Daher TBM 900","turboprop-light",12.8,10.7],EC35:["Airbus H135","helicopter-light",10.2,12.1],EC45:["Airbus H145","helicopter-medium",11,13.6],AS50:["Airbus H125","helicopter-light",10.7,12.9],EC30:["Airbus H130","helicopter-light",10.7,12.6],B407:["Bell 407","helicopter-light",10.7,12.7],B06:["Bell 206","helicopter-light",10.2,12],B429:["Bell 429","helicopter-medium",10.9,13],B505:["Bell 505","helicopter-light",10.4,11.9],R44:["Robinson R44","helicopter-light",10.1,11.7],R22:["Robinson R22","helicopter-light",7.7,8.8],A109:["Agusta A109","helicopter-medium",11,13],A139:["Leonardo AW139","helicopter-medium",13.8,16.7],S92:["Sikorsky S-92","helicopter-heavy",17.2,20.9],H60:["Sikorsky UH-60 Black Hawk","helicopter-heavy",16.4,19.8],T38:["Northrop T-38 Talon","military-jet",7.7,14.1],HAWK:["BAE Hawk","military-jet",9.4,11.9],GLID:["Glider","glider",17,7],BALL:["Balloon","balloon",15,20],ULAC:["Ultralight","ultralight",9.5,6],C42:["Ikarus C42","ultralight",9.4,6.3],DRON:["Drone","unmanned",1,.6]};static CATEGORIES={A1:["Light aircraft","light-piston",11,8.3],A2:["Small aircraft","business-jet",15,15],A3:["Large aircraft","airliner-narrow",34.1,37.6],A4:["High-vortex large aircraft","airliner-narrow",38,47.3],A5:["Heavy aircraft","airliner-wide",60.3,63.7],A6:["High-performance aircraft","military-jet",8,14],A7:["Rotorcraft","helicopter-medium",10.7,12.7],B1:["Glider","glider",17,7],B2:["Lighter-than-air","balloon",15,20],B4:["Ultralight","ultralight",9.5,6],B6:["Unmanned aircraft","unmanned",1.5,1]};static GENERIC={name:"Airliner",kind:"airliner-narrow",spanM:34.1,lengthM:37.6,basis:"nothing"};static of(t){const e=t?.type?.toUpperCase(),a=e?y.TYPES[e]:void 0;if(a)return{code:e,name:a[0],kind:a[1],spanM:a[2],lengthM:a[3],basis:"type"};const n=t?.category?y.CATEGORIES[t.category]:void 0;return n?{name:n[0],kind:n[1],spanM:n[2],lengthM:n[3],basis:"category"}:{...y.GENERIC}}static isHelicopter(t){return t.kind.startsWith("helicopter")}}class O{static DUSK_SUN_ELEVATION_DEG=-.83;static ALWAYS=new Set(["airliner-narrow","airliner-wide","regional-turboprop","regional-jet","business-jet"]);static NONE=new Set(["glider","balloon"]);static BRIGHTNESS={"light-piston":[.5,.2,.5],"turboprop-light":[.7,.4,.8],ultralight:[.4,.2,.4],unmanned:[0,.05,0],"helicopter-light":[1,1,1],"helicopter-medium":[1,1,1],"helicopter-heavy":[1,1,1],"military-jet":[1,1,1]};static LANDING_LIGHTS_BELOW_FT=1e4;static LANDING_INTENSITY=600;static LANDING_BEAM_DEG=10;static LANDING_COLOR="#fff1dc";static LANDING_BRIGHTNESS={"airliner-narrow":1,"airliner-wide":1,"regional-jet":.6,"regional-turboprop":.6,"business-jet":.4,"turboprop-light":.2,"light-piston":.1,ultralight:.05,"helicopter-light":.1,"helicopter-medium":.2,"helicopter-heavy":.2};static lampsOn(t,e){if(O.NONE.has(t))return{navigation:!1,beacon:!1,strobes:!1};if(O.ALWAYS.has(t))return{navigation:!0,beacon:!0,strobes:!0};const a=e<O.DUSK_SUN_ELEVATION_DEG;return t==="unmanned"?{navigation:!1,beacon:!1,strobes:a}:{navigation:a,beacon:a,strobes:a}}static lights(t,e){const a=O.lampsOn(t.kind,e),n=t.kind.startsWith("helicopter"),i=pt.find(u=>u.id===(n?"helicopter":"airliner")).create(),[o,r]=n?[5,7]:[17,18],c=t.spanM/2/o,h=t.lengthM/2/r,[s,d,l]=O.BRIGHTNESS[t.kind]??[1,1,1];return i.filter(u=>u.id.startsWith("nav")?a.navigation:u.id.startsWith("strobe")?a.strobes:u.id.startsWith("beacon")?a.beacon:!0).filter(u=>!(u.id.startsWith("beacon")&&!a.beacon)).map(u=>{const p=u.id.startsWith("nav")?s:u.id.startsWith("strobe")?d:l;return{...u,offsetM:{x:u.offsetM.x*c,y:u.offsetM.y,z:u.offsetM.z*h},intensity:(u.intensity??1)*p}}).filter(u=>(u.intensity??1)>0)}static landingLights(t,e,a){const n=O.LANDING_BRIGHTNESS[t.kind]??0;if(n===0||!O.lampsOn(t.kind,e).navigation)return[];const i=s=>s<O.LANDING_LIGHTS_BELOW_FT;if(!a.some(s=>i(s.altitudeFt)))return[];const o=O.LANDING_INTENSITY*n,r=a.flatMap((s,d)=>d>0&&i(s.altitudeFt)!==i(a[d-1].altitudeFt)?[{t:s.t,intensity:i(s.altitudeFt)?o:0}]:[]),c=t.spanM/34,h=t.lengthM/36;return[-1,1].map(s=>({id:s<0?"landing-left":"landing-right",offsetM:{x:s*5*c,y:-1,z:3*h},color:O.LANDING_COLOR,intensity:i(a[0].altitudeFt)?o:0,pattern:{kind:"steady"},beamDeg:O.LANDING_BEAM_DEG,keyframes:r}))}static bodyColor(t){return t.kind==="military-jet"?"#8a8e94":t.kind.startsWith("helicopter")?"#c8ccd1":t.kind==="unmanned"?"#2c2e33":"#dde0e4"}}class j{static FAMILIES={"amvlab-a320":["A318","A319","A320","A321","A19N","A20N","A21N"],"amvlab-b737":["B732","B733","B734","B735","B736","B737","B738","B739","B37M","B38M","B39M","B3XM"],"amvlab-a350":["A359","A35K"],"amvlab-a380":["A388"],"amvlab-b787":["B788","B789","B78X"]};static BY_TYPE=new Map(Object.entries(j.FAMILIES).flatMap(([t,e])=>e.map(a=>[a,t])));static idOf(t){return t?j.BY_TYPE.get(t.toUpperCase()):void 0}}class R{static ID_PREFIX=W.ID_PREFIX;static MAX_OBJECTS=40;static FT_TO_M=.3048;static DEG=Math.PI/180;static from(t,e,a,n=R.MAX_OBJECTS,i={}){return new yt(t,e,a,n,i).build()}static idOf(t,e){return W.idOf(t,e)}static keyOf(t){return W.keyOf(t)}static HEIGHT_OVER_LENGTH=.29;static sizeOf(t){return{widthM:t.spanM,lengthM:t.lengthM,heightM:t.lengthM*R.HEIGHT_OVER_LENGTH}}static offsetOf(t,e){const a=L.seenFrom(t,{lat:e.lat,lng:e.lng,heightM:e.altitudeFt*R.FT_TO_M}),n=a.distanceKm*1e3,i=n*Math.cos(a.altitudeDeg*R.DEG);return{eastM:i*Math.sin(a.azimuthDeg*R.DEG),northM:i*Math.cos(a.azimuthDeg*R.DEG),upM:n*Math.sin(a.altitudeDeg*R.DEG),altitudeDeg:a.altitudeDeg,distanceKm:a.distanceKm}}static segments(t){const e=[];let a=[];for(const n of t.points){const i=a[a.length-1];i&&n.t-i.t>F.MAX_GAP_S*1e3&&(e.push(a),a=[]),a.push(n)}return e.push(a),e.filter(n=>n.length>=2)}static bearingDeg(t,e){return(Math.atan2(e.eastM-t.eastM,e.northM-t.northM)/R.DEG+360)%360}}class yt{constructor(t,e,a,n,i){this.tracks=t,this.observer=e,this.startMs=a,this.maxObjects=n,this.options=i}build(){const t=[];for(const a of this.tracks){const n=R.keyOf(a),i=this.options.models?.get(n)??y.of(void 0);R.segments(a).forEach((o,r)=>{const c=o.map(u=>({point:u,at:R.offsetOf(this.observer,u)}));if(!c.some(u=>u.at.altitudeDeg>=0))return;const h=c.map((u,p)=>({t:u.point.t-this.startMs,eastM:u.at.eastM,northM:u.at.northM,altitudeM:u.at.upM,headingDeg:u.point.trackDeg??(p+1<c.length?R.bearingDeg(u.at,c[p+1].at):R.bearingDeg(c[p-1].at,u.at))})),s=R.idOf(a,r),d=c[Math.floor(c.length/2)].point,l=this.options.sunElevationAt?.(d)??90;t.push({object:{id:s,kind:"aircraft",eastM:h[0].eastM,northM:h[0].northM,headingDeg:h[0].headingDeg,sizeM:R.sizeOf(i),model:j.idOf(i.code)?{id:j.idOf(i.code)}:void 0,color:O.bodyColor(i),lights:[...O.lights(i,l),...O.landingLights(i,l,o.map(u=>({t:u.t-this.startMs,altitudeFt:u.altitudeFt})))],track:h},presence:{fromMs:h[0].t,untilMs:h[h.length-1].t},flight:{icao:a.icao,nonIcao:a.nonIcao,points:o},closestKm:Math.min(...c.map(u=>u.at.distanceKm))})})}t.sort((a,n)=>a.closestKm-n.closestKm);const e=t.slice(0,this.maxObjects);return{objects:e.map(a=>a.object),presence:new Map(e.map(a=>[a.object.id,a.presence])),flights:new Map(e.map(a=>[a.object.id,a.flight])),total:t.length,shown:e.length}}}const dt=[{id:"turbofan-narrow-body",name:"Turbofan airliner, narrow-body",kinds:["airliner-narrow"],totalDbA:148,shapeDb:[-32,-17,-9,-6,-5,-7,-12,-22],character:{toneHz:1800,toneShare:.3,humHz:90,humShare:.7}},{id:"turbofan-wide-body",name:"Turbofan airliner, wide-body",kinds:["airliner-wide"],totalDbA:151,shapeDb:[-28,-14,-7,-4,-3,-6,-12,-22],character:{toneHz:1200,toneShare:.3,humHz:70,humShare:.7}},{id:"regional-jet",name:"Regional jet",kinds:["regional-jet"],totalDbA:144,shapeDb:[-32,-17,-9,-5,-4,-6,-11,-21],character:{toneHz:1900,toneShare:.3,humHz:95,humShare:.7}},{id:"business-jet",name:"Business jet",kinds:["business-jet"],totalDbA:141,shapeDb:[-30,-15,-8,-4,-3,-4,-9,-19],character:{toneHz:2500,toneShare:.25,humHz:110,humShare:.7}},{id:"turboprop",name:"Turboprop",kinds:["regional-turboprop","turboprop-light"],totalDbA:138,shapeDb:[-14,-9,-8,-6,-8,-13,-20,-28],character:{toneHz:80,toneShare:.5}},{id:"light-piston",name:"Light piston aircraft",kinds:["light-piston"],totalDbA:130,shapeDb:[-18,-9,-5,-4,-8,-14,-22,-30],character:{toneHz:80,toneShare:.4}},{id:"ultralight",name:"Ultralight",kinds:["ultralight"],totalDbA:124,shapeDb:[-16,-8,-5,-4,-9,-15,-23,-31],character:{toneHz:140,toneShare:.4}},{id:"helicopter-light",name:"Light helicopter",kinds:["helicopter-light"],totalDbA:134,shapeDb:[-15,-8,-4,-3,-6,-10,-16,-24],character:{modulationHz:20,modulationDepth:.5}},{id:"helicopter-medium",name:"Medium helicopter",kinds:["helicopter-medium"],totalDbA:138,shapeDb:[-14,-7,-4,-3,-6,-10,-16,-24],character:{modulationHz:22,modulationDepth:.5}},{id:"helicopter-heavy",name:"Heavy helicopter",kinds:["helicopter-heavy"],totalDbA:144,shapeDb:[-12,-6,-4,-4,-7,-11,-17,-25],character:{modulationHz:17,modulationDepth:.5}},{id:"military-jet",name:"Military jet",kinds:["military-jet"],totalDbA:152,shapeDb:[-26,-12,-6,-3,-2,-3,-7,-15]},{id:"glider",name:"Glider",kinds:["glider"],totalDbA:85,shapeDb:[-30,-22,-15,-10,-8,-8,-14,-22]},{id:"balloon",name:"Hot-air balloon",kinds:["balloon"],totalDbA:100,shapeDb:[-25,-15,-9,-5,-3,-6,-12,-20]},{id:"unmanned",name:"Unmanned aircraft",kinds:["unmanned"],totalDbA:88,shapeDb:[-40,-30,-20,-12,-6,-3,-3,-8],character:{toneHz:450,toneShare:1}}],ht=dt.map(w=>({id:w.id,name:w.name,soundPowerA:w.shapeDb.map(t=>t+w.totalDbA-m.sumDb(w.shapeDb)),character:w.character}));class g{static DEFAULT_AMBIENT_DB_A=35;static DETECTION_MARGIN_DB=3;static AMBIENT_SHAPE_DB=[-12,-7,-5,-5,-7,-11,-17,-25];static HEARING_FLOOR_DB_A=0;static ITERATIONS=30;static CONVERGED_MS=.5;static VELOCITY_STEP_MS=500;static noiseOfKind(t){const e=dt.find(a=>a.kinds.includes(t));return ht.find(a=>a.id===(e?.id??"turbofan-narrow-body"))}static bandsAt(t,e,a=m.STANDARD){const n=20*Math.log10(Math.max(e*1e3,1))+11;return m.OCTAVES.map((i,o)=>t.soundPowerA[o]-n-m.absorptionDbPerKm(i,a)*e)}static couldBeHeard(t,e,a=g.DEFAULT_AMBIENT_DB_A,n=m.STANDARD){const i=g.ambientBands(a);return g.bandsAt(t,e,n).some((o,r)=>o>=Math.max(i[r]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A))}static ambientBands(t){const e=g.AMBIENT_SHAPE_DB,a=m.sumDb(e);return e.map(n=>t+n-a)}static heardAt(t,e,a,n={}){const i=n.air??m.STANDARD,o=m.speedOfSound(i.temperatureC),r=t.points[t.points.length-1]?.t;if(r===void 0)return;let c=Math.min(a,r),h=F.positionAt(t,c);if(!h)return;let s=L.seenFrom(e,h.geo);for(let b=0;b<g.ITERATIONS;b++){const N=a-s.distanceKm*1e3*1e3/o,K=Math.abs(N-c);if(c=N,h=F.positionAt(t,c),!h)return;if(s=L.seenFrom(e,h.geo),K<g.CONVERGED_MS)break}const d=F.positionAt(t,a),l=d?L.seenFrom(e,d.geo):s,u=n.noise??ht[0],p=n.ambientDbA??g.DEFAULT_AMBIENT_DB_A,A=g.ambientBands(p),M=g.bandsAt(u,s.distanceKm,i),f=M.map((b,N)=>b>=Math.max(A[N]+g.DETECTION_MARGIN_DB,g.HEARING_FLOOR_DB_A)),I=M.indexOf(Math.max(...M)),S=f.lastIndexOf(!0);return{track:t,audible:f.some(Boolean),levelDbA:m.sumDb(M),bandsDbA:M,ambientDbA:p,delayS:(a-c)/1e3,emittedAtMs:c,sound:s,seen:l,lagDeg:g.angleBetween(s,l),dopplerRatio:g.doppler(t,e,c,o),dominantHz:m.OCTAVES[I],cutoffHz:S<0?void 0:m.OCTAVES[S]}}static profile(t,e,a,n,i=2e3,o={}){const r=[];let c,h,s=a;for(let d=a;d<=n;d+=i){const l=g.heardAt(t,e,d,o);l&&(!h||l.levelDbA>h.levelDbA)&&(h=l,s=d),l?.audible?c?c.untilMs=d:r.push(c={fromMs:d,untilMs:d}):c=void 0}return{track:t,audible:r,peakDbA:h?.levelDbA??-1/0,peakAtMs:s,peakDelayS:h?.delayS??0}}static angleBetween(t,e){const a=s=>{const d=s.altitudeDeg*Math.PI/180,l=s.azimuthDeg*Math.PI/180;return[Math.cos(d)*Math.sin(l),Math.cos(d)*Math.cos(l),Math.sin(d)]},[n,i,o]=a(t),[r,c,h]=a(e);return Math.acos(Math.min(1,Math.max(-1,n*r+i*c+o*h)))*180/Math.PI}static doppler(t,e,a,n){const i=g.VELOCITY_STEP_MS,o=F.positionAt(t,a-i),r=F.positionAt(t,a+i);if(!o||!r)return 1;const c=L.seenFrom(e,o.geo).distanceKm*1e3,h=L.seenFrom(e,r.geo).distanceKm*1e3;return 1/(1-(c-h)/(2*i/1e3)/n)}}class Ht{static at(t,e,a,n,i={}){const o=F.seenFrom(t,a,n);if(!o)return;const r=y.of(e),c=g.heardAt(t,a,n,{noise:g.noiseOfKind(r.kind),...i});return{hex:`${t.nonIcao?"~":""}${t.icao.toString(16).padStart(6,"0")}`,registration:e?.registration,typeCode:r.code??e?.type,name:r.basis==="nothing"?void 0:r.name,kind:r.kind,basis:r.basis,military:e?.military===!0,restricted:e?.restricted===!0,altitudeFt:o.altitudeFt,groundSpeedKt:o.groundSpeedKt,trackDeg:o.trackDeg,sky:o.sky,angularRateDegPerS:o.angularRateDegPerS,hearing:c&&{audible:c.audible,levelDbA:c.levelDbA,ambientDbA:c.ambientDbA,delayS:c.delayS,lagDeg:c.lagDeg,dopplerRatio:c.dopplerRatio,cutoffHz:c.cutoffHz,dominantHz:c.dominantHz}}}}class D{static REFERENCE_AMPLITUDE=.02;static MASKING_RANGE_DB=6;static KNEE_DB=20;static COMPRESSION_RATIO=1.5;static EXPANSION_RATIO=1.8;static DEFAULT_MAX_VOICES=4;static candidates(t,e,a,n,i={}){const o=new Set;for(const[r,c]of t){const h=g.noiseOfKind(y.of(e.get(a(c))).kind);let s=1/0;for(const d of c.points)s=Math.min(s,L.seenFrom(n,{lat:d.lat,lng:d.lng,heightM:d.altitudeFt*.3048}).distanceKm);g.couldBeHeard(h,s,i.ambientDbA,i.air)&&o.add(r)}return o}static voices(t,e,a,n,i,o,r={}){const c=[];for(const h of t){const s=e.get(h);if(!s||r.only?.(h)===!1)continue;const d=r.kindOf?.(h)??y.of(a.get(n(s))).kind,l=r.noiseOf?.(h)??g.noiseOfKind(d),u=g.heardAt(s,i,o,{...r,noise:l});if(!u?.audible)continue;const p=r.throughDb,A=p?u.bandsDbA.map((M,f)=>M-(p[f]??0)):u.bandsDbA;p&&!D.noticed(A,u.ambientDbA)||c.push({id:h,kind:d,bandAmplitudes:D.bandAmplitudes(A,u.ambientDbA,r.referenceAmplitude),levelDbA:p?m.sumDb(A):u.levelDbA,distanceKm:u.sound.distanceKm,dopplerRatio:u.dopplerRatio,azimuthDeg:u.sound.azimuthDeg,elevationDeg:u.sound.altitudeDeg,character:l.character})}return c.sort((h,s)=>s.levelDbA-h.levelDbA).slice(0,r.maxVoices??D.DEFAULT_MAX_VOICES)}static noticed(t,e){const a=g.ambientBands(e);return t.some((n,i)=>n>=a[i]+g.DETECTION_MARGIN_DB)}static bandAmplitudes(t,e,a=D.REFERENCE_AMPLITUDE){const n=g.ambientBands(e),i=g.DETECTION_MARGIN_DB,o=m.sumDb(t),r=o-e,c=r>=D.KNEE_DB?D.KNEE_DB+(r-D.KNEE_DB)/D.COMPRESSION_RATIO:D.KNEE_DB-(D.KNEE_DB-r)*D.EXPANSION_RATIO,h=a*10**(c/20);return t.map((s,d)=>{const l=Math.min(1,Math.max(0,(s-n[d]-i+D.MASKING_RANGE_DB)/(2*D.MASKING_RANGE_DB)));return l*l*(3-2*l)*h*10**((s-o)/20)})}static BANDS_HZ=m.OCTAVES}class V{static RUMBLE_BELOW_HZ=500;static DULL_BELOW_HZ=2e3;static PITCH_NOTICED=.03;static text(t,e,a,n){const i=(l,u=0)=>l.toLocaleString(n,{maximumFractionDigits:u}),o=(l,u)=>l.replace(/\{(\w+)\}/g,(p,A)=>u[A]??`{${A}}`),r=[],c=[t.registration,t.name].filter(Boolean).join(" · ");r.push(c||o(e.unnamed,{hex:t.hex}));const h=[o(e.altitude,{value:i(Math.round(t.altitudeFt/100)*100)}),t.groundSpeedKt===void 0?void 0:o(e.speed,{value:i(Math.round(t.groundSpeedKt))}),t.trackDeg===void 0?void 0:o(e.heading,{value:i(Math.round(t.trackDeg))})].filter(Boolean);r.push(h.join(" · ")),r.push(o(e.position,{distance:i(t.sky.distanceKm,t.sky.distanceKm<10?1:0),elevation:i(Math.round(t.sky.altitudeDeg)),bearing:a(t.sky.azimuthDeg)}));const s=t.hearing;if(!s)r.push(e.soundUnknown);else if(!s.audible)r.push(o(e.inaudible,{level:i(Math.round(s.levelDbA)),ambient:i(Math.round(s.ambientDbA))}));else{const l=s.cutoffHz??0,u=l<=V.RUMBLE_BELOW_HZ?e.rumble:l<=V.DULL_BELOW_HZ?e.muffled:e.broad,p=s.dopplerRatio-1,A=Math.abs(p)<V.PITCH_NOTICED?"":o(p>0?e.pitchHigher:e.pitchLower,{percent:i(Math.round(Math.abs(p)*100))});r.push(o(e.heard,{level:i(Math.round(s.levelDbA)),delay:i(Math.round(s.delayS)),lag:i(Math.round(s.lagDeg)),character:o(u,{cutoff:i(l)}),pitch:A}))}t.contrail&&r.push(o(t.contrail.persistent?e.contrailPersistent:e.contrailShort,{rhi:i(Math.round(t.contrail.iceRelativeHumidity*100))}));const d=[t.military?e.military:void 0,t.restricted?e.restricted:void 0].filter(Boolean);return d.length>0&&r.push(d.join(" · ")),r.push(e.candidate),r.join(`
|
|
2
2
|
`)}}class Z{static EFFICIENCY={"airliner-narrow":.34,"airliner-wide":.38,"regional-jet":.32,"business-jet":.3,"military-jet":.22,unknown:.34};static efficiencyOf(t){return Z.EFFICIENCY[t]}}class E{static EMISSION_INDEX_WATER=1.25;static COMBUSTION_HEAT=432e5;static AIR_HEAT_CAPACITY=1004;static MOLAR_MASS_RATIO=.622;static FT_TO_M=.3048;static TROPOPAUSE_M=11e3;static TROPOPAUSE_HPA=226.32;static ISOTHERMAL_SCALE_HEIGHT_M=6341.62;static pressureAtAltitudeFt(t){const e=t*E.FT_TO_M;return e<=E.TROPOPAUSE_M?1013.25*(1-225577e-10*e)**5.25588:E.TROPOPAUSE_HPA*Math.exp(-(e-E.TROPOPAUSE_M)/E.ISOTHERMAL_SCALE_HEIGHT_M)}static saturationOverWaterPa(t){const e=t+273.15;return Math.exp(54.842763-6763.22/e-4.21*Math.log(e)+367e-6*e+Math.tanh(.0415*(e-218.8))*(53.878-1331.22/e-9.44523*Math.log(e)+.014025*e))}static saturationOverIcePa(t){const e=t+273.15;return Math.exp(9.550426-5723.265/e+3.53068*Math.log(e)-.00728332*e)}static iceRelativeHumidity(t,e){return e*E.saturationOverWaterPa(t)/E.saturationOverIcePa(t)}static mixingSlope(t,e){return E.EMISSION_INDEX_WATER*E.AIR_HEAT_CAPACITY*t*100/(E.MOLAR_MASS_RATIO*E.COMBUSTION_HEAT*(1-e))}static criticalTemperatureC(t,e){const a=Math.log(E.mixingSlope(t,e)-.053);return-46.46+9.43*a+.72*a*a}static requiredHumidity(t,e,a){const n=E.criticalTemperatureC(t,e);return(E.mixingSlope(t,e)*(a-n)+E.saturationOverWaterPa(n))/E.saturationOverWaterPa(a)}static evaluate(t,e){const a=E.criticalTemperatureC(t.pressureHpa,e),n=E.requiredHumidity(t.pressureHpa,e,t.temperatureC),i=E.iceRelativeHumidity(t.temperatureC,t.relativeHumidity),o=t.temperatureC<a&&t.relativeHumidity>=n;return{forms:o,persistent:o&&i>=1,criticalTemperatureC:a,requiredHumidity:n,iceRelativeHumidity:i}}}class k{static HOLD_MS=36e5;static DEG=Math.PI/180;static GAS_CONSTANT_OVER_GRAVITY=287.05/9.80665;static at(t,e,a){if(t.length===0)return;const n=t[0],i=t[t.length-1];if(e<n.t-k.HOLD_MS||e>i.t+k.HOLD_MS)return;const o=t.findIndex(u=>u.t>e),r=o===0?t[0]:t[(o===-1?t.length:o)-1],c=o===-1||o===0?r:t[o],h=k.atLevel(r,a),s=k.atLevel(c,a);if(!h||!s)return;const d=c.t>r.t?Math.min(1,Math.max(0,(e-r.t)/(c.t-r.t))):0,l=(u,p)=>u+(p-u)*d;return{pressureHpa:a,temperatureC:l(h.temperatureC,s.temperatureC),relativeHumidity:l(h.relativeHumidity,s.relativeHumidity),driftEastMs:l(h.driftEastMs,s.driftEastMs),driftNorthMs:l(h.driftNorthMs,s.driftNorthMs),shearPerS:l(h.shearPerS,s.shearPerS)}}static atLevel(t,e){const a=t.levels;for(let n=0;n+1<a.length;n++){const i=a[n],o=a[n+1];if(e>i.pressureHpa||e<o.pressureHpa)continue;const r=(Math.log(i.pressureHpa)-Math.log(e))/(Math.log(i.pressureHpa)-Math.log(o.pressureHpa)),c=(u,p)=>u+(p-u)*r,h=u=>{const p=u.windFromDeg*k.DEG;return{east:-u.windSpeedMs*Math.sin(p),north:-u.windSpeedMs*Math.cos(p)}},s=h(i),d=h(o),l=k.GAS_CONSTANT_OVER_GRAVITY*((i.temperatureC+o.temperatureC)/2+273.15)*Math.log(i.pressureHpa/o.pressureHpa);return{pressureHpa:e,temperatureC:c(i.temperatureC,o.temperatureC),relativeHumidity:c(i.relativeHumidity,o.relativeHumidity),driftEastMs:c(s.east,d.east),driftNorthMs:c(s.north,d.north),shearPerS:Math.hypot(d.east-s.east,d.north-s.north)/l}}}}class H{static MIN_ALTITUDE_FT=2e4;static DENSE_MS=3e5;static SPARSE_STEP_MS=6e4;static SATURATION_HORIZON_MS=3*36e5;static SATURATION_STEP_MS=6e5;static PRESSURE_STEP_HPA=5;static plan(t,e,a,n){if(a.length===0)return[];const i=[],o=new Map,r=(c,h,s)=>{const d=Math.round(h/H.PRESSURE_STEP_HPA)*H.PRESSURE_STEP_HPA,l=H.SATURATION_STEP_MS,u=Math.floor(c/l)*l,p=`${d}|${u}`,A=o.get(p);if(A!==void 0)return A+(u-c)/1e3;let M=1/0;for(let f=l;f<=H.SATURATION_HORIZON_MS;f+=l){const I=k.at(a,u+f,d);if(!I)break;if(E.evaluate(I,s).iceRelativeHumidity<1){M=f/1e3;break}}return o.set(p,M),M+(u-c)/1e3};for(const c of t.objects){const h=t.flights.get(c.id),s=c.track;if(!h||!s||s.length!==h.points.length)continue;const d=e?.get(W.keyOf(h))??y.of(void 0),l=Z.efficiencyOf(d.kind);if(l===void 0)continue;const u=[];let p=-1/0;s.forEach((A,M)=>{if(A.t<-H.DENSE_MS&&M+1<s.length&&A.t-p<H.SPARSE_STEP_MS)return;p=A.t;const f=h.points[M],I=E.pressureAtAltitudeFt(f.altitudeFt),S=k.at(a,n+A.t,I),b=S&&E.evaluate(S,l);u.push({tMs:A.t,eastM:A.eastM,northM:A.northM,upM:A.altitudeM??0,forms:b?.forms??!1,persistent:b?.persistent??!1,lifetimeS:b?et.lifetimeS(b.iceRelativeHumidity):0,driftEastMs:S?.driftEastMs??0,driftNorthMs:S?.driftNorthMs??0,shearPerS:S?.shearPerS??et.TYPICAL_SHEAR_PER_S,iceRelativeHumidity:b?.iceRelativeHumidity??0,saturatedForS:b?.persistent?r(n+A.t,I,l):0})}),u.some((A,M)=>A.forms&&u[M+1]?.forms)&&i.push({id:c.id,spanM:d.spanM,points:u})}return i}}class C{static DEFAULT_KIND=U.DEFAULT_KIND;static STEP_MS=1e3;static LEAD_MS=12e4;static FT_PER_M=1/.3048;static ID_PREFIX="decor:";tracks=new Map;static kindOf(t,e){return U.kindOf(t,e)}static flies(t){return U.flies(t)}voices(t,e,a,n={},i=()=>{}){const o=t.event.place?.[0];if(!o)return[];const r=new Map,c=new Map,h=Math.max(t.observerTrack.duration,(t.event.durationSeconds??0)*1e3);for(const s of t.decor){const d=U.kindOf(s,i(s));if(!d)continue;const l=`${C.ID_PREFIX}${s.id}`;r.set(l,this.trackOf(s,l,o,h)),c.set(l,d)}for(const s of this.tracks.keys())r.has(s)||this.tracks.delete(s);return r.size===0?[]:D.voices(new Set(r.keys()),r,new Map,s=>String(s.icao),a,e,{...n,kindOf:s=>c.get(s)})}trackOf(t,e,a,n){const i=JSON.stringify([t.track,t.eastM,t.northM,t.headingDeg,a.lat,a.lng,n]),o=this.tracks.get(e);if(o?.key===i)return o.track;const r=[];for(let l=0;l<=n;l+=C.STEP_MS)r.push(C.pointAt(t,l,a));(r.length===0||r[r.length-1].t<n)&&r.push(C.pointAt(t,n,a));const c=r[0],h=r[1]??c,s=l=>(h[l]-c[l])/(h.t-c.t||1);for(let l=C.STEP_MS*10;l<=C.LEAD_MS;l+=C.STEP_MS*10)r.unshift({t:-l,lat:c.lat-s("lat")*l,lng:c.lng-s("lng")*l,altitudeFt:Math.max(0,c.altitudeFt-s("altitudeFt")*l)});const d={icao:C.hash(e),nonIcao:!0,points:r};return this.tracks.set(e,{key:i,track:d}),d}static pointAt(t,e,a){const n=At(t,e),i=$(n.eastM,-n.northM,a.lat,a.lng);return{t:e,lat:i.lat,lng:i.lng,altitudeFt:n.altitudeM*C.FT_PER_M}}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}class X{static CABIN_DB_A={"airliner-wide":76,"airliner-narrow":78,"regional-jet":78,"business-jet":82,"regional-turboprop":84,"turboprop-light":88,"light-piston":92,"military-jet":95,ultralight:95,"helicopter-light":95,"helicopter-medium":96,"helicopter-heavy":98,glider:70,balloon:60};static DEFAULT_DB_A=78;static voice(t,e={}){const a=tt.aircraftOf(t);if(!a)return;const n=g.noiseOfKind(a),i=tt.insulationDb(t),o=n.soundPowerA.map((s,d)=>s-i[d]),r=m.sumDb(o),c=X.levelDbA(a,t?.noise),h=o.map(s=>s-r+c);return{id:"observer:cabin",kind:a,bandAmplitudes:D.bandAmplitudes(h,e.ambientDbA??0,e.referenceAmplitude),levelDbA:c,inside:!0,distanceKm:0,dopplerRatio:1,azimuthDeg:0,elevationDeg:0,character:n.character}}static levelDbA(t,e){return(X.CABIN_DB_A[t]??X.DEFAULT_DB_A)+20*Math.log10(Math.max(e??1,.01))}}class G{static STEP_MS=250;static FT_PER_M=1/.3048;static ID_PREFIX="body:";tracks=new Map;static noiseOf(t){const e=g.noiseOfKind(t.kind),a=t.quieterDb??0;return a===0?e:{...e,id:`${e.id}-${a}dB`,soundPowerA:e.soundPowerA.map(n=>n-a)}}voices(t,e,a,n,i,o,r={}){const c=new Map,h=new Map,s=new Map;for(const l of t){if(!l.sound)continue;const u=`${G.ID_PREFIX}${l.id}`,p=this.trackOf(l,u,e,n,o);p&&(c.set(u,p),h.set(u,l.sound.kind),s.set(u,G.noiseOf(l.sound)))}for(const l of this.tracks.keys())c.has(l)||this.tracks.delete(l);if(c.size===0)return[];const d=$(a.eastM,-a.northM,n.lat,n.lng);return D.voices(new Set(c.keys()),c,new Map,l=>String(l.icao),{lat:d.lat,lng:d.lng,heightM:a.upM},i,{...r,kindOf:l=>h.get(l),noiseOf:l=>s.get(l)})}trackOf(t,e,a,n,i){const o=`${n.lat},${n.lng},${i}`,r=this.tracks.get(e);if(r&&r.body===t&&r.origin===o)return r.track;const c=[];for(let s=-12e4;s<=i;s+=G.STEP_MS){const d=a(t,s);if(!d)continue;const l=$(d.eastM,-d.northM,n.lat,n.lng);c.push({t:s,lat:l.lat,lng:l.lng,altitudeFt:d.upM*G.FT_PER_M})}if(c.length<2)return;const h={icao:G.hash(e),nonIcao:!0,points:c};return this.tracks.set(e,{body:t,origin:o,track:h}),h}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}export{x as AircraftAudio,H as AircraftContrails,y as AircraftModels,v as AmbientNoise,G as BodyHearing,X as CabinHearing,C as DecorAircraftHearing,R as TrafficDecor,Ht as TrafficInfos,D as TrafficSound,V as TrafficTooltip,Gt as UPPER_AIR_SOURCES};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rr0/ufoathome",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.179.0",
|
|
5
5
|
"description": "UFO@home — record and replay a UFO sighting's shape, movement and appearance",
|
|
6
6
|
"author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={title:"Title",time:"When",by:"Interviewer",medium:"Medium",witness:"Witness",witnessNone:"—",summary:"Description",transcript:"Transcript",transcriptHint:"Address of the anonymised transcript file (optional)",summaryTab:"Summary",fileTab:"File",importFile:"Load a file",importFileHint:"JSON, text, WebVTT, SRT",inputFileFromFile:"from your disk",inputFileFromUrl:"from an address",inputFileModeHint:"Click to give it the other way: a file of yours, or an address",inputFileLoad:"Load",saveButton:"Save",loading:"Loading the transcript…",invalid:"This text is not valid JSON yet: the interview keeps the last transcript it understood.",notATranscript:"That file is not an interview transcript (it has no segments).",loadFailed:"That transcript could not be read.",editorLabel:"Interview transcript as JSON",byHint:"RR0 people ids, separated by commas",exchangesTab:"Exchanges",exchangesEmpty:"Nothing was said yet.",redacted:"Passage removed",colon:": ",proofreadAll:"Proofread by everyone.",proofreadPending:"Not proofread yet by: {names}",play:"Play",pause:"Pause",recordings:"Recordings ({n})",recordingsTitle:"Recordings",recordingKind:"Type",recordingAudio:"Audio",recordingVideo:"Video",recordingFile:"File",recordingOffset:"Offset",recordingRemove:"Remove",recordingAdd:"Add a recording",close:"Close",noRecording:"No recording: add the audio or video file of the interview to listen to it.",redactSelection:"Take out the selection",redactedWords:"passage taken out · {n} word(s)",redactAll:"Take all out",restoreAll:"Restore all",editTurn:"Edit",deleteTurn:"Delete this turn",saveTurn:"Save",cancelTurn:"Cancel",turnEditHint:"⟦ … ⟧ marks a passage taken out",selectionOnePassage:"The selection has to stay within one passage not taken out.",selectionNone:"Select words of a passage to take them out.",reviewedBy:"{name} has proofread",linkMoment:"Link to a moment…",momentLabel:"Moment {k} · {text}",unlinkMoment:"Remove this link",noMoments:"The observation has no named moment yet.",redactReason:"taken out at proofreading",roles:{interviewer:"Interviewer",interviewee:"Interviewee",witness:"Witness"}};export{e as interviewMessages_en};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={title:"Título",time:"Fecha",by:"Entrevistador",medium:"Medio",witness:"Testigo",witnessNone:"—",summary:"Descripción",transcript:"Transcripción",transcriptHint:"Dirección del archivo de transcripción anonimizada (opcional)",summaryTab:"Resumen",fileTab:"Archivo",importFile:"Cargar un archivo",importFileHint:"JSON, texto, WebVTT, SRT",inputFileFromFile:"desde su disco",inputFileFromUrl:"desde una dirección",inputFileModeHint:"Pulsar para darlo de la otra forma: un archivo suyo o una dirección",inputFileLoad:"Cargar",saveButton:"Guardar",loading:"Cargando la transcripción…",invalid:"Este texto aún no es JSON válido: la entrevista conserva la última transcripción que entendió.",notATranscript:"Ese archivo no es una transcripción de entrevista (no tiene turnos de palabra).",loadFailed:"No se pudo leer esa transcripción.",editorLabel:"Transcripción de la entrevista en JSON",byHint:"Identificadores de personas de RR0, separados por comas",exchangesTab:"Intercambios",exchangesEmpty:"Todavía no se ha dicho nada.",redacted:"Pasaje eliminado",colon:": ",proofreadAll:"Revisado por todos.",proofreadPending:"Aún no revisado por: {names}",play:"Reproducir",pause:"Pausa",recordings:"Grabaciones ({n})",recordingsTitle:"Grabaciones",recordingKind:"Tipo",recordingAudio:"Audio",recordingVideo:"Vídeo",recordingFile:"Archivo",recordingOffset:"Desfase",recordingRemove:"Quitar",recordingAdd:"Añadir una grabación",close:"Cerrar",noRecording:"Sin grabación: añada el archivo de audio o vídeo de la entrevista para poder escucharla.",redactSelection:"Retirar la selección",redactedWords:"pasaje retirado · {n} palabra(s)",redactAll:"Retirar todo",restoreAll:"Restablecer todo",editTurn:"Modificar",deleteTurn:"Eliminar este turno de palabra",saveTurn:"Guardar",cancelTurn:"Cancelar",turnEditHint:"⟦ … ⟧ marca un pasaje retirado",selectionOnePassage:"La selección debe caber en un solo pasaje no retirado.",selectionNone:"Seleccione palabras de un pasaje para retirarlas.",reviewedBy:"{name} ha revisado",linkMoment:"Vincular a un momento…",momentLabel:"Momento {k} · {text}",unlinkMoment:"Quitar este vínculo",noMoments:"La observación aún no tiene momentos con nombre.",redactReason:"retirado en la revisión",roles:{interviewer:"Entrevistador",interviewee:"Entrevistado",witness:"Testigo"}};export{e as interviewMessages_es};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={title:"Titre",time:"Date",by:"Enquêteur",medium:"Moyen",witness:"Témoin",witnessNone:"—",summary:"Description",transcript:"Transcription",transcriptHint:"Adresse du fichier de transcription anonymisée (facultative)",summaryTab:"Résumé",fileTab:"Fichier",importFile:"Charger un fichier",importFileHint:"JSON, texte, WebVTT, SRT",inputFileFromFile:"depuis votre disque",inputFileFromUrl:"depuis une adresse",inputFileModeHint:"Cliquer pour le donner autrement : un fichier à vous, ou une adresse",inputFileLoad:"Charger",saveButton:"Sauver",loading:"Chargement de la transcription…",invalid:"Ce texte n'est pas encore du JSON valide : l'interview garde la dernière transcription qu'elle a comprise.",notATranscript:"Ce fichier n'est pas une transcription d'interview (il n'a pas de tours de parole).",loadFailed:"Cette transcription n'a pas pu être lue.",editorLabel:"Transcription de l'interview en JSON",byHint:"Identifiants de personnes RR0, séparés par des virgules",exchangesTab:"Échanges",exchangesEmpty:"Rien n'a encore été dit.",redacted:"Passage retiré",colon:" : ",proofreadAll:"Relu par tous les participants.",proofreadPending:"Pas encore relu par : {names}",play:"Lecture",pause:"Pause",recordings:"Enregistrements ({n})",recordingsTitle:"Enregistrements",recordingKind:"Type",recordingAudio:"Audio",recordingVideo:"Vidéo",recordingFile:"Fichier",recordingOffset:"Décalage",recordingRemove:"Retirer",recordingAdd:"Ajouter un enregistrement",close:"Fermer",noRecording:"Aucun enregistrement : ajoutez le fichier audio ou vidéo de l'entretien pour pouvoir l'écouter.",redactSelection:"Retirer la sélection",redactedWords:"passage retiré · {n} mot(s)",redactAll:"Retirer tout",restoreAll:"Rétablir tout",editTurn:"Modifier",deleteTurn:"Supprimer ce tour de parole",saveTurn:"Enregistrer",cancelTurn:"Annuler",turnEditHint:"⟦ … ⟧ marque un passage retiré",selectionOnePassage:"La sélection doit tenir dans un seul passage non retiré.",selectionNone:"Sélectionnez des mots d'un passage pour les retirer.",reviewedBy:"{name} a relu",linkMoment:"Relier à un moment…",momentLabel:"Moment {k} · {text}",unlinkMoment:"Retirer ce lien",noMoments:"L'observation n'a pas encore de moment nommé.",redactReason:"retiré à la relecture",roles:{interviewer:"Intervieweur",interviewee:"Interviewé",witness:"Témoin"}};export{e as interviewMessages_fr};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const i={title:"Titolo",time:"Data",by:"Intervistatore",medium:"Mezzo",witness:"Testimone",witnessNone:"—",summary:"Descrizione",transcript:"Trascrizione",transcriptHint:"Indirizzo del file di trascrizione anonimizzata (facoltativo)",summaryTab:"Riepilogo",fileTab:"File",importFile:"Carica un file",importFileHint:"JSON, testo, WebVTT, SRT",inputFileFromFile:"dal proprio disco",inputFileFromUrl:"da un indirizzo",inputFileModeHint:"Fare clic per darlo nell'altro modo: un proprio file o un indirizzo",inputFileLoad:"Carica",saveButton:"Salva",loading:"Caricamento della trascrizione…",invalid:"Questo testo non è ancora JSON valido: l'intervista conserva l'ultima trascrizione che ha capito.",notATranscript:"Quel file non è una trascrizione di intervista (non ha turni di parola).",loadFailed:"Impossibile leggere quella trascrizione.",editorLabel:"Trascrizione dell'intervista in JSON",byHint:"Identificatori di persone RR0, separati da virgole",exchangesTab:"Scambi",exchangesEmpty:"Non è stato ancora detto nulla.",redacted:"Passaggio rimosso",colon:": ",proofreadAll:"Rivisto da tutti.",proofreadPending:"Non ancora rivisto da: {names}",play:"Riproduci",pause:"Pausa",recordings:"Registrazioni ({n})",recordingsTitle:"Registrazioni",recordingKind:"Tipo",recordingAudio:"Audio",recordingVideo:"Video",recordingFile:"File",recordingOffset:"Scarto",recordingRemove:"Rimuovi",recordingAdd:"Aggiungi una registrazione",close:"Chiudi",noRecording:"Nessuna registrazione: aggiungi il file audio o video dell'intervista per poterla ascoltare.",redactSelection:"Rimuovi la selezione",redactedWords:"passaggio rimosso · {n} parola/e",redactAll:"Rimuovi tutto",restoreAll:"Ripristina tutto",editTurn:"Modifica",deleteTurn:"Elimina questo turno",saveTurn:"Salva",cancelTurn:"Annulla",turnEditHint:"⟦ … ⟧ indica un passaggio rimosso",selectionOnePassage:"La selezione deve restare in un solo passaggio non rimosso.",selectionNone:"Seleziona parole di un passaggio per rimuoverle.",reviewedBy:"{name} ha riletto",linkMoment:"Collega a un momento…",momentLabel:"Momento {k} · {text}",unlinkMoment:"Rimuovi questo collegamento",noMoments:"L'osservazione non ha ancora momenti con nome.",redactReason:"rimosso in rilettura",roles:{interviewer:"Intervistatore",interviewee:"Intervistato",witness:"Testimone"}};export{i as interviewMessages_it};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{c as y,_ as d,a$ as E}from"./rr0-scene.mjs";import{P as b,S as w,a as x,b as j,I as g,E as k,c as v}from"./ParameterForm-ez-n_0Dw.js";import{L as T}from"./LaunchPlume-eEIp7_hM.js";import{T as I}from"./TimelineTracks-BQXJMJaJ.js";const S=y.catalog({en:()=>d(()=>import("./LaunchParameterTexts_en-DvrCwbDM.js"),[],import.meta.url).then(r=>r.launchParameterTexts_en),fr:()=>d(()=>import("./LaunchParameterTexts_fr-Bh_1zVzy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_fr),es:()=>d(()=>import("./LaunchParameterTexts_es--RUAegVp.js"),[],import.meta.url).then(r=>r.launchParameterTexts_es),it:()=>d(()=>import("./LaunchParameterTexts_it-CWDx9nJy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_it)});class n{static plumeValue(e){return t=>T.plumeOf(t)[e]}static plume(e,t){return{type:"number",key:`plume.${e}`,effective:n.plumeValue(e),...t}}static burn(e,t){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t.label,hint:t.hint,group:"engine",effective:i=>t.ends(i.track??[])?.t}}static placeAt(e,t){if(e.length===0)return{t,lat:0,lng:0,altitudeKm:0};if(e.length===1)return{t,lat:e[0].lat,lng:e[0].lng,altitudeKm:e[0].altitudeKm};let i=0;for(;i<e.length-2&&e[i+1].t<t;)i++;const s=e[i],a=e[i+1],l=a.t===s.t?0:(t-s.t)/(a.t-s.t),o=(m,h)=>m+(h-m)*l;return{t,lat:o(s.lat,a.lat),lng:o(s.lng,a.lng),altitudeKm:Math.max(0,o(s.altitudeKm,a.altitudeKm))}}static instantsOf(e){return[...e.track.map(t=>t.t),...[e.burnFromT,e.burnUntilT].filter(t=>t!==void 0),...(e.jets??[]).flatMap(t=>[t.fromT,t.untilT])]}static SET={kind:"launch",title:"launch",parameters:[{type:"said",key:"title",label:"name",group:"vehicle"},{type:"text",key:"vehicle.mission",label:"mission",placeholder:"Starlink Group 10-49",group:"vehicle"},{type:"number",key:"vehicle.engine.thrustKN",min:1,max:1e5,step:1,unit:"kN",label:"thrustVacuum",hint:"merlinVacuum934Rl10110A",group:"engine"},{type:"number",key:"vehicle.engine.specificImpulseS",min:100,max:500,step:1,unit:"s",label:"specificImpulseVacuum",hint:"times981MSIt",group:"engine"},{type:"choice",key:"vehicle.engine.propellant",label:"propellant",hint:"whatTheExhaustIsMadeOf",choices:[{value:"rp1-lox",label:"keroseneAndOxygen"},{value:"methane-lox",label:"methaneAndOxygen"},{value:"hydrogen-lox",label:"hydrogenAndOxygen"},{value:"hypergolic",label:"hypergolic"},{value:"solid",label:"solid"}],group:"engine"},n.burn("burnFromT",{label:"engineStart",hint:"whenTheEngineStartedInSeconds",ends:e=>e[0]}),n.burn("burnUntilT",{label:"engineCutOff",hint:"whenTheEngineStoppedInSeconds",ends:e=>e[e.length-1]}),n.plume("exhaustKgPerS",{min:.1,max:1e5,step:.1,unit:"kg/s",label:"exhaustFlow",hint:"howMuchExhaustLeavesTheEngine",group:"plume"}),n.plume("condensedShare",{min:0,max:1,step:.01,label:"shareThatScatters",hint:"theShareOfTheExhaustThat",group:"plume"}),n.plume("particleRadiusUm",{min:.05,max:5,step:.05,unit:"µm",label:"particleRadius",group:"plume"}),n.plume("lifetimeS",{min:10,max:3600,step:10,unit:"s",label:"trailLifetime",hint:"howLongTheNarrowTrailLasts",group:"plume"}),n.plume("expansionKmPerS",{min:0,max:5,step:.01,unit:"km/s",label:"trailSpreading",group:"plume"}),n.plume("initialRadiusKm",{min:0,max:50,step:.1,unit:"km",label:"radiusAtRelease",group:"plume"}),n.plume("collarShare",{min:0,max:1,step:.01,label:"shareInTheCollar",hint:"theCollarIsTheExhaustJust",group:"collar"}),n.plume("collarExpansionKmPerS",{min:0,max:10,step:.05,unit:"km/s",label:"collarSpreading",hint:"howFastTheCollarWidensThree",group:"collar"}),n.plume("collarLifetimeS",{min:1,max:300,step:1,unit:"s",label:"collarLifetime",group:"collar"})]};static PLACE={kind:"launch-place",title:"placeOfThePath",parameters:[{type:"number",key:"t",min:-3600,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecordingNegativeBefore"},{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:1,label:"position"},{type:"number",key:"altitudeKm",min:0,max:2e3,step:.1,unit:"km",required:!0,label:"altitude"}]};static jetContext(e,t){return{launch:e,index:t}}static jetValue(e){return(t,i)=>{const{launch:s,index:a}=i??{};return s?e(T.releaseOf(s,t,a)):void 0}}static JET_GROUP="jet";static JET={kind:"launch-jet",title:"jet",parameters:[{type:"choice",key:"kind",required:!0,label:"what",choices:[{value:"burn",label:"engineBurn"},{value:"vent",label:"propellantVented"}],group:n.JET_GROUP},{type:"number",key:"fromT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"from",hint:"secondsOfTheRecordingNegativeBefore2",group:n.JET_GROUP},{type:"number",key:"untilT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"until",group:n.JET_GROUP},{type:"number",key:"angleDeg",min:0,max:180,step:1,unit:"°",effective:()=>0,label:"directionFromAft",hint:"t0StraightBackAlongTheStage",group:n.JET_GROUP},{type:"number",key:"azimuthDeg",min:-360,max:360,step:1,unit:"°",effective:()=>0,label:"side",hint:"roundTheLineOfMotionWhich",group:n.JET_GROUP},{type:"number",key:"spinPeriodS",min:-3600,max:3600,step:.1,unit:"s",label:"spinPeriod",hint:"howLongTheStageTakesTo",group:n.JET_GROUP},{type:"number",key:"speedKmPerS",min:0,max:10,step:.01,unit:"km/s",effective:n.jetValue(e=>e.speedKmPerS),label:"speed",hint:"howFastItLeavesTheStage",group:n.JET_GROUP},{type:"number",key:"massKgPerS",min:0,max:1e5,step:.1,unit:"kg/s",effective:n.jetValue(e=>e.massKgPerS),label:"flow",group:n.JET_GROUP},{type:"number",key:"condensedShare",min:0,max:1,step:.01,effective:n.jetValue(e=>e.condensedShare),label:"shareThatScatters",group:n.JET_GROUP},{type:"number",key:"particleRadiusUm",min:.05,max:5,step:.05,unit:"µm",effective:n.jetValue(e=>e.particleRadiusUm),label:"particleRadius",group:n.JET_GROUP},{type:"number",key:"expansionKmPerS",min:0,max:5,step:.01,unit:"km/s",effective:n.jetValue(e=>e.populations[0].expansionKmPerS),label:"spreading",hint:"howFastEachPuffOfIt",group:n.JET_GROUP},{type:"number",key:"initialRadiusKm",min:0,max:50,step:.1,unit:"km",effective:n.jetValue(e=>e.initialRadiusKm),label:"radiusAtRelease",group:n.JET_GROUP},{type:"number",key:"lifetimeS",min:1,max:7200,step:1,unit:"s",effective:n.jetValue(e=>e.populations[0].lifetimeS),label:"lifetime",group:n.JET_GROUP}]};static publish(){b.publish(n.SET)}}const O=y.catalog({en:()=>d(()=>import("./LaunchEditorMessages_en-BnzNAYW9.js"),[],import.meta.url).then(r=>r.launchEditorMessages_en),fr:()=>d(()=>import("./LaunchEditorMessages_fr-Ds_VOB8c.js"),[],import.meta.url).then(r=>r.launchEditorMessages_fr),es:()=>d(()=>import("./LaunchEditorMessages_es-BE0dEl7I.js"),[],import.meta.url).then(r=>r.launchEditorMessages_es),it:()=>d(()=>import("./LaunchEditorMessages_it-DPQaR8HY.js"),[],import.meta.url).then(r=>r.launchEditorMessages_it)});class u{constructor(e,t,i){this.container=e,this.host=t,w.attach(e,"launch-editor-part",u.STYLE),this.language=i,b.of("launch")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="path";placeForm;placeIndex=0;jetForm;jetIndex=0;language;shown=[];static STYLE='.launch-editor-part { flex-basis: 100%; min-width: 0; } .launch-editor-part #launch-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .launch-editor-part .launch-path > .icon-btn { align-self: flex-end; } .launch-editor-part #launch-list, .launch-editor-part #launch-places { flex-basis: 100%; min-width: 0; } .launch-editor-part .launch-editor, .launch-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .launch-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .launch-editor-part [hidden] { display: none !important; } .launch-editor-part select { min-width: 0; width: 100%; } .launch-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-track { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .launch-editor-part .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .launch-editor-part input, .launch-editor-part select { max-width: 100%; box-sizing: border-box; } .launch-editor-part input[type="text"] { width: 12em; } .launch-editor-part #launch-title { width: 18em; } .launch-editor-part label { min-width: 0; max-width: 100%; } .launch-editor-part input.parameter-derived::placeholder { opacity: .65; } .launch-editor-part .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([O.load(e),S.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.launches;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("launch-fields").hidden=t===void 0,!t)return;this.syncPlace(!0),this.syncJet(!0);const i=this.resolved(b.of("launch"));this.form??=new x(this.element("launch-parameters"),this.language,"",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i,t,()=>this.written())}refresh(){if(!this.messages)return;this.syncAddState();const e=this.launches;if(e.length===this.shown.length&&e.every((t,i)=>t===this.shown[i])){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.startOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="path",this.placeIndex=0,this.jetIndex=0,this.sync())}resolved(e){return j.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
2
|
-
<p class="launch-intro">${e.intro}</p>
|
|
3
|
-
<div id="launch-list"></div>
|
|
4
|
-
<div id="launch-fields" class="launch-fields">
|
|
5
|
-
<div id="launch-parameters" class="launch-parameters"></div>
|
|
6
|
-
<div id="launch-timeline" class="launch-timeline"></div>
|
|
7
|
-
<button id="launch-jet-add-burn" type="button" title="${e.addJet}">${g.PLUS} ${e.jetBurn}</button>
|
|
8
|
-
<button id="launch-jet-add-vent" type="button" title="${e.addJet}">${g.PLUS} ${e.jetVent}</button>
|
|
9
|
-
<p class="launch-intro">${e.timelineNote}</p>
|
|
10
|
-
<fieldset id="launch-path" class="launch-path">
|
|
11
|
-
<legend>${e.path}</legend>
|
|
12
|
-
<div id="launch-place-parameters" class="launch-parameters"></div>
|
|
13
|
-
<button id="launch-place-delete" class="icon-btn" type="button" title="${e.deletePlace}" aria-label="${e.deletePlace}">${g.TRASH}</button>
|
|
14
|
-
</fieldset>
|
|
15
|
-
<fieldset id="launch-jets" class="launch-path">
|
|
16
|
-
<legend id="launch-jet-legend">${e.jet}</legend>
|
|
17
|
-
<div id="launch-jet-parameters" class="launch-parameters"></div>
|
|
18
|
-
<button id="launch-jet-delete" class="icon-btn" type="button" title="${e.deleteJet}" aria-label="${e.deleteJet}">${g.TRASH}</button>
|
|
19
|
-
</fieldset>
|
|
20
|
-
<p class="launch-intro">${e.derivedNote}</p>
|
|
21
|
-
</div>
|
|
22
|
-
</div>`;const t=this.element("launch-list");this.list=new k({header:t,body:this.element("launch-fields"),ids:{list:"launch-select",remove:"launch-delete",add:"launch-add",kinds:"launch-add-kind",kind:i=>`launch-add-${i}`},onSelect:i=>this.show(i),onAdd:i=>this.addLaunch(i??u.VEHICLES[0].id),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.launch,remove:e.deleteLaunch,add:e.addLaunch,empty:e.none}),this.list.setKinds(u.VEHICLES.map(i=>({value:i.id,label:i.vehicle.name??i.id}))),this.timeline=new I(this.element("launch-timeline"),i=>this.host.seekTo(i),{addKeyframeHere:e.addHere,keyframeHere:e.here,zoomHint:e.zoomHint}),this.element("launch-jet-add-burn").addEventListener("click",()=>this.addJet("burn",this.host.currentTime())),this.element("launch-jet-add-vent").addEventListener("click",()=>this.addJet("vent",this.host.currentTime())),this.element("launch-place-delete").addEventListener("click",()=>this.removePlace()),this.element("launch-jet-delete").addEventListener("click",()=>this.removeJet()),this.placeForm=void 0,this.jetForm=void 0}written(){this.host.changed();const e=this.current;e&&(this.list?.rename(e.id,this.labelOf(e)),this.syncTimeline())}static PATH_COLOR="#e08a1e";static JET_COLOR="#4f8fd6";jetLabel(e,t){return`${e.kind==="vent"?this.messages.jetVent:this.messages.jetBurn} ${t+1}`}syncTimeline(){const e=this.current;if(!this.timeline||!e)return;const i={id:"path",label:this.messages.path,color:u.PATH_COLOR,times:e.track.map(h=>h.t),active:this.row==="path",selectedTime:this.row==="path"?e.track[this.placeIndex]?.t:void 0,open:()=>this.selectPlace(this.placeIndex),pressed:(h,c)=>{const p=c===void 0?-1:(this.current?.track??[]).findIndex(f=>f.t===c);this.selectPlace(p>=0?p:this.placeIndex)},move:(h,c)=>this.movePlace(h,c),add:()=>this.addPlaceAt(this.host.currentTime())},s=(e.jets??[]).map((h,c)=>({id:`jet-${c}`,label:this.jetLabel(h,c),color:u.JET_COLOR,times:[h.fromT,h.untilT],spans:[{t:h.fromT,until:h.untilT,label:""}],active:this.row==="jet"&&c===this.jetIndex,open:()=>this.selectJet(c),pressed:()=>this.selectJet(c),move:(p,f)=>this.moveJetEnd(c,p,f),add:()=>this.addJet(h.kind??"burn",this.host.currentTime())})),a=n.instantsOf(e),l=Math.min(...a),o=Math.max(...a),m=Math.max(500,(o-l)/10);this.timeline.show([i,...s],this.host.duration(),this.host.currentTime(),{from:l-m,to:o+m})}syncDetail(){const t=this.current?.jets?.[this.jetIndex];this.row==="jet"&&!t&&(this.row="path"),this.element("launch-path").hidden=this.row!=="path",this.element("launch-jets").hidden=this.row!=="jet",this.element("launch-jet-legend").textContent=t?this.jetLabel(t,this.jetIndex):this.messages.jet}static MIN_PLACES=2;syncPlace(e=!1){const t=this.current?.track??[];this.placeIndex=Math.max(0,Math.min(this.placeIndex,t.length-1)),this.element("launch-place-delete").disabled=t.length<=u.MIN_PLACES,this.placeForm?this.placeForm.sync(e):(this.placeForm=new x(this.element("launch-place-parameters"),this.language,"launchPlace."),this.placeForm.show(this.resolved(n.PLACE),new v(()=>this.current?.track[this.placeIndex],i=>this.editPlace(this.placeIndex,i),void 0,this.host.positionPlace?.()),()=>{})),this.syncDetail(),this.syncTimeline()}selectPlace(e){this.row="path",this.placeIndex=e,this.syncPlace(!0)}editPlace(e,t){const i=this.current;if(!i)return;const s={...i.track[e]};t(s),i.track=i.track.map((a,l)=>l===e?s:a).sort((a,l)=>a.t-l.t),this.placeIndex=i.track.indexOf(s),this.syncPlace(),this.written()}movePlace(e,t){const i=this.current?.track.findIndex(s=>s.t===e)??-1;i<0||(this.editPlace(i,s=>{s.t=t}),this.syncPlace(!0))}addPlaceAt(e){const t=this.current;if(!t)return;const i=t.track.findIndex(s=>Math.abs(s.t-e)<1);if(i<0){const s=n.placeAt(t.track,Math.round(e));t.track=[...t.track,s].sort((a,l)=>a.t-l.t),this.host.changed(),this.selectPlace(t.track.indexOf(s));return}this.selectPlace(i)}removePlace(){const e=this.current;!e||e.track.length<=u.MIN_PLACES||(e.track=e.track.filter((t,i)=>i!==this.placeIndex),this.syncPlace(!0),this.host.changed())}syncJet(e=!1){const t=this.current?.jets??[];this.jetIndex=Math.max(0,Math.min(this.jetIndex,t.length-1)),this.jetForm?this.jetForm.sync(e):(this.jetForm=new x(this.element("launch-jet-parameters"),this.language,"launchJet."),this.jetForm.show(this.resolved(n.JET),new v(()=>this.current?.jets?.[this.jetIndex],i=>this.editJet(this.jetIndex,i),()=>this.current?n.jetContext(this.current,this.jetIndex):void 0),()=>{})),this.syncDetail(),this.syncTimeline()}selectJet(e){this.row="jet",this.jetIndex=e,this.syncJet(!0)}editJet(e,t){const i=this.current;if(!i?.jets)return;const s={...i.jets[e]};t(s),i.jets=i.jets.map((a,l)=>l===e?s:a),this.written()}moveJetEnd(e,t,i){const s=this.current?.jets?.[e];s&&(this.editJet(e,a=>{const l=t===s.fromT?[i,s.untilT]:[s.fromT,i];a.fromT=Math.min(l[0],l[1]),a.untilT=Math.max(l[0],l[1])}),this.selectJet(e))}addJet(e,t){const i=this.current;if(!i)return;const s=i.track,a=Math.round(t),l=e==="vent"?{kind:e,fromT:a,untilT:a+3e4,angleDeg:90}:{kind:e,fromT:a,untilT:a+3e4};!i.jets?.length&&i.burnFromT===void 0&&i.burnUntilT===void 0&&(i.burnFromT=s[0].t,i.burnUntilT=s[s.length-1].t),i.jets=[...i.jets??[],l],this.form?.sync(!0),this.host.changed(),this.selectJet(i.jets.length-1)}removeJet(){const e=this.current;if(!e?.jets?.length)return;const t=e.jets.filter((i,s)=>s!==this.jetIndex);t.length?e.jets=t:delete e.jets,this.host.changed(),t.length?this.selectJet(Math.min(this.jetIndex,t.length-1)):this.selectPlace(this.placeIndex)}startOfNew(){const e=this.host.sighting(),t=e.event?.place?.[0];if(t?.lat===void 0||t.lng===void 0)return;const i=(e.observerTrack?.getInterpolatedPoseAt(0)?.headingDeg??0)*Math.PI/180,s=a=>({lat:t.lat+a*Math.cos(i)/111.32,lng:t.lng+a*Math.sin(i)/(111.32*Math.max(.05,Math.cos(t.lat*Math.PI/180)))});return[{t:0,...s(300),altitudeKm:80},{t:6e4,...s(450),altitudeKm:160}]}static VEHICLES=[{id:"falcon-9",vehicle:{name:"Falcon 9"}}];addLaunch(e){const t=this.startOfNew();if(!t)return;const i=u.VEHICLES.find(o=>o.id===e)??u.VEHICLES[0];let s=this.launches.length+1;for(;this.launches.some(o=>o.id===`launch-${s}`);)s++;const a={id:`launch-${s}`,vehicle:{...i.vehicle},track:t},l=this.host.sighting();l.skyEvents={...l.skyEvents,launches:[...this.launches,a]},this.currentId=a.id,this.row="path",this.placeIndex=0,this.host.changed(),this.sync()}deleteCurrent(){const e=this.current;if(!e)return;this.currentId=void 0;const t=this.host.sighting();t.skyEvents=E.written({...t.skyEvents,launches:this.launches.filter(i=>i!==e)}),this.host.changed(),this.sync()}labelOf(e){const t=this.host.said().read(e.title)??e.vehicle?.mission??e.vehicle?.name;return t?`${t} (${e.id})`:e.id}get launches(){return this.host.sighting().skyEvents?.launches??[]}element(e){return this.container.querySelector(`#${e}`)}}export{u as LaunchEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={title:"Title",time:"When",by:"Interviewer",medium:"Medium",witness:"Witness",witnessNone:"—",summary:"Description",transcript:"Transcript",transcriptHint:"Address of the anonymised transcript file (optional)",summaryTab:"Summary",fileTab:"File",importFile:"Load a file",importFileHint:"JSON, text, WebVTT, SRT",inputFileFromFile:"from your disk",inputFileFromUrl:"from an address",inputFileModeHint:"Click to give it the other way: a file of yours, or an address",inputFileLoad:"Load",saveButton:"Save",loading:"Loading the transcript…",invalid:"This text is not valid JSON yet: the interview keeps the last transcript it understood.",notATranscript:"That file is not an interview transcript (it has no segments).",loadFailed:"That transcript could not be read.",editorLabel:"Interview transcript as JSON",byHint:"RR0 people ids, separated by commas",exchangesTab:"Exchanges",exchangesEmpty:"Nothing was said yet.",redacted:"Passage removed",colon:": ",proofreadAll:"Proofread by everyone.",proofreadPending:"Not proofread yet by: {names}",play:"Play",pause:"Pause",recordings:"Recordings ({n})",recordingsTitle:"Recordings",recordingKind:"Type",recordingAudio:"Audio",recordingVideo:"Video",recordingFile:"File",recordingOffset:"Offset",recordingRemove:"Remove",recordingAdd:"Add a recording",close:"Close",noRecording:"No recording: add the audio or video file of the interview to listen to it.",redactSelection:"Take out the selection",redactedWords:"passage taken out · {n} word(s)",redactAll:"Take all out",restoreAll:"Restore all",editTurn:"Edit",deleteTurn:"Delete this turn",saveTurn:"Save",cancelTurn:"Cancel",turnEditHint:"⟦ … ⟧ marks a passage taken out",selectionOnePassage:"The selection has to stay within one passage not taken out.",selectionNone:"Select words of a passage to take them out.",reviewedBy:"{name} has proofread",linkMoment:"Link to a moment…",momentLabel:"Moment {k} · {text}",unlinkMoment:"Remove this link",noMoments:"The observation has no named moment yet.",redactReason:"taken out at proofreading",roles:{interviewer:"Interviewer",interviewee:"Interviewee",witness:"Witness"}};export{e as interviewMessages_en};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={title:"Título",time:"Fecha",by:"Entrevistador",medium:"Medio",witness:"Testigo",witnessNone:"—",summary:"Descripción",transcript:"Transcripción",transcriptHint:"Dirección del archivo de transcripción anonimizada (opcional)",summaryTab:"Resumen",fileTab:"Archivo",importFile:"Cargar un archivo",importFileHint:"JSON, texto, WebVTT, SRT",inputFileFromFile:"desde su disco",inputFileFromUrl:"desde una dirección",inputFileModeHint:"Pulsar para darlo de la otra forma: un archivo suyo o una dirección",inputFileLoad:"Cargar",saveButton:"Guardar",loading:"Cargando la transcripción…",invalid:"Este texto aún no es JSON válido: la entrevista conserva la última transcripción que entendió.",notATranscript:"Ese archivo no es una transcripción de entrevista (no tiene turnos de palabra).",loadFailed:"No se pudo leer esa transcripción.",editorLabel:"Transcripción de la entrevista en JSON",byHint:"Identificadores de personas de RR0, separados por comas",exchangesTab:"Intercambios",exchangesEmpty:"Todavía no se ha dicho nada.",redacted:"Pasaje eliminado",colon:": ",proofreadAll:"Revisado por todos.",proofreadPending:"Aún no revisado por: {names}",play:"Reproducir",pause:"Pausa",recordings:"Grabaciones ({n})",recordingsTitle:"Grabaciones",recordingKind:"Tipo",recordingAudio:"Audio",recordingVideo:"Vídeo",recordingFile:"Archivo",recordingOffset:"Desfase",recordingRemove:"Quitar",recordingAdd:"Añadir una grabación",close:"Cerrar",noRecording:"Sin grabación: añada el archivo de audio o vídeo de la entrevista para poder escucharla.",redactSelection:"Retirar la selección",redactedWords:"pasaje retirado · {n} palabra(s)",redactAll:"Retirar todo",restoreAll:"Restablecer todo",editTurn:"Modificar",deleteTurn:"Eliminar este turno de palabra",saveTurn:"Guardar",cancelTurn:"Cancelar",turnEditHint:"⟦ … ⟧ marca un pasaje retirado",selectionOnePassage:"La selección debe caber en un solo pasaje no retirado.",selectionNone:"Seleccione palabras de un pasaje para retirarlas.",reviewedBy:"{name} ha revisado",linkMoment:"Vincular a un momento…",momentLabel:"Momento {k} · {text}",unlinkMoment:"Quitar este vínculo",noMoments:"La observación aún no tiene momentos con nombre.",redactReason:"retirado en la revisión",roles:{interviewer:"Entrevistador",interviewee:"Entrevistado",witness:"Testigo"}};export{e as interviewMessages_es};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={title:"Titre",time:"Date",by:"Enquêteur",medium:"Moyen",witness:"Témoin",witnessNone:"—",summary:"Description",transcript:"Transcription",transcriptHint:"Adresse du fichier de transcription anonymisée (facultative)",summaryTab:"Résumé",fileTab:"Fichier",importFile:"Charger un fichier",importFileHint:"JSON, texte, WebVTT, SRT",inputFileFromFile:"depuis votre disque",inputFileFromUrl:"depuis une adresse",inputFileModeHint:"Cliquer pour le donner autrement : un fichier à vous, ou une adresse",inputFileLoad:"Charger",saveButton:"Sauver",loading:"Chargement de la transcription…",invalid:"Ce texte n'est pas encore du JSON valide : l'interview garde la dernière transcription qu'elle a comprise.",notATranscript:"Ce fichier n'est pas une transcription d'interview (il n'a pas de tours de parole).",loadFailed:"Cette transcription n'a pas pu être lue.",editorLabel:"Transcription de l'interview en JSON",byHint:"Identifiants de personnes RR0, séparés par des virgules",exchangesTab:"Échanges",exchangesEmpty:"Rien n'a encore été dit.",redacted:"Passage retiré",colon:" : ",proofreadAll:"Relu par tous les participants.",proofreadPending:"Pas encore relu par : {names}",play:"Lecture",pause:"Pause",recordings:"Enregistrements ({n})",recordingsTitle:"Enregistrements",recordingKind:"Type",recordingAudio:"Audio",recordingVideo:"Vidéo",recordingFile:"Fichier",recordingOffset:"Décalage",recordingRemove:"Retirer",recordingAdd:"Ajouter un enregistrement",close:"Fermer",noRecording:"Aucun enregistrement : ajoutez le fichier audio ou vidéo de l'entretien pour pouvoir l'écouter.",redactSelection:"Retirer la sélection",redactedWords:"passage retiré · {n} mot(s)",redactAll:"Retirer tout",restoreAll:"Rétablir tout",editTurn:"Modifier",deleteTurn:"Supprimer ce tour de parole",saveTurn:"Enregistrer",cancelTurn:"Annuler",turnEditHint:"⟦ … ⟧ marque un passage retiré",selectionOnePassage:"La sélection doit tenir dans un seul passage non retiré.",selectionNone:"Sélectionnez des mots d'un passage pour les retirer.",reviewedBy:"{name} a relu",linkMoment:"Relier à un moment…",momentLabel:"Moment {k} · {text}",unlinkMoment:"Retirer ce lien",noMoments:"L'observation n'a pas encore de moment nommé.",redactReason:"retiré à la relecture",roles:{interviewer:"Intervieweur",interviewee:"Interviewé",witness:"Témoin"}};export{e as interviewMessages_fr};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const i={title:"Titolo",time:"Data",by:"Intervistatore",medium:"Mezzo",witness:"Testimone",witnessNone:"—",summary:"Descrizione",transcript:"Trascrizione",transcriptHint:"Indirizzo del file di trascrizione anonimizzata (facoltativo)",summaryTab:"Riepilogo",fileTab:"File",importFile:"Carica un file",importFileHint:"JSON, testo, WebVTT, SRT",inputFileFromFile:"dal proprio disco",inputFileFromUrl:"da un indirizzo",inputFileModeHint:"Fare clic per darlo nell'altro modo: un proprio file o un indirizzo",inputFileLoad:"Carica",saveButton:"Salva",loading:"Caricamento della trascrizione…",invalid:"Questo testo non è ancora JSON valido: l'intervista conserva l'ultima trascrizione che ha capito.",notATranscript:"Quel file non è una trascrizione di intervista (non ha turni di parola).",loadFailed:"Impossibile leggere quella trascrizione.",editorLabel:"Trascrizione dell'intervista in JSON",byHint:"Identificatori di persone RR0, separati da virgole",exchangesTab:"Scambi",exchangesEmpty:"Non è stato ancora detto nulla.",redacted:"Passaggio rimosso",colon:": ",proofreadAll:"Rivisto da tutti.",proofreadPending:"Non ancora rivisto da: {names}",play:"Riproduci",pause:"Pausa",recordings:"Registrazioni ({n})",recordingsTitle:"Registrazioni",recordingKind:"Tipo",recordingAudio:"Audio",recordingVideo:"Video",recordingFile:"File",recordingOffset:"Scarto",recordingRemove:"Rimuovi",recordingAdd:"Aggiungi una registrazione",close:"Chiudi",noRecording:"Nessuna registrazione: aggiungi il file audio o video dell'intervista per poterla ascoltare.",redactSelection:"Rimuovi la selezione",redactedWords:"passaggio rimosso · {n} parola/e",redactAll:"Rimuovi tutto",restoreAll:"Ripristina tutto",editTurn:"Modifica",deleteTurn:"Elimina questo turno",saveTurn:"Salva",cancelTurn:"Annulla",turnEditHint:"⟦ … ⟧ indica un passaggio rimosso",selectionOnePassage:"La selezione deve restare in un solo passaggio non rimosso.",selectionNone:"Seleziona parole di un passaggio per rimuoverle.",reviewedBy:"{name} ha riletto",linkMoment:"Collega a un momento…",momentLabel:"Momento {k} · {text}",unlinkMoment:"Rimuovi questo collegamento",noMoments:"L'osservazione non ha ancora momenti con nome.",redactReason:"rimosso in rilettura",roles:{interviewer:"Intervistatore",interviewee:"Intervistato",witness:"Testimone"}};export{i as interviewMessages_it};
|