resultats = {
const ENDPOINT =
"https://www.resultats-elections.interieur.gouv.fr/telechargements/LG2024/resultatsT1/";
const depts = await d3.html(ENDPOINT).then(
(d) =>
Array.from(d3.select(d).selectAll("a"), (d) =>
d.getAttribute("href")
).filter((d) => !d.match(/[.]/))
);
const circos = (
await Promise.all(
depts.map((d) =>
d3.html(`${ENDPOINT}${d}`).then((h) =>
Array.from(d3.select(h).selectAll("a"), (d) => d.getAttribute("href"))
.filter((e) => e.match(`^R1${d.replace(/[/]$/, "..[.]xml$")}`))
.map((e) => `${d}${e}`)
)
)
)
).flat();
const allCircos = Promise.all(
circos.map((d) =>
d3.text(`${ENDPOINT}${d}`).then((d) => convert.xml2js(d).elements)
)
);
return allCircos;
}