/* Express lightpaths (#58): the panel of one, the section on a dark fiber's panel (what rides it, where it chains on) and the Express tab of the link window (70-link-modal.js). The rules are in 80-simulation/65-express.js. */ const xpSpanName=s=>`${CITY[s.a].name} ⇄ ${CITY[s.b].name}`; // Why an express is dark today, fiber by fiber. function xpDarkWhy(l){const sp=xpSpans(l);if(!sp)return [tr('express.dark_gone')];const d=S.day,out=[]; for(const s of sp){const n=xpSpanName(s);if(linkCut(s))out.push(tr('express.dark_cut',{span:n}));else if(s.ready>d)out.push(trn('express.dark_building',s.ready-d,{span:n}));else if(s.eqDown>d)out.push(tr('express.dark_system',{span:n}));} if(!out.length)out.push(tr('express.dark_reach'));return out;} // One fiber of a path: whose it is, how long, the slots left for express channels. const xpSpanMeta=s=>`${s.own?tr('common.own_dark_fiber'):tr('common.leased_iru')} · ${Math.round(s.km).toLocaleString()} km · ${tr('express.free_slots',{n:Math.max(0,xpFree(s)),max:chMax(s)})}`; // An optic's settings over a run, as the fiber panel lists them. const xpModes=(o,run)=>OPT[o].modes.map(([g,r])=>tr('link_panels.g_to_km_km',{g:fmtG(g),km:r.toLocaleString()})).join(' · ')+` · ${xpOptG(o,run)?tr('express.runs_at',{g:fmtG(xpOptG(o,run))}):tr('express.out_of_reach')}`; function xpPanel(l){const sp=xpSpans(l),load=R.load[l.id]||0,cap=capOf(l),u=cap?load/cap:0,down=linkDown(l),A=CITY[l.a].name,B=CITY[l.b].name,run=sp?xpRunKm(sp):0,ch=l.ch||[]; let h=`
${t}
`).join('')}${tr('express.passes',{via:esc(xpVia(l))})}
${tr('express.slot_note')}
${tr('link_panels.unplugged_optics_go_on_the_spares')}
`;} h+=`${trafficSection(l)}${metricSection(l)}${tr('express.tear_down_note')}
${tr('express.lead')}
`; if(!rdm)h+=`${tr('express.needs_roadm')}
`; if(on.length)h+=`${tr('express.riding_note')}
`; if(tg.length)h+=`${tr('express.modal_lead',{a:CITY[a].name,b:CITY[b].name})}
`; for(const r of routes){const sp=r.sp,ids=sp.map(s=>s.id),cs=xpCities(a,sp),run=xpRunKm(sp),old=xpFind(a,b,ids),lat=sp.reduce((x,s)=>x+linkLat(s),0); h+=`${trn('express.already',(old.ch||[]).length)}
`:''}${tr('express.modal_note',{price:fmt$(XP_PASS)})}
`;}