Merge remote-tracking branch 'origin/main' into feat/viewer-toc-pr-layout

# Conflicts:
#	public/asset-manifest.json
#	public/css/all.min.css
#	public/css/style.css
#	public/script/vendor.min.js
#	test/vue-ui.test.js
This commit is contained in:
Thomas Durieux committed 2026-11-29 12:34:42 +00:00
commit 85422b897a
53 files changed
+2184 -316

No files matched your search

+2 -2
View File
@@ -42,7 +42,7 @@ if service == "mongodb" {
if includes(["quota_denied", "deployment", "account_removed", "application_log", "billing_maintenance_failed", "billing_reconciliation_deferred", "billing_requires_attention", "billing_worker_failed", "blob_api_failed_falling_back_to_raw_url", "branch_not_found", "cache_removal_failed", "cache_removed", "checking_repository_status_and_unused_repositories", "cleared_lock_for_active_job", "conference_expire_failed", "content_expiration_failed", "daily_stats_snapshot_failed", "daily_stats_snapshot_stored", "download_completed", "download_start", "downloaded", "downloadfile_failed", "downloading_file", "downloading_gist", "downloading_pull_request", "downloading_via_raw_url_lfs", "duplicate_stripe_customer_requires_review", "ensuretodaysnapshot_failed", "error_log_redis_connect_failed", "expired_repository_cleanup_failed", "failed_removal_recovery_failed", "failed_to_persist_error_status", "failed_to_record_repository_removal_error", "gettoken", "github_primary_rate_limit_hit", "github_secondary_rate_limit_hit", "grant_revocation_failed", "initial_repository_status_check_failed", "job_completed", "job_failed", "job_stalled", "job_started", "lastusedat_update_failed", "login_token_failed", "login_token_req_login_failed", "logout_after_account_removal_failed", "logout_failed", "lookup_failed", "markerrorifinflight_failed", "markerrorifremoving_failed", "metadata_cleanup_complete", "metadata_cleanup_deferred", "owner_access_alert_reset_unavailable", "owner_access_email_accepted", "owner_access_email_audit_unavailable", "owner_access_email_claim_cleanup_unavailable", "owner_access_email_deferred_recovery_unavailable", "owner_access_email_delivery_failed", "owner_access_email_preparation_cleanup_unavailable", "owner_access_email_recovery_recorded", "owner_access_email_recovery_unavailable", "owner_access_email_result_reconciliation_required", "owner_access_email_unavailable", "pr_comments_404_continuing_without_them", "process_fatal_error", "process_heartbeat", "process_started", "progress", "queue_heartbeat", "queued_for_download", "rate_limit_gate_active_delaying_job_before_work", "rate_limit_gate_set", "rate_limited_delaying_job", "recover_failed", "recovered_expired_repository_cleanup", "recovered_file_from_truncated_tree", "recovered_file_invalidation_failed", "recovered_stuck_repo", "recoverstuckpreparing_failed", "recoverstuckremoving_failed", "redis_client_error", "redis_rate_limit_gate_written", "rejected_upstream_download_destination", "removal_failed", "removal_recovery_failed", "removecache_save_failed", "removed_cache_for_unused_repository", "removing_cache", "removing_repository", "repo_claimed", "repository_cache_removal_failed", "repository_expiration_failed", "repository_expired", "repository_removal_failed", "repository_removed", "request_cancelled", "request_completed", "request_slow", "requeued_failed_removal", "requeued_interrupted_removal", "reset", "retired_tree_cleanup_deferred", "retired_tree_cleanup_failed", "running_daily_stats_snapshot", "s3_body_stream_error", "send_failed", "server_started", "source_stream_failed_cache_write_discarded", "staged_tree_cleanup_failed", "staged_tree_completion_deferred", "streamer_fetch_failed", "streamer_started", "streamer_startup_failed", "streamer_zip_fetch_failed", "temporary_storage_cleanup_deferred", "token_refresh_failed_backing_off", "up_to_date", "update_queued", "verify_failed", "waiting_for_rate_limit_gate", "webhook_log", "webhook_processing_failed", "write_failed", "zip_stream_failed"], record.event) { out.event = record.event }
if is_string(record.release) && match(string!(record.release), r'^[a-f0-9]{7,40}$') { out.release = record.release }
if is_string(record.instance) && match(string!(record.instance), r'^[a-f0-9-]{36}$') { out.instance = record.instance }
if includes(["repo_renamed", "preparation_interrupted", "commit_not_found", "zip_not_available", "ABORT_ERR", "ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "EPIPE", "ETIMEDOUT", "billing_address_missing", "billing_city_missing", "billing_country_missing", "billing_email_missing", "billing_missing", "billing_name_missing", "billing_zip_missing", "branch_not_found", "branch_not_specified", "cache_busy", "cache_miss", "cannot_coauthor_self", "commit_not_specified", "conf_end_date_invalid", "conf_end_date_missing", "conf_id_missing", "conf_id_used", "conf_name_missing", "conf_not_activated", "conf_not_found", "conf_start_date_invalid", "conf_start_date_missing", "conference_not_found", "connection_changed", "download_not_enabled", "expiration_limit_reached", "file_listing_too_large", "file_not_accessible", "file_not_found", "file_not_supported", "file_too_big", "folder_not_supported", "gistId_already_used", "gistId_not_specified", "gist_expired", "gist_not_found", "gist_not_ready", "github_app_access_required", "github_app_reconnect_required", "github_identity_mismatch", "github_rate_limit_exceeded", "github_token_invalid", "github_user_not_found", "invalid_commit_format", "invalid_cursor", "invalid_file_path", "invalid_gistId", "invalid_path", "invalid_plan", "invalid_preserve_files_format", "invalid_project_name", "invalid_pullRequestId", "invalid_repo", "invalid_repoId", "invalid_request", "invalid_settings", "invalid_signature", "invalid_sort", "invalid_status", "invalid_terms_format", "invalid_token_id", "invalid_token_options", "is_removed", "not_authorized", "not_connected", "options_not_provided", "page_not_activated", "page_not_supported_on_different_branch", "path_not_defined", "path_not_specified", "pullRequestId_already_used", "pullRequestId_is_not_a_number", "pullRequestId_not_specified", "pull_request_expired", "pull_request_not_found", "pull_request_not_ready", "token_refresh_failed", "anonymized_output_too_large", "anonymization_memory_budget_exceeded", "anonymization_queue_full", "anonymization_queue_timeout", "anonymization_cancelled", "anonymization_worker_exited", "anonymization_deadline_exceeded", "anonymization_spool_budget_exceeded", "anonymization_worker_failed", "anonymization_storage_full", "anonymization_io_failed", "zip_unsafe_entry_path", "quota_exceeded", "quota_repository_limit", "quota_storage_limit", "rate_limited", "readme_not_available", "repoId_already_used", "repoId_not_defined", "repoUrl_not_defined", "repo_access_limited", "repo_empty", "repo_not_accessible", "repo_not_found", "repo_saml_enforcement", "repository_archived", "repository_changed", "repository_expired", "repository_job_cancelled", "repository_not_found", "repository_not_ready", "repository_not_specified", "repository_tree_incomplete", "repository_tree_too_large", "s3_config_not_provided", "source_not_provided", "storage_delete_failed", "storage_write_size_mismatch", "submodule_not_available", "terms_not_specified", "token_expired", "token_limit_reached", "unable_to_connect_user", "unable_to_download", "upstream_error", "upstream_timeout", "user_not_found", "username_not_defined", "webhook_processing_failed"], record.errorCode) { out.errorCode = record.errorCode }
if includes(["repo_renamed", "preparation_interrupted", "commit_not_found", "zip_not_available", "ABORT_ERR", "ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "EPIPE", "ETIMEDOUT", "billing_address_missing", "billing_city_missing", "billing_country_missing", "billing_email_missing", "billing_missing", "billing_name_missing", "billing_zip_missing", "branch_not_found", "branch_not_specified", "cache_busy", "cache_miss", "cannot_coauthor_self", "commit_not_specified", "conf_end_date_invalid", "conf_end_date_missing", "conf_id_missing", "conf_id_used", "conf_name_missing", "conf_not_activated", "conf_not_found", "conf_start_date_invalid", "conf_start_date_missing", "conference_not_found", "connection_changed", "download_not_enabled", "expiration_limit_reached", "file_listing_too_large", "file_not_accessible", "file_not_found", "file_not_supported", "file_too_big", "folder_not_supported", "gistId_already_used", "gistId_not_specified", "gist_expired", "gist_not_found", "gist_not_ready", "github_app_access_required", "github_app_reconnect_required", "github_identity_mismatch", "github_rate_limit_exceeded", "github_token_invalid", "github_user_not_found", "invalid_commit_format", "invalid_cursor", "invalid_file_path", "invalid_gistId", "invalid_path", "invalid_plan", "invalid_preserve_files_format", "invalid_project_name", "invalid_pullRequestId", "invalid_repo", "invalid_repoId", "invalid_request", "invalid_settings", "invalid_signature", "invalid_sort", "invalid_status", "invalid_terms_format", "invalid_token_id", "invalid_token_options", "is_removed", "not_authorized", "not_connected", "options_not_provided", "page_not_activated", "page_not_supported_on_different_branch", "path_not_defined", "path_not_specified", "pullRequestId_already_used", "pullRequestId_is_not_a_number", "pullRequestId_not_specified", "pull_request_expired", "pull_request_not_found", "pull_request_not_ready", "token_refresh_failed", "anonymized_output_too_large", "anonymization_memory_budget_exceeded", "anonymization_queue_full", "anonymization_queue_timeout", "anonymization_cancelled", "anonymization_worker_exited", "anonymization_deadline_exceeded", "anonymization_spool_budget_exceeded", "anonymization_worker_failed", "anonymization_storage_full", "anonymization_io_failed", "zip_unsafe_entry_path", "quota_exceeded", "quota_repository_limit", "quota_storage_limit", "rate_limited", "readme_not_available", "repoId_already_used", "repoId_not_defined", "repoUrl_not_defined", "repo_access_limited", "repo_empty", "repo_not_accessible", "repo_not_found", "repo_saml_enforcement", "repository_archived", "repository_changed", "repository_expired", "repository_job_cancelled", "repository_not_found", "repository_not_ready", "repository_not_specified", "repository_tree_incomplete", "repository_tree_too_large", "s3_config_not_provided", "source_not_provided", "storage_delete_failed", "storage_write_size_mismatch", "submodule_not_available", "terms_not_specified", "token_expired", "token_limit_reached", "unable_to_connect_user", "unable_to_download", "upstream_error", "upstream_timeout", "user_not_found", "username_not_defined", "webhook_processing_failed", "another_login_required", "billing_already_paid", "billing_busy", "billing_checkout_disabled", "billing_checkout_in_progress", "billing_customer_mismatch", "billing_draft_not_found", "billing_invalid_conference", "billing_invalid_draft", "billing_invalid_purchase", "billing_invalid_repository_size", "billing_invalid_review_window", "billing_plan_change_not_supported", "billing_plan_unavailable", "billing_price_misconfigured", "billing_recovery_required", "billing_review_window_locked", "billing_subscription_exists", "billing_unavailable", "conference_payment_required", "gist_not_available", "github_app_authorization_cancelled", "github_app_disabled", "github_app_permissions_invalid", "github_app_refresh_busy", "github_grant_revocation_failed", "github_oauth_required", "github_unavailable", "invalid_auth_state", "invalid_billing_expiration", "invalid_connection", "invalid_github_path", "not_owner", "oauth_resources_remaining", "pull_request_not_available", "repository_busy", "repository_not_accessible", "streamer_unreachable", "streamer_upstream_error", "subscription_required_for_never_expiration", "user_banned", "sync_failed", "streamer_route_not_found", "streamer_unexpected_response"], record.errorCode) { out.errorCode = record.errorCode }
if includes(["admin", "anonymized-file", "auth", "billing", "dailyStats", "file-tree", "fs", "gh-stream", "gist", "github", "github-app-webhook", "owner-notifications", "process", "pull-request", "queue", "queue:cache", "queue:download", "queue:remove", "repository", "repository-public", "requests", "route", "route:repo", "s3", "schedule", "server", "streamer", "temporary-storage", "token-auth", "user", "zip-stream"], record.module) { out.module = record.module }
if includes(["protocol", "credentials", "port", "host"], record.reason) { out.reason = record.reason }
if includes(["parse", "find_grant_owners", "reconcile_grant", "persist_installation_block", "reconcile_installation"], record.phase) { out.phase = record.phase }
@@ -81,7 +81,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-errors.ts":["<anonymous>","anonymizationErrorCode","data"],"build/core/anonymization-errors.js":["<anonymous>","anonymizationErrorCode","data"],"src/core/anonymization-pool.ts":["<anonymous>","anonymizeOLine 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","ownerGitHubAccessRequired","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"build/core/GitHubUtils.js":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","ownerGitHubAccessRequired","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-errors.ts":["<anonymous>","anonymizationErrorCode","data"],"build/core/anonymization-errors.js":["<anonymous>","anonymizationErrorCode","data"],"srLine 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) }
+16 -2
View File
@@ -29,8 +29,22 @@ Configure:
- Allow installation on any account if this is a public service.
- Generate a private key and record the App ID, slug, client ID and client secret.
GitHub delivers installation, installation repository selection, and App user
revocation lifecycle events. The webhook verifies raw request bytes before parsing
Under **Permissions & events › Subscribe to events**, check **Repository**.
GitHub delivers installation, installation repository selection (`installation_repositories`),
and App user revocation (`github_app_authorization`) events to every App; the
**Repository** event (created, deleted, renamed, transferred, privatized,
publicized) is delivered only when subscribed.
The anonymize page's "Your repositories" picker reads a list stored in MongoDB
(`userrepositories`, with one `userrepositorysyncs` row per user and connection).
It calls GitHub only when the list is empty, when the user presses refresh, or
after an installation change marks it stale. These webhooks update the stored
lists in place: an uninstall or deselection removes the affected rows, a
suspension hides them, and renames, transfers and visibility changes rewrite
them. New repositories are added for the user named by the event; other users
of the same installation get a background sync, because only GitHub knows
whether they can see a newly added private repository. Legacy OAuth lists get
no webhooks and change only on refresh. The webhook verifies raw request bytes before parsing
JSON. Failed processing returns an error for operational visibility; use GitHub's
delivery redelivery controls after an outage. Pending installation checks also
retry on repository access. Access checks verify the user's current repository
+2 -2
View File
@@ -1,8 +1,8 @@
{
"core.min.js": "core.d23af1c652.min.js",
"vendor.min.js": "vendor.d309b9ae87.min.js",
"vendor.min.js": "vendor.375d384758.min.js",
"mermaid.min.js": "mermaid.a7356d5ed1.min.js",
"all.min.css": "all.581d0765db.min.css",
"all.min.css": "all.38119ba6ea.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
@@ -6,4 +6,4 @@
*/:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]){color:inherit;text-decoration:none}a:not([href]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.5rem;font-weight:500;line-height:1.2}.h1,h1{font-size:2.5rem}.h2,h2{font-size:2rem}.h3,h3{font-size:1.75rem}.h4,h4{font-size:1.5rem}.h5,h5{font-size:1.25rem}.h6,h6{font-size:1rem}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:6rem;font-weight:300;line-height:1.2}.display-2{font-size:5.5rem;font-weight:300;line-height:1.2}.display-3{font-size:4.5rem;font-weight:300;line-height:1.2}.display-4{font-size:3.5rem;font-weight:300;line-height:1.2}hr{margin-top:1rem;margin-bottom:1rem;border:0;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:400}.mark,mark{padding:.2em;background-color:#fcf8e3}.list-unsLine truncated
* Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{contentLine truncated
*/.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{contentLine truncated
+97
View File
@@ -13668,6 +13668,7 @@ input[type="date"].form-control { font-family: var(--font-sans) !important; font
.anonymize-page .anonymize-preview-col.reviewer-preview { border-left: 0; padding: 0 16px 20px !important; }
.reviewer-preview .rp-caption { padding: 14px 0 10px; flex-wrap: wrap; row-gap: 4px; }
.reviewer-preview .rp-open { display: none; }
.reviewer-preview .rp-open.rp-files { display: inline; }
.reviewer-preview .rp-window { margin: 0; border: 1px solid var(--rp-line); border-radius: 10px; min-height: 64vh; }
.reviewer-preview .rp-chrome { height: 30px; }
.reviewer-preview .rp-url { font-size: 11px; margin-left: 6px; }
@@ -15084,3 +15085,99 @@ body.dark-mode .reviewer-preview .rp-preserved-tag { background: rgba(251, 191,
@media (max-width: 767px) {
.gist-file-tools { width: 100%; margin-left: 0; justify-content: space-between; }
}
/* ===== Round 19: workspace polish ===== */
/* R19.1 Lists keep their tab bar while they load. The first load holds the tab
row with placeholders; a reload keeps the tabs, counts and current rows,
dimmed after a short delay so a fast answer does not flicker. */
.paper-page .dashboard-meta.dashboard-meta { min-height: 41px; }
.dashboard-meta.is-loading .dashboard-view-tabs { align-items: center; min-height: 40px; }
.dashboard-meta.is-loading .dashboard-tab-skeleton { height: 10px; margin: 0; }
.paper-table.is-refreshing > :not(.paper-table-head, .paper-table-skeleton) { opacity: .55; transition: opacity .15s ease .2s; pointer-events: none; }
.paper-table.is-refreshing > .paper-table-skeleton { animation: list-skeleton-in .15s ease .2s both; }
@keyframes list-skeleton-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .paper-table.is-refreshing > * { transition: none !important; } }
/* Phone rows label their cells ("views", "Expires"); placeholder rows have nothing to label. */
@media (max-width: 767px) {
.paper-table-dashboard .paper-table-skeleton .cell-views.num::after,
.paper-table-dashboard .paper-table-skeleton .cell-expires > span::before { content: none !important; }
}
/* R19.2 Repository picker footer: one row, the access link on the left and a
compact pager on the right. Previous only exists after page 1; the pager
buttons are quiet icon buttons, so a disabled one is just muted. */
.repo-picker-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; min-height: 52px; padding: 8px 10px 8px 16px; border-top: 1px solid var(--border-color); }
.repo-picker-foot .repo-picker-access { margin: 0; padding: 0; }
.repo-picker-foot .repo-picker-pagination { display: flex; align-items: center; gap: 2px; margin-left: auto; padding: 0; border-top: 0; }
.repo-picker-foot .repo-picker-count { padding: 0 6px; }
.repo-picker-page { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--ink-soft, var(--ink-muted)); font: 500 13px/1 var(--font-sans); cursor: pointer; }
.repo-picker-page .ui-icon { width: 16px; height: 16px; }
.repo-picker-page:hover:not(:disabled) { background: var(--hover-bg-color); color: var(--color); }
.repo-picker-page:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.repo-picker-page:disabled { color: var(--ink-faint, var(--ink-muted)); opacity: .6; cursor: default; }
.repo-picker-page.has-label { padding: 0 4px 0 10px; color: var(--accent); }
@media (max-width: 767px) {
/* Phones keep one row: the question over its link on the left, the pager on the right. */
.repo-picker-foot { flex-wrap: nowrap; padding: 6px 4px 6px 16px; }
.repo-picker-foot .repo-picker-access { flex-direction: column; align-items: flex-start; gap: 0; min-width: 0; line-height: 1.4; }
.repo-picker-foot .repo-picker-access .connection-link { min-height: 32px; }
.repo-picker-foot .repo-picker-count { padding: 0 2px; white-space: nowrap; }
.repo-picker-page { min-width: 44px; height: 44px; }
}
/* R19.3 Preview caption: the title stands alone and the redaction status is a
chip beside it. From 992px the tree is always beside the document; narrower
windows open it from the window's own Files button, or from the caption's
when no file is shown. */
.reviewer-preview button.rp-status-empty { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; box-shadow: inset 0 0 0 1px var(--rp-line); color: var(--ink-soft, var(--ink-muted)); font: 400 12.5px/1 var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer; }
.reviewer-preview button.rp-status-empty .rp-status-action { color: var(--accent); font-weight: 500; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.reviewer-preview button.rp-status-empty:hover .rp-status-action { text-decoration-color: currentColor; }
.reviewer-preview button.rp-status-empty:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* R19.4 / R20 Expiration: one column under each option. The dated option names
the date ("Expire on Apr 29, 2027"); below it a muted line gives the
distance, the reason and "Change date". The date and "After expiry" rows
share one label column, and the hint under "Never expire" sits on the same
text edge as the dated option's lines. */
.anonymize-page .dated-options { padding: 0 0 12px 26px; margin-top: -8px; }
.anonymize-page .expiration-choice-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.anonymize-page .expiration-choice-row > .expiration-choice { flex: 1 1 auto; min-width: 0; }
.anonymize-page .expiration-choice-row > .expiry-change { flex: none; margin-top: 12px; }
.anonymize-page .expiry-meta { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.anonymize-page .expiry-meta-sep { color: var(--ink-faint, var(--ink-muted)); }
.anonymize-page .expiry-meta-note { white-space: nowrap; }
.anonymize-page .expiry-change { padding: 0; border: 0; background: none; font: 500 13px/21px var(--font-sans); color: var(--accent); cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.anonymize-page .expiry-change:hover { text-decoration-color: currentColor; }
.anonymize-page .expiry-change:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.anonymize-page .dated-options .hosting-date,
.anonymize-page .dated-options .hosting-property { grid-template-columns: 84px minmax(0, 1fr); gap: 4px 12px; }
.anonymize-page .dated-options .hosting-date { margin-bottom: 10px; }
.anonymize-page .dated-options .hosting-date .date-echo { grid-column: 2; margin-top: 0; }
.anonymize-page .dated-options .hosting-property label,
.anonymize-page .dated-options .hosting-date .paper-field-label { color: var(--ink-soft, var(--ink-muted)); }
@media (max-width: 767px) { .anonymize-page .expiration-choice-row > .expiry-change { min-height: 44px; margin-top: 0; } }
/* Below 992px the file tree sits off-screen. With no file shown (no README,
loading, error) the window has no Files button, so the caption carries one. */
@media (min-width: 992px) { .reviewer-preview .rp-open.rp-files { display: none; } }
/* Picker header: saved-list age under the title, refresh beside the search (same outlined icon button as Refresh branches). */
.repo-picker-tools { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; max-width: 60%; }
.repo-picker-tools .repo-picker-filter.form-control { flex: 0 1 220px; min-width: 0; max-width: none; }
.anonymize-page .btn.btn-icon.repo-picker-refresh { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; border: 1px solid #CFC7B9; border-radius: var(--radius-control); background: var(--paper-card); color: var(--ink-muted); box-shadow: none; }
.anonymize-page .btn.btn-icon.repo-picker-refresh:hover:not(:disabled) { color: var(--color); background: var(--hover-bg-color); }
/* Busy is aria-busy, not disabled: the button keeps its idle look while the icon turns; extra clicks are ignored. */
.anonymize-page .btn.btn-icon.repo-picker-refresh.is-busy { cursor: progress; }
.dark-mode .anonymize-page .btn.btn-icon.repo-picker-refresh { border-color: #48433C; }
.repo-picker-refresh .ui-icon { width: 16px; height: 16px; }
@keyframes repo-picker-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) { .repo-picker-refresh.is-busy .ui-icon { animation: repo-picker-turn 1s linear infinite; } }
@media (max-width: 767px) {
.repo-picker-tools .repo-picker-filter.form-control { flex-basis: 150px; }
/* Same 36px height as the search field; the touch target extends to 44px. */
.anonymize-page .btn.btn-icon.repo-picker-refresh { position: relative; width: 36px; min-width: 36px; height: 36px; min-height: 36px; }
.anonymize-page .btn.btn-icon.repo-picker-refresh::after { content: ""; position: absolute; inset: -4px; }
}
@media (max-width: 480px) {
.repo-picker-tools { flex: 1 1 100%; max-width: 100%; }
.repo-picker-tools .repo-picker-filter.form-control { flex: 1 1 auto; }
}
+5
View File
@@ -9,6 +9,7 @@
},
"ERRORS": {
"cache_busy": "Downloads are busy. Please try again shortly.",
"cache_miss": "This file is not cached yet. Please try again.",
"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.",
@@ -143,6 +144,10 @@
"storage_write_size_mismatch": "The downloaded file was smaller than expected. The upstream source may have returned an incomplete response — please try again.",
"storage_read_error": "An error occurred while reading the file from storage — please try again.",
"upstream_error": "A temporary error occurred while fetching from GitHub — please try again.",
"streamer_upstream_error": "The file server received an unexpected response — please try again.",
"streamer_unreachable": "The file server is temporarily unreachable — please try again.",
"streamer_unexpected_response": "The file server received an unexpected response — please try again.",
"streamer_route_not_found": "The file server could not handle this request — please try again later.",
"token_expired": "The repository owner needs to renew their GitHub connection before this content can be loaded.",
"job_is_active": "This job is currently running — wait for it to finish or remove it first.",
"github_app_access_required": "Allow this repository on GitHub using the read-only access button, then retry. Organization access may require administrator approval.",
+4 -2
View File
@@ -55,7 +55,7 @@
</div>
</form>
<div class="paper-table paper-table-conferences w-100" role="table" aria-label="Conferences">
<div class="paper-table paper-table-conferences w-100" role="table" aria-label="Conferences" :aria-busy="listLoading ? 'true' : 'false'" :class="{ 'is-refreshing': listLoading &amp;&amp; listLoaded }">
<div class="paper-table-head" role="row" v-if="total !== 0">
<div role="columnheader"><button type="button" class="sortable" :class="{active: query?.sort == &#x27;name&#x27;}" @click="sortBy(&#x27;name&#x27;)">Conference <svg class="ui-icon sort-direction" aria-hidden="true" v-if="sortIcon(&#x27;name&#x27;)" :class="{ascending: sortIcon(&#x27;name&#x27;) === 'fa-arrow-up'}"><use href="#project-icon-arrow"></use></svg></button></div>
<div role="columnheader"><button type="button" class="sortable" :class="{active: query?.sort == &#x27;status&#x27;}" @click="sortBy(&#x27;status&#x27;)">Status <svg class="ui-icon sort-direction" aria-hidden="true" v-if="sortIcon(&#x27;status&#x27;)" :class="{ascending: sortIcon(&#x27;status&#x27;) === 'fa-arrow-up'}"><use href="#project-icon-arrow"></use></svg></button></div>
@@ -96,7 +96,9 @@
</div>
</div>
</div>
<div class="paper-table-empty" v-if="filteredConferences?.length == 0">
<!-- Placeholder rows until the first page arrives, and while a reload has none of the new rows yet -->
<template v-for="i in [1, 2, 3, 4]" :key="'skeleton-' + i"><div class="paper-table-row paper-table-skeleton" role="row" aria-hidden="true" v-if="!listLoaded || (listLoading &amp;&amp; filteredConferences?.length == 0)"><div class="cell-anon" role="cell"><div class="anon-text"><span class="skeleton skeleton-line" style="width: 42%"></span><span class="skeleton skeleton-line skeleton-line-sm" style="width: 64%"></span></div></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"></div></div></template>
<div class="paper-table-empty" v-if="listLoaded &amp;&amp; !listLoading &amp;&amp; filteredConferences?.length == 0">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-inbox"></use></svg>
<span>{{ total ? 'No conferences match the current filters.' : 'No conferences yet.' }}</span>
</div>
+4 -2
View File
@@ -67,7 +67,7 @@
<button class="btn btn-sm" type="button" @click="clearSelection()">Clear</button>
</div>
<div class="paper-table paper-table-repos has-bulk w-100" role="table" aria-label="Repositories">
<div class="paper-table paper-table-repos has-bulk w-100" role="table" aria-label="Repositories" :aria-busy="listLoading ? 'true' : 'false'" :class="{ 'is-refreshing': listLoading &amp;&amp; listLoaded }">
<div class="paper-table-head" role="row">
<div role="columnheader" style="width: 28px;">
<input type="checkbox" aria-label="Select all on page" @click="selectAllOnPage()" :checked="allSelected">
@@ -121,7 +121,9 @@
</div>
</div>
</div>
<div class="paper-table-empty" v-if="filteredRepositories?.length == 0">
<!-- Placeholder rows until the first page arrives, and while a reload has none of the new rows yet -->
<template v-for="i in [1, 2, 3, 4]" :key="'skeleton-' + i"><div class="paper-table-row paper-table-skeleton" role="row" aria-hidden="true" v-if="!listLoaded || (listLoading &amp;&amp; filteredRepositories?.length == 0)"><div role="cell" style="width: 28px;"></div><div class="cell-anon" role="cell"><div class="anon-text"><span class="skeleton skeleton-line" style="width: 42%"></span><span class="skeleton skeleton-line skeleton-line-sm" style="width: 64%"></span></div></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"></div></div></template>
<div class="paper-table-empty" v-if="listLoaded &amp;&amp; !listLoading &amp;&amp; filteredRepositories?.length == 0">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-inbox"></use></svg>
<span>No repositories match the current filters.</span>
<button type="button" class="btn btn-sm btn-outline-ink" v-if="!(query.ready &amp;&amp; query.expired &amp;&amp; query.removed &amp;&amp; query.error &amp;&amp; query.preparing)" @click="showAllStatuses()">Show all statuses</button>
+4 -2
View File
@@ -62,7 +62,7 @@
<button class="btn btn-sm" type="button" @click="selected = {}; allSelected = false">Clear</button>
</div>
<div class="paper-table w-100" role="table" aria-label="Users" style="--cols: 28px minmax(280px, 2.4fr) 100px 140px 140px 52px;">
<div class="paper-table w-100" role="table" aria-label="Users" :aria-busy="listLoading ? 'true' : 'false'" :class="{ 'is-refreshing': listLoading &amp;&amp; listLoaded }" style="--cols: 28px minmax(280px, 2.4fr) 100px 140px 140px 52px;">
<div class="paper-table-head admin-users-row" role="row">
<div role="columnheader" style="width: 28px;">
<input type="checkbox" aria-label="Select all on page" @click="selectAllOnPage()" :checked="allSelected">
@@ -113,7 +113,9 @@
</div>
</div>
</div>
<div class="paper-table-empty" v-if="filteredUsers?.length == 0">
<!-- Placeholder rows until the first page arrives, and while a reload has none of the new rows yet -->
<template v-for="i in [1, 2, 3, 4]" :key="'skeleton-' + i"><div class="paper-table-row paper-table-skeleton" role="row" aria-hidden="true" v-if="!listLoaded || (listLoading &amp;&amp; filteredUsers?.length == 0)"><div role="cell" style="width: 28px;"></div><div class="cell-anon" role="cell"><div class="anon-text"><span class="skeleton skeleton-line" style="width: 42%"></span><span class="skeleton skeleton-line skeleton-line-sm" style="width: 64%"></span></div></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div><div role="cell"></div></div></template>
<div class="paper-table-empty" v-if="listLoaded &amp;&amp; !listLoading &amp;&amp; filteredUsers?.length == 0">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-inbox"></use></svg>
<span>No users match the current filters.</span>
</div>
+36 -20
View File
@@ -40,8 +40,14 @@
<div class="repo-picker-title">
<h2 id="repo-picker-title">Your repositories</h2>
<span class="repo-picker-count" role="status" v-if="userReposStatus === 'loading'">{{ userRepoFilter.trim() ? 'Searching repositories…' : 'Loading repositories…' }}</span>
<span class="repo-picker-count repo-picker-updated" role="status" v-else-if="userReposStatus === 'ready' &amp;&amp; userReposUpdatedLabel()" :title="userReposUpdatedTitle()">{{ userReposUpdatedLabel() }}</span>
</div>
<div class="repo-picker-tools">
<input type="search" class="form-control repo-picker-filter" placeholder="Search repositories…" aria-label="Search your repositories" autocomplete="off" maxlength="200" v-model="userRepoFilter">
<button type="button" class="btn btn-icon repo-picker-refresh" v-if="userReposStatus === 'ready'" :class="{ 'is-busy': userReposSyncing }" :aria-busy="userReposSyncing ? 'true' : null" @click="refreshUserRepos()" :title="userReposWebhooks ? 'Refresh from GitHub' : 'Refresh from GitHub to see new repositories'" aria-label="Refresh your repositories from GitHub">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-refresh"></use></svg>
</button>
</div>
<input type="search" class="form-control repo-picker-filter" placeholder="Search repositories…" aria-label="Search your repositories" autocomplete="off" maxlength="200" v-model="userRepoFilter">
</div>
<ul class="repo-picker-list" v-if="userReposStatus === 'loading' || userReposStatus === 'idle'" aria-busy="true" aria-label="Loading your repositories">
<template v-for="(i, index) in [1, 2, 3, 4]"><li class="repo-picker-row is-skeleton" aria-hidden="true"><span class="skeleton skeleton-line" :style="{ width: (34 + i * 9) + '%' }"></span></li></template>
@@ -49,7 +55,7 @@
<ul class="repo-picker-list" v-if="userReposStatus === 'ready' &amp;&amp; userRepos.length &gt; 0">
<template v-for="(repo, index) in userRepos" :key="repo.id || repo.fullName"><li class="repo-picker-row">
<svg class="project-type-svg" aria-hidden="true"><use href="#project-type-repo"></use></svg>
<span class="repo-picker-name" :title="repo.fullName"><span class="repo-picker-owner">{{ repo.fullName.split('/')[0] }}<span class="repo-picker-slash">/</span></span><span class="repo-picker-repo">{{ repo.fullName.split('/').slice(1).join('/') }}</span></span>
<span class="repo-picker-name" @mouseenter="titleIfTruncated($event, repo.fullName)"><span class="repo-picker-owner">{{ repo.fullName.split('/')[0] }}<span class="repo-picker-slash">/</span></span><span class="repo-picker-repo">{{ repo.fullName.split('/').slice(1).join('/') }}</span></span>
<button type="button" class="btn btn-outline-ink btn-sm repo-picker-select" @click="selectUserRepo(repo)" :aria-label="'Select ' + repo.fullName">Select</button>
</li></template>
</ul>
@@ -57,12 +63,15 @@
<p class="repo-picker-state" role="status" v-if="userReposStatus === 'ready' &amp;&amp; userRepos.length === 0 &amp;&amp; userRepoFilter.trim()">{{ userRepoNext !== null ? 'No matches yet. Continue searching the remaining repositories.' : userRepoPage > 1 ? 'No more matching repositories.' : 'No matching repositories found.' }}</p>
<p class="repo-picker-state" v-if="userReposStatus === 'ready' &amp;&amp; userRepos.length === 0 &amp;&amp; !userRepoFilter.trim()">No repositories found. Paste a URL above, or grant access below.</p>
<p class="repo-picker-state" role="alert" v-if="userReposStatus === 'error'">Your repositories could not be loaded. <button type="button" class="task-text-button" @click="loadUserRepos()">Try again</button></p>
<nav class="repo-picker-pagination" aria-label="Repository pages" v-if="userRepoPage &gt; 1 || userRepoNext !== null">
<button type="button" class="btn btn-outline-ink btn-sm" :disabled="userRepoPage === 1 || userReposStatus === 'loading'" @click="changeUserRepoPage(-1)">Previous</button>
<span class="repo-picker-count" role="status">Page {{ userRepoPage }}</span>
<button type="button" class="btn btn-outline-ink btn-sm" :disabled="userRepoNext === null || userReposStatus !== 'ready'" @click="changeUserRepoPage(1)">{{ userRepoFilter.trim() &amp;&amp; !userRepos.length ? 'Continue search' : 'Next' }}</button>
</nav>
<p class="repo-picker-access" v-if="!sourceUrl &amp;&amp; githubConnections?.appEnabled &amp;&amp; githubConnections.appConnected &amp;&amp; userReposStatus === 'ready'">Don&rsquo;t see your repository? <button type="button" class="connection-link" v-if="githubConnection !== 'oauth'" @click="grantGitHubAccess()">Manage GitHub access <svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-external-link"></use></svg></button><a class="connection-link" href="/connections" v-else>Manage GitHub access <svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-external-link"></use></svg></a></p>
<!-- Footer: the access link on the left, a compact pager on the right -->
<div class="repo-picker-foot" v-if="(userRepoPage &gt; 1 || userRepoNext !== null) || (!sourceUrl &amp;&amp; githubConnections?.appEnabled &amp;&amp; githubConnections.appConnected &amp;&amp; userReposStatus === 'ready')">
<p class="repo-picker-access" v-if="!sourceUrl &amp;&amp; githubConnections?.appEnabled &amp;&amp; githubConnections.appConnected &amp;&amp; userReposStatus === 'ready'">Don&rsquo;t see your repository? <button type="button" class="connection-link" v-if="githubConnection !== 'oauth'" @click="grantGitHubAccess()">Manage GitHub access <svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-external-link"></use></svg></button><a class="connection-link" href="/connections" v-else>Manage GitHub access <svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-external-link"></use></svg></a></p>
<nav class="repo-picker-pagination" aria-label="Repository pages" v-if="userRepoPage &gt; 1 || userRepoNext !== null">
<button type="button" class="repo-picker-page" v-if="userRepoPage &gt; 1" :disabled="userReposStatus === 'loading'" @click="changeUserRepoPage(-1)" aria-label="Previous page" title="Previous page"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chevron-left"></use></svg></button>
<span class="repo-picker-count" role="status">Page {{ userRepoPage }}</span>
<button type="button" class="repo-picker-page" :class="{ 'has-label': userRepoFilter.trim() &amp;&amp; !userRepos.length }" :disabled="userRepoNext === null || userReposStatus !== 'ready'" @click="changeUserRepoPage(1)" :aria-label="userRepoFilter.trim() &amp;&amp; !userRepos.length ? 'Continue search' : 'Next page'" :title="userRepoFilter.trim() &amp;&amp; !userRepos.length ? null : 'Next page'"><span v-if="userRepoFilter.trim() &amp;&amp; !userRepos.length">Continue search</span><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chevron-right"></use></svg></button>
</nav>
</div>
</section>
</div>
@@ -427,17 +436,23 @@
<h4 class="hosting-subhead" v-if="hostingNeedsPayment() &amp;&amp; !billingPending">Expiration</h4>
<fieldset class="expiration-choices">
<legend class="sr-only">Expiration</legend>
<label class="expiration-choice"><input type="radio" name="expiration-choice" :checked="options.expirationMode !== 'never'" @change="useDatedHosting()" :disabled="billingPending"><span>Expire on a date</span></label>
<div class="dated-options" v-if="options.expirationMode !== 'never'">
<div class="hosting-date" v-if="options?.expirationMode !== 'never'">
<label class="paper-field-label" for="expirationDate">Expires</label>
<input class="form-control" type="date" name="expirationDate" id="expirationDate" required v-field="{ state: viewState, set: value =&gt; { options.expirationDate = value }, value: options?.expirationDate, form: &quot;anonymize&quot;, options: {} }" :class="{&#x27;is-invalid&#x27;: anonymize?.expirationDate?.invalid}" :min="(minExpirationDate)" :max="(maxExpirationDate)">
<p class="date-echo" aria-live="polite" v-if="fmt?.dateEcho(options?.expirationDate)">Expires {{ fmt?.dateEcho(options?.expirationDate) }}</p>
<div class="invalid-feedback" v-show="anonymize?.expirationDate?.errors?.min">Pick a date in the future.</div>
<div class="invalid-feedback" v-show="anonymize?.expirationDate?.errors?.max">Pick a date on or before {{ fmt?.date(maxExpirationDate) }}.</div>
<div class="invalid-feedback" v-show="anonymize?.expirationDate?.errors?.required || anonymize?.expirationDate?.errors?.date">Enter a valid expiration date.</div>
<!-- Under a plan limit the option names the date ("Expire on Apr 29, 2027"); a muted line says why, and "Change date" reveals the bounded input -->
<div class="expiration-choice-row">
<label class="expiration-choice"><input type="radio" name="expiration-choice" :checked="options.expirationMode !== 'never'" @change="useDatedHosting()" :disabled="billingPending"><span>{{ expiryChoiceLabel() }}</span></label>
<button type="button" class="expiry-change" v-if="options.expirationMode !== 'never' &amp;&amp; !expiryPickerShown()" @click="openExpiryPicker()">Change date</button>
</div>
<div class="hosting-property"><label for="expiration">Then</label><select id="expiration" class="form-control" v-model="options.expirationMode"><option value="remove">Remove content</option><option value="redirect">Redirect to GitHub</option></select></div>
<div class="dated-options" v-if="options.expirationMode !== 'never'">
<p class="expiry-meta" aria-live="polite" v-if="expiryCapped() &amp;&amp; expiryChoiceLabel() !== 'Expire on a date'">{{ expiryRelative() }}<template v-if="expiryNote()"><span class="expiry-meta-sep" aria-hidden="true"> · </span><span class="expiry-meta-note">{{ expiryNote() }}</span></template></p>
<!-- One date input in every mode (the form keeps one field); under a plan limit it stays hidden until "Change date" or an invalid date -->
<div class="hosting-date" :class="{ 'is-capped': expiryCapped() }" v-show="expiryPickerShown()" @reveal="expiryPickerOpen = true">
<label class="paper-field-label" for="expirationDate">Date</label>
<input class="form-control" type="date" name="expirationDate" id="expirationDate" required v-field="{ state: viewState, set: value =&gt; { options.expirationDate = value }, value: options?.expirationDate, form: &quot;anonymize&quot;, options: {} }" :class="{&#x27;is-invalid&#x27;: anonymize?.expirationDate?.invalid}" :min="(minExpirationDate)" :max="(maxExpirationDate)">
<p class="date-echo" aria-live="polite" v-if="!expiryCapped() &amp;&amp; fmt?.dateEcho(options?.expirationDate)">{{ fmt?.dateEcho(options?.expirationDate) }}</p>
<div class="invalid-feedback" v-show="anonymize?.expirationDate?.errors?.min">Pick a date in the future.</div>
<div class="invalid-feedback" v-show="anonymize?.expirationDate?.errors?.max">Pick a date on or before {{ fmt?.date(maxExpirationDate) }}.</div>
<div class="invalid-feedback" v-show="anonymize?.expirationDate?.errors?.required || anonymize?.expirationDate?.errors?.date">Enter a valid expiration date.</div>
</div>
<div class="hosting-property"><label for="expiration">After expiry</label><select id="expiration" class="form-control" v-model="options.expirationMode"><option value="remove">Remove content</option><option value="redirect">Redirect to GitHub</option></select></div>
</div>
<label class="expiration-choice" v-if="detectedType === 'repo'"><input type="radio" name="expiration-choice" :checked="options.expirationMode === 'never'" @change="options.expirationMode = 'never'" :disabled="billingPending"><span>Never expire<small v-if="(options.expirationMode !== 'never' || hasAuthorHosting() || repositoryGrants('repo_never').length) &amp;&amp; !(hostingNeedsPayment() &amp;&amp; hostingOptionPlans().length)">{{ neverExpireTag() }}</small></span></label>
</fieldset>
@@ -523,10 +538,11 @@
<div id="workspace-preview" :role="mobileWorkspace ? 'tabpanel' : null" :aria-labelledby="mobileWorkspace ? 'workspace-preview-tab' : null" class="anonymize-preview-col reviewer-preview" v-if="detectedType">
<div class="rp-caption">
<span class="rp-title">What reviewers will see</span>
<button type="button" class="rp-open" v-if="detectedType === 'repo' &amp;&amp; details" @click="previewViewer.sidebarCollapsed = !previewViewer.sidebarCollapsed" :aria-expanded="!previewViewer.sidebarCollapsed" aria-controls="preview-file-tree">Files</button>
<button type="button" class="rp-open rp-files" v-if="detectedType === 'repo' &amp;&amp; details &amp;&amp; previewStatus !== 'ready'" @click="previewViewer.sidebarCollapsed = !previewViewer.sidebarCollapsed" :aria-expanded="!previewViewer.sidebarCollapsed" aria-controls="preview-file-tree">Files</button>
<span class="rp-count" v-if="previewStatus === 'ready' &amp;&amp; previewRedactions() &gt; 0" :title="previewRedactions() + ' redacted terms in this preview'"><span class="redact-slot" aria-hidden="true"><i>{{ previewRedactions() }}</i></span> redacted</span>
<span class="rp-count rp-count-none" v-else-if="previewStatus === 'ready' &amp;&amp; !String(terms || '').trim()">No terms yet</span>
<button type="button" class="rp-count rp-status-empty" v-else-if="previewStatus === 'ready' &amp;&amp; !String(terms || '').trim()" @click="focusTerms()">Nothing redacted yet: <span class="rp-status-action">add terms</span></button>
<button type="button" class="rp-count rp-count-none" v-else-if="previewStatus === 'ready' &amp;&amp; previewPreserved()" @click="openPreserveFiles()" title="Change it in Leave files unredacted">{{ previewName(previewFile ? previewFile.slice(previewFile.lastIndexOf('/') + 1) : readmeName()) }} left unredacted</button>
<span class="rp-count rp-count-none" v-else-if="previewStatus === 'ready'">{{ detectedType === 'repo' ? 'No terms found in this file' : 'No terms found' }}</span>
<span class="rp-spacer"></span>
<a class="rp-open is-external" v-if="isUpdate &amp;&amp; previewUrl()" :href="safeUrl(previewPath())" target="_blank" rel="noopener">Open reviewer page <span aria-hidden="true">↗</span></a>
<button type="button" class="rp-open is-toggle" v-else @click="previewExpanded = !previewExpanded" :aria-pressed="!!previewExpanded"><svg class="rp-open-icon" viewBox="0 0 16 16" aria-hidden="true"><path v-if="!previewExpanded" d="M9.5 2.5h4v4M13.5 2.5 9 7M6.5 13.5h-4v-4M2.5 13.5 7 9"/><path v-else d="M13.5 6.5h-4v-4M9.5 6.5 14 2M2.5 9.5h4v4M6.5 9.5 2 14"/></svg>{{ previewExpanded ? 'Back to settings' : 'Expand preview' }}</button>
+10 -3
View File
@@ -47,7 +47,7 @@
<button type="button" v-if="confCount('attention') &gt; 0 || confView() === 'attention'" :aria-pressed="confView() === 'attention'" @click="setConfView('attention')" :aria-label="'Needs attention ' + confCount('attention')"><span class="dashboard-attention-prefix">Needs </span><span>attention</span> <span class="attention-count" :class="{'has-attention': confCount('attention') &gt; 0}">{{ fmt?.number(confCount('attention')) }}</span></button>
<button type="button" v-if="confCount('removed') &gt; 0 || confView() === 'removed'" :aria-pressed="confView() === 'removed'" @click="setConfView('removed')" title="Links reviewers can no longer open">Removed <span class="attention-count">{{ fmt?.number(confCount('removed')) }}</span></button>
</div>
<span class="dashboard-count" role="status">{{ search.trim() ? fmt?.number(filteredRepositories?.length || 0) + ' shown' : fmt?.number(filteredRepositories?.length || 0) + ((filteredRepositories?.length || 0) === 1 ? ' repository' : ' repositories') }}</span>
<span class="dashboard-count" role="status">{{ !conferenceLoaded ? '' : search.trim() ? fmt?.number(filteredRepositories?.length || 0) + ' shown' : fmt?.number(filteredRepositories?.length || 0) + ((filteredRepositories?.length || 0) === 1 ? ' repository' : ' repositories') }}</span>
</div>
<form class="w-100 conf-repo-toolbar" aria-label="Filter repositories" accept-charset="UTF-8" v-form="viewState" @submit.prevent="submitForm($event, () =&gt; { $event.preventDefault() })">
<div class="search-wrap">
@@ -82,7 +82,7 @@
</div>
</form>
<div class="dashboard-page conf-rows"><div class="paper-table paper-table-dashboard paper-table-conf w-100" role="table" aria-label="Repositories" :class="{'is-removed-view': confView() === 'removed'}">
<div class="dashboard-page conf-rows"><div class="paper-table paper-table-dashboard paper-table-conf w-100" role="table" aria-label="Repositories" :aria-busy="!conferenceLoaded" :class="{'is-removed-view': confView() === 'removed'}">
<div class="paper-table-head" role="row">
<div role="columnheader">Repository</div>
<div role="columnheader">Status</div>
@@ -90,6 +90,13 @@
<div role="columnheader">Expires</div>
<div role="columnheader"><span class="sr-only">Actions</span></div>
</div>
<template v-for="(i, index) in [1, 2, 3, 4]"><div class="paper-table-row paper-table-skeleton" role="row" aria-hidden="true" v-if="!conferenceLoaded">
<div class="cell-anon" role="cell"><span class="skeleton skeleton-badge"></span><div class="anon-text"><span class="skeleton skeleton-line" style="width: 38%"></span><span class="skeleton skeleton-line skeleton-line-sm" style="width: 56%"></span></div></div>
<div class="cell-status" role="cell"><span class="skeleton skeleton-line" style="width: 60%"></span></div>
<div class="cell-views num" role="cell"><span class="skeleton skeleton-line" style="width: 40%"></span></div>
<div class="cell-expires" role="cell"><span class="skeleton skeleton-line" style="width: 55%"></span></div>
<div class="cell-actions" role="cell"></div>
</div></template>
<div class="paper-table-row" role="row" v-for="(repo, index) in filteredRepositories" :key="repo?.repoId" :class="{&#x27;repo-inactive&#x27;: repo?.status == &#x27;expired&#x27; || repo?.status == &#x27;removed&#x27;, &#x27;repo-error&#x27;: repo?.status == &#x27;error&#x27;}">
<div class="cell-anon" role="cell">
<span class="project-type-icon" role="img" aria-label="Repository" title="Repository"><svg class="project-type-svg" aria-hidden="true"><use href="#project-type-repo"></use></svg></span>
@@ -138,7 +145,7 @@
</div>
</div>
</div>
<div class="paper-table-empty" v-if="filteredRepositories?.length == 0">
<div class="paper-table-empty" v-if="conferenceLoaded &amp;&amp; filteredRepositories?.length == 0">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-inbox"></use></svg>
<span v-if="!conference?.repositories?.length">No repository has been submitted to this conference yet.</span>
<span v-if="conference?.repositories?.length">Nothing matches the current filters.</span>
+9 -2
View File
@@ -70,8 +70,8 @@
</div>
<div class="conference-feedback" role="alert" v-if="error"><span>{{ error }}</span><button type="button" class="btn btn-outline-ink" @click="loadConferences()">Retry</button></div>
<div class="conference-feedback" role="status" v-if="loading">Loading conferences…</div>
<div class="paper-table paper-table-conferences w-100" role="table" aria-label="Conferences">
<p class="sr-only" role="status" v-if="loading">Loading conferences…</p>
<div class="paper-table paper-table-conferences w-100" role="table" aria-label="Conferences" :aria-busy="loading ? 'true' : 'false'">
<div class="paper-table-head" role="row">
<div role="columnheader">Conference</div>
<div role="columnheader">Status</div>
@@ -79,6 +79,13 @@
<div role="columnheader">Review window</div>
<div role="columnheader"><span class="sr-only">Actions</span></div>
</div>
<template v-for="(i, index) in [1, 2, 3]"><div class="paper-table-row paper-table-skeleton" role="row" aria-hidden="true" v-if="loading">
<div class="cell-anon" role="cell"><div class="anon-text"><span class="skeleton skeleton-line" style="width: 46%"></span><span class="skeleton skeleton-line skeleton-line-sm" style="width: 30%"></span></div></div>
<div role="cell"><span class="skeleton skeleton-line" style="width: 56%"></span></div>
<div class="num" role="cell"><span class="skeleton skeleton-line" style="width: 32%; margin-left: auto"></span></div>
<div role="cell"><span class="skeleton skeleton-line" style="width: 72%"></span></div>
<div role="cell"></div>
</div></template>
<div class="paper-table-row row-clickable" role="row" v-for="(conference, index) in filteredConferences" :key="conference?.conferenceID" :class="{&#x27;repo-inactive&#x27;: conference?.status == &#x27;expired&#x27; || conference?.status == &#x27;removed&#x27;}">
<div class="cell-anon" role="cell">
<svg class="ui-icon record-type-icon" role="img" aria-label="Conference"><use href="#project-icon-conference"></use></svg>
+12 -7
View File
@@ -3,7 +3,7 @@
<div class="w-100">
<div class="dashboard-heading page-head page-head-main">
<div>
<div class="dashboard-title-line"><h1 class="paper-page-title">My work</h1><span class="dashboard-count-head" v-if="!loading &amp;&amp; isPlainView()" aria-hidden="true">{{ fmt?.number(dashboardTotals?.filtered ?? filteredItems?.length) }} project<span v-if="(dashboardTotals?.filtered ?? filteredItems?.length) !== 1">s</span></span></div>
<div class="dashboard-title-line"><h1 class="paper-page-title">My work</h1><span class="dashboard-count-head" v-if="dashboardLoaded &amp;&amp; isPlainView()" aria-hidden="true">{{ fmt?.number(dashboardTotals?.filtered ?? filteredItems?.length) }} project<span v-if="(dashboardTotals?.filtered ?? filteredItems?.length) !== 1">s</span></span></div>
<p class="paper-page-lede">Manage your anonymous links.</p>
@@ -34,7 +34,11 @@
</div>
<!-- Result count + active filter chips -->
<div class="dashboard-meta" v-if="!loading">
<!-- First load: the tab row keeps its place with placeholders, so nothing jumps when the counts arrive -->
<div class="dashboard-meta is-loading" v-if="!dashboardLoaded" aria-hidden="true">
<div class="dashboard-view-tabs"><span class="skeleton skeleton-line dashboard-tab-skeleton" style="width: 56px"></span><span class="skeleton skeleton-line dashboard-tab-skeleton" style="width: 112px"></span></div>
</div>
<div class="dashboard-meta" v-if="dashboardLoaded">
<div class="dashboard-view-tabs" role="group" aria-label="Project view" v-if="showViewTabs()">
<button type="button" :aria-pressed="statusView() === 'active'" @click="setStatusView('active')" title="Every project except removed links">Current</button>
<button type="button" v-if="attentionCount() &gt; 0 || statusView() === 'attention'" :aria-pressed="statusView() === 'attention'" @click="setStatusView('attention')" :aria-label="'Needs attention ' + attentionCount()"><span class="dashboard-attention-prefix">Needs </span><span>attention</span> <span class="attention-count" :class="{'has-attention': attentionCount() > 0}">{{ attentionCount() }}</span></button>
@@ -101,7 +105,7 @@
</div>
</div>
</form>
<div class="dashboard-active-filters dashboard-active-filters-row" v-if="!loading &amp;&amp; showClearFilters()">
<div class="dashboard-active-filters dashboard-active-filters-row" v-if="dashboardLoaded &amp;&amp; showClearFilters()">
<template v-for="f in statusChipKeys()" :key="f"><button type="button" class="filter-chip" @click="filters.status[f] = true" :aria-label="'Show ' + statusKeyLabels[f] + ' again'" :title="'Show ' + statusKeyLabels[f] + ' again'">Hiding {{ (statusKeyLabels[f] || '').toLowerCase() }}<svg class="project-type-svg" aria-hidden="true"><use href="#project-icon-close"></use></svg></button></template>
<button type="button" class="filter-chip" v-if="typeFilter !== 'all'" @click="typeFilter = 'all'" aria-label="Show all project types">{{ typeFilter === 'repo' ? 'Repositories' : typeFilter === 'pr' ? 'Pull requests' : 'Gists' }}<svg class="project-type-svg" aria-hidden="true"><use href="#project-icon-close"></use></svg></button>
<button type="button" class="btn-link-inline" v-if="showClearFilters()" @click="clearFilters()">Clear filters</button>
@@ -110,7 +114,7 @@
</div>
<!-- Table -->
<div class="paper-table paper-table-dashboard" role="table" aria-label="Anonymizations" :aria-busy="(loading)" :class="{'is-removed-view': statusView() === 'removed'}">
<div class="paper-table paper-table-dashboard" role="table" aria-label="Anonymizations" :aria-busy="(loading || refreshing)" :class="{'is-removed-view': statusView() === 'removed', 'is-refreshing': refreshing}">
<div class="paper-table-head" role="row">
<div role="columnheader" :aria-sort="(isSortedBy(&#x27;_label&#x27;) ? (sortDesc() ? &#x27;descending&#x27; : &#x27;ascending&#x27;) : &#x27;none&#x27;)">
<button type="button" class="sortable" :class="{active: isSortedBy(&#x27;_label&#x27;)}" @click="setSort(&#x27;_label&#x27;)">
@@ -135,8 +139,9 @@
<div role="columnheader" class="col-link"><span class="sr-only">Actions</span></div>
</div>
<!-- Loading skeleton: keeps the layout stable while the three lists load -->
<template v-for="(i, index) in [1, 2, 3, 4]"><div class="paper-table-row paper-table-skeleton" role="row" aria-hidden="true" v-if="loading">
<!-- Loading skeleton: keeps the layout stable while the lists load, and stands in
for the rows when a reload (tab, search, filter) has none of the new rows yet -->
<template v-for="(i, index) in [1, 2, 3, 4]"><div class="paper-table-row paper-table-skeleton" role="row" aria-hidden="true" v-if="loading || (refreshing &amp;&amp; filteredItems?.length == 0)">
<div class="cell-anon" role="cell"><span class="skeleton skeleton-badge"></span><div class="anon-text"><span class="skeleton skeleton-line" style="width: 38%"></span><span class="skeleton skeleton-line skeleton-line-sm" style="width: 56%"></span></div></div>
<div class="cell-status" role="cell"><span class="skeleton skeleton-line" style="width: 60%"></span></div>
<div class="cell-views num" role="cell"><span class="skeleton skeleton-line" style="width: 40%"></span></div>
@@ -257,7 +262,7 @@
</div>
</div></template>
<div class="paper-table-empty" v-if="!loading &amp;&amp; filteredItems?.length == 0">
<div class="paper-table-empty" v-if="!loading &amp;&amp; !refreshing &amp;&amp; filteredItems?.length == 0">
<svg class="project-type-svg project-empty-icon" aria-hidden="true"><use href="#project-icon-inbox"></use></svg>
<span v-if="!hasProjects()">You have no anonymizations yet.</span>
<span v-if="hasProjects()">Nothing matches the current filters.</span>
+27 -3
View File
@@ -3,6 +3,18 @@ import { reactive, onScopeDispose, nextTick } from "vue";
import { createTimers, createListeners } from "./state.js";
import { duration, statusMsg, number as formatNumber, date as formatDate } from "./formatters.js";
// List loading for the admin tables. The status chips, filters and counts stay
// rendered while a page loads; until the first answer the table shows
// placeholder rows, and a reload keeps the current rows, marked busy.
function markListLoading(state) {
state.listLoading = true;
if (state.listLoaded === undefined) state.listLoaded = false;
}
function markListLoaded(state) {
state.listLoading = false;
state.listLoaded = true;
}
// One status filter model for every admin list (and the conference page):
// a single-select segmented control. One rule everywhere: "All N" is every
// record in the list, removed ones included, and selecting it shows exactly
@@ -49,6 +61,8 @@ export const repositoriesAdminController = function (state, http, location) {
state.repositories = [];
state.total = -1;
state.listLoaded = false;
state.listLoading = true;
state.totalPage = 0;
state.statusCounts = [];
state.totalSize = 0;
@@ -278,7 +292,8 @@ export const repositoriesAdminController = function (state, http, location) {
state.fetchError = null;
function getRepositories() {
state.fetchError = null;
http.get("/api/admin/repos", { params: state.query }).then(
markListLoading(state);
http.get("/api/admin/repos", { params: state.query }).finally(() => markListLoaded(state)).then(
(res) => {
state.total = res.data.total;
state.totalPage = Math.ceil(res.data.total / state.query.limit);
@@ -318,6 +333,7 @@ export const repositoriesAdminController = function (state, http, location) {
"query",
() => {
timers.timeout.cancel(timeClear);
markListLoading(state);
timeClear = timers.timeout(() => { getRepositories(); getStatusCounts(); }, 500);
const { page, search, ...persisted } = state.query;
saveFilterPrefs(reposAdminPrefsKey, persisted);
@@ -343,6 +359,8 @@ export const usersAdminController = function (state, http, location) {
state.users = [];
state.total = -1;
state.listLoaded = false;
state.listLoading = true;
state.totalPage = 0;
state.statusCounts = [];
state.selected = {};
@@ -451,7 +469,8 @@ export const usersAdminController = function (state, http, location) {
state.fetchError = null;
function getUsers() {
state.fetchError = null;
http.get("/api/admin/users", { params: state.query }).then(
markListLoading(state);
http.get("/api/admin/users", { params: state.query }).finally(() => markListLoaded(state)).then(
(res) => {
state.total = res.data.total;
state.totalPage = Math.ceil(res.data.total / state.query.limit);
@@ -473,6 +492,7 @@ export const usersAdminController = function (state, http, location) {
"query",
() => {
timers.timeout.cancel(timeClear);
markListLoading(state);
timeClear = timers.timeout(getUsers, 500);
const { page, search, ...persisted } = state.query;
saveFilterPrefs(usersAdminPrefsKey, persisted);
@@ -809,6 +829,8 @@ export const conferencesAdminController = function (state, http, location) {
state.conferences = [];
state.total = -1;
state.listLoaded = false;
state.listLoading = true;
state.totalPage = 0;
state.statusCounts = [];
@@ -921,7 +943,8 @@ export const conferencesAdminController = function (state, http, location) {
state.fetchError = null;
function getConferences() {
state.fetchError = null;
http.get("/api/admin/conferences", { params: state.query }).then(
markListLoading(state);
http.get("/api/admin/conferences", { params: state.query }).finally(() => markListLoaded(state)).then(
(res) => {
state.total = res.data.total;
state.totalPage = Math.ceil(res.data.total / state.query.limit);
@@ -947,6 +970,7 @@ export const conferencesAdminController = function (state, http, location) {
"query",
() => {
timers.timeout.cancel(timeClear);
markListLoading(state);
timeClear = timers.timeout(getConferences, 500);
const { page, search, ...persisted } = state.query;
saveFilterPrefs(confAdminPrefsKey, persisted);
+156 -15
View File
@@ -1140,7 +1140,7 @@ export const unifiedDashboardController = function (state, http, location, promi
// All three lists load in parallel and are merged once, so the table
// does not re-sort three times while it fills in.
function loadLegacy() {
state.loading = true;
state.loading = !state.dashboardLoaded;
return promises
.all([
safeGet("/api/user/anonymized_repositories"),
@@ -1197,10 +1197,14 @@ export const unifiedDashboardController = function (state, http, location, promi
state.items = items;
state.removedCount = items.filter(item => item._statusKey === "removed").length;
state.loading = false;
state.refreshing = false;
state.dashboardLoaded = true;
});
}
let dashboardGeneration = 0;
let legacyDashboard = false;
state.dashboardLoaded = false;
state.refreshing = false;
state.dashboardCursor = null;
state.dashboardError = "";
function decorateSummary(item) {
@@ -1214,7 +1218,11 @@ export const unifiedDashboardController = function (state, http, location, promi
function loadAll(append = false) {
if (legacyDashboard) return loadLegacy();
const generation = ++dashboardGeneration;
state.loading = !append;
// Only the first load has nothing to show. A reload (tab, search,
// filter, sort) keeps the tabs, counts and current rows on screen,
// marked busy, until the new page replaces them.
state.loading = !append && !state.dashboardLoaded;
state.refreshing = !append && state.dashboardLoaded;
state.loadingMore = append;
state.dashboardError = "";
return http.get("/api/user/dashboard", { params: {
@@ -1235,7 +1243,7 @@ export const unifiedDashboardController = function (state, http, location, promi
if (error.status === 404) { legacyDashboard = true; return loadLegacy(); }
state.dashboardError = "Projects could not be loaded. Please try again.";
}).finally(() => {
if (generation === dashboardGeneration) { state.loading = false; state.loadingMore = false; }
if (generation === dashboardGeneration) { state.loading = false; state.refreshing = false; state.loadingMore = false; state.dashboardLoaded = true; }
});
}
state.loadMoreProjects = () => loadAll(true);
@@ -1656,10 +1664,29 @@ export const anonymizeController = function (state, http, html, params, location
state.hostingReview = false;
state.previewExpanded = false;
state.taskValidationError = "";
state.editRepository = () => {
// The preview's "add terms" takes the author to the Terms field, from the
// phone's Preview tab and from the expanded preview too.
state.focusTerms = () => {
state.mobilePane = "settings";
state.previewExpanded = false;
nextTick(() => document.querySelector(".anonymize-fields .is-invalid")?.focus());
nextTick(() => {
const field = document.getElementById("terms");
if (!field) return;
field.scrollIntoView?.({ block: "center", behavior: "smooth" });
field.focus({ preventScroll: true });
});
};
state.editRepository = () => {
// The exact date input is hidden under a plan limit; an invalid date reveals it.
if (state.anonymize?.expirationDate?.invalid) state.expiryPickerOpen = true;
state.mobilePane = "settings";
state.previewExpanded = false;
nextTick(() => {
const field = document.querySelector(".anonymize-fields .is-invalid");
const details = field?.closest("details");
if (details && !details.open) details.open = true;
field?.focus();
});
};
state.submitRepository = (event) => {
state.taskValidationError = "";
@@ -1877,17 +1904,29 @@ export const anonymizeController = function (state, http, html, params, location
// Extended expiration add-ons or its conference's review window. A saved
// later date stays selectable.
state.minExpirationDate = toLocalDateString(new Date());
// What sets the latest date, for the expiry summary: the free "plan"
// window, an Extended expiration add-on, the conference, or the saved
// date. Null when no plan limit applies (no billing, an author
// subscription, a gist or a pull request).
state.maxExpirationReason = null;
const updateExpirationLimit = () => {
const now = new Date();
let maximum = new Date(now);
maximum.setFullYear(maximum.getFullYear() + 1);
state.maxExpirationReason = null;
// Gists and pull requests keep their one-year limit; billing only limits repositories.
if (state.billing?.enabled && state.detectedType === "repo" && !state.hasAuthorHosting()) {
maximum = new Date(now);
maximum.setMonth(maximum.getMonth() + (state.billing.freeExpirationMonths || 5));
for (const grant of state.repositoryGrants("repo_extend")) if (new Date(grant.until) > maximum) maximum = new Date(grant.until);
if (state.conference_data?.endDate && new Date(state.conference_data.endDate) > maximum) maximum = new Date(state.conference_data.endDate);
if (state._savedExpirationDate && state._savedExpirationDate > maximum) maximum = new Date(state._savedExpirationDate);
let reason = "plan";
for (const grant of state.repositoryGrants("repo_extend")) if (new Date(grant.until) > maximum) { maximum = new Date(grant.until); reason = "extend"; }
if (state.conference_data?.endDate && new Date(state.conference_data.endDate) > maximum) { maximum = new Date(state.conference_data.endDate); reason = "conference"; }
if (state._savedExpirationDate && state._savedExpirationDate > maximum) {
// A saved date on the same day as the limit keeps the limit's reason.
if (toLocalDateString(state._savedExpirationDate) > toLocalDateString(maximum)) reason = "saved";
maximum = new Date(state._savedExpirationDate);
}
state.maxExpirationReason = reason;
// A default or carried-over date must fit the limit; only the saved
// date may stay later.
const date = state.options?.expirationDate;
@@ -1897,44 +1936,135 @@ export const anonymizeController = function (state, http, html, params, location
state.maxExpirationDate = toLocalDateString(maximum);
};
updateExpirationLimit();
// With a plan limit the date defaults to the latest allowed day, so the
// dated option names it ("Expire on Apr 29, 2027"), a muted line says
// why, and "Change date" reveals the bounded input. Without a limit the
// input shows as before.
state.expiryPickerOpen = false;
state.expiryCapped = () => !!state.maxExpirationReason && state.options?.expirationMode !== "never";
const expiryInvalid = () => !!state.anonymize?.expirationDate?.invalid;
state.expiryPickerShown = () => !state.expiryCapped() || state.expiryPickerOpen || expiryInvalid();
state.openExpiryPicker = () => {
state.expiryPickerOpen = true;
nextTick(() => document.getElementById("expirationDate")?.focus());
};
const expiryParts = () => {
const echo = dateEcho(state.options?.expirationDate);
const at = echo.lastIndexOf(" · ");
return at < 0 ? null : { date: echo.slice(0, at), relative: echo.slice(at + 3) };
};
state.expiryChoiceLabel = () => {
const parts = state.expiryCapped() && !expiryInvalid() ? expiryParts() : null;
return parts ? "Expire on " + parts.date : "Expire on a date";
};
state.expiryRelative = () => {
const rel = expiryParts()?.relative || "";
return rel.charAt(0).toUpperCase() + rel.slice(1);
};
const sameDay = (a, b) => {
const x = new Date(a), y = new Date(b);
return !isNaN(x) && !isNaN(y) && x.getFullYear() === y.getFullYear() && x.getMonth() === y.getMonth() && x.getDate() === y.getDate();
};
state.expiryNote = () => {
const date = state.options?.expirationDate;
if (!date) return "";
if (state.conference_data?.endDate && sameDay(date, state.conference_data.endDate)) return "When " + (state.conference_data.name || "the conference") + " ends";
if (!state.maxExpirationDate || !sameDay(date, state.maxExpirationDate + "T00:00:00")) return "";
return { plan: "Maximum on your plan", extend: "Maximum with Extended expiration", saved: "Date saved for this link" }[state.maxExpirationReason] || "";
};
state.watch(() => [state.billing, state.repoId, state.conference_data, state.isUpdate, state._savedExpirationDate, state.options?.expirationMode, state.detectedType], updateExpirationLimit, true, false);
state.anonymize_readme = "";
state.readme = "";
state.isUpdate = false;
// Landing: the user's GitHub repositories, so step 1 is a pick, not a blank field.
// A row's full name becomes its tooltip only when the row cuts it short.
state.titleIfTruncated = (event, text) => {
const el = event?.currentTarget;
if (!el) return;
if (el.scrollWidth > el.clientWidth + 1) el.title = text;
else el.removeAttribute("title");
};
state.userRepos = [];
state.userReposStatus = "idle";
state.userRepoFilter = "";
state.userRepoPage = 1;
state.userRepoNext = null;
let repoRequest = 0, repoSearchTimer;
// The list is stored server-side: `syncedAt` dates it, `syncing` means a
// GitHub fetch is still filling it, `webhooks` that App events keep it current.
state.userReposSyncedAt = null;
state.userReposSyncing = false;
state.userReposWebhooks = false;
state.userReposNow = Date.now();
state.userReposRefreshFailed = false;
let repoRequest = 0, repoSearchTimer, repoPollTimer, repoPolls = 0;
let repoPages = [0];
const repoTimers = createTimers();
repoTimers.interval(() => { state.userReposNow = Date.now(); }, 30000);
state.on("dispose", () => { repoRequest++; clearTimeout(repoSearchTimer); });
state.loadUserRepos = async () => {
state.userReposUpdatedLabel = () => {
if (state.userReposSyncing) return "Updating…";
if (state.userReposRefreshFailed) return "Couldn’t update";
if (!state.userReposSyncedAt) return "";
const minutes = Math.floor((state.userReposNow - Date.parse(state.userReposSyncedAt)) / 60000);
if (minutes < 1) return "Updated just now";
if (minutes < 60) return "Updated " + minutes + " min ago";
if (minutes < 24 * 60) return "Updated " + Math.floor(minutes / 60) + " h ago";
return "Updated " + shortDate(state.userReposSyncedAt);
};
state.userReposUpdatedTitle = () => state.userReposWebhooks
? "New repositories you give the GitHub App access to appear automatically. Refresh to check GitHub now."
: "Your repository list is saved. Refresh to fetch new repositories from GitHub.";
// `quiet` keeps the current rows on screen (polling and refresh); `force`
// asks the server to fetch the list from GitHub again.
state.loadUserRepos = async (opts = {}) => {
clearTimeout(repoSearchTimer);
repoTimers.timeout.cancel(repoPollTimer);
const request = ++repoRequest;
const query = state.userRepoFilter.trim();
state.userReposStatus = "loading";
state.userRepos = [];
if (!opts.quiet) {
state.userReposStatus = "loading";
state.userRepos = [];
}
if (opts.force) { state.userReposSyncing = true; state.userReposRefreshFailed = false; }
if (!opts.poll) repoPolls = 0;
let cursor = repoPages[state.userRepoPage - 1];
try {
// Bound each search pass; sparse searches can continue from the footer.
for (let batch = 0; batch < 5; batch++) {
const res = await http.get("/api/user/repository_picker", { params: {
cursor, q: query, connection: state.githubConnection,
cursor, q: query, connection: state.githubConnection, force: opts.force && batch === 0 ? 1 : undefined,
} });
if (sourceDisposed || request !== repoRequest) return;
state.userRepos = res.data.items || [];
state.userRepoNext = res.data.nextCursor ?? null;
state.userReposSyncedAt = res.data.syncedAt || null;
state.userReposSyncing = !!res.data.syncing;
state.userReposWebhooks = !!res.data.webhooks;
state.userReposNow = Date.now();
if (state.userRepos.length || state.userRepoNext === null || !query) break;
cursor = state.userRepoNext;
}
state.userReposStatus = "ready";
// While GitHub is still being read, show the rows as they arrive.
if (state.userReposSyncing && repoPolls < 60) {
repoPolls++;
repoPollTimer = repoTimers.timeout(() => {
if (!sourceDisposed && request === repoRequest) state.loadUserRepos({ quiet: true, poll: true });
}, 2000);
}
} catch (_) {
if (!sourceDisposed && request === repoRequest) state.userReposStatus = "error";
if (sourceDisposed || request !== repoRequest) return;
state.userReposSyncing = false;
// A failed refresh keeps the saved list on screen.
if (!opts.quiet || !state.userRepos.length) state.userReposStatus = "error";
else if (opts.force) state.userReposRefreshFailed = true;
}
};
state.refreshUserRepos = () => {
if (state.userReposSyncing || state.userReposStatus === "loading") return;
state.loadUserRepos({ quiet: true, force: true });
};
state.changeUserRepoPage = (direction) => {
if (state.userReposStatus === "loading") return;
if (direction > 0 && state.userRepoNext !== null) {
@@ -2214,6 +2344,13 @@ export const anonymizeController = function (state, http, html, params, location
state.source.branch = "";
state.readme = "";
state.branches = [];
// The old source's preview must not cover a failed reconnection.
scheduleRepoPreview.cancel();
refreshPrPreview.cancel();
refreshGistPreview.cancel();
state.previewStatus = "idle";
state.anonymize_readme = "";
resetPreviewFile();
try { await getRepoDetails(); }
catch (_) { /* getRepoDetails displays the access error. */ }
};
@@ -4482,12 +4619,16 @@ export const conferenceController = function (state, http, location, params) {
return false;
};
// Until the conference arrives the table shows placeholder rows, not the
// "no repository submitted yet" empty state.
state.conferenceLoaded = false;
function getConference() {
http
.get("/api/conferences/" + params.conferenceId)
.then((res) => {
state.conference = res.data;
});
})
.finally(() => { state.conferenceLoaded = true; });
}
getConference();
};
+11
View File
@@ -93,9 +93,20 @@ export function submitForm(event, callback) {
});
if (form && !form.checkValidity()) {
const invalid = form.querySelector("input:invalid, select:invalid, textarea:invalid");
// A field behind a closed disclosure or a hidden row cannot take focus or
// show its message: open the disclosure, ask the row to reveal itself
// ("reveal" event), and focus again once the page has re-rendered.
const details = invalid?.closest("details");
if (details && !details.open) details.open = true;
invalid?.dispatchEvent(new Event("reveal", { bubbles: true }));
invalid?.scrollIntoView?.({ block: "center" });
invalid?.focus();
form.reportValidity();
if (invalid) setTimeout(() => {
if (document.activeElement === invalid) return;
invalid.scrollIntoView?.({ block: "center" });
invalid.focus();
}, 0);
return;
}
return callback();
+54 -53
View File
@@ -1,57 +1,58 @@
"use strict";(()=>{var kl=Object.defineProperty;var Cl=e=>{throw TypeError(e)};var Of=(e,t,o)=>t in e?kl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var Mf=(e,t)=>{for(var o in t)kl(e,o,{get:t[o],enumerable:!0})};var nt=(e,t,o)=>Of(e,typeof t!="symbol"?t+"":t,o),Mr=(e,t,o)=>t.has(e)||Cl("Cannot "+o);var ae=(e,t,o)=>(Mr(e,t,"read from private field"),o?o.call(e):t.get(e)),_e=(e,t,o)=>t.has(e)?Cl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),ze=(e,t,o,r)=>(Mr(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o),$e=(e,t,o)=>(Mr(e,t,"access private method"),o);var Sl=(e,t,o,r)=>({set _(s){ze(e,t,s,o)},get _(){return ae(e,t,r)}});var he=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ge={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",editor:"/script/editor.4f142d3adc.min.js"};function El(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let o=new URLSearchParams(t);if([...o.keys()].length!==3||[...o.keys()].some(d=>!["clientId","intentId","token"].includes(d)))return null;let r=o.get("clientId"),s=o.get("intentId"),i=o.get("token");return!/^[a-f0-9]{32}$/.test(r||"")||!/^[a-f0-9]{32}$/.test(s||"")||!/^[a-f0-9]{64}$/.test(i||"")?null:{contract:"4open.artifacts/1",clientId:r,intentId:s,token:i}}function Nl(e,t){let{http:o,promises:r,window:s}=t,i=t.takeReviewHandoff(),d=i?{clientId:i.clientId,intentId:i.intentId}:null,p,c,v,m,y,g=!0,k,w=r.defer(),C=()=>[...s.crypto.getRandomValues(new Uint8Array(16))].map(_=>_.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:i?"":"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,i=p=c=void 0,w.resolve(),s.clearTimeout(k)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,_=>{!y&&_?y=_:y&&_!==y&&(b(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let P=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),M=_=>_?.status===404?"Artifact linking is not available on this server.":_?.status===401?"Sign in, then open a new artifact link from your submission.":_?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!g||!i||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let _=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(_)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,p=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,s.clearTimeout(k),m||(m=C());try{let H=(await o.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 ne=(await o.post("/api/review-consent/preview",{repositoryId:_,intent:{...i,requestId:m}},P())).data;if(!N())return;if(!ne||typeof ne.ticket!="string"||!ne.ticket||ne.ticket.length>8192||typeof ne.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
`))),e[yn]=Bo(s);let i=r||s.props&&s.props.type==="number";$n(e,t?"change":"input",d=>{d.target.composing||e[yn](ba(e.value,o,i))}),(o||i)&&$n(e,"change",()=>{e.value=ba(e.value,o,i)}),t||($n(e,"compositionstart",Lh),$n(e,"compositionend",cu),$n(e,"change",cu))},mounted(e,{value:t,modifiers:{trim:o,number:r}}){let s=t??"",i=e[ji];delete e[ji],i!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==i?e[yn](ba(e.value,o,r)):e.value=s},beforeUpdate(e,{value:t,oldValue:o,modifiers:{lazy:r,trim:s,number:i}},d){if(e[yn]=Bo(d),e.composing)return;let p=(i||e.type==="number")&&!/^0\d/.test(e.value)?Vo(e.value):e.value,c=t??"";if(p===c)return;let v=e.getRootNode();(v instanceof Document||v instanceof ShadowRoot)&&v.activeElement===e&&e.type!=="range"&&(r&&t===o||s&&e.value.trim()===c)||(e.value=c)}},ka={deep:!0,created(e,t,o){e[yn]=Bo(o),$n(e,"change",()=>{let r=e._modelValue,s=Us(e),i=e.checked,d=e[yn];if(Te(r)){let p=yi(r,s),c=p!==-1;if(i&&!c)d(r.concat(s));else if(!i&&c){let v=[...r];v.splice(p,1),d(v)}}else if(Xt(r)){let p=new Set(r);i?p.add(s):p.delete(s),d(p)}else d(vu(e,i))})},mounted:pu,beforeUpdate(e,t,o){e[yn]=Bo(o),pu(e,t,o)}};function pu(e,{value:t,oldValue:o},r){e._modelValue=t;let s;if(Te(t))s=yi(t,r.props.value)>-1;else if(Xt(t))s=t.has(r.props.value);else{if(t===o)return;s=Qt(t,vu(e,!0))}e.checked!==s&&(e.checked=s)}var Nt={deep:!0,created(e,{value:t,modifiers:{number:o}},r){e._modelValue=t,$n(e,"change",()=>{let s=Array.prototype.filter.call(e.options,c=>c.selected).map(c=>o?Vo(Us(c)):Us(c)),i=e.multiple,d=i?Xt(e._modelValue)?new Set(s):s:s[0],p=e._pendingValue=[i,i?Te(d)?s.slice():s:d];try{e[yn](d)}finally{je(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[yn]=Bo(r)},mounted(e,{value:t}){fu(e,t)},beforeUpdate(e,{value:t},o){e._modelValue=t,e[yn]=Bo(o)},updated(e,{value:t}){let o=e._pendingValue;e._pendingValue=void 0,(!o||o[0]!==e.multiple||!Fh(t,o[1],o[0]))&&fu(e,t)}};function Fh(e,t,o){if(!o)return Qt(e,t);if(Te(e))return Qt(e,t);if(Xt(e)){if(e.size!==t.length)return!1;for(let r of t)if(!e.has(r))return!1;return!0}return!1}function fu(e,t){let o=e.multiple,r=Te(t);if(!(o&&!r&&!Xt(t))){for(let s=0,i=e.options.length;s<i;s++){let d=e.options[s],p=Us(d);if(o)if(r){let c=typeof p;c==="string"||c==="number"?d.selected=t.some(v=>String(v)===String(p)):d.selected=yi(t,p)>-1}else d.selected=t.has(p);else if(Qt(Us(d),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!o&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Us(e){return"_value"in e?e._value:e.value}function vu(e,t){let o=t?"_trueValue":"_falseValue";return o in e?e[o]:t}var _h=["ctrl","shift","alt","meta"],$h={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>_h.some(o=>e[`${o}Key`]&&!t.includes(o))},re=(e,t)=>{if(!e)return e;let o=e._withMods||(e._withMods={}),r=t.join(".");return o[r]||(o[r]=((s,...i)=>{for(let d=0;d<t.length;d++){let p=$h[t[d]];if(p&&p(s,t))return}return e(s,...i)}))},Uh={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},_t=(e,t)=>{let o=e._withKeys||(e._withKeys={}),r=t.join(".");return o[r]||(o[r]=(s=>{if(!("key"in s))return;let i=ln(s.key);if(t.some(d=>d===i||Uh[d]===i))return e(s)}))},Bh=pt({patchProp:Mh},vh),mu;function zh(){return mu||(mu=Kd(Bh))}var yu=((...e)=>{let t=zh().createApp(...e),{mount:o}=t;return t.mount=r=>{let s=jh(r);if(!s)return;let i=t._component;!Oe(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");let d=o(s,!1,Hh(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),d},t});function Hh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function jh(e){return lt(e)?document.querySelector(e):e}var co=typeof document<"u";function wu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Gh(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&wu(e.default)}var xe=Object.assign;function Wi(e,t){let o={};for(let r in t){let s=t[r];o[r]=Yt(s)?s.map(e):e(s)}return o}var Ho=()=>{},Yt=Array.isArray;function Ea(e,t){let o={};for(let r in e)o[r]=r in t?t[r]:e[r];return o}var ku=/#/g,Wh=/&/g,Kh=/\//g,Yh=/=/g,Jh=/\?/g,Cu=/\+/g,Xh=/%5B/g,Qh=/%5D/g,Su=/%5E/g,Zh=/%60/g,Eu=/%7B/g,xh=/%7C/g,Nu=/%7D/g,eg=/%20/g;function Na(e){return e==null?"":encodeURI(""+e).replace(xh,"|").replace(Xh,"[").replace(Qh,"]")}function Ru(e){return Na(e).replace(Eu,"{").replace(Nu,"}").replace(Su,"^")}function Ca(e){return Na(e).replace(Cu,"%2B").replace(eg,"+").replace(ku,"%23").replace(Wh,"%26").replace(Zh,"`").replace(Eu,"{").replace(Nu,"}").replace(Su,"^")}function tg(e){return Ca(e).replace(Yh,"%3D")}function ng(e){return NLine truncated
"use strict";(()=>{var Dl=Object.defineProperty;var Al=e=>{throw TypeError(e)};var Uf=(e,t,o)=>t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var Bf=(e,t)=>{for(var o in t)Dl(e,o,{get:t[o],enumerable:!0})};var tt=(e,t,o)=>Uf(e,typeof t!="symbol"?t+"":t,o),Ur=(e,t,o)=>t.has(e)||Al("Cannot "+o);var le=(e,t,o)=>(Ur(e,t,"read from private field"),o?o.call(e):t.get(e)),Le=(e,t,o)=>t.has(e)?Al("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),Ue=(e,t,o,r)=>(Ur(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o),qe=(e,t,o)=>(Ur(e,t,"access private method"),o);var Il=(e,t,o,r)=>({set _(s){Ue(e,t,s,o)},get _(){return le(e,t,r)}});var ve=["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 ye={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 Ol(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let o=new URLSearchParams(t);if([...o.keys()].length!==3||[...o.keys()].some(d=>!["clientId","intentId","token"].includes(d)))return null;let r=o.get("clientId"),s=o.get("intentId"),i=o.get("token");return!/^[a-f0-9]{32}$/.test(r||"")||!/^[a-f0-9]{32}$/.test(s||"")||!/^[a-f0-9]{64}$/.test(i||"")?null:{contract:"4open.artifacts/1",clientId:r,intentId:s,token:i}}function Ml(e,t){let{http:o,promises:r,window:s}=t,i=t.takeReviewHandoff(),d=i?{clientId:i.clientId,intentId:i.intentId}:null,p,c,v,m,y,g=!0,C,w=r.defer(),S=()=>[...s.crypto.getRandomValues(new Uint8Array(16))].map(_=>_.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:i?"":"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,i=p=c=void 0,w.resolve(),s.clearTimeout(C)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,_=>{!y&&_?y=_:y&&_!==y&&(b(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let P=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),V=_=>_?.status===404?"Artifact linking is not available on this server.":_?.status===401?"Sign in, then open a new artifact link from your submission.":_?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!g||!i||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let _=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(_)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,p=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,s.clearTimeout(C),m||(m=S());try{let j=(await o.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(c=j.csrf,e.handoffEnabled=j.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(c||""))throw new Error("invalid_csrf");let ne=(await o.post("/api/review-consent/preview",{repositoryId:_,intent:{...i,requestId:m}},P())).data;if(!N())return;if(!ne||typeof ne.ticket!="string"||!ne.ticket||ne.ticket.length>8192||typeof ne.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
`))),e[bn]=zo(s);let i=r||s.props&&s.props.type==="number";Un(e,t?"change":"input",d=>{d.target.composing||e[bn](Ra(e.value,o,i))}),(o||i)&&Un(e,"change",()=>{e.value=Ra(e.value,o,i)}),t||(Un(e,"compositionstart",jh),Un(e,"compositionend",bu),Un(e,"change",bu))},mounted(e,{value:t,modifiers:{trim:o,number:r}}){let s=t??"",i=e[Ki];delete e[Ki],i!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==i?e[bn](Ra(e.value,o,r)):e.value=s},beforeUpdate(e,{value:t,oldValue:o,modifiers:{lazy:r,trim:s,number:i}},d){if(e[bn]=zo(d),e.composing)return;let p=(i||e.type==="number")&&!/^0\d/.test(e.value)?Lo(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"&&(r&&t===o||s&&e.value.trim()===c)||(e.value=c)}},Pa={deep:!0,created(e,t,o){e[bn]=zo(o),Un(e,"change",()=>{let r=e._modelValue,s=zs(e),i=e.checked,d=e[bn];if(Ne(r)){let p=ki(r,s),c=p!==-1;if(i&&!c)d(r.concat(s));else if(!i&&c){let v=[...r];v.splice(p,1),d(v)}}else if(Zt(r)){let p=new Set(r);i?p.add(s):p.delete(s),d(p)}else d(Nu(e,i))})},mounted:wu,beforeUpdate(e,t,o){e[bn]=zo(o),wu(e,t,o)}};function wu(e,{value:t,oldValue:o},r){e._modelValue=t;let s;if(Ne(t))s=ki(t,r.props.value)>-1;else if(Zt(t))s=t.has(r.props.value);else{if(t===o)return;s=xt(t,Nu(e,!0))}e.checked!==s&&(e.checked=s)}var Nt={deep:!0,created(e,{value:t,modifiers:{number:o}},r){e._modelValue=t,Un(e,"change",()=>{let s=Array.prototype.filter.call(e.options,c=>c.selected).map(c=>o?Lo(zs(c)):zs(c)),i=e.multiple,d=i?Zt(e._modelValue)?new Set(s):s:s[0],p=e._pendingValue=[i,i?Ne(d)?s.slice():s:d];try{e[bn](d)}finally{Be(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[bn]=zo(r)},mounted(e,{value:t}){ku(e,t)},beforeUpdate(e,{value:t},o){e._modelValue=t,e[bn]=zo(o)},updated(e,{value:t}){let o=e._pendingValue;e._pendingValue=void 0,(!o||o[0]!==e.multiple||!Gh(t,o[1],o[0]))&&ku(e,t)}};function Gh(e,t,o){if(!o)return xt(e,t);if(Ne(e))return xt(e,t);if(Zt(e)){if(e.size!==t.length)return!1;for(let r of t)if(!e.has(r))return!1;return!0}return!1}function ku(e,t){let o=e.multiple,r=Ne(t);if(!(o&&!r&&!Zt(t))){for(let s=0,i=e.options.length;s<i;s++){let d=e.options[s],p=zs(d);if(o)if(r){let c=typeof p;c==="string"||c==="number"?d.selected=t.some(v=>String(v)===String(p)):d.selected=ki(t,p)>-1}else d.selected=t.has(p);else if(xt(zs(d),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!o&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function zs(e){return"_value"in e?e._value:e.value}function Nu(e,t){let o=t?"_trueValue":"_falseValue";return o in e?e[o]:t}var Wh=["ctrl","shift","alt","meta"],Kh={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)=>Wh.some(o=>e[`${o}Key`]&&!t.includes(o))},ae=(e,t)=>{if(!e)return e;let o=e._withMods||(e._withMods={}),r=t.join(".");return o[r]||(o[r]=((s,...i)=>{for(let d=0;d<t.length;d++){let p=Kh[t[d]];if(p&&p(s,t))return}return e(s,...i)}))},Yh={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},_t=(e,t)=>{let o=e._withKeys||(e._withKeys={}),r=t.join(".");return o[r]||(o[r]=(s=>{if(!("key"in s))return;let i=dn(s.key);if(t.some(d=>d===i||Yh[d]===i))return e(s)}))},Jh=pt({patchProp:Bh},Nh),Cu;function Xh(){return Cu||(Cu=tu(Jh))}var Ru=((...e)=>{let t=Xh().createApp(...e),{mount:o}=t;return t.mount=r=>{let s=Zh(r);if(!s)return;let i=t._component;!Ae(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");let d=o(s,!1,Qh(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),d},t});function Qh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Zh(e){return at(e)?document.querySelector(e):e}var po=typeof document<"u";function Pu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function xh(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Pu(e.default)}var Ze=Object.assign;function Ji(e,t){let o={};for(let r in t){let s=t[r];o[r]=Xt(s)?s.map(e):e(s)}return o}var jo=()=>{},Xt=Array.isArray;function Ia(e,t){let o={};for(let r in e)o[r]=r in t?t[r]:e[r];return o}var Du=/#/g,eg=/&/g,tg=/\//g,ng=/=/g,og=/\?/g,Au=/\+/g,sg=/%5B/g,ig=/%5D/g,Iu=/%5E/g,rg=/%60/g,Ou=/%7B/g,ag=/%7C/g,Mu=/%7D/g,lg=/%20/g;function Oa(e){return e==null?"":encodeURI(""+e).replace(ag,"|").replace(sg,"[").replace(ig,"]")}function Vu(e){return Oa(e).replace(Ou,"{").replace(Mu,"}").replace(Iu,"^")}function Da(e){return Oa(e).replace(Au,"%2B").replace(lg,"+").replace(Du,"%23").replace(eg,"%26").replace(rg,"`").replace(Ou,"{").replace(Mu,"}").replace(Iu,"^")}function dg(e){return Da(e).replace(ng,"%3D")}function ug(e){return OLine 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 "${cg(t)}" via a navigation guard.`},[ct.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[ct.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[ct.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function uo(e,t){return xe(new Error,{type:e,[qu]:!0},t)}function bn(e,t){return e instanceof Error&&qu in e&&(t==null||!!(e.type&t))}var ug=["params","query","hash"];function cg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let o of ug)o in e&&(t[o]=e[o]);return JSON.stringify(t,null,2)}function Lu(e){let t={};if(e===""||e==="?")return t;let o=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<o.length;++r){let s=o[r].replace(Cu," "),i=s.indexOf("="),d=zo(i<0?s:s.slice(0,i)),p=i<0?null:zo(s.slice(i+1));if(d in t){let c=t[d];Yt(c)||(c=t[d]=[c]),c.push(p)}else t[d]=p}return t}function Aa(e){let t="";for(let o in e){let r=e[o];if(o=tg(o),r==null){r!==void 0&&(t+=(t.length?"&":"")+o);continue}(Yt(r)?r.map(s=>s&&Ca(s)):[r&&Ca(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+o,s!=null&&(t+="="+s))})}return t}function Fu(e){let t={};for(let o in e){let r=e[o];r!==void 0&&(t[o]=Yt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}var _u=Symbol(""),Ia=Symbol(""),Xi=Symbol(""),Qi=Symbol(""),Zi=Symbol("");function jo(){let e=[];function t(r){return e.push(r),()=>{let s=e.indexOf(r);s>-1&&e.splice(s,1)}}function o(){e=[]}return{add:t,list:()=>e.slice(),reset:o}}function An(e,t,o,r,s,i=d=>d()){let d=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((p,c)=>{let v=g=>{g===!1?c(uo(ct.NAVIGATION_ABORTED,{from:o,to:t})):g instanceof Error?c(g):dg(g)?c(uo(ct.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(d&&r.enterCallbacks[s]===d&&typeof g=="function"&&d.push(g),p())},m=i(()=>e.call(r&&r.instances[s],t,o,v)),y=Promise.resolve(m);e.length<3&&(y=y.then(v)),y.catch(g=>c(g))})}function xi(e,t,o,r,s=i=>i()){let i=[];for(let d of e)for(let p in d.components){let c=d.components[p];if(!(t!=="beforeRouteEnter"&&!d.instances[p]))if(wu(c)){let v=(c.__vccOpts||c)[t];v&&i.push(An(v,o,r,d,p,s))}else{let v=c();i.push(()=>v.then(m=>{if(!m)throw new Error(`Couldn't resolve component "${p}" at "${d.path}"`);let y=Gh(m)?m.default:m;d.mods[p]=m,d.components[p]=y;let g=(y.__vccOpts||y)[t];return g&&An(g,o,r,d,p,s)()}))}}return i}function $u(e,t){let o=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let d=0;d<i;d++){let p=t.matched[d];p&&(e.matched.find(v=>lo(v,p))?r.push(p):o.push(p));let c=e.matched[d];c&&(t.matched.find(v=>lo(v,c))||s.push(c))}return[o,r,s]}var pg=()=>location.protocol+"//"+location.host;function Xu(e,t){let{pathname:o,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let d=s.includes(e.slice(i))?e.slice(i).length:1,p=s.slice(d);return p[0]!=="/"&&(p="/"+p),Ra(p,"")}return Ra(o,e)+r+s}function fg(e,t,o,r){let s=[],i=[],d=null,p=({state:g})=>{let k=Xu(e,location),w=o.value,C=t.value,N=0;if(g){if(o.value=k,t.value=g,d&&d===w){d=null;return}N=C?g.position-C.position:0}else r(k);s.forEach(b=>{b(o.value,w,{delta:N,type:Yi.pop,direction:N?N>0?Ji.forward:Ji.back:Ji.unknown})})};function c(){d=o.value}function v(g){s.push(g);let k=()=>{let w=s.indexOf(g);w>-1&&s.splice(w,1)};return i.push(k),k}function m(){if(document.visibilityState==="hidden"){let{history:g}=window;if(!g.state)return;g.replaceState(xe({},g.state,{scroll:Bs()}),"")}}function y(){for(let g of i)g();i=[],window.removeEventListener("popstate",p),window.removeEventListener("pagehide",m),document.removeEventListener("visibilitychange",m)}return window.addEventListener("popstate",p),window.addEventListener("pagehide",m),document.addEventListener("visibilitychange",m),{pauseListeners:c,listen:v,destroy:y}}function Uu(e,t,o,r=!1,s=!1){return{back:e,current:t,forward:o,replaced:r,position:window.history.length,scroll:s?Bs():null}}function mg(e){let{history:t,location:o}=window,r={value:Xu(e,o)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(c,v,m){let y=e.indexOf("#"),g=y>-1?(o.host&&document.querySelector("base")?e:e.slice(y))+c:pg()+e+c;try{t[m?"replaceState":"pushState"](v,"",g),s.value=v}catch(k){console.error(k),o[m?"replace":"assign"](g)}}function d(c,v){i(c,xe({},t.state,Uu(s.value.back,c,s.value.forward,!0),v,{position:s.value.position}),!0),r.value=c}function p(c,v){let m=xe({},s.value,t.state,{forward:c,scroll:Bs()});i(m.current,m,!0),i(c,xe({},Uu(r.value,c,null),{position:m.position+1},v),!1),r.value=c}return{location:r,state:s,push:p,replace:d}}function Qu(e){e=Au(e);let t=mg(e),o=fg(e,t.state,t.location,t.replace);function r(i,d=!0){d||o.pauseListeners(),history.go(i)}let s=xe({locatLine truncated
`);for(let m of v){if(o&&(i>0||d>0)&&/^([-+ ]|$)/.test(m)){m.startsWith("+")?(o.lines.push({kind:"add",oldNo:"",newNo:s++,text:m.slice(1)}),d--):m.startsWith("-")?(o.lines.push({kind:"remove",oldNo:r++,newNo:"",text:m.slice(1)}),i--):(o.lines.push({kind:"ctx",oldNo:r++,newNo:s++,text:m.slice(1)}),i--,d--);continue}if(m.startsWith("diff --git")){p(),c();continue}if(m.startsWith("--- ")){o&&o.lines.length&&p(),c().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){c().newPath=m.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!/^(index |similarity index|rename |new file mode|deleted file mode|Binary files)/.test(m)){if(m.startsWith("@@")){let y=m.match(/@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);y&&(r=parseInt(y[1],10),s=parseInt(y[3],10),i=y[2]==null?1:parseInt(y[2],10),d=y[4]==null?1:parseInt(y[4],10)),c().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}if(o)if(m.startsWith("+"))o.lines.push({kind:"add",oldNo:"",newNo:s++,text:m.slice(1)});else if(m.startsWith("-"))o.lines.push({kind:"remove",oldNo:r++,newNo:"",text:m.slice(1)});else{if(m.startsWith("\\"))continue;o.lines.push({kind:"ctx",oldNo:r++,newNo:s++,text:m.startsWith(" ")?m.slice(1):m})}}}return p(),t}var zs=(e,t)=>{let o=[],r=[],s="",i=!1;for(let d=0;d<e.length;d++){let p=e[d];i?p==='"'?e[d+1]==='"'?(s+='"',d++):i=!1:s+=p:p==='"'&&s===""?i=!0:p===t?(r.push(s),s=""):p===`
`+JSON.stringify(t):""}`},[ut.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${bg(t)}" via a navigation guard.`},[ut.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[ut.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[ut.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function co(e,t){return Ze(new Error,{type:e,[Hu]:!0},t)}function wn(e,t){return e instanceof Error&&Hu in e&&(t==null||!!(e.type&t))}var yg=["params","query","hash"];function bg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let o of yg)o in e&&(t[o]=e[o]);return JSON.stringify(t,null,2)}function ju(e){let t={};if(e===""||e==="?")return t;let o=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<o.length;++r){let s=o[r].replace(Au," "),i=s.indexOf("="),d=Ho(i<0?s:s.slice(0,i)),p=i<0?null:Ho(s.slice(i+1));if(d in t){let c=t[d];Xt(c)||(c=t[d]=[c]),c.push(p)}else t[d]=p}return t}function Fa(e){let t="";for(let o in e){let r=e[o];if(o=dg(o),r==null){r!==void 0&&(t+=(t.length?"&":"")+o);continue}(Xt(r)?r.map(s=>s&&Da(s)):[r&&Da(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+o,s!=null&&(t+="="+s))})}return t}function Gu(e){let t={};for(let o in e){let r=e[o];r!==void 0&&(t[o]=Xt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}var Wu=Symbol(""),$a=Symbol(""),xi=Symbol(""),er=Symbol(""),tr=Symbol("");function Go(){let e=[];function t(r){return e.push(r),()=>{let s=e.indexOf(r);s>-1&&e.splice(s,1)}}function o(){e=[]}return{add:t,list:()=>e.slice(),reset:o}}function Mn(e,t,o,r,s,i=d=>d()){let d=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((p,c)=>{let v=g=>{g===!1?c(co(ut.NAVIGATION_ABORTED,{from:o,to:t})):g instanceof Error?c(g):vg(g)?c(co(ut.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(d&&r.enterCallbacks[s]===d&&typeof g=="function"&&d.push(g),p())},m=i(()=>e.call(r&&r.instances[s],t,o,v)),y=Promise.resolve(m);e.length<3&&(y=y.then(v)),y.catch(g=>c(g))})}function nr(e,t,o,r,s=i=>i()){let i=[];for(let d of e)for(let p in d.components){let c=d.components[p];if(!(t!=="beforeRouteEnter"&&!d.instances[p]))if(Pu(c)){let v=(c.__vccOpts||c)[t];v&&i.push(Mn(v,o,r,d,p,s))}else{let v=c();i.push(()=>v.then(m=>{if(!m)throw new Error(`Couldn't resolve component "${p}" at "${d.path}"`);let y=xh(m)?m.default:m;d.mods[p]=m,d.components[p]=y;let g=(y.__vccOpts||y)[t];return g&&Mn(g,o,r,d,p,s)()}))}}return i}function Ku(e,t){let o=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let d=0;d<i;d++){let p=t.matched[d];p&&(e.matched.find(v=>uo(v,p))?r.push(p):o.push(p));let c=e.matched[d];c&&(t.matched.find(v=>uo(v,c))||s.push(c))}return[o,r,s]}var wg=()=>location.protocol+"//"+location.host;function sc(e,t){let{pathname:o,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let d=s.includes(e.slice(i))?e.slice(i).length:1,p=s.slice(d);return p[0]!=="/"&&(p="/"+p),Ma(p,"")}return Ma(o,e)+r+s}function kg(e,t,o,r){let s=[],i=[],d=null,p=({state:g})=>{let C=sc(e,location),w=o.value,S=t.value,N=0;if(g){if(o.value=C,t.value=g,d&&d===w){d=null;return}N=S?g.position-S.position:0}else r(C);s.forEach(b=>{b(o.value,w,{delta:N,type:Qi.pop,direction:N?N>0?Zi.forward:Zi.back:Zi.unknown})})};function c(){d=o.value}function v(g){s.push(g);let C=()=>{let w=s.indexOf(g);w>-1&&s.splice(w,1)};return i.push(C),C}function m(){if(document.visibilityState==="hidden"){let{history:g}=window;if(!g.state)return;g.replaceState(Ze({},g.state,{scroll:Hs()}),"")}}function y(){for(let g of i)g();i=[],window.removeEventListener("popstate",p),window.removeEventListener("pagehide",m),document.removeEventListener("visibilitychange",m)}return window.addEventListener("popstate",p),window.addEventListener("pagehide",m),document.addEventListener("visibilitychange",m),{pauseListeners:c,listen:v,destroy:y}}function Yu(e,t,o,r=!1,s=!1){return{back:e,current:t,forward:o,replaced:r,position:window.history.length,scroll:s?Hs():null}}function Cg(e){let{history:t,location:o}=window,r={value:sc(e,o)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(c,v,m){let y=e.indexOf("#"),g=y>-1?(o.host&&document.querySelector("base")?e:e.slice(y))+c:wg()+e+c;try{t[m?"replaceState":"pushState"](v,"",g),s.value=v}catch(C){console.error(C),o[m?"replace":"assign"](g)}}function d(c,v){i(c,Ze({},t.state,Yu(s.value.back,c,s.value.forward,!0),v,{position:s.value.position}),!0),r.value=c}function p(c,v){let m=Ze({},s.value,t.state,{forward:c,scroll:Hs()});i(m.current,m,!0),i(c,Ze({},Yu(r.value,c,null),{position:m.position+1},v),!1),r.value=c}return{location:r,state:s,push:p,replace:d}}function ic(e){e=$u(e);let t=Cg(e),o=kg(e,t.state,t.location,t.replace);function r(i,d=!0){d||o.pauseListeners(),history.go(i)}let s=Ze({locatLine truncated
`);for(let m of v){if(o&&(i>0||d>0)&&/^([-+ ]|$)/.test(m)){m.startsWith("+")?(o.lines.push({kind:"add",oldNo:"",newNo:s++,text:m.slice(1)}),d--):m.startsWith("-")?(o.lines.push({kind:"remove",oldNo:r++,newNo:"",text:m.slice(1)}),i--):(o.lines.push({kind:"ctx",oldNo:r++,newNo:s++,text:m.slice(1)}),i--,d--);continue}if(m.startsWith("diff --git")){p(),c();continue}if(m.startsWith("--- ")){o&&o.lines.length&&p(),c().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){c().newPath=m.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!/^(index |similarity index|rename |new file mode|deleted file mode|Binary files)/.test(m)){if(m.startsWith("@@")){let y=m.match(/@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);y&&(r=parseInt(y[1],10),s=parseInt(y[3],10),i=y[2]==null?1:parseInt(y[2],10),d=y[4]==null?1:parseInt(y[4],10)),c().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}if(o)if(m.startsWith("+"))o.lines.push({kind:"add",oldNo:"",newNo:s++,text:m.slice(1)});else if(m.startsWith("-"))o.lines.push({kind:"remove",oldNo:r++,newNo:"",text:m.slice(1)});else{if(m.startsWith("\\"))continue;o.lines.push({kind:"ctx",oldNo:r++,newNo:s++,text:m.startsWith(" ")?m.slice(1):m})}}}return p(),t}var js=(e,t)=>{let o=[],r=[],s="",i=!1;for(let d=0;d<e.length;d++){let p=e[d];i?p==='"'?e[d+1]==='"'?(s+='"',d++):i=!1:s+=p:p==='"'&&s===""?i=!0:p===t?(r.push(s),s=""):p===`
`||p==="\r"?(p==="\r"&&e[d+1]===`
`&&d++,r.push(s),o.push(r),r=[],s=""):s+=p}return(s!==""||r.length)&&(r.push(s),o.push(r)),o.filter(d=>d.length>1||d[0]!=="")},Go=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),Ug=(function(){let e=o=>o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=o=>{let r=['<div class="diff-file-block">','<div class="diff-file-header"><span class="diff-file-icon"><i class="far fa-file-code"></i></span><span class="diff-file-name">'+e(o.path)+'</span><span class="diff-file-status diff-file-status-'+o.status+'">'+o.status+"</span></div>"];if(o.lines.length){r.push('<table class="diff-file-table"><tbody>');for(let s of o.lines)r.push('<tr class="diff-row diff-row-'+s.kind+'"><td class="diff-gutter diff-gutter-old">'+(s.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(s.newNo||"")+'</td><td class="diff-sign">'+(s.kind==="add"?"+":s.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+Go(s.text)+'ch">'+e(s.text)+"</td></tr>");r.push("</tbody></table>")}return r.push("</div>"),r.join("")};return o=>o&&lr(o).map(t).join("")})();function Va(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Bg(e,t="EUR"){let o=Number(e)||0;return new Intl.NumberFormat(void 0,{style:"currency",currency:t,minimumFractionDigits:o%1?2:0,maximumFractionDigits:2}).format(o)}function zg(e){return String(e??"").toUpperCase()}function Hg(e,t,o=0){return(e||[]).slice(o,o+t)}function jg(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function Gg(e,t){if(!t)return e||[];let o=Array.isArray(t)?t:[t];return[...e||[]].sort((r,s)=>{for(let i of o){let d=i[0]==="-"?-1:1;i=i.replace(/^[+-]/,"");let p=i.split(".").reduce((v,m)=>v?.[m],r),c=i.split(".").reduce((v,m)=>v?.[m],s);if(typeof p=="string"&&(p=p.toLowerCase()),typeof c=="string"&&(c=c.toLowerCase()),p!==c)return(p==null?-1:c==null?1:p<c?-1:1)*d}return 0})}function dr(e,t){if(!e)return"";let o=new Date(e);if(isNaN(o))return String(e);if(!t||t==="mediumDate")return o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r={yyyy:o.getFullYear(),MMM:o.toLocaleDateString(void 0,{month:"short"}),MM:String(o.getMonth()+1).padStart(2,"0"),dd:String(o.getDate()).padStart(2,"0"),d:o.getDate(),HH:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0"),ss:String(o.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,s=>r[s])}function Wg(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function qa(e){if(!e)return"";let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e)),o=t?new Date(+t[1],+t[2]-1,+t[3]):new Date(e);if(isNaN(o))return"";let r=o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),s=new Date;s.setHours(0,0,0,0);let i=Math.round((o-s)/864e5),d;if(i===0)d="today";else if(i===1)d="tomorrow";else if(i===-1)d="yesterday";else{let p=Math.abs(i),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"],m=v[0]+" "+v[1]+(v[0]===1?"":"s");d=i>0?"in "+m:m+" ago"}return r+" \xB7 "+d}function Un(e){if(e==null||e===""||isNaN(e))return"";e=Number(e);let t="\u202F";if(e<1e3)return+(e<10?e.toFixed(2):e<100?e.toFixed(1):Math.round(e))+t+"ms";let o=e/1e3;if(o<60)return+(o<10?o.toFixed(2):o.toFixed(1))+t+"s";let r=i=>String(i).padStart(2,"0"),s=Math.round(o);return s<3600?Math.floor(s/60)+"m "+r(s%60)+"s":Math.floor(s/3600)+"h "+r(Math.floor(s%3600/60))+"m"}function La(e){if(!e)return"";let t=new Date(e);if(isNaN(t))return"";let o={day:"numeric",month:"short"};return t.getFullYear()!==new Date().getFullYear()&&(o.year="numeric"),t.toLocaleDateString(void 0,o)}function nc(e,t){return t?.split(".").reduce((o,r)=>o?.[r],e)}function Hs(e=null,t=new Map){let o=at({}),r=[],s=!1,i=new Proxy(o,{get(d,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(d,p)?Reflect.get(d,p):e?.[p]}});return Object.defineProperty(o,"parent",{value:e,configurable:!0}),Object.defineProperty(o,"viewState",{get:()=>i}),i.watch=(d,p,c=!1,v=!0)=>{let m=typeof d=="function"?()=>d(i):()=>nc(i,d),y=ut(m,p,{deep:c,flush:"post"});return r.push(y),v&&je(()=>{s||p(m(),m())}),y},i.watchGroup=(d,p,c=!0)=>i.watch(()=>d.map(v=>nc(i,v)),p,!0,c),i.on=(d,p)=>{if(d==="dispose")return r.push(p),()=>{};t.has(d)||t.set(d,new Set),t.get(d).add(p);let c=()=>t.get(d)?.delete(p);return r.push(c),c},i.emit=(d,...p)=>{for(let c of[...t.get(d)||[]])c({},...p)},i.dispose=()=>{s=!0,r.splice(0).reverse().forEach(d=>d())},Nn(i.dispose),i}function bt(){let e=new Set,t=new Set,o=!1,r=(i,d=0)=>{if(o)return;let p=setTimeout(()=>{e.delete(p),i()},d);return e.add(p),p};r.cancel=i=>{clearTimeout(i),e.delete(i)};let s=(i,d)=>{if(o)return;let p=setInterval(i,d);return t.add(p),p};return s.cancel=i=>{clearInterval(i),t.delete(i)},Nn(()=>{o=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:r,interval:s}}function Ot(){let e=new Set;return N Line truncated
`).forEach((L,E)=>{for(let[F,Y]of k){let G=F.exec(L);if(G&&!/^(if|for|while|switch|return|catch)$/.test(G[1])){O.push({name:G[1],kind:Y,line:E+1});break}}}),w={content:e.content,list:O.slice(0,300)},w.list},e.goToSymbol=function(O){e.symbolsOpen=!1;let L=e.codeEditor;L&&(L.scrollToLine(O-1,!0,!0,()=>{}),L.gotoLine(O,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+O),window.dispatchEvent(new HashChangeEvent("hashchange")))},e.gotoLine=function(){e.codeEditor&&(e.moreOpen=!1,e.gotoError="",e.gotoValue=String(e.codeEditor.getCursorPosition().row+1),e.gotoOpen=!0,setTimeout(()=>{let O=window.document.getElementById("goto-input");O&&(O.focus(),O.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let O=e.codeEditor;if(!O)return;let L=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),E=O.session.getLength();if(!L||+L[1]<1||+L[1]>E){e.gotoError="Enter a line from 1 to "+E;return}O.gotoLine(+L[1],L[2]?Math.max(0,+L[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",O.focus()},e.rootEntries=function(){return[...e.files||[]].sort((O,L)=>{let E=O.size==null,F=L.size==null;return E!==F?E?-1:1:O.name.localeCompare(L.name)})},e.formatSize=function(O){if(O==null)return"";if(O<1024)return O+" B";let L=O/1024,E=F=>F.toFixed(1).replace(/\.0$/,"");return L<1024?E(L)+" KB":L<1024*1024?E(L/1024)+" MB":E(L/1024/1024)+" GB"},e.fileSize=function(O){if(!O)return null;let L=O.replace(/^\/+/,""),E=(e.files||[]).find(F=>(F.path?F.path+"/":"")+F.name===L);return E&&E.size!=null?E.size:null},e.revealFolder=function(O){e.sidebarHidden=!1,e.sidebarCollapsed=!1,je(()=>{let L=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(O):O)+'"]');L&&(L.closest("li")?.classList.contains("open")||L.click(),L.scrollIntoView({block:"nearest"}),L.focus())})};let C={content:null,n:0},N=O=>{if(C.content===O)return C.n;let L=O;if(typeof L=="string")try{L=JSON.parse(L)}catch{L=null}let E=[],F=G=>{Array.isArray(G)?E.push(G.join("")):typeof G=="string"&&E.push(G)};(L&&(L.cells||(L.worksheets||[]).flatMap(G=>G.cells||[]))||[]).forEach(G=>{F(G?.source??G?.input),(G?.outputs||[]).forEach(Z=>{F(Z?.text),Z?.data&&(F(Z.data["text/plain"]),F(Z.data["text/markdown"]),F(Z.data["text/html"])),F(Z?.traceback)})});let Y=E.reduce((G,Z)=>G+(Z.match(o)||[]).length,0);return C={content:O,n:Y},Y};e.redactionCount=function(){return e.type==="IPython"?N(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(o)||[]).length},e.renderRedacted=Wo;let b=O=>O.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(O){let L=e.renderRedacted(O);if(!L||typeof window.DOMParser!="function")return L;let E=new window.DOMParser().parseFromString("<div>"+L+"</div>","text/html"),F={};return E.querySelectorAll("h1, h2, h3").forEach(Y=>{let G=Y.id||b(Y.textContent);F[G]?G+="-"+ ++F[G]:F[G]=1,Y.id=G}),E.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},M=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let O=sr(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),L=O.length,E=null;if(O[0]?.level===1&&O.filter(F=>F.level===1).length===1){E=O[0],O=O.slice(1);let F=Math.min(...O.map(Y=>Y.level));O=O.map(Y=>({...Y,depth:Y.level-F}))}return P={content:e.content,list:O,title:E,count:L},P};e.readmeToc=()=>M().list,e.tocTitle=()=>M().title,e.tocCount=()=>M().count,e.activeHeading=null,s(window,"scroll",()=>{let O=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let L=ir(O.map(E=>E.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==L&&(e.activeHeading=L)},{capture:!0,passive:!0}),e.scrollToHeading=function(O){if(!O){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}rr(O),e.activeHeading=O},e.csvView="table";let _={content:null,rows:[]};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(_.content!==e.content){let O=/\.tsv$/i.test(e.filePath||"")?" ":",";_={content:e.content,rows:zs(e.content,O)}}return _.rows},e.csvNumCol=O=>{let L=e.csvRows().slice(1).map(E=>E[O]).filter(E=>E!=null&&String(E).trim()!=="");return L.length>0&&L.every(E=>e.csvNumeric(E))},e.csvNumeric=O=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(O)&&/\d/.test(O),e.redactParts=wn,e.pathCopied=!1,e.copyPath=async function(){window.navigator.clipboard?.writeText&&(await window.navigator.clipboard.writeText(e.filePath||""),e.pathCopied=!0,setTimeout(()=>{e.pathCopied=!1},1600))},e.contentCopied=!1,e.copyContent=async function(){if(typeof e.content!="string"||!window.navigator.clipboard?.writeText)return;let O=e.content;if(e.type== Line truncated
`).length:0,Yg=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function sc(e,t){let o=Ot();e.redactParts=wn,e.hangIndent=Go,e.isRedactedName=s=>/^XXXX-\d+$/.test(String(s||"").trim()),e.tocOpen=!1,e.activeAnchor="";let r=()=>{let s=t();if(!s.length)return;let i=ir(s,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==i&&(e.activeAnchor=i)};return o(window,"scroll",r,{capture:!0,passive:!0}),o(window,"resize",r,{passive:!0}),o(window.document,"click",s=>{e.tocOpen&&!s.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),o(window.document,"keydown",s=>{s.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=s=>{e.tocOpen=!1,rr(s)&&(e.activeAnchor=s)},r}var ur=e=>(String(e||"").split(".").pop()||"").toLowerCase(),Jg={md:"markdown",markdown:"markdown",mdx:"markdown",ipynb:"notebook",csv:"csv",tsv:"csv",svg:"svg",png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",bmp:"image",ico:"image",avif:"image",pdf:"pdf",mp4:"video",webm:"video",mov:"video",m4v:"video",ogv:"video",mp3:"audio",wav:"audio",ogg:"audio",oga:"audio",m4a:"audio",flac:"audio",aac:"audio"},Xg={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",pdf:"application/pdf",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/mp4",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",m4a:"audio/mp4",flac:"audio/flac",aac:"audio/aac"},Qg=1024*1024;function Ko(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=Jg[ur(e?.filename)]||(e?.language==="Markdown"?"markdown":null);return e?.encoding==="base64"?["image","pdf","video","audio"].includes(t)&&e.content?t:"binary":e?.content?t==="csv"&&e.content.length>Qg?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var Zg=e=>["markdown","notebook","csv","svg"].includes(e),oc={markdown:"Markdown",notebook:"Jupyter notebook",csv:"Table",svg:"SVG",image:"Image",pdf:"PDF",video:"Video",audio:"Audio",binary:"Binary","too-large":"Too large",hidden:"Image"};function xg(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||ur(e?.filename)||"none"}var ev=e=>{let t=window.atob(e||""),o=new Uint8Array(t.length);for(let r=0;r<t.length;r++)o[r]=t.charCodeAt(r);return o};function ic(e){e.gistViews={},e.gistKind=i=>Ko(e.details?.files?.[i]),e.gistHasRendered=i=>Zg(e.gistKind(i)),e.gistView=i=>e.gistHasRendered(i)&&e.gistViews[i]!=="raw"?"rendered":"raw",e.setGistView=(i,d)=>{e.gistViews={...e.gistViews,[i]:d}},e.gistSourceFile=i=>{let d=e.details?.files?.[i];return{...d,language:xg(d,e.gistKind(i)),filename:"source.txt"}};let t=new Map;Nn(()=>{t.forEach(i=>window.URL.revokeObjectURL?.(i)),t.clear()});let o=(i,d)=>{if(!i||!window.URL?.createObjectURL)return null;let p=i.encoding==="base64",c=!d||p?Xg[ur(i.filename)]||(p?"application/octet-stream":"text/plain"):"text/plain",v=(i.filename||"")+"\0"+c+"\0"+(i.content||"").length;if(!t.has(v)){let m=p?ev(i.content):i.content||"";t.set(v,window.URL.createObjectURL(new window.Blob([m],{type:c+(p?"":";charset=utf-8")})))}return t.get(v)};e.gistMediaUrl=i=>o(i,!1),e.gistRawUrl=i=>o(i,!0);let r={content:null,rows:[]};e.gistCsvRows=i=>(r.content!==i?.content&&(r={content:i?.content,rows:zs(i?.content||"",ur(i?.filename)==="tsv"?" ":",")}),r.rows),e.gistCsvNumeric=(i,d)=>{let p=e.gistCsvRows(i).slice(1).map(c=>c[d]).filter(c=>c!=null&&String(c).trim()!=="");return p.length>0&&p.every(c=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(c)&&/\d/.test(c))},e.gistCopied=null,e.copyGistFile=async i=>{let d=e.details?.files?.[i];!d||d.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(d.content||""),e.gistCopied=i,window.setTimeout(()=>{e.gistCopied===i&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=i=>"file-"+(i+1),e.setFileOutline=(i,d)=>{let p=e.fileOutlines[i];p&&p.map(c=>c.id).join()===d.map(c=>c.id).join()||(e.fileOutlines={...e.fileOutlines,[i]:d})},e.gistToc=()=>(e.details?.files||[]).map((i,d)=>({id:e.gistFileId(d),index:d,parts:wn(i.filename),kind:Ko(i),language:oc[Ko(i)]&&Ko(i)!=="csv"?oc[Ko(i)]:i.language||(Ko(i)==="csv"?"CSV":"Text"),lines:i.encoding==="base64"?null:Kg(i.content),size:i.size,headings:Yg(i)&&e.gistView(d)==="rendered"?e.fileOutlines[d]||[]:[]}));let s=()=>e.gistToc().flatMap(i=>[i.id,...i.headings.map(d=>d.id)]);e.showGistToc=()=>{let i=e.gistToc();return e.tabState?.active==="files"&&(i.length>=2||(i[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let d=e.gistToc().find(p=>p.id===e.activeAnchor||p.headings.some(c=>c.id===e.activeAnchor));return d?d.index:0},sc(e,s)}var tv=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function rc(e){let t={diff:null,threads:null,files:[]};e.prFiles=()=>{let o=e.details?.diff,r=e.details?.reviewComments| Line truncated
`&&d++,r.push(s),o.push(r),r=[],s=""):s+=p}return(s!==""||r.length)&&(r.push(s),o.push(r)),o.filter(d=>d.length>1||d[0]!=="")},Wo=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),Yg=(function(){let e=o=>o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=o=>{let r=['<div class="diff-file-block">','<div class="diff-file-header"><span class="diff-file-icon"><i class="far fa-file-code"></i></span><span class="diff-file-name">'+e(o.path)+'</span><span class="diff-file-status diff-file-status-'+o.status+'">'+o.status+"</span></div>"];if(o.lines.length){r.push('<table class="diff-file-table"><tbody>');for(let s of o.lines)r.push('<tr class="diff-row diff-row-'+s.kind+'"><td class="diff-gutter diff-gutter-old">'+(s.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(s.newNo||"")+'</td><td class="diff-sign">'+(s.kind==="add"?"+":s.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+Wo(s.text)+'ch">'+e(s.text)+"</td></tr>");r.push("</tbody></table>")}return r.push("</div>"),r.join("")};return o=>o&&cr(o).map(t).join("")})();function Ba(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Jg(e,t="EUR"){let o=Number(e)||0;return new Intl.NumberFormat(void 0,{style:"currency",currency:t,minimumFractionDigits:o%1?2:0,maximumFractionDigits:2}).format(o)}function Xg(e){return String(e??"").toUpperCase()}function Qg(e,t,o=0){return(e||[]).slice(o,o+t)}function Zg(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function xg(e,t){if(!t)return e||[];let o=Array.isArray(t)?t:[t];return[...e||[]].sort((r,s)=>{for(let i of o){let d=i[0]==="-"?-1:1;i=i.replace(/^[+-]/,"");let p=i.split(".").reduce((v,m)=>v?.[m],r),c=i.split(".").reduce((v,m)=>v?.[m],s);if(typeof p=="string"&&(p=p.toLowerCase()),typeof c=="string"&&(c=c.toLowerCase()),p!==c)return(p==null?-1:c==null?1:p<c?-1:1)*d}return 0})}function pr(e,t){if(!e)return"";let o=new Date(e);if(isNaN(o))return String(e);if(!t||t==="mediumDate")return o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r={yyyy:o.getFullYear(),MMM:o.toLocaleDateString(void 0,{month:"short"}),MM:String(o.getMonth()+1).padStart(2,"0"),dd:String(o.getDate()).padStart(2,"0"),d:o.getDate(),HH:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0"),ss:String(o.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,s=>r[s])}function ev(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function fr(e){if(!e)return"";let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e)),o=t?new Date(+t[1],+t[2]-1,+t[3]):new Date(e);if(isNaN(o))return"";let r=o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),s=new Date;s.setHours(0,0,0,0);let i=Math.round((o-s)/864e5),d;if(i===0)d="today";else if(i===1)d="tomorrow";else if(i===-1)d="yesterday";else{let p=Math.abs(i),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"],m=v[0]+" "+v[1]+(v[0]===1?"":"s");d=i>0?"in "+m:m+" ago"}return r+" \xB7 "+d}function Bn(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 o=e/1e3;if(o<60)return+(o<10?o.toFixed(2):o.toFixed(1))+t+"s";let r=i=>String(i).padStart(2,"0"),s=Math.round(o);return s<3600?Math.floor(s/60)+"m "+r(s%60)+"s":Math.floor(s/3600)+"h "+r(Math.floor(s%3600/60))+"m"}function mr(e){if(!e)return"";let t=new Date(e);if(isNaN(t))return"";let o={day:"numeric",month:"short"};return t.getFullYear()!==new Date().getFullYear()&&(o.year="numeric"),t.toLocaleDateString(void 0,o)}function uc(e,t){return t?.split(".").reduce((o,r)=>o?.[r],e)}function Gs(e=null,t=new Map){let o=rt({}),r=[],s=!1,i=new Proxy(o,{get(d,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(d,p)?Reflect.get(d,p):e?.[p]}});return Object.defineProperty(o,"parent",{value:e,configurable:!0}),Object.defineProperty(o,"viewState",{get:()=>i}),i.watch=(d,p,c=!1,v=!0)=>{let m=typeof d=="function"?()=>d(i):()=>uc(i,d),y=dt(m,p,{deep:c,flush:"post"});return r.push(y),v&&Be(()=>{s||p(m(),m())}),y},i.watchGroup=(d,p,c=!0)=>i.watch(()=>d.map(v=>uc(i,v)),p,!0,c),i.on=(d,p)=>{if(d==="dispose")return r.push(p),()=>{};t.has(d)||t.set(d,new Set),t.get(d).add(p);let c=()=>t.get(d)?.delete(p);return r.push(c),c},i.emit=(d,...p)=>{for(let c of[...t.get(d)||[]])c({},...p)},i.dispose=()=>{s=!0,r.splice(0).reverse().forEach(d=>d())},Pn(i.dispose),i}function yt(){let e=new Set,t=new Set,o=!1,r=(i,d=0)=>{if(o)return;let p=setTimeout(()=>{e.delete(p),i()},d);return e.add(p),p};r.cancel=i=>{clearTimeout(i),e.delete(i)};let s=(i,d)=>{if(o)return;let p=setInterval(i,d);return t.add(p),p};return s.cancel=i=>{clearInterval(i),t.delete(i)},Pn(()=>{o=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:r,interval:s}}function Ot(){let e=new Set;return P Line truncated
`).forEach((q,E)=>{for(let[F,Y]of C){let G=F.exec(q);if(G&&!/^(if|for|while|switch|return|catch)$/.test(G[1])){O.push({name:G[1],kind:Y,line:E+1});break}}}),w={content:e.content,list:O.slice(0,300)},w.list},e.goToSymbol=function(O){e.symbolsOpen=!1;let q=e.codeEditor;q&&(q.scrollToLine(O-1,!0,!0,()=>{}),q.gotoLine(O,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+O),window.dispatchEvent(new HashChangeEvent("hashchange")))},e.gotoLine=function(){e.codeEditor&&(e.moreOpen=!1,e.gotoError="",e.gotoValue=String(e.codeEditor.getCursorPosition().row+1),e.gotoOpen=!0,setTimeout(()=>{let O=window.document.getElementById("goto-input");O&&(O.focus(),O.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let O=e.codeEditor;if(!O)return;let q=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),E=O.session.getLength();if(!q||+q[1]<1||+q[1]>E){e.gotoError="Enter a line from 1 to "+E;return}O.gotoLine(+q[1],q[2]?Math.max(0,+q[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",O.focus()},e.rootEntries=function(){return[...e.files||[]].sort((O,q)=>{let E=O.size==null,F=q.size==null;return E!==F?E?-1:1:O.name.localeCompare(q.name)})},e.formatSize=function(O){if(O==null)return"";if(O<1024)return O+" B";let q=O/1024,E=F=>F.toFixed(1).replace(/\.0$/,"");return q<1024?E(q)+" KB":q<1024*1024?E(q/1024)+" MB":E(q/1024/1024)+" GB"},e.fileSize=function(O){if(!O)return null;let q=O.replace(/^\/+/,""),E=(e.files||[]).find(F=>(F.path?F.path+"/":"")+F.name===q);return E&&E.size!=null?E.size:null},e.revealFolder=function(O){e.sidebarHidden=!1,e.sidebarCollapsed=!1,Be(()=>{let q=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(O):O)+'"]');q&&(q.closest("li")?.classList.contains("open")||q.click(),q.scrollIntoView({block:"nearest"}),q.focus())})};let S={content:null,n:0},N=O=>{if(S.content===O)return S.n;let q=O;if(typeof q=="string")try{q=JSON.parse(q)}catch{q=null}let E=[],F=G=>{Array.isArray(G)?E.push(G.join("")):typeof G=="string"&&E.push(G)};(q&&(q.cells||(q.worksheets||[]).flatMap(G=>G.cells||[]))||[]).forEach(G=>{F(G?.source??G?.input),(G?.outputs||[]).forEach(x=>{F(x?.text),x?.data&&(F(x.data["text/plain"]),F(x.data["text/markdown"]),F(x.data["text/html"])),F(x?.traceback)})});let Y=E.reduce((G,x)=>G+(x.match(o)||[]).length,0);return S={content:O,n:Y},Y};e.redactionCount=function(){return e.type==="IPython"?N(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(o)||[]).length},e.renderRedacted=Ko;let b=O=>O.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(O){let q=e.renderRedacted(O);if(!q||typeof window.DOMParser!="function")return q;let E=new window.DOMParser().parseFromString("<div>"+q+"</div>","text/html"),F={};return E.querySelectorAll("h1, h2, h3").forEach(Y=>{let G=Y.id||b(Y.textContent);F[G]?G+="-"+ ++F[G]:F[G]=1,Y.id=G}),E.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},V=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let O=ar(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),q=O.length,E=null;if(O[0]?.level===1&&O.filter(F=>F.level===1).length===1){E=O[0],O=O.slice(1);let F=Math.min(...O.map(Y=>Y.level));O=O.map(Y=>({...Y,depth:Y.level-F}))}return P={content:e.content,list:O,title:E,count:q},P};e.readmeToc=()=>V().list,e.tocTitle=()=>V().title,e.tocCount=()=>V().count,e.activeHeading=null,s(window,"scroll",()=>{let O=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let q=lr(O.map(E=>E.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==q&&(e.activeHeading=q)},{capture:!0,passive:!0}),e.scrollToHeading=function(O){if(!O){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}dr(O),e.activeHeading=O},e.csvView="table";let _={content:null,rows:[]};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(_.content!==e.content){let O=/\.tsv$/i.test(e.filePath||"")?" ":",";_={content:e.content,rows:js(e.content,O)}}return _.rows},e.csvNumCol=O=>{let q=e.csvRows().slice(1).map(E=>E[O]).filter(E=>E!=null&&String(E).trim()!=="");return q.length>0&&q.every(E=>e.csvNumeric(E))},e.csvNumeric=O=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(O)&&/\d/.test(O),e.redactParts=kn,e.pathCopied=!1,e.copyPath=async function(){window.navigator.clipboard?.writeText&&(await window.navigator.clipboard.writeText(e.filePath||""),e.pathCopied=!0,setTimeout(()=>{e.pathCopied=!1},1600))},e.contentCopied=!1,e.copyContent=async function(){if(typeof e.content!="string"||!window.navigator.clipboard?.writeText)return;let O=e.content;if(e.type== Line truncated
`).length:0,nv=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function pc(e,t){let o=Ot();e.redactParts=kn,e.hangIndent=Wo,e.isRedactedName=s=>/^XXXX-\d+$/.test(String(s||"").trim()),e.tocOpen=!1,e.activeAnchor="";let r=()=>{let s=t();if(!s.length)return;let i=lr(s,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==i&&(e.activeAnchor=i)};return o(window,"scroll",r,{capture:!0,passive:!0}),o(window,"resize",r,{passive:!0}),o(window.document,"click",s=>{e.tocOpen&&!s.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),o(window.document,"keydown",s=>{s.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=s=>{e.tocOpen=!1,dr(s)&&(e.activeAnchor=s)},r}var hr=e=>(String(e||"").split(".").pop()||"").toLowerCase(),ov={md:"markdown",markdown:"markdown",mdx:"markdown",ipynb:"notebook",csv:"csv",tsv:"csv",svg:"svg",png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",bmp:"image",ico:"image",avif:"image",pdf:"pdf",mp4:"video",webm:"video",mov:"video",m4v:"video",ogv:"video",mp3:"audio",wav:"audio",ogg:"audio",oga:"audio",m4a:"audio",flac:"audio",aac:"audio"},sv={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",pdf:"application/pdf",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/mp4",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",m4a:"audio/mp4",flac:"audio/flac",aac:"audio/aac"},iv=1024*1024;function Yo(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=ov[hr(e?.filename)]||(e?.language==="Markdown"?"markdown":null);return e?.encoding==="base64"?["image","pdf","video","audio"].includes(t)&&e.content?t:"binary":e?.content?t==="csv"&&e.content.length>iv?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var rv=e=>["markdown","notebook","csv","svg"].includes(e),cc={markdown:"Markdown",notebook:"Jupyter notebook",csv:"Table",svg:"SVG",image:"Image",pdf:"PDF",video:"Video",audio:"Audio",binary:"Binary","too-large":"Too large",hidden:"Image"};function av(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||hr(e?.filename)||"none"}var lv=e=>{let t=window.atob(e||""),o=new Uint8Array(t.length);for(let r=0;r<t.length;r++)o[r]=t.charCodeAt(r);return o};function fc(e){e.gistViews={},e.gistKind=i=>Yo(e.details?.files?.[i]),e.gistHasRendered=i=>rv(e.gistKind(i)),e.gistView=i=>e.gistHasRendered(i)&&e.gistViews[i]!=="raw"?"rendered":"raw",e.setGistView=(i,d)=>{e.gistViews={...e.gistViews,[i]:d}},e.gistSourceFile=i=>{let d=e.details?.files?.[i];return{...d,language:av(d,e.gistKind(i)),filename:"source.txt"}};let t=new Map;Pn(()=>{t.forEach(i=>window.URL.revokeObjectURL?.(i)),t.clear()});let o=(i,d)=>{if(!i||!window.URL?.createObjectURL)return null;let p=i.encoding==="base64",c=!d||p?sv[hr(i.filename)]||(p?"application/octet-stream":"text/plain"):"text/plain",v=(i.filename||"")+"\0"+c+"\0"+(i.content||"").length;if(!t.has(v)){let m=p?lv(i.content):i.content||"";t.set(v,window.URL.createObjectURL(new window.Blob([m],{type:c+(p?"":";charset=utf-8")})))}return t.get(v)};e.gistMediaUrl=i=>o(i,!1),e.gistRawUrl=i=>o(i,!0);let r={content:null,rows:[]};e.gistCsvRows=i=>(r.content!==i?.content&&(r={content:i?.content,rows:js(i?.content||"",hr(i?.filename)==="tsv"?" ":",")}),r.rows),e.gistCsvNumeric=(i,d)=>{let p=e.gistCsvRows(i).slice(1).map(c=>c[d]).filter(c=>c!=null&&String(c).trim()!=="");return p.length>0&&p.every(c=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(c)&&/\d/.test(c))},e.gistCopied=null,e.copyGistFile=async i=>{let d=e.details?.files?.[i];!d||d.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(d.content||""),e.gistCopied=i,window.setTimeout(()=>{e.gistCopied===i&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=i=>"file-"+(i+1),e.setFileOutline=(i,d)=>{let p=e.fileOutlines[i];p&&p.map(c=>c.id).join()===d.map(c=>c.id).join()||(e.fileOutlines={...e.fileOutlines,[i]:d})},e.gistToc=()=>(e.details?.files||[]).map((i,d)=>({id:e.gistFileId(d),index:d,parts:kn(i.filename),kind:Yo(i),language:cc[Yo(i)]&&Yo(i)!=="csv"?cc[Yo(i)]:i.language||(Yo(i)==="csv"?"CSV":"Text"),lines:i.encoding==="base64"?null:tv(i.content),size:i.size,headings:nv(i)&&e.gistView(d)==="rendered"?e.fileOutlines[d]||[]:[]}));let s=()=>e.gistToc().flatMap(i=>[i.id,...i.headings.map(d=>d.id)]);e.showGistToc=()=>{let i=e.gistToc();return e.tabState?.active==="files"&&(i.length>=2||(i[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let d=e.gistToc().find(p=>p.id===e.activeAnchor||p.headings.some(c=>c.id===e.activeAnchor));return d?d.index:0},pc(e,s)}var dv=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function mc(e){let t={diff:null,threads:null,files:[]};e.prFiles=()=>{let o=e.details?.diff,r=e.details?.reviewComments| Line truncated
`),p=r.date?e.fmt?.date(r.date):"",c=o[o.length-1];(!c||c.day!==p)&&o.push(c={day:p,commits:[]}),c.commits.push({...r,index:s+1,headline:i,detail:d.join(`
`).trim()})}),o},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let o=e.prFiles().find(r=>r.id===e.activeAnchor);return o?o.index:0},e.openTab=o=>{e.tabState={active:o},e.tocOpen=!1},e.showInDiff=o=>{o&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[o.index]:!1},je(()=>e.jumpToAnchor(o.id)))},e.jumpToFile=o=>{e.collapsedFiles={...e.collapsedFiles,[o.index]:!1},e.jumpToAnchor(o.id)},sc(e,()=>e.tabState?.active==="files"?e.prFiles().map(o=>o.id):[])}function ac(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function $a(e,t,o){let r,s=!1,i="form-draft:"+o,d=()=>Object.fromEntries(t.map(g=>[g,e[g]])),p=()=>JSON.stringify(d()),c=g=>{for(let k of t)Object.prototype.hasOwnProperty.call(g,k)&&(e[k]=g[k]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},v=()=>{try{window.sessionStorage.removeItem(i)}catch{}},m=(g=!1)=>{if(r!==void 0){if(g&&document.querySelectorAll("input, select, textarea").forEach(k=>{k._field?.binding.state===e&&k._field.timer&&k._field.commit()}),e.unsavedChanges=p()!==r,e.draftSaved=!1,!e.unsavedChanges){v();return}try{window.sessionStorage.setItem(i,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:d()})),e.draftSaved=!0}catch{}}},y=()=>m(!0);return e.on("routeLeave",y),window.addEventListener("beforeunload",y),e.on("dispose",()=>window.removeEventListener("beforeunload",y)),{restore(){r=p();let g;try{g=JSON.parse(window.sessionStorage.getItem(i)||"null")}catch{}let k=g&&g.account===(e.user?.username||null)&&Date.now()-g.savedAt<30*6e4&&g.values;return k&&(c(g.values),e.draftRestored=!0),s||(s=!0,e.watch(()=>d(),()=>m(),!0)),e.unsavedChanges=p()!==r,!!k},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state===e&&g._field.timer&&g._field.commit()}),JSON.parse(p())},accept(g){r=JSON.stringify(g),e.draftRestored=!1,m()},discard(){document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state!==e||!g._field.timer||(clearTimeout(g._field.timer),g._field.timer=null,g.value=g._field.binding.value??"")}),r!==void 0&&c(JSON.parse(r)),e.draftRestored=!1,m()},clear(){r=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,v()}}}function lc(e,t){e.errorSource="central",e.logView={search:"",severity:"",sort:"recent"},e.selectedLog=null,e.logDetailTab="overview",e.logSeverity=y=>Number(y?.status||y?.httpStatus)>=500||["error","fatal"].includes(y?.severity)?"error":y?.severity==="warn"?"warn":"info",e.filteredLogGroups=()=>{let y=e.logView.search.trim().toLowerCase();return(e.logData?.groups||[]).filter(g=>(!e.logView.severity||e.logSeverity(g.sample)===e.logView.severity)&&(!y||Object.values(g.sample).join(" ").toLowerCase().includes(y))).slice().sort((g,k)=>e.logView.sort==="count"?k.count-g.count:Date.parse(k.last)-Date.parse(g.last))},e.shortLogId=y=>y?y.slice(0,8):"",e.isLogIdentifier=(y,g)=>typeof g=="string"&&g.length>16&&/(?:id|sha|release)$/i.test(y),e.compactLogValue=y=>String(y).slice(0,8)+"\u2026"+String(y).slice(-4),e.logCopyStatus="",e.copyLogValue=async y=>{try{await navigator.clipboard.writeText(String(y)),e.logCopyStatus="Full value copied"}catch{e.logCopyStatus="Copy unavailable. Expand the value to select it."}},e.logExplanation=y=>{let g=y.service||"The application",k={job_failed:"reported a failed job",request_failed:"reported a failed request",request_aborted:"reported an aborted request",edge_request:"recorded an edge request",http_access:"recorded an HTTP request"}[y.event]||"recorded \u201C"+(y.event||"application event")+"\u201D",w=Number(y.status||y.httpStatus),C={502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[w];return g+" "+k+(w?" with HTTP "+w+(C?" ("+C+")":""):"")+"."},e.logEvidence=y=>[y.errorCode?"Recorded error code: "+y.errorCode+".":"No error code was included in this sample.",y.ms!==void 0?"Recorded duration: "+y.ms+" ms.":"",y.attempt!==void 0?"Recorded attempt: "+y.attempt+".":"",y.queue?"Queue: "+y.queue+".":""].filter(Boolean).join(" "),e.occurrenceTime=y=>Number.isFinite(Date.parse(y))?new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"}):"Time not captured",e.historyOccurrences=y=>(y?._related||[]).slice().sort((g,k)=>Date.parse(k.ts)-Date.parse(g.ts)),e.historyDetailFields=y=>{try{let g=JSON.parse(y?._detailJson||"{}");return g&&typeof g=="object"?Object.entries(g):[["value",g]]}catch{return[["record",y?._detailJson||""]]}},e.logFieldText=y=>typeof y=="object"?JSON.stringify(y):String(y??""),e.captureErrorScroll=y=>{let g=[];for(let k=y?.parentElement;k;k=k.parentElement)g.push({element:k,top:k.scrollTop,left:k.scrollLeft});return g},e.restoreErrorScroll=y=>y.forEach(({element:g,top:k,left:w})=>{g.isConnected&&(g.scrollTop=k,g.scrollLeft=w)});let o=null,r=null,s=null,i=[];e.selectLog=async(y,g)=>{if(r=g||document.activeElement, Line truncated
`+C.join(`
`)],{type:"text/csv"}),b=document.createElement("a");b.href=URL.createObjectURL(N),b.download=r.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(r.username),c(r.username),e.banUser=()=>{confirm(`Ban user ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/ban`).then(()=>v(r.username),g=>console.error(g))},e.activateUser=()=>{t.post(`/api/admin/users/${r.username}/activate`).then(()=>v(r.username),g=>console.error(g))},e.promoteUser=()=>{confirm(`Promote ${r.username} to admin?`)&&t.post(`/api/admin/users/${r.username}/promote`).then(()=>v(r.username),g=>console.error(g))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/demote`).then(()=>v(r.username),g=>console.error(g))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(g=>{e.tokens=g.data||[]},g=>{g.status!==401&&g.status!==403&&console.error(g)})}m(),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="",m()},g=>console.error(g))},e.revokeToken=g=>{confirm(`Revoke token "${g.name}"?`)&&t.delete("/api/admin/tokens/"+g.id).then(()=>m(),k=>console.error(k))},e.removeCache=g=>{confirm("Remove cached files for "+g.repoId+"?")&&t.delete("/api/admin/repos/"+g.repoId).then(()=>c(r.username),k=>console.error(k))},e.removeRepository=g=>{confirm("Remove repository "+g.repoId+"?")&&t.delete("/api/repo/"+g.repoId+"/").then(()=>c(r.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",()=>{s.timeout.cancel(y),y=s.timeout(()=>{c(r.username)},500)},!0)},pc=function(e,t,o){let r=bt(),s=Ot();e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.conferences=[],e.total=-1,e.totalPage=0,e.statusCounts=[];let i=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()}};s(document,"keydown",i),e.on("dispose",()=>document.removeEventListener("keydown",i)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let d=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let C=(e.statusCounts||[]).find(N=>N._id===w);return C?C.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let p="admin.conferences.filterPrefs",c={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},v=loadFilterPrefs(p)||{};e.query=Object.assign({},c,v,{page:1,search:""});let m=o.search();m.search&&(e.query.search=m.search);let y="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(y)||"[]"),e.savePreset=()=>{let w=window.prompt("Preset name:");if(!w)return;let C=Object.assign({},e.query);delete C.page,e.presets=(e.presets||[]).filter(N=>N.name!==w),e.presets.push({name:w,query:C}),localStorage.setItem(y,JSON.stringify(e.presets))},e.applyPreset=w=>{Object.assign(e.query,w.query,{page:1})},e.deletePreset=w=>{e.presets=(e.presets||[]).filter(C=>C.name!==w.name),localStorage.setItem(y,JS Line truncated
`):typeof z.stack=="string"?z.stack:null;for(var O=[z.cause,z.err].filter(Boolean),L=0;!F&&L<O.length;L++)for(var E=O[L];!F&&E&&typeof E=="object";)typeof E.stack=="string"&&(F=E.stack),E=E.cause;q._stack=F}else q.displayMessage=q.message,q._status=null,q._url=null,q._stack=null;return q._bucket=g(z,q.level),q._detailJson=w(q,z),q}function w(q,z){let O=[],L=(G,Z)=>{Z==null||Z===""||O.push([G,Z])};for(let G of["service","event","severity","requestId","jobId"])L(G,z&&z[G]);L("name",z&&z.name),L("code",q.displayMessage||z&&z.message),q._bucket&&L("kind",q._bucket),L("httpStatus",z&&z.httpStatus),z&&z.status&&!z.httpStatus&&L("status",z.status),L("module",q.module);let E=z&&z.detail;if(typeof E=="string"){let G=E.trim();if(G[0]==="{"||G[0]==="[")try{E=JSON.parse(E)}catch{}}if(L("detail",E),L("repoId",z&&z.repoId),L("filePath",z&&z.filePath),L("upstreamStatus",z&&z.upstreamStatus),L("upstreamBody",z&&z.upstreamBody),L("url",q._url),L("err",z&&z.err),L("cause",z&&!z.err&&z.cause),L("ts",q.ts),!O.length)return JSON.stringify(q,null,2);let F=O.reduce((G,Z)=>Math.max(G,Z[0].length),0),Y=["{"];return O.forEach(([G,Z],ie)=>{let fe=` ${`"${G}":`.padEnd(F+3," ")} `,ve=ie<O.length-1?",":"",Be;if(Z&&typeof Z=="object"){let He=" ".repeat(fe.length);Be=JSON.stringify(Z,null,2).split(`
`).map((Ze,Ne)=>Ne===0?Ze:He+Ze).join(`
`)}else typeof Z=="number"||typeof Z=="boolean"?Be=String(Z):Be=JSON.stringify(Z);Y.push(`${fe}${Be}${ve}`)}),Y.push("}"),Y.join(`
`)}function C(q){let z=[],O="",L=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,E=0,F;for(;F=L.exec(q);)O+=q.slice(E,F.index),E=L.lastIndex,z.push({key:F[1],op:F[2]||"=",val:F[3]});return O+=q.slice(E),{filters:z,free:O.trim().toLowerCase()}}function N(q,z){for(let O of z.filters){let L=(F,Y,G)=>{let Z=parseFloat(F),ie=parseFloat(Y);return G==="="?String(F)===String(Y):G==="!="?String(F)!==String(Y):G===">="?Z>=ie:G==="<="?Z<=ie:G===">"?Z>ie:G==="<"?Z<ie:!0},E;if(O.key==="code")E=q.displayMessage;else if(O.key==="module")E=q.module;else if(O.key==="status")E=q._status;else if(O.key==="url")E=q._url;else if(O.key==="repo")E=q._repoId;else if(O.key==="level")E=q.level;else continue;if(E==null||!L(E,O.val,O.op))return!1}return!(z.free&&((q.displayMessage||"")+" "+(q.module||"")+" "+(q._url||"")+" "+JSON.stringify(q.raw||[])).toLowerCase().indexOf(z.free)===-1)}function b(){let q=C(e.query.search||"");e.parsedFilterCount=q.filters.length;let z=e.query.bucket,O=e.entries.filter(G=>z&&G._bucket!==z?!1:N(G,q)),L=e.query.group;if(L){let G=x=>JSON.stringify(L==="module"?[x.module,x._bucket]:[x.raw?.[0]?.service||"unknown",x.module,x.displayMessage||x.message||"_",x._bucket,x._status]),Z=new Map;for(let x of O){let fe=G(x);if(Z.has(fe)){let ve=Z.get(fe);ve.count++,ve._related.push(x),new Date(x.ts)>new Date(ve.ts)&&(ve.ts=x.ts,ve._url=x._url,ve._status=x._status),new Date(x.ts)<new Date(ve._firstSeen)&&(ve._firstSeen=x.ts)}else{let ve=Object.assign({},x);ve._key=`${L}:${fe}`,ve._related=[x],ve._firstSeen=x.ts,ve._lastHourCount=0,ve.count=1,Z.set(fe,ve)}}let ie=Date.now()-3600*1e3;for(let x of Z.values())x._lastHourCount=x._related.filter(fe=>new Date(fe.ts).getTime()>=ie).length;O=Array.from(Z.values())}else O=O.map((G,Z)=>(G._key="row:"+Z+":"+G.ts,G._related=[G],G._firstSeen=G.ts,G._lastHourCount=0,G.count=1,G));let E=G=>({error:0,warn:1,info:2})[G._bucket]??1;e.query.sort==="count"?O.sort((G,Z)=>E(G)-E(Z)||Z.count-G.count||new Date(Z.ts)-new Date(G.ts)):O.sort((G,Z)=>E(G)-E(Z)||new Date(Z.ts)-new Date(G.ts)),e.visible=O;let F=!!(e.query.bucket||(e.query.search||"").trim()),Y=!F&&(e.stats?.severity?.error||0)>0&&!O.some(G=>G._bucket==="error")&&e.entries.length<1500;(F&&!O.length||Y)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,P(!0))}function P(q){if(q&&e.redisLoading)return;let z=++s;e.redisLoading=!0;let O=q?e.redisNextOffset||e.entries.length:0,L=q?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:O,limit:L}}).then(E=>{if(p||z!==s)return;e.redisLoading=!1;let F=(E.data.entries||[]).map(k);e.entries=q?e.entries.concat(F):F,e.redisRedacted=(q&&e.redisRedacted||0)+(E.data.redactedEntries||0),e.redisNextOffset=E.data.nextOffset??O+(E.data.entries||[]).length,e.available=!!E.data.available,e.redisCollecting=E.data.redisCollecting!==!1,e.cap=E.data.max||e.cap,e.total=E.data.total||e.entries.length,e._autoLoading=!1,b()},()=>{p||z!==s||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>P(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function M(q=!1){if(q&&d)return;let z=++i;d=!0,t.get("/api/admin/errors/stats").then(O=>{if(p||z!==i)return;d=!1;let L=O.data||{};e.redisStatsState=L.available===!1?"unavailable":"ready";let E=L.prev24h?Math.round((L.last24h-L.prev24h)/L.prev24h*100):0;e.stats={last24h:L.last24h||0,prev24h:L.prev24h||0,delta:E,severity:L.severity||{error:0,warn:0,info:0},unique:L.unique||{error:0,warn:0,info:0},buckets:L.buckets||[],dropped:L.dropped||0},b()},()=>{!p&&z===i&&(d=!1,e.redisStatsState="unavailable")})}function _(q=!1){(!q||!e.redisLoading)&&P(),M(q)}e.barPx=(q,z)=>{let O=e.stats.buckets||[],L=0,E=0;for(let Z of O)L=Math.max(L,(Z.error||0)+(Z.warn||0)),E=Math.max(E,Z.info||0);let F=q[z]||0;if(!F)return 0;if(z==="info")return E?Math.max(2,Math.round(F/E*(L?16:60))):0;let Y=(q.error||0)+(q.warn||0),G=Math.round(Y/L*44);return Math.max(4,Math.round(F/Y*G))},e.bucketTitle=q=>`${new Date(q.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${q.error||0} err \xB7 ${q.warn||0} warn \xB7 ${q.info||0} info`,e.toggle=async(q,z)=>{v=z||document.activeElement,m=e.captureErrorScroll(v),e.historySelected=q,e.historyView="overview",e.expanded={[q._key]:!0},await je(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=q=>{if(e.historyView="timeline",e.traceSelection)return;let z=["requestId","jobId"].find(O=>e.logTraceId(e.historySelected,O));z&&e.lookupTrace(z,e.logTraceId(e.historySelected,z),q,e.historySelected)},e.closeHistory=async()=>{let q=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await je(),(v?.isConnected?v:[...document.querySelectorAll("[data-history-key]")].find(O=>O.dataset.historyKey===q))?.focus({preventScroll:!0}),e.restoreErrorScroll(m)},e.setBucket=q Line truncated
`)],{type:"text/csv;charset=utf-8"}),L=URL.createObjectURL(O),E=document.createElement("a");E.href=L,E.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(L)};function H(q){e.copyHint=`${q} copied`,c.timeout(()=>{e.copyHint=""},1500)}e.copyJson=q=>{navigator.clipboard.writeText(q._rawJson).then(()=>H("JSON"))},e.copyCurl=q=>{if(!q._url)return;let O=`curl -X ${q._method||"GET"} '${window.location.origin}${q._url}'`;navigator.clipboard.writeText(O).then(()=>H("curl"))},_();let ne=r(()=>{e.query.autoRefresh&&_(!0)},15e3);e.on("dispose",()=>{p=!0,s++,i++,r.cancel(ne)}),e.watch("query.search",b),e.watch("query.bucket",b),e.watch("query.sort",b),e.watch("query.group",b)},hc=function(e,t,o,r){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null){o.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 s=!1;e.loadCache=function(){if(!s){s=!0;var b=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:b}}).then(function(P){b===e.cacheMinutes&&(e.cacheReport=P.data,e.cacheError=P.data.available?null:P.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){s=!1,b!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(b){return e.cacheTraffic==="all"||b.traffic===e.cacheTraffic})},e.cacheRate=function(b,P){var M=e.cacheRows(),_=function(q){return M.filter(function(z){return z.name===q}).reduce(function(z,O){return z+O[P]},0)},H=_(b+"_hit"),ne=_(b+"_miss");return H+ne?(100*H/(H+ne)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(b){return b.replaceAll("_"," ")},e.cacheP95=function(b){var P=0,M=e.cacheReport?.latencyBucketsMs||[];if(!b.count)return"No samples";if(!b.ms)return"Not timed";for(var _=0;_<=M.length;_++)if(P+=b["b"+_]||0,P>=Math.ceil(b.count*.95))return _<M.length?"\u2264 "+Un(M[_]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let b=e.data&&e.data.system||{},P=[["Memory",b.memPercent],["Disk",b.diskPercent]].filter(([,_])=>_>90);return P.length?P.map(([_,H])=>_+" is at "+H+"%").join(" and ")+". New anonymizations may fail until "+(P.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(b){return b==null?"":Un(b)},e.latencyBound=function(b,P){return b.count?b[P]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(b[P]):"No samples"},e.firstByteBound=function(b){return e.latencyBound({count:b.firstByteCount,p95UpperMs:b.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(b){return Math.max(0,Math.round((Date.now()-b.sampledAt)/1e3))},e.peakRss=function(b){return(e.performance.runtimeSeries||[]).filter(function(P){return P.instance===b.instance}).reduce(function(P,M){return Math.max(P,M.rss)},b.memory.rss)},e.performanceWarning=function(b){return e.sampleAge(b)>45||b.droppedBatches||b.droppedMetrics||b.sockets?.closeWait>0||b.eventLoop?.p95Ms>100||b.memoryLimitBytes&&b.memory.rss>b.memoryLimitBytes*.8};var i=!1;e.loadPerformance=function(){var b=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==b&&(e.performance=null),!i&&(i=!0,t.get("/api/admin/performance",{params:{minutes:b}}).then(function(P){b===e.performanceMinutes&&(e.performance=P.data,e.performanceError=P.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){b===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){i=!1,b!==e.performanceMinutes&&e.loadPerformance()}))};function d(b){if(b==null)return"\u2014";for(var P=["B","KB","MB","GB","TB"],M=0,_=b;_>=1024&&M<P.length-1;)_/=1024,M++;return _.toFixed(M>0?1:0).replace(/\.0$/,"")+" "+P[M]}e.humanBytes=d;function p(b){if(!b)return"\u2014";var P=Math.floor(b/86400),M=Math.floor(b%86400/3600),_=Math.floor(b%3600/60);return P>0?P+"d "+(M<10?"0":"")+M+"h":M>0?M+"h "+(_<10?"0":"")+_+"m":_+"m"}e.humanDuration=p;function c(b){return b==null?"\u2014":b>=1e6?(b/1e6).toFixed(1)+"M":b>=1e3?(b/1e3).toFixed(1)+"K":String(b)}e.humanNum=c,e.queueTotal=function(b){return b?(b.waiting||0)+(b.active||0)+(b.delayed||0)+(b.failed||0):0},e.statusCount=function(b){if(!e.data||!e.data.repos)return 0;for(var P=e.data.repos.statusBreakdown||[],M=0;M<P.length;M++)if(P[M]._id===b)return P[M].count;return 0},e.barPct=function(b){var P=e.data&&e.data.repos?e.data.repos.total:0;if(!P)return 0;var M=[b];b==="expired"&&M.push("expiring"),b==="remov Line truncated
`)},e.tipSide=w=>{let C=(e.summary?.series||[]).length;return C<3?"":w<C/4?"tip-start":w>=C*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((w,C)=>w+e.bucketTotal(C),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(w=>w.active||w.allTimeSales||w.sales),e.familyLabel=w=>(cr.find(C=>C.id===w)||{}).label||"",e.familyPlans=w=>(e.summary?.plans||[]).filter(C=>C.family===w),e.familySum=(w,C)=>e.familyPlans(w).reduce((N,b)=>N+(b[C]||0),0),e.familyMoney=(w,C,N)=>{if(!e.revenueOn())return"\u2014";let b=e.familyPlans(w);return b.some(P=>P[N]===!1)?"Incomplete":e.moneyText(b.reduce((P,M)=>i(P,M[C]),{}))},e.planTotals=()=>{let w=C=>(e.summary?.plans||[]).reduce((N,b)=>N+(b[C]||0),0);return{active:w("active"),sales:w("sales"),allTimeSales:w("allTimeSales")}},e.webhookState=()=>{let w=e.summary?.webhooks;return w?w.failed||w.reconciliationFailed?"bad":w.oldestPendingSeconds>900||w.unreviewedRevocations?"warn":"ok":"ok"},e.age=w=>w?Un(w*1e3):"\u2014";let d=0;e.loadSummary=()=>{let w=++d;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(C=>{if(w!==d)return;e.summaryLoading=!1;let N=C.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},C=>{w===d&&(e.summaryLoading=!1,e.summaryError=C&&C.data&&C.data.error||"Could not load billing figures.")})},e.setPeriod=w=>{if(e.period!==w){e.period=w;try{localStorage.setItem("admin.billing.period",w)}catch{}e.loadSummary()}},e.grants=[],e.total=-1,e.totalPage=0,e.stateCounts={},e.statuses=[],e.grantsError=null,e.filtersOpen=!1,e.query={page:1,limit:25,search:"",plan:"",status:"",state:"",period:"",sort:"purchasedAt",direction:"desc"};let p=o.search();p.search&&(e.query.search=p.search),e.stateView=()=>e.query.state||"all",e.setStateView=w=>{e.query.state=w==="all"?"":w,e.query.page=1},e.stateCount=w=>w==="all"?["active","expired","revoked"].reduce((C,N)=>C+(e.stateCounts[N]||0),0):e.stateCounts[w]||0,e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let c=()=>{let w=[];e.query.plan&&w.push({key:"plan",label:"Plan",value:e.planName(e.query.plan)}),e.query.status&&w.push({key:"status",label:"Stripe status",value:e.query.status.replace(/_/g," ")}),e.query.period&&w.push({key:"period",label:"Started",value:"last "+((e.periods.find(C=>C.id===e.query.period)||{}).label||e.query.period)}),e.chips=w};e.clearFilter=w=>{e.query[w]="",e.query.page=1},e.filterPlan=w=>{Object.assign(e.query,{plan:w,page:1});let C=document.getElementById("bl-grants");C&&C.scrollIntoView&&C.scrollIntoView({behavior:"smooth",block:"start"})},e.clearFilters=()=>Object.assign(e.query,{search:"",plan:"",status:"",state:"",period:"",page:1}),e.hasFilters=()=>!!(e.query.search||e.query.plan||e.query.status||e.query.state||e.query.period),e.filterCount=()=>["plan","status","period"].filter(w=>e.query[w]).length,e.amountText=w=>{if(!w.amount)return"\u2014";let C=fo({[w.amount.currency]:w.amount.value})[0]||"\u2014";if(!w.amount.interval)return C;let N=w.amount.intervalCount>1?w.amount.intervalCount+" "+w.amount.interval+"s":w.amount.interval;return C+" / "+N},e.amountTitle=w=>w.amount?"Stripe list price"+(w.pack?" of the whole pack":""):{stripe_not_configured:"Revenue unavailable: Stripe is not configured on this server.",unresolved:"Revenue unavailable: this Stripe price could not be looked up.",unrecorded:"Revenue unavailable: no sale price was recorded for this subscription."}[w.amountMissing]||"Revenue unavailable.",e.endText=w=>{if(w.never)return"Never ends";if(!w.until)return"\u2014";let C=dr(w.until);return w.state!=="active"?(new Date(w.until)<new Date?"Ended ":"Ends ")+C:w.subscription?(w.cancelAtPeriodEnd?"Ends ":"Renews ")+C:"Until "+C},e.packNote=w=>{let C=(w.parts||[]).find(N=>N.planId==="author_pass");return!w.pack||!C||!C.until?"":(new Date(C.until)<new Date?"Updates ended ":"Updates until ")+dr(C.until)};let v={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=w=>(w.parts||[]).map(C=>v[C.planId]||e.planName(C.planId)).join(", ").replace(/^./,C=>C.toUpperCase()),e.packPartsTitle=w=>"Paper pack: "+(w.parts||[]).map(C=>e.planName(C.planId)).join(", "),e.statusText=w=>(w.status||"unknown").replace(/_/g," "),e.revocationText=w=>w==="dispute"?"Disputed":w==="full_refund"?"Refunded":"Revoked",e.scopeHref=w=>w?.kind==="repo"?"/admin/repositories?search="+encodeURIComponent(w.id):w?.kind==="conference"?"/conference/"+encodeURIComponent(w.id):null;let m=0;function y(){let w=++m;e.grantsError=null;let C=Object.fromEntries(Object.entries(e.query).filter(([,N])=>N!==""&&N!=null));t.get("/api/admin/billing/grants",{params:C}).then(N=>{w===m&&( Line truncated
`)},Ka=class{constructor(t){nt(this,"gen");nt(this,"threads",[]);nt(this,"match",!1);nt(this,"runs",[]);nt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Mc=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((o,r)=>o!==t.ids[r])?!1:e.runs.every(o=>t.runs.some(r=>r.neg===o.neg&&Mc(r.state,o.state))),Rc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),ho,Wn,Ya,Ja,Ks=class{constructor(t,o,r){_e(this,Wn);nt(this,"dots");nt(this,"dotStart");_e(this,ho);this.dots=t,this.dotStart=o,ze(this,ho,r)}state(){return new Ka(++ae(this,ho).gen)}done(t){return t.ids=t.threads.map(o=>o.id).sort((o,r)=>o-r),t.match&&t.ids.unshift(Wa.id),t}restricted(t,o){return o&&(this.dots||this.dotStart&&t===0)}add(t,o,r,s){switch(o.t){case"split":if(!$e(this,Wn,Ya).call(this,t,o))return;for(let d of o.out)this.add(t,d,r,s);return;case"neg":if(!$e(this,Wn,Ya).call(this,t,o))return;let i=this.state();return this.add(i,o.sub,r,!1),this.done(i),this.addRun(t,{t:"run",neg:o,state:i},r,s);case"star":if(this.restricted(r,s))return;$e(this,Wn,Ja).call(this,t,o)&&this.add(t,o.next,r,s);return;case"match":t.match=!0;return;default:$e(this,Wn,Ja).call(this,t,o)}}addRun(t,o,r,s){for(let i of t.runs)if(i.neg===o.neg&&Mc(i.state,o.state))return;t.runs.push(o),o.state.match||this.add(t,o.neg.next,r,s)}step(t,o,r,s){let i=this.state();for(let d of t.threads)switch(d.t){case"lit":Za(d,o)&&this.add(i,d.next,r+1,s);break;case"any":this.restricted(r,s)||this.add(i,d.next,r+1,s);break;case"class":!this.restricted(r,s)&&d.re.test(o)&&this.add(i,d.next,r+1,s);break;case"star":this.restricted(r,s)||this.add(i,d,r+1,s)}if(!this.restricted(r,s))for(let d of t.runs){if(d.state.dead){this.addRun(i,d,r+1,s);continue}let p=this.step(d.state,o,r,!1);this.addRun(i,{t:"run",neg:d.neg,state:p},r+1,s)}return this.done(i)}};ho=new WeakMap,Wn=new WeakSet,Ya=function(t,o){let{seen:r}=ae(this,ho);return r[o.id]===t.gen?!1:(r[o.id]=t.gen,!0)},Ja=function(t,o){let{has:r}=ae(this,ho);return r[o.id]===t.gen?!1:(r[o.id]=t.gen,t.threads.push(o),!0)};var Vc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let o=e.runs.map(r=>`${r.neg.id}(${Vc(r.state)})`);return`${t}|${o.sort().join("|")}`},Lv=1<<18,Yo,Jo,Bn,go,zn,Hn,jn,sn,Qa,gr,qc,Xa=class{constructor(t,o){_e(this,sn);_e(this,Yo);_e(this,Jo,new Map);_e(this,Bn,0);_e(this,go);_e(this,zn);_e(this,Hn);_e(this,jn);ze(this,Yo,t),ze(this,Hn,new Ks(!1,!1,o)),ze(this,jn,new Ks(!1,!0,o))}start(t){if(t){if(ae(this,zn))return ae(this,zn);let r=ae(this,jn).state();return ae(this,jn).add(r,ae(this,Yo),0,!0),ze(this,zn,$e(this,sn,Qa).call(this,ae(this,jn).done(r)))}if(ae(this,go))return ae(this,go);let o=ae(this,Hn).state();return ae(this,Hn).add(o,ae(this,Yo),0,!0),ze(this,go,$e(this,sn,gr).call(this,ae(this,Hn).done(o)))}next(t,o){let r=o.charCodeAt(0),s=r<128?void 0:t.next.get(o);if(s)return s;let i=t===ae(this,zn)?$e(this,sn,gr).call(this,ae(this,jn).step(t.state,o,0,!0)):$e(this,sn,gr).call(this,ae(this,Hn).step(t.state,o,1,!0));return r<128?(t.ascii||(t.ascii=new Array(128),ze(this,Bn,ae(this,Bn)+128)),t.ascii[r]=i):t.next.set(o,i),Sl(this,Bn)._++,i}};Yo=new WeakMap,Jo=new WeakMap,Bn=new WeakMap,go=new WeakMap,zn=new WeakMap,Hn=new WeakMap,jn=new WeakMap,sn=new WeakSet,Qa=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},gr=function(t){let o=Vc(t),r=ae(this,Jo).get(o);if(r)return r;ae(this,Bn)>Lv&&$e(this,sn,qc).call(this);let s=$e(this,sn,Qa).call(this,t);return ae(this,Jo).set(o,s),ze(this,Bn,ae(this,Bn)+(o.length+1)),s},qc=function(){ae(this,Jo).clear(),ze(this,Bn,0),ze(this,go,void 0),ze(this,zn,void 0)};var Fv=e=>{let t=[];for(let o=e;o.t!=="match";o=o.next){if(o.t==="split"||o.t==="neg")return;t.push(o)}return t},_v=(e,t,o,r)=>{let s=0,i=o,d=-1,p=0;for(;i<r;){let c=e[s];if(c?.t==="star"){d=s++,p=i;continue}let v=t[i];if(c&&(c.t==="any"||c.t==="lit"&&Za(c,v)||c.t==="class"&&c.re.test(v))){s++,i++;continue}if(d===-1)return!1;s=d+1,i=++p}for(;e[s]?.t==="star";)s++;return s===e.length},Lc=e=>{let t=0,o=0;for(let r of e){let[s,i]=$v(r);t+=s,o+=i}return[t,o]},$v=e=>{if(e.t==="star")return[0,1/0];if(e.t!=="ext")return[1,1];if(e.type==="!")return[0,1/0];let t=e.alts.map(Lc),o=Math.min(...t.map(i=>i[0])),r=Math.max(...t.map(i=>i[1])),s=r===0?0:1/0;return e.type==="@"?[o,r]:e.type==="?"?[0,r]:e.type==="*"?[0,s]:[o,s]},Tc=(e,t,o)=>{for(let r=0;r<e.length;r++)if(!Za(e[r],t[o+r]))return!1;return!0},Uv=/[/\ud800-\udfff]/,Bv=/[\ud800-\udfff]/,hr=e=>Bv.test(e)?[...e]:e,Pc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Gn,Xo,vo,vr,yo,Js,yr,bo,Xs,Qs,Zs,On,kn,Qo,Zo,xs,br,on,wo,Ws,Ys=class{constructor(t,o={}){_e(this,wo);nt(this,"pattern");nt(this,"options");_e(this,Gn);_e(this,Xo);_e(this,vo);_e(this,vr);_e(this,yo);_e(this,Js,!1);_e(this,yr);_e(this,bo);_e(this,Xs,!1);_e(this,Qs,0);_e(this,Zs,1/0);_e(this,On,[]);_e(this,kn,[]);_e(this,Qo);_e(this,Zo);_e(this,xs,!1);_e(this,br);_e(this,on);if(t.includes Line truncated
`).forEach((o,r)=>{let{term:s}=ul(o.trim());if(!s)return;let i=[];for(let d=0;d<s.length;d++){if(s[d]==="\\"){d++;continue}xc.has(s[d])&&!i.includes(s[d])&&i.push(s[d])}i.length&&t.push({line:r,term:s,symbols:i})}),t}function tp(e,t){let o=String(e||"").split(`
`),r=o[t];if(r===void 0)return e;let{term:s}=ul(r.trim());if(!s)return e;let i="";for(let p=0;p<s.length;p++){if(s[p]==="\\"){i+=s.slice(p,p+2),p++;continue}i+=xc.has(s[p])||s[p]==="."?"\\"+s[p]:s[p]}let d=r.indexOf(s);return o[t]=r.slice(0,d)+i+r.slice(d+s.length),o.join(`
`)}var Zn={VIEWER_ERRORS:{title:"Content could not be loaded",access_title:"GitHub access needs attention",reader_help:"Reading this repository? You do not need to sign in. Try again after the owner restores access, or let them know this anonymous link is unavailable.",owner_help:"Own this repository? If your GitHub account was suspended or recently recovered, sign in to Anonymous GitHub again and check the GitHub connection and repository permissions in your dashboard. Then retry this page. Keep the existing anonymous URL; do not delete the repository to restore access.",retry:"Try again",dashboard:"Open owner dashboard"},ERRORS:{cache_busy:"Downloads are busy. Please try again shortly.",invalid_sort:"The selected sort order is invalid.",invalid_cursor:"This project page is no longer valid. Reload the list.",repository_changed:"The repository changed while processing. Please retry.",repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"We could not load this content. Try again. If it still fails, contact support with the anonymous URL and the time of the error.",unreachable:"The service could not complete this request. Wait a moment and try again.",request_error:"The connection was interrupted. Check your internet connection and try again.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"Anonymous GitHub cannot access the source repository on GitHub. It may be private, unavailable, or require the owner to reconnect GitHub.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub temporarily blocked the request because we hit its API rate limit. Wait a few minutes and try again. If the problem persists and you contact GitHub Support, include the request ID and timestamp shown in GitHub's response (the 'X-GitHub-Request-Id' header).",rate_limited:"GitHub API rate limit reached. The repository will be available shortly \u2014 please wait a moment and refresh.",repoId_already_used:"The repository ID is already used.",invalid_repoId:"The format of the repository ID is invalid.",unsupported_source:"The repository source type is not supported.",branch_not_specified:"The branch is not specified.",branch_not_found:"The branch of the repository cannot be found.",commit_not_specified:"A commit must be specified.",commit_not_found:"The configured commit no longer exists in the source repository. It may have been force-pushed, rebased, or removed.",repo_renamed:"The source repository appears to have been renamed or moved on GitHub. Please refresh and try again \u2014 the cached name has been updated.",invalid_commit_format:"The commit hash format is invalid. It must be a hexadecimal string.",pull_request_not_found:"The requested pull request could not be found.",pull_request_expired:"This pull request has expired and is no longer available.",pull_request_not_ready:"This pull request is still being prepared. Please t Line truncated
`).trim()})}),o},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let o=e.prFiles().find(r=>r.id===e.activeAnchor);return o?o.index:0},e.openTab=o=>{e.tabState={active:o},e.tocOpen=!1},e.showInDiff=o=>{o&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[o.index]:!1},Be(()=>e.jumpToAnchor(o.id)))},e.jumpToFile=o=>{e.collapsedFiles={...e.collapsedFiles,[o.index]:!1},e.jumpToAnchor(o.id)},pc(e,()=>e.tabState?.active==="files"?e.prFiles().map(o=>o.id):[])}function hc(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function ja(e,t,o){let r,s=!1,i="form-draft:"+o,d=()=>Object.fromEntries(t.map(g=>[g,e[g]])),p=()=>JSON.stringify(d()),c=g=>{for(let C of t)Object.prototype.hasOwnProperty.call(g,C)&&(e[C]=g[C]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},v=()=>{try{window.sessionStorage.removeItem(i)}catch{}},m=(g=!1)=>{if(r!==void 0){if(g&&document.querySelectorAll("input, select, textarea").forEach(C=>{C._field?.binding.state===e&&C._field.timer&&C._field.commit()}),e.unsavedChanges=p()!==r,e.draftSaved=!1,!e.unsavedChanges){v();return}try{window.sessionStorage.setItem(i,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:d()})),e.draftSaved=!0}catch{}}},y=()=>m(!0);return e.on("routeLeave",y),window.addEventListener("beforeunload",y),e.on("dispose",()=>window.removeEventListener("beforeunload",y)),{restore(){r=p();let g;try{g=JSON.parse(window.sessionStorage.getItem(i)||"null")}catch{}let C=g&&g.account===(e.user?.username||null)&&Date.now()-g.savedAt<30*6e4&&g.values;return C&&(c(g.values),e.draftRestored=!0),s||(s=!0,e.watch(()=>d(),()=>m(),!0)),e.unsavedChanges=p()!==r,!!C},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state===e&&g._field.timer&&g._field.commit()}),JSON.parse(p())},accept(g){r=JSON.stringify(g),e.draftRestored=!1,m()},discard(){document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state!==e||!g._field.timer||(clearTimeout(g._field.timer),g._field.timer=null,g.value=g._field.binding.value??"")}),r!==void 0&&c(JSON.parse(r)),e.draftRestored=!1,m()},clear(){r=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,v()}}}function gc(e,t){e.errorSource="central",e.logView={search:"",severity:"",sort:"recent"},e.selectedLog=null,e.logDetailTab="overview",e.logSeverity=y=>Number(y?.status||y?.httpStatus)>=500||["error","fatal"].includes(y?.severity)?"error":y?.severity==="warn"?"warn":"info",e.filteredLogGroups=()=>{let y=e.logView.search.trim().toLowerCase();return(e.logData?.groups||[]).filter(g=>(!e.logView.severity||e.logSeverity(g.sample)===e.logView.severity)&&(!y||Object.values(g.sample).join(" ").toLowerCase().includes(y))).slice().sort((g,C)=>e.logView.sort==="count"?C.count-g.count:Date.parse(C.last)-Date.parse(g.last))},e.shortLogId=y=>y?y.slice(0,8):"",e.isLogIdentifier=(y,g)=>typeof g=="string"&&g.length>16&&/(?:id|sha|release)$/i.test(y),e.compactLogValue=y=>String(y).slice(0,8)+"\u2026"+String(y).slice(-4),e.logCopyStatus="",e.copyLogValue=async y=>{try{await navigator.clipboard.writeText(String(y)),e.logCopyStatus="Full value copied"}catch{e.logCopyStatus="Copy unavailable. Expand the value to select it."}},e.logExplanation=y=>{let g=y.service||"The application",C={job_failed:"reported a failed job",request_failed:"reported a failed request",request_aborted:"reported an aborted request",edge_request:"recorded an edge request",http_access:"recorded an HTTP request"}[y.event]||"recorded \u201C"+(y.event||"application event")+"\u201D",w=Number(y.status||y.httpStatus),S={502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[w];return g+" "+C+(w?" with HTTP "+w+(S?" ("+S+")":""):"")+"."},e.logEvidence=y=>[y.errorCode?"Recorded error code: "+y.errorCode+".":"No error code was included in this sample.",y.ms!==void 0?"Recorded duration: "+y.ms+" ms.":"",y.attempt!==void 0?"Recorded attempt: "+y.attempt+".":"",y.queue?"Queue: "+y.queue+".":""].filter(Boolean).join(" "),e.occurrenceTime=y=>Number.isFinite(Date.parse(y))?new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"}):"Time not captured",e.historyOccurrences=y=>(y?._related||[]).slice().sort((g,C)=>Date.parse(C.ts)-Date.parse(g.ts)),e.historyDetailFields=y=>{try{let g=JSON.parse(y?._detailJson||"{}");return g&&typeof g=="object"?Object.entries(g):[["value",g]]}catch{return[["record",y?._detailJson||""]]}},e.logFieldText=y=>typeof y=="object"?JSON.stringify(y):String(y??""),e.captureErrorScroll=y=>{let g=[];for(let C=y?.parentElement;C;C=C.parentElement)g.push({element:C,top:C.scrollTop,left:C.scrollLeft});return g},e.restoreErrorScroll=y=>y.forEach(({element:g,top:C,left:w})=>{g.isConnected&&(g.scrollTop=C,g.scrollLeft=w)});let o=null,r=null,s=null,i=[];e.selectLog=async(y,g)=>{if(r=g||document.activeElement, Line truncated
`+S.join(`
`)],{type:"text/csv"}),b=document.createElement("a");b.href=URL.createObjectURL(N),b.download=r.username+"-repositories.csv",b.click()},e.showStatusMessage=g=>{let C=g.statusMessage||"(no message)";window.prompt(`Status message for ${g.repoId} (${g.status}):`,C)},e.fetchGithubInfo=g=>{let C=window.open("","_blank");C&&C.document.write("<pre>Loading GitHub info for "+g.repoId+"...</pre>"),t.get("/api/admin/repos/"+g.repoId+"/github").then(w=>{C&&(C.document.open(),C.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(w.data,null,2).replace(/[<>]/g,S=>S==="<"?"&lt;":"&gt;")+"</pre>"),C.document.close())},w=>{let S=w&&w.data?JSON.stringify(w.data,null,2):String(w);C&&(C.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+S+"</pre>")})};function c(g){t.get("/api/admin/users/"+g+"/repos",{}).then(C=>{e.repositories=C.data},C=>{console.error(C)})}function v(g){t.get("/api/admin/users/"+g,{}).then(C=>{e.userInfo=C.data},C=>{console.error(C)})}v(r.username),c(r.username),e.banUser=()=>{confirm(`Ban user ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/ban`).then(()=>v(r.username),g=>console.error(g))},e.activateUser=()=>{t.post(`/api/admin/users/${r.username}/activate`).then(()=>v(r.username),g=>console.error(g))},e.promoteUser=()=>{confirm(`Promote ${r.username} to admin?`)&&t.post(`/api/admin/users/${r.username}/promote`).then(()=>v(r.username),g=>console.error(g))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/demote`).then(()=>v(r.username),g=>console.error(g))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(g=>{e.tokens=g.data||[]},g=>{g.status!==401&&g.status!==403&&console.error(g)})}m(),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="",m()},g=>console.error(g))},e.revokeToken=g=>{confirm(`Revoke token "${g.name}"?`)&&t.delete("/api/admin/tokens/"+g.id).then(()=>m(),C=>console.error(C))},e.removeCache=g=>{confirm("Remove cached files for "+g.repoId+"?")&&t.delete("/api/admin/repos/"+g.repoId).then(()=>c(r.username),C=>console.error(C))},e.removeRepository=g=>{confirm("Remove repository "+g.repoId+"?")&&t.delete("/api/repo/"+g.repoId+"/").then(()=>c(r.username),C=>console.error(C))},e.updateRepository=g=>{let C=rt({title:`Refreshing ${g.repoId}...`,date:new Date,body:`The repository ${g.repoId} is going to be refreshed.`});e.toasts.push(C),t.post(`/api/repo/${g.repoId}/refresh`).then(w=>{w.data.status=="ready"?C.title=`${g.repoId} is refreshed.`:C.title=`Refreshing of ${g.repoId}.`},w=>{C.title=`Error during the refresh of ${g.repoId}.`,C.body=w.body})},e.getGitHubRepositories=g=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(C=>{e.userInfo.repositories=C.data})};let y=null;e.watch("query",()=>{s.timeout.cancel(y),y=s.timeout(()=>{c(r.username)},500)},!0)},wc=function(e,t,o){let r=yt(),s=Ot();e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.conferences=[],e.total=-1,e.listLoaded=!1,e.listLoading=!0,e.totalPage=0,e.statusCounts=[];let i=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let S=document.querySelector('.admin-filter-toolbar input[type="search"]');S&&S.focus()}};s(document,"keydown",i),e.on("dispose",()=>document.removeEventListener("keydown",i)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let d=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let S=(e.statusCounts||[]).find(N=>N._id===w);return S?S.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 m=o.search();m.search&&(e.query.search=m.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 S=Object.assign({},e.query);delete S.page,e.presets=(e.presets||[]).filter(N=>N.name!==w),e.presets.push({name:w,query:S}),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(S=>S.name!== Line truncated
`):typeof z.stack=="string"?z.stack:null;for(var O=[z.cause,z.err].filter(Boolean),q=0;!F&&q<O.length;q++)for(var E=O[q];!F&&E&&typeof E=="object";)typeof E.stack=="string"&&(F=E.stack),E=E.cause;L._stack=F}else L.displayMessage=L.message,L._status=null,L._url=null,L._stack=null;return L._bucket=g(z,L.level),L._detailJson=w(L,z),L}function w(L,z){let O=[],q=(G,x)=>{x==null||x===""||O.push([G,x])};for(let G of["service","event","severity","requestId","jobId"])q(G,z&&z[G]);q("name",z&&z.name),q("code",L.displayMessage||z&&z.message),L._bucket&&q("kind",L._bucket),q("httpStatus",z&&z.httpStatus),z&&z.status&&!z.httpStatus&&q("status",z.status),q("module",L.module);let E=z&&z.detail;if(typeof E=="string"){let G=E.trim();if(G[0]==="{"||G[0]==="[")try{E=JSON.parse(E)}catch{}}if(q("detail",E),q("repoId",z&&z.repoId),q("filePath",z&&z.filePath),q("upstreamStatus",z&&z.upstreamStatus),q("upstreamBody",z&&z.upstreamBody),q("url",L._url),q("err",z&&z.err),q("cause",z&&!z.err&&z.cause),q("ts",L.ts),!O.length)return JSON.stringify(L,null,2);let F=O.reduce((G,x)=>Math.max(G,x[0].length),0),Y=["{"];return O.forEach(([G,x],re)=>{let fe=` ${`"${G}":`.padEnd(F+3," ")} `,ge=re<O.length-1?",":"",$e;if(x&&typeof x=="object"){let He=" ".repeat(fe.length);$e=JSON.stringify(x,null,2).split(`
`).map((Ye,ze)=>ze===0?Ye:He+Ye).join(`
`)}else typeof x=="number"||typeof x=="boolean"?$e=String(x):$e=JSON.stringify(x);Y.push(`${fe}${$e}${ge}`)}),Y.push("}"),Y.join(`
`)}function S(L){let z=[],O="",q=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,E=0,F;for(;F=q.exec(L);)O+=L.slice(E,F.index),E=q.lastIndex,z.push({key:F[1],op:F[2]||"=",val:F[3]});return O+=L.slice(E),{filters:z,free:O.trim().toLowerCase()}}function N(L,z){for(let O of z.filters){let q=(F,Y,G)=>{let x=parseFloat(F),re=parseFloat(Y);return G==="="?String(F)===String(Y):G==="!="?String(F)!==String(Y):G===">="?x>=re:G==="<="?x<=re:G===">"?x>re:G==="<"?x<re:!0},E;if(O.key==="code")E=L.displayMessage;else if(O.key==="module")E=L.module;else if(O.key==="status")E=L._status;else if(O.key==="url")E=L._url;else if(O.key==="repo")E=L._repoId;else if(O.key==="level")E=L.level;else continue;if(E==null||!q(E,O.val,O.op))return!1}return!(z.free&&((L.displayMessage||"")+" "+(L.module||"")+" "+(L._url||"")+" "+JSON.stringify(L.raw||[])).toLowerCase().indexOf(z.free)===-1)}function b(){let L=S(e.query.search||"");e.parsedFilterCount=L.filters.length;let z=e.query.bucket,O=e.entries.filter(G=>z&&G._bucket!==z?!1:N(G,L)),q=e.query.group;if(q){let G=ee=>JSON.stringify(q==="module"?[ee.module,ee._bucket]:[ee.raw?.[0]?.service||"unknown",ee.module,ee.displayMessage||ee.message||"_",ee._bucket,ee._status]),x=new Map;for(let ee of O){let fe=G(ee);if(x.has(fe)){let ge=x.get(fe);ge.count++,ge._related.push(ee),new Date(ee.ts)>new Date(ge.ts)&&(ge.ts=ee.ts,ge._url=ee._url,ge._status=ee._status),new Date(ee.ts)<new Date(ge._firstSeen)&&(ge._firstSeen=ee.ts)}else{let ge=Object.assign({},ee);ge._key=`${q}:${fe}`,ge._related=[ee],ge._firstSeen=ee.ts,ge._lastHourCount=0,ge.count=1,x.set(fe,ge)}}let re=Date.now()-3600*1e3;for(let ee of x.values())ee._lastHourCount=ee._related.filter(fe=>new Date(fe.ts).getTime()>=re).length;O=Array.from(x.values())}else O=O.map((G,x)=>(G._key="row:"+x+":"+G.ts,G._related=[G],G._firstSeen=G.ts,G._lastHourCount=0,G.count=1,G));let E=G=>({error:0,warn:1,info:2})[G._bucket]??1;e.query.sort==="count"?O.sort((G,x)=>E(G)-E(x)||x.count-G.count||new Date(x.ts)-new Date(G.ts)):O.sort((G,x)=>E(G)-E(x)||new Date(x.ts)-new Date(G.ts)),e.visible=O;let F=!!(e.query.bucket||(e.query.search||"").trim()),Y=!F&&(e.stats?.severity?.error||0)>0&&!O.some(G=>G._bucket==="error")&&e.entries.length<1500;(F&&!O.length||Y)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,P(!0))}function P(L){if(L&&e.redisLoading)return;let z=++s;e.redisLoading=!0;let O=L?e.redisNextOffset||e.entries.length:0,q=L?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:O,limit:q}}).then(E=>{if(p||z!==s)return;e.redisLoading=!1;let F=(E.data.entries||[]).map(C);e.entries=L?e.entries.concat(F):F,e.redisRedacted=(L&&e.redisRedacted||0)+(E.data.redactedEntries||0),e.redisNextOffset=E.data.nextOffset??O+(E.data.entries||[]).length,e.available=!!E.data.available,e.redisCollecting=E.data.redisCollecting!==!1,e.cap=E.data.max||e.cap,e.total=E.data.total||e.entries.length,e._autoLoading=!1,b()},()=>{p||z!==s||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>P(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function V(L=!1){if(L&&d)return;let z=++i;d=!0,t.get("/api/admin/errors/stats").then(O=>{if(p||z!==i)return;d=!1;let q=O.data||{};e.redisStatsState=q.available===!1?"unavailable":"ready";let E=q.prev24h?Math.round((q.last24h-q.prev24h)/q.prev24h*100):0;e.stats={last24h:q.last24h||0,prev24h:q.prev24h||0,delta:E,severity:q.severity||{error:0,warn:0,info:0},unique:q.unique||{error:0,warn:0,info:0},buckets:q.buckets||[],dropped:q.dropped||0},b()},()=>{!p&&z===i&&(d=!1,e.redisStatsState="unavailable")})}function _(L=!1){(!L||!e.redisLoading)&&P(),V(L)}e.barPx=(L,z)=>{let O=e.stats.buckets||[],q=0,E=0;for(let x of O)q=Math.max(q,(x.error||0)+(x.warn||0)),E=Math.max(E,x.info||0);let F=L[z]||0;if(!F)return 0;if(z==="info")return E?Math.max(2,Math.round(F/E*(q?16:60))):0;let Y=(L.error||0)+(L.warn||0),G=Math.round(Y/q*44);return Math.max(4,Math.round(F/Y*G))},e.bucketTitle=L=>`${new Date(L.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${L.error||0} err \xB7 ${L.warn||0} warn \xB7 ${L.info||0} info`,e.toggle=async(L,z)=>{v=z||document.activeElement,m=e.captureErrorScroll(v),e.historySelected=L,e.historyView="overview",e.expanded={[L._key]:!0},await Be(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=L=>{if(e.historyView="timeline",e.traceSelection)return;let z=["requestId","jobId"].find(O=>e.logTraceId(e.historySelected,O));z&&e.lookupTrace(z,e.logTraceId(e.historySelected,z),L,e.historySelected)},e.closeHistory=async()=>{let L=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await Be(),(v?.isConnected?v:[...document.querySelectorAll("[data-history-key]")].find(O=>O.dataset.historyKey===L))?.focus({preventScroll:!0}),e.restoreError Line truncated
`)],{type:"text/csv;charset=utf-8"}),q=URL.createObjectURL(O),E=document.createElement("a");E.href=q,E.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(q)};function j(L){e.copyHint=`${L} copied`,c.timeout(()=>{e.copyHint=""},1500)}e.copyJson=L=>{navigator.clipboard.writeText(L._rawJson).then(()=>j("JSON"))},e.copyCurl=L=>{if(!L._url)return;let O=`curl -X ${L._method||"GET"} '${window.location.origin}${L._url}'`;navigator.clipboard.writeText(O).then(()=>j("curl"))},_();let ne=r(()=>{e.query.autoRefresh&&_(!0)},15e3);e.on("dispose",()=>{p=!0,s++,i++,r.cancel(ne)}),e.watch("query.search",b),e.watch("query.bucket",b),e.watch("query.sort",b),e.watch("query.group",b)},Sc=function(e,t,o,r){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null){o.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 s=!1;e.loadCache=function(){if(!s){s=!0;var b=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:b}}).then(function(P){b===e.cacheMinutes&&(e.cacheReport=P.data,e.cacheError=P.data.available?null:P.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){s=!1,b!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(b){return e.cacheTraffic==="all"||b.traffic===e.cacheTraffic})},e.cacheRate=function(b,P){var V=e.cacheRows(),_=function(L){return V.filter(function(z){return z.name===L}).reduce(function(z,O){return z+O[P]},0)},j=_(b+"_hit"),ne=_(b+"_miss");return j+ne?(100*j/(j+ne)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(b){return b.replaceAll("_"," ")},e.cacheP95=function(b){var P=0,V=e.cacheReport?.latencyBucketsMs||[];if(!b.count)return"No samples";if(!b.ms)return"Not timed";for(var _=0;_<=V.length;_++)if(P+=b["b"+_]||0,P>=Math.ceil(b.count*.95))return _<V.length?"\u2264 "+Bn(V[_]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let b=e.data&&e.data.system||{},P=[["Memory",b.memPercent],["Disk",b.diskPercent]].filter(([,_])=>_>90);return P.length?P.map(([_,j])=>_+" is at "+j+"%").join(" and ")+". New anonymizations may fail until "+(P.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(b){return b==null?"":Bn(b)},e.latencyBound=function(b,P){return b.count?b[P]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(b[P]):"No samples"},e.firstByteBound=function(b){return e.latencyBound({count:b.firstByteCount,p95UpperMs:b.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(b){return Math.max(0,Math.round((Date.now()-b.sampledAt)/1e3))},e.peakRss=function(b){return(e.performance.runtimeSeries||[]).filter(function(P){return P.instance===b.instance}).reduce(function(P,V){return Math.max(P,V.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 i=!1;e.loadPerformance=function(){var b=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==b&&(e.performance=null),!i&&(i=!0,t.get("/api/admin/performance",{params:{minutes:b}}).then(function(P){b===e.performanceMinutes&&(e.performance=P.data,e.performanceError=P.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){b===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){i=!1,b!==e.performanceMinutes&&e.loadPerformance()}))};function d(b){if(b==null)return"\u2014";for(var P=["B","KB","MB","GB","TB"],V=0,_=b;_>=1024&&V<P.length-1;)_/=1024,V++;return _.toFixed(V>0?1:0).replace(/\.0$/,"")+" "+P[V]}e.humanBytes=d;function p(b){if(!b)return"\u2014";var P=Math.floor(b/86400),V=Math.floor(b%86400/3600),_=Math.floor(b%3600/60);return P>0?P+"d "+(V<10?"0":"")+V+"h":V>0?V+"h "+(_<10?"0":"")+_+"m":_+"m"}e.humanDuration=p;function c(b){return b==null?"\u2014":b>=1e6?(b/1e6).toFixed(1)+"M":b>=1e3?(b/1e3).toFixed(1)+"K":String(b)}e.humanNum=c,e.queueTotal=function(b){return b?(b.waiting||0)+(b.active||0)+(b.delayed||0)+(b.failed||0):0},e.statusCount=function(b){if(!e.data||!e.data.repos)return 0;for(var P=e.data.repos.statusBreakdown||[],V=0;V<P.length;V++)if(P[V]._id===b)return P[V].count;return 0},e.barPct=function(b){var P=e.data&&e.data.repos?e.data.repos.total:0;if(!P)return 0;var V=[b];b==="expired"&&V.push("expiring"),b==="remov Line truncated
`)},e.tipSide=w=>{let S=(e.summary?.series||[]).length;return S<3?"":w<S/4?"tip-start":w>=S*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((w,S)=>w+e.bucketTotal(S),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(w=>w.active||w.allTimeSales||w.sales),e.familyLabel=w=>(gr.find(S=>S.id===w)||{}).label||"",e.familyPlans=w=>(e.summary?.plans||[]).filter(S=>S.family===w),e.familySum=(w,S)=>e.familyPlans(w).reduce((N,b)=>N+(b[S]||0),0),e.familyMoney=(w,S,N)=>{if(!e.revenueOn())return"\u2014";let b=e.familyPlans(w);return b.some(P=>P[N]===!1)?"Incomplete":e.moneyText(b.reduce((P,V)=>i(P,V[S]),{}))},e.planTotals=()=>{let w=S=>(e.summary?.plans||[]).reduce((N,b)=>N+(b[S]||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?Bn(w*1e3):"\u2014";let d=0;e.loadSummary=()=>{let w=++d;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(S=>{if(w!==d)return;e.summaryLoading=!1;let N=S.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},S=>{w===d&&(e.summaryLoading=!1,e.summaryError=S&&S.data&&S.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=o.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((S,N)=>S+(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(S=>S.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 S=document.getElementById("bl-grants");S&&S.scrollIntoView&&S.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 S=mo({[w.amount.currency]:w.amount.value})[0]||"\u2014";if(!w.amount.interval)return S;let N=w.amount.intervalCount>1?w.amount.intervalCount+" "+w.amount.interval+"s":w.amount.interval;return S+" / "+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 S=pr(w.until);return w.state!=="active"?(new Date(w.until)<new Date?"Ended ":"Ends ")+S:w.subscription?(w.cancelAtPeriodEnd?"Ends ":"Renews ")+S:"Until "+S},e.packNote=w=>{let S=(w.parts||[]).find(N=>N.planId==="author_pass");return!w.pack||!S||!S.until?"":(new Date(S.until)<new Date?"Updates ended ":"Updates until ")+pr(S.until)};let v={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=w=>(w.parts||[]).map(S=>v[S.planId]||e.planName(S.planId)).join(", ").replace(/^./,S=>S.toUpperCase()),e.packPartsTitle=w=>"Paper pack: "+(w.parts||[]).map(S=>e.planName(S.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 m=0;function y(){let w=++m;e.grantsError=null;let S=Object.fromEntries(Object.entries(e.query).filter(([,N])=>N!==""&&N!=null));t.get("/api/admin/billing/grants",{params:S}).then(N=>{w===m&&( Line truncated
`)},xa=class{constructor(t){tt(this,"gen");tt(this,"threads",[]);tt(this,"match",!1);tt(this,"runs",[]);tt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Bc=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((o,r)=>o!==t.ids[r])?!1:e.runs.every(o=>t.runs.some(r=>r.neg===o.neg&&Bc(r.state,o.state))),Vc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),go,Kn,el,tl,Js=class{constructor(t,o,r){Le(this,Kn);tt(this,"dots");tt(this,"dotStart");Le(this,go);this.dots=t,this.dotStart=o,Ue(this,go,r)}state(){return new xa(++le(this,go).gen)}done(t){return t.ids=t.threads.map(o=>o.id).sort((o,r)=>o-r),t.match&&t.ids.unshift(Za.id),t}restricted(t,o){return o&&(this.dots||this.dotStart&&t===0)}add(t,o,r,s){switch(o.t){case"split":if(!qe(this,Kn,el).call(this,t,o))return;for(let d of o.out)this.add(t,d,r,s);return;case"neg":if(!qe(this,Kn,el).call(this,t,o))return;let i=this.state();return this.add(i,o.sub,r,!1),this.done(i),this.addRun(t,{t:"run",neg:o,state:i},r,s);case"star":if(this.restricted(r,s))return;qe(this,Kn,tl).call(this,t,o)&&this.add(t,o.next,r,s);return;case"match":t.match=!0;return;default:qe(this,Kn,tl).call(this,t,o)}}addRun(t,o,r,s){for(let i of t.runs)if(i.neg===o.neg&&Bc(i.state,o.state))return;t.runs.push(o),o.state.match||this.add(t,o.neg.next,r,s)}step(t,o,r,s){let i=this.state();for(let d of t.threads)switch(d.t){case"lit":sl(d,o)&&this.add(i,d.next,r+1,s);break;case"any":this.restricted(r,s)||this.add(i,d.next,r+1,s);break;case"class":!this.restricted(r,s)&&d.re.test(o)&&this.add(i,d.next,r+1,s);break;case"star":this.restricted(r,s)||this.add(i,d,r+1,s)}if(!this.restricted(r,s))for(let d of t.runs){if(d.state.dead){this.addRun(i,d,r+1,s);continue}let p=this.step(d.state,o,r,!1);this.addRun(i,{t:"run",neg:d.neg,state:p},r+1,s)}return this.done(i)}};go=new WeakMap,Kn=new WeakSet,el=function(t,o){let{seen:r}=le(this,go);return r[o.id]===t.gen?!1:(r[o.id]=t.gen,!0)},tl=function(t,o){let{has:r}=le(this,go);return r[o.id]===t.gen?!1:(r[o.id]=t.gen,t.threads.push(o),!0)};var zc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let o=e.runs.map(r=>`${r.neg.id}(${zc(r.state)})`);return`${t}|${o.sort().join("|")}`},jv=1<<18,Xo,Qo,zn,vo,Hn,jn,Gn,an,ol,kr,Hc,nl=class{constructor(t,o){Le(this,an);Le(this,Xo);Le(this,Qo,new Map);Le(this,zn,0);Le(this,vo);Le(this,Hn);Le(this,jn);Le(this,Gn);Ue(this,Xo,t),Ue(this,jn,new Js(!1,!1,o)),Ue(this,Gn,new Js(!1,!0,o))}start(t){if(t){if(le(this,Hn))return le(this,Hn);let r=le(this,Gn).state();return le(this,Gn).add(r,le(this,Xo),0,!0),Ue(this,Hn,qe(this,an,ol).call(this,le(this,Gn).done(r)))}if(le(this,vo))return le(this,vo);let o=le(this,jn).state();return le(this,jn).add(o,le(this,Xo),0,!0),Ue(this,vo,qe(this,an,kr).call(this,le(this,jn).done(o)))}next(t,o){let r=o.charCodeAt(0),s=r<128?void 0:t.next.get(o);if(s)return s;let i=t===le(this,Hn)?qe(this,an,kr).call(this,le(this,Gn).step(t.state,o,0,!0)):qe(this,an,kr).call(this,le(this,jn).step(t.state,o,1,!0));return r<128?(t.ascii||(t.ascii=new Array(128),Ue(this,zn,le(this,zn)+128)),t.ascii[r]=i):t.next.set(o,i),Il(this,zn)._++,i}};Xo=new WeakMap,Qo=new WeakMap,zn=new WeakMap,vo=new WeakMap,Hn=new WeakMap,jn=new WeakMap,Gn=new WeakMap,an=new WeakSet,ol=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},kr=function(t){let o=zc(t),r=le(this,Qo).get(o);if(r)return r;le(this,zn)>jv&&qe(this,an,Hc).call(this);let s=qe(this,an,ol).call(this,t);return le(this,Qo).set(o,s),Ue(this,zn,le(this,zn)+(o.length+1)),s},Hc=function(){le(this,Qo).clear(),Ue(this,zn,0),Ue(this,vo,void 0),Ue(this,Hn,void 0)};var Gv=e=>{let t=[];for(let o=e;o.t!=="match";o=o.next){if(o.t==="split"||o.t==="neg")return;t.push(o)}return t},Wv=(e,t,o,r)=>{let s=0,i=o,d=-1,p=0;for(;i<r;){let c=e[s];if(c?.t==="star"){d=s++,p=i;continue}let v=t[i];if(c&&(c.t==="any"||c.t==="lit"&&sl(c,v)||c.t==="class"&&c.re.test(v))){s++,i++;continue}if(d===-1)return!1;s=d+1,i=++p}for(;e[s]?.t==="star";)s++;return s===e.length},jc=e=>{let t=0,o=0;for(let r of e){let[s,i]=Kv(r);t+=s,o+=i}return[t,o]},Kv=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(jc),o=Math.min(...t.map(i=>i[0])),r=Math.max(...t.map(i=>i[1])),s=r===0?0:1/0;return e.type==="@"?[o,r]:e.type==="?"?[0,r]:e.type==="*"?[0,s]:[o,s]},Lc=(e,t,o)=>{for(let r=0;r<e.length;r++)if(!sl(e[r],t[o+r]))return!1;return!0},Yv=/[/\ud800-\udfff]/,Jv=/[\ud800-\udfff]/,wr=e=>Jv.test(e)?[...e]:e,qc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Wn,Zo,yo,Cr,bo,Qs,Sr,wo,Zs,xs,ei,Ln,Cn,xo,es,ti,Er,rn,ko,Ys,Xs=class{constructor(t,o={}){Le(this,ko);tt(this,"pattern");tt(this,"options");Le(this,Wn);Le(this,Zo);Le(this,yo);Le(this,Cr);Le(this,bo);Le(this,Qs,!1);Le(this,Sr);Le(this,wo);Le(this,Zs,!1);Le(this,xs,0);Le(this,ei,1/0);Le(this,Ln,[]);Le(this,Cn,[]);Le(this,xo);Le(this,es);Le(this,ti,!1);Le(this,Er);Le(this,rn);if(t.includes Line truncated
`).forEach((o,r)=>{let{term:s}=gl(o.trim());if(!s)return;let i=[];for(let d=0;d<s.length;d++){if(s[d]==="\\"){d++;continue}ap.has(s[d])&&!i.includes(s[d])&&i.push(s[d])}i.length&&t.push({line:r,term:s,symbols:i})}),t}function dp(e,t){let o=String(e||"").split(`
`),r=o[t];if(r===void 0)return e;let{term:s}=gl(r.trim());if(!s)return e;let i="";for(let p=0;p<s.length;p++){if(s[p]==="\\"){i+=s.slice(p,p+2),p++;continue}i+=ap.has(s[p])||s[p]==="."?"\\"+s[p]:s[p]}let d=r.indexOf(s);return o[t]=r.slice(0,d)+i+r.slice(d+s.length),o.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.",cache_miss:"This file is not cached yet. Please try again.",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_no Line truncated
`)),e.options=Object.assign({},e.options,y.options),p.restore()})}c();let v=null;e.saveDefault=m=>{if(m&&m.preventDefault&&m.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&&r.cancel(v),v=r(()=>{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([o("ERRORS."+w),o("ERRORS.unknown_error")]).then(([N,b])=>{e.error=w&&N!==b?N:C},()=>{e.error=C})})},e.deleteAccount=()=>{e.deletingAccount||!e.confirmDeleteAccount||e.deleteUsername!==e.user?.username||(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},ap=function(e,t,o){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(r=>{o.url("/dashboard")},r=>{e.error=r.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},lp=function(e,t,o,r,s){e.user&&!e.user.status&&o.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&o.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 m=e.features.length,y=v==="first"?0:v==="last"?m-1:(c+v+m)%m;e.feature=e.features[y].key,s(()=>{let g=r.document.getElementById("feature-tab-"+e.feature);g&&g.focus()})},e.demoText=`# DeepLearnUtils
`).map(C=>C.trim()).filter(C=>C.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&&r.cancel(v),v=r(()=>{e.message=null},2500)},C=>{e.saving=!1;let w=C&&C.data&&C.data.error,S="Unable to save your defaults. Please try again.";Promise.all([o("ERRORS."+w),o("ERRORS.unknown_error")]).then(([N,b])=>{e.error=w&&N!==b?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."}))}},hp=function(e,t,o){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(r=>{o.url("/dashboard")},r=>{e.error=r.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},gp=function(e,t,o,r,s){e.user&&!e.user.status&&o.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&o.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 m=e.features.length,y=v==="first"?0:v==="last"?m-1:(c+v+m)%m;e.feature=e.features[y].key,s(()=>{let g=r.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(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"),m={},y=0;return(e.demoText||"").split(v).filter(g=>g!=="").map(g=>{let k=p.find(w=>w.toLowerCase()===g.toLowerCase());return k?(m[k.toLowerCase()]||(m[k.toLowerCase()]=++y),{text:String(m[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 i(){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(()=>{})}i();function d(p){let c={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return c;let v=new Array(p.length-1);for(let C=1;C<p.length;C++)v[C-1]=p[C]-p[C-1];let m=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=m*2,c.bars=new Array(m);for(let C=0;C<m;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[m-1],m>=2){let C=v[m-2];C&&(c.pctChange=(c.deltaToday-C)/C*100)}return c.pctAbs=Math.round(Math.abs(c.pctChange)),c.isUp=c.pctChange>=0,c}e.history={repositories:d([]),users:d([]),pageViews:d([]),pullRequests:d([])},t.get("/api/stat/history?days=60").then(p=>{let c=p.data||[];e.history={repositories:d(c.map(v=>v.nbRepositories||0)),users:d(c.map(v=>v.nbUsers||0)),pageViews:d(c.map(v=>v.nbPageViews||0)),pullRequests:d(c.map(v=>v.nbPullRequests||0))}}).catch(()=>{})},dp=function(e,t,o,r,s,i){let d=bt();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),d.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,je(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Ot()(document,"click",E=>{e.quotaExpanded&&!E.target.closest?.(".dashboard-quota")&&(e.quotaExpanded=!1)}),e.filtersExpanded=!1,e.projectView="all",e.selectedProject=null,e.projectName="",e.nameSaving=!1,e.nameError="",e.nameMessage="",e.needsAttention=E=>E.status==="error"||E._broken||c(E.status)==="progress"&&E._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=E=>{e.projectView=E,E==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=E=>{let F=Ma(E?.anonymizeDate||E?.lastView)||"";return/ ago$/.test(F)?"No activity for "+F.replace(/ ago$/,""):"No activity since "+F.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=E=>"project-details-"+encodeURIComponent(E._type+":"+(E._id||E._source||"unknown")),e.showProjectDetails=async E=>{e.selectedProject=E,e.projectName=E.projectName||"",e.nameError="",e.nameMessage="",await je();let F=document.getElementById(e.projectDetailsId(E));F?.focus(),F?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=E=>{e.selectedProject=null,je(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(E._type+":"+E._id)}"]`)?.focus())},e.saveProjectName=async E=>{if(e.nameSaving||!E._id)return;let F=e.projectName.trim();if(F.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let Y=await t.post("/api/user/project-name",{type:E._type,id:E._id,name:F});E.projectName=Y.data.name,E._label=E.projectName||E._fallbackLabel,e.selectedProject===E&&(e.nameMessage=F?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await _(),e.selectedProject===E&&(e.selectedProject=e.items.find(G=>G._type===E._type&&G._id===E._id)||null))}catch{e.selectedProject===E&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async E=>{if(!E._viewUrl||e.copyingId)return;let F=new URL(E._viewUrl,s.location.origin).href;e.copyingId=E._type+":"+E._id;try{await cl(F),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:F})}finally{e.copyingId=null}},e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"Preparing",error:"Error",expired:"Expiring / expired",removed:"Removing / removed"};let p=["queue","download","downloaded","preparing","anonymizing"];function Line truncated
`)),e.options=Object.assign({},e.options,B.options),e.options.expirationDate=B.options&&B.options.expirationDate?new Date(B.options.expirationDate):q(),!r.repoId&&!r.pullRequestId&&!r.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),S&&S()})}function Ne(S,V,B){e.anonymize&&e.anonymize[S]&&e.anonymize[S].setValidity(V,B)}function tt(S){try{let V=parseGithubUrl(S);if(V&&V.owner&&V.repo)return V.owner+"/"+V.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!r.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||tt(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let S=g();try{let V=await t.get("/github/connections");if(e.githubConnections=V.data,!V.data.appEnabled)return;let B=await t.post("/github/connections/migrate",{type:"repository",id:r.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":V.data.csrf}});if(!y(S))return;e.error=null,B.data.fullName&&(e._originalFullName=B.data.fullName,e.source.fullName=B.data.fullName,e.sourceUrl="https://github.com/"+B.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(S)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,k(S)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.details=null,e.source.commit="",e.source.branch="",e.readme="",e.branches=[];try{await ce()}catch{}}};function Re(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:tt(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function qe(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function X(){let S=new URLSearchParams(window.location.search).get("billingDraft");if(S){N.restore();try{let B=(await t.get("/api/billing/draft/"+encodeURIComponent(S))).data;if(B.path!==s.path())throw new Error("Wrong task");b=B.values.conference||null;for(let K of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(B.values,K)&&(e[K]=B.values[K]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=B.id,M=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await qe(),s.replace?.(s.path()),!0}catch{e.billingError="The checkout draft could not be restored. Retry by reloading this page; any local draft is still available."}}let V;try{V=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!V||V.path!==s.path()||Date.now()-V.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await qe(),!0):!1;N.restore();for(let B of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(V.draft,B)&&(e[B]=V.draft[B]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await qe(),sessionStorage.removeItem("github-access-draft"),!0}Ze(()=>{!r.repoId&&!r.pullRequestId&&!r.gistId&&d(X,0),r.repoId&&r.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=r.repoId,t.get("/api/repo/"+e.repoId).then(async S=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(S.data.status),e.githubConnection=S.data.connection||"oauth",e.sourceUrl="https://github.com/"+S.data.source.fullName,e._originalFullName=S.data.source.fullName,e.terms=S.data.options.terms.filter(V=>V).join(`
`),e.source=S.data.source,e.role=S.data.role||"owner",e._existingNever=S.data.options.expirationMode==="never",e._savedExpirationDate=S.data.options.expirationDate?new Date(S.data.options.expirationDate):null,e.coauthors=S.data.coauthors||[],e._originalBranch=S.data.source.branch,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,e.repositoryID=S.data.source.repositoryID,e._originalRepositoryID=S.data.source.repositoryID,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await X()&&(await Promise.all([ce(),ue()]),No())},()=>{s.url("/404")})),r.pullRequestId&&r.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=r.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async S=>{if(e.githubConnection=S.data.connection||"oauth",e.sourceUrl="https://github.com/"+S.data.source.repositoryFullName+"/pull/"+S.data.source.pullRequestId,e.terms=S.data.options.terms.filter(V=>V).join(`
`),e.source=S.data.source,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await X())try{await bl()}catch{}},()=>{s.url("/404")})),r.gistId&&r.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=r.gistId,t.get("/api/gist/"+e.gistId).then(async S=>{e.sourceUrl="https://gist.github.com/"+S.data.source.gistId,e.terms=S.data.options.terms.filter(V=>V).join(`
`),e.source=S.data.source,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await X()&&await wl()},()=>{s.url("/404")}))}),t.get("/github/connections").then(S=>{e.githubConnections=S.data,!r.repoId&&!r.pullRequestId&&!r.gistId&&e.githubConnection===void 0&&S.data.appEnabled&&S.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&qe())}).catch(()=>{}).finally(()=>{!v&&!r.repoId&&!r.pullRequestId&&!r.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(S=!1)=>{let V=++c;e.previousConfigurations=[],e.previousConfigurationId="";let B;try{B=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,fe(),Jt.cancel(),qn.cancel(),Ln.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",Ne("sourceUrl","github",!1);return}let K=C(B),le=S||w===K;w=K,e.sourceUrlError="",Ne("sourceUrl","github",!0),fe();let be=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let Ge=window.document.getElementById("sourceUrl");if(Ge){try{Ge.setSelectionRange(0,0)}catch{}Ge.scrollLeft=0}},50),be&&d(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!le&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],le||(e.source={type:"GitHubStream",branch:"",commit:""}),Jt.cancel(),qn.cancel(),Ln.cancel(),Ro.clear(),To.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",Nf(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=le;try{B.gistId&&!B.repo?(e.detectedType="gist",e.source={gistId:B.gistId},await wl()):B.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:B.owner+"/"+B.repo,pullRequestId:B.pullRequestId},await bl()):(e.detectedType="repo",Z(),await Promise.all([ce(),ue()]),No())}catch{}finally{V===c&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let S=e.branches.filter(B=>B.name==e.source.branch)[0];if(!S)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=S.commit),e.readme=S.readme,await ue(),No()}),e.getBranches=async S=>{let V=parseGithubUrl(e.sourceUrl),B=g();try{if(!e.details){await ce(S);return}let K=await t.get(`/api/repo/${V.owner}/${V.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&tt(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:S===!0||e.reconnectingSource?"1":"0",repositoryID:Re()}});if(!y(B))return;e.branches=K.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let le=e.branches.filter(be=>be.name==e.source.branch);le.length>0&&(!(!e.reconnectingSource&&!S&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=le[0].commit),e.readme=le[0].readme,await ue(S))}catch(K){if(!y(B))return;e.branches=[],e.sourceUnreachable=K&&(K.status===404||K.data&&K.data.error==="repo_not_found"),e.details=null,x(K)}finally{k(B)}};async function ce(S=!1){let V=parseGithubUrl(e.sourceUrl),B=g();try{Po(),fe();let K=await t.get(`/api/repo/${V.owner}/${V.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&tt(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,repositoryID:Re(),force:"1"}});if(!y(B))return;e.details=K.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(S||e.reconnectingSource)}catch(K){if(!y(B))return;throw x(K),K}finally{k(B)}}async function ue(S){if(e.readme&&!S)return e.readme;let V=parseGithubUrl(e.sourceUrl),B=g();try{let K=await t.get(`/api/repo/${V.owner}/${V.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&tt(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:S===!0?"1":"0",branch:e.source.branch,repositoryID:Re()}});y(B,!0)&&(e.readme=K.data)}catch{y(B,!0)&&(e.readme="")}finally{k(B)}}let me={magicalBraces:!0},we=S=>S.startsWith("/")&&!S.endsWith("/")&&Kn(ko(S.slice(1),me),me)===S.slice(1),Ve=()=>Object.keys(e.preserve.picked).filter(S=>e.preserve.picked[S]).sort().map(S=>"/"+Kn(S,me)),A=S=>"/"+Kn(S,me)+"/**",I=S=>"!/"+Kn(S,me)+"/",U=()=>String(e.preserve.patterns||"").split(`
`).map(S=>S.trim()).filter(Boolean),J=null,W=null,ee=new Set,de=0,oe=null,se=()=>!1;function te(){let S=de+"\0"+e.preserve.patterns;if(S!==oe){oe=S;try{se=dl(ll([...Ve(),...U()]))}catch{se=()=>!1}}return se}function ke(S){let V=new Map([["",{dirs:[],files:[]}]]);for(let B of S){let K=B.split("/"),le="";for(let be=0;be<K.length-1;be++){let Ge=K.slice(0,be+1).join("/");V.has(Ge)||(V.set(Ge,{dirs:[],files:[]}),V.get(le).dirs.push(Ge)),le=Ge}V.get(le).files.push(B)}for(let B of V.values())B.dirs.sort();return{files:S,dirs:V,descendants:new Map}}function pe(S){return J.descendants.has(S)||J.descendants.set(S,J.files.filter(V=>V.startsWith(S+"/"))),J.descendants.get(S)}let Ee=S=>te()(S);function Pe(S){let V=pe(S),B=0;for(let K of V)Ee(K)&&B++;return B===0?"none":B===V.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let S=(e.options?.preserveFiles||[]).map(V=>String(V).trim()).filter(Boolean).map(V=>we(V)?ko(V.slice(1),me):V);return S.length?S.slice(0,2).join(", ")+(S.length>2?` and ${S.length-2} more`:""):"None. Every file is redacted."};async function Le(){let S=e.source?.commit;if(!(J&&e.preserve.commit===S)){e.preserve.loading=!0,e.preserve.error="",J=null,W=null;try{let V=parseGithubUrl(e.sourceUrl),B=await t.get(`/api/repo/${V.owner}/${V.repo}/tree`,{params:{commit:S,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&r.repoId&&tt(e.sourceUrl)===e._originalFullName?r.repoId:void 0,repositoryID:Re()}});if(e.source?.commit!==S)return;let K=Array.isArray(B.data.binaryFiles)?B.data.binaryFiles:[];J=fn(ke(B.data.files||[])),W=K.length?fn(ke([...B.data.files||[],...K])):J,ee=fn(new Set(K)),e.preserve.commit=S,e.preserve.truncated=!!B.data.truncated,e.previewFile||Jt()}catch{e.preserve.error="The file list could not be loaded from GitHub. You can still use patterns.",e.preserve.patternsOpen=!0}finally{e.preserve.loading=!1}}}e.watch("source.commit",S=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&S&&e.sourceUrl&&Le().catch(()=>{})}),e.openPreserveFiles=()=>{let S={},V=[];for(let K of e.options?.preserveFiles||[]){let le=String(K).trim();le&&(!V.length&&we(le)?S[ko(le.slice(1),me)]=!0:V.push(le))}let B={};for(let K of Object.keys(S)){let le=K.split("/");for(let be=1;be<le.length;be++)B[le.slice(0,be).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:S,expanded:B,patterns:V.join(`
`),patternsOpen:V.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),de++,d(()=>{let K=document.getElementById("preserve-files-dialog");K?.showModal&&!K.open&&K.showModal(),document.getElementById("preserve-files-search")?.focus()},0),Le()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=ll([...Ve(),...U()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!J)return[];let S=te(),V=(be,Ge,Mt)=>{let ft=!!e.preserve.picked[be],Rt=S(be);return{kind:"file",path:be,label:Mt,depth:Ge,state:Rt?"all":"none",locked:!ft&&Rt,note:!ft&&Rt?"matched by a pattern":ft&&!Rt?"excluded by a pattern":""}},B=String(e.preserve.search||"").trim().toLowerCase();if(B)return J.files.filter(be=>be.toLowerCase().includes(B)).slice(0,300).map(be=>V(be,0,be));let K=[],le=(be,Ge)=>{let Mt=J.dirs.get(be);for(let ft of Mt.dirs){let Rt=!!e.preserve.expanded[ft],jt=U().includes(A(ft));K.push({kind:"dir",path:ft,label:ft.slice(be?be.length+1:0)+"/",depth:Ge,open:Rt,state:Pe(ft),locked:!1,note:jt?"whole folder":""}),Rt&&le(ft,Ge+1)}for(let ft of Mt.files)K.push(V(ft,Ge,ft.slice(be?be.length+1:0)))};return le("",0),K},e.preserveCount=()=>J?J.files.filter(Ee).length:0,e.togglePreserveDir=S=>{e.preserve.expanded[S]=!e.preserve.expanded[S]},e.togglePreserveFile=S=>{e.preserve.picked[S]=!e.preserve.picked[S],de++},e.togglePreserveFolder=S=>{let V=A(S),B=I(S),K=U().filter(be=>be!==V&&be!==B),le=Pe(S)==="all"||U().includes(V);for(let be of pe(S))e.preserve.picked[be]=!1;de++,e.preserve.patterns=(le?K:[...K,V]).join(`
`),le&&pe(S).some(Ee)&&(e.preserve.patterns=[...K,B].join(`
`))};let Xe=/^readme(\.[^/]*)?$/i,We=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],Se=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],Fe=S=>{let V=Be(S),B=V.indexOf("."),K=We.indexOf(B===-1?"":V.slice(B).toLowerCase());return K===-1?We.length:K},it=()=>!!J&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!it())return"";for(let S of[".github","","docs"]){let V=(J.dirs.get(S)?.files||[]).filter(B=>Xe.test(Be(B)));if(V.length)return V.sort((B,K)=>Fe(B)-Fe(K)||ve(B,K))[0]}return""},e.readmeName=()=>Be(e.readmePath())||"README.md";let dt={key:null,fn:()=>!1},Pt=()=>{let S=(e.options?.preserveFiles||[]).map(B=>String(B).trim()).filter(Boolean),V=S.join(`
`);if(V!==dt.key){let B=()=>!1;try{S.length&&(B=dl(S))}catch{}dt={key:V,fn:B}}return dt.fn};e.pathPreserved=S=>!!S&&Pt()(S),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let S=Pt();if(it()){let V=e.readmePath();return!!V&&S(V)}return Se.some(V=>S(V))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function wt(){let S={terms:e.terms?e.terms.split(`
`):[],filePath:e.previewOpenPath()||"README.md",preserveFiles:e.options.preserveFiles||[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(S.branchName=e.source.branch);try{let V=parseGithubUrl(e.sourceUrl);S.repoName=`${V.owner}/${V.repo}`}catch{}return S}function rt(S,V,B){let K=null,le=0,be=()=>{if(e.detectedType!==S)return;K&&d.cancel(K);let Ge=++le;e.previewStatus="loading",K=d(()=>{K=null;let Mt=V();if(!Mt){e.previewStatus="idle";return}t.post("/api/anonymize-preview",Mt).then(ft=>{Ge===le&&(B(ft.data,Mt),e.previewStatus="ready")}).catch(()=>{Ge===le&&(e.previewStatus="error")})},200)};return be.cancel=()=>{le++,K&&d.cancel(K),K=null},e.on("dispose",be.cancel),be}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof an!="string"?vl(e.previewFile):Jt()),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()};let Ie=fn(Hs(e));Object.defineProperty(e,"previewViewer",{get:()=>Ie}),_a(Ie,e),Object.assign(Ie,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),Ie.preview=!0,Ie.fileSize=S=>S===Ie.filePath&&typeof an=="string"?new Blob([an]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,Ie.openPreserveFiles=()=>e.openPreserveFiles(),Ie.previewPreserved=()=>e.previewPreserved(),Ie.retryContent=()=>e.retryPreview();let rn=S=>ee.has(S)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(S),So=(S="")=>({path:S,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=So();let is=0,an=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=S=>{if(S=S||"",S&&S===e.readmePath()&&(S=""),is++,an=null,ai(),Jt.cancel(),e.previewFile=S,e.previewDoc=So(S),Ie.sidebarCollapsed=!0,Ie.content=null,!S){e.readme?Jt():e.previewStatus="idle";return}if(rn(S)){Dr("binary"),e.previewStatus="ready";return}vl(S)};function Nf(){is++,an=null,e.previewFile="",e.previewDoc=So(),Ie.sidebarCollapsed=!0,Ie.content=null}function vl(S){let V=++is;an=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let B;try{B=parseGithubUrl(e.sourceUrl)}catch{B=null}if(!B||!e.source?.commit){Object.assign(e.previewDoc,{loading:!1,loadError:"The repository is still loading. Try again in a moment."}),e.previewStatus="error";return}t.get(`/api/repo/${B.owner}/${B.repo}/file`,{params:{commit:e.source.commit,path:S,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&r.repoId&&tt(e.sourceUrl)===e._originalFullName?r.repoId:void 0,repositoryID:Re()},transformResponse:K=>K}).then(K=>{if(V!==is)return;e.previewDoc.loading=!1;let le=typeof K.headers=="function"&&K.headers("content-type")||"";if(/json/i.test(le)){let be=null;try{be=JSON.parse(K.data)}catch{}if(be&&be.binary===!0){Dr("binary"),e.previewStatus="ready";return}}an=typeof K.data=="string"?K.data:"",Jt()},K=>{if(V!==is)return;e.previewDoc.loading=!1;let le=Er(K);if(le==="file_too_big"){Dr("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=Zn.ERRORS[le]||"GitHub did not return this file.",e.previewStatus="error"})}let ri;function ai(){ri&&window.URL.revokeObjectURL(ri),ri=void 0,Ie.url=void 0}e.on("dispose",ai);function Dr(S){ai(),e.previewDoc.note=S,Ie.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),Ie.type=S==="too_big"?"error":"binary",Ie.content=S==="too_big"?"file_too_big":"binary"}function Rf(S){try{let V=parseGithubUrl(e.sourceUrl),B=e.source.branch||e.details&&e.details.defaultBranch||"main",K=S&&S.includes("/")?S.slice(0,S.lastIndexOf("/")+1):"";return`https://github.com/${V.owner}/${V.repo}/raw/${B}/${K}`}catch{return""}}let yl=rt("repo",()=>e.previewFile?typeof an!="string"?null:{content:an,options:wt()}:e.readme?{content:e.readme,options:wt()}:null,S=>{if(typeof S?.content!="string")throw Error("Invalid preview response");ai(),window.URL?.createObjectURL&&(Ie.url=ri=window.URL.createObjectURL(new Blob([S.content],{type:"text/plain"})));let V=e.previewOpenPath()||e.readmeName();Ie.prepareFile(e.previewPathName(V)),Ie.fileBaseUrl=Rf(V),Ie.renderFileContent(S.content,Ie.type,Ie.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=S.content)}),Jt=()=>{e.previewFile&&typeof an!="string"||yl()};Jt.cancel=yl.cancel;let Eo=at(new Map),Ar=new Set,Ir=new Set,rs="",as=null,li=()=>String(e.terms||"").split(`
`).filter(S=>S.trim());function Tf(){as=null;let S=li(),V=S.join(`
`);V!==rs&&(Eo.clear(),Ir.clear(),rs=V);let B=[...Ar].filter(K=>!Eo.has(K));if(Ar.clear(),!(!B.length||!S.length))for(let K=0;K<B.length;K+=400){let le=B.slice(K,K+400);t.post("/api/anonymize-preview",{contents:le,options:{terms:S,image:!0,link:!0}}).then(be=>{if(rs!==V||li().join(`
`)!==V)return;let Ge=be.data?.contents;if(!Array.isArray(Ge)||Ge.length!==le.length)throw Error("Invalid preview response");le.forEach((Mt,ft)=>Eo.set(Mt,typeof Ge[ft]=="string"?Ge[ft]:Mt))}).catch(()=>{rs===V&&le.forEach(be=>Ir.add(be))})}}e.previewName=S=>{if(!S||!li().length)return S;if(rs===li().join(`
`)){if(Eo.has(S))return Eo.get(S);if(Ir.has(S))return S}return Ar.add(S),as||(as=d(Tf,120)),S},e.previewPathName=S=>{S=String(S||"");let V=S.lastIndexOf("/");return V<0?e.previewName(S):e.previewName(S.slice(0,V))+"/"+e.previewName(S.slice(V+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{Ie.repoId=e.repoId||"repository",Ie.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),Ie.paths=Ie.filePath.split("/"),Ie.files=e.previewTreeFiles(),Ie.loadedFolders=Object.fromEntries([...W?.dirs.keys()||[]].map(S=>[e.previewName(S),!0]))},!0),e.on("dispose",()=>{as&&d.cancel(as)});function No(){!e.anonymize||!e.anonymize.terms||Jt()}async function bl(){let S=parseGithubUrl(e.sourceUrl),V=g();try{Po(),fe();let B=await t.get(`/api/pr/${S.owner}/${S.repo}/${S.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(V))return;e.details=B.data,e.pullRequestId||(e.pullRequestId=S.repo+"-PR"+S.pullRequestId+"-"+generateRandomId(4))}catch(B){if(!y(V))return;throw x(B),B}finally{k(V)}}let Ro=at(new Map);function Pf(){let S=new Set,V=e.details&&e.details.pullRequest;if(!V)return S;typeof V.title=="string"&&S.add(V.title),typeof V.body=="string"&&S.add(V.body),typeof V.diff=="string"&&S.add(V.diff);let B=V.comments||[];for(let K of B)typeof K.author=="string"&&S.add(K.author),typeof K.body=="string"&&S.add(K.body);return S}let qn=rt("pr",()=>{let S=Pf(),V=Array.from(S);return V.length===0?null:{contents:V,options:wt()}},(S,V)=>{if(!Array.isArray(S?.contents)||S.contents.length!==V.contents.length||S.contents.some(le=>typeof le!="string"))throw Error("Invalid preview response");let B=V.contents,K=new Map;for(let le=0;le<B.length&&le<S.contents.length;le++)K.set(B[le],S.contents[le]);Ro.clear(),K.forEach((le,be)=>Ro.set(be,le))});e.anonymizePrContent=function(S){return S&&(Ro.has(S)?Ro.get(S):"")};async function wl(){let S=parseGithubUrl(e.sourceUrl),V=g();try{Po(),fe(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let B=await t.get(`/api/gist/source/${S.gistId}`);if(!y(V))return;e.details=B.data,e.gistId||(e.gistId="gist-"+S.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(B){if(!y(V))return;if(B.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,Ne("sourceUrl","missing",!1);return}if(B.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,Ne("sourceUrl","missing",!1);return}throw x(B),B}finally{k(V)}}let To=at(new Map);function Df(){let S=new Set,V=e.details&&e.details.gist;if(!V)return S;typeof V.description=="string"&&S.add(V.description),typeof V.ownerLogin=="string"&&S.add(V.ownerLogin);let B=V.files||[];for(let le of B)typeof le.filename=="string"&&S.add(le.filename),typeof le.content=="string"&&S.add(le.content);let K=V.comments||[];for(let le of K)typeof le.author=="string"&&S.add(le.author),typeof le.body=="string"&&S.add(le.body);return S}let Ln=rt("gist",()=>{let S=Df(),V=Array.from(S);return V.length===0?null:{contents:V,options:wt()}},(S,V)=>{if(!Array.isArray(S?.contents)||S.contents.length!==V.contents.length||S.contents.some(le=>typeof le!="string"))throw Error("Invalid preview response");let B=V.contents,K=new Map;for(let le=0;le<B.length&&le<S.contents.length;le++)K.set(B[le],S.contents[le]);To.clear(),K.forEach((le,be)=>To.set(be,le)),Or()});e.anonymizeGistContent=function(S){return S&&(To.has(S)?To.get(S):"")},e.previewGistFiles=[];function Or(){let S=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=S.map(V=>({filename:e.anonymizeGistContent(V.filename),content:e.anonymizeGistContent(V.content),language:V.language}))}e.watch("details.gist.files",Or,!0),e.watch("terms",Or);function Af(){let S=e.conference;if(e.conference_data=null,!S)return;let V=S===b||e.isUpdate&&S===e._originalConference;S!==b&&(b=null),t.get("/api/conferences/"+S).then(B=>{e.conference===S&&(e.conference_data=B.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!V&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===S&&(e.conference_data=null)})}function Po(){Ne("repoId","used",!0),Ne("repoId","format",!0),Ne("pullRequestId","used",!0),Ne("pullRequestId","format",!0),Ne("gistId","used",!0),Ne("gistId","format",!0),Ne("sourceUrl","used",!0),Ne("sourceUrl","missing",!0),Ne("sourceUrl","access",!0),Ne("sourceUrl","github",!0),Ne("commit","exists",!0),Ne("conference","activated",!0),Ne("terms","format",!0),e.termHints=[]}function di(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let S=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||S&&S.invalid?(S&&S.setDirty&&S.setDirty(),e.error="Pl Line truncated
`).filter(be=>be),connection:e.githubConnection,fullName:`${B.owner}/${B.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(K.options.pageSource=e.details.pageSource),Po();let le=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(le,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},be=>{if(be.data){let Ge=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(be.data.error);Ge||i("ERRORS."+be.data.error).then(Mt=>{e.error=Mt},console.error),ui(be.data.error),Ge&&(be.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,je(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{V.disabled=!1})},e.anonymizeGist=S=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(di())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let V=S.currentTarget||S.target.closest?.("button")||S.target;V.disabled=!0;let B=parseGithubUrl(e.sourceUrl),K={gistId:e.gistId,terms:e.terms.trim().split(`
`).filter(be=>be),source:{gistId:B.gistId},options:e.options,conference:e.conference};Po();let le=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(le,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},be=>{be.data&&(i("ERRORS."+be.data.error).then(Ge=>{e.error=Ge},console.error),ui(be.data.error))}).finally(()=>{V.disabled=!1})},e.anonymizePullRequest=S=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(di())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let V=S.currentTarget||S.target.closest?.("button")||S.target;V.disabled=!0;let B=parseGithubUrl(e.sourceUrl),K={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
`).filter(be=>be),source:{repositoryFullName:`${B.owner}/${B.repo}`,pullRequestId:B.pullRequestId},options:e.options,conference:e.conference};Po();let le=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(le,K,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},be=>{be.data&&(i("ERRORS."+be.data.error).then(Ge=>{e.error=Ge},console.error),ui(be.data.error))}).finally(()=>{V.disabled=!1})},e.watch("conference",()=>{Af()}),e.termHints=[],e.matchTermAsWritten=S=>{e.terms=tp(e.terms,S)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&Jt()}),e.watch("terms",()=>{e.termHints=ep(e.terms),e.detectedType==="repo"&&No(),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()}),e.watch("options.image",()=>{e.detectedType==="repo"&&No(),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()}),e.watch("options.link",()=>{e.detectedType==="repo"&&No(),e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()}),e.watch("details",()=>{e.detectedType==="pr"&&qn(),e.detectedType==="gist"&&Ln()},!0)},pl=function(e,t,o,r,s,i){_a(e);let d=bt();Rr();let p=Ot(),c=0,v=null,m=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){v&&(v.resolve(),v=null),m&&(d.timeout.cancel(m),m=null)}let g=!1;e.on("dispose",()=>{g=!0,c++,y(),k&&k.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,p(document,"click",O=>{e.symbolsOpen&&!O.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!O.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!O.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&O.target.isConnected&&!O.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!O.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!O.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",O=>{O.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(O.ctrlKey||O.metaKey)&&!O.altKey&&O.key&&O.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(O.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(O){if((O.metaKey||O.ctrlKey)&&O.key==="k"){O.preventDefault();var L=document.querySelector(".tree-search-input");L&&(L.focus(),L.select())}});var k=null;e.onFileSearchChange=function(){k&&(k.resolve(),k=null);let O=e.fileSearchQuery;if(!O||O.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let L=i.defer();k=L,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(O)}`,{timeout:L.promise}).then(function(E){if(!(g||k!==L)){k=null,e.fileSearchLoading=!1;var F={};e.files.forEach(function(qe){F[(qe.path||"")+"/"+qe.name]=!0});for(var Y=[],G={},Z=0;Z<E.data.length;Z++){var ie=E.data[Z];if(ie.path)for(var x=ie.path.split("/"),fe="",ve=0;ve<x.length;ve++){var Be=fe;fe=fe?fe+"/"+x[ve]:x[ve];var He=Be+"/"+x[ve];!F[He]&&!G[He]&&(G[He]=!0,Y.push({name:x[ve],path:Be}))}}Y.sort(function(qe,X){return(qe.path||"").split("/").length-(X.path||"").split("/").length}),Y.length>0&&e.files.push.apply(e.files,Y);for(var Ze=[],Ne=0;Ne<E.data.length;Ne++){var tt=E.data[Ne],Re=(tt.path||"")+"/"+tt.name;!F[Re]&&tt.size!=null&&(Ze.push(tt),F[Re]=!0)}Ze.length>0&&e.files.push.apply(e.files,Ze),e.fileSearchResults=E.data}},function(){!g&&k===L&&(k=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(O,L){if(e.repoId!=r.repoId)return z();if((r.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=r.path||"",e.paths=e.filePath.split("/").filter(E=>E&&E.trim().length>0),q();for(let E=0;E<e.paths.length-1;E++){let F=E>0?e.paths.slice(0,E).join("/"):"";e.files.some(G=>G.path===F)||e.getFiles(F)}}});function w(){if(e.paths[0]!="")return;let O=["readme.md","readme.txt","readme.org","readme.1st","readme"],L={};for(let F of e.files)F.name.toLowerCase().indexOf("readme")>-1&&(L[F.name.toLowerCase()]=F.name);let E=null;for(let F of O)if(L[F]){E=F;break}if(!E&&Object.keys(L).length>0&&(E=Object.keys(L)[0]),E){let F=o.url();F[F.length-1]!="/"&&(F+="/"),o.url(F+encodePathForUrl(L[E]))}}e.fileCounts=null;let C=0,N=new Set,b=!1;e.getFiles=function(O,L=!1){let E=e.repoId,F=C;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(O)}&v=${e.options.lastUpdateDate}`).then(function(Y){if(g||E!==e.repoId||F!==C)return[];let G=O||"";return e.files=e.files.filter(Z=>Z.path!==G),e.files.push(...Y.data),e.loadedFolders={...e.loadedFolders,[G]:!0},P(G,F),Y.data},function(Y){if(g||E!==e.repoId||F!==C)return[];L||(e.type="error",e.content=Er(Y),e.files=[])})};function P(O,L){if(b||N.has(O))return;N.add(O);let E=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(O)}`).then(function(F){g||E!==e.repoId||L!==C||(e.fileCounts={...e.fileCounts,...F.data})},function(){g||E!= Line truncated
Contact: jane.smith@mit.edu`,e.demoTerms="Jane Smith, Smith, MIT CSAIL, jane.smith@mit.edu",e.demoParts=function(){let p=(e.demoTerms||"").split(/[,\n]/).map(g=>g.trim()).filter(Boolean).sort((g,C)=>C.length-g.length),c=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let v=new RegExp("("+p.map(c).join("|")+")","gi"),m={},y=0;return(e.demoText||"").split(v).filter(g=>g!=="").map(g=>{let C=p.find(w=>w.toLowerCase()===g.toLowerCase());return C?(m[C.toLowerCase()]||(m[C.toLowerCase()]=++y),{text:String(m[C.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 i(){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(()=>{})}i();function d(p){let c={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return c;let v=new Array(p.length-1);for(let S=1;S<p.length;S++)v[S-1]=p[S]-p[S-1];let m=v.length,y=Math.max.apply(null,v),g=Math.min.apply(null,v),C=Math.min(0,g),w=y-C||1;c.viewW=m*2,c.bars=new Array(m);for(let S=0;S<m;S++){let N=(v[S]-C)/w,b=Math.max(1.5,N*34);c.bars[S]={x:(S*2+.25).toFixed(2),y:(36-b).toFixed(2),w:"1.5",h:b.toFixed(2)}}if(c.deltaToday=v[m-1],m>=2){let S=v[m-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:d([]),users:d([]),pageViews:d([]),pullRequests:d([])},t.get("/api/stat/history?days=60").then(p=>{let c=p.data||[];e.history={repositories:d(c.map(v=>v.nbRepositories||0)),users:d(c.map(v=>v.nbUsers||0)),pageViews:d(c.map(v=>v.nbPageViews||0)),pullRequests:d(c.map(v=>v.nbPullRequests||0))}}).catch(()=>{})},vp=function(e,t,o,r,s,i){let d=yt();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),d.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,Be(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Ot()(document,"click",E=>{e.quotaExpanded&&!E.target.closest?.(".dashboard-quota")&&(e.quotaExpanded=!1)}),e.filtersExpanded=!1,e.projectView="all",e.selectedProject=null,e.projectName="",e.nameSaving=!1,e.nameError="",e.nameMessage="",e.needsAttention=E=>E.status==="error"||E._broken||c(E.status)==="progress"&&E._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=E=>{e.projectView=E,E==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=E=>{let F=Ua(E?.anonymizeDate||E?.lastView)||"";return/ ago$/.test(F)?"No activity for "+F.replace(/ ago$/,""):"No activity since "+F.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=E=>"project-details-"+encodeURIComponent(E._type+":"+(E._id||E._source||"unknown")),e.showProjectDetails=async E=>{e.selectedProject=E,e.projectName=E.projectName||"",e.nameError="",e.nameMessage="",await Be();let F=document.getElementById(e.projectDetailsId(E));F?.focus(),F?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=E=>{e.selectedProject=null,Be(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(E._type+":"+E._id)}"]`)?.focus())},e.saveProjectName=async E=>{if(e.nameSaving||!E._id)return;let F=e.projectName.trim();if(F.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let Y=await t.post("/api/user/project-name",{type:E._type,id:E._id,name:F});E.projectName=Y.data.name,E._label=E.projectName||E._fallbackLabel,e.selectedProject===E&&(e.nameMessage=F?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await _(),e.selectedProject===E&&(e.selectedProject=e.items.find(G=>G._type===E._type&&G._id===E._id)||null))}catch{e.selectedProject===E&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async E=>{if(!E._viewUrl||e.copyingId)return;let F=new URL(E._viewUrl,s.location.origin).href;e.copyingId=E._type+":"+E._id;try{await vl(F),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:F})}finally{e.copyingId=null}},e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"Preparing",error:"Error",expired:"Expiring / expired",removed:"Removing / removed"};let p=["queue","download","downloaded","preparing","anonymizing"];function Line truncated
`)),e.options=Object.assign({},e.options,U.options),e.options.expirationDate=U.options&&U.options.expirationDate?new Date(U.options.expirationDate):L(),!r.repoId&&!r.pullRequestId&&!r.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),k&&k()})}function oe(k,M,U){e.anonymize&&e.anonymize[k]&&e.anonymize[k].setValidity(M,U)}function me(k){try{let M=parseGithubUrl(k);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||!r.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||me(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let k=g();try{let M=await t.get("/github/connections");if(e.githubConnections=M.data,!M.data.appEnabled)return;let U=await t.post("/github/connections/migrate",{type:"repository",id:r.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":M.data.csrf}});if(!y(k))return;e.error=null,U.data.fullName&&(e._originalFullName=U.data.fullName,e.source.fullName=U.data.fullName,e.sourceUrl="https://github.com/"+U.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(k)&&(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,C(k)}},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=[],Gt.cancel(),Sn.cancel(),En.cancel(),e.previewStatus="idle",e.anonymize_readme="",El();try{await I()}catch{}}};function be(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:me(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function Oe(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function A(){let k=new URLSearchParams(window.location.search).get("billingDraft");if(k){N.restore();try{let U=(await t.get("/api/billing/draft/"+encodeURIComponent(k))).data;if(U.path!==s.path())throw new Error("Wrong task");b=U.values.conference||null;for(let W of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(U.values,W)&&(e[W]=U.values[W]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=U.id,V=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await Oe(),s.replace?.(s.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!==s.path()||Date.now()-M.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await Oe(),!0):!1;N.restore();for(let U of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(M.draft,U)&&(e[U]=M.draft[U]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await Oe(),sessionStorage.removeItem("github-access-draft"),!0}pe(()=>{!r.repoId&&!r.pullRequestId&&!r.gistId&&d(A,0),r.repoId&&r.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=r.repoId,t.get("/api/repo/"+e.repoId).then(async k=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(k.data.status),e.githubConnection=k.data.connection||"oauth",e.sourceUrl="https://github.com/"+k.data.source.fullName,e._originalFullName=k.data.source.fullName,e.terms=k.data.options.terms.filter(M=>M).join(`
`),e.source=k.data.source,e.role=k.data.role||"owner",e._existingNever=k.data.options.expirationMode==="never",e._savedExpirationDate=k.data.options.expirationDate?new Date(k.data.options.expirationDate):null,e.coauthors=k.data.coauthors||[],e._originalBranch=k.data.source.branch,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,e.repositoryID=k.data.source.repositoryID,e._originalRepositoryID=k.data.source.repositoryID,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await A()&&(await Promise.all([I(),B()]),Ro())},()=>{s.url("/404")})),r.pullRequestId&&r.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=r.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async k=>{if(e.githubConnection=k.data.connection||"oauth",e.sourceUrl="https://github.com/"+k.data.source.repositoryFullName+"/pull/"+k.data.source.pullRequestId,e.terms=k.data.options.terms.filter(M=>M).join(`
`),e.source=k.data.source,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await A())try{await Tl()}catch{}},()=>{s.url("/404")})),r.gistId&&r.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=r.gistId,t.get("/api/gist/"+e.gistId).then(async k=>{e.sourceUrl="https://gist.github.com/"+k.data.source.gistId,e.terms=k.data.options.terms.filter(M=>M).join(`
`),e.source=k.data.source,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await A()&&await Pl()},()=>{s.url("/404")}))}),t.get("/github/connections").then(k=>{e.githubConnections=k.data,!r.repoId&&!r.pullRequestId&&!r.gistId&&e.githubConnection===void 0&&k.data.appEnabled&&k.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&Oe())}).catch(()=>{}).finally(()=>{!v&&!r.repoId&&!r.pullRequestId&&!r.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(k=!1)=>{let M=++c;e.previousConfigurations=[],e.previousConfigurationId="";let U;try{U=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,st(),Gt.cancel(),Sn.cancel(),En.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",oe("sourceUrl","github",!1);return}let W=S(U),de=k||w===W;w=W,e.sourceUrlError="",oe("sourceUrl","github",!0),st();let he=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),he&&d(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!de&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],de||(e.source={type:"GitHubStream",branch:"",commit:""}),Gt.cancel(),Sn.cancel(),En.cancel(),To.clear(),Po.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",El(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=de;try{U.gistId&&!U.repo?(e.detectedType="gist",e.source={gistId:U.gistId},await Pl()):U.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:U.owner+"/"+U.repo,pullRequestId:U.pullRequestId},await Tl()):(e.detectedType="repo",He(),await Promise.all([I(),B()]),Ro())}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 k=e.branches.filter(U=>U.name==e.source.branch)[0];if(!k)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=k.commit),e.readme=k.readme,await B(),Ro()}),e.getBranches=async k=>{let M=parseGithubUrl(e.sourceUrl),U=g();try{if(!e.details){await I(k);return}let W=await t.get(`/api/repo/${M.owner}/${M.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:k===!0||e.reconnectingSource?"1":"0",repositoryID:be()}});if(!y(U))return;e.branches=W.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let de=e.branches.filter(he=>he.name==e.source.branch);de.length>0&&(!(!e.reconnectingSource&&!k&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=de[0].commit),e.readme=de[0].readme,await B(k))}catch(W){if(!y(U))return;e.branches=[],e.sourceUnreachable=W&&(W.status===404||W.data&&W.data.error==="repo_not_found"),e.details=null,ze(W)}finally{C(U)}};async function I(k=!1){let M=parseGithubUrl(e.sourceUrl),U=g();try{Do(),st();let W=await t.get(`/api/repo/${M.owner}/${M.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,repositoryID:be(),force:"1"}});if(!y(U))return;e.details=W.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(k||e.reconnectingSource)}catch(W){if(!y(U))return;throw ze(W),W}finally{C(U)}}async function B(k){if(e.readme&&!k)return e.readme;let M=parseGithubUrl(e.sourceUrl),U=g();try{let W=await t.get(`/api/repo/${M.owner}/${M.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:k===!0?"1":"0",branch:e.source.branch,repositoryID:be()}});y(U,!0)&&(e.readme=W.data)}catch{y(U,!0)&&(e.readme="")}finally{C(U)}}let Q={magicalBraces:!0},K=k=>k.startsWith("/")&&!k.endsWith("/")&&Yn(Co(k.slice(1),Q),Q)===k.slice(1),te=()=>Object.keys(e.preserve.picked).filter(k=>e.preserve.picked[k]).sort().map(k=>"/"+Yn(k,Q)),ue=k=>"/"+Yn(k,Q)+"/**",ie=k=>"!/"+Yn(k,Q)+"/",se=()=>String(e.preserve.patterns||"").split(`
`).map(k=>k.trim()).filter(Boolean),X=null,ke=null,ce=new Set,Ee=0,Te=null,Me=()=>!1;function Je(){let k=Ee+"\0"+e.preserve.patterns;if(k!==Te){Te=k;try{Me=hl(ml([...te(),...se()]))}catch{Me=()=>!1}}return Me}function Ge(k){let M=new Map([["",{dirs:[],files:[]}]]);for(let U of k){let W=U.split("/"),de="";for(let he=0;he<W.length-1;he++){let je=W.slice(0,he+1).join("/");M.has(je)||(M.set(je,{dirs:[],files:[]}),M.get(de).dirs.push(je)),de=je}M.get(de).files.push(U)}for(let U of M.values())U.dirs.sort();return{files:k,dirs:M,descendants:new Map}}function Ce(k){return X.descendants.has(k)||X.descendants.set(k,X.files.filter(M=>M.startsWith(k+"/"))),X.descendants.get(k)}let Ve=k=>Je()(k);function it(k){let M=Ce(k),U=0;for(let W of M)Ve(W)&&U++;return U===0?"none":U===M.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let k=(e.options?.preserveFiles||[]).map(M=>String(M).trim()).filter(Boolean).map(M=>K(M)?Co(M.slice(1),Q):M);return k.length?k.slice(0,2).join(", ")+(k.length>2?` and ${k.length-2} more`:""):"None. Every file is redacted."};async function ct(){let k=e.source?.commit;if(!(X&&e.preserve.commit===k)){e.preserve.loading=!0,e.preserve.error="",X=null,ke=null;try{let M=parseGithubUrl(e.sourceUrl),U=await t.get(`/api/repo/${M.owner}/${M.repo}/tree`,{params:{commit:k,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,repositoryID:be()}});if(e.source?.commit!==k)return;let W=Array.isArray(U.data.binaryFiles)?U.data.binaryFiles:[];X=mn(Ge(U.data.files||[])),ke=W.length?mn(Ge([...U.data.files||[],...W])):X,ce=mn(new Set(W)),e.preserve.commit=k,e.preserve.truncated=!!U.data.truncated,e.previewFile||Gt()}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",k=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&k&&e.sourceUrl&&ct().catch(()=>{})}),e.openPreserveFiles=()=>{let k={},M=[];for(let W of e.options?.preserveFiles||[]){let de=String(W).trim();de&&(!M.length&&K(de)?k[Co(de.slice(1),Q)]=!0:M.push(de))}let U={};for(let W of Object.keys(k)){let de=W.split("/");for(let he=1;he<de.length;he++)U[de.slice(0,he).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:k,expanded:U,patterns:M.join(`
`),patternsOpen:M.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),Ee++,d(()=>{let W=document.getElementById("preserve-files-dialog");W?.showModal&&!W.open&&W.showModal(),document.getElementById("preserve-files-search")?.focus()},0),ct()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=ml([...te(),...se()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!X)return[];let k=Je(),M=(he,je,Vt)=>{let mt=!!e.preserve.picked[he],Rt=k(he);return{kind:"file",path:he,label:Vt,depth:je,state:Rt?"all":"none",locked:!mt&&Rt,note:!mt&&Rt?"matched by a pattern":mt&&!Rt?"excluded by a pattern":""}},U=String(e.preserve.search||"").trim().toLowerCase();if(U)return X.files.filter(he=>he.toLowerCase().includes(U)).slice(0,300).map(he=>M(he,0,he));let W=[],de=(he,je)=>{let Vt=X.dirs.get(he);for(let mt of Vt.dirs){let Rt=!!e.preserve.expanded[mt],Wt=se().includes(ue(mt));W.push({kind:"dir",path:mt,label:mt.slice(he?he.length+1:0)+"/",depth:je,open:Rt,state:it(mt),locked:!1,note:Wt?"whole folder":""}),Rt&&de(mt,je+1)}for(let mt of Vt.files)W.push(M(mt,je,mt.slice(he?he.length+1:0)))};return de("",0),W},e.preserveCount=()=>X?X.files.filter(Ve).length:0,e.togglePreserveDir=k=>{e.preserve.expanded[k]=!e.preserve.expanded[k]},e.togglePreserveFile=k=>{e.preserve.picked[k]=!e.preserve.picked[k],Ee++},e.togglePreserveFolder=k=>{let M=ue(k),U=ie(k),W=se().filter(he=>he!==M&&he!==U),de=it(k)==="all"||se().includes(M);for(let he of Ce(k))e.preserve.picked[he]=!1;Ee++,e.preserve.patterns=(de?W:[...W,M]).join(`
`),de&&Ce(k).some(Ve)&&(e.preserve.patterns=[...W,U].join(`
`))};let Mt=/^readme(\.[^/]*)?$/i,Pt=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],lt=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],ft=k=>{let M=_e(k),U=M.indexOf("."),W=Pt.indexOf(U===-1?"":M.slice(U).toLowerCase());return W===-1?Pt.length:W},Qt=()=>!!X&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!Qt())return"";for(let k of[".github","","docs"]){let M=(X.dirs.get(k)?.files||[]).filter(U=>Mt.test(_e(U)));if(M.length)return M.sort((U,W)=>ft(U)-ft(W)||Re(U,W))[0]}return""},e.readmeName=()=>_e(e.readmePath())||"README.md";let Eo={key:null,fn:()=>!1},Sl=()=>{let k=(e.options?.preserveFiles||[]).map(U=>String(U).trim()).filter(Boolean),M=k.join(`
`);if(M!==Eo.key){let U=()=>!1;try{k.length&&(U=hl(k))}catch{}Eo={key:M,fn:U}}return Eo.fn};e.pathPreserved=k=>!!k&&Sl()(k),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let k=Sl();if(Qt()){let M=e.readmePath();return!!M&&k(M)}return lt.some(M=>k(M))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function li(){let k={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&&(k.branchName=e.source.branch);try{let M=parseGithubUrl(e.sourceUrl);k.repoName=`${M.owner}/${M.repo}`}catch{}return k}function Vr(k,M,U){let W=null,de=0,he=()=>{if(e.detectedType!==k)return;W&&d.cancel(W);let je=++de;e.previewStatus="loading",W=d(()=>{W=null;let Vt=M();if(!Vt){e.previewStatus="idle";return}t.post("/api/anonymize-preview",Vt).then(mt=>{je===de&&(U(mt.data,Vt),e.previewStatus="ready")}).catch(()=>{je===de&&(e.previewStatus="error")})},200)};return he.cancel=()=>{de++,W&&d.cancel(W),W=null},e.on("dispose",he.cancel),he}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof ln!="string"?Nl(e.previewFile):Gt()),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()};let et=mn(Gs(e));Object.defineProperty(e,"previewViewer",{get:()=>et}),Ha(et,e),Object.assign(et,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),et.preview=!0,et.fileSize=k=>k===et.filePath&&typeof ln=="string"?new Blob([ln]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,et.openPreserveFiles=()=>e.openPreserveFiles(),et.previewPreserved=()=>e.previewPreserved(),et.retryContent=()=>e.retryPreview();let Mf=k=>ce.has(k)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(k),Lr=(k="")=>({path:k,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=Lr();let as=0,ln=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=k=>{if(k=k||"",k&&k===e.readmePath()&&(k=""),as++,ln=null,ui(),Gt.cancel(),e.previewFile=k,e.previewDoc=Lr(k),et.sidebarCollapsed=!0,et.content=null,!k){e.readme?Gt():e.previewStatus="idle";return}if(Mf(k)){qr("binary"),e.previewStatus="ready";return}Nl(k)};function El(){as++,ln=null,e.previewFile="",e.previewDoc=Lr(),et.sidebarCollapsed=!0,et.content=null}function Nl(k){let M=++as;ln=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let U;try{U=parseGithubUrl(e.sourceUrl)}catch{U=null}if(!U||!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/${U.owner}/${U.repo}/file`,{params:{commit:e.source.commit,path:k,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,repositoryID:be()},transformResponse:W=>W}).then(W=>{if(M!==as)return;e.previewDoc.loading=!1;let de=typeof W.headers=="function"&&W.headers("content-type")||"";if(/json/i.test(de)){let he=null;try{he=JSON.parse(W.data)}catch{}if(he&&he.binary===!0){qr("binary"),e.previewStatus="ready";return}}ln=typeof W.data=="string"?W.data:"",Gt()},W=>{if(M!==as)return;e.previewDoc.loading=!1;let de=Dr(W);if(de==="file_too_big"){qr("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=xn.ERRORS[de]||"GitHub did not return this file.",e.previewStatus="error"})}let di;function ui(){di&&window.URL.revokeObjectURL(di),di=void 0,et.url=void 0}e.on("dispose",ui);function qr(k){ui(),e.previewDoc.note=k,et.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),et.type=k==="too_big"?"error":"binary",et.content=k==="too_big"?"file_too_big":"binary"}function Vf(k){try{let M=parseGithubUrl(e.sourceUrl),U=e.source.branch||e.details&&e.details.defaultBranch||"main",W=k&&k.includes("/")?k.slice(0,k.lastIndexOf("/")+1):"";return`https://github.com/${M.owner}/${M.repo}/raw/${U}/${W}`}catch{return""}}let Rl=Vr("repo",()=>e.previewFile?typeof ln!="string"?null:{content:ln,options:li()}:e.readme?{content:e.readme,options:li()}:null,k=>{if(typeof k?.content!="string")throw Error("Invalid preview response");ui(),window.URL?.createObjectURL&&(et.url=di=window.URL.createObjectURL(new Blob([k.content],{type:"text/plain"})));let M=e.previewOpenPath()||e.readmeName();et.prepareFile(e.previewPathName(M)),et.fileBaseUrl=Vf(M),et.renderFileContent(k.content,et.type,et.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=k.content)}),Gt=()=>{e.previewFile&&typeof ln!="string"||Rl()};Gt.cancel=Rl.cancel;let No=rt(new Map),Fr=new Set,$r=new Set,ls="",ds=null,ci=()=>String(e.terms||"").split(`
`).filter(k=>k.trim());function Lf(){ds=null;let k=ci(),M=k.join(`
`);M!==ls&&(No.clear(),$r.clear(),ls=M);let U=[...Fr].filter(W=>!No.has(W));if(Fr.clear(),!(!U.length||!k.length))for(let W=0;W<U.length;W+=400){let de=U.slice(W,W+400);t.post("/api/anonymize-preview",{contents:de,options:{terms:k,image:!0,link:!0}}).then(he=>{if(ls!==M||ci().join(`
`)!==M)return;let je=he.data?.contents;if(!Array.isArray(je)||je.length!==de.length)throw Error("Invalid preview response");de.forEach((Vt,mt)=>No.set(Vt,typeof je[mt]=="string"?je[mt]:Vt))}).catch(()=>{ls===M&&de.forEach(he=>$r.add(he))})}}e.previewName=k=>{if(!k||!ci().length)return k;if(ls===ci().join(`
`)){if(No.has(k))return No.get(k);if($r.has(k))return k}return Fr.add(k),ds||(ds=d(Lf,120)),k},e.previewPathName=k=>{k=String(k||"");let M=k.lastIndexOf("/");return M<0?e.previewName(k):e.previewName(k.slice(0,M))+"/"+e.previewName(k.slice(M+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{et.repoId=e.repoId||"repository",et.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),et.paths=et.filePath.split("/"),et.files=e.previewTreeFiles(),et.loadedFolders=Object.fromEntries([...ke?.dirs.keys()||[]].map(k=>[e.previewName(k),!0]))},!0),e.on("dispose",()=>{ds&&d.cancel(ds)});function Ro(){!e.anonymize||!e.anonymize.terms||Gt()}async function Tl(){let k=parseGithubUrl(e.sourceUrl),M=g();try{Do(),st();let U=await t.get(`/api/pr/${k.owner}/${k.repo}/${k.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(M))return;e.details=U.data,e.pullRequestId||(e.pullRequestId=k.repo+"-PR"+k.pullRequestId+"-"+generateRandomId(4))}catch(U){if(!y(M))return;throw ze(U),U}finally{C(M)}}let To=rt(new Map);function qf(){let k=new Set,M=e.details&&e.details.pullRequest;if(!M)return k;typeof M.title=="string"&&k.add(M.title),typeof M.body=="string"&&k.add(M.body),typeof M.diff=="string"&&k.add(M.diff);let U=M.comments||[];for(let W of U)typeof W.author=="string"&&k.add(W.author),typeof W.body=="string"&&k.add(W.body);return k}let Sn=Vr("pr",()=>{let k=qf(),M=Array.from(k);return M.length===0?null:{contents:M,options:li()}},(k,M)=>{if(!Array.isArray(k?.contents)||k.contents.length!==M.contents.length||k.contents.some(de=>typeof de!="string"))throw Error("Invalid preview response");let U=M.contents,W=new Map;for(let de=0;de<U.length&&de<k.contents.length;de++)W.set(U[de],k.contents[de]);To.clear(),W.forEach((de,he)=>To.set(he,de))});e.anonymizePrContent=function(k){return k&&(To.has(k)?To.get(k):"")};async function Pl(){let k=parseGithubUrl(e.sourceUrl),M=g();try{Do(),st(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let U=await t.get(`/api/gist/source/${k.gistId}`);if(!y(M))return;e.details=U.data,e.gistId||(e.gistId="gist-"+k.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(U){if(!y(M))return;if(U.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,oe("sourceUrl","missing",!1);return}if(U.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,oe("sourceUrl","missing",!1);return}throw ze(U),U}finally{C(M)}}let Po=rt(new Map);function Ff(){let k=new Set,M=e.details&&e.details.gist;if(!M)return k;typeof M.description=="string"&&k.add(M.description),typeof M.ownerLogin=="string"&&k.add(M.ownerLogin);let U=M.files||[];for(let de of U)typeof de.filename=="string"&&k.add(de.filename),typeof de.content=="string"&&k.add(de.content);let W=M.comments||[];for(let de of W)typeof de.author=="string"&&k.add(de.author),typeof de.body=="string"&&k.add(de.body);return k}let En=Vr("gist",()=>{let k=Ff(),M=Array.from(k);return M.length===0?null:{contents:M,options:li()}},(k,M)=>{if(!Array.isArray(k?.contents)||k.contents.length!==M.contents.length||k.contents.some(de=>typeof de!="string"))throw Error("Invalid preview response");let U=M.contents,W=new Map;for(let de=0;de<U.length&&de<k.contents.length;de++)W.set(U[de],k.contents[de]);Po.clear(),W.forEach((de,he)=>Po.set(he,de)),_r()});e.anonymizeGistContent=function(k){return k&&(Po.has(k)?Po.get(k):"")},e.previewGistFiles=[];function _r(){let k=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=k.map(M=>({filename:e.anonymizeGistContent(M.filename),content:e.anonymizeGistContent(M.content),language:M.language}))}e.watch("details.gist.files",_r,!0),e.watch("terms",_r);function $f(){let k=e.conference;if(e.conference_data=null,!k)return;let M=k===b||e.isUpdate&&k===e._originalConference;k!==b&&(b=null),t.get("/api/conferences/"+k).then(U=>{e.conference===k&&(e.conference_data=U.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===k&&(e.conference_data=null)})}function Do(){oe("repoId","used",!0),oe("repoId","format",!0),oe("pullRequestId","used",!0),oe("pullRequestId","format",!0),oe("gistId","used",!0),oe("gistId","format",!0),oe("sourceUrl","used",!0),oe("sourceUrl","missing",!0),oe("sourceUrl","access",!0),oe("sourceUrl","github",!0),oe("commit","exists",!0),oe("conference","activated",!0),oe("terms","format",!0),e.termHints=[]}function pi(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let k=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||k&&k.invalid?(k&&k.setDirty&&k.setDirty(),e.error= Line truncated
`).filter(he=>he),connection:e.githubConnection,fullName:`${U.owner}/${U.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(W.options.pageSource=e.details.pageSource),Do();let de=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(de,W,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},he=>{if(he.data){let je=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(he.data.error);je||i("ERRORS."+he.data.error).then(Vt=>{e.error=Vt},console.error),fi(he.data.error),je&&(he.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,Be(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{M.disabled=!1})},e.anonymizeGist=k=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(pi())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=k.currentTarget||k.target.closest?.("button")||k.target;M.disabled=!0;let U=parseGithubUrl(e.sourceUrl),W={gistId:e.gistId,terms:e.terms.trim().split(`
`).filter(he=>he),source:{gistId:U.gistId},options:e.options,conference:e.conference};Do();let de=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(de,W,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},he=>{he.data&&(i("ERRORS."+he.data.error).then(je=>{e.error=je},console.error),fi(he.data.error))}).finally(()=>{M.disabled=!1})},e.anonymizePullRequest=k=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(pi())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=k.currentTarget||k.target.closest?.("button")||k.target;M.disabled=!0;let U=parseGithubUrl(e.sourceUrl),W={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
`).filter(he=>he),source:{repositoryFullName:`${U.owner}/${U.repo}`,pullRequestId:U.pullRequestId},options:e.options,conference:e.conference};Do();let de=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(de,W,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},he=>{he.data&&(i("ERRORS."+he.data.error).then(je=>{e.error=je},console.error),fi(he.data.error))}).finally(()=>{M.disabled=!1})},e.watch("conference",()=>{$f()}),e.termHints=[],e.matchTermAsWritten=k=>{e.terms=dp(e.terms,k)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&Gt()}),e.watch("terms",()=>{e.termHints=lp(e.terms),e.detectedType==="repo"&&Ro(),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()}),e.watch("options.image",()=>{e.detectedType==="repo"&&Ro(),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()}),e.watch("options.link",()=>{e.detectedType==="repo"&&Ro(),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()}),e.watch("details",()=>{e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()},!0)},yl=function(e,t,o,r,s,i){Ha(e);let d=yt();Ir();let p=Ot(),c=0,v=null,m=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){v&&(v.resolve(),v=null),m&&(d.timeout.cancel(m),m=null)}let g=!1;e.on("dispose",()=>{g=!0,c++,y(),C&&C.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,p(document,"click",O=>{e.symbolsOpen&&!O.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!O.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!O.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&O.target.isConnected&&!O.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!O.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!O.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",O=>{O.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(O.ctrlKey||O.metaKey)&&!O.altKey&&O.key&&O.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(O.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(O){if((O.metaKey||O.ctrlKey)&&O.key==="k"){O.preventDefault();var q=document.querySelector(".tree-search-input");q&&(q.focus(),q.select())}});var C=null;e.onFileSearchChange=function(){C&&(C.resolve(),C=null);let O=e.fileSearchQuery;if(!O||O.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let q=i.defer();C=q,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(O)}`,{timeout:q.promise}).then(function(E){if(!(g||C!==q)){C=null,e.fileSearchLoading=!1;var F={};e.files.forEach(function(_e){F[(_e.path||"")+"/"+_e.name]=!0});for(var Y=[],G={},x=0;x<E.data.length;x++){var re=E.data[x];if(re.path)for(var ee=re.path.split("/"),fe="",ge=0;ge<ee.length;ge++){var $e=fe;fe=fe?fe+"/"+ee[ge]:ee[ge];var He=$e+"/"+ee[ge];!F[He]&&!G[He]&&(G[He]=!0,Y.push({name:ee[ge],path:$e}))}}Y.sort(function(_e,J){return(_e.path||"").split("/").length-(J.path||"").split("/").length}),Y.length>0&&e.files.push.apply(e.files,Y);for(var Ye=[],ze=0;ze<E.data.length;ze++){var st=E.data[ze],Re=(st.path||"")+"/"+st.name;!F[Re]&&st.size!=null&&(Ye.push(st),F[Re]=!0)}Ye.length>0&&e.files.push.apply(e.files,Ye),e.fileSearchResults=E.data}},function(){!g&&C===q&&(C=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(O,q){if(e.repoId!=r.repoId)return z();if((r.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=r.path||"",e.paths=e.filePath.split("/").filter(E=>E&&E.trim().length>0),L();for(let E=0;E<e.paths.length-1;E++){let F=E>0?e.paths.slice(0,E).join("/"):"";e.files.some(G=>G.path===F)||e.getFiles(F)}}});function w(){if(e.paths[0]!="")return;let O=["readme.md","readme.txt","readme.org","readme.1st","readme"],q={};for(let F of e.files)F.name.toLowerCase().indexOf("readme")>-1&&(q[F.name.toLowerCase()]=F.name);let E=null;for(let F of O)if(q[F]){E=F;break}if(!E&&Object.keys(q).length>0&&(E=Object.keys(q)[0]),E){let F=o.url();F[F.length-1]!="/"&&(F+="/"),o.url(F+encodePathForUrl(q[E]))}}e.fileCounts=null;let S=0,N=new Set,b=!1;e.getFiles=function(O,q=!1){let E=e.repoId,F=S;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(O)}&v=${e.options.lastUpdateDate}`).then(function(Y){if(g||E!==e.repoId||F!==S)return[];let G=O||"";return e.files=e.files.filter(x=>x.path!==G),e.files.push(...Y.data),e.loadedFolders={...e.loadedFolders,[G]:!0},P(G,F),Y.data},function(Y){if(g||E!==e.repoId||F!==S)return[];q||(e.type="error",e.content=Dr(Y),e.files=[])})};function P(O,q){if(b||N.has(O))return;N.add(O);let E=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(O)}`).then(function(F){g||E!==e.repoId||q!==S||(e.fileCounts={...e.fileCounts,...F.data})},function(){ Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,10,h5),[[d,{state:e.viewState,set:c=>{e.terms=c},value:e.terms,form:"anonymize",options:{debounce:250}}]]),t[125]||(t[125]=n("small",{class:"form-text text-muted"},"One term per line.",-1)),n("details",g5,[t[120]||(t[120]=n("summary",null,"Regex & replacement syntax",-1)),t[121]||(t[121]=h()),n("small",v5,[t[114]||(t[114]=h("Regex is supported. Replaced by ",-1)),n("code",null,u(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(T,null,j((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,u(c.term),1),t[123]||(t[123]=h(", ",-1)),n("code",null,u(c.symbols.join(" ")),1),h(" "+u(c.symbols.length>1?"are regex symbols":"is a regex symbol")+", so it may not match the text as written.",1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm",onClick:v=>e.matchTermAsWritten(c.line)},"Match as written",8,y5)]))),128)),(e.termHints||[]).length>3?(a(),l("div",b5,u(e.termHints.length-3)+" more "+u(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),D(n("div",w5,"Terms are in an invalid format.",512),[[Q,e.anonymize?.terms?.errors?.format]])]),D(n("div",k5,[n("div",C5,[t[126]||(t[126]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",S5,u(e.preserveSummary()),1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm","aria-describedby":"preserve-files-label",disabled:!e.source?.commit,onClick:t[25]||(t[25]=c=>e.openPreserveFiles())},u((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,E5)],512),[[Q,e.detectedType==="repo"]]),e.preserve?.open?(a(),l("dialog",{key:0,id:"preserve-files-dialog",class:"preserve-dialog","aria-labelledby":"preserve-files-title",onCancel:t[30]||(t[30]=re(c=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[29]||(t[29]=re(c=>e.savePreserveFiles(),["prevent"]))},[t[130]||(t[130]=n("h2",{id:"preserve-files-title"},"Leave files unredacted",-1)),t[131]||(t[131]=n("p",{class:"preserve-intro"},"Checked files are shown exactly as written, for example a bibliography where redacted self-citations would reveal you. File names are still redacted.",-1)),D(n("input",{type:"search",id:"preserve-files-search",class:"form-control",placeholder:"Search files","aria-label":"Search files",autocomplete:"off","onUpdate:modelValue":t[26]||(t[26]=c=>e.preserve.search=c)},null,512),[[ot,e.preserve.search]]),n("div",N5,[e.preserve.loading?(a(),l("p",R5,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",T5,u(e.preserve.error),1)):(a(),l(T,{key:2},[(a(!0),l(T,null,j(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:m=>e.togglePreserveDir(c.path)},u(c.open?"\u25BE":"\u25B8"),9,P5)):(a(),l("span",D5)),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:m=>c.kind==="dir"?e.togglePreserveFolder(c.path):e.togglePreserveFile(c.path)},null,40,A5),n("label",{for:c.kind==="file"?"pf-"+v:null,class:"preserve-name",onClick:m=>c.kind==="dir"&&e.togglePreserveDir(c.path)},u(c.label),9,I5),c.note?(a(),l("span",O5,u(c.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",M5,u(e.preserve.search?"No file matches your search.":"No text files in this commit."),1)):f("v-if",!0)],64))]),e.preserve.truncated?(a(),l("p",V5,"This repository has too many files to list them all. Use a pattern for files you cannot find.")):f("v-if",!0),n("details",{class:"preserve-patterns",open:e.preserve.patternsOpen},[t[127]||(t[127]=n("summary",null,"Patterns",-1)),D(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
paper/appendix/**`,"onUpdate:modelValue":t[27]||(t[27]=c=>e.preserve.patterns=c)},null,512),[[ot,e.preserve.patterns]]),t[128]||(t[128]=n("small",{class:"form-text text-muted"},[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,q5),n("div",L5,[n("span",F5,u(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",_5,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[28]||(t[28]=c=>e.closePreserveFiles())},"Cancel"),t[129]||(t[129]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[Q,e.detectedType&&e.sourceReady()]]),D(n("section",$5,[t[152]||(t[152]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),D(n("div",null,[n("div",U5,[D(n("input",B5,null,512),[[d,{state:e.viewState,set:c=>{e.options.link=c},value:e.options?.link,form:"anonymize",options:{}}]]),t[133]||(t[133]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",z5,[D(n("input",H5,null,512),[[d,{state:e.viewState,set:c=>{e.options.image=c},value:e.options?.image,form:"anonymize",options:{}}]]),t[134]||(t[134]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",j5,[D(n("input",G5,null,512),[[d,{state:e.viewState,set:c=>{e.options.pdf=c},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[135]||(t[135]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",W5,[D(n("input",K5,null,512),[[d,{state:e.viewState,set:c=>{e.options.notebook=c},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[136]||(t[136]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",Y5,[D(n("input",{class:"form-check-input",type:"checkbox",id:"page",name:"page",disabled:!e.details?.hasPage||e.details?.pageSource&&e.details?.pageSource?.branch!==e.source?.branch},null,8,J5),[[d,{state:e.viewState,set:c=>{e.options.page=c},value:e.options?.page,form:"anonymize",options:{}}]]),t[137]||(t[137]=n("label",{class:"form-check-label",for:"page"},"GitHub Pages",-1)),e.details?.hasPage?f("v-if",!0):(a(),l("small",X5,u(e.fmt?.translate("WARNINGS.page_not_enabled_on_repo")),1)),e.details?.hasPage&&e.details?.pageSource?.branch&&e.source?.branch&&e.details.pageSource.branch!==e.source.branch?(a(),l("small",Q5,u(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[Q,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",Z5,[...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),D(n("div",null,[n("div",x5,[D(n("input",e6,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[139]||(t[139]=n("label",{class:"form-check-label",for:"title-gist"},"Gist description",-1))]),n("div",t6,[D(n("input",n6,null,512),[[d,{state:e.viewState,set:c=>{e.options.content=c},value:e.options?.content,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"content-gist"},"File contents",-1))]),n("div",o6,[D(n("input",s6,null,512),[[d,{state:e.viewState,set:c=>{e.options.comments=c},value:e.options?.comments,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",i6,[D(n("input",r6,null,512),[[d,{state:e.viewState,set:c=>{e.options.username=c},value:e.options?.username,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",a6,[D(n("input",l6,null,512),[[d,{state:e.viewState,set:c=>{e.options.date=c},value:e.options?.date,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",d6,[D(n("input",u6,null,512),[[d,{state:e.viewState,set:c=>{e.options.origin=c},value:e.options?.origin,form:"anonymize",options:{}}]]),t[144]||(t[144]=n("label",{class:"form-check-label",for:"origin-gist"},"Source gist ID",-1))])],512),[[Q,e.detectedType==="gist"]]),D(n("div",null,[n("div",c6,[D(n("input",p6,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[145]||(t[145]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",f6,[D(n("input",m6,null,512),[[d,{state:e.viewState,set:c=>{e.options.body=c},value:e.options?.body,form:"anonymize",options:{}}]]),t[146]||(t[146]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]),n( Line truncated
anonymous_github`)])])])])]),f(" Limitations "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-warning"})]),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,I5),[[d,{state:e.viewState,set:c=>{e.terms=c},value:e.terms,form:"anonymize",options:{debounce:250}}]]),t[132]||(t[132]=n("small",{class:"form-text text-muted"},"One term per line.",-1)),n("details",O5,[t[127]||(t[127]=n("summary",null,"Regex & replacement syntax",-1)),t[128]||(t[128]=h()),n("small",M5,[t[121]||(t[121]=h("Regex is supported. Replaced by ",-1)),n("code",null,u(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[122]||(t[122]=h(", or use ",-1)),t[123]||(t[123]=n("code",null,"term=>replacement",-1)),t[124]||(t[124]=h(" to pick your own (e.g. ",-1)),t[125]||(t[125]=n("code",null,"Anonymous=>ABC",-1)),t[126]||(t[126]=h(").",-1))])]),(a(!0),l(T,null,H((e.termHints||[]).slice(0,3),c=>(a(),l("div",{class:"term-hint",key:c.line},[n("span",null,[t[129]||(t[129]=h("In ",-1)),n("code",null,u(c.term),1),t[130]||(t[130]=h(", ",-1)),n("code",null,u(c.symbols.join(" ")),1),h(" "+u(c.symbols.length>1?"are regex symbols":"is a regex symbol")+", so it may not match the text as written.",1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm",onClick:v=>e.matchTermAsWritten(c.line)},"Match as written",8,V5)]))),128)),(e.termHints||[]).length>3?(a(),l("div",L5,u(e.termHints.length-3)+" more "+u(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),D(n("div",q5,"Terms are in an invalid format.",512),[[Z,e.anonymize?.terms?.errors?.format]])]),D(n("div",F5,[n("div",$5,[t[133]||(t[133]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",_5,u(e.preserveSummary()),1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm","aria-describedby":"preserve-files-label",disabled:!e.source?.commit,onClick:t[26]||(t[26]=c=>e.openPreserveFiles())},u((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,U5)],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[31]||(t[31]=ae(c=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[30]||(t[30]=ae(c=>e.savePreserveFiles(),["prevent"]))},[t[137]||(t[137]=n("h2",{id:"preserve-files-title"},"Leave files unredacted",-1)),t[138]||(t[138]=n("p",{class:"preserve-intro"},"Checked files are shown exactly as written, for example a bibliography where redacted self-citations would reveal you. File names are still redacted.",-1)),D(n("input",{type:"search",id:"preserve-files-search",class:"form-control",placeholder:"Search files","aria-label":"Search files",autocomplete:"off","onUpdate:modelValue":t[27]||(t[27]=c=>e.preserve.search=c)},null,512),[[nt,e.preserve.search]]),n("div",B5,[e.preserve.loading?(a(),l("p",z5,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",H5,u(e.preserve.error),1)):(a(),l(T,{key:2},[(a(!0),l(T,null,H(e.preserveRows(),(c,v)=>(a(),l("div",{class:"preserve-item",key:c.kind+":"+c.path,style:De({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:m=>e.togglePreserveDir(c.path)},u(c.open?"\u25BE":"\u25B8"),9,j5)):(a(),l("span",G5)),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:m=>c.kind==="dir"?e.togglePreserveFolder(c.path):e.togglePreserveFile(c.path)},null,40,W5),n("label",{for:c.kind==="file"?"pf-"+v:null,class:"preserve-name",onClick:m=>c.kind==="dir"&&e.togglePreserveDir(c.path)},u(c.label),9,K5),c.note?(a(),l("span",Y5,u(c.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",J5,u(e.preserve.search?"No file matches your search.":"No text files in this commit."),1)):f("v-if",!0)],64))]),e.preserve.truncated?(a(),l("p",X5,"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[134]||(t[134]=n("summary",null,"Patterns",-1)),D(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
paper/appendix/**`,"onUpdate:modelValue":t[28]||(t[28]=c=>e.preserve.patterns=c)},null,512),[[nt,e.preserve.patterns]]),t[135]||(t[135]=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,Q5),n("div",Z5,[n("span",x5,u(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",e6,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[29]||(t[29]=c=>e.closePreserveFiles())},"Cancel"),t[136]||(t[136]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[Z,e.detectedType&&e.sourceReady()]]),D(n("section",t6,[t[159]||(t[159]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),D(n("div",null,[n("div",n6,[D(n("input",o6,null,512),[[d,{state:e.viewState,set:c=>{e.options.link=c},value:e.options?.link,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",s6,[D(n("input",i6,null,512),[[d,{state:e.viewState,set:c=>{e.options.image=c},value:e.options?.image,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",r6,[D(n("input",a6,null,512),[[d,{state:e.viewState,set:c=>{e.options.pdf=c},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",l6,[D(n("input",d6,null,512),[[d,{state:e.viewState,set:c=>{e.options.notebook=c},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",u6,[D(n("input",{class:"form-check-input",type:"checkbox",id:"page",name:"page",disabled:!e.details?.hasPage||e.details?.pageSource&&e.details?.pageSource?.branch!==e.source?.branch},null,8,c6),[[d,{state:e.viewState,set:c=>{e.options.page=c},value:e.options?.page,form:"anonymize",options:{}}]]),t[144]||(t[144]=n("label",{class:"form-check-label",for:"page"},"GitHub Pages",-1)),e.details?.hasPage?f("v-if",!0):(a(),l("small",p6,u(e.fmt?.translate("WARNINGS.page_not_enabled_on_repo")),1)),e.details?.hasPage&&e.details?.pageSource?.branch&&e.source?.branch&&e.details.pageSource.branch!==e.source.branch?(a(),l("small",f6,u(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",m6,[...t[145]||(t[145]=[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),D(n("div",null,[n("div",h6,[D(n("input",g6,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[146]||(t[146]=n("label",{class:"form-check-label",for:"title-gist"},"Gist description",-1))]),n("div",v6,[D(n("input",y6,null,512),[[d,{state:e.viewState,set:c=>{e.options.content=c},value:e.options?.content,form:"anonymize",options:{}}]]),t[147]||(t[147]=n("label",{class:"form-check-label",for:"content-gist"},"File contents",-1))]),n("div",b6,[D(n("input",w6,null,512),[[d,{state:e.viewState,set:c=>{e.options.comments=c},value:e.options?.comments,form:"anonymize",options:{}}]]),t[148]||(t[148]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",k6,[D(n("input",C6,null,512),[[d,{state:e.viewState,set:c=>{e.options.username=c},value:e.options?.username,form:"anonymize",options:{}}]]),t[149]||(t[149]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",S6,[D(n("input",E6,null,512),[[d,{state:e.viewState,set:c=>{e.options.date=c},value:e.options?.date,form:"anonymize",options:{}}]]),t[150]||(t[150]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",N6,[D(n("input",R6,null,512),[[d,{state:e.viewState,set:c=>{e.options.origin=c},value:e.options?.origin,form:"anonymize",options:{}}]]),t[151]||(t[151]=n("label",{class:"form-check-label",for:"origin-gist"},"Source gist ID",-1))])],512),[[Z,e.detectedType==="gist"]]),D(n("div",null,[n("div",T6,[D(n("input",P6,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[152]||(t[152]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",D6,[D(n("input",A6,null,512),[[d,{state:e.viewState,set:c=>{e.options.body=c},value:e.options?.body,form:"anonymize",options:{}}]]),t[153]||(t[153]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]),n( Line truncated
for the rows when a reload (tab, search, filter) has none of the new rows yet `),(a(),l(T,null,H([1,2,3,4],(i,d)=>(a(),l(T,null,[e.loading||e.refreshing&&e.filteredItems?.length==0?(a(),l("div",eU,[...t[63]||(t[63]=[n("div",{class:"cell-anon",role:"cell"},[n("span",{class:"skeleton skeleton-badge"}),n("div",{class:"anon-text"},[n("span",{class:"skeleton skeleton-line",style:{width:"38%"}}),n("span",{class:"skeleton skeleton-line skeleton-line-sm",style:{width:"56%"}})])],-1),n("div",{class:"cell-status",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"60%"}})],-1),n("div",{class:"cell-views num",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"40%"}})],-1),n("div",{class:"cell-expires",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"55%"}})],-1),n("div",{class:"cell-actions",role:"cell"},null,-1)])])):f("v-if",!0)],64))),64)),(a(!0),l(T,null,H(e.filteredItems,(i,d)=>(a(),l(T,{key:i?._type+":"+(i?._id||d)},[e.loading?f("v-if",!0):(a(),l("div",{key:0,class:R(["paper-table-row",{"repo-inactive":i?._statusKey=="expired"||i?._statusKey=="removed","repo-error":i?.status=="error","row-clickable":!!i?._viewUrl}]),role:"row",onClick:p=>e.openItem(i,p)},[n("div",nU,[n("span",{class:"project-type-icon",role:"img","aria-label":i?._type==="repo"?"Repository":i?._type==="pr"?"Pull request":"Gist",title:i?._type==="repo"?"Repository":i?._type==="pr"?"Pull request":"Gist"},[(a(),l("svg",sU,[n("use",{href:"#project-type-"+i._type},null,8,iU)]))],8,oU),n("div",rU,[n("div",aU,[i?._viewUrl?(a(),l("a",{key:0,class:"repo-name",title:i._label,href:e.safeUrl(i?._viewUrl)},[(i?._label||"").indexOf("/")>0?(a(),l(T,{key:0},[n("span",dU,u(i._label.slice(0,i._label.indexOf("/")+1)),1),t[64]||(t[64]=n("wbr",null,null,-1)),n("span",uU,u(i._label.slice(i._label.indexOf("/")+1)),1)],64)):(a(),l(T,{key:1},[h(u(i?._label),1)],64))],8,lU)):f("v-if",!0),i?._viewUrl?f("v-if",!0):(a(),l("span",cU,[(i?._label||"").indexOf("/")>0?(a(),l(T,{key:0},[n("span",pU,u(i._label.slice(0,i._label.indexOf("/")+1)),1),t[65]||(t[65]=n("wbr",null,null,-1)),n("span",fU,u(i._label.slice(i._label.indexOf("/")+1)),1)],64)):(a(),l(T,{key:1},[h(u(i?._label),1)],64))])),i?.role==="coauthor"?(a(),l("span",mU,"Co-author")):f("v-if",!0)]),i?._id||i?._type==="repo"&&i?.source?.commit||i?.conference?(a(),l("div",hU,[i?._id?(a(),l("code",{key:0,class:"anonymous-id",title:i._id},[i._id.length>14?(a(),l(T,{key:0},[n("span",vU,u(i._id.slice(0,-6)),1),n("span",yU,u(i._id.slice(-6)),1)],64)):(a(),l(T,{key:1},[h(u(i._id),1)],64))],8,gU)):f("v-if",!0),i?._type==="repo"&&i?.source?.commit?(a(),l("span",{key:1,class:"commit-hash",title:i.source.commit},u(i.source.commit.substring(0,7)),9,bU)):f("v-if",!0),i?.conference?(a(),l("span",{key:2,class:"cell-conf conf-tag",title:"Conference: "+i.conference},[t[66]||(t[66]=n("svg",{class:"project-type-svg","aria-hidden":"true"},[n("use",{href:"#project-icon-conference"})],-1)),n("span",{class:"conf-name",textContent:u(i?.conference)},null,8,kU)],8,wU)):f("v-if",!0)])):f("v-if",!0)])]),n("div",CU,[n("div",SU,[n("div",EU,[n("span",{class:R(["status-dot","status-"+i?._statusKey]),"aria-hidden":"true"},null,2),n("span",{class:"status-word",textContent:u(e.fmt?.statusLabel(i?.status))},null,8,NU),i?.status=="removed"?(a(),l(T,{key:0},[t[67]||(t[67]=n("span",{class:"seg-sep status-removed-sep","aria-hidden":"true"},"\xB7",-1)),n("button",{type:"button",class:"project-attention-action status-enable",onClick:ae(p=>e.refreshItem(i),["stop"]),title:"Reviewers can no longer open this link"},"Enable again",8,RU)],64)):f("v-if",!0)]),i?.status=="error"&&i?.statusMessage?(a(),l("div",{key:0,class:"status-sub status-sub-error",textContent:u(e.fmt?.statusMsg(i?.statusMessage)),title:i?.statusMessage},null,8,TU)):f("v-if",!0),i?._stale?(a(),l("div",{key:1,class:"status-sub status-sub-warn",title:"Last activity "+e.fmt?.humanTime(i?.anonymizeDate||i?.lastView)},u(e.idleText(i)),9,PU)):f("v-if",!0),i.status==="error"&&i._editUrl?(a(),l("a",{key:2,class:"project-attention-action",href:e.safeUrl(i._editUrl)},"Fix source",8,DU)):f("v-if",!0),i._stale||i._broken?(a(),l("div",AU,[i._stale&&!i._broken?(a(),l("span",IU,[...t[68]||(t[68]=[h("May be stuck",-1),n("span",{"aria-hidden":"true"}," \xB7 ",-1)])])):f("v-if",!0),i._stale||i._broken?(a(),l("button",{key:1,type:"button",class:"project-attention-action",onClick:ae(p=>e.showProjectDetails(i),["stop"]),"data-project-actions":i._broken?encodeURIComponent(i._type+":"+i._id):null,"aria-controls":i._broken?e.projectDetailsId(i):null,"aria-expanded":i._broken?e.selectedProject===i:null},u(i._broken?"Review details":"Check progress"),9,OU)):f("v-if",!0)])):f("v-if",!0),i?.status=="expired"?(a(),l("button",{key:4,type:"button",class:"project-attention-action",onClick:ae(p=>e.extendItem(i),["stop"]),title:"Reviewers can no longer open this link"},"Extend 6 months",8,MU)):f("v-if",!0),i?.status=="removed"&&i?.anonymizeDate?(a(),l("div",VU,"anonymized 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
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",mH,[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]=o=>{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",hH,[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]=o=>{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",gH,[...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",vH,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=re(o=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",yH,[n("a",bH,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,wH)):f("v-if",!0),n("span",kH,u(e.user?.username),1)]),n("div",CH,[n("h6",SH,"Signed in as @"+u(e.user?.username),1),t[25]||(t[25]=Ce('<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",EH,[...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,NH)):f("v-if",!0),e.emailPromptOpen?(a(),l("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[8]||(t[8]=re(o=>e.respondToEmailPrompt("later"),["prevent"]))},[n("form",{onSubmit:t[7]||(t[7]=re(o=>e.respondToEmailPrompt("save"),["prevent"]))},[t[30]||(t[30]=n("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[31]||(t[31]=n("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[32]||(t[32]=n("label",{for:"email-prompt-address"},"Email address",-1)),D(n("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[4]||(t[4]=o=>e.emailPromptAddress=o),disabled:e.emailPromptBusy},null,8,RH),[[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",_H,[e.statsEmpty()?f("v-if",!0):(a(),l("div",$H,[...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",UH,[(a(!0),l(T,null,j(e.cards,(r,s)=>(a(),l("div",{class:"paper-stat-card",key:r?.key},[n("div",{class:R(["paper-stat-value",{"is-pending":!e.stat}])},u(e.stat?e.fmt?.bigNum(r?.total):"\u2014"),3),n("div",BH,u(r?.label),1),e.history[r?.key].bars?.length>1&&e.history[r?.key].deltaToday>0?(a(),l("div",zH," +"+u(e.fmt?.number(e.history[r?.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",HH,[n("div",jH,[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)),D(n("textarea",{id:"demo-terms",class:"demo-terms-input",rows:"1","onUpdate:modelValue":t[0]||(t[0]=r=>e.demoTerms=r),spellcheck:"false",autocomplete:"off",onKeydown:t[1]||(t[1]=_t(re(()=>{},["prevent"]),["enter"]))},null,544),[[ot,e.demoTerms]])]),n("div",GH,[n("div",WH,[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",KH,[n("div",YH,[(a(!0),l(T,null,j(e.demoParts(),(r,s)=>(a(),l(T,{key:s},[r.redacted?(a(),l("mark",JH,u(r.original),1)):(a(),l(T,{key:1},[h(u(r.text),1)],64))],64))),128)),t[14]||(t[14]=h("\u200B",-1))]),D(n("textarea",{class:"pane-body demo-input","onUpdate:modelValue":t[2]||(t[2]=r=>e.demoText=r),spellcheck:"false","aria-label":"Sample README to anonymize"},null,512),[[ot,e.demoText]])])]),n("div",XH,[n("div",QH,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",ZH,[n("span",xH,u(e.demoCount())+" redacted",1)])]),n("div",ej,[(a(!0),l(T,null,j(e.demoParts(),(r,s)=>(a(),l(T,{key:s},[r.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+r.original+"\u201D"},u(r.text),9,tj)):(a(),l(T,{key:1},[h(u(r.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",nj,[n("div",oj,[(a(!0),l(T,null,j(e.features,(r,s)=>(a(),l("div",{class:R(["paper-feature",{"is-on":e.feature===r?.key}]),key:r?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:i=>e.selectFeature(r.key),onKeydown:i=>e.featureKeydown(i,s),id:"feature-tab-"+r?.key,"aria-controls":"feature-panel-"+r?.key,"aria-selected":e.feature===r?.key,tabindex:e.feature===r?.key?0:-1},[n("span",ij,[n("span",rj,u(r?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",aj,u(r?.eyebrow),1)]),n("span",lj,[h(u(r?.title.split("-")[0]),1),r?.title.includes("-")?(a(),l("span",dj,"-")):f("v-if",!0),h(u(r?.title.split("-").slice(1).join("-"))+" "+u(r?.accent),1)])],40,sj),n("div",uj,[n("span",cj,[h(u(r?.title.split("-")[0]),1),r?.title.includes("-")?(a(),l("span",pj,"-")):f("v-if",!0),h(u(r?.title.split("-").slice(1).join("-"))+" "+u(r?.accent),1)]),n("p",null,u(r?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(r)),target:e.featureTarget(r)},u(r?.cta)+" \u2192",9,fj)])],2))),128))]),n("div",mj,[(a(!0),l(T,null,j(e.features,(r,s)=>D((a(),l("div",{class:"paper-feature-panel",role:"tabpanel",key:r?.key,id:"feature-panel-"+r?.key,"aria-labelledby":"feature-tab-"+r?.key},[n("div",gj,[n("div",vj,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",yj,u(r?.url),1)]),n("div",{class:R(["feat-mock","is-"+r?.key]),role:"img","aria-label":r?.alt},[r?.key==="anonymize"?(a(),l("div",wj,[...t[19]||(t[19]=[Ce('<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"})]),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",qH,[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]=o=>{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",FH,[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]=o=>{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",$H,[...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",_H,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=ae(o=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",UH,[n("a",BH,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,zH)):f("v-if",!0),n("span",HH,u(e.user?.username),1)]),n("div",jH,[n("h6",GH,"Signed in as @"+u(e.user?.username),1),t[25]||(t[25]=Se('<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",WH,[...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,KH)):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]=ae(o=>e.respondToEmailPrompt("later"),["prevent"]))},[n("form",{onSubmit:t[7]||(t[7]=ae(o=>e.respondToEmailPrompt("save"),["prevent"]))},[t[30]||(t[30]=n("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[31]||(t[31]=n("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[32]||(t[32]=n("label",{for:"email-prompt-address"},"Email address",-1)),D(n("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[4]||(t[4]=o=>e.emailPromptAddress=o),disabled:e.emailPromptBusy},null,8,YH),[[nt,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",rj,[e.statsEmpty()?f("v-if",!0):(a(),l("div",aj,[...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",lj,[(a(!0),l(T,null,H(e.cards,(r,s)=>(a(),l("div",{class:"paper-stat-card",key:r?.key},[n("div",{class:R(["paper-stat-value",{"is-pending":!e.stat}])},u(e.stat?e.fmt?.bigNum(r?.total):"\u2014"),3),n("div",dj,u(r?.label),1),e.history[r?.key].bars?.length>1&&e.history[r?.key].deltaToday>0?(a(),l("div",uj," +"+u(e.fmt?.number(e.history[r?.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",cj,[n("div",pj,[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)),D(n("textarea",{id:"demo-terms",class:"demo-terms-input",rows:"1","onUpdate:modelValue":t[0]||(t[0]=r=>e.demoTerms=r),spellcheck:"false",autocomplete:"off",onKeydown:t[1]||(t[1]=_t(ae(()=>{},["prevent"]),["enter"]))},null,544),[[nt,e.demoTerms]])]),n("div",fj,[n("div",mj,[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",hj,[n("div",gj,[(a(!0),l(T,null,H(e.demoParts(),(r,s)=>(a(),l(T,{key:s},[r.redacted?(a(),l("mark",vj,u(r.original),1)):(a(),l(T,{key:1},[h(u(r.text),1)],64))],64))),128)),t[14]||(t[14]=h("\u200B",-1))]),D(n("textarea",{class:"pane-body demo-input","onUpdate:modelValue":t[2]||(t[2]=r=>e.demoText=r),spellcheck:"false","aria-label":"Sample README to anonymize"},null,512),[[nt,e.demoText]])])]),n("div",yj,[n("div",bj,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",wj,[n("span",kj,u(e.demoCount())+" redacted",1)])]),n("div",Cj,[(a(!0),l(T,null,H(e.demoParts(),(r,s)=>(a(),l(T,{key:s},[r.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+r.original+"\u201D"},u(r.text),9,Sj)):(a(),l(T,{key:1},[h(u(r.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",Ej,[n("div",Nj,[(a(!0),l(T,null,H(e.features,(r,s)=>(a(),l("div",{class:R(["paper-feature",{"is-on":e.feature===r?.key}]),key:r?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:i=>e.selectFeature(r.key),onKeydown:i=>e.featureKeydown(i,s),id:"feature-tab-"+r?.key,"aria-controls":"feature-panel-"+r?.key,"aria-selected":e.feature===r?.key,tabindex:e.feature===r?.key?0:-1},[n("span",Tj,[n("span",Pj,u(r?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",Dj,u(r?.eyebrow),1)]),n("span",Aj,[h(u(r?.title.split("-")[0]),1),r?.title.includes("-")?(a(),l("span",Ij,"-")):f("v-if",!0),h(u(r?.title.split("-").slice(1).join("-"))+" "+u(r?.accent),1)])],40,Rj),n("div",Oj,[n("span",Mj,[h(u(r?.title.split("-")[0]),1),r?.title.includes("-")?(a(),l("span",Vj,"-")):f("v-if",!0),h(u(r?.title.split("-").slice(1).join("-"))+" "+u(r?.accent),1)]),n("p",null,u(r?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(r)),target:e.featureTarget(r)},u(r?.cta)+" \u2192",9,Lj)])],2))),128))]),n("div",qj,[(a(!0),l(T,null,H(e.features,(r,s)=>D((a(),l("div",{class:"paper-feature-panel",role:"tabpanel",key:r?.key,id:"feature-panel-"+r?.key,"aria-labelledby":"feature-tab-"+r?.key},[n("div",$j,[n("div",_j,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",Uj,u(r?.url),1)]),n("div",{class:R(["feat-mock","is-"+r?.key]),role:"img","aria-label":r?.alt},[r?.key==="anonymize"?(a(),l("div",zj,[...t[19]||(t[19]=[Se('<div class="fm-label">GitHub reposit Line truncated
<span class="ln">2</span><span class="c"># Author: <span class="redact">XXXX-1</span>, <span class="redact">XXXX-2</span></span>
<span class="ln">3</span><span class="k">import</span> torch
<span class="ln">4</span><span class="k">from</span> utils <span class="k">import</span> load_config
@@ -60,18 +61,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",Cj,[...t[21]||(t[21]=[Ce('<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,bj)])],8,hj)),[[Q,e.feature===r?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=Ce('<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(o,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var Sj={class:"paper-empty"},Ej={class:"paper-empty-inner"},Nj={key:0,class:"paper-eyebrow"},Rj={key:1,class:"paper-eyebrow"},Tj={key:2,class:"paper-empty-title"},Pj=["textContent"];function zp(e,t){return a(),l("div",Sj,[n("div",Ej,[e.error?f("v-if",!0):(a(),l("div",Nj,"Working")),e.error?(a(),l("div",Rj,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",Tj,[...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:u(e.fmt.translate(e.error))},null,8,Pj)):f("v-if",!0)])])}var Dj={class:"container paper-page paper-settings"},Aj={class:"paper-crumbs"},Ij={class:"here"},Oj={class:"paper-page-title"},Mj={class:"paper-settings-body"},Vj={class:"paper-settings-toc"},qj={href:"#conf-billing"},Lj={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},Fj={id:"conf-basics",class:"paper-settings-section"},_j={class:"form-group"},$j={class:"invalid-feedback"},Uj={class:"invalid-feedback"},Bj={class:"form-group"},zj={class:"invalid-feedback"},Hj={class:"form-group"},jj={class:"invalid-feedback"},Gj={class:"invalid-feedback"},Wj={id:"conf-window",class:"paper-settings-section"},Kj={class:"form-grid-2"},Yj={class:"form-group"},Jj={class:"invalid-feedback"},Xj={class:"invalid-feedback"},Qj={class:"form-group"},Zj={class:"invalid-feedback"},xj={class:"invalid-feedback"},eG={id:"conf-rendering",class:"paper-settings-section"},tG={class:"form-check"},nG={class:"form-check-input",type:"checkbox",id:"link",name:"link"},oG={class:"form-check"},sG={class:"form-check-input",type:"checkbox",id:"image",name:"image"},iG={class:"form-check"},rG={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},aG={class:"form-check"},lG={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},dG={id:"conf-features",class:"paper-settings-section"},uG={class:"form-check"},cG={class:"form-check-input",type:"checkbox",id:"update",name:"update"},pG={class:"form-check"},fG={class:"form-check-input",type:"checkbox",id:"page",name:"page"},mG={id:"conf-plan",class:"paper-settings-section"},hG={key:0,class:"paper-section-copy"},gG={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"},Line truncated
`).length))+" lines",1)):f("v-if",!0)]),D(n("button",{type:"button",class:"btn btn-sm btn-icon-only btn-ghost copy-path-btn","aria-label":e.pathCopied?"Path copied":"Copy file path",title:e.pathCopied?"Path copied":"Copy file path",onClick:t[2]||(t[2]=d=>e.copyPath())},[(a(),l("svg",dW,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,uW)]))],8,lW),[[Q,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",cW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(u(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,pW),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),h(u(e.languageName||"Text"),1),n("span",fW,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.content.length<1024?e.content.length+" B":(e.content.length/1024).toFixed(1)+" KB"),1)]),t[52]||(t[52]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",mW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(u(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,hW),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(T,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.formatSize(e.fileSize(e.filePath))),1)],64)):f("v-if",!0)])):f("v-if",!0),e.preview&&e.previewPreserved()?(a(),l("button",{key:2,type:"button",class:"rp-preserved-tag",onClick:t[3]||(t[3]=d=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",gW,[e.isCsv()?(a(),l("div",vW,[n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,yW),n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[5]||(t[5]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,bW)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",wW,[n("button",{type:"button",class:R(["btn btn-sm btn-ghost btn-symbols",{"is-on":e.symbolsOpen}]),"aria-expanded":e.symbolsOpen?"true":"false","aria-haspopup":"true",title:"Symbols in this file",onClick:t[6]||(t[6]=d=>e.symbolsOpen=!e.symbolsOpen)},[...t[57]||(t[57]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-list"})],-1),n("span",{class:"btn-find-label"},"Symbols",-1)])],10,kW),e.symbolsOpen?(a(),l("div",CW,[n("div",SW,u(e.symbols().length)+" "+u(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(T,null,j(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:p=>e.goToSymbol(d.line)},[n("span",{class:R(["symbols-kind","is-"+d.kind])},u(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",NW,u(d.name),1),n("span",RW,u(d.line),1)],8,EW))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:R(["btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find",{"is-on":e.mdFindOpen}]),"aria-label":"Find on this page",title:"Find on this page ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[7]||(t[7]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,TW)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?(a(),l("div",PW,[e.type!="html"?(a(),l("button",{key:0,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-goto","aria-label":"Go to line",title:"Go to line ("+(e.isMac?"\u2318":"Ctrl+")+"G)",onClick:t[8]||(t[8]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,DW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost btn-toggle",{"is-on":e.wrapLines}]),"aria-pressed":e.wrapLines?"true":"false","aria-label":"Wrap lines",title:"Wrap lines (Alt+Z)",onClick:t[9]||(t[9]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,AW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:2,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-find","aria-label":"Find in file",title:"Find in file ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[10]||(t[10]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,IW)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",OW,[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,MW),typeof e.content=="string"?(a(),l("button",{key:0,type:"button",class:"tb-seg-btn tb-seg-icon","aria-label":e.contentCopied?"Copied":"Copy file contents",title:e.contentCopied?"Copied":"Copy file contents",onClick:t[11]||(t[11]=d=>e.copyContent())},[(a(),l("svg",qW,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,LW)]))],8,VW)):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,FW)])):f("v-if",!0),typeof e.content=="string"?(a(),l("button",{key:5,type:"button",class:"btn btn-sm btn-icon-only btn-ghost tb-copy-m","aria-label":e.contentCopied?"Copied":"Copy file contents",onClick:t[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",$W,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,UW)]))],8,_W)):f("v-if",!0),e.type=="html"&&e.t Line truncated
`).length))+" lines",1)],64)):f("v-if",!0)])):f("v-if",!0),e.options?.publishedAt||e.options?.sourceCommitDate||e.options?.anonymizedAt||e.options?.lastUpdateDate?(a(),l("div",QW)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[17]||(t[17]=d=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),h("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",ZW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[18]||(t[18]=d=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),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]=d=>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]=d=>e.toggleWrap())},[t[70]||(t[70]=n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)),t[71]||(t[71]=h("Wrap lines",-1)),e.wrapLines?(a(),l("span",eK,"\u2713")):f("v-if",!0)],8,xW)):f("v-if",!0),e.isCsv()?(a(),l("button",{key:8,type:"button",role:"menuitem",class:"tb-csv-view",onClick:t[21]||(t[21]=d=>{e.csvView=e.csvView==="table"?"raw":"table",e.moreOpen=!1})},[(a(),l("svg",tK,[n("use",{href:e.csvView==="table"?"#ui-icon-code":"#ui-icon-list"},null,8,nK)])),h(u(e.csvView==="table"?"Show as text":"Show as table"),1)])):f("v-if",!0),e.type!="html"?(a(),l("div",oK)):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,sK)):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,iK)):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,rK)):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,aK)):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,lK)):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,dK)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=d=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),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]=re(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),D(n("input",{id:"goto-input",class:"goto-input",type:"text",inputmode:"numeric",autocomplete:"off",spellcheck:"false",placeholder:"1\u2013"+e.fmt?.number(typeof e.content=="string"?e.content.split(`
`).length:1),"aria-invalid":e.gotoError?"true":"false","onUpdate:modelValue":t[24]||(t[24]=d=>e.gotoValue=d),onKeydown:t[25]||(t[25]=_t(re(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,uK),[[ot,e.gotoValue]]),n("span",{class:R(["goto-hint",{"is-error":e.gotoError}])},u(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView==="table"?(a(),l("div",{key:0,class:"csv-table-wrap",tabindex:"0",role:"region","aria-label":"Table view of "+(e.paths?.[e.paths.length-1]||"file")},[n("table",pK,[n("thead",null,[n("tr",null,[t[83]||(t[83]=n("th",{class:"csv-rownum",scope:"col"},[n("span",{class:"sr-only"},"Row")],-1)),(a(!0),l(T,null,j(e.csvRows()[0]||[],(d,p)=>(a(),l("th",{scope:"col",key:p,class:R({"is-num":e.csvNumCol(p)})},[(a(!0),l(T,null,j(e.redactParts(d),(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,fK)):(a(),l(T,{key:1},[h(u(c.t),1)],64))],64))),128))],2))),128))])]),n("tbody",null,[(a(!0),l(T,null,j(e.csvRows().slice(1),(d,p)=>(a(),l("tr",{key:p},[n("td",mK,u(p+1),1),(a(!0),l(T,null,j(d,(c,v)=>(a(),l("td",{key:v,class:R({"is-num":e.csvNumCol(v)})},[(a(!0),l(T,null,j(e.redactParts(c),(m,y)=>(a(),l(T,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,u(m.n),1)],8,hK)):(a(),l(T,{key:1},[h(u(m.t),1)],64))],64))),128))],2))),128))]))),128))])])],8,cK)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?D((a(),l("div",gK,null,512)),[[i,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",vK,[n("input",{type:"search",class:"md-find-input",placeholder:"Find on this page","aria-label":"Find on this page",value:e.mdFindQuery,onInput:t[27]||(t[27]=d=>{e.mdFindQuery=d.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=_t(re(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=_t(re(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,yK),n("span",bK,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[84]||(t[84]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,wK),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=d=>e.stepMdFind(1)),disabled:!e.mdFindTotal},[...t[85]||(t[85]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-right"})],-1)])],8,kK)]),n("span",CK,u(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:R(["md-find-opt",{"is-on":e.mdFindCase}]),"aria-pressed":e.mdFindCase?"true":"false",title:"Match case","aria-label":"Match case",onClick:t[32]||(t[32]=d=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,SK),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=d=>e.toggleMdFind(!1))},"\xD7")])):f("v-if",!0),e.type=="html"?(a(),l("div",EK,[n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,NK),e.tocCount()>=3?(a(),l("aside",RK,[t[86]||(t[86]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",TK,[n("a",{href:"#",class:R(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=re(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(T,{key:0},j(e.tocTitle().parts,(d,p)=>(a(),l(T,{key:p},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,u(d.n),1)],8,PK)):(a(),l(T,{key:1},[h(u(d.t),1)],64))],64))),128)):(a(),l(T,{key:1},[h("Introduction")],64))],2),(a(!0),l(T,null,j(e.readmeToc(),(d,p)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:R(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:re(c=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(T,null,j(d.parts,(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,AK)):(a(),l(T,{key:1},[h(u(c.t),1)],64))],64))),128))],10,DK))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Tt(o,{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",IK,[n("div",OK,[n("button",{type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost card-files-btn",{"is-needed":e.sidebarHidden}]),title:"Show file tree",onClick:t[35]||(t[35]=d=>e.sidebarHidden?e.sidebarHidden=!1:e.sidebarCollapsed=!1)},[...t[87]||(t[87]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sidebar"})],-1),n("span",{class:"card-files-label"},"Files",-1)])],2 Line truncated
<span class="ln">10</span> log(<span class="s">&quot;epoch %d: %.3f&quot;</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",jj,[...t[21]||(t[21]=[Se('<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,Bj)])],8,Fj)),[[Z,e.feature===r?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=Se('<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)),Ie(o,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var Gj={class:"paper-empty"},Wj={class:"paper-empty-inner"},Kj={key:0,class:"paper-eyebrow"},Yj={key:1,class:"paper-eyebrow"},Jj={key:2,class:"paper-empty-title"},Xj=["textContent"];function Xp(e,t){return a(),l("div",Gj,[n("div",Wj,[e.error?f("v-if",!0):(a(),l("div",Kj,"Working")),e.error?(a(),l("div",Yj,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",Jj,[...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:u(e.fmt.translate(e.error))},null,8,Xj)):f("v-if",!0)])])}var Qj={class:"container paper-page paper-settings"},Zj={class:"paper-crumbs"},xj={class:"here"},eG={class:"paper-page-title"},tG={class:"paper-settings-body"},nG={class:"paper-settings-toc"},oG={href:"#conf-billing"},sG={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},iG={id:"conf-basics",class:"paper-settings-section"},rG={class:"form-group"},aG={class:"invalid-feedback"},lG={class:"invalid-feedback"},dG={class:"form-group"},uG={class:"invalid-feedback"},cG={class:"form-group"},pG={class:"invalid-feedback"},fG={class:"invalid-feedback"},mG={id:"conf-window",class:"paper-settings-section"},hG={class:"form-grid-2"},gG={class:"form-group"},vG={class:"invalid-feedback"},yG={class:"invalid-feedback"},bG={class:"form-group"},wG={class:"invalid-feedback"},kG={class:"invalid-feedback"},CG={id:"conf-rendering",class:"paper-settings-section"},SG={class:"form-check"},EG={class:"form-check-input",type:"checkbox",id:"link",name:"link"},NG={class:"form-check"},RG={class:"form-check-input",type:"checkbox",id:"image",name:"image"},TG={class:"form-check"},PG={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},DG={class:"form-check"},AG={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},IG={id:"conf-features",class:"paper-settings-section"},OG={class:"form-check"},MG={class:"form-check-input",type:"checkbox",id:"update",name:"update"},VG={class:"form-check"},LG={class:"form-check-input",type:"checkbox",id:"page",name:"page"},qG={id:"conf-plan",class:"paper-settings-section"},FG={key:0,class:"paper-section-copy"},$G={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"},Line truncated
`).length))+" lines",1)):f("v-if",!0)]),D(n("button",{type:"button",class:"btn btn-sm btn-icon-only btn-ghost copy-path-btn","aria-label":e.pathCopied?"Path copied":"Copy file path",title:e.pathCopied?"Path copied":"Copy file path",onClick:t[2]||(t[2]=d=>e.copyPath())},[(a(),l("svg",IW,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,OW)]))],8,AW),[[Z,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",MW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(u(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,VW),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),h(u(e.languageName||"Text"),1),n("span",LW,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.content.length<1024?e.content.length+" B":(e.content.length/1024).toFixed(1)+" KB"),1)]),t[52]||(t[52]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",qW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(u(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,FW),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(T,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.formatSize(e.fileSize(e.filePath))),1)],64)):f("v-if",!0)])):f("v-if",!0),e.preview&&e.previewPreserved()?(a(),l("button",{key:2,type:"button",class:"rp-preserved-tag",onClick:t[3]||(t[3]=d=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",$W,[e.isCsv()?(a(),l("div",_W,[n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,UW),n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[5]||(t[5]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,BW)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",zW,[n("button",{type:"button",class:R(["btn btn-sm btn-ghost btn-symbols",{"is-on":e.symbolsOpen}]),"aria-expanded":e.symbolsOpen?"true":"false","aria-haspopup":"true",title:"Symbols in this file",onClick:t[6]||(t[6]=d=>e.symbolsOpen=!e.symbolsOpen)},[...t[57]||(t[57]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-list"})],-1),n("span",{class:"btn-find-label"},"Symbols",-1)])],10,HW),e.symbolsOpen?(a(),l("div",jW,[n("div",GW,u(e.symbols().length)+" "+u(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(T,null,H(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:p=>e.goToSymbol(d.line)},[n("span",{class:R(["symbols-kind","is-"+d.kind])},u(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",KW,u(d.name),1),n("span",YW,u(d.line),1)],8,WW))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:R(["btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find",{"is-on":e.mdFindOpen}]),"aria-label":"Find on this page",title:"Find on this page ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[7]||(t[7]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,JW)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?(a(),l("div",XW,[e.type!="html"?(a(),l("button",{key:0,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-goto","aria-label":"Go to line",title:"Go to line ("+(e.isMac?"\u2318":"Ctrl+")+"G)",onClick:t[8]||(t[8]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,QW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost btn-toggle",{"is-on":e.wrapLines}]),"aria-pressed":e.wrapLines?"true":"false","aria-label":"Wrap lines",title:"Wrap lines (Alt+Z)",onClick:t[9]||(t[9]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,ZW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:2,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-find","aria-label":"Find in file",title:"Find in file ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[10]||(t[10]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,xW)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",eK,[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,tK),typeof e.content=="string"?(a(),l("button",{key:0,type:"button",class:"tb-seg-btn tb-seg-icon","aria-label":e.contentCopied?"Copied":"Copy file contents",title:e.contentCopied?"Copied":"Copy file contents",onClick:t[11]||(t[11]=d=>e.copyContent())},[(a(),l("svg",oK,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,sK)]))],8,nK)):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,iK)])):f("v-if",!0),typeof e.content=="string"?(a(),l("button",{key:5,type:"button",class:"btn btn-sm btn-icon-only btn-ghost tb-copy-m","aria-label":e.contentCopied?"Copied":"Copy file contents",onClick:t[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",aK,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,lK)]))],8,rK)):f("v-if",!0),e.type=="html"&&e.t Line truncated
`).length))+" lines",1)],64)):f("v-if",!0)])):f("v-if",!0),e.options?.publishedAt||e.options?.sourceCommitDate||e.options?.anonymizedAt||e.options?.lastUpdateDate?(a(),l("div",bK)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[17]||(t[17]=d=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),h("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",wK)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[18]||(t[18]=d=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),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]=d=>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]=d=>e.toggleWrap())},[t[70]||(t[70]=n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)),t[71]||(t[71]=h("Wrap lines",-1)),e.wrapLines?(a(),l("span",CK,"\u2713")):f("v-if",!0)],8,kK)):f("v-if",!0),e.isCsv()?(a(),l("button",{key:8,type:"button",role:"menuitem",class:"tb-csv-view",onClick:t[21]||(t[21]=d=>{e.csvView=e.csvView==="table"?"raw":"table",e.moreOpen=!1})},[(a(),l("svg",SK,[n("use",{href:e.csvView==="table"?"#ui-icon-code":"#ui-icon-list"},null,8,EK)])),h(u(e.csvView==="table"?"Show as text":"Show as table"),1)])):f("v-if",!0),e.type!="html"?(a(),l("div",NK)):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,RK)):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,TK)):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,PK)):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,DK)):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,AK)):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,IK)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=d=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),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]=ae(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),D(n("input",{id:"goto-input",class:"goto-input",type:"text",inputmode:"numeric",autocomplete:"off",spellcheck:"false",placeholder:"1\u2013"+e.fmt?.number(typeof e.content=="string"?e.content.split(`
`).length:1),"aria-invalid":e.gotoError?"true":"false","onUpdate:modelValue":t[24]||(t[24]=d=>e.gotoValue=d),onKeydown:t[25]||(t[25]=_t(ae(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,OK),[[nt,e.gotoValue]]),n("span",{class:R(["goto-hint",{"is-error":e.gotoError}])},u(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView==="table"?(a(),l("div",{key:0,class:"csv-table-wrap",tabindex:"0",role:"region","aria-label":"Table view of "+(e.paths?.[e.paths.length-1]||"file")},[n("table",VK,[n("thead",null,[n("tr",null,[t[83]||(t[83]=n("th",{class:"csv-rownum",scope:"col"},[n("span",{class:"sr-only"},"Row")],-1)),(a(!0),l(T,null,H(e.csvRows()[0]||[],(d,p)=>(a(),l("th",{scope:"col",key:p,class:R({"is-num":e.csvNumCol(p)})},[(a(!0),l(T,null,H(e.redactParts(d),(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,LK)):(a(),l(T,{key:1},[h(u(c.t),1)],64))],64))),128))],2))),128))])]),n("tbody",null,[(a(!0),l(T,null,H(e.csvRows().slice(1),(d,p)=>(a(),l("tr",{key:p},[n("td",qK,u(p+1),1),(a(!0),l(T,null,H(d,(c,v)=>(a(),l("td",{key:v,class:R({"is-num":e.csvNumCol(v)})},[(a(!0),l(T,null,H(e.redactParts(c),(m,y)=>(a(),l(T,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,u(m.n),1)],8,FK)):(a(),l(T,{key:1},[h(u(m.t),1)],64))],64))),128))],2))),128))]))),128))])])],8,MK)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?D((a(),l("div",$K,null,512)),[[i,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",_K,[n("input",{type:"search",class:"md-find-input",placeholder:"Find on this page","aria-label":"Find on this page",value:e.mdFindQuery,onInput:t[27]||(t[27]=d=>{e.mdFindQuery=d.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=_t(ae(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=_t(ae(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,UK),n("span",BK,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[84]||(t[84]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,zK),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=d=>e.stepMdFind(1)),disabled:!e.mdFindTotal},[...t[85]||(t[85]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-right"})],-1)])],8,HK)]),n("span",jK,u(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:R(["md-find-opt",{"is-on":e.mdFindCase}]),"aria-pressed":e.mdFindCase?"true":"false",title:"Match case","aria-label":"Match case",onClick:t[32]||(t[32]=d=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,GK),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=d=>e.toggleMdFind(!1))},"\xD7")])):f("v-if",!0),e.type=="html"?(a(),l("div",WK,[n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,KK),e.tocCount()>=3?(a(),l("aside",YK,[t[86]||(t[86]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",JK,[n("a",{href:"#",class:R(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=ae(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(T,{key:0},H(e.tocTitle().parts,(d,p)=>(a(),l(T,{key:p},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,u(d.n),1)],8,XK)):(a(),l(T,{key:1},[h(u(d.t),1)],64))],64))),128)):(a(),l(T,{key:1},[h("Introduction")],64))],2),(a(!0),l(T,null,H(e.readmeToc(),(d,p)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:R(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:ae(c=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(T,null,H(d.parts,(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,ZK)):(a(),l(T,{key:1},[h(u(c.t),1)],64))],64))),128))],10,QK))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Tt(o,{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",xK,[n("div",eY,[n("button",{type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost card-files-btn",{"is-needed":e.sidebarHidden}]),title:"Show file tree",onClick:t[35]||(t[35]=d=>e.sidebarHidden?e.sidebarHidden=!1:e.sidebarCollapsed=!1)},[...t[87]||(t[87]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sidebar"})],-1),n("span",{class:"card-files-label"},"Files",-1)])],2 Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,8,YJ),[[r,{state:e.viewState,set:i=>{e.terms=i},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",JJ,[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,u(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))])]),D(n("div",XJ,"Terms are in an invalid format.",512),[[Q,e.defaultsForm?.terms?.errors?.format]])])]),n("section",QJ,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",ZJ,[n("label",xJ,[D(n("input",eX,null,512),[[r,{state:e.viewState,set:i=>{e.options.link=i},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=h("Keep links",-1))]),n("label",tX,[D(n("input",nX,null,512),[[r,{state:e.viewState,set:i=>{e.options.image=i},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=h("Display images",-1))]),n("label",oX,[D(n("input",sX,null,512),[[r,{state:e.viewState,set:i=>{e.options.pdf=i},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=h("Display PDFs",-1))]),n("label",iX,[D(n("input",rX,null,512),[[r,{state:e.viewState,set:i=>{e.options.notebook=i},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=h("Display notebooks",-1))]),n("label",aX,[D(n("input",lX,null,512),[[r,{state:e.viewState,set:i=>{e.options.loc=i},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=h("Show line counts",-1))]),n("label",dX,[D(n("input",uX,null,512),[[r,{state:e.viewState,set:i=>{e.options.page=i},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",cX,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",pX,[D(n("input",fX,null,512),[[r,{state:e.viewState,set:i=>{e.options.update=i},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",mX,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[D((a(),l("select",hX,[...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)])])),[[r,{state:e.viewState,set:i=>{e.options.expirationMode=i},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",gX,u(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",vX,[n("div",yX,[e.draftRestored?(a(),l("span",bX,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",wX,"Unsaved changes"+u(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",kX,u(e.message?"Defaults saved":"No unsaved changes"),1))]),e.draftRestored||e.unsavedChanges?(a(),l("button",{key:0,type:"button",class:"draft-discard",onClick:t[0]||(t[0]=i=>e.discardDraft())},"Discard changes")):f("v-if",!0),n("button",{id:"save",type:"submit",class:R(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},u(e.saving?"Saving\u2026":"Save defaults"),11,CX),e.error?(a(),l("div",SX,u(e.error),1)):f("v-if",!0)])],32)),[[s,e.viewState]])],512),[[Q,e.settingsTab==="defaults"]]),D(n("section",{id:"settings-billing","aria-busy":e.billingLoading||e.billingBusy},[t[95]||(t[95]=n("p",{class:"settings-scope"},"Your plan and usage. Reviewer access is always free.",-1)),e.billingLoading?(a(),l("p",NX,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",RX,[h(u(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=i=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,TX)])):f("v-if",!0),e.billingNotice?(a(),l("p",PX,u(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",DX,[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]=i=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,AX)])):f("v-if",!0),n("section",IX,[n("div",OX,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",MX,u(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",VX,[h(u(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access u Line truncated
jane.smith@example.org`},null,8,gX),[[r,{state:e.viewState,set:i=>{e.terms=i},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",vX,[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,u(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))])]),D(n("div",yX,"Terms are in an invalid format.",512),[[Z,e.defaultsForm?.terms?.errors?.format]])])]),n("section",bX,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",wX,[n("label",kX,[D(n("input",CX,null,512),[[r,{state:e.viewState,set:i=>{e.options.link=i},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=h("Keep links",-1))]),n("label",SX,[D(n("input",EX,null,512),[[r,{state:e.viewState,set:i=>{e.options.image=i},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=h("Display images",-1))]),n("label",NX,[D(n("input",RX,null,512),[[r,{state:e.viewState,set:i=>{e.options.pdf=i},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=h("Display PDFs",-1))]),n("label",TX,[D(n("input",PX,null,512),[[r,{state:e.viewState,set:i=>{e.options.notebook=i},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=h("Display notebooks",-1))]),n("label",DX,[D(n("input",AX,null,512),[[r,{state:e.viewState,set:i=>{e.options.loc=i},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=h("Show line counts",-1))]),n("label",IX,[D(n("input",OX,null,512),[[r,{state:e.viewState,set:i=>{e.options.page=i},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",MX,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",VX,[D(n("input",LX,null,512),[[r,{state:e.viewState,set:i=>{e.options.update=i},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",qX,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[D((a(),l("select",FX,[...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)])])),[[r,{state:e.viewState,set:i=>{e.options.expirationMode=i},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",$X,u(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",_X,[n("div",UX,[e.draftRestored?(a(),l("span",BX,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",zX,"Unsaved changes"+u(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",HX,u(e.message?"Defaults saved":"No unsaved changes"),1))]),e.draftRestored||e.unsavedChanges?(a(),l("button",{key:0,type:"button",class:"draft-discard",onClick:t[0]||(t[0]=i=>e.discardDraft())},"Discard changes")):f("v-if",!0),n("button",{id:"save",type:"submit",class:R(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},u(e.saving?"Saving\u2026":"Save defaults"),11,jX),e.error?(a(),l("div",GX,u(e.error),1)):f("v-if",!0)])],32)),[[s,e.viewState]])],512),[[Z,e.settingsTab==="defaults"]]),D(n("section",{id:"settings-billing","aria-busy":e.billingLoading||e.billingBusy},[t[95]||(t[95]=n("p",{class:"settings-scope"},"Your plan and usage. Reviewer access is always free.",-1)),e.billingLoading?(a(),l("p",KX,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",YX,[h(u(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=i=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,JX)])):f("v-if",!0),e.billingNotice?(a(),l("p",XX,u(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",QX,[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]=i=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,ZX)])):f("v-if",!0),n("section",xX,[n("div",eQ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",tQ,u(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",nQ,[h(u(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access u Line truncated
`);t.innerHTML=o.map(r=>{let s=r.replace(/^(<[^>]+>)+/,"").charAt(0),i=r.startsWith("@@")?"hunk":s==="+"?"add":s==="-"?"remove":"";return`<span class="md-diff-line${i?" is-"+i:""}">${r||" "}</span>`}).join(`
`)}),rf=(e,t=0)=>{let o=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+o+4,24)},uf=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let o=t.querySelectorAll(".md-diff-line");if(o.length){o.forEach(s=>{s.classList.contains("is-hunk")||s.style.setProperty("--hang",rf(s.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let r=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
`).map(s=>{let i=r.join("");s.replace(/<\/?span\b[^>]*>/g,p=>(p.startsWith("</")?r.pop():r.push(p),p));let d=s.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${rf(d)}ch">${i}${s||" "}${"</span>".repeat(r.length)}</span>`}).join(`
`)})},Joe=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",hl={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),o=()=>{let r=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?Wo(r):r,df(t.value),uf(t.value),e.idPrefix!=null){let s={};t.value.querySelectorAll("h1, h2, h3").forEach(i=>{let d=e.idPrefix+(i.id||Joe(i.textContent));s[d]?d+="-"+ ++s[d]:s[d]=1,i.id=d})}e.onOutline?.(sr(t.value))};return vn(()=>{o(),ut(()=>[e.content,e.terms,e.options],o,{deep:!0})}),()=>ye("markdown",{ref:t,class:e.reader?"markdown-body":null})}},af=e=>wn(e).map(t=>t.n?ye("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},ye("i",t.n)):t.t),ml=e=>/^XXXX-\d+$/.test(String(e||"").trim()),Xoe=(e,t="Reviewer")=>e?ye("span",{class:["pr-author",{"is-redacted":ml(e)}],title:ml(e)?"Redacted author":null},ml(e)?af(e):["@",...af(e)]):ye("span",{class:"pr-author is-hidden"},t),cf={props:["comments","fmt"],setup(e){return()=>ye("div",{class:"pr-thread"},(e.comments||[]).map((t,o)=>ye("article",{class:["pr-thread-comment",{"is-reply":o>0}],key:o},[ye("header",{class:"pr-thread-head"},[ye("span",{class:"pr-avatar","aria-hidden":"true"},ye("svg",{class:"ui-icon"},ye("use",{href:"#ui-icon-user"}))),Xoe(t.author),t.creationDate||t.updatedDate?ye("time",{class:"pr-thread-date",datetime:t.creationDate||t.updatedDate},e.fmt?.date(t.creationDate||t.updatedDate)):null]),t.body?ye("div",{class:"pr-thread-body"},ye(hl,{content:t.body,reader:!0})):null])))}},Qoe=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),Zoe=new Set(["add","remove","ctx","hunk"]),xoe=e=>{let t=Zoe.has(e.kind)?e.kind:"ctx",o=wn(e.text).map(r=>r.n?`<span class="redact-slot" role="img" aria-label="Redacted term ${Number(r.n)}"><i>${Number(r.n)}</i></span>`:Qoe(r.t)).join("");return`<tr class="diff-row diff-row-${t}"><td class="diff-gutter diff-gutter-old">${Number(e.oldNo)||""}</td><td class="diff-gutter diff-gutter-new">${Number(e.newNo)||""}</td><td class="diff-sign">${t==="add"?"+":t==="remove"?"\u2212":""}</td><td class="diff-code" style="--hang: ${Go(e.text)}ch">${o}</td></tr>`},ese={props:["file","fmt"],setup(e){return()=>{let t=[],o="",r=()=>{o&&t.push(ye("tbody",{key:"r"+t.length,innerHTML:o})),o=""};return(e.file?.lines||[]).forEach(s=>{o+=xoe(s),s.threads?.length&&(r(),t.push(ye("tbody",{key:"t"+t.length},s.threads.map((i,d)=>ye("tr",{class:"diff-thread-row",key:d},[ye("td",{class:"diff-thread-gutter",colspan:3}),ye("td",{class:"diff-thread-cell"},ye(cf,{comments:i.comments,fmt:e.fmt}))])))))}),r(),ye("table",{class:"diff-file-table"},t)}}},tse={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),o=()=>je(()=>{t.value?.querySelectorAll("pre code").forEach(r=>window.Prism?.highlightElement(r)),df(t.value),uf(t.value)});return vn(o),ut(()=>[e.file?.content,e.terms,e.options],o,{deep:!0}),()=>{let r=e.file||{},s=(r.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(s)||r.language==="Markdown")return ye("gist-file",{ref:t},ye(hl,{content:r.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));let i={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},d=(r.language||s||"none").toLowerCase();return ye("gist-file",{ref:t},ye("pre",{class:"line-numbers"},ye("code",{class:"language-"+(i[d]||d),key:r.content},r.content||"")))}}},nse=e=>e?.querySelectorAll(".nb-input pre").forEach(t=>{if(t.parentElement?.classList.contains("nb-code-scroll"))return;let o=document.createElement("div");o.className="nb-code-scroll",t.replaceWith(o),o.appendChild(t);let r=()=>{let s=t.scrollWidth-t.clientWidth>1;if(o.classList.toggle("is-overflowing",s),o.classList.toggle("is-at-end",s&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!s)return;let i=t.clientWidth-16,d=Math.max(24,i*t.clientWidth/t.scrollWidth);o.style.setProperty("--thumb-w",d+"px"),o.style.setProperty("--thumb-x",(i-d)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",r,{passive:!0}),window.ResizeObserver?new ResizeObserver(r).observe(t):r(),r()}),ose={props:["file","content"],setup(e){let t=Ct(null),o=0,r,s=async()=>{let i=++o;r?.abort(),r=new AbortController;try{let d=e.content?JSON.parse(e.content):await fetch(e.file?.download_url||e.file,{signal:r.signal}).then(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await xn("notebook"),i!==o)return;t.value.innerHTML=Wo(DOMPurify.sanitize(nb.parse(d).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),nse(t.value)}catch(d){i===o&&d.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return vn(()=>{s(),ut(()=>[e.file,e.content],s)}),ao(()=>{o++,r?.abort()}),()=>ye("notebook",{ref:t})}},ssLine truncated
`)}),mf=(e,t=0)=>{let o=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+o+4,24)},yf=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let o=t.querySelectorAll(".md-diff-line");if(o.length){o.forEach(s=>{s.classList.contains("is-hunk")||s.style.setProperty("--hang",mf(s.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let r=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
`).map(s=>{let i=r.join("");s.replace(/<\/?span\b[^>]*>/g,p=>(p.startsWith("</")?r.pop():r.push(p),p));let d=s.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${mf(d)}ch">${i}${s||" "}${"</span>".repeat(r.length)}</span>`}).join(`
`)})},vse=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",kl={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),o=()=>{let r=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?Ko(r):r,vf(t.value),yf(t.value),e.idPrefix!=null){let s={};t.value.querySelectorAll("h1, h2, h3").forEach(i=>{let d=e.idPrefix+(i.id||vse(i.textContent));s[d]?d+="-"+ ++s[d]:s[d]=1,i.id=d})}e.onOutline?.(ar(t.value))};return yn(()=>{o(),dt(()=>[e.content,e.terms,e.options],o,{deep:!0})}),()=>we("markdown",{ref:t,class:e.reader?"markdown-body":null})}},hf=e=>kn(e).map(t=>t.n?we("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},we("i",t.n)):t.t),wl=e=>/^XXXX-\d+$/.test(String(e||"").trim()),yse=(e,t="Reviewer")=>e?we("span",{class:["pr-author",{"is-redacted":wl(e)}],title:wl(e)?"Redacted author":null},wl(e)?hf(e):["@",...hf(e)]):we("span",{class:"pr-author is-hidden"},t),bf={props:["comments","fmt"],setup(e){return()=>we("div",{class:"pr-thread"},(e.comments||[]).map((t,o)=>we("article",{class:["pr-thread-comment",{"is-reply":o>0}],key:o},[we("header",{class:"pr-thread-head"},[we("span",{class:"pr-avatar","aria-hidden":"true"},we("svg",{class:"ui-icon"},we("use",{href:"#ui-icon-user"}))),yse(t.author),t.creationDate||t.updatedDate?we("time",{class:"pr-thread-date",datetime:t.creationDate||t.updatedDate},e.fmt?.date(t.creationDate||t.updatedDate)):null]),t.body?we("div",{class:"pr-thread-body"},we(kl,{content:t.body,reader:!0})):null])))}},bse=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),wse=new Set(["add","remove","ctx","hunk"]),kse=e=>{let t=wse.has(e.kind)?e.kind:"ctx",o=kn(e.text).map(r=>r.n?`<span class="redact-slot" role="img" aria-label="Redacted term ${Number(r.n)}"><i>${Number(r.n)}</i></span>`:bse(r.t)).join("");return`<tr class="diff-row diff-row-${t}"><td class="diff-gutter diff-gutter-old">${Number(e.oldNo)||""}</td><td class="diff-gutter diff-gutter-new">${Number(e.newNo)||""}</td><td class="diff-sign">${t==="add"?"+":t==="remove"?"\u2212":""}</td><td class="diff-code" style="--hang: ${Wo(e.text)}ch">${o}</td></tr>`},Cse={props:["file","fmt"],setup(e){return()=>{let t=[],o="",r=()=>{o&&t.push(we("tbody",{key:"r"+t.length,innerHTML:o})),o=""};return(e.file?.lines||[]).forEach(s=>{o+=kse(s),s.threads?.length&&(r(),t.push(we("tbody",{key:"t"+t.length},s.threads.map((i,d)=>we("tr",{class:"diff-thread-row",key:d},[we("td",{class:"diff-thread-gutter",colspan:3}),we("td",{class:"diff-thread-cell"},we(bf,{comments:i.comments,fmt:e.fmt}))])))))}),r(),we("table",{class:"diff-file-table"},t)}}},Sse={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),o=()=>Be(()=>{t.value?.querySelectorAll("pre code").forEach(r=>window.Prism?.highlightElement(r)),vf(t.value),yf(t.value)});return yn(o),dt(()=>[e.file?.content,e.terms,e.options],o,{deep:!0}),()=>{let r=e.file||{},s=(r.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(s)||r.language==="Markdown")return we("gist-file",{ref:t},we(kl,{content:r.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));let i={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},d=(r.language||s||"none").toLowerCase();return we("gist-file",{ref:t},we("pre",{class:"line-numbers"},we("code",{class:"language-"+(i[d]||d),key:r.content},r.content||"")))}}},Ese=e=>e?.querySelectorAll(".nb-input pre").forEach(t=>{if(t.parentElement?.classList.contains("nb-code-scroll"))return;let o=document.createElement("div");o.className="nb-code-scroll",t.replaceWith(o),o.appendChild(t);let r=()=>{let s=t.scrollWidth-t.clientWidth>1;if(o.classList.toggle("is-overflowing",s),o.classList.toggle("is-at-end",s&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!s)return;let i=t.clientWidth-16,d=Math.max(24,i*t.clientWidth/t.scrollWidth);o.style.setProperty("--thumb-w",d+"px"),o.style.setProperty("--thumb-x",(i-d)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",r,{passive:!0}),window.ResizeObserver?new ResizeObserver(r).observe(t):r(),r()}),Nse={props:["file","content"],setup(e){let t=Ct(null),o=0,r,s=async()=>{let i=++o;r?.abort(),r=new AbortController;try{let d=e.content?JSON.parse(e.content):await fetch(e.file?.download_url||e.file,{signal:r.signal}).then(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await eo("notebook"),i!==o)return;t.value.innerHTML=Ko(DOMPurify.sanitize(nb.parse(d).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),Ese(t.value)}catch(d){i===o&&d.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return yn(()=>{s(),dt(()=>[e.file,e.content],s)}),lo(()=>{o++,r?.abort()}),()=>we("notebook",{ref:t})}},RsLine truncated
/*! Bundled license information:
@vue/shared/dist/shared.esm-bundler.js:
+75 -4
View File
@@ -277,6 +277,38 @@ app.get("/api/user/quota", (req, res) => res.json(quota));
app.get("/api/user/anonymized_repositories", (req, res) => res.json(repositories));
app.get("/api/user/anonymized_pull_requests", (req, res) => res.json(pullRequests));
app.get("/api/user/anonymized_gists", (req, res) => res.json(gists));
// The dashboard summary API (src/server/routes/dashboard-summary.ts) over the
// same fixtures: status keys, attention, type/status/search filters and sort.
// A `mock_dashboard_delay=<ms>` cookie holds each answer, so the loading and
// reloading states (first load, tab switch, search) can be checked.
const summaryItems = () => [
...repositories.map((r) => ({ ...r, _type: "repo", _id: r.repoId, _label: r.source?.fullName, _source: r.source?.fullName })),
...pullRequests.map((p) => ({ ...p, _type: "pr", _id: p.pullRequestId || "", _label: `${p.source.repositoryFullName}#${p.source.pullRequestId}`, _source: `${p.source.repositoryFullName}#${p.source.pullRequestId}` })),
...gists.map((g) => ({ ...g, _type: "gist", _id: g.gistId, _label: `Gist ${g.gistId}`, _source: g.source?.gistId })),
].map((item) => {
const expired = item.status === "ready" && item.options && item.options.expirationMode !== "never" && item.options.expirationDate && new Date(item.options.expirationDate) <= new Date();
const status = expired ? "expired" : item.status;
const key = ["ready", "error"].includes(status) ? status : ["expired", "expiring"].includes(status) ? "expired" : ["removed", "removing"].includes(status) ? "removed" : "progress";
const since = item.anonymizeDate || item.lastView;
const attention = status === "error" || !item._id || (key === "progress" && !!since && new Date(since) < new Date(Date.now() - 2 * 3600000));
return { ...item, status, _statusKey: key, _attention: attention };
});
app.get("/api/user/dashboard", (req, res) => {
const all = summaryItems();
const statuses = String(req.query.statuses || "ready,progress,error,expired").split(",");
const q = String(req.query.q || "").trim().toLowerCase();
const sort = String(req.query.sort || "-anonymizeDate");
const field = sort.replace(/^-/, ""), dir = sort.startsWith("-") ? -1 : 1;
const value = (item) => field.split(".").reduce((o, k) => (o == null ? o : o[k]), item);
const filtered = all.filter((item) => statuses.includes(item._statusKey)
&& (!["repo", "pr", "gist"].includes(req.query.type) || item._type === req.query.type)
&& (req.query.attention !== "true" || item._attention)
&& (!q || [item._id, item._label, item._source, item.conference].some((v) => String(v || "").toLowerCase().includes(q))));
filtered.sort((a, b) => { const x = value(a) ?? "", y = value(b) ?? ""; return (x > y ? 1 : x < y ? -1 : 0) * dir; });
const items = filtered.map(({ _id, _source, _statusKey, _attention, ...item }) => item);
const delayMs = Number((/(?:^|;\s*)mock_dashboard_delay=(\d+)/.exec(req.headers.cookie || "") || [])[1] || 0);
global.setTimeout(() => res.json({ items, cursor: null, total: all.length, attention: all.filter((i) => i._attention).length, filtered: filtered.length }), delayMs);
});
// The landing picker: repositories the GitHub App can read.
app.get("/api/user/all_repositories", (req, res) => res.json(["jsmith/robust-repair", "jsmith/thesis-code", "tdurieux/anonymous_github", "acme-lab/benchmarks"].map((fullName, i) => ({ id: "r" + i, fullName }))));
app.get("/api/user/default", (req, res) =>
@@ -297,7 +329,7 @@ app.get("/api/conferences/plans", (req, res) => res.json(billingOn(req)
? conferenceTiers.map((t) => ({ id: t.id, name: t.name, pricePerRepo: 0, storagePerRepo: t.storage, repositories: t.repositories, description: `<li>Up to ${t.repositories} repositories</li><li>Up to 180 days</li><li>Prepaid at checkout</li>` }))
: plans));
app.get("/api/billing/", (req, res) => billingOn(req)
? res.json({ enabled: true, csrf: "local-preview-only", checkoutEnabled: true, freeExpirationMonths: 12, grants: [], purchases: [], repositories: [], portal: false, allowance: null,
? res.json({ enabled: true, csrf: "local-preview-only", checkoutEnabled: true, freeExpirationMonths: 5, grants: [], purchases: [], repositories: [], portal: false, allowance: null,
plans: conferenceTiers.map((t) => ({ id: t.id, name: t.name, description: "", repositories: t.repositories, storage: t.storage, amount: t.amount, currency: "eur" })) })
: res.status(404).json({ error: "not mocked: /api/billing/" }));
app.get("/api/conferences/", (req, res) => res.json(conferences));
@@ -1064,12 +1096,51 @@ app.get("/api/admin/users/:username", (req, res) => {
});
app.post("/api/admin/users/:username/ban", (req, res) => res.json({ ok: true, reposQueued: 2 }));
app.post("/api/admin/users/:username/:action", ok);
// Stored "Your repositories" list, as the server keeps it in MongoDB: paging
// and search read it, `force=1` simulates a GitHub refresh (about 2.5 s, then
// one new repository), and a simulated App webhook changes it in place:
// curl -XPOST localhost:4002/__mock/repository-webhook -H 'Content-Type: application/json' \
// -d '{"action":"added","fullName":"research/new-paper"}' # also: removed, renamed (+ newName)
// `{"action":"reset"}` restores the fixture list, saved 3 minutes ago.
// `?repos=empty` on the first picker call starts from an empty list (first fetch).
const fixtureRepos = () => Array.from({ length: 63 }, (_, id) => ({ id, fullName: `research/project-${String(id + 1).padStart(2, "0")}`, private: id % 3 === 0 }));
const storedRepos = { rows: fixtureRepos(), syncedAt: new Date(Date.now() - 3 * 60000), syncingUntil: 0, nextId: 1000 };
const finishMockSync = () => {
if (!storedRepos.syncingUntil || Date.now() < storedRepos.syncingUntil) return;
storedRepos.syncingUntil = 0;
storedRepos.syncedAt = new Date();
if (!storedRepos.rows.some(r => r.fullName === "research/camera-ready")) storedRepos.rows.push({ id: storedRepos.nextId++, fullName: "research/camera-ready", private: true });
};
app.get("/api/user/repository_picker", (req, res) => {
finishMockSync();
if (req.query.repos === "empty") { storedRepos.rows = []; storedRepos.syncedAt = null; }
if (req.query.force === "1" || (!storedRepos.rows.length && !storedRepos.syncingUntil)) {
storedRepos.syncingUntil = Date.now() + 2500;
if (!storedRepos.rows.length) storedRepos.rows = fixtureRepos();
}
const cursor = Number(req.query.cursor || 0);
const query = String(req.query.q || "").toLowerCase();
const repos = Array.from({ length: 63 }, (_, id) => ({ id, fullName: `research/project-${String(id + 1).padStart(2, "0")}` }));
const matches = repos.filter(repo => repo.fullName.toLowerCase().includes(query));
res.json({ items: matches.slice(cursor, cursor + 20), nextCursor: cursor + 20 < matches.length ? cursor + 20 : null });
const matches = storedRepos.rows.filter(repo => repo.fullName.toLowerCase().includes(query))
.sort((a, b) => a.fullName.toLowerCase().localeCompare(b.fullName.toLowerCase()));
res.json({
items: matches.slice(cursor, cursor + 20),
nextCursor: cursor + 20 < matches.length ? cursor + 20 : null,
syncedAt: storedRepos.syncedAt, syncing: !!storedRepos.syncingUntil,
webhooks: req.query.connection !== "oauth",
});
});
app.post("/__mock/repository-webhook", express.json(), (req, res) => {
const { action, fullName, newName } = req.body || {};
if (action === "reset") {
Object.assign(storedRepos, { rows: fixtureRepos(), syncedAt: new Date(Date.now() - 3 * 60000), syncingUntil: 0 });
return res.json({ count: storedRepos.rows.length });
}
if (!/^[^/\s]+\/[^/\s]+$/.test(fullName || "")) return res.status(400).json({ error: "fullName owner/name required" });
const existing = storedRepos.rows.find(r => r.fullName === fullName);
if (action === "added" && !existing) storedRepos.rows.push({ id: storedRepos.nextId++, fullName, private: true });
else if (action === "removed") storedRepos.rows = storedRepos.rows.filter(r => r.fullName !== fullName);
else if (action === "renamed" && existing && /^[^/\s]+\/[^/\s]+$/.test(newName || "")) existing.fullName = newName;
res.json({ count: storedRepos.rows.length });
});
app.get("/api/user/:username/all_repositories", (req, res) => {
+24 -2
View File
@@ -1,6 +1,18 @@
// Generate finite diagnostic allowlists from repository code, never runtime input.
const fs = require('fs'), path = require('path'), ts = require('typescript');
const files = {};
// Error codes the code base throws or relays, so the logger and the collector
// keep them as errorCode instead of dropping them as arbitrary strings.
const codePattern = /^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)+$/;
const errorFactories = new Set(['AnonymousError','billingError','appError']);
const thrownCodes = new Set();
function codeLiterals(node) {
if (!node) return;
if (ts.isStringLiteralLike(node)) { if (codePattern.test(node.text)) thrownCodes.add(node.text); }
else if (ts.isConditionalExpression(node)) { codeLiterals(node.whenTrue); codeLiterals(node.whenFalse); }
else if (ts.isBinaryExpression(node) && [ts.SyntaxKind.BarBarToken, ts.SyntaxKind.QuestionQuestionToken].includes(node.operatorToken.kind)) { codeLiterals(node.left); codeLiterals(node.right); }
else if (ts.isParenthesizedExpression(node)) codeLiterals(node.expression);
}
function scan(dir) {
for (const entry of fs.readdirSync(dir, {withFileTypes:true})) {
const file = path.join(dir,entry.name);
@@ -11,6 +23,11 @@ function scan(dir) {
function visit(node) {
if ((ts.isFunctionDeclaration(node)||ts.isMethodDeclaration(node)||ts.isFunctionExpression(node)) && node.name && ts.isIdentifier(node.name)) names.add(node.name.text);
if(ts.isVariableDeclaration(node)&&ts.isIdentifier(node.name)&&node.initializer&&(ts.isArrowFunction(node.initializer)||ts.isFunctionExpression(node.initializer))) names.add(node.name.text);
// new AnonymousError("code"), billingError("code"), appError("code")
if((ts.isNewExpression(node)||ts.isCallExpression(node))&&ts.isIdentifier(node.expression)&&errorFactories.has(node.expression.text)&&node.arguments?.length) codeLiterals(node.arguments[0]);
// Codes picked into a variable first: errCode = "streamer_unreachable"
if(ts.isVariableDeclaration(node)&&ts.isIdentifier(node.name)&&/^(errCode|code)$/.test(node.name.text)) codeLiterals(node.initializer);
if(ts.isBinaryExpression(node)&&node.operatorToken.kind===ts.SyntaxKind.EqualsToken&&ts.isIdentifier(node.left)&&/^(errCode|code)$/.test(node.left.text)) codeLiterals(node.right);
ts.forEachChild(node,visit);
}
visit(source);
@@ -23,7 +40,12 @@ scan('src');
const types=['Error','TypeError','RangeError','ReferenceError','SyntaxError','URIError','EvalError','AggregateError','AnonymousError','HTTPError','RequestError','MongoServerError','MongoNetworkError','MongoServerSelectionError','ValidationError','TimeoutError','AbortError','UnknownError'];
const vrl=fs.readFileSync('deploy/logging/sanitize.vrl','utf8');
const routes=JSON.parse(vrl.match(/if includes\((\[.*?\]), record.route\)/)[1]);
fs.writeFileSync('src/core/log-diagnostic-schema.ts','// Generated by scripts/generate-log-diagnostics.js; do not edit.\nexport const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = '+JSON.stringify(files,null,2)+';\nexport const LOG_ERROR_TYPES = '+JSON.stringify(types)+';\nexport const LOG_ROUTES = '+JSON.stringify(routes)+';\n');
const codes=[...thrownCodes].sort();
fs.writeFileSync('src/core/log-diagnostic-schema.ts','// Generated by scripts/generate-log-diagnostics.js; do not edit.\nexport const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = '+JSON.stringify(files,null,2)+';\nexport const LOG_ERROR_TYPES = '+JSON.stringify(types)+';\nexport const LOG_ROUTES = '+JSON.stringify(routes)+';\nexport const LOG_THROWN_ERROR_CODES = '+JSON.stringify(codes)+';\n');
// The collector keeps reviewed codes too (system errnos, worker codes); only add.
const codeList=/(if includes\()(\[.*?\])(, record\.errorCode\))/;
const collectorCodes=JSON.parse(vrl.match(codeList)[2]);
const mergedCodes=[...collectorCodes,...codes.filter(code=>!collectorCodes.includes(code))];
const block=`# BEGIN GENERATED DIAGNOSTICS
source_functions = ${JSON.stringify(files)}
for_each(["errorType", "causeType"]) -> |_index, key| {
@@ -43,5 +65,5 @@ for_each(["errorStack", "causeStack"]) -> |_index, key| {
}
}
# END GENERATED DIAGNOSTICS`;
const clean=vrl.replace(/# BEGIN GENERATED DIAGNOSTICS[\s\S]*?# END GENERATED DIAGNOSTICS\n?/,'');
const clean=vrl.replace(/# BEGIN GENERATED DIAGNOSTICS[\s\S]*?# END GENERATED DIAGNOSTICS\n?/,'').replace(codeList,(_,start,_list,end)=>start+JSON.stringify(mergedCodes).replace(/","/g,'", "')+end);
fs.writeFileSync('deploy/logging/sanitize.vrl',clean.replace('out._msg = out.event',()=>block+'\nout._msg = out.event'));
+24 -28
View File
@@ -59,14 +59,16 @@ function defaultMaskCandidateRegex(value: string): RegExp {
// generic 404. Without this, a corrupt cache, a 5xx from the streamer, an
// LFS pointer issue, and a missing file all surface to the user as the
// same `file_not_found` — which makes incidents impossible to triage.
// The request's handleError logs the result once. When the streamer answered,
// it already logged its side under the same requestId.
function streamerErrorToAnonymous(
err: Error & { response?: { statusCode?: number; body?: unknown } },
context: { repoId: string; filePath: string }
err: Error & { response?: { statusCode?: number; body?: unknown } }
): { error: AnonymousError; upstreamStatus?: number; upstreamBody?: string } {
const upstreamStatus = err?.response?.statusCode;
let errCode = "file_not_found";
let httpStatus = 404;
let upstreamBody: string | undefined;
let streamerCode = false;
if (err?.response?.body != null) {
try {
@@ -84,6 +86,7 @@ function streamerErrorToAnonymous(
const parsed = JSON.parse(upstreamBody);
if (parsed && typeof parsed.error === "string") {
errCode = parsed.error;
streamerCode = true;
}
} catch {
// body wasn't JSON — keep the default code
@@ -97,6 +100,12 @@ function streamerErrorToAnonymous(
httpStatus = upstreamStatus >= 500 ? 502 : upstreamStatus;
if (upstreamStatus >= 500 && errCode === "file_not_found") {
errCode = "streamer_upstream_error";
} else if (!streamerCode) {
// The streamer's handleError always sends a code. An uncoded 4xx came
// from something in front of it (body-size limit, ingress, wrong
// entrypoint), which is a fault, not a missing file.
errCode = "streamer_unexpected_response";
httpStatus = 502;
}
} else if (errCode === "file_not_found") {
// No HTTP response at all (connection refused, timeout, DNS) — that's
@@ -105,27 +114,14 @@ function streamerErrorToAnonymous(
httpStatus = 502;
}
logger.warn("streamer fetch failed", {
code: errCode,
const error = new AnonymousError(errCode, {
httpStatus,
repoId: context.repoId,
filePath: context.filePath,
upstreamStatus,
upstreamBody: upstreamBody?.slice(0, 500),
url: config.STREAMER_ENTRYPOINT
? join(config.STREAMER_ENTRYPOINT, "api")
: undefined,
err: serializeError(err),
cause: err,
});
return {
error: new AnonymousError(errCode, {
httpStatus,
cause: err,
}),
upstreamStatus,
upstreamBody,
};
error.upstreamStatus = upstreamStatus;
// A coded body comes from the streamer's handleError, which logged it.
error.upstreamLogged = streamerCode && typeof upstreamStatus === "number";
return { error, upstreamStatus, upstreamBody };
}
/**
@@ -434,7 +430,7 @@ export default class AnonymizedFile {
},
}));
content.on("error", err => {
const { error } = streamerErrorToAnonymous(err, { repoId: this.repository.repoId, filePath: this.anonymizedPath });
const { error } = streamerErrorToAnonymous(err);
void notifyOwnerAccessProblem(this.repository.owner.id, error, { kind: "repository", id: String(this.repository.model._id) });
});
return content;
@@ -493,7 +489,7 @@ export default class AnonymizedFile {
headersDone(true);
const { error } = streamerErrorToAnonymous(err as Error & {
response?: { statusCode?: number; body?: unknown };
}, { repoId: this.repository.repoId, filePath: this.anonymizedPath });
});
void notifyOwnerAccessProblem(this.repository.owner.id, error, { kind: "repository", id: String(this.repository.model._id) });
error.value = this;
throw error;
@@ -540,16 +536,16 @@ export default class AnonymizedFile {
const { error } = streamerErrorToAnonymous(
err as Error & {
response?: { statusCode?: number; body?: unknown };
},
{
repoId: this.repository.repoId,
filePath: this.anonymizedPath,
}
);
void notifyOwnerAccessProblem(this.repository.owner.id, error, { kind: "repository", id: String(this.repository.model._id) });
error.value = this;
// Only a response that was already streaming body bytes must be
// cut. handleError's own reply can be mid-write: express-session
// holds back its last byte until the session store touch ends.
const streaming = res.headersSent;
handleError(error, res);
if (res.headersSent && !res.writableEnded) res.destroy();
if (streaming && !res.writableEnded) res.destroy();
});
resolve();
return;
+4
View File
@@ -12,6 +12,10 @@ export default class AnonymousError extends CustomError {
value?: unknown;
httpStatus?: number;
cause?: Error;
/** Status of the internal service response this error relays. */
upstreamStatus?: number;
/** The internal service that answered already logged this failure. */
upstreamLogged?: boolean;
private explicitUrl?: string;
constructor(
+14 -6
View File
@@ -1,4 +1,5 @@
import { recordResponseFailure } from "./request-evidence";
import { watchClientClose } from "./response-cancellation";
import { createGzip } from "zlib";
import { createHash } from "crypto";
import { Readable, PassThrough } from "stream";
@@ -53,12 +54,19 @@ async function sendCached(content: Readable, res: Response,
// Install evidence before pipeline's listeners destroy the response.
const localFailure = () => { if (!res.destroyed) recordResponseFailure(res, "unknown", "local_abort"); };
stream.once("error", localFailure);
if (record.encoding === "identity" && !res.req.acceptsEncodings("identity")) {
res.setHeader("Content-Encoding", "gzip"); res.removeHeader("Content-Length");
const gzip = createGzip();
gzip.once("error", localFailure);
await pipeline(stream, gzip, res);
} else await pipeline(stream, res);
const clientClosed = watchClientClose(res, stream);
try {
if (record.encoding === "identity" && !res.req.acceptsEncodings("identity")) {
res.setHeader("Content-Encoding", "gzip"); res.removeHeader("Content-Length");
const gzip = createGzip();
gzip.once("error", localFailure);
await pipeline(stream, gzip, res);
} else await pipeline(stream, res);
} catch (error) {
// A visitor who stops a download is not a server fault.
if (clientClosed()) throw Object.assign(new Error("response_cancelled"), { cause: error });
throw error;
}
return true;
};
const decision = results.decision(key);
+3
View File
@@ -6,6 +6,7 @@ import AnonymousError from "./AnonymousError";
import CredentialModel from "./model/credentials/credentials.model";
import InstallationModel from "./model/github-installation";
import UserModel from "./model/users/users.model";
import { UserRepositorySyncModel } from "./model/user-repositories";
import { credentialCipher, getCredentialToken } from "./credentials";
import { RepositoryAccess } from "./repository-access.types";
@@ -84,6 +85,8 @@ export async function saveAppGrant(ownerId: string, data: AppTokenResponse) {
$set: tokenFields(ownerId, data), $unset: { refreshLock: "", refreshLockUntil: "" },
}, { upsert: true, runValidators: true });
await UserModel.updateOne({ _id: ownerId }, { $set: { repositories: [] } });
// A new grant may see other installations: refresh the stored picker list.
await UserRepositorySyncModel.updateOne({ ownerId, connection: "github-app" }, { $set: { needsSyncAt: new Date() } });
}
export async function appUserToken(ownerId: string): Promise<string> {
-22
View File
@@ -1,22 +0,0 @@
import { octokit } from "./GitHubUtils";
/** One upstream page per request. Search cursors resume within that page. */
export async function repositoryPickerPage(token: string, cursor = 0, query = "") {
const size = query ? 100 : 20;
const page = Math.floor(cursor / size) + 1;
const offset = cursor % size;
const response = await octokit(token).request("GET /user/repos", {
visibility: "all", sort: "full_name", direction: "asc", per_page: size, page,
});
const items: { id: number; fullName: string }[] = [];
let index = offset;
for (; index < response.data.length; index++) {
const repo = response.data[index];
if (!query || repo.full_name.toLowerCase().includes(query.toLowerCase())) {
items.push({ id: repo.id, fullName: repo.full_name });
if (items.length === 20) { index++; break; }
}
}
const hasNext = index < response.data.length || /rel="next"/.test(response.headers.link || "");
return { items, nextCursor: hasNext ? (page - 1) * size + index : null };
}
+71 -12
View File
@@ -142,6 +142,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"getToken",
"getTokenGateResetAt",
"octokit",
"ownerGitHubAccessRequired",
"rateLimitDetail",
"resolveRepositoryToken",
"run",
@@ -160,6 +161,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"getToken",
"getTokenGateResetAt",
"octokit",
"ownerGitHubAccessRequired",
"rateLimitDetail",
"resolveRepositoryToken",
"run",
@@ -984,14 +986,6 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"<anonymous>",
"isGitHubRateLimitError"
],
"src/core/github-repository-picker.ts": [
"<anonymous>",
"repositoryPickerPage"
],
"build/core/github-repository-picker.js": [
"<anonymous>",
"repositoryPickerPage"
],
"src/core/github-token-context.ts": [
"<anonymous>",
"githubQuotaKey",
@@ -1306,6 +1300,12 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"build/core/model/repository-access.schema.js": [
"<anonymous>"
],
"src/core/model/user-repositories.ts": [
"<anonymous>"
],
"build/core/model/user-repositories.js": [
"<anonymous>"
],
"src/core/model/users/users.model.ts": [
"<anonymous>"
],
@@ -1570,11 +1570,13 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
],
"src/core/response-cancellation.ts": [
"<anonymous>",
"isResponseCancellation"
"isResponseCancellation",
"watchClientClose"
],
"build/core/response-cancellation.js": [
"<anonymous>",
"isResponseCancellation"
"isResponseCancellation",
"watchClientClose"
],
"src/core/response-stream.ts": [
"<anonymous>",
@@ -1643,6 +1645,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"admitResolvedBytes",
"assertActive",
"assertDownloadUrl",
"assertHost",
"cached",
"confirmOwnerAccess",
"deferredRawDownload",
@@ -1651,6 +1654,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"downloadFile",
"downloadFileViaRaw",
"downloadRaw",
"downloadViaJsDelivr",
"downloadWithFallback",
"fallbackToRaw",
"fetchContent",
@@ -1663,9 +1667,12 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"githubRawFileUrl",
"iterateFiles",
"iterateTreeBatches",
"jsDelivrFileUrl",
"lfsPointerGuard",
"normalize",
"pMap",
"produce",
"rejectLfsPointer",
"resolve",
"resolveLfsPointer",
"stopSourceOnDestroy",
@@ -1679,6 +1686,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"admitResolvedBytes",
"assertActive",
"assertDownloadUrl",
"assertHost",
"cached",
"confirmOwnerAccess",
"deferredRawDownload",
@@ -1687,6 +1695,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"downloadFile",
"downloadFileViaRaw",
"downloadRaw",
"downloadViaJsDelivr",
"downloadWithFallback",
"fallbackToRaw",
"fetchContent",
@@ -1699,9 +1708,12 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"githubRawFileUrl",
"iterateFiles",
"iterateTreeBatches",
"jsDelivrFileUrl",
"lfsPointerGuard",
"normalize",
"pMap",
"produce",
"rejectLfsPointer",
"resolve",
"resolveLfsPointer",
"stopSourceOnDestroy",
@@ -1990,6 +2002,48 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"<anonymous>",
"joinUrl"
],
"src/core/user-repository-list.ts": [
"<anonymous>",
"acquireLock",
"appUsers",
"applyRepositoryWebhook",
"clearRepositoryList",
"date",
"escapeRegex",
"hasApp",
"installationOwners",
"markRepositoryListStale",
"pickerConnection",
"repositoryListPage",
"retryDelay",
"runSync",
"settleRepositorySyncs",
"startRepositorySync",
"toRow",
"upsertRows",
"upstreamPages"
],
"build/core/user-repository-list.js": [
"<anonymous>",
"acquireLock",
"appUsers",
"applyRepositoryWebhook",
"clearRepositoryList",
"date",
"escapeRegex",
"hasApp",
"installationOwners",
"markRepositoryListStale",
"pickerConnection",
"repositoryListPage",
"retryDelay",
"runSync",
"settleRepositorySyncs",
"startRepositorySync",
"toRow",
"upsertRows",
"upstreamPages"
],
"src/core/zipStream.ts": [
"<anonymous>",
"fail",
@@ -2623,6 +2677,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"src/server/routes/route-utils.ts": [
"<anonymous>",
"ensureUrl",
"errorLogLevel",
"explicitErrorStatus",
"extendExpirationDate",
"getGist",
@@ -2640,6 +2695,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
"build/server/routes/route-utils.js": [
"<anonymous>",
"ensureUrl",
"errorLogLevel",
"explicitErrorStatus",
"extendExpirationDate",
"getGist",
@@ -2918,12 +2974,15 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
],
"src/streamer/route.ts": [
"<anonymous>",
"handleStreamError"
"handleStreamError",
"replyError"
],
"build/streamer/route.js": [
"<anonymous>",
"handleStreamError"
"handleStreamError",
"replyError"
]
};
export const LOG_ERROR_TYPES = ["Error","TypeError","RangeError","ReferenceError","SyntaxError","URIError","EvalError","AggregateError","AnonymousError","HTTPError","RequestError","MongoServerError","MongoNetworkError","MongoServerSelectionError","ValidationError","TimeoutError","AbortError","UnknownError"];
export const LOG_ROUTES = ["/","other","/dashboard","/anonymize","/healthcheck","/api/healthcheck","/api","/api/download","/api/stat","/api/stat/history","/api/options","/api/message","/api/user","/api/user/quota","/api/user/dashboard","/api/repo","/api/anonymize-preview","/api/admin/overview","/api/admin/performance","/api/admin/errors","/api/admin/errors/stats","/api/admin/queues","/api/admin/queues/metrics","/github/app/webhook","/api/repo/:repoId","/api/repo/:repoId/file/:path","/api/repo/:repoId/files","/api/repo/:repoId/files/counts","/api/repo/:repoId/files/search","/api/repo/:repoId/zip","/api/repo/:repoId/options","/api/repo/:repoId/refresh","/api/repo/:repoId/coauthors","/api/repo/:repoId/extend","/api/repo/:owner/:repo","/api/repo/:owner/:repo/tree","/api/repo/:owner/:repo/file","/api/repo/:owner/:repo/readme","/api/repo/:owner/:repo/branches","/w/:repoId/:path","/r/:repoId/:path","/api/pr/:id/:path","/api/gist/:id/:path","/assets/:path","/github/:action","/api/admin/:action","/api/user/:action","/api/repo/:id/file/:path","/api/repo/:id/files/counts","/api/repo/:id/files/search","/api/repo/:id/files","/api/repo/:id/zip","/api/repo/:id","/viewer/:id/:path","/api/billing","/api/billing/draft","/api/billing/draft/:id","/api/billing/checkout","/api/billing/portal","/api/billing/refresh","/api/billing/webhook","/api/conferences/plans","/profile","/conference/:id"];
export const LOG_THROWN_ERROR_CODES = ["another_login_required","billing_address_missing","billing_already_paid","billing_busy","billing_checkout_disabled","billing_checkout_in_progress","billing_city_missing","billing_country_missing","billing_customer_mismatch","billing_draft_not_found","billing_email_missing","billing_invalid_conference","billing_invalid_draft","billing_invalid_purchase","billing_invalid_repository_size","billing_invalid_review_window","billing_missing","billing_name_missing","billing_plan_change_not_supported","billing_plan_unavailable","billing_price_misconfigured","billing_recovery_required","billing_review_window_locked","billing_subscription_exists","billing_unavailable","billing_zip_missing","branch_not_found","branch_not_specified","cache_busy","cache_miss","cannot_coauthor_self","commit_not_found","commit_not_specified","conf_end_date_invalid","conf_end_date_missing","conf_id_missing","conf_id_used","conf_name_missing","conf_not_activated","conf_not_found","conf_start_date_invalid","conf_start_date_missing","conference_not_found","conference_payment_required","connection_changed","download_not_enabled","expiration_limit_reached","file_listing_too_large","file_not_accessible","file_not_found","file_not_supported","file_too_big","folder_not_supported","gistId_already_used","gistId_not_specified","gist_expired","gist_not_available","gist_not_found","gist_not_ready","github_app_access_required","github_app_authorization_cancelled","github_app_disabled","github_app_permissions_invalid","github_app_reconnect_required","github_app_refresh_busy","github_grant_revocation_failed","github_identity_mismatch","github_oauth_required","github_rate_limit_exceeded","github_unavailable","github_user_not_found","invalid_auth_state","invalid_billing_expiration","invalid_commit_format","invalid_connection","invalid_cursor","invalid_file_path","invalid_gistId","invalid_github_path","invalid_path","invalid_plan","invalid_preserve_files_format","invalid_project_name","invalid_pullRequestId","invalid_repo","invalid_repoId","invalid_request","invalid_settings","invalid_sort","invalid_status","invalid_terms_format","invalid_token_id","invalid_token_options","is_removed","not_authorized","not_connected","not_owner","oauth_resources_remaining","options_not_provided","page_not_activated","page_not_supported_on_different_branch","path_not_defined","path_not_specified","pullRequestId_already_used","pullRequestId_is_not_a_number","pullRequestId_not_specified","pull_request_expired","pull_request_not_available","pull_request_not_found","pull_request_not_ready","quota_exceeded","quota_repository_limit","quota_storage_limit","rate_limited","readme_not_available","repoId_already_used","repoId_not_defined","repoUrl_not_defined","repo_access_limited","repo_empty","repo_not_accessible","repo_not_found","repo_saml_enforcement","repository_archived","repository_busy","repository_changed","repository_expired","repository_job_cancelled","repository_not_accessible","repository_not_ready","repository_not_specified","repository_tree_incomplete","repository_tree_too_large","s3_config_not_provided","source_not_provided","storage_delete_failed","storage_write_size_mismatch","streamer_route_not_found","streamer_unexpected_response","streamer_unreachable","streamer_upstream_error","submodule_not_available","subscription_required_for_never_expiration","sync_failed","terms_not_specified","token_expired","token_limit_reached","unable_to_connect_user","unable_to_download","upstream_error","user_banned","user_not_found","username_not_defined","zip_not_available","zip_unsafe_entry_path"];
+5 -4
View File
@@ -1,7 +1,7 @@
import { ANONYMIZATION_ERRORS } from "./anonymization-errors";
import { requestReproduction, safeReproductionPath } from "./log-reproduction";
import { safeDiagnosticFields, errorDiagnostics } from "./log-diagnostics";
import { LOG_ROUTES } from "./log-diagnostic-schema";
import { LOG_ROUTES, LOG_THROWN_ERROR_CODES } from "./log-diagnostic-schema";
import { LOG_MODULES, ERROR_CODES, LOG_EVENTS } from "./log-schema";
import { randomUUID } from "crypto";
import { logContext, validTraceId } from "./log-context";
@@ -17,8 +17,9 @@ const events: Record<string, string> = {
"process heartbeat": "process_heartbeat", "job started": "job_started", "job completed": "job_completed",
"job failed": "job_failed", "job stalled": "job_stalled", "queue heartbeat": "queue_heartbeat",
};
const errorCodes = new Set([
...ERROR_CODES, ...ANONYMIZATION_ERRORS, "zip_unsafe_entry_path",
// LOG_THROWN_ERROR_CODES is generated from the codes the source throws.
export const LOG_ERROR_CODES: ReadonlySet<string> = new Set([
...ERROR_CODES, ...ANONYMIZATION_ERRORS, ...LOG_THROWN_ERROR_CODES, "zip_unsafe_entry_path",
"repo_renamed", "preparation_interrupted", "commit_not_found", "zip_not_available", "token_refresh_failed", "quota_exceeded", "quota_repository_limit", "quota_storage_limit", "github_rate_limit_exceeded", "github_app_reconnect_required", "github_token_invalid",
"repository_expired", "repository_not_ready", "repository_not_found", "repository_job_cancelled",
"ECONNRESET", "ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND", "EPIPE", "ABORT_ERR",
@@ -57,7 +58,7 @@ export function logRecord(level: string, module: string, args: unknown[]) {
}
if (Number.isSafeInteger(context.attempt)) record.attempt = context.attempt;
for (const key of LOG_NUMBERS) if (typeof details[key] === "number" && Number.isFinite(details[key])) record[key] = details[key];
const code = [details.code, details.message].find(value => typeof value === "string" && errorCodes.has(value));
const code = [details.code, details.message].find(value => typeof value === "string" && LOG_ERROR_CODES.has(value));
if (code) record.errorCode = code;
if (allowed(["protocol", "credentials", "port", "host"], details.reason)) record.reason = details.reason;
if (allowed(["parse", "find_grant_owners", "reconcile_grant", "persist_installation_block", "reconcile_installation"], details.phase)) record.phase = details.phase;
+2
View File
@@ -325,6 +325,7 @@ type ErrorLike = {
stack?: string;
status?: number;
httpStatus?: number;
upstreamStatus?: number;
code?: string | number;
cause?: unknown;
request?: { url?: string; method?: string };
@@ -353,6 +354,7 @@ export function serializeError(err: unknown, seen = new WeakSet<object>(), depth
// AnonymousError carries an httpStatus and an inner cause.
if (typeof e.httpStatus === "number") out.httpStatus = e.httpStatus;
if (typeof e.upstreamStatus === "number") out.upstreamStatus = e.upstreamStatus;
// Octokit's deprecated `code` getter emits a stack on every read. Only
// inspect data properties so logging never invokes that getter.
const code = Object.getOwnPropertyDescriptor(e, "code")?.value;
+53
View File
@@ -0,0 +1,53 @@
import { model, Schema } from "mongoose";
export type RepositoryConnection = "oauth" | "github-app";
/**
* One GitHub repository a user can pick on the anonymize page, as seen through
* one connection. The landing picker pages and searches these rows instead of
* calling GitHub. Rows are written by a full sync (`syncId`) and by App
* webhooks (`syncedAt`), so a sync only removes rows it did not see that no
* webhook touched after the sync started.
*/
const schema = new Schema({
ownerId: { type: String, required: true },
connection: { type: String, enum: ["oauth", "github-app"], required: true },
repositoryId: { type: Number, required: true },
fullName: { type: String, required: true },
/** Lower-case `fullName`, used for sorting and substring search. */
nameKey: { type: String, required: true },
private: Boolean,
defaultBranch: String,
githubUpdatedAt: Date,
pushedAt: Date,
/** App rows only: the installation that grants access. */
installationId: Number,
/** Hidden while the installation is suspended; restored on unsuspend. */
suspended: { type: Boolean, default: undefined },
syncId: String,
syncedAt: { type: Date, required: true },
});
schema.index({ ownerId: 1, connection: 1, repositoryId: 1 }, { unique: true });
// Matches the picker sort, so a page never sorts in memory.
schema.index({ ownerId: 1, connection: 1, nameKey: 1, repositoryId: 1 });
schema.index({ repositoryId: 1 });
schema.index({ installationId: 1 }, { partialFilterExpression: { installationId: { $exists: true } } });
export const UserRepositoryModel = model("UserRepository", schema);
/** Per user and connection: when the list was last complete, and the sync lock. */
const syncSchema = new Schema({
ownerId: { type: String, required: true },
connection: { type: String, enum: ["oauth", "github-app"], required: true },
/** Last time a full sync finished. Absent until the first one completes. */
syncedAt: Date,
lockId: String,
lockUntil: Date,
startedAt: Date,
/** Set by installation changes; a sync started after it clears it. */
needsSyncAt: Date,
/** GitHub asked us to slow down: no sync before this time. */
retryAfter: Date,
error: String,
});
syncSchema.index({ ownerId: 1, connection: 1 }, { unique: true });
export const UserRepositorySyncModel = model("UserRepositorySync", syncSchema);
+16
View File
@@ -14,3 +14,19 @@ export function isResponseCancellation(error: unknown, response?: { destroyed?:
}
return false;
}
/**
* pipeline() rejects with ERR_STREAM_PREMATURE_CLOSE both when the client goes
* away and when the source ends early. Call before piping; the returned check
* is true only when the response closed unfinished before the source failed.
*/
export function watchClientClose(response: { writableFinished?: boolean; once(event: "close", listener: () => void): unknown },
source: { readableEnded?: boolean; once(event: "close" | "error", listener: () => void): unknown }): () => boolean {
let sourceFailed = false;
let clientClosed = false;
source.once("error", () => { sourceFailed = true; });
// A source that closes without ending was cut short.
source.once("close", () => { if (!source.readableEnded) sourceFailed = true; });
response.once("close", () => { if (!sourceFailed && !response.writableFinished) clientClosed = true; });
return () => clientClosed;
}
+349
View File
@@ -0,0 +1,349 @@
import { randomUUID } from "crypto";
import config from "../config";
import { octokit } from "./GitHubUtils";
import { isGitHubRateLimitError } from "./github-rate-limit";
import { APP_PROVIDER, appError, appUserToken, githubRequest, GitHubRepositoryInfo, userInstallations } from "./github-app";
import { getCredentialToken } from "./credentials";
import CredentialModel from "./model/credentials/credentials.model";
import UserModel from "./model/users/users.model";
import { RepositoryConnection, UserRepositoryModel, UserRepositorySyncModel } from "./model/user-repositories";
import { createLogger, serializeError } from "./logger";
const logger = createLogger("user-repository-list");
export const PAGE_SIZE = 20;
/** A sync holds its lock this long past its last page; a crashed sync is taken over after it. */
const LOCK_MS = 60_000;
/** The first request waits this long for the first upstream page of an empty list. */
const FIRST_PAGE_WAIT_MS = 10_000;
/** Ignore forced refreshes this soon after a completed sync. */
const FORCE_MIN_INTERVAL_MS = 10_000;
/** An empty list that synced recently is a user with no repositories, not a missing list. */
const EMPTY_RECHECK_MS = 5 * 60_000;
/** Webhooks miss some changes (new org installs, OAuth lists); resync in the background after this. */
const STALE_MS = 12 * 60 * 60_000;
/** Default pause after a rate-limit response without a reset time. */
const RATE_LIMIT_PAUSE_MS = 60_000;
/** Bound a runaway pagination: 100,000 repositories. */
const MAX_PAGES = 1000;
type Upstream = Pick<GitHubRepositoryInfo, "id" | "full_name"> & Partial<GitHubRepositoryInfo> & {
updated_at?: string | null; pushed_at?: string | null;
};
interface Row {
repositoryId: number; fullName: string; nameKey: string; private?: boolean; defaultBranch?: string;
githubUpdatedAt?: Date; pushedAt?: Date; installationId?: number;
}
const date = (value: unknown) => {
const time = typeof value === "string" ? Date.parse(value) : NaN;
return Number.isFinite(time) ? new Date(time) : undefined;
};
function toRow(repo: Upstream, installationId?: number): Row | null {
if (!Number.isSafeInteger(repo?.id) || typeof repo.full_name !== "string" || !/^[^/\s]+\/[^/\s]+$/.test(repo.full_name)) return null;
const row: Row = { repositoryId: repo.id, fullName: repo.full_name, nameKey: repo.full_name.toLowerCase() };
if (typeof repo.private === "boolean") row.private = repo.private;
if (typeof repo.default_branch === "string") row.defaultBranch = repo.default_branch;
const updated = date(repo.updated_at), pushed = date(repo.pushed_at);
if (updated) row.githubUpdatedAt = updated;
if (pushed) row.pushedAt = pushed;
if (Number.isSafeInteger(installationId)) row.installationId = installationId;
return row;
}
async function upsertRows(ownerId: string, connection: RepositoryConnection, rows: Row[], syncId?: string) {
if (!rows.length) return;
const now = new Date();
await UserRepositoryModel.bulkWrite(rows.map(row => ({ updateOne: {
filter: { ownerId, connection, repositoryId: row.repositoryId },
update: { $set: { ...row, syncedAt: now, ...(syncId ? { syncId } : {}) }, $unset: { suspended: "" } },
upsert: true,
} })), { ordered: false });
}
/** Pages of the repositories one connection can see, in a stable order. */
async function* upstreamPages(ownerId: string, connection: RepositoryConnection): AsyncGenerator<Row[]> {
if (connection === "oauth") {
const token = await getCredentialToken(ownerId);
if (!token) throw appError("github_oauth_required", 401);
for (let page = 1; page <= MAX_PAGES; page++) {
const response = await octokit(token).request("GET /user/repos", {
visibility: "all", sort: "full_name", direction: "asc", per_page: 100, page,
});
yield (response.data as Upstream[]).map(r => toRow(r)).filter((r): r is Row => !!r);
if (response.data.length < 100 || !/rel="next"/.test(response.headers.link || "")) return;
}
return;
}
const installations = await userInstallations(ownerId);
let yielded = false;
for (const installation of installations) {
if (installation.suspended_at) continue;
for (let page = 1; page <= MAX_PAGES; page++) {
const data = await githubRequest<{ repositories: Upstream[] }>(
`/user/installations/${installation.id}/repositories?per_page=100&page=${page}`, await appUserToken(ownerId));
yielded = true;
yield data.repositories.map(r => toRow(r, installation.id)).filter((r): r is Row => !!r);
if (data.repositories.length < 100) break;
}
}
if (!yielded) yield [];
}
function retryDelay(error: unknown): number | null {
if (error instanceof Error && error.message === "github_rate_limit_exceeded") return RATE_LIMIT_PAUSE_MS;
if (!isGitHubRateLimitError(error)) return null;
const headers = (error as { response?: { headers?: Record<string, string | undefined> } }).response?.headers || {};
const retry = Number(headers["retry-after"]);
if (Number.isFinite(retry) && retry > 0) return retry * 1000;
const reset = Number(headers["x-ratelimit-reset"]) * 1000;
if (Number.isFinite(reset) && reset > Date.now()) return Math.min(reset - Date.now(), 3600_000);
return RATE_LIMIT_PAUSE_MS;
}
async function acquireLock(ownerId: string, connection: RepositoryConnection) {
const lockId = randomUUID();
const startedAt = new Date();
try {
const row = await UserRepositorySyncModel.findOneAndUpdate(
{ ownerId, connection, $or: [{ lockUntil: { $exists: false } }, { lockUntil: null }, { lockUntil: { $lt: startedAt } }] },
{ $set: { lockId, lockUntil: new Date(startedAt.getTime() + LOCK_MS), startedAt } },
{ upsert: true, new: true }).lean();
return row?.lockId === lockId ? { lockId, startedAt } : null;
} catch (error) {
// The upsert races an existing, locked row: someone else is syncing.
if ((error as { code?: number })?.code === 11000) return null;
throw error;
}
}
async function runSync(ownerId: string, connection: RepositoryConnection, lock: { lockId: string; startedAt: Date }, firstPage: () => void) {
const { lockId, startedAt } = lock;
try {
for await (const rows of upstreamPages(ownerId, connection)) {
await upsertRows(ownerId, connection, rows, lockId);
const kept = await UserRepositorySyncModel.updateOne({ ownerId, connection, lockId },
{ $set: { lockUntil: new Date(Date.now() + LOCK_MS) } });
if (!kept.matchedCount) return; // Another process took over a stalled lock.
firstPage();
}
// Drop what this sync did not see, unless a webhook wrote it after the sync began.
await UserRepositoryModel.deleteMany({ ownerId, connection, syncId: { $ne: lockId }, syncedAt: { $lt: startedAt } });
await UserRepositorySyncModel.updateOne({ ownerId, connection, lockId },
{ $set: { syncedAt: new Date() }, $unset: { lockId: "", lockUntil: "", error: "", retryAfter: "" } });
await UserRepositorySyncModel.updateOne({ ownerId, connection, needsSyncAt: { $lte: startedAt } }, { $unset: { needsSyncAt: "" } });
} catch (error) {
const delay = retryDelay(error);
const code = delay !== null ? "github_rate_limit_exceeded" : error instanceof Error && /^[a-z_]{1,64}$/.test(error.message) ? error.message : "sync_failed";
await UserRepositorySyncModel.updateOne({ ownerId, connection, lockId }, {
$set: { error: code, ...(delay !== null ? { retryAfter: new Date(Date.now() + delay) } : {}) },
$unset: { lockId: "", lockUntil: "" },
});
throw error;
}
}
const running = new Map<string, Promise<void>>();
/**
* Start a sync unless one is running for this list (in this process or, via the
* Mongo lock, in another). Returns null when one is already running, otherwise
* `first`, a promise that resolves once the first page is stored (or rejects if the sync
* fails before it). The rest of the pages continue in the background.
*/
export async function startRepositorySync(ownerId: string, connection: RepositoryConnection): Promise<{ first: Promise<void> } | null> {
const key = `${ownerId}:${connection}`;
if (running.has(key)) return null;
const lock = await acquireLock(ownerId, connection);
if (!lock) return null;
let resolveFirst!: () => void, rejectFirst!: (error: unknown) => void;
const first = new Promise<void>((resolve, reject) => { resolveFirst = resolve; rejectFirst = reject; });
first.catch(() => { /* callers that do not wait for the first page */ });
const work = runSync(ownerId, connection, lock, resolveFirst)
.then(() => resolveFirst(), error => {
rejectFirst(error);
logger.warn("repository list sync failed", { connection, ...serializeError(error) });
})
.finally(() => running.delete(key));
running.set(key, work);
return { first };
}
/** For tests: wait for this process's background syncs. */
export async function settleRepositorySyncs() {
while (running.size) await Promise.all([...running.values()]);
}
/** Which stored list the picker reads, mirroring how the picker chose a token. */
export async function pickerConnection(ownerId: string, requested?: unknown): Promise<RepositoryConnection | null> {
const hasApp = async () => config.GITHUB_APP_ENABLED &&
!!(await CredentialModel.exists({ ownerId, provider: APP_PROVIDER, revoked: { $ne: true } }));
if (requested === "github-app") return await hasApp() ? "github-app" : null;
if (await getCredentialToken(ownerId)) return "oauth";
if (requested === "oauth") return null;
return await hasApp() ? "github-app" : null;
}
const escapeRegex = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
/**
* One picker page from the stored list. Fetches from GitHub only when the list
* is empty, when forced, or after an installation change.
*/
export async function repositoryListPage(ownerId: string, connection: RepositoryConnection, opts: { cursor?: number; query?: string; force?: boolean } = {}) {
const cursor = opts.cursor || 0;
const query = (opts.query || "").toLowerCase();
const [state, hasRows] = await Promise.all([
UserRepositorySyncModel.findOne({ ownerId, connection }).lean(),
UserRepositoryModel.exists({ ownerId, connection }),
]);
const now = Date.now();
const lastSync = state?.syncedAt?.getTime() || 0;
const wanted = !lastSync || !!state?.needsSyncAt
|| (opts.force === true && now - lastSync >= FORCE_MIN_INTERVAL_MS)
|| (!hasRows && now - lastSync >= EMPTY_RECHECK_MS)
|| now - lastSync >= STALE_MS;
const paused = !!state?.retryAfter && state.retryAfter.getTime() > now;
if (wanted && !paused) {
const started = await startRepositorySync(ownerId, connection);
if (started && !hasRows) {
// Return the first page quickly; a large account keeps paginating behind it.
let timer: NodeJS.Timeout | undefined;
await Promise.race([started.first, new Promise(resolve => { timer = setTimeout(resolve, FIRST_PAGE_WAIT_MS); })])
.catch(error => { throw retryDelay(error) !== null ? appError("github_rate_limit_exceeded", 429) : error; })
.finally(() => clearTimeout(timer));
}
} else if (paused && !hasRows) {
throw appError("github_rate_limit_exceeded", 429);
}
const filter: Record<string, unknown> = { ownerId, connection, suspended: { $ne: true } };
if (query) filter.nameKey = { $regex: escapeRegex(query) };
const rows = await UserRepositoryModel.find(filter).sort({ nameKey: 1, repositoryId: 1 })
.skip(cursor).limit(PAGE_SIZE + 1).select("repositoryId fullName private").lean();
const current = await UserRepositorySyncModel.findOne({ ownerId, connection }).select("syncedAt lockUntil").lean();
return {
items: rows.slice(0, PAGE_SIZE).map(r => ({ id: r.repositoryId, fullName: r.fullName, private: r.private })),
nextCursor: rows.length > PAGE_SIZE ? cursor + PAGE_SIZE : null,
syncedAt: current?.syncedAt || null,
syncing: !!current?.lockUntil && current.lockUntil.getTime() > Date.now(),
// Only App connections receive webhooks; OAuth lists change on refresh.
webhooks: connection === "github-app",
};
}
/** Forget a connection's stored list, e.g. when its grant is revoked. */
export async function clearRepositoryList(ownerId: string, connection: RepositoryConnection) {
await UserRepositoryModel.deleteMany({ ownerId, connection });
await UserRepositorySyncModel.deleteMany({ ownerId, connection });
}
/** The next picker load syncs this App list in the background. */
export async function markRepositoryListStale(ownerIds: string[], connection: RepositoryConnection = "github-app") {
const ids = [...new Set(ownerIds)];
if (!ids.length) return;
await UserRepositorySyncModel.updateMany({ ownerId: { $in: ids }, connection }, { $set: { needsSyncAt: new Date() } });
}
// ---- GitHub App webhooks ----------------------------------------------------
interface WebhookBody {
action?: string;
installation?: { id?: number; account?: { id?: number; type?: string } };
sender?: { id?: number };
repositories?: Upstream[];
repositories_added?: Upstream[];
repositories_removed?: Upstream[];
repository_selection?: string;
repository?: Upstream;
}
/** Local users behind GitHub accounts, limited to those with an App grant. */
async function appUsers(githubIds: unknown[]): Promise<string[]> {
const ids = [...new Set(githubIds.filter(id => Number.isSafeInteger(id)).map(String))];
if (!ids.length) return [];
const users = await UserModel.find({ "externalIDs.github": { $in: ids } }).select("_id").lean();
const owners = users.map(u => String(u._id));
if (!owners.length) return [];
const granted = await CredentialModel.find({ ownerId: { $in: owners }, provider: APP_PROVIDER, revoked: { $ne: true } })
.select("ownerId").lean();
return [...new Set(granted.map(c => String(c.ownerId)))];
}
async function installationOwners(installationId: number): Promise<string[]> {
return (await UserRepositoryModel.distinct("ownerId", { connection: "github-app", installationId })).map(String);
}
/**
* Apply one verified App webhook to the stored lists. Every branch is a set,
* upsert or delete keyed by GitHub ids, so redelivery is harmless.
*
* Users named by the event (the sender, or the personal account that owns the
* installation) get the change directly. Other users of an installation only
* get removals and metadata updates; additions are left to a background sync,
* because only GitHub knows whether they can see a newly added private repository.
*/
export async function applyRepositoryWebhook(event: string, body: WebhookBody) {
const installationId = body.installation?.id;
const action = body.action;
const personal = body.installation?.account?.type === "User" ? body.installation.account.id : undefined;
if (event === "installation" && Number.isSafeInteger(installationId)) {
if (action === "deleted") {
await UserRepositoryModel.deleteMany({ connection: "github-app", installationId });
} else if (action === "suspend") {
await UserRepositoryModel.updateMany({ connection: "github-app", installationId }, { $set: { suspended: true } });
} else if (action === "unsuspend") {
const owners = await installationOwners(installationId!);
await UserRepositoryModel.updateMany({ connection: "github-app", installationId }, { $unset: { suspended: "" } });
await markRepositoryListStale([...owners, ...await appUsers([body.sender?.id, personal])]);
} else if (action === "created" || action === "new_permissions_accepted") {
const direct = await appUsers([body.sender?.id, personal]);
const rows = (body.repositories || []).map(r => toRow(r, installationId)).filter((r): r is Row => !!r);
for (const ownerId of direct) await upsertRows(ownerId, "github-app", rows);
await markRepositoryListStale(direct);
}
return;
}
if (event === "installation_repositories" && Number.isSafeInteger(installationId)) {
const removed = (body.repositories_removed || []).map(r => r.id).filter(id => Number.isSafeInteger(id));
if (removed.length) {
await UserRepositoryModel.deleteMany({ connection: "github-app", installationId, repositoryId: { $in: removed } });
}
const added = (body.repositories_added || []).map(r => toRow(r, installationId)).filter((r): r is Row => !!r);
if (added.length) {
const direct = await appUsers([body.sender?.id, personal]);
for (const ownerId of direct) await upsertRows(ownerId, "github-app", added);
const others = (await installationOwners(installationId!)).filter(id => !direct.includes(id));
// Rows from the payload lack the default branch; switching to "all" can add many.
await markRepositoryListStale([...others, ...(body.repository_selection === "all" ? direct : [])]);
}
return;
}
if (event === "repository" && body.repository && Number.isSafeInteger(body.repository.id)) {
const repositoryId = body.repository.id;
if (action === "deleted") {
await UserRepositoryModel.deleteMany({ repositoryId });
return;
}
const row = toRow(body.repository, installationId);
if (!row) return;
if (action === "created") {
if (!Number.isSafeInteger(installationId)) return;
const direct = await appUsers([body.sender?.id]);
for (const ownerId of direct) await upsertRows(ownerId, "github-app", [row]);
await markRepositoryListStale((await installationOwners(installationId!)).filter(id => !direct.includes(id)));
return;
}
if (["renamed", "transferred", "privatized", "publicized", "edited"].includes(action || "")) {
const { installationId: _ignored, repositoryId: _id, ...fields } = row;
// Never let a delayed delivery undo a newer change.
const fresh = row.githubUpdatedAt
? { $or: [{ githubUpdatedAt: { $exists: false } }, { githubUpdatedAt: null }, { githubUpdatedAt: { $lte: row.githubUpdatedAt } }] }
: {};
await UserRepositoryModel.updateMany({ repositoryId, ...fresh }, { $set: fields });
if (action === "transferred" || action === "privatized") {
// Access may have changed with the owner or visibility; let GitHub decide.
const owners = (await UserRepositoryModel.distinct("ownerId", { repositoryId, connection: "github-app" })).map(String);
await markRepositoryListStale(owners);
}
}
}
}
+3
View File
@@ -1,5 +1,6 @@
import { installDatabaseTiming } from "../core/database-timing";
import InstallationModel from "../core/model/github-installation";
import { UserRepositoryModel, UserRepositorySyncModel } from "../core/model/user-repositories";
import { credentialCipher } from "../core/credentials";
import CredentialModel from "../core/model/credentials/credentials.model";
import mongoose, { ConnectOptions } from "mongoose";
@@ -37,6 +38,8 @@ export async function connect(overrides: Pick<ConnectOptions, "appName" | "maxPo
await mongoose.connect(getMongoUrl(), options);
await CredentialModel.createIndexes();
if (config.GITHUB_APP_ENABLED) await InstallationModel.createIndexes();
await UserRepositoryModel.createIndexes();
await UserRepositorySyncModel.createIndexes();
await initializeOwnerAccessAlerts();
isConnected = true;
+16 -1
View File
@@ -16,6 +16,7 @@ import { getCredentialToken } from "../../core/credentials";
import { APP_PROVIDER, appError, appUserToken, AppInstallation, clearAppTokenCache, exchangeAppToken,
githubRequest, GitHubRepositoryInfo, reconcileAppGrant, reconcileInstallation, installationURL, saveAppGrant, selectRepositoryAccess, userInstallations } from "../../core/github-app";
import { explicitErrorStatus, getUser, handleError } from "./route-utils";
import { applyRepositoryWebhook, clearRepositoryList, markRepositoryListStale } from "../../core/user-repository-list";
import { isDisabledAccount, safeAuthReturnTo } from "./auth-utils";
type Flow = { state: string; expires: number; ownerId?: string; returnTo: string; repository?: string; install?: boolean };
@@ -156,6 +157,7 @@ router.get("/app/setup", enabled, async (req, res) => {
await resetOwnerAccessAlerts(user.id);
}
await UserModel.updateOne({ _id: user.id }, { $set: { repositories: [] } });
await markRepositoryListStale([user.id]);
res.redirect(flow.returnTo);
} catch (error) { handleError(error, res, req); }
});
@@ -275,6 +277,8 @@ export async function revokeGrant(ownerId: string, provider: "github" | "github-
const token = await getCredentialToken(ownerId, provider);
const clientId = provider === "github" ? config.CLIENT_ID : config.GITHUB_APP_CLIENT_ID;
const clientSecret = provider === "github" ? config.CLIENT_SECRET : config.GITHUB_APP_CLIENT_SECRET;
// Before the GitHub call: a failed revoke must not keep private repo names.
await clearRepositoryList(ownerId, provider === "github" ? "oauth" : "github-app");
if (token) {
const response = await fetch(`https://api.github.com/applications/${clientId}/grant`, { method: "DELETE",
headers: { Authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString("base64")}`, "Content-Type": "application/json", Accept: "application/vnd.github+json" },
@@ -321,7 +325,12 @@ githubAppWebhook.post("/", express.raw({ type: "application/json", limit: "2mb"
phase = "find_grant_owners";
const users = await UserModel.find({ "externalIDs.github": String(body.sender.id) }).select("_id").lean();
phase = "reconcile_grant";
for (const user of users) await reconcileAppGrant(String(user._id));
for (const user of users) {
await reconcileAppGrant(String(user._id));
// Private repository names must not outlive the grant; a live grant
// simply resyncs on the next picker load.
await clearRepositoryList(String(user._id), "github-app");
}
}
if (["installation", "installation_repositories"].includes(String(event)) && Number.isSafeInteger(body.installation?.id) && String(body.installation.app_id) === config.GITHUB_APP_ID) {
const installation = body.installation as AppInstallation;
@@ -336,6 +345,12 @@ githubAppWebhook.post("/", express.raw({ type: "application/json", limit: "2mb"
phase = "reconcile_installation";
if (body.action !== "deleted") await reconcileInstallation(installation.id, revision);
}
if (["installation", "installation_repositories", "repository"].includes(String(event))) {
// After the installation block: a failed picker write must never leave a
// deleted or suspended installation usable. The lists also resync by age.
phase = "update_repository_lists";
await applyRepositoryWebhook(String(event), body);
}
return res.status(204).end();
} catch (error) {
const delivery = req.headers["x-github-delivery"];
+12 -22
View File
@@ -17,13 +17,10 @@ import { RepositoryStatus } from "../../core/types";
import User from "../../core/User";
import { streamAnonymizedZip } from "../../core/zipStream";
import FileModel from "../../core/model/files/files.model";
import { createLogger, serializeError } from "../../core/logger";
import { githubTokenForStreamer } from "../../core/github-token-context";
import gh = require("parse-github-url");
import { requestHeaders, startStage } from "../../core/request-monitoring";
const logger = createLogger("repository-public");
const router = express.Router();
router.get(
@@ -94,6 +91,7 @@ router.get(
headersDone(true);
const upstreamStatus = err?.response?.statusCode;
let upstreamBody: string | undefined;
let streamerCode = false;
let errCode = "zip_not_available";
let httpStatus = 502;
if (err?.response?.body != null) {
@@ -112,6 +110,7 @@ router.get(
const parsed = JSON.parse(upstreamBody);
if (parsed && typeof parsed.error === "string") {
errCode = parsed.error;
streamerCode = true;
}
} catch {
/* not JSON */
@@ -121,26 +120,17 @@ router.get(
if (typeof upstreamStatus === "number") {
httpStatus = upstreamStatus >= 500 ? 502 : upstreamStatus;
}
logger.warn("streamer zip fetch failed", {
code: errCode,
httpStatus,
repoId: repo.repoId,
upstreamStatus,
upstreamBody: upstreamBody?.slice(0, 500),
url: config.STREAMER_ENTRYPOINT
? join(config.STREAMER_ENTRYPOINT, "api/download")
: undefined,
err: serializeError(err),
});
const streaming = res.headersSent;
handleError(
new AnonymousError(errCode, {
url: req.originalUrl,
httpStatus,
cause: err,
}),
res
);
const error = new AnonymousError(errCode, {
url: req.originalUrl,
httpStatus,
cause: err,
});
error.upstreamStatus = upstreamStatus;
// A coded body comes from the streamer's handleError, which
// already logged this failure under the same requestId.
error.upstreamLogged = streamerCode && typeof upstreamStatus === "number";
handleError(error, res);
// Once ZIP bytes have been sent, handleError cannot send JSON.
// Terminate the truncated response so the client reports failure
// instead of waiting forever for the ZIP's central directory.
+43 -16
View File
@@ -184,8 +184,44 @@ export function explicitErrorStatus(error: unknown): number | undefined {
.find(status => Number.isInteger(status) && status! >= 400 && status! <= 599);
}
// Request end states that need no operator action: the visitor asked for
// something that is gone, expired, unsupported or not theirs. They are logged
// at info so the admin Errors page (warn and error) keeps to faults. Rate
// limits, expired owner tokens and upstream failures are left out on purpose.
export const EXPECTED_CLIENT_ERRORS: ReadonlySet<string> = new Set([
"repo_not_found", "repository_not_found", "commit_not_found", "branch_not_found",
"file_not_found", "folder_not_supported", "file_not_supported", "file_too_big",
"readme_not_available", "submodule_not_available",
"repository_expired", "repository_archived", "repository_not_ready", "is_removed",
"github_app_access_required", "not_connected", "not_authorized",
"page_not_activated", "page_not_supported_on_different_branch", "download_not_enabled",
"gist_not_found", "gist_expired", "gist_not_ready",
"pull_request_not_found", "pull_request_expired", "pull_request_not_ready",
"conf_not_found", "conference_not_found", "repoId_already_used", "invalid_repoId",
]);
export type ErrorLogOptions = {
/** The reply goes to another service that logs the request's end state. */
internal?: boolean;
};
type LogLevel = "debug" | "info" | "warn" | "error";
/** One record per failed request, at a level that matches who has to act. */
export function errorLogLevel(error: unknown, options: ErrorLogOptions = {}): LogLevel {
const status = explicitErrorStatus(error);
let level: LogLevel = status !== undefined && status < 500 ? "warn" : "error";
if (error instanceof AnonymousError) {
// The internal service that answered logged the failure at its own level.
if (error.upstreamLogged) level = "info";
else if (level === "warn" && EXPECTED_CLIENT_ERRORS.has(error.message)) level = "info";
}
return level === "info" && options.internal ? "debug" : level;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function printError(error: any, req?: express.Request) {
function printError(error: any, req?: express.Request, options: ErrorLogOptions = {}) {
const level = errorLogLevel(error, options);
if (error instanceof AnonymousError) {
if (req?.originalUrl === "/api/repo/undefined/options") return;
const payload: Record<string, unknown> = serializeError(error);
@@ -194,20 +230,11 @@ function printError(error: any, req?: express.Request) {
// Errors page surfaces something meaningful (e.g. "repoId_already_used")
// instead of a generic "anonymous error" wrapper.
const summary = error.message || error.name || "AnonymousError";
// 4xx are expected client errors (not_found, expired, not_connected) —
// route them to warn so the admin Errors page can split server faults
// (5xx) from client misuse (4xx) cleanly.
const status = explicitErrorStatus(error);
if (typeof status === "number" && status >= 400 && status < 500) {
logger.warn(summary, payload);
} else {
logger.error(summary, payload);
}
logger[level](summary, payload);
} else if (error instanceof HTTPError) {
const payload: Record<string, unknown> = serializeError(error);
ensureUrl(payload, req);
const status = explicitErrorStatus(error);
logger[status && status < 500 ? "warn" : "error"](error.code || error.name || "HTTPError", payload);
logger[level](error.code || error.name || "HTTPError", payload);
} else {
// Unhandled errors: use the error class name (SyntaxError, TypeError,
// RangeError, ...) as the summary so the admin page shows
@@ -225,8 +252,7 @@ function printError(error: any, req?: express.Request) {
((error as { name?: string }).name ||
(error as { message?: string }).message)) ||
"UnhandledError";
const status = explicitErrorStatus(error);
logger[status && status < 500 ? "warn" : "error"](summary, serialized);
logger[level](summary, serialized);
}
}
@@ -234,10 +260,11 @@ export function handleError(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
error: any,
res?: express.Response,
req?: express.Request
req?: express.Request,
options?: ErrorLogOptions
) {
if (isResponseCancellation(error, res)) return;
printError(error, req);
printError(error, req, options);
let errorCode = error;
if (error instanceof Error) {
errorCode = error.message;
+6 -7
View File
@@ -1,6 +1,4 @@
import { repositoryPickerPage } from "../../core/github-repository-picker";
import { appUserToken } from "../../core/github-app";
import { getCredentialToken } from "../../core/credentials";
import { pickerConnection, repositoryListPage } from "../../core/user-repository-list";
import AnonymousError from "../../core/AnonymousError";
import { BillingQuota, BillingDraft } from "../../core/billing/models";
import { cancelAccountBilling } from "../../core/billing/stripe";
@@ -383,11 +381,12 @@ router.get("/repository_picker", async (req, res) => {
res.status(400).json({ error: "Invalid repository search" });
return;
}
const token = connection === "github-app" ? await appUserToken(user.id)
: connection === "oauth" ? await getCredentialToken(user.id) : await user.getAccessToken();
if (!token) { res.status(401).json({ error: "GitHub connection required" }); return; }
// Served from the stored list; GitHub is only asked when it is empty,
// forced, or stale after an installation change.
const list = await pickerConnection(user.id, connection);
if (!list) { res.status(401).json({ error: "GitHub connection required" }); return; }
res.set("Cache-Control", "no-store");
res.json(await repositoryPickerPage(token, cursor, query));
res.json(await repositoryListPage(user.id, list, { cursor, query, force: req.query.force === "1" }));
} catch (error) { handleError(error, res, req); }
});
+2 -1
View File
@@ -43,7 +43,8 @@ app.get("/healthcheck", async (_, res) => {
app.all("/{*path}", (req, res) => {
handleError(
new AnonymousError("file_not_found", {
// Callers only use known routes; reaching here is a misconfiguration.
new AnonymousError("streamer_route_not_found", {
httpStatus: 404,
url: req.originalUrl,
}),
+17 -8
View File
@@ -6,10 +6,17 @@ import {
AnonymizeTransformer,
isTextFile,
} from "../core/anonymize-utils";
import AnonymousError from "../core/AnonymousError";
import { handleError } from "../server/routes/route-utils";
import { lookup } from "mime-types";
import { streamAnonymizedZip } from "../core/zipStream";
// The API relays these replies and logs each request's end state, so expected
// outcomes are only debug here. Faults keep their level and streamer stack.
function replyError(error: unknown, res: express.Response) {
handleError(error, res, undefined, { internal: true });
}
export const router = express.Router();
router.post(
@@ -18,7 +25,7 @@ router.post(
req.body = req.body || {};
const token: string = req.body.token;
if (typeof req.body.repoFullName !== "string" || typeof token !== "string") {
return res.status(400).json({ error: "invalid_request" });
return replyError(new AnonymousError("invalid_request", { httpStatus: 400 }), res);
}
const repoFullName = req.body.repoFullName.split("/");
const repoId = req.body.repoId;
@@ -41,8 +48,9 @@ router.post(
res
);
} catch (error) {
handleError(error, res);
if (res.headersSent && !res.writableEnded) res.destroy();
const streaming = res.headersSent;
replyError(error, res);
if (streaming && !res.writableEnded) res.destroy();
}
}
);
@@ -50,7 +58,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
req.body = req.body || {};
const token: string = req.body.token;
if (typeof req.body.repoFullName !== "string" || typeof token !== "string") {
return res.status(400).json({ error: "invalid_request" });
return replyError(new AnonymousError("invalid_request", { httpStatus: 400 }), res);
}
const repoFullName = req.body.repoFullName.split("/");
const repoId = req.body.repoId;
@@ -76,7 +84,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
.split(/[\\/]/)
.some((segment) => segment === ".." || segment === "")
) {
return res.status(400).json({ error: "invalid_file_path" });
return replyError(new AnonymousError("invalid_file_path", { httpStatus: 400 }), res);
}
const source = new GitHubStream({
@@ -121,8 +129,9 @@ router.post("/", async (req: express.Request, res: express.Response) => {
if (!content.closed && !content.destroyed) {
content.destroy();
}
handleError(error, res);
if (res.headersSent && !res.writableEnded) res.destroy();
const streaming = res.headersSent;
replyError(error, res);
if (streaming && !res.writableEnded) res.destroy();
anonymizer.destroy();
}
content
@@ -144,7 +153,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
res.status(409).end();
return;
}
handleError(error, res);
replyError(error, res);
}
});
+108
View File
@@ -0,0 +1,108 @@
const { strict: assert } = require("node:assert");
const { promises: fs } = require("node:fs");
const http = require("node:http");
const { tmpdir } = require("node:os");
const { join } = require("node:path");
const { PassThrough, Readable, Writable } = require("node:stream");
const { pipeline } = require("node:stream/promises");
const { setTimeout } = require("node:timers");
const { createHash } = require("node:crypto");
const express = require("express");
require("ts-node/register/transpile-only");
const config = require("../src/config").default;
const { sharedBlobCache, closeBlobCaches } = require("../src/core/blob-cache");
const { watchClientClose, isResponseCancellation } = require("../src/core/response-cancellation");
const streamer = require("../src/streamer/route").default;
const body = Buffer.alloc(8 * 1024 * 1024, 7);
const sha = createHash("sha1").update(`blob ${body.length}\0`).update(body).digest("hex");
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/** Collect the structured records a test run writes to stdout. */
function captureLogs() {
const records = [];
const write = process.stdout.write;
process.stdout.write = function (chunk, ...rest) {
for (const line of String(chunk).split("\n")) {
try { const record = JSON.parse(line); if (record && record.severity) { records.push(record); continue; } } catch { /* not a record */ }
if (line) write.call(process.stdout, line + "\n");
}
const callback = rest.find((arg) => typeof arg === "function");
if (callback) callback();
return true;
};
return { records, restore: () => { process.stdout.write = write; } };
}
describe("cached response cancellation", function () {
this.timeout(15000);
let root, old;
beforeEach(async () => {
old = { ...config }; closeBlobCaches();
root = await fs.mkdtemp(join(tmpdir(), "cached-cancel-"));
Object.assign(config, { STORAGE: "filesystem", FOLDER: root, SHARED_CACHE_ENABLED: true,
SHARED_CACHE_PATH: join(root, "cache"), SHARED_CACHE_BYTES: 64 * 1024 ** 2,
SHARED_CACHE_RESULT_BYTES: 32 * 1024 ** 2, SHARED_CACHE_MAX_FILE_BYTES: 16 * 1024 ** 2,
SHARED_CACHE_FREE_BYTES: 0, BILLING_ENABLED: false });
});
afterEach(async () => {
closeBlobCaches(); Object.assign(config, old);
await fs.rm(root, { recursive: true, force: true });
});
it("does not log a client that stops a cached download as a server error", async () => {
const seeded = await sharedBlobCache().getOrFill(`git-${sha}`, async () => Readable.from([body]), async () => `git-${sha}`, body.length);
for await (const chunk of seeded) void chunk;
const app = express(); app.use(express.json()); app.use("/api", streamer);
const server = await new Promise((resolve) => { const s = app.listen(0, "127.0.0.1", () => resolve(s)); });
const logs = captureLogs();
try {
await new Promise((resolve) => {
const req = http.request({ host: "127.0.0.1", port: server.address().port, path: "/api", method: "POST",
headers: { "content-type": "application/json" } }, (res) => {
res.once("data", () => req.destroy());
res.on("error", () => undefined);
res.on("close", resolve);
});
req.on("error", resolve);
req.end(JSON.stringify({ token: "", repoFullName: "owner/repo", repoId: "anon", sha, size: body.length,
filePath: "video.bin", anonymizerOptions: { terms: [], filePath: "video.bin" } }));
});
await wait(300);
} finally {
logs.restore();
server.closeAllConnections();
await new Promise((resolve) => server.close(resolve));
}
const faults = logs.records.filter((record) => record.severity === "error" || record.severity === "warn");
assert.deepEqual(faults, []);
});
it("names a client disconnect but keeps a source that ended early as a failure", async () => {
const attribute = async (closeFirst) => {
const source = new PassThrough();
// The "late" response never acknowledges its write, like a slow socket.
const response = new Writable({ write(_chunk, _encoding, done) { if (closeFirst !== "late") done(); } });
const clientClosed = watchClientClose(response, source);
const piping = pipeline(source, response);
source.write("partial");
if (closeFirst === "late") source.end();
await wait(5);
if (closeFirst !== "source") response.destroy();
else source.destroy();
const error = await piping.then(() => undefined, (failure) => failure);
return { error, clientClosed: clientClosed(), cancellation: isResponseCancellation(error, response) };
};
const client = await attribute("client");
assert.equal(client.error.code, "ERR_STREAM_PREMATURE_CLOSE");
assert.equal(client.clientClosed, true);
// The source was fully read but the response had not flushed yet.
const late = await attribute("late");
assert.equal(late.error.code, "ERR_STREAM_PREMATURE_CLOSE");
assert.equal(late.clientClosed, true);
const source = await attribute("source");
assert.equal(source.error.code, "ERR_STREAM_PREMATURE_CLOSE");
assert.equal(source.clientClosed, false);
assert.equal(source.cancellation, false);
});
});
+2 -1
View File
@@ -5,6 +5,7 @@ const {installDatabaseTiming}=require('../src/core/database-timing');
const {monitorRequests,RequestMetrics}=require('../src/core/request-monitoring');
const express=require('express');
const http=require('node:http');
const {setTimeout:delay}=require('node:timers/promises');
describe('database execution timing',()=>{
it('preserves query receiver, result and failure while measuring execution once',async()=>{
const Model=mongoose.model("TimingFixture",new mongoose.Schema({}));
@@ -13,7 +14,7 @@ describe('database execution timing',()=>{
installDatabaseTiming();const wrapped=mongoose.Query.prototype.exec;installDatabaseTiming();expect(mongoose.Query.prototype.exec).equal(wrapped);
app.use(monitorRequests('api',new RequestMetrics(),{info:(_,row)=>logs.push(row),warn:(_,row)=>logs.push(row)}));
app.get('/',async(_req,res)=>{
const query=Model.find();query._find=async function(){expect(this).equal(query);await new Promise(r=>setTimeout(r,20));return ['ok'];};
const query=Model.find();query._find=async function(){expect(this).equal(query);await delay(20);return ['ok'];};
expect(await query.exec()).deep.equal(['ok']);
const failed=Model.find();const error=new Error('PRIVATE query');failed._find=async()=>{throw error;};
try{await failed.exec();throw Error('expected failure');}catch(e){expect(e).equal(error);}
+143
View File
@@ -0,0 +1,143 @@
const { strict: assert } = require("node:assert");
const { setTimeout } = require("node:timers");
const express = require("express");
require("ts-node/register/transpile-only");
const config = require("../src/config").default;
const AnonymousError = require("../src/core/AnonymousError").default;
const File = require("../src/core/AnonymizedFile").default;
const GitHubStream = require("../src/core/source/GitHubStream").default;
const { AnonymizeTransformer } = require("../src/core/anonymize-utils");
const { errorLogLevel, handleError } = require("../src/server/routes/route-utils");
const streamer = require("../src/streamer/route").default;
const got = require("got");
const error = (code, httpStatus, extra = {}) => Object.assign(new AnonymousError(code, { httpStatus }), extra);
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/** Collect the structured records written to stdout while `run` executes. */
async function captureLogs(run) {
const records = [];
const write = process.stdout.write;
process.stdout.write = function (chunk, ...rest) {
for (const line of String(chunk).split("\n")) {
try { const record = JSON.parse(line); if (record && record.severity) { records.push(record); continue; } } catch { /* not a record */ }
if (line) write.call(process.stdout, line + "\n");
}
const callback = rest.find((arg) => typeof arg === "function");
if (callback) callback();
return true;
};
try { await run(); } finally { process.stdout.write = write; }
return records;
}
describe("error log levels", () => {
it("logs expected client outcomes at info and faults at warn or error", () => {
for (const [code, status] of [["repo_not_found", 404], ["repository_expired", 410], ["file_not_found", 404],
["github_app_access_required", 403], ["repository_archived", 410], ["folder_not_supported", 404], ["is_removed", 410]]) {
assert.equal(errorLogLevel(error(code, status)), "info", code);
}
assert.equal(errorLogLevel(error("token_expired", 401)), "warn");
assert.equal(errorLogLevel(error("rate_limited", 429)), "warn");
assert.equal(errorLogLevel(error("github_rate_limit_exceeded", 429)), "warn");
assert.equal(errorLogLevel(error("invalid_file_path", 400)), "warn");
assert.equal(errorLogLevel(error("upstream_error", 502)), "error");
assert.equal(errorLogLevel(error("streamer_unreachable", 502)), "error");
assert.equal(errorLogLevel(new Error("boom")), "error");
// A known code with a server status is still a fault.
assert.equal(errorLogLevel(error("file_not_found", 500)), "error");
});
it("leaves a relayed failure to the service that logged it", () => {
assert.equal(errorLogLevel(error("upstream_error", 502, { upstreamStatus: 502, upstreamLogged: true })), "info");
assert.equal(errorLogLevel(error("streamer_upstream_error", 502, { upstreamStatus: 502 })), "error");
});
it("drops expected outcomes to debug when another service logs the end state", () => {
assert.equal(errorLogLevel(error("repo_not_found", 404), { internal: true }), "debug");
assert.equal(errorLogLevel(error("token_expired", 401), { internal: true }), "warn");
assert.equal(errorLogLevel(error("upstream_error", 502), { internal: true }), "error");
});
});
describe("streamer file failures", function () {
this.timeout(10000);
let old, original, streamerServer, apiServer, base;
beforeEach(async () => {
old = { ...config };
original = GitHubStream.prototype.getFileContentCache;
const streamerApp = express(); streamerApp.use(express.json()); streamerApp.use("/api", streamer);
streamerServer = await new Promise((resolve) => { const s = streamerApp.listen(0, "127.0.0.1", () => resolve(s)); });
Object.assign(config, { STREAMER_ENTRYPOINT: `http://127.0.0.1:${streamerServer.address().port}/`, SHARED_CACHE_ENABLED: false });
const api = express();
api.get("/file", async (req, res) => {
const file = new File({ repository: {
repoId: "anon", owner: { id: "507f1f77bcf86cd799439011" }, options: { terms: [] },
model: { _id: "507f1f77bcf86cd799439012", source: { repositoryName: "owner/gone" } },
getToken: async () => "token",
generateAnonymizeTransformer: (filePath) => new AnonymizeTransformer({ terms: [], filePath }),
}, anonymizedPath: "README.md" });
file._file = { name: "README.md", path: "", sha: "sha", size: 10 };
try { await file.send(res); } catch (failure) { handleError(failure, res, req); }
});
apiServer = await new Promise((resolve) => { const s = api.listen(0, "127.0.0.1", () => resolve(s)); });
base = `http://127.0.0.1:${apiServer.address().port}`;
});
afterEach(async () => {
GitHubStream.prototype.getFileContentCache = original;
await new Promise((resolve) => apiServer.close(resolve));
await new Promise((resolve) => streamerServer.close(resolve));
Object.assign(config, old);
});
const request = async (failure) => {
GitHubStream.prototype.getFileContentCache = async () => { throw failure; };
let response;
const records = await captureLogs(async () => {
response = await got(`${base}/file`, { throwHttpErrors: false, retry: 0 });
await wait(50);
});
return { response, records: records.filter((record) => record.severity !== "debug") };
};
it("logs a missing source repository once, at info", async () => {
const { response, records } = await request(new AnonymousError("repo_not_found", { httpStatus: 404 }));
assert.equal(response.statusCode, 404);
assert.equal(records.length, 1, JSON.stringify(records));
assert.equal(records[0].severity, "info");
assert.equal(records[0].errorCode, "repo_not_found");
assert.equal(records[0].upstreamStatus, 404);
});
it("keeps a single fault record from the streamer", async () => {
const { response, records } = await request(new AnonymousError("upstream_error", { httpStatus: 502 }));
assert.equal(response.statusCode, 502);
const faults = records.filter((record) => record.severity === "warn" || record.severity === "error");
assert.equal(faults.length, 1, JSON.stringify(records));
assert.equal(faults[0].errorCode, "upstream_error");
// The streamer's own record, not the API relay (which carries upstreamStatus).
assert.equal(faults[0].upstreamStatus, undefined);
assert.equal(records.filter((record) => record.upstreamStatus === 502).length, 1);
});
it("reports an uncoded 4xx from in front of the streamer as a fault", async () => {
// e.g. a body-size limit or an ingress 404: nothing logged it upstream.
const proxy = await new Promise((resolve) => {
const s = require("node:http").createServer((req, res) => {
req.resume();
res.writeHead(413, { "content-type": "text/html" }).end("<h1>Payload Too Large</h1>");
}).listen(0, "127.0.0.1", () => resolve(s));
});
config.STREAMER_ENTRYPOINT = `http://127.0.0.1:${proxy.address().port}/`;
try {
const { response, records } = await request(new Error("unused"));
assert.equal(response.statusCode, 502);
assert.equal(records.length, 1, JSON.stringify(records));
assert.equal(records[0].severity, "error");
assert.equal(records[0].errorCode, "streamer_unexpected_response");
assert.equal(records[0].upstreamStatus, 413);
} finally {
await new Promise((resolve) => proxy.close(resolve));
}
});
});
+10
View File
@@ -797,6 +797,16 @@ describeMongo("GitHub App credential and repository integration", function () {
expect((await Installations.findOne({ installationId: 4 })).blocked).to.equal(false);
});
it("blocks a deleted installation even when the picker list update fails", async () => {
const UserRepositories = require("../src/core/model/user-repositories").UserRepositoryModel;
const original = UserRepositories.deleteMany;
UserRepositories.deleteMany = async () => { throw new Error("picker write failed"); };
try {
expect((await webhook("installation", { action: "deleted", installation: { id: 4, app_id: 123 } })).status).to.equal(503);
} finally { UserRepositories.deleteMany = original; }
expect((await Installations.findOne({ installationId: 4 })).blocked).to.equal(true);
});
it("does not let an in-flight installation check undo a deletion", async () => {
await Installations.create({ appId: "123", installationId: 4, revision: "old", blocked: true, reconciliationPending: true });
mock(async () => {
-47
View File
@@ -1,47 +0,0 @@
const { expect } = require("chai");
require("ts-node/register/transpile-only");
const github = require("../src/core/GitHubUtils");
const { repositoryPickerPage } = require("../src/core/github-repository-picker");
describe("repository picker bounded pages", () => {
let original;
beforeEach(() => { original = github.octokit; });
afterEach(() => { github.octokit = original; });
it("fetches only one small upstream page for browsing", async () => {
let calls = 0;
github.octokit = token => ({ request: async (route, params) => {
calls++;
expect(token).to.equal("private-token");
expect(params).to.include({ page: 2, per_page: 20, sort: "full_name" });
return { data: [{ id: 21, full_name: "org/repo" }], headers: {} };
} });
expect(await repositoryPickerPage("private-token", 20)).to.deep.equal({
items: [{ id: 21, fullName: "org/repo" }], nextCursor: null,
});
expect(calls).to.equal(1);
});
it("searches case-insensitively and resumes without skipping matches", async () => {
github.octokit = () => ({ request: async () => ({
data: Array.from({ length: 100 }, (_, id) => ({ id, full_name: `Org/${id % 2 ? "other" : "Match"}-${id}` })),
headers: { link: '<https://api.github.com/user/repos?page=2>; rel="next"' },
}) });
const first = await repositoryPickerPage("token", 0, "org/match");
expect(first.items).to.have.length(20);
expect(first.nextCursor).to.equal(39);
const second = await repositoryPickerPage("token", first.nextCursor, "org/match");
expect(second.items[0].id).to.equal(40);
expect(second.items).to.have.length(20);
});
it("returns a continuation for an empty search batch, not a false end", async () => {
github.octokit = () => ({ request: async () => ({
data: Array.from({ length: 100 }, (_, id) => ({ id, full_name: `org/repo-${id}` })),
headers: { link: '<https://api.github.com/user/repos?page=2>; rel="next"' },
}) });
expect(await repositoryPickerPage("token", 0, "missing")).to.deep.equal({ items: [], nextCursor: 100 });
});
it("propagates upstream failures so the UI can retry", async () => {
github.octokit = () => ({ request: async () => { throw new Error("rate limit"); } });
try { await repositoryPickerPage("token"); throw new Error("unexpected success"); }
catch (error) { expect(error.message).to.equal("rate limit"); }
});
});
+3 -1
View File
@@ -361,7 +361,9 @@ const uri = process.env.PERFORMANCE_MONGO_URI;
expect(saved.githubAccess.revision).not.to.equal("old-access"); expect(saved.anonymizeDate.getTime()).to.be.greaterThan(1);
expect(saved.options.terms).to.deep.equal(["after"]);
expect(await File.countDocuments({ repoId: row.repoId })).to.equal(0); expect(await Path.countDocuments({ repoId: row.repoId })).to.equal(0);
expect(jobs).to.have.length(1); expect(jobs[0][1]).to.deep.equal({ repoId: row.repoId });
expect(jobs).to.have.length(1);
const { logJobId, ...jobData } = jobs[0][1];
expect(jobData).to.deep.equal({ repoId: row.repoId }); expect(logJobId).to.match(/^[a-f0-9-]{36}$/);
});
for (const [label, change] of [...changedSnapshots, ["settings revision", { settingsSavedAt: new Date(1) }]] ) {
+8 -1
View File
@@ -8,6 +8,7 @@ const github = require("../src/core/source/GitHubRepository");
const Resources = require("../src/core/model/anonymizedRepositories/anonymizedRepositories.model").default;
const Sources = require("../src/core/model/repositories/repositories.model").default;
const Users = require("../src/core/model/users/users.model").default;
const { UserRepositorySyncModel } = require("../src/core/model/user-repositories");
const repositoryRouter = require("../src/server/routes/repository-private").default;
const appRouter = require("../src/server/routes/github-app").githubAppRouter;
const handler = (router, path) => router.stack.find(layer => layer.route?.path === path).route.stack.at(-1).handle;
@@ -52,6 +53,8 @@ describe("owner actions rearm access alerts", () => {
for (const action of ["install", "request", "unverified"]) it(`handles ${action} installation completion without premature resets`, async () => {
stub(app, "userInstallations", async () => [{ id: 42 }]);
stub(Users, "updateOne", async () => ({}));
let staleList;
stub(UserRepositorySyncModel, "updateMany", async filter => { staleList = filter; return {}; });
const req = { session: {
githubInstallFlow: { ownerId: owner, state: "state", expires: Date.now() + 60000, returnTo: "/connections" },
save: callback => callback(),
@@ -60,6 +63,10 @@ describe("owner actions rearm access alerts", () => {
try { await handler(appRouter, "/app/setup")(req, { redirect() {} }); } catch (error) { failure = error; }
expect(resets).to.deep.equal(action === "install" ? [[owner]] : []);
if (action === "unverified") expect(failure?.message).to.equal("github_app_access_required");
else expect(failure).to.equal(undefined);
else {
expect(failure).to.equal(undefined);
// Completing setup marks the stored repository picker list for a sync.
expect(staleList).to.deep.equal({ ownerId: { $in: [owner] }, connection: "github-app" });
}
});
});
+5 -4
View File
@@ -996,13 +996,14 @@ const uri = process.env.PERFORMANCE_MONGO_URI;
const row = await Repo.create({ repoId: "active-staged", status: "ready", statusDate: new Date(), lastView: new Date(),
treeGeneration: "old", source: { type: "GitHubStream" }, options: { expirationMode: "never" } });
await File.create({ repoId: row.repoId, treeGeneration: "old", path: "", name: "old.txt" });
const repo = new Repository(row), updateMany = File.updateMany;
// Completion clears markers through the driver collection (clearStagedRowsInBatches).
const repo = new Repository(row), updateMany = File.collection.updateMany;
Object.defineProperty(repo, "source", { get: () => ({ getFiles: async () => [{ path: "", name: "active.txt", size: 1 }] }) });
File.updateMany = function (filter, ...args) {
if (filter.treeStaged) return { exec: async () => { throw Error("marker cleanup interrupted"); } };
File.collection.updateMany = function (filter, ...args) {
if (filter.treeStaged) return Promise.reject(Error("marker cleanup interrupted"));
return updateMany.call(this, filter, ...args);
};
try { await repo.files({ force: true }); } finally { File.updateMany = updateMany; }
try { await repo.files({ force: true }); } finally { File.collection.updateMany = updateMany; }
expect(await File.countDocuments({ treeStaged: true })).to.equal(1);
await require("../src/server/schedule").runRepositoryStatusCheck();
expect((await File.find({ repoId: row.repoId })).map(file => file.name)).to.deep.equal(["active.txt"]);
+13 -3
View File
@@ -6,7 +6,7 @@ const path = require("node:path");
const net = require("node:net");
const { randomBytes } = require("node:crypto");
const { once } = require("node:events");
const { setTimeout } = require("node:timers");
const { setTimeout, clearTimeout } = require("node:timers");
const { fetch } = globalThis;
const mongoose = require("mongoose");
require("ts-node/register/transpile-only");
@@ -51,10 +51,20 @@ const uri = process.env.PERFORMANCE_MONGO_URI;
});
const messages = []; child.on("message", message => messages.push(message));
const ready = new Promise((resolve, reject) => {
// Fail before the mocha timeout so callers' finally blocks always stop the child.
const deadline = setTimeout(() => reject(Error("Streamer did not report streamer_started")), 20000);
const settle = (fn, value) => { clearTimeout(deadline); fn(value); };
let logs = "";
child.stdout.on("data", chunk => { logs += chunk; if (logs.includes("streamer started")) resolve(); });
child.stdout.on("data", chunk => {
logs += chunk; const lines = logs.split("\n"); logs = lines.pop();
for (const line of lines) {
let record; try { record = JSON.parse(line); } catch { continue; }
if (record.event === "streamer_started") settle(resolve);
}
});
child.stderr.on("data", () => {});
child.once("error", reject); child.once("exit", code => reject(Error(`Streamer exited ${code} before serving`)));
child.once("error", error => settle(reject, error));
child.once("exit", code => settle(reject, Error(`Streamer exited ${code} before serving`)));
});
ready.catch(() => {});
return { child, ready, messages, directory, stale, url: `http://127.0.0.1:${port}` };
+3 -1
View File
@@ -88,7 +88,9 @@ describe("large anonymization resources", function () {
maxOutput: 1000000, context: { mask: "XXXX", hostname: "localhost" } }, text.length, controller.signal);
} catch (error) { failure = error; }
expect(failure).to.be.instanceOf(Error);
expect(failure.message).to.match(/timed out after 1000ms/);
// Workers report fixed codes only; the elapsed bound proves the 1s regex deadline,
// not the 15s pool deadline that reports the same code, stopped the job.
expect(failure.message).to.equal("anonymization_deadline_exceeded");
expect(Date.now() - started).to.be.lessThan(8000);
let exists = true;
try { await fs.access(output); } catch (error) { if (error.code === "ENOENT") exists = false; else throw error; }
+5 -3
View File
@@ -207,11 +207,13 @@ describe("repository activity dates", () => {
});
}
}
// FileModel.exists() returns a Mongoose query; production code chains .hint().
const missingFile = () => Object.assign(Promise.resolve(null), { hint() { return this; } });
it("returns publication and settings dates independently of the older source commit", async () => {
const repo = repository(); auth(repo);
repo.model.settingsSavedAt = new Date("2026-03-01");
repo.model.publishedAt = new Date("2026-02-01");
stub(Files, "exists", async () => null);
stub(Files, "exists", missingFile);
let body;
await handler("repository-public", "/:repoId/options", "get")({}, { header: () => {}, json: value => { body = value; } });
expect(body.lastUpdateDate).to.deep.equal(repo.model.settingsSavedAt);
@@ -220,7 +222,7 @@ describe("repository activity dates", () => {
});
it("does not invent publication or settings dates for legacy repositories", async () => {
const repo = repository(); auth(repo);
stub(Files, "exists", async () => null);
stub(Files, "exists", missingFile);
let body;
await handler("repository-public", "/:repoId/options", "get")({}, { header: () => {}, json: value => { body = value; } });
expect(body.publishedAt).to.equal(undefined);
@@ -232,7 +234,7 @@ describe("repository activity dates", () => {
const repo = repository(); auth(repo);
repo.model.options.expirationMode = "remove";
repo.model.options.expirationDate = new Date("2099-01-01");
stub(Files, "exists", async () => null);
stub(Files, "exists", missingFile);
let body;
await handler("repository-public", "/:repoId/options", "get")({}, { header: () => {}, json: value => { body = value; } });
expect(body.expirationDate).to.deep.equal(new Date("2099-01-01"));
+71
View File
@@ -0,0 +1,71 @@
const { strict: assert } = require("node:assert");
const http = require("node:http");
const { setTimeout } = require("node:timers");
const express = require("express");
const session = require("express-session");
require("ts-node/register/transpile-only");
const config = require("../src/config").default;
const File = require("../src/core/AnonymizedFile").default;
const { AnonymizeTransformer } = require("../src/core/anonymize-utils");
const got = require("got");
// connect-redis implements touch(), so every request that carries a session
// cookie goes through express-session's split write: all but the last body
// byte is written at once and the last byte follows the asynchronous touch.
class TouchingStore extends session.MemoryStore {
touch(sid, sess, callback) {
setTimeout(() => super.touch(sid, sess, callback), 20);
}
}
const listen = (handler) => new Promise((resolve) => {
const server = http.createServer(handler);
server.listen(0, "127.0.0.1", () => resolve(server));
});
const close = (server) => new Promise((resolve) => server.close(resolve));
describe("streamer error responses with a session cookie", function () {
this.timeout(10000);
let old, streamer, api, base;
beforeEach(async () => {
old = { ...config };
streamer = await listen((req, res) => {
req.resume();
res.writeHead(404, { "content-type": "application/json" });
res.end(JSON.stringify({ error: "repo_not_found" }));
});
Object.assign(config, {
STREAMER_ENTRYPOINT: `http://127.0.0.1:${streamer.address().port}/`,
SHARED_CACHE_ENABLED: false,
});
const app = express();
app.use(session({ secret: "test", store: new TouchingStore(), resave: false,
saveUninitialized: false, rolling: true }));
app.get("/login", (req, res) => { req.session.visited = true; res.end("ok"); });
app.get("/file", async (_req, res) => {
const file = new File({ repository: {
repoId: "anon", owner: { id: "507f1f77bcf86cd799439011" }, options: { terms: [] },
model: { _id: "507f1f77bcf86cd799439012", source: { repositoryName: "owner/gone" } },
getToken: async () => "token",
generateAnonymizeTransformer: (filePath) => new AnonymizeTransformer({ terms: [], filePath }),
}, anonymizedPath: "README.md" });
file._file = { name: "README.md", path: "", sha: "sha", size: 10 };
await file.send(res);
});
api = await new Promise((resolve) => { const s = app.listen(0, "127.0.0.1", () => resolve(s)); });
base = `http://127.0.0.1:${api.address().port}`;
});
afterEach(async () => {
await close(api);
await close(streamer);
Object.assign(config, old);
});
it("delivers the whole 404 body instead of cutting the connection", async () => {
const login = await got(`${base}/login`, { retry: 0 });
const cookie = login.headers["set-cookie"].map((value) => value.split(";")[0]).join("; ");
const response = await got(`${base}/file`, { headers: { cookie }, throwHttpErrors: false, retry: 0 });
assert.equal(response.statusCode, 404);
assert.equal(response.body, JSON.stringify({ error: "repo_not_found" }));
});
});
+1
View File
@@ -1,6 +1,7 @@
const {expect}=require('chai');
const express=require('express');
const http=require('node:http');
const {setTimeout}=require('node:timers');
const {Readable}=require('node:stream');
require('ts-node/register/transpile-only');
const {monitorRequests,RequestMetrics}=require('../src/core/request-monitoring');
+66
View File
@@ -0,0 +1,66 @@
const { strict: assert } = require("node:assert");
const fs = require("node:fs");
const path = require("node:path");
const ts = require("typescript");
require("ts-node/register/transpile-only");
const { logRecord, LOG_ERROR_CODES } = require("../src/core/log-record");
const { serializeError } = require("../src/core/logger");
const { billingError } = require("../src/core/billing/config");
const { consumeFlow } = require("../src/server/routes/github-app");
const root = path.join(__dirname, "..");
const vrl = fs.readFileSync(path.join(root, "deploy/logging/sanitize.vrl"), "utf8");
const collectorCodes = new Set(JSON.parse(vrl.match(/if includes\((\[.*?\]), record\.errorCode\)/)[1]));
// Independent of the generator: string codes passed straight to the error
// factories anywhere under src/.
function thrownCodes() {
const codes = new Map();
const literals = (node, file) => {
if (!node) return;
if (ts.isStringLiteralLike(node)) { if (/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)+$/.test(node.text)) codes.set(node.text, file); }
else if (ts.isConditionalExpression(node)) { literals(node.whenTrue, file); literals(node.whenFalse, file); }
else if (ts.isParenthesizedExpression(node)) literals(node.expression, file);
};
const walk = (dir) => {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const file = path.join(dir, entry.name);
if (entry.isDirectory()) { walk(file); continue; }
if (!file.endsWith(".ts") || file.endsWith(".d.ts")) continue;
const source = ts.createSourceFile(file, fs.readFileSync(file, "utf8"), ts.ScriptTarget.Latest, true);
(function visit(node) {
if ((ts.isNewExpression(node) || ts.isCallExpression(node)) && ts.isIdentifier(node.expression) &&
["AnonymousError", "billingError", "appError"].includes(node.expression.text) && node.arguments?.length) {
literals(node.arguments[0], path.relative(root, file));
}
ts.forEachChild(node, visit);
})(source);
}
};
walk(path.join(root, "src"));
return codes;
}
describe("thrown error codes reach the logs", () => {
it("keeps the billing expiration and GitHub App state codes", () => {
const billing = logRecord("warn", "route", [serializeError(billingError("invalid_billing_expiration"))]);
assert.equal(billing.errorCode, "invalid_billing_expiration");
let state;
try { consumeFlow(undefined, "state"); } catch (error) { state = error; }
assert.equal(state.message, "invalid_auth_state");
assert.equal(logRecord("warn", "route", [serializeError(state)]).errorCode, "invalid_auth_state");
for (const code of ["invalid_billing_expiration", "invalid_auth_state", "streamer_unreachable"]) {
assert.ok(collectorCodes.has(code), `${code} is missing from sanitize.vrl`);
}
});
it("allowlists every code passed to an error factory", () => {
const missing = [...thrownCodes()].filter(([code]) => !LOG_ERROR_CODES.has(code) || !collectorCodes.has(code))
.map(([code, file]) => `${code} (${file})`);
assert.deepEqual(missing, [], "run node scripts/generate-log-diagnostics.js");
});
it("lets the collector keep every code the logger emits", () => {
assert.deepEqual([...LOG_ERROR_CODES].filter((code) => !collectorCodes.has(code)), []);
});
});
+356
View File
@@ -0,0 +1,356 @@
const { expect } = require("chai");
const { createHmac, generateKeyPairSync } = require("crypto");
const process = require("process");
const { URL, URLSearchParams } = require("node:url");
const express = require("express");
const mongoose = require("mongoose");
require("ts-node/register/transpile-only");
const config = require("../src/config").default;
const github = require("../src/core/GitHubUtils");
const app = require("../src/core/github-app");
const { setCredential } = require("../src/core/credentials");
const list = require("../src/core/user-repository-list");
const { UserRepositoryModel: Rows, UserRepositorySyncModel: Syncs } = require("../src/core/model/user-repositories");
const Users = require("../src/core/model/users/users.model").default;
const Credentials = require("../src/core/model/credentials/credentials.model").default;
const Installations = require("../src/core/model/github-installation").default;
const { githubAppWebhook, revokeGrant } = require("../src/server/routes/github-app");
const keys = JSON.stringify({ test: Buffer.alloc(32, 9).toString("base64") });
const pem = generateKeyPairSync("rsa", { modulusLength: 2048 }).privateKey.export({ type: "pkcs8", format: "pem" });
const repo = (id, name, extra = {}) => ({ id, full_name: name, private: id % 2 === 0, default_branch: "main",
updated_at: "2026-01-01T00:00:00Z", pushed_at: "2026-01-02T00:00:00Z", ...extra });
const describeMongo = process.env.TEST_MONGODB_URI ? describe : describe.skip;
describeMongo("stored repository picker list", function () {
this.timeout(20000);
let owner, other, previousConfig, previousOctokit, previousFetch, server, base, upstream, calls;
before(async () => {
previousConfig = { ...config };
Object.assign(config, { GITHUB_APP_ENABLED: true, GITHUB_APP_ID: "123", GITHUB_APP_CLIENT_ID: "Iv.test",
GITHUB_APP_PRIVATE_KEY: pem, CREDENTIAL_KEYS: keys, CREDENTIAL_ACTIVE_KEY_ID: "test",
GITHUB_APP_WEBHOOK_SECRET: "webhook-secret" });
await mongoose.connect(process.env.TEST_MONGODB_URI, { dbName: "repo_list_test_" + Date.now() });
await Promise.all([Rows, Syncs, Credentials, Installations].map(m => m.createIndexes()));
const api = express();
api.use("/github/app/webhook", githubAppWebhook);
api.use((req, _res, next) => {
req.user = { user: owner };
req.isAuthenticated = () => true;
req.logout = done => done();
next();
});
api.use("/api/user", require("../src/server/routes/user").default);
server = await new Promise(resolve => { const s = api.listen(0, "127.0.0.1", () => resolve(s)); });
base = `http://127.0.0.1:${server.address().port}`;
previousOctokit = github.octokit;
previousFetch = globalThis.fetch;
});
after(async () => {
github.octokit = previousOctokit;
globalThis.fetch = previousFetch;
await new Promise(resolve => server.close(resolve));
await mongoose.connection.dropDatabase();
await mongoose.disconnect();
Object.assign(config, previousConfig);
});
beforeEach(async () => {
await list.settleRepositorySyncs();
await Promise.all([Rows, Syncs, Users, Credentials, Installations].map(m => m.deleteMany({})));
owner = await Users.create({ username: "owner", externalIDs: { github: "10" } });
other = await Users.create({ username: "other", externalIDs: { github: "11" } });
calls = [];
// OAuth: GitHub /user/repos pages of 100, sorted by name.
upstream = Array.from({ length: 250 }, (_, i) => repo(1000 + i, `org/repo-${String(i).padStart(3, "0")}`));
github.octokit = () => ({ request: async (route, params) => {
calls.push(params.page);
const data = upstream.slice((params.page - 1) * 100, params.page * 100);
const more = params.page * 100 < upstream.length;
return { data, headers: more ? { link: '<https://api.github.com/user/repos?page=2>; rel="next"' } : {} };
} });
globalThis.fetch = previousFetch;
});
afterEach(async () => { await list.settleRepositorySyncs(); });
const picker = async (params = {}) => {
const response = await previousFetch(`${base}/api/user/repository_picker?${new URLSearchParams(params)}`);
return { status: response.status, body: await response.json() };
};
function webhook(event, payload, secret = "webhook-secret") {
const body = JSON.stringify(payload);
return previousFetch(base + "/github/app/webhook", { method: "POST", body, headers: {
"Content-Type": "application/json", "X-GitHub-Event": event,
"X-Hub-Signature-256": "sha256=" + createHmac("sha256", secret).update(body).digest("hex") } });
}
// GitHub App upstream: installations and their repositories, plus the installation check.
function mockApp(installations) {
globalThis.fetch = async (url, options) => {
if (String(url).startsWith(base)) return previousFetch(url, options);
const path = new URL(String(url)).pathname;
calls.push(path);
let body;
const listed = /^\/user\/installations\/(\d+)\/repositories$/.exec(path);
if (path === "/user/installations") body = { installations: Object.keys(installations).map(id => ({ id: Number(id), app_id: 123, suspended_at: null, account: { id: 10, login: "owner", type: "User" }, permissions: {} })) };
else if (listed) body = { repositories: installations[listed[1]] || [] };
else if (/^\/app\/installations\/\d+$/.test(path)) body = { id: Number(path.split("/").pop()), app_id: 123, suspended_at: null, account: { id: 10, login: "owner", type: "User" } };
else return new globalThis.Response("{}", { status: 404 });
return new globalThis.Response(JSON.stringify(body), { status: 200, headers: { "content-type": "application/json" } });
};
}
const grantApp = ownerId => app.saveAppGrant(ownerId, { access_token: "ghu_" + ownerId, refresh_token: "ghr", expires_in: 3600, refresh_token_expires_in: 100000 });
const names = async ownerId => (await Rows.find({ ownerId: String(ownerId) }).sort({ nameKey: 1 }).lean()).map(r => r.fullName);
it("fetches an empty list once, then pages and searches from MongoDB", async () => {
await setCredential(owner.id, "oauth-token");
const first = await picker();
expect(first.status).to.equal(200);
expect(first.body.items).to.have.length(20);
expect(first.body.items[0]).to.deep.equal({ id: 1000, fullName: "org/repo-000", private: true });
expect(first.body.nextCursor).to.equal(20);
expect(first.body.webhooks).to.equal(false);
await list.settleRepositorySyncs();
expect(calls).to.deep.equal([1, 2, 3]);
expect(await Rows.countDocuments({ ownerId: owner.id, connection: "oauth" })).to.equal(250);
const stored = await Rows.findOne({ repositoryId: 1001 }).lean();
expect(stored).to.include({ fullName: "org/repo-001", private: false, defaultBranch: "main", connection: "oauth" });
expect(stored.pushedAt.toISOString()).to.equal("2026-01-02T00:00:00.000Z");
calls = [];
const page = await picker({ cursor: 240 });
expect(page.body.items.map(r => r.fullName)).to.deep.equal(Array.from({ length: 10 }, (_, i) => `org/repo-${240 + i}`));
expect(page.body.nextCursor).to.equal(null);
expect(page.body.syncedAt).to.be.a("string");
const search = await picker({ q: "REPO-12" });
expect(search.body.items.map(r => r.fullName)).to.deep.equal([...Array.from({ length: 10 }, (_, i) => `org/repo-12${i}`)]);
// Regex characters are literal.
expect((await picker({ q: "repo.01" })).body.items).to.deep.equal([]);
expect(calls).to.deep.equal([]);
});
it("returns the first page of a large account before pagination finishes", async () => {
await setCredential(owner.id, "oauth-token");
let release;
const gate = new Promise(resolve => { release = resolve; });
const original = github.octokit;
github.octokit = token => ({ request: async (route, params) => {
if (params.page > 1) await gate;
return original(token).request(route, params);
} });
const first = await picker();
expect(first.body.items).to.have.length(20);
expect(first.body.nextCursor).to.equal(20);
expect(first.body.syncing).to.equal(true);
expect(first.body.syncedAt).to.equal(null);
// A second request while the sync runs does not start another one.
expect((await picker()).body.syncing).to.equal(true);
release();
await list.settleRepositorySyncs();
expect(calls).to.deep.equal([1, 2, 3]);
const done = await picker();
expect(done.body.syncing).to.equal(false);
expect(await Rows.countDocuments()).to.equal(250);
});
it("runs one sync per list even when requests arrive together", async () => {
await setCredential(owner.id, "oauth-token");
const results = await Promise.all([picker(), picker(), picker()]);
await list.settleRepositorySyncs();
expect(calls.filter(page => page === 1)).to.have.length(1);
expect(results.every(r => r.status === 200)).to.equal(true);
// A lock held by another process blocks this one until it expires.
await Syncs.updateOne({ ownerId: owner.id }, { $set: { lockId: "elsewhere", lockUntil: new Date(Date.now() + 60000) } });
expect(await list.startRepositorySync(owner.id, "oauth")).to.equal(null);
await Syncs.updateOne({ ownerId: owner.id }, { $set: { lockUntil: new Date(Date.now() - 1) } });
expect(await list.startRepositorySync(owner.id, "oauth")).to.have.property("first");
});
it("refreshes only when forced, and drops repositories that disappeared", async () => {
await setCredential(owner.id, "oauth-token");
await picker();
await list.settleRepositorySyncs();
upstream = [repo(1, "new/one"), ...upstream.slice(1)];
calls = [];
await picker();
expect(calls).to.deep.equal([]);
// A forced refresh right after a sync is ignored.
await picker({ force: "1" });
expect(calls).to.deep.equal([]);
await Syncs.updateOne({ ownerId: owner.id }, { $set: { syncedAt: new Date(Date.now() - 60000) } });
const forced = await picker({ force: "1" });
expect(forced.status).to.equal(200);
await list.settleRepositorySyncs();
expect(calls).to.deep.equal([1, 2, 3]);
const stored = await names(owner.id);
expect(stored).to.include("new/one");
expect(stored).not.to.include("org/repo-000");
expect(stored).to.have.length(250);
});
it("resyncs a list older than 12 hours in the background", async () => {
await setCredential(owner.id, "oauth-token");
await picker();
await list.settleRepositorySyncs();
calls = [];
await Syncs.updateOne({ ownerId: owner.id }, { $set: { syncedAt: new Date(Date.now() - 11 * 3600_000) } });
await picker();
await list.settleRepositorySyncs();
expect(calls).to.deep.equal([]);
await Syncs.updateOne({ ownerId: owner.id }, { $set: { syncedAt: new Date(Date.now() - 13 * 3600_000) } });
expect((await picker()).status).to.equal(200);
await list.settleRepositorySyncs();
expect(calls).to.deep.equal([1, 2, 3]);
});
it("pauses after a rate limit instead of retrying on every load", async () => {
await setCredential(owner.id, "oauth-token");
github.octokit = () => ({ request: async () => {
calls.push("limited");
const error = new Error("API rate limit exceeded");
error.status = 403;
error.response = { headers: { "x-ratelimit-remaining": "0", "retry-after": "120" } };
throw error;
} });
expect((await picker()).status).to.equal(429);
await list.settleRepositorySyncs();
const state = await Syncs.findOne({ ownerId: owner.id }).lean();
expect(state.error).to.equal("github_rate_limit_exceeded");
expect(state.retryAfter.getTime()).to.be.greaterThan(Date.now() + 100000);
expect((await picker({ force: "1" })).status).to.equal(429);
expect(calls).to.deep.equal(["limited"]);
});
it("lists App installations and keeps OAuth and App lists apart", async () => {
await setCredential(owner.id, "oauth-token");
await grantApp(owner.id);
mockApp({ 4: [repo(7, "owner/app-repo")], 5: [repo(8, "acme/lab")] });
// The first installation's page answers at once; the next one follows.
expect((await picker({ connection: "github-app" })).body.items.map(r => r.fullName)).to.deep.equal(["owner/app-repo"]);
await list.settleRepositorySyncs();
const result = await picker({ connection: "github-app" });
expect(result.body.items.map(r => r.fullName)).to.deep.equal(["acme/lab", "owner/app-repo"]);
expect(result.body.webhooks).to.equal(true);
expect((await Rows.findOne({ repositoryId: 8 }).lean()).installationId).to.equal(5);
expect(await Rows.countDocuments({ connection: "oauth" })).to.equal(0);
expect((await picker()).body.items[0].fullName).to.equal("org/repo-000");
await list.settleRepositorySyncs();
await revokeGrant(owner.id, "github-app-user");
expect(await Rows.countDocuments({ connection: "github-app" })).to.equal(0);
expect(await Rows.countDocuments({ connection: "oauth" })).to.equal(250);
expect((await picker({ connection: "github-app" })).status).to.equal(401);
});
describe("GitHub App webhooks", () => {
beforeEach(async () => {
await grantApp(owner.id);
await grantApp(other.id);
mockApp({ 4: [repo(7, "owner/seven"), repo(9, "owner/nine")], 6: [repo(70, "acme/shared")] });
await picker({ connection: "github-app" });
await list.settleRepositorySyncs();
await Rows.insertMany([
{ ownerId: other.id, connection: "github-app", repositoryId: 7, fullName: "owner/seven", nameKey: "owner/seven", installationId: 4, syncedAt: new Date() },
]);
await Syncs.create({ ownerId: other.id, connection: "github-app", syncedAt: new Date() });
calls = [];
});
it("rejects unsigned or forged deliveries without changing lists", async () => {
const payload = { action: "deleted", installation: { id: 4, app_id: 123 } };
expect((await webhook("installation", payload, "wrong-secret")).status).to.equal(401);
expect(await Rows.countDocuments({ installationId: 4 })).to.equal(3);
});
it("adds and removes selected repositories idempotently", async () => {
const added = { action: "added", installation: { id: 4, app_id: 123, account: { id: 10, type: "User" } },
sender: { id: 10 }, repository_selection: "selected", repositories_added: [{ id: 12, full_name: "owner/twelve", private: true }] };
expect((await webhook("installation_repositories", added)).status).to.equal(204);
expect((await webhook("installation_repositories", added)).status).to.equal(204);
expect(await Rows.countDocuments({ repositoryId: 12, ownerId: owner.id })).to.equal(1);
// Another installation user is not told about a private repository; they resync instead.
expect(await Rows.countDocuments({ repositoryId: 12, ownerId: other.id })).to.equal(0);
expect((await Syncs.findOne({ ownerId: other.id }).lean()).needsSyncAt).to.be.instanceOf(Date);
expect((await Syncs.findOne({ ownerId: owner.id }).lean()).needsSyncAt).to.equal(undefined);
const search = await picker({ connection: "github-app", q: "twelve" });
expect(search.body.items).to.deep.equal([{ id: 12, fullName: "owner/twelve", private: true }]);
const removed = { action: "removed", installation: { id: 4, app_id: 123 }, sender: { id: 10 },
repositories_removed: [{ id: 7, full_name: "owner/seven" }, { id: 12, full_name: "owner/twelve" }] };
expect((await webhook("installation_repositories", removed)).status).to.equal(204);
expect((await webhook("installation_repositories", removed)).status).to.equal(204);
expect(await names(owner.id)).to.deep.equal(["acme/shared", "owner/nine"]);
expect(await names(other.id)).to.deep.equal([]);
});
it("removes an uninstalled installation's repositories and hides suspended ones", async () => {
const suspend = { action: "suspend", installation: { id: 6, app_id: 123 } };
expect((await webhook("installation", suspend)).status).to.equal(204);
expect((await picker({ connection: "github-app" })).body.items.map(r => r.fullName)).to.deep.equal(["owner/nine", "owner/seven"]);
expect((await webhook("installation", { action: "unsuspend", installation: { id: 6, app_id: 123 } })).status).to.equal(204);
expect((await Syncs.findOne({ ownerId: owner.id }).lean()).needsSyncAt).to.be.instanceOf(Date);
await list.settleRepositorySyncs();
expect((await picker({ connection: "github-app" })).body.items.map(r => r.fullName)).to.include("acme/shared");
await list.settleRepositorySyncs();
const deleted = { action: "deleted", installation: { id: 4, app_id: 123 } };
expect((await webhook("installation", deleted)).status).to.equal(204);
expect((await webhook("installation", deleted)).status).to.equal(204);
expect(await names(owner.id)).to.deep.equal(["acme/shared"]);
expect(await names(other.id)).to.deep.equal([]);
});
it("stores a new installation's repositories for the user who installed it", async () => {
const created = { action: "created", installation: { id: 8, app_id: 123, account: { id: 99, type: "Organization" } },
sender: { id: 11 }, repositories: [{ id: 80, full_name: "neworg/tool", private: false }] };
expect((await webhook("installation", created)).status).to.equal(204);
expect(await names(other.id)).to.deep.equal(["neworg/tool", "owner/seven"]);
expect((await Rows.findOne({ repositoryId: 80 }).lean()).installationId).to.equal(8);
expect(await Rows.countDocuments({ repositoryId: 80, ownerId: owner.id })).to.equal(0);
expect((await Syncs.findOne({ ownerId: other.id }).lean()).needsSyncAt).to.be.instanceOf(Date);
});
it("follows repository renames, visibility changes and deletions", async () => {
const renamed = { action: "renamed", installation: { id: 4 }, sender: { id: 10 },
repository: repo(7, "owner/seven-renamed", { private: false, updated_at: "2026-02-01T00:00:00Z" }) };
expect((await webhook("repository", renamed)).status).to.equal(204);
expect(await names(owner.id)).to.include("owner/seven-renamed");
expect(await names(other.id)).to.deep.equal(["owner/seven-renamed"]);
// A delayed older delivery does not undo the rename.
const stale = { ...renamed, repository: repo(7, "owner/seven-old", { updated_at: "2026-01-15T00:00:00Z" }) };
expect((await webhook("repository", stale)).status).to.equal(204);
expect(await names(other.id)).to.deep.equal(["owner/seven-renamed"]);
const privatized = { action: "privatized", installation: { id: 4 }, sender: { id: 10 },
repository: repo(7, "owner/seven-renamed", { private: true, updated_at: "2026-02-02T00:00:00Z" }) };
expect((await webhook("repository", privatized)).status).to.equal(204);
expect((await Rows.findOne({ ownerId: other.id, repositoryId: 7 }).lean()).private).to.equal(true);
expect((await Syncs.findOne({ ownerId: other.id }).lean()).needsSyncAt).to.be.instanceOf(Date);
const created = { action: "created", installation: { id: 4 }, sender: { id: 10 }, repository: repo(15, "owner/fresh") };
expect((await webhook("repository", created)).status).to.equal(204);
expect(await names(owner.id)).to.include("owner/fresh");
expect(await Rows.countDocuments({ repositoryId: 15, ownerId: other.id })).to.equal(0);
const deleted = { action: "deleted", installation: { id: 4 }, sender: { id: 10 }, repository: repo(7, "owner/seven-renamed") };
expect((await webhook("repository", deleted)).status).to.equal(204);
expect((await webhook("repository", deleted)).status).to.equal(204);
expect(await Rows.countDocuments({ repositoryId: 7 })).to.equal(0);
expect(calls.filter(c => c.startsWith("/user/"))).to.deep.equal([]);
});
it("lets a sync keep rows a webhook wrote while it ran", async () => {
let release;
const gate = new Promise(resolve => { release = resolve; });
const fetchApp = globalThis.fetch;
globalThis.fetch = async (url, options) => {
if (String(url).includes("/user/installations/6/repositories")) await gate;
return fetchApp(url, options);
};
await Syncs.updateOne({ ownerId: owner.id }, { $set: { syncedAt: new Date(Date.now() - 60000) } });
await picker({ connection: "github-app", force: "1" });
await webhook("installation_repositories", { action: "added", installation: { id: 4, app_id: 123, account: { id: 10, type: "User" } },
sender: { id: 10 }, repositories_added: [{ id: 13, full_name: "owner/during", private: false }] });
release();
await list.settleRepositorySyncs();
expect(await names(owner.id)).to.include("owner/during");
});
});
});
+201 -6
View File
@@ -449,13 +449,16 @@ describe("Vue 3 UI", function () {
},
});
const picker = () => ui.window.document.querySelector(".repo-picker");
const button = text => [...picker().querySelectorAll("button")].find(b => b.textContent.trim() === text);
const button = label => picker().querySelector(`button[aria-label="${label}"]`);
expect(picker().textContent).to.include("repo-0");
expect(button("Previous").disabled).to.equal(true);
button("Next").click();
// Page 1 has no Previous button; the pager is the footer's compact icon pair.
expect(button("Previous page")).to.equal(null);
expect(picker().querySelector(".repo-picker-foot .repo-picker-pagination")).to.not.equal(null);
button("Next page").click();
await delay(30);
expect(picker().textContent).to.include("repo-20");
button("Previous").click();
expect(button("Previous page").disabled).to.equal(false);
button("Previous page").click();
await delay(30);
expect(picker().textContent).to.include("repo-0");
await ui.input(".repo-picker-filter", "needle");
@@ -1099,9 +1102,12 @@ describe("Vue 3 UI", function () {
state.sourceUrl = "https://github.com/owner/repo";
await state.urlSelected(); await delay(60);
expect(doc.querySelector('.repository-task')).to.equal(null);
for (const selector of ['#sourceUrl', '#terms', '#image', '#conference', '#expirationDate']) {
for (const selector of ['#sourceUrl', '#terms', '#image', '#conference']) {
expect(doc.querySelector(selector).closest('details')).to.equal(null);
}
// Under the free plan's limit the expiry reads as text; the exact date is one click away.
expect(doc.querySelector('.expiry-meta').textContent).to.include("Maximum on your plan");
expect(doc.querySelector('#expirationDate').closest('.hosting-date').style.display).to.equal("none");
state.terms = "Private Author";
await delay(450);
expect(doc.querySelector('.reviewer-preview .file-content, .anonymize-preview-body').textContent).to.include("MASKED");
@@ -1109,7 +1115,7 @@ describe("Vue 3 UI", function () {
state.options.expirationMode = "never"; await delay(20);
expect(doc.querySelector('.hosting-options').textContent).to.include("20 repositories");
expect(doc.querySelector('.anonymize-submit-bar').textContent).to.include("Continue to checkout");
// The caption also has a "Files" toggle (.rp-open) for the preview's tree; target Expand preview.
// Expand preview is the caption's only window control.
doc.querySelector('.reviewer-preview .rp-open.is-toggle').click(); await delay(10);
expect(doc.querySelector('.anonymize-page').classList.contains('preview-expanded')).to.equal(true);
doc.querySelector('.reviewer-preview .rp-open.is-toggle').click(); await delay(10);
@@ -3130,4 +3136,193 @@ describe("Vue 3 UI", function () {
expect(body(1).querySelector("pre code").textContent).to.equal(files[1].content);
expect(ui.errors).to.deep.equal([]);
});
describe("workspace polish (r19)", () => {
it("keeps the dashboard tabs and counts rendered while a tab reloads", async () => {
const item = (repoId, status) => ({ _type: "repo", repoId, status, source: { fullName: "owner/" + repoId }, options: {} });
let release;
ui = await browser("/dashboard", {
"/api/user": { username: "tester" },
"/api/user/dashboard": request => {
const removed = request.url.searchParams.get("statuses") === "removed";
const body = { items: removed ? [item("gone", "removed")] : [item("alpha", "ready"), item("broken", "error")],
total: 3, filtered: removed ? 1 : 2, attention: 1, cursor: null };
return removed ? new Promise(resolve => { release = () => resolve(body); }) : body;
},
});
const doc = ui.window.document;
await delay(50);
const tabs = () => [...doc.querySelectorAll(".dashboard-meta .dashboard-view-tabs button")].map(b => b.textContent.replace(/\s+/g, " ").trim());
expect(tabs()).to.deep.equal(["Current", "Needs attention 1", "Removed 1"]);
[...doc.querySelectorAll(".dashboard-view-tabs button")].find(b => /Removed/.test(b.textContent)).click();
await delay(250);
// The answer is pending: same tabs, the table busy, placeholders instead of a false empty state.
expect(tabs()).to.deep.equal(["Current", "Needs attention 1", "Removed 1"]);
const table = doc.querySelector(".paper-table-dashboard");
expect(table.getAttribute("aria-busy")).to.equal("true");
expect(table.classList.contains("is-refreshing")).to.equal(true);
expect(doc.querySelector(".paper-table-empty")).to.equal(null);
expect(doc.querySelectorAll(".paper-table-skeleton").length).to.be.greaterThan(0);
release(); await delay(30);
expect(table.classList.contains("is-refreshing")).to.equal(false);
expect(doc.querySelectorAll(".paper-table-skeleton")).to.have.length(0);
expect(doc.querySelector(".paper-table-row:not(.paper-table-skeleton):not(.paper-table-head)").textContent).to.include("gone");
expect(ui.errors).to.deep.equal([]);
});
it("holds the dashboard tab row with placeholders on the first load", async () => {
let release;
ui = await browser("/dashboard", {
"/api/user": { username: "tester" },
"/api/user/dashboard": () => new Promise(resolve => { release = () => resolve({ items: [], total: 0, filtered: 0, attention: 0, cursor: null }); }),
});
const doc = ui.window.document;
expect(doc.querySelector(".dashboard-meta.is-loading .dashboard-tab-skeleton")).to.not.equal(null);
expect(doc.querySelector(".paper-table-empty")).to.equal(null);
release(); await delay(30);
expect(doc.querySelector(".dashboard-meta.is-loading")).to.equal(null);
expect(doc.querySelector(".dashboard-meta .dashboard-count")).to.not.equal(null);
expect(ui.errors).to.deep.equal([]);
});
it("shows admin placeholder rows instead of an empty state until the list arrives", async () => {
let release;
ui = await browser("/admin/repositories", {
"/api/user": { username: "admin", isAdmin: true },
"/api/admin/repos": request => request.url.searchParams.get("limit") === "1"
? { total: 1, results: [], statusCounts: [] }
: new Promise(resolve => { release = () => resolve({ total: 1, results: [{ repoId: "r1", status: "ready", source: { repositoryName: "owner/r1" }, options: {} }] }); }),
});
const doc = ui.window.document;
await delay(30);
expect(doc.querySelectorAll(".paper-table-repos .paper-table-skeleton").length).to.be.greaterThan(0);
expect(doc.querySelector(".paper-table-repos .paper-table-empty")).to.equal(null);
expect(doc.querySelector(".seg-filter")).to.not.equal(null);
release(); await delay(30);
expect(doc.querySelectorAll(".paper-table-repos .paper-table-skeleton")).to.have.length(0);
expect(doc.querySelector(".paper-table-repos").getAttribute("aria-busy")).to.equal("false");
expect(ui.errors).to.deep.equal([]);
});
it("gives a picker row a tooltip only when its name is cut short", async () => {
ui = await browser("/anonymize", {
"/api/user/repository_picker": { items: [{ id: 1, fullName: "org/short" }], nextCursor: null },
});
const name = ui.window.document.querySelector(".repo-picker-name");
expect(name.hasAttribute("title")).to.equal(false);
name.dispatchEvent(new ui.window.MouseEvent("mouseenter"));
expect(name.hasAttribute("title")).to.equal(false);
Object.defineProperty(name, "scrollWidth", { configurable: true, value: 400 });
Object.defineProperty(name, "clientWidth", { configurable: true, value: 200 });
name.dispatchEvent(new ui.window.MouseEvent("mouseenter"));
expect(name.getAttribute("title")).to.equal("org/short");
expect(ui.errors).to.deep.equal([]);
});
it("states the redaction status beside the preview title and leads to the Terms field", async () => {
ui = await browser("/anonymize", { ...repositorySource, "/api/user/default": { terms: [], options: {} },
"/api/anonymize-preview": request => {
const mask = text => (request.payload.options?.terms || []).includes("Private Author") ? text.replaceAll("Private Author", "XXXX-1") : text;
return request.payload.contents ? { contents: request.payload.contents.map(mask) } : { content: mask(String(request.payload.content)) };
} });
const doc = ui.window.document;
const state = doc.querySelector("#sourceUrl")._field.binding.state;
state.sourceUrl = "https://github.com/owner/repo";
await state.urlSelected(); await delay(450);
const caption = doc.querySelector(".reviewer-preview .rp-caption");
expect(caption.querySelector(".rp-title").textContent).to.equal("What reviewers will see");
expect([...caption.querySelectorAll("button")].some(b => b.textContent.trim() === "Files")).to.equal(false);
const chip = caption.querySelector(".rp-status-empty");
expect(chip.textContent.replace(/\s+/g, " ").trim()).to.equal("Nothing redacted yet: add terms");
state.mobilePane = "preview";
chip.click(); await delay(20);
expect(state.mobilePane).to.equal("settings");
expect(doc.activeElement.id).to.equal("terms");
state.terms = "Private Author"; await delay(450);
expect(caption.querySelector(".rp-status-empty")).to.equal(null);
expect(caption.querySelector(".rp-count").textContent.replace(/\s+/g, " ").trim()).to.equal("1 redacted");
state.terms = "Nobody"; await delay(450);
expect(caption.querySelector(".rp-count").textContent).to.equal("No terms found in this file");
expect(ui.errors).to.deep.equal([]);
});
it("names the plan-limited date in the option and reveals the bounded input on Change date", async () => {
ui = await browser("/anonymize", { ...repositorySource, "/api/billing/": { ...taskBilling, freeExpirationMonths: 5 },
"/api/user/quota": { repository: { used: 1, total: 5 } } });
const doc = ui.window.document;
const state = doc.querySelector("#sourceUrl")._field.binding.state;
state.sourceUrl = "https://github.com/owner/repo";
await state.urlSelected(); await delay(60);
const option = doc.querySelector(".expiration-choice span");
expect(option.textContent).to.match(/^Expire on [A-Z][a-z]{2} \d{1,2}, \d{4}$/);
const meta = () => doc.querySelector(".expiry-meta").textContent.replace(/\s+/g, " ").trim();
expect(meta()).to.equal("In 5 months · Maximum on your plan");
expect(doc.querySelector(".expiration-choice-row .expiry-change").textContent).to.equal("Change date");
expect(doc.querySelector(".dated-options").textContent).not.to.match(/Expires|Then|Advanced/);
expect(doc.querySelector(".hosting-property label").textContent).to.equal("After expiry");
const row = doc.querySelector("#expirationDate").closest(".hosting-date");
expect(row.style.display).to.equal("none");
doc.querySelector(".expiry-change").click(); await delay(20);
expect(row.style.display).to.equal("");
expect(doc.activeElement.id).to.equal("expirationDate");
expect(doc.querySelector(".expiry-change")).to.equal(null);
const input = doc.querySelector("#expirationDate");
expect(input.getAttribute("max")).to.equal(state.maxExpirationDate);
expect(input.getAttribute("min")).to.equal(state.minExpirationDate);
// An earlier pick is still named, without the "maximum" reason.
const earlier = new Date(); earlier.setMonth(earlier.getMonth() + 2);
state.options.expirationDate = new ui.window.Date(earlier.getTime()); await delay(20);
expect(meta()).to.equal("In 2 months");
state.options.expirationMode = "never"; await delay(20);
expect(doc.querySelector(".dated-options")).to.equal(null);
expect(option.textContent).to.equal("Expire on a date");
expect(ui.errors).to.deep.equal([]);
});
it("reveals and focuses a hidden invalid date on submit", async () => {
ui = await browser("/anonymize", { ...repositorySource, "/api/billing/": { ...taskBilling, freeExpirationMonths: 5 },
"/api/user/quota": { repository: { used: 1, total: 5 } } });
const doc = ui.window.document;
const state = doc.querySelector("#sourceUrl")._field.binding.state;
state.sourceUrl = "https://github.com/owner/repo";
await state.urlSelected(); await delay(60);
const input = doc.querySelector("#expirationDate");
expect(input.closest(".hosting-date").style.display).to.equal("none");
input.setCustomValidity("out of range");
input.dispatchEvent(new ui.window.Event("reveal", { bubbles: true }));
await delay(20);
expect(state.expiryPickerOpen).to.equal(true);
expect(input.closest(".hosting-date").style.display).to.equal("");
expect(ui.errors).to.deep.equal([]);
});
it("keeps the plain date picker when no plan limit applies", async () => {
ui = await browser("/anonymize", repositorySource);
const doc = ui.window.document;
const state = doc.querySelector("#sourceUrl")._field.binding.state;
state.sourceUrl = "https://github.com/owner/repo";
await state.urlSelected(); await delay(60);
expect(doc.querySelector(".expiry-meta")).to.equal(null);
expect(doc.querySelector(".expiration-choice span").textContent).to.equal("Expire on a date");
expect(doc.querySelector("#expirationDate").closest(".hosting-date").style.display).to.equal("");
const echo = doc.querySelector(".hosting-date .date-echo").textContent;
expect(echo).not.to.match(/^Expires/);
expect(echo).to.match(/· in \d+ months?$/);
expect(ui.errors).to.deep.equal([]);
});
it("names the conference when its end date sets the expiry", async () => {
const end = new Date(); end.setMonth(end.getMonth() + 9);
ui = await browser("/anonymize", { ...repositorySource, "/api/billing/": { ...taskBilling, freeExpirationMonths: 5 },
"/api/user/quota": { repository: { used: 1, total: 5 } },
"/api/conferences/ICSE": { conferenceID: "ICSE", name: "ICSE 2027", startDate: new Date().toISOString(), endDate: end.toISOString(), options: {} } });
const doc = ui.window.document;
const state = doc.querySelector("#sourceUrl")._field.binding.state;
state.sourceUrl = "https://github.com/owner/repo";
await state.urlSelected(); await delay(60);
state.conference = "ICSE"; await delay(60);
expect(doc.querySelector(".expiry-meta").textContent).to.include("When ICSE 2027 ends");
expect(ui.errors).to.deep.equal([]);
});
});
});