mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
feat(viewers): sort, filter, summarize, group and chart tables
The CSV/TSV viewer (explorer, gists, the author's preview) becomes an analysis view that runs on the anonymized text already in the page: click-to-sort headers (numbers, dates, natural text; stable, empty cells last), a search box and per-column range or value filters, a summary row (Average by default; Sum, Median, Min, Max, Count, Std dev) over the filtered rows, group by with an aggregate, column stats with a histogram, copy as CSV or Markdown and download of the current view, and a Chart view (bar, line, scatter) drawn in inline SVG. The view lives in the URL fragment (#table:group=model, #table-2:... for a gist file) so a link can carry it; links without it open as before. Markdown and notebook tables (pandas DataFrames) get sortable headers, an optional summary row and "Open as table" for the full view. Redaction slots keep rendering; sorting uses the XXXX-n text. The 1 MB limit holds: rows render 200 at a time as one escaped HTML string while aggregates, filters and charts use every row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
98bf382fa8
commit
43e92bef53
19 files changed
+2094
-98
No files matched your search
@@ -5,6 +5,8 @@ import PdfViewer from "./pdf-viewer.js";
|
||||
import { slotRedactions } from "./app.js";
|
||||
import { headingOutline, redactParts } from "./outline.js";
|
||||
import { render as quotaUsageTemplate } from "../partials/quotaUsage.htm";
|
||||
import { DataTable } from "./data-table.js";
|
||||
import { enhanceTables } from "./table-enhance.js";
|
||||
|
||||
const QuotaUsage = {
|
||||
props: ["quota", "fmt"],
|
||||
@@ -72,6 +74,7 @@ const Markdown = {
|
||||
heading.id = id;
|
||||
});
|
||||
}
|
||||
enhanceTables(host.value);
|
||||
props.onOutline?.(headingOutline(host.value));
|
||||
};
|
||||
onMounted(() => { render(); watch(() => [props.content, props.terms, props.options], render, { deep: true }); });
|
||||
@@ -163,6 +166,7 @@ const Notebook = {
|
||||
host.value.innerHTML = slotRedactions(DOMPurify.sanitize(nb.parse(json).render()));
|
||||
host.value.querySelectorAll("pre code").forEach(el => window.Prism?.highlightElement(el));
|
||||
markScrollableCode(host.value);
|
||||
enhanceTables(host.value);
|
||||
} catch (error) { if (current === generation && error.name !== "AbortError") host.value.textContent = "Unable to render the notebook."; }
|
||||
};
|
||||
onMounted(() => { render(); watch(() => [props.file, props.content], render); });
|
||||
@@ -180,7 +184,7 @@ const Loc = {
|
||||
};
|
||||
},
|
||||
};
|
||||
export const components = { Markdown, GistFile, PrThread, Notebook, Loc, HtmlDoc, QuotaUsage, Pdfviewer: defineAsyncComponent(async () => {
|
||||
export const components = { Markdown, GistFile, PrThread, Notebook, Loc, HtmlDoc, QuotaUsage, DataTable, Pdfviewer: defineAsyncComponent(async () => {
|
||||
await loadLibrary("pdf");
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = "/script/external/pdf.worker.js";
|
||||
return PdfViewer;
|
||||
|
||||
@@ -0,0 +1,376 @@
|
||||
// The table viewer shared by CSV/TSV files (explorer, gists, the author's
|
||||
// preview) and "Open as table" on Markdown and notebook tables: sort, filter,
|
||||
// summary row, group by, column stats, charts and export. Everything runs on
|
||||
// the anonymized text already in the page; nothing is sent anywhere.
|
||||
import { reactive, computed, watch, ref, onMounted, onBeforeUnmount, nextTick, createApp, h } from "vue";
|
||||
import {
|
||||
analyzeTable, filterIndices, sortIndices, groupTable, summarize, columnStats, distinctValues,
|
||||
formatKey, formatNumber, toDelimited, toMarkdown, readHashState, writeHashState, isTableHash,
|
||||
AGGREGATES, AGGREGATE_LABEL, aggregateShort,
|
||||
} from "./table-analysis.js";
|
||||
import { buildChart, defaultChart, MAX_SERIES } from "./table-chart.js";
|
||||
import { redactParts } from "./outline.js";
|
||||
import { render as dataTableTemplate } from "../partials/dataTable.htm";
|
||||
import { setTableOpener } from "./table-enhance.js";
|
||||
|
||||
export const PAGE_SIZE = 200;
|
||||
const ESCAPES = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
||||
const escapeHtml = (text) => String(text).replace(/[&<>"']/g, (ch) => ESCAPES[ch]);
|
||||
export const cellHtml = (text) => {
|
||||
const value = text == null ? "" : String(text);
|
||||
if (value.indexOf("XXXX-") === -1) return escapeHtml(value);
|
||||
return redactParts(value).map((seg) => (seg.n ? `<span class="redact-slot" role="img" aria-label="Redacted term ${seg.n}"><i>${seg.n}</i></span>` : escapeHtml(seg.t))).join("");
|
||||
};
|
||||
const CHIP_LIMIT = 24;
|
||||
|
||||
export const DataTable = {
|
||||
name: "DataTable",
|
||||
props: { rows: { type: Array, default: () => [] }, name: String, stateKey: String, view: { type: String, default: "table" }, label: String },
|
||||
setup(props) {
|
||||
const fromHash = props.stateKey ? readHashState(window.location.hash, props.stateKey) : null;
|
||||
const s = reactive({
|
||||
query: fromHash?.query || "", sort: fromHash?.sort || null, group: fromHash?.group || null, agg: fromHash?.agg || "mean",
|
||||
ranges: fromHash?.ranges || {}, values: fromHash?.values || {}, sums: fromHash?.sums || {},
|
||||
chart: fromHash?.chart || null, x: fromHash?.x || null, y: fromHash?.y || [],
|
||||
limit: PAGE_SIZE, menu: null, toolsOpen: false, copyOpen: false, copied: "", tip: null,
|
||||
});
|
||||
const base = computed(() => analyzeTable(props.rows));
|
||||
const byName = (table, name) => table.columns.find((c) => c.name === name);
|
||||
const indexed = (map) => Object.fromEntries(Object.entries(map).map(([name, v]) => [byName(base.value, name)?.index, v]).filter(([i]) => i != null));
|
||||
const filtered = computed(() => filterIndices(base.value, { query: s.query, ranges: indexed(s.ranges), values: indexed(s.values) }));
|
||||
const groupColumn = computed(() => (s.group ? byName(base.value, s.group) : null));
|
||||
const table = computed(() => (groupColumn.value ? groupTable(base.value, filtered.value, groupColumn.value.index, s.agg) : base.value));
|
||||
const rowsInView = computed(() => (groupColumn.value ? table.value.body.map((_, i) => i) : filtered.value));
|
||||
const sortColumn = computed(() => (s.sort ? byName(table.value, s.sort.column) : null));
|
||||
const sorted = computed(() => (sortColumn.value ? sortIndices(table.value, rowsInView.value, sortColumn.value.index, s.sort.dir) : rowsInView.value));
|
||||
const visible = computed(() => sorted.value.slice(0, s.limit));
|
||||
const summary = computed(() => table.value.columns.map((c) => summarize(c, rowsInView.value, s.sums[c.name] || "mean")));
|
||||
const numericColumns = computed(() => table.value.columns.filter((c) => c.type === "number"));
|
||||
|
||||
// ---- Sorting: ascending, descending, then the file's order ----
|
||||
const sortState = (column) => (s.sort && s.sort.column === column.name ? s.sort.dir : null);
|
||||
const cycleSort = (column) => {
|
||||
const dir = sortState(column);
|
||||
s.sort = dir === "asc" ? { column: column.name, dir: "desc" } : dir === "desc" ? null : { column: column.name, dir: "asc" };
|
||||
};
|
||||
const setSort = (column, dir) => { s.sort = dir ? { column: column.name, dir } : null; };
|
||||
const ariaSort = (column) => ({ asc: "ascending", desc: "descending" })[sortState(column)] || "none";
|
||||
|
||||
// ---- Filters ----
|
||||
const sourceColumn = (column) => (groupColumn.value ? (column.source != null ? base.value.columns[column.source] : null) : column);
|
||||
const setRange = (column, end, value) => {
|
||||
const source = sourceColumn(column);
|
||||
if (!source) return;
|
||||
const text = String(value ?? "").trim();
|
||||
const number = text === "" ? null : Number(text.replace(/,/g, ""));
|
||||
const current = s.ranges[source.name] || [null, null];
|
||||
const next = end === 0 ? [Number.isFinite(number) ? number : null, current[1]] : [current[0], Number.isFinite(number) ? number : null];
|
||||
const ranges = { ...s.ranges };
|
||||
if (next[0] == null && next[1] == null) delete ranges[source.name]; else ranges[source.name] = next;
|
||||
s.ranges = ranges;
|
||||
};
|
||||
const rangeValue = (column, end) => { const r = s.ranges[sourceColumn(column)?.name]; return r && r[end] != null ? String(r[end]) : ""; };
|
||||
const chipValues = (column) => {
|
||||
const source = sourceColumn(column);
|
||||
if (!source || source.type === "number") return [];
|
||||
const counts = distinctValues(source);
|
||||
if (counts.size > CHIP_LIMIT) return [];
|
||||
return [...counts.entries()].map(([value, count]) => ({ value, count, label: source.type === "date" ? formatKey(source, value) : value }));
|
||||
};
|
||||
const chipOn = (column, value) => (s.values[sourceColumn(column)?.name] || []).includes(String(value));
|
||||
const toggleChip = (column, value) => {
|
||||
const source = sourceColumn(column);
|
||||
if (!source) return;
|
||||
const list = new Set(s.values[source.name] || []);
|
||||
const key = String(value);
|
||||
if (list.has(key)) list.delete(key); else list.add(key);
|
||||
const values = { ...s.values };
|
||||
if (list.size) values[source.name] = [...list]; else delete values[source.name];
|
||||
s.values = values;
|
||||
};
|
||||
const activeFilters = computed(() => [
|
||||
...Object.entries(s.ranges).map(([name, [min, max]]) => {
|
||||
const c = byName(base.value, name);
|
||||
const f = (v) => formatNumber(v, Math.max(c?.decimals || 0, String(v).split(".")[1]?.length || 0), c?.unit || "");
|
||||
return { key: "r:" + name, name, text: min != null && max != null ? `${f(min)}–${f(max)}` : min != null ? `≥ ${f(min)}` : `≤ ${f(max)}`, clear: () => { const r = { ...s.ranges }; delete r[name]; s.ranges = r; } };
|
||||
}),
|
||||
...Object.entries(s.values).map(([name, list]) => {
|
||||
const c = byName(base.value, name);
|
||||
const labels = list.map((v) => (c?.type === "date" ? formatKey(c, Number(v)) : v));
|
||||
return { key: "v:" + name, name, text: labels.length <= 2 ? labels.join(", ") : `${labels.length} values`, clear: () => { const v = { ...s.values }; delete v[name]; s.values = v; } };
|
||||
}),
|
||||
]);
|
||||
const clearFilters = () => { s.query = ""; s.ranges = {}; s.values = {}; };
|
||||
const filtering = computed(() => !!(s.query || activeFilters.value.length));
|
||||
|
||||
// ---- Group by ----
|
||||
// Text and dates, plus whole-number columns with few values (seed, fold, epoch).
|
||||
const groupable = computed(() => base.value.columns.filter((c) => c.type !== "number" || (c.decimals === 0 && !c.unit && distinctValues(c).size <= 50)));
|
||||
const setGroup = (name) => { s.group = name || null; s.sort = null; s.limit = PAGE_SIZE; s.menu = null; resetChartAxes(); };
|
||||
const setAgg = (fn) => { s.agg = fn; };
|
||||
const setSum = (column, fn) => { s.sums = { ...s.sums, [column.name]: fn }; };
|
||||
|
||||
// ---- Column menu (stats, sort, filter, group) ----
|
||||
const menuColumn = computed(() => (s.menu ? table.value.columns[s.menu.index] : null));
|
||||
const menuStats = computed(() => {
|
||||
const column = menuColumn.value;
|
||||
if (!column) return null;
|
||||
const stats = columnStats(column, rowsInView.value);
|
||||
const fmt = (v) => formatKey(column, v);
|
||||
const peak = Math.max(1, ...(stats.histogram || []).map((b) => b.count));
|
||||
return {
|
||||
...stats,
|
||||
typeLabel: column.type === "number" ? (column.decimals ? `Number · ${column.decimals} ${column.decimals === 1 ? "decimal" : "decimals"}` : "Whole number") + (column.unit ? " · %" : "") : column.type === "date" ? "Date" : "Text",
|
||||
rows: [
|
||||
["Values", formatNumber(stats.count)], ["Empty", formatNumber(stats.empty)], ["Distinct", formatNumber(stats.distinct)],
|
||||
...(stats.min != null ? [["Min", fmt(stats.min)], ["Max", fmt(stats.max)]] : []),
|
||||
...(stats.mean != null ? [["Mean", formatKey(column, stats.mean, "mean")]] : []),
|
||||
...(stats.std != null ? [["Std dev", formatKey(column, stats.std, "std")]] : []),
|
||||
],
|
||||
bars: (stats.histogram || []).map((b, i, all) => ({ x: (i * 216) / all.length + 1, w: Math.max(1, 216 / all.length - 2), h: Math.max(b.count ? 2 : 0, (b.count / peak) * 40), count: b.count,
|
||||
title: `${fmt(b.from)} – ${fmt(b.to)}: ${b.count} ${b.count === 1 ? "row" : "rows"}` })),
|
||||
histFrom: stats.histogram ? fmt(stats.min) : "", histTo: stats.histogram ? fmt(stats.max) : "",
|
||||
top: (stats.top || []).map(([value, count]) => ({ value, count, share: (count / Math.max(1, stats.count)) * 100 })),
|
||||
};
|
||||
});
|
||||
const openMenu = (index, event) => {
|
||||
if (s.menu?.index === index) { s.menu = null; return; }
|
||||
const th = event.currentTarget.closest("th") || event.currentTarget;
|
||||
const r = th.getBoundingClientRect();
|
||||
const width = 260, vw = window.innerWidth;
|
||||
s.menu = { index, left: Math.max(8, Math.min(r.left, vw - width - 8)), top: r.bottom + 4 };
|
||||
nextTick(() => window.document.querySelector(".dt-menu")?.focus());
|
||||
};
|
||||
const closeMenus = () => { s.menu = null; s.toolsOpen = false; s.copyOpen = false; };
|
||||
|
||||
// ---- Export ----
|
||||
const exportRows = () => {
|
||||
const t = table.value;
|
||||
const header = t.columns.map((c) => c.name);
|
||||
const body = sorted.value.map((i) => t.columns.map((c) => t.body[i][c.index] ?? ""));
|
||||
return { header, body };
|
||||
};
|
||||
const flash = (what) => { s.copied = what; window.setTimeout(() => { if (s.copied === what) s.copied = ""; }, 1600); };
|
||||
const copyAs = async (format) => {
|
||||
const { header, body } = exportRows();
|
||||
const text = format === "md" ? toMarkdown(header, body, table.value.columns.map((c) => c.type === "number")) : toDelimited(header, body, ",");
|
||||
closeMenus();
|
||||
try { await window.navigator.clipboard.writeText(text); flash(format); } catch { flash("error"); }
|
||||
};
|
||||
const fileBase = () => String(props.name || "table").replace(/\.[^.]+$/, "") || "table";
|
||||
const download = () => {
|
||||
const { header, body } = exportRows();
|
||||
const blob = new window.Blob([toDelimited(header, body, ",")], { type: "text/csv;charset=utf-8" });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = window.document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = fileBase() + (isChanged() ? "-view" : "") + ".csv";
|
||||
window.document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
window.setTimeout(() => window.URL.revokeObjectURL(url), 1000);
|
||||
closeMenus();
|
||||
};
|
||||
const isChanged = () => !!(filtering.value || s.sort || s.group);
|
||||
|
||||
// ---- Chart ----
|
||||
const chartWidth = ref(0);
|
||||
const chartHost = ref(null);
|
||||
const chartSpec = computed(() => {
|
||||
const fallback = defaultChart(table.value, !!groupColumn.value);
|
||||
const x = s.x && byName(table.value, s.x) ? s.x : fallback.x;
|
||||
const y = s.y.filter((n) => byName(table.value, n)?.type === "number");
|
||||
return { type: s.chart || fallback.type, x, y: y.length ? y : fallback.y, agg: s.agg };
|
||||
});
|
||||
const chart = computed(() => (props.view === "chart" && chartWidth.value ? buildChart(table.value, sorted.value, chartSpec.value, { width: chartWidth.value }) : null));
|
||||
const resetChartAxes = () => { s.x = null; s.y = []; };
|
||||
watch(chart, () => { s.tip = null; });
|
||||
const setChartType = (type) => { s.chart = type; s.tip = null; };
|
||||
const setX = (name) => { s.x = name; s.tip = null; };
|
||||
const yOn = (name) => chartSpec.value.y.includes(name);
|
||||
const toggleY = (name) => {
|
||||
const current = chartSpec.value.y;
|
||||
const next = current.includes(name) ? current.filter((n) => n !== name) : [...current, name];
|
||||
if (!next.length) return;
|
||||
s.y = next.slice(-MAX_SERIES[chartSpec.value.type]);
|
||||
s.tip = null;
|
||||
};
|
||||
const seriesIndex = (name) => chartSpec.value.y.indexOf(name);
|
||||
let observer;
|
||||
const observe = (el) => {
|
||||
observer?.disconnect();
|
||||
if (!el) return;
|
||||
const measure = () => { const w = el.clientWidth; if (w && Math.abs(w - chartWidth.value) > 1) chartWidth.value = w; };
|
||||
measure();
|
||||
if (window.ResizeObserver) { observer = new window.ResizeObserver(measure); observer.observe(el); }
|
||||
};
|
||||
watch(chartHost, observe);
|
||||
// Hover and keyboard: bars by category, lines by the nearest x, scatter by the nearest point.
|
||||
const tipAt = (index, x, y) => {
|
||||
const c = chart.value;
|
||||
if (!c) return;
|
||||
const item = c.kind === "bar" ? c.categories[index]?.tip : c.points[index];
|
||||
if (!item) { s.tip = null; return; }
|
||||
s.tip = { index, ...item, x, y, crossX: c.kind === "line" ? c.points[index].x : null };
|
||||
};
|
||||
const pointerAt = (event) => {
|
||||
const c = chart.value;
|
||||
const svg = event.currentTarget.ownerSVGElement || event.currentTarget;
|
||||
const box = svg.getBoundingClientRect();
|
||||
const px = event.clientX - box.left, py = event.clientY - box.top;
|
||||
if (c.kind === "bar") {
|
||||
const index = c.categories.findIndex((cat) => py >= cat.hit.y && py < cat.hit.y + cat.hit.h);
|
||||
if (index < 0) { s.tip = null; return; }
|
||||
tipAt(index, px, c.categories[index].y);
|
||||
return;
|
||||
}
|
||||
let best = -1, bestD = Infinity;
|
||||
if (c.kind === "scatter") {
|
||||
c.series.forEach((ser) => ser.dots.forEach((d) => { const dd = (d.x - px) ** 2 + (d.y - py) ** 2; if (dd < bestD) { bestD = dd; best = d.i; } }));
|
||||
if (bestD > 40 * 40) { s.tip = null; return; }
|
||||
} else c.points.forEach((p, i) => { const dd = Math.abs(p.x - px); if (dd < bestD) { bestD = dd; best = i; } });
|
||||
tipAt(best, c.kind === "scatter" ? c.points[best].x : c.points[best].x, py);
|
||||
};
|
||||
const keyStep = (event) => {
|
||||
const c = chart.value;
|
||||
if (!c || c.empty) return;
|
||||
const count = c.kind === "bar" ? c.categories.length : c.points.length;
|
||||
const delta = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1, Home: -Infinity, End: Infinity }[event.key];
|
||||
if (event.key === "Escape") { s.tip = null; return; }
|
||||
if (delta == null) return;
|
||||
event.preventDefault();
|
||||
const current = s.tip ? s.tip.index : -1;
|
||||
const next = delta === -Infinity ? 0 : delta === Infinity ? count - 1 : Math.max(0, Math.min(count - 1, current + delta));
|
||||
if (c.kind === "bar") tipAt(next, c.plot.x + 8, c.categories[next].y);
|
||||
else tipAt(next, c.points[next].x, c.plot.y + 20);
|
||||
};
|
||||
const tipStyle = computed(() => {
|
||||
if (!s.tip || !chart.value) return {};
|
||||
const w = chartWidth.value, left = s.tip.x + 14;
|
||||
return left + 200 > w ? { right: Math.max(4, w - s.tip.x + 14) + "px", top: s.tip.y + 8 + "px" } : { left: left + "px", top: s.tip.y + 8 + "px" };
|
||||
});
|
||||
const chartSummary = computed(() => {
|
||||
const c = chart.value;
|
||||
if (!c || c.empty) return "";
|
||||
const what = c.series.map((x) => x.name).join(", ");
|
||||
return `${{ bar: "Bar chart", line: "Line chart", scatter: "Scatter plot" }[c.kind]} of ${what} by ${c.x.name}`;
|
||||
});
|
||||
|
||||
// ---- Shareable state in the URL fragment ----
|
||||
const snapshot = () => ({
|
||||
view: props.view, query: s.query, sort: s.sort, group: s.group, agg: s.agg, ranges: s.ranges, values: s.values,
|
||||
sums: s.sums, chart: s.chart, x: s.x, y: s.y,
|
||||
});
|
||||
if (props.stateKey) {
|
||||
let timer;
|
||||
watch(() => JSON.stringify(snapshot()), () => {
|
||||
window.clearTimeout(timer);
|
||||
timer = window.setTimeout(() => {
|
||||
const hash = writeHashState(props.stateKey, snapshot());
|
||||
const current = window.location.hash;
|
||||
// Leave other fragments (#L12, a heading) alone unless we are replacing our own.
|
||||
if (!hash && !isTableHash(current)) return;
|
||||
if (hash && current && !isTableHash(current) && current !== "#") return;
|
||||
if (hash === current) return;
|
||||
window.history.replaceState(window.history.state, "", window.location.pathname + window.location.search + hash);
|
||||
}, 250);
|
||||
});
|
||||
}
|
||||
|
||||
// ---- Phone toolbar and menus ----
|
||||
const onDocClick = (event) => {
|
||||
if (!event.target.closest?.(".dt-menu, .dt-col-btn")) s.menu = null;
|
||||
if (!event.target.closest?.(".dt-tools-menu, .dt-tools-btn")) s.toolsOpen = false;
|
||||
if (!event.target.closest?.(".dt-copy-menu, .dt-copy-btn")) s.copyOpen = false;
|
||||
};
|
||||
const onKey = (event) => { if (event.key === "Escape" && (s.menu || s.toolsOpen || s.copyOpen)) { const back = s.menu ? window.document.querySelector(`.dt-col-btn[data-col="${s.menu.index}"]`) : null; closeMenus(); back?.focus(); } };
|
||||
const onScroll = (event) => { if (s.menu && !event.target?.closest?.(".dt-menu")) s.menu = null; };
|
||||
onMounted(() => {
|
||||
window.document.addEventListener("click", onDocClick);
|
||||
window.document.addEventListener("keydown", onKey);
|
||||
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
window.document.removeEventListener("click", onDocClick);
|
||||
window.document.removeEventListener("keydown", onKey);
|
||||
window.removeEventListener("scroll", onScroll, { capture: true });
|
||||
observer?.disconnect();
|
||||
});
|
||||
watch(() => [s.query, s.ranges, s.values], () => { s.limit = PAGE_SIZE; }, { deep: true });
|
||||
|
||||
// The visible rows as one HTML string: thousands of cells patch far faster
|
||||
// this way than as component vnodes. Cell text is escaped; XXXX-n becomes
|
||||
// the same slot as everywhere else in the viewer.
|
||||
const bodyHtml = computed(() => {
|
||||
const t = table.value, cols = t.columns, grouped = !!groupColumn.value;
|
||||
const out = [];
|
||||
for (const ri of visible.value) {
|
||||
out.push("<tr>");
|
||||
if (!grouped) out.push('<td class="csv-rownum">', String(ri + 1), "</td>");
|
||||
const row = t.body[ri];
|
||||
for (const c of cols) out.push(c.type === "number" ? '<td class="is-num">' : "<td>", cellHtml(row[c.index]), "</td>");
|
||||
out.push("</tr>");
|
||||
}
|
||||
return out.join("");
|
||||
});
|
||||
const rowCountText = computed(() => {
|
||||
const total = base.value.size, shown = filtered.value.length;
|
||||
const rows = shown === total ? `${formatNumber(total)} ${total === 1 ? "row" : "rows"}` : `${formatNumber(shown)} of ${formatNumber(total)} rows`;
|
||||
return groupColumn.value ? `${formatNumber(table.value.size)} ${table.value.size === 1 ? "group" : "groups"} · ${rows}` : rows;
|
||||
});
|
||||
|
||||
return {
|
||||
s, props, base, table, sorted, visible, summary, numericColumns, filtered, groupColumn, rowsInView,
|
||||
redactParts, cycleSort, setSort, sortState, ariaSort, setRange, rangeValue, chipValues, chipOn, toggleChip,
|
||||
activeFilters, clearFilters, filtering, groupable, setGroup, setAgg, setSum, AGGREGATES, AGGREGATE_LABEL, aggregateShort,
|
||||
menuColumn, menuStats, openMenu, closeMenus, sourceColumn, copyAs, download, isChanged, bodyHtml, rowCountText,
|
||||
chart, chartSpec, chartHost, setChartType, setX, yOn, toggleY, seriesIndex, pointerAt, keyStep, tipStyle, chartSummary,
|
||||
MAX_SERIES, PAGE_SIZE, formatNumber,
|
||||
showMore: () => { s.limit += PAGE_SIZE; },
|
||||
showAll: () => { s.limit = Infinity; },
|
||||
leaveChart: () => { s.tip = null; },
|
||||
};
|
||||
},
|
||||
render: dataTableTemplate,
|
||||
};
|
||||
|
||||
// "Open as table" for a Markdown or notebook table: the full viewer in a dialog.
|
||||
export function openTableDialog(rows, title) {
|
||||
const host = window.document.createElement("div");
|
||||
window.document.body.appendChild(host);
|
||||
const opener = window.document.activeElement;
|
||||
let app;
|
||||
const close = () => { app.unmount(); host.remove(); window.document.removeEventListener("keydown", onKey); opener?.focus?.(); };
|
||||
const onKey = (event) => {
|
||||
if (event.key === "Escape" && !window.document.querySelector(".dt-menu, .dt-tools-menu, .dt-copy-menu")) close();
|
||||
// Keep Tab inside the dialog.
|
||||
if (event.key !== "Tab") return;
|
||||
const items = [...host.querySelectorAll("button, select, input, [tabindex='0']")].filter((el) => !el.disabled && el.offsetParent !== null);
|
||||
if (!items.length) return;
|
||||
const first = items[0], last = items[items.length - 1], active = window.document.activeElement;
|
||||
if (!host.contains(active) || (event.shiftKey ? active === first || active === host.querySelector(".dt-dialog") : active === last)) {
|
||||
event.preventDefault();
|
||||
(event.shiftKey ? last : first).focus();
|
||||
}
|
||||
};
|
||||
window.document.addEventListener("keydown", onKey);
|
||||
app = createApp({
|
||||
setup() {
|
||||
const view = ref("table");
|
||||
onMounted(() => host.querySelector(".dt-dialog")?.focus());
|
||||
return () => h("div", { class: "dt-dialog-backdrop", onClick: (e) => { if (e.target === e.currentTarget) close(); } },
|
||||
h("div", { class: "dt-dialog", role: "dialog", "aria-modal": "true", "aria-label": title || "Table", tabindex: "-1" }, [
|
||||
h("header", { class: "dt-dialog-head" }, [
|
||||
h("span", { class: "dt-dialog-title" }, title || "Table"),
|
||||
h("div", { class: "seg-filter dt-view-toggle", role: "radiogroup", "aria-label": "View" }, ["table", "chart"].map((v) =>
|
||||
h("button", { type: "button", role: "radio", class: ["seg-chip", { active: view.value === v }], "aria-checked": view.value === v ? "true" : "false", onClick: () => { view.value = v; } }, v === "table" ? "Table" : "Chart"))),
|
||||
h("button", { type: "button", class: "btn btn-sm btn-ghost btn-icon-only dt-dialog-close", "aria-label": "Close", onClick: close }, h("svg", { class: "ui-icon", "aria-hidden": "true" }, h("use", { href: "#project-icon-close" }))),
|
||||
]),
|
||||
h(DataTable, { rows, name: (title || "table").replace(/[^\w.-]+/g, "-").toLowerCase(), view: view.value, label: title }),
|
||||
]));
|
||||
},
|
||||
});
|
||||
app.mount(host);
|
||||
return close;
|
||||
}
|
||||
setTableOpener(openTableDialog);
|
||||
@@ -3,6 +3,7 @@ import { parseDelimited } from "./formatters.js";
|
||||
import { nextTick, markRaw } from "vue";
|
||||
import { createTimers, createListeners } from "./state.js";
|
||||
import { slotRedactions } from "./app.js";
|
||||
import { readHashState } from "./table-analysis.js";
|
||||
|
||||
// Used by the reviewer page and the author's preview with pageView.htm.
|
||||
export const setupFileViewer = function (state, events = state) {
|
||||
@@ -322,9 +323,11 @@ export const setupFileViewer = function (state, events = state) {
|
||||
jumpTo(id);
|
||||
state.activeHeading = id;
|
||||
};
|
||||
// CSV/TSV files up to 1 MB render as a table (sticky header, rules, tabular
|
||||
// figures) with a Raw toggle back to the code view.
|
||||
state.csvView = "table";
|
||||
// CSV/TSV files up to 1 MB open in the table viewer (data-table.js: sort,
|
||||
// filter, summary, group by, charts) with a Text toggle back to the code view.
|
||||
// A shared link can open the chart or text view (#table:view=chart).
|
||||
const csvViewFromHash = () => (!state.preview && readHashState(window.location.hash, "table")?.view) || "table";
|
||||
state.csvView = csvViewFromHash();
|
||||
let csvCache = { content: null, rows: [] };
|
||||
state.isCsv = () => typeof state.content === "string" && state.type !== "html"
|
||||
&& /\.(csv|tsv)$/i.test(state.filePath || "") && state.content.length <= 1024 * 1024;
|
||||
@@ -335,11 +338,6 @@ export const setupFileViewer = function (state, events = state) {
|
||||
}
|
||||
return csvCache.rows;
|
||||
};
|
||||
state.csvNumCol = (ci) => {
|
||||
const rows = state.csvRows().slice(1).map((r) => r[ci]).filter((v) => v != null && String(v).trim() !== "");
|
||||
return rows.length > 0 && rows.every((v) => state.csvNumeric(v));
|
||||
};
|
||||
state.csvNumeric = (value) => /^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(value) && /\d/.test(value);
|
||||
state.redactParts = redactParts;
|
||||
state.pathCopied = false;
|
||||
state.copyPath = async function () {
|
||||
@@ -407,6 +405,7 @@ export const setupFileViewer = function (state, events = state) {
|
||||
state.prepareFile = function (path) {
|
||||
state.showSource = false;
|
||||
state.allowScripts = false;
|
||||
state.csvView = csvViewFromHash();
|
||||
state.imageSize = "";
|
||||
state.filePath = path;
|
||||
state.paths = path.split("/").filter(Boolean);
|
||||
|
||||
@@ -15,6 +15,7 @@ import translations from "../i18n/locale-en.json";
|
||||
import { components, codeEditor, paperScrollspy } from "./components.js";
|
||||
import Tree from "./tree.js";
|
||||
import { fieldDirective, formDirective, submitForm } from "./forms.js";
|
||||
import { dataTablesDirective } from "./table-enhance.js";
|
||||
|
||||
const sessionKey = Symbol("session");
|
||||
export const serverPaths = /^\/(w|api|github)(\/|$)/;
|
||||
@@ -133,6 +134,7 @@ export function mountApplication(target = "#app", options = {}) {
|
||||
app.directive("form", formDirective);
|
||||
app.directive("code-editor", codeEditor);
|
||||
app.directive("paper-scrollspy", paperScrollspy);
|
||||
app.directive("data-tables", dataTablesDirective);
|
||||
app.use(router);
|
||||
router.beforeEach(async to => {
|
||||
if ((to.path === "/review-link" && !isolatedConsent) || (isolatedConsent && to.path !== "/review-link")) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { nextTick, onScopeDispose } from "vue";
|
||||
import { activeSection, jumpTo, redactParts } from "./outline.js";
|
||||
import { parseDiff, hangIndent, parseDelimited } from "./formatters.js";
|
||||
import { createListeners } from "./state.js";
|
||||
import { readHashState } from "./table-analysis.js";
|
||||
|
||||
export const lineCount = (text) => (text ? String(text).replace(/\n$/, "").split("\n").length : 0);
|
||||
export const isMarkdownFile = (file) => /\.(md|markdown|mdx)$/i.test(file?.filename || "") || file?.language === "Markdown";
|
||||
@@ -78,10 +79,19 @@ const decodeBase64 = (text) => {
|
||||
|
||||
export function setupGistPage(state) {
|
||||
// Rendered or raw, per file; the file's bytes as blob URLs for media, Raw and Download.
|
||||
// A shared link can open a CSV file's chart (#table-2:view=chart).
|
||||
state.gistViews = {};
|
||||
const linked = /^#table-(\d+):/.exec(window.location.hash || "");
|
||||
if (linked) {
|
||||
const view = readHashState(window.location.hash, "table-" + linked[1])?.view;
|
||||
if (view === "chart" || view === "raw") state.gistViews[+linked[1] - 1] = view;
|
||||
}
|
||||
state.gistKind = (index) => gistFileKind(state.details?.files?.[index]);
|
||||
state.gistHasRendered = (index) => hasRenderedView(state.gistKind(index));
|
||||
state.gistView = (index) => (state.gistHasRendered(index) && state.gistViews[index] !== "raw" ? "rendered" : "raw");
|
||||
state.gistView = (index) => {
|
||||
if (!state.gistHasRendered(index) || state.gistViews[index] === "raw") return "raw";
|
||||
return state.gistViews[index] === "chart" && state.gistKind(index) === "csv" ? "chart" : "rendered";
|
||||
};
|
||||
state.setGistView = (index, view) => { state.gistViews = { ...state.gistViews, [index]: view }; };
|
||||
state.gistSourceFile = (index) => {
|
||||
const file = state.details?.files?.[index];
|
||||
@@ -102,14 +112,12 @@ export function setupGistPage(state) {
|
||||
};
|
||||
state.gistMediaUrl = (file) => blobUrl(file, false);
|
||||
state.gistRawUrl = (file) => blobUrl(file, true);
|
||||
let csvCache = { content: null, rows: [] };
|
||||
// Parsed once per file: the table viewer re-analyzes only when its rows change.
|
||||
const csvCache = new Map();
|
||||
state.gistCsvRows = (file) => {
|
||||
if (csvCache.content !== file?.content) csvCache = { content: file?.content, rows: parseDelimited(file?.content || "", extension(file?.filename) === "tsv" ? "\t" : ",") };
|
||||
return csvCache.rows;
|
||||
};
|
||||
state.gistCsvNumeric = (file, ci) => {
|
||||
const values = state.gistCsvRows(file).slice(1).map((r) => r[ci]).filter((v) => v != null && String(v).trim() !== "");
|
||||
return values.length > 0 && values.every((v) => /^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(v) && /\d/.test(v));
|
||||
const key = (file?.filename || "") + "\0" + (file?.content || "");
|
||||
if (!csvCache.has(key)) csvCache.set(key, parseDelimited(file?.content || "", extension(file?.filename) === "tsv" ? "\t" : ","));
|
||||
return csvCache.get(key);
|
||||
};
|
||||
state.gistCopied = null;
|
||||
state.copyGistFile = async (index) => {
|
||||
|
||||
@@ -0,0 +1,393 @@
|
||||
// Client-side analysis of a parsed table (CSV/TSV files, Markdown and notebook
|
||||
// tables): type detection, sorting, filtering, grouping, aggregates, export and
|
||||
// the shareable URL state. Pure functions, no DOM: everything runs on the
|
||||
// anonymized text already on the page.
|
||||
|
||||
export const AGGREGATES = [
|
||||
["mean", "Average"], ["sum", "Sum"], ["median", "Median"], ["min", "Min"],
|
||||
["max", "Max"], ["count", "Count"], ["std", "Std dev"],
|
||||
];
|
||||
export const AGGREGATE_LABEL = Object.fromEntries(AGGREGATES);
|
||||
const AGGREGATE_SHORT = { mean: "Avg", sum: "Sum", median: "Median", min: "Min", max: "Max", count: "Count", std: "Std dev" };
|
||||
export const aggregateShort = (fn) => AGGREGATE_SHORT[fn] || fn;
|
||||
|
||||
// Cells that mean "no value" in exported data (pandas, R, spreadsheets).
|
||||
const MISSING = /^(?:|na|n\/a|nan|null|none|-|—|–)$/i;
|
||||
export const isMissing = (raw) => raw == null || MISSING.test(String(raw).trim());
|
||||
|
||||
// 1,234 · -0.5 · +3 · 12% · 1e-3 · −2 (Unicode minus) · .5 — one match gives
|
||||
// the value, the decimals as written and the percent sign.
|
||||
const NUMBER_RE = /^([-+]?)(\d{1,3}(?:,\d{3})+|\d*)(?:\.(\d+))?(?:e([-+]?\d+))?(%?)$/i;
|
||||
export function scanNumber(raw) {
|
||||
if (raw == null) return null;
|
||||
if (typeof raw === "number") return Number.isFinite(raw) ? { value: raw, decimals: 0, percent: false } : null;
|
||||
let text = String(raw).trim();
|
||||
if (text.charCodeAt(0) === 0x2212) text = "-" + text.slice(1);
|
||||
const m = NUMBER_RE.exec(text);
|
||||
if (!m || (!m[2] && !m[3])) return null;
|
||||
const value = Number(m[1] + (m[2] ? m[2].replace(/,/g, "") : "0") + (m[3] ? "." + m[3] : "") + (m[4] ? "e" + m[4] : ""));
|
||||
if (!Number.isFinite(value)) return null;
|
||||
return { value, decimals: Math.max(0, Math.min(10, (m[3] || "").length - (m[4] ? Number(m[4]) : 0))), percent: m[5] === "%", exponent: !!m[4], mantissa: (m[3] || "").length };
|
||||
}
|
||||
export const parseNumber = (raw) => scanNumber(raw)?.value ?? null;
|
||||
// Digits after the decimal point, as written ("78.90" -> 2, "1e-3" -> 3).
|
||||
export const decimalsOf = (raw) => scanNumber(raw)?.decimals ?? 0;
|
||||
|
||||
// Unambiguous dates only: ISO (2026-03-01, 2026-03-01T10:00Z, 2026/03/01) and
|
||||
// written months with a year (Mar 1, 2026 · 1 March 2026). 03/01/2026 is left as text.
|
||||
const ISO_DATE = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[T ](\d{1,2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?\s*(Z|[+-]\d{2}:?\d{2})?)?$/i;
|
||||
const MONTHS = "jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec";
|
||||
const WORD_DATE = new RegExp(`^(?:\\d{1,2}\\s+(?:${MONTHS})[a-z]*\\.?,?\\s+\\d{4}|(?:${MONTHS})[a-z]*\\.?\\s+\\d{1,2},?\\s+\\d{4})$`, "i");
|
||||
export function parseDate(raw) {
|
||||
if (raw == null) return null;
|
||||
const text = String(raw).trim();
|
||||
if (!text) return null;
|
||||
const iso = ISO_DATE.exec(text);
|
||||
if (iso) {
|
||||
const [, y, mo, d, h = "0", mi = "0", s = "0", zone] = iso;
|
||||
if (+mo < 1 || +mo > 12 || +d < 1 || +d > 31) return null;
|
||||
if (zone) {
|
||||
const t = Date.parse(`${y}-${mo.padStart(2, "0")}-${d.padStart(2, "0")}T${h.padStart(2, "0")}:${mi}:${s.padStart(2, "0")}${zone.length === 5 ? zone.slice(0, 3) + ":" + zone.slice(3) : zone}`);
|
||||
return Number.isFinite(t) ? t : null;
|
||||
}
|
||||
return Date.UTC(+y, +mo - 1, +d, +h, +mi, +s);
|
||||
}
|
||||
if (WORD_DATE.test(text)) {
|
||||
const t = Date.parse(text.replace(/\./g, "") + " UTC");
|
||||
return Number.isFinite(t) ? t : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// "number" when every non-empty cell parses as a number, "date" when every one
|
||||
// parses as a date, "text" otherwise (and for a column with no values).
|
||||
export const detectType = (values) => makeColumn("", 0, values).type;
|
||||
|
||||
const collator = typeof Intl !== "undefined" ? new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }) : null;
|
||||
const compareText = collator ? collator.compare : (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
||||
|
||||
/**
|
||||
* A table model from rows of strings (the first row is the header).
|
||||
* Each column gets its detected type, precision (max decimals seen), unit ("%"
|
||||
* when every value has one) and a key per row: a number for numbers and dates
|
||||
* (null when empty), the cell text otherwise.
|
||||
*/
|
||||
export function analyzeTable(rows) {
|
||||
const header = (rows && rows[0]) || [];
|
||||
const body = rows ? rows.slice(1) : [];
|
||||
const width = Math.max(header.length, ...body.slice(0, 2000).map((r) => r.length), 0);
|
||||
const columns = [];
|
||||
for (let ci = 0; ci < width; ci++) {
|
||||
const values = body.map((r) => r[ci] ?? "");
|
||||
columns.push(makeColumn(String(header[ci] ?? "").trim() || "Column " + (ci + 1), ci, values));
|
||||
}
|
||||
return { header: columns.map((c) => c.name), body, columns, size: body.length };
|
||||
}
|
||||
|
||||
export function makeColumn(name, index, values, forced) {
|
||||
const n = values.length;
|
||||
const keys = new Array(n);
|
||||
let type = forced?.type, decimals = 0, empty = 0, percent = 0, filled = 0, exponent = 0, mantissa = 0;
|
||||
for (let i = 0; i < n; i++) if (isMissing(values[i])) { keys[i] = null; empty++; } else filled++;
|
||||
// One pass per candidate type, stopping at the first cell that doesn't fit.
|
||||
if (!type || type === "number") {
|
||||
let ok = filled > 0 || type === "number";
|
||||
for (let i = 0; ok && i < n; i++) {
|
||||
if (keys[i] === null) continue;
|
||||
const scan = scanNumber(values[i]);
|
||||
if (!scan) { ok = type === "number"; keys[i] = null; continue; }
|
||||
keys[i] = scan.value;
|
||||
if (scan.decimals > decimals) decimals = scan.decimals;
|
||||
if (scan.percent) percent++;
|
||||
if (scan.exponent) { exponent++; if (scan.mantissa > mantissa) mantissa = scan.mantissa; }
|
||||
}
|
||||
if (ok) type = "number";
|
||||
}
|
||||
if (!type || type === "date") {
|
||||
let ok = filled > 0 || type === "date";
|
||||
for (let i = 0; ok && i < n; i++) {
|
||||
if (isMissing(values[i])) continue;
|
||||
const t = parseDate(values[i]);
|
||||
if (t == null) ok = type === "date";
|
||||
keys[i] = t;
|
||||
}
|
||||
if (ok) type = "date";
|
||||
}
|
||||
if (!type || type === "text") {
|
||||
type = "text";
|
||||
for (let i = 0; i < n; i++) keys[i] = isMissing(values[i]) ? null : String(values[i]).trim();
|
||||
}
|
||||
return {
|
||||
name, index, type, keys, empty,
|
||||
decimals: forced?.decimals ?? decimals,
|
||||
unit: forced?.unit ?? (type === "number" && filled && percent === filled ? "%" : ""),
|
||||
// Written as 1.38e-3: aggregates keep scientific notation and its significant digits.
|
||||
scientific: forced?.scientific ?? (type === "number" && exponent * 2 >= filled && exponent > 0 ? mantissa : null),
|
||||
};
|
||||
}
|
||||
|
||||
let distinctCache = new WeakMap();
|
||||
export function distinctValues(column, indices) {
|
||||
const all = !indices;
|
||||
if (all && distinctCache.has(column)) return distinctCache.get(column);
|
||||
const counts = new Map();
|
||||
const list = indices || column.keys.map((_, i) => i);
|
||||
for (const i of list) {
|
||||
const k = column.keys[i];
|
||||
if (k == null) continue;
|
||||
counts.set(k, (counts.get(k) || 0) + 1);
|
||||
}
|
||||
if (all) distinctCache.set(column, counts);
|
||||
return counts;
|
||||
}
|
||||
|
||||
// Row order for the given column: ascending or descending, stable (ties keep
|
||||
// their current order) and with empty cells last in both directions.
|
||||
export function sortIndices(table, indices, columnIndex, direction) {
|
||||
const column = table.columns[columnIndex];
|
||||
if (!column || !direction) return indices.slice();
|
||||
const sign = direction === "desc" ? -1 : 1;
|
||||
const keys = column.keys;
|
||||
const numeric = column.type !== "text";
|
||||
const order = indices.map((row, position) => ({ row, position }));
|
||||
order.sort((a, b) => {
|
||||
const ka = keys[a.row], kb = keys[b.row];
|
||||
if (ka == null || kb == null) return ka == null && kb == null ? a.position - b.position : ka == null ? 1 : -1;
|
||||
const c = numeric ? ka - kb : compareText(ka, kb);
|
||||
return c ? c * sign : a.position - b.position;
|
||||
});
|
||||
return order.map((o) => o.row);
|
||||
}
|
||||
|
||||
// Rows matching the search text (any cell, case-insensitive), every numeric
|
||||
// range { [column]: [min, max] } (either bound may be null) and every value set
|
||||
// { [column]: [values] } (as text; a date is its timestamp).
|
||||
export function filterIndices(table, { query = "", ranges = {}, values = {} } = {}) {
|
||||
const needle = String(query || "").trim().toLowerCase();
|
||||
const rangeList = Object.entries(ranges || {}).map(([ci, r]) => [table.columns[ci], r]).filter(([c, r]) => c && r && (r[0] != null || r[1] != null));
|
||||
const valueList = Object.entries(values || {}).map(([ci, v]) => [table.columns[ci], new Set(v)]).filter(([c, v]) => c && v.size);
|
||||
const out = [];
|
||||
const haystack = needle ? searchText(table) : null;
|
||||
for (let i = 0; i < table.size; i++) {
|
||||
if (needle && haystack[i].indexOf(needle) === -1) continue;
|
||||
let keep = true;
|
||||
for (const [c, [min, max]] of rangeList) {
|
||||
const k = c.keys[i];
|
||||
if (k == null || (min != null && k < min) || (max != null && k > max)) { keep = false; break; }
|
||||
}
|
||||
if (!keep) continue;
|
||||
for (const [c, set] of valueList) if (!set.has(c.keys[i] == null ? "" : String(c.keys[i]))) { keep = false; break; }
|
||||
if (keep) out.push(i);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
const searchCache = new WeakMap();
|
||||
function searchText(table) {
|
||||
if (!searchCache.has(table)) searchCache.set(table, table.body.map((r) => r.join("\u0001").toLowerCase()));
|
||||
return searchCache.get(table);
|
||||
}
|
||||
|
||||
// One aggregate over the non-empty keys of the given rows. null when undefined
|
||||
// (no values; a standard deviation needs two).
|
||||
export function aggregate(keys, indices, fn) {
|
||||
const values = [];
|
||||
for (const i of indices) { const k = keys[i]; if (k != null && Number.isFinite(k)) values.push(k); }
|
||||
const n = values.length;
|
||||
if (fn === "count") return n;
|
||||
if (!n) return null;
|
||||
if (fn === "sum") return values.reduce((s, v) => s + v, 0);
|
||||
if (fn === "mean") return values.reduce((s, v) => s + v, 0) / n;
|
||||
if (fn === "min") return values.reduce((m, v) => (v < m ? v : m), Infinity);
|
||||
if (fn === "max") return values.reduce((m, v) => (v > m ? v : m), -Infinity);
|
||||
if (fn === "median") {
|
||||
values.sort((a, b) => a - b);
|
||||
return n % 2 ? values[(n - 1) / 2] : (values[n / 2 - 1] + values[n / 2]) / 2;
|
||||
}
|
||||
if (fn === "std") {
|
||||
if (n < 2) return null;
|
||||
const mean = values.reduce((s, v) => s + v, 0) / n;
|
||||
return Math.sqrt(values.reduce((s, v) => s + (v - mean) ** 2, 0) / (n - 1));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Decimals shown for an aggregate: the column's own precision; an average,
|
||||
// median or standard deviation of whole numbers keeps one decimal.
|
||||
export const aggregateDecimals = (column, fn) => fn === "count" ? 0
|
||||
: ["mean", "median", "std"].includes(fn) ? Math.max(column.decimals, 1) : column.decimals;
|
||||
|
||||
const formats = new Map();
|
||||
const numberFormat = (d) => {
|
||||
if (!formats.has(d)) formats.set(d, new Intl.NumberFormat("en-US", { minimumFractionDigits: d, maximumFractionDigits: d }));
|
||||
return formats.get(d);
|
||||
};
|
||||
export function formatNumber(value, decimals = 0, unit = "") {
|
||||
if (value == null || !Number.isFinite(value)) return "—";
|
||||
const d = Math.max(0, Math.min(10, decimals));
|
||||
const abs = Math.abs(value);
|
||||
if (abs !== 0 && (abs >= 1e15 || (abs < 1e-6 && d <= 6))) return value.toExponential(Math.min(d, 3)) + unit;
|
||||
return numberFormat(d).format(value) + unit;
|
||||
}
|
||||
const pad = (n) => String(n).padStart(2, "0");
|
||||
export function formatDate(ms, withTime) {
|
||||
if (ms == null || !Number.isFinite(ms)) return "—";
|
||||
const d = new Date(ms);
|
||||
const day = `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
|
||||
return withTime ? `${day} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}` : day;
|
||||
}
|
||||
const hasTime = (column) => column.keys.some((k) => k != null && k % 86400000 !== 0);
|
||||
export function formatKey(column, key, fn) {
|
||||
if (column.type === "number" && column.scientific != null && fn !== "count" && key != null && Number.isFinite(key) && key !== 0) return key.toExponential(column.scientific + (["mean", "median", "std"].includes(fn) ? 1 : 0)) + column.unit;
|
||||
if (column.type === "date") return fn === "count" ? formatNumber(key, 0) : formatDate(key, hasTime(column));
|
||||
if (column.type === "number" || fn) return formatNumber(key, fn ? aggregateDecimals(column, fn) : column.decimals, fn === "count" ? "" : column.unit);
|
||||
return key == null ? "" : String(key);
|
||||
}
|
||||
|
||||
// The summary cell of a column over the given rows: the selected aggregate for
|
||||
// numbers, the count of distinct values otherwise.
|
||||
export function summarize(column, indices, fn = "mean") {
|
||||
if (column.type === "number") {
|
||||
const value = aggregate(column.keys, indices, fn);
|
||||
return { kind: "number", fn, value, text: formatKey(column, value, fn) };
|
||||
}
|
||||
const distinct = distinctValues(column, indices).size;
|
||||
return { kind: "distinct", value: distinct, text: distinct === 1 ? "1 distinct" : formatNumber(distinct) + " distinct" };
|
||||
}
|
||||
|
||||
/**
|
||||
* Rows grouped by one column: the group's value, its row count, then every
|
||||
* numeric column aggregated with fn. The result is a table model like
|
||||
* analyzeTable's, so it can be sorted, summarized, charted and exported.
|
||||
*/
|
||||
export function groupTable(table, indices, groupIndex, fn = "mean") {
|
||||
const by = table.columns[groupIndex];
|
||||
if (!by) return null;
|
||||
const groups = new Map();
|
||||
for (const i of indices) {
|
||||
const key = by.keys[i] == null ? "" : by.keys[i];
|
||||
if (!groups.has(key)) groups.set(key, []);
|
||||
groups.get(key).push(i);
|
||||
}
|
||||
const numeric = table.columns.filter((c) => c.type === "number" && c.index !== groupIndex);
|
||||
const entries = [...groups.entries()];
|
||||
// Text groups keep the cell as written (first occurrence); numbers and dates are formatted.
|
||||
const labels = entries.map(([key, rows]) => (key === "" ? "(empty)" : by.type === "text" ? table.body[rows[0]][groupIndex].trim() : formatKey(by, key)));
|
||||
const groupColumn = makeColumn(by.name, 0, labels, { type: by.type, decimals: by.decimals, unit: by.unit });
|
||||
groupColumn.keys = entries.map(([key]) => (key === "" ? null : key));
|
||||
groupColumn.source = groupIndex;
|
||||
const countColumn = makeColumn("Rows", 1, entries.map(([, rows]) => rows.length), { type: "number", decimals: 0, unit: "" });
|
||||
const valueColumns = numeric.map((c, n) => {
|
||||
const values = entries.map(([, rows]) => aggregate(c.keys, rows, fn));
|
||||
const column = makeColumn(c.name, n + 2, values, { type: "number", decimals: aggregateDecimals(c, fn), unit: fn === "count" ? "" : c.unit, scientific: fn === "count" || c.scientific == null ? null : c.scientific + (["mean", "median", "std"].includes(fn) ? 1 : 0) });
|
||||
column.source = c.index;
|
||||
column.agg = fn;
|
||||
return column;
|
||||
});
|
||||
const columns = [groupColumn, countColumn, ...valueColumns];
|
||||
const body = entries.map((_, r) => columns.map((c) => (c === groupColumn ? labels[r] : formatKey(c, c.keys[r]))));
|
||||
return { header: columns.map((c) => c.name), body, columns, size: body.length, grouped: { by: by.name, fn } };
|
||||
}
|
||||
|
||||
// Quick facts for a column's menu: type, counts, range, mean and a histogram.
|
||||
export function columnStats(column, indices, bins = 12) {
|
||||
const stats = { type: column.type, count: 0, empty: 0, distinct: distinctValues(column, indices).size };
|
||||
for (const i of indices) { if (column.keys[i] == null) stats.empty++; else stats.count++; }
|
||||
if (column.type === "text") {
|
||||
stats.top = [...distinctValues(column, indices).entries()].sort((a, b) => b[1] - a[1] || compareText(a[0], b[0])).slice(0, 5);
|
||||
return stats;
|
||||
}
|
||||
stats.min = aggregate(column.keys, indices, "min");
|
||||
stats.max = aggregate(column.keys, indices, "max");
|
||||
if (column.type === "number") {
|
||||
stats.mean = aggregate(column.keys, indices, "mean");
|
||||
stats.std = aggregate(column.keys, indices, "std");
|
||||
}
|
||||
if (stats.count && stats.min != null) {
|
||||
const n = stats.min === stats.max ? 1 : bins;
|
||||
const width = (stats.max - stats.min) / n || 1;
|
||||
const counts = new Array(n).fill(0);
|
||||
for (const i of indices) {
|
||||
const k = column.keys[i];
|
||||
if (k == null) continue;
|
||||
counts[Math.min(n - 1, Math.floor((k - stats.min) / width))]++;
|
||||
}
|
||||
stats.histogram = counts.map((count, b) => ({ count, from: stats.min + b * width, to: stats.min + (b + 1) * width }));
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
|
||||
// ---- Export -----------------------------------------------------------------
|
||||
const csvCell = (value, sep) => {
|
||||
const text = String(value ?? "");
|
||||
return text.includes(sep) || /["\r\n]/.test(text) || /^\s|\s$/.test(text) ? '"' + text.replace(/"/g, '""') + '"' : text;
|
||||
};
|
||||
export const toDelimited = (header, rows, sep = ",") => [header, ...rows].map((r) => r.map((v) => csvCell(v, sep)).join(sep)).join("\n") + "\n";
|
||||
const mdCell = (value) => String(value ?? "").replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
|
||||
export function toMarkdown(header, rows, numeric = []) {
|
||||
const lines = [
|
||||
"| " + header.map(mdCell).join(" | ") + " |",
|
||||
"| " + header.map((_, i) => (numeric[i] ? "---:" : "---")).join(" | ") + " |",
|
||||
...rows.map((r) => "| " + header.map((_, i) => mdCell(r[i])).join(" | ") + " |"),
|
||||
];
|
||||
return lines.join("\n") + "\n";
|
||||
}
|
||||
|
||||
// ---- Shareable state --------------------------------------------------------
|
||||
// The analysis of a table lives in the URL fragment so a link can carry
|
||||
// "grouped by model, average accuracy": #table:group=model&agg=mean (a single
|
||||
// file) or #table-2:... (the second file of a gist). Columns are named, not
|
||||
// numbered. Without the fragment the table opens as it always did.
|
||||
export const DEFAULT_STATE = Object.freeze({ view: "table", query: "", sort: null, group: null, agg: "mean", ranges: {}, values: {}, sums: {}, chart: null, x: null, y: [] });
|
||||
|
||||
export function encodeState(state) {
|
||||
const p = new URLSearchParams();
|
||||
if (state.view && state.view !== "table") p.set("view", state.view);
|
||||
if (state.query) p.set("q", state.query);
|
||||
if (state.sort?.column) p.set("sort", state.sort.column + (state.sort.dir === "desc" ? ":desc" : ""));
|
||||
if (state.group) p.set("group", state.group);
|
||||
if (state.group && state.agg && state.agg !== "mean") p.set("agg", state.agg);
|
||||
for (const [name, [min, max]] of Object.entries(state.ranges || {})) if (min != null || max != null) p.set("range." + name, (min ?? "") + "~" + (max ?? ""));
|
||||
for (const [name, list] of Object.entries(state.values || {})) for (const v of list || []) p.append("in." + name, v);
|
||||
for (const [name, fn] of Object.entries(state.sums || {})) if (fn && fn !== "mean") p.set("sum." + name, fn);
|
||||
if (state.chart) p.set("chart", state.chart);
|
||||
if (state.x) p.set("x", state.x);
|
||||
if (state.y?.length) p.set("y", state.y.join("|"));
|
||||
return p.toString();
|
||||
}
|
||||
|
||||
export function decodeState(text) {
|
||||
const p = new URLSearchParams(text || "");
|
||||
const out = { ...DEFAULT_STATE, ranges: {}, values: {}, sums: {}, y: [] };
|
||||
const view = p.get("view");
|
||||
if (["table", "chart", "raw"].includes(view)) out.view = view;
|
||||
out.query = p.get("q") || "";
|
||||
const sort = p.get("sort");
|
||||
if (sort) { const m = /^(.*?)(?::(asc|desc))?$/.exec(sort); out.sort = { column: m[1], dir: m[2] || "asc" }; }
|
||||
out.group = p.get("group") || null;
|
||||
const agg = p.get("agg");
|
||||
if (agg && AGGREGATE_LABEL[agg]) out.agg = agg;
|
||||
for (const [key, value] of p.entries()) {
|
||||
if (key.startsWith("range.")) {
|
||||
const [min, max] = value.split("~").map((v) => (v === "" || v == null ? null : Number(v)));
|
||||
out.ranges[key.slice(6)] = [Number.isFinite(min) ? min : null, Number.isFinite(max) ? max : null];
|
||||
} else if (key.startsWith("in.")) (out.values[key.slice(3)] ||= []).push(value);
|
||||
else if (key.startsWith("sum.") && AGGREGATE_LABEL[value]) out.sums[key.slice(4)] = value;
|
||||
}
|
||||
const chart = p.get("chart");
|
||||
if (["bar", "line", "scatter"].includes(chart)) out.chart = chart;
|
||||
out.x = p.get("x") || null;
|
||||
out.y = (p.get("y") || "").split("|").filter(Boolean);
|
||||
return out;
|
||||
}
|
||||
|
||||
const hashPrefix = (key) => "#" + key + ":";
|
||||
export function readHashState(hash, key) {
|
||||
if (!key || typeof hash !== "string" || !hash.startsWith(hashPrefix(key))) return null;
|
||||
try { return decodeState(hash.slice(hashPrefix(key).length)); } catch { return null; }
|
||||
}
|
||||
// The fragment for a state, "" when the state is the default (the link is then left clean).
|
||||
export function writeHashState(key, state) {
|
||||
const encoded = encodeState(state);
|
||||
return encoded ? hashPrefix(key) + encoded.replace(/%3A/gi, ":").replace(/%7C/gi, "|").replace(/%7E/gi, "~").replace(/%2C/gi, ",") : "";
|
||||
}
|
||||
export const isTableHash = (hash) => /^#table(?:-\d+)?:/.test(hash || "");
|
||||
@@ -0,0 +1,258 @@
|
||||
// Chart geometry for the table viewer's Chart view, as plain data the template
|
||||
// draws in inline SVG (no chart library). Bars are horizontal so category names
|
||||
// stay readable on a phone; lines and scatter plots share one value axis.
|
||||
import { aggregate, formatKey, formatNumber, formatDate } from "./table-analysis.js";
|
||||
|
||||
// Categorical slots, light and dark steps chosen and validated for this page's
|
||||
// surfaces (dataviz reference palette, adjacent pairs; scatter uses the first three).
|
||||
export const SERIES_LIGHT = ["#2a78d6", "#eb6834", "#1baf7a", "#eda100"];
|
||||
export const SERIES_DARK = ["#3987e5", "#d95926", "#199e70", "#c98500"];
|
||||
export const MAX_SERIES = { bar: 4, line: 4, scatter: 3 };
|
||||
export const MAX_BARS = 40;
|
||||
export const MAX_POINTS = 2000;
|
||||
|
||||
const ID_LIKE = /^(?:seed|id|run|fold|trial|rep|repeat|index|idx|#|no\.?|row)s?$/i;
|
||||
const isIdLike = (column) => column.type === "number" && ID_LIKE.test(column.name.trim());
|
||||
|
||||
// The default chart: a bar of the first measure by the first text column (the
|
||||
// group column once grouped); a line when the x axis is a date or a number.
|
||||
export function defaultChart(table, grouped) {
|
||||
const cols = table.columns;
|
||||
const x = grouped ? cols[0] : cols.find((c) => c.type === "text") || cols.find((c) => c.type === "date") || cols.find((c) => c.type === "number");
|
||||
const measures = cols.filter((c) => c.type === "number" && c !== x && !(grouped && c.index === 1));
|
||||
const y = measures.find((c) => !isIdLike(c)) || measures[0];
|
||||
return { type: x && x.type !== "text" ? "line" : "bar", x: x?.name || null, y: y ? [y.name] : [] };
|
||||
}
|
||||
|
||||
// Round axis bounds and 3-6 ticks at 1/2/5 steps.
|
||||
export function niceTicks(min, max, count = 5) {
|
||||
if (!Number.isFinite(min) || !Number.isFinite(max)) return { min: 0, max: 1, ticks: [0, 1], step: 1 };
|
||||
if (min === max) { const pad = Math.abs(min) * 0.1 || 1; min -= pad; max += pad; }
|
||||
const raw = (max - min) / count;
|
||||
const mag = 10 ** Math.floor(Math.log10(raw));
|
||||
const step = [1, 2, 2.5, 5, 10].map((m) => m * mag).find((s) => s >= raw) || 10 * mag;
|
||||
const lo = Math.floor(min / step + 1e-9) * step, hi = Math.ceil(max / step - 1e-9) * step;
|
||||
const ticks = [];
|
||||
for (let v = lo; v <= hi + step / 2; v += step) ticks.push(Math.abs(v) < step / 1e6 ? 0 : +v.toPrecision(12));
|
||||
return { min: lo, max: hi, ticks, step };
|
||||
}
|
||||
const stepDecimals = (step) => (String(+step.toPrecision(6)).split(".")[1] || "").length;
|
||||
// Axis labels: full under 10,000, compact (12K, 1.5M) when the axis reaches it.
|
||||
export function tickLabel(value, step, unit = "") {
|
||||
const top = Math.abs(value);
|
||||
if (top >= 10000) {
|
||||
const [div, suffix] = top >= 1e9 ? [1e9, "B"] : top >= 1e6 ? [1e6, "M"] : [1e3, "K"];
|
||||
return formatNumber(value / div, Math.max(0, stepDecimals(step / div))) + suffix + unit;
|
||||
}
|
||||
return formatNumber(value, stepDecimals(step)) + unit;
|
||||
}
|
||||
|
||||
// Measured text is not available outside the page; an average Inter glyph at 11-12px is close enough to size gutters.
|
||||
const textWidth = (text, size = 11.5) => String(text).length * size * 0.56;
|
||||
|
||||
/**
|
||||
* table: a model from analyzeTable/groupTable; rows: row indices in view order;
|
||||
* spec: { type, x, y: [names], agg }; box: { width, dark }.
|
||||
*/
|
||||
export function buildChart(table, rows, spec, box) {
|
||||
const cols = table.columns;
|
||||
const x = cols.find((c) => c.name === spec.x);
|
||||
const type = spec.type || "bar";
|
||||
const ys = (spec.y || []).map((n) => cols.find((c) => c.name === n && c.type === "number")).filter(Boolean).slice(0, MAX_SERIES[type]);
|
||||
const palette = box.dark ? SERIES_DARK : SERIES_LIGHT;
|
||||
const width = Math.max(260, Math.floor(box.width || 640));
|
||||
const base = { type, width, x, ys, notes: [], series: ys.map((c, i) => ({ name: c.name, color: palette[i] })) };
|
||||
if (!x) return { ...base, empty: "Pick a column for the x axis." };
|
||||
if (!ys.length) return { ...base, empty: "Pick at least one numeric column to plot." };
|
||||
if (!rows.length) return { ...base, empty: "No rows match the current filters." };
|
||||
if ((spec.y || []).length > ys.length) base.notes.push(`Showing the first ${ys.length} series; a chart with more is hard to read.`);
|
||||
// One value axis only: say so when the series live on very different scales.
|
||||
const spans = ys.map((y) => Math.max(...rows.slice(0, 5000).map((r) => Math.abs(y.keys[r] ?? 0)))).filter((v) => v > 0);
|
||||
if (spans.length > 1 && Math.max(...spans) / Math.min(...spans) > 20) base.notes.push("These columns have very different ranges; chart them one at a time to compare their values.");
|
||||
return type === "bar" ? barChart(table, rows, x, ys, spec, base)
|
||||
: type === "line" ? lineChart(table, rows, x, ys, spec, base)
|
||||
: scatterChart(table, rows, x, ys, base);
|
||||
}
|
||||
|
||||
// One entry per x value in first-seen order; repeated x values are combined
|
||||
// with the chosen aggregate (a chart of "accuracy by model" over seeds).
|
||||
function categories(table, rows, x, ys, agg) {
|
||||
const map = new Map();
|
||||
for (const r of rows) {
|
||||
const key = x.keys[r] == null ? "" : x.keys[r];
|
||||
if (!map.has(key)) map.set(key, { key, label: key === "" ? "(empty)" : x.type === "text" ? String(table.body[r][x.index]).trim() : formatKey(x, key), rows: [] });
|
||||
map.get(key).rows.push(r);
|
||||
}
|
||||
const list = [...map.values()];
|
||||
const repeated = list.some((c) => c.rows.length > 1);
|
||||
for (const c of list) c.values = ys.map((y) => (repeated ? aggregate(y.keys, c.rows, agg) : y.keys[c.rows[0]]));
|
||||
return { list, repeated };
|
||||
}
|
||||
|
||||
function valueFormat(y, fn) { return (v) => formatKey(y, v, fn); }
|
||||
|
||||
function barChart(table, rows, x, ys, spec, base) {
|
||||
const agg = spec.agg || "mean";
|
||||
const { list: all, repeated } = categories(table, rows, x, ys, agg);
|
||||
const list = all.slice(0, MAX_BARS);
|
||||
if (repeated) base.notes.unshift(`${aggLabel(agg)} per ${x.name} over ${rows.length} rows.`);
|
||||
if (all.length > list.length) base.notes.push(`First ${list.length} of ${all.length} ${x.name} values, in table order.`);
|
||||
const values = list.flatMap((c) => c.values).filter((v) => v != null);
|
||||
const lo = Math.min(0, ...values), hi = Math.max(0, ...values);
|
||||
const scale = niceTicks(lo, hi, base.width < 480 ? 4 : 6);
|
||||
const fmt = ys.map((y) => valueFormat(y, repeated ? agg : undefined));
|
||||
const labelW = Math.min(Math.max(...list.map((c) => textWidth(c.label, 12))) + 12, Math.round(base.width * 0.38));
|
||||
const valueW = Math.max(...list.flatMap((c) => c.values.map((v, i) => textWidth(fmt[i](v), 11.5)))) + 10;
|
||||
const bar = ys.length > 2 ? 12 : 16, gap = 2, pad = 14;
|
||||
const band = ys.length * bar + (ys.length - 1) * gap + pad;
|
||||
const top = 8, axisH = 26;
|
||||
const plot = { x: labelW, y: top, w: Math.max(80, base.width - labelW - valueW - 4), h: list.length * band };
|
||||
const sx = (v) => plot.x + ((v - scale.min) / (scale.max - scale.min)) * plot.w;
|
||||
const zero = sx(0);
|
||||
const marks = [];
|
||||
list.forEach((c, ci) => {
|
||||
const y0 = plot.y + ci * band + pad / 2;
|
||||
c.values.forEach((v, si) => {
|
||||
if (v == null) return;
|
||||
const x1 = sx(v), left = Math.min(zero, x1), w = Math.abs(x1 - zero);
|
||||
marks.push({ key: ci + ":" + si, series: si, cat: ci, x: left, y: y0 + si * (bar + gap), w, h: bar, positive: v >= 0, color: base.series[si].color,
|
||||
path: roundedBar(left, y0 + si * (bar + gap), w, bar, v >= 0),
|
||||
label: fmt[si](v), lx: v >= 0 ? x1 + 6 : x1 - 6, anchor: v >= 0 ? "start" : "end", ly: y0 + si * (bar + gap) + bar / 2 });
|
||||
});
|
||||
});
|
||||
return {
|
||||
...base, kind: "bar", height: plot.y + plot.h + axisH, plot, zero,
|
||||
categories: list.map((c, ci) => ({ label: c.label, y: plot.y + ci * band + band / 2, hit: { y: plot.y + ci * band, h: band },
|
||||
tip: { title: c.label, rows: c.values.map((v, si) => ({ name: ys[si].name, color: base.series[si].color, value: fmt[si](v) })), note: repeated ? `${aggLabel(agg)} of ${c.rows.length} ${c.rows.length === 1 ? "row" : "rows"}` : "" } })),
|
||||
marks, showValues: list.length <= 30,
|
||||
xTicks: scale.ticks.map((v) => ({ v, x: sx(v), label: tickLabel(v, scale.step, ys.length === 1 ? ys[0].unit : "") })),
|
||||
axisLabel: ys.length === 1 ? (repeated ? `${aggLabel(agg)} ${ys[0].name}` : measureName(ys[0])) : repeated ? aggLabel(agg) : "",
|
||||
};
|
||||
}
|
||||
|
||||
// 4px rounded data end, square at the baseline.
|
||||
function roundedBar(x, y, w, h, positive) {
|
||||
const r = Math.min(4, w / 2, h / 2);
|
||||
if (w <= 0.5) return "";
|
||||
return positive
|
||||
? `M${x},${y}H${x + w - r}Q${x + w},${y} ${x + w},${y + r}V${y + h - r}Q${x + w},${y + h} ${x + w - r},${y + h}H${x}Z`
|
||||
: `M${x + w},${y}H${x + r}Q${x},${y} ${x},${y + r}V${y + h - r}Q${x},${y + h} ${x + r},${y + h}H${x + w}Z`;
|
||||
}
|
||||
|
||||
// A grouped table's columns are aggregates: "Average accuracy".
|
||||
const measureName = (column) => (column.agg ? `${aggLabel(column.agg)} ${column.name}` : column.name);
|
||||
const aggLabel = (fn) => ({ mean: "Average", sum: "Sum", median: "Median", min: "Min", max: "Max", count: "Count", std: "Std dev" })[fn] || fn;
|
||||
|
||||
function xAxis(points, x, plotW, continuous) {
|
||||
if (continuous) {
|
||||
const keys = points.map((p) => p.xv);
|
||||
const scale = niceTicks(Math.min(...keys), Math.max(...keys), plotW < 360 ? 3 : 6);
|
||||
let ticks = scale.ticks;
|
||||
if (x.type === "date") {
|
||||
const lo = Math.min(...keys), hi = Math.max(...keys), span = hi - lo || 86400000;
|
||||
// Calendar steps: hours, days, weeks, months (30 days), years.
|
||||
const HOUR = 3600000, DAY = 24 * HOUR;
|
||||
const steps = [HOUR, 3 * HOUR, 6 * HOUR, 12 * HOUR, DAY, 2 * DAY, 7 * DAY, 14 * DAY, 30 * DAY, 91 * DAY, 182 * DAY, 365 * DAY, 730 * DAY, 1826 * DAY];
|
||||
const want = plotW < 360 ? 3 : 6;
|
||||
const step = steps.find((s) => span / s <= want) || steps[steps.length - 1];
|
||||
ticks = [];
|
||||
for (let t = Math.ceil(lo / step) * step; t <= hi; t += step) ticks.push(t);
|
||||
if (!ticks.length) ticks = [lo];
|
||||
return { min: lo, max: hi === lo ? lo + DAY : hi, ticks, label: (v) => formatDate(v, step < DAY) };
|
||||
}
|
||||
return { min: scale.min, max: scale.max, ticks, label: (v) => tickLabel(v, scale.step, x.unit) };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function lineChart(table, rows, x, ys, spec, base) {
|
||||
const continuous = x.type !== "text";
|
||||
let points;
|
||||
if (continuous) {
|
||||
const usable = rows.filter((r) => x.keys[r] != null);
|
||||
const repeated = new Set(usable.map((r) => x.keys[r])).size < usable.length;
|
||||
if (repeated) {
|
||||
const { list } = categories(table, usable, x, ys, spec.agg || "mean");
|
||||
points = list.map((c) => ({ xv: c.key, label: c.label, values: c.values, count: c.rows.length }));
|
||||
base.notes.unshift(`${aggLabel(spec.agg || "mean")} per ${x.name}.`);
|
||||
} else points = usable.map((r) => ({ xv: x.keys[r], label: formatKey(x, x.keys[r]), values: ys.map((y) => y.keys[r]), count: 1 }));
|
||||
points.sort((a, b) => a.xv - b.xv);
|
||||
} else {
|
||||
const { list, repeated } = categories(table, rows, x, ys, spec.agg || "mean");
|
||||
points = list.map((c) => ({ label: c.label, values: c.values, count: c.rows.length }));
|
||||
if (repeated) base.notes.unshift(`${aggLabel(spec.agg || "mean")} per ${x.name}.`);
|
||||
}
|
||||
points = thin(points, base);
|
||||
return xyChart(points, x, ys, base, continuous, "line", spec);
|
||||
}
|
||||
|
||||
function scatterChart(table, rows, x, ys, base) {
|
||||
const continuous = x.type !== "text";
|
||||
let points = rows.filter((r) => x.keys[r] != null).map((r) => ({ xv: continuous ? x.keys[r] : null, label: x.type === "text" ? String(table.body[r][x.index]).trim() : formatKey(x, x.keys[r]), values: ys.map((y) => y.keys[r]), count: 1, row: r }));
|
||||
if (!continuous) {
|
||||
// Text on the x axis: one position per value in first-seen order.
|
||||
const order = new Map();
|
||||
points.forEach((p) => { if (!order.has(p.label)) order.set(p.label, order.size); p.xv = order.get(p.label); });
|
||||
base.categoryLabels = [...order.keys()];
|
||||
}
|
||||
points = thin(points, base);
|
||||
return xyChart(points, x, ys, base, true, "scatter");
|
||||
}
|
||||
|
||||
// Long series keep every n-th point so the SVG stays light; the note says so.
|
||||
function thin(points, base) {
|
||||
if (points.length <= MAX_POINTS) return points;
|
||||
const step = Math.ceil(points.length / MAX_POINTS);
|
||||
base.notes.push(`Showing every ${step}th of ${points.length.toLocaleString("en-US")} points.`);
|
||||
return points.filter((_, i) => i % step === 0);
|
||||
}
|
||||
|
||||
function xyChart(points, x, ys, base, continuous, kind) {
|
||||
const values = points.flatMap((p) => p.values).filter((v) => v != null);
|
||||
if (!values.length) return { ...base, empty: "The selected columns have no values in these rows." };
|
||||
const narrow = base.width < 480;
|
||||
const yScale = niceTicks(Math.min(...values), Math.max(...values), narrow ? 4 : 5);
|
||||
const unit = ys.length === 1 ? ys[0].unit : "";
|
||||
const yLabels = yScale.ticks.map((v) => tickLabel(v, yScale.step, unit));
|
||||
const left = Math.max(...yLabels.map((l) => textWidth(l))) + 14;
|
||||
const height = narrow ? 240 : 300;
|
||||
const plot = { x: left, y: 10, w: base.width - left - 16, h: height - 10 - 30 };
|
||||
const cats = base.categoryLabels;
|
||||
let sxv, xTicks;
|
||||
if (continuous && !cats) {
|
||||
const axis = xAxis(points, x, plot.w, true);
|
||||
const span = axis.max - axis.min || 1;
|
||||
sxv = (v) => plot.x + ((v - axis.min) / span) * plot.w;
|
||||
xTicks = axis.ticks.map((v) => ({ x: sxv(v), label: axis.label(v) }));
|
||||
} else {
|
||||
const n = cats ? cats.length : points.length;
|
||||
const inset = n > 1 ? Math.min(24, plot.w / (2 * n)) : plot.w / 2;
|
||||
const stepW = n > 1 ? (plot.w - 2 * inset) / (n - 1) : 0;
|
||||
sxv = (i) => plot.x + inset + i * stepW;
|
||||
if (!cats) points.forEach((p, i) => { p.xv = i; });
|
||||
const labels = cats || points.map((p) => p.label);
|
||||
const maxLabels = Math.max(2, Math.floor(plot.w / (Math.max(...labels.map((l) => textWidth(l))) + 12)));
|
||||
const every = Math.ceil(labels.length / maxLabels);
|
||||
xTicks = labels.map((label, i) => ({ x: sxv(i), label, show: i % every === 0 })).filter((t) => t.show);
|
||||
}
|
||||
// Labels near the plot's edges are anchored inside it, never cut off.
|
||||
xTicks.forEach((t) => { const half = textWidth(t.label) / 2; t.anchor = t.x - half < plot.x - 8 ? "start" : t.x + half > plot.x + plot.w + 12 ? "end" : "middle"; });
|
||||
const sy = (v) => plot.y + plot.h - ((v - yScale.min) / (yScale.max - yScale.min || 1)) * plot.h;
|
||||
const fmt = ys.map((y) => (v) => formatKey(y, v, undefined));
|
||||
const dots = points.length <= 80 || kind === "scatter";
|
||||
const series = base.series.map((s, si) => {
|
||||
const pts = points.map((p, i) => (p.values[si] == null ? null : { i, x: sxv(p.xv), y: sy(p.values[si]) }));
|
||||
let path = "", pen = false;
|
||||
for (const pt of pts) { if (!pt) { pen = false; continue; } path += (pen ? "L" : "M") + pt.x.toFixed(1) + "," + pt.y.toFixed(1); pen = true; }
|
||||
return { ...s, path: kind === "line" ? path : "", dots: dots ? pts.filter(Boolean) : [] };
|
||||
});
|
||||
const cols = points.map((p) => ({ x: sxv(p.xv), title: (x.type === "text" || cats ? "" : x.name + " ") + p.label,
|
||||
rows: p.values.map((v, si) => ({ name: ys[si].name, color: base.series[si].color, value: v == null ? "—" : fmt[si](v) })),
|
||||
note: p.count > 1 ? `${p.count} rows` : "" }));
|
||||
return {
|
||||
...base, kind, height, plot, series, points: cols,
|
||||
yTicks: yScale.ticks.map((v, i) => ({ y: sy(v), label: yLabels[i] })),
|
||||
xTicks, xLabel: x.name, yLabel: ys.length === 1 ? measureName(ys[0]) : "",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
// Tables inside rendered Markdown and notebook outputs (pandas DataFrames) get
|
||||
// a light version of the table viewer: click a header to sort, an optional Σ
|
||||
// summary row, and "Open as table" for the full analysis view. Redaction slots
|
||||
// stay in place (rows are moved, never re-rendered); sorting and the exported
|
||||
// data use the anonymized text (XXXX-n).
|
||||
import { analyzeTable, sortIndices, summarize, AGGREGATES } from "./table-analysis.js";
|
||||
|
||||
// "Open as table" opens the full viewer; data-table.js registers it (kept out of
|
||||
// this module so the extraction can be tested without the compiled template).
|
||||
let openTable = null;
|
||||
export const setTableOpener = (fn) => { openTable = fn; };
|
||||
|
||||
const SKIP = ".dt, .csv-table, pre, .diff-file-table, .md-table-off";
|
||||
|
||||
// A cell's text with its redaction chips or slots read back as XXXX-n.
|
||||
export function cellText(cell) {
|
||||
const copy = cell.cloneNode(true);
|
||||
copy.querySelectorAll("mark.redact-chip[data-term]").forEach((m) => m.replaceWith(m.dataset.term));
|
||||
copy.querySelectorAll(".redact-slot").forEach((m) => m.replaceWith("XXXX-" + (m.textContent || "").trim()));
|
||||
copy.querySelectorAll(".md-sort").forEach((m) => m.remove());
|
||||
return copy.textContent.replace(/\s+/g, " ").trim();
|
||||
}
|
||||
|
||||
const spans = (row) => [...row.cells].some((c) => c.colSpan > 1 || c.rowSpan > 1);
|
||||
|
||||
// { header: [text], trs: [body <tr>], headerCells: [<th>] } or null for tables
|
||||
// this light mode can't handle (merged cells, fewer than two data rows).
|
||||
export function tableData(table) {
|
||||
if (!table?.rows?.length || table.closest(SKIP) || table.parentElement?.closest?.("table")) return null;
|
||||
let headRows = table.tHead ? [...table.tHead.rows] : [];
|
||||
let trs = [...table.tBodies].flatMap((b) => [...b.rows]);
|
||||
if (!headRows.length) {
|
||||
const first = table.rows[0];
|
||||
if (!first || ![...first.cells].every((c) => c.tagName === "TH")) return null;
|
||||
headRows = [first];
|
||||
trs = trs.filter((r) => r !== first);
|
||||
}
|
||||
if (trs.length < 2 || trs.some(spans)) return null;
|
||||
// pandas writes the column names and the index name on two header rows.
|
||||
if (headRows.some(spans) && headRows.length > 1) return null;
|
||||
const width = Math.max(...trs.map((r) => r.cells.length), ...headRows.map((r) => r.cells.length));
|
||||
if (headRows.some((r) => r.cells.length !== width && spans(r))) return null;
|
||||
const header = Array.from({ length: width }, (_, i) => headRows.map((r) => (r.cells[i] ? cellText(r.cells[i]) : "")).filter(Boolean).join(" ") || (i === 0 ? "" : "Column " + (i + 1)));
|
||||
const rows = [header, ...trs.map((r) => Array.from({ length: width }, (_, i) => (r.cells[i] ? cellText(r.cells[i]) : "")))];
|
||||
return { rows, trs, headerCells: [...headRows[headRows.length - 1].cells] };
|
||||
}
|
||||
|
||||
const SORT_ICON = '<svg class="dt-sort-icon" viewBox="0 0 10 14" aria-hidden="true"><path class="up" d="M5 1.5 8.5 5.5h-7z"/><path class="down" d="M5 12.5 1.5 8.5h7z"/></svg>';
|
||||
|
||||
function titleFor(table) {
|
||||
const root = table.closest(".markdown-body, notebook, markdown") || table.ownerDocument.body;
|
||||
let title = "";
|
||||
for (const h of root.querySelectorAll("h1, h2, h3, h4")) {
|
||||
if (h.compareDocumentPosition(table) & 4) title = h.textContent.replace(/\s+/g, " ").trim(); else break;
|
||||
}
|
||||
return title ? "Table · " + title : "Table";
|
||||
}
|
||||
|
||||
function enhance(table) {
|
||||
if (table.dataset.dtEnhanced) return;
|
||||
const data = tableData(table);
|
||||
if (!data) return;
|
||||
table.dataset.dtEnhanced = "1";
|
||||
const doc = table.ownerDocument;
|
||||
const model = analyzeTable(data.rows);
|
||||
const original = data.trs.slice();
|
||||
const parentOf = new Map(original.map((tr) => [tr, tr.parentNode]));
|
||||
let sort = null;
|
||||
|
||||
const wrap = doc.createElement("div");
|
||||
wrap.className = "md-table";
|
||||
table.parentNode.insertBefore(wrap, table);
|
||||
wrap.appendChild(table);
|
||||
|
||||
const apply = () => {
|
||||
const order = sort ? sortIndices(model, original.map((_, i) => i), sort.index, sort.dir) : original.map((_, i) => i);
|
||||
order.forEach((i) => parentOf.get(original[i]).appendChild(original[i]));
|
||||
data.headerCells.forEach((th, i) => {
|
||||
const dir = sort && sort.index === i ? sort.dir : null;
|
||||
th.setAttribute("aria-sort", dir === "asc" ? "ascending" : dir === "desc" ? "descending" : "none");
|
||||
th.querySelector(".dt-sort-icon")?.setAttribute("class", "dt-sort-icon" + (dir ? " is-" + dir : ""));
|
||||
});
|
||||
};
|
||||
data.headerCells.forEach((th, i) => {
|
||||
if (i >= model.columns.length) return;
|
||||
th.classList.add("md-sortable");
|
||||
const button = doc.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = "md-sort";
|
||||
button.setAttribute("aria-label", "Sort by " + (model.columns[i].name || "column " + (i + 1)));
|
||||
button.innerHTML = SORT_ICON;
|
||||
th.appendChild(button);
|
||||
th.addEventListener("click", (event) => {
|
||||
if (event.target.closest("a")) return;
|
||||
const dir = sort && sort.index === i ? sort.dir : null;
|
||||
sort = dir === "asc" ? { index: i, dir: "desc" } : dir === "desc" ? null : { index: i, dir: "asc" };
|
||||
apply();
|
||||
});
|
||||
});
|
||||
apply();
|
||||
|
||||
// Σ: a footer row with one aggregate for every numeric column (Average first).
|
||||
const numeric = model.columns.some((c) => c.type === "number");
|
||||
const tools = doc.createElement("div");
|
||||
tools.className = "md-table-tools";
|
||||
let foot = null, fn = "mean", select = null;
|
||||
const renderFoot = () => {
|
||||
if (!foot) return;
|
||||
const all = original.map((_, i) => i);
|
||||
const tr = foot.rows[0];
|
||||
tr.textContent = "";
|
||||
let labelled = false;
|
||||
model.columns.forEach((c, i) => {
|
||||
const td = doc.createElement("td");
|
||||
const align = data.headerCells[i]?.getAttribute("align") || data.headerCells[i]?.style.textAlign;
|
||||
if (align) td.style.textAlign = align;
|
||||
if (c.type === "number") {
|
||||
td.className = "is-num";
|
||||
td.textContent = summarize(c, all, fn).text;
|
||||
} else if (!labelled && i === 0) {
|
||||
td.className = "md-summary-label";
|
||||
td.textContent = AGGREGATES.find(([k]) => k === fn)[1];
|
||||
labelled = true;
|
||||
} else {
|
||||
td.className = "is-muted";
|
||||
td.textContent = summarize(c, all).text;
|
||||
}
|
||||
tr.appendChild(td);
|
||||
});
|
||||
};
|
||||
if (numeric) {
|
||||
const sigma = doc.createElement("button");
|
||||
sigma.type = "button";
|
||||
sigma.className = "md-table-btn md-sigma";
|
||||
sigma.setAttribute("aria-pressed", "false");
|
||||
sigma.title = "Show a summary row";
|
||||
sigma.innerHTML = '<span aria-hidden="true">Σ</span><span class="md-table-btn-text">Summary</span>';
|
||||
select = doc.createElement("select");
|
||||
select.className = "md-table-agg";
|
||||
select.setAttribute("aria-label", "Summary");
|
||||
select.hidden = true;
|
||||
AGGREGATES.forEach(([k, text]) => { const o = doc.createElement("option"); o.value = k; o.textContent = text; select.appendChild(o); });
|
||||
select.addEventListener("change", () => { fn = select.value; renderFoot(); });
|
||||
sigma.addEventListener("click", () => {
|
||||
const on = !foot;
|
||||
sigma.setAttribute("aria-pressed", on ? "true" : "false");
|
||||
sigma.classList.toggle("is-on", on);
|
||||
select.hidden = !on;
|
||||
if (on) {
|
||||
foot = doc.createElement("tfoot");
|
||||
foot.className = "md-summary";
|
||||
foot.appendChild(doc.createElement("tr"));
|
||||
table.appendChild(foot);
|
||||
renderFoot();
|
||||
} else { foot.remove(); foot = null; }
|
||||
});
|
||||
tools.append(sigma, select);
|
||||
}
|
||||
const open = doc.createElement("button");
|
||||
open.type = "button";
|
||||
open.className = "md-table-btn md-open";
|
||||
open.innerHTML = '<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chart"></use></svg><span>Open as table</span>';
|
||||
open.addEventListener("click", () => openTable?.(data.rows, titleFor(table)));
|
||||
tools.appendChild(open);
|
||||
wrap.appendChild(tools);
|
||||
}
|
||||
|
||||
export function enhanceTables(root) {
|
||||
if (!root?.querySelectorAll) return;
|
||||
root.querySelectorAll("table:not([data-dt-enhanced])").forEach((table) => {
|
||||
try { enhance(table); } catch { table.dataset.dtEnhanced = "error"; }
|
||||
});
|
||||
}
|
||||
|
||||
// v-data-tables on v-html Markdown: enhance after each render (idempotent).
|
||||
export const dataTablesDirective = {
|
||||
mounted(el) { enhanceTables(el); },
|
||||
updated(el) { enhanceTables(el); },
|
||||
};
|
||||
Vendored
+59
-55
@@ -1,57 +1,61 @@
|
||||
"use strict";(()=>{var kl=Object.defineProperty;var Cl=e=>{throw TypeError(e)};var If=(e,t,s)=>t in e?kl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Of=(e,t)=>{for(var s in t)kl(e,s,{get:t[s],enumerable:!0})};var nt=(e,t,s)=>If(e,typeof t!="symbol"?t+"":t,s),Mr=(e,t,s)=>t.has(e)||Cl("Cannot "+s);var ae=(e,t,s)=>(Mr(e,t,"read from private field"),s?s.call(e):t.get(e)),_e=(e,t,s)=>t.has(e)?Cl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ze=(e,t,s,i)=>(Mr(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),$e=(e,t,s)=>(Mr(e,t,"access private method"),s);var Sl=(e,t,s,i)=>({set _(o){ze(e,t,o,s)},get _(){return ae(e,t,i)}});var he=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ge={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",editor:"/script/editor.4f142d3adc.min.js"};function El(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let s=new URLSearchParams(t);if([...s.keys()].length!==3||[...s.keys()].some(d=>!["clientId","intentId","token"].includes(d)))return null;let i=s.get("clientId"),o=s.get("intentId"),r=s.get("token");return!/^[a-f0-9]{32}$/.test(i||"")||!/^[a-f0-9]{32}$/.test(o||"")||!/^[a-f0-9]{64}$/.test(r||"")?null:{contract:"4open.artifacts/1",clientId:i,intentId:o,token:r}}function Nl(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),d=r?{clientId:r.clientId,intentId:r.intentId}:null,p,c,v,h,y,g=!0,k,w=i.defer(),C=()=>[...o.crypto.getRandomValues(new Uint8Array(16))].map(_=>_.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:r?"":"Open a new artifact link from your submission. This link is missing or invalid."});let N=()=>g&&e.user?.username===y;function b(){g=!1,r=p=c=void 0,w.resolve(),o.clearTimeout(k)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,_=>{!y&&_?y=_:y&&_!==y&&(b(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let P=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),M=_=>_?.status===404?"Artifact linking is not available on this server.":_?.status===401?"Sign in, then open a new artifact link from your submission.":_?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!g||!r||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let _=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(_)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,p=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,o.clearTimeout(k),h||(h=C());try{let j=(await s.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(c=j.csrf,e.handoffEnabled=j.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(c||""))throw new Error("invalid_csrf");let ne=(await s.post("/api/review-consent/preview",{repositoryId:_,intent:{...r,requestId:h}},P())).data;if(!N())return;if(!ne||typeof ne.ticket!="string"||!ne.ticket||ne.ticket.length>8192||typeof ne.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
|
||||
`))),e[yn]=Bo(o);let r=i||o.props&&o.props.type==="number";$n(e,t?"change":"input",d=>{d.target.composing||e[yn](ba(e.value,s,r))}),(s||r)&&$n(e,"change",()=>{e.value=ba(e.value,s,r)}),t||($n(e,"compositionstart",qh),$n(e,"compositionend",cu),$n(e,"change",cu))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[Hi];delete e[Hi],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[yn](ba(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},d){if(e[yn]=Bo(d),e.composing)return;let p=(r||e.type==="number")&&!/^0\d/.test(e.value)?Vo(e.value):e.value,c=t??"";if(p===c)return;let v=e.getRootNode();(v instanceof Document||v instanceof ShadowRoot)&&v.activeElement===e&&e.type!=="range"&&(i&&t===s||o&&e.value.trim()===c)||(e.value=c)}},ka={deep:!0,created(e,t,s){e[yn]=Bo(s),$n(e,"change",()=>{let i=e._modelValue,o=$s(e),r=e.checked,d=e[yn];if(Te(i)){let p=vi(i,o),c=p!==-1;if(r&&!c)d(i.concat(o));else if(!r&&c){let v=[...i];v.splice(p,1),d(v)}}else if(Xt(i)){let p=new Set(i);r?p.add(o):p.delete(o),d(p)}else d(vu(e,r))})},mounted:pu,beforeUpdate(e,t,s){e[yn]=Bo(s),pu(e,t,s)}};function pu(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Te(t))o=vi(t,i.props.value)>-1;else if(Xt(t))o=t.has(i.props.value);else{if(t===s)return;o=Qt(t,vu(e,!0))}e.checked!==o&&(e.checked=o)}var Nt={deep:!0,created(e,{value:t,modifiers:{number:s}},i){e._modelValue=t,$n(e,"change",()=>{let o=Array.prototype.filter.call(e.options,c=>c.selected).map(c=>s?Vo($s(c)):$s(c)),r=e.multiple,d=r?Xt(e._modelValue)?new Set(o):o:o[0],p=e._pendingValue=[r,r?Te(d)?o.slice():o:d];try{e[yn](d)}finally{je(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[yn]=Bo(i)},mounted(e,{value:t}){fu(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[yn]=Bo(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!Lh(t,s[1],s[0]))&&fu(e,t)}};function Lh(e,t,s){if(!s)return Qt(e,t);if(Te(e))return Qt(e,t);if(Xt(e)){if(e.size!==t.length)return!1;for(let i of t)if(!e.has(i))return!1;return!0}return!1}function fu(e,t){let s=e.multiple,i=Te(t);if(!(s&&!i&&!Xt(t))){for(let o=0,r=e.options.length;o<r;o++){let d=e.options[o],p=$s(d);if(s)if(i){let c=typeof p;c==="string"||c==="number"?d.selected=t.some(v=>String(v)===String(p)):d.selected=vi(t,p)>-1}else d.selected=t.has(p);else if(Qt($s(d),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function $s(e){return"_value"in e?e._value:e.value}function vu(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var Fh=["ctrl","shift","alt","meta"],_h={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Fh.some(s=>e[`${s}Key`]&&!t.includes(s))},re=(e,t)=>{if(!e)return e;let s=e._withMods||(e._withMods={}),i=t.join(".");return s[i]||(s[i]=((o,...r)=>{for(let d=0;d<t.length;d++){let p=_h[t[d]];if(p&&p(o,t))return}return e(o,...r)}))},$h={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},_t=(e,t)=>{let s=e._withKeys||(e._withKeys={}),i=t.join(".");return s[i]||(s[i]=(o=>{if(!("key"in o))return;let r=ln(o.key);if(t.some(d=>d===r||$h[d]===r))return e(o)}))},Uh=pt({patchProp:Oh},gh),mu;function Bh(){return mu||(mu=Kd(Uh))}var yu=((...e)=>{let t=Bh().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=Hh(i);if(!o)return;let r=t._component;!Oe(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let d=s(o,!1,zh(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),d},t});function zh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Hh(e){return lt(e)?document.querySelector(e):e}var co=typeof document<"u";function wu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function jh(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&wu(e.default)}var xe=Object.assign;function Gi(e,t){let s={};for(let i in t){let o=t[i];s[i]=Yt(o)?o.map(e):e(o)}return s}var Ho=()=>{},Yt=Array.isArray;function Ea(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var ku=/#/g,Gh=/&/g,Wh=/\//g,Kh=/=/g,Yh=/\?/g,Cu=/\+/g,Jh=/%5B/g,Xh=/%5D/g,Su=/%5E/g,Qh=/%60/g,Eu=/%7B/g,Zh=/%7C/g,Nu=/%7D/g,xh=/%20/g;function Na(e){return e==null?"":encodeURI(""+e).replace(Zh,"|").replace(Jh,"[").replace(Xh,"]")}function Ru(e){return Na(e).replace(Eu,"{").replace(Nu,"}").replace(Su,"^")}function Ca(e){return Na(e).replace(Cu,"%2B").replace(xh,"+").replace(ku,"%23").replace(Gh,"%26").replace(Qh,"`").replace(Eu,"{").replace(Nu,"}").replace(Su,"^")}function eg(e){return Ca(e).replace(Kh,"%3D")}function tg(e){return NLine truncated
|
||||
"use strict";(()=>{var Zl=Object.defineProperty;var xl=e=>{throw TypeError(e)};var Im=(e,t,s)=>t in e?Zl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Om=(e,t)=>{for(var s in t)Zl(e,s,{get:t[s],enumerable:!0})};var lt=(e,t,s)=>Im(e,typeof t!="symbol"?t+"":t,s),Qr=(e,t,s)=>t.has(e)||xl("Cannot "+s);var ce=(e,t,s)=>(Qr(e,t,"read from private field"),s?s.call(e):t.get(e)),ze=(e,t,s)=>t.has(e)?xl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Ge=(e,t,s,i)=>(Qr(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),He=(e,t,s)=>(Qr(e,t,"access private method"),s);var ed=(e,t,s,i)=>({set _(o){Ge(e,t,o,s)},get _(){return ce(e,t,i)}});var we=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ke={markdown:"/script/markdown.6c8dfb7b1d.min.js",org:"/script/org.f61f262915.min.js",notebook:"/script/notebook.c3144c18ae.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",editor:"/script/editor.4f142d3adc.min.js"};function td(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let s=new URLSearchParams(t);if([...s.keys()].length!==3||[...s.keys()].some(u=>!["clientId","intentId","token"].includes(u)))return null;let i=s.get("clientId"),o=s.get("intentId"),r=s.get("token");return!/^[a-f0-9]{32}$/.test(i||"")||!/^[a-f0-9]{32}$/.test(o||"")||!/^[a-f0-9]{64}$/.test(r||"")?null:{contract:"4open.artifacts/1",clientId:i,intentId:o,token:r}}function nd(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=r?{clientId:r.clientId,intentId:r.intentId}:null,p,d,h,m,y,v=!0,k,b=i.defer(),C=()=>[...o.crypto.getRandomValues(new Uint8Array(16))].map(F=>F.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:r?"":"Open a new artifact link from your submission. This link is missing or invalid."});let N=()=>v&&e.user?.username===y;function w(){v=!1,r=p=d=void 0,b.resolve(),o.clearTimeout(k)}e.on("dispose",w),e.on("routeLeave",w),e.watch(()=>e.user?.username,F=>{!y&&F?y=F:y&&F!==y&&(w(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let P=()=>({timeout:b.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":d}}),O=F=>F?.status===404?"Artifact linking is not available on this server.":F?.status===401?"Sign in, then open a new artifact link from your submission.":F?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!v||!r||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let F=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(F)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,p=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,o.clearTimeout(k),m||(m=C());try{let H=(await s.get("/api/review-consent/csrf",{timeout:b.promise})).data;if(!N())return;if(d=H.csrf,e.handoffEnabled=H.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(d||""))throw new Error("invalid_csrf");let Y=(await s.post("/api/review-consent/preview",{repositoryId:F,intent:{...r,requestId:m}},P())).data;if(!N())return;if(!Y||typeof Y.ticket!="string"||!Y.ticket||Y.ticket.length>8192||typeof Y.repositoryName!="string"||!["restricted-review","anonymous-link"].iLine truncated
|
||||
`))),e[Cn]=js(o);let r=i||o.props&&o.props.type==="number";Hn(e,t?"change":"input",u=>{u.target.composing||e[Cn]($a(e.value,s,r))}),(s||r)&&Hn(e,"change",()=>{e.value=$a(e.value,s,r)}),t||(Hn(e,"compositionstart",Lg),Hn(e,"compositionend",zu),Hn(e,"change",zu))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[er];delete e[er],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[Cn]($a(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},u){if(e[Cn]=js(u),e.composing)return;let p=(r||e.type==="number")&&!/^0\d/.test(e.value)?$s(e.value):e.value,d=t??"";if(p===d)return;let h=e.getRootNode();(h instanceof Document||h instanceof ShadowRoot)&&h.activeElement===e&&e.type!=="range"&&(i&&t===s||o&&e.value.trim()===d)||(e.value=d)}},Ua={deep:!0,created(e,t,s){e[Cn]=js(s),Hn(e,"change",()=>{let i=e._modelValue,o=Wo(e),r=e.checked,u=e[Cn];if(Ve(i)){let p=Pi(i,o),d=p!==-1;if(r&&!d)u(i.concat(o));else if(!r&&d){let h=[...i];h.splice(p,1),u(h)}}else if(nn(i)){let p=new Set(i);r?p.add(o):p.delete(o),u(p)}else u(Yu(e,r))})},mounted:Hu,beforeUpdate(e,t,s){e[Cn]=js(s),Hu(e,t,s)}};function Hu(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Ve(t))o=Pi(t,i.props.value)>-1;else if(nn(t))o=t.has(i.props.value);else{if(t===s)return;o=sn(t,Yu(e,!0))}e.checked!==o&&(e.checked=o)}var At={deep:!0,created(e,{value:t,modifiers:{number:s}},i){e._modelValue=t,Hn(e,"change",()=>{let o=Array.prototype.filter.call(e.options,d=>d.selected).map(d=>s?$s(Wo(d)):Wo(d)),r=e.multiple,u=r?nn(e._modelValue)?new Set(o):o:o[0],p=e._pendingValue=[r,r?Ve(u)?o.slice():o:u];try{e[Cn](u)}finally{We(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[Cn]=js(i)},mounted(e,{value:t}){ju(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[Cn]=js(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!qg(t,s[1],s[0]))&&ju(e,t)}};function qg(e,t,s){if(!s)return sn(e,t);if(Ve(e))return sn(e,t);if(nn(e)){if(e.size!==t.length)return!1;for(let i of t)if(!e.has(i))return!1;return!0}return!1}function ju(e,t){let s=e.multiple,i=Ve(t);if(!(s&&!i&&!nn(t))){for(let o=0,r=e.options.length;o<r;o++){let u=e.options[o],p=Wo(u);if(s)if(i){let d=typeof p;d==="string"||d==="number"?u.selected=t.some(h=>String(h)===String(p)):u.selected=Pi(t,p)>-1}else u.selected=t.has(p);else if(sn(Wo(u),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Wo(e){return"_value"in e?e._value:e.value}function Yu(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var $g=["ctrl","shift","alt","meta"],Fg={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>$g.some(s=>e[`${s}Key`]&&!t.includes(s))},de=(e,t)=>{if(!e)return e;let s=e._withMods||(e._withMods={}),i=t.join(".");return s[i]||(s[i]=((o,...r)=>{for(let u=0;u<t.length;u++){let p=Fg[t[u]];if(p&&p(o,t))return}return e(o,...r)}))},Ug={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Nt=(e,t)=>{let s=e._withKeys||(e._withKeys={}),i=t.join(".");return s[i]||(s[i]=(o=>{if(!("key"in o))return;let r=fn(o.key);if(t.some(u=>u===r||Ug[u]===r))return e(o)}))},_g=ht({patchProp:Og},gg),Gu;function Bg(){return Gu||(Gu=Eu(_g))}var nr=((...e)=>{let t=Bg().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=Hg(i);if(!o)return;let r=t._component;!Fe(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let u=s(o,!1,zg(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),u},t});function zg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Hg(e){return ft(e)?document.querySelector(e):e}var ms=typeof document<"u";function Ju(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function jg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Ju(e.default)}var it=Object.assign;function sr(e,t){let s={};for(let i in t){let o=t[i];s[i]=xt(o)?o.map(e):e(o)}return s}var Ws=()=>{},xt=Array.isArray;function za(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var Qu=/#/g,Gg=/&/g,Wg=/\//g,Kg=/=/g,Yg=/\?/g,Zu=/\+/g,Xg=/%5B/g,Jg=/%5D/g,xu=/%5E/g,Qg=/%60/g,ec=/%7B/g,Zg=/%7C/g,tc=/%7D/g,xg=/%20/g;function Ha(e){return e==null?"":encodeURI(""+e).replace(Zg,"|").replace(Xg,"[").replace(Jg,"]")}function nc(e){return Ha(e).replace(ec,"{").replace(tc,"}").replace(xu,"^")}function _a(e){return Ha(e).replace(Zu,"%2B").replace(xg,"+").replace(Qu,"%23").replace(Gg,"%26").replace(Qg,"`").replace(ec,"{").replace(tc,"}").replace(xu,"^")}function ev(e){return _a(e).replace(Kg,"%3D")}function tv(e){return HLine truncated
|
||||
${JSON.stringify(e)}${t?`
|
||||
while being at
|
||||
`+JSON.stringify(t):""}`},[ct.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${ug(t)}" via a navigation guard.`},[ct.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[ct.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[ct.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function uo(e,t){return xe(new Error,{type:e,[qu]:!0},t)}function bn(e,t){return e instanceof Error&&qu in e&&(t==null||!!(e.type&t))}var dg=["params","query","hash"];function ug(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of dg)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Lu(e){let t={};if(e===""||e==="?")return t;let s=(e[0]==="?"?e.slice(1):e).split("&");for(let i=0;i<s.length;++i){let o=s[i].replace(Cu," "),r=o.indexOf("="),d=zo(r<0?o:o.slice(0,r)),p=r<0?null:zo(o.slice(r+1));if(d in t){let c=t[d];Yt(c)||(c=t[d]=[c]),c.push(p)}else t[d]=p}return t}function Aa(e){let t="";for(let s in e){let i=e[s];if(s=eg(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(Yt(i)?i.map(o=>o&&Ca(o)):[i&&Ca(i)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+s,o!=null&&(t+="="+o))})}return t}function Fu(e){let t={};for(let s in e){let i=e[s];i!==void 0&&(t[s]=Yt(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}var _u=Symbol(""),Ia=Symbol(""),Ji=Symbol(""),Xi=Symbol(""),Qi=Symbol("");function jo(){let e=[];function t(i){return e.push(i),()=>{let o=e.indexOf(i);o>-1&&e.splice(o,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function Dn(e,t,s,i,o,r=d=>d()){let d=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((p,c)=>{let v=g=>{g===!1?c(uo(ct.NAVIGATION_ABORTED,{from:s,to:t})):g instanceof Error?c(g):lg(g)?c(uo(ct.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(d&&i.enterCallbacks[o]===d&&typeof g=="function"&&d.push(g),p())},h=r(()=>e.call(i&&i.instances[o],t,s,v)),y=Promise.resolve(h);e.length<3&&(y=y.then(v)),y.catch(g=>c(g))})}function Zi(e,t,s,i,o=r=>r()){let r=[];for(let d of e)for(let p in d.components){let c=d.components[p];if(!(t!=="beforeRouteEnter"&&!d.instances[p]))if(wu(c)){let v=(c.__vccOpts||c)[t];v&&r.push(Dn(v,s,i,d,p,o))}else{let v=c();r.push(()=>v.then(h=>{if(!h)throw new Error(`Couldn't resolve component "${p}" at "${d.path}"`);let y=jh(h)?h.default:h;d.mods[p]=h,d.components[p]=y;let g=(y.__vccOpts||y)[t];return g&&Dn(g,s,i,d,p,o)()}))}}return r}function $u(e,t){let s=[],i=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let d=0;d<r;d++){let p=t.matched[d];p&&(e.matched.find(v=>lo(v,p))?i.push(p):s.push(p));let c=e.matched[d];c&&(t.matched.find(v=>lo(v,c))||o.push(c))}return[s,i,o]}var cg=()=>location.protocol+"//"+location.host;function Xu(e,t){let{pathname:s,search:i,hash:o}=t,r=e.indexOf("#");if(r>-1){let d=o.includes(e.slice(r))?e.slice(r).length:1,p=o.slice(d);return p[0]!=="/"&&(p="/"+p),Ra(p,"")}return Ra(s,e)+i+o}function pg(e,t,s,i){let o=[],r=[],d=null,p=({state:g})=>{let k=Xu(e,location),w=s.value,C=t.value,N=0;if(g){if(s.value=k,t.value=g,d&&d===w){d=null;return}N=C?g.position-C.position:0}else i(k);o.forEach(b=>{b(s.value,w,{delta:N,type:Ki.pop,direction:N?N>0?Yi.forward:Yi.back:Yi.unknown})})};function c(){d=s.value}function v(g){o.push(g);let k=()=>{let w=o.indexOf(g);w>-1&&o.splice(w,1)};return r.push(k),k}function h(){if(document.visibilityState==="hidden"){let{history:g}=window;if(!g.state)return;g.replaceState(xe({},g.state,{scroll:Us()}),"")}}function y(){for(let g of r)g();r=[],window.removeEventListener("popstate",p),window.removeEventListener("pagehide",h),document.removeEventListener("visibilitychange",h)}return window.addEventListener("popstate",p),window.addEventListener("pagehide",h),document.addEventListener("visibilitychange",h),{pauseListeners:c,listen:v,destroy:y}}function Uu(e,t,s,i=!1,o=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:o?Us():null}}function fg(e){let{history:t,location:s}=window,i={value:Xu(e,s)},o={value:t.state};o.value||r(i.value,{back:null,current:i.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(c,v,h){let y=e.indexOf("#"),g=y>-1?(s.host&&document.querySelector("base")?e:e.slice(y))+c:cg()+e+c;try{t[h?"replaceState":"pushState"](v,"",g),o.value=v}catch(k){console.error(k),s[h?"replace":"assign"](g)}}function d(c,v){r(c,xe({},t.state,Uu(o.value.back,c,o.value.forward,!0),v,{position:o.value.position}),!0),i.value=c}function p(c,v){let h=xe({},o.value,t.state,{forward:c,scroll:Us()});r(h.current,h,!0),r(c,xe({},Uu(i.value,c,null),{position:h.position+1},v),!1),i.value=c}return{location:i,state:o,push:p,replace:d}}function Qu(e){e=Au(e);let t=fg(e),s=pg(e,t.state,t.location,t.replace);function i(r,d=!0){d||s.pauseListeners(),history.go(r)}let o=xe({locatLine truncated
|
||||
`);for(let c of p){if(c.startsWith("diff --git")){r(),d();continue}if(c.startsWith("--- ")){s&&s.lines.length&&r(),d().oldPath=c.replace(/^--- (a\/)?/,"").trim();continue}if(c.startsWith("+++ ")){d().newPath=c.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!/^(index |similarity index|rename |new file mode|deleted file mode|Binary files)/.test(c)){if(c.startsWith("@@")){let v=c.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);v&&(i=parseInt(v[1],10),o=parseInt(v[2],10)),d().lines.push({kind:"hunk",oldNo:"",newNo:"",text:c});continue}if(s)if(c.startsWith("+"))s.lines.push({kind:"add",oldNo:"",newNo:o++,text:c.slice(1)});else if(c.startsWith("-"))s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:c.slice(1)});else{if(c.startsWith("\\"))continue;s.lines.push({kind:"ctx",oldNo:i++,newNo:o++,text:c.startsWith(" ")?c.slice(1):c})}}}return r(),t}var Bs=(e,t)=>{let s=[],i=[],o="",r=!1;for(let d=0;d<e.length;d++){let p=e[d];r?p==='"'?e[d+1]==='"'?(o+='"',d++):r=!1:o+=p:p==='"'&&o===""?r=!0:p===t?(i.push(o),o=""):p===`
|
||||
`||p==="\r"?(p==="\r"&&e[d+1]===`
|
||||
`&&d++,i.push(o),s.push(i),i=[],o=""):o+=p}return(o!==""||i.length)&&(i.push(o),s.push(i)),s.filter(d=>d.length>1||d[0]!=="")},lr=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),$g=(function(){let e=s=>s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),t=s=>{let i=['<div class="diff-file-block">','<div class="diff-file-header"><span class="diff-file-icon"><i class="far fa-file-code"></i></span><span class="diff-file-name">'+e(s.path)+'</span><span class="diff-file-status diff-file-status-'+s.status+'">'+s.status+"</span></div>"];if(s.lines.length){i.push('<table class="diff-file-table"><tbody>');for(let o of s.lines)i.push('<tr class="diff-row diff-row-'+o.kind+'"><td class="diff-gutter diff-gutter-old">'+(o.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(o.newNo||"")+'</td><td class="diff-sign">'+(o.kind==="add"?"+":o.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+lr(o.text)+'ch">'+e(o.text)+"</td></tr>");i.push("</tbody></table>")}return i.push("</div>"),i.join("")};return s=>s&&ar(s).map(t).join("")})();function Va(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Ug(e,t="EUR"){let s=Number(e)||0;return new Intl.NumberFormat(void 0,{style:"currency",currency:t,minimumFractionDigits:s%1?2:0,maximumFractionDigits:2}).format(s)}function Bg(e){return String(e??"").toUpperCase()}function zg(e,t,s=0){return(e||[]).slice(s,s+t)}function Hg(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function jg(e,t){if(!t)return e||[];let s=Array.isArray(t)?t:[t];return[...e||[]].sort((i,o)=>{for(let r of s){let d=r[0]==="-"?-1:1;r=r.replace(/^[+-]/,"");let p=r.split(".").reduce((v,h)=>v?.[h],i),c=r.split(".").reduce((v,h)=>v?.[h],o);if(typeof p=="string"&&(p=p.toLowerCase()),typeof c=="string"&&(c=c.toLowerCase()),p!==c)return(p==null?-1:c==null?1:p<c?-1:1)*d}return 0})}function dr(e,t){if(!e)return"";let s=new Date(e);if(isNaN(s))return String(e);if(!t||t==="mediumDate")return s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let i={yyyy:s.getFullYear(),MMM:s.toLocaleDateString(void 0,{month:"short"}),MM:String(s.getMonth()+1).padStart(2,"0"),dd:String(s.getDate()).padStart(2,"0"),d:s.getDate(),HH:String(s.getHours()).padStart(2,"0"),mm:String(s.getMinutes()).padStart(2,"0"),ss:String(s.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,o=>i[o])}function Gg(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function qa(e){if(!e)return"";let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e)),s=t?new Date(+t[1],+t[2]-1,+t[3]):new Date(e);if(isNaN(s))return"";let i=s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),o=new Date;o.setHours(0,0,0,0);let r=Math.round((s-o)/864e5),d;if(r===0)d="today";else if(r===1)d="tomorrow";else if(r===-1)d="yesterday";else{let p=Math.abs(r),c=Math.round(p/30.44),v=p<14?[p,"day"]:p<60?[Math.round(p/7),"week"]:c<18?[c,"month"]:[Math.round(p/365.25),"year"],h=v[0]+" "+v[1]+(v[0]===1?"":"s");d=r>0?"in "+h:h+" ago"}return i+" \xB7 "+d}function Un(e){if(e==null||e===""||isNaN(e))return"";e=Number(e);let t="\u202F";if(e<1e3)return+(e<10?e.toFixed(2):e<100?e.toFixed(1):Math.round(e))+t+"ms";let s=e/1e3;if(s<60)return+(s<10?s.toFixed(2):s.toFixed(1))+t+"s";let i=r=>String(r).padStart(2,"0"),o=Math.round(s);return o<3600?Math.floor(o/60)+"m "+i(o%60)+"s":Math.floor(o/3600)+"h "+i(Math.floor(o%3600/60))+"m"}function La(e){if(!e)return"";let t=new Date(e);if(isNaN(t))return"";let s={day:"numeric",month:"short"};return t.getFullYear()!==new Date().getFullYear()&&(s.year="numeric"),t.toLocaleDateString(void 0,s)}function nc(e,t){return t?.split(".").reduce((s,i)=>s?.[i],e)}function zs(e=null,t=new Map){let s=at({}),i=[],o=!1,r=new Proxy(s,{get(d,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(d,p)?Reflect.get(d,p):e?.[p]}});return Object.defineProperty(s,"parent",{value:e,configurable:!0}),Object.defineProperty(s,"viewState",{get:()=>r}),r.watch=(d,p,c=!1,v=!0)=>{let h=typeof d=="function"?()=>d(r):()=>nc(r,d),y=ut(h,p,{deep:c,flush:"post"});return i.push(y),v&&je(()=>{o||p(h(),h())}),y},r.watchGroup=(d,p,c=!0)=>r.watch(()=>d.map(v=>nc(r,v)),p,!0,c),r.on=(d,p)=>{if(d==="dispose")return i.push(p),()=>{};t.has(d)||t.set(d,new Set),t.get(d).add(p);let c=()=>t.get(d)?.delete(p);return i.push(c),c},r.emit=(d,...p)=>{for(let c of[...t.get(d)||[]])c({},...p)},r.dispose=()=>{o=!0,i.splice(0).reverse().forEach(d=>d())},En(r.dispose),r}function bt(){let e=new Set,t=new Set,s=!1,i=(r,d=0)=>{if(s)return;let p=setTimeout(()=>{e.delete(p),r()},d);return e.add(p),p};i.cancel=r=>{clearTimeout(r),e.delete(r)};let o=(r,d)=>{if(s)return;let p=setInterval(r,d);return t.add(p),p};return o.cancel=r=>{clearInterval(r),t.delete(r)},En(()=>{s=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:i,interval:o}}function Ot(){let e=new Set;return E
Line truncated
|
||||
`).forEach((L,E)=>{for(let[F,Y]of k){let G=F.exec(L);if(G&&!/^(if|for|while|switch|return|catch)$/.test(G[1])){O.push({name:G[1],kind:Y,line:E+1});break}}}),w={content:e.content,list:O.slice(0,300)},w.list},e.goToSymbol=function(O){e.symbolsOpen=!1;let L=e.codeEditor;L&&(L.scrollToLine(O-1,!0,!0,()=>{}),L.gotoLine(O,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+O),window.dispatchEvent(new HashChangeEvent("hashchange")))},e.gotoLine=function(){e.codeEditor&&(e.moreOpen=!1,e.gotoError="",e.gotoValue=String(e.codeEditor.getCursorPosition().row+1),e.gotoOpen=!0,setTimeout(()=>{let O=window.document.getElementById("goto-input");O&&(O.focus(),O.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let O=e.codeEditor;if(!O)return;let L=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),E=O.session.getLength();if(!L||+L[1]<1||+L[1]>E){e.gotoError="Enter a line from 1 to "+E;return}O.gotoLine(+L[1],L[2]?Math.max(0,+L[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",O.focus()},e.rootEntries=function(){return[...e.files||[]].sort((O,L)=>{let E=O.size==null,F=L.size==null;return E!==F?E?-1:1:O.name.localeCompare(L.name)})},e.formatSize=function(O){if(O==null)return"";if(O<1024)return O+" B";let L=O/1024,E=F=>F.toFixed(1).replace(/\.0$/,"");return L<1024?E(L)+" KB":L<1024*1024?E(L/1024)+" MB":E(L/1024/1024)+" GB"},e.fileSize=function(O){if(!O)return null;let L=O.replace(/^\/+/,""),E=(e.files||[]).find(F=>(F.path?F.path+"/":"")+F.name===L);return E&&E.size!=null?E.size:null},e.revealFolder=function(O){e.sidebarHidden=!1,e.sidebarCollapsed=!1,je(()=>{let L=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(O):O)+'"]');L&&(L.closest("li")?.classList.contains("open")||L.click(),L.scrollIntoView({block:"nearest"}),L.focus())})};let C={content:null,n:0},N=O=>{if(C.content===O)return C.n;let L=O;if(typeof L=="string")try{L=JSON.parse(L)}catch{L=null}let E=[],F=G=>{Array.isArray(G)?E.push(G.join("")):typeof G=="string"&&E.push(G)};(L&&(L.cells||(L.worksheets||[]).flatMap(G=>G.cells||[]))||[]).forEach(G=>{F(G?.source??G?.input),(G?.outputs||[]).forEach(Z=>{F(Z?.text),Z?.data&&(F(Z.data["text/plain"]),F(Z.data["text/markdown"]),F(Z.data["text/html"])),F(Z?.traceback)})});let Y=E.reduce((G,Z)=>G+(Z.match(s)||[]).length,0);return C={content:O,n:Y},Y};e.redactionCount=function(){return e.type==="IPython"?N(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(s)||[]).length},e.renderRedacted=Go;let b=O=>O.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(O){let L=e.renderRedacted(O);if(!L||typeof window.DOMParser!="function")return L;let E=new window.DOMParser().parseFromString("<div>"+L+"</div>","text/html"),F={};return E.querySelectorAll("h1, h2, h3").forEach(Y=>{let G=Y.id||b(Y.textContent);F[G]?G+="-"+ ++F[G]:F[G]=1,Y.id=G}),E.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},M=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let O=or(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),L=O.length,E=null;if(O[0]?.level===1&&O.filter(F=>F.level===1).length===1){E=O[0],O=O.slice(1);let F=Math.min(...O.map(Y=>Y.level));O=O.map(Y=>({...Y,depth:Y.level-F}))}return P={content:e.content,list:O,title:E,count:L},P};e.readmeToc=()=>M().list,e.tocTitle=()=>M().title,e.tocCount=()=>M().count,e.activeHeading=null,o(window,"scroll",()=>{let O=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let L=sr(O.map(E=>E.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==L&&(e.activeHeading=L)},{capture:!0,passive:!0}),e.scrollToHeading=function(O){if(!O){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}ir(O),e.activeHeading=O},e.csvView="table";let _={content:null,rows:[]};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(_.content!==e.content){let O=/\.tsv$/i.test(e.filePath||"")?" ":",";_={content:e.content,rows:Bs(e.content,O)}}return _.rows},e.csvNumCol=O=>{let L=e.csvRows().slice(1).map(E=>E[O]).filter(E=>E!=null&&String(E).trim()!=="");return L.length>0&&L.every(E=>e.csvNumeric(E))},e.csvNumeric=O=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(O)&&/\d/.test(O),e.redactParts=In,e.pathCopied=!1,e.copyPath=async function(){window.navigator.clipboard?.writeText&&(await window.navigator.clipboard.writeText(e.filePath||""),e.pathCopied=!0,setTimeout(()=>{e.pathCopied=!1},1600))},e.contentCopied=!1,e.copyContent=async function(){if(typeof e.content!="string"||!window.navigator.clipboard?.writeText)return;let O=e.content;if(e.type==
Line truncated
|
||||
`).length:0,Kg=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function sc(e,t){let s=Ot();e.redactParts=In,e.hangIndent=lr,e.isRedactedName=o=>/^XXXX-\d+$/.test(String(o||"").trim()),e.tocOpen=!1,e.activeAnchor="";let i=()=>{let o=t();if(!o.length)return;let r=sr(o,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==r&&(e.activeAnchor=r)};return s(window,"scroll",i,{capture:!0,passive:!0}),s(window,"resize",i,{passive:!0}),s(window.document,"click",o=>{e.tocOpen&&!o.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),s(window.document,"keydown",o=>{o.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=o=>{e.tocOpen=!1,ir(o)&&(e.activeAnchor=o)},i}var ur=e=>(String(e||"").split(".").pop()||"").toLowerCase(),Yg={md:"markdown",markdown:"markdown",mdx:"markdown",ipynb:"notebook",csv:"csv",tsv:"csv",svg:"svg",png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",bmp:"image",ico:"image",avif:"image",pdf:"pdf",mp4:"video",webm:"video",mov:"video",m4v:"video",ogv:"video",mp3:"audio",wav:"audio",ogg:"audio",oga:"audio",m4a:"audio",flac:"audio",aac:"audio"},Jg={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",pdf:"application/pdf",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/mp4",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",m4a:"audio/mp4",flac:"audio/flac",aac:"audio/aac"},Xg=1024*1024;function Wo(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=Yg[ur(e?.filename)]||(e?.language==="Markdown"?"markdown":null);return e?.encoding==="base64"?["image","pdf","video","audio"].includes(t)&&e.content?t:"binary":e?.content?t==="csv"&&e.content.length>Xg?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var Qg=e=>["markdown","notebook","csv","svg"].includes(e),oc={markdown:"Markdown",notebook:"Jupyter notebook",csv:"Table",svg:"SVG",image:"Image",pdf:"PDF",video:"Video",audio:"Audio",binary:"Binary","too-large":"Too large",hidden:"Image"};function Zg(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||ur(e?.filename)||"none"}var xg=e=>{let t=window.atob(e||""),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s};function ic(e){e.gistViews={},e.gistKind=r=>Wo(e.details?.files?.[r]),e.gistHasRendered=r=>Qg(e.gistKind(r)),e.gistView=r=>e.gistHasRendered(r)&&e.gistViews[r]!=="raw"?"rendered":"raw",e.setGistView=(r,d)=>{e.gistViews={...e.gistViews,[r]:d}},e.gistSourceFile=r=>{let d=e.details?.files?.[r];return{...d,language:Zg(d,e.gistKind(r)),filename:"source.txt"}};let t=new Map;En(()=>{t.forEach(r=>window.URL.revokeObjectURL?.(r)),t.clear()});let s=(r,d)=>{if(!r||!window.URL?.createObjectURL)return null;let p=r.encoding==="base64",c=!d||p?Jg[ur(r.filename)]||(p?"application/octet-stream":"text/plain"):"text/plain",v=(r.filename||"")+"\0"+c+"\0"+(r.content||"").length;if(!t.has(v)){let h=p?xg(r.content):r.content||"";t.set(v,window.URL.createObjectURL(new window.Blob([h],{type:c+(p?"":";charset=utf-8")})))}return t.get(v)};e.gistMediaUrl=r=>s(r,!1),e.gistRawUrl=r=>s(r,!0);let i={content:null,rows:[]};e.gistCsvRows=r=>(i.content!==r?.content&&(i={content:r?.content,rows:Bs(r?.content||"",ur(r?.filename)==="tsv"?" ":",")}),i.rows),e.gistCsvNumeric=(r,d)=>{let p=e.gistCsvRows(r).slice(1).map(c=>c[d]).filter(c=>c!=null&&String(c).trim()!=="");return p.length>0&&p.every(c=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(c)&&/\d/.test(c))},e.gistCopied=null,e.copyGistFile=async r=>{let d=e.details?.files?.[r];!d||d.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(d.content||""),e.gistCopied=r,window.setTimeout(()=>{e.gistCopied===r&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=r=>"file-"+(r+1),e.setFileOutline=(r,d)=>{let p=e.fileOutlines[r];p&&p.map(c=>c.id).join()===d.map(c=>c.id).join()||(e.fileOutlines={...e.fileOutlines,[r]:d})},e.gistToc=()=>(e.details?.files||[]).map((r,d)=>({id:e.gistFileId(d),index:d,parts:In(r.filename),kind:Wo(r),language:oc[Wo(r)]&&Wo(r)!=="csv"?oc[Wo(r)]:r.language||(Wo(r)==="csv"?"CSV":"Text"),lines:r.encoding==="base64"?null:Wg(r.content),size:r.size,headings:Kg(r)&&e.gistView(d)==="rendered"?e.fileOutlines[d]||[]:[]}));let o=()=>e.gistToc().flatMap(r=>[r.id,...r.headings.map(d=>d.id)]);e.showGistToc=()=>{let r=e.gistToc();return e.tabState?.active==="files"&&(r.length>=2||(r[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let d=e.gistToc().find(p=>p.id===e.activeAnchor||p.headings.some(c=>c.id===e.activeAnchor));return d?d.index:0},sc(e,o)}var ev=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function rc(e){let t={diff:null,threads:null,files:[]};e.prFiles=()=>{let s=e.details?.diff,i=e.details?.reviewComments|
Line truncated
|
||||
`),p=i.date?e.fmt?.date(i.date):"",c=s[s.length-1];(!c||c.day!==p)&&s.push(c={day:p,commits:[]}),c.commits.push({...i,index:o+1,headline:r,detail:d.join(`
|
||||
`).trim()})}),s},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let s=e.prFiles().find(i=>i.id===e.activeAnchor);return s?s.index:0},e.openTab=s=>{e.tabState={active:s},e.tocOpen=!1},e.showInDiff=s=>{s&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},je(()=>e.jumpToAnchor(s.id)))},e.jumpToFile=s=>{e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},e.jumpToAnchor(s.id)},sc(e,()=>e.tabState?.active==="files"?e.prFiles().map(s=>s.id):[])}function ac(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function $a(e,t,s){let i,o=!1,r="form-draft:"+s,d=()=>Object.fromEntries(t.map(g=>[g,e[g]])),p=()=>JSON.stringify(d()),c=g=>{for(let k of t)Object.prototype.hasOwnProperty.call(g,k)&&(e[k]=g[k]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},v=()=>{try{window.sessionStorage.removeItem(r)}catch{}},h=(g=!1)=>{if(i!==void 0){if(g&&document.querySelectorAll("input, select, textarea").forEach(k=>{k._field?.binding.state===e&&k._field.timer&&k._field.commit()}),e.unsavedChanges=p()!==i,e.draftSaved=!1,!e.unsavedChanges){v();return}try{window.sessionStorage.setItem(r,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:d()})),e.draftSaved=!0}catch{}}},y=()=>h(!0);return e.on("routeLeave",y),window.addEventListener("beforeunload",y),e.on("dispose",()=>window.removeEventListener("beforeunload",y)),{restore(){i=p();let g;try{g=JSON.parse(window.sessionStorage.getItem(r)||"null")}catch{}let k=g&&g.account===(e.user?.username||null)&&Date.now()-g.savedAt<30*6e4&&g.values;return k&&(c(g.values),e.draftRestored=!0),o||(o=!0,e.watch(()=>d(),()=>h(),!0)),e.unsavedChanges=p()!==i,!!k},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state===e&&g._field.timer&&g._field.commit()}),JSON.parse(p())},accept(g){i=JSON.stringify(g),e.draftRestored=!1,h()},discard(){document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state!==e||!g._field.timer||(clearTimeout(g._field.timer),g._field.timer=null,g.value=g._field.binding.value??"")}),i!==void 0&&c(JSON.parse(i)),e.draftRestored=!1,h()},clear(){i=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,v()}}}function lc(e,t){e.errorSource="central",e.logView={search:"",severity:"",sort:"recent"},e.selectedLog=null,e.logDetailTab="overview",e.logSeverity=y=>Number(y?.status||y?.httpStatus)>=500||["error","fatal"].includes(y?.severity)?"error":y?.severity==="warn"?"warn":"info",e.filteredLogGroups=()=>{let y=e.logView.search.trim().toLowerCase();return(e.logData?.groups||[]).filter(g=>(!e.logView.severity||e.logSeverity(g.sample)===e.logView.severity)&&(!y||Object.values(g.sample).join(" ").toLowerCase().includes(y))).slice().sort((g,k)=>e.logView.sort==="count"?k.count-g.count:Date.parse(k.last)-Date.parse(g.last))},e.shortLogId=y=>y?y.slice(0,8):"",e.isLogIdentifier=(y,g)=>typeof g=="string"&&g.length>16&&/(?:id|sha|release)$/i.test(y),e.compactLogValue=y=>String(y).slice(0,8)+"\u2026"+String(y).slice(-4),e.logCopyStatus="",e.copyLogValue=async y=>{try{await navigator.clipboard.writeText(String(y)),e.logCopyStatus="Full value copied"}catch{e.logCopyStatus="Copy unavailable. Expand the value to select it."}},e.logExplanation=y=>{let g=y.service||"The application",k={job_failed:"reported a failed job",request_failed:"reported a failed request",request_aborted:"reported an aborted request",edge_request:"recorded an edge request",http_access:"recorded an HTTP request"}[y.event]||"recorded \u201C"+(y.event||"application event")+"\u201D",w=Number(y.status||y.httpStatus),C={502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[w];return g+" "+k+(w?" with HTTP "+w+(C?" ("+C+")":""):"")+"."},e.logEvidence=y=>[y.errorCode?"Recorded error code: "+y.errorCode+".":"No error code was included in this sample.",y.ms!==void 0?"Recorded duration: "+y.ms+" ms.":"",y.attempt!==void 0?"Recorded attempt: "+y.attempt+".":"",y.queue?"Queue: "+y.queue+".":""].filter(Boolean).join(" "),e.occurrenceTime=y=>Number.isFinite(Date.parse(y))?new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"}):"Time not captured",e.historyOccurrences=y=>(y?._related||[]).slice().sort((g,k)=>Date.parse(k.ts)-Date.parse(g.ts)),e.historyDetailFields=y=>{try{let g=JSON.parse(y?._detailJson||"{}");return g&&typeof g=="object"?Object.entries(g):[["value",g]]}catch{return[["record",y?._detailJson||""]]}},e.logFieldText=y=>typeof y=="object"?JSON.stringify(y):String(y??""),e.captureErrorScroll=y=>{let g=[];for(let k=y?.parentElement;k;k=k.parentElement)g.push({element:k,top:k.scrollTop,left:k.scrollLeft});return g},e.restoreErrorScroll=y=>y.forEach(({element:g,top:k,left:w})=>{g.isConnected&&(g.scrollTop=k,g.scrollLeft=w)});let s=null,i=null,o=null,r=[];e.selectLog=async(y,g)=>{if(i=g||document.activeElement,
Line truncated
|
||||
`+JSON.stringify(t):""}`},[mt.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${uv(t)}" via a navigation guard.`},[mt.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[mt.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[mt.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function fs(e,t){return it(new Error,{type:e,[cc]:!0},t)}function Sn(e,t){return e instanceof Error&&cc in e&&(t==null||!!(e.type&t))}var dv=["params","query","hash"];function uv(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of dv)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function pc(e){let t={};if(e===""||e==="?")return t;let s=(e[0]==="?"?e.slice(1):e).split("&");for(let i=0;i<s.length;++i){let o=s[i].replace(Zu," "),r=o.indexOf("="),u=Gs(r<0?o:o.slice(0,r)),p=r<0?null:Gs(o.slice(r+1));if(u in t){let d=t[u];xt(d)||(d=t[u]=[d]),d.push(p)}else t[u]=p}return t}function Ya(e){let t="";for(let s in e){let i=e[s];if(s=ev(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(xt(i)?i.map(o=>o&&_a(o)):[i&&_a(i)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+s,o!=null&&(t+="="+o))})}return t}function fc(e){let t={};for(let s in e){let i=e[s];i!==void 0&&(t[s]=xt(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}var mc=Symbol(""),Xa=Symbol(""),ar=Symbol(""),lr=Symbol(""),dr=Symbol("");function Ks(){let e=[];function t(i){return e.push(i),()=>{let o=e.indexOf(i);o>-1&&e.splice(o,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function Vn(e,t,s,i,o,r=u=>u()){let u=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((p,d)=>{let h=v=>{v===!1?d(fs(mt.NAVIGATION_ABORTED,{from:s,to:t})):v instanceof Error?d(v):lv(v)?d(fs(mt.NAVIGATION_GUARD_REDIRECT,{from:t,to:v})):(u&&i.enterCallbacks[o]===u&&typeof v=="function"&&u.push(v),p())},m=r(()=>e.call(i&&i.instances[o],t,s,h)),y=Promise.resolve(m);e.length<3&&(y=y.then(h)),y.catch(v=>d(v))})}function ur(e,t,s,i,o=r=>r()){let r=[];for(let u of e)for(let p in u.components){let d=u.components[p];if(!(t!=="beforeRouteEnter"&&!u.instances[p]))if(Ju(d)){let h=(d.__vccOpts||d)[t];h&&r.push(Vn(h,s,i,u,p,o))}else{let h=d();r.push(()=>h.then(m=>{if(!m)throw new Error(`Couldn't resolve component "${p}" at "${u.path}"`);let y=jg(m)?m.default:m;u.mods[p]=m,u.components[p]=y;let v=(y.__vccOpts||y)[t];return v&&Vn(v,s,i,u,p,o)()}))}}return r}function hc(e,t){let s=[],i=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let u=0;u<r;u++){let p=t.matched[u];p&&(e.matched.find(h=>ps(h,p))?i.push(p):s.push(p));let d=e.matched[u];d&&(t.matched.find(h=>ps(h,d))||o.push(d))}return[s,i,o]}var cv=()=>location.protocol+"//"+location.host;function Rc(e,t){let{pathname:s,search:i,hash:o}=t,r=e.indexOf("#");if(r>-1){let u=o.includes(e.slice(r))?e.slice(r).length:1,p=o.slice(u);return p[0]!=="/"&&(p="/"+p),ja(p,"")}return ja(s,e)+i+o}function pv(e,t,s,i){let o=[],r=[],u=null,p=({state:v})=>{let k=Rc(e,location),b=s.value,C=t.value,N=0;if(v){if(s.value=k,t.value=v,u&&u===b){u=null;return}N=C?v.position-C.position:0}else i(k);o.forEach(w=>{w(s.value,b,{delta:N,type:ir.pop,direction:N?N>0?rr.forward:rr.back:rr.unknown})})};function d(){u=s.value}function h(v){o.push(v);let k=()=>{let b=o.indexOf(v);b>-1&&o.splice(b,1)};return r.push(k),k}function m(){if(document.visibilityState==="hidden"){let{history:v}=window;if(!v.state)return;v.replaceState(it({},v.state,{scroll:Ko()}),"")}}function y(){for(let v of r)v();r=[],window.removeEventListener("popstate",p),window.removeEventListener("pagehide",m),document.removeEventListener("visibilitychange",m)}return window.addEventListener("popstate",p),window.addEventListener("pagehide",m),document.addEventListener("visibilitychange",m),{pauseListeners:d,listen:h,destroy:y}}function gc(e,t,s,i=!1,o=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:o?Ko():null}}function fv(e){let{history:t,location:s}=window,i={value:Rc(e,s)},o={value:t.state};o.value||r(i.value,{back:null,current:i.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(d,h,m){let y=e.indexOf("#"),v=y>-1?(s.host&&document.querySelector("base")?e:e.slice(y))+d:cv()+e+d;try{t[m?"replaceState":"pushState"](h,"",v),o.value=h}catch(k){console.error(k),s[m?"replace":"assign"](v)}}function u(d,h){r(d,it({},t.state,gc(o.value.back,d,o.value.forward,!0),h,{position:o.value.position}),!0),i.value=d}function p(d,h){let m=it({},o.value,t.state,{forward:d,scroll:Ko()});r(m.current,m,!0),r(d,it({},gc(i.value,d,null),{position:m.position+1},h),!1),i.value=d}return{location:i,state:o,push:p,replace:u}}function Tc(e){e=rc(e);let t=fv(e),s=pv(e,t.state,t.location,t.replace);function i(r,u=!0){u||s.pauseListeners(),history.go(r)}let o=it({locatLine truncated
|
||||
`);for(let d of p){if(d.startsWith("diff --git")){r(),u();continue}if(d.startsWith("--- ")){s&&s.lines.length&&r(),u().oldPath=d.replace(/^--- (a\/)?/,"").trim();continue}if(d.startsWith("+++ ")){u().newPath=d.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!/^(index |similarity index|rename |new file mode|deleted file mode|Binary files)/.test(d)){if(d.startsWith("@@")){let h=d.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);h&&(i=parseInt(h[1],10),o=parseInt(h[2],10)),u().lines.push({kind:"hunk",oldNo:"",newNo:"",text:d});continue}if(s)if(d.startsWith("+"))s.lines.push({kind:"add",oldNo:"",newNo:o++,text:d.slice(1)});else if(d.startsWith("-"))s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:d.slice(1)});else{if(d.startsWith("\\"))continue;s.lines.push({kind:"ctx",oldNo:i++,newNo:o++,text:d.startsWith(" ")?d.slice(1):d})}}}return r(),t}var Yo=(e,t)=>{let s=[],i=[],o="",r=!1;for(let u=0;u<e.length;u++){let p=e[u];r?p==='"'?e[u+1]==='"'?(o+='"',u++):r=!1:o+=p:p==='"'&&o===""?r=!0:p===t?(i.push(o),o=""):p===`
|
||||
`||p==="\r"?(p==="\r"&&e[u+1]===`
|
||||
`&&u++,i.push(o),s.push(i),i=[],o=""):o+=p}return(o!==""||i.length)&&(i.push(o),s.push(i)),s.filter(u=>u.length>1||u[0]!=="")},wr=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),Uv=(function(){let e=s=>s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),t=s=>{let i=['<div class="diff-file-block">','<div class="diff-file-header"><span class="diff-file-icon"><i class="far fa-file-code"></i></span><span class="diff-file-name">'+e(s.path)+'</span><span class="diff-file-status diff-file-status-'+s.status+'">'+s.status+"</span></div>"];if(s.lines.length){i.push('<table class="diff-file-table"><tbody>');for(let o of s.lines)i.push('<tr class="diff-row diff-row-'+o.kind+'"><td class="diff-gutter diff-gutter-old">'+(o.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(o.newNo||"")+'</td><td class="diff-sign">'+(o.kind==="add"?"+":o.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+wr(o.text)+'ch">'+e(o.text)+"</td></tr>");i.push("</tbody></table>")}return i.push("</div>"),i.join("")};return s=>s&&br(s).map(t).join("")})();function Za(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function _v(e,t="EUR"){let s=Number(e)||0;return new Intl.NumberFormat(void 0,{style:"currency",currency:t,minimumFractionDigits:s%1?2:0,maximumFractionDigits:2}).format(s)}function Bv(e){return String(e??"").toUpperCase()}function zv(e,t,s=0){return(e||[]).slice(s,s+t)}function Hv(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function jv(e,t){if(!t)return e||[];let s=Array.isArray(t)?t:[t];return[...e||[]].sort((i,o)=>{for(let r of s){let u=r[0]==="-"?-1:1;r=r.replace(/^[+-]/,"");let p=r.split(".").reduce((h,m)=>h?.[m],i),d=r.split(".").reduce((h,m)=>h?.[m],o);if(typeof p=="string"&&(p=p.toLowerCase()),typeof d=="string"&&(d=d.toLowerCase()),p!==d)return(p==null?-1:d==null?1:p<d?-1:1)*u}return 0})}function kr(e,t){if(!e)return"";let s=new Date(e);if(isNaN(s))return String(e);if(!t||t==="mediumDate")return s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let i={yyyy:s.getFullYear(),MMM:s.toLocaleDateString(void 0,{month:"short"}),MM:String(s.getMonth()+1).padStart(2,"0"),dd:String(s.getDate()).padStart(2,"0"),d:s.getDate(),HH:String(s.getHours()).padStart(2,"0"),mm:String(s.getMinutes()).padStart(2,"0"),ss:String(s.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,o=>i[o])}function Gv(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function xa(e){if(!e)return"";let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e)),s=t?new Date(+t[1],+t[2]-1,+t[3]):new Date(e);if(isNaN(s))return"";let i=s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),o=new Date;o.setHours(0,0,0,0);let r=Math.round((s-o)/864e5),u;if(r===0)u="today";else if(r===1)u="tomorrow";else if(r===-1)u="yesterday";else{let p=Math.abs(r),d=Math.round(p/30.44),h=p<14?[p,"day"]:p<60?[Math.round(p/7),"week"]:d<18?[d,"month"]:[Math.round(p/365.25),"year"],m=h[0]+" "+h[1]+(h[0]===1?"":"s");u=r>0?"in "+m:m+" ago"}return i+" \xB7 "+u}function jn(e){if(e==null||e===""||isNaN(e))return"";e=Number(e);let t="\u202F";if(e<1e3)return+(e<10?e.toFixed(2):e<100?e.toFixed(1):Math.round(e))+t+"ms";let s=e/1e3;if(s<60)return+(s<10?s.toFixed(2):s.toFixed(1))+t+"s";let i=r=>String(r).padStart(2,"0"),o=Math.round(s);return o<3600?Math.floor(o/60)+"m "+i(o%60)+"s":Math.floor(o/3600)+"h "+i(Math.floor(o%3600/60))+"m"}function el(e){if(!e)return"";let t=new Date(e);if(isNaN(t))return"";let s={day:"numeric",month:"short"};return t.getFullYear()!==new Date().getFullYear()&&(s.year="numeric"),t.toLocaleDateString(void 0,s)}function Oc(e,t){return t?.split(".").reduce((s,i)=>s?.[i],e)}function Xo(e=null,t=new Map){let s=ut({}),i=[],o=!1,r=new Proxy(s,{get(u,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(u,p)?Reflect.get(u,p):e?.[p]}});return Object.defineProperty(s,"parent",{value:e,configurable:!0}),Object.defineProperty(s,"viewState",{get:()=>r}),r.watch=(u,p,d=!1,h=!0)=>{let m=typeof u=="function"?()=>u(r):()=>Oc(r,u),y=dt(m,p,{deep:d,flush:"post"});return i.push(y),h&&We(()=>{o||p(m(),m())}),y},r.watchGroup=(u,p,d=!0)=>r.watch(()=>u.map(h=>Oc(r,h)),p,!0,d),r.on=(u,p)=>{if(u==="dispose")return i.push(p),()=>{};t.has(u)||t.set(u,new Set),t.get(u).add(p);let d=()=>t.get(u)?.delete(p);return i.push(d),d},r.emit=(u,...p)=>{for(let d of[...t.get(u)||[]])d({},...p)},r.dispose=()=>{o=!0,i.splice(0).reverse().forEach(u=>u())},Pn(r.dispose),r}function Rt(){let e=new Set,t=new Set,s=!1,i=(r,u=0)=>{if(s)return;let p=setTimeout(()=>{e.delete(p),r()},u);return e.add(p),p};i.cancel=r=>{clearTimeout(r),e.delete(r)};let o=(r,u)=>{if(s)return;let p=setInterval(r,u);return t.add(p),p};return o.cancel=r=>{clearInterval(r),t.delete(r)},Pn(()=>{s=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:i,interval:o}}function Lt(){let e=new Set;return P
Line truncated
|
||||
`)+`
|
||||
`,Lc=e=>String(e??"").replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g," ");function zc(e,t,s=[]){return["| "+e.map(Lc).join(" | ")+" |","| "+e.map((o,r)=>s[r]?"---:":"---").join(" | ")+" |",...t.map(o=>"| "+e.map((r,u)=>Lc(o[u])).join(" | ")+" |")].join(`
|
||||
`)+`
|
||||
`}var sy=Object.freeze({view:"table",query:"",sort:null,group:null,agg:"mean",ranges:{},values:{},sums:{},chart:null,x:null,y:[]});function oy(e){let t=new URLSearchParams;e.view&&e.view!=="table"&&t.set("view",e.view),e.query&&t.set("q",e.query),e.sort?.column&&t.set("sort",e.sort.column+(e.sort.dir==="desc"?":desc":"")),e.group&&t.set("group",e.group),e.group&&e.agg&&e.agg!=="mean"&&t.set("agg",e.agg);for(let[s,[i,o]]of Object.entries(e.ranges||{}))(i!=null||o!=null)&&t.set("range."+s,(i??"")+"~"+(o??""));for(let[s,i]of Object.entries(e.values||{}))for(let o of i||[])t.append("in."+s,o);for(let[s,i]of Object.entries(e.sums||{}))i&&i!=="mean"&&t.set("sum."+s,i);return e.chart&&t.set("chart",e.chart),e.x&&t.set("x",e.x),e.y?.length&&t.set("y",e.y.join("|")),t.toString()}function iy(e){var p,d;let t=new URLSearchParams(e||""),s={...sy,ranges:{},values:{},sums:{},y:[]},i=t.get("view");["table","chart","raw"].includes(i)&&(s.view=i),s.query=t.get("q")||"";let o=t.get("sort");if(o){let h=/^(.*?)(?::(asc|desc))?$/.exec(o);s.sort={column:h[1],dir:h[2]||"asc"}}s.group=t.get("group")||null;let r=t.get("agg");r&&Er[r]&&(s.agg=r);for(let[h,m]of t.entries())if(h.startsWith("range.")){let[y,v]=m.split("~").map(k=>k===""||k==null?null:Number(k));s.ranges[h.slice(6)]=[Number.isFinite(y)?y:null,Number.isFinite(v)?v:null]}else h.startsWith("in.")?((p=s.values)[d=h.slice(3)]||(p[d]=[])).push(m):h.startsWith("sum.")&&Er[m]&&(s.sums[h.slice(4)]=m);let u=t.get("chart");return["bar","line","scatter"].includes(u)&&(s.chart=u),s.x=t.get("x")||null,s.y=(t.get("y")||"").split("|").filter(Boolean),s}var rl=e=>"#"+e+":";function Js(e,t){if(!t||typeof e!="string"||!e.startsWith(rl(t)))return null;try{return iy(e.slice(rl(t).length))}catch{return null}}function Hc(e,t){let s=oy(t);return s?rl(e)+s.replace(/%3A/gi,":").replace(/%7C/gi,"|").replace(/%7E/gi,"~").replace(/%2C/gi,","):""}var dl=e=>/^#table(?:-\d+)?:/.test(e||"");var ul=function(e,t=e){let s=/\bXXXX-\d+\b/g;t.on("dark-mode",(M,S)=>{e.aceOption&&(e.aceOption.theme=S?"nord_dark":"chrome")});let i=Rt(),o=Lt();e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent);let r={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},u=["license","txt"],p=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],d=["wav","mp3","ogg","wma","flac","aac","m4a"],h=["mp4","avi","webm","mov","mpg","mpeg","mkv","flv","wmv","3gp","3g2","m4v","f4v","f4p","f4a","f4b"];e.toggleSource=function(){e.showSource=!e.showSource},e.toggleAllowScripts=function(){e.allowScripts=!e.allowScripts};let m=(()=>{try{return window.localStorage?.getItem("wrapLines")}catch{return null}})();e.wrapLines=(m??(window.matchMedia?.("(max-width: 767px)").matches?"false":"true"))!=="false",e.toggleWrap=function(){e.wrapLines=!e.wrapLines;try{window.localStorage?.setItem("wrapLines",String(e.wrapLines))}catch{}e.codeEditor?.session.setUseWrapMode(e.wrapLines)};function y(){return window.document.querySelector(".reading-layout .markdown-body")}function v(){let M=y();M&&(M.querySelectorAll("mark.md-find").forEach(S=>{S.replaceWith(window.document.createTextNode(S.textContent))}),M.normalize())}e.runMdFind=function(){v(),e.mdFindTotal=0,e.mdFindIndex=0;let M=(e.mdFindQuery||"").trim(),S=y();if(!M||!S)return;let L=!!e.mdFindCase,X=L?M:M.toLowerCase(),Z=window.document.createTreeWalker(S,4),j=[];for(;Z.nextNode();)(L?Z.currentNode.nodeValue:Z.currentNode.nodeValue.toLowerCase()).includes(X)&&j.push(Z.currentNode);let se=0;for(let te of j){let me=te.nodeValue,Ce=L?me:me.toLowerCase(),_e=window.document.createDocumentFragment(),Ye=0,Xe;for(;(Xe=Ce.indexOf(X,Ye))!==-1;){_e.appendChild(window.document.createTextNode(me.slice(Ye,Xe)));let De=window.document.createElement("mark");De.className="md-find",De.textContent=me.slice(Xe,Xe+M.length),_e.appendChild(De),se++,Ye=Xe+M.length}_e.appendChild(window.document.createTextNode(me.slice(Ye))),te.parentNode.replaceChild(_e,te)}e.mdFindTotal=se,se&&e.stepMdFind(0)},e.stepMdFind=function(M){let S=y();if(!S||!e.mdFindTotal)return;let L=S.querySelectorAll("mark.md-find");e.mdFindIndex=(e.mdFindIndex+M+L.length)%L.length,L.forEach((X,Z)=>X.classList.toggle("is-current",Z===e.mdFindIndex)),L[e.mdFindIndex]?.scrollIntoView({block:"center",behavior:"smooth"})},e.toggleMdFind=function(M){if(e.mdFindOpen=M===void 0?!e.mdFindOpen:M,!e.mdFindOpen){v(),e.mdFindTotal=0;return}We(()=>window.document.querySelector(".md-find-input")?.focus())},e.findInFile=function(){let M=e.codeEditor;if(!M)return;M.focus(),M.execCommand("find");let S=()=>{let L=M.searchBox?.element;L&&(M.renderer.setScrollMargin(52,12,0,0),!L._dockObserver&&(L._dockObserver=new MutationObserver(()=>{M.renderer.setScrollMargin(L.style.display!=="none"?52:12,12,0,0)}),L._dockObserver.observe(L,{attributes:!0,attributeFilter:["style"]})))};S(),setTimeout(S,150)};let k=[[/^\s*(?:export\s+)?(?:default\s+)?(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/,"class"],[/^\s*(?:export\s+)?(?:d
Line truncated
|
||||
`).forEach((S,L)=>{for(let[X,Z]of k){let j=X.exec(S);if(j&&!/^(if|for|while|switch|return|catch)$/.test(j[1])){M.push({name:j[1],kind:Z,line:L+1});break}}}),b={content:e.content,list:M.slice(0,300)},b.list},e.goToSymbol=function(M){e.symbolsOpen=!1;let S=e.codeEditor;S&&(S.scrollToLine(M-1,!0,!0,()=>{}),S.gotoLine(M,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+M),window.dispatchEvent(new HashChangeEvent("hashchange")))},e.gotoLine=function(){e.codeEditor&&(e.moreOpen=!1,e.gotoError="",e.gotoValue=String(e.codeEditor.getCursorPosition().row+1),e.gotoOpen=!0,setTimeout(()=>{let M=window.document.getElementById("goto-input");M&&(M.focus(),M.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let M=e.codeEditor;if(!M)return;let S=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),L=M.session.getLength();if(!S||+S[1]<1||+S[1]>L){e.gotoError="Enter a line from 1 to "+L;return}M.gotoLine(+S[1],S[2]?Math.max(0,+S[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",M.focus()},e.rootEntries=function(){return[...e.files||[]].sort((M,S)=>{let L=M.size==null,X=S.size==null;return L!==X?L?-1:1:M.name.localeCompare(S.name)})},e.formatSize=function(M){if(M==null)return"";if(M<1024)return M+" B";let S=M/1024,L=X=>X.toFixed(1).replace(/\.0$/,"");return S<1024?L(S)+" KB":S<1024*1024?L(S/1024)+" MB":L(S/1024/1024)+" GB"},e.fileSize=function(M){if(!M)return null;let S=M.replace(/^\/+/,""),L=(e.files||[]).find(X=>(X.path?X.path+"/":"")+X.name===S);return L&&L.size!=null?L.size:null},e.revealFolder=function(M){e.sidebarHidden=!1,e.sidebarCollapsed=!1,We(()=>{let S=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(M):M)+'"]');S&&(S.closest("li")?.classList.contains("open")||S.click(),S.scrollIntoView({block:"nearest"}),S.focus())})};let C={content:null,n:0},N=M=>{if(C.content===M)return C.n;let S=M;if(typeof S=="string")try{S=JSON.parse(S)}catch{S=null}let L=[],X=j=>{Array.isArray(j)?L.push(j.join("")):typeof j=="string"&&L.push(j)};(S&&(S.cells||(S.worksheets||[]).flatMap(j=>j.cells||[]))||[]).forEach(j=>{X(j?.source??j?.input),(j?.outputs||[]).forEach(se=>{X(se?.text),se?.data&&(X(se.data["text/plain"]),X(se.data["text/markdown"]),X(se.data["text/html"])),X(se?.traceback)})});let Z=L.reduce((j,se)=>j+(se.match(s)||[]).length,0);return C={content:M,n:Z},Z};e.redactionCount=function(){return e.type==="IPython"?N(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(s)||[]).length},e.renderRedacted=Qs;let w=M=>M.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(M){let S=e.renderRedacted(M);if(!S||typeof window.DOMParser!="function")return S;let L=new window.DOMParser().parseFromString("<div>"+S+"</div>","text/html"),X={};return L.querySelectorAll("h1, h2, h3").forEach(Z=>{let j=Z.id||w(Z.textContent);X[j]?j+="-"+ ++X[j]:X[j]=1,Z.id=j}),L.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},O=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let M=hr(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),S=M.length,L=null;if(M[0]?.level===1&&M.filter(X=>X.level===1).length===1){L=M[0],M=M.slice(1);let X=Math.min(...M.map(Z=>Z.level));M=M.map(Z=>({...Z,depth:Z.level-X}))}return P={content:e.content,list:M,title:L,count:S},P};e.readmeToc=()=>O().list,e.tocTitle=()=>O().title,e.tocCount=()=>O().count,e.activeHeading=null,o(window,"scroll",()=>{let M=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let S=gr(M.map(L=>L.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==S&&(e.activeHeading=S)},{capture:!0,passive:!0}),e.scrollToHeading=function(M){if(!M){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}vr(M),e.activeHeading=M};let F=()=>!e.preview&&Js(window.location.hash,"table")?.view||"table";e.csvView=F();let H={content:null,rows:[]};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(H.content!==e.content){let M=/\.tsv$/i.test(e.filePath||"")?" ":",";H={content:e.content,rows:Yo(e.content,M)}}return H.rows},e.redactParts=en,e.pathCopied=!1,e.copyPath=async function(){window.navigator.clipboard?.writeText&&(await window.navigator.clipboard.writeText(e.filePath||""),e.pathCopied=!0,setTimeout(()=>{e.pathCopied=!1},1600))},e.contentCopied=!1,e.copyContent=async function(){if(typeof e.content!="string"||!window.navigator.clipboard?.writeText)return;let M=e.content;if(e.type==="html"&&e.url)if(e.preview)M=e.sourceContent;else try{M=await(await window.fetch(e.url,{credentials:"same-origin"})).text()}catch{return}await window.navigato
Line truncated
|
||||
`).length:0,ay=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function Gc(e,t){let s=Lt();e.redactParts=en,e.hangIndent=wr,e.isRedactedName=o=>/^XXXX-\d+$/.test(String(o||"").trim()),e.tocOpen=!1,e.activeAnchor="";let i=()=>{let o=t();if(!o.length)return;let r=gr(o,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==r&&(e.activeAnchor=r)};return s(window,"scroll",i,{capture:!0,passive:!0}),s(window,"resize",i,{passive:!0}),s(window.document,"click",o=>{e.tocOpen&&!o.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),s(window.document,"keydown",o=>{o.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=o=>{e.tocOpen=!1,vr(o)&&(e.activeAnchor=o)},i}var Tr=e=>(String(e||"").split(".").pop()||"").toLowerCase(),ly={md:"markdown",markdown:"markdown",mdx:"markdown",ipynb:"notebook",csv:"csv",tsv:"csv",svg:"svg",png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",bmp:"image",ico:"image",avif:"image",pdf:"pdf",mp4:"video",webm:"video",mov:"video",m4v:"video",ogv:"video",mp3:"audio",wav:"audio",ogg:"audio",oga:"audio",m4a:"audio",flac:"audio",aac:"audio"},dy={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",pdf:"application/pdf",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/mp4",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",m4a:"audio/mp4",flac:"audio/flac",aac:"audio/aac"},uy=1024*1024;function Zs(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=ly[Tr(e?.filename)]||(e?.language==="Markdown"?"markdown":null);return e?.encoding==="base64"?["image","pdf","video","audio"].includes(t)&&e.content?t:"binary":e?.content?t==="csv"&&e.content.length>uy?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var cy=e=>["markdown","notebook","csv","svg"].includes(e),jc={markdown:"Markdown",notebook:"Jupyter notebook",csv:"Table",svg:"SVG",image:"Image",pdf:"PDF",video:"Video",audio:"Audio",binary:"Binary","too-large":"Too large",hidden:"Image"};function py(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||Tr(e?.filename)||"none"}var fy=e=>{let t=window.atob(e||""),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s};function Wc(e){e.gistViews={};let t=/^#table-(\d+):/.exec(window.location.hash||"");if(t){let u=Js(window.location.hash,"table-"+t[1])?.view;(u==="chart"||u==="raw")&&(e.gistViews[+t[1]-1]=u)}e.gistKind=u=>Zs(e.details?.files?.[u]),e.gistHasRendered=u=>cy(e.gistKind(u)),e.gistView=u=>!e.gistHasRendered(u)||e.gistViews[u]==="raw"?"raw":e.gistViews[u]==="chart"&&e.gistKind(u)==="csv"?"chart":"rendered",e.setGistView=(u,p)=>{e.gistViews={...e.gistViews,[u]:p}},e.gistSourceFile=u=>{let p=e.details?.files?.[u];return{...p,language:py(p,e.gistKind(u)),filename:"source.txt"}};let s=new Map;Pn(()=>{s.forEach(u=>window.URL.revokeObjectURL?.(u)),s.clear()});let i=(u,p)=>{if(!u||!window.URL?.createObjectURL)return null;let d=u.encoding==="base64",h=!p||d?dy[Tr(u.filename)]||(d?"application/octet-stream":"text/plain"):"text/plain",m=(u.filename||"")+"\0"+h+"\0"+(u.content||"").length;if(!s.has(m)){let y=d?fy(u.content):u.content||"";s.set(m,window.URL.createObjectURL(new window.Blob([y],{type:h+(d?"":";charset=utf-8")})))}return s.get(m)};e.gistMediaUrl=u=>i(u,!1),e.gistRawUrl=u=>i(u,!0);let o=new Map;e.gistCsvRows=u=>{let p=(u?.filename||"")+"\0"+(u?.content||"");return o.has(p)||o.set(p,Yo(u?.content||"",Tr(u?.filename)==="tsv"?" ":",")),o.get(p)},e.gistCopied=null,e.copyGistFile=async u=>{let p=e.details?.files?.[u];!p||p.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(p.content||""),e.gistCopied=u,window.setTimeout(()=>{e.gistCopied===u&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=u=>"file-"+(u+1),e.setFileOutline=(u,p)=>{let d=e.fileOutlines[u];d&&d.map(h=>h.id).join()===p.map(h=>h.id).join()||(e.fileOutlines={...e.fileOutlines,[u]:p})},e.gistToc=()=>(e.details?.files||[]).map((u,p)=>({id:e.gistFileId(p),index:p,parts:en(u.filename),kind:Zs(u),language:jc[Zs(u)]&&Zs(u)!=="csv"?jc[Zs(u)]:u.language||(Zs(u)==="csv"?"CSV":"Text"),lines:u.encoding==="base64"?null:ry(u.content),size:u.size,headings:ay(u)&&e.gistView(p)==="rendered"?e.fileOutlines[p]||[]:[]}));let r=()=>e.gistToc().flatMap(u=>[u.id,...u.headings.map(p=>p.id)]);e.showGistToc=()=>{let u=e.gistToc();return e.tabState?.active==="files"&&(u.length>=2||(u[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let p=e.gistToc().find(d=>d.id===e.activeAnchor||d.headings.some(h=>h.id===e.activeAnchor));return p?p.index:0},Gc(e,r)}var my=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function Kc(e){let t={diff:null,threads:null,files:[]};e.prFiles=()=>{let s=e.details?.diff,i=e.details?.reviewC
Line truncated
|
||||
`),p=i.date?e.fmt?.date(i.date):"",d=s[s.length-1];(!d||d.day!==p)&&s.push(d={day:p,commits:[]}),d.commits.push({...i,index:o+1,headline:r,detail:u.join(`
|
||||
`).trim()})}),s},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let s=e.prFiles().find(i=>i.id===e.activeAnchor);return s?s.index:0},e.openTab=s=>{e.tabState={active:s},e.tocOpen=!1},e.showInDiff=s=>{s&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},We(()=>e.jumpToAnchor(s.id)))},e.jumpToFile=s=>{e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},e.jumpToAnchor(s.id)},Gc(e,()=>e.tabState?.active==="files"?e.prFiles().map(s=>s.id):[])}function Yc(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function cl(e,t,s){let i,o=!1,r="form-draft:"+s,u=()=>Object.fromEntries(t.map(v=>[v,e[v]])),p=()=>JSON.stringify(u()),d=v=>{for(let k of t)Object.prototype.hasOwnProperty.call(v,k)&&(e[k]=v[k]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},h=()=>{try{window.sessionStorage.removeItem(r)}catch{}},m=(v=!1)=>{if(i!==void 0){if(v&&document.querySelectorAll("input, select, textarea").forEach(k=>{k._field?.binding.state===e&&k._field.timer&&k._field.commit()}),e.unsavedChanges=p()!==i,e.draftSaved=!1,!e.unsavedChanges){h();return}try{window.sessionStorage.setItem(r,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:u()})),e.draftSaved=!0}catch{}}},y=()=>m(!0);return e.on("routeLeave",y),window.addEventListener("beforeunload",y),e.on("dispose",()=>window.removeEventListener("beforeunload",y)),{restore(){i=p();let v;try{v=JSON.parse(window.sessionStorage.getItem(r)||"null")}catch{}let k=v&&v.account===(e.user?.username||null)&&Date.now()-v.savedAt<30*6e4&&v.values;return k&&(d(v.values),e.draftRestored=!0),o||(o=!0,e.watch(()=>u(),()=>m(),!0)),e.unsavedChanges=p()!==i,!!k},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(v=>{v._field?.binding.state===e&&v._field.timer&&v._field.commit()}),JSON.parse(p())},accept(v){i=JSON.stringify(v),e.draftRestored=!1,m()},discard(){document.querySelectorAll("input, select, textarea").forEach(v=>{v._field?.binding.state!==e||!v._field.timer||(clearTimeout(v._field.timer),v._field.timer=null,v.value=v._field.binding.value??"")}),i!==void 0&&d(JSON.parse(i)),e.draftRestored=!1,m()},clear(){i=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,h()}}}function Xc(e,t){e.errorSource="central",e.logView={search:"",severity:"",sort:"recent"},e.selectedLog=null,e.logDetailTab="overview",e.logSeverity=y=>Number(y?.status||y?.httpStatus)>=500||["error","fatal"].includes(y?.severity)?"error":y?.severity==="warn"?"warn":"info",e.filteredLogGroups=()=>{let y=e.logView.search.trim().toLowerCase();return(e.logData?.groups||[]).filter(v=>(!e.logView.severity||e.logSeverity(v.sample)===e.logView.severity)&&(!y||Object.values(v.sample).join(" ").toLowerCase().includes(y))).slice().sort((v,k)=>e.logView.sort==="count"?k.count-v.count:Date.parse(k.last)-Date.parse(v.last))},e.shortLogId=y=>y?y.slice(0,8):"",e.isLogIdentifier=(y,v)=>typeof v=="string"&&v.length>16&&/(?:id|sha|release)$/i.test(y),e.compactLogValue=y=>String(y).slice(0,8)+"\u2026"+String(y).slice(-4),e.logCopyStatus="",e.copyLogValue=async y=>{try{await navigator.clipboard.writeText(String(y)),e.logCopyStatus="Full value copied"}catch{e.logCopyStatus="Copy unavailable. Expand the value to select it."}},e.logExplanation=y=>{let v=y.service||"The application",k={job_failed:"reported a failed job",request_failed:"reported a failed request",request_aborted:"reported an aborted request",edge_request:"recorded an edge request",http_access:"recorded an HTTP request"}[y.event]||"recorded \u201C"+(y.event||"application event")+"\u201D",b=Number(y.status||y.httpStatus),C={502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[b];return v+" "+k+(b?" with HTTP "+b+(C?" ("+C+")":""):"")+"."},e.logEvidence=y=>[y.errorCode?"Recorded error code: "+y.errorCode+".":"No error code was included in this sample.",y.ms!==void 0?"Recorded duration: "+y.ms+" ms.":"",y.attempt!==void 0?"Recorded attempt: "+y.attempt+".":"",y.queue?"Queue: "+y.queue+".":""].filter(Boolean).join(" "),e.occurrenceTime=y=>Number.isFinite(Date.parse(y))?new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"}):"Time not captured",e.historyOccurrences=y=>(y?._related||[]).slice().sort((v,k)=>Date.parse(k.ts)-Date.parse(v.ts)),e.historyDetailFields=y=>{try{let v=JSON.parse(y?._detailJson||"{}");return v&&typeof v=="object"?Object.entries(v):[["value",v]]}catch{return[["record",y?._detailJson||""]]}},e.logFieldText=y=>typeof y=="object"?JSON.stringify(y):String(y??""),e.captureErrorScroll=y=>{let v=[];for(let k=y?.parentElement;k;k=k.parentElement)v.push({element:k,top:k.scrollTop,left:k.scrollLeft});return v},e.restoreErrorScroll=y=>y.forEach(({element:v,top:k,left:b})=>{v.isConnected&&(v.scrollTop=k,v.scrollLeft=b)});let s=null,i=null,o=null,r=[];e.selectLog=async(y,v)=>{if(i=v||document.activeElement,
Line truncated
|
||||
`+C.join(`
|
||||
`)],{type:"text/csv"}),b=document.createElement("a");b.href=URL.createObjectURL(N),b.download=i.username+"-repositories.csv",b.click()},e.showStatusMessage=g=>{let k=g.statusMessage||"(no message)";window.prompt(`Status message for ${g.repoId} (${g.status}):`,k)},e.fetchGithubInfo=g=>{let k=window.open("","_blank");k&&k.document.write("<pre>Loading GitHub info for "+g.repoId+"...</pre>"),t.get("/api/admin/repos/"+g.repoId+"/github").then(w=>{k&&(k.document.open(),k.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(w.data,null,2).replace(/[<>]/g,C=>C==="<"?"<":">")+"</pre>"),k.document.close())},w=>{let C=w&&w.data?JSON.stringify(w.data,null,2):String(w);k&&(k.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+C+"</pre>")})};function c(g){t.get("/api/admin/users/"+g+"/repos",{}).then(k=>{e.repositories=k.data},k=>{console.error(k)})}function v(g){t.get("/api/admin/users/"+g,{}).then(k=>{e.userInfo=k.data},k=>{console.error(k)})}v(i.username),c(i.username),e.banUser=()=>{confirm(`Ban user ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/ban`).then(()=>v(i.username),g=>console.error(g))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>v(i.username),g=>console.error(g))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>v(i.username),g=>console.error(g))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>v(i.username),g=>console.error(g))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function h(){t.get("/api/admin/tokens").then(g=>{e.tokens=g.data||[]},g=>{g.status!==401&&g.status!==403&&console.error(g)})}h(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(g=>{e.tokenForm.plaintext=g.data.token,e.tokenForm.name="",h()},g=>console.error(g))},e.revokeToken=g=>{confirm(`Revoke token "${g.name}"?`)&&t.delete("/api/admin/tokens/"+g.id).then(()=>h(),k=>console.error(k))},e.removeCache=g=>{confirm("Remove cached files for "+g.repoId+"?")&&t.delete("/api/admin/repos/"+g.repoId).then(()=>c(i.username),k=>console.error(k))},e.removeRepository=g=>{confirm("Remove repository "+g.repoId+"?")&&t.delete("/api/repo/"+g.repoId+"/").then(()=>c(i.username),k=>console.error(k))},e.updateRepository=g=>{let k=at({title:`Refreshing ${g.repoId}...`,date:new Date,body:`The repository ${g.repoId} is going to be refreshed.`});e.toasts.push(k),t.post(`/api/repo/${g.repoId}/refresh`).then(w=>{w.data.status=="ready"?k.title=`${g.repoId} is refreshed.`:k.title=`Refreshing of ${g.repoId}.`},w=>{k.title=`Error during the refresh of ${g.repoId}.`,k.body=w.body})},e.getGitHubRepositories=g=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(k=>{e.userInfo.repositories=k.data})};let y=null;e.watch("query",()=>{o.timeout.cancel(y),y=o.timeout(()=>{c(i.username)},500)},!0)},pc=function(e,t,s){let i=bt(),o=Ot();e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let r=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let C=document.querySelector('.admin-filter-toolbar input[type="search"]');C&&C.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let d=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let C=(e.statusCounts||[]).find(N=>N._id===w);return C?C.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let p="admin.conferences.filterPrefs",c={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},v=loadFilterPrefs(p)||{};e.query=Object.assign({},c,v,{page:1,search:""});let h=s.search();h.search&&(e.query.search=h.search);let y="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(y)||"[]"),e.savePreset=()=>{let w=window.prompt("Preset name:");if(!w)return;let C=Object.assign({},e.query);delete C.page,e.presets=(e.presets||[]).filter(N=>N.name!==w),e.presets.push({name:w,query:C}),localStorage.setItem(y,JSON.stringify(e.presets))},e.applyPreset=w=>{Object.assign(e.query,w.query,{page:1})},e.deletePreset=w=>{e.presets=(e.presets||[]).filter(C=>C.name!==w.name),localStorage.setItem(y,JS
Line truncated
|
||||
`):typeof z.stack=="string"?z.stack:null;for(var O=[z.cause,z.err].filter(Boolean),L=0;!F&&L<O.length;L++)for(var E=O[L];!F&&E&&typeof E=="object";)typeof E.stack=="string"&&(F=E.stack),E=E.cause;q._stack=F}else q.displayMessage=q.message,q._status=null,q._url=null,q._stack=null;return q._bucket=g(z,q.level),q._detailJson=w(q,z),q}function w(q,z){let O=[],L=(G,Z)=>{Z==null||Z===""||O.push([G,Z])};for(let G of["service","event","severity","requestId","jobId"])L(G,z&&z[G]);L("name",z&&z.name),L("code",q.displayMessage||z&&z.message),q._bucket&&L("kind",q._bucket),L("httpStatus",z&&z.httpStatus),z&&z.status&&!z.httpStatus&&L("status",z.status),L("module",q.module);let E=z&&z.detail;if(typeof E=="string"){let G=E.trim();if(G[0]==="{"||G[0]==="[")try{E=JSON.parse(E)}catch{}}if(L("detail",E),L("repoId",z&&z.repoId),L("filePath",z&&z.filePath),L("upstreamStatus",z&&z.upstreamStatus),L("upstreamBody",z&&z.upstreamBody),L("url",q._url),L("err",z&&z.err),L("cause",z&&!z.err&&z.cause),L("ts",q.ts),!O.length)return JSON.stringify(q,null,2);let F=O.reduce((G,Z)=>Math.max(G,Z[0].length),0),Y=["{"];return O.forEach(([G,Z],ie)=>{let fe=` ${`"${G}":`.padEnd(F+3," ")} `,ve=ie<O.length-1?",":"",Be;if(Z&&typeof Z=="object"){let He=" ".repeat(fe.length);Be=JSON.stringify(Z,null,2).split(`
|
||||
`).map((Ze,Ne)=>Ne===0?Ze:He+Ze).join(`
|
||||
`)}else typeof Z=="number"||typeof Z=="boolean"?Be=String(Z):Be=JSON.stringify(Z);Y.push(`${fe}${Be}${ve}`)}),Y.push("}"),Y.join(`
|
||||
`)}function C(q){let z=[],O="",L=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,E=0,F;for(;F=L.exec(q);)O+=q.slice(E,F.index),E=L.lastIndex,z.push({key:F[1],op:F[2]||"=",val:F[3]});return O+=q.slice(E),{filters:z,free:O.trim().toLowerCase()}}function N(q,z){for(let O of z.filters){let L=(F,Y,G)=>{let Z=parseFloat(F),ie=parseFloat(Y);return G==="="?String(F)===String(Y):G==="!="?String(F)!==String(Y):G===">="?Z>=ie:G==="<="?Z<=ie:G===">"?Z>ie:G==="<"?Z<ie:!0},E;if(O.key==="code")E=q.displayMessage;else if(O.key==="module")E=q.module;else if(O.key==="status")E=q._status;else if(O.key==="url")E=q._url;else if(O.key==="repo")E=q._repoId;else if(O.key==="level")E=q.level;else continue;if(E==null||!L(E,O.val,O.op))return!1}return!(z.free&&((q.displayMessage||"")+" "+(q.module||"")+" "+(q._url||"")+" "+JSON.stringify(q.raw||[])).toLowerCase().indexOf(z.free)===-1)}function b(){let q=C(e.query.search||"");e.parsedFilterCount=q.filters.length;let z=e.query.bucket,O=e.entries.filter(G=>z&&G._bucket!==z?!1:N(G,q)),L=e.query.group;if(L){let G=x=>JSON.stringify(L==="module"?[x.module,x._bucket]:[x.raw?.[0]?.service||"unknown",x.module,x.displayMessage||x.message||"_",x._bucket,x._status]),Z=new Map;for(let x of O){let fe=G(x);if(Z.has(fe)){let ve=Z.get(fe);ve.count++,ve._related.push(x),new Date(x.ts)>new Date(ve.ts)&&(ve.ts=x.ts,ve._url=x._url,ve._status=x._status),new Date(x.ts)<new Date(ve._firstSeen)&&(ve._firstSeen=x.ts)}else{let ve=Object.assign({},x);ve._key=`${L}:${fe}`,ve._related=[x],ve._firstSeen=x.ts,ve._lastHourCount=0,ve.count=1,Z.set(fe,ve)}}let ie=Date.now()-3600*1e3;for(let x of Z.values())x._lastHourCount=x._related.filter(fe=>new Date(fe.ts).getTime()>=ie).length;O=Array.from(Z.values())}else O=O.map((G,Z)=>(G._key="row:"+Z+":"+G.ts,G._related=[G],G._firstSeen=G.ts,G._lastHourCount=0,G.count=1,G));let E=G=>({error:0,warn:1,info:2})[G._bucket]??1;e.query.sort==="count"?O.sort((G,Z)=>E(G)-E(Z)||Z.count-G.count||new Date(Z.ts)-new Date(G.ts)):O.sort((G,Z)=>E(G)-E(Z)||new Date(Z.ts)-new Date(G.ts)),e.visible=O;let F=!!(e.query.bucket||(e.query.search||"").trim()),Y=!F&&(e.stats?.severity?.error||0)>0&&!O.some(G=>G._bucket==="error")&&e.entries.length<1500;(F&&!O.length||Y)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,P(!0))}function P(q){if(q&&e.redisLoading)return;let z=++o;e.redisLoading=!0;let O=q?e.redisNextOffset||e.entries.length:0,L=q?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:O,limit:L}}).then(E=>{if(p||z!==o)return;e.redisLoading=!1;let F=(E.data.entries||[]).map(k);e.entries=q?e.entries.concat(F):F,e.redisRedacted=(q&&e.redisRedacted||0)+(E.data.redactedEntries||0),e.redisNextOffset=E.data.nextOffset??O+(E.data.entries||[]).length,e.available=!!E.data.available,e.redisCollecting=E.data.redisCollecting!==!1,e.cap=E.data.max||e.cap,e.total=E.data.total||e.entries.length,e._autoLoading=!1,b()},()=>{p||z!==o||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>P(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function M(q=!1){if(q&&d)return;let z=++r;d=!0,t.get("/api/admin/errors/stats").then(O=>{if(p||z!==r)return;d=!1;let L=O.data||{};e.redisStatsState=L.available===!1?"unavailable":"ready";let E=L.prev24h?Math.round((L.last24h-L.prev24h)/L.prev24h*100):0;e.stats={last24h:L.last24h||0,prev24h:L.prev24h||0,delta:E,severity:L.severity||{error:0,warn:0,info:0},unique:L.unique||{error:0,warn:0,info:0},buckets:L.buckets||[],dropped:L.dropped||0},b()},()=>{!p&&z===r&&(d=!1,e.redisStatsState="unavailable")})}function _(q=!1){(!q||!e.redisLoading)&&P(),M(q)}e.barPx=(q,z)=>{let O=e.stats.buckets||[],L=0,E=0;for(let Z of O)L=Math.max(L,(Z.error||0)+(Z.warn||0)),E=Math.max(E,Z.info||0);let F=q[z]||0;if(!F)return 0;if(z==="info")return E?Math.max(2,Math.round(F/E*(L?16:60))):0;let Y=(q.error||0)+(q.warn||0),G=Math.round(Y/L*44);return Math.max(4,Math.round(F/Y*G))},e.bucketTitle=q=>`${new Date(q.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${q.error||0} err \xB7 ${q.warn||0} warn \xB7 ${q.info||0} info`,e.toggle=async(q,z)=>{v=z||document.activeElement,h=e.captureErrorScroll(v),e.historySelected=q,e.historyView="overview",e.expanded={[q._key]:!0},await je(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=q=>{if(e.historyView="timeline",e.traceSelection)return;let z=["requestId","jobId"].find(O=>e.logTraceId(e.historySelected,O));z&&e.lookupTrace(z,e.logTraceId(e.historySelected,z),q,e.historySelected)},e.closeHistory=async()=>{let q=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await je(),(v?.isConnected?v:[...document.querySelectorAll("[data-history-key]")].find(O=>O.dataset.historyKey===q))?.focus({preventScroll:!0}),e.restoreErrorScroll(h)},e.setBucket=q
Line truncated
|
||||
`)],{type:"text/csv;charset=utf-8"}),L=URL.createObjectURL(O),E=document.createElement("a");E.href=L,E.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(L)};function j(q){e.copyHint=`${q} copied`,c.timeout(()=>{e.copyHint=""},1500)}e.copyJson=q=>{navigator.clipboard.writeText(q._rawJson).then(()=>j("JSON"))},e.copyCurl=q=>{if(!q._url)return;let O=`curl -X ${q._method||"GET"} '${window.location.origin}${q._url}'`;navigator.clipboard.writeText(O).then(()=>j("curl"))},_();let ne=i(()=>{e.query.autoRefresh&&_(!0)},15e3);e.on("dispose",()=>{p=!0,o++,r++,i.cancel(ne)}),e.watch("query.search",b),e.watch("query.bucket",b),e.watch("query.sort",b),e.watch("query.group",b)},hc=function(e,t,s,i){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null){s.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.cacheReport=null,e.cacheError=null,e.cacheMinutes=60,e.cacheTraffic="all",e.ovView=["performance","cache"].includes((window.location.hash||"").slice(1))?window.location.hash.slice(1):"summary",e.setOvView=function(b){e.ovView=b;try{window.history.replaceState(null,"",b==="summary"?window.location.pathname:"#"+b)}catch{}};var o=!1;e.loadCache=function(){if(!o){o=!0;var b=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:b}}).then(function(P){b===e.cacheMinutes&&(e.cacheReport=P.data,e.cacheError=P.data.available?null:P.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){o=!1,b!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(b){return e.cacheTraffic==="all"||b.traffic===e.cacheTraffic})},e.cacheRate=function(b,P){var M=e.cacheRows(),_=function(q){return M.filter(function(z){return z.name===q}).reduce(function(z,O){return z+O[P]},0)},j=_(b+"_hit"),ne=_(b+"_miss");return j+ne?(100*j/(j+ne)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(b){return b.replaceAll("_"," ")},e.cacheP95=function(b){var P=0,M=e.cacheReport?.latencyBucketsMs||[];if(!b.count)return"No samples";if(!b.ms)return"Not timed";for(var _=0;_<=M.length;_++)if(P+=b["b"+_]||0,P>=Math.ceil(b.count*.95))return _<M.length?"\u2264 "+Un(M[_]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let b=e.data&&e.data.system||{},P=[["Memory",b.memPercent],["Disk",b.diskPercent]].filter(([,_])=>_>90);return P.length?P.map(([_,j])=>_+" is at "+j+"%").join(" and ")+". New anonymizations may fail until "+(P.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(b){return b==null?"":Un(b)},e.latencyBound=function(b,P){return b.count?b[P]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(b[P]):"No samples"},e.firstByteBound=function(b){return e.latencyBound({count:b.firstByteCount,p95UpperMs:b.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(b){return Math.max(0,Math.round((Date.now()-b.sampledAt)/1e3))},e.peakRss=function(b){return(e.performance.runtimeSeries||[]).filter(function(P){return P.instance===b.instance}).reduce(function(P,M){return Math.max(P,M.rss)},b.memory.rss)},e.performanceWarning=function(b){return e.sampleAge(b)>45||b.droppedBatches||b.droppedMetrics||b.sockets?.closeWait>0||b.eventLoop?.p95Ms>100||b.memoryLimitBytes&&b.memory.rss>b.memoryLimitBytes*.8};var r=!1;e.loadPerformance=function(){var b=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==b&&(e.performance=null),!r&&(r=!0,t.get("/api/admin/performance",{params:{minutes:b}}).then(function(P){b===e.performanceMinutes&&(e.performance=P.data,e.performanceError=P.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){b===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){r=!1,b!==e.performanceMinutes&&e.loadPerformance()}))};function d(b){if(b==null)return"\u2014";for(var P=["B","KB","MB","GB","TB"],M=0,_=b;_>=1024&&M<P.length-1;)_/=1024,M++;return _.toFixed(M>0?1:0).replace(/\.0$/,"")+" "+P[M]}e.humanBytes=d;function p(b){if(!b)return"\u2014";var P=Math.floor(b/86400),M=Math.floor(b%86400/3600),_=Math.floor(b%3600/60);return P>0?P+"d "+(M<10?"0":"")+M+"h":M>0?M+"h "+(_<10?"0":"")+_+"m":_+"m"}e.humanDuration=p;function c(b){return b==null?"\u2014":b>=1e6?(b/1e6).toFixed(1)+"M":b>=1e3?(b/1e3).toFixed(1)+"K":String(b)}e.humanNum=c,e.queueTotal=function(b){return b?(b.waiting||0)+(b.active||0)+(b.delayed||0)+(b.failed||0):0},e.statusCount=function(b){if(!e.data||!e.data.repos)return 0;for(var P=e.data.repos.statusBreakdown||[],M=0;M<P.length;M++)if(P[M]._id===b)return P[M].count;return 0},e.barPct=function(b){var P=e.data&&e.data.repos?e.data.repos.total:0;if(!P)return 0;var M=[b];b==="expired"&&M.push("expiring"),b==="remov
Line truncated
|
||||
`)},e.tipSide=w=>{let C=(e.summary?.series||[]).length;return C<3?"":w<C/4?"tip-start":w>=C*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((w,C)=>w+e.bucketTotal(C),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(w=>w.active||w.allTimeSales||w.sales),e.familyLabel=w=>(cr.find(C=>C.id===w)||{}).label||"",e.familyPlans=w=>(e.summary?.plans||[]).filter(C=>C.family===w),e.familySum=(w,C)=>e.familyPlans(w).reduce((N,b)=>N+(b[C]||0),0),e.familyMoney=(w,C,N)=>{if(!e.revenueOn())return"\u2014";let b=e.familyPlans(w);return b.some(P=>P[N]===!1)?"Incomplete":e.moneyText(b.reduce((P,M)=>r(P,M[C]),{}))},e.planTotals=()=>{let w=C=>(e.summary?.plans||[]).reduce((N,b)=>N+(b[C]||0),0);return{active:w("active"),sales:w("sales"),allTimeSales:w("allTimeSales")}},e.webhookState=()=>{let w=e.summary?.webhooks;return w?w.failed||w.reconciliationFailed?"bad":w.oldestPendingSeconds>900||w.unreviewedRevocations?"warn":"ok":"ok"},e.age=w=>w?Un(w*1e3):"\u2014";let d=0;e.loadSummary=()=>{let w=++d;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(C=>{if(w!==d)return;e.summaryLoading=!1;let N=C.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},C=>{w===d&&(e.summaryLoading=!1,e.summaryError=C&&C.data&&C.data.error||"Could not load billing figures.")})},e.setPeriod=w=>{if(e.period!==w){e.period=w;try{localStorage.setItem("admin.billing.period",w)}catch{}e.loadSummary()}},e.grants=[],e.total=-1,e.totalPage=0,e.stateCounts={},e.statuses=[],e.grantsError=null,e.filtersOpen=!1,e.query={page:1,limit:25,search:"",plan:"",status:"",state:"",period:"",sort:"purchasedAt",direction:"desc"};let p=s.search();p.search&&(e.query.search=p.search),e.stateView=()=>e.query.state||"all",e.setStateView=w=>{e.query.state=w==="all"?"":w,e.query.page=1},e.stateCount=w=>w==="all"?["active","expired","revoked"].reduce((C,N)=>C+(e.stateCounts[N]||0),0):e.stateCounts[w]||0,e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let c=()=>{let w=[];e.query.plan&&w.push({key:"plan",label:"Plan",value:e.planName(e.query.plan)}),e.query.status&&w.push({key:"status",label:"Stripe status",value:e.query.status.replace(/_/g," ")}),e.query.period&&w.push({key:"period",label:"Started",value:"last "+((e.periods.find(C=>C.id===e.query.period)||{}).label||e.query.period)}),e.chips=w};e.clearFilter=w=>{e.query[w]="",e.query.page=1},e.filterPlan=w=>{Object.assign(e.query,{plan:w,page:1});let C=document.getElementById("bl-grants");C&&C.scrollIntoView&&C.scrollIntoView({behavior:"smooth",block:"start"})},e.clearFilters=()=>Object.assign(e.query,{search:"",plan:"",status:"",state:"",period:"",page:1}),e.hasFilters=()=>!!(e.query.search||e.query.plan||e.query.status||e.query.state||e.query.period),e.filterCount=()=>["plan","status","period"].filter(w=>e.query[w]).length,e.amountText=w=>{if(!w.amount)return"\u2014";let C=fo({[w.amount.currency]:w.amount.value})[0]||"\u2014";if(!w.amount.interval)return C;let N=w.amount.intervalCount>1?w.amount.intervalCount+" "+w.amount.interval+"s":w.amount.interval;return C+" / "+N},e.amountTitle=w=>w.amount?"Stripe list price"+(w.pack?" of the whole pack":""):{stripe_not_configured:"Revenue unavailable: Stripe is not configured on this server.",unresolved:"Revenue unavailable: this Stripe price could not be looked up.",unrecorded:"Revenue unavailable: no sale price was recorded for this subscription."}[w.amountMissing]||"Revenue unavailable.",e.endText=w=>{if(w.never)return"Never ends";if(!w.until)return"\u2014";let C=dr(w.until);return w.state!=="active"?(new Date(w.until)<new Date?"Ended ":"Ends ")+C:w.subscription?(w.cancelAtPeriodEnd?"Ends ":"Renews ")+C:"Until "+C},e.packNote=w=>{let C=(w.parts||[]).find(N=>N.planId==="author_pass");return!w.pack||!C||!C.until?"":(new Date(C.until)<new Date?"Updates ended ":"Updates until ")+dr(C.until)};let v={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=w=>(w.parts||[]).map(C=>v[C.planId]||e.planName(C.planId)).join(", ").replace(/^./,C=>C.toUpperCase()),e.packPartsTitle=w=>"Paper pack: "+(w.parts||[]).map(C=>e.planName(C.planId)).join(", "),e.statusText=w=>(w.status||"unknown").replace(/_/g," "),e.revocationText=w=>w==="dispute"?"Disputed":w==="full_refund"?"Refunded":"Revoked",e.scopeHref=w=>w?.kind==="repo"?"/admin/repositories?search="+encodeURIComponent(w.id):w?.kind==="conference"?"/conference/"+encodeURIComponent(w.id):null;let h=0;function y(){let w=++h;e.grantsError=null;let C=Object.fromEntries(Object.entries(e.query).filter(([,N])=>N!==""&&N!=null));t.get("/api/admin/billing/grants",{params:C}).then(N=>{w===h&&(
Line truncated
|
||||
`)},Ka=class{constructor(t){nt(this,"gen");nt(this,"threads",[]);nt(this,"match",!1);nt(this,"runs",[]);nt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Mc=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((s,i)=>s!==t.ids[i])?!1:e.runs.every(s=>t.runs.some(i=>i.neg===s.neg&&Mc(i.state,s.state))),Rc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),ho,Wn,Ya,Ja,Ws=class{constructor(t,s,i){_e(this,Wn);nt(this,"dots");nt(this,"dotStart");_e(this,ho);this.dots=t,this.dotStart=s,ze(this,ho,i)}state(){return new Ka(++ae(this,ho).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(Wa.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!$e(this,Wn,Ya).call(this,t,s))return;for(let d of s.out)this.add(t,d,i,o);return;case"neg":if(!$e(this,Wn,Ya).call(this,t,s))return;let r=this.state();return this.add(r,s.sub,i,!1),this.done(r),this.addRun(t,{t:"run",neg:s,state:r},i,o);case"star":if(this.restricted(i,o))return;$e(this,Wn,Ja).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:$e(this,Wn,Ja).call(this,t,s)}}addRun(t,s,i,o){for(let r of t.runs)if(r.neg===s.neg&&Mc(r.state,s.state))return;t.runs.push(s),s.state.match||this.add(t,s.neg.next,i,o)}step(t,s,i,o){let r=this.state();for(let d of t.threads)switch(d.t){case"lit":Za(d,s)&&this.add(r,d.next,i+1,o);break;case"any":this.restricted(i,o)||this.add(r,d.next,i+1,o);break;case"class":!this.restricted(i,o)&&d.re.test(s)&&this.add(r,d.next,i+1,o);break;case"star":this.restricted(i,o)||this.add(r,d,i+1,o)}if(!this.restricted(i,o))for(let d of t.runs){if(d.state.dead){this.addRun(r,d,i+1,o);continue}let p=this.step(d.state,s,i,!1);this.addRun(r,{t:"run",neg:d.neg,state:p},i+1,o)}return this.done(r)}};ho=new WeakMap,Wn=new WeakSet,Ya=function(t,s){let{seen:i}=ae(this,ho);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},Ja=function(t,s){let{has:i}=ae(this,ho);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var Vc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${Vc(i.state)})`);return`${t}|${s.sort().join("|")}`},qv=1<<18,Ko,Yo,Bn,go,zn,Hn,jn,sn,Qa,gr,qc,Xa=class{constructor(t,s){_e(this,sn);_e(this,Ko);_e(this,Yo,new Map);_e(this,Bn,0);_e(this,go);_e(this,zn);_e(this,Hn);_e(this,jn);ze(this,Ko,t),ze(this,Hn,new Ws(!1,!1,s)),ze(this,jn,new Ws(!1,!0,s))}start(t){if(t){if(ae(this,zn))return ae(this,zn);let i=ae(this,jn).state();return ae(this,jn).add(i,ae(this,Ko),0,!0),ze(this,zn,$e(this,sn,Qa).call(this,ae(this,jn).done(i)))}if(ae(this,go))return ae(this,go);let s=ae(this,Hn).state();return ae(this,Hn).add(s,ae(this,Ko),0,!0),ze(this,go,$e(this,sn,gr).call(this,ae(this,Hn).done(s)))}next(t,s){let i=s.charCodeAt(0),o=i<128?void 0:t.next.get(s);if(o)return o;let r=t===ae(this,zn)?$e(this,sn,gr).call(this,ae(this,jn).step(t.state,s,0,!0)):$e(this,sn,gr).call(this,ae(this,Hn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),ze(this,Bn,ae(this,Bn)+128)),t.ascii[i]=r):t.next.set(s,r),Sl(this,Bn)._++,r}};Ko=new WeakMap,Yo=new WeakMap,Bn=new WeakMap,go=new WeakMap,zn=new WeakMap,Hn=new WeakMap,jn=new WeakMap,sn=new WeakSet,Qa=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},gr=function(t){let s=Vc(t),i=ae(this,Yo).get(s);if(i)return i;ae(this,Bn)>qv&&$e(this,sn,qc).call(this);let o=$e(this,sn,Qa).call(this,t);return ae(this,Yo).set(s,o),ze(this,Bn,ae(this,Bn)+(s.length+1)),o},qc=function(){ae(this,Yo).clear(),ze(this,Bn,0),ze(this,go,void 0),ze(this,zn,void 0)};var Lv=e=>{let t=[];for(let s=e;s.t!=="match";s=s.next){if(s.t==="split"||s.t==="neg")return;t.push(s)}return t},Fv=(e,t,s,i)=>{let o=0,r=s,d=-1,p=0;for(;r<i;){let c=e[o];if(c?.t==="star"){d=o++,p=r;continue}let v=t[r];if(c&&(c.t==="any"||c.t==="lit"&&Za(c,v)||c.t==="class"&&c.re.test(v))){o++,r++;continue}if(d===-1)return!1;o=d+1,r=++p}for(;e[o]?.t==="star";)o++;return o===e.length},Lc=e=>{let t=0,s=0;for(let i of e){let[o,r]=_v(i);t+=o,s+=r}return[t,s]},_v=e=>{if(e.t==="star")return[0,1/0];if(e.t!=="ext")return[1,1];if(e.type==="!")return[0,1/0];let t=e.alts.map(Lc),s=Math.min(...t.map(r=>r[0])),i=Math.max(...t.map(r=>r[1])),o=i===0?0:1/0;return e.type==="@"?[s,i]:e.type==="?"?[0,i]:e.type==="*"?[0,o]:[s,o]},Tc=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!Za(e[i],t[s+i]))return!1;return!0},$v=/[/\ud800-\udfff]/,Uv=/[\ud800-\udfff]/,hr=e=>Uv.test(e)?[...e]:e,Pc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Gn,Jo,vo,vr,yo,Ys,yr,bo,Js,Xs,Qs,On,wn,Xo,Qo,Zs,br,on,wo,Gs,Ks=class{constructor(t,s={}){_e(this,wo);nt(this,"pattern");nt(this,"options");_e(this,Gn);_e(this,Jo);_e(this,vo);_e(this,vr);_e(this,yo);_e(this,Ys,!1);_e(this,yr);_e(this,bo);_e(this,Js,!1);_e(this,Xs,0);_e(this,Qs,1/0);_e(this,On,[]);_e(this,wn,[]);_e(this,Xo);_e(this,Qo);_e(this,Zs,!1);_e(this,br);_e(this,on);if(t.includes
Line truncated
|
||||
`).forEach((s,i)=>{let{term:o}=ul(s.trim());if(!o)return;let r=[];for(let d=0;d<o.length;d++){if(o[d]==="\\"){d++;continue}xc.has(o[d])&&!r.includes(o[d])&&r.push(o[d])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function tp(e,t){let s=String(e||"").split(`
|
||||
`),i=s[t];if(i===void 0)return e;let{term:o}=ul(i.trim());if(!o)return e;let r="";for(let p=0;p<o.length;p++){if(o[p]==="\\"){r+=o.slice(p,p+2),p++;continue}r+=xc.has(o[p])||o[p]==="."?"\\"+o[p]:o[p]}let d=i.indexOf(o);return s[t]=i.slice(0,d)+r+i.slice(d+o.length),s.join(`
|
||||
`)}var Zn={VIEWER_ERRORS:{title:"Content could not be loaded",access_title:"GitHub access needs attention",reader_help:"Reading this repository? You do not need to sign in. Try again after the owner restores access, or let them know this anonymous link is unavailable.",owner_help:"Own this repository? If your GitHub account was suspended or recently recovered, sign in to Anonymous GitHub again and check the GitHub connection and repository permissions in your dashboard. Then retry this page. Keep the existing anonymous URL; do not delete the repository to restore access.",retry:"Try again",dashboard:"Open owner dashboard"},ERRORS:{cache_busy:"Downloads are busy. Please try again shortly.",invalid_sort:"The selected sort order is invalid.",invalid_cursor:"This project page is no longer valid. Reload the list.",repository_changed:"The repository changed while processing. Please retry.",repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"We could not load this content. Try again. If it still fails, contact support with the anonymous URL and the time of the error.",unreachable:"The service could not complete this request. Wait a moment and try again.",request_error:"The connection was interrupted. Check your internet connection and try again.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"Anonymous GitHub cannot access the source repository on GitHub. It may be private, unavailable, or require the owner to reconnect GitHub.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub temporarily blocked the request because we hit its API rate limit. Wait a few minutes and try again. If the problem persists and you contact GitHub Support, include the request ID and timestamp shown in GitHub's response (the 'X-GitHub-Request-Id' header).",rate_limited:"GitHub API rate limit reached. The repository will be available shortly \u2014 please wait a moment and refresh.",repoId_already_used:"The repository ID is already used.",invalid_repoId:"The format of the repository ID is invalid.",unsupported_source:"The repository source type is not supported.",branch_not_specified:"The branch is not specified.",branch_not_found:"The branch of the repository cannot be found.",commit_not_specified:"A commit must be specified.",commit_not_found:"The configured commit no longer exists in the source repository. It may have been force-pushed, rebased, or removed.",repo_renamed:"The source repository appears to have been renamed or moved on GitHub. Please refresh and try again \u2014 the cached name has been updated.",invalid_commit_format:"The commit hash format is invalid. It must be a hexadecimal string.",pull_request_not_found:"The requested pull request could not be found.",pull_request_expired:"This pull request has expired and is no longer available.",pull_request_not_ready:"This pull request is still being prepared. Please t
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,y.options),p.restore()})}c();let v=null;e.saveDefault=h=>{if(h&&h.preventDefault&&h.preventDefault(),e.saving)return;let y=p.checkpoint(),g={terms:e.terms.split(`
|
||||
`).map(k=>k.trim()).filter(k=>k.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",g).then(()=>{p.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",v&&i.cancel(v),v=i(()=>{e.message=null},2500)},k=>{e.saving=!1;let w=k&&k.data&&k.data.error,C="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+w),s("ERRORS.unknown_error")]).then(([N,b])=>{e.error=w&&N!==b?N:C},()=>{e.error=C})})},e.deleteAccount=()=>{e.deletingAccount||!e.confirmDeleteAccount||e.deleteUsername!==e.user?.username||(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},ap=function(e,t,s){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(i=>{s.url("/dashboard")},i=>{e.error=i.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},lp=function(e,t,s,i,o){e.user&&!e.user.status&&s.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&s.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(p){e.feature=p},e.featureHref=function(p){return p.needsUser&&!e.user?"/signin":p.href},e.featureTarget=function(p){return p.needsUser&&!e.user?"_self":p.target||void 0},e.featureKeydown=function(p,c){let v={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[p.key];if(v===void 0)return;p.preventDefault();let h=e.features.length,y=v==="first"?0:v==="last"?h-1:(c+v+h)%h;e.feature=e.features[y].key,o(()=>{let g=i.document.getElementById("feature-tab-"+e.feature);g&&g.focus()})},e.demoText=`# DeepLearnUtils
|
||||
`)],{type:"text/csv"}),w=document.createElement("a");w.href=URL.createObjectURL(N),w.download=i.username+"-repositories.csv",w.click()},e.showStatusMessage=v=>{let k=v.statusMessage||"(no message)";window.prompt(`Status message for ${v.repoId} (${v.status}):`,k)},e.fetchGithubInfo=v=>{let k=window.open("","_blank");k&&k.document.write("<pre>Loading GitHub info for "+v.repoId+"...</pre>"),t.get("/api/admin/repos/"+v.repoId+"/github").then(b=>{k&&(k.document.open(),k.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(b.data,null,2).replace(/[<>]/g,C=>C==="<"?"<":">")+"</pre>"),k.document.close())},b=>{let C=b&&b.data?JSON.stringify(b.data,null,2):String(b);k&&(k.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+C+"</pre>")})};function d(v){t.get("/api/admin/users/"+v+"/repos",{}).then(k=>{e.repositories=k.data},k=>{console.error(k)})}function h(v){t.get("/api/admin/users/"+v,{}).then(k=>{e.userInfo=k.data},k=>{console.error(k)})}h(i.username),d(i.username),e.banUser=()=>{confirm(`Ban user ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/ban`).then(()=>h(i.username),v=>console.error(v))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>h(i.username),v=>console.error(v))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>h(i.username),v=>console.error(v))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>h(i.username),v=>console.error(v))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(v=>{e.tokens=v.data||[]},v=>{v.status!==401&&v.status!==403&&console.error(v)})}m(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(v=>{e.tokenForm.plaintext=v.data.token,e.tokenForm.name="",m()},v=>console.error(v))},e.revokeToken=v=>{confirm(`Revoke token "${v.name}"?`)&&t.delete("/api/admin/tokens/"+v.id).then(()=>m(),k=>console.error(k))},e.removeCache=v=>{confirm("Remove cached files for "+v.repoId+"?")&&t.delete("/api/admin/repos/"+v.repoId).then(()=>d(i.username),k=>console.error(k))},e.removeRepository=v=>{confirm("Remove repository "+v.repoId+"?")&&t.delete("/api/repo/"+v.repoId+"/").then(()=>d(i.username),k=>console.error(k))},e.updateRepository=v=>{let k=ut({title:`Refreshing ${v.repoId}...`,date:new Date,body:`The repository ${v.repoId} is going to be refreshed.`});e.toasts.push(k),t.post(`/api/repo/${v.repoId}/refresh`).then(b=>{b.data.status=="ready"?k.title=`${v.repoId} is refreshed.`:k.title=`Refreshing of ${v.repoId}.`},b=>{k.title=`Error during the refresh of ${v.repoId}.`,k.body=b.body})},e.getGitHubRepositories=v=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(k=>{e.userInfo.repositories=k.data})};let y=null;e.watch("query",()=>{o.timeout.cancel(y),y=o.timeout(()=>{d(i.username)},500)},!0)},xc=function(e,t,s){let i=Rt(),o=Lt();e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let r=b=>{if(b.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){b.preventDefault();let C=document.querySelector('.admin-filter-toolbar input[type="search"]');C&&C.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=b=>{b==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[b]="",e.query.page=1},e.chips=[];let u=()=>{let b=[];(e.query.dateFrom||e.query.dateTo)&&b.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=b};e.statusCountFor=b=>{let C=(e.statusCounts||[]).find(N=>N._id===b);return C?C.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=b=>{e.query.sort===b?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=b,e.query.direction="desc"),e.query.page=1},e.sortIcon=b=>e.query.sort===b?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let p="admin.conferences.filterPrefs",d={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},h=loadFilterPrefs(p)||{};e.query=Object.assign({},d,h,{page:1,search:""});let m=s.search();m.search&&(e.query.search=m.search);let y="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(y)||"[]"),e.savePreset=()=>{let b=window.prompt("Preset name:");if(!b)return;let C=Object.assign({},e.query);delete C.page,e.presets=(e.presets||[]).filter(N=>N.name!==b),e.presets.push({name:b,query:C}),localStorage.setItem(y,JSON.stringify(e.presets))},e.applyPreset=b=>{Object.assign(e.query,b.query,{page:1})},e.deletePreset=b=>{e.presets=(e.presets||[]).filter(C=>C.name!==b.name),localStorage.setItem(y,JS
Line truncated
|
||||
`):typeof U.stack=="string"?U.stack:null;for(var G=[U.cause,U.err].filter(Boolean),M=0;!L&&M<G.length;M++)for(var S=G[M];!L&&S&&typeof S=="object";)typeof S.stack=="string"&&(L=S.stack),S=S.cause;q._stack=L}else q.displayMessage=q.message,q._status=null,q._url=null,q._stack=null;return q._bucket=v(U,q.level),q._detailJson=b(q,U),q}function b(q,U){let G=[],M=(Z,j)=>{j==null||j===""||G.push([Z,j])};for(let Z of["service","event","severity","requestId","jobId"])M(Z,U&&U[Z]);M("name",U&&U.name),M("code",q.displayMessage||U&&U.message),q._bucket&&M("kind",q._bucket),M("httpStatus",U&&U.httpStatus),U&&U.status&&!U.httpStatus&&M("status",U.status),M("module",q.module);let S=U&&U.detail;if(typeof S=="string"){let Z=S.trim();if(Z[0]==="{"||Z[0]==="[")try{S=JSON.parse(S)}catch{}}if(M("detail",S),M("repoId",U&&U.repoId),M("filePath",U&&U.filePath),M("upstreamStatus",U&&U.upstreamStatus),M("upstreamBody",U&&U.upstreamBody),M("url",q._url),M("err",U&&U.err),M("cause",U&&!U.err&&U.cause),M("ts",q.ts),!G.length)return JSON.stringify(q,null,2);let L=G.reduce((Z,j)=>Math.max(Z,j[0].length),0),X=["{"];return G.forEach(([Z,j],se)=>{let me=` ${`"${Z}":`.padEnd(L+3," ")} `,Ce=se<G.length-1?",":"",_e;if(j&&typeof j=="object"){let Ye=" ".repeat(me.length);_e=JSON.stringify(j,null,2).split(`
|
||||
`).map((Xe,De)=>De===0?Xe:Ye+Xe).join(`
|
||||
`)}else typeof j=="number"||typeof j=="boolean"?_e=String(j):_e=JSON.stringify(j);X.push(`${me}${_e}${Ce}`)}),X.push("}"),X.join(`
|
||||
`)}function C(q){let U=[],G="",M=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,S=0,L;for(;L=M.exec(q);)G+=q.slice(S,L.index),S=M.lastIndex,U.push({key:L[1],op:L[2]||"=",val:L[3]});return G+=q.slice(S),{filters:U,free:G.trim().toLowerCase()}}function N(q,U){for(let G of U.filters){let M=(L,X,Z)=>{let j=parseFloat(L),se=parseFloat(X);return Z==="="?String(L)===String(X):Z==="!="?String(L)!==String(X):Z===">="?j>=se:Z==="<="?j<=se:Z===">"?j>se:Z==="<"?j<se:!0},S;if(G.key==="code")S=q.displayMessage;else if(G.key==="module")S=q.module;else if(G.key==="status")S=q._status;else if(G.key==="url")S=q._url;else if(G.key==="repo")S=q._repoId;else if(G.key==="level")S=q.level;else continue;if(S==null||!M(S,G.val,G.op))return!1}return!(U.free&&((q.displayMessage||"")+" "+(q.module||"")+" "+(q._url||"")+" "+JSON.stringify(q.raw||[])).toLowerCase().indexOf(U.free)===-1)}function w(){let q=C(e.query.search||"");e.parsedFilterCount=q.filters.length;let U=e.query.bucket,G=e.entries.filter(Z=>U&&Z._bucket!==U?!1:N(Z,q)),M=e.query.group;if(M){let Z=te=>JSON.stringify(M==="module"?[te.module,te._bucket]:[te.raw?.[0]?.service||"unknown",te.module,te.displayMessage||te.message||"_",te._bucket,te._status]),j=new Map;for(let te of G){let me=Z(te);if(j.has(me)){let Ce=j.get(me);Ce.count++,Ce._related.push(te),new Date(te.ts)>new Date(Ce.ts)&&(Ce.ts=te.ts,Ce._url=te._url,Ce._status=te._status),new Date(te.ts)<new Date(Ce._firstSeen)&&(Ce._firstSeen=te.ts)}else{let Ce=Object.assign({},te);Ce._key=`${M}:${me}`,Ce._related=[te],Ce._firstSeen=te.ts,Ce._lastHourCount=0,Ce.count=1,j.set(me,Ce)}}let se=Date.now()-3600*1e3;for(let te of j.values())te._lastHourCount=te._related.filter(me=>new Date(me.ts).getTime()>=se).length;G=Array.from(j.values())}else G=G.map((Z,j)=>(Z._key="row:"+j+":"+Z.ts,Z._related=[Z],Z._firstSeen=Z.ts,Z._lastHourCount=0,Z.count=1,Z));let S=Z=>({error:0,warn:1,info:2})[Z._bucket]??1;e.query.sort==="count"?G.sort((Z,j)=>S(Z)-S(j)||j.count-Z.count||new Date(j.ts)-new Date(Z.ts)):G.sort((Z,j)=>S(Z)-S(j)||new Date(j.ts)-new Date(Z.ts)),e.visible=G;let L=!!(e.query.bucket||(e.query.search||"").trim()),X=!L&&(e.stats?.severity?.error||0)>0&&!G.some(Z=>Z._bucket==="error")&&e.entries.length<1500;(L&&!G.length||X)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,P(!0))}function P(q){if(q&&e.redisLoading)return;let U=++o;e.redisLoading=!0;let G=q?e.redisNextOffset||e.entries.length:0,M=q?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:G,limit:M}}).then(S=>{if(p||U!==o)return;e.redisLoading=!1;let L=(S.data.entries||[]).map(k);e.entries=q?e.entries.concat(L):L,e.redisRedacted=(q&&e.redisRedacted||0)+(S.data.redactedEntries||0),e.redisNextOffset=S.data.nextOffset??G+(S.data.entries||[]).length,e.available=!!S.data.available,e.redisCollecting=S.data.redisCollecting!==!1,e.cap=S.data.max||e.cap,e.total=S.data.total||e.entries.length,e._autoLoading=!1,w()},()=>{p||U!==o||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>P(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function O(q=!1){if(q&&u)return;let U=++r;u=!0,t.get("/api/admin/errors/stats").then(G=>{if(p||U!==r)return;u=!1;let M=G.data||{};e.redisStatsState=M.available===!1?"unavailable":"ready";let S=M.prev24h?Math.round((M.last24h-M.prev24h)/M.prev24h*100):0;e.stats={last24h:M.last24h||0,prev24h:M.prev24h||0,delta:S,severity:M.severity||{error:0,warn:0,info:0},unique:M.unique||{error:0,warn:0,info:0},buckets:M.buckets||[],dropped:M.dropped||0},w()},()=>{!p&&U===r&&(u=!1,e.redisStatsState="unavailable")})}function F(q=!1){(!q||!e.redisLoading)&&P(),O(q)}e.barPx=(q,U)=>{let G=e.stats.buckets||[],M=0,S=0;for(let j of G)M=Math.max(M,(j.error||0)+(j.warn||0)),S=Math.max(S,j.info||0);let L=q[U]||0;if(!L)return 0;if(U==="info")return S?Math.max(2,Math.round(L/S*(M?16:60))):0;let X=(q.error||0)+(q.warn||0),Z=Math.round(X/M*44);return Math.max(4,Math.round(L/X*Z))},e.bucketTitle=q=>`${new Date(q.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${q.error||0} err \xB7 ${q.warn||0} warn \xB7 ${q.info||0} info`,e.toggle=async(q,U)=>{h=U||document.activeElement,m=e.captureErrorScroll(h),e.historySelected=q,e.historyView="overview",e.expanded={[q._key]:!0},await We(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=q=>{if(e.historyView="timeline",e.traceSelection)return;let U=["requestId","jobId"].find(G=>e.logTraceId(e.historySelected,G));U&&e.lookupTrace(U,e.logTraceId(e.historySelected,U),q,e.historySelected)},e.closeHistory=async()=>{let q=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await We(),(h?.isConnected?h:[...document.querySelectorAll("[data-history-key]")].find(G=>G.dataset.historyKey===q))?.focus({preventScroll:!0}),e.restoreError
Line truncated
|
||||
`)],{type:"text/csv;charset=utf-8"}),M=URL.createObjectURL(G),S=document.createElement("a");S.href=M,S.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(M)};function H(q){e.copyHint=`${q} copied`,d.timeout(()=>{e.copyHint=""},1500)}e.copyJson=q=>{navigator.clipboard.writeText(q._rawJson).then(()=>H("JSON"))},e.copyCurl=q=>{if(!q._url)return;let G=`curl -X ${q._method||"GET"} '${window.location.origin}${q._url}'`;navigator.clipboard.writeText(G).then(()=>H("curl"))},F();let Y=i(()=>{e.query.autoRefresh&&F(!0)},15e3);e.on("dispose",()=>{p=!0,o++,r++,i.cancel(Y)}),e.watch("query.search",w),e.watch("query.bucket",w),e.watch("query.sort",w),e.watch("query.group",w)},np=function(e,t,s,i){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null){s.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.cacheReport=null,e.cacheError=null,e.cacheMinutes=60,e.cacheTraffic="all",e.ovView=["performance","cache"].includes((window.location.hash||"").slice(1))?window.location.hash.slice(1):"summary",e.setOvView=function(w){e.ovView=w;try{window.history.replaceState(null,"",w==="summary"?window.location.pathname:"#"+w)}catch{}};var o=!1;e.loadCache=function(){if(!o){o=!0;var w=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:w}}).then(function(P){w===e.cacheMinutes&&(e.cacheReport=P.data,e.cacheError=P.data.available?null:P.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){o=!1,w!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(w){return e.cacheTraffic==="all"||w.traffic===e.cacheTraffic})},e.cacheRate=function(w,P){var O=e.cacheRows(),F=function(q){return O.filter(function(U){return U.name===q}).reduce(function(U,G){return U+G[P]},0)},H=F(w+"_hit"),Y=F(w+"_miss");return H+Y?(100*H/(H+Y)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(w){return w.replaceAll("_"," ")},e.cacheP95=function(w){var P=0,O=e.cacheReport?.latencyBucketsMs||[];if(!w.count)return"No samples";if(!w.ms)return"Not timed";for(var F=0;F<=O.length;F++)if(P+=w["b"+F]||0,P>=Math.ceil(w.count*.95))return F<O.length?"\u2264 "+jn(O[F]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let w=e.data&&e.data.system||{},P=[["Memory",w.memPercent],["Disk",w.diskPercent]].filter(([,F])=>F>90);return P.length?P.map(([F,H])=>F+" is at "+H+"%").join(" and ")+". New anonymizations may fail until "+(P.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(w){return w==null?"":jn(w)},e.latencyBound=function(w,P){return w.count?w[P]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(w[P]):"No samples"},e.firstByteBound=function(w){return e.latencyBound({count:w.firstByteCount,p95UpperMs:w.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(w){return Math.max(0,Math.round((Date.now()-w.sampledAt)/1e3))},e.peakRss=function(w){return(e.performance.runtimeSeries||[]).filter(function(P){return P.instance===w.instance}).reduce(function(P,O){return Math.max(P,O.rss)},w.memory.rss)},e.performanceWarning=function(w){return e.sampleAge(w)>45||w.droppedBatches||w.droppedMetrics||w.sockets?.closeWait>0||w.eventLoop?.p95Ms>100||w.memoryLimitBytes&&w.memory.rss>w.memoryLimitBytes*.8};var r=!1;e.loadPerformance=function(){var w=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==w&&(e.performance=null),!r&&(r=!0,t.get("/api/admin/performance",{params:{minutes:w}}).then(function(P){w===e.performanceMinutes&&(e.performance=P.data,e.performanceError=P.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){w===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){r=!1,w!==e.performanceMinutes&&e.loadPerformance()}))};function u(w){if(w==null)return"\u2014";for(var P=["B","KB","MB","GB","TB"],O=0,F=w;F>=1024&&O<P.length-1;)F/=1024,O++;return F.toFixed(O>0?1:0).replace(/\.0$/,"")+" "+P[O]}e.humanBytes=u;function p(w){if(!w)return"\u2014";var P=Math.floor(w/86400),O=Math.floor(w%86400/3600),F=Math.floor(w%3600/60);return P>0?P+"d "+(O<10?"0":"")+O+"h":O>0?O+"h "+(F<10?"0":"")+F+"m":F+"m"}e.humanDuration=p;function d(w){return w==null?"\u2014":w>=1e6?(w/1e6).toFixed(1)+"M":w>=1e3?(w/1e3).toFixed(1)+"K":String(w)}e.humanNum=d,e.queueTotal=function(w){return w?(w.waiting||0)+(w.active||0)+(w.delayed||0)+(w.failed||0):0},e.statusCount=function(w){if(!e.data||!e.data.repos)return 0;for(var P=e.data.repos.statusBreakdown||[],O=0;O<P.length;O++)if(P[O]._id===w)return P[O].count;return 0},e.barPct=function(w){var P=e.data&&e.data.repos?e.data.repos.total:0;if(!P)return 0;var O=[w];w==="expired"&&O.push("expiring"),w==="removed"&&
Line truncated
|
||||
`)},e.tipSide=b=>{let C=(e.summary?.series||[]).length;return C<3?"":b<C/4?"tip-start":b>=C*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((b,C)=>b+e.bucketTotal(C),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(b=>b.active||b.allTimeSales||b.sales),e.familyLabel=b=>(Pr.find(C=>C.id===b)||{}).label||"",e.familyPlans=b=>(e.summary?.plans||[]).filter(C=>C.family===b),e.familySum=(b,C)=>e.familyPlans(b).reduce((N,w)=>N+(w[C]||0),0),e.familyMoney=(b,C,N)=>{if(!e.revenueOn())return"\u2014";let w=e.familyPlans(b);return w.some(P=>P[N]===!1)?"Incomplete":e.moneyText(w.reduce((P,O)=>r(P,O[C]),{}))},e.planTotals=()=>{let b=C=>(e.summary?.plans||[]).reduce((N,w)=>N+(w[C]||0),0);return{active:b("active"),sales:b("sales"),allTimeSales:b("allTimeSales")}},e.webhookState=()=>{let b=e.summary?.webhooks;return b?b.failed||b.reconciliationFailed?"bad":b.oldestPendingSeconds>900||b.unreviewedRevocations?"warn":"ok":"ok"},e.age=b=>b?jn(b*1e3):"\u2014";let u=0;e.loadSummary=()=>{let b=++u;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(C=>{if(b!==u)return;e.summaryLoading=!1;let N=C.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},C=>{b===u&&(e.summaryLoading=!1,e.summaryError=C&&C.data&&C.data.error||"Could not load billing figures.")})},e.setPeriod=b=>{if(e.period!==b){e.period=b;try{localStorage.setItem("admin.billing.period",b)}catch{}e.loadSummary()}},e.grants=[],e.total=-1,e.totalPage=0,e.stateCounts={},e.statuses=[],e.grantsError=null,e.filtersOpen=!1,e.query={page:1,limit:25,search:"",plan:"",status:"",state:"",period:"",sort:"purchasedAt",direction:"desc"};let p=s.search();p.search&&(e.query.search=p.search),e.stateView=()=>e.query.state||"all",e.setStateView=b=>{e.query.state=b==="all"?"":b,e.query.page=1},e.stateCount=b=>b==="all"?["active","expired","revoked"].reduce((C,N)=>C+(e.stateCounts[N]||0),0):e.stateCounts[b]||0,e.sortBy=b=>{e.query.sort===b?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=b,e.query.direction="desc"),e.query.page=1},e.sortIcon=b=>e.query.sort===b?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let d=()=>{let b=[];e.query.plan&&b.push({key:"plan",label:"Plan",value:e.planName(e.query.plan)}),e.query.status&&b.push({key:"status",label:"Stripe status",value:e.query.status.replace(/_/g," ")}),e.query.period&&b.push({key:"period",label:"Started",value:"last "+((e.periods.find(C=>C.id===e.query.period)||{}).label||e.query.period)}),e.chips=b};e.clearFilter=b=>{e.query[b]="",e.query.page=1},e.filterPlan=b=>{Object.assign(e.query,{plan:b,page:1});let C=document.getElementById("bl-grants");C&&C.scrollIntoView&&C.scrollIntoView({behavior:"smooth",block:"start"})},e.clearFilters=()=>Object.assign(e.query,{search:"",plan:"",status:"",state:"",period:"",page:1}),e.hasFilters=()=>!!(e.query.search||e.query.plan||e.query.status||e.query.state||e.query.period),e.filterCount=()=>["plan","status","period"].filter(b=>e.query[b]).length,e.amountText=b=>{if(!b.amount)return"\u2014";let C=gs({[b.amount.currency]:b.amount.value})[0]||"\u2014";if(!b.amount.interval)return C;let N=b.amount.intervalCount>1?b.amount.intervalCount+" "+b.amount.interval+"s":b.amount.interval;return C+" / "+N},e.amountTitle=b=>b.amount?"Stripe list price"+(b.pack?" of the whole pack":""):{stripe_not_configured:"Revenue unavailable: Stripe is not configured on this server.",unresolved:"Revenue unavailable: this Stripe price could not be looked up.",unrecorded:"Revenue unavailable: no sale price was recorded for this subscription."}[b.amountMissing]||"Revenue unavailable.",e.endText=b=>{if(b.never)return"Never ends";if(!b.until)return"\u2014";let C=kr(b.until);return b.state!=="active"?(new Date(b.until)<new Date?"Ended ":"Ends ")+C:b.subscription?(b.cancelAtPeriodEnd?"Ends ":"Renews ")+C:"Until "+C},e.packNote=b=>{let C=(b.parts||[]).find(N=>N.planId==="author_pass");return!b.pack||!C||!C.until?"":(new Date(C.until)<new Date?"Updates ended ":"Updates until ")+kr(C.until)};let h={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=b=>(b.parts||[]).map(C=>h[C.planId]||e.planName(C.planId)).join(", ").replace(/^./,C=>C.toUpperCase()),e.packPartsTitle=b=>"Paper pack: "+(b.parts||[]).map(C=>e.planName(C.planId)).join(", "),e.statusText=b=>(b.status||"unknown").replace(/_/g," "),e.revocationText=b=>b==="dispute"?"Disputed":b==="full_refund"?"Refunded":"Revoked",e.scopeHref=b=>b?.kind==="repo"?"/admin/repositories?search="+encodeURIComponent(b.id):b?.kind==="conference"?"/conference/"+encodeURIComponent(b.id):null;let m=0;function y(){let b=++m;e.grantsError=null;let C=Object.fromEntries(Object.entries(e.query).filter(([,N])=>N!==""&&N!=null));t.get("/api/admin/billing/grants",{params:C}).then(N=>{b===m&&(
Line truncated
|
||||
`)},bl=class{constructor(t){lt(this,"gen");lt(this,"threads",[]);lt(this,"match",!1);lt(this,"runs",[]);lt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},wp=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((s,i)=>s!==t.ids[i])?!1:e.runs.every(s=>t.runs.some(i=>i.neg===s.neg&&wp(i.state,s.state))),fp=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),ys,Qn,wl,kl,ei=class{constructor(t,s,i){ze(this,Qn);lt(this,"dots");lt(this,"dotStart");ze(this,ys);this.dots=t,this.dotStart=s,Ge(this,ys,i)}state(){return new bl(++ce(this,ys).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(yl.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!He(this,Qn,wl).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,o);return;case"neg":if(!He(this,Qn,wl).call(this,t,s))return;let r=this.state();return this.add(r,s.sub,i,!1),this.done(r),this.addRun(t,{t:"run",neg:s,state:r},i,o);case"star":if(this.restricted(i,o))return;He(this,Qn,kl).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:He(this,Qn,kl).call(this,t,s)}}addRun(t,s,i,o){for(let r of t.runs)if(r.neg===s.neg&&wp(r.state,s.state))return;t.runs.push(s),s.state.match||this.add(t,s.neg.next,i,o)}step(t,s,i,o){let r=this.state();for(let u of t.threads)switch(u.t){case"lit":El(u,s)&&this.add(r,u.next,i+1,o);break;case"any":this.restricted(i,o)||this.add(r,u.next,i+1,o);break;case"class":!this.restricted(i,o)&&u.re.test(s)&&this.add(r,u.next,i+1,o);break;case"star":this.restricted(i,o)||this.add(r,u,i+1,o)}if(!this.restricted(i,o))for(let u of t.runs){if(u.state.dead){this.addRun(r,u,i+1,o);continue}let p=this.step(u.state,s,i,!1);this.addRun(r,{t:"run",neg:u.neg,state:p},i+1,o)}return this.done(r)}};ys=new WeakMap,Qn=new WeakSet,wl=function(t,s){let{seen:i}=ce(this,ys);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},kl=function(t,s){let{has:i}=ce(this,ys);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var kp=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${kp(i.state)})`);return`${t}|${s.sort().join("|")}`},Xy=1<<18,xs,eo,Wn,bs,Kn,Yn,Xn,cn,Sl,Mr,Cp,Cl=class{constructor(t,s){ze(this,cn);ze(this,xs);ze(this,eo,new Map);ze(this,Wn,0);ze(this,bs);ze(this,Kn);ze(this,Yn);ze(this,Xn);Ge(this,xs,t),Ge(this,Yn,new ei(!1,!1,s)),Ge(this,Xn,new ei(!1,!0,s))}start(t){if(t){if(ce(this,Kn))return ce(this,Kn);let i=ce(this,Xn).state();return ce(this,Xn).add(i,ce(this,xs),0,!0),Ge(this,Kn,He(this,cn,Sl).call(this,ce(this,Xn).done(i)))}if(ce(this,bs))return ce(this,bs);let s=ce(this,Yn).state();return ce(this,Yn).add(s,ce(this,xs),0,!0),Ge(this,bs,He(this,cn,Mr).call(this,ce(this,Yn).done(s)))}next(t,s){let i=s.charCodeAt(0),o=i<128?void 0:t.next.get(s);if(o)return o;let r=t===ce(this,Kn)?He(this,cn,Mr).call(this,ce(this,Xn).step(t.state,s,0,!0)):He(this,cn,Mr).call(this,ce(this,Yn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),Ge(this,Wn,ce(this,Wn)+128)),t.ascii[i]=r):t.next.set(s,r),ed(this,Wn)._++,r}};xs=new WeakMap,eo=new WeakMap,Wn=new WeakMap,bs=new WeakMap,Kn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,cn=new WeakSet,Sl=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},Mr=function(t){let s=kp(t),i=ce(this,eo).get(s);if(i)return i;ce(this,Wn)>Xy&&He(this,cn,Cp).call(this);let o=He(this,cn,Sl).call(this,t);return ce(this,eo).set(s,o),Ge(this,Wn,ce(this,Wn)+(s.length+1)),o},Cp=function(){ce(this,eo).clear(),Ge(this,Wn,0),Ge(this,bs,void 0),Ge(this,Kn,void 0)};var Jy=e=>{let t=[];for(let s=e;s.t!=="match";s=s.next){if(s.t==="split"||s.t==="neg")return;t.push(s)}return t},Qy=(e,t,s,i)=>{let o=0,r=s,u=-1,p=0;for(;r<i;){let d=e[o];if(d?.t==="star"){u=o++,p=r;continue}let h=t[r];if(d&&(d.t==="any"||d.t==="lit"&&El(d,h)||d.t==="class"&&d.re.test(h))){o++,r++;continue}if(u===-1)return!1;o=u+1,r=++p}for(;e[o]?.t==="star";)o++;return o===e.length},Sp=e=>{let t=0,s=0;for(let i of e){let[o,r]=Zy(i);t+=o,s+=r}return[t,s]},Zy=e=>{if(e.t==="star")return[0,1/0];if(e.t!=="ext")return[1,1];if(e.type==="!")return[0,1/0];let t=e.alts.map(Sp),s=Math.min(...t.map(r=>r[0])),i=Math.max(...t.map(r=>r[1])),o=i===0?0:1/0;return e.type==="@"?[s,i]:e.type==="?"?[0,i]:e.type==="*"?[0,o]:[s,o]},mp=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!El(e[i],t[s+i]))return!1;return!0},xy=/[/\ud800-\udfff]/,eb=/[\ud800-\udfff]/,Or=e=>eb.test(e)?[...e]:e,hp=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Jn,to,ws,Vr,ks,ni,Lr,Cs,si,oi,ii,qn,En,no,so,ri,qr,un,Ss,xo,ti=class{constructor(t,s={}){ze(this,Ss);lt(this,"pattern");lt(this,"options");ze(this,Jn);ze(this,to);ze(this,ws);ze(this,Vr);ze(this,ks);ze(this,ni,!1);ze(this,Lr);ze(this,Cs);ze(this,si,!1);ze(this,oi,0);ze(this,ii,1/0);ze(this,qn,[]);ze(this,En,[]);ze(this,no);ze(this,so);ze(this,ri,!1);ze(this,qr);ze(this,un);if(t.includes
Line truncated
|
||||
`).forEach((s,i)=>{let{term:o}=ql(s.trim());if(!o)return;let r=[];for(let u=0;u<o.length;u++){if(o[u]==="\\"){u++;continue}_p.has(o[u])&&!r.includes(o[u])&&r.push(o[u])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function zp(e,t){let s=String(e||"").split(`
|
||||
`),i=s[t];if(i===void 0)return e;let{term:o}=ql(i.trim());if(!o)return e;let r="";for(let p=0;p<o.length;p++){if(o[p]==="\\"){r+=o.slice(p,p+2),p++;continue}r+=_p.has(o[p])||o[p]==="."?"\\"+o[p]:o[p]}let u=i.indexOf(o);return s[t]=i.slice(0,u)+r+i.slice(u+o.length),s.join(`
|
||||
`)}var ss={VIEWER_ERRORS:{title:"Content could not be loaded",access_title:"GitHub access needs attention",reader_help:"Reading this repository? You do not need to sign in. Try again after the owner restores access, or let them know this anonymous link is unavailable.",owner_help:"Own this repository? If your GitHub account was suspended or recently recovered, sign in to Anonymous GitHub again and check the GitHub connection and repository permissions in your dashboard. Then retry this page. Keep the existing anonymous URL; do not delete the repository to restore access.",retry:"Try again",dashboard:"Open owner dashboard"},ERRORS:{cache_busy:"Downloads are busy. Please try again shortly.",invalid_sort:"The selected sort order is invalid.",invalid_cursor:"This project page is no longer valid. Reload the list.",repository_changed:"The repository changed while processing. Please retry.",repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"We could not load this content. Try again. If it still fails, contact support with the anonymous URL and the time of the error.",unreachable:"The service could not complete this request. Wait a moment and try again.",request_error:"The connection was interrupted. Check your internet connection and try again.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"Anonymous GitHub cannot access the source repository on GitHub. It may be private, unavailable, or require the owner to reconnect GitHub.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub temporarily blocked the request because we hit its API rate limit. Wait a few minutes and try again. If the problem persists and you contact GitHub Support, include the request ID and timestamp shown in GitHub's response (the 'X-GitHub-Request-Id' header).",rate_limited:"GitHub API rate limit reached. The repository will be available shortly \u2014 please wait a moment and refresh.",repoId_already_used:"The repository ID is already used.",invalid_repoId:"The format of the repository ID is invalid.",unsupported_source:"The repository source type is not supported.",branch_not_specified:"The branch is not specified.",branch_not_found:"The branch of the repository cannot be found.",commit_not_specified:"A commit must be specified.",commit_not_found:"The configured commit no longer exists in the source repository. It may have been force-pushed, rebased, or removed.",repo_renamed:"The source repository appears to have been renamed or moved on GitHub. Please refresh and try again \u2014 the cached name has been updated.",invalid_commit_format:"The commit hash format is invalid. It must be a hexadecimal string.",pull_request_not_found:"The requested pull request could not be found.",pull_request_expired:"This pull request has expired and is no longer available.",pull_request_not_ready:"This pull request is still being prepared. Please t
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,y.options),p.restore()})}d();let h=null;e.saveDefault=m=>{if(m&&m.preventDefault&&m.preventDefault(),e.saving)return;let y=p.checkpoint(),v={terms:e.terms.split(`
|
||||
`).map(k=>k.trim()).filter(k=>k.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",v).then(()=>{p.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",h&&i.cancel(h),h=i(()=>{e.message=null},2500)},k=>{e.saving=!1;let b=k&&k.data&&k.data.error,C="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+b),s("ERRORS.unknown_error")]).then(([N,w])=>{e.error=b&&N!==w?N:C},()=>{e.error=C})})},e.deleteAccount=()=>{e.deletingAccount||!e.confirmDeleteAccount||e.deleteUsername!==e.user?.username||(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},Yp=function(e,t,s){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(i=>{s.url("/dashboard")},i=>{e.error=i.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},Xp=function(e,t,s,i,o){e.user&&!e.user.status&&s.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&s.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(p){e.feature=p},e.featureHref=function(p){return p.needsUser&&!e.user?"/signin":p.href},e.featureTarget=function(p){return p.needsUser&&!e.user?"_self":p.target||void 0},e.featureKeydown=function(p,d){let h={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[p.key];if(h===void 0)return;p.preventDefault();let m=e.features.length,y=h==="first"?0:h==="last"?m-1:(d+h+m)%m;e.feature=e.features[y].key,o(()=>{let v=i.document.getElementById("feature-tab-"+e.feature);v&&v.focus()})},e.demoText=`# DeepLearnUtils
|
||||
Developed by Jane Smith at MIT CSAIL.
|
||||
See Smith et al., "Attention That Works," 2026.
|
||||
Contact: jane.smith@mit.edu`,e.demoTerms="Jane Smith, Smith, MIT CSAIL, jane.smith@mit.edu",e.demoParts=function(){let p=(e.demoTerms||"").split(/[,\n]/).map(g=>g.trim()).filter(Boolean).sort((g,k)=>k.length-g.length),c=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let v=new RegExp("("+p.map(c).join("|")+")","gi"),h={},y=0;return(e.demoText||"").split(v).filter(g=>g!=="").map(g=>{let k=p.find(w=>w.toLowerCase()===g.toLowerCase());return k?(h[k.toLowerCase()]||(h[k.toLowerCase()]=++y),{text:String(h[k.toLowerCase()]),redacted:!0,original:g}):{text:g}})},e.demoCount=()=>e.demoParts().filter(p=>p.redacted).length,e.cards=[{key:"repositories",total:0,label:"repositories anonymized"},{key:"users",total:0,label:"researchers"},{key:"pageViews",total:0,label:"page views"},{key:"pullRequests",total:0,label:"pull requests"}],e.statsEmpty=()=>!!e.stat&&e.cards.every(p=>!p.total);function r(){t.get("/api/stat/").then(p=>{e.stat=p.data,e.cards[0].total=p.data.nbRepositories,e.cards[1].total=p.data.nbUsers,e.cards[2].total=p.data.nbPageViews,e.cards[3].total=p.data.nbPullRequests}).catch(()=>{})}r();function d(p){let c={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return c;let v=new Array(p.length-1);for(let C=1;C<p.length;C++)v[C-1]=p[C]-p[C-1];let h=v.length,y=Math.max.apply(null,v),g=Math.min.apply(null,v),k=Math.min(0,g),w=y-k||1;c.viewW=h*2,c.bars=new Array(h);for(let C=0;C<h;C++){let N=(v[C]-k)/w,b=Math.max(1.5,N*34);c.bars[C]={x:(C*2+.25).toFixed(2),y:(36-b).toFixed(2),w:"1.5",h:b.toFixed(2)}}if(c.deltaToday=v[h-1],h>=2){let C=v[h-2];C&&(c.pctChange=(c.deltaToday-C)/C*100)}return c.pctAbs=Math.round(Math.abs(c.pctChange)),c.isUp=c.pctChange>=0,c}e.history={repositories:d([]),users:d([]),pageViews:d([]),pullRequests:d([])},t.get("/api/stat/history?days=60").then(p=>{let c=p.data||[];e.history={repositories:d(c.map(v=>v.nbRepositories||0)),users:d(c.map(v=>v.nbUsers||0)),pageViews:d(c.map(v=>v.nbPageViews||0)),pullRequests:d(c.map(v=>v.nbPullRequests||0))}}).catch(()=>{})},dp=function(e,t,s,i,o,r){let d=bt();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),d.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,je(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Ot()(document,"click",E=>{e.quotaExpanded&&!E.target.closest?.(".dashboard-quota")&&(e.quotaExpanded=!1)}),e.filtersExpanded=!1,e.projectView="all",e.selectedProject=null,e.projectName="",e.nameSaving=!1,e.nameError="",e.nameMessage="",e.needsAttention=E=>E.status==="error"||E._broken||c(E.status)==="progress"&&E._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=E=>{e.projectView=E,E==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=E=>{let F=Ma(E?.anonymizeDate||E?.lastView)||"";return/ ago$/.test(F)?"No activity for "+F.replace(/ ago$/,""):"No activity since "+F.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=E=>"project-details-"+encodeURIComponent(E._type+":"+(E._id||E._source||"unknown")),e.showProjectDetails=async E=>{e.selectedProject=E,e.projectName=E.projectName||"",e.nameError="",e.nameMessage="",await je();let F=document.getElementById(e.projectDetailsId(E));F?.focus(),F?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=E=>{e.selectedProject=null,je(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(E._type+":"+E._id)}"]`)?.focus())},e.saveProjectName=async E=>{if(e.nameSaving||!E._id)return;let F=e.projectName.trim();if(F.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let Y=await t.post("/api/user/project-name",{type:E._type,id:E._id,name:F});E.projectName=Y.data.name,E._label=E.projectName||E._fallbackLabel,e.selectedProject===E&&(e.nameMessage=F?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await _(),e.selectedProject===E&&(e.selectedProject=e.items.find(G=>G._type===E._type&&G._id===E._id)||null))}catch{e.selectedProject===E&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async E=>{if(!E._viewUrl||e.copyingId)return;let F=new URL(E._viewUrl,o.location.origin).href;e.copyingId=E._type+":"+E._id;try{await cl(F),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:F})}finally{e.copyingId=null}},e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"Preparing",error:"Error",expired:"Expiring / expired",removed:"Removing / removed"};let p=["queue","download","downloaded","preparing","anonymizing"];function
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,B.options),e.options.expirationDate=B.options&&B.options.expirationDate?new Date(B.options.expirationDate):q(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),S&&S()})}function Ne(S,V,B){e.anonymize&&e.anonymize[S]&&e.anonymize[S].setValidity(V,B)}function tt(S){try{let V=parseGithubUrl(S);if(V&&V.owner&&V.repo)return V.owner+"/"+V.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!i.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||tt(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let S=g();try{let V=await t.get("/github/connections");if(e.githubConnections=V.data,!V.data.appEnabled)return;let B=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":V.data.csrf}});if(!y(S))return;e.error=null,B.data.fullName&&(e._originalFullName=B.data.fullName,e.source.fullName=B.data.fullName,e.sourceUrl="https://github.com/"+B.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(S)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,k(S)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.details=null,e.source.commit="",e.source.branch="",e.readme="",e.branches=[];try{await ce()}catch{}}};function Re(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:tt(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function qe(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function X(){let S=new URLSearchParams(window.location.search).get("billingDraft");if(S){N.restore();try{let B=(await t.get("/api/billing/draft/"+encodeURIComponent(S))).data;if(B.path!==o.path())throw new Error("Wrong task");b=B.values.conference||null;for(let K of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(B.values,K)&&(e[K]=B.values[K]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=B.id,M=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await qe(),o.replace?.(o.path()),!0}catch{e.billingError="The checkout draft could not be restored. Retry by reloading this page; any local draft is still available."}}let V;try{V=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!V||V.path!==o.path()||Date.now()-V.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await qe(),!0):!1;N.restore();for(let B of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(V.draft,B)&&(e[B]=V.draft[B]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await qe(),sessionStorage.removeItem("github-access-draft"),!0}Ze(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&d(X,0),i.repoId&&i.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=i.repoId,t.get("/api/repo/"+e.repoId).then(async S=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(S.data.status),e.githubConnection=S.data.connection||"oauth",e.sourceUrl="https://github.com/"+S.data.source.fullName,e._originalFullName=S.data.source.fullName,e.terms=S.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=S.data.source,e.role=S.data.role||"owner",e._existingNever=S.data.options.expirationMode==="never",e._savedExpirationDate=S.data.options.expirationDate?new Date(S.data.options.expirationDate):null,e.coauthors=S.data.coauthors||[],e._originalBranch=S.data.source.branch,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,e.repositoryID=S.data.source.repositoryID,e._originalRepositoryID=S.data.source.repositoryID,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await X()&&(await Promise.all([ce(),ue()]),No())},()=>{o.url("/404")})),i.pullRequestId&&i.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=i.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async S=>{if(e.githubConnection=S.data.connection||"oauth",e.sourceUrl="https://github.com/"+S.data.source.repositoryFullName+"/pull/"+S.data.source.pullRequestId,e.terms=S.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=S.data.source,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await X())try{await bl()}catch{}},()=>{o.url("/404")})),i.gistId&&i.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=i.gistId,t.get("/api/gist/"+e.gistId).then(async S=>{e.sourceUrl="https://gist.github.com/"+S.data.source.gistId,e.terms=S.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=S.data.source,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await X()&&await wl()},()=>{o.url("/404")}))}),t.get("/github/connections").then(S=>{e.githubConnections=S.data,!i.repoId&&!i.pullRequestId&&!i.gistId&&e.githubConnection===void 0&&S.data.appEnabled&&S.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&qe())}).catch(()=>{}).finally(()=>{!v&&!i.repoId&&!i.pullRequestId&&!i.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(S=!1)=>{let V=++c;e.previousConfigurations=[],e.previousConfigurationId="";let B;try{B=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,fe(),Jt.cancel(),qn.cancel(),Ln.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",Ne("sourceUrl","github",!1);return}let K=C(B),le=S||w===K;w=K,e.sourceUrlError="",Ne("sourceUrl","github",!0),fe();let ye=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let Ge=window.document.getElementById("sourceUrl");if(Ge){try{Ge.setSelectionRange(0,0)}catch{}Ge.scrollLeft=0}},50),ye&&d(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!le&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],le||(e.source={type:"GitHubStream",branch:"",commit:""}),Jt.cancel(),qn.cancel(),Ln.cancel(),Ro.clear(),To.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",Ef(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=le;try{B.gistId&&!B.repo?(e.detectedType="gist",e.source={gistId:B.gistId},await wl()):B.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:B.owner+"/"+B.repo,pullRequestId:B.pullRequestId},await bl()):(e.detectedType="repo",Z(),await Promise.all([ce(),ue()]),No())}catch{}finally{V===c&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let S=e.branches.filter(B=>B.name==e.source.branch)[0];if(!S)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=S.commit),e.readme=S.readme,await ue(),No()}),e.getBranches=async S=>{let V=parseGithubUrl(e.sourceUrl),B=g();try{if(!e.details){await ce(S);return}let K=await t.get(`/api/repo/${V.owner}/${V.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:S===!0||e.reconnectingSource?"1":"0",repositoryID:Re()}});if(!y(B))return;e.branches=K.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let le=e.branches.filter(ye=>ye.name==e.source.branch);le.length>0&&(!(!e.reconnectingSource&&!S&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=le[0].commit),e.readme=le[0].readme,await ue(S))}catch(K){if(!y(B))return;e.branches=[],e.sourceUnreachable=K&&(K.status===404||K.data&&K.data.error==="repo_not_found"),e.details=null,x(K)}finally{k(B)}};async function ce(S=!1){let V=parseGithubUrl(e.sourceUrl),B=g();try{Po(),fe();let K=await t.get(`/api/repo/${V.owner}/${V.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,repositoryID:Re(),force:"1"}});if(!y(B))return;e.details=K.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(S||e.reconnectingSource)}catch(K){if(!y(B))return;throw x(K),K}finally{k(B)}}async function ue(S){if(e.readme&&!S)return e.readme;let V=parseGithubUrl(e.sourceUrl),B=g();try{let K=await t.get(`/api/repo/${V.owner}/${V.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:S===!0?"1":"0",branch:e.source.branch,repositoryID:Re()}});y(B,!0)&&(e.readme=K.data)}catch{y(B,!0)&&(e.readme="")}finally{k(B)}}let me={magicalBraces:!0},be=S=>S.startsWith("/")&&!S.endsWith("/")&&Kn(ko(S.slice(1),me),me)===S.slice(1),Ve=()=>Object.keys(e.preserve.picked).filter(S=>e.preserve.picked[S]).sort().map(S=>"/"+Kn(S,me)),A=S=>"/"+Kn(S,me)+"/**",I=S=>"!/"+Kn(S,me)+"/",U=()=>String(e.preserve.patterns||"").split(`
|
||||
`).map(S=>S.trim()).filter(Boolean),J=null,W=null,ee=new Set,de=0,oe=null,se=()=>!1;function te(){let S=de+"\0"+e.preserve.patterns;if(S!==oe){oe=S;try{se=dl(ll([...Ve(),...U()]))}catch{se=()=>!1}}return se}function we(S){let V=new Map([["",{dirs:[],files:[]}]]);for(let B of S){let K=B.split("/"),le="";for(let ye=0;ye<K.length-1;ye++){let Ge=K.slice(0,ye+1).join("/");V.has(Ge)||(V.set(Ge,{dirs:[],files:[]}),V.get(le).dirs.push(Ge)),le=Ge}V.get(le).files.push(B)}for(let B of V.values())B.dirs.sort();return{files:S,dirs:V,descendants:new Map}}function pe(S){return J.descendants.has(S)||J.descendants.set(S,J.files.filter(V=>V.startsWith(S+"/"))),J.descendants.get(S)}let Ee=S=>te()(S);function Pe(S){let V=pe(S),B=0;for(let K of V)Ee(K)&&B++;return B===0?"none":B===V.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let S=(e.options?.preserveFiles||[]).map(V=>String(V).trim()).filter(Boolean).map(V=>be(V)?ko(V.slice(1),me):V);return S.length?S.slice(0,2).join(", ")+(S.length>2?` and ${S.length-2} more`:""):"None. Every file is redacted."};async function Le(){let S=e.source?.commit;if(!(J&&e.preserve.commit===S)){e.preserve.loading=!0,e.preserve.error="",J=null,W=null;try{let V=parseGithubUrl(e.sourceUrl),B=await t.get(`/api/repo/${V.owner}/${V.repo}/tree`,{params:{commit:S,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Re()}});if(e.source?.commit!==S)return;let K=Array.isArray(B.data.binaryFiles)?B.data.binaryFiles:[];J=fn(we(B.data.files||[])),W=K.length?fn(we([...B.data.files||[],...K])):J,ee=fn(new Set(K)),e.preserve.commit=S,e.preserve.truncated=!!B.data.truncated,e.previewFile||Jt()}catch{e.preserve.error="The file list could not be loaded from GitHub. You can still use patterns.",e.preserve.patternsOpen=!0}finally{e.preserve.loading=!1}}}e.watch("source.commit",S=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&S&&e.sourceUrl&&Le().catch(()=>{})}),e.openPreserveFiles=()=>{let S={},V=[];for(let K of e.options?.preserveFiles||[]){let le=String(K).trim();le&&(!V.length&&be(le)?S[ko(le.slice(1),me)]=!0:V.push(le))}let B={};for(let K of Object.keys(S)){let le=K.split("/");for(let ye=1;ye<le.length;ye++)B[le.slice(0,ye).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:S,expanded:B,patterns:V.join(`
|
||||
`),patternsOpen:V.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),de++,d(()=>{let K=document.getElementById("preserve-files-dialog");K?.showModal&&!K.open&&K.showModal(),document.getElementById("preserve-files-search")?.focus()},0),Le()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=ll([...Ve(),...U()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!J)return[];let S=te(),V=(ye,Ge,Mt)=>{let ft=!!e.preserve.picked[ye],Rt=S(ye);return{kind:"file",path:ye,label:Mt,depth:Ge,state:Rt?"all":"none",locked:!ft&&Rt,note:!ft&&Rt?"matched by a pattern":ft&&!Rt?"excluded by a pattern":""}},B=String(e.preserve.search||"").trim().toLowerCase();if(B)return J.files.filter(ye=>ye.toLowerCase().includes(B)).slice(0,300).map(ye=>V(ye,0,ye));let K=[],le=(ye,Ge)=>{let Mt=J.dirs.get(ye);for(let ft of Mt.dirs){let Rt=!!e.preserve.expanded[ft],jt=U().includes(A(ft));K.push({kind:"dir",path:ft,label:ft.slice(ye?ye.length+1:0)+"/",depth:Ge,open:Rt,state:Pe(ft),locked:!1,note:jt?"whole folder":""}),Rt&&le(ft,Ge+1)}for(let ft of Mt.files)K.push(V(ft,Ge,ft.slice(ye?ye.length+1:0)))};return le("",0),K},e.preserveCount=()=>J?J.files.filter(Ee).length:0,e.togglePreserveDir=S=>{e.preserve.expanded[S]=!e.preserve.expanded[S]},e.togglePreserveFile=S=>{e.preserve.picked[S]=!e.preserve.picked[S],de++},e.togglePreserveFolder=S=>{let V=A(S),B=I(S),K=U().filter(ye=>ye!==V&&ye!==B),le=Pe(S)==="all"||U().includes(V);for(let ye of pe(S))e.preserve.picked[ye]=!1;de++,e.preserve.patterns=(le?K:[...K,V]).join(`
|
||||
`),le&&pe(S).some(Ee)&&(e.preserve.patterns=[...K,B].join(`
|
||||
`))};let Xe=/^readme(\.[^/]*)?$/i,We=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],Ce=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],Fe=S=>{let V=Be(S),B=V.indexOf("."),K=We.indexOf(B===-1?"":V.slice(B).toLowerCase());return K===-1?We.length:K},it=()=>!!J&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!it())return"";for(let S of[".github","","docs"]){let V=(J.dirs.get(S)?.files||[]).filter(B=>Xe.test(Be(B)));if(V.length)return V.sort((B,K)=>Fe(B)-Fe(K)||ve(B,K))[0]}return""},e.readmeName=()=>Be(e.readmePath())||"README.md";let dt={key:null,fn:()=>!1},Pt=()=>{let S=(e.options?.preserveFiles||[]).map(B=>String(B).trim()).filter(Boolean),V=S.join(`
|
||||
`);if(V!==dt.key){let B=()=>!1;try{S.length&&(B=dl(S))}catch{}dt={key:V,fn:B}}return dt.fn};e.pathPreserved=S=>!!S&&Pt()(S),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let S=Pt();if(it()){let V=e.readmePath();return!!V&&S(V)}return Ce.some(V=>S(V))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function wt(){let S={terms:e.terms?e.terms.split(`
|
||||
`):[],filePath:e.previewOpenPath()||"README.md",preserveFiles:e.options.preserveFiles||[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(S.branchName=e.source.branch);try{let V=parseGithubUrl(e.sourceUrl);S.repoName=`${V.owner}/${V.repo}`}catch{}return S}function rt(S,V,B){let K=null,le=0,ye=()=>{if(e.detectedType!==S)return;K&&d.cancel(K);let Ge=++le;e.previewStatus="loading",K=d(()=>{K=null;let Mt=V();if(!Mt){e.previewStatus="idle";return}t.post("/api/anonymize-preview",Mt).then(ft=>{Ge===le&&(B(ft.data,Mt),e.previewStatus="ready")}).catch(()=>{Ge===le&&(e.previewStatus="error")})},200)};return ye.cancel=()=>{le++,K&&d.cancel(K),K=null},e.on("dispose",ye.cancel),ye}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof an!="string"?vl(e.previewFile):Jt()),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()};let Ie=fn(zs(e));Object.defineProperty(e,"previewViewer",{get:()=>Ie}),_a(Ie,e),Object.assign(Ie,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),Ie.preview=!0,Ie.fileSize=S=>S===Ie.filePath&&typeof an=="string"?new Blob([an]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,Ie.openPreserveFiles=()=>e.openPreserveFiles(),Ie.previewPreserved=()=>e.previewPreserved(),Ie.retryContent=()=>e.retryPreview();let rn=S=>ee.has(S)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(S),So=(S="")=>({path:S,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=So();let ss=0,an=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=S=>{if(S=S||"",S&&S===e.readmePath()&&(S=""),ss++,an=null,ri(),Jt.cancel(),e.previewFile=S,e.previewDoc=So(S),Ie.sidebarCollapsed=!0,Ie.content=null,!S){e.readme?Jt():e.previewStatus="idle";return}if(rn(S)){Dr("binary"),e.previewStatus="ready";return}vl(S)};function Ef(){ss++,an=null,e.previewFile="",e.previewDoc=So(),Ie.sidebarCollapsed=!0,Ie.content=null}function vl(S){let V=++ss;an=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let B;try{B=parseGithubUrl(e.sourceUrl)}catch{B=null}if(!B||!e.source?.commit){Object.assign(e.previewDoc,{loading:!1,loadError:"The repository is still loading. Try again in a moment."}),e.previewStatus="error";return}t.get(`/api/repo/${B.owner}/${B.repo}/file`,{params:{commit:e.source.commit,path:S,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Re()},transformResponse:K=>K}).then(K=>{if(V!==ss)return;e.previewDoc.loading=!1;let le=typeof K.headers=="function"&&K.headers("content-type")||"";if(/json/i.test(le)){let ye=null;try{ye=JSON.parse(K.data)}catch{}if(ye&&ye.binary===!0){Dr("binary"),e.previewStatus="ready";return}}an=typeof K.data=="string"?K.data:"",Jt()},K=>{if(V!==ss)return;e.previewDoc.loading=!1;let le=Er(K);if(le==="file_too_big"){Dr("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=Zn.ERRORS[le]||"GitHub did not return this file.",e.previewStatus="error"})}let ii;function ri(){ii&&window.URL.revokeObjectURL(ii),ii=void 0,Ie.url=void 0}e.on("dispose",ri);function Dr(S){ri(),e.previewDoc.note=S,Ie.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),Ie.type=S==="too_big"?"error":"binary",Ie.content=S==="too_big"?"file_too_big":"binary"}function Nf(S){try{let V=parseGithubUrl(e.sourceUrl),B=e.source.branch||e.details&&e.details.defaultBranch||"main",K=S&&S.includes("/")?S.slice(0,S.lastIndexOf("/")+1):"";return`https://github.com/${V.owner}/${V.repo}/raw/${B}/${K}`}catch{return""}}let yl=rt("repo",()=>e.previewFile?typeof an!="string"?null:{content:an,options:wt()}:e.readme?{content:e.readme,options:wt()}:null,S=>{if(typeof S?.content!="string")throw Error("Invalid preview response");ri(),window.URL?.createObjectURL&&(Ie.url=ii=window.URL.createObjectURL(new Blob([S.content],{type:"text/plain"})));let V=e.previewOpenPath()||e.readmeName();Ie.prepareFile(e.previewPathName(V)),Ie.fileBaseUrl=Nf(V),Ie.renderFileContent(S.content,Ie.type,Ie.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=S.content)}),Jt=()=>{e.previewFile&&typeof an!="string"||yl()};Jt.cancel=yl.cancel;let Eo=at(new Map),Ar=new Set,Ir=new Set,is="",rs=null,ai=()=>String(e.terms||"").split(`
|
||||
`).filter(S=>S.trim());function Rf(){rs=null;let S=ai(),V=S.join(`
|
||||
`);V!==is&&(Eo.clear(),Ir.clear(),is=V);let B=[...Ar].filter(K=>!Eo.has(K));if(Ar.clear(),!(!B.length||!S.length))for(let K=0;K<B.length;K+=400){let le=B.slice(K,K+400);t.post("/api/anonymize-preview",{contents:le,options:{terms:S,image:!0,link:!0}}).then(ye=>{if(is!==V||ai().join(`
|
||||
`)!==V)return;let Ge=ye.data?.contents;if(!Array.isArray(Ge)||Ge.length!==le.length)throw Error("Invalid preview response");le.forEach((Mt,ft)=>Eo.set(Mt,typeof Ge[ft]=="string"?Ge[ft]:Mt))}).catch(()=>{is===V&&le.forEach(ye=>Ir.add(ye))})}}e.previewName=S=>{if(!S||!ai().length)return S;if(is===ai().join(`
|
||||
`)){if(Eo.has(S))return Eo.get(S);if(Ir.has(S))return S}return Ar.add(S),rs||(rs=d(Rf,120)),S},e.previewPathName=S=>{S=String(S||"");let V=S.lastIndexOf("/");return V<0?e.previewName(S):e.previewName(S.slice(0,V))+"/"+e.previewName(S.slice(V+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{Ie.repoId=e.repoId||"repository",Ie.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),Ie.paths=Ie.filePath.split("/"),Ie.files=e.previewTreeFiles(),Ie.loadedFolders=Object.fromEntries([...W?.dirs.keys()||[]].map(S=>[e.previewName(S),!0]))},!0),e.on("dispose",()=>{rs&&d.cancel(rs)});function No(){!e.anonymize||!e.anonymize.terms||Jt()}async function bl(){let S=parseGithubUrl(e.sourceUrl),V=g();try{Po(),fe();let B=await t.get(`/api/pr/${S.owner}/${S.repo}/${S.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(V))return;e.details=B.data,e.pullRequestId||(e.pullRequestId=S.repo+"-PR"+S.pullRequestId+"-"+generateRandomId(4))}catch(B){if(!y(V))return;throw x(B),B}finally{k(V)}}let Ro=at(new Map);function Tf(){let S=new Set,V=e.details&&e.details.pullRequest;if(!V)return S;typeof V.title=="string"&&S.add(V.title),typeof V.body=="string"&&S.add(V.body),typeof V.diff=="string"&&S.add(V.diff);let B=V.comments||[];for(let K of B)typeof K.author=="string"&&S.add(K.author),typeof K.body=="string"&&S.add(K.body);return S}let qn=rt("pr",()=>{let S=Tf(),V=Array.from(S);return V.length===0?null:{contents:V,options:wt()}},(S,V)=>{if(!Array.isArray(S?.contents)||S.contents.length!==V.contents.length||S.contents.some(le=>typeof le!="string"))throw Error("Invalid preview response");let B=V.contents,K=new Map;for(let le=0;le<B.length&&le<S.contents.length;le++)K.set(B[le],S.contents[le]);Ro.clear(),K.forEach((le,ye)=>Ro.set(ye,le))});e.anonymizePrContent=function(S){return S&&(Ro.has(S)?Ro.get(S):"")};async function wl(){let S=parseGithubUrl(e.sourceUrl),V=g();try{Po(),fe(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let B=await t.get(`/api/gist/source/${S.gistId}`);if(!y(V))return;e.details=B.data,e.gistId||(e.gistId="gist-"+S.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(B){if(!y(V))return;if(B.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,Ne("sourceUrl","missing",!1);return}if(B.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,Ne("sourceUrl","missing",!1);return}throw x(B),B}finally{k(V)}}let To=at(new Map);function Pf(){let S=new Set,V=e.details&&e.details.gist;if(!V)return S;typeof V.description=="string"&&S.add(V.description),typeof V.ownerLogin=="string"&&S.add(V.ownerLogin);let B=V.files||[];for(let le of B)typeof le.filename=="string"&&S.add(le.filename),typeof le.content=="string"&&S.add(le.content);let K=V.comments||[];for(let le of K)typeof le.author=="string"&&S.add(le.author),typeof le.body=="string"&&S.add(le.body);return S}let Ln=rt("gist",()=>{let S=Pf(),V=Array.from(S);return V.length===0?null:{contents:V,options:wt()}},(S,V)=>{if(!Array.isArray(S?.contents)||S.contents.length!==V.contents.length||S.contents.some(le=>typeof le!="string"))throw Error("Invalid preview response");let B=V.contents,K=new Map;for(let le=0;le<B.length&&le<S.contents.length;le++)K.set(B[le],S.contents[le]);To.clear(),K.forEach((le,ye)=>To.set(ye,le)),Or()});e.anonymizeGistContent=function(S){return S&&(To.has(S)?To.get(S):"")},e.previewGistFiles=[];function Or(){let S=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=S.map(V=>({filename:e.anonymizeGistContent(V.filename),content:e.anonymizeGistContent(V.content),language:V.language}))}e.watch("details.gist.files",Or,!0),e.watch("terms",Or);function Df(){let S=e.conference;if(e.conference_data=null,!S)return;let V=S===b||e.isUpdate&&S===e._originalConference;S!==b&&(b=null),t.get("/api/conferences/"+S).then(B=>{e.conference===S&&(e.conference_data=B.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!V&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===S&&(e.conference_data=null)})}function Po(){Ne("repoId","used",!0),Ne("repoId","format",!0),Ne("pullRequestId","used",!0),Ne("pullRequestId","format",!0),Ne("gistId","used",!0),Ne("gistId","format",!0),Ne("sourceUrl","used",!0),Ne("sourceUrl","missing",!0),Ne("sourceUrl","access",!0),Ne("sourceUrl","github",!0),Ne("commit","exists",!0),Ne("conference","activated",!0),Ne("terms","format",!0),e.termHints=[]}function li(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let S=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||S&&S.invalid?(S&&S.setDirty&&S.setDirty(),e.error="Pl
Line truncated
|
||||
`).filter(ye=>ye),connection:e.githubConnection,fullName:`${B.owner}/${B.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(K.options.pageSource=e.details.pageSource),Po();let le=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(le,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},ye=>{if(ye.data){let Ge=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(ye.data.error);Ge||r("ERRORS."+ye.data.error).then(Mt=>{e.error=Mt},console.error),di(ye.data.error),Ge&&(ye.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,je(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{V.disabled=!1})},e.anonymizeGist=S=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(li())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let V=S.currentTarget||S.target.closest?.("button")||S.target;V.disabled=!0;let B=parseGithubUrl(e.sourceUrl),K={gistId:e.gistId,terms:e.terms.trim().split(`
|
||||
`).filter(ye=>ye),source:{gistId:B.gistId},options:e.options,conference:e.conference};Po();let le=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(le,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},ye=>{ye.data&&(r("ERRORS."+ye.data.error).then(Ge=>{e.error=Ge},console.error),di(ye.data.error))}).finally(()=>{V.disabled=!1})},e.anonymizePullRequest=S=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(li())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let V=S.currentTarget||S.target.closest?.("button")||S.target;V.disabled=!0;let B=parseGithubUrl(e.sourceUrl),K={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
|
||||
`).filter(ye=>ye),source:{repositoryFullName:`${B.owner}/${B.repo}`,pullRequestId:B.pullRequestId},options:e.options,conference:e.conference};Po();let le=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(le,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},ye=>{ye.data&&(r("ERRORS."+ye.data.error).then(Ge=>{e.error=Ge},console.error),di(ye.data.error))}).finally(()=>{V.disabled=!1})},e.watch("conference",()=>{Df()}),e.termHints=[],e.matchTermAsWritten=S=>{e.terms=tp(e.terms,S)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&Jt()}),e.watch("terms",()=>{e.termHints=ep(e.terms),e.detectedType==="repo"&&No(),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()}),e.watch("options.image",()=>{e.detectedType==="repo"&&No(),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()}),e.watch("options.link",()=>{e.detectedType==="repo"&&No(),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()}),e.watch("details",()=>{e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()},!0)},pl=function(e,t,s,i,o,r){_a(e);let d=bt();Rr();let p=Ot(),c=0,v=null,h=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){v&&(v.resolve(),v=null),h&&(d.timeout.cancel(h),h=null)}let g=!1;e.on("dispose",()=>{g=!0,c++,y(),k&&k.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,p(document,"click",O=>{e.symbolsOpen&&!O.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!O.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!O.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&O.target.isConnected&&!O.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!O.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!O.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",O=>{O.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(O.ctrlKey||O.metaKey)&&!O.altKey&&O.key&&O.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(O.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(O){if((O.metaKey||O.ctrlKey)&&O.key==="k"){O.preventDefault();var L=document.querySelector(".tree-search-input");L&&(L.focus(),L.select())}});var k=null;e.onFileSearchChange=function(){k&&(k.resolve(),k=null);let O=e.fileSearchQuery;if(!O||O.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let L=r.defer();k=L,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(O)}`,{timeout:L.promise}).then(function(E){if(!(g||k!==L)){k=null,e.fileSearchLoading=!1;var F={};e.files.forEach(function(qe){F[(qe.path||"")+"/"+qe.name]=!0});for(var Y=[],G={},Z=0;Z<E.data.length;Z++){var ie=E.data[Z];if(ie.path)for(var x=ie.path.split("/"),fe="",ve=0;ve<x.length;ve++){var Be=fe;fe=fe?fe+"/"+x[ve]:x[ve];var He=Be+"/"+x[ve];!F[He]&&!G[He]&&(G[He]=!0,Y.push({name:x[ve],path:Be}))}}Y.sort(function(qe,X){return(qe.path||"").split("/").length-(X.path||"").split("/").length}),Y.length>0&&e.files.push.apply(e.files,Y);for(var Ze=[],Ne=0;Ne<E.data.length;Ne++){var tt=E.data[Ne],Re=(tt.path||"")+"/"+tt.name;!F[Re]&&tt.size!=null&&(Ze.push(tt),F[Re]=!0)}Ze.length>0&&e.files.push.apply(e.files,Ze),e.fileSearchResults=E.data}},function(){!g&&k===L&&(k=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(O,L){if(e.repoId!=i.repoId)return z();if((i.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=i.path||"",e.paths=e.filePath.split("/").filter(E=>E&&E.trim().length>0),q();for(let E=0;E<e.paths.length-1;E++){let F=E>0?e.paths.slice(0,E).join("/"):"";e.files.some(G=>G.path===F)||e.getFiles(F)}}});function w(){if(e.paths[0]!="")return;let O=["readme.md","readme.txt","readme.org","readme.1st","readme"],L={};for(let F of e.files)F.name.toLowerCase().indexOf("readme")>-1&&(L[F.name.toLowerCase()]=F.name);let E=null;for(let F of O)if(L[F]){E=F;break}if(!E&&Object.keys(L).length>0&&(E=Object.keys(L)[0]),E){let F=s.url();F[F.length-1]!="/"&&(F+="/"),s.url(F+encodePathForUrl(L[E]))}}e.fileCounts=null;let C=0,N=new Set,b=!1;e.getFiles=function(O,L=!1){let E=e.repoId,F=C;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(O)}&v=${e.options.lastUpdateDate}`).then(function(Y){if(g||E!==e.repoId||F!==C)return[];let G=O||"";return e.files=e.files.filter(Z=>Z.path!==G),e.files.push(...Y.data),e.loadedFolders={...e.loadedFolders,[G]:!0},P(G,F),Y.data},function(Y){if(g||E!==e.repoId||F!==C)return[];L||(e.type="error",e.content=Er(Y),e.files=[])})};function P(O,L){if(b||N.has(O))return;N.add(O);let E=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(O)}`).then(function(F){g||E!==e.repoId||L!==C||(e.fileCounts={...e.fileCounts,...F.data})},function(){g||E!=
Line truncated
|
||||
Contact: jane.smith@mit.edu`,e.demoTerms="Jane Smith, Smith, MIT CSAIL, jane.smith@mit.edu",e.demoParts=function(){let p=(e.demoTerms||"").split(/[,\n]/).map(v=>v.trim()).filter(Boolean).sort((v,k)=>k.length-v.length),d=v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let h=new RegExp("("+p.map(d).join("|")+")","gi"),m={},y=0;return(e.demoText||"").split(h).filter(v=>v!=="").map(v=>{let k=p.find(b=>b.toLowerCase()===v.toLowerCase());return k?(m[k.toLowerCase()]||(m[k.toLowerCase()]=++y),{text:String(m[k.toLowerCase()]),redacted:!0,original:v}):{text:v}})},e.demoCount=()=>e.demoParts().filter(p=>p.redacted).length,e.cards=[{key:"repositories",total:0,label:"repositories anonymized"},{key:"users",total:0,label:"researchers"},{key:"pageViews",total:0,label:"page views"},{key:"pullRequests",total:0,label:"pull requests"}],e.statsEmpty=()=>!!e.stat&&e.cards.every(p=>!p.total);function r(){t.get("/api/stat/").then(p=>{e.stat=p.data,e.cards[0].total=p.data.nbRepositories,e.cards[1].total=p.data.nbUsers,e.cards[2].total=p.data.nbPageViews,e.cards[3].total=p.data.nbPullRequests}).catch(()=>{})}r();function u(p){let d={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return d;let h=new Array(p.length-1);for(let C=1;C<p.length;C++)h[C-1]=p[C]-p[C-1];let m=h.length,y=Math.max.apply(null,h),v=Math.min.apply(null,h),k=Math.min(0,v),b=y-k||1;d.viewW=m*2,d.bars=new Array(m);for(let C=0;C<m;C++){let N=(h[C]-k)/b,w=Math.max(1.5,N*34);d.bars[C]={x:(C*2+.25).toFixed(2),y:(36-w).toFixed(2),w:"1.5",h:w.toFixed(2)}}if(d.deltaToday=h[m-1],m>=2){let C=h[m-2];C&&(d.pctChange=(d.deltaToday-C)/C*100)}return d.pctAbs=Math.round(Math.abs(d.pctChange)),d.isUp=d.pctChange>=0,d}e.history={repositories:u([]),users:u([]),pageViews:u([]),pullRequests:u([])},t.get("/api/stat/history?days=60").then(p=>{let d=p.data||[];e.history={repositories:u(d.map(h=>h.nbRepositories||0)),users:u(d.map(h=>h.nbUsers||0)),pageViews:u(d.map(h=>h.nbPageViews||0)),pullRequests:u(d.map(h=>h.nbPullRequests||0))}}).catch(()=>{})},Jp=function(e,t,s,i,o,r){let u=Rt();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),u.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,We(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Lt()(document,"click",S=>{e.quotaExpanded&&!S.target.closest?.(".dashboard-quota")&&(e.quotaExpanded=!1)}),e.filtersExpanded=!1,e.projectView="all",e.selectedProject=null,e.projectName="",e.nameSaving=!1,e.nameError="",e.nameMessage="",e.needsAttention=S=>S.status==="error"||S._broken||d(S.status)==="progress"&&S._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=S=>{e.projectView=S,S==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=S=>{let L=Qa(S?.anonymizeDate||S?.lastView)||"";return/ ago$/.test(L)?"No activity for "+L.replace(/ ago$/,""):"No activity since "+L.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=S=>"project-details-"+encodeURIComponent(S._type+":"+(S._id||S._source||"unknown")),e.showProjectDetails=async S=>{e.selectedProject=S,e.projectName=S.projectName||"",e.nameError="",e.nameMessage="",await We();let L=document.getElementById(e.projectDetailsId(S));L?.focus(),L?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=S=>{e.selectedProject=null,We(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(S._type+":"+S._id)}"]`)?.focus())},e.saveProjectName=async S=>{if(e.nameSaving||!S._id)return;let L=e.projectName.trim();if(L.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let X=await t.post("/api/user/project-name",{type:S._type,id:S._id,name:L});S.projectName=X.data.name,S._label=S.projectName||S._fallbackLabel,e.selectedProject===S&&(e.nameMessage=L?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await F(),e.selectedProject===S&&(e.selectedProject=e.items.find(Z=>Z._type===S._type&&Z._id===S._id)||null))}catch{e.selectedProject===S&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async S=>{if(!S._viewUrl||e.copyingId)return;let L=new URL(S._viewUrl,o.location.origin).href;e.copyingId=S._type+":"+S._id;try{await $l(L),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:L})}finally{e.copyingId=null}},e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"Preparing",error:"Error",expired:"Expiring / expired",removed:"Removing / removed"};let p=["queue","download","downloaded","preparing","anonymizing"];function
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,z.options),e.options.expirationDate=z.options&&z.options.expirationDate?new Date(z.options.expirationDate):q(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),E&&E()})}function De(E,V,z){e.anonymize&&e.anonymize[E]&&e.anonymize[E].setValidity(V,z)}function tt(E){try{let V=parseGithubUrl(E);if(V&&V.owner&&V.repo)return V.owner+"/"+V.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!i.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||tt(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let E=v();try{let V=await t.get("/github/connections");if(e.githubConnections=V.data,!V.data.appEnabled)return;let z=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":V.data.csrf}});if(!y(E))return;e.error=null,z.data.fullName&&(e._originalFullName=z.data.fullName,e.source.fullName=z.data.fullName,e.sourceUrl="https://github.com/"+z.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(E)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,k(E)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.details=null,e.source.commit="",e.source.branch="",e.readme="",e.branches=[];try{await ge()}catch{}}};function at(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:tt(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function Pe(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function Q(){let E=new URLSearchParams(window.location.search).get("billingDraft");if(E){N.restore();try{let z=(await t.get("/api/billing/draft/"+encodeURIComponent(E))).data;if(z.path!==o.path())throw new Error("Wrong task");w=z.values.conference||null;for(let x of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(z.values,x)&&(e[x]=z.values[x]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=z.id,O=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await Pe(),o.replace?.(o.path()),!0}catch{e.billingError="The checkout draft could not be restored. Retry by reloading this page; any local draft is still available."}}let V;try{V=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!V||V.path!==o.path()||Date.now()-V.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await Pe(),!0):!1;N.restore();for(let z of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(V.draft,z)&&(e[z]=V.draft[z]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await Pe(),sessionStorage.removeItem("github-access-draft"),!0}Xe(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&u(Q,0),i.repoId&&i.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=i.repoId,t.get("/api/repo/"+e.repoId).then(async E=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(E.data.status),e.githubConnection=E.data.connection||"oauth",e.sourceUrl="https://github.com/"+E.data.source.fullName,e._originalFullName=E.data.source.fullName,e.terms=E.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=E.data.source,e.role=E.data.role||"owner",e._existingNever=E.data.options.expirationMode==="never",e._savedExpirationDate=E.data.options.expirationDate?new Date(E.data.options.expirationDate):null,e.coauthors=E.data.coauthors||[],e._originalBranch=E.data.source.branch,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,e.repositoryID=E.data.source.repositoryID,e._originalRepositoryID=E.data.source.repositoryID,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),b=C(parseGithubUrl(e.sourceUrl)),!await Q()&&(await Promise.all([ge(),ue()]),Ps())},()=>{o.url("/404")})),i.pullRequestId&&i.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=i.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async E=>{if(e.githubConnection=E.data.connection||"oauth",e.sourceUrl="https://github.com/"+E.data.source.repositoryFullName+"/pull/"+E.data.source.pullRequestId,e.terms=E.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=E.data.source,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),b=C(parseGithubUrl(e.sourceUrl)),!await Q())try{await Jl()}catch{}},()=>{o.url("/404")})),i.gistId&&i.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=i.gistId,t.get("/api/gist/"+e.gistId).then(async E=>{e.sourceUrl="https://gist.github.com/"+E.data.source.gistId,e.terms=E.data.options.terms.filter(V=>V).join(`
|
||||
`),e.source=E.data.source,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),b=C(parseGithubUrl(e.sourceUrl)),!await Q()&&await Ql()},()=>{o.url("/404")}))}),t.get("/github/connections").then(E=>{e.githubConnections=E.data,!i.repoId&&!i.pullRequestId&&!i.gistId&&e.githubConnection===void 0&&E.data.appEnabled&&E.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&Pe())}).catch(()=>{}).finally(()=>{!h&&!i.repoId&&!i.pullRequestId&&!i.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(E=!1)=>{let V=++d;e.previousConfigurations=[],e.previousConfigurationId="";let z;try{z=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,me(),tn.cancel(),Un.cancel(),_n.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",De("sourceUrl","github",!1);return}let x=C(z),fe=E||b===x;b=x,e.sourceUrlError="",De("sourceUrl","github",!0),me();let Ee=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let Je=window.document.getElementById("sourceUrl");if(Je){try{Je.setSelectionRange(0,0)}catch{}Je.scrollLeft=0}},50),Ee&&u(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!fe&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],fe||(e.source={type:"GitHubStream",branch:"",commit:""}),tn.cancel(),Un.cancel(),_n.cancel(),As.clear(),Ds.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",Em(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=fe;try{z.gistId&&!z.repo?(e.detectedType="gist",e.source={gistId:z.gistId},await Ql()):z.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:z.owner+"/"+z.repo,pullRequestId:z.pullRequestId},await Jl()):(e.detectedType="repo",j(),await Promise.all([ge(),ue()]),Ps())}catch{}finally{V===d&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let E=e.branches.filter(z=>z.name==e.source.branch)[0];if(!E)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=E.commit),e.readme=E.readme,await ue(),Ps()}),e.getBranches=async E=>{let V=parseGithubUrl(e.sourceUrl),z=v();try{if(!e.details){await ge(E);return}let x=await t.get(`/api/repo/${V.owner}/${V.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:E===!0||e.reconnectingSource?"1":"0",repositoryID:at()}});if(!y(z))return;e.branches=x.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let fe=e.branches.filter(Ee=>Ee.name==e.source.branch);fe.length>0&&(!(!e.reconnectingSource&&!E&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=fe[0].commit),e.readme=fe[0].readme,await ue(E))}catch(x){if(!y(z))return;e.branches=[],e.sourceUnreachable=x&&(x.status===404||x.data&&x.data.error==="repo_not_found"),e.details=null,te(x)}finally{k(z)}};async function ge(E=!1){let V=parseGithubUrl(e.sourceUrl),z=v();try{Is(),me();let x=await t.get(`/api/repo/${V.owner}/${V.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,repositoryID:at(),force:"1"}});if(!y(z))return;e.details=x.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(E||e.reconnectingSource)}catch(x){if(!y(z))return;throw te(x),x}finally{k(z)}}async function ue(E){if(e.readme&&!E)return e.readme;let V=parseGithubUrl(e.sourceUrl),z=v();try{let x=await t.get(`/api/repo/${V.owner}/${V.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:E===!0?"1":"0",branch:e.source.branch,repositoryID:at()}});y(z,!0)&&(e.readme=x.data)}catch{y(z,!0)&&(e.readme="")}finally{k(z)}}let ye={magicalBraces:!0},Ne=E=>E.startsWith("/")&&!E.endsWith("/")&&Zn(Es(E.slice(1),ye),ye)===E.slice(1),qe=()=>Object.keys(e.preserve.picked).filter(E=>e.preserve.picked[E]).sort().map(E=>"/"+Zn(E,ye)),D=E=>"/"+Zn(E,ye)+"/**",I=E=>"!/"+Zn(E,ye)+"/",B=()=>String(e.preserve.patterns||"").split(`
|
||||
`).map(E=>E.trim()).filter(Boolean),ee=null,J=null,oe=new Set,pe=0,re=null,ae=()=>!1;function ie(){let E=pe+"\0"+e.preserve.patterns;if(E!==re){re=E;try{ae=Ll(Vl([...qe(),...B()]))}catch{ae=()=>!1}}return ae}function Re(E){let V=new Map([["",{dirs:[],files:[]}]]);for(let z of E){let x=z.split("/"),fe="";for(let Ee=0;Ee<x.length-1;Ee++){let Je=x.slice(0,Ee+1).join("/");V.has(Je)||(V.set(Je,{dirs:[],files:[]}),V.get(fe).dirs.push(Je)),fe=Je}V.get(fe).files.push(z)}for(let z of V.values())z.dirs.sort();return{files:E,dirs:V,descendants:new Map}}function he(E){return ee.descendants.has(E)||ee.descendants.set(E,ee.files.filter(V=>V.startsWith(E+"/"))),ee.descendants.get(E)}let Te=E=>ie()(E);function Me(E){let V=he(E),z=0;for(let x of V)Te(x)&&z++;return z===0?"none":z===V.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let E=(e.options?.preserveFiles||[]).map(V=>String(V).trim()).filter(Boolean).map(V=>Ne(V)?Es(V.slice(1),ye):V);return E.length?E.slice(0,2).join(", ")+(E.length>2?` and ${E.length-2} more`:""):"None. Every file is redacted."};async function Be(){let E=e.source?.commit;if(!(ee&&e.preserve.commit===E)){e.preserve.loading=!0,e.preserve.error="",ee=null,J=null;try{let V=parseGithubUrl(e.sourceUrl),z=await t.get(`/api/repo/${V.owner}/${V.repo}/tree`,{params:{commit:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:at()}});if(e.source?.commit!==E)return;let x=Array.isArray(z.data.binaryFiles)?z.data.binaryFiles:[];ee=yn(Re(z.data.files||[])),J=x.length?yn(Re([...z.data.files||[],...x])):ee,oe=yn(new Set(x)),e.preserve.commit=E,e.preserve.truncated=!!z.data.truncated,e.previewFile||tn()}catch{e.preserve.error="The file list could not be loaded from GitHub. You can still use patterns.",e.preserve.patternsOpen=!0}finally{e.preserve.loading=!1}}}e.watch("source.commit",E=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&E&&e.sourceUrl&&Be().catch(()=>{})}),e.openPreserveFiles=()=>{let E={},V=[];for(let x of e.options?.preserveFiles||[]){let fe=String(x).trim();fe&&(!V.length&&Ne(fe)?E[Es(fe.slice(1),ye)]=!0:V.push(fe))}let z={};for(let x of Object.keys(E)){let fe=x.split("/");for(let Ee=1;Ee<fe.length;Ee++)z[fe.slice(0,Ee).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:E,expanded:z,patterns:V.join(`
|
||||
`),patternsOpen:V.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),pe++,u(()=>{let x=document.getElementById("preserve-files-dialog");x?.showModal&&!x.open&&x.showModal(),document.getElementById("preserve-files-search")?.focus()},0),Be()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=Vl([...qe(),...B()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!ee)return[];let E=ie(),V=(Ee,Je,$t)=>{let gt=!!e.preserve.picked[Ee],Dt=E(Ee);return{kind:"file",path:Ee,label:$t,depth:Je,state:Dt?"all":"none",locked:!gt&&Dt,note:!gt&&Dt?"matched by a pattern":gt&&!Dt?"excluded by a pattern":""}},z=String(e.preserve.search||"").trim().toLowerCase();if(z)return ee.files.filter(Ee=>Ee.toLowerCase().includes(z)).slice(0,300).map(Ee=>V(Ee,0,Ee));let x=[],fe=(Ee,Je)=>{let $t=ee.dirs.get(Ee);for(let gt of $t.dirs){let Dt=!!e.preserve.expanded[gt],Xt=B().includes(D(gt));x.push({kind:"dir",path:gt,label:gt.slice(Ee?Ee.length+1:0)+"/",depth:Je,open:Dt,state:Me(gt),locked:!1,note:Xt?"whole folder":""}),Dt&&fe(gt,Je+1)}for(let gt of $t.files)x.push(V(gt,Je,gt.slice(Ee?Ee.length+1:0)))};return fe("",0),x},e.preserveCount=()=>ee?ee.files.filter(Te).length:0,e.togglePreserveDir=E=>{e.preserve.expanded[E]=!e.preserve.expanded[E]},e.togglePreserveFile=E=>{e.preserve.picked[E]=!e.preserve.picked[E],pe++},e.togglePreserveFolder=E=>{let V=D(E),z=I(E),x=B().filter(Ee=>Ee!==V&&Ee!==z),fe=Me(E)==="all"||B().includes(V);for(let Ee of he(E))e.preserve.picked[Ee]=!1;pe++,e.preserve.patterns=(fe?x:[...x,V]).join(`
|
||||
`),fe&&he(E).some(Te)&&(e.preserve.patterns=[...x,z].join(`
|
||||
`))};let xe=/^readme(\.[^/]*)?$/i,K=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],W=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],le=E=>{let V=_e(E),z=V.indexOf("."),x=K.indexOf(z===-1?"":V.slice(z).toLowerCase());return x===-1?K.length:x},ve=()=>!!ee&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!ve())return"";for(let E of[".github","","docs"]){let V=(ee.dirs.get(E)?.files||[]).filter(z=>xe.test(_e(z)));if(V.length)return V.sort((z,x)=>le(z)-le(x)||Ce(z,x))[0]}return""},e.readmeName=()=>_e(e.readmePath())||"README.md";let be={key:null,fn:()=>!1},$e=()=>{let E=(e.options?.preserveFiles||[]).map(z=>String(z).trim()).filter(Boolean),V=E.join(`
|
||||
`);if(V!==be.key){let z=()=>!1;try{E.length&&(z=Ll(E))}catch{}be={key:V,fn:z}}return be.fn};e.pathPreserved=E=>!!E&&$e()(E),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let E=$e();if(ve()){let V=e.readmePath();return!!V&&E(V)}return W.some(V=>E(V))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function st(){let E={terms:e.terms?e.terms.split(`
|
||||
`):[],filePath:e.previewOpenPath()||"README.md",preserveFiles:e.options.preserveFiles||[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(E.branchName=e.source.branch);try{let V=parseGithubUrl(e.sourceUrl);E.repoName=`${V.owner}/${V.repo}`}catch{}return E}function Ze(E,V,z){let x=null,fe=0,Ee=()=>{if(e.detectedType!==E)return;x&&u.cancel(x);let Je=++fe;e.previewStatus="loading",x=u(()=>{x=null;let $t=V();if(!$t){e.previewStatus="idle";return}t.post("/api/anonymize-preview",$t).then(gt=>{Je===fe&&(z(gt.data,$t),e.previewStatus="ready")}).catch(()=>{Je===fe&&(e.previewStatus="error")})},200)};return Ee.cancel=()=>{fe++,x&&u.cancel(x),x=null},e.on("dispose",Ee.cancel),Ee}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof pn!="string"?Yl(e.previewFile):tn()),e.detectedType==="pr"&&Un(),e.detectedType==="gist"&&_n()};let Oe=yn(Xo(e));Object.defineProperty(e,"previewViewer",{get:()=>Oe}),ul(Oe,e),Object.assign(Oe,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),Oe.preview=!0,Oe.fileSize=E=>E===Oe.filePath&&typeof pn=="string"?new Blob([pn]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,Oe.openPreserveFiles=()=>e.openPreserveFiles(),Oe.previewPreserved=()=>e.previewPreserved(),Oe.retryContent=()=>e.retryPreview();let yt=E=>oe.has(E)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(E),Yt=(E="")=>({path:E,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=Yt();let co=0,pn=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=E=>{if(E=E||"",E&&E===e.readmePath()&&(E=""),co++,pn=null,vi(),tn.cancel(),e.previewFile=E,e.previewDoc=Yt(E),Oe.sidebarCollapsed=!0,Oe.content=null,!E){e.readme?tn():e.previewStatus="idle";return}if(yt(E)){Kr("binary"),e.previewStatus="ready";return}Yl(E)};function Em(){co++,pn=null,e.previewFile="",e.previewDoc=Yt(),Oe.sidebarCollapsed=!0,Oe.content=null}function Yl(E){let V=++co;pn=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let z;try{z=parseGithubUrl(e.sourceUrl)}catch{z=null}if(!z||!e.source?.commit){Object.assign(e.previewDoc,{loading:!1,loadError:"The repository is still loading. Try again in a moment."}),e.previewStatus="error";return}t.get(`/api/repo/${z.owner}/${z.repo}/file`,{params:{commit:e.source.commit,path:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:at()},transformResponse:x=>x}).then(x=>{if(V!==co)return;e.previewDoc.loading=!1;let fe=typeof x.headers=="function"&&x.headers("content-type")||"";if(/json/i.test(fe)){let Ee=null;try{Ee=JSON.parse(x.data)}catch{}if(Ee&&Ee.binary===!0){Kr("binary"),e.previewStatus="ready";return}}pn=typeof x.data=="string"?x.data:"",tn()},x=>{if(V!==co)return;e.previewDoc.loading=!1;let fe=Br(x);if(fe==="file_too_big"){Kr("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=ss.ERRORS[fe]||"GitHub did not return this file.",e.previewStatus="error"})}let gi;function vi(){gi&&window.URL.revokeObjectURL(gi),gi=void 0,Oe.url=void 0}e.on("dispose",vi);function Kr(E){vi(),e.previewDoc.note=E,Oe.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),Oe.type=E==="too_big"?"error":"binary",Oe.content=E==="too_big"?"file_too_big":"binary"}function Nm(E){try{let V=parseGithubUrl(e.sourceUrl),z=e.source.branch||e.details&&e.details.defaultBranch||"main",x=E&&E.includes("/")?E.slice(0,E.lastIndexOf("/")+1):"";return`https://github.com/${V.owner}/${V.repo}/raw/${z}/${x}`}catch{return""}}let Xl=Ze("repo",()=>e.previewFile?typeof pn!="string"?null:{content:pn,options:st()}:e.readme?{content:e.readme,options:st()}:null,E=>{if(typeof E?.content!="string")throw Error("Invalid preview response");vi(),window.URL?.createObjectURL&&(Oe.url=gi=window.URL.createObjectURL(new Blob([E.content],{type:"text/plain"})));let V=e.previewOpenPath()||e.readmeName();Oe.prepareFile(e.previewPathName(V)),Oe.fileBaseUrl=Nm(V),Oe.renderFileContent(E.content,Oe.type,Oe.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=E.content)}),tn=()=>{e.previewFile&&typeof pn!="string"||Xl()};tn.cancel=Xl.cancel;let Ts=ut(new Map),Yr=new Set,Xr=new Set,po="",fo=null,yi=()=>String(e.terms||"").split(`
|
||||
`).filter(E=>E.trim());function Rm(){fo=null;let E=yi(),V=E.join(`
|
||||
`);V!==po&&(Ts.clear(),Xr.clear(),po=V);let z=[...Yr].filter(x=>!Ts.has(x));if(Yr.clear(),!(!z.length||!E.length))for(let x=0;x<z.length;x+=400){let fe=z.slice(x,x+400);t.post("/api/anonymize-preview",{contents:fe,options:{terms:E,image:!0,link:!0}}).then(Ee=>{if(po!==V||yi().join(`
|
||||
`)!==V)return;let Je=Ee.data?.contents;if(!Array.isArray(Je)||Je.length!==fe.length)throw Error("Invalid preview response");fe.forEach(($t,gt)=>Ts.set($t,typeof Je[gt]=="string"?Je[gt]:$t))}).catch(()=>{po===V&&fe.forEach(Ee=>Xr.add(Ee))})}}e.previewName=E=>{if(!E||!yi().length)return E;if(po===yi().join(`
|
||||
`)){if(Ts.has(E))return Ts.get(E);if(Xr.has(E))return E}return Yr.add(E),fo||(fo=u(Rm,120)),E},e.previewPathName=E=>{E=String(E||"");let V=E.lastIndexOf("/");return V<0?e.previewName(E):e.previewName(E.slice(0,V))+"/"+e.previewName(E.slice(V+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{Oe.repoId=e.repoId||"repository",Oe.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),Oe.paths=Oe.filePath.split("/"),Oe.files=e.previewTreeFiles(),Oe.loadedFolders=Object.fromEntries([...J?.dirs.keys()||[]].map(E=>[e.previewName(E),!0]))},!0),e.on("dispose",()=>{fo&&u.cancel(fo)});function Ps(){!e.anonymize||!e.anonymize.terms||tn()}async function Jl(){let E=parseGithubUrl(e.sourceUrl),V=v();try{Is(),me();let z=await t.get(`/api/pr/${E.owner}/${E.repo}/${E.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(V))return;e.details=z.data,e.pullRequestId||(e.pullRequestId=E.repo+"-PR"+E.pullRequestId+"-"+generateRandomId(4))}catch(z){if(!y(V))return;throw te(z),z}finally{k(V)}}let As=ut(new Map);function Tm(){let E=new Set,V=e.details&&e.details.pullRequest;if(!V)return E;typeof V.title=="string"&&E.add(V.title),typeof V.body=="string"&&E.add(V.body),typeof V.diff=="string"&&E.add(V.diff);let z=V.comments||[];for(let x of z)typeof x.author=="string"&&E.add(x.author),typeof x.body=="string"&&E.add(x.body);return E}let Un=Ze("pr",()=>{let E=Tm(),V=Array.from(E);return V.length===0?null:{contents:V,options:st()}},(E,V)=>{if(!Array.isArray(E?.contents)||E.contents.length!==V.contents.length||E.contents.some(fe=>typeof fe!="string"))throw Error("Invalid preview response");let z=V.contents,x=new Map;for(let fe=0;fe<z.length&&fe<E.contents.length;fe++)x.set(z[fe],E.contents[fe]);As.clear(),x.forEach((fe,Ee)=>As.set(Ee,fe))});e.anonymizePrContent=function(E){return E&&(As.has(E)?As.get(E):"")};async function Ql(){let E=parseGithubUrl(e.sourceUrl),V=v();try{Is(),me(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let z=await t.get(`/api/gist/source/${E.gistId}`);if(!y(V))return;e.details=z.data,e.gistId||(e.gistId="gist-"+E.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(z){if(!y(V))return;if(z.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,De("sourceUrl","missing",!1);return}if(z.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,De("sourceUrl","missing",!1);return}throw te(z),z}finally{k(V)}}let Ds=ut(new Map);function Pm(){let E=new Set,V=e.details&&e.details.gist;if(!V)return E;typeof V.description=="string"&&E.add(V.description),typeof V.ownerLogin=="string"&&E.add(V.ownerLogin);let z=V.files||[];for(let fe of z)typeof fe.filename=="string"&&E.add(fe.filename),typeof fe.content=="string"&&E.add(fe.content);let x=V.comments||[];for(let fe of x)typeof fe.author=="string"&&E.add(fe.author),typeof fe.body=="string"&&E.add(fe.body);return E}let _n=Ze("gist",()=>{let E=Pm(),V=Array.from(E);return V.length===0?null:{contents:V,options:st()}},(E,V)=>{if(!Array.isArray(E?.contents)||E.contents.length!==V.contents.length||E.contents.some(fe=>typeof fe!="string"))throw Error("Invalid preview response");let z=V.contents,x=new Map;for(let fe=0;fe<z.length&&fe<E.contents.length;fe++)x.set(z[fe],E.contents[fe]);Ds.clear(),x.forEach((fe,Ee)=>Ds.set(Ee,fe)),Jr()});e.anonymizeGistContent=function(E){return E&&(Ds.has(E)?Ds.get(E):"")},e.previewGistFiles=[];function Jr(){let E=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=E.map(V=>({filename:e.anonymizeGistContent(V.filename),content:e.anonymizeGistContent(V.content),language:V.language}))}e.watch("details.gist.files",Jr,!0),e.watch("terms",Jr);function Am(){let E=e.conference;if(e.conference_data=null,!E)return;let V=E===w||e.isUpdate&&E===e._originalConference;E!==w&&(w=null),t.get("/api/conferences/"+E).then(z=>{e.conference===E&&(e.conference_data=z.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!V&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===E&&(e.conference_data=null)})}function Is(){De("repoId","used",!0),De("repoId","format",!0),De("pullRequestId","used",!0),De("pullRequestId","format",!0),De("gistId","used",!0),De("gistId","format",!0),De("sourceUrl","used",!0),De("sourceUrl","missing",!0),De("sourceUrl","access",!0),De("sourceUrl","github",!0),De("commit","exists",!0),De("conference","activated",!0),De("terms","format",!0),e.termHints=[]}function bi(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let E=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||E&&E.invalid?(E&&E.setDirty&&E.setDirty(),e.error="
Line truncated
|
||||
`).filter(Ee=>Ee),connection:e.githubConnection,fullName:`${z.owner}/${z.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(x.options.pageSource=e.details.pageSource),Is();let fe=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(fe,x,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},Ee=>{if(Ee.data){let Je=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(Ee.data.error);Je||r("ERRORS."+Ee.data.error).then($t=>{e.error=$t},console.error),wi(Ee.data.error),Je&&(Ee.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,We(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{V.disabled=!1})},e.anonymizeGist=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(bi())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let V=E.currentTarget||E.target.closest?.("button")||E.target;V.disabled=!0;let z=parseGithubUrl(e.sourceUrl),x={gistId:e.gistId,terms:e.terms.trim().split(`
|
||||
`).filter(Ee=>Ee),source:{gistId:z.gistId},options:e.options,conference:e.conference};Is();let fe=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(fe,x,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},Ee=>{Ee.data&&(r("ERRORS."+Ee.data.error).then(Je=>{e.error=Je},console.error),wi(Ee.data.error))}).finally(()=>{V.disabled=!1})},e.anonymizePullRequest=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(bi())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let V=E.currentTarget||E.target.closest?.("button")||E.target;V.disabled=!0;let z=parseGithubUrl(e.sourceUrl),x={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
|
||||
`).filter(Ee=>Ee),source:{repositoryFullName:`${z.owner}/${z.repo}`,pullRequestId:z.pullRequestId},options:e.options,conference:e.conference};Is();let fe=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(fe,x,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},Ee=>{Ee.data&&(r("ERRORS."+Ee.data.error).then(Je=>{e.error=Je},console.error),wi(Ee.data.error))}).finally(()=>{V.disabled=!1})},e.watch("conference",()=>{Am()}),e.termHints=[],e.matchTermAsWritten=E=>{e.terms=zp(e.terms,E)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&tn()}),e.watch("terms",()=>{e.termHints=Bp(e.terms),e.detectedType==="repo"&&Ps(),e.detectedType==="pr"&&Un(),e.detectedType==="gist"&&_n()}),e.watch("options.image",()=>{e.detectedType==="repo"&&Ps(),e.detectedType==="pr"&&Un(),e.detectedType==="gist"&&_n()}),e.watch("options.link",()=>{e.detectedType==="repo"&&Ps(),e.detectedType==="pr"&&Un(),e.detectedType==="gist"&&_n()}),e.watch("details",()=>{e.detectedType==="pr"&&Un(),e.detectedType==="gist"&&_n()},!0)},Fl=function(e,t,s,i,o,r){ul(e);let u=Rt();Hr();let p=Lt(),d=0,h=null,m=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){h&&(h.resolve(),h=null),m&&(u.timeout.cancel(m),m=null)}let v=!1;e.on("dispose",()=>{v=!0,d++,y(),k&&k.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,p(document,"click",G=>{e.symbolsOpen&&!G.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!G.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!G.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&G.target.isConnected&&!G.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!G.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!G.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",G=>{G.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(G.ctrlKey||G.metaKey)&&!G.altKey&&G.key&&G.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(G.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(G){if((G.metaKey||G.ctrlKey)&&G.key==="k"){G.preventDefault();var M=document.querySelector(".tree-search-input");M&&(M.focus(),M.select())}});var k=null;e.onFileSearchChange=function(){k&&(k.resolve(),k=null);let G=e.fileSearchQuery;if(!G||G.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let M=r.defer();k=M,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(G)}`,{timeout:M.promise}).then(function(S){if(!(v||k!==M)){k=null,e.fileSearchLoading=!1;var L={};e.files.forEach(function(Pe){L[(Pe.path||"")+"/"+Pe.name]=!0});for(var X=[],Z={},j=0;j<S.data.length;j++){var se=S.data[j];if(se.path)for(var te=se.path.split("/"),me="",Ce=0;Ce<te.length;Ce++){var _e=me;me=me?me+"/"+te[Ce]:te[Ce];var Ye=_e+"/"+te[Ce];!L[Ye]&&!Z[Ye]&&(Z[Ye]=!0,X.push({name:te[Ce],path:_e}))}}X.sort(function(Pe,Q){return(Pe.path||"").split("/").length-(Q.path||"").split("/").length}),X.length>0&&e.files.push.apply(e.files,X);for(var Xe=[],De=0;De<S.data.length;De++){var tt=S.data[De],at=(tt.path||"")+"/"+tt.name;!L[at]&&tt.size!=null&&(Xe.push(tt),L[at]=!0)}Xe.length>0&&e.files.push.apply(e.files,Xe),e.fileSearchResults=S.data}},function(){!v&&k===M&&(k=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(G,M){if(e.repoId!=i.repoId)return U();if((i.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=i.path||"",e.paths=e.filePath.split("/").filter(S=>S&&S.trim().length>0),q();for(let S=0;S<e.paths.length-1;S++){let L=S>0?e.paths.slice(0,S).join("/"):"";e.files.some(Z=>Z.path===L)||e.getFiles(L)}}});function b(){if(e.paths[0]!="")return;let G=["readme.md","readme.txt","readme.org","readme.1st","readme"],M={};for(let L of e.files)L.name.toLowerCase().indexOf("readme")>-1&&(M[L.name.toLowerCase()]=L.name);let S=null;for(let L of G)if(M[L]){S=L;break}if(!S&&Object.keys(M).length>0&&(S=Object.keys(M)[0]),S){let L=s.url();L[L.length-1]!="/"&&(L+="/"),s.url(L+encodePathForUrl(M[S]))}}e.fileCounts=null;let C=0,N=new Set,w=!1;e.getFiles=function(G,M=!1){let S=e.repoId,L=C;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(G)}&v=${e.options.lastUpdateDate}`).then(function(X){if(v||S!==e.repoId||L!==C)return[];let Z=G||"";return e.files=e.files.filter(j=>j.path!==Z),e.files.push(...X.data),e.loadedFolders={...e.loadedFolders,[Z]:!0},P(Z,L),X.data},function(X){if(v||S!==e.repoId||L!==C)return[];M||(e.type="error",e.content=Br(X),e.files=[])})};function P(G,M){if(w||N.has(G))return;N.add(G);let S=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(G)}`).then(function(L){v||S!==e.repoId||M!==C||(e.fileCounts={...e.fileCounts,...L.data})},function(){
Line truncated
|
||||
`).length+1)),placeholder:`Jane Smith
|
||||
MIT CSAIL
|
||||
jane.smith@example.org`},null,10,m5),[[d,{state:e.viewState,set:c=>{e.terms=c},value:e.terms,form:"anonymize",options:{debounce:250}}]]),t[125]||(t[125]=n("small",{class:"form-text text-muted"},"One term per line.",-1)),n("details",h5,[t[120]||(t[120]=n("summary",null,"Regex & replacement syntax",-1)),t[121]||(t[121]=m()),n("small",g5,[t[114]||(t[114]=m("Regex is supported. Replaced by ",-1)),n("code",null,u(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[115]||(t[115]=m(", or use ",-1)),t[116]||(t[116]=n("code",null,"term=>replacement",-1)),t[117]||(t[117]=m(" to pick your own (e.g. ",-1)),t[118]||(t[118]=n("code",null,"Anonymous=>ABC",-1)),t[119]||(t[119]=m(").",-1))])]),(a(!0),l(T,null,H((e.termHints||[]).slice(0,3),c=>(a(),l("div",{class:"term-hint",key:c.line},[n("span",null,[t[122]||(t[122]=m("In ",-1)),n("code",null,u(c.term),1),t[123]||(t[123]=m(", ",-1)),n("code",null,u(c.symbols.join(" ")),1),m(" "+u(c.symbols.length>1?"are regex symbols":"is a regex symbol")+", so it may not match the text as written.",1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm",onClick:v=>e.matchTermAsWritten(c.line)},"Match as written",8,v5)]))),128)),(e.termHints||[]).length>3?(a(),l("div",y5,u(e.termHints.length-3)+" more "+u(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),D(n("div",b5,"Terms are in an invalid format.",512),[[Q,e.anonymize?.terms?.errors?.format]])]),D(n("div",w5,[n("div",k5,[t[126]||(t[126]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",C5,u(e.preserveSummary()),1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm","aria-describedby":"preserve-files-label",disabled:!e.source?.commit,onClick:t[25]||(t[25]=c=>e.openPreserveFiles())},u((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,S5)],512),[[Q,e.detectedType==="repo"]]),e.preserve?.open?(a(),l("dialog",{key:0,id:"preserve-files-dialog",class:"preserve-dialog","aria-labelledby":"preserve-files-title",onCancel:t[30]||(t[30]=re(c=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[29]||(t[29]=re(c=>e.savePreserveFiles(),["prevent"]))},[t[130]||(t[130]=n("h2",{id:"preserve-files-title"},"Leave files unredacted",-1)),t[131]||(t[131]=n("p",{class:"preserve-intro"},"Checked files are shown exactly as written, for example a bibliography where redacted self-citations would reveal you. File names are still redacted.",-1)),D(n("input",{type:"search",id:"preserve-files-search",class:"form-control",placeholder:"Search files","aria-label":"Search files",autocomplete:"off","onUpdate:modelValue":t[26]||(t[26]=c=>e.preserve.search=c)},null,512),[[ot,e.preserve.search]]),n("div",E5,[e.preserve.loading?(a(),l("p",N5,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",R5,u(e.preserve.error),1)):(a(),l(T,{key:2},[(a(!0),l(T,null,H(e.preserveRows(),(c,v)=>(a(),l("div",{class:"preserve-item",key:c.kind+":"+c.path,style:Ae({paddingLeft:c.depth*18+6+"px"})},[c.kind==="dir"?(a(),l("button",{key:0,type:"button",class:"preserve-caret","aria-expanded":c.open?"true":"false","aria-label":(c.open?"Collapse ":"Expand ")+c.label,onClick:h=>e.togglePreserveDir(c.path)},u(c.open?"\u25BE":"\u25B8"),9,T5)):(a(),l("span",P5)),n("input",{type:"checkbox",id:"pf-"+v,"aria-label":c.kind==="dir"?"Leave folder "+c.path+" unredacted":null,checked:c.state==="all",".indeterminate":c.state==="some",disabled:c.locked,onChange:h=>c.kind==="dir"?e.togglePreserveFolder(c.path):e.togglePreserveFile(c.path)},null,40,D5),n("label",{for:c.kind==="file"?"pf-"+v:null,class:"preserve-name",onClick:h=>c.kind==="dir"&&e.togglePreserveDir(c.path)},u(c.label),9,A5),c.note?(a(),l("span",I5,u(c.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",O5,u(e.preserve.search?"No file matches your search.":"No text files in this commit."),1)):f("v-if",!0)],64))]),e.preserve.truncated?(a(),l("p",M5,"This repository has too many files to list them all. Use a pattern for files you cannot find.")):f("v-if",!0),n("details",{class:"preserve-patterns",open:e.preserve.patternsOpen},[t[127]||(t[127]=n("summary",null,"Patterns",-1)),D(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
|
||||
paper/appendix/**`,"onUpdate:modelValue":t[27]||(t[27]=c=>e.preserve.patterns=c)},null,512),[[ot,e.preserve.patterns]]),t[128]||(t[128]=n("small",{class:"form-text text-muted"},[m("One per line, as in .gitignore: "),n("code",null,"*.bib"),m(" matches in any folder; "),n("code",null,"/refs.bib"),m(" and "),n("code",null,"paper/refs.bib"),m(" match from the repository root; a folder name such as "),n("code",null,"drafts/"),m(" covers everything inside it; "),n("code",null,"!private.bib"),m(" excludes again.")],-1))],8,V5),n("div",q5,[n("span",L5,u(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",F5,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[28]||(t[28]=c=>e.closePreserveFiles())},"Cancel"),t[129]||(t[129]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[Q,e.detectedType&&e.sourceReady()]]),D(n("section",_5,[t[152]||(t[152]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),D(n("div",null,[n("div",$5,[D(n("input",U5,null,512),[[d,{state:e.viewState,set:c=>{e.options.link=c},value:e.options?.link,form:"anonymize",options:{}}]]),t[133]||(t[133]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",B5,[D(n("input",z5,null,512),[[d,{state:e.viewState,set:c=>{e.options.image=c},value:e.options?.image,form:"anonymize",options:{}}]]),t[134]||(t[134]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",H5,[D(n("input",j5,null,512),[[d,{state:e.viewState,set:c=>{e.options.pdf=c},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[135]||(t[135]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",G5,[D(n("input",W5,null,512),[[d,{state:e.viewState,set:c=>{e.options.notebook=c},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[136]||(t[136]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",K5,[D(n("input",{class:"form-check-input",type:"checkbox",id:"page",name:"page",disabled:!e.details?.hasPage||e.details?.pageSource&&e.details?.pageSource?.branch!==e.source?.branch},null,8,Y5),[[d,{state:e.viewState,set:c=>{e.options.page=c},value:e.options?.page,form:"anonymize",options:{}}]]),t[137]||(t[137]=n("label",{class:"form-check-label",for:"page"},"GitHub Pages",-1)),e.details?.hasPage?f("v-if",!0):(a(),l("small",J5,u(e.fmt?.translate("WARNINGS.page_not_enabled_on_repo")),1)),e.details?.hasPage&&e.details?.pageSource?.branch&&e.source?.branch&&e.details.pageSource.branch!==e.source.branch?(a(),l("small",X5,u(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[Q,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",Q5,[...t[138]||(t[138]=[m("Images and PDFs are served unchanged. Review their contents and metadata before sharing. ",-1),n("a",{href:"/faq#formats"},"Supported formats",-1)])])):f("v-if",!0),D(n("div",null,[n("div",Z5,[D(n("input",x5,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[139]||(t[139]=n("label",{class:"form-check-label",for:"title-gist"},"Gist description",-1))]),n("div",e6,[D(n("input",t6,null,512),[[d,{state:e.viewState,set:c=>{e.options.content=c},value:e.options?.content,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"content-gist"},"File contents",-1))]),n("div",n6,[D(n("input",o6,null,512),[[d,{state:e.viewState,set:c=>{e.options.comments=c},value:e.options?.comments,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",s6,[D(n("input",i6,null,512),[[d,{state:e.viewState,set:c=>{e.options.username=c},value:e.options?.username,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",r6,[D(n("input",a6,null,512),[[d,{state:e.viewState,set:c=>{e.options.date=c},value:e.options?.date,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",l6,[D(n("input",d6,null,512),[[d,{state:e.viewState,set:c=>{e.options.origin=c},value:e.options?.origin,form:"anonymize",options:{}}]]),t[144]||(t[144]=n("label",{class:"form-check-label",for:"origin-gist"},"Source gist ID",-1))])],512),[[Q,e.detectedType==="gist"]]),D(n("div",null,[n("div",u6,[D(n("input",c6,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[145]||(t[145]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",p6,[D(n("input",f6,null,512),[[d,{state:e.viewState,set:c=>{e.options.body=c},value:e.options?.body,form:"anonymize",options:{}}]]),t[146]||(t[146]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]),n(
Line truncated
|
||||
anonymous_github`)])])])])]),f(" Limitations "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-warning"})]),m("Limitations ")]),n("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-limitations",href:"#limitation","aria-expanded":"false","aria-controls":"limitation"}," What are the limitations of Anonymous GitHub? ")])]),n("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[n("div",{class:"panel-body p-3"},[n("ul",null,[n("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),n("li",null," Files larger than 8 MB are not supported. "),n("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),n("li",null," The anonymization of terms within source code may change the behavior of the program (e.g., if a replaced term appears in a string literal or identifier). ")])])])])]),f(" Privacy and security "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-shield"})]),m("Privacy and security ")]),n("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#data","aria-expanded":"false","aria-controls":"data"}," How is my data handled? ")])]),n("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[n("div",{class:"panel-body p-3"},[n("p",null," Repository data is used to provide the anonymization service. If you purchase a plan, Stripe processes payment and billing information. When a repository is removed or expires, only its configuration is retained. This makes it easy to restore the repository if needed and ensures that no future repository reuses the same ID. ")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#permissions","aria-expanded":"false","aria-controls":"permissions"}," Why does GitHub say Anonymous GitHub asks for write access? ")])]),n("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[n("div",{class:"panel-body p-3"},[n("p",null,[m("The GitHub App has read-only access to the repositories you choose. You can change repository access on your "),n("a",{href:"/connections"},"GitHub connections"),m(" page.")]),n("p",null,"Legacy GitHub OAuth includes write access to private repositories because GitHub's OAuth scopes do not offer a read-only option for them. Existing OAuth anonymizations and gists can still use this connection."),n("p",null,"Anonymous GitHub reads repository content. It never pushes, modifies, or deletes files on GitHub.")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#viewer","aria-expanded":"false","aria-controls":"viewer"}," Can repository owners see who viewed their anonymized repository? ")])]),n("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[n("div",{class:"panel-body p-3"},[n("p",null," No. Only the total number of views is tracked as an incremental counter. It is not possible for the repository owner or for Anonymous GitHub to identify individual viewers. Reviewer anonymity is fully preserved. ")])])])]),f(" Self-hosting "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#project-icon-storage"})]),m("Self"),n("span",{class:"serif-hy"},"-"),m("hosting ")]),n("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-hosting",href:"#deploy","aria-expanded":"false","aria-controls":"deploy"}," Can I deploy my own instance? ")])]),n("div",{id:"deploy",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingDeploy"},[n("div",{cla
Line truncated
|
||||
jane.smith@example.org`},null,10,P6),[[u,{state:e.viewState,set:d=>{e.terms=d},value:e.terms,form:"anonymize",options:{debounce:250}}]]),t[125]||(t[125]=n("small",{class:"form-text text-muted"},"One term per line.",-1)),n("details",A6,[t[120]||(t[120]=n("summary",null,"Regex & replacement syntax",-1)),t[121]||(t[121]=g()),n("small",D6,[t[114]||(t[114]=g("Regex is supported. Replaced by ",-1)),n("code",null,c(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[115]||(t[115]=g(", or use ",-1)),t[116]||(t[116]=n("code",null,"term=>replacement",-1)),t[117]||(t[117]=g(" to pick your own (e.g. ",-1)),t[118]||(t[118]=n("code",null,"Anonymous=>ABC",-1)),t[119]||(t[119]=g(").",-1))])]),(a(!0),l(R,null,_((e.termHints||[]).slice(0,3),d=>(a(),l("div",{class:"term-hint",key:d.line},[n("span",null,[t[122]||(t[122]=g("In ",-1)),n("code",null,c(d.term),1),t[123]||(t[123]=g(", ",-1)),n("code",null,c(d.symbols.join(" ")),1),g(" "+c(d.symbols.length>1?"are regex symbols":"is a regex symbol")+", so it may not match the text as written.",1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm",onClick:h=>e.matchTermAsWritten(d.line)},"Match as written",8,I6)]))),128)),(e.termHints||[]).length>3?(a(),l("div",O6,c(e.termHints.length-3)+" more "+c(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),A(n("div",M6,"Terms are in an invalid format.",512),[[ne,e.anonymize?.terms?.errors?.format]])]),A(n("div",V6,[n("div",L6,[t[126]||(t[126]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",q6,c(e.preserveSummary()),1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm","aria-describedby":"preserve-files-label",disabled:!e.source?.commit,onClick:t[25]||(t[25]=d=>e.openPreserveFiles())},c((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,$6)],512),[[ne,e.detectedType==="repo"]]),e.preserve?.open?(a(),l("dialog",{key:0,id:"preserve-files-dialog",class:"preserve-dialog","aria-labelledby":"preserve-files-title",onCancel:t[30]||(t[30]=de(d=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[29]||(t[29]=de(d=>e.savePreserveFiles(),["prevent"]))},[t[130]||(t[130]=n("h2",{id:"preserve-files-title"},"Leave files unredacted",-1)),t[131]||(t[131]=n("p",{class:"preserve-intro"},"Checked files are shown exactly as written, for example a bibliography where redacted self-citations would reveal you. File names are still redacted.",-1)),A(n("input",{type:"search",id:"preserve-files-search",class:"form-control",placeholder:"Search files","aria-label":"Search files",autocomplete:"off","onUpdate:modelValue":t[26]||(t[26]=d=>e.preserve.search=d)},null,512),[[ct,e.preserve.search]]),n("div",F6,[e.preserve.loading?(a(),l("p",U6,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",_6,c(e.preserve.error),1)):(a(),l(R,{key:2},[(a(!0),l(R,null,_(e.preserveRows(),(d,h)=>(a(),l("div",{class:"preserve-item",key:d.kind+":"+d.path,style:Ie({paddingLeft:d.depth*18+6+"px"})},[d.kind==="dir"?(a(),l("button",{key:0,type:"button",class:"preserve-caret","aria-expanded":d.open?"true":"false","aria-label":(d.open?"Collapse ":"Expand ")+d.label,onClick:m=>e.togglePreserveDir(d.path)},c(d.open?"\u25BE":"\u25B8"),9,B6)):(a(),l("span",z6)),n("input",{type:"checkbox",id:"pf-"+h,"aria-label":d.kind==="dir"?"Leave folder "+d.path+" unredacted":null,checked:d.state==="all",".indeterminate":d.state==="some",disabled:d.locked,onChange:m=>d.kind==="dir"?e.togglePreserveFolder(d.path):e.togglePreserveFile(d.path)},null,40,H6),n("label",{for:d.kind==="file"?"pf-"+h:null,class:"preserve-name",onClick:m=>d.kind==="dir"&&e.togglePreserveDir(d.path)},c(d.label),9,j6),d.note?(a(),l("span",G6,c(d.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",W6,c(e.preserve.search?"No file matches your search.":"No text files in this commit."),1)):f("v-if",!0)],64))]),e.preserve.truncated?(a(),l("p",K6,"This repository has too many files to list them all. Use a pattern for files you cannot find.")):f("v-if",!0),n("details",{class:"preserve-patterns",open:e.preserve.patternsOpen},[t[127]||(t[127]=n("summary",null,"Patterns",-1)),A(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
|
||||
paper/appendix/**`,"onUpdate:modelValue":t[27]||(t[27]=d=>e.preserve.patterns=d)},null,512),[[ct,e.preserve.patterns]]),t[128]||(t[128]=n("small",{class:"form-text text-muted"},[g("One per line, as in .gitignore: "),n("code",null,"*.bib"),g(" matches in any folder; "),n("code",null,"/refs.bib"),g(" and "),n("code",null,"paper/refs.bib"),g(" match from the repository root; a folder name such as "),n("code",null,"drafts/"),g(" covers everything inside it; "),n("code",null,"!private.bib"),g(" excludes again.")],-1))],8,Y6),n("div",X6,[n("span",J6,c(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",Q6,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[28]||(t[28]=d=>e.closePreserveFiles())},"Cancel"),t[129]||(t[129]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[ne,e.detectedType&&e.sourceReady()]]),A(n("section",Z6,[t[152]||(t[152]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),A(n("div",null,[n("div",x6,[A(n("input",eM,null,512),[[u,{state:e.viewState,set:d=>{e.options.link=d},value:e.options?.link,form:"anonymize",options:{}}]]),t[133]||(t[133]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",tM,[A(n("input",nM,null,512),[[u,{state:e.viewState,set:d=>{e.options.image=d},value:e.options?.image,form:"anonymize",options:{}}]]),t[134]||(t[134]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",sM,[A(n("input",oM,null,512),[[u,{state:e.viewState,set:d=>{e.options.pdf=d},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[135]||(t[135]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",iM,[A(n("input",rM,null,512),[[u,{state:e.viewState,set:d=>{e.options.notebook=d},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[136]||(t[136]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",aM,[A(n("input",{class:"form-check-input",type:"checkbox",id:"page",name:"page",disabled:!e.details?.hasPage||e.details?.pageSource&&e.details?.pageSource?.branch!==e.source?.branch},null,8,lM),[[u,{state:e.viewState,set:d=>{e.options.page=d},value:e.options?.page,form:"anonymize",options:{}}]]),t[137]||(t[137]=n("label",{class:"form-check-label",for:"page"},"GitHub Pages",-1)),e.details?.hasPage?f("v-if",!0):(a(),l("small",dM,c(e.fmt?.translate("WARNINGS.page_not_enabled_on_repo")),1)),e.details?.hasPage&&e.details?.pageSource?.branch&&e.source?.branch&&e.details.pageSource.branch!==e.source.branch?(a(),l("small",uM,c(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[ne,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",cM,[...t[138]||(t[138]=[g("Images and PDFs are served unchanged. Review their contents and metadata before sharing. ",-1),n("a",{href:"/faq#formats"},"Supported formats",-1)])])):f("v-if",!0),A(n("div",null,[n("div",pM,[A(n("input",fM,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},value:e.options?.title,form:"anonymize",options:{}}]]),t[139]||(t[139]=n("label",{class:"form-check-label",for:"title-gist"},"Gist description",-1))]),n("div",mM,[A(n("input",hM,null,512),[[u,{state:e.viewState,set:d=>{e.options.content=d},value:e.options?.content,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"content-gist"},"File contents",-1))]),n("div",gM,[A(n("input",vM,null,512),[[u,{state:e.viewState,set:d=>{e.options.comments=d},value:e.options?.comments,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",yM,[A(n("input",bM,null,512),[[u,{state:e.viewState,set:d=>{e.options.username=d},value:e.options?.username,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",wM,[A(n("input",kM,null,512),[[u,{state:e.viewState,set:d=>{e.options.date=d},value:e.options?.date,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",CM,[A(n("input",SM,null,512),[[u,{state:e.viewState,set:d=>{e.options.origin=d},value:e.options?.origin,form:"anonymize",options:{}}]]),t[144]||(t[144]=n("label",{class:"form-check-label",for:"origin-gist"},"Source gist ID",-1))])],512),[[ne,e.detectedType==="gist"]]),A(n("div",null,[n("div",EM,[A(n("input",NM,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},value:e.options?.title,form:"anonymize",options:{}}]]),t[145]||(t[145]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",RM,[A(n("input",TM,null,512),[[u,{state:e.viewState,set:d=>{e.options.body=d},value:e.options?.body,form:"anonymize",options:{}}]]),t[146]||(t[146]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))])
Line truncated
|
||||
anonymous_github`)])])])])]),f(" Limitations "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-warning"})]),g("Limitations ")]),n("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-limitations",href:"#limitation","aria-expanded":"false","aria-controls":"limitation"}," What are the limitations of Anonymous GitHub? ")])]),n("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[n("div",{class:"panel-body p-3"},[n("ul",null,[n("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),n("li",null," Files larger than 8 MB are not supported. "),n("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),n("li",null," The anonymization of terms within source code may change the behavior of the program (e.g., if a replaced term appears in a string literal or identifier). ")])])])])]),f(" Privacy and security "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-shield"})]),g("Privacy and security ")]),n("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#data","aria-expanded":"false","aria-controls":"data"}," How is my data handled? ")])]),n("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[n("div",{class:"panel-body p-3"},[n("p",null," Repository data is used to provide the anonymization service. If you purchase a plan, Stripe processes payment and billing information. When a repository is removed or expires, only its configuration is retained. This makes it easy to restore the repository if needed and ensures that no future repository reuses the same ID. ")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#permissions","aria-expanded":"false","aria-controls":"permissions"}," Why does GitHub say Anonymous GitHub asks for write access? ")])]),n("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[n("div",{class:"panel-body p-3"},[n("p",null,[g("The GitHub App has read-only access to the repositories you choose. You can change repository access on your "),n("a",{href:"/connections"},"GitHub connections"),g(" page.")]),n("p",null,"Legacy GitHub OAuth includes write access to private repositories because GitHub's OAuth scopes do not offer a read-only option for them. Existing OAuth anonymizations and gists can still use this connection."),n("p",null,"Anonymous GitHub reads repository content. It never pushes, modifies, or deletes files on GitHub.")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#viewer","aria-expanded":"false","aria-controls":"viewer"}," Can repository owners see who viewed their anonymized repository? ")])]),n("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[n("div",{class:"panel-body p-3"},[n("p",null," No. Only the total number of views is tracked as an incremental counter. It is not possible for the repository owner or for Anonymous GitHub to identify individual viewers. Reviewer anonymity is fully preserved. ")])])])]),f(" Self-hosting "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#project-icon-storage"})]),g("Self"),n("span",{class:"serif-hy"},"-"),g("hosting ")]),n("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-hosting",href:"#deploy","aria-expanded":"false","aria-controls":"deploy"}," Can I deploy my own instance? ")])]),n("div",{id:"deploy",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingDeploy"},[n("div",{cla
Line truncated
|
||||
anonymized repository often think it is about the paper, so the
|
||||
label names the service and the tooltip says who to contact. `),n("li",{class:R(["nav-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[19]||(t[19]=[n("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[n("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),m("Report a bug ")],-1)])],2),n("li",{class:R(["nav-item nav-support-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[20]||(t[20]=[n("a",{class:"nav-link nav-support-inline",href:"https://ko-fi.com/tdurieux",target:"_blank",rel:"noopener",title:"Donate on Ko-fi to help cover hosting costs"},[n("svg",{class:"ui-icon nav-heart","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})]),m("Support ")],-1)])],2),e.isDarkMode?f("v-if",!0):(a(),l("li",hH,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to dark mode","aria-label":"Switch to dark mode",onClick:t[1]||(t[1]=s=>{e.darkMode(!0)})},[...t[21]||(t[21]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-moon"})],-1)])])])),e.isDarkMode?(a(),l("li",gH,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to light mode","aria-label":"Switch to light mode",onClick:t[2]||(t[2]=s=>{e.darkMode(!1)})},[...t[22]||(t[22]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sun"})],-1)])])])):f("v-if",!0),!e.user&&!e.isReviewerRoute?(a(),l("li",vH,[...t[23]||(t[23]=[n("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[n("i",{class:"fab fa-github mr-1"}),m(" Sign in ")],-1)])])):f("v-if",!0),e.user?.username&&e.headerCanUpgrade&&!e.headerBillingPending?(a(),l("li",yH,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=re(s=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",bH,[n("a",wH,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,kH)):f("v-if",!0),n("span",CH,u(e.user?.username),1)]),n("div",SH,[n("h6",EH,"Signed in as @"+u(e.user?.username),1),t[25]||(t[25]=ke('<a class="dropdown-item" href="/profile"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg><span>Settings<small>Defaults, quotas, account</small></span></a><a class="dropdown-item" href="/connections"><i class="fab fa-github" aria-hidden="true"></i><span>GitHub connections<small>Repository access and OAuth</small></span></a><a class="dropdown-item" href="/claim"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-link"></use></svg><span>Claim an anonymization<small>Attach an existing mirror to your account</small></span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg><span>Report a bug<small>About this service, not a paper</small></span></a><a class="dropdown-item um-extra" href="https://github.com/tdurieux/anonymous_github/" target="_blank" rel="noopener"><i class="fab fa-github" aria-hidden="true"></i><span>Source code</span></a>',6)),e.headerShowSupport?(a(),l("a",NH,[...t[24]||(t[24]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})],-1),n("span",null,"Support the project",-1)])])):f("v-if",!0),t[26]||(t[26]=n("div",{class:"dropdown-divider"},null,-1)),t[27]||(t[27]=n("a",{class:"dropdown-item",href:"/api/user/logout",target:"_self"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-logout"})]),n("span",null,"Sign out")],-1))])])):f("v-if",!0)])])],2),e.generalMessage?(a(),l("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,RH)):f("v-if",!0),e.emailPromptOpen?(a(),l("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[8]||(t[8]=re(s=>e.respondToEmailPrompt("later"),["prevent"]))},[n("form",{onSubmit:t[7]||(t[7]=re(s=>e.respondToEmailPrompt("save"),["prevent"]))},[t[30]||(t[30]=n("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[31]||(t[31]=n("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[32]||(t[32]=n("label",{for:"email-prompt-address"},"Email address",-1)),D(n("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[4]||(t[4]=s=>e.emailPromptAddress=s),disabled:e.emailPromptBusy},null,8,TH),[[ot,e.emailPromptAddress]]),e.emailPromptError?(a(),l("p
Line truncated
|
||||
python experiments/run.py`),n("p",null,[m("Contact: "),n("span",{class:"redact",role:"img","aria-label":"Redacted term 3"},[n("i",null,"3")])])])])])])],-1))]),f(" Live stats "),n("section",{class:R(["paper-stats paper-wrap",{"is-empty":e.statsEmpty()}]),id:"metrics","aria-label":"Usage over the last 60 days"},[n("div",$H,[e.statsEmpty()?f("v-if",!0):(a(),l("div",UH,[...t[11]||(t[11]=[n("span",{class:"paper-stats-dot","aria-hidden":"true"},null,-1),m(),n("span",null,[m("Live \xB7 last 60 days"),n("span",{class:"paper-stats-daily"}," \xB7 updated daily")],-1)])])),t[12]||(t[12]=n("div",{class:"paper-stats-meta-right"},"Used by authors at ICSE \xB7 FSE \xB7 OOPSLA",-1))]),e.statsEmpty()?f("v-if",!0):(a(),l("div",BH,[(a(!0),l(T,null,H(e.cards,(i,o)=>(a(),l("div",{class:"paper-stat-card",key:i?.key},[n("div",{class:R(["paper-stat-value",{"is-pending":!e.stat}])},u(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",zH,u(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",HH," +"+u(e.fmt?.number(e.history[i?.key].deltaToday))+" today ",1)):f("v-if",!0)]))),128))]))],2),f(" Before / after "),t[22]||(t[22]=n("section",{class:"paper-section-head paper-wrap"},[n("div",null,[n("div",{class:"paper-eyebrow"},"Try it"),n("h2",null,[m("The same repository, "),n("em",null,"minus you.")])]),n("p",null," Names, affiliations, emails, and any term you list are replaced across the README, source files, notebooks, and PDF links. Reviewers browse the real thing, not a zip. ")],-1)),n("div",jH,[n("div",GH,[t[13]||(t[13]=n("label",{for:"demo-terms"},[m("Terms to redact "),n("span",null,[m("comma-separated"),n("span",{class:"dt-try"},", try adding your own")])],-1)),D(n("textarea",{id:"demo-terms",class:"demo-terms-input",rows:"1","onUpdate:modelValue":t[0]||(t[0]=i=>e.demoTerms=i),spellcheck:"false",autocomplete:"off",onKeydown:t[1]||(t[1]=_t(re(()=>{},["prevent"]),["enter"]))},null,544),[[ot,e.demoTerms]])]),n("div",WH,[n("div",KH,[t[15]||(t[15]=n("div",{class:"pane-header"},[n("span",{class:"pane-label"},[m("Your repository "),n("span",{class:"pane-edit-hint"},"\xB7 editable")]),n("span",{class:"pane-url"},"github.com/jane-smith/DeepLearnUtils")],-1)),n("div",YH,[n("div",JH,[(a(!0),l(T,null,H(e.demoParts(),(i,o)=>(a(),l(T,{key:o},[i.redacted?(a(),l("mark",XH,u(i.original),1)):(a(),l(T,{key:1},[m(u(i.text),1)],64))],64))),128)),t[14]||(t[14]=m("\u200B",-1))]),D(n("textarea",{class:"pane-body demo-input","onUpdate:modelValue":t[2]||(t[2]=i=>e.demoText=i),spellcheck:"false","aria-label":"Sample README to anonymize"},null,512),[[ot,e.demoText]])])]),n("div",QH,[n("div",ZH,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",xH,[n("span",ej,u(e.demoCount())+" redacted",1)])]),n("div",tj,[(a(!0),l(T,null,H(e.demoParts(),(i,o)=>(a(),l(T,{key:o},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},u(i.text),9,nj)):(a(),l(T,{key:1},[m(u(i.text),1)],64))],64))),128))])])])]),f(" What you get: one screenshot, three tabs "),t[23]||(t[23]=n("section",{class:"paper-section-head paper-wrap",id:"about"},[n("div",null,[n("div",{class:"paper-eyebrow"},"What you get"),n("h2",null,"Anonymize, review, manage.")]),n("p",null," Terms are redacted in text files. Enabled images and PDFs are served unchanged, so review them for identifying content before sharing. Monitor your mirror, update it, or remove it when the review is over. ")],-1)),n("section",oj,[n("div",sj,[(a(!0),l(T,null,H(e.features,(i,o)=>(a(),l("div",{class:R(["paper-feature",{"is-on":e.feature===i?.key}]),key:i?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:r=>e.selectFeature(i.key),onKeydown:r=>e.featureKeydown(r,o),id:"feature-tab-"+i?.key,"aria-controls":"feature-panel-"+i?.key,"aria-selected":e.feature===i?.key,tabindex:e.feature===i?.key?0:-1},[n("span",rj,[n("span",aj,u(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",lj,u(i?.eyebrow),1)]),n("span",dj,[m(u(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",uj,"-")):f("v-if",!0),m(u(i?.title.split("-").slice(1).join("-"))+" "+u(i?.accent),1)])],40,ij),n("div",cj,[n("span",pj,[m(u(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",fj,"-")):f("v-if",!0),m(u(i?.title.split("-").slice(1).join("-"))+" "+u(i?.accent),1)]),n("p",null,u(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},u(i?.cta)+" \u2192",9,mj)])],2))),128))]),n("div",hj,[(a(!0),l(T,null,H(e.features,(i,o)=>D((a(),l("div",{class:"paper-feature-panel",role:"tabpanel",key:i?.key,id:"feature-panel-"+i?.key,"aria-labelledby":"feature-tab-"+i?.key},[n("div",vj,[n("div",yj,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",bj,u(i?.url),1)]),n("div",{class:R(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",kj,[...t[19]||(t[19]=[ke('<div class="fm-label">GitHub reposit
Line truncated
|
||||
label names the service and the tooltip says who to contact. `),n("li",{class:T(["nav-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[19]||(t[19]=[n("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[n("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),g("Report a bug ")],-1)])],2),n("li",{class:T(["nav-item nav-support-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[20]||(t[20]=[n("a",{class:"nav-link nav-support-inline",href:"https://ko-fi.com/tdurieux",target:"_blank",rel:"noopener",title:"Donate on Ko-fi to help cover hosting costs"},[n("svg",{class:"ui-icon nav-heart","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})]),g("Support ")],-1)])],2),e.isDarkMode?f("v-if",!0):(a(),l("li",Nj,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to dark mode","aria-label":"Switch to dark mode",onClick:t[1]||(t[1]=s=>{e.darkMode(!0)})},[...t[21]||(t[21]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-moon"})],-1)])])])),e.isDarkMode?(a(),l("li",Rj,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to light mode","aria-label":"Switch to light mode",onClick:t[2]||(t[2]=s=>{e.darkMode(!1)})},[...t[22]||(t[22]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sun"})],-1)])])])):f("v-if",!0),!e.user&&!e.isReviewerRoute?(a(),l("li",Tj,[...t[23]||(t[23]=[n("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[n("i",{class:"fab fa-github mr-1"}),g(" Sign in ")],-1)])])):f("v-if",!0),e.user?.username&&e.headerCanUpgrade&&!e.headerBillingPending?(a(),l("li",Pj,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=de(s=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",Aj,[n("a",Dj,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,Ij)):f("v-if",!0),n("span",Oj,c(e.user?.username),1)]),n("div",Mj,[n("h6",Vj,"Signed in as @"+c(e.user?.username),1),t[25]||(t[25]=Ae('<a class="dropdown-item" href="/profile"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg><span>Settings<small>Defaults, quotas, account</small></span></a><a class="dropdown-item" href="/connections"><i class="fab fa-github" aria-hidden="true"></i><span>GitHub connections<small>Repository access and OAuth</small></span></a><a class="dropdown-item" href="/claim"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-link"></use></svg><span>Claim an anonymization<small>Attach an existing mirror to your account</small></span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg><span>Report a bug<small>About this service, not a paper</small></span></a><a class="dropdown-item um-extra" href="https://github.com/tdurieux/anonymous_github/" target="_blank" rel="noopener"><i class="fab fa-github" aria-hidden="true"></i><span>Source code</span></a>',6)),e.headerShowSupport?(a(),l("a",Lj,[...t[24]||(t[24]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})],-1),n("span",null,"Support the project",-1)])])):f("v-if",!0),t[26]||(t[26]=n("div",{class:"dropdown-divider"},null,-1)),t[27]||(t[27]=n("a",{class:"dropdown-item",href:"/api/user/logout",target:"_self"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-logout"})]),n("span",null,"Sign out")],-1))])])):f("v-if",!0)])])],2),e.generalMessage?(a(),l("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,qj)):f("v-if",!0),e.emailPromptOpen?(a(),l("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[8]||(t[8]=de(s=>e.respondToEmailPrompt("later"),["prevent"]))},[n("form",{onSubmit:t[7]||(t[7]=de(s=>e.respondToEmailPrompt("save"),["prevent"]))},[t[30]||(t[30]=n("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[31]||(t[31]=n("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[32]||(t[32]=n("label",{for:"email-prompt-address"},"Email address",-1)),A(n("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[4]||(t[4]=s=>e.emailPromptAddress=s),disabled:e.emailPromptBusy},null,8,$j),[[ct,e.emailPromptAddress]]),e.emailPromptError?(a(),l("p
Line truncated
|
||||
python experiments/run.py`),n("p",null,[g("Contact: "),n("span",{class:"redact",role:"img","aria-label":"Redacted term 3"},[n("i",null,"3")])])])])])])],-1))]),f(" Live stats "),n("section",{class:T(["paper-stats paper-wrap",{"is-empty":e.statsEmpty()}]),id:"metrics","aria-label":"Usage over the last 60 days"},[n("div",Xj,[e.statsEmpty()?f("v-if",!0):(a(),l("div",Jj,[...t[11]||(t[11]=[n("span",{class:"paper-stats-dot","aria-hidden":"true"},null,-1),g(),n("span",null,[g("Live \xB7 last 60 days"),n("span",{class:"paper-stats-daily"}," \xB7 updated daily")],-1)])])),t[12]||(t[12]=n("div",{class:"paper-stats-meta-right"},"Used by authors at ICSE \xB7 FSE \xB7 OOPSLA",-1))]),e.statsEmpty()?f("v-if",!0):(a(),l("div",Qj,[(a(!0),l(R,null,_(e.cards,(i,o)=>(a(),l("div",{class:"paper-stat-card",key:i?.key},[n("div",{class:T(["paper-stat-value",{"is-pending":!e.stat}])},c(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",Zj,c(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",xj," +"+c(e.fmt?.number(e.history[i?.key].deltaToday))+" today ",1)):f("v-if",!0)]))),128))]))],2),f(" Before / after "),t[22]||(t[22]=n("section",{class:"paper-section-head paper-wrap"},[n("div",null,[n("div",{class:"paper-eyebrow"},"Try it"),n("h2",null,[g("The same repository, "),n("em",null,"minus you.")])]),n("p",null," Names, affiliations, emails, and any term you list are replaced across the README, source files, notebooks, and PDF links. Reviewers browse the real thing, not a zip. ")],-1)),n("div",eG,[n("div",tG,[t[13]||(t[13]=n("label",{for:"demo-terms"},[g("Terms to redact "),n("span",null,[g("comma-separated"),n("span",{class:"dt-try"},", try adding your own")])],-1)),A(n("textarea",{id:"demo-terms",class:"demo-terms-input",rows:"1","onUpdate:modelValue":t[0]||(t[0]=i=>e.demoTerms=i),spellcheck:"false",autocomplete:"off",onKeydown:t[1]||(t[1]=Nt(de(()=>{},["prevent"]),["enter"]))},null,544),[[ct,e.demoTerms]])]),n("div",nG,[n("div",sG,[t[15]||(t[15]=n("div",{class:"pane-header"},[n("span",{class:"pane-label"},[g("Your repository "),n("span",{class:"pane-edit-hint"},"\xB7 editable")]),n("span",{class:"pane-url"},"github.com/jane-smith/DeepLearnUtils")],-1)),n("div",oG,[n("div",iG,[(a(!0),l(R,null,_(e.demoParts(),(i,o)=>(a(),l(R,{key:o},[i.redacted?(a(),l("mark",rG,c(i.original),1)):(a(),l(R,{key:1},[g(c(i.text),1)],64))],64))),128)),t[14]||(t[14]=g("\u200B",-1))]),A(n("textarea",{class:"pane-body demo-input","onUpdate:modelValue":t[2]||(t[2]=i=>e.demoText=i),spellcheck:"false","aria-label":"Sample README to anonymize"},null,512),[[ct,e.demoText]])])]),n("div",aG,[n("div",lG,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",dG,[n("span",uG,c(e.demoCount())+" redacted",1)])]),n("div",cG,[(a(!0),l(R,null,_(e.demoParts(),(i,o)=>(a(),l(R,{key:o},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},c(i.text),9,pG)):(a(),l(R,{key:1},[g(c(i.text),1)],64))],64))),128))])])])]),f(" What you get: one screenshot, three tabs "),t[23]||(t[23]=n("section",{class:"paper-section-head paper-wrap",id:"about"},[n("div",null,[n("div",{class:"paper-eyebrow"},"What you get"),n("h2",null,"Anonymize, review, manage.")]),n("p",null," Terms are redacted in text files. Enabled images and PDFs are served unchanged, so review them for identifying content before sharing. Monitor your mirror, update it, or remove it when the review is over. ")],-1)),n("section",fG,[n("div",mG,[(a(!0),l(R,null,_(e.features,(i,o)=>(a(),l("div",{class:T(["paper-feature",{"is-on":e.feature===i?.key}]),key:i?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:r=>e.selectFeature(i.key),onKeydown:r=>e.featureKeydown(r,o),id:"feature-tab-"+i?.key,"aria-controls":"feature-panel-"+i?.key,"aria-selected":e.feature===i?.key,tabindex:e.feature===i?.key?0:-1},[n("span",gG,[n("span",vG,c(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",yG,c(i?.eyebrow),1)]),n("span",bG,[g(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",wG,"-")):f("v-if",!0),g(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)])],40,hG),n("div",kG,[n("span",CG,[g(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",SG,"-")):f("v-if",!0),g(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)]),n("p",null,c(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},c(i?.cta)+" \u2192",9,EG)])],2))),128))]),n("div",NG,[(a(!0),l(R,null,_(e.features,(i,o)=>A((a(),l("div",{class:"paper-feature-panel",role:"tabpanel",key:i?.key,id:"feature-panel-"+i?.key,"aria-labelledby":"feature-tab-"+i?.key},[n("div",TG,[n("div",PG,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",AG,c(i?.url),1)]),n("div",{class:T(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",IG,[...t[19]||(t[19]=[Ae('<div class="fm-label">GitHub reposit
Line truncated
|
||||
<span class="ln">2</span><span class="c"># Author: <span class="redact">XXXX-1</span>, <span class="redact">XXXX-2</span></span>
|
||||
<span class="ln">3</span><span class="k">import</span> torch
|
||||
<span class="ln">4</span><span class="k">from</span> utils <span class="k">import</span> load_config
|
||||
@@ -60,18 +64,18 @@ python experiments/run.py`),n("p",null,[m("Contact: "),n("span",{class:"redact",
|
||||
<span class="ln">7</span> model = build_model(config)
|
||||
<span class="ln">8</span> <span class="k">for</span> epoch <span class="k">in</span> range(config.epochs):
|
||||
<span class="ln">9</span> loss = step(model)
|
||||
<span class="ln">10</span> log(<span class="s">"epoch %d: %.3f"</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",Sj,[...t[21]||(t[21]=[ke('<div class="fm-dash-head"><span>Project</span><span>Status</span><span>Views</span><span>Expires</span></div><div class="fm-dash-row"><span><b>DeepLearnUtils</b><i>paper-7f2a \xB7 ICSE 2027</i></span><span class="st is-ready">Ready</span><span>41</span><span>Mar 31, 2027</span></div><div class="fm-dash-row"><span><b>vision-bench#212</b><i>pull request \xB7 FSE 2027</i></span><span class="st is-ready">Ready</span><span>12</span><span>Never</span></div><div class="fm-dash-row"><span><b>graph-repair</b><i>gr-91ab</i></span><span class="st is-progress">Updating</span><span>5</span><span>Jan 5, 2027</span></div><div class="fm-dash-row is-muted"><span><b>JarSift</b><i>OOPSLA 2025</i></span><span class="st is-expired">Expired</span><span>72</span><span>Sep 28, 2026</span></div>',5)])]))],10,wj)])],8,gj)),[[Q,e.feature===i?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=ke('<section class="paper-qa paper-qa-r3 paper-wrap" aria-labelledby="qa-heading"><div class="qa-head"><div><div class="paper-eyebrow">Before you sign in</div><h2 id="qa-heading">The questions that come up most.</h2></div><a class="paper-link-arrow" href="/faq">Read the full FAQ \u2192</a></div><div class="qa-grid"><div class="q"><a href="/faq#permissions">What access does GitHub sign-in require?</a><p> The GitHub App has read-only access to gists and the repositories you choose. Legacy OAuth uses broader permissions. Anonymous GitHub never writes to your repositories. </p></div><div class="q"><a href="/faq#formats">Which file formats are supported?</a><p> Source code with syntax highlighting, Markdown, Jupyter notebooks, PDFs, images, and GitHub Pages sites. Text files are anonymized; enabled images and PDFs are served unchanged. </p></div><div class="q"><a href="/faq#expiration">What happens when an anonymized repository expires?</a><p> You choose: the mirror is removed, or visitors are redirected to the original GitHub repository once the review is over. </p></div></div></section><section class="paper-cta paper-wrap" aria-labelledby="cta-heading"><div><h2 id="cta-heading">Ready for review?</h2><p>Create an anonymous mirror in a couple of minutes. Reviewers just open the link.</p></div><div class="paper-cta-actions"><a class="btn-hero" href="/signin" target="_self"><i class="fab fa-github" aria-hidden="true"></i> Sign in with GitHub</a><a class="paper-link-arrow" target="_self" href="https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/">See an anonymized repository \u2192</a></div></section>',2)),Me(s,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var Ej={class:"paper-empty"},Nj={class:"paper-empty-inner"},Rj={key:0,class:"paper-eyebrow"},Tj={key:1,class:"paper-eyebrow"},Pj={key:2,class:"paper-empty-title"},Dj=["textContent"];function zp(e,t){return a(),l("div",Ej,[n("div",Nj,[e.error?f("v-if",!0):(a(),l("div",Rj,"Working")),e.error?(a(),l("div",Tj,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",Pj,[...t[0]||(t[0]=[m(" Loading",-1),n("span",{class:"dot-anim"},"\u2026",-1)])])),e.error?(a(),l("h1",{key:3,class:"paper-empty-title",textContent:u(e.fmt.translate(e.error))},null,8,Dj)):f("v-if",!0)])])}var Aj={class:"container paper-page paper-settings"},Ij={class:"paper-crumbs"},Oj={class:"here"},Mj={class:"paper-page-title"},Vj={class:"paper-settings-body"},qj={class:"paper-settings-toc"},Lj={href:"#conf-billing"},Fj={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},_j={id:"conf-basics",class:"paper-settings-section"},$j={class:"form-group"},Uj={class:"invalid-feedback"},Bj={class:"invalid-feedback"},zj={class:"form-group"},Hj={class:"invalid-feedback"},jj={class:"form-group"},Gj={class:"invalid-feedback"},Wj={class:"invalid-feedback"},Kj={id:"conf-window",class:"paper-settings-section"},Yj={class:"form-grid-2"},Jj={class:"form-group"},Xj={class:"invalid-feedback"},Qj={class:"invalid-feedback"},Zj={class:"form-group"},xj={class:"invalid-feedback"},eG={class:"invalid-feedback"},tG={id:"conf-rendering",class:"paper-settings-section"},nG={class:"form-check"},oG={class:"form-check-input",type:"checkbox",id:"link",name:"link"},sG={class:"form-check"},iG={class:"form-check-input",type:"checkbox",id:"image",name:"image"},rG={class:"form-check"},aG={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},lG={class:"form-check"},dG={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},uG={id:"conf-features",class:"paper-settings-section"},cG={class:"form-check"},pG={class:"form-check-input",type:"checkbox",id:"update",name:"update"},fG={class:"form-check"},mG={class:"form-check-input",type:"checkbox",id:"page",name:"page"},hG={id:"conf-plan",class:"paper-settings-section"},gG={key:0,class:"paper-section-copy"},vG={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"},Line truncated
|
||||
`).length))+" lines",1)):f("v-if",!0)]),D(n("button",{type:"button",class:"btn btn-sm btn-icon-only btn-ghost copy-path-btn","aria-label":e.pathCopied?"Path copied":"Copy file path",title:e.pathCopied?"Path copied":"Copy file path",onClick:t[2]||(t[2]=d=>e.copyPath())},[(a(),l("svg",uW,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,cW)]))],8,dW),[[Q,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",pW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[m(u(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,fW),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),m(u(e.languageName||"Text"),1),n("span",mW,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),m(u(e.content.length<1024?e.content.length+" B":(e.content.length/1024).toFixed(1)+" KB"),1)]),t[52]||(t[52]=n("span",{class:"sep"},"\xB7",-1)),m(u(e.fmt?.number(e.content.split(`
|
||||
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",hW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[m(u(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,gW),t[54]||(t[54]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),t[56]||(t[56]=m("Markdown",-1)),e.fileSize(e.filePath)!=null?(a(),l(T,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),m(u(e.formatSize(e.fileSize(e.filePath))),1)],64)):f("v-if",!0)])):f("v-if",!0),e.preview&&e.previewPreserved()?(a(),l("button",{key:2,type:"button",class:"rp-preserved-tag",onClick:t[3]||(t[3]=d=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",vW,[e.isCsv()?(a(),l("div",yW,[n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,bW),n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[5]||(t[5]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,wW)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",kW,[n("button",{type:"button",class:R(["btn btn-sm btn-ghost btn-symbols",{"is-on":e.symbolsOpen}]),"aria-expanded":e.symbolsOpen?"true":"false","aria-haspopup":"true",title:"Symbols in this file",onClick:t[6]||(t[6]=d=>e.symbolsOpen=!e.symbolsOpen)},[...t[57]||(t[57]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-list"})],-1),n("span",{class:"btn-find-label"},"Symbols",-1)])],10,CW),e.symbolsOpen?(a(),l("div",SW,[n("div",EW,u(e.symbols().length)+" "+u(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(T,null,H(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:p=>e.goToSymbol(d.line)},[n("span",{class:R(["symbols-kind","is-"+d.kind])},u(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",RW,u(d.name),1),n("span",TW,u(d.line),1)],8,NW))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:R(["btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find",{"is-on":e.mdFindOpen}]),"aria-label":"Find on this page",title:"Find on this page ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[7]||(t[7]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,PW)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?(a(),l("div",DW,[e.type!="html"?(a(),l("button",{key:0,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-goto","aria-label":"Go to line",title:"Go to line ("+(e.isMac?"\u2318":"Ctrl+")+"G)",onClick:t[8]||(t[8]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,AW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost btn-toggle",{"is-on":e.wrapLines}]),"aria-pressed":e.wrapLines?"true":"false","aria-label":"Wrap lines",title:"Wrap lines (Alt+Z)",onClick:t[9]||(t[9]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,IW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:2,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-find","aria-label":"Find in file",title:"Find in file ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[10]||(t[10]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,OW)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",MW,[n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn",title:e.type=="html"?"Open the Markdown source":"Open the raw file",href:e.safeUrl(e.url)},"Raw",8,VW),typeof e.content=="string"?(a(),l("button",{key:0,type:"button",class:"tb-seg-btn tb-seg-icon","aria-label":e.contentCopied?"Copied":"Copy file contents",title:e.contentCopied?"Copied":"Copy file contents",onClick:t[11]||(t[11]=d=>e.copyContent())},[(a(),l("svg",LW,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,FW)]))],8,qW)):f("v-if",!0),n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn tb-seg-icon","aria-label":"Download file",title:"Download file",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[62]||(t[62]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1)])],8,_W)])):f("v-if",!0),typeof e.content=="string"?(a(),l("button",{key:5,type:"button",class:"btn btn-sm btn-icon-only btn-ghost tb-copy-m","aria-label":e.contentCopied?"Copied":"Copy file contents",onClick:t[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",UW,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,BW)]))],8,$W)):f("v-if",!0),e.type=="html"&&e.t
Line truncated
|
||||
`).length))+" lines",1)],64)):f("v-if",!0)])):f("v-if",!0),e.options?.publishedAt||e.options?.sourceCommitDate||e.options?.anonymizedAt||e.options?.lastUpdateDate?(a(),l("div",ZW)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[17]||(t[17]=d=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),m("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",xW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[18]||(t[18]=d=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),m("Find in file",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:6,type:"button",role:"menuitem",onClick:t[19]||(t[19]=d=>e.gotoLine())},[...t[69]||(t[69]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1),m("Go to line",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:7,type:"button",role:"menuitemcheckbox","aria-checked":e.wrapLines?"true":"false",onClick:t[20]||(t[20]=d=>e.toggleWrap())},[t[70]||(t[70]=n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)),t[71]||(t[71]=m("Wrap lines",-1)),e.wrapLines?(a(),l("span",tK,"\u2713")):f("v-if",!0)],8,eK)):f("v-if",!0),e.isCsv()?(a(),l("button",{key:8,type:"button",role:"menuitem",class:"tb-csv-view",onClick:t[21]||(t[21]=d=>{e.csvView=e.csvView==="table"?"raw":"table",e.moreOpen=!1})},[(a(),l("svg",nK,[n("use",{href:e.csvView==="table"?"#ui-icon-code":"#ui-icon-list"},null,8,oK)])),m(u(e.csvView==="table"?"Show as text":"Show as table"),1)])):f("v-if",!0),e.type!="html"?(a(),l("div",sK)):f("v-if",!0),e.type=="html"&&(!e.preview||e.url)?(a(),l("a",{key:10,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[72]||(t[72]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),m("View raw",-1)])],8,iK)):f("v-if",!0),e.type!="html"&&(!e.preview||e.url)?(a(),l("a",{key:11,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[73]||(t[73]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),m("View raw",-1)])],8,rK)):f("v-if",!0),!e.preview||e.url?(a(),l("a",{key:12,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[74]||(t[74]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1),m("Download file",-1)])],8,aK)):f("v-if",!0),e.options?.hasWebsite?(a(),l("a",{key:13,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/w/"+e.repoId+"/")},[...t[75]||(t[75]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-globe"})],-1),m("Open website",-1)])],8,lK)):f("v-if",!0),e.options?.isAdmin||e.options?.isOwner?(a(),l("a",{key:14,role:"menuitem",href:e.safeUrl("/anonymize/"+e.repoId)},[...t[76]||(t[76]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-edit"})],-1),m("Edit anonymization",-1)])],8,dK)):f("v-if",!0),e.options?.download?(a(),l("a",{key:15,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/api/repo/"+e.repoId+"/zip")},[...t[77]||(t[77]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-archive"})],-1),m("Download ZIP",-1)])],8,uK)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=d=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),m("Copy file path",-1)])]),t[79]||(t[79]=n("div",{class:"tb-menu-sep"},null,-1)),t[80]||(t[80]=n("a",{role:"menuitem",href:"/faq"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-help"})]),m("FAQ")],-1)),t[81]||(t[81]=n("a",{role:"menuitem",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",target:"_blank",rel:"noopener"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),m("Report a bug")],-1))])):f("v-if",!0)])]),e.gotoOpen&&e.type!="html"?(a(),l("form",{key:3,class:"goto-pop",role:"dialog","aria-label":"Go to line",onSubmit:t[26]||(t[26]=re(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),D(n("input",{id:"goto-input",class:"goto-input",type:"text",inputmode:"numeric",autocomplete:"off",spellcheck:"false",placeholder:"1\u2013"+e.fmt?.number(typeof e.content=="string"?e.content.split(`
|
||||
`).length:1),"aria-invalid":e.gotoError?"true":"false","onUpdate:modelValue":t[24]||(t[24]=d=>e.gotoValue=d),onKeydown:t[25]||(t[25]=_t(re(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,cK),[[ot,e.gotoValue]]),n("span",{class:R(["goto-hint",{"is-error":e.gotoError}])},u(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView==="table"?(a(),l("div",{key:0,class:"csv-table-wrap",tabindex:"0",role:"region","aria-label":"Table view of "+(e.paths?.[e.paths.length-1]||"file")},[n("table",fK,[n("thead",null,[n("tr",null,[t[83]||(t[83]=n("th",{class:"csv-rownum",scope:"col"},[n("span",{class:"sr-only"},"Row")],-1)),(a(!0),l(T,null,H(e.csvRows()[0]||[],(d,p)=>(a(),l("th",{scope:"col",key:p,class:R({"is-num":e.csvNumCol(p)})},[(a(!0),l(T,null,H(e.redactParts(d),(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,mK)):(a(),l(T,{key:1},[m(u(c.t),1)],64))],64))),128))],2))),128))])]),n("tbody",null,[(a(!0),l(T,null,H(e.csvRows().slice(1),(d,p)=>(a(),l("tr",{key:p},[n("td",hK,u(p+1),1),(a(!0),l(T,null,H(d,(c,v)=>(a(),l("td",{key:v,class:R({"is-num":e.csvNumCol(v)})},[(a(!0),l(T,null,H(e.redactParts(c),(h,y)=>(a(),l(T,{key:y},[h.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+h.n},[n("i",null,u(h.n),1)],8,gK)):(a(),l(T,{key:1},[m(u(h.t),1)],64))],64))),128))],2))),128))]))),128))])])],8,pK)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?D((a(),l("div",vK,null,512)),[[r,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",yK,[n("input",{type:"search",class:"md-find-input",placeholder:"Find on this page","aria-label":"Find on this page",value:e.mdFindQuery,onInput:t[27]||(t[27]=d=>{e.mdFindQuery=d.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=_t(re(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=_t(re(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,bK),n("span",wK,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[84]||(t[84]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,kK),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=d=>e.stepMdFind(1)),disabled:!e.mdFindTotal},[...t[85]||(t[85]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-right"})],-1)])],8,CK)]),n("span",SK,u(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:R(["md-find-opt",{"is-on":e.mdFindCase}]),"aria-pressed":e.mdFindCase?"true":"false",title:"Match case","aria-label":"Match case",onClick:t[32]||(t[32]=d=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,EK),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=d=>e.toggleMdFind(!1))},"\xD7")])):f("v-if",!0),e.type=="html"?(a(),l("div",NK,[n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,RK),e.tocCount()>=3?(a(),l("aside",TK,[t[86]||(t[86]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",PK,[n("a",{href:"#",class:R(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=re(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(T,{key:0},H(e.tocTitle().parts,(d,p)=>(a(),l(T,{key:p},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,u(d.n),1)],8,DK)):(a(),l(T,{key:1},[m(u(d.t),1)],64))],64))),128)):(a(),l(T,{key:1},[m("Introduction")],64))],2),(a(!0),l(T,null,H(e.readmeToc(),(d,p)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:R(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:re(c=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(T,null,H(d.parts,(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,IK)):(a(),l(T,{key:1},[m(u(c.t),1)],64))],64))),128))],10,AK))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Tt(s,{key:2,content:e.content,"base-url":e.fileBaseUrl,"allow-scripts":e.allowScripts},null,8,["content","base-url","allow-scripts"])):f("v-if",!0),e.fileFrame()?(a(),l("section",{key:3,class:R(["file-card file-card-media","view-"+e.type])},[n("header",OK,[n("div",MK,[n("button",{type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost card-files-btn",{"is-needed":e.sidebarHidden}]),title:"Show file tree",onClick:t[35]||(t[35]=d=>e.sidebarHidden?e.sidebarHidden=!1:e.sidebarCollapsed=!1)},[...t[87]||(t[87]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sidebar"})],-1),n("span",{class:"card-files-label"},"Files",-1)])],2
Line truncated
|
||||
<span class="ln">10</span> log(<span class="s">"epoch %d: %.3f"</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",MG,[...t[21]||(t[21]=[Ae('<div class="fm-dash-head"><span>Project</span><span>Status</span><span>Views</span><span>Expires</span></div><div class="fm-dash-row"><span><b>DeepLearnUtils</b><i>paper-7f2a \xB7 ICSE 2027</i></span><span class="st is-ready">Ready</span><span>41</span><span>Mar 31, 2027</span></div><div class="fm-dash-row"><span><b>vision-bench#212</b><i>pull request \xB7 FSE 2027</i></span><span class="st is-ready">Ready</span><span>12</span><span>Never</span></div><div class="fm-dash-row"><span><b>graph-repair</b><i>gr-91ab</i></span><span class="st is-progress">Updating</span><span>5</span><span>Jan 5, 2027</span></div><div class="fm-dash-row is-muted"><span><b>JarSift</b><i>OOPSLA 2025</i></span><span class="st is-expired">Expired</span><span>72</span><span>Sep 28, 2026</span></div>',5)])]))],10,DG)])],8,RG)),[[ne,e.feature===i?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=Ae('<section class="paper-qa paper-qa-r3 paper-wrap" aria-labelledby="qa-heading"><div class="qa-head"><div><div class="paper-eyebrow">Before you sign in</div><h2 id="qa-heading">The questions that come up most.</h2></div><a class="paper-link-arrow" href="/faq">Read the full FAQ \u2192</a></div><div class="qa-grid"><div class="q"><a href="/faq#permissions">What access does GitHub sign-in require?</a><p> The GitHub App has read-only access to gists and the repositories you choose. Legacy OAuth uses broader permissions. Anonymous GitHub never writes to your repositories. </p></div><div class="q"><a href="/faq#formats">Which file formats are supported?</a><p> Source code with syntax highlighting, Markdown, Jupyter notebooks, PDFs, images, and GitHub Pages sites. Text files are anonymized; enabled images and PDFs are served unchanged. </p></div><div class="q"><a href="/faq#expiration">What happens when an anonymized repository expires?</a><p> You choose: the mirror is removed, or visitors are redirected to the original GitHub repository once the review is over. </p></div></div></section><section class="paper-cta paper-wrap" aria-labelledby="cta-heading"><div><h2 id="cta-heading">Ready for review?</h2><p>Create an anonymous mirror in a couple of minutes. Reviewers just open the link.</p></div><div class="paper-cta-actions"><a class="btn-hero" href="/signin" target="_self"><i class="fab fa-github" aria-hidden="true"></i> Sign in with GitHub</a><a class="paper-link-arrow" target="_self" href="https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/">See an anonymized repository \u2192</a></div></section>',2)),Ue(s,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var VG={class:"paper-empty"},LG={class:"paper-empty-inner"},qG={key:0,class:"paper-eyebrow"},$G={key:1,class:"paper-eyebrow"},FG={key:2,class:"paper-empty-title"},UG=["textContent"];function Df(e,t){return a(),l("div",VG,[n("div",LG,[e.error?f("v-if",!0):(a(),l("div",qG,"Working")),e.error?(a(),l("div",$G,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",FG,[...t[0]||(t[0]=[g(" Loading",-1),n("span",{class:"dot-anim"},"\u2026",-1)])])),e.error?(a(),l("h1",{key:3,class:"paper-empty-title",textContent:c(e.fmt.translate(e.error))},null,8,UG)):f("v-if",!0)])])}var _G={class:"container paper-page paper-settings"},BG={class:"paper-crumbs"},zG={class:"here"},HG={class:"paper-page-title"},jG={class:"paper-settings-body"},GG={class:"paper-settings-toc"},WG={href:"#conf-billing"},KG={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},YG={id:"conf-basics",class:"paper-settings-section"},XG={class:"form-group"},JG={class:"invalid-feedback"},QG={class:"invalid-feedback"},ZG={class:"form-group"},xG={class:"invalid-feedback"},eW={class:"form-group"},tW={class:"invalid-feedback"},nW={class:"invalid-feedback"},sW={id:"conf-window",class:"paper-settings-section"},oW={class:"form-grid-2"},iW={class:"form-group"},rW={class:"invalid-feedback"},aW={class:"invalid-feedback"},lW={class:"form-group"},dW={class:"invalid-feedback"},uW={class:"invalid-feedback"},cW={id:"conf-rendering",class:"paper-settings-section"},pW={class:"form-check"},fW={class:"form-check-input",type:"checkbox",id:"link",name:"link"},mW={class:"form-check"},hW={class:"form-check-input",type:"checkbox",id:"image",name:"image"},gW={class:"form-check"},vW={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},yW={class:"form-check"},bW={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},wW={id:"conf-features",class:"paper-settings-section"},kW={class:"form-check"},CW={class:"form-check-input",type:"checkbox",id:"update",name:"update"},SW={class:"form-check"},EW={class:"form-check-input",type:"checkbox",id:"page",name:"page"},NW={id:"conf-plan",class:"paper-settings-section"},RW={key:0,class:"paper-section-copy"},TW={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"}Line truncated
|
||||
`).length))+" lines",1)):f("v-if",!0)]),A(n("button",{type:"button",class:"btn btn-sm btn-icon-only btn-ghost copy-path-btn","aria-label":e.pathCopied?"Path copied":"Copy file path",title:e.pathCopied?"Path copied":"Copy file path",onClick:t[2]||(t[2]=d=>e.copyPath())},[(a(),l("svg",wK,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,kK)]))],8,bK),[[ne,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",CK,[e.redactionCount()?(a(),l(R,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,SK),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),g(c(e.languageName||"Text"),1),n("span",EK,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),g(c(e.content.length<1024?e.content.length+" B":(e.content.length/1024).toFixed(1)+" KB"),1)]),t[52]||(t[52]=n("span",{class:"sep"},"\xB7",-1)),g(c(e.fmt?.number(e.content.split(`
|
||||
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",NK,[e.redactionCount()?(a(),l(R,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,RK),t[54]||(t[54]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),t[56]||(t[56]=g("Markdown",-1)),e.fileSize(e.filePath)!=null?(a(),l(R,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),g(c(e.formatSize(e.fileSize(e.filePath))),1)],64)):f("v-if",!0)])):f("v-if",!0),e.preview&&e.previewPreserved()?(a(),l("button",{key:2,type:"button",class:"rp-preserved-tag",onClick:t[3]||(t[3]=d=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",TK,[e.isCsv()?(a(),l("div",PK,[n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,AK),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="chart"}]),"aria-checked":e.csvView==="chart",onClick:t[5]||(t[5]=d=>e.csvView="chart"),title:"Chart the table"},"Chart",10,DK),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[6]||(t[6]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,IK)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",OK,[n("button",{type:"button",class:T(["btn btn-sm btn-ghost btn-symbols",{"is-on":e.symbolsOpen}]),"aria-expanded":e.symbolsOpen?"true":"false","aria-haspopup":"true",title:"Symbols in this file",onClick:t[7]||(t[7]=d=>e.symbolsOpen=!e.symbolsOpen)},[...t[57]||(t[57]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-list"})],-1),n("span",{class:"btn-find-label"},"Symbols",-1)])],10,MK),e.symbolsOpen?(a(),l("div",VK,[n("div",LK,c(e.symbols().length)+" "+c(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(R,null,_(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:h=>e.goToSymbol(d.line)},[n("span",{class:T(["symbols-kind","is-"+d.kind])},c(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",$K,c(d.name),1),n("span",FK,c(d.line),1)],8,qK))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:T(["btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find",{"is-on":e.mdFindOpen}]),"aria-label":"Find on this page",title:"Find on this page ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[8]||(t[8]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,UK)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?(a(),l("div",_K,[e.type!="html"?(a(),l("button",{key:0,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-goto","aria-label":"Go to line",title:"Go to line ("+(e.isMac?"\u2318":"Ctrl+")+"G)",onClick:t[9]||(t[9]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,BK)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:T(["btn btn-sm btn-icon-only btn-ghost btn-toggle",{"is-on":e.wrapLines}]),"aria-pressed":e.wrapLines?"true":"false","aria-label":"Wrap lines",title:"Wrap lines (Alt+Z)",onClick:t[10]||(t[10]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,zK)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:2,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-find","aria-label":"Find in file",title:"Find in file ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[11]||(t[11]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,HK)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",jK,[n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn",title:e.type=="html"?"Open the Markdown source":"Open the raw file",href:e.safeUrl(e.url)},"Raw",8,GK),typeof e.content=="string"?(a(),l("button",{key:0,type:"button",class:"tb-seg-btn tb-seg-icon","aria-label":e.contentCopied?"Copied":"Copy file contents",title:e.contentCopied?"Copied":"Copy file contents",onClick:t[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",KK,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,YK)]))],8,WK)):f("v-if",!0),n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn tb-seg-icon","aria-label":"Download file",title:"Download file",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[62]||(t[62]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1)])],8,XK)])):f("v-if",!0),typeof e.content=="string"?(a(),l("button",{key:5,type:"button",class:"btn btn-sm btn-icon-only btn-ghost tb-copy-m","aria-label":e.contentCopied?"Copied
Line truncated
|
||||
`).length))+" lines",1)],64)):f("v-if",!0)])):f("v-if",!0),e.options?.publishedAt||e.options?.sourceCommitDate||e.options?.anonymizedAt||e.options?.lastUpdateDate?(a(),l("div",dY)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[18]||(t[18]=d=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),g("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",uY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[19]||(t[19]=d=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),g("Find in file",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:6,type:"button",role:"menuitem",onClick:t[20]||(t[20]=d=>e.gotoLine())},[...t[69]||(t[69]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1),g("Go to line",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:7,type:"button",role:"menuitemcheckbox","aria-checked":e.wrapLines?"true":"false",onClick:t[21]||(t[21]=d=>e.toggleWrap())},[t[70]||(t[70]=n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)),t[71]||(t[71]=g("Wrap lines",-1)),e.wrapLines?(a(),l("span",pY,"\u2713")):f("v-if",!0)],8,cY)):f("v-if",!0),e.isCsv()?(a(),l(R,{key:8},_(["table","chart","raw"],d=>n("button",{type:"button",role:"menuitemradio",class:"tb-csv-view",key:d,"aria-checked":e.csvView===d?"true":"false",onClick:h=>{e.csvView=d,e.moreOpen=!1}},[(a(),l("svg",mY,[n("use",{href:d==="raw"?"#ui-icon-code":d==="chart"?"#ui-icon-chart":"#ui-icon-list"},null,8,hY)])),g(c(d==="raw"?"Show as text":d==="chart"?"Show as chart":"Show as table"),1),e.csvView===d?(a(),l("span",gY,"\u2713")):f("v-if",!0)],8,fY)),64)):f("v-if",!0),e.type!="html"?(a(),l("div",vY)):f("v-if",!0),e.type=="html"&&(!e.preview||e.url)?(a(),l("a",{key:10,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[72]||(t[72]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),g("View raw",-1)])],8,yY)):f("v-if",!0),e.type!="html"&&(!e.preview||e.url)?(a(),l("a",{key:11,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[73]||(t[73]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),g("View raw",-1)])],8,bY)):f("v-if",!0),!e.preview||e.url?(a(),l("a",{key:12,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[74]||(t[74]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1),g("Download file",-1)])],8,wY)):f("v-if",!0),e.options?.hasWebsite?(a(),l("a",{key:13,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/w/"+e.repoId+"/")},[...t[75]||(t[75]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-globe"})],-1),g("Open website",-1)])],8,kY)):f("v-if",!0),e.options?.isAdmin||e.options?.isOwner?(a(),l("a",{key:14,role:"menuitem",href:e.safeUrl("/anonymize/"+e.repoId)},[...t[76]||(t[76]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-edit"})],-1),g("Edit anonymization",-1)])],8,CY)):f("v-if",!0),e.options?.download?(a(),l("a",{key:15,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/api/repo/"+e.repoId+"/zip")},[...t[77]||(t[77]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-archive"})],-1),g("Download ZIP",-1)])],8,SY)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=d=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),g("Copy file path",-1)])]),t[79]||(t[79]=n("div",{class:"tb-menu-sep"},null,-1)),t[80]||(t[80]=n("a",{role:"menuitem",href:"/faq"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-help"})]),g("FAQ")],-1)),t[81]||(t[81]=n("a",{role:"menuitem",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",target:"_blank",rel:"noopener"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),g("Report a bug")],-1))])):f("v-if",!0)])]),e.gotoOpen&&e.type!="html"?(a(),l("form",{key:3,class:"goto-pop",role:"dialog","aria-label":"Go to line",onSubmit:t[26]||(t[26]=de(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),A(n("input",{id:"goto-input",class:"goto-input",type:"text",inputmode:"numeric",autocomplete:"off",spellcheck:"false",placeholder:"1\u2013"+e.fmt?.number(typeof e.content=="string"?e.content.split(`
|
||||
`).length:1),"aria-invalid":e.gotoError?"true":"false","onUpdate:modelValue":t[24]||(t[24]=d=>e.gotoValue=d),onKeydown:t[25]||(t[25]=Nt(de(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,EY),[[ct,e.gotoValue]]),n("span",{class:T(["goto-hint",{"is-error":e.gotoError}])},c(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView!=="raw"?(a(),Et(s,{key:0,rows:e.csvRows(),name:e.paths?.[e.paths.length-1],"state-key":e.preview?null:"table",view:e.csvView},null,8,["rows","name","state-key","view"])):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?A((a(),l("div",NY,null,512)),[[u,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",RY,[n("input",{type:"search",class:"md-find-input",placeholder:"Find on this page","aria-label":"Find on this page",value:e.mdFindQuery,onInput:t[27]||(t[27]=d=>{e.mdFindQuery=d.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=Nt(de(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=Nt(de(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,TY),n("span",PY,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[83]||(t[83]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,AY),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=d=>e.stepMdFind(1)),disabled:!e.mdFindTotal},[...t[84]||(t[84]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-right"})],-1)])],8,DY)]),n("span",IY,c(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:T(["md-find-opt",{"is-on":e.mdFindCase}]),"aria-pressed":e.mdFindCase?"true":"false",title:"Match case","aria-label":"Match case",onClick:t[32]||(t[32]=d=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,OY),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=d=>e.toggleMdFind(!1))},"\xD7")])):f("v-if",!0),e.type=="html"?(a(),l("div",MY,[A(n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,VY),[[p]]),e.tocCount()>=3?(a(),l("aside",LY,[t[85]||(t[85]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",qY,[n("a",{href:"#",class:T(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=de(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(R,{key:0},_(e.tocTitle().parts,(d,h)=>(a(),l(R,{key:h},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,c(d.n),1)],8,$Y)):(a(),l(R,{key:1},[g(c(d.t),1)],64))],64))),128)):(a(),l(R,{key:1},[g("Introduction")],64))],2),(a(!0),l(R,null,_(e.readmeToc(),(d,h)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:T(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:de(m=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(R,null,_(d.parts,(m,y)=>(a(),l(R,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,UY)):(a(),l(R,{key:1},[g(c(m.t),1)],64))],64))),128))],10,FY))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Et(i,{key:2,content:e.content,"base-url":e.fileBaseUrl,"allow-scripts":e.allowScripts},null,8,["content","base-url","allow-scripts"])):f("v-if",!0),e.fileFrame()?(a(),l("section",{key:3,class:T(["file-card file-card-media","view-"+e.type])},[n("header",_Y,[n("div",BY,[n("button",{type:"button",class:T(["btn btn-sm btn-icon-only btn-ghost card-files-btn",{"is-needed":e.sidebarHidden}]),title:"Show file tree",onClick:t[35]||(t[35]=d=>e.sidebarHidden?e.sidebarHidden=!1:e.sidebarCollapsed=!1)},[...t[86]||(t[86]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sidebar"})],-1),n("span",{class:"card-files-label"},"Files",-1)])],2),n("ol",zY,[n("li",HY,[n("a",{href:e.safeUrl("/r/"+e.repoId+"/"),title:e.repoId,textContent:c(/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e.repoId||"")?"repository":e.repoId)},null,8,jY)]),(a(!0),l(R,null,_(e.paths,(d,h)=>(a(),l("li",{class:"breadcrumb-item","aria-current":h===e.paths.length-1?"page":null},[(a(!0),l(R,null,_(e.redactParts(d),(m,y)=>(a(),l(R,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,WY)):(a(),l(R,{key:1},[g(c(m.t),1)],64))],64))),128))],8,GY))),256))]),n("span",KY,[e.type=="IPython"&&e.redactionCount()?(a(),l("b",{key:0,class:"ms-item ms-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[87]||(t[87]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,YY)):f("v-if",!0),n("span",XY,c(e.fileKind()),1),e.imageSize?(a(),l("span",JY,c(e.imageSize),1)):f("v-if",!0),e.fileSize(e.filePath)!=n
Line truncated
|
||||
`).length+1)),placeholder:`Jane Smith
|
||||
MIT CSAIL
|
||||
jane.smith@example.org`},null,8,JJ),[[i,{state:e.viewState,set:r=>{e.terms=r},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",XJ,[t[25]||(t[25]=n("summary",null,"Regex & replacement syntax",-1)),n("p",null,[t[21]||(t[21]=m("Matches become ",-1)),n("code",null,u(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[22]||(t[22]=m(". Use ",-1)),t[23]||(t[23]=n("code",null,"term=>replacement",-1)),t[24]||(t[24]=m(" for a custom replacement. Regex is supported.",-1))])]),D(n("div",QJ,"Terms are in an invalid format.",512),[[Q,e.defaultsForm?.terms?.errors?.format]])])]),n("section",ZJ,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",xJ,[n("label",eX,[D(n("input",tX,null,512),[[i,{state:e.viewState,set:r=>{e.options.link=r},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=m("Keep links",-1))]),n("label",nX,[D(n("input",oX,null,512),[[i,{state:e.viewState,set:r=>{e.options.image=r},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=m("Display images",-1))]),n("label",sX,[D(n("input",iX,null,512),[[i,{state:e.viewState,set:r=>{e.options.pdf=r},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=m("Display PDFs",-1))]),n("label",rX,[D(n("input",aX,null,512),[[i,{state:e.viewState,set:r=>{e.options.notebook=r},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=m("Display notebooks",-1))]),n("label",lX,[D(n("input",dX,null,512),[[i,{state:e.viewState,set:r=>{e.options.loc=r},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=m("Show line counts",-1))]),n("label",uX,[D(n("input",cX,null,512),[[i,{state:e.viewState,set:r=>{e.options.page=r},value:e.options?.page,form:"defaultsForm",options:{}}]]),t[32]||(t[32]=m("GitHub Pages",-1))])]),t[33]||(t[33]=n("p",{class:"settings-help"},"Images and PDFs are not anonymized.",-1)),t[34]||(t[34]=n("p",{class:"settings-help"},"GitHub Pages must use the anonymized branch.",-1))])]),n("section",pX,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",fX,[D(n("input",mX,null,512),[[i,{state:e.viewState,set:r=>{e.options.update=r},value:e.options?.update,form:"defaultsForm",options:{}}]]),t[36]||(t[36]=m("Auto-update from GitHub",-1))]),t[37]||(t[37]=n("p",{class:"settings-help"},"Latest commit, at most once an hour.",-1))])]),n("section",hX,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[D((a(),l("select",gX,[...t[39]||(t[39]=[n("option",{value:"redirect"},"Redirect visitors to the GitHub repository",-1),n("option",{value:"remove",selected:""},"Remove the anonymized repository",-1)])])),[[i,{state:e.viewState,set:r=>{e.options.expirationMode=r},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",vX,u(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",yX,[n("div",bX,[e.draftRestored?(a(),l("span",wX,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",kX,"Unsaved changes"+u(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",CX,u(e.message?"Defaults saved":"No unsaved changes"),1))]),e.draftRestored||e.unsavedChanges?(a(),l("button",{key:0,type:"button",class:"draft-discard",onClick:t[0]||(t[0]=r=>e.discardDraft())},"Discard changes")):f("v-if",!0),n("button",{id:"save",type:"submit",class:R(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},u(e.saving?"Saving\u2026":"Save defaults"),11,SX),e.error?(a(),l("div",EX,u(e.error),1)):f("v-if",!0)])],32)),[[o,e.viewState]])],512),[[Q,e.settingsTab==="defaults"]]),D(n("section",{id:"settings-billing","aria-busy":e.billingLoading||e.billingBusy},[t[95]||(t[95]=n("p",{class:"settings-scope"},"Your plan and usage. Reviewer access is always free.",-1)),e.billingLoading?(a(),l("p",RX,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",TX,[m(u(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=r=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,PX)])):f("v-if",!0),e.billingNotice?(a(),l("p",DX,u(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",AX,[t[42]||(t[42]=n("strong",null,"Confirming your payment",-1)),t[43]||(t[43]=n("p",null,"Your allowance will update after confirmation. Please do not pay again.",-1)),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[4]||(t[4]=r=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,IX)])):f("v-if",!0),n("section",OX,[n("div",MX,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",VX,u(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",qX,[m(u(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access u
Line truncated
|
||||
jane.smith@example.org`},null,8,sQ),[[i,{state:e.viewState,set:r=>{e.terms=r},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",oQ,[t[25]||(t[25]=n("summary",null,"Regex & replacement syntax",-1)),n("p",null,[t[21]||(t[21]=g("Matches become ",-1)),n("code",null,c(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[22]||(t[22]=g(". Use ",-1)),t[23]||(t[23]=n("code",null,"term=>replacement",-1)),t[24]||(t[24]=g(" for a custom replacement. Regex is supported.",-1))])]),A(n("div",iQ,"Terms are in an invalid format.",512),[[ne,e.defaultsForm?.terms?.errors?.format]])])]),n("section",rQ,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",aQ,[n("label",lQ,[A(n("input",dQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.link=r},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=g("Keep links",-1))]),n("label",uQ,[A(n("input",cQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.image=r},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=g("Display images",-1))]),n("label",pQ,[A(n("input",fQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.pdf=r},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=g("Display PDFs",-1))]),n("label",mQ,[A(n("input",hQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.notebook=r},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=g("Display notebooks",-1))]),n("label",gQ,[A(n("input",vQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.loc=r},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=g("Show line counts",-1))]),n("label",yQ,[A(n("input",bQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.page=r},value:e.options?.page,form:"defaultsForm",options:{}}]]),t[32]||(t[32]=g("GitHub Pages",-1))])]),t[33]||(t[33]=n("p",{class:"settings-help"},"Images and PDFs are not anonymized.",-1)),t[34]||(t[34]=n("p",{class:"settings-help"},"GitHub Pages must use the anonymized branch.",-1))])]),n("section",wQ,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",kQ,[A(n("input",CQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.update=r},value:e.options?.update,form:"defaultsForm",options:{}}]]),t[36]||(t[36]=g("Auto-update from GitHub",-1))]),t[37]||(t[37]=n("p",{class:"settings-help"},"Latest commit, at most once an hour.",-1))])]),n("section",SQ,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[A((a(),l("select",EQ,[...t[39]||(t[39]=[n("option",{value:"redirect"},"Redirect visitors to the GitHub repository",-1),n("option",{value:"remove",selected:""},"Remove the anonymized repository",-1)])])),[[i,{state:e.viewState,set:r=>{e.options.expirationMode=r},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",NQ,c(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",RQ,[n("div",TQ,[e.draftRestored?(a(),l("span",PQ,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",AQ,"Unsaved changes"+c(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",DQ,c(e.message?"Defaults saved":"No unsaved changes"),1))]),e.draftRestored||e.unsavedChanges?(a(),l("button",{key:0,type:"button",class:"draft-discard",onClick:t[0]||(t[0]=r=>e.discardDraft())},"Discard changes")):f("v-if",!0),n("button",{id:"save",type:"submit",class:T(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},c(e.saving?"Saving\u2026":"Save defaults"),11,IQ),e.error?(a(),l("div",OQ,c(e.error),1)):f("v-if",!0)])],32)),[[o,e.viewState]])],512),[[ne,e.settingsTab==="defaults"]]),A(n("section",{id:"settings-billing","aria-busy":e.billingLoading||e.billingBusy},[t[95]||(t[95]=n("p",{class:"settings-scope"},"Your plan and usage. Reviewer access is always free.",-1)),e.billingLoading?(a(),l("p",VQ,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",LQ,[g(c(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=r=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,qQ)])):f("v-if",!0),e.billingNotice?(a(),l("p",$Q,c(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",FQ,[t[42]||(t[42]=n("strong",null,"Confirming your payment",-1)),t[43]||(t[43]=n("p",null,"Your allowance will update after confirmation. Please do not pay again.",-1)),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[4]||(t[4]=r=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,UQ)])):f("v-if",!0),n("section",_Q,[n("div",BQ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",zQ,c(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",HQ,[g(c(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access
Line truncated
|
||||
`);t.innerHTML=s.map(i=>{let o=i.replace(/^(<[^>]+>)+/,"").charAt(0),r=i.startsWith("@@")?"hunk":o==="+"?"add":o==="-"?"remove":"";return`<span class="md-diff-line${r?" is-"+r:""}">${i||" "}</span>`}).join(`
|
||||
`)}),rf=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},uf=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let s=t.querySelectorAll(".md-diff-line");if(s.length){s.forEach(o=>{o.classList.contains("is-hunk")||o.style.setProperty("--hang",rf(o.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let i=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
|
||||
`).map(o=>{let r=i.join("");o.replace(/<\/?span\b[^>]*>/g,p=>(p.startsWith("</")?i.pop():i.push(p),p));let d=o.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${rf(d)}ch">${r}${o||" "}${"</span>".repeat(i.length)}</span>`}).join(`
|
||||
`)})},nse=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",hl={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),s=()=>{let i=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?Go(i):i,df(t.value),uf(t.value),e.idPrefix!=null){let o={};t.value.querySelectorAll("h1, h2, h3").forEach(r=>{let d=e.idPrefix+(r.id||nse(r.textContent));o[d]?d+="-"+ ++o[d]:o[d]=1,r.id=d})}e.onOutline?.(or(t.value))};return vn(()=>{s(),ut(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>Se("markdown",{ref:t,class:e.reader?"markdown-body":null})}},af=e=>In(e).map(t=>t.n?Se("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},Se("i",t.n)):t.t),ml=e=>/^XXXX-\d+$/.test(String(e||"").trim()),ose=(e,t="Reviewer")=>e?Se("span",{class:["pr-author",{"is-redacted":ml(e)}],title:ml(e)?"Redacted author":null},ml(e)?af(e):["@",...af(e)]):Se("span",{class:"pr-author is-hidden"},t),sse={props:["comments","fmt"],setup(e){return()=>Se("div",{class:"pr-thread"},(e.comments||[]).map((t,s)=>Se("article",{class:["pr-thread-comment",{"is-reply":s>0}],key:s},[Se("header",{class:"pr-thread-head"},[Se("span",{class:"pr-avatar","aria-hidden":"true"},Se("svg",{class:"ui-icon"},Se("use",{href:"#ui-icon-user"}))),ose(t.author),t.creationDate||t.updatedDate?Se("time",{class:"pr-thread-date",datetime:t.creationDate||t.updatedDate},e.fmt?.date(t.creationDate||t.updatedDate)):null]),t.body?Se("div",{class:"pr-thread-body"},Se(hl,{content:t.body,reader:!0})):null])))}},ise={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),s=()=>je(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),df(t.value),uf(t.value)});return vn(s),ut(()=>[e.file?.content,e.terms,e.options],s,{deep:!0}),()=>{let i=e.file||{},o=(i.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(o)||i.language==="Markdown")return Se("gist-file",{ref:t},Se(hl,{content:i.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));let r={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},d=(i.language||o||"none").toLowerCase();return Se("gist-file",{ref:t},Se("pre",{class:"line-numbers"},Se("code",{class:"language-"+(r[d]||d),key:i.content},i.content||"")))}}},rse=e=>e?.querySelectorAll(".nb-input pre").forEach(t=>{if(t.parentElement?.classList.contains("nb-code-scroll"))return;let s=document.createElement("div");s.className="nb-code-scroll",t.replaceWith(s),s.appendChild(t);let i=()=>{let o=t.scrollWidth-t.clientWidth>1;if(s.classList.toggle("is-overflowing",o),s.classList.toggle("is-at-end",o&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!o)return;let r=t.clientWidth-16,d=Math.max(24,r*t.clientWidth/t.scrollWidth);s.style.setProperty("--thumb-w",d+"px"),s.style.setProperty("--thumb-x",(r-d)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",i,{passive:!0}),window.ResizeObserver?new ResizeObserver(i).observe(t):i(),i()}),ase={props:["file","content"],setup(e){let t=Ct(null),s=0,i,o=async()=>{let r=++s;i?.abort(),i=new AbortController;try{let d=e.content?JSON.parse(e.content):await fetch(e.file?.download_url||e.file,{signal:i.signal}).then(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await xn("notebook"),r!==s)return;t.value.innerHTML=Go(DOMPurify.sanitize(nb.parse(d).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),rse(t.value)}catch(d){r===s&&d.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return vn(()=>{o(),ut(()=>[e.file,e.content],o)}),ao(()=>{s++,i?.abort()}),()=>Se("notebook",{ref:t})}},lse={props:["stats"],setup(e){return()=>{let t=Object.entries(e.stats||{}).filter(([,i])=>i.code),s=t.reduce((i,[,o])=>i+o.code,0);return Se("loc",t.map(([i,o])=>Se("div",{class:"lang",title:`${i}: ${o.code.toLocaleString()} lines`,style:{width:o.code*100/s+"%",background:langColors[i]}})))}}},cf={Markdown:hl,GistFile:ise,PrThread:sse,Notebook:ase,Loc:lse,HtmlDoc:nf,QuotaUsage:ese,Pdfviewer:Rd(async()=>(await xn("pdf"),pdfjsLib.GlobalWorkerOptions.workerSrc="/script/external/pdf.worker.js",of))},pf={async mounted(e,{value:t}){e._editorValue=t;try{if(await ci(),e._editorDisposed)return;let s=e._editorValue,i=ace.edit(e);e._editor=i,i.setValue(String(s.content??""),-1),lf(e,s.options),e._editorCleanup=s.options?.onLoad?.(i)}catch(s){e._editorDisposed||(e.textContent=s.message)}},updated(e,{value:t}){e._editorValue=t,e._editor&&(e._editor.getValue()!==String(t.content??"")&&e._editor.setValue(String(t.content??""),-1),lf(e,t.options))},beforeUnmount(e){e._editorDisposed=!0,e._editorCleanup?.(),e._editor?.destroy()}};function lf(e,t={}){let s=tse.has(t.mode)?t.mode:"text";e._editor.session.setMode("ace/mode/"+s),t.theme&&e._edi
Line truncated
|
||||
`)}),rm=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},um=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let s=t.querySelectorAll(".md-diff-line");if(s.length){s.forEach(o=>{o.classList.contains("is-hunk")||o.style.setProperty("--hang",rm(o.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let i=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
|
||||
`).map(o=>{let r=i.join("");o.replace(/<\/?span\b[^>]*>/g,p=>(p.startsWith("</")?i.pop():i.push(p),p));let u=o.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${rm(u)}ch">${r}${o||" "}${"</span>".repeat(i.length)}</span>`}).join(`
|
||||
`)})},Mae=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",Wl={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=vt(null),s=()=>{let i=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?Qs(i):i,dm(t.value),um(t.value),e.idPrefix!=null){let o={};t.value.querySelectorAll("h1, h2, h3").forEach(r=>{let u=e.idPrefix+(r.id||Mae(r.textContent));o[u]?u+="-"+ ++o[u]:o[u]=1,r.id=u})}mi(t.value),e.onOutline?.(hr(t.value))};return Wt(()=>{s(),dt(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>Se("markdown",{ref:t,class:e.reader?"markdown-body":null})}},am=e=>en(e).map(t=>t.n?Se("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},Se("i",t.n)):t.t),Gl=e=>/^XXXX-\d+$/.test(String(e||"").trim()),Vae=(e,t="Reviewer")=>e?Se("span",{class:["pr-author",{"is-redacted":Gl(e)}],title:Gl(e)?"Redacted author":null},Gl(e)?am(e):["@",...am(e)]):Se("span",{class:"pr-author is-hidden"},t),Lae={props:["comments","fmt"],setup(e){return()=>Se("div",{class:"pr-thread"},(e.comments||[]).map((t,s)=>Se("article",{class:["pr-thread-comment",{"is-reply":s>0}],key:s},[Se("header",{class:"pr-thread-head"},[Se("span",{class:"pr-avatar","aria-hidden":"true"},Se("svg",{class:"ui-icon"},Se("use",{href:"#ui-icon-user"}))),Vae(t.author),t.creationDate||t.updatedDate?Se("time",{class:"pr-thread-date",datetime:t.creationDate||t.updatedDate},e.fmt?.date(t.creationDate||t.updatedDate)):null]),t.body?Se("div",{class:"pr-thread-body"},Se(Wl,{content:t.body,reader:!0})):null])))}},qae={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=vt(null),s=()=>We(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),dm(t.value),um(t.value)});return Wt(s),dt(()=>[e.file?.content,e.terms,e.options],s,{deep:!0}),()=>{let i=e.file||{},o=(i.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(o)||i.language==="Markdown")return Se("gist-file",{ref:t},Se(Wl,{content:i.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));let r={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},u=(i.language||o||"none").toLowerCase();return Se("gist-file",{ref:t},Se("pre",{class:"line-numbers"},Se("code",{class:"language-"+(r[u]||u),key:i.content},i.content||"")))}}},$ae=e=>e?.querySelectorAll(".nb-input pre").forEach(t=>{if(t.parentElement?.classList.contains("nb-code-scroll"))return;let s=document.createElement("div");s.className="nb-code-scroll",t.replaceWith(s),s.appendChild(t);let i=()=>{let o=t.scrollWidth-t.clientWidth>1;if(s.classList.toggle("is-overflowing",o),s.classList.toggle("is-at-end",o&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!o)return;let r=t.clientWidth-16,u=Math.max(24,r*t.clientWidth/t.scrollWidth);s.style.setProperty("--thumb-w",u+"px"),s.style.setProperty("--thumb-x",(r-u)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",i,{passive:!0}),window.ResizeObserver?new ResizeObserver(i).observe(t):i(),i()}),Fae={props:["file","content"],setup(e){let t=vt(null),s=0,i,o=async()=>{let r=++s;i?.abort(),i=new AbortController;try{let u=e.content?JSON.parse(e.content):await fetch(e.file?.download_url||e.file,{signal:i.signal}).then(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await os("notebook"),r!==s)return;t.value.innerHTML=Qs(DOMPurify.sanitize(nb.parse(u).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),$ae(t.value),mi(t.value)}catch(u){r===s&&u.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return Wt(()=>{o(),dt(()=>[e.file,e.content],o)}),On(()=>{s++,i?.abort()}),()=>Se("notebook",{ref:t})}},Uae={props:["stats"],setup(e){return()=>{let t=Object.entries(e.stats||{}).filter(([,i])=>i.code),s=t.reduce((i,[,o])=>i+o.code,0);return Se("loc",t.map(([i,o])=>Se("div",{class:"lang",title:`${i}: ${o.code.toLocaleString()} lines`,style:{width:o.code*100/s+"%",background:langColors[i]}})))}}},cm={Markdown:Wl,GistFile:qae,PrThread:Lae,Notebook:Fae,Loc:Uae,HtmlDoc:jf,QuotaUsage:Iae,DataTable:jl,Pdfviewer:su(async()=>(await os("pdf"),pdfjsLib.GlobalWorkerOptions.workerSrc="/script/external/pdf.worker.js",Gf))},pm={async mounted(e,{value:t}){e._editorValue=t;try{if(await Ci(),e._editorDisposed)return;let s=e._editorValue,i=ace.edit(e);e._editor=i,i.setValue(String(s.content??""),-1),lm(e,s.options),e._editorCleanup=s.options?.onLoad?.(i)}catch(s){e._editorDisposed||(e.textContent=s.message)}},updated(e,{value:t}){e._editorValue=t,e._editor&&(e._editor.getValue()!==String(t.content??"")&&e._editor.setValue(String(t.content??""),-1),lm(e,t.options))},beforeUnmount(e){e._editorDisposed=!0,e._editorCleanup?.(),e._editor?.destroy()}};function lm(e,t={}){let s=Oae.has(t.mode)?t.mode:"text";e._editor.session.s
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
@vue/shared/dist/shared.esm-bundler.js:
|
||||
|
||||
Reference in new issue
Block a user