// Deliberately scan all exits for every flow, without byRank, local-city // shortcuts or first-group selection. Stable sorting preserves E order on ties. // Without Auto-TE, an exit whose shortest path from this POP is already full fits nothing, so it counts as // unusable, like a full exit (#210). module.exports = ` // A carrier's own port (dr) is also a plain transit exit. A POP with a Prefer-marked transit port keeps what Prefer // says, and a port not set to carry only takes its own POP's traffic. const PH=new Set(E.filter(x=>x.k==='t'&&x.pref==='high').map(x=>CIDX[x.city])); const dr=(e,ci,n)=>{if(e.k!=='t'||PH.has(ci)||eff(e,n)!==3)return 0;const t=directTier(e.net,n);return t?DIRECT_RANK[t][e.carry?0:1]:0;}; // An IX port counts as a hair further than a PNI in the same place (#298). const tie=e=>e.k==='ix'?PNI_TIE:0; for(const pass of PASSES)for(const rank of RANKS){ for(F=0;Fe.used(a.pref==='high'?0:1)-(b.pref==='high'?0:1)||Dv[CIDX[a.city]]-Dv[CIDX[b.city]]+(tie(a)-tie(b))); for(let i=0;i1e-6;){ let j=i+1;while(j