fix: make the admin billing tab count sales consistently and show amounts

- The subscriptions list shows one row per sale, grouped with the same
  stages as the summary: a paper pack is one "Paper pack" row with its
  parts on a second line. Filters, state tabs, sort and pagination count
  sales. A new "Started" filter matches the summary periods.
- N days now draw N buckets ending today (12 months: 52 weeks), and the
  tiles count from the same start.
- One family vocabulary: Subscriptions, Repository add-ons, Conferences in
  the legend, the By-plan grouping and the list.
- Cancelling folds into "Renews / ends", revocation into "Status"; rows
  have one height. Names and repository ids use proportional figures,
  since Inter's tabular figures widen hyphens.
- New Amount column (cached Stripe list price, per period for
  subscriptions, once per pack). Chart tooltips show count and revenue
  per family and the total per currency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Thomas DurieuxandClaude Opus 5.5 committed 2026-11-16 15:28:19 +00:00
1 parent 982a778bdf
commit 1e99cda5e0
12 files changed
+525 -235

No files matched your search

+1 -1
View File
@@ -79,7 +79,7 @@ if includes(["/", "other", "/dashboard", "/anonymize", "/healthcheck", "/api/hea
}
}
# BEGIN GENERATED DIAGNOSTICS
source_functions = {"src/cli/index.ts":["<anonymous>","generateRandomFileName","main"],"build/cli/index.js":["<anonymous>","generateRandomFileName","main"],"src/config.ts":["<anonymous>"],"build/config.js":["<anonymous>"],"src/core/AnonymizedFile.ts":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"build/core/AnonymizedFile.js":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"src/core/AnonymousError.ts":["<anonymous>","detail","toString","url"],"build/core/AnonymousError.js":["<anonymous>","detail","toString","url"],"src/core/Conference.ts":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"build/core/Conference.js":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"src/core/Gist.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/Gist.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/GitHubUtils.ts":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"build/core/GitHubUtils.js":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"src/core/PullRequest.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/PullRequest.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/Repository.ts":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"build/core/Repository.js":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"src/core/User.ts":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"build/core/User.js":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"src/core/anonymization-pool.ts":["<anonymous>","anonymizeOnWorker","cancel","exited","failed","finish","getAnonymizationPoolStats","message","pump","release","releaseSpool","reserveSpool"],"build/core/anonymization-pool.js":["Line truncated
source_functions = {"src/cli/index.ts":["<anonymous>","generateRandomFileName","main"],"build/cli/index.js":["<anonymous>","generateRandomFileName","main"],"src/config.ts":["<anonymous>"],"build/config.js":["<anonymous>"],"src/core/AnonymizedFile.ts":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"build/core/AnonymizedFile.js":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"src/core/AnonymousError.ts":["<anonymous>","detail","toString","url"],"build/core/AnonymousError.js":["<anonymous>","detail","toString","url"],"src/core/Conference.ts":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"build/core/Conference.js":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"src/core/Gist.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/Gist.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/GitHubUtils.ts":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"build/core/GitHubUtils.js":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"src/core/PullRequest.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/PullRequest.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/Repository.ts":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"build/core/Repository.js":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"src/core/User.ts":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"build/core/User.js":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"src/core/anonymization-pool.ts":["<anonymous>","anonymizeOnWorker","cancel","exited","failed","finish","getAnonymizationPoolStats","message","pump","release","releaseSpool","reserveSpool"],"build/core/anonymization-pool.js":["Line truncated
for_each(["errorType", "causeType"]) -> |_index, key| {
value = get(record, [key]) ?? null
if includes(["Error","TypeError","RangeError","ReferenceError","SyntaxError","URIError","EvalError","AggregateError","AnonymousError","HTTPError","RequestError","MongoServerError","MongoNetworkError","MongoServerSelectionError","ValidationError","TimeoutError","AbortError","UnknownError"], value) { out = set!(out, [key], value) }
+2 -2
View File
@@ -1,8 +1,8 @@
{
"core.min.js": "core.d23af1c652.min.js",
"vendor.min.js": "vendor.64e9833dd5.min.js",
"vendor.min.js": "vendor.362291990e.min.js",
"mermaid.min.js": "mermaid.a7356d5ed1.min.js",
"all.min.css": "all.e8df2ae9d6.min.css",
"all.min.css": "all.372d62b9f7.min.css",
"markdown.min.js": "markdown.6c8dfb7b1d.min.js",
"pdf.min.js": "pdf.4d9cc6ff49.min.js",
"notebook.min.js": "notebook.c3144c18ae.min.js",
+1 -1
View File
@@ -10,4 +10,4 @@
@container explorer-file (max-width: 700px) {
.reviewer-preview .file-card-head .file-card-meta, .reviewer-preview .file-card-head .symbols { display: none !important; }
}
.reviewer-preview .rp-main{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.reviewer-preview .rp-document{flex:1 1 auto;min-height:0;min-width:0;overflow:auto;scrollbar-width:thin;position:relative}.reviewer-preview button.rp-count{background:0 0;border:0;padding:0;font:inherit;cursor:pointer;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:3px}.reviewer-preview button.rp-count:hover{text-decoration-color:currentColor}@media (max-width:767px){.reviewer-preview .file-card-head .rp-preserved-tag{display:none}}.billing-page{--bl-subscription:#008C7E;--bl-repository:#D0652A;--bl-conference:#6250D6}.dark-mode .billing-page{--bl-subscription:#16A091;--bl-repository:#D95926;--bl-conference:#9085E9}.billing-page .bl-subscription{background:var(--bl-subscription)!important}.billing-page .bl-repository{background:var(--bl-repository)!important}.billing-page .bl-conference{background:var(--bl-conference)!important}.billing-page .bl-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;margin:4px 0 0}.billing-page .bl-basis{margin:0;font-size:12px;color:var(--ink-muted)}.billing-page .bl-message{display:flex;align-items:center;gap:8px;margin:14px 0 0;padding:10px 14px;border:1px solid var(--border-color);border-radius:var(--radius-control,8px);font-size:13px;color:var(--color);background:var(--paper-card)}.billing-page .bl-message .ui-icon{width:16px;height:16px;flex:none;color:var(--ink-muted)}.billing-page .bl-message.ov-performance-warning{border-color:color-mix(in srgb,var(--status-progress) 45%,var(--border-color));background:color-mix(in srgb,var(--status-progress) 8%,var(--paper-card))}.billing-page .bl-message.ov-performance-warning .ui-icon{color:var(--status-progress)}.billing-page .bl-message .btn{margin-left:auto}.overview-page .bl-kpi-row{grid-template-columns:repeat(6,minmax(0,1fr));margin:16px 0 16px}.overview-page .bl-kpi-row .ov-kpi-card{min-width:0;padding:16px 18px}.overview-page .bl-kpi-row .ov-kpi-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overview-page .bl-kpi-row .ov-kpi-sub{white-space:normal;overflow-wrap:anywhere;line-height:1.4}.overview-page .bl-kpi-row .ov-kpi-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overview-page .bl-kpi-row .bl-muted-value{color:var(--ink-muted);font-size:20px;line-height:28px}.overview-page .bl-kpi-row.is-loading .ov-kpi-card{opacity:.6}.billing-page .bl-skeleton-value{display:block;width:50%;height:28px;margin:4px 0;border-radius:6px}@media (max-width:1279px){.overview-page .bl-kpi-row{grid-template-columns:repeat(3,minmax(0,1fr))!important}}@media (max-width:767px){.overview-page .bl-kpi-row{grid-template-columns:repeat(2,minmax(0,1fr))!important}}.billing-page .bl-health{display:flex;align-items:center;flex-wrap:wrap;gap:6px 20px;padding:10px 16px;margin:0 0 16px;border:1px solid var(--border-color);border-radius:var(--radius-control,8px);background:var(--paper-card);font-size:13px;font-variant-numeric:tabular-nums}.billing-page .bl-health-title{display:inline-flex;align-items:center;gap:8px;font-weight:600}.billing-page .bl-health-title .ov-svc-dot{width:8px;height:8px;margin:0;border-radius:50%}.billing-page .bl-dot-bad{background:var(--st-bad,#b42318)}.billing-page .bl-health-item .k{color:var(--ink-muted);margin-right:2px}.billing-page .bl-health-item.is-bad{color:var(--st-bad,#b42318);font-weight:600}.billing-page .bl-health-item.is-warn{color:#946519;font-weight:600}.dark-mode .billing-page .bl-health-item.is-warn{color:var(--status-progress)}.dark-mode .billing-page .bl-health-item.is-bad{color:#f08a82}.billing-page .bl-health-error{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.billing-page .bl-health-error code{font-size:12px;color:inherit;background:var(--paper-bg-alt);padding:1px 5px;border-radius:4px}.billing-page .bl-chart-card{margin-bottom:16px}.billing-page .bl-swatch{display:inline-block;width:8px;height:8px;border-radius:2px;flex:none}.billing-page .bl-bars{position:relative;gap:3px}.billing-page .bl-bars.is-dense{gap:1px}.billing-page .bl-col{min-width:0}.billing-page .bl-stack{display:flex;flex-direction:column-reverse;width:100%;gap:1px;border-radius:2px 2px 0 0;overflow:hidden}.billing-page .bl-stack>i{display:block;min-height:2px;flex-basis:0}.billing-page .bl-col:hover .bl-stack{filter:brightness(1.08)}.billing-page .bl-col.is-zero .bl-stack{height:1px!important;background:var(--border-color)}.billing-page .bl-empty{margin:8px 0 4px;padding:32px 0;text-align:center;color:var(--ink-muted)}.billing-page .bl-plans{margin-bottom:24px}.billing-page .ov-metrics-table thead th.bl-group{text-align:center;border-bottom:1px solid var(--border-color)}.billing-page .ov-metrics-table tfoot td,.billing-page .ov-metrics-table tfoot th{border-top:1px solid var(--border-color);border-bottom:0;font-weight:600;background:var(--paper-bg-alt)}.billing-page .ov-metrics-table tboLine truncated
.reviewer-preview .rp-main{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.reviewer-preview .rp-document{flex:1 1 auto;min-height:0;min-width:0;overflow:auto;scrollbar-width:thin;position:relative}.reviewer-preview button.rp-count{background:0 0;border:0;padding:0;font:inherit;cursor:pointer;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:3px}.reviewer-preview button.rp-count:hover{text-decoration-color:currentColor}@media (max-width:767px){.reviewer-preview .file-card-head .rp-preserved-tag{display:none}}.billing-page{--bl-subscription:#008C7E;--bl-repository:#D0652A;--bl-conference:#6250D6}.dark-mode .billing-page{--bl-subscription:#16A091;--bl-repository:#D95926;--bl-conference:#9085E9}.billing-page .bl-subscription{background:var(--bl-subscription)!important}.billing-page .bl-repository{background:var(--bl-repository)!important}.billing-page .bl-conference{background:var(--bl-conference)!important}.billing-page .bl-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;margin:4px 0 0}.billing-page .bl-basis{margin:0;font-size:12px;color:var(--ink-muted)}.billing-page .bl-message{display:flex;align-items:center;gap:8px;margin:14px 0 0;padding:10px 14px;border:1px solid var(--border-color);border-radius:var(--radius-control,8px);font-size:13px;color:var(--color);background:var(--paper-card)}.billing-page .bl-message .ui-icon{width:16px;height:16px;flex:none;color:var(--ink-muted)}.billing-page .bl-message.ov-performance-warning{border-color:color-mix(in srgb,var(--status-progress) 45%,var(--border-color));background:color-mix(in srgb,var(--status-progress) 8%,var(--paper-card))}.billing-page .bl-message.ov-performance-warning .ui-icon{color:var(--status-progress)}.billing-page .bl-message .btn{margin-left:auto}.overview-page .bl-kpi-row{grid-template-columns:repeat(6,minmax(0,1fr));margin:16px 0 16px}.overview-page .bl-kpi-row .ov-kpi-card{min-width:0;padding:16px 18px}.overview-page .bl-kpi-row .ov-kpi-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overview-page .bl-kpi-row .ov-kpi-sub{white-space:normal;overflow-wrap:anywhere;line-height:1.4}.overview-page .bl-kpi-row .ov-kpi-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.overview-page .bl-kpi-row .bl-muted-value{color:var(--ink-muted);font-size:20px;line-height:28px}.overview-page .bl-kpi-row.is-loading .ov-kpi-card{opacity:.6}.billing-page .bl-skeleton-value{display:block;width:50%;height:28px;margin:4px 0;border-radius:6px}@media (max-width:1279px){.overview-page .bl-kpi-row{grid-template-columns:repeat(3,minmax(0,1fr))!important}}@media (max-width:767px){.overview-page .bl-kpi-row{grid-template-columns:repeat(2,minmax(0,1fr))!important}}.billing-page .bl-health{display:flex;align-items:center;flex-wrap:wrap;gap:6px 20px;padding:10px 16px;margin:0 0 16px;border:1px solid var(--border-color);border-radius:var(--radius-control,8px);background:var(--paper-card);font-size:13px;font-variant-numeric:tabular-nums}.billing-page .bl-health-title{display:inline-flex;align-items:center;gap:8px;font-weight:600}.billing-page .bl-health-title .ov-svc-dot{width:8px;height:8px;margin:0;border-radius:50%}.billing-page .bl-dot-bad{background:var(--st-bad,#b42318)}.billing-page .bl-health-item .k{color:var(--ink-muted);margin-right:2px}.billing-page .bl-health-item.is-bad{color:var(--st-bad,#b42318);font-weight:600}.billing-page .bl-health-item.is-warn{color:#946519;font-weight:600}.dark-mode .billing-page .bl-health-item.is-warn{color:var(--status-progress)}.dark-mode .billing-page .bl-health-item.is-bad{color:#f08a82}.billing-page .bl-health-error{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.billing-page .bl-health-error code{font-size:12px;color:inherit;background:var(--paper-bg-alt);padding:1px 5px;border-radius:4px}.billing-page .bl-chart-card{margin-bottom:16px}.billing-page .bl-swatch{display:inline-block;width:8px;height:8px;border-radius:2px;flex:none}.billing-page .bl-bars{position:relative;gap:3px}.billing-page .bl-bars.is-dense{gap:1px}.billing-page .bl-col{min-width:0}.billing-page .bl-stack{display:flex;flex-direction:column-reverse;width:100%;gap:1px;border-radius:2px 2px 0 0;overflow:hidden}.billing-page .bl-stack>i{display:block;min-height:2px;flex-basis:0}.billing-page .bl-col:hover .bl-stack{filter:brightness(1.08)}.billing-page .bl-col.is-zero .bl-stack{height:1px!important;background:var(--border-color)}.billing-page .bl-col.has-tip::after{white-space:pre;line-height:1.6;text-align:left;padding:8px 10px}.billing-page .bl-col.has-tip.tip-start::after{left:0;transform:translateY(4px)}.billing-page .bl-col.has-tip.tip-end::after{left:auto;right:0;transform:translateY(4px)}.billing-page .bl-col.has-tip.tip-end:hover::after,.billing-page .bl-col.has-tip.tip-start:hover::after{transform:translateY(0)}.billing-page .bl-empty{margin:8px 0 4px;padding:32px 0;text-align:center;Line truncated
+18 -3
View File
@@ -14284,6 +14284,11 @@ body.dark-mode .reviewer-preview .rp-preserved-tag { background: rgba(251, 191,
.billing-page .bl-stack > i { display: block; min-height: 2px; flex-basis: 0; }
.billing-page .bl-col:hover .bl-stack { filter: brightness(1.08); }
.billing-page .bl-col.is-zero .bl-stack { height: 1px !important; background: var(--border-color); }
/* Multi-line tooltip: one line per family, then the total. Edge columns open inward. */
.billing-page .bl-col.has-tip::after { white-space: pre; line-height: 1.6; text-align: left; padding: 8px 10px; }
.billing-page .bl-col.has-tip.tip-start::after { left: 0; transform: translateY(4px); }
.billing-page .bl-col.has-tip.tip-end::after { left: auto; right: 0; transform: translateY(4px); }
.billing-page .bl-col.has-tip.tip-start:hover::after, .billing-page .bl-col.has-tip.tip-end:hover::after { transform: translateY(0); }
.billing-page .bl-empty { margin: 8px 0 4px; padding: 32px 0; text-align: center; color: var(--ink-muted); }
/* By plan and grant tables. */
@@ -14297,13 +14302,23 @@ body.dark-mode .reviewer-preview .rp-preserved-tag { background: rgba(251, 191,
.billing-page .bl-link:hover { text-decoration: underline; }
.billing-page .bl-idle td, .billing-page .bl-idle .bl-link { color: var(--ink-faint); }
.billing-page .ov-muted { color: var(--ink-faint); }
.billing-page .bl-family-row > * { font-weight: 600; background: color-mix(in srgb, var(--paper-bg-alt) 60%, transparent); }
.billing-page .bl-plan-name.bl-plan-child { padding-left: 28px; font-weight: 400; }
.billing-page .bl-note { margin: 10px 0 0; }
.billing-page .bl-grants { margin: 8px 0 24px; scroll-margin-top: 16px; }
.billing-page .bl-section-head { margin: 0 0 8px; }
.billing-page .bl-section-head h2 { margin: 0; }
.billing-page .bl-grant-scroll { margin-top: 12px; }
.billing-page .bl-grant-table th[scope="row"] { font-weight: 500; text-align: left; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.billing-page .bl-grant-table th, .billing-page .bl-grant-table td { padding: 9px 12px; }
.billing-page .bl-grant-table th[scope="row"] { font-weight: 500; text-align: left; max-width: 168px; overflow: hidden; text-overflow: ellipsis; }
.billing-page .bl-grant-table th, .billing-page .bl-grant-table td { padding: 9px 10px; }
/* Every row is two lines tall, whether or not a cell has a second line. */
.billing-page .bl-grant-table tbody th, .billing-page .bl-grant-table tbody td { height: 58px; }
.billing-page .bl-grant-table small .bl-flag { font-size: 11px; padding: 0 7px; }
.billing-page .bl-grant-table .bl-amount { white-space: nowrap; }
/* Inter's tabular figures also widen hyphens, so names and repository ids
("thomas-u-grund", "BioASQ-Cond-EDE1") use proportional figures; amounts and dates stay tabular. */
.billing-page .bl-grant-table { font-variant-numeric: normal; }
.billing-page .bl-grant-table .num, .billing-page .bl-grant-table .bl-date { font-variant-numeric: tabular-nums; }
.billing-page .bl-grant-table th[scope="row"] a, .billing-page .bl-scope a { color: var(--link-color); }
.billing-page .bl-grant-table .sortable { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.billing-page .bl-grant-table .sortable.active { color: var(--color); }
@@ -14314,7 +14329,7 @@ body.dark-mode .reviewer-preview .rp-preserved-tag { background: rgba(251, 191,
.dark-mode .billing-page .bl-flag { color: var(--status-progress); }
.billing-page .bl-flag.is-bad { background: color-mix(in srgb, var(--st-bad, #B42318) 12%, transparent); color: #A1251B; }
.dark-mode .billing-page .bl-flag.is-bad { color: #F08A82; }
.billing-page .bl-scope a { display: inline-flex; align-items: center; gap: 6px; max-width: 200px; min-width: 0; }
.billing-page .bl-scope a { display: inline-flex; align-items: center; gap: 6px; max-width: 184px; min-width: 0; }
.billing-page .bl-scope a > span { overflow: hidden; text-overflow: ellipsis; }
.billing-page .bl-scope .ui-icon { width: 14px; height: 14px; flex: none; color: var(--ink-muted); }
.billing-page .bl-page { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
+26 -15
View File
@@ -93,13 +93,13 @@
<div class="ov-chart-head">
<span class="ov-chart-title">Sales per {{ bucketName() }} &middot; {{ periodPhrase() }}</span>
<span class="ov-chart-legends" v-if="seriesSales()">
<span class="ov-chart-legend" v-for="f in families" :key="f.id"><span class="bl-swatch" :class="'bl-' + f.id" aria-hidden="true"></span>{{ f.label }} &middot; {{ fmt?.number(familyTotal(f.id)) }}</span>
<span class="ov-chart-legend" v-for="f in families" :key="f.id"><span class="bl-swatch" :class="'bl-' + f.id" aria-hidden="true"></span>{{ f.label }} &middot; {{ legendText(f.id) }}</span>
</span>
</div>
<template v-if="seriesSales()">
<div class="ov-spark-bars ov-has-axis bl-bars" :class="{ 'is-dense': summary.series.length &gt; 45 }" role="img" :aria-label="fmt?.number(seriesSales()) + ' sales, ' + periodPhrase() + ', by plan family'">
<div class="ov-yaxis" aria-hidden="true"><span>{{ fmt?.number(chartMax()) }}</span><span>{{ fmt?.number(chartMax() / 2) }}</span><span>0</span></div>
<div class="ov-spark-col has-tip bl-col" v-for="(d, index) in summary.series" :key="index" :data-tip="bucketTip(d)" :class="{ 'is-zero': !bucketTotal(d) }">
<div class="ov-spark-col has-tip bl-col" v-for="(d, index) in summary.series" :key="index" :data-tip="bucketTip(d)" :class="[tipSide(index), { 'is-zero': !bucketTotal(d) }]">
<span class="bl-stack" :style="{ height: (bucketTotal(d) / chartMax() * 100) + '%' }">
<i v-for="f in families" :key="f.id" v-show="d[f.id]" :class="'bl-' + f.id" :style="{ flexGrow: d[f.id] }"></i>
</span>
@@ -127,9 +127,15 @@
<tr><th scope="col" rowspan="2">Plan</th><th scope="col" rowspan="2" class="num">Active</th><th scope="colgroup" colspan="2" class="bl-group" v-if="period !== 'all'">{{ periodPhrase().replace(/^./, c =&gt; c.toUpperCase()) }}</th><th scope="colgroup" colspan="2" class="bl-group">All time</th></tr>
<tr><template v-if="period !== 'all'"><th scope="col" class="num">Sales</th><th scope="col" class="num">Revenue</th></template><th scope="col" class="num">Sales</th><th scope="col" class="num">Revenue</th></tr>
</thead>
<tbody>
<tr v-for="p in summary.plans" :key="p.planId" :class="{ 'bl-idle': !p.active &amp;&amp; !p.sales &amp;&amp; !p.allTimeSales }">
<th scope="row" class="bl-plan-name"><span class="bl-swatch" :class="'bl-' + p.family" aria-hidden="true"></span><button type="button" class="bl-link" :title="'Show ' + p.name + ' grants'" @click="filterPlan(p.planId)">{{ p.name }}</button></th>
<tbody v-for="f in families" :key="f.id" v-show="familyPlans(f.id).length">
<tr class="bl-family-row">
<th scope="rowgroup" class="bl-plan-name"><span class="bl-swatch" :class="'bl-' + f.id" aria-hidden="true"></span>{{ f.label }}</th>
<td class="num">{{ fmt?.number(familySum(f.id, 'active')) }}</td>
<template v-if="period !== 'all'"><td class="num">{{ fmt?.number(familySum(f.id, 'sales')) }}</td><td class="num">{{ familyMoney(f.id, 'revenue', 'revenueComplete') }}</td></template>
<td class="num">{{ fmt?.number(familySum(f.id, 'allTimeSales')) }}</td><td class="num">{{ familyMoney(f.id, 'allTimeRevenue', 'allTimeRevenueComplete') }}</td>
</tr>
<tr v-for="p in familyPlans(f.id)" :key="p.planId" :class="{ 'bl-idle': !p.active &amp;&amp; !p.sales &amp;&amp; !p.allTimeSales }">
<th scope="row" class="bl-plan-name bl-plan-child"><button type="button" class="bl-link" :title="'Show ' + p.name + ' sales'" @click="filterPlan(p.planId)">{{ p.name }}</button></th>
<td class="num">{{ fmt?.number(p.active) }}</td>
<template v-if="period !== 'all'"><td class="num">{{ fmt?.number(p.sales) }}</td>
<td class="num">{{ revenueOn() ? (p.revenueComplete === false ? 'Incomplete' : moneyText(p.revenue)) : '—' }}</td></template>
@@ -142,7 +148,7 @@
</tfoot>
</table>
</div>
<p class="ov-performance-note bl-note">A paper pack counts once, under Paper pack. Active means paid time remains and the payment wasn't reversed.</p>
<p class="ov-performance-note bl-note">A paper pack counts once, under Paper pack, here, in the chart and in the list below. Active means paid time remains and the payment wasn't reversed.</p>
</section>
<!-- ── Subscriptions and purchases ─────────────────────────── -->
@@ -165,7 +171,7 @@
</div>
<form class="w-100 admin-filter-toolbar" aria-label="Subscriptions and purchases" accept-charset="UTF-8" v-form="viewState" @submit.prevent>
<button type="button" class="btn btn-sm admin-filters-toggle" @click="filtersOpen = !filtersOpen" :aria-expanded="filtersOpen ? 'true' : 'false'">Filters<template v-if="query.plan || query.status"> ({{ (query.plan ? 1 : 0) + (query.status ? 1 : 0) }})</template></button>
<button type="button" class="btn btn-sm admin-filters-toggle" @click="filtersOpen = !filtersOpen" :aria-expanded="filtersOpen ? 'true' : 'false'">Filters<template v-if="filterCount()"> ({{ filterCount() }})</template></button>
<div class="admin-filter-row" :class="{ 'is-open': filtersOpen }">
<div class="search-wrap">
<input type="search" class="form-control" aria-label="Search by user" placeholder="Search by user…" autocomplete="off" v-field="{ state: viewState, set: value =&gt; { query.search = value }, value: query?.search, form: null, options: {} }">
@@ -176,6 +182,12 @@
<optgroup v-for="f in families" :key="f.id" :label="f.label"><option v-for="p in (summary?.plans || []).filter(p =&gt; p.family === f.id)" :key="p.planId" :value="p.planId">{{ p.name }}</option></optgroup>
</select>
</span>
<span class="admin-filter-inline"><label for="bl-period">Started</label>
<select id="bl-period" class="form-control form-control-sm" v-field="{ state: viewState, set: value =&gt; { query.period = value }, value: query?.period, form: null, options: {} }">
<option value="">Any time</option>
<option v-for="p in periods.filter(p =&gt; p.id !== 'all')" :key="p.id" :value="p.id">Last {{ p.label }}</option>
</select>
</span>
<span class="admin-filter-inline"><label for="bl-status">Stripe status</label>
<select id="bl-status" class="form-control form-control-sm" v-field="{ state: viewState, set: value =&gt; { query.status = value }, value: query?.status, form: null, options: {} }">
<option value="">Any</option>
@@ -207,18 +219,17 @@
<th scope="col">User</th><th scope="col">Plan</th><th scope="col">Status</th>
<th scope="col"><button type="button" class="sortable" :class="{ active: query?.sort == 'purchasedAt' }" @click="sortBy('purchasedAt')">Started <svg class="ui-icon sort-direction" aria-hidden="true" v-if="sortIcon('purchasedAt')" :class="{ ascending: sortIcon('purchasedAt') === 'fa-arrow-up' }"><use href="#project-icon-arrow"></use></svg></button></th>
<th scope="col"><button type="button" class="sortable" :class="{ active: query?.sort == 'until' }" @click="sortBy('until')">Renews / ends <svg class="ui-icon sort-direction" aria-hidden="true" v-if="sortIcon('until')" :class="{ ascending: sortIcon('until') === 'fa-arrow-up' }"><use href="#project-icon-arrow"></use></svg></button></th>
<th scope="col">Cancelling</th><th scope="col">Revoked</th><th scope="col">Applies to</th>
<th scope="col" class="num">Amount</th><th scope="col">Applies to</th>
</tr></thead>
<tbody>
<tr v-for="g in grants" :key="g.id">
<th scope="row" class="bl-user"><a v-if="g.user" :title="g.user" :href="safeUrl('/admin/users/' + g.user)">{{ g.user }}</a><span class="ov-muted" v-else>Deleted user</span></th>
<td><span class="bl-plan-cell"><span class="bl-swatch" :class="'bl-' + g.family" aria-hidden="true"></span>{{ planName(g.planId) }}</span><small v-if="g.pack">Part of a paper pack</small></td>
<td><span class="bl-state"><span class="status-dot" :class="g.state === 'active' ? 'st-ready' : g.state === 'revoked' ? 'st-error' : 'st-expired'"></span>{{ g.state === 'active' ? 'Active' : g.state === 'revoked' ? 'Revoked' : 'Expired' }}</span><small v-if="!['active', 'paid'].includes(g.status)">Stripe: {{ statusText(g) }}</small></td>
<td>{{ g.purchasedAt ? fmt?.date(g.purchasedAt) : '—' }}</td>
<td><template v-if="g.never">Never ends</template><template v-else-if="g.until">{{ fmt?.date(g.until) }}</template><template v-else>—</template><small v-if="g.subscription &amp;&amp; g.state === 'active'">{{ g.cancelAtPeriodEnd ? 'Ends' : 'Renews' }}</small></td>
<td><span class="bl-flag" v-if="g.cancelAtPeriodEnd">Cancelling</span><span class="ov-muted" v-else>—</span></td>
<td><template v-if="g.revoked"><span class="bl-flag is-bad">{{ revocationText(g.revocationReason) }}</span><small v-if="g.revokedAt">{{ fmt?.date(g.revokedAt) }}</small></template><span class="ov-muted" v-else>—</span></td>
<td class="bl-scope"><a v-if="scopeHref(g.scope)" :href="safeUrl(scopeHref(g.scope))"><svg class="ui-icon" aria-hidden="true"><use :href="g.scope.kind === 'conference' ? '#project-icon-conference' : '#project-type-repo'"></use></svg><span>{{ g.scope.id }}</span></a><span class="ov-muted" v-else>Account</span></td>
<td><span class="bl-plan-cell" :title="familyLabel(g.family)"><span class="bl-swatch" :class="'bl-' + g.family" aria-hidden="true"></span>{{ planName(g.planId) }}</span><small v-if="g.pack" :title="packPartsTitle(g)">{{ packParts(g) }}</small></td>
<td><span class="bl-state"><span class="status-dot" :class="g.state === 'active' ? 'st-ready' : g.state === 'revoked' ? 'st-error' : 'st-expired'"></span>{{ g.state === 'active' ? 'Active' : g.state === 'revoked' ? 'Revoked' : 'Expired' }}</span><small v-if="g.revoked">{{ revocationText(g.revocationReason) }}<template v-if="g.revokedAt"> &middot; {{ fmt?.date(g.revokedAt) }}</template></small><small v-else-if="!['active', 'paid'].includes(g.status)">Stripe: {{ statusText(g) }}</small></td>
<td class="bl-date">{{ g.purchasedAt ? fmt?.date(g.purchasedAt) : '—' }}</td>
<td class="bl-date">{{ endText(g) }}<small v-if="g.subscription &amp;&amp; g.cancelAtPeriodEnd &amp;&amp; g.state === 'active'"><span class="bl-flag">Cancelling</span></small><small v-else-if="packNote(g)">{{ packNote(g) }}</small></td>
<td class="num bl-amount" :title="amountTitle(g)"><span :class="{ 'ov-muted': !g.amount }">{{ amountText(g) }}</span></td>
<td class="bl-scope"><a v-if="scopeHref(g.scope)" :href="safeUrl(scopeHref(g.scope))" :title="g.scope.id"><svg class="ui-icon" aria-hidden="true"><use :href="g.scope.kind === 'conference' ? '#project-icon-conference' : '#project-type-repo'"></use></svg><span>{{ g.scope.id }}</span></a><span class="ov-muted" v-else>Account</span></td>
</tr>
</tbody>
</table>
+75 -8
View File
@@ -1,7 +1,7 @@
import { installLogInvestigation } from "./admin-log-investigation.js";
import { reactive, onScopeDispose, nextTick } from "vue";
import { createTimers, createListeners } from "./state.js";
import { duration, statusMsg } from "./formatters.js";
import { duration, statusMsg, number as formatNumber, date as formatDate } from "./formatters.js";
// One status filter model for every admin list (and the conference page):
// a single-select segmented control. One rule everywhere: "All N" is every
@@ -2302,7 +2302,7 @@ function watchMetaLines(timers, listen) {
const ZERO_DECIMAL = ["bif", "clp", "djf", "gnf", "jpy", "kmf", "krw", "mga", "pyg", "rwf", "ugx", "vnd", "vuv", "xaf", "xof", "xpf"];
export const BILLING_FAMILIES = [
{ id: "subscription", label: "Subscriptions" },
{ id: "repository", label: "Repository purchases" },
{ id: "repository", label: "Repository add-ons" },
{ id: "conference", label: "Conferences" },
];
// Names from src/core/billing/config.ts, used until the summary (which carries them) arrives.
@@ -2348,6 +2348,16 @@ export const billingAdminController = function (state, http, location) {
};
state.segmentPct = (d, family) => d && d[family] ? (d[family] / state.chartMax()) * 100 : 0;
state.familyTotal = (family) => (state.summary?.series || []).reduce((n, d) => n + d[family], 0);
const addMoney = (into, amounts) => { for (const [c, v] of Object.entries(amounts || {})) into[c] = (into[c] || 0) + v; return into; };
state.familyRevenue = (family) => (state.summary?.series || []).reduce((m, d) => addMoney(m, d.revenue?.[family]), {});
state.seriesMissing = () => (state.summary?.series || []).reduce((n, d) => n + (d.missing || 0), 0);
// "17 · €85", or just the count when revenue is unavailable or incomplete.
state.legendText = (family) => {
const count = formatNumber(state.familyTotal(family));
if (!state.revenueOn() || state.seriesMissing()) return count;
const money = moneyParts(state.familyRevenue(family));
return money.length ? count + " · " + money.join(" · ") : count;
};
state.bucketLabel = (d) => {
if (!d) return "";
const date = new Date(d.date);
@@ -2356,16 +2366,39 @@ export const billingAdminController = function (state, http, location) {
if (state.period === "12m" || state.period === "all" || date.getUTCFullYear() !== new Date().getUTCFullYear()) opts.year = "numeric";
return (state.summary?.bucket === "week" ? "Week of " : "") + date.toLocaleDateString(undefined, opts);
};
// One line per family with its count and list-price revenue, then the
// bucket total per currency. The tooltip is monospace, so padding aligns columns.
state.bucketTip = (d) => {
const total = state.bucketTotal(d);
if (!total) return state.bucketLabel(d) + ": no sales";
const parts = BILLING_FAMILIES.filter((f) => d[f.id]).map((f) => d[f.id] + " " + f.label.toLowerCase());
return state.bucketLabel(d) + ": " + total + (total === 1 ? " sale" : " sales") + " (" + parts.join(", ") + ")";
const head = state.bucketLabel(d) + " · " + (total ? total + (total === 1 ? " sale" : " sales") : "no sales");
if (!total) return head;
const revenue = state.revenueOn();
const rows = BILLING_FAMILIES.filter((f) => d[f.id]).map((f) => [f.label, String(d[f.id]), revenue ? moneyParts(d.revenue?.[f.id]).join(" · ") : ""]);
const sum = BILLING_FAMILIES.reduce((m, f) => addMoney(m, d.revenue?.[f.id]), {});
const footer = !revenue ? ["Revenue unavailable"]
: [...(moneyParts(sum).length ? ["Total " + moneyParts(sum).join(" · ")] : []), ...(d.missing ? [d.missing + (d.missing === 1 ? " sale" : " sales") + " without a known price"] : [])];
const width = (i) => Math.max(...rows.map((r) => r[i].length));
const lines = rows.map((r) => (r[0].padEnd(width(0)) + " " + r[1].padStart(width(1)) + (r[2] ? " " + r[2] : "")).trimEnd());
return [head, ...lines, ...footer].join("\n");
};
// Tips near the edges open inward so they stay inside the card.
state.tipSide = (index) => {
const n = (state.summary?.series || []).length;
return n < 3 ? "" : index < n / 4 ? "tip-start" : index >= n * 3 / 4 ? "tip-end" : "";
};
state.bucketName = () => ({ day: "day", week: "week", month: "month" })[state.summary?.bucket] || "day";
state.seriesSales = () => (state.summary?.series || []).reduce((n, d) => n + state.bucketTotal(d), 0);
state.plansWithActivity = () => (state.summary?.plans || []).filter((p) => p.active || p.allTimeSales || p.sales);
state.familyLabel = (family) => (BILLING_FAMILIES.find((f) => f.id === family) || {}).label || "";
state.familyPlans = (family) => (state.summary?.plans || []).filter((p) => p.family === family);
state.familySum = (family, key) => state.familyPlans(family).reduce((n, p) => n + (p[key] || 0), 0);
state.familyMoney = (family, key, completeKey) => {
if (!state.revenueOn()) return "—";
const plans = state.familyPlans(family);
if (plans.some((p) => p[completeKey] === false)) return "Incomplete";
return state.moneyText(plans.reduce((m, p) => addMoney(m, p[key]), {}));
};
state.planTotals = () => {
const sum = (key) => (state.summary?.plans || []).reduce((n, p) => n + (p[key] || 0), 0);
return { active: sum("active"), sales: sum("sales"), allTimeSales: sum("allTimeSales") };
@@ -2412,7 +2445,7 @@ export const billingAdminController = function (state, http, location) {
state.statuses = [];
state.grantsError = null;
state.filtersOpen = false;
state.query = { page: 1, limit: 25, search: "", plan: "", status: "", state: "", sort: "purchasedAt", direction: "desc" };
state.query = { page: 1, limit: 25, search: "", plan: "", status: "", state: "", period: "", sort: "purchasedAt", direction: "desc" };
const urlParams = location.search();
if (urlParams.search) state.query.search = urlParams.search;
state.stateView = () => state.query.state || "all";
@@ -2431,6 +2464,7 @@ export const billingAdminController = function (state, http, location) {
const out = [];
if (state.query.plan) out.push({ key: "plan", label: "Plan", value: state.planName(state.query.plan) });
if (state.query.status) out.push({ key: "status", label: "Stripe status", value: state.query.status.replace(/_/g, " ") });
if (state.query.period) out.push({ key: "period", label: "Started", value: "last " + ((state.periods.find((p) => p.id === state.query.period) || {}).label || state.query.period) });
state.chips = out;
};
state.clearFilter = (key) => { state.query[key] = ""; state.query.page = 1; };
@@ -2439,8 +2473,41 @@ export const billingAdminController = function (state, http, location) {
const list = document.getElementById("bl-grants");
if (list && list.scrollIntoView) list.scrollIntoView({ behavior: "smooth", block: "start" });
};
state.clearFilters = () => Object.assign(state.query, { search: "", plan: "", status: "", state: "", page: 1 });
state.hasFilters = () => !!(state.query.search || state.query.plan || state.query.status || state.query.state);
state.clearFilters = () => Object.assign(state.query, { search: "", plan: "", status: "", state: "", period: "", page: 1 });
state.hasFilters = () => !!(state.query.search || state.query.plan || state.query.status || state.query.state || state.query.period);
state.filterCount = () => ["plan", "status", "period"].filter((k) => state.query[k]).length;
// A sale's list price: "€5 / month" for a subscription, once for a pack.
state.amountText = (g) => {
if (!g.amount) return "—";
const money = moneyParts({ [g.amount.currency]: g.amount.value })[0] || "—";
if (!g.amount.interval) return money;
const every = g.amount.intervalCount > 1 ? g.amount.intervalCount + " " + g.amount.interval + "s" : g.amount.interval;
return money + " / " + every;
};
state.amountTitle = (g) => g.amount ? "Stripe list price" + (g.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.",
})[g.amountMissing] || "Revenue unavailable.";
// "Renews / ends" as one line, with at most one quiet second line.
state.endText = (g) => {
if (g.never) return "Never ends";
if (!g.until) return "—";
const date = formatDate(g.until);
if (g.state !== "active") return (new Date(g.until) < new Date() ? "Ended " : "Ends ") + date;
if (g.subscription) return (g.cancelAtPeriodEnd ? "Ends " : "Renews ") + date;
return "Until " + date;
};
// The part of a pack that runs out first, while the repository itself never ends.
state.packNote = (g) => {
const updates = (g.parts || []).find((p) => p.planId === "author_pass");
if (!g.pack || !updates || !updates.until) return "";
return (new Date(updates.until) < new Date() ? "Updates ended " : "Updates until ") + formatDate(updates.until);
};
// Short names keep the pack row within the table; the title has the full ones.
const PACK_PART_SHORT = { repo_slot: "repository", author_pass: "updates", repo_extend: "+1 year" };
state.packParts = (g) => (g.parts || []).map((p) => PACK_PART_SHORT[p.planId] || state.planName(p.planId)).join(", ").replace(/^./, (c) => c.toUpperCase());
state.packPartsTitle = (g) => "Paper pack: " + (g.parts || []).map((p) => state.planName(p.planId)).join(", ");
state.statusText = (g) => (g.status || "unknown").replace(/_/g, " ");
state.revocationText = (reason) => reason === "dispute" ? "Disputed" : reason === "full_refund" ? "Refunded" : "Revoked";
state.scopeHref = (scope) => scope?.kind === "repo" ? "/admin/repositories?search=" + encodeURIComponent(scope.id)
+50 -49
View File
@@ -1,53 +1,54 @@
"use strict";(()=>{var il=Object.defineProperty;var rl=e=>{throw TypeError(e)};var ff=(e,t,s)=>t in e?il(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var mf=(e,t)=>{for(var s in t)il(e,s,{get:t[s],enumerable:!0})};var nt=(e,t,s)=>ff(e,typeof t!="symbol"?t+"":t,s),wr=(e,t,s)=>t.has(e)||rl("Cannot "+s);var re=(e,t,s)=>(wr(e,t,"read from private field"),s?s.call(e):t.get(e)),$e=(e,t,s)=>t.has(e)?rl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ze=(e,t,s,i)=>(wr(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),Fe=(e,t,s)=>(wr(e,t,"access private method"),s);var al=(e,t,s,i)=>({set _(o){ze(e,t,o,s)},get _(){return re(e,t,i)}});var ge=["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 ve={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 ll(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 dl(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=r?{clientId:r.clientId,intentId:r.intentId}:null,p,c,v,g,y,m=!0,b,E=i.defer(),S=()=>[...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=()=>m&&e.user?.username===y;function w(){m=!1,r=p=c=void 0,E.resolve(),o.clearTimeout(b)}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 T=()=>({timeout:E.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),M=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(!m||!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(b),g||(g=S());try{let j=(await s.get("/api/review-consent/csrf",{timeout:E.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 oe=(await s.post("/api/review-consent/preview",{repositoryId:F,intent:{...r,requestId:g}},T())).data;if(!N())return;if(!oe||typeof oe.ticket!="string"||!oe.ticket||oe.ticket.length>8192||typeof oe.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
`))),e[yn]=Fo(o);let r=i||o.props&&o.props.type==="number";_n(e,t?"change":"input",u=>{u.target.composing||e[yn](ra(e.value,s,r))}),(s||r)&&_n(e,"change",()=>{e.value=ra(e.value,s,r)}),t||(_n(e,"compositionstart",vh),_n(e,"compositionend",Jd),_n(e,"change",Jd))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[Fi];delete e[Fi],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[yn](ra(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},u){if(e[yn]=Fo(u),e.composing)return;let p=(r||e.type==="number")&&!/^0\d/.test(e.value)?Oo(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)}},la={deep:!0,created(e,t,s){e[yn]=Fo(s),_n(e,"change",()=>{let i=e._modelValue,o=qs(e),r=e.checked,u=e[yn];if(Re(i)){let p=fi(i,o),c=p!==-1;if(r&&!c)u(i.concat(o));else if(!r&&c){let v=[...i];v.splice(p,1),u(v)}}else if(Xt(i)){let p=new Set(i);r?p.add(o):p.delete(o),u(p)}else u(tu(e,r))})},mounted:Xd,beforeUpdate(e,t,s){e[yn]=Fo(s),Xd(e,t,s)}};function Xd(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Re(t))o=fi(t,i.props.value)>-1;else if(Xt(t))o=t.has(i.props.value);else{if(t===s)return;o=Qt(t,tu(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?Oo(qs(c)):qs(c)),r=e.multiple,u=r?Xt(e._modelValue)?new Set(o):o:o[0],p=e._pendingValue=[r,r?Re(u)?o.slice():o:u];try{e[yn](u)}finally{We(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[yn]=Fo(i)},mounted(e,{value:t}){Qd(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[yn]=Fo(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!yh(t,s[1],s[0]))&&Qd(e,t)}};function yh(e,t,s){if(!s)return Qt(e,t);if(Re(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 Qd(e,t){let s=e.multiple,i=Re(t);if(!(s&&!i&&!Xt(t))){for(let o=0,r=e.options.length;o<r;o++){let u=e.options[o],p=qs(u);if(s)if(i){let c=typeof p;c==="string"||c==="number"?u.selected=t.some(v=>String(v)===String(p)):u.selected=fi(t,p)>-1}else u.selected=t.has(p);else if(Qt(qs(u),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function qs(e){return"_value"in e?e._value:e.value}function tu(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var bh=["ctrl","shift","alt","meta"],wh={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)=>bh.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=wh[t[u]];if(p&&p(o,t))return}return e(o,...r)}))},kh={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Lt=(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(u=>u===r||kh[u]===r))return e(o)}))},Ch=pt({patchProp:mh},Zm),Zd;function Sh(){return Zd||(Zd=Id(Ch))}var nu=((...e)=>{let t=Sh().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=Nh(i);if(!o)return;let r=t._component;!Oe(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let u=s(o,!1,Eh(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),u},t});function Eh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Nh(e){return lt(e)?document.querySelector(e):e}var uo=typeof document<"u";function su(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Rh(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&su(e.default)}var xe=Object.assign;function Bi(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 Bo=()=>{},Yt=Array.isArray;function ca(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var iu=/#/g,Th=/&/g,Ph=/\//g,Dh=/=/g,Ah=/\?/g,ru=/\+/g,Ih=/%5B/g,Oh=/%5D/g,au=/%5E/g,Mh=/%60/g,lu=/%7B/g,Vh=/%7C/g,du=/%7D/g,qh=/%20/g;function pa(e){return e==null?"":encodeURI(""+e).replace(Vh,"|").replace(Ih,"[").replace(Oh,"]")}function uu(e){return pa(e).replace(lu,"{").replace(du,"}").replace(au,"^")}function da(e){return pa(e).replace(ru,"%2B").replace(qh,"+").replace(iu,"%23").replace(Th,"%26").replace(Mh,"`").replace(lu,"{").replace(du,"}").replace(au,"^")}function Lh(e){return da(e).replace(Dh,"%3D")}function _h(e){return pLine truncated
"use strict";(()=>{var dl=Object.defineProperty;var ul=e=>{throw TypeError(e)};var hf=(e,t,s)=>t in e?dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var gf=(e,t)=>{for(var s in t)dl(e,s,{get:t[s],enumerable:!0})};var nt=(e,t,s)=>hf(e,typeof t!="symbol"?t+"":t,s),Sr=(e,t,s)=>t.has(e)||ul("Cannot "+s);var re=(e,t,s)=>(Sr(e,t,"read from private field"),s?s.call(e):t.get(e)),$e=(e,t,s)=>t.has(e)?ul("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ze=(e,t,s,i)=>(Sr(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),Fe=(e,t,s)=>(Sr(e,t,"access private method"),s);var cl=(e,t,s,i)=>({set _(o){ze(e,t,o,s)},get _(){return re(e,t,i)}});var ge=["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 ve={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",editor:"/script/editor.4f142d3adc.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js"};function pl(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 fl(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=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(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=()=>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,F=>{!y&&F?y=F:y&&F!==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 T=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),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(!g||!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),h||(h=C());try{let H=(await s.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(c=H.csrf,e.handoffEnabled=H.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(c||""))throw new Error("invalid_csrf");let oe=(await s.post("/api/review-consent/preview",{repositoryId:F,intent:{...r,requestId:h}},T())).data;if(!N())return;if(!oe||typeof oe.ticket!="string"||!oe.ticket||oe.ticket.length>8192||typeof oe.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
`))),e[yn]=Uo(o);let r=i||o.props&&o.props.type==="number";_n(e,t?"change":"input",u=>{u.target.composing||e[yn](da(e.value,s,r))}),(s||r)&&_n(e,"change",()=>{e.value=da(e.value,s,r)}),t||(_n(e,"compositionstart",bh),_n(e,"compositionend",xd),_n(e,"change",xd))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[Ui];delete e[Ui],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[yn](da(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},u){if(e[yn]=Uo(u),e.composing)return;let p=(r||e.type==="number")&&!/^0\d/.test(e.value)?Mo(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)}},ca={deep:!0,created(e,t,s){e[yn]=Uo(s),_n(e,"change",()=>{let i=e._modelValue,o=Ls(e),r=e.checked,u=e[yn];if(Re(i)){let p=mi(i,o),c=p!==-1;if(r&&!c)u(i.concat(o));else if(!r&&c){let v=[...i];v.splice(p,1),u(v)}}else if(Xt(i)){let p=new Set(i);r?p.add(o):p.delete(o),u(p)}else u(iu(e,r))})},mounted:eu,beforeUpdate(e,t,s){e[yn]=Uo(s),eu(e,t,s)}};function eu(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Re(t))o=mi(t,i.props.value)>-1;else if(Xt(t))o=t.has(i.props.value);else{if(t===s)return;o=Qt(t,iu(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?Mo(Ls(c)):Ls(c)),r=e.multiple,u=r?Xt(e._modelValue)?new Set(o):o:o[0],p=e._pendingValue=[r,r?Re(u)?o.slice():o:u];try{e[yn](u)}finally{We(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[yn]=Uo(i)},mounted(e,{value:t}){tu(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[yn]=Uo(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!wh(t,s[1],s[0]))&&tu(e,t)}};function wh(e,t,s){if(!s)return Qt(e,t);if(Re(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 tu(e,t){let s=e.multiple,i=Re(t);if(!(s&&!i&&!Xt(t))){for(let o=0,r=e.options.length;o<r;o++){let u=e.options[o],p=Ls(u);if(s)if(i){let c=typeof p;c==="string"||c==="number"?u.selected=t.some(v=>String(v)===String(p)):u.selected=mi(t,p)>-1}else u.selected=t.has(p);else if(Qt(Ls(u),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ls(e){return"_value"in e?e._value:e.value}function iu(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var kh=["ctrl","shift","alt","meta"],Ch={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)=>kh.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=Ch[t[u]];if(p&&p(o,t))return}return e(o,...r)}))},Sh={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Lt=(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(u=>u===r||Sh[u]===r))return e(o)}))},Eh=pt({patchProp:gh},eh),nu;function Nh(){return nu||(nu=qd(Eh))}var ru=((...e)=>{let t=Nh().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=Th(i);if(!o)return;let r=t._component;!Oe(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let u=s(o,!1,Rh(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),u},t});function Rh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Th(e){return lt(e)?document.querySelector(e):e}var uo=typeof document<"u";function lu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Ph(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&lu(e.default)}var xe=Object.assign;function zi(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 zo=()=>{},Yt=Array.isArray;function ma(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var du=/#/g,Dh=/&/g,Ah=/\//g,Ih=/=/g,Oh=/\?/g,uu=/\+/g,Mh=/%5B/g,Vh=/%5D/g,cu=/%5E/g,qh=/%60/g,pu=/%7B/g,Lh=/%7C/g,fu=/%7D/g,_h=/%20/g;function ha(e){return e==null?"":encodeURI(""+e).replace(Lh,"|").replace(Mh,"[").replace(Vh,"]")}function mu(e){return ha(e).replace(pu,"{").replace(fu,"}").replace(cu,"^")}function pa(e){return ha(e).replace(uu,"%2B").replace(_h,"+").replace(du,"%23").replace(Dh,"%26").replace(qh,"`").replace(pu,"{").replace(fu,"}").replace(cu,"^")}function $h(e){return pa(e).replace(Ih,"%3D")}function Fh(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 "${Wh(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 lo(e,t){return xe(new Error,{type:e,[bu]:!0},t)}function bn(e,t){return e instanceof Error&&bu in e&&(t==null||!!(e.type&t))}var Gh=["params","query","hash"];function Wh(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of Gh)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function wu(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(ru," "),r=o.indexOf("="),u=Uo(r<0?o:o.slice(0,r)),p=r<0?null:Uo(o.slice(r+1));if(u in t){let c=t[u];Yt(c)||(c=t[u]=[c]),c.push(p)}else t[u]=p}return t}function va(e){let t="";for(let s in e){let i=e[s];if(s=Lh(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(Yt(i)?i.map(o=>o&&da(o)):[i&&da(i)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+s,o!=null&&(t+="="+o))})}return t}function ku(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 Cu=Symbol(""),ya=Symbol(""),Gi=Symbol(""),Wi=Symbol(""),Ki=Symbol("");function zo(){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 Pn(e,t,s,i,o,r=u=>u()){let u=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((p,c)=>{let v=m=>{m===!1?c(lo(ct.NAVIGATION_ABORTED,{from:s,to:t})):m instanceof Error?c(m):jh(m)?c(lo(ct.NAVIGATION_GUARD_REDIRECT,{from:t,to:m})):(u&&i.enterCallbacks[o]===u&&typeof m=="function"&&u.push(m),p())},g=r(()=>e.call(i&&i.instances[o],t,s,v)),y=Promise.resolve(g);e.length<3&&(y=y.then(v)),y.catch(m=>c(m))})}function Yi(e,t,s,i,o=r=>r()){let r=[];for(let u of e)for(let p in u.components){let c=u.components[p];if(!(t!=="beforeRouteEnter"&&!u.instances[p]))if(su(c)){let v=(c.__vccOpts||c)[t];v&&r.push(Pn(v,s,i,u,p,o))}else{let v=c();r.push(()=>v.then(g=>{if(!g)throw new Error(`Couldn't resolve component "${p}" at "${u.path}"`);let y=Rh(g)?g.default:g;u.mods[p]=g,u.components[p]=y;let m=(y.__vccOpts||y)[t];return m&&Pn(m,s,i,u,p,o)()}))}}return r}function Su(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(v=>ao(v,p))?i.push(p):s.push(p));let c=e.matched[u];c&&(t.matched.find(v=>ao(v,c))||o.push(c))}return[s,i,o]}var Kh=()=>location.protocol+"//"+location.host;function Vu(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),fa(p,"")}return fa(s,e)+i+o}function Yh(e,t,s,i){let o=[],r=[],u=null,p=({state:m})=>{let b=Vu(e,location),E=s.value,S=t.value,N=0;if(m){if(s.value=b,t.value=m,u&&u===E){u=null;return}N=S?m.position-S.position:0}else i(b);o.forEach(w=>{w(s.value,E,{delta:N,type:Hi.pop,direction:N?N>0?ji.forward:ji.back:ji.unknown})})};function c(){u=s.value}function v(m){o.push(m);let b=()=>{let E=o.indexOf(m);E>-1&&o.splice(E,1)};return r.push(b),b}function g(){if(document.visibilityState==="hidden"){let{history:m}=window;if(!m.state)return;m.replaceState(xe({},m.state,{scroll:Ls()}),"")}}function y(){for(let m of r)m();r=[],window.removeEventListener("popstate",p),window.removeEventListener("pagehide",g),document.removeEventListener("visibilitychange",g)}return window.addEventListener("popstate",p),window.addEventListener("pagehide",g),document.addEventListener("visibilitychange",g),{pauseListeners:c,listen:v,destroy:y}}function Eu(e,t,s,i=!1,o=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:o?Ls():null}}function Jh(e){let{history:t,location:s}=window,i={value:Vu(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,g){let y=e.indexOf("#"),m=y>-1?(s.host&&document.querySelector("base")?e:e.slice(y))+c:Kh()+e+c;try{t[g?"replaceState":"pushState"](v,"",m),o.value=v}catch(b){console.error(b),s[g?"replace":"assign"](m)}}function u(c,v){r(c,xe({},t.state,Eu(o.value.back,c,o.value.forward,!0),v,{position:o.value.position}),!0),i.value=c}function p(c,v){let g=xe({},o.value,t.state,{forward:c,scroll:Ls()});r(g.current,g,!0),r(c,xe({},Eu(i.value,c,null),{position:g.position+1},v),!1),i.value=c}return{location:i,state:o,push:p,replace:u}}function qu(e){e=mu(e);let t=Jh(e),s=Yh(e,t.state,t.location,t.replace);function i(r,u=!0){u||s.pauseListeners(),history.go(r)}let o=xe({locatLine truncated
`).forEach((L,k)=>{for(let[q,G]of b){let H=q.exec(L);if(H&&!/^(if|for|while|switch|return|catch)$/.test(H[1])){I.push({name:H[1],kind:G,line:k+1});break}}}),E={content:e.content,list:I.slice(0,300)},E.list},e.goToSymbol=function(I){e.symbolsOpen=!1;let L=e.codeEditor;L&&(L.scrollToLine(I-1,!0,!0,()=>{}),L.gotoLine(I,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+I),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 I=window.document.getElementById("goto-input");I&&(I.focus(),I.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let I=e.codeEditor;if(!I)return;let L=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),k=I.session.getLength();if(!L||+L[1]<1||+L[1]>k){e.gotoError="Enter a line from 1 to "+k;return}I.gotoLine(+L[1],L[2]?Math.max(0,+L[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",I.focus()},e.rootEntries=function(){return[...e.files||[]].sort((I,L)=>{let k=I.size==null,q=L.size==null;return k!==q?k?-1:1:I.name.localeCompare(L.name)})},e.formatSize=function(I){if(I==null)return"";if(I<1024)return I+" B";let L=I/1024,k=q=>q.toFixed(1).replace(/\.0$/,"");return L<1024?k(L)+" KB":L<1024*1024?k(L/1024)+" MB":k(L/1024/1024)+" GB"},e.fileSize=function(I){if(!I)return null;let L=I.replace(/^\/+/,""),k=(e.files||[]).find(q=>(q.path?q.path+"/":"")+q.name===L);return k&&k.size!=null?k.size:null},e.revealFolder=function(I){e.sidebarHidden=!1,e.sidebarCollapsed=!1,We(()=>{let L=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(I):I)+'"]');L&&(L.closest("li")?.classList.contains("open")||L.click(),L.scrollIntoView({block:"nearest"}),L.focus())})};let S={content:null,n:0},N=I=>{if(S.content===I)return S.n;let L=I;if(typeof L=="string")try{L=JSON.parse(L)}catch{L=null}let k=[],q=H=>{Array.isArray(H)?k.push(H.join("")):typeof H=="string"&&k.push(H)};(L&&(L.cells||(L.worksheets||[]).flatMap(H=>H.cells||[]))||[]).forEach(H=>{q(H?.source??H?.input),(H?.outputs||[]).forEach(Y=>{q(Y?.text),Y?.data&&(q(Y.data["text/plain"]),q(Y.data["text/markdown"]),q(Y.data["text/html"])),q(Y?.traceback)})});let G=k.reduce((H,Y)=>H+(Y.match(s)||[]).length,0);return S={content:I,n:G},G};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=$s;let w=I=>I.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(I){let L=e.renderRedacted(I);if(!L||typeof window.DOMParser!="function")return L;let k=new window.DOMParser().parseFromString("<div>"+L+"</div>","text/html"),q={};return k.querySelectorAll("h1, h2, h3").forEach(G=>{let H=G.id||w(G.textContent);q[H]?H+="-"+ ++q[H]:q[H]=1,G.id=H}),k.body.firstChild.innerHTML};let T={content:null,list:[]};e.readmeToc=function(){if(e.type!=="html"||typeof e.content!="string")return[];if(T.content===e.content)return T.list;let L=[...new window.DOMParser().parseFromString("<div>"+e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)+"</div>","text/html").querySelectorAll("h2, h3")].map(k=>({id:k.id,text:k.textContent.trim(),level:k.tagName==="H3"?3:2})).slice(0,40);return T={content:e.content,list:L},L},e.activeHeading=null,o(window,"scroll",()=>{let I=e.readmeToc?e.readmeToc():[];if(!I.length)return;let L=150,k="",q="";for(let G of I){let H=window.document.getElementById(G.id);if(!H)continue;let Y=H.getBoundingClientRect().top;Y<L?k=G.id:!q&&Y<window.innerHeight-80&&(q=G.id)}q&&(k=q),e.activeHeading!==k&&(e.activeHeading=k)},{capture:!0,passive:!0}),e.scrollToHeading=function(I){if(!I){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}let L=window.document.getElementById(I);L&&L.scrollIntoView({behavior:"smooth",block:"start"}),e.activeHeading=I},e.csvView="table";let M={content:null,rows:[]},F=(I,L)=>{let k=[],q=[],G="",H=!1;for(let Y=0;Y<I.length;Y++){let ee=I[Y];H?ee==='"'?I[Y+1]==='"'?(G+='"',Y++):H=!1:G+=ee:ee==='"'&&G===""?H=!0:ee===L?(q.push(G),G=""):ee===`
`+JSON.stringify(t):""}`},[ct.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${Yh(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 lo(e,t){return xe(new Error,{type:e,[Su]:!0},t)}function bn(e,t){return e instanceof Error&&Su in e&&(t==null||!!(e.type&t))}var Kh=["params","query","hash"];function Yh(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of Kh)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Eu(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(uu," "),r=o.indexOf("="),u=Bo(r<0?o:o.slice(0,r)),p=r<0?null:Bo(o.slice(r+1));if(u in t){let c=t[u];Yt(c)||(c=t[u]=[c]),c.push(p)}else t[u]=p}return t}function wa(e){let t="";for(let s in e){let i=e[s];if(s=$h(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(Yt(i)?i.map(o=>o&&pa(o)):[i&&pa(i)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+s,o!=null&&(t+="="+o))})}return t}function Nu(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 Ru=Symbol(""),ka=Symbol(""),Wi=Symbol(""),Ki=Symbol(""),Yi=Symbol("");function Ho(){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 Pn(e,t,s,i,o,r=u=>u()){let u=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((p,c)=>{let v=g=>{g===!1?c(lo(ct.NAVIGATION_ABORTED,{from:s,to:t})):g instanceof Error?c(g):Wh(g)?c(lo(ct.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(u&&i.enterCallbacks[o]===u&&typeof g=="function"&&u.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 Ji(e,t,s,i,o=r=>r()){let r=[];for(let u of e)for(let p in u.components){let c=u.components[p];if(!(t!=="beforeRouteEnter"&&!u.instances[p]))if(lu(c)){let v=(c.__vccOpts||c)[t];v&&r.push(Pn(v,s,i,u,p,o))}else{let v=c();r.push(()=>v.then(h=>{if(!h)throw new Error(`Couldn't resolve component "${p}" at "${u.path}"`);let y=Ph(h)?h.default:h;u.mods[p]=h,u.components[p]=y;let g=(y.__vccOpts||y)[t];return g&&Pn(g,s,i,u,p,o)()}))}}return r}function Tu(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(v=>ao(v,p))?i.push(p):s.push(p));let c=e.matched[u];c&&(t.matched.find(v=>ao(v,c))||o.push(c))}return[s,i,o]}var Jh=()=>location.protocol+"//"+location.host;function $u(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),ga(p,"")}return ga(s,e)+i+o}function Xh(e,t,s,i){let o=[],r=[],u=null,p=({state:g})=>{let k=$u(e,location),w=s.value,C=t.value,N=0;if(g){if(s.value=k,t.value=g,u&&u===w){u=null;return}N=C?g.position-C.position:0}else i(k);o.forEach(b=>{b(s.value,w,{delta:N,type:ji.pop,direction:N?N>0?Gi.forward:Gi.back:Gi.unknown})})};function c(){u=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:_s()}),"")}}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 Pu(e,t,s,i=!1,o=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:o?_s():null}}function Qh(e){let{history:t,location:s}=window,i={value:$u(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:Jh()+e+c;try{t[h?"replaceState":"pushState"](v,"",g),o.value=v}catch(k){console.error(k),s[h?"replace":"assign"](g)}}function u(c,v){r(c,xe({},t.state,Pu(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:_s()});r(h.current,h,!0),r(c,xe({},Pu(i.value,c,null),{position:h.position+1},v),!1),i.value=c}return{location:i,state:o,push:p,replace:u}}function Fu(e){e=yu(e);let t=Qh(e),s=Xh(e,t.state,t.location,t.replace);function i(r,u=!0){u||s.pauseListeners(),history.go(r)}let o=xe({locatLine truncated
`).forEach((L,S)=>{for(let[q,G]of k){let j=q.exec(L);if(j&&!/^(if|for|while|switch|return|catch)$/.test(j[1])){I.push({name:j[1],kind:G,line:S+1});break}}}),w={content:e.content,list:I.slice(0,300)},w.list},e.goToSymbol=function(I){e.symbolsOpen=!1;let L=e.codeEditor;L&&(L.scrollToLine(I-1,!0,!0,()=>{}),L.gotoLine(I,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+I),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 I=window.document.getElementById("goto-input");I&&(I.focus(),I.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let I=e.codeEditor;if(!I)return;let L=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),S=I.session.getLength();if(!L||+L[1]<1||+L[1]>S){e.gotoError="Enter a line from 1 to "+S;return}I.gotoLine(+L[1],L[2]?Math.max(0,+L[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",I.focus()},e.rootEntries=function(){return[...e.files||[]].sort((I,L)=>{let S=I.size==null,q=L.size==null;return S!==q?S?-1:1:I.name.localeCompare(L.name)})},e.formatSize=function(I){if(I==null)return"";if(I<1024)return I+" B";let L=I/1024,S=q=>q.toFixed(1).replace(/\.0$/,"");return L<1024?S(L)+" KB":L<1024*1024?S(L/1024)+" MB":S(L/1024/1024)+" GB"},e.fileSize=function(I){if(!I)return null;let L=I.replace(/^\/+/,""),S=(e.files||[]).find(q=>(q.path?q.path+"/":"")+q.name===L);return S&&S.size!=null?S.size:null},e.revealFolder=function(I){e.sidebarHidden=!1,e.sidebarCollapsed=!1,We(()=>{let L=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(I):I)+'"]');L&&(L.closest("li")?.classList.contains("open")||L.click(),L.scrollIntoView({block:"nearest"}),L.focus())})};let C={content:null,n:0},N=I=>{if(C.content===I)return C.n;let L=I;if(typeof L=="string")try{L=JSON.parse(L)}catch{L=null}let S=[],q=j=>{Array.isArray(j)?S.push(j.join("")):typeof j=="string"&&S.push(j)};(L&&(L.cells||(L.worksheets||[]).flatMap(j=>j.cells||[]))||[]).forEach(j=>{q(j?.source??j?.input),(j?.outputs||[]).forEach(Y=>{q(Y?.text),Y?.data&&(q(Y.data["text/plain"]),q(Y.data["text/markdown"]),q(Y.data["text/html"])),q(Y?.traceback)})});let G=S.reduce((j,Y)=>j+(Y.match(s)||[]).length,0);return C={content:I,n:G},G};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=Fs;let b=I=>I.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(I){let L=e.renderRedacted(I);if(!L||typeof window.DOMParser!="function")return L;let S=new window.DOMParser().parseFromString("<div>"+L+"</div>","text/html"),q={};return S.querySelectorAll("h1, h2, h3").forEach(G=>{let j=G.id||b(G.textContent);q[j]?j+="-"+ ++q[j]:q[j]=1,G.id=j}),S.body.firstChild.innerHTML};let T={content:null,list:[]};e.readmeToc=function(){if(e.type!=="html"||typeof e.content!="string")return[];if(T.content===e.content)return T.list;let L=[...new window.DOMParser().parseFromString("<div>"+e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)+"</div>","text/html").querySelectorAll("h2, h3")].map(S=>({id:S.id,text:S.textContent.trim(),level:S.tagName==="H3"?3:2})).slice(0,40);return T={content:e.content,list:L},L},e.activeHeading=null,o(window,"scroll",()=>{let I=e.readmeToc?e.readmeToc():[];if(!I.length)return;let L=150,S="",q="";for(let G of I){let j=window.document.getElementById(G.id);if(!j)continue;let Y=j.getBoundingClientRect().top;Y<L?S=G.id:!q&&Y<window.innerHeight-80&&(q=G.id)}q&&(S=q),e.activeHeading!==S&&(e.activeHeading=S)},{capture:!0,passive:!0}),e.scrollToHeading=function(I){if(!I){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}let L=window.document.getElementById(I);L&&L.scrollIntoView({behavior:"smooth",block:"start"}),e.activeHeading=I},e.csvView="table";let O={content:null,rows:[]},F=(I,L)=>{let S=[],q=[],G="",j=!1;for(let Y=0;Y<I.length;Y++){let ee=I[Y];j?ee==='"'?I[Y+1]==='"'?(G+='"',Y++):j=!1:G+=ee:ee==='"'&&G===""?j=!0:ee===L?(q.push(G),G=""):ee===`
`||ee==="\r"?(ee==="\r"&&I[Y+1]===`
`&&Y++,q.push(G),k.push(q),q=[],G=""):G+=ee}return(G!==""||q.length)&&(q.push(G),k.push(q)),k.filter(Y=>Y.length>1||Y[0]!=="")};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(M.content!==e.content){let I=/\.tsv$/i.test(e.filePath||"")?" ":",";M={content:e.content,rows:F(e.content,I)}}return M.rows},e.csvNumCol=I=>{let L=e.csvRows().slice(1).map(k=>k[I]).filter(k=>k!=null&&String(k).trim()!=="");return L.length>0&&L.every(k=>e.csvNumeric(k))},e.csvNumeric=I=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(I)&&/\d/.test(I),e.redactParts=function(I){let L=[],k=0,q,G=/\bXXXX-(\d+)\b/g;for(I=String(I||"");q=G.exec(I);)q.index>k&&L.push({t:I.slice(k,q.index)}),L.push({n:q[1]}),k=q.index+q[0].length;return k<I.length&&L.push({t:I.slice(k)}),L},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 I=e.content;if(e.type==="html"&&e.url)if(e.preview)I=e.sourceContent;else try{I=await(await window.fetch(e.url,{credentials:"same-origin"})).text()}catch{return}await window.navigator.clipboard.writeText(I),e.contentCopied=!0,setTimeout(()=>{e.contentCopied=!1},1600)};function j(I){return r[I]?r[I]:I}function oe(I){return I=="pdf"?"pdf":I=="html"||I=="htm"?"html-doc":["md","markdown","mdown","mkdn","mdx"].includes(I)?"md":I=="org"?"org":I=="ipynb"?"IPython":u.indexOf(I)>-1?"text":p.indexOf(I)>-1?"image":v.indexOf(I)>-1?"media":c.indexOf(I)>-1?"audio":"code"}e.downloadUrl=()=>e.preview?e.url:e.url+"&download=true",e.prepareFile=function(I){e.showSource=!1,e.allowScripts=!1,e.imageSize="",e.filePath=I,e.paths=I.split("/").filter(Boolean);let L=e.filePath.toLowerCase(),k=L.lastIndexOf(".");k>-1&&(L=L.substring(k+1));let q={javascript:"JavaScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",python:"Python",java:"Java",c_cpp:"C/C++",csharp:"C#",golang:"Go",rust:"Rust",ruby:"Ruby",php:"PHP",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",yaml:"YAML",markdown:"Markdown",sh:"Shell",dockerfile:"Dockerfile",xml:"XML",sql:"SQL",kotlin:"Kotlin",swift:"Swift",scala:"Scala",r:"R",julia:"Julia",latex:"LaTeX",toml:"TOML",csv:"CSV",tsv:"TSV",text:""},G=j(L);e.languageName=q[G]??(G?G.charAt(0).toUpperCase()+G.slice(1):""),e.aceOption={readOnly:!0,useWrapMode:!0,showGutter:!0,theme:"chrome",useSoftTab:!0,tabSize:2,fontSize:window.matchMedia?.("(max-width: 767px)").matches?12:13,keyBinding:"vscode",fullLineSelection:!0,highlightActiveLine:!1,highlightGutterLine:!1,cursor:"hide",showInvisibles:!1,showIndentGuides:!1,showPrintMargin:!1,highlightSelectedWord:!1,enableBehaviours:!0,fadeFoldWidgets:!1,mode:j(L),onLoad:function(H){e.codeEditor=fn(H);{let Ne=H.session,qe=Ne.getTokens.bind(Ne),X=/\bXXXX-\d+\b/g;if(Ne.getTokens=function(ce){let ue=qe(ce);if(!ue.some(be=>be.value.indexOf("XXXX-")!==-1))return ue;let me=[];for(let be of ue){if(be.value.indexOf("XXXX-")===-1){me.push(be);continue}let Ve=0;X.lastIndex=0;let D;for(;D=X.exec(be.value);)D.index>Ve&&me.push({type:be.type,value:be.value.slice(Ve,D.index)}),me.push({type:"redacted.n"+D[0].slice(5),value:D[0]}),Ve=D.index+D[0].length;Ve<be.value.length&&me.push({type:be.type,value:be.value.slice(Ve)})}return me},!window.document.getElementById("redact-index-rules")){let ce=window.document.createElement("style");ce.id="redact-index-rules",ce.textContent=Array.from({length:99},(ue,me)=>`.ace_redacted.ace_n${me+1}::after{content:"${me+1}"}`).join(""),window.document.head.appendChild(ce)}H.renderer.updateFull(!0)}H.session.setUseWrapMode(e.wrapLines!==!1);let Y=H.container.closest?.(".file-card"),ee=()=>{if(!Y)return;let Ne=H.renderer,qe=(Ne.layerConfig?.width||0)-(Ne.$size?.scrollerWidth||0);Y.classList.toggle("at-right-edge",qe<=2||Ne.getScrollLeft()>=qe-2)};H.session.on("changeScrollLeft",ee),H.renderer.on("afterRender",ee),window.matchMedia?.("(max-width: 767px)").matches&&H.setOption("hScrollBarAlwaysVisible",!0);let x=ace.require("ace/range").Range,fe=null;function he(Ne,qe){fe!==null&&(H.session.removeMarker(fe),fe=null),Ne!=null&&(fe=H.session.addMarker(new x(Ne,0,qe,1),"highlighted-line","fullLine"))}function Be(Ne){let qe=!e.preview&&window.location.hash.match(/^#L(\d+)(?:-L(\d+))?/);if(!qe){he(null);return}let X=parseInt(qe[1])-1,ce=qe[2]?parseInt(qe[2])-1:X;he(X,ce),Ne&&i.timeout(()=>{H.scrollToLine(X,!0,!0,function(){})},100)}Be(!0);let He=null;H.on("guttermousedown",function(Ne){let qe=Ne.getDocumentPosition().row,X=Ne.domEvent&&Ne.domEvent.shiftKey,ce=qe,ue=qe;X&&He!==null?(ce=Math.min(He,qe),ue=Math.max(He,qe)):He=qe;let me=ce===ue?`#L${ce+1}`:`#L${ce+1}-L${ue+1}`,be=window.location.pathname+window.location.search+me;e.preview||window.history.replaceState(null,"",be),he(ce,ue),Ne.stop()});let Qe=o(window,"hashcha Line truncated
`);for(let y=0;y<g.length;y++){let m=g[y];if(m.startsWith("diff --git")){v(),c();continue}if(m.startsWith("--- ")){r&&r.lines.length&&v(),c().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){c().newPath=m.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!(m.startsWith("index ")||m.startsWith("similarity index")||m.startsWith("rename ")||m.startsWith("new file mode")||m.startsWith("deleted file mode")||m.startsWith("Binary files"))){if(m.startsWith("@@")){let b=m.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);b&&(u=parseInt(b[1],10),p=parseInt(b[2],10)),c().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}r&&(m.startsWith("+")?(r.lines.push({kind:"add",oldNo:"",newNo:p,text:m.slice(1)}),p++):m.startsWith("-")?(r.lines.push({kind:"remove",oldNo:u,newNo:"",text:m.slice(1)}),u++):(r.lines.push({kind:"ctx",oldNo:u,newNo:p,text:m.startsWith(" ")?m.slice(1):m}),u++,p++))}}return s(o,r),o.join("")}})({trustAsHtml:e=>e});function kg(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Cg(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 Sg(e){return String(e??"").toUpperCase()}function Eg(e,t,s=0){return(e||[]).slice(s,s+t)}function Ng(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function Rg(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((v,g)=>v?.[g],i),c=r.split(".").reduce((v,g)=>v?.[g],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)*u}return 0})}function Tg(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 Pg(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function Sa(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),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"],g=v[0]+" "+v[1]+(v[0]===1?"":"s");u=r>0?"in "+g:g+" ago"}return i+" \xB7 "+u}function $n(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 Ea(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)}var er=e=>["preparing","download","downloading","downloaded","queue","anonymizing"].includes(e)?"preparing":e==="expiring"?"expired":e==="removing"?"removed":e;function tr(e,{flags:t,keys:s,count:i,onChange:o=()=>{}}){if(e.segView=()=>{let r=t()||{};if(s.every(p=>!!r[p]))return"all";let u=s.filter(p=>!!r[p]);return u.length===1?u[0]:"custom"},e.setSegView=r=>{let u=t();if(u){for(let p of s)u[p]=r==="all"?!0:p===r;o()}},e.segCount=r=>r==="all"?s.reduce((u,p)=>u+i(p),0):i(r),t()&&e.segView()==="custom")for(let r of s)t()[r]=!0}var ju=function(e,t,s){let i=bt(),o=Bt();Qu(i,o),e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),e.repositories=[],e.total=-1,e.totalPage=0,e.statusCounts=[],e.totalSize=0,e.selected={},e.allSelected=!1;let r=S=>{if(S.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){S.preventDefault();let N=document.querySelector('.admin-filter-toolbar input[type="search"]');N&&N.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=S=>{S==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[S]="",e.query.page=1},e.chips=[];let u=()=>{let S=[];e.query.owner&&S.push({key:"owner",label:"Owner",value:e.query.owner}),e.query.conference&&S.push({key:"conference",label:"Conference",value:e.query.conference}),e.chips=S};e.showSta Line truncated
`+S.join(`
`)],{type:"text/csv"}),w=document.createElement("a");w.href=URL.createObjectURL(N),w.download=i.username+"-repositories.csv",w.click()},e.showStatusMessage=m=>{let b=m.statusMessage||"(no message)";window.prompt(`Status message for ${m.repoId} (${m.status}):`,b)},e.fetchGithubInfo=m=>{let b=window.open("","_blank");b&&b.document.write("<pre>Loading GitHub info for "+m.repoId+"...</pre>"),t.get("/api/admin/repos/"+m.repoId+"/github").then(E=>{b&&(b.document.open(),b.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(E.data,null,2).replace(/[<>]/g,S=>S==="<"?"&lt;":"&gt;")+"</pre>"),b.document.close())},E=>{let S=E&&E.data?JSON.stringify(E.data,null,2):String(E);b&&(b.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+S+"</pre>")})};function c(m){t.get("/api/admin/users/"+m+"/repos",{}).then(b=>{e.repositories=b.data},b=>{console.error(b)})}function v(m){t.get("/api/admin/users/"+m,{}).then(b=>{e.userInfo=b.data},b=>{console.error(b)})}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),m=>console.error(m))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>v(i.username),m=>console.error(m))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>v(i.username),m=>console.error(m))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>v(i.username),m=>console.error(m))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function g(){t.get("/api/admin/tokens").then(m=>{e.tokens=m.data||[]},m=>{m.status!==401&&m.status!==403&&console.error(m)})}g(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(m=>{e.tokenForm.plaintext=m.data.token,e.tokenForm.name="",g()},m=>console.error(m))},e.revokeToken=m=>{confirm(`Revoke token "${m.name}"?`)&&t.delete("/api/admin/tokens/"+m.id).then(()=>g(),b=>console.error(b))},e.removeCache=m=>{confirm("Remove cached files for "+m.repoId+"?")&&t.delete("/api/admin/repos/"+m.repoId).then(()=>c(i.username),b=>console.error(b))},e.removeRepository=m=>{confirm("Remove repository "+m.repoId+"?")&&t.delete("/api/repo/"+m.repoId+"/").then(()=>c(i.username),b=>console.error(b))},e.updateRepository=m=>{let b=at({title:`Refreshing ${m.repoId}...`,date:new Date,body:`The repository ${m.repoId} is going to be refreshed.`});e.toasts.push(b),t.post(`/api/repo/${m.repoId}/refresh`).then(E=>{E.data.status=="ready"?b.title=`${m.repoId} is refreshed.`:b.title=`Refreshing of ${m.repoId}.`},E=>{b.title=`Error during the refresh of ${m.repoId}.`,b.body=E.body})},e.getGitHubRepositories=m=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(b=>{e.userInfo.repositories=b.data})};let y=null;e.watch("query",()=>{o.timeout.cancel(y),y=o.timeout(()=>{c(i.username)},500)},!0)},Ku=function(e,t,s){let i=bt(),o=Bt();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=E=>{if(E.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){E.preventDefault();let S=document.querySelector('.admin-filter-toolbar input[type="search"]');S&&S.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=E=>{E==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[E]="",e.query.page=1},e.chips=[];let u=()=>{let E=[];(e.query.dateFrom||e.query.dateTo)&&E.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=E};e.statusCountFor=E=>{let S=(e.statusCounts||[]).find(N=>N._id===E);return S?S.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=E=>{e.query.sort===E?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=E,e.query.direction="desc"),e.query.page=1},e.sortIcon=E=>e.query.sort===E?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 g=s.search();g.search&&(e.query.search=g.search);let y="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(y)||"[]"),e.savePreset=()=>{let E=window.prompt("Preset name:");if(!E)return;let S=Object.assign({},e.query);delete S.page,e.presets=(e.presets||[]).filter(N=>N.name!==E),e.presets.push({name:E,query:S}),localStorage.setItem(y,JSON.stringify(e.presets))},e.applyPreset=E=>{Object.assign(e.query,E.query,{page:1})},e.deletePreset=E=>{e.presets=(e.presets||[]).filter(S=>S.name!==E.name),localStorage.setItem(y,JS Line truncated
`):typeof z.stack=="string"?z.stack:null;for(var I=[z.cause,z.err].filter(Boolean),L=0;!q&&L<I.length;L++)for(var k=I[L];!q&&k&&typeof k=="object";)typeof k.stack=="string"&&(q=k.stack),k=k.cause;_._stack=q}else _.displayMessage=_.message,_._status=null,_._url=null,_._stack=null;return _._bucket=m(z,_.level),_._detailJson=E(_,z),_}function E(_,z){let I=[],L=(H,Y)=>{Y==null||Y===""||I.push([H,Y])};for(let H of["service","event","severity","requestId","jobId"])L(H,z&&z[H]);L("name",z&&z.name),L("code",_.displayMessage||z&&z.message),_._bucket&&L("kind",_._bucket),L("httpStatus",z&&z.httpStatus),z&&z.status&&!z.httpStatus&&L("status",z.status),L("module",_.module);let k=z&&z.detail;if(typeof k=="string"){let H=k.trim();if(H[0]==="{"||H[0]==="[")try{k=JSON.parse(k)}catch{}}if(L("detail",k),L("repoId",z&&z.repoId),L("filePath",z&&z.filePath),L("upstreamStatus",z&&z.upstreamStatus),L("upstreamBody",z&&z.upstreamBody),L("url",_._url),L("err",z&&z.err),L("cause",z&&!z.err&&z.cause),L("ts",_.ts),!I.length)return JSON.stringify(_,null,2);let q=I.reduce((H,Y)=>Math.max(H,Y[0].length),0),G=["{"];return I.forEach(([H,Y],ee)=>{let fe=` ${`"${H}":`.padEnd(q+3," ")} `,he=ee<I.length-1?",":"",Be;if(Y&&typeof Y=="object"){let He=" ".repeat(fe.length);Be=JSON.stringify(Y,null,2).split(`
`&&Y++,q.push(G),S.push(q),q=[],G=""):G+=ee}return(G!==""||q.length)&&(q.push(G),S.push(q)),S.filter(Y=>Y.length>1||Y[0]!=="")};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(O.content!==e.content){let I=/\.tsv$/i.test(e.filePath||"")?" ":",";O={content:e.content,rows:F(e.content,I)}}return O.rows},e.csvNumCol=I=>{let L=e.csvRows().slice(1).map(S=>S[I]).filter(S=>S!=null&&String(S).trim()!=="");return L.length>0&&L.every(S=>e.csvNumeric(S))},e.csvNumeric=I=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(I)&&/\d/.test(I),e.redactParts=function(I){let L=[],S=0,q,G=/\bXXXX-(\d+)\b/g;for(I=String(I||"");q=G.exec(I);)q.index>S&&L.push({t:I.slice(S,q.index)}),L.push({n:q[1]}),S=q.index+q[0].length;return S<I.length&&L.push({t:I.slice(S)}),L},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 I=e.content;if(e.type==="html"&&e.url)if(e.preview)I=e.sourceContent;else try{I=await(await window.fetch(e.url,{credentials:"same-origin"})).text()}catch{return}await window.navigator.clipboard.writeText(I),e.contentCopied=!0,setTimeout(()=>{e.contentCopied=!1},1600)};function H(I){return r[I]?r[I]:I}function oe(I){return I=="pdf"?"pdf":I=="html"||I=="htm"?"html-doc":["md","markdown","mdown","mkdn","mdx"].includes(I)?"md":I=="org"?"org":I=="ipynb"?"IPython":u.indexOf(I)>-1?"text":p.indexOf(I)>-1?"image":v.indexOf(I)>-1?"media":c.indexOf(I)>-1?"audio":"code"}e.downloadUrl=()=>e.preview?e.url:e.url+"&download=true",e.prepareFile=function(I){e.showSource=!1,e.allowScripts=!1,e.imageSize="",e.filePath=I,e.paths=I.split("/").filter(Boolean);let L=e.filePath.toLowerCase(),S=L.lastIndexOf(".");S>-1&&(L=L.substring(S+1));let q={javascript:"JavaScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",python:"Python",java:"Java",c_cpp:"C/C++",csharp:"C#",golang:"Go",rust:"Rust",ruby:"Ruby",php:"PHP",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",yaml:"YAML",markdown:"Markdown",sh:"Shell",dockerfile:"Dockerfile",xml:"XML",sql:"SQL",kotlin:"Kotlin",swift:"Swift",scala:"Scala",r:"R",julia:"Julia",latex:"LaTeX",toml:"TOML",csv:"CSV",tsv:"TSV",text:""},G=H(L);e.languageName=q[G]??(G?G.charAt(0).toUpperCase()+G.slice(1):""),e.aceOption={readOnly:!0,useWrapMode:!0,showGutter:!0,theme:"chrome",useSoftTab:!0,tabSize:2,fontSize:window.matchMedia?.("(max-width: 767px)").matches?12:13,keyBinding:"vscode",fullLineSelection:!0,highlightActiveLine:!1,highlightGutterLine:!1,cursor:"hide",showInvisibles:!1,showIndentGuides:!1,showPrintMargin:!1,highlightSelectedWord:!1,enableBehaviours:!0,fadeFoldWidgets:!1,mode:H(L),onLoad:function(j){e.codeEditor=fn(j);{let Ne=j.session,qe=Ne.getTokens.bind(Ne),X=/\bXXXX-\d+\b/g;if(Ne.getTokens=function(ce){let ue=qe(ce);if(!ue.some(be=>be.value.indexOf("XXXX-")!==-1))return ue;let me=[];for(let be of ue){if(be.value.indexOf("XXXX-")===-1){me.push(be);continue}let Ve=0;X.lastIndex=0;let D;for(;D=X.exec(be.value);)D.index>Ve&&me.push({type:be.type,value:be.value.slice(Ve,D.index)}),me.push({type:"redacted.n"+D[0].slice(5),value:D[0]}),Ve=D.index+D[0].length;Ve<be.value.length&&me.push({type:be.type,value:be.value.slice(Ve)})}return me},!window.document.getElementById("redact-index-rules")){let ce=window.document.createElement("style");ce.id="redact-index-rules",ce.textContent=Array.from({length:99},(ue,me)=>`.ace_redacted.ace_n${me+1}::after{content:"${me+1}"}`).join(""),window.document.head.appendChild(ce)}j.renderer.updateFull(!0)}j.session.setUseWrapMode(e.wrapLines!==!1);let Y=j.container.closest?.(".file-card"),ee=()=>{if(!Y)return;let Ne=j.renderer,qe=(Ne.layerConfig?.width||0)-(Ne.$size?.scrollerWidth||0);Y.classList.toggle("at-right-edge",qe<=2||Ne.getScrollLeft()>=qe-2)};j.session.on("changeScrollLeft",ee),j.renderer.on("afterRender",ee),window.matchMedia?.("(max-width: 767px)").matches&&j.setOption("hScrollBarAlwaysVisible",!0);let x=ace.require("ace/range").Range,fe=null;function he(Ne,qe){fe!==null&&(j.session.removeMarker(fe),fe=null),Ne!=null&&(fe=j.session.addMarker(new x(Ne,0,qe,1),"highlighted-line","fullLine"))}function Be(Ne){let qe=!e.preview&&window.location.hash.match(/^#L(\d+)(?:-L(\d+))?/);if(!qe){he(null);return}let X=parseInt(qe[1])-1,ce=qe[2]?parseInt(qe[2])-1:X;he(X,ce),Ne&&i.timeout(()=>{j.scrollToLine(X,!0,!0,function(){})},100)}Be(!0);let He=null;j.on("guttermousedown",function(Ne){let qe=Ne.getDocumentPosition().row,X=Ne.domEvent&&Ne.domEvent.shiftKey,ce=qe,ue=qe;X&&He!==null?(ce=Math.min(He,qe),ue=Math.max(He,qe)):He=qe;let me=ce===ue?`#L${ce+1}`:`#L${ce+1}-L${ue+1}`,be=window.location.pathname+window.location.search+me;e.preview||window.history.replaceState(null,"",be),he(ce,ue),Ne.stop()});let Qe=o(window,"hashcha Line truncated
`);for(let y=0;y<h.length;y++){let g=h[y];if(g.startsWith("diff --git")){v(),c();continue}if(g.startsWith("--- ")){r&&r.lines.length&&v(),c().oldPath=g.replace(/^--- (a\/)?/,"").trim();continue}if(g.startsWith("+++ ")){c().newPath=g.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!(g.startsWith("index ")||g.startsWith("similarity index")||g.startsWith("rename ")||g.startsWith("new file mode")||g.startsWith("deleted file mode")||g.startsWith("Binary files"))){if(g.startsWith("@@")){let k=g.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);k&&(u=parseInt(k[1],10),p=parseInt(k[2],10)),c().lines.push({kind:"hunk",oldNo:"",newNo:"",text:g});continue}r&&(g.startsWith("+")?(r.lines.push({kind:"add",oldNo:"",newNo:p,text:g.slice(1)}),p++):g.startsWith("-")?(r.lines.push({kind:"remove",oldNo:u,newNo:"",text:g.slice(1)}),u++):(r.lines.push({kind:"ctx",oldNo:u,newNo:p,text:g.startsWith(" ")?g.slice(1):g}),u++,p++))}}return s(o,r),o.join("")}})({trustAsHtml:e=>e});function Ra(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Sg(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 Eg(e){return String(e??"").toUpperCase()}function Ng(e,t,s=0){return(e||[]).slice(s,s+t)}function Rg(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function Tg(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((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)*u}return 0})}function tr(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 Pg(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function Ta(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),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");u=r>0?"in "+h:h+" ago"}return i+" \xB7 "+u}function $n(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 Pa(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)}var or=e=>["preparing","download","downloading","downloaded","queue","anonymizing"].includes(e)?"preparing":e==="expiring"?"expired":e==="removing"?"removed":e;function sr(e,{flags:t,keys:s,count:i,onChange:o=()=>{}}){if(e.segView=()=>{let r=t()||{};if(s.every(p=>!!r[p]))return"all";let u=s.filter(p=>!!r[p]);return u.length===1?u[0]:"custom"},e.setSegView=r=>{let u=t();if(u){for(let p of s)u[p]=r==="all"?!0:p===r;o()}},e.segCount=r=>r==="all"?s.reduce((u,p)=>u+i(p),0):i(r),t()&&e.segView()==="custom")for(let r of s)t()[r]=!0}var Wu=function(e,t,s){let i=bt(),o=Bt();xu(i,o),e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),e.repositories=[],e.total=-1,e.totalPage=0,e.statusCounts=[],e.totalSize=0,e.selected={},e.allSelected=!1;let r=C=>{if(C.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){C.preventDefault();let N=document.querySelector('.admin-filter-toolbar input[type="search"]');N&&N.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=C=>{C==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[C]="",e.query.page=1},e.chips=[];let u=()=>{let C=[];e.query.owner&&C.push({key:"owner",label:"Owner",value:e.query.owner}),e.query.conference&&C.push({key:"conference",label:"Conference",value:e.query.conference}),e.chips=C};e.showSta 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==="<"?"&lt;":"&gt;")+"</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)},Ju=function(e,t,s){let i=bt(),o=Bt();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 u=()=>{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 I=[z.cause,z.err].filter(Boolean),L=0;!q&&L<I.length;L++)for(var S=I[L];!q&&S&&typeof S=="object";)typeof S.stack=="string"&&(q=S.stack),S=S.cause;_._stack=q}else _.displayMessage=_.message,_._status=null,_._url=null,_._stack=null;return _._bucket=g(z,_.level),_._detailJson=w(_,z),_}function w(_,z){let I=[],L=(j,Y)=>{Y==null||Y===""||I.push([j,Y])};for(let j of["service","event","severity","requestId","jobId"])L(j,z&&z[j]);L("name",z&&z.name),L("code",_.displayMessage||z&&z.message),_._bucket&&L("kind",_._bucket),L("httpStatus",z&&z.httpStatus),z&&z.status&&!z.httpStatus&&L("status",z.status),L("module",_.module);let S=z&&z.detail;if(typeof S=="string"){let j=S.trim();if(j[0]==="{"||j[0]==="[")try{S=JSON.parse(S)}catch{}}if(L("detail",S),L("repoId",z&&z.repoId),L("filePath",z&&z.filePath),L("upstreamStatus",z&&z.upstreamStatus),L("upstreamBody",z&&z.upstreamBody),L("url",_._url),L("err",z&&z.err),L("cause",z&&!z.err&&z.cause),L("ts",_.ts),!I.length)return JSON.stringify(_,null,2);let q=I.reduce((j,Y)=>Math.max(j,Y[0].length),0),G=["{"];return I.forEach(([j,Y],ee)=>{let fe=` ${`"${j}":`.padEnd(q+3," ")} `,he=ee<I.length-1?",":"",Be;if(Y&&typeof Y=="object"){let He=" ".repeat(fe.length);Be=JSON.stringify(Y,null,2).split(`
`).map((Qe,Ee)=>Ee===0?Qe:He+Qe).join(`
`)}else typeof Y=="number"||typeof Y=="boolean"?Be=String(Y):Be=JSON.stringify(Y);G.push(`${fe}${Be}${he}`)}),G.push("}"),G.join(`
`)}function S(_){let z=[],I="",L=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,k=0,q;for(;q=L.exec(_);)I+=_.slice(k,q.index),k=L.lastIndex,z.push({key:q[1],op:q[2]||"=",val:q[3]});return I+=_.slice(k),{filters:z,free:I.trim().toLowerCase()}}function N(_,z){for(let I of z.filters){let L=(q,G,H)=>{let Y=parseFloat(q),ee=parseFloat(G);return H==="="?String(q)===String(G):H==="!="?String(q)!==String(G):H===">="?Y>=ee:H==="<="?Y<=ee:H===">"?Y>ee:H==="<"?Y<ee:!0},k;if(I.key==="code")k=_.displayMessage;else if(I.key==="module")k=_.module;else if(I.key==="status")k=_._status;else if(I.key==="url")k=_._url;else if(I.key==="repo")k=_._repoId;else if(I.key==="level")k=_.level;else continue;if(k==null||!L(k,I.val,I.op))return!1}return!(z.free&&((_.displayMessage||"")+" "+(_.module||"")+" "+(_._url||"")+" "+JSON.stringify(_.raw||[])).toLowerCase().indexOf(z.free)===-1)}function w(){let _=S(e.query.search||"");e.parsedFilterCount=_.filters.length;let z=e.query.bucket,I=e.entries.filter(H=>z&&H._bucket!==z?!1:N(H,_)),L=e.query.group;if(L){let H=x=>JSON.stringify(L==="module"?[x.module,x._bucket]:[x.raw?.[0]?.service||"unknown",x.module,x.displayMessage||x.message||"_",x._bucket,x._status]),Y=new Map;for(let x of I){let fe=H(x);if(Y.has(fe)){let he=Y.get(fe);he.count++,he._related.push(x),new Date(x.ts)>new Date(he.ts)&&(he.ts=x.ts,he._url=x._url,he._status=x._status),new Date(x.ts)<new Date(he._firstSeen)&&(he._firstSeen=x.ts)}else{let he=Object.assign({},x);he._key=`${L}:${fe}`,he._related=[x],he._firstSeen=x.ts,he._lastHourCount=0,he.count=1,Y.set(fe,he)}}let ee=Date.now()-3600*1e3;for(let x of Y.values())x._lastHourCount=x._related.filter(fe=>new Date(fe.ts).getTime()>=ee).length;I=Array.from(Y.values())}else I=I.map((H,Y)=>(H._key="row:"+Y+":"+H.ts,H._related=[H],H._firstSeen=H.ts,H._lastHourCount=0,H.count=1,H));let k=H=>({error:0,warn:1,info:2})[H._bucket]??1;e.query.sort==="count"?I.sort((H,Y)=>k(H)-k(Y)||Y.count-H.count||new Date(Y.ts)-new Date(H.ts)):I.sort((H,Y)=>k(H)-k(Y)||new Date(Y.ts)-new Date(H.ts)),e.visible=I;let q=!!(e.query.bucket||(e.query.search||"").trim()),G=!q&&(e.stats?.severity?.error||0)>0&&!I.some(H=>H._bucket==="error")&&e.entries.length<1500;(q&&!I.length||G)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,T(!0))}function T(_){if(_&&e.redisLoading)return;let z=++o;e.redisLoading=!0;let I=_?e.redisNextOffset||e.entries.length:0,L=_?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:I,limit:L}}).then(k=>{if(p||z!==o)return;e.redisLoading=!1;let q=(k.data.entries||[]).map(b);e.entries=_?e.entries.concat(q):q,e.redisRedacted=(_&&e.redisRedacted||0)+(k.data.redactedEntries||0),e.redisNextOffset=k.data.nextOffset??I+(k.data.entries||[]).length,e.available=!!k.data.available,e.redisCollecting=k.data.redisCollecting!==!1,e.cap=k.data.max||e.cap,e.total=k.data.total||e.entries.length,e._autoLoading=!1,w()},()=>{p||z!==o||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>T(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function M(_=!1){if(_&&u)return;let z=++r;u=!0,t.get("/api/admin/errors/stats").then(I=>{if(p||z!==r)return;u=!1;let L=I.data||{};e.redisStatsState=L.available===!1?"unavailable":"ready";let k=L.prev24h?Math.round((L.last24h-L.prev24h)/L.prev24h*100):0;e.stats={last24h:L.last24h||0,prev24h:L.prev24h||0,delta:k,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},w()},()=>{!p&&z===r&&(u=!1,e.redisStatsState="unavailable")})}function F(_=!1){(!_||!e.redisLoading)&&T(),M(_)}e.barPx=(_,z)=>{let I=e.stats.buckets||[],L=0,k=0;for(let Y of I)L=Math.max(L,(Y.error||0)+(Y.warn||0)),k=Math.max(k,Y.info||0);let q=_[z]||0;if(!q)return 0;if(z==="info")return k?Math.max(2,Math.round(q/k*(L?16:60))):0;let G=(_.error||0)+(_.warn||0),H=Math.round(G/L*44);return Math.max(4,Math.round(q/G*H))},e.bucketTitle=_=>`${new Date(_.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${_.error||0} err \xB7 ${_.warn||0} warn \xB7 ${_.info||0} info`,e.toggle=async(_,z)=>{v=z||document.activeElement,g=e.captureErrorScroll(v),e.historySelected=_,e.historyView="overview",e.expanded={[_._key]:!0},await We(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=_=>{if(e.historyView="timeline",e.traceSelection)return;let z=["requestId","jobId"].find(I=>e.logTraceId(e.historySelected,I));z&&e.lookupTrace(z,e.logTraceId(e.historySelected,z),_,e.historySelected)},e.closeHistory=async()=>{let _=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await We(),(v?.isConnected?v:[...document.querySelectorAll("[data-history-key]")].find(I=>I.dataset.historyKey===_))?.focus({preventScroll:!0}),e.restoreErrorScroll(g)},e.setBucket=_ Line truncated
`)],{type:"text/csv;charset=utf-8"}),L=URL.createObjectURL(I),k=document.createElement("a");k.href=L,k.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(L)};function j(_){e.copyHint=`${_} copied`,c.timeout(()=>{e.copyHint=""},1500)}e.copyJson=_=>{navigator.clipboard.writeText(_._rawJson).then(()=>j("JSON"))},e.copyCurl=_=>{if(!_._url)return;let I=`curl -X ${_._method||"GET"} '${window.location.origin}${_._url}'`;navigator.clipboard.writeText(I).then(()=>j("curl"))},F();let oe=i(()=>{e.query.autoRefresh&&F(!0)},15e3);e.on("dispose",()=>{p=!0,o++,r++,i.cancel(oe)}),e.watch("query.search",w),e.watch("query.bucket",w),e.watch("query.sort",w),e.watch("query.group",w)},Xu=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(T){w===e.cacheMinutes&&(e.cacheReport=T.data,e.cacheError=T.data.available?null:T.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,T){var M=e.cacheRows(),F=function(_){return M.filter(function(z){return z.name===_}).reduce(function(z,I){return z+I[T]},0)},j=F(w+"_hit"),oe=F(w+"_miss");return j+oe?(100*j/(j+oe)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(w){return w.replaceAll("_"," ")},e.cacheP95=function(w){var T=0,M=e.cacheReport?.latencyBucketsMs||[];if(!w.count)return"No samples";if(!w.ms)return"Not timed";for(var F=0;F<=M.length;F++)if(T+=w["b"+F]||0,T>=Math.ceil(w.count*.95))return F<M.length?"\u2264 "+$n(M[F]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let w=e.data&&e.data.system||{},T=[["Memory",w.memPercent],["Disk",w.diskPercent]].filter(([,F])=>F>90);return T.length?T.map(([F,j])=>F+" is at "+j+"%").join(" and ")+". New anonymizations may fail until "+(T.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(w){return w==null?"":$n(w)},e.latencyBound=function(w,T){return w.count?w[T]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(w[T]):"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(T){return T.instance===w.instance}).reduce(function(T,M){return Math.max(T,M.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(T){w===e.performanceMinutes&&(e.performance=T.data,e.performanceError=T.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 T=["B","KB","MB","GB","TB"],M=0,F=w;F>=1024&&M<T.length-1;)F/=1024,M++;return F.toFixed(M>0?1:0).replace(/\.0$/,"")+" "+T[M]}e.humanBytes=u;function p(w){if(!w)return"\u2014";var T=Math.floor(w/86400),M=Math.floor(w%86400/3600),F=Math.floor(w%3600/60);return T>0?T+"d "+(M<10?"0":"")+M+"h":M>0?M+"h "+(F<10?"0":"")+F+"m":F+"m"}e.humanDuration=p;function c(w){return w==null?"\u2014":w>=1e6?(w/1e6).toFixed(1)+"M":w>=1e3?(w/1e3).toFixed(1)+"K":String(w)}e.humanNum=c,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 T=e.data.repos.statusBreakdown||[],M=0;M<T.length;M++)if(T[M]._id===w)return T[M].count;return 0},e.barPct=function(w){var T=e.data&&e.data.repos?e.data.repos.total:0;if(!T)return 0;var M=[w];w==="expired"&&M.push("expiring"),w==="remov Line truncated
`)},Ma=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))),ac=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),fo,jn,Va,qa,zs=class{constructor(t,s,i){$e(this,jn);nt(this,"dots");nt(this,"dotStart");$e(this,fo);this.dots=t,this.dotStart=s,ze(this,fo,i)}state(){return new Ma(++re(this,fo).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(Oa.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!Fe(this,jn,Va).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,o);return;case"neg":if(!Fe(this,jn,Va).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;Fe(this,jn,qa).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:Fe(this,jn,qa).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 u of t.threads)switch(u.t){case"lit":$a(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)}};fo=new WeakMap,jn=new WeakSet,Va=function(t,s){let{seen:i}=re(this,fo);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},qa=function(t,s){let{has:i}=re(this,fo);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var hc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${hc(i.state)})`);return`${t}|${s.sort().join("|")}`},dv=1<<18,Ho,jo,Fn,mo,Un,Bn,zn,sn,_a,sr,gc,La=class{constructor(t,s){$e(this,sn);$e(this,Ho);$e(this,jo,new Map);$e(this,Fn,0);$e(this,mo);$e(this,Un);$e(this,Bn);$e(this,zn);ze(this,Ho,t),ze(this,Bn,new zs(!1,!1,s)),ze(this,zn,new zs(!1,!0,s))}start(t){if(t){if(re(this,Un))return re(this,Un);let i=re(this,zn).state();return re(this,zn).add(i,re(this,Ho),0,!0),ze(this,Un,Fe(this,sn,_a).call(this,re(this,zn).done(i)))}if(re(this,mo))return re(this,mo);let s=re(this,Bn).state();return re(this,Bn).add(s,re(this,Ho),0,!0),ze(this,mo,Fe(this,sn,sr).call(this,re(this,Bn).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===re(this,Un)?Fe(this,sn,sr).call(this,re(this,zn).step(t.state,s,0,!0)):Fe(this,sn,sr).call(this,re(this,Bn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),ze(this,Fn,re(this,Fn)+128)),t.ascii[i]=r):t.next.set(s,r),al(this,Fn)._++,r}};Ho=new WeakMap,jo=new WeakMap,Fn=new WeakMap,mo=new WeakMap,Un=new WeakMap,Bn=new WeakMap,zn=new WeakMap,sn=new WeakSet,_a=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},sr=function(t){let s=hc(t),i=re(this,jo).get(s);if(i)return i;re(this,Fn)>dv&&Fe(this,sn,gc).call(this);let o=Fe(this,sn,_a).call(this,t);return re(this,jo).set(s,o),ze(this,Fn,re(this,Fn)+(s.length+1)),o},gc=function(){re(this,jo).clear(),ze(this,Fn,0),ze(this,mo,void 0),ze(this,Un,void 0)};var uv=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},cv=(e,t,s,i)=>{let o=0,r=s,u=-1,p=0;for(;r<i;){let c=e[o];if(c?.t==="star"){u=o++,p=r;continue}let v=t[r];if(c&&(c.t==="any"||c.t==="lit"&&$a(c,v)||c.t==="class"&&c.re.test(v))){o++,r++;continue}if(u===-1)return!1;o=u+1,r=++p}for(;e[o]?.t==="star";)o++;return o===e.length},vc=e=>{let t=0,s=0;for(let i of e){let[o,r]=pv(i);t+=o,s+=r}return[t,s]},pv=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(vc),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]},lc=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!$a(e[i],t[s+i]))return!1;return!0},fv=/[/\ud800-\udfff]/,mv=/[\ud800-\udfff]/,or=e=>mv.test(e)?[...e]:e,dc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Hn,Go,ho,ir,go,js,rr,vo,Gs,Ws,Ks,An,wn,Wo,Ko,Ys,ar,on,yo,Bs,Hs=class{constructor(t,s={}){$e(this,yo);nt(this,"pattern");nt(this,"options");$e(this,Hn);$e(this,Go);$e(this,ho);$e(this,ir);$e(this,go);$e(this,js,!1);$e(this,rr);$e(this,vo);$e(this,Gs,!1);$e(this,Ws,0);$e(this,Ks,1/0);$e(this,An,[]);$e(this,wn,[]);$e(this,Wo);$e(this,Ko);$e(this,Ys,!1);$e(this,ar);$e(this,on);if(t.includes Line truncated
`).forEach((s,i)=>{let{term:o}=Xa(s.trim());if(!o)return;let r=[];for(let u=0;u<o.length;u++){if(o[u]==="\\"){u++;continue}Vc.has(o[u])&&!r.includes(o[u])&&r.push(o[u])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function Lc(e,t){let s=String(e||"").split(`
`),i=s[t];if(i===void 0)return e;let{term:o}=Xa(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+=Vc.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 Xn={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=g=>{if(g&&g.preventDefault&&g.preventDefault(),e.saving)return;let y=p.checkpoint(),m={terms:e.terms.split(`
`).map(b=>b.trim()).filter(b=>b.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",m).then(()=>{p.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",v&&i.cancel(v),v=i(()=>{e.message=null},2500)},b=>{e.saving=!1;let E=b&&b.data&&b.data.error,S="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+E),s("ERRORS.unknown_error")]).then(([N,w])=>{e.error=E&&N!==w?N:S},()=>{e.error=S})})},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."}))}},Hc=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)})}},jc=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 g=e.features.length,y=v==="first"?0:v==="last"?g-1:(c+v+g)%g;e.feature=e.features[y].key,o(()=>{let m=i.document.getElementById("feature-tab-"+e.feature);m&&m.focus()})},e.demoText=`# DeepLearnUtils
`)}function C(_){let z=[],I="",L=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,S=0,q;for(;q=L.exec(_);)I+=_.slice(S,q.index),S=L.lastIndex,z.push({key:q[1],op:q[2]||"=",val:q[3]});return I+=_.slice(S),{filters:z,free:I.trim().toLowerCase()}}function N(_,z){for(let I of z.filters){let L=(q,G,j)=>{let Y=parseFloat(q),ee=parseFloat(G);return j==="="?String(q)===String(G):j==="!="?String(q)!==String(G):j===">="?Y>=ee:j==="<="?Y<=ee:j===">"?Y>ee:j==="<"?Y<ee:!0},S;if(I.key==="code")S=_.displayMessage;else if(I.key==="module")S=_.module;else if(I.key==="status")S=_._status;else if(I.key==="url")S=_._url;else if(I.key==="repo")S=_._repoId;else if(I.key==="level")S=_.level;else continue;if(S==null||!L(S,I.val,I.op))return!1}return!(z.free&&((_.displayMessage||"")+" "+(_.module||"")+" "+(_._url||"")+" "+JSON.stringify(_.raw||[])).toLowerCase().indexOf(z.free)===-1)}function b(){let _=C(e.query.search||"");e.parsedFilterCount=_.filters.length;let z=e.query.bucket,I=e.entries.filter(j=>z&&j._bucket!==z?!1:N(j,_)),L=e.query.group;if(L){let j=x=>JSON.stringify(L==="module"?[x.module,x._bucket]:[x.raw?.[0]?.service||"unknown",x.module,x.displayMessage||x.message||"_",x._bucket,x._status]),Y=new Map;for(let x of I){let fe=j(x);if(Y.has(fe)){let he=Y.get(fe);he.count++,he._related.push(x),new Date(x.ts)>new Date(he.ts)&&(he.ts=x.ts,he._url=x._url,he._status=x._status),new Date(x.ts)<new Date(he._firstSeen)&&(he._firstSeen=x.ts)}else{let he=Object.assign({},x);he._key=`${L}:${fe}`,he._related=[x],he._firstSeen=x.ts,he._lastHourCount=0,he.count=1,Y.set(fe,he)}}let ee=Date.now()-3600*1e3;for(let x of Y.values())x._lastHourCount=x._related.filter(fe=>new Date(fe.ts).getTime()>=ee).length;I=Array.from(Y.values())}else I=I.map((j,Y)=>(j._key="row:"+Y+":"+j.ts,j._related=[j],j._firstSeen=j.ts,j._lastHourCount=0,j.count=1,j));let S=j=>({error:0,warn:1,info:2})[j._bucket]??1;e.query.sort==="count"?I.sort((j,Y)=>S(j)-S(Y)||Y.count-j.count||new Date(Y.ts)-new Date(j.ts)):I.sort((j,Y)=>S(j)-S(Y)||new Date(Y.ts)-new Date(j.ts)),e.visible=I;let q=!!(e.query.bucket||(e.query.search||"").trim()),G=!q&&(e.stats?.severity?.error||0)>0&&!I.some(j=>j._bucket==="error")&&e.entries.length<1500;(q&&!I.length||G)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,T(!0))}function T(_){if(_&&e.redisLoading)return;let z=++o;e.redisLoading=!0;let I=_?e.redisNextOffset||e.entries.length:0,L=_?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:I,limit:L}}).then(S=>{if(p||z!==o)return;e.redisLoading=!1;let q=(S.data.entries||[]).map(k);e.entries=_?e.entries.concat(q):q,e.redisRedacted=(_&&e.redisRedacted||0)+(S.data.redactedEntries||0),e.redisNextOffset=S.data.nextOffset??I+(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,b()},()=>{p||z!==o||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>T(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function O(_=!1){if(_&&u)return;let z=++r;u=!0,t.get("/api/admin/errors/stats").then(I=>{if(p||z!==r)return;u=!1;let L=I.data||{};e.redisStatsState=L.available===!1?"unavailable":"ready";let S=L.prev24h?Math.round((L.last24h-L.prev24h)/L.prev24h*100):0;e.stats={last24h:L.last24h||0,prev24h:L.prev24h||0,delta:S,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&&(u=!1,e.redisStatsState="unavailable")})}function F(_=!1){(!_||!e.redisLoading)&&T(),O(_)}e.barPx=(_,z)=>{let I=e.stats.buckets||[],L=0,S=0;for(let Y of I)L=Math.max(L,(Y.error||0)+(Y.warn||0)),S=Math.max(S,Y.info||0);let q=_[z]||0;if(!q)return 0;if(z==="info")return S?Math.max(2,Math.round(q/S*(L?16:60))):0;let G=(_.error||0)+(_.warn||0),j=Math.round(G/L*44);return Math.max(4,Math.round(q/G*j))},e.bucketTitle=_=>`${new Date(_.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${_.error||0} err \xB7 ${_.warn||0} warn \xB7 ${_.info||0} info`,e.toggle=async(_,z)=>{v=z||document.activeElement,h=e.captureErrorScroll(v),e.historySelected=_,e.historyView="overview",e.expanded={[_._key]:!0},await We(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=_=>{if(e.historyView="timeline",e.traceSelection)return;let z=["requestId","jobId"].find(I=>e.logTraceId(e.historySelected,I));z&&e.lookupTrace(z,e.logTraceId(e.historySelected,z),_,e.historySelected)},e.closeHistory=async()=>{let _=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await We(),(v?.isConnected?v:[...document.querySelectorAll("[data-history-key]")].find(I=>I.dataset.historyKey===_))?.focus({preventScroll:!0}),e.restoreErrorScroll(h)},e.setBucket=_ Line truncated
`)],{type:"text/csv;charset=utf-8"}),L=URL.createObjectURL(I),S=document.createElement("a");S.href=L,S.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(L)};function H(_){e.copyHint=`${_} copied`,c.timeout(()=>{e.copyHint=""},1500)}e.copyJson=_=>{navigator.clipboard.writeText(_._rawJson).then(()=>H("JSON"))},e.copyCurl=_=>{if(!_._url)return;let I=`curl -X ${_._method||"GET"} '${window.location.origin}${_._url}'`;navigator.clipboard.writeText(I).then(()=>H("curl"))},F();let oe=i(()=>{e.query.autoRefresh&&F(!0)},15e3);e.on("dispose",()=>{p=!0,o++,r++,i.cancel(oe)}),e.watch("query.search",b),e.watch("query.bucket",b),e.watch("query.sort",b),e.watch("query.group",b)},Zu=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(T){b===e.cacheMinutes&&(e.cacheReport=T.data,e.cacheError=T.data.available?null:T.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,T){var O=e.cacheRows(),F=function(_){return O.filter(function(z){return z.name===_}).reduce(function(z,I){return z+I[T]},0)},H=F(b+"_hit"),oe=F(b+"_miss");return H+oe?(100*H/(H+oe)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(b){return b.replaceAll("_"," ")},e.cacheP95=function(b){var T=0,O=e.cacheReport?.latencyBucketsMs||[];if(!b.count)return"No samples";if(!b.ms)return"Not timed";for(var F=0;F<=O.length;F++)if(T+=b["b"+F]||0,T>=Math.ceil(b.count*.95))return F<O.length?"\u2264 "+$n(O[F]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let b=e.data&&e.data.system||{},T=[["Memory",b.memPercent],["Disk",b.diskPercent]].filter(([,F])=>F>90);return T.length?T.map(([F,H])=>F+" is at "+H+"%").join(" and ")+". New anonymizations may fail until "+(T.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(b){return b==null?"":$n(b)},e.latencyBound=function(b,T){return b.count?b[T]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(b[T]):"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(T){return T.instance===b.instance}).reduce(function(T,O){return Math.max(T,O.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(T){b===e.performanceMinutes&&(e.performance=T.data,e.performanceError=T.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 u(b){if(b==null)return"\u2014";for(var T=["B","KB","MB","GB","TB"],O=0,F=b;F>=1024&&O<T.length-1;)F/=1024,O++;return F.toFixed(O>0?1:0).replace(/\.0$/,"")+" "+T[O]}e.humanBytes=u;function p(b){if(!b)return"\u2014";var T=Math.floor(b/86400),O=Math.floor(b%86400/3600),F=Math.floor(b%3600/60);return T>0?T+"d "+(O<10?"0":"")+O+"h":O>0?O+"h "+(F<10?"0":"")+F+"m":F+"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 T=e.data.repos.statusBreakdown||[],O=0;O<T.length;O++)if(T[O]._id===b)return T[O].count;return 0},e.barPct=function(b){var T=e.data&&e.data.repos?e.data.repos.total:0;if(!T)return 0;var O=[b];b==="expired"&&O.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=>(nr.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(T=>T[N]===!1)?"Incomplete":e.moneyText(b.reduce((T,O)=>r(T,O[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?$n(w*1e3):"\u2014";let u=0;e.loadSummary=()=>{let w=++u;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(C=>{if(w!==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=>{w===u&&(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=po({[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=tr(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 ")+tr(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
`)},_a=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}},gc=(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&&gc(i.state,s.state))),dc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),mo,jn,$a,Fa,Hs=class{constructor(t,s,i){$e(this,jn);nt(this,"dots");nt(this,"dotStart");$e(this,mo);this.dots=t,this.dotStart=s,ze(this,mo,i)}state(){return new _a(++re(this,mo).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(La.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!Fe(this,jn,$a).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,o);return;case"neg":if(!Fe(this,jn,$a).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;Fe(this,jn,Fa).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:Fe(this,jn,Fa).call(this,t,s)}}addRun(t,s,i,o){for(let r of t.runs)if(r.neg===s.neg&&gc(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":za(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)}};mo=new WeakMap,jn=new WeakSet,$a=function(t,s){let{seen:i}=re(this,mo);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},Fa=function(t,s){let{has:i}=re(this,mo);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("|")}`},dv=1<<18,jo,Go,Fn,ho,Un,Bn,zn,sn,Ba,ar,yc,Ua=class{constructor(t,s){$e(this,sn);$e(this,jo);$e(this,Go,new Map);$e(this,Fn,0);$e(this,ho);$e(this,Un);$e(this,Bn);$e(this,zn);ze(this,jo,t),ze(this,Bn,new Hs(!1,!1,s)),ze(this,zn,new Hs(!1,!0,s))}start(t){if(t){if(re(this,Un))return re(this,Un);let i=re(this,zn).state();return re(this,zn).add(i,re(this,jo),0,!0),ze(this,Un,Fe(this,sn,Ba).call(this,re(this,zn).done(i)))}if(re(this,ho))return re(this,ho);let s=re(this,Bn).state();return re(this,Bn).add(s,re(this,jo),0,!0),ze(this,ho,Fe(this,sn,ar).call(this,re(this,Bn).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===re(this,Un)?Fe(this,sn,ar).call(this,re(this,zn).step(t.state,s,0,!0)):Fe(this,sn,ar).call(this,re(this,Bn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),ze(this,Fn,re(this,Fn)+128)),t.ascii[i]=r):t.next.set(s,r),cl(this,Fn)._++,r}};jo=new WeakMap,Go=new WeakMap,Fn=new WeakMap,ho=new WeakMap,Un=new WeakMap,Bn=new WeakMap,zn=new WeakMap,sn=new WeakSet,Ba=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},ar=function(t){let s=vc(t),i=re(this,Go).get(s);if(i)return i;re(this,Fn)>dv&&Fe(this,sn,yc).call(this);let o=Fe(this,sn,Ba).call(this,t);return re(this,Go).set(s,o),ze(this,Fn,re(this,Fn)+(s.length+1)),o},yc=function(){re(this,Go).clear(),ze(this,Fn,0),ze(this,ho,void 0),ze(this,Un,void 0)};var uv=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},cv=(e,t,s,i)=>{let o=0,r=s,u=-1,p=0;for(;r<i;){let c=e[o];if(c?.t==="star"){u=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(u===-1)return!1;o=u+1,r=++p}for(;e[o]?.t==="star";)o++;return o===e.length},bc=e=>{let t=0,s=0;for(let i of e){let[o,r]=pv(i);t+=o,s+=r}return[t,s]},pv=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(bc),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]},uc=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!za(e[i],t[s+i]))return!1;return!0},fv=/[/\ud800-\udfff]/,mv=/[\ud800-\udfff]/,rr=e=>mv.test(e)?[...e]:e,cc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Hn,Wo,go,lr,vo,Gs,dr,yo,Ws,Ks,Ys,An,wn,Ko,Yo,Js,ur,on,bo,zs,js=class{constructor(t,s={}){$e(this,bo);nt(this,"pattern");nt(this,"options");$e(this,Hn);$e(this,Wo);$e(this,go);$e(this,lr);$e(this,vo);$e(this,Gs,!1);$e(this,dr);$e(this,yo);$e(this,Ws,!1);$e(this,Ks,0);$e(this,Ys,1/0);$e(this,An,[]);$e(this,wn,[]);$e(this,Ko);$e(this,Yo);$e(this,Js,!1);$e(this,ur);$e(this,on);if(t.includes Line truncated
`).forEach((s,i)=>{let{term:o}=el(s.trim());if(!o)return;let r=[];for(let u=0;u<o.length;u++){if(o[u]==="\\"){u++;continue}Lc.has(o[u])&&!r.includes(o[u])&&r.push(o[u])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function $c(e,t){let s=String(e||"").split(`
`),i=s[t];if(i===void 0)return e;let{term:o}=el(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+=Lc.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 Xn={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."}))}},Gc=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)})}},Wc=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
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(m=>m.trim()).filter(Boolean).sort((m,b)=>b.length-m.length),c=m=>m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let v=new RegExp("("+p.map(c).join("|")+")","gi"),g={},y=0;return(e.demoText||"").split(v).filter(m=>m!=="").map(m=>{let b=p.find(E=>E.toLowerCase()===m.toLowerCase());return b?(g[b.toLowerCase()]||(g[b.toLowerCase()]=++y),{text:String(g[b.toLowerCase()]),redacted:!0,original:m}):{text:m}})},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 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 S=1;S<p.length;S++)v[S-1]=p[S]-p[S-1];let g=v.length,y=Math.max.apply(null,v),m=Math.min.apply(null,v),b=Math.min(0,m),E=y-b||1;c.viewW=g*2,c.bars=new Array(g);for(let S=0;S<g;S++){let N=(v[S]-b)/E,w=Math.max(1.5,N*34);c.bars[S]={x:(S*2+.25).toFixed(2),y:(36-w).toFixed(2),w:"1.5",h:w.toFixed(2)}}if(c.deltaToday=v[g-1],g>=2){let S=v[g-2];S&&(c.pctChange=(c.deltaToday-S)/S*100)}return c.pctAbs=Math.round(Math.abs(c.pctChange)),c.isUp=c.pctChange>=0,c}e.history={repositories:u([]),users:u([]),pageViews:u([]),pullRequests:u([])},t.get("/api/stat/history?days=60").then(p=>{let c=p.data||[];e.history={repositories:u(c.map(v=>v.nbRepositories||0)),users:u(c.map(v=>v.nbUsers||0)),pageViews:u(c.map(v=>v.nbPageViews||0)),pullRequests:u(c.map(v=>v.nbPullRequests||0))}}).catch(()=>{})},Gc=function(e,t,s,i,o,r){let u=bt();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())},Bt()(document,"click",k=>{e.quotaExpanded&&!k.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=k=>k.status==="error"||k._broken||c(k.status)==="progress"&&k._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=k=>{e.projectView=k,k==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=k=>{let q=Ca(k?.anonymizeDate||k?.lastView)||"";return/ ago$/.test(q)?"No activity for "+q.replace(/ ago$/,""):"No activity since "+q.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=k=>"project-details-"+encodeURIComponent(k._type+":"+(k._id||k._source||"unknown")),e.showProjectDetails=async k=>{e.selectedProject=k,e.projectName=k.projectName||"",e.nameError="",e.nameMessage="",await We();let q=document.getElementById(e.projectDetailsId(k));q?.focus(),q?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=k=>{e.selectedProject=null,We(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(k._type+":"+k._id)}"]`)?.focus())},e.saveProjectName=async k=>{if(e.nameSaving||!k._id)return;let q=e.projectName.trim();if(q.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let G=await t.post("/api/user/project-name",{type:k._type,id:k._id,name:q});k.projectName=G.data.name,k._label=k.projectName||k._fallbackLabel,e.selectedProject===k&&(e.nameMessage=q?"Project name saved.":"Default project name restored."),T||(e.dashboardCursor=null,await F(),e.selectedProject===k&&(e.selectedProject=e.items.find(H=>H._type===k._type&&H._id===k._id)||null))}catch{e.selectedProject===k&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async k=>{if(!k._viewUrl||e.copyingId)return;let q=new URL(k._viewUrl,o.location.origin).href;e.copyingId=k._type+":"+k._id;try{await Qa(q),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:q})}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):_(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),C&&C()})}function Ee(C,O,B){e.anonymize&&e.anonymize[C]&&e.anonymize[C].setValidity(O,B)}function tt(C){try{let O=parseGithubUrl(C);if(O&&O.owner&&O.repo)return O.owner+"/"+O.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 C=m();try{let O=await t.get("/github/connections");if(e.githubConnections=O.data,!O.data.appEnabled)return;let B=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":O.data.csrf}});if(!y(C))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(C)&&(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,b(C)}},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 Ne(){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 C=new URLSearchParams(window.location.search).get("billingDraft");if(C){N.restore();try{let B=(await t.get("/api/billing/draft/"+encodeURIComponent(C))).data;if(B.path!==o.path())throw new Error("Wrong task");w=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)),T=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 O;try{O=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!O||O.path!==o.path()||Date.now()-O.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(O.draft,B)&&(e[B]=O.draft[B]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await qe(),sessionStorage.removeItem("github-access-draft"),!0}Qe(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&u(X,0),i.repoId&&i.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=i.repoId,t.get("/api/repo/"+e.repoId).then(async C=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(C.data.status),e.githubConnection=C.data.connection||"oauth",e.sourceUrl="https://github.com/"+C.data.source.fullName,e._originalFullName=C.data.source.fullName,e.terms=C.data.options.terms.filter(O=>O).join(`
`),e.source=C.data.source,e.role=C.data.role||"owner",e._existingNever=C.data.options.expirationMode==="never",e._savedExpirationDate=C.data.options.expirationDate?new Date(C.data.options.expirationDate):null,e.coauthors=C.data.coauthors||[],e._originalBranch=C.data.source.branch,e.options=Object.assign({},e.options,C.data.options),e.conference=C.data.conference,e._originalConference=C.data.conference,e.repositoryID=C.data.source.repositoryID,e._originalRepositoryID=C.data.source.repositoryID,C.data.options.expirationDate&&(e.options.expirationDate=new Date(C.data.options.expirationDate)),E=S(parseGithubUrl(e.sourceUrl)),!await X()&&(await Promise.all([ce(),ue()]),So())},()=>{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 C=>{if(e.githubConnection=C.data.connection||"oauth",e.sourceUrl="https://github.com/"+C.data.source.repositoryFullName+"/pull/"+C.data.source.pullRequestId,e.terms=C.data.options.terms.filter(O=>O).join(`
`),e.source=C.data.source,e.options=Object.assign({},e.options,C.data.options),e.conference=C.data.conference,e._originalConference=C.data.conference,C.data.options.expirationDate&&(e.options.expirationDate=new Date(C.data.options.expirationDate)),E=S(parseGithubUrl(e.sourceUrl)),!await X())try{await ol()}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 C=>{e.sourceUrl="https://gist.github.com/"+C.data.source.gistId,e.terms=C.data.options.terms.filter(O=>O).join(`
`),e.source=C.data.source,e.options=Object.assign({},e.options,C.data.options),e.conference=C.data.conference,e._originalConference=C.data.conference,C.data.options.expirationDate&&(e.options.expirationDate=new Date(C.data.options.expirationDate)),E=S(parseGithubUrl(e.sourceUrl)),!await X()&&await sl()},()=>{o.url("/404")}))}),t.get("/github/connections").then(C=>{e.githubConnections=C.data,!i.repoId&&!i.pullRequestId&&!i.gistId&&e.githubConnection===void 0&&C.data.appEnabled&&C.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(C=!1)=>{let O=++c;e.previousConfigurations=[],e.previousConfigurationId="";let B;try{B=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,fe(),Jt.cancel(),Mn.cancel(),Vn.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",Ee("sourceUrl","github",!1);return}let K=S(B),ae=C||E===K;E=K,e.sourceUrlError="",Ee("sourceUrl","github",!0),fe();let ye=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),ye&&u(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!ae&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],ae||(e.source={type:"GitHubStream",branch:"",commit:""}),Jt.cancel(),Mn.cancel(),Vn.cancel(),Eo.clear(),No.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",rf(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=ae;try{B.gistId&&!B.repo?(e.detectedType="gist",e.source={gistId:B.gistId},await sl()):B.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:B.owner+"/"+B.repo,pullRequestId:B.pullRequestId},await ol()):(e.detectedType="repo",Y(),await Promise.all([ce(),ue()]),So())}catch{}finally{O===c&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let C=e.branches.filter(B=>B.name==e.source.branch)[0];if(!C)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=C.commit),e.readme=C.readme,await ue(),So()}),e.getBranches=async C=>{let O=parseGithubUrl(e.sourceUrl),B=m();try{if(!e.details){await ce(C);return}let K=await t.get(`/api/repo/${O.owner}/${O.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:C===!0||e.reconnectingSource?"1":"0",repositoryID:Ne()}});if(!y(B))return;e.branches=K.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let ae=e.branches.filter(ye=>ye.name==e.source.branch);ae.length>0&&(!(!e.reconnectingSource&&!C&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=ae[0].commit),e.readme=ae[0].readme,await ue(C))}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{b(B)}};async function ce(C=!1){let O=parseGithubUrl(e.sourceUrl),B=m();try{Ro(),fe();let K=await t.get(`/api/repo/${O.owner}/${O.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:Ne(),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(C||e.reconnectingSource)}catch(K){if(!y(B))return;throw x(K),K}finally{b(B)}}async function ue(C){if(e.readme&&!C)return e.readme;let O=parseGithubUrl(e.sourceUrl),B=m();try{let K=await t.get(`/api/repo/${O.owner}/${O.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:C===!0?"1":"0",branch:e.source.branch,repositoryID:Ne()}});y(B,!0)&&(e.readme=K.data)}catch{y(B,!0)&&(e.readme="")}finally{b(B)}}let me={magicalBraces:!0},be=C=>C.startsWith("/")&&!C.endsWith("/")&&Gn(bo(C.slice(1),me),me)===C.slice(1),Ve=()=>Object.keys(e.preserve.picked).filter(C=>e.preserve.picked[C]).sort().map(C=>"/"+Gn(C,me)),D=C=>"/"+Gn(C,me)+"/**",A=C=>"!/"+Gn(C,me)+"/",U=()=>String(e.preserve.patterns||"").split(`
`).map(C=>C.trim()).filter(Boolean),J=null,W=null,te=new Set,le=0,se=null,ie=()=>!1;function ne(){let C=le+"\0"+e.preserve.patterns;if(C!==se){se=C;try{ie=Ja(Ya([...Ve(),...U()]))}catch{ie=()=>!1}}return ie}function we(C){let O=new Map([["",{dirs:[],files:[]}]]);for(let B of C){let K=B.split("/"),ae="";for(let ye=0;ye<K.length-1;ye++){let je=K.slice(0,ye+1).join("/");O.has(je)||(O.set(je,{dirs:[],files:[]}),O.get(ae).dirs.push(je)),ae=je}O.get(ae).files.push(B)}for(let B of O.values())B.dirs.sort();return{files:C,dirs:O,descendants:new Map}}function pe(C){return J.descendants.has(C)||J.descendants.set(C,J.files.filter(O=>O.startsWith(C+"/"))),J.descendants.get(C)}let Se=C=>ne()(C);function Te(C){let O=pe(C),B=0;for(let K of O)Se(K)&&B++;return B===0?"none":B===O.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let C=(e.options?.preserveFiles||[]).map(O=>String(O).trim()).filter(Boolean).map(O=>be(O)?bo(O.slice(1),me):O);return C.length?C.slice(0,2).join(", ")+(C.length>2?` and ${C.length-2} more`:""):"None. Every file is redacted."};async function Le(){let C=e.source?.commit;if(!(J&&e.preserve.commit===C)){e.preserve.loading=!0,e.preserve.error="",J=null,W=null;try{let O=parseGithubUrl(e.sourceUrl),B=await t.get(`/api/repo/${O.owner}/${O.repo}/tree`,{params:{commit:C,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ne()}});if(e.source?.commit!==C)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,te=fn(new Set(K)),e.preserve.commit=C,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",C=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&C&&e.sourceUrl&&Le().catch(()=>{})}),e.openPreserveFiles=()=>{let C={},O=[];for(let K of e.options?.preserveFiles||[]){let ae=String(K).trim();ae&&(!O.length&&be(ae)?C[bo(ae.slice(1),me)]=!0:O.push(ae))}let B={};for(let K of Object.keys(C)){let ae=K.split("/");for(let ye=1;ye<ae.length;ye++)B[ae.slice(0,ye).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:C,expanded:B,patterns:O.join(`
`),patternsOpen:O.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),le++,u(()=>{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=Ya([...Ve(),...U()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!J)return[];let C=ne(),O=(ye,je,It)=>{let ft=!!e.preserve.picked[ye],Rt=C(ye);return{kind:"file",path:ye,label:It,depth:je,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=>O(ye,0,ye));let K=[],ae=(ye,je)=>{let It=J.dirs.get(ye);for(let ft of It.dirs){let Rt=!!e.preserve.expanded[ft],Ht=U().includes(D(ft));K.push({kind:"dir",path:ft,label:ft.slice(ye?ye.length+1:0)+"/",depth:je,open:Rt,state:Te(ft),locked:!1,note:Ht?"whole folder":""}),Rt&&ae(ft,je+1)}for(let ft of It.files)K.push(O(ft,je,ft.slice(ye?ye.length+1:0)))};return ae("",0),K},e.preserveCount=()=>J?J.files.filter(Se).length:0,e.togglePreserveDir=C=>{e.preserve.expanded[C]=!e.preserve.expanded[C]},e.togglePreserveFile=C=>{e.preserve.picked[C]=!e.preserve.picked[C],le++},e.togglePreserveFolder=C=>{let O=D(C),B=A(C),K=U().filter(ye=>ye!==O&&ye!==B),ae=Te(C)==="all"||U().includes(O);for(let ye of pe(C))e.preserve.picked[ye]=!1;le++,e.preserve.patterns=(ae?K:[...K,O]).join(`
`),ae&&pe(C).some(Se)&&(e.preserve.patterns=[...K,B].join(`
`))};let Je=/^readme(\.[^/]*)?$/i,Ge=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],Ce=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],_e=C=>{let O=Be(C),B=O.indexOf("."),K=Ge.indexOf(B===-1?"":O.slice(B).toLowerCase());return K===-1?Ge.length:K},it=()=>!!J&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!it())return"";for(let C of[".github","","docs"]){let O=(J.dirs.get(C)?.files||[]).filter(B=>Je.test(Be(B)));if(O.length)return O.sort((B,K)=>_e(B)-_e(K)||he(B,K))[0]}return""},e.readmeName=()=>Be(e.readmePath())||"README.md";let dt={key:null,fn:()=>!1},Tt=()=>{let C=(e.options?.preserveFiles||[]).map(B=>String(B).trim()).filter(Boolean),O=C.join(`
`);if(O!==dt.key){let B=()=>!1;try{C.length&&(B=Ja(C))}catch{}dt={key:O,fn:B}}return dt.fn};e.pathPreserved=C=>!!C&&Tt()(C),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let C=Tt();if(it()){let O=e.readmePath();return!!O&&C(O)}return Ce.some(O=>C(O))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function wt(){let C={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&&(C.branchName=e.source.branch);try{let O=parseGithubUrl(e.sourceUrl);C.repoName=`${O.owner}/${O.repo}`}catch{}return C}function rt(C,O,B){let K=null,ae=0,ye=()=>{if(e.detectedType!==C)return;K&&u.cancel(K);let je=++ae;e.previewStatus="loading",K=u(()=>{K=null;let It=O();if(!It){e.previewStatus="idle";return}t.post("/api/anonymize-preview",It).then(ft=>{je===ae&&(B(ft.data,It),e.previewStatus="ready")}).catch(()=>{je===ae&&(e.previewStatus="error")})},200)};return ye.cancel=()=>{ae++,K&&u.cancel(K),K=null},e.on("dispose",ye.cancel),ye}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof an!="string"?tl(e.previewFile):Jt()),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()};let Ie=fn(_s(e));Object.defineProperty(e,"previewViewer",{get:()=>Ie}),wa(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=C=>C===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=C=>te.has(C)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(C),ko=(C="")=>({path:C,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=ko();let es=0,an=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=C=>{if(C=C||"",C&&C===e.readmePath()&&(C=""),es++,an=null,ni(),Jt.cancel(),e.previewFile=C,e.previewDoc=ko(C),Ie.sidebarCollapsed=!0,Ie.content=null,!C){e.readme?Jt():e.previewStatus="idle";return}if(rn(C)){gr("binary"),e.previewStatus="ready";return}tl(C)};function rf(){es++,an=null,e.previewFile="",e.previewDoc=ko(),Ie.sidebarCollapsed=!0,Ie.content=null}function tl(C){let O=++es;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:C,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ne()},transformResponse:K=>K}).then(K=>{if(O!==es)return;e.previewDoc.loading=!1;let ae=typeof K.headers=="function"&&K.headers("content-type")||"";if(/json/i.test(ae)){let ye=null;try{ye=JSON.parse(K.data)}catch{}if(ye&&ye.binary===!0){gr("binary"),e.previewStatus="ready";return}}an=typeof K.data=="string"?K.data:"",Jt()},K=>{if(O!==es)return;e.previewDoc.loading=!1;let ae=pr(K);if(ae==="file_too_big"){gr("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=Xn.ERRORS[ae]||"GitHub did not return this file.",e.previewStatus="error"})}let ti;function ni(){ti&&window.URL.revokeObjectURL(ti),ti=void 0,Ie.url=void 0}e.on("dispose",ni);function gr(C){ni(),e.previewDoc.note=C,Ie.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),Ie.type=C==="too_big"?"error":"binary",Ie.content=C==="too_big"?"file_too_big":"binary"}function af(C){try{let O=parseGithubUrl(e.sourceUrl),B=e.source.branch||e.details&&e.details.defaultBranch||"main",K=C&&C.includes("/")?C.slice(0,C.lastIndexOf("/")+1):"";return`https://github.com/${O.owner}/${O.repo}/raw/${B}/${K}`}catch{return""}}let nl=rt("repo",()=>e.previewFile?typeof an!="string"?null:{content:an,options:wt()}:e.readme?{content:e.readme,options:wt()}:null,C=>{if(typeof C?.content!="string")throw Error("Invalid preview response");ni(),window.URL?.createObjectURL&&(Ie.url=ti=window.URL.createObjectURL(new Blob([C.content],{type:"text/plain"})));let O=e.previewOpenPath()||e.readmeName();Ie.prepareFile(e.previewPathName(O)),Ie.fileBaseUrl=af(O),Ie.renderFileContent(C.content,Ie.type,Ie.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=C.content)}),Jt=()=>{e.previewFile&&typeof an!="string"||nl()};Jt.cancel=nl.cancel;let Co=at(new Map),vr=new Set,yr=new Set,ts="",ns=null,oi=()=>String(e.terms||"").split(`
`).filter(C=>C.trim());function lf(){ns=null;let C=oi(),O=C.join(`
`);O!==ts&&(Co.clear(),yr.clear(),ts=O);let B=[...vr].filter(K=>!Co.has(K));if(vr.clear(),!(!B.length||!C.length))for(let K=0;K<B.length;K+=400){let ae=B.slice(K,K+400);t.post("/api/anonymize-preview",{contents:ae,options:{terms:C,image:!0,link:!0}}).then(ye=>{if(ts!==O||oi().join(`
`)!==O)return;let je=ye.data?.contents;if(!Array.isArray(je)||je.length!==ae.length)throw Error("Invalid preview response");ae.forEach((It,ft)=>Co.set(It,typeof je[ft]=="string"?je[ft]:It))}).catch(()=>{ts===O&&ae.forEach(ye=>yr.add(ye))})}}e.previewName=C=>{if(!C||!oi().length)return C;if(ts===oi().join(`
`)){if(Co.has(C))return Co.get(C);if(yr.has(C))return C}return vr.add(C),ns||(ns=u(lf,120)),C},e.previewPathName=C=>{C=String(C||"");let O=C.lastIndexOf("/");return O<0?e.previewName(C):e.previewName(C.slice(0,O))+"/"+e.previewName(C.slice(O+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(C=>[e.previewName(C),!0]))},!0),e.on("dispose",()=>{ns&&u.cancel(ns)});function So(){!e.anonymize||!e.anonymize.terms||Jt()}async function ol(){let C=parseGithubUrl(e.sourceUrl),O=m();try{Ro(),fe();let B=await t.get(`/api/pr/${C.owner}/${C.repo}/${C.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(O))return;e.details=B.data,e.pullRequestId||(e.pullRequestId=C.repo+"-PR"+C.pullRequestId+"-"+generateRandomId(4))}catch(B){if(!y(O))return;throw x(B),B}finally{b(O)}}let Eo=at(new Map);function df(){let C=new Set,O=e.details&&e.details.pullRequest;if(!O)return C;typeof O.title=="string"&&C.add(O.title),typeof O.body=="string"&&C.add(O.body),typeof O.diff=="string"&&C.add(O.diff);let B=O.comments||[];for(let K of B)typeof K.author=="string"&&C.add(K.author),typeof K.body=="string"&&C.add(K.body);return C}let Mn=rt("pr",()=>{let C=df(),O=Array.from(C);return O.length===0?null:{contents:O,options:wt()}},(C,O)=>{if(!Array.isArray(C?.contents)||C.contents.length!==O.contents.length||C.contents.some(ae=>typeof ae!="string"))throw Error("Invalid preview response");let B=O.contents,K=new Map;for(let ae=0;ae<B.length&&ae<C.contents.length;ae++)K.set(B[ae],C.contents[ae]);Eo.clear(),K.forEach((ae,ye)=>Eo.set(ye,ae))});e.anonymizePrContent=function(C){return C&&(Eo.has(C)?Eo.get(C):"")};async function sl(){let C=parseGithubUrl(e.sourceUrl),O=m();try{Ro(),fe(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let B=await t.get(`/api/gist/source/${C.gistId}`);if(!y(O))return;e.details=B.data,e.gistId||(e.gistId="gist-"+C.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(B){if(!y(O))return;if(B.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,Ee("sourceUrl","missing",!1);return}if(B.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,Ee("sourceUrl","missing",!1);return}throw x(B),B}finally{b(O)}}let No=at(new Map);function uf(){let C=new Set,O=e.details&&e.details.gist;if(!O)return C;typeof O.description=="string"&&C.add(O.description),typeof O.ownerLogin=="string"&&C.add(O.ownerLogin);let B=O.files||[];for(let ae of B)typeof ae.filename=="string"&&C.add(ae.filename),typeof ae.content=="string"&&C.add(ae.content);let K=O.comments||[];for(let ae of K)typeof ae.author=="string"&&C.add(ae.author),typeof ae.body=="string"&&C.add(ae.body);return C}let Vn=rt("gist",()=>{let C=uf(),O=Array.from(C);return O.length===0?null:{contents:O,options:wt()}},(C,O)=>{if(!Array.isArray(C?.contents)||C.contents.length!==O.contents.length||C.contents.some(ae=>typeof ae!="string"))throw Error("Invalid preview response");let B=O.contents,K=new Map;for(let ae=0;ae<B.length&&ae<C.contents.length;ae++)K.set(B[ae],C.contents[ae]);No.clear(),K.forEach((ae,ye)=>No.set(ye,ae)),br()});e.anonymizeGistContent=function(C){return C&&(No.has(C)?No.get(C):"")},e.previewGistFiles=[];function br(){let C=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=C.map(O=>({filename:e.anonymizeGistContent(O.filename),content:e.anonymizeGistContent(O.content),language:O.language}))}e.watch("details.gist.files",br,!0),e.watch("terms",br);function cf(){let C=e.conference;if(e.conference_data=null,!C)return;let O=C===w||e.isUpdate&&C===e._originalConference;C!==w&&(w=null),t.get("/api/conferences/"+C).then(B=>{e.conference===C&&(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),!O&&(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===C&&(e.conference_data=null)})}function Ro(){Ee("repoId","used",!0),Ee("repoId","format",!0),Ee("pullRequestId","used",!0),Ee("pullRequestId","format",!0),Ee("gistId","used",!0),Ee("gistId","format",!0),Ee("sourceUrl","used",!0),Ee("sourceUrl","missing",!0),Ee("sourceUrl","access",!0),Ee("sourceUrl","github",!0),Ee("commit","exists",!0),Ee("conference","activated",!0),Ee("terms","format",!0),e.termHints=[]}function si(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let C=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||C&&C.invalid?(C&&C.setDirty&&C.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),Ro();let ae=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(ae,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},ye=>{if(ye.data){let je=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(ye.data.error);je||r("ERRORS."+ye.data.error).then(It=>{e.error=It},console.error),ii(ye.data.error),je&&(ye.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(()=>{O.disabled=!1})},e.anonymizeGist=C=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(si())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let O=C.currentTarget||C.target.closest?.("button")||C.target;O.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};Ro();let ae=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(ae,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},ye=>{ye.data&&(r("ERRORS."+ye.data.error).then(je=>{e.error=je},console.error),ii(ye.data.error))}).finally(()=>{O.disabled=!1})},e.anonymizePullRequest=C=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(si())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let O=C.currentTarget||C.target.closest?.("button")||C.target;O.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};Ro();let ae=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(ae,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},ye=>{ye.data&&(r("ERRORS."+ye.data.error).then(je=>{e.error=je},console.error),ii(ye.data.error))}).finally(()=>{O.disabled=!1})},e.watch("conference",()=>{cf()}),e.termHints=[],e.matchTermAsWritten=C=>{e.terms=Lc(e.terms,C)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&Jt()}),e.watch("terms",()=>{e.termHints=qc(e.terms),e.detectedType==="repo"&&So(),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()}),e.watch("options.image",()=>{e.detectedType==="repo"&&So(),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()}),e.watch("options.link",()=>{e.detectedType==="repo"&&So(),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()}),e.watch("details",()=>{e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()},!0)},Za=function(e,t,s,i,o,r){wa(e);let u=bt();$c();let p=Bt(),c=0,v=null,g=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){v&&(v.resolve(),v=null),g&&(u.timeout.cancel(g),g=null)}let m=!1;e.on("dispose",()=>{m=!0,c++,y(),b&&b.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",I=>{e.symbolsOpen&&!I.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!I.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!I.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&I.target.isConnected&&!I.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!I.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!I.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",I=>{I.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(I.ctrlKey||I.metaKey)&&!I.altKey&&I.key&&I.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(I.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(I){if((I.metaKey||I.ctrlKey)&&I.key==="k"){I.preventDefault();var L=document.querySelector(".tree-search-input");L&&(L.focus(),L.select())}});var b=null;e.onFileSearchChange=function(){b&&(b.resolve(),b=null);let I=e.fileSearchQuery;if(!I||I.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let L=r.defer();b=L,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(I)}`,{timeout:L.promise}).then(function(k){if(!(m||b!==L)){b=null,e.fileSearchLoading=!1;var q={};e.files.forEach(function(qe){q[(qe.path||"")+"/"+qe.name]=!0});for(var G=[],H={},Y=0;Y<k.data.length;Y++){var ee=k.data[Y];if(ee.path)for(var x=ee.path.split("/"),fe="",he=0;he<x.length;he++){var Be=fe;fe=fe?fe+"/"+x[he]:x[he];var He=Be+"/"+x[he];!q[He]&&!H[He]&&(H[He]=!0,G.push({name:x[he],path:Be}))}}G.sort(function(qe,X){return(qe.path||"").split("/").length-(X.path||"").split("/").length}),G.length>0&&e.files.push.apply(e.files,G);for(var Qe=[],Ee=0;Ee<k.data.length;Ee++){var tt=k.data[Ee],Ne=(tt.path||"")+"/"+tt.name;!q[Ne]&&tt.size!=null&&(Qe.push(tt),q[Ne]=!0)}Qe.length>0&&e.files.push.apply(e.files,Qe),e.fileSearchResults=k.data}},function(){!m&&b===L&&(b=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(I,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(k=>k&&k.trim().length>0),_();for(let k=0;k<e.paths.length-1;k++){let q=k>0?e.paths.slice(0,k).join("/"):"";e.files.some(H=>H.path===q)||e.getFiles(q)}}});function E(){if(e.paths[0]!="")return;let I=["readme.md","readme.txt","readme.org","readme.1st","readme"],L={};for(let q of e.files)q.name.toLowerCase().indexOf("readme")>-1&&(L[q.name.toLowerCase()]=q.name);let k=null;for(let q of I)if(L[q]){k=q;break}if(!k&&Object.keys(L).length>0&&(k=Object.keys(L)[0]),k){let q=s.url();q[q.length-1]!="/"&&(q+="/"),s.url(q+encodePathForUrl(L[k]))}}e.fileCounts=null;let S=0,N=new Set,w=!1;e.getFiles=function(I,L=!1){let k=e.repoId,q=S;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(I)}&v=${e.options.lastUpdateDate}`).then(function(G){if(m||k!==e.repoId||q!==S)return[];let H=I||"";return e.files=e.files.filter(Y=>Y.path!==H),e.files.push(...G.data),e.loadedFolders={...e.loadedFolders,[H]:!0},T(H,q),G.data},function(G){if(m||k!==e.repoId||q!==S)return[];L||(e.type="error",e.content=pr(G),e.files=[])})};function T(I,L){if(w||N.has(I))return;N.add(I);let k=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(I)}`).then(function(q){m||k!==e.repoId||L!==S||(e.fileCounts={...e.fileCounts,...q.data})},function(){m||k!= 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(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 u(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:u([]),users:u([]),pageViews:u([]),pullRequests:u([])},t.get("/api/stat/history?days=60").then(p=>{let c=p.data||[];e.history={repositories:u(c.map(v=>v.nbRepositories||0)),users:u(c.map(v=>v.nbUsers||0)),pageViews:u(c.map(v=>v.nbPageViews||0)),pullRequests:u(c.map(v=>v.nbPullRequests||0))}}).catch(()=>{})},Kc=function(e,t,s,i,o,r){let u=bt();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())},Bt()(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||c(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 q=Na(S?.anonymizeDate||S?.lastView)||"";return/ ago$/.test(q)?"No activity for "+q.replace(/ ago$/,""):"No activity since "+q.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 q=document.getElementById(e.projectDetailsId(S));q?.focus(),q?.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 q=e.projectName.trim();if(q.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let G=await t.post("/api/user/project-name",{type:S._type,id:S._id,name:q});S.projectName=G.data.name,S._label=S.projectName||S._fallbackLabel,e.selectedProject===S&&(e.nameMessage=q?"Project name saved.":"Default project name restored."),T||(e.dashboardCursor=null,await F(),e.selectedProject===S&&(e.selectedProject=e.items.find(j=>j._type===S._type&&j._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 q=new URL(S._viewUrl,o.location.origin).href;e.copyingId=S._type+":"+S._id;try{await tl(q),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:q})}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):_(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),E&&E()})}function Ee(E,M,B){e.anonymize&&e.anonymize[E]&&e.anonymize[E].setValidity(M,B)}function tt(E){try{let M=parseGithubUrl(E);if(M&&M.owner&&M.repo)return M.owner+"/"+M.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=g();try{let M=await t.get("/github/connections");if(e.githubConnections=M.data,!M.data.appEnabled)return;let B=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":M.data.csrf}});if(!y(E))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(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 ce()}catch{}}};function Ne(){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 E=new URLSearchParams(window.location.search).get("billingDraft");if(E){N.restore();try{let B=(await t.get("/api/billing/draft/"+encodeURIComponent(E))).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)),T=B.id,O=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 M;try{M=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!M||M.path!==o.path()||Date.now()-M.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(M.draft,B)&&(e[B]=M.draft[B]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await qe(),sessionStorage.removeItem("github-access-draft"),!0}Qe(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&u(X,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(M=>M).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)),w=C(parseGithubUrl(e.sourceUrl)),!await X()&&(await Promise.all([ce(),ue()]),Eo())},()=>{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(M=>M).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)),w=C(parseGithubUrl(e.sourceUrl)),!await X())try{await al()}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(M=>M).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)),w=C(parseGithubUrl(e.sourceUrl)),!await X()&&await ll()},()=>{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&&qe())}).catch(()=>{}).finally(()=>{!v&&!i.repoId&&!i.pullRequestId&&!i.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(E=!1)=>{let M=++c;e.previousConfigurations=[],e.previousConfigurationId="";let B;try{B=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,fe(),Jt.cancel(),Mn.cancel(),Vn.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",Ee("sourceUrl","github",!1);return}let K=C(B),ae=E||w===K;w=K,e.sourceUrlError="",Ee("sourceUrl","github",!0),fe();let ye=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),ye&&u(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!ae&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],ae||(e.source={type:"GitHubStream",branch:"",commit:""}),Jt.cancel(),Mn.cancel(),Vn.cancel(),No.clear(),Ro.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",lf(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=ae;try{B.gistId&&!B.repo?(e.detectedType="gist",e.source={gistId:B.gistId},await ll()):B.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:B.owner+"/"+B.repo,pullRequestId:B.pullRequestId},await al()):(e.detectedType="repo",Y(),await Promise.all([ce(),ue()]),Eo())}catch{}finally{M===c&&(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(B=>B.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(),Eo()}),e.getBranches=async E=>{let M=parseGithubUrl(e.sourceUrl),B=g();try{if(!e.details){await ce(E);return}let K=await t.get(`/api/repo/${M.owner}/${M.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:Ne()}});if(!y(B))return;e.branches=K.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let ae=e.branches.filter(ye=>ye.name==e.source.branch);ae.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=ae[0].commit),e.readme=ae[0].readme,await ue(E))}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(E=!1){let M=parseGithubUrl(e.sourceUrl),B=g();try{To(),fe();let K=await t.get(`/api/repo/${M.owner}/${M.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:Ne(),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(E||e.reconnectingSource)}catch(K){if(!y(B))return;throw x(K),K}finally{k(B)}}async function ue(E){if(e.readme&&!E)return e.readme;let M=parseGithubUrl(e.sourceUrl),B=g();try{let K=await t.get(`/api/repo/${M.owner}/${M.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:Ne()}});y(B,!0)&&(e.readme=K.data)}catch{y(B,!0)&&(e.readme="")}finally{k(B)}}let me={magicalBraces:!0},be=E=>E.startsWith("/")&&!E.endsWith("/")&&Gn(wo(E.slice(1),me),me)===E.slice(1),Ve=()=>Object.keys(e.preserve.picked).filter(E=>e.preserve.picked[E]).sort().map(E=>"/"+Gn(E,me)),D=E=>"/"+Gn(E,me)+"/**",A=E=>"!/"+Gn(E,me)+"/",U=()=>String(e.preserve.patterns||"").split(`
`).map(E=>E.trim()).filter(Boolean),J=null,W=null,te=new Set,le=0,se=null,ie=()=>!1;function ne(){let E=le+"\0"+e.preserve.patterns;if(E!==se){se=E;try{ie=xa(Za([...Ve(),...U()]))}catch{ie=()=>!1}}return ie}function we(E){let M=new Map([["",{dirs:[],files:[]}]]);for(let B of E){let K=B.split("/"),ae="";for(let ye=0;ye<K.length-1;ye++){let je=K.slice(0,ye+1).join("/");M.has(je)||(M.set(je,{dirs:[],files:[]}),M.get(ae).dirs.push(je)),ae=je}M.get(ae).files.push(B)}for(let B of M.values())B.dirs.sort();return{files:E,dirs:M,descendants:new Map}}function pe(E){return J.descendants.has(E)||J.descendants.set(E,J.files.filter(M=>M.startsWith(E+"/"))),J.descendants.get(E)}let Se=E=>ne()(E);function Te(E){let M=pe(E),B=0;for(let K of M)Se(K)&&B++;return B===0?"none":B===M.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(M=>String(M).trim()).filter(Boolean).map(M=>be(M)?wo(M.slice(1),me):M);return E.length?E.slice(0,2).join(", ")+(E.length>2?` and ${E.length-2} more`:""):"None. Every file is redacted."};async function Le(){let E=e.source?.commit;if(!(J&&e.preserve.commit===E)){e.preserve.loading=!0,e.preserve.error="",J=null,W=null;try{let M=parseGithubUrl(e.sourceUrl),B=await t.get(`/api/repo/${M.owner}/${M.repo}/tree`,{params:{commit:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ne()}});if(e.source?.commit!==E)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,te=fn(new Set(K)),e.preserve.commit=E,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",E=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&E&&e.sourceUrl&&Le().catch(()=>{})}),e.openPreserveFiles=()=>{let E={},M=[];for(let K of e.options?.preserveFiles||[]){let ae=String(K).trim();ae&&(!M.length&&be(ae)?E[wo(ae.slice(1),me)]=!0:M.push(ae))}let B={};for(let K of Object.keys(E)){let ae=K.split("/");for(let ye=1;ye<ae.length;ye++)B[ae.slice(0,ye).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:E,expanded:B,patterns:M.join(`
`),patternsOpen:M.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),le++,u(()=>{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=Za([...Ve(),...U()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!J)return[];let E=ne(),M=(ye,je,It)=>{let ft=!!e.preserve.picked[ye],Rt=E(ye);return{kind:"file",path:ye,label:It,depth:je,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=>M(ye,0,ye));let K=[],ae=(ye,je)=>{let It=J.dirs.get(ye);for(let ft of It.dirs){let Rt=!!e.preserve.expanded[ft],Ht=U().includes(D(ft));K.push({kind:"dir",path:ft,label:ft.slice(ye?ye.length+1:0)+"/",depth:je,open:Rt,state:Te(ft),locked:!1,note:Ht?"whole folder":""}),Rt&&ae(ft,je+1)}for(let ft of It.files)K.push(M(ft,je,ft.slice(ye?ye.length+1:0)))};return ae("",0),K},e.preserveCount=()=>J?J.files.filter(Se).length:0,e.togglePreserveDir=E=>{e.preserve.expanded[E]=!e.preserve.expanded[E]},e.togglePreserveFile=E=>{e.preserve.picked[E]=!e.preserve.picked[E],le++},e.togglePreserveFolder=E=>{let M=D(E),B=A(E),K=U().filter(ye=>ye!==M&&ye!==B),ae=Te(E)==="all"||U().includes(M);for(let ye of pe(E))e.preserve.picked[ye]=!1;le++,e.preserve.patterns=(ae?K:[...K,M]).join(`
`),ae&&pe(E).some(Se)&&(e.preserve.patterns=[...K,B].join(`
`))};let Je=/^readme(\.[^/]*)?$/i,Ge=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],Ce=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],_e=E=>{let M=Be(E),B=M.indexOf("."),K=Ge.indexOf(B===-1?"":M.slice(B).toLowerCase());return K===-1?Ge.length:K},it=()=>!!J&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!it())return"";for(let E of[".github","","docs"]){let M=(J.dirs.get(E)?.files||[]).filter(B=>Je.test(Be(B)));if(M.length)return M.sort((B,K)=>_e(B)-_e(K)||he(B,K))[0]}return""},e.readmeName=()=>Be(e.readmePath())||"README.md";let dt={key:null,fn:()=>!1},Tt=()=>{let E=(e.options?.preserveFiles||[]).map(B=>String(B).trim()).filter(Boolean),M=E.join(`
`);if(M!==dt.key){let B=()=>!1;try{E.length&&(B=xa(E))}catch{}dt={key:M,fn:B}}return dt.fn};e.pathPreserved=E=>!!E&&Tt()(E),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let E=Tt();if(it()){let M=e.readmePath();return!!M&&E(M)}return Ce.some(M=>E(M))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function wt(){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 M=parseGithubUrl(e.sourceUrl);E.repoName=`${M.owner}/${M.repo}`}catch{}return E}function rt(E,M,B){let K=null,ae=0,ye=()=>{if(e.detectedType!==E)return;K&&u.cancel(K);let je=++ae;e.previewStatus="loading",K=u(()=>{K=null;let It=M();if(!It){e.previewStatus="idle";return}t.post("/api/anonymize-preview",It).then(ft=>{je===ae&&(B(ft.data,It),e.previewStatus="ready")}).catch(()=>{je===ae&&(e.previewStatus="error")})},200)};return ye.cancel=()=>{ae++,K&&u.cancel(K),K=null},e.on("dispose",ye.cancel),ye}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof an!="string"?il(e.previewFile):Jt()),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()};let Ie=fn($s(e));Object.defineProperty(e,"previewViewer",{get:()=>Ie}),Sa(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=E=>E===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=E=>te.has(E)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(E),Co=(E="")=>({path:E,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=Co();let ts=0,an=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=E=>{if(E=E||"",E&&E===e.readmePath()&&(E=""),ts++,an=null,oi(),Jt.cancel(),e.previewFile=E,e.previewDoc=Co(E),Ie.sidebarCollapsed=!0,Ie.content=null,!E){e.readme?Jt():e.previewStatus="idle";return}if(rn(E)){br("binary"),e.previewStatus="ready";return}il(E)};function lf(){ts++,an=null,e.previewFile="",e.previewDoc=Co(),Ie.sidebarCollapsed=!0,Ie.content=null}function il(E){let M=++ts;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:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&tt(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ne()},transformResponse:K=>K}).then(K=>{if(M!==ts)return;e.previewDoc.loading=!1;let ae=typeof K.headers=="function"&&K.headers("content-type")||"";if(/json/i.test(ae)){let ye=null;try{ye=JSON.parse(K.data)}catch{}if(ye&&ye.binary===!0){br("binary"),e.previewStatus="ready";return}}an=typeof K.data=="string"?K.data:"",Jt()},K=>{if(M!==ts)return;e.previewDoc.loading=!1;let ae=hr(K);if(ae==="file_too_big"){br("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=Xn.ERRORS[ae]||"GitHub did not return this file.",e.previewStatus="error"})}let ni;function oi(){ni&&window.URL.revokeObjectURL(ni),ni=void 0,Ie.url=void 0}e.on("dispose",oi);function br(E){oi(),e.previewDoc.note=E,Ie.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),Ie.type=E==="too_big"?"error":"binary",Ie.content=E==="too_big"?"file_too_big":"binary"}function df(E){try{let M=parseGithubUrl(e.sourceUrl),B=e.source.branch||e.details&&e.details.defaultBranch||"main",K=E&&E.includes("/")?E.slice(0,E.lastIndexOf("/")+1):"";return`https://github.com/${M.owner}/${M.repo}/raw/${B}/${K}`}catch{return""}}let rl=rt("repo",()=>e.previewFile?typeof an!="string"?null:{content:an,options:wt()}:e.readme?{content:e.readme,options:wt()}:null,E=>{if(typeof E?.content!="string")throw Error("Invalid preview response");oi(),window.URL?.createObjectURL&&(Ie.url=ni=window.URL.createObjectURL(new Blob([E.content],{type:"text/plain"})));let M=e.previewOpenPath()||e.readmeName();Ie.prepareFile(e.previewPathName(M)),Ie.fileBaseUrl=df(M),Ie.renderFileContent(E.content,Ie.type,Ie.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=E.content)}),Jt=()=>{e.previewFile&&typeof an!="string"||rl()};Jt.cancel=rl.cancel;let So=at(new Map),wr=new Set,kr=new Set,ns="",os=null,si=()=>String(e.terms||"").split(`
`).filter(E=>E.trim());function uf(){os=null;let E=si(),M=E.join(`
`);M!==ns&&(So.clear(),kr.clear(),ns=M);let B=[...wr].filter(K=>!So.has(K));if(wr.clear(),!(!B.length||!E.length))for(let K=0;K<B.length;K+=400){let ae=B.slice(K,K+400);t.post("/api/anonymize-preview",{contents:ae,options:{terms:E,image:!0,link:!0}}).then(ye=>{if(ns!==M||si().join(`
`)!==M)return;let je=ye.data?.contents;if(!Array.isArray(je)||je.length!==ae.length)throw Error("Invalid preview response");ae.forEach((It,ft)=>So.set(It,typeof je[ft]=="string"?je[ft]:It))}).catch(()=>{ns===M&&ae.forEach(ye=>kr.add(ye))})}}e.previewName=E=>{if(!E||!si().length)return E;if(ns===si().join(`
`)){if(So.has(E))return So.get(E);if(kr.has(E))return E}return wr.add(E),os||(os=u(uf,120)),E},e.previewPathName=E=>{E=String(E||"");let M=E.lastIndexOf("/");return M<0?e.previewName(E):e.previewName(E.slice(0,M))+"/"+e.previewName(E.slice(M+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(E=>[e.previewName(E),!0]))},!0),e.on("dispose",()=>{os&&u.cancel(os)});function Eo(){!e.anonymize||!e.anonymize.terms||Jt()}async function al(){let E=parseGithubUrl(e.sourceUrl),M=g();try{To(),fe();let B=await t.get(`/api/pr/${E.owner}/${E.repo}/${E.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(M))return;e.details=B.data,e.pullRequestId||(e.pullRequestId=E.repo+"-PR"+E.pullRequestId+"-"+generateRandomId(4))}catch(B){if(!y(M))return;throw x(B),B}finally{k(M)}}let No=at(new Map);function cf(){let E=new Set,M=e.details&&e.details.pullRequest;if(!M)return E;typeof M.title=="string"&&E.add(M.title),typeof M.body=="string"&&E.add(M.body),typeof M.diff=="string"&&E.add(M.diff);let B=M.comments||[];for(let K of B)typeof K.author=="string"&&E.add(K.author),typeof K.body=="string"&&E.add(K.body);return E}let Mn=rt("pr",()=>{let E=cf(),M=Array.from(E);return M.length===0?null:{contents:M,options:wt()}},(E,M)=>{if(!Array.isArray(E?.contents)||E.contents.length!==M.contents.length||E.contents.some(ae=>typeof ae!="string"))throw Error("Invalid preview response");let B=M.contents,K=new Map;for(let ae=0;ae<B.length&&ae<E.contents.length;ae++)K.set(B[ae],E.contents[ae]);No.clear(),K.forEach((ae,ye)=>No.set(ye,ae))});e.anonymizePrContent=function(E){return E&&(No.has(E)?No.get(E):"")};async function ll(){let E=parseGithubUrl(e.sourceUrl),M=g();try{To(),fe(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let B=await t.get(`/api/gist/source/${E.gistId}`);if(!y(M))return;e.details=B.data,e.gistId||(e.gistId="gist-"+E.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(B){if(!y(M))return;if(B.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,Ee("sourceUrl","missing",!1);return}if(B.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,Ee("sourceUrl","missing",!1);return}throw x(B),B}finally{k(M)}}let Ro=at(new Map);function pf(){let E=new Set,M=e.details&&e.details.gist;if(!M)return E;typeof M.description=="string"&&E.add(M.description),typeof M.ownerLogin=="string"&&E.add(M.ownerLogin);let B=M.files||[];for(let ae of B)typeof ae.filename=="string"&&E.add(ae.filename),typeof ae.content=="string"&&E.add(ae.content);let K=M.comments||[];for(let ae of K)typeof ae.author=="string"&&E.add(ae.author),typeof ae.body=="string"&&E.add(ae.body);return E}let Vn=rt("gist",()=>{let E=pf(),M=Array.from(E);return M.length===0?null:{contents:M,options:wt()}},(E,M)=>{if(!Array.isArray(E?.contents)||E.contents.length!==M.contents.length||E.contents.some(ae=>typeof ae!="string"))throw Error("Invalid preview response");let B=M.contents,K=new Map;for(let ae=0;ae<B.length&&ae<E.contents.length;ae++)K.set(B[ae],E.contents[ae]);Ro.clear(),K.forEach((ae,ye)=>Ro.set(ye,ae)),Cr()});e.anonymizeGistContent=function(E){return E&&(Ro.has(E)?Ro.get(E):"")},e.previewGistFiles=[];function Cr(){let E=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=E.map(M=>({filename:e.anonymizeGistContent(M.filename),content:e.anonymizeGistContent(M.content),language:M.language}))}e.watch("details.gist.files",Cr,!0),e.watch("terms",Cr);function ff(){let E=e.conference;if(e.conference_data=null,!E)return;let M=E===b||e.isUpdate&&E===e._originalConference;E!==b&&(b=null),t.get("/api/conferences/"+E).then(B=>{e.conference===E&&(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),!M&&(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 To(){Ee("repoId","used",!0),Ee("repoId","format",!0),Ee("pullRequestId","used",!0),Ee("pullRequestId","format",!0),Ee("gistId","used",!0),Ee("gistId","format",!0),Ee("sourceUrl","used",!0),Ee("sourceUrl","missing",!0),Ee("sourceUrl","access",!0),Ee("sourceUrl","github",!0),Ee("commit","exists",!0),Ee("conference","activated",!0),Ee("terms","format",!0),e.termHints=[]}function ii(){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="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),To();let ae=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(ae,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},ye=>{if(ye.data){let je=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(ye.data.error);je||r("ERRORS."+ye.data.error).then(It=>{e.error=It},console.error),ri(ye.data.error),je&&(ye.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(()=>{M.disabled=!1})},e.anonymizeGist=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(ii())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=E.currentTarget||E.target.closest?.("button")||E.target;M.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};To();let ae=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(ae,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},ye=>{ye.data&&(r("ERRORS."+ye.data.error).then(je=>{e.error=je},console.error),ri(ye.data.error))}).finally(()=>{M.disabled=!1})},e.anonymizePullRequest=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(ii())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=E.currentTarget||E.target.closest?.("button")||E.target;M.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};To();let ae=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(ae,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},ye=>{ye.data&&(r("ERRORS."+ye.data.error).then(je=>{e.error=je},console.error),ri(ye.data.error))}).finally(()=>{M.disabled=!1})},e.watch("conference",()=>{ff()}),e.termHints=[],e.matchTermAsWritten=E=>{e.terms=$c(e.terms,E)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&Jt()}),e.watch("terms",()=>{e.termHints=_c(e.terms),e.detectedType==="repo"&&Eo(),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()}),e.watch("options.image",()=>{e.detectedType==="repo"&&Eo(),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()}),e.watch("options.link",()=>{e.detectedType==="repo"&&Eo(),e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()}),e.watch("details",()=>{e.detectedType==="pr"&&Mn(),e.detectedType==="gist"&&Vn()},!0)},nl=function(e,t,s,i,o,r){Sa(e);let u=bt();Uc();let p=Bt(),c=0,v=null,h=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){v&&(v.resolve(),v=null),h&&(u.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",I=>{e.symbolsOpen&&!I.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!I.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!I.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&I.target.isConnected&&!I.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!I.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!I.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",I=>{I.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(I.ctrlKey||I.metaKey)&&!I.altKey&&I.key&&I.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(I.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(I){if((I.metaKey||I.ctrlKey)&&I.key==="k"){I.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 I=e.fileSearchQuery;if(!I||I.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(I)}`,{timeout:L.promise}).then(function(S){if(!(g||k!==L)){k=null,e.fileSearchLoading=!1;var q={};e.files.forEach(function(qe){q[(qe.path||"")+"/"+qe.name]=!0});for(var G=[],j={},Y=0;Y<S.data.length;Y++){var ee=S.data[Y];if(ee.path)for(var x=ee.path.split("/"),fe="",he=0;he<x.length;he++){var Be=fe;fe=fe?fe+"/"+x[he]:x[he];var He=Be+"/"+x[he];!q[He]&&!j[He]&&(j[He]=!0,G.push({name:x[he],path:Be}))}}G.sort(function(qe,X){return(qe.path||"").split("/").length-(X.path||"").split("/").length}),G.length>0&&e.files.push.apply(e.files,G);for(var Qe=[],Ee=0;Ee<S.data.length;Ee++){var tt=S.data[Ee],Ne=(tt.path||"")+"/"+tt.name;!q[Ne]&&tt.size!=null&&(Qe.push(tt),q[Ne]=!0)}Qe.length>0&&e.files.push.apply(e.files,Qe),e.fileSearchResults=S.data}},function(){!g&&k===L&&(k=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(I,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(S=>S&&S.trim().length>0),_();for(let S=0;S<e.paths.length-1;S++){let q=S>0?e.paths.slice(0,S).join("/"):"";e.files.some(j=>j.path===q)||e.getFiles(q)}}});function w(){if(e.paths[0]!="")return;let I=["readme.md","readme.txt","readme.org","readme.1st","readme"],L={};for(let q of e.files)q.name.toLowerCase().indexOf("readme")>-1&&(L[q.name.toLowerCase()]=q.name);let S=null;for(let q of I)if(L[q]){S=q;break}if(!S&&Object.keys(L).length>0&&(S=Object.keys(L)[0]),S){let q=s.url();q[q.length-1]!="/"&&(q+="/"),s.url(q+encodePathForUrl(L[S]))}}e.fileCounts=null;let C=0,N=new Set,b=!1;e.getFiles=function(I,L=!1){let S=e.repoId,q=C;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(I)}&v=${e.options.lastUpdateDate}`).then(function(G){if(g||S!==e.repoId||q!==C)return[];let j=I||"";return e.files=e.files.filter(Y=>Y.path!==j),e.files.push(...G.data),e.loadedFolders={...e.loadedFolders,[j]:!0},T(j,q),G.data},function(G){if(g||S!==e.repoId||q!==C)return[];L||(e.type="error",e.content=hr(G),e.files=[])})};function T(I,L){if(b||N.has(I))return;N.add(I);let S=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(I)}`).then(function(q){g||S!==e.repoId||L!==C||(e.fileCounts={...e.fileCounts,...q.data})},function(){g||S!= Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,10,z5),[[u,{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]=h()),n("small",j5,[t[114]||(t[114]=h("Regex is supported. Replaced by ",-1)),n("code",null,d(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[115]||(t[115]=h(", or use ",-1)),t[116]||(t[116]=n("code",null,"term=>replacement",-1)),t[117]||(t[117]=h(" to pick your own (e.g. ",-1)),t[118]||(t[118]=n("code",null,"Anonymous=>ABC",-1)),t[119]||(t[119]=h(").",-1))])]),(a(!0),l(V,null,Q((e.termHints||[]).slice(0,3),c=>(a(),l("div",{class:"term-hint",key:c.line},[n("span",null,[t[122]||(t[122]=h("In ",-1)),n("code",null,d(c.term),1),t[123]||(t[123]=h(", ",-1)),n("code",null,d(c.symbols.join(" ")),1),h(" "+d(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,G5)]))),128)),(e.termHints||[]).length>3?(a(),l("div",W5,d(e.termHints.length-3)+" more "+d(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),P(n("div",K5,"Terms are in an invalid format.",512),[[Z,e.anonymize?.terms?.errors?.format]])]),P(n("div",Y5,[n("div",J5,[t[126]||(t[126]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",X5,d(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())},d((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,Q5)],512),[[Z,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(c=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[29]||(t[29]=de(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)),P(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",Z5,[e.preserve.loading?(a(),l("p",x5,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",e8,d(e.preserve.error),1)):(a(),l(V,{key:2},[(a(!0),l(V,null,Q(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:g=>e.togglePreserveDir(c.path)},d(c.open?"\u25BE":"\u25B8"),9,t8)):(a(),l("span",n8)),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:g=>c.kind==="dir"?e.togglePreserveFolder(c.path):e.togglePreserveFile(c.path)},null,40,o8),n("label",{for:c.kind==="file"?"pf-"+v:null,class:"preserve-name",onClick:g=>c.kind==="dir"&&e.togglePreserveDir(c.path)},d(c.label),9,s8),c.note?(a(),l("span",i8,d(c.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",r8,d(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",a8,"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)),P(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"},[h("One per line, as in .gitignore: "),n("code",null,"*.bib"),h(" matches in any folder; "),n("code",null,"/refs.bib"),h(" and "),n("code",null,"paper/refs.bib"),h(" match from the repository root; a folder name such as "),n("code",null,"drafts/"),h(" covers everything inside it; "),n("code",null,"!private.bib"),h(" excludes again.")],-1))],8,l8),n("div",d8,[n("span",u8,d(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",c8,[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),[[Z,e.detectedType&&e.sourceReady()]]),P(n("section",p8,[t[152]||(t[152]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),P(n("div",null,[n("div",f8,[P(n("input",m8,null,512),[[u,{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",h8,[P(n("input",g8,null,512),[[u,{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",v8,[P(n("input",y8,null,512),[[u,{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",b8,[P(n("input",w8,null,512),[[u,{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",k8,[P(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,C8),[[u,{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",S8,d(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",E8,d(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[Z,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",N8,[...t[138]||(t[138]=[h("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),P(n("div",null,[n("div",R8,[P(n("input",T8,null,512),[[u,{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",P8,[P(n("input",D8,null,512),[[u,{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",A8,[P(n("input",I8,null,512),[[u,{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",O8,[P(n("input",M8,null,512),[[u,{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",V8,[P(n("input",q8,null,512),[[u,{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",L8,[P(n("input",_8,null,512),[[u,{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),[[Z,e.detectedType==="gist"]]),P(n("div",null,[n("div",$8,[P(n("input",F8,null,512),[[u,{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",U8,[P(n("input",B8,null,512),[[u,{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"})]),h("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"})]),h("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,[h("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"),h(" 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"})]),h("Self"),n("span",{class:"serif-hy"},"-"),h("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,z5),[[u,{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",j5,[t[114]||(t[114]=m("Regex is supported. Replaced by ",-1)),n("code",null,d(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(V,null,Q((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,d(c.term),1),t[123]||(t[123]=m(", ",-1)),n("code",null,d(c.symbols.join(" ")),1),m(" "+d(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,G5)]))),128)),(e.termHints||[]).length>3?(a(),l("div",W5,d(e.termHints.length-3)+" more "+d(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),P(n("div",K5,"Terms are in an invalid format.",512),[[Z,e.anonymize?.terms?.errors?.format]])]),P(n("div",Y5,[n("div",J5,[t[126]||(t[126]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",X5,d(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())},d((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,Q5)],512),[[Z,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(c=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[29]||(t[29]=de(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)),P(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",Z5,[e.preserve.loading?(a(),l("p",x5,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",e8,d(e.preserve.error),1)):(a(),l(V,{key:2},[(a(!0),l(V,null,Q(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)},d(c.open?"\u25BE":"\u25B8"),9,t8)):(a(),l("span",n8)),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,o8),n("label",{for:c.kind==="file"?"pf-"+v:null,class:"preserve-name",onClick:h=>c.kind==="dir"&&e.togglePreserveDir(c.path)},d(c.label),9,s8),c.note?(a(),l("span",i8,d(c.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",r8,d(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",a8,"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)),P(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,l8),n("div",d8,[n("span",u8,d(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",c8,[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),[[Z,e.detectedType&&e.sourceReady()]]),P(n("section",p8,[t[152]||(t[152]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),P(n("div",null,[n("div",f8,[P(n("input",m8,null,512),[[u,{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",h8,[P(n("input",g8,null,512),[[u,{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",v8,[P(n("input",y8,null,512),[[u,{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",b8,[P(n("input",w8,null,512),[[u,{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",k8,[P(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,C8),[[u,{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",S8,d(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",E8,d(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[Z,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",N8,[...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),P(n("div",null,[n("div",R8,[P(n("input",T8,null,512),[[u,{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",P8,[P(n("input",D8,null,512),[[u,{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",A8,[P(n("input",I8,null,512),[[u,{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",O8,[P(n("input",M8,null,512),[[u,{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",V8,[P(n("input",q8,null,512),[[u,{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",L8,[P(n("input",_8,null,512),[[u,{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),[[Z,e.detectedType==="gist"]]),P(n("div",null,[n("div",$8,[P(n("input",F8,null,512),[[u,{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",U8,[P(n("input",B8,null,512),[[u,{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
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"})]),h("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"})]),h("Support ")],-1)])],2),e.isDarkMode?f("v-if",!0):(a(),l("li",xB,[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",ez,[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",tz,[...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"}),h(" Sign in ")],-1)])])):f("v-if",!0),e.user?.username&&e.headerCanUpgrade&&!e.headerBillingPending?(a(),l("li",nz,[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",oz,[n("a",sz,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,iz)):f("v-if",!0),n("span",rz,d(e.user?.username),1)]),n("div",az,[n("h6",lz,"Signed in as @"+d(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",dz,[...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,uz)):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)),P(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,cz),[[ot,e.emailPromptAddress]]),e.emailPromptError?(a(),l("p Line truncated
python experiments/run.py`),n("p",null,[h("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",Sz,[e.statsEmpty()?f("v-if",!0):(a(),l("div",Ez,[...t[11]||(t[11]=[n("span",{class:"paper-stats-dot","aria-hidden":"true"},null,-1),h(),n("span",null,[h("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",Nz,[(a(!0),l(V,null,Q(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}])},d(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",Rz,d(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",Tz," +"+d(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,[h("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",Pz,[n("div",Dz,[t[13]||(t[13]=n("label",{for:"demo-terms"},[h("Terms to redact "),n("span",null,[h("comma-separated"),n("span",{class:"dt-try"},", try adding your own")])],-1)),P(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]=Lt(de(()=>{},["prevent"]),["enter"]))},null,544),[[ot,e.demoTerms]])]),n("div",Az,[n("div",Iz,[t[15]||(t[15]=n("div",{class:"pane-header"},[n("span",{class:"pane-label"},[h("Your repository "),n("span",{class:"pane-edit-hint"},"\xB7 editable")]),n("span",{class:"pane-url"},"github.com/jane-smith/DeepLearnUtils")],-1)),n("div",Oz,[n("div",Mz,[(a(!0),l(V,null,Q(e.demoParts(),(i,o)=>(a(),l(V,{key:o},[i.redacted?(a(),l("mark",Vz,d(i.original),1)):(a(),l(V,{key:1},[h(d(i.text),1)],64))],64))),128)),t[14]||(t[14]=h("\u200B",-1))]),P(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",qz,[n("div",Lz,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",_z,[n("span",$z,d(e.demoCount())+" redacted",1)])]),n("div",Fz,[(a(!0),l(V,null,Q(e.demoParts(),(i,o)=>(a(),l(V,{key:o},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},d(i.text),9,Uz)):(a(),l(V,{key:1},[h(d(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",Bz,[n("div",zz,[(a(!0),l(V,null,Q(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",jz,[n("span",Gz,d(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",Wz,d(i?.eyebrow),1)]),n("span",Kz,[h(d(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",Yz,"-")):f("v-if",!0),h(d(i?.title.split("-").slice(1).join("-"))+" "+d(i?.accent),1)])],40,Hz),n("div",Jz,[n("span",Xz,[h(d(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",Qz,"-")):f("v-if",!0),h(d(i?.title.split("-").slice(1).join("-"))+" "+d(i?.accent),1)]),n("p",null,d(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},d(i?.cta)+" \u2192",9,Zz)])],2))),128))]),n("div",xz,[(a(!0),l(V,null,Q(e.features,(i,o)=>P((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",tH,[n("div",nH,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",oH,d(i?.url),1)]),n("div",{class:R(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",iH,[...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: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",xB,[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",ez,[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",tz,[...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",nz,[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",oz,[n("a",sz,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,iz)):f("v-if",!0),n("span",rz,d(e.user?.username),1)]),n("div",az,[n("h6",lz,"Signed in as @"+d(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",dz,[...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,uz)):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)),P(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,cz),[[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",Sz,[e.statsEmpty()?f("v-if",!0):(a(),l("div",Ez,[...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",Nz,[(a(!0),l(V,null,Q(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}])},d(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",Rz,d(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",Tz," +"+d(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",Pz,[n("div",Dz,[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)),P(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]=Lt(de(()=>{},["prevent"]),["enter"]))},null,544),[[ot,e.demoTerms]])]),n("div",Az,[n("div",Iz,[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",Oz,[n("div",Mz,[(a(!0),l(V,null,Q(e.demoParts(),(i,o)=>(a(),l(V,{key:o},[i.redacted?(a(),l("mark",Vz,d(i.original),1)):(a(),l(V,{key:1},[m(d(i.text),1)],64))],64))),128)),t[14]||(t[14]=m("\u200B",-1))]),P(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",qz,[n("div",Lz,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",_z,[n("span",$z,d(e.demoCount())+" redacted",1)])]),n("div",Fz,[(a(!0),l(V,null,Q(e.demoParts(),(i,o)=>(a(),l(V,{key:o},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},d(i.text),9,Uz)):(a(),l(V,{key:1},[m(d(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",Bz,[n("div",zz,[(a(!0),l(V,null,Q(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",jz,[n("span",Gz,d(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",Wz,d(i?.eyebrow),1)]),n("span",Kz,[m(d(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",Yz,"-")):f("v-if",!0),m(d(i?.title.split("-").slice(1).join("-"))+" "+d(i?.accent),1)])],40,Hz),n("div",Jz,[n("span",Xz,[m(d(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",Qz,"-")):f("v-if",!0),m(d(i?.title.split("-").slice(1).join("-"))+" "+d(i?.accent),1)]),n("p",null,d(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},d(i?.cta)+" \u2192",9,Zz)])],2))),128))]),n("div",xz,[(a(!0),l(V,null,Q(e.features,(i,o)=>P((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",tH,[n("div",nH,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",oH,d(i?.url),1)]),n("div",{class:R(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",iH,[...t[19]||(t[19]=[ke('<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
@@ -56,18 +57,18 @@ python experiments/run.py`),n("p",null,[h("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">&quot;epoch %d: %.3f&quot;</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",aH,[...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,sH)])],8,eH)),[[Z,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 lH={class:"paper-empty"},dH={class:"paper-empty-inner"},uH={key:0,class:"paper-eyebrow"},cH={key:1,class:"paper-eyebrow"},pH={key:2,class:"paper-empty-title"},fH=["textContent"];function Ep(e,t){return a(),l("div",lH,[n("div",dH,[e.error?f("v-if",!0):(a(),l("div",uH,"Working")),e.error?(a(),l("div",cH,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",pH,[...t[0]||(t[0]=[h(" Loading",-1),n("span",{class:"dot-anim"},"\u2026",-1)])])),e.error?(a(),l("h1",{key:3,class:"paper-empty-title",textContent:d(e.fmt.translate(e.error))},null,8,fH)):f("v-if",!0)])])}var mH={class:"container paper-page paper-settings"},hH={class:"paper-crumbs"},gH={class:"here"},vH={class:"paper-page-title"},yH={class:"paper-settings-body"},bH={class:"paper-settings-toc"},wH={href:"#conf-billing"},kH={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},CH={id:"conf-basics",class:"paper-settings-section"},SH={class:"form-group"},EH={class:"invalid-feedback"},NH={class:"invalid-feedback"},RH={class:"form-group"},TH={class:"invalid-feedback"},PH={class:"form-group"},DH={class:"invalid-feedback"},AH={class:"invalid-feedback"},IH={id:"conf-window",class:"paper-settings-section"},OH={class:"form-grid-2"},MH={class:"form-group"},VH={class:"invalid-feedback"},qH={class:"invalid-feedback"},LH={class:"form-group"},_H={class:"invalid-feedback"},$H={class:"invalid-feedback"},FH={id:"conf-rendering",class:"paper-settings-section"},UH={class:"form-check"},BH={class:"form-check-input",type:"checkbox",id:"link",name:"link"},zH={class:"form-check"},HH={class:"form-check-input",type:"checkbox",id:"image",name:"image"},jH={class:"form-check"},GH={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},WH={class:"form-check"},KH={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},YH={id:"conf-features",class:"paper-settings-section"},JH={class:"form-check"},XH={class:"form-check-input",type:"checkbox",id:"update",name:"update"},QH={class:"form-check"},ZH={class:"form-check-input",type:"checkbox",id:"page",name:"page"},xH={id:"conf-plan",class:"paper-settings-section"},ej={key:0,class:"paper-section-copy"},tj={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"},Line truncated
`).length))+" lines",1)):f("v-if",!0)]),P(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]=u=>e.copyPath())},[(a(),l("svg",Yj,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,Jj)]))],8,Kj),[[Z,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",Xj,[e.redactionCount()?(a(),l(V,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(d(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,Qj),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),h(d(e.languageName||"Text"),1),n("span",Zj,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),h(d(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)),h(d(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",xj,[e.redactionCount()?(a(),l(V,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(d(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,eG),t[54]||(t[54]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),t[56]||(t[56]=h("Markdown",-1)),e.fileSize(e.filePath)!=null?(a(),l(V,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),h(d(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]=u=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",tG,[e.isCsv()?(a(),l("div",nG,[n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=u=>e.csvView="table")},"Table",10,oG),n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[5]||(t[5]=u=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,sG)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",iG,[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]=u=>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,rG),e.symbolsOpen?(a(),l("div",aG,[n("div",lG,d(e.symbols().length)+" "+d(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(V,null,Q(e.symbols(),u=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:u.line+u.name,onClick:p=>e.goToSymbol(u.line)},[n("span",{class:R(["symbols-kind","is-"+u.kind])},d(u.kind==="class"?"C":u.kind==="function"?"\u0192":"v"),3),n("span",uG,d(u.name),1),n("span",cG,d(u.line),1)],8,dG))),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]=u=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,pG)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?(a(),l("div",fG,[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]=u=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,mG)):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]=u=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,hG)):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]=u=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,gG)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",vG,[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,yG),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]=u=>e.copyContent())},[(a(),l("svg",wG,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,kG)]))],8,bG)):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,CG)])):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]=u=>e.copyContent())},[(a(),l("svg",EG,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,NG)]))],8,SG)):f("v-if",!0),e.type=="html"&&e.r 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",VG)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[17]||(t[17]=u=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),h("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",qG)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[18]||(t[18]=u=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),h("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]=u=>e.gotoLine())},[...t[69]||(t[69]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1),h("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]=u=>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]=h("Wrap lines",-1)),e.wrapLines?(a(),l("span",_G,"\u2713")):f("v-if",!0)],8,LG)):f("v-if",!0),e.isCsv()?(a(),l("button",{key:8,type:"button",role:"menuitem",class:"tb-csv-view",onClick:t[21]||(t[21]=u=>{e.csvView=e.csvView==="table"?"raw":"table",e.moreOpen=!1})},[(a(),l("svg",$G,[n("use",{href:e.csvView==="table"?"#ui-icon-code":"#ui-icon-list"},null,8,FG)])),h(d(e.csvView==="table"?"Show as text":"Show as table"),1)])):f("v-if",!0),e.type!="html"?(a(),l("div",UG)):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),h("View raw",-1)])],8,BG)):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),h("View raw",-1)])],8,zG)):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),h("Download file",-1)])],8,HG)):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),h("Open website",-1)])],8,jG)):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),h("Edit anonymization",-1)])],8,GG)):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),h("Download ZIP",-1)])],8,WG)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=u=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),h("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"})]),h("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"})]),h("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(u=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),P(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]=u=>e.gotoValue=u),onKeydown:t[25]||(t[25]=Lt(de(u=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,KG),[[ot,e.gotoValue]]),n("span",{class:R(["goto-hint",{"is-error":e.gotoError}])},d(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",JG,[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(V,null,Q(e.csvRows()[0]||[],(u,p)=>(a(),l("th",{scope:"col",key:p,class:R({"is-num":e.csvNumCol(p)})},[(a(!0),l(V,null,Q(e.redactParts(u),(c,v)=>(a(),l(V,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,d(c.n),1)],8,XG)):(a(),l(V,{key:1},[h(d(c.t),1)],64))],64))),128))],2))),128))])]),n("tbody",null,[(a(!0),l(V,null,Q(e.csvRows().slice(1),(u,p)=>(a(),l("tr",{key:p},[n("td",QG,d(p+1),1),(a(!0),l(V,null,Q(u,(c,v)=>(a(),l("td",{key:v,class:R({"is-num":e.csvNumCol(v)})},[(a(!0),l(V,null,Q(e.redactParts(c),(g,y)=>(a(),l(V,{key:y},[g.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+g.n},[n("i",null,d(g.n),1)],8,ZG)):(a(),l(V,{key:1},[h(d(g.t),1)],64))],64))),128))],2))),128))]))),128))])])],8,YG)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?P((a(),l("div",xG,null,512)),[[r,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",eW,[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]=u=>{e.mdFindQuery=u.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=Lt(de(u=>u.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=Lt(de(u=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,tW),n("span",nW,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=u=>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,oW),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=u=>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,sW)]),n("span",iW,d(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]=u=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,rW),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=u=>e.toggleMdFind(!1))},"\xD7")])):f("v-if",!0),e.type=="html"?(a(),l("div",aW,[n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,lW),e.readmeToc().length>=3?(a(),l("aside",dW,[t[86]||(t[86]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",uW,[n("a",{href:"#",class:R(["lvl-2 toc-top",{"is-active":!e.activeHeading}]),onClick:t[34]||(t[34]=de(u=>e.scrollToHeading(null),["prevent"]))},"Introduction",2),(a(!0),l(V,null,Q(e.readmeToc(),(u,p)=>(a(),l("a",{key:u.id,href:"#"+u.id,class:R(["lvl-"+u.level,{"is-active":e.activeHeading===u.id}]),onClick:de(c=>e.scrollToHeading(u.id),["prevent"])},d(u.text),11,cW))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Kt(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",pW,[n("div",fW,[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]=u=>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),n("ol",mW,[n("li",hW,[n("a",{href:e.safeUrl("/r/"+e.repoId+"/"),title:e.repoId,textContent:d(/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e.repoId||"")?"repository":e.repoId)},null,8,gW)]),(a(!0),l(V,null,Q(e.paths,(u,p)=>(a(),l("li",{class:"breadcrumb-item","aria-current":p===e.paths.length-1?"page":null},[(a(!0),l(V,null,Q(e.redactParts(u),(c,v)=>(a(),l(V,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,d(c.n),1)],8,yW)):(a(),l(V,{key:1},[h(d(c.t),1)],64))],64))),128))],8,vW))),256))]),n("span",bW,[e.type=="IPython Line truncated
<span class="ln">10</span> log(<span class="s">&quot;epoch %d: %.3f&quot;</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",aH,[...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,sH)])],8,eH)),[[Z,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 lH={class:"paper-empty"},dH={class:"paper-empty-inner"},uH={key:0,class:"paper-eyebrow"},cH={key:1,class:"paper-eyebrow"},pH={key:2,class:"paper-empty-title"},fH=["textContent"];function Rp(e,t){return a(),l("div",lH,[n("div",dH,[e.error?f("v-if",!0):(a(),l("div",uH,"Working")),e.error?(a(),l("div",cH,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",pH,[...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:d(e.fmt.translate(e.error))},null,8,fH)):f("v-if",!0)])])}var mH={class:"container paper-page paper-settings"},hH={class:"paper-crumbs"},gH={class:"here"},vH={class:"paper-page-title"},yH={class:"paper-settings-body"},bH={class:"paper-settings-toc"},wH={href:"#conf-billing"},kH={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},CH={id:"conf-basics",class:"paper-settings-section"},SH={class:"form-group"},EH={class:"invalid-feedback"},NH={class:"invalid-feedback"},RH={class:"form-group"},TH={class:"invalid-feedback"},PH={class:"form-group"},DH={class:"invalid-feedback"},AH={class:"invalid-feedback"},IH={id:"conf-window",class:"paper-settings-section"},OH={class:"form-grid-2"},MH={class:"form-group"},VH={class:"invalid-feedback"},qH={class:"invalid-feedback"},LH={class:"form-group"},_H={class:"invalid-feedback"},$H={class:"invalid-feedback"},FH={id:"conf-rendering",class:"paper-settings-section"},UH={class:"form-check"},BH={class:"form-check-input",type:"checkbox",id:"link",name:"link"},zH={class:"form-check"},HH={class:"form-check-input",type:"checkbox",id:"image",name:"image"},jH={class:"form-check"},GH={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},WH={class:"form-check"},KH={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},YH={id:"conf-features",class:"paper-settings-section"},JH={class:"form-check"},XH={class:"form-check-input",type:"checkbox",id:"update",name:"update"},QH={class:"form-check"},ZH={class:"form-check-input",type:"checkbox",id:"page",name:"page"},xH={id:"conf-plan",class:"paper-settings-section"},ej={key:0,class:"paper-section-copy"},tj={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"},Line truncated
`).length))+" lines",1)):f("v-if",!0)]),P(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]=u=>e.copyPath())},[(a(),l("svg",Yj,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,Jj)]))],8,Kj),[[Z,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",Xj,[e.redactionCount()?(a(),l(V,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[m(d(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,Qj),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),m(d(e.languageName||"Text"),1),n("span",Zj,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),m(d(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(d(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",xj,[e.redactionCount()?(a(),l(V,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[m(d(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,eG),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(V,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),m(d(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]=u=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",tG,[e.isCsv()?(a(),l("div",nG,[n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=u=>e.csvView="table")},"Table",10,oG),n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[5]||(t[5]=u=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,sG)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",iG,[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]=u=>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,rG),e.symbolsOpen?(a(),l("div",aG,[n("div",lG,d(e.symbols().length)+" "+d(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(V,null,Q(e.symbols(),u=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:u.line+u.name,onClick:p=>e.goToSymbol(u.line)},[n("span",{class:R(["symbols-kind","is-"+u.kind])},d(u.kind==="class"?"C":u.kind==="function"?"\u0192":"v"),3),n("span",uG,d(u.name),1),n("span",cG,d(u.line),1)],8,dG))),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]=u=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,pG)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?(a(),l("div",fG,[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]=u=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,mG)):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]=u=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,hG)):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]=u=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,gG)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",vG,[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,yG),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]=u=>e.copyContent())},[(a(),l("svg",wG,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,kG)]))],8,bG)):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,CG)])):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]=u=>e.copyContent())},[(a(),l("svg",EG,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,NG)]))],8,SG)):f("v-if",!0),e.type=="html"&&e.r 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",VG)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[17]||(t[17]=u=>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",qG)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[18]||(t[18]=u=>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]=u=>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]=u=>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",_G,"\u2713")):f("v-if",!0)],8,LG)):f("v-if",!0),e.isCsv()?(a(),l("button",{key:8,type:"button",role:"menuitem",class:"tb-csv-view",onClick:t[21]||(t[21]=u=>{e.csvView=e.csvView==="table"?"raw":"table",e.moreOpen=!1})},[(a(),l("svg",$G,[n("use",{href:e.csvView==="table"?"#ui-icon-code":"#ui-icon-list"},null,8,FG)])),m(d(e.csvView==="table"?"Show as text":"Show as table"),1)])):f("v-if",!0),e.type!="html"?(a(),l("div",UG)):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,BG)):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,zG)):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,HG)):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,jG)):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,GG)):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,WG)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=u=>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]=de(u=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),P(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]=u=>e.gotoValue=u),onKeydown:t[25]||(t[25]=Lt(de(u=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,KG),[[ot,e.gotoValue]]),n("span",{class:R(["goto-hint",{"is-error":e.gotoError}])},d(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",JG,[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(V,null,Q(e.csvRows()[0]||[],(u,p)=>(a(),l("th",{scope:"col",key:p,class:R({"is-num":e.csvNumCol(p)})},[(a(!0),l(V,null,Q(e.redactParts(u),(c,v)=>(a(),l(V,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,d(c.n),1)],8,XG)):(a(),l(V,{key:1},[m(d(c.t),1)],64))],64))),128))],2))),128))])]),n("tbody",null,[(a(!0),l(V,null,Q(e.csvRows().slice(1),(u,p)=>(a(),l("tr",{key:p},[n("td",QG,d(p+1),1),(a(!0),l(V,null,Q(u,(c,v)=>(a(),l("td",{key:v,class:R({"is-num":e.csvNumCol(v)})},[(a(!0),l(V,null,Q(e.redactParts(c),(h,y)=>(a(),l(V,{key:y},[h.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+h.n},[n("i",null,d(h.n),1)],8,ZG)):(a(),l(V,{key:1},[m(d(h.t),1)],64))],64))),128))],2))),128))]))),128))])])],8,YG)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?P((a(),l("div",xG,null,512)),[[r,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",eW,[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]=u=>{e.mdFindQuery=u.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=Lt(de(u=>u.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=Lt(de(u=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,tW),n("span",nW,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=u=>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,oW),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=u=>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,sW)]),n("span",iW,d(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]=u=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,rW),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=u=>e.toggleMdFind(!1))},"\xD7")])):f("v-if",!0),e.type=="html"?(a(),l("div",aW,[n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,lW),e.readmeToc().length>=3?(a(),l("aside",dW,[t[86]||(t[86]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",uW,[n("a",{href:"#",class:R(["lvl-2 toc-top",{"is-active":!e.activeHeading}]),onClick:t[34]||(t[34]=de(u=>e.scrollToHeading(null),["prevent"]))},"Introduction",2),(a(!0),l(V,null,Q(e.readmeToc(),(u,p)=>(a(),l("a",{key:u.id,href:"#"+u.id,class:R(["lvl-"+u.level,{"is-active":e.activeHeading===u.id}]),onClick:de(c=>e.scrollToHeading(u.id),["prevent"])},d(u.text),11,cW))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Kt(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",pW,[n("div",fW,[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]=u=>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),n("ol",mW,[n("li",hW,[n("a",{href:e.safeUrl("/r/"+e.repoId+"/"),title:e.repoId,textContent:d(/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e.repoId||"")?"repository":e.repoId)},null,8,gW)]),(a(!0),l(V,null,Q(e.paths,(u,p)=>(a(),l("li",{class:"breadcrumb-item","aria-current":p===e.paths.length-1?"page":null},[(a(!0),l(V,null,Q(e.redactParts(u),(c,v)=>(a(),l(V,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,d(c.n),1)],8,yW)):(a(),l(V,{key:1},[m(d(c.t),1)],64))],64))),128))],8,vW))),256))]),n("span",bW,[e.type=="IPython Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,8,DY),[[i,{state:e.viewState,set:r=>{e.terms=r},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",AY,[t[25]||(t[25]=n("summary",null,"Regex & replacement syntax",-1)),n("p",null,[t[21]||(t[21]=h("Matches become ",-1)),n("code",null,d(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[22]||(t[22]=h(". Use ",-1)),t[23]||(t[23]=n("code",null,"term=>replacement",-1)),t[24]||(t[24]=h(" for a custom replacement. Regex is supported.",-1))])]),P(n("div",IY,"Terms are in an invalid format.",512),[[Z,e.defaultsForm?.terms?.errors?.format]])])]),n("section",OY,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",MY,[n("label",VY,[P(n("input",qY,null,512),[[i,{state:e.viewState,set:r=>{e.options.link=r},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=h("Keep links",-1))]),n("label",LY,[P(n("input",_Y,null,512),[[i,{state:e.viewState,set:r=>{e.options.image=r},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=h("Display images",-1))]),n("label",$Y,[P(n("input",FY,null,512),[[i,{state:e.viewState,set:r=>{e.options.pdf=r},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=h("Display PDFs",-1))]),n("label",UY,[P(n("input",BY,null,512),[[i,{state:e.viewState,set:r=>{e.options.notebook=r},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=h("Display notebooks",-1))]),n("label",zY,[P(n("input",HY,null,512),[[i,{state:e.viewState,set:r=>{e.options.loc=r},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=h("Show line counts",-1))]),n("label",jY,[P(n("input",GY,null,512),[[i,{state:e.viewState,set:r=>{e.options.page=r},value:e.options?.page,form:"defaultsForm",options:{}}]]),t[32]||(t[32]=h("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",WY,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",KY,[P(n("input",YY,null,512),[[i,{state:e.viewState,set:r=>{e.options.update=r},value:e.options?.update,form:"defaultsForm",options:{}}]]),t[36]||(t[36]=h("Auto-update from GitHub",-1))]),t[37]||(t[37]=n("p",{class:"settings-help"},"Latest commit, at most once an hour.",-1))])]),n("section",JY,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[P((a(),l("select",XY,[...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",QY,d(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",ZY,[n("div",xY,[e.draftRestored?(a(),l("span",eJ,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",tJ,"Unsaved changes"+d(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",nJ,d(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)},d(e.saving?"Saving\u2026":"Save defaults"),11,oJ),e.error?(a(),l("div",sJ,d(e.error),1)):f("v-if",!0)])],32)),[[o,e.viewState]])],512),[[Z,e.settingsTab==="defaults"]]),P(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",rJ,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",aJ,[h(d(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,lJ)])):f("v-if",!0),e.billingNotice?(a(),l("p",dJ,d(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",uJ,[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,cJ)])):f("v-if",!0),n("section",pJ,[n("div",fJ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",mJ,d(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",hJ,[h(d(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access u Line truncated
jane.smith@example.org`},null,8,DY),[[i,{state:e.viewState,set:r=>{e.terms=r},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",AY,[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,d(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))])]),P(n("div",IY,"Terms are in an invalid format.",512),[[Z,e.defaultsForm?.terms?.errors?.format]])])]),n("section",OY,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",MY,[n("label",VY,[P(n("input",qY,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",LY,[P(n("input",_Y,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",$Y,[P(n("input",FY,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",UY,[P(n("input",BY,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",zY,[P(n("input",HY,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",jY,[P(n("input",GY,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",WY,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",KY,[P(n("input",YY,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",JY,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[P((a(),l("select",XY,[...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",QY,d(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",ZY,[n("div",xY,[e.draftRestored?(a(),l("span",eJ,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",tJ,"Unsaved changes"+d(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",nJ,d(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)},d(e.saving?"Saving\u2026":"Save defaults"),11,oJ),e.error?(a(),l("div",sJ,d(e.error),1)):f("v-if",!0)])],32)),[[o,e.viewState]])],512),[[Z,e.settingsTab==="defaults"]]),P(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",rJ,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",aJ,[m(d(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,lJ)])):f("v-if",!0),e.billingNotice?(a(),l("p",dJ,d(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",uJ,[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,cJ)])):f("v-if",!0),n("section",pJ,[n("div",fJ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",mJ,d(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",hJ,[m(d(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access u 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(`
`)}),Bp=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},jp=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",Bp(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:${Bp(u)}ch">${r}${o||" "}${"</span>".repeat(i.length)}</span>`}).join(`
`)})},Gp={props:["content","terms","options"],setup(e){let t=Ct(null),s=()=>{t.value.innerHTML=renderMD(e.content||"",window.location.pathname+"/../"),Hp(t.value),jp(t.value)};return vn(()=>{s(),ut(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>De("markdown",{ref:t})}},Wee={props:["file","terms","options"],setup(e){let t=Ct(null),s=()=>We(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),Hp(t.value),jp(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 De("gist-file",{ref:t},De(Gp,{content:i.content,terms:e.terms,options:e.options}));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 De("gist-file",{ref:t},De("pre",{class:"line-numbers"},De("code",{class:"language-"+(r[u]||u),key:i.content},i.content||"")))}}},Kee=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()}),Yee={props:["file","content"],setup(e){let t=Ct(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 Qn("notebook"),r!==s)return;t.value.innerHTML=$s(DOMPurify.sanitize(nb.parse(u).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),Kee(t.value)}catch(u){r===s&&u.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return vn(()=>{o(),ut(()=>[e.file,e.content],o)}),ro(()=>{s++,i?.abort()}),()=>De("notebook",{ref:t})}},Jee={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 De("loc",t.map(([i,o])=>De("div",{class:"lang",title:`${i}: ${o.code.toLocaleString()} lines`,style:{width:o.code*100/s+"%",background:langColors[i]}})))}}},Wp={Markdown:Gp,GistFile:Wee,Notebook:Yee,Loc:Jee,HtmlDoc:$p,QuotaUsage:jee,Pdfviewer:ud(async()=>(await Qn("pdf"),pdfjsLib.GlobalWorkerOptions.workerSrc="/script/external/pdf.worker.js",Fp))},Kp={async mounted(e,{value:t}){e._editorValue=t;try{if(await ai(),e._editorDisposed)return;let s=e._editorValue,i=ace.edit(e);e._editor=i,i.setValue(String(s.content??""),-1),zp(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),zp(e,t.options))},beforeUnmount(e){e._editorDisposed=!0,e._editorCleanup?.(),e._editor?.destroy()}};function zp(e,t={}){let s=Gee.has(t.mode)?t.mode:"text";e._editor.session.setMode("ace/mode/"+s),t.theme&&e._editor.setTheme("ace/theme/"+t.theme),e._editor.setReadOnly(t.readOnly!==!1)}var Yp={mounted(e){if(!window.IntersectionObserver)return;let t=[...e.querySelectorAll('a[href^="#"]')],s=new Set,i=new IntersectionObserver(o=>{o.forEach(u=>u.isIntersecting?s.add(u.target.id):s.delete(u.target.id));let r=t.find(u=>s.has(u.hash.slice(1)));r&&t.forEach(u=>u.classList.toggle("active",u===r))},{rootMargin:"-20% 0px -60% 0px",threshold:0});We(()=>{t.forEach(o=>{let r=document.getElementById(o.hash.slice(1));r&&i.observe(r)}),t[0]&&!t.some(o=>o.classList.contains("active"))&&t[0].classList.add("active")}),e._observer=i},beforeUnmount(e){e._observer?.disconnect()}};function Jp(e){let t=[],s=0,i=/\bXXXX-(\d+)\b/g,o;for(;o=i.exec(e);)o.index>s&&t.push(e.slice(s,o.index)),t.push(De("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+o[1]},[De("i",null,o[1])])),s=o.index+o[0].length;return t.length?(s<e.length&&t.push(e.slice(s)),t):e}function Xee(e){let t=Jp(e),s=[];for(let i of Array.isArray(t)?t:[t]){if(typeof i!="string"){s.push(i);continue}let o=i.split(/(?<=[._-])/);o.forEach((r,u)=>{s.push(r),u<o.length-1&&s.push(De("wbr"))})}return s}function Qee(e){if(e<1024)return`${e} B`;let t=["KB","MB","GB"],s=e/1024,i=0;for(;s>=1024&&i<t.length-1;)s/=1024,i++;return`${s.toFixed(1)} ${t[i]}`}function Zee(e){let t={children:[]},s=new Map([["",t]]);function i(o){if(s.has(o))return s.get(o);let r=o Line truncated
`)}),Hp=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},Wp=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",Hp(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:${Hp(u)}ch">${r}${o||" "}${"</span>".repeat(i.length)}</span>`}).join(`
`)})},Kp={props:["content","terms","options"],setup(e){let t=Ct(null),s=()=>{t.value.innerHTML=renderMD(e.content||"",window.location.pathname+"/../"),Gp(t.value),Wp(t.value)};return vn(()=>{s(),ut(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>De("markdown",{ref:t})}},nte={props:["file","terms","options"],setup(e){let t=Ct(null),s=()=>We(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),Gp(t.value),Wp(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 De("gist-file",{ref:t},De(Kp,{content:i.content,terms:e.terms,options:e.options}));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 De("gist-file",{ref:t},De("pre",{class:"line-numbers"},De("code",{class:"language-"+(r[u]||u),key:i.content},i.content||"")))}}},ote=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()}),ste={props:["file","content"],setup(e){let t=Ct(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 Qn("notebook"),r!==s)return;t.value.innerHTML=Fs(DOMPurify.sanitize(nb.parse(u).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),ote(t.value)}catch(u){r===s&&u.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return vn(()=>{o(),ut(()=>[e.file,e.content],o)}),ro(()=>{s++,i?.abort()}),()=>De("notebook",{ref:t})}},ite={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 De("loc",t.map(([i,o])=>De("div",{class:"lang",title:`${i}: ${o.code.toLocaleString()} lines`,style:{width:o.code*100/s+"%",background:langColors[i]}})))}}},Yp={Markdown:Kp,GistFile:nte,Notebook:ste,Loc:ite,HtmlDoc:Up,QuotaUsage:ete,Pdfviewer:md(async()=>(await Qn("pdf"),pdfjsLib.GlobalWorkerOptions.workerSrc="/script/external/pdf.worker.js",Bp))},Jp={async mounted(e,{value:t}){e._editorValue=t;try{if(await li(),e._editorDisposed)return;let s=e._editorValue,i=ace.edit(e);e._editor=i,i.setValue(String(s.content??""),-1),jp(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),jp(e,t.options))},beforeUnmount(e){e._editorDisposed=!0,e._editorCleanup?.(),e._editor?.destroy()}};function jp(e,t={}){let s=tte.has(t.mode)?t.mode:"text";e._editor.session.setMode("ace/mode/"+s),t.theme&&e._editor.setTheme("ace/theme/"+t.theme),e._editor.setReadOnly(t.readOnly!==!1)}var Xp={mounted(e){if(!window.IntersectionObserver)return;let t=[...e.querySelectorAll('a[href^="#"]')],s=new Set,i=new IntersectionObserver(o=>{o.forEach(u=>u.isIntersecting?s.add(u.target.id):s.delete(u.target.id));let r=t.find(u=>s.has(u.hash.slice(1)));r&&t.forEach(u=>u.classList.toggle("active",u===r))},{rootMargin:"-20% 0px -60% 0px",threshold:0});We(()=>{t.forEach(o=>{let r=document.getElementById(o.hash.slice(1));r&&i.observe(r)}),t[0]&&!t.some(o=>o.classList.contains("active"))&&t[0].classList.add("active")}),e._observer=i},beforeUnmount(e){e._observer?.disconnect()}};function Qp(e){let t=[],s=0,i=/\bXXXX-(\d+)\b/g,o;for(;o=i.exec(e);)o.index>s&&t.push(e.slice(s,o.index)),t.push(De("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+o[1]},[De("i",null,o[1])])),s=o.index+o[0].length;return t.length?(s<e.length&&t.push(e.slice(s)),t):e}function rte(e){let t=Qp(e),s=[];for(let i of Array.isArray(t)?t:[t]){if(typeof i!="string"){s.push(i);continue}let o=i.split(/(?<=[._-])/);o.forEach((r,u)=>{s.push(r),u<o.length-1&&s.push(De("wbr"))})}return s}function ate(e){if(e<1024)return`${e} B`;let t=["KB","MB","GB"],s=e/1024,i=0;for(;s>=1024&&i<t.length-1;)s/=1024,i++;return`${s.toFixed(1)} ${t[i]}`}function lte(e){let t={children:[]},s=new Map([["",t]]);function i(o){if(s.has(o))return s.get(o);let r=o Line truncated
/*! Bundled license information:
@vue/shared/dist/shared.esm-bundler.js:
+114 -56
View File
@@ -1102,7 +1102,8 @@ app.delete("/api/admin/errors", (req, res) => res.json({ ok: true, cleared: erro
// ---- Admin billing (/api/admin/billing/*) --------------------------------
// Grants as stored in Mongo (BillingGrant), summarized the way
// src/core/billing/report.ts does: a paper pack's three grants are one sale,
// revenue is the Stripe list price per currency (minor units).
// the list shows one row per sale, revenue is the Stripe list price per
// currency (minor units), and an unknown price leaves its sales out of revenue.
// Cookies: mock_billing_empty=1 (no sales), mock_billing_norevenue=1 (Stripe
// not configured), mock_billing_slow=1 (summary never answers: loading state).
const BILLING_PLANS = [
@@ -1111,60 +1112,97 @@ const BILLING_PLANS = [
["repo_slot", "Extra repository", "repository"], ["repo_pack", "Paper pack", "repository"],
["conference_workshop", "Workshop", "conference"], ["conference", "Conference", "conference"], ["conference_large", "Large conference", "conference"],
];
// Stripe prices by id. "price_retired" is unknown, like a deleted price.
const BILLING_PRICES = {
author_monthly: { eur: 500, interval: "month" }, author_annual: { eur: 4800, interval: "year" }, author_pass: { eur: 400 },
repo_extend: { eur: 300 }, repo_never: { eur: 1500 }, repo_slot: { eur: 300 }, repo_pack: { eur: 800 },
conference_workshop: { eur: 9900 }, conference: { eur: 29900 }, conference_large: { usd: 64900 }, // a price in another currency stays apart
price_author_monthly: { currency: "eur", amount: 500, interval: "month" }, price_author_annual: { currency: "eur", amount: 4800, interval: "year" },
price_author_pass: { currency: "eur", amount: 400 }, price_repo_extend: { currency: "eur", amount: 300 }, price_repo_never: { currency: "eur", amount: 1500 },
price_repo_slot: { currency: "eur", amount: 300 }, price_repo_pack: { currency: "eur", amount: 800 },
price_conference_workshop: { currency: "eur", amount: 9900 }, price_conference: { currency: "eur", amount: 29900 },
price_conference_large: { currency: "usd", amount: 64900 }, // a price in another currency stays apart
};
const NEVER = "9999-12-31T00:00:00.000Z";
const PACK_PARTS = ["repo_slot", "author_pass", "repo_extend"];
const billingGrants = (() => {
// Deterministic pseudo-random sales over 14 months, denser recently.
let seed = 7;
const rand = () => { seed = (seed * 16807) % 2147483647; return seed / 2147483647; };
const owners = adminUsers.filter((u) => u.status === "active");
const repos = ["anonymous_github-C72C", "icse24-artifact-7B1D", "JarSift", "runtime-repair-experiments-very-long-identifier-2ff4", "replication-package-5E1A"];
const repos = ["anonymous_github-C72C", "icse24-artifact-7B1D", "JarSift-0A3E", "runtime-repair-experiments-very-long-identifier-2ff4", "replication-package-5E1A"];
const out = [];
const sale = (plan, owner, days, repo, extra = {}) => {
const purchasedAt = ago(days);
const base = { owner: owner._id, purchasedAt, status: "paid", revoked: false, cancelAtPeriodEnd: false, priceId: "price_" + plan };
const id = extra.id || rand().toString(36).slice(2, 10);
if (plan === "author_monthly" || plan === "author_annual") {
const period = plan === "author_annual" ? 365 : 30;
const ended = extra.ended ?? (rand() < 0.25 && days > 40);
const until = ended ? ago(Math.max(1, days - period * 2)) : ahead(period - (days % period) || 1);
out.push({ ...base, _id: "sub_" + id, scope: "user:" + owner._id, planId: plan, subscription: true, status: ended ? "canceled" : extra.status || (rand() < 0.06 ? "past_due" : "active"), until,
cancelAtPeriodEnd: !ended && (extra.cancel ?? rand() < 0.18) });
} else if (plan === "repo_pack") {
for (const part of PACK_PARTS) out.push({ ...base, _id: "cs_" + id + ":" + part, scope: "repo:" + repo, planId: part, pack: true, ...extra.grant,
until: part === "repo_slot" ? NEVER : ago(days - (part === "author_pass" ? 180 : 365)) });
} else if (plan.startsWith("conference")) {
out.push({ ...base, _id: "cs_" + id, scope: "conference:" + repo, planId: plan, until: ago(days - 160), ...extra.grant });
} else {
const length = { author_pass: 180, repo_extend: 365 }[plan];
out.push({ ...base, _id: "cs_" + id, scope: "repo:" + repo, planId: plan, until: length ? ago(days - length) : NEVER, ...extra.grant });
}
};
const weights = [["author_monthly", 14], ["author_annual", 6], ["author_pass", 10], ["repo_extend", 8], ["repo_never", 6], ["repo_slot", 7], ["repo_pack", 9], ["conference_workshop", 2], ["conference", 2], ["conference_large", 1]];
const total = weights.reduce((n, [, w]) => n + w, 0);
const pick = () => { let r = rand() * total; for (const [id, w] of weights) { if ((r -= w) < 0) return id; } return "repo_slot"; };
for (let i = 0; i < 150; i++) {
const days = Math.floor(Math.pow(rand(), 1.6) * 420);
const days = 8 + Math.floor(Math.pow(rand(), 1.6) * 412);
const plan = pick(), owner = owners[Math.floor(rand() * owners.length)];
const purchasedAt = ago(days + rand());
const base = { owner: owner._id, purchasedAt, status: "paid", revoked: false, cancelAtPeriodEnd: false };
const id = (rand().toString(36).slice(2, 10));
if (plan.startsWith("author_") && plan !== "author_pass") {
const period = plan === "author_annual" ? 365 : 30;
const ended = rand() < 0.25 && days > 40;
const until = ended ? ago(Math.max(1, days - period * 2)) : ahead(period - (days % period) || 1);
out.push({ ...base, _id: "sub_" + id, scope: "user:" + owner._id, planId: plan, subscription: true, status: ended ? "canceled" : rand() < 0.06 ? "past_due" : "active", until, cancelAtPeriodEnd: !ended && rand() < 0.18 });
} else if (plan === "repo_pack") {
const repo = repos[Math.floor(rand() * repos.length)];
for (const part of ["repo_slot", "author_pass", "repo_extend"]) out.push({ ...base, _id: "cs_" + id + ":" + part, scope: "repo:" + repo, planId: part, pack: true, until: part === "repo_slot" ? NEVER : ago(days - (part === "author_pass" ? 180 : 365)) });
} else if (plan.startsWith("conference")) {
out.push({ ...base, _id: "cs_" + id, scope: "conference:" + ["FSE25", "ICSE26-AE", "FSE23"][Math.floor(rand() * 3)], planId: plan, until: ago(days - 160) });
} else {
const length = { author_pass: 180, repo_extend: 365 }[plan];
out.push({ ...base, _id: "cs_" + id, scope: "repo:" + repos[Math.floor(rand() * repos.length)], planId: plan, until: length ? ago(days - length) : NEVER });
}
const target = plan.startsWith("conference") ? ["FSE25", "ICSE26-AE", "FSE23"][Math.floor(rand() * 3)] : repos[Math.floor(rand() * repos.length)];
sale(plan, owner, days + rand(), target);
}
// Reversals: a recent refund, an older dispute.
const oneOffs = out.filter((g) => g._id.startsWith("cs_") && !g.pack);
Object.assign(oneOffs[2], { revoked: true, revocationReason: "full_refund", revokedAt: ago(3) });
// The last week, shaped like production: several paper packs, subscriptions
// with one cancelling, extra repositories whose ids are short codes, a
// conference, a USD sale, a refund and a sale whose price is unknown.
const [tdurieux, alice, bob, noemail, longname, dmitri] = owners;
const week = [
["author_monthly", alice, 0.2, null, { cancel: false, ended: false }], ["repo_slot", bob, 0.3, "031F"], ["repo_slot", bob, 0.35, "43E2"],
["repo_slot", noemail, 0.4, "Concept_Drift_Under_Shift-7C1A"], ["repo_pack", longname, 0.5, "BioASQ-Cond-EDE1"],
["repo_pack", dmitri, 1.3, "GECO-submission-E487"], ["author_monthly", tdurieux, 1.4, null, { cancel: true, ended: false }],
["author_annual", bob, 1.5, null, { cancel: false, ended: false }], ["author_pass", alice, 1.6, "mmse-prediction-benchmark-2D9F"],
["author_annual", dmitri, 1.7, null, { cancel: false, ended: false, status: "past_due" }], ["repo_slot", noemail, 1.8, "ADD-28CC"],
["repo_pack", alice, 2.2, "AWR-452D"], ["conference", tdurieux, 2.4, "ICSE27"], ["repo_never", bob, 2.6, "replication-package-5E1A", { grant: { revoked: true, revocationReason: "full_refund", revokedAt: ago(1.1) } }],
["repo_pack", bob, 3.3, "icse24-artifact-7B1D"], ["conference_large", dmitri, 3.5, "FSE27"], ["author_monthly", noemail, 4.2, null, { cancel: false, ended: false }],
["repo_extend", longname, 4.4, "JarSift-0A3E", { grant: { priceId: "price_retired" } }], ["author_monthly", bob, 5.3, null, { cancel: false, ended: false }],
["repo_pack", tdurieux, 5.5, "anonymous_github-C72C"], ["author_annual", alice, 6.2, null, { cancel: false, ended: false }], ["repo_slot", dmitri, 6.4, "4B7A"],
];
for (const [plan, owner, days, target, extra] of week) sale(plan, owner, days, target, extra);
// Older reversals: a dispute and a refund.
const oneOffs = out.filter((g) => g._id.startsWith("cs_") && !g.pack && !g.revoked && g.purchasedAt < ago(8));
Object.assign(oneOffs[9], { revoked: true, revocationReason: "dispute", revokedAt: ago(40) });
Object.assign(oneOffs[14], { revoked: true, revocationReason: "full_refund", revokedAt: ago(12) });
return out.sort((a, b) => b.purchasedAt.localeCompare(a.purchasedAt));
})();
const billingUsable = (g, now) => !g.revoked && g.until > now && ["active", "paid", "past_due"].includes(g.status);
const billingFamily = (planId) => (BILLING_PLANS.find((p) => p[0] === planId) || [])[2] || "repository";
// Mirrors periodStart in src/core/billing/report.ts: N days are N daily buckets ending today.
const billingUnit = (period) => period === "12m" ? "week" : period === "all" ? "month" : "day";
const billingTrunc = (d, unit) => { const x = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), unit === "month" ? 1 : d.getUTCDate())); if (unit === "week") x.setUTCDate(x.getUTCDate() - ((x.getUTCDay() + 6) % 7)); return x; };
function billingSince(period, now = new Date()) {
const days = { "7d": 7, "30d": 30, "90d": 90, "12m": 365 }[period];
if (!days) return null;
const unit = billingUnit(period), start = billingTrunc(now, unit);
start.setUTCDate(start.getUTCDate() - (unit === "week" ? 7 * (Math.floor(days / 7) - 1) : days - 1));
return start;
}
function billingSales(grants) {
const sales = new Map();
const now = new Date().toISOString();
for (const g of grants) {
const key = g.pack ? g._id.split(":")[0] : g._id;
const sale = sales.get(key) || { plan: g.pack ? "repo_pack" : g.planId, purchasedAt: g.purchasedAt, revoked: false, active: false, cancel: false };
const now = new Date().toISOString();
const sale = sales.get(key) || { id: key, plan: g.pack ? "repo_pack" : g.planId, priceId: g.priceId, owner: g.owner, scope: g.scope, status: g.status, subscription: !!g.subscription,
purchasedAt: g.purchasedAt, until: g.until, revoked: false, active: false, cancel: false, parts: [] };
sale.revoked = sale.revoked || g.revoked; sale.reason = sale.reason || g.revocationReason; sale.revokedAt = sale.revokedAt || g.revokedAt;
sale.active = sale.active || billingUsable(g, now); sale.cancel = sale.cancel || g.cancelAtPeriodEnd;
if (g.until > sale.until) sale.until = g.until;
if (g.pack) sale.parts.push({ planId: g.planId, until: g.until === NEVER ? null : g.until, never: g.until === NEVER });
sales.set(key, sale);
}
return [...sales.values()];
@@ -1173,37 +1211,52 @@ function billingSummary(req) {
const cookie = req.headers.cookie || "";
const empty = /mock_billing_empty=1/.test(cookie), revenue = !/mock_billing_norevenue=1/.test(cookie);
const period = ["7d", "30d", "90d", "12m", "all"].includes(req.query.period) ? req.query.period : "30d";
const days = { "7d": 7, "30d": 30, "90d": 90, "12m": 365 }[period];
const now = new Date(), since = days ? new Date(now - days * DAY) : null;
const now = new Date(), since = billingSince(period, now);
const sales = empty ? [] : billingSales(billingGrants);
const inPeriod = (date) => date && (!since || new Date(date) >= since);
const money = (list, fn = () => 1) => { if (!revenue) return {}; const m = {}; for (const s of list) { const [currency, amount] = Object.entries(BILLING_PRICES[s.plan]).find(([k]) => k !== "interval"); m[currency] = Math.round((m[currency] || 0) + amount * fn(s)); } return m; };
const known = (s) => !!BILLING_PRICES[s.priceId];
const money = (list, fn = () => 1) => { if (!revenue) return {}; const m = {}; for (const s of list.filter(known)) { const { currency, amount } = BILLING_PRICES[s.priceId]; m[currency] = Math.round((m[currency] || 0) + amount * fn(s)); } return m; };
const complete = (list) => revenue && list.every(known);
const subs = sales.filter((s) => s.active && billingFamily(s.plan) === "subscription");
const reversals = sales.filter((s) => s.revoked && inPeriod(s.revokedAt));
const unit = period === "12m" ? "week" : period === "all" ? "month" : "day";
const trunc = (d) => { const x = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), unit === "month" ? 1 : d.getUTCDate())); if (unit === "week") x.setUTCDate(x.getUTCDate() - ((x.getUTCDay() + 6) % 7)); return x; };
const unit = billingUnit(period);
const next = (d) => { const x = new Date(d); if (unit === "month") x.setUTCMonth(x.getUTCMonth() + 1); else x.setUTCDate(x.getUTCDate() + (unit === "week" ? 7 : 1)); return x; };
const first = since || (sales.length ? new Date(sales.reduce((m, s) => s.purchasedAt < m ? s.purchasedAt : m, sales[0].purchasedAt)) : null);
const series = [];
if (first) {
const buckets = new Map();
for (let d = trunc(first); d <= now; d = next(d)) { const b = { date: d.toISOString(), subscription: 0, repository: 0, conference: 0 }; buckets.set(d.getTime(), b); series.push(b); }
for (const s of sales) if (inPeriod(s.purchasedAt)) { const b = buckets.get(trunc(new Date(s.purchasedAt)).getTime()); if (b) b[billingFamily(s.plan)]++; }
for (let d = billingTrunc(first, unit); d <= now; d = next(d)) {
const b = { date: d.toISOString(), subscription: 0, repository: 0, conference: 0, revenue: { subscription: {}, repository: {}, conference: {} }, missing: 0 };
buckets.set(d.getTime(), b); series.push(b);
}
for (const s of sales) {
if (!inPeriod(s.purchasedAt)) continue;
const b = buckets.get(billingTrunc(new Date(s.purchasedAt), unit).getTime());
if (!b) continue;
const family = billingFamily(s.plan);
b[family]++;
if (!revenue) continue;
const price = BILLING_PRICES[s.priceId];
if (price) b.revenue[family][price.currency] = (b.revenue[family][price.currency] || 0) + price.amount;
else b.missing++;
}
}
const periodSales = sales.filter((s) => inPeriod(s.purchasedAt));
return {
period, since, now, bucket: unit,
subscriptions: { active: subs.length, monthly: subs.filter((s) => s.plan === "author_monthly").length, annual: subs.filter((s) => s.plan === "author_annual").length,
cancelling: subs.filter((s) => s.cancel).length, mrr: money(subs, (s) => s.plan === "author_annual" ? 1 / 12 : 1) },
sales: { count: periodSales.length, revenue: money(periodSales) },
allTime: { count: sales.length, revenue: money(sales) },
reversals: { refunds: reversals.filter((s) => s.reason !== "dispute").length, disputes: reversals.filter((s) => s.reason === "dispute").length, amount: money(reversals) },
cancelling: subs.filter((s) => s.cancel).length, mrr: money(subs, (s) => s.plan === "author_annual" ? 1 / 12 : 1), complete: complete(subs) },
sales: { count: periodSales.length, revenue: money(periodSales), complete: complete(periodSales) },
allTime: { count: sales.length, revenue: money(sales), complete: complete(sales) },
reversals: { refunds: reversals.filter((s) => s.reason !== "dispute").length, disputes: reversals.filter((s) => s.reason === "dispute").length },
plans: BILLING_PLANS.map(([planId, name, family]) => {
const of = (list) => list.filter((s) => s.plan === planId);
return { planId, name, family, active: of(sales.filter((s) => s.active)).length, sales: of(periodSales).length, revenue: money(of(periodSales)), allTimeSales: of(sales).length, allTimeRevenue: money(of(sales)) };
return { planId, name, family, active: of(sales.filter((s) => s.active)).length, sales: of(periodSales).length, revenue: money(of(periodSales)), revenueComplete: complete(of(periodSales)),
allTimeSales: of(sales).length, allTimeRevenue: money(of(sales)), allTimeRevenueComplete: complete(of(sales)) };
}),
series,
revenue: { available: revenue, reason: revenue ? null : "stripe_not_configured", missingSales: 0, basis: "list_price" },
revenue: { available: revenue, reason: revenue ? null : "stripe_not_configured", basis: "list_price",
missingSales: revenue ? periodSales.filter((s) => !known(s)).length : 0, missingAllTimeSales: revenue ? sales.filter((s) => !known(s)).length : 0, missingSubscriptions: revenue ? subs.filter((s) => !known(s)).length : 0 },
webhooks: empty
? { pending: 0, failed: 0, oldestPendingSeconds: 0, unresolved: 0, reconciliationFailed: 0, lastError: null, unreviewedRevocations: 0, latestRevocation: null }
: { pending: 2, failed: 1, oldestPendingSeconds: 140, unresolved: 0, reconciliationFailed: 0, unreviewedRevocations: 1, latestRevocation: { reason: "full_refund", createdAt: ago(3) },
@@ -1215,26 +1268,31 @@ app.get("/api/admin/billing/summary", (req, res) => {
res.json(billingSummary(req));
});
app.get("/api/admin/billing/grants", (req, res) => {
const now = new Date().toISOString();
const word = (v) => typeof v === "string" && /^[a-z_]{1,40}$/.test(v) ? v : "";
const plan = word(req.query.plan), status = word(req.query.status), state = word(req.query.state);
const cookie = req.headers.cookie || "";
const revenue = !/mock_billing_norevenue=1/.test(cookie);
const word = (v) => typeof v === "string" && /^[a-z0-9_]{1,40}$/.test(v) ? v : "";
const plan = word(req.query.plan), status = word(req.query.status), state = word(req.query.state), since = billingSince(word(req.query.period));
const search = String(req.query.search || "").toLowerCase();
const name = (g) => (adminUsers.find((u) => u._id === g.owner) || {}).username;
const stateOf = (g) => g.revoked ? "revoked" : billingUsable(g, now) ? "active" : "expired";
let rows = /mock_billing_empty=1/.test(req.headers.cookie || "") ? [] : billingGrants;
rows = rows.filter((g) => (!plan || (plan === "repo_pack" ? g.pack : g.planId === plan)) && (!status || g.status === status) && (!search || (name(g) || "").toLowerCase().includes(search)));
const name = (s) => (adminUsers.find((u) => u._id === s.owner) || {}).username;
const stateOf = (s) => s.revoked ? "revoked" : s.active ? "active" : "expired";
let rows = /mock_billing_empty=1/.test(cookie) ? [] : billingSales(billingGrants);
rows = rows.filter((s) => (!plan || s.plan === plan) && (!status || s.status === status) && (!since || new Date(s.purchasedAt) >= since) && (!search || (name(s) || "").toLowerCase().includes(search)));
const stateCounts = { active: 0, expired: 0, revoked: 0 };
for (const g of rows) stateCounts[stateOf(g)]++;
if (state) rows = rows.filter((g) => stateOf(g) === state);
for (const s of rows) stateCounts[stateOf(s)]++;
if (state) rows = rows.filter((s) => stateOf(s) === state);
const field = req.query.sort === "until" ? "until" : "purchasedAt", dir = req.query.direction === "asc" ? 1 : -1;
rows = [...rows].sort((a, b) => dir * a[field].localeCompare(b[field]));
const pageNo = Math.max(1, parseInt(req.query.page, 10) || 1), limit = Math.min(100, parseInt(req.query.limit, 10) || 25);
const results = rows.slice((pageNo - 1) * limit, pageNo * limit).map((g) => {
const [kind, id] = g.scope.split(/:(.*)/s);
return { id: g._id.replace(/[^a-z0-9]/gi, "").slice(-12), user: name(g) || null, planId: g.planId, pack: !!g.pack, family: billingFamily(g.planId), subscription: !!g.subscription,
status: g.status, state: stateOf(g), purchasedAt: g.purchasedAt, until: g.until === NEVER ? null : g.until, never: g.until === NEVER,
cancelAtPeriodEnd: g.cancelAtPeriodEnd, revoked: g.revoked, revocationReason: g.revocationReason || null, revokedAt: g.revokedAt || null,
scope: kind === "repo" || kind === "conference" ? { kind, id } : { kind: "account", id: null } };
const results = rows.slice((pageNo - 1) * limit, pageNo * limit).map((s) => {
const [kind, id] = s.scope.split(/:(.*)/s);
const price = revenue && BILLING_PRICES[s.priceId];
return { id: s.id.replace(/[^a-z0-9]/gi, "").slice(-12), user: name(s) || null, planId: s.plan, pack: s.plan === "repo_pack", family: billingFamily(s.plan), subscription: s.subscription,
parts: [...s.parts].sort((a, b) => PACK_PARTS.indexOf(a.planId) - PACK_PARTS.indexOf(b.planId)),
status: s.status, state: stateOf(s), purchasedAt: s.purchasedAt, until: s.until === NEVER ? null : s.until, never: s.until === NEVER,
cancelAtPeriodEnd: s.cancel, revoked: s.revoked, revocationReason: s.reason || null, revokedAt: s.revokedAt || null,
scope: kind === "repo" || kind === "conference" ? { kind, id } : { kind: "account", id: null },
amount: price ? { value: price.amount, currency: price.currency, interval: s.subscription ? price.interval : null, intervalCount: 1 } : null,
amountMissing: price ? null : revenue ? "unresolved" : "stripe_not_configured" };
});
res.json({ page: pageNo, limit, total: rows.length, results, stateCounts, statuses: [...new Set(billingGrants.map((g) => g.status))].sort() });
});
+117 -77
View File
@@ -5,7 +5,7 @@ import UserModel from "../model/users/users.model";
import { BillingEvent, BillingGrant, BillingRevocation } from "./models";
import { billingHealth } from "./events";
import { stripeClient } from "./stripe";
import { billingPlans, CONFERENCE_PLANS, REPO_NEVER_UNTIL } from "./config";
import { billingPlans, CONFERENCE_PLANS, PACK_PLANS, PlanId, REPO_NEVER_UNTIL } from "./config";
// Admin billing report. A sale is one checkout or one subscription: the three
// grants of a paper pack count once, under "repo_pack". Grants hold no amounts,
@@ -39,6 +39,17 @@ function nextBucket(date: Date, unit: Bucket) {
else d.setUTCDate(d.getUTCDate() + (unit === "week" ? 7 : 1));
return d;
}
// The start of a period: N days are N daily buckets ending with today, and
// 12 months are 52 weekly buckets ending with this week. The tiles, the chart
// and the list's period filter all count from this date.
export function periodStart(period: string, now = new Date()) {
const days = BILLING_PERIODS[period];
if (days == null) return null;
const unit = bucketFor(period);
const start = truncate(now, unit);
start.setUTCDate(start.getUTCDate() - (unit === "week" ? 7 * (Math.floor(days / 7) - 1) : days - 1));
return start;
}
type Price = { amount: number; currency: string; interval: string | null; intervalCount: number };
type PriceLookup = (id: string) => Promise<{ unit_amount: number | null; currency: string; recurring?: { interval: string; interval_count: number } | null }>;
@@ -70,15 +81,14 @@ export function monthlyAmount(price: Price, planId?: string | null) {
const PACK_PART = "^cs_[^:]+:(repo_slot|author_pass|repo_extend)$";
type Row = { _id: { plan: string; priceId?: string | null; reason?: string }; count: number; cancelling?: number };
type SeriesRow = { _id: { bucket: Date; plan: string; priceId?: string | null }; count: number };
export async function billingSummary(period: string, now = new Date(), lookup?: PriceLookup) {
const days = BILLING_PERIODS[period];
const since = days == null ? null : new Date(now.getTime() - days * 86400_000);
const unit = bucketFor(period);
// One document per sale, shared by the summary and the list so both count the
// same unit: a paper pack's three grants become one "repo_pack" sale.
function saleStages(now: Date) {
const isPack = { $regexMatch: { input: { $toString: "$_id" }, regex: PACK_PART } };
const subscription = { $ne: [{ $ifNull: ["$subscriptionId", null] }, null] };
const group = { _id: { plan: "$plan", priceId: "$priceId" }, count: { $sum: 1 } };
const [facets] = await BillingGrant.aggregate([
return [
{ $project: {
sale: { $cond: [isPack, { $arrayElemAt: [{ $split: ["$_id", ":"] }, 0] }, "$_id"] },
plan: { $cond: [isPack, "repo_pack", { $cond: [subscription, { $ifNull: ["$salePlanId", "subscription_unknown"] }, { $ifNull: ["$planId", "unknown"] }] }] },
@@ -87,20 +97,35 @@ export async function billingSummary(period: string, now = new Date(), lookup?:
// syncSubscription only advances until from a paid invoice and retains it
// after cancellation. Epoch means no payment has ever granted service.
purchasedAt: { $cond: [
{ $and: [{ $ne: [{ $ifNull: ["$subscriptionId", null] }, null] }, { $not: [{ $gt: ["$until", new Date(0)] }] }] },
{ $and: [subscription, { $not: [{ $gt: ["$until", new Date(0)] }] }] },
null, "$purchasedAt",
] },
startedAt: "$purchasedAt", until: 1, owner: 1, scope: 1, status: 1, subscription,
part: { $cond: [isPack, { planId: "$planId", until: "$until" }, "$$REMOVE"] },
cancel: { $eq: ["$cancelAtPeriodEnd", true] },
revoked: { $eq: ["$revoked", true] }, revocationReason: 1, revokedAt: 1,
usable: { $and: [{ $ne: ["$revoked", true] }, { $gt: ["$until", now] }, { $in: ["$status", USABLE_STATUSES] }] },
} },
{ $group: { _id: "$sale", plan: { $first: "$plan" }, priceId: { $first: "$priceId" }, purchasedAt: { $min: "$purchasedAt" },
currentPriceId: { $first: "$currentPriceId" }, currentPlan: { $first: "$currentPlan" }, active: { $max: "$usable" }, cancel: { $max: "$cancel" } } },
currentPriceId: { $first: "$currentPriceId" }, currentPlan: { $first: "$currentPlan" }, active: { $max: "$usable" }, cancel: { $max: "$cancel" },
startedAt: { $min: "$startedAt" }, until: { $max: "$until" }, owner: { $first: "$owner" }, scope: { $first: "$scope" }, status: { $first: "$status" },
subscription: { $max: "$subscription" }, revoked: { $max: "$revoked" }, revocationReason: { $max: "$revocationReason" }, revokedAt: { $max: "$revokedAt" },
parts: { $push: "$part" } } },
];
}
export async function billingSummary(period: string, now = new Date(), lookup?: PriceLookup) {
const since = periodStart(period, now);
const unit = bucketFor(period);
const group = { _id: { plan: "$plan", priceId: "$priceId" }, count: { $sum: 1 } };
const [facets] = await BillingGrant.aggregate([
...saleStages(now),
{ $facet: {
allTime: [{ $match: { purchasedAt: { $ne: null } } }, { $group: group }],
period: [{ $match: { purchasedAt: since ? { $gte: since } : { $ne: null } } }, { $group: group }],
active: [{ $match: { active: true } }, { $group: { ...group, _id: { plan: "$currentPlan", priceId: "$currentPriceId" }, cancelling: { $sum: { $cond: ["$cancel", 1, 0] } } } }],
series: [{ $match: { purchasedAt: since ? { $gte: since } : { $ne: null } } },
{ $group: { _id: { bucket: { $dateTrunc: { date: "$purchasedAt", unit, startOfWeek: "monday" } }, plan: "$plan" }, count: { $sum: 1 } } }],
{ $group: { _id: { bucket: { $dateTrunc: { date: "$purchasedAt", unit, startOfWeek: "monday" } }, plan: "$plan", priceId: "$priceId" }, count: { $sum: 1 } } }],
} },
]);
const rows = (name: string) => (facets?.[name] || []) as Row[];
@@ -151,7 +176,7 @@ export async function billingSummary(period: string, now = new Date(), lookup?:
disputes: count(reversals.filter(r => r._id === "dispute")),
},
plans: planRows(rows, available ? (list: Row[]) => money(list) : () => ({}), list => available && missing(list) === 0),
series: fillSeries(rows("series") as unknown as { _id: { bucket: Date; plan: string }; count: number }[], since, now, unit),
series: fillSeries(rows("series") as unknown as SeriesRow[], since, now, unit, available ? id => (id ? prices.get(id) : undefined) : null),
revenue: { available, reason: available ? null : "stripe_not_configured", missingSales: available ? missingSales : 0, missingAllTimeSales: available ? missing(allTime) : 0, missingSubscriptions: available ? missing(activeSubs) : 0, basis: "list_price" },
};
return result;
@@ -171,14 +196,26 @@ function planRows(rows: (name: string) => Row[], money: (list: Row[]) => Money,
});
}
function fillSeries(rows: { _id: { bucket: Date; plan: string }; count: number }[], since: Date | null, now: Date, unit: Bucket) {
// One entry per bucket from the period start to now, with each family's sale
// count and list-price revenue per currency. `missing` counts sales whose price
// is unknown; `price` is null when Stripe is not configured.
export function fillSeries(rows: SeriesRow[], since: Date | null, now: Date, unit: Bucket, price: ((id?: string | null) => Price | undefined) | null) {
const first = since || rows.reduce<Date | null>((min, r) => !min || r._id.bucket < min ? r._id.bucket : min, null);
if (!first) return [];
const buckets = new Map<number, { date: Date; subscription: number; repository: number; conference: number }>();
for (let d = truncate(first, unit); d <= now; d = nextBucket(d, unit)) buckets.set(d.getTime(), { date: d, subscription: 0, repository: 0, conference: 0 });
type Point = { date: Date; subscription: number; repository: number; conference: number; revenue: Record<Family, Money>; missing: number };
const buckets = new Map<number, Point>();
for (let d = truncate(first, unit); d <= now; d = nextBucket(d, unit)) {
buckets.set(d.getTime(), { date: d, subscription: 0, repository: 0, conference: 0, revenue: { subscription: {}, repository: {}, conference: {} }, missing: 0 });
}
for (const r of rows) {
const bucket = buckets.get(new Date(r._id.bucket).getTime());
if (bucket) bucket[planFamily(r._id.plan)] += r.count;
if (!bucket) continue;
const family = planFamily(r._id.plan);
bucket[family] += r.count;
if (!price) continue;
const p = price(r._id.priceId);
if (p) add(bucket.revenue[family], p.currency, p.amount * r.count);
else bucket.missing += r.count;
}
return [...buckets.values()];
}
@@ -197,76 +234,79 @@ export async function billingWebhookHealth() {
unreviewedRevocations: unreviewed, latestRevocation: latest ? { reason: latest.reason, createdAt: latest.createdAt } : null };
}
export type GrantQuery = { search?: unknown; page?: unknown; limit?: unknown; plan?: unknown; status?: unknown; state?: unknown; owners?: string[] | null; sort?: unknown; direction?: unknown };
const STATE_FILTERS = (now: Date): Record<string, Record<string, unknown>> => ({
active: { revoked: { $ne: true }, until: { $gt: now }, status: { $in: USABLE_STATUSES } },
expired: { revoked: { $ne: true }, $or: [{ until: { $not: { $gt: now } } }, { status: { $nin: USABLE_STATUSES } }] },
export type GrantQuery = { search?: unknown; page?: unknown; limit?: unknown; plan?: unknown; status?: unknown; state?: unknown; period?: unknown; owners?: string[] | null; sort?: unknown; direction?: unknown };
// Matched against sales (see saleStages), so the tabs count sales like the summary.
const STATE_FILTERS: Record<string, Record<string, unknown>> = {
active: { revoked: false, active: true },
expired: { revoked: false, active: false },
revoked: { revoked: true },
});
const word = (v: unknown) => typeof v === "string" && /^[a-z_]{1,40}$/.test(v) ? v : "";
// The filtered grant list. Only plain words reach the query, never operators.
};
const word = (v: unknown) => typeof v === "string" && /^[a-z0-9_]{1,40}$/.test(v) ? v : "";
// The filtered sale list. Only plain words reach the query, never operators.
// `grant` applies to grants before they are grouped into sales, `sale` after.
export function grantFilter(query: GrantQuery, now = new Date()) {
const filter: Record<string, unknown> = {};
const plan = word(query.plan), status = word(query.status), state = word(query.state);
if (plan === "repo_pack") filter._id = { $regex: PACK_PART };
else if (plan) filter.planId = plan;
if (status) filter.status = status;
if (query.owners) filter.owner = { $in: query.owners };
return { filter, state: STATE_FILTERS(now)[state] || null };
const grant: Record<string, unknown> = {}, sale: Record<string, unknown> = {};
const plan = word(query.plan), status = word(query.status), state = word(query.state), period = word(query.period);
// A subscription matches both the plan it was sold as and its current plan.
if (plan) sale.$or = [{ plan }, { currentPlan: plan }];
if (status) sale.status = status;
const since = period in BILLING_PERIODS ? periodStart(period, now) : null;
if (since) sale.purchasedAt = { $gte: since };
if (query.owners) grant.owner = { $in: query.owners };
return { grant, sale, state: STATE_FILTERS[state] || null };
}
export async function billingGrants(query: GrantQuery, usernames: (ids: string[]) => Promise<Map<string, string>>, now = new Date()) {
type Sale = { _id: string; plan: string; currentPlan: string; priceId?: string | null; startedAt?: Date | null; until?: Date | null; owner?: string | null; scope?: string | null;
status?: string | null; subscription: boolean; active: boolean; cancel: boolean; revoked: boolean; revocationReason?: string | null; revokedAt?: Date | null;
parts: { planId: string; until?: Date | null }[] };
export async function billingGrants(query: GrantQuery, usernames: (ids: string[]) => Promise<Map<string, string>>, now = new Date(), lookup?: PriceLookup) {
const page = Math.max(1, parseInt(String(query.page)) || 1);
const limit = Math.min(Math.max(1, parseInt(String(query.limit)) || 25), 100);
const sortField = ["purchasedAt", "until"].includes(String(query.sort)) ? String(query.sort) : "purchasedAt";
const { filter, state } = grantFilter(query, now);
const states = STATE_FILTERS(now);
const listed = state ? { $and: [filter, state] } : filter;
const sortField = String(query.sort) === "until" ? "until" : "startedAt";
const { grant, sale, state } = grantFilter(query, now);
const search = typeof query.search === "string" ? query.search.trim() : "";
const selection = "owner scope planId status until cancelAtPeriodEnd purchasedAt revoked revocationReason revokedAt subscriptionId";
const statuses = await BillingGrant.distinct("status");
let total: number, grants: InferSchemaType<typeof BillingGrant.schema>[], stateCounts: [string, number][];
if (search) {
const escaped = search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const [result] = await BillingGrant.aggregate([
{ $match: filter },
{ $set: { userId: { $convert: { input: "$owner", to: "objectId", onError: null, onNull: null } } } },
{ $lookup: { from: UserModel.collection.name, localField: "userId", foreignField: "_id",
pipeline: [{ $match: { username: { $regex: escaped, $options: "i" } } }, { $project: { _id: 1 } }], as: "user" } },
{ $match: { "user.0": { $exists: true } } },
{ $facet: {
total: [...(state ? [{ $match: state }] : []), { $count: "count" }],
grants: [...(state ? [{ $match: state }] : []),
{ $sort: { [sortField]: query.direction === "asc" ? 1 : -1, _id: -1 } },
{ $skip: (page - 1) * limit }, { $limit: limit },
{ $project: Object.fromEntries(selection.split(" ").map(key => [key, 1])) }],
...Object.fromEntries(Object.entries(states).map(([key, f]) => [key, [{ $match: f }, { $count: "count" }]])),
} },
]);
total = result.total[0]?.count || 0; grants = result.grants;
stateCounts = Object.keys(states).map(key => [key, result[key][0]?.count || 0]);
} else {
[total, grants, stateCounts] = await Promise.all([
BillingGrant.countDocuments(listed),
BillingGrant.find(listed).sort({ [sortField]: query.direction === "asc" ? 1 : -1, _id: -1 }).skip((page - 1) * limit).limit(limit)
.select(selection).lean(),
Promise.all(Object.entries(states).map(async ([key, f]) => [key, await BillingGrant.countDocuments({ $and: [filter, f] })] as [string, number])),
]);
}
const names = await usernames([...new Set(grants.map(g => g.owner).filter((o): o is string => !!o))]);
const usable = (g: { revoked?: boolean | null; until?: Date | null; status?: string | null }) => !g.revoked && !!g.until && g.until > now && USABLE_STATUSES.includes(g.status || "");
const results = grants.map(g => {
const [kind, target] = String(g.scope || "").split(/:(.*)/s);
const never = !!g.until && g.until.getTime() >= REPO_NEVER_UNTIL.getTime();
const pack = new RegExp(PACK_PART).test(String(g._id));
const userMatch = search ? [
{ $set: { userId: { $convert: { input: "$owner", to: "objectId", onError: null, onNull: null } } } },
{ $lookup: { from: UserModel.collection.name, localField: "userId", foreignField: "_id",
pipeline: [{ $match: { username: { $regex: search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), $options: "i" } } }, { $project: { _id: 1 } }], as: "user" } },
{ $match: { "user.0": { $exists: true } } },
] : [];
const listed = state ? [{ $match: state }] : [];
const [[result], statuses] = await Promise.all([BillingGrant.aggregate([
{ $match: grant }, ...userMatch, ...saleStages(now), { $match: sale },
{ $facet: {
total: [...listed, { $count: "count" }],
sales: [...listed, { $sort: { [sortField]: query.direction === "asc" ? 1 : -1, _id: -1 } }, { $skip: (page - 1) * limit }, { $limit: limit }],
...Object.fromEntries(Object.entries(STATE_FILTERS).map(([key, f]) => [key, [{ $match: f }, { $count: "count" }]])),
} },
]), BillingGrant.distinct("status")]);
const sales = (result?.sales || []) as Sale[];
const names = await usernames([...new Set(sales.map(s => s.owner).filter((o): o is string => !!o))]);
const available = revenueAvailable();
const prices = available ? await resolvePrices(sales.map(s => s.priceId).filter((id): id is string => !!id), lookup) : new Map<string, Price>();
const ends = (until?: Date | null) => {
const never = !!until && until.getTime() >= REPO_NEVER_UNTIL.getTime();
return { until: never ? null : until || null, never };
};
const results = sales.map(s => {
const [kind, target] = String(s.scope || "").split(/:(.*)/s);
const pack = s.plan === "repo_pack";
const planId = pack ? "repo_pack" : s.currentPlan;
const price = s.priceId ? prices.get(s.priceId) : undefined;
return {
id: createHash("sha256").update(String(g._id)).digest("hex").slice(0, 12),
user: (g.owner && names.get(g.owner)) || null,
planId: g.planId || "unknown", pack, family: planFamily(g.planId), subscription: !!g.subscriptionId,
status: g.status || null, state: g.revoked ? "revoked" : usable(g) ? "active" : "expired",
purchasedAt: g.purchasedAt || null, until: never ? null : g.until || null, never,
cancelAtPeriodEnd: !!g.cancelAtPeriodEnd, revoked: !!g.revoked, revocationReason: g.revocationReason || null, revokedAt: g.revokedAt || null,
id: createHash("sha256").update(String(s._id)).digest("hex").slice(0, 12),
user: (s.owner && names.get(s.owner)) || null,
planId, pack, family: planFamily(planId), subscription: !!s.subscription,
parts: pack ? s.parts.map(p => ({ planId: p.planId, ...ends(p.until) })).sort((a, b) => PACK_PLANS.indexOf(a.planId as PlanId) - PACK_PLANS.indexOf(b.planId as PlanId)) : [],
status: s.status || null, state: s.revoked ? "revoked" : s.active ? "active" : "expired",
purchasedAt: s.startedAt || null, ...ends(s.until),
cancelAtPeriodEnd: !!s.cancel, revoked: !!s.revoked, revocationReason: s.revocationReason || null, revokedAt: s.revokedAt || null,
scope: kind === "repo" || kind === "conference" ? { kind, id: target } : { kind: "account", id: null },
// The sale's list price, the one the summary sums; per period for a subscription.
amount: price ? { value: price.amount, currency: price.currency, interval: s.subscription ? price.interval || (s.plan === "author_annual" ? "year" : "month") : null, intervalCount: price.intervalCount } : null,
amountMissing: price ? null : !available ? "stripe_not_configured" : s.priceId ? "unresolved" : "unrecorded",
};
});
return { page, limit, total, results, stateCounts: Object.fromEntries(stateCounts), statuses: statuses.filter(Boolean).sort() };
const total = result?.total[0]?.count || 0;
const stateCounts = Object.fromEntries(Object.keys(STATE_FILTERS).map(key => [key, result?.[key][0]?.count || 0]));
return { page, limit, total, results, stateCounts, statuses: statuses.filter(Boolean).sort() };
}
+6 -4
View File
@@ -574,7 +574,6 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
],
"src/core/billing/report.ts": [
"<anonymous>",
"STATE_FILTERS",
"add",
"billingGrants",
"billingSummary",
@@ -582,6 +581,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"bucketFor",
"clearPriceCache",
"count",
"ends",
"fillSeries",
"grantFilter",
"missing",
@@ -589,20 +589,20 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"monthlyAmount",
"nextBucket",
"of",
"periodStart",
"planFamily",
"planRows",
"resolvePrices",
"revenueAvailable",
"roundMoney",
"rows",
"saleStages",
"sum",
"truncate",
"usable",
"word"
],
"build/core/billing/report.js": [
"<anonymous>",
"STATE_FILTERS",
"add",
"billingGrants",
"billingSummary",
@@ -610,6 +610,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"bucketFor",
"clearPriceCache",
"count",
"ends",
"fillSeries",
"grantFilter",
"missing",
@@ -617,15 +618,16 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"monthlyAmount",
"nextBucket",
"of",
"periodStart",
"planFamily",
"planRows",
"resolvePrices",
"revenueAvailable",
"roundMoney",
"rows",
"saleStages",
"sum",
"truncate",
"usable",
"word"
],
"src/core/billing/stripe.ts": [
+95 -17
View File
@@ -25,10 +25,46 @@ describe("admin billing report helpers", () => {
expect(report.monthlyAmount({ amount: 1200, interval: null, intervalCount: 1 }, "author_annual")).to.equal(100);
});
it("passes only plain words from the query string into the grant filter", () => {
const { filter, state } = report.grantFilter({ plan: { $ne: "x" }, status: "active", state: "revoked" });
expect(filter).to.deep.equal({ status: "active" });
const { grant, sale, state } = report.grantFilter({ plan: { $ne: "x" }, status: "active", state: "revoked", period: { $gt: "" } });
expect(grant).to.deep.equal({});
expect(sale).to.deep.equal({ status: "active" });
expect(state).to.deep.equal({ revoked: true });
expect(report.grantFilter({ plan: "repo_pack", status: "$where" }).filter).to.deep.equal({ _id: { $regex: "^cs_[^:]+:(repo_slot|author_pass|repo_extend)$" } });
expect(report.grantFilter({ plan: "repo_pack", status: "$where" }).sale).to.deep.equal({ $or: [{ plan: "repo_pack" }, { currentPlan: "repo_pack" }] });
const now = new Date("2026-11-16T15:00:00Z");
expect(report.grantFilter({ period: "7d" }, now).sale).to.deep.equal({ purchasedAt: { $gte: new Date("2026-11-10T00:00:00Z") } });
expect(report.grantFilter({ period: "1y" }, now).sale).to.deep.equal({});
});
it("draws N buckets for N days, ending with the current one", () => {
const now = new Date("2026-11-16T15:00:00Z"); // a Monday
const expected = { "7d": [7, "2026-11-10"], "30d": [30, "2026-10-18"], "90d": [90, "2026-08-19"], "12m": [52, "2025-11-24"] };
for (const [period, [buckets, first]] of Object.entries(expected)) {
const since = report.periodStart(period, now);
const series = report.fillSeries([], since, now, report.bucketFor(period), null);
expect(series, period).to.have.length(buckets);
expect(since.toISOString(), period).to.equal(first + "T00:00:00.000Z");
expect(series[0].date.getTime(), period).to.equal(since.getTime());
expect(series.at(-1).date.toISOString(), period).to.equal(report.truncate(now, report.bucketFor(period)).toISOString());
}
expect(report.periodStart("all", now)).to.equal(null);
const monthly = report.fillSeries([{ _id: { bucket: new Date("2025-09-01T00:00:00Z"), plan: "repo_slot" }, count: 1 }], null, now, "month", null);
expect(monthly.map(d => d.date.toISOString().slice(0, 7))).to.have.length(15).and.to.include.members(["2025-09", "2026-11"]);
});
it("adds each bucket's revenue per family and currency, and counts unknown prices", () => {
const now = new Date("2026-11-16T15:00:00Z");
const day = new Date("2026-11-15T00:00:00Z");
const prices = { p_eur: { amount: 500, currency: "eur" }, p_usd: { amount: 2000, currency: "usd" }, p_pack: { amount: 1500, currency: "eur" } };
const rows = [
{ _id: { bucket: day, plan: "author_monthly", priceId: "p_eur" }, count: 2 },
{ _id: { bucket: day, plan: "repo_pack", priceId: "p_pack" }, count: 1 },
{ _id: { bucket: day, plan: "repo_never", priceId: "p_usd" }, count: 1 },
{ _id: { bucket: day, plan: "conference", priceId: "p_gone" }, count: 1 },
];
const series = report.fillSeries(rows, report.periodStart("7d", now), now, "day", id => prices[id]);
const bucket = series.find(d => d.date.getTime() === day.getTime());
expect(bucket).to.include({ subscription: 2, repository: 2, conference: 1, missing: 1 });
expect(bucket.revenue).to.deep.equal({ subscription: { eur: 1000 }, repository: { eur: 1500, usd: 2000 }, conference: {} });
expect(report.fillSeries(rows, report.periodStart("7d", now), now, "day", null).find(d => d.date.getTime() === day.getTime()))
.to.deep.include({ missing: 0, revenue: { subscription: {}, repository: {}, conference: {} } });
});
it("mounts the billing routes behind the administrator check", () => {
const admin = require("../src/server/routes/admin").default;
@@ -73,7 +109,8 @@ const uri = process.env.BILLING_TEST_MONGODB_URI;
{ _id: "sub_m", owner: a, scope: `user:${a}`, planId: "author_monthly", subscriptionId: "sub_m", priceId: "price_monthly", salePriceId: "price_monthly", salePlanId: "author_monthly", status: "active", until: later(20), purchasedAt: ago(3) },
{ _id: "sub_y", owner: b, scope: `user:${b}`, planId: "author_annual", subscriptionId: "sub_y", priceId: "price_annual", salePriceId: "price_annual", salePlanId: "author_annual", status: "active", until: later(200), purchasedAt: ago(100), cancelAtPeriodEnd: true },
{ _id: "sub_old", owner: b, scope: `user:${b}`, planId: "author_monthly", subscriptionId: "sub_old", priceId: "price_monthly", salePriceId: "price_monthly", salePlanId: "author_monthly", status: "canceled", until: ago(40), purchasedAt: ago(400) },
...["repo_slot", "author_pass", "repo_extend"].map(part => ({ _id: `cs_pack:${part}`, owner: a, scope: "repo:paper-1", planId: part, paymentIntentId: "pi_pack", priceId: "price_pack", status: "paid", until: later(100), purchasedAt: ago(2) })),
...["repo_slot", "author_pass", "repo_extend"].map(part => ({ _id: `cs_pack:${part}`, owner: a, scope: "repo:paper-1", planId: part, paymentIntentId: "pi_pack", priceId: "price_pack", status: "paid",
until: { repo_slot: new Date("9999-12-31T00:00:00Z"), author_pass: later(178), repo_extend: later(363) }[part], purchasedAt: ago(2) })),
{ _id: "cs_never", owner: b, scope: "repo:other", planId: "repo_never", paymentIntentId: "pi_never", priceId: "price_never", status: "paid", until: new Date("9999-12-31T00:00:00Z"), purchasedAt: ago(5), revoked: true, revocationReason: "full_refund", revokedAt: ago(1) },
{ _id: "cs_conf", owner: a, scope: "conference:FSE26", planId: "conference", paymentIntentId: "pi_conf", priceId: "price_conf", status: "paid", until: later(60), purchasedAt: ago(10) },
{ _id: "cs_gone", owner: a, scope: "repo:paper-2", planId: "repo_extend", paymentIntentId: "pi_gone", priceId: "price_retired", status: "paid", until: later(10), purchasedAt: ago(1) },
@@ -96,10 +133,16 @@ const uri = process.env.BILLING_TEST_MONGODB_URI;
expect(pack).to.include({ active: 1, sales: 1, allTimeSales: 1 });
expect(pack.revenue).to.deep.equal({ eur: 1500 });
expect(s.plans.find(p => p.planId === "repo_slot").sales).to.equal(0);
expect(s.series).to.have.length(31);
expect(s.series).to.have.length(30);
const total = s.series.reduce((n, d) => n + d.subscription + d.repository + d.conference, 0);
expect(total).to.equal(5);
expect(s.series.reduce((n, d) => n + d.conference, 0)).to.equal(1);
// Per-bucket revenue adds up to the period revenue; the retired price is the one missing sale.
const revenue = {};
for (const d of s.series) for (const family of Object.values(d.revenue)) for (const [c, v] of Object.entries(family)) revenue[c] = (revenue[c] || 0) + v;
expect(revenue).to.deep.equal(s.sales.revenue);
expect(s.series.reduce((n, d) => n + d.missing, 0)).to.equal(1);
expect(s.series.find(d => d.repository === 1 && d.revenue.repository.eur).revenue.repository).to.deep.equal({ eur: 1500 });
// One Stripe call per distinct price, then the cache.
expect(lookups.sort()).to.deep.equal(["price_annual", "price_conf", "price_monthly", "price_never", "price_pack", "price_retired"]);
lookups = [];
@@ -193,31 +236,66 @@ const uri = process.env.BILLING_TEST_MONGODB_URI;
expect(s.plans.every(p => p.sales === 0 && p.active === 0)).to.equal(true);
});
it("filters, searches and paginates grants without exposing Stripe identifiers", async () => {
it("lists one row per sale, a paper pack included, without exposing Stripe identifiers", async () => {
const usernames = async ids => new Map((await User.find({ _id: { $in: ids } }).lean()).map(u => [String(u._id), u.username]));
const all = await report.billingGrants({ limit: 4 }, usernames, now);
expect(all.total).to.equal(9);
const all = await report.billingGrants({ limit: 4 }, usernames, now, lookup);
// 9 grants, 7 sales: the pack's three grants are one row.
expect(all.total).to.equal(7);
expect(all.results).to.have.length(4);
expect(all.stateCounts).to.deep.equal({ active: 7, expired: 1, revoked: 1 });
expect(all.stateCounts).to.deep.equal({ active: 5, expired: 1, revoked: 1 });
expect(JSON.stringify(all)).not.to.match(/sub_m|pi_|cus_|price_/);
expect(all.results[0]).to.include({ user: "alice-lab", planId: "repo_extend" });
const page3 = await report.billingGrants({ limit: 4, page: 3 }, usernames, now);
expect(page3.results).to.have.length(1);
const page2 = await report.billingGrants({ limit: 4, page: 2 }, usernames, now, lookup);
expect(page2.results).to.have.length(3);
const revoked = await report.billingGrants({ state: "revoked" }, usernames, now);
const revoked = await report.billingGrants({ state: "revoked" }, usernames, now, lookup);
expect(revoked.results).to.have.length(1);
expect(revoked.results[0]).to.include({ planId: "repo_never", never: true, until: null, revocationReason: "full_refund", user: "bob" });
expect(revoked.results[0].scope).to.deep.equal({ kind: "repo", id: "other" });
const pack = await report.billingGrants({ plan: "repo_pack" }, usernames, now);
expect(pack.results.map(r => r.pack)).to.deep.equal([true, true, true]);
const expired = await report.billingGrants({ state: "expired", status: "canceled" }, usernames, now);
const pack = await report.billingGrants({ plan: "repo_pack" }, usernames, now, lookup);
expect(pack.total).to.equal(1);
expect(pack.results[0]).to.include({ planId: "repo_pack", pack: true, family: "repository", never: true, until: null, state: "active" });
expect(pack.results[0].parts.map(p => [p.planId, p.never])).to.deep.equal([["repo_slot", true], ["author_pass", false], ["repo_extend", false]]);
expect(new Date(pack.results[0].parts[1].until).getTime()).to.equal(later(178).getTime());
// The parts are not sold separately.
expect((await report.billingGrants({ plan: "repo_slot" }, usernames, now, lookup)).total).to.equal(0);
const expired = await report.billingGrants({ state: "expired", status: "canceled" }, usernames, now, lookup);
expect(expired.results.map(r => r.planId)).to.deep.equal(["author_monthly"]);
const bobs = await report.billingGrants({ owners: [String(bob._id)], sort: "until", direction: "asc" }, usernames, now);
const bobs = await report.billingGrants({ owners: [String(bob._id)], sort: "until", direction: "asc" }, usernames, now, lookup);
expect(bobs.results.map(r => r.user)).to.deep.equal(["bob", "bob", "bob"]);
expect(bobs.results[0].scope.kind).to.equal("account");
});
it("shows each sale's list price, once per pack and per period for subscriptions", async () => {
const usernames = async () => new Map();
const { results } = await report.billingGrants({ limit: 100 }, usernames, now, lookup);
const byPlan = Object.fromEntries(results.filter(r => r.state !== "expired").map(r => [r.planId, r]));
expect(byPlan.repo_pack.amount).to.deep.equal({ value: 1500, currency: "eur", interval: null, intervalCount: 1 });
expect(byPlan.author_monthly.amount).to.deep.equal({ value: 500, currency: "eur", interval: "month", intervalCount: 1 });
expect(byPlan.author_annual.amount).to.include({ value: 4800, interval: "year" });
expect(byPlan.repo_never.amount).to.include({ value: 2000, currency: "usd" });
expect(byPlan.repo_extend).to.include({ amount: null, amountMissing: "unresolved" });
// Resolved once per distinct price, then cached.
expect(lookups.filter(id => id === "price_pack")).to.have.length(1);
config.STRIPE_SECRET_KEY = "";
const off = await report.billingGrants({ plan: "repo_pack" }, usernames, now, lookup);
expect(off.results[0]).to.include({ amount: null, amountMissing: "stripe_not_configured" });
});
it("reconciles the chart, the plans, the tile and the list for each period", async () => {
const usernames = async () => new Map();
for (const period of ["7d", "30d"]) {
const s = await report.billingSummary(period, now, lookup);
const chart = s.series.reduce((n, d) => n + d.subscription + d.repository + d.conference, 0);
const plans = s.plans.reduce((n, p) => n + p.sales, 0);
const list = await report.billingGrants({ period }, usernames, now, lookup);
expect([chart, plans, list.total], period).to.deep.equal([s.sales.count, s.sales.count, s.sales.count]);
expect(list.results.reduce((n, r) => n + (r.amount?.currency === "eur" ? r.amount.value : 0), 0), period).to.equal(s.sales.revenue.eur);
}
expect((await report.billingSummary("7d", now, lookup)).sales.count).to.equal(4);
});
it("serves the summary and the grant list through the admin router", async () => {
await BillingEvent.create([{ _id: "test:platform:evt_1", eventId: "evt_1", type: "invoice.paid", state: "failed", attempts: 12, lastError: "api_error:rate_limit", receivedAt: ago(1) },
{ _id: "test:platform:evt_2", eventId: "evt_2", type: "checkout.session.completed", state: "pending", receivedAt: new Date(now.getTime() - 120000) }]);
@@ -236,7 +314,7 @@ const uri = process.env.BILLING_TEST_MONGODB_URI;
expect(summary.body.webhooks.oldestPendingSeconds).to.be.at.least(119);
expect(summary.body.webhooks.lastError).to.include({ type: "invoice.paid", error: "api_error:rate_limit", state: "failed" });
const grants = await call("/grants", { search: "ALICE", limit: "100" });
expect(grants.body.total).to.equal(6);
expect(grants.body.total).to.equal(4);
expect(grants.body.results.every(r => r.user === "alice-lab")).to.equal(true);
const none = await call("/grants", { search: "nobody" });
expect(none.body.total).to.equal(0);
+20 -2
View File
@@ -1735,11 +1735,16 @@ describe("Vue 3 UI", function () {
const summary = (available) => ({ period: "30d", bucket: "day", subscriptions: { active: 3, monthly: 2, annual: 1, cancelling: 1, mrr: available ? { eur: 1400 } : {} },
sales: { count: 4, revenue: available ? { eur: 31300, usd: 2000 } : {} }, allTime: { count: 9, revenue: available ? { eur: 50000 } : {} },
reversals: { refunds: 1, disputes: 1, amount: {} }, plans,
series: [{ date: "2026-11-12T00:00:00.000Z", subscription: 1, repository: 2, conference: 0 }, { date: "2026-11-13T00:00:00.000Z", subscription: 0, repository: 0, conference: 1 }],
series: [{ date: "2026-11-12T00:00:00.000Z", subscription: 1, repository: 2, conference: 0, revenue: available ? { subscription: { eur: 500 }, repository: { eur: 800, usd: 2000 }, conference: {} } : { subscription: {}, repository: {}, conference: {} }, missing: 0 },
{ date: "2026-11-13T00:00:00.000Z", subscription: 0, repository: 0, conference: 1, revenue: { subscription: {}, repository: {}, conference: available ? { eur: 30000 } : {} }, missing: 0 }],
revenue: { available, reason: available ? null : "stripe_not_configured", missingSales: 0 },
webhooks: { pending: 1, failed: 2, oldestPendingSeconds: 90, lastError: { type: "invoice.paid", error: "api_error", receivedAt: new Date().toISOString() }, unreviewedRevocations: 1 } });
const grants = { total: 1, stateCounts: { active: 0, expired: 0, revoked: 1 }, statuses: ["paid"], results: [{ id: "a", user: "alice", planId: "repo_never", family: "repository",
status: "paid", state: "revoked", purchasedAt: "2026-11-01", until: null, never: true, revoked: true, revocationReason: "dispute", scope: { kind: "conference", id: "FSE26" } }] };
status: "paid", state: "revoked", purchasedAt: "2026-11-01", until: null, never: true, revoked: true, revocationReason: "dispute", scope: { kind: "conference", id: "FSE26" }, amount: null, amountMissing: "unresolved" },
{ id: "b", user: "bob", planId: "repo_pack", pack: true, family: "repository", parts: [{ planId: "repo_slot", until: null, never: true }, { planId: "author_pass", until: "2027-05-15T00:00:00.000Z", never: false }, { planId: "repo_extend", until: "2027-11-16T00:00:00.000Z", never: false }],
status: "paid", state: "active", purchasedAt: "2026-11-16", until: null, never: true, scope: { kind: "repo", id: "BioASQ-Cond-EDE1" }, amount: { value: 800, currency: "eur", interval: null, intervalCount: 1 } },
{ id: "c", user: "carol", planId: "author_monthly", family: "subscription", subscription: true, status: "active", state: "active", purchasedAt: "2026-11-15", until: "2026-12-15T00:00:00.000Z", cancelAtPeriodEnd: true,
scope: { kind: "account", id: null }, amount: { value: 500, currency: "eur", interval: "month", intervalCount: 1 } }] };
let available = true, incomplete = false;
const response = () => {
const value = summary(available);
@@ -1765,6 +1770,18 @@ describe("Vue 3 UI", function () {
expect(row.querySelector("a[href='/admin/users/alice']")).to.not.equal(null);
expect(row.querySelector("a[href='/conference/FSE26']")).to.not.equal(null);
expect(row.textContent).to.include("Disputed").and.to.include("Never ends");
expect(doc.querySelectorAll(".bl-grant-table thead th")).to.have.length(7);
expect(row.querySelector(".bl-amount").textContent.trim()).to.equal("—");
expect(row.querySelector(".bl-amount").getAttribute("title")).to.include("could not be looked up");
const [, pack, sub] = doc.querySelectorAll(".bl-grant-table tbody tr");
expect(pack.textContent).to.include("Paper pack").and.to.include("Repository, updates, +1 year").and.to.include("Updates until");
expect(pack.querySelector(".bl-amount").textContent).to.match(/€8/);
expect(sub.querySelector(".bl-amount").textContent).to.match(/€5 \/ month/);
expect(sub.textContent).to.include("Ends").and.to.include("Cancelling");
const tip = doc.querySelectorAll(".bl-col")[0].getAttribute("data-tip");
expect(tip).to.include("3 sales").and.to.include("Repository add-ons").and.to.match(/Total .*€13/).and.to.match(/\$20/);
expect(doc.querySelector(".ov-chart-legends").textContent).to.include("Repository add-ons").and.not.to.include("Repository purchases");
expect([...doc.querySelectorAll(".bl-family-row")].map(r => r.querySelector("th").textContent.trim())).to.deep.equal(["Subscriptions", "Repository add-ons", "Conferences"]);
expect(ui.requests.some(r => r.url.pathname === "/api/admin/billing/summary" && r.url.searchParams.get("period") === "30d")).to.equal(true);
incomplete = true;
[...doc.querySelectorAll(".bl-toolbar .seg-chip")].find(b => b.textContent.includes("90 days")).click();
@@ -1778,6 +1795,7 @@ describe("Vue 3 UI", function () {
expect(ui.requests.some(r => r.url.searchParams.get("period") === "7d")).to.equal(true);
expect(doc.querySelector(".billing-page").textContent).to.include("Revenue unavailable");
expect(doc.querySelectorAll(".bl-kpi-row .ov-kpi-card")[1].textContent).to.include("Unavailable");
expect(doc.querySelectorAll(".bl-col")[0].getAttribute("data-tip")).to.include("Revenue unavailable").and.not.to.include("€");
expect(ui.errors).to.deep.equal([]);
});