// Teleports and satellite circuits on screen (#83): a POP's section, the order sheet, a circuit's panel. const satLogo=P=>`${esc(P.n.slice(0,2).toUpperCase())}`; // Round trip over bird id between a and b, in whole ms. const satRtt=(id,a,b)=>Math.round(2*satLat({bird:id,km:satKm(id,a,b)})); const satModalHead=(eye,title)=>`
${tr('satellites.a_teleport_is_a_satellite_gateway')}
${why&&teleSees(c).length?`${tr('satellites.reachable_from_your_teleports',{city:CITY[c].name})}
${tr('satellites.no_teleport_reaches_city',{city:CITY[c].name})}
`;}; // A city without a POP of yours, that a teleport of yours reaches: a POP and a circuit in one go. function satNoPop(c){if(pzOn()||S.pops[c])return '';const from=satFrom(c);if(!from.length)return ''; return `${tr('satellites.no_cable_needed_a_pop_here',{city:CITY[c].name})}
${satReach(c,from)}${tr('satellites.no_teleport_reaches_city',{city:CITY[b].name})}
`));return;}} if(!a||!teleOf(a))return; if(!b){const ts=satTargets(a),mine=ts.filter(x=>S.pops[x]),more=ts.filter(x=>!S.pops[x]).slice(0,12); const row=x=>`${tr('satellites.who_a_satellite_serves')}
` +(mine.length?`${tr('satellites.nothing_in_view_from_here')}
`));return;} const pop=S.pops[b]?0:newPopCost(b),sib=pairLinks(a,b).some(l=>l.kind!=='sat'),birds=satBirds(a,b); const rows=birds.map(id=>{const B=SATS[id],O=SAT_ORB[B.orb],P=SAT_PROV[B.p],why=satWhy(a,b,id); return `${tr('satellites.users_notice_geo_meo')}
` +(pop?`${tr('satellites.no_pop_there_yet',{city:CITY[b].name,cost:fmt$(pop)})}
`:'')+(sib?`${tr('satellites.it_waits_on_standby')}
`:'') +(rows||`${tr('satellites.no_bird_sees_both',{a:CITY[a].name,b:CITY[b].name})}
`));} // A circuit's panel: what it carries, its latency and rent, a size up or down, standby and the metric, cancel. function satPanel(l){const B=SATS[l.bird],O=SAT_ORB[B.orb],P=SAT_PROV[B.p],load=R.load[l.id]||0,cap=capOf(l),u=cap?load/cap:0,ms=satLat(l); let h=`${B.orb==='geo'?tr('satellites.geo_users_notice',{p:pct(O.loss)}):tr('satellites.meo_users_notice',{p:pct(O.loss)})} ${esc(P.blurb)}