// The commit of the dataset the page reads: asked of the Hub once and shared by the first screen (first.js) and the // reader of the index (data.js), so both name the same commit. import { datasetInfo } from 'https://cdn.jsdelivr.net/npm/@huggingface/hub@2.17.10/+esm'; export const REPO = 'Battam/training-data-foundation'; export const HF = 'https://huggingface.co'; const asked = new Map(); /** The commit to read: ?rev=, else main. -> {sha, date, files}; sha is '' when the Hub gave none. */ export function loadRevision(rev) { const key = rev || 'main'; if (!asked.has(key)) { asked.set(key, datasetInfo({ name: REPO, revision: key, additionalFields: ['sha', 'siblings'] }).then((j) => { const sha = /^[0-9a-f]{40}$/.test(j.sha || '') ? j.sha : ''; return { sha, date: j.updatedAt.toISOString(), files: (j.siblings || []).map((s) => s.rfilename) }; })); } return asked.get(key); }