Merge pull request #989 from tdurieux/feat/table-analysis

feat(viewer): sort, filter, summarize, group and chart tables
This commit is contained in:
Thomas Durieux authored and GitHub committed 2026-11-29 04:47:50 -08:00
commit 7699759ab4
19 files changed
+2229 -101

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
{
"core.min.js": "core.d23af1c652.min.js",
"vendor.min.js": "vendor.375d384758.min.js",
"vendor.min.js": "vendor.f9a85827d5.min.js",
"mermaid.min.js": "mermaid.a7356d5ed1.min.js",
"all.min.css": "all.38119ba6ea.min.css",
"all.min.css": "all.062d856a9f.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
+239
View File
@@ -15086,6 +15086,245 @@ body.dark-mode .reviewer-preview .rp-preserved-tag { background: rgba(251, 191,
.gist-file-tools { width: 100%; margin-left: 0; justify-content: space-between; }
}
/* ===== R21 Table analysis (data-table.js, table-enhance.js) =====
The CSV viewer keeps its table; a quiet toolbar row sits above it and a summary
row under it. Series colours: dataviz reference slots 1-4, validated on the
card (#FFF) and the dark canvas (#161412). */
body { --dt-series-1: #2a78d6; --dt-series-2: #eb6834; --dt-series-3: #1baf7a; --dt-series-4: #eda100; --dt-grid: #ECE8E0; --dt-axis: #CFC8BB; }
.dark-mode { --dt-series-1: #3987e5; --dt-series-2: #d95926; --dt-series-3: #199e70; --dt-series-4: #c98500; --dt-grid: #2A2724; --dt-axis: #4A453E; }
.dt { display: flex; flex-direction: column; min-width: 0; }
.dt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 24px 0; font-size: 13px; }
.dt-search { position: relative; display: inline-flex; align-items: center; margin: 0; flex: 0 1 220px; min-width: 140px; }
.dt-search .ui-icon { position: absolute; left: 9px; width: 14px; height: 14px; color: var(--ink-muted); pointer-events: none; }
.dt-search-input { width: 100%; height: 30px; padding: 0 10px 0 29px; border: 1px solid var(--border-color); border-radius: var(--radius-control); background: var(--input-bg); color: var(--input-color); font: 13px/1 var(--font-sans); }
.dt-search-input::placeholder { color: var(--ink-muted); }
.dt-search-input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
.dt-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); font-size: 12.5px; color: var(--color); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dt-chip-name { color: var(--ink-soft); }
.dt-chip-name::after { content: ":"; }
.dt-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer; }
.dt-chip-x:hover { background: var(--hover-bg-color); color: var(--color); }
.dt-chip-x .ui-icon { width: 12px; height: 12px; }
.dt-link { padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--link-color); cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
.dt-count { margin-left: auto; font-size: 12.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt-tools { display: inline-flex; align-items: center; gap: 6px; }
.dt-select { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; margin: 0; padding: 0 26px 0 10px; border: 1px solid var(--border-color); border-radius: var(--radius-control); background: var(--paper-card); font-size: 12.5px; color: var(--color); white-space: nowrap; }
.dt-select:hover { background: var(--hover-bg-color); }
.dt-select.is-on { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-color)); }
.dt-select-label { color: var(--ink-muted); font-size: 12.5px; }
.dt-select select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; padding: 0; font: 500 12.5px/1 var(--font-sans); color: var(--color); cursor: pointer; max-width: 160px; }
.dt-select select:focus { outline: none; }
.dt-select:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.dt-select select::before { content: ""; position: absolute; inset: 0; }
.dt-select .dt-caret, .dt-copy-btn .dt-caret { position: absolute; right: 7px; width: 12px; height: 12px; color: var(--ink-muted); pointer-events: none; }
.dark-mode .dt-select { background: var(--canvas-bg-color); }
.dark-mode .dt-select select option { background: var(--paper-card); color: var(--color); }
.dt-copy { position: relative; }
.dt-copy-btn { position: relative; height: 30px; padding: 0 26px 0 9px !important; gap: 6px; font-size: 12.5px !important; border: 1px solid var(--border-color) !important; }
.dt-copy-btn .ui-icon:not(.dt-caret) { width: 14px; height: 14px; }
.dt-copy-menu, .dt-tools-menu { width: 240px; }
.dt-tools-m { display: none; position: relative; }
.dt-menu-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 6px 10px; font-size: 13px; color: var(--ink-soft); }
.dt-menu-field select { max-width: 130px; height: 30px; border: 1px solid var(--border-color); border-radius: var(--radius-control); background: var(--input-bg); color: var(--color); font: 13px var(--font-sans); }
/* No vertical padding on the scroller: the sticky header and summary row meet its edges, so no rows peek past them. */
/* The scroll box is the table's rounded frame: it clips the sticky header and
summary row to its corners and ends at the summary row, so no row shows past
it. The table inside draws no outer border of its own. */
.dt .dt-wrap { width: fit-content; max-width: calc(100% - 48px); max-height: calc(100vh - 190px); margin: 12px 24px 24px; padding: 0 !important; overflow: auto; border: 1px solid var(--border-color); border-radius: 8px; background: var(--paper-card) !important; }
.dark-mode .dt .dt-wrap { background: var(--canvas-bg-color) !important; }
.dt .dt-wrap .dt-table { border: 0 !important; border-radius: 0 !important; background: transparent !important; }
.dt .dt-wrap .dt-table thead th { border-radius: 0 !important; }
.dt .dt-wrap .dt-table tbody tr:last-child td { border-radius: 0 !important; }
@media (max-width: 767px) { .dt .dt-wrap { max-width: calc(100% - 32px); max-height: calc(100dvh - 210px); margin: 12px 16px 16px; } }
/* Header: the name sorts; the chevron opens stats and filters. */
.dt-table thead th { padding: 0 !important; }
.dt-th { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.dt-table th.is-num .dt-th { flex-direction: row-reverse; }
.dt-sort { display: inline-flex; align-items: center; gap: 6px; padding: 8px 4px 8px 22px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.dt-table th.is-num .dt-sort { padding: 8px 22px 8px 4px; flex-direction: row-reverse; }
.dt-sort:hover .dt-th-name { color: var(--color); }
.dt-sort:focus-visible, .dt-col-btn:focus-visible, .md-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.dt-sort-icon { width: 8px; height: 12px; flex: none; fill: var(--ink-faint); opacity: .45; transition: opacity .12s; }
th:hover .dt-sort-icon { opacity: .9; }
.dt-sort-icon.is-asc, .dt-sort-icon.is-desc { opacity: 1; }
.dt-sort-icon.is-asc .up, .dt-sort-icon.is-desc .down { fill: var(--accent); }
.dt-sort-icon.is-asc .down, .dt-sort-icon.is-desc .up { opacity: .25; }
.dt-table th.is-sorted { color: var(--color); }
.dt-col-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 0 6px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--ink-muted); cursor: pointer; opacity: 0; transition: opacity .12s; }
.dt-col-btn .ui-icon { width: 12px; height: 12px; }
th:hover .dt-col-btn, .dt-col-btn:focus-visible, .dt-col-btn.is-on { opacity: 1; }
.dt-col-btn:hover, .dt-col-btn.is-on { background: var(--hover-bg-color); color: var(--color); }
@media (hover: none) { .dt-col-btn { opacity: .7; } }
.dt-table th:first-child .dt-sort { padding-left: 16px; }
.dt-table .csv-rownum + th .dt-sort { padding-left: 22px; }
@media (max-width: 767px) {
.dt-sort { padding: 7px 2px 7px 10px; }
.dt-table th.is-num .dt-sort { padding: 7px 10px 7px 2px; }
.dt-col-btn { margin: 0 2px; }
}
/* Summary row: the table's last row, on the column grid. A 2px rule and a solid
fill; it sticks to the bottom of the scroll box, which ends at its edge. Each
numeric cell has its own small aggregate select. */
.dt-table tfoot td { position: sticky; bottom: 0; z-index: 1; padding-top: 8px; padding-bottom: 8px; border-top: 2px solid var(--border-color); border-bottom: 0; box-shadow: none; background: var(--paper-bg-alt) !important; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dark-mode .dt-table tfoot td { background: var(--paper-card) !important; }
.dt-table:has(> tfoot) tbody tr:last-child td { border-bottom: 0 !important; border-radius: 0 !important; }
.dt-table tfoot .csv-rownum { color: var(--ink-muted); font-size: 13px; }
.dt-sum { display: inline-flex; align-items: baseline; gap: 6px; }
.dt-sum.is-text { color: var(--ink-muted); }
.dt-sum-value { font-weight: 600; color: var(--color); font-size: 13px; }
.dt-sum-fn { position: relative; display: inline-flex; align-items: center; gap: 1px; margin: 0; color: var(--ink-muted); font-size: 11.5px; cursor: pointer; }
.dt-sum-fn select { position: absolute; inset: -4px -6px; width: calc(100% + 12px); opacity: 0; cursor: pointer; font-size: 16px; }
.dt-sum-caret { width: 10px; height: 10px; color: var(--ink-faint); }
.dt-sum-fn:hover, .dt-sum-fn:hover .dt-sum-caret { color: var(--color); }
.dt-sum-fn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.dt-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dt-menu-hint { margin: 4px 8px 0; font-size: 12px; color: var(--ink-muted); line-height: 1.45; }
.dt-empty-row td { padding: 28px 22px !important; color: var(--ink-muted); text-align: center !important; white-space: normal !important; }
.dt-more { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: -10px; padding: 0 24px 24px; font-size: 12.5px; color: var(--ink-muted); }
@media (max-width: 767px) { .dt-more { margin-top: -6px; padding: 0 16px 16px; } }
.dt.is-grouped .dt-table tbody td:first-child { font-weight: 500; }
/* Column menu: stats, histogram, sort, filter, group. */
.dt-menu { position: fixed; z-index: 60; width: 260px; max-height: min(520px, calc(100vh - 24px)); overflow: auto; padding: 12px; background: var(--paper-card); border: 1px solid var(--border-color); border-radius: var(--radius-surface); box-shadow: 0 8px 28px rgba(26, 24, 21, .14); font-size: 12.5px; color: var(--color); text-align: left; font-weight: 400; }
.dark-mode .dt-menu { box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.dt-menu:focus { outline: none; }
.dt-menu-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dt-menu-head b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-menu-head span { color: var(--ink-muted); font-size: 12px; white-space: nowrap; }
.dt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin: 0; }
.dt-stats div { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.dt-stats dt { font-weight: 400; color: var(--ink-muted); }
.dt-stats dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-hist { margin: 12px 0 0; }
.dt-hist svg { display: block; }
.dt-hist rect { fill: var(--dt-series-1); }
.dt-hist figcaption { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.dt-top { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 5px; }
.dt-top li { display: grid; grid-template-columns: minmax(0, 1fr) 72px 28px; align-items: center; gap: 8px; }
.dt-top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-top-bar { height: 6px; border-radius: 3px; background: var(--dt-series-1); justify-self: start; }
.dt-top-n { text-align: right; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.dt-menu-sec { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.dt-menu-label { margin-bottom: 6px; color: var(--ink-muted); font-size: 12px; }
.dt-menu-sort { display: flex; width: 100%; }
.dt-menu-sort .seg-chip { flex: 1; justify-content: center; height: 26px; font-size: 12.5px; }
.dt-range { display: flex; align-items: center; gap: 6px; color: var(--ink-muted); }
.dt-range-input { width: 100%; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--border-color); border-radius: var(--radius-control); background: var(--input-bg); color: var(--input-color); font: 13px var(--font-sans); font-variant-numeric: tabular-nums; }
.dt-range-input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.dt-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.dt-value-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1px solid var(--border-color); border-radius: 999px; background: transparent; font: 12.5px var(--font-sans); color: var(--color); cursor: pointer; max-width: 100%; }
.dt-value-chip:hover { background: var(--hover-bg-color); }
.dt-value-chip.is-on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 500; }
.dt-value-n { color: var(--ink-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.dt-menu-action { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border: 0; border-radius: var(--radius-control); background: none; font: 13px var(--font-sans); color: var(--color); cursor: pointer; text-align: left; }
.dt-menu-action:hover { background: var(--hover-bg-color); }
.dt-menu-action .ui-icon { width: 15px; height: 15px; color: var(--ink-soft); }
/* Chart view */
.dt-chart-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px 24px 0; }
.dt-chart-type { padding: 2px; }
.dt-chart-type .seg-chip { height: 26px; padding: 0 10px; font-size: 12.5px; }
.dt-y { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.dt-y .dt-select-label { margin-right: 2px; }
.dt-y-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--border-color); border-radius: 999px; background: transparent; font: 12.5px var(--font-sans); color: var(--ink-soft); cursor: pointer; }
.dt-y-chip:hover { background: var(--hover-bg-color); color: var(--color); }
.dt-y-chip.is-on { color: var(--color); font-weight: 500; border-color: color-mix(in srgb, var(--ink-muted) 60%, transparent); }
.dt-key { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 2px; background: var(--key); }
.dt-key.is-line { width: 12px; height: 2px; border-radius: 1px; }
.dt-key.is-scatter { width: 8px; height: 8px; border-radius: 50%; }
.dt-chart { position: relative; margin: 14px 24px 24px; padding: 16px 16px 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--paper-card); }
.dark-mode .dt-chart { background: var(--canvas-bg-color); }
.dt-chart-notes { margin: 0 0 8px; font-size: 12px; color: var(--ink-muted); }
.dt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-soft); }
.dt-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.dt-chart-empty { margin: 32px 0; text-align: center; color: var(--ink-muted); font-size: 13px; }
.dt-svg { display: block; max-width: 100%; overflow: visible; font-family: var(--font-sans); }
.dt-svg:focus { outline: none; }
.dt-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.dt-grid { stroke: var(--dt-grid); stroke-width: 1; shape-rendering: crispEdges; }
.dt-axis { stroke: var(--dt-axis); stroke-width: 1; shape-rendering: crispEdges; }
.dt-crosshair { stroke: var(--ink-muted); stroke-width: 1; shape-rendering: crispEdges; }
.dt-tick { fill: var(--ink-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.dt-cat { fill: var(--ink-soft); font-size: 12px; }
.dt-value { fill: var(--ink-soft); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.dt-bar { transition: opacity .12s; }
.dt-bar.is-dim { opacity: .45; }
.dt-hover-band { fill: var(--hover-bg-color); }
.dt-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dt-dot { stroke: var(--paper-card); stroke-width: 2; }
.dark-mode .dt-dot { stroke: var(--canvas-bg-color); }
.dt-hit { fill: transparent; cursor: crosshair; }
.dt-axis-label { margin-top: 4px; font-size: 12px; color: var(--ink-muted); text-align: center; }
.dt-tip { position: absolute; z-index: 5; min-width: 120px; max-width: 240px; padding: 8px 10px; background: var(--paper-card); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 6px 20px rgba(26, 24, 21, .14); font-size: 12px; pointer-events: none; }
.dark-mode .dt-tip { background: var(--paper-card); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.dt-tip-title { margin-bottom: 4px; color: var(--ink-soft); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-tip-row { display: flex; align-items: center; gap: 7px; line-height: 1.6; white-space: nowrap; }
.dt-tip-row b { font-weight: 600; color: var(--color); font-variant-numeric: tabular-nums; }
.dt-tip-row span:last-child { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; }
.dt-tip-note { margin-top: 3px; color: var(--ink-muted); font-size: 11.5px; }
/* Gist cards and the dialog: same toolbar, tighter gutters. */
.gist-file-body.is-csv .dt-toolbar, .gist-file-body.is-csv .dt-chart-controls { padding-left: 20px; padding-right: 20px; }
.gist-file-body.is-csv .dt-chart { margin: 14px 20px 20px; }
.gist-file-body.is-csv .dt .dt-wrap { max-height: 520px; max-width: calc(100% - 40px); margin: 12px 20px 20px; border: 1px solid var(--border-color); border-radius: 8px; }
@media (max-width: 767px) { .gist-file-body.is-csv .dt .dt-wrap { max-width: calc(100% - 32px); margin: 12px 16px 16px; } }
@media (max-width: 767px) {
.dt-toolbar { padding: 12px 16px 0; gap: 6px; flex-wrap: nowrap; }
.dt-toolbar .dt-chip, .dt-toolbar .dt-link { display: none; }
.dt-search { flex: 1 1 auto; min-width: 0; }
.dt-count { margin-left: 4px; font-size: 12px; }
.dt-tools { display: none; }
.dt-tools-m { display: inline-flex; }
.dt-tools-btn { width: 32px !important; height: 32px !important; border: 1px solid var(--border-color) !important; }
.dt-chart-controls { padding: 12px 16px 0; }
.dt-chart { margin: 12px 16px 16px; padding: 12px 10px 10px; }
.gist-file-body.is-csv .dt-toolbar, .gist-file-body.is-csv .dt-chart-controls { padding-left: 16px; padding-right: 16px; }
.gist-file-body.is-csv .dt-chart { margin: 12px 16px 16px; }
}
/* Markdown and notebook tables: sortable headers, an optional Σ row, Open as table. */
.md-table { display: block; width: max-content; max-width: 100%; margin: 0 0 16px; }
.markdown-body .md-table > table { margin-bottom: 0 !important; }
.md-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.md-sort { display: inline-flex; align-items: center; margin-left: 5px; padding: 2px; border: 0; background: none; vertical-align: -1px; cursor: pointer; }
.md-sort .dt-sort-icon { opacity: .35; }
.md-sortable:hover .md-sort .dt-sort-icon { opacity: .9; }
.md-sort .dt-sort-icon.is-asc, .md-sort .dt-sort-icon.is-desc { opacity: 1; }
.markdown-body table tfoot.md-summary td, notebook table.dataframe tfoot.md-summary td { border-top: 2px solid var(--border-color) !important; background: var(--paper-bg-alt) !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dark-mode .markdown-body table tfoot.md-summary td, .dark-mode notebook table.dataframe tfoot.md-summary td { background: var(--paper-card) !important; }
.markdown-body table tfoot.md-summary td.is-num, .markdown-body table tfoot.md-summary td.is-muted, .markdown-body table tfoot.md-summary td.md-summary-label, notebook table.dataframe tfoot.md-summary td.is-muted, notebook table.dataframe tfoot.md-summary td.md-summary-label { color: var(--ink-muted); font-size: .9em; }
.markdown-body tfoot.md-summary .dt-sum-value, notebook tfoot.md-summary .dt-sum-value { font-size: inherit; }
.md-table-tools { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 6px; }
.md-table-btn { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border: 0; border-radius: var(--radius-control); background: none; font: 12.5px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.md-table-btn:hover { background: var(--hover-bg-color); color: var(--color); }
.md-table-btn .ui-icon { width: 14px; height: 14px; }
.md-sigma > span[aria-hidden] { font-size: 14px; line-height: 1; }
.md-sigma.is-on { color: var(--color); background: var(--accent-soft); }
.md-table-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.notebook-body .md-table, notebook .md-table { margin-bottom: 4px; }
/* Open as table: the full viewer in a dialog. */
.dt-dialog-backdrop { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 24px 24px; background: rgba(26, 24, 21, .36); }
.dark-mode .dt-dialog-backdrop { background: rgba(0, 0, 0, .6); }
.dt-dialog { display: flex; flex-direction: column; width: min(1040px, 100%); max-height: 88vh; overflow: hidden; background: var(--main-bg-color); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 24px 60px rgba(26, 24, 21, .25); }
.dt-dialog-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 24px; border-bottom: 1px solid var(--border-color); }
.dt-dialog-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-dialog .dt-view-toggle { padding: 2px; }
.dt-dialog .dt-view-toggle .seg-chip { height: 26px; padding: 0 10px; font-size: 12.5px; }
.dt-dialog .dt { overflow: auto; }
.dt-dialog .dt .dt-wrap { max-height: none; }
@media (max-width: 767px) {
.dt-dialog-backdrop { padding: 0; }
.dt-dialog { max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; }
.dt-dialog-head { padding: 10px 10px 10px 16px; }
}
.dt-th-agg { font-weight: 400; font-size: 11.5px; color: var(--ink-muted); }
.dt-menu-note { padding: 4px 10px 2px; font-size: 12px; color: var(--ink-muted); }
.dt-dialog:focus { outline: none; }
/* ===== 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,
+165
View File
@@ -0,0 +1,165 @@
<div class="dt" :class="{ 'is-chart': view === 'chart', 'is-grouped': !!groupColumn }">
<div class="dt-toolbar" role="toolbar" :aria-label="'Analyze ' + (label || name || 'table')">
<label class="dt-search">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-search"></use></svg>
<span class="sr-only">Filter rows</span>
<input type="search" class="dt-search-input" placeholder="Filter rows" autocomplete="off" spellcheck="false" :value="s.query" @input="s.query = $event.target.value" @keydown.esc="s.query = ''">
</label>
<span class="dt-chip" v-for="f in activeFilters" :key="f.key"><span class="dt-chip-name">{{ f.name }}</span><template v-for="(seg, si) in redactParts(f.text)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template><button type="button" class="dt-chip-x" :aria-label="'Remove the ' + f.name + ' filter'" @click="f.clear()"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-close"></use></svg></button></span>
<button type="button" class="dt-link" v-if="activeFilters.length &gt; 1 || (activeFilters.length &amp;&amp; s.query)" @click="clearFilters()">Clear</button>
<span class="dt-count" aria-live="polite">{{ rowCountText }}</span>
<div class="dt-tools">
<label class="dt-select" :class="{ 'is-on': !!groupColumn }">
<span class="dt-select-label">Group by</span>
<select :value="s.group || ''" @change="setGroup($event.target.value)" aria-label="Group rows by">
<option value="">None</option>
<option v-for="c in groupable" :key="c.index" :value="c.name">{{ c.name }}</option>
</select>
<svg class="ui-icon dt-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg>
</label>
<label class="dt-select is-on" v-if="groupColumn">
<span class="sr-only">Aggregate of each group</span>
<select :value="s.agg" @change="setAgg($event.target.value)" aria-label="Aggregate of each group">
<option v-for="[fn, text] in AGGREGATES" :key="fn" :value="fn">{{ text }}</option>
</select>
<svg class="ui-icon dt-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg>
</label>
<div class="dt-copy">
<button type="button" class="btn btn-sm btn-ghost dt-copy-btn" :class="{ 'is-on': s.copyOpen }" aria-haspopup="true" :aria-expanded="s.copyOpen ? 'true' : 'false'" :title="isChanged() ? 'Copy or download this view' : 'Copy or download the table'" @click="s.copyOpen = !s.copyOpen"><svg class="ui-icon" aria-hidden="true"><use :href="s.copied &amp;&amp; s.copied !== 'error' ? '#ui-icon-check' : '#project-icon-copy'"></use></svg><span>{{ s.copied === 'csv' ? 'Copied CSV' : s.copied === 'md' ? 'Copied Markdown' : s.copied === 'error' ? 'Copy failed' : 'Copy' }}</span><svg class="ui-icon dt-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button>
<div class="tb-menu dt-copy-menu" v-if="s.copyOpen" role="menu">
<div class="tb-menu-label">{{ isChanged() ? 'This view · ' + formatNumber(sorted.length) + (groupColumn ? ' groups' : ' rows') : 'All ' + formatNumber(sorted.length) + ' rows' }}</div>
<button type="button" role="menuitem" @click="copyAs('csv')"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-copy"></use></svg>Copy as CSV</button>
<button type="button" role="menuitem" @click="copyAs('md')"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg>Copy as Markdown table</button>
<button type="button" role="menuitem" @click="download()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-download"></use></svg>Download as CSV</button>
</div>
</div>
</div>
<div class="dt-tools-m">
<button type="button" class="btn btn-sm btn-ghost btn-icon-only dt-tools-btn" :class="{ 'is-on': s.toolsOpen || !!groupColumn }" aria-label="Table tools" aria-haspopup="true" :aria-expanded="s.toolsOpen ? 'true' : 'false'" @click="s.toolsOpen = !s.toolsOpen"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg></button>
<div class="tb-menu dt-tools-menu" v-if="s.toolsOpen" role="menu">
<label class="dt-menu-field"><span>Group by</span><select :value="s.group || ''" @change="setGroup($event.target.value)"><option value="">None</option><option v-for="c in groupable" :key="c.index" :value="c.name">{{ c.name }}</option></select></label>
<label class="dt-menu-field" v-if="groupColumn"><span>Aggregate</span><select :value="s.agg" @change="setAgg($event.target.value)"><option v-for="[fn, text] in AGGREGATES" :key="fn" :value="fn">{{ text }}</option></select></label>
<template v-if="activeFilters.length"><div class="tb-menu-sep"></div><div class="dt-menu-note">Filters</div><button type="button" role="menuitem" v-for="f in activeFilters" :key="'m' + f.key" @click="f.clear()"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-close"></use></svg>{{ f.name }}: {{ f.text }}</button></template>
<div class="tb-menu-sep"></div>
<button type="button" role="menuitem" @click="copyAs('csv')"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-copy"></use></svg>Copy as CSV</button>
<button type="button" role="menuitem" @click="copyAs('md')"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg>Copy as Markdown table</button>
<button type="button" role="menuitem" @click="download()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-download"></use></svg>Download as CSV</button>
</div>
</div>
</div>
<template v-if="view === 'chart'">
<div class="dt-chart-controls">
<div class="seg-filter dt-chart-type" role="radiogroup" aria-label="Chart type">
<button type="button" role="radio" class="seg-chip" v-for="t in ['bar', 'line', 'scatter']" :key="t" :class="{ active: chartSpec.type === t }" :aria-checked="chartSpec.type === t ? 'true' : 'false'" @click="setChartType(t)">{{ t === 'bar' ? 'Bar' : t === 'line' ? 'Line' : 'Scatter' }}</button>
</div>
<label class="dt-select is-on">
<span class="dt-select-label">X</span>
<select :value="chartSpec.x" @change="setX($event.target.value)" aria-label="Column on the x axis">
<option v-for="c in table.columns" :key="c.index" :value="c.name">{{ c.name }}</option>
</select>
<svg class="ui-icon dt-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg>
</label>
<div class="dt-y" role="group" aria-label="Columns to plot">
<span class="dt-select-label">Y</span>
<button type="button" class="dt-y-chip" v-for="c in numericColumns.filter(c =&gt; c.name !== chartSpec.x)" :key="c.index" :class="{ 'is-on': yOn(c.name) }" :aria-pressed="yOn(c.name) ? 'true' : 'false'" @click="toggleY(c.name)"><span class="dt-key" v-if="yOn(c.name)" :class="['is-' + chartSpec.type]" :style="{ '--key': 'var(--dt-series-' + (seriesIndex(c.name) + 1) + ')' }"></span>{{ c.name }}</button>
</div>
</div>
<figure class="dt-chart" ref="chartHost" @mouseleave="leaveChart()">
<figcaption class="dt-chart-notes" v-if="chart &amp;&amp; chart.notes.length">{{ chart.notes.join(' ') }}</figcaption>
<div class="dt-legend" v-if="chart &amp;&amp; !chart.empty &amp;&amp; chart.series.length &gt; 1"><span class="dt-legend-item" v-for="(ser, si) in chart.series" :key="ser.name"><span class="dt-key" :class="'is-' + chart.kind" :style="{ '--key': 'var(--dt-series-' + (si + 1) + ')' }"></span>{{ ser.name }}</span></div>
<p class="dt-chart-empty" v-if="chart &amp;&amp; chart.empty">{{ chart.empty }}</p>
<svg v-if="chart &amp;&amp; !chart.empty" class="dt-svg" :width="chart.width" :height="chart.height" :viewBox="'0 0 ' + chart.width + ' ' + chart.height" role="img" :aria-label="chartSummary" tabindex="0" @keydown="keyStep($event)" @blur="leaveChart()">
<template v-if="chart.kind === 'bar'">
<line v-for="t in chart.xTicks" :key="'g' + t.v" class="dt-grid" :x1="t.x" :x2="t.x" :y1="chart.plot.y" :y2="chart.plot.y + chart.plot.h"></line>
<rect v-if="s.tip" class="dt-hover-band" :x="0" :y="chart.categories[s.tip.index].hit.y" :width="chart.width" :height="chart.categories[s.tip.index].hit.h"></rect>
<path v-for="m in chart.marks" :key="m.key" class="dt-bar" :d="m.path" :style="{ fill: 'var(--dt-series-' + (m.series + 1) + ')' }" :class="{ 'is-dim': s.tip &amp;&amp; s.tip.index !== m.cat }"></path>
<line class="dt-axis" :x1="chart.zero" :x2="chart.zero" :y1="chart.plot.y" :y2="chart.plot.y + chart.plot.h"></line>
<text v-for="(cat, ci) in chart.categories" :key="'c' + ci" class="dt-cat" :x="chart.plot.x - 10" :y="cat.y" text-anchor="end" dominant-baseline="central">{{ cat.label.length &gt; 28 ? cat.label.slice(0, 27) + '…' : cat.label }}</text>
<template v-if="chart.showValues"><text v-for="m in chart.marks" :key="'v' + m.key" class="dt-value" :x="m.lx" :y="m.ly" :text-anchor="m.anchor" dominant-baseline="central">{{ m.label }}</text></template>
<text v-for="t in chart.xTicks" :key="'t' + t.v" class="dt-tick" :x="t.x" :y="chart.plot.y + chart.plot.h + 16" text-anchor="middle">{{ t.label }}</text>
<rect class="dt-hit" x="0" :y="chart.plot.y" :width="chart.width" :height="chart.plot.h" @pointermove="pointerAt($event)" @pointerdown="pointerAt($event)"></rect>
</template>
<template v-else>
<line v-for="(t, ti) in chart.yTicks" :key="'g' + ti" class="dt-grid" :x1="chart.plot.x" :x2="chart.plot.x + chart.plot.w" :y1="t.y" :y2="t.y"></line>
<text v-for="(t, ti) in chart.yTicks" :key="'y' + ti" class="dt-tick" :x="chart.plot.x - 8" :y="t.y" text-anchor="end" dominant-baseline="central">{{ t.label }}</text>
<line class="dt-axis" :x1="chart.plot.x" :x2="chart.plot.x + chart.plot.w" :y1="chart.plot.y + chart.plot.h" :y2="chart.plot.y + chart.plot.h"></line>
<text v-for="(t, ti) in chart.xTicks" :key="'x' + ti" class="dt-tick" :x="t.x" :y="chart.plot.y + chart.plot.h + 18" :text-anchor="t.anchor || 'middle'">{{ t.label.length &gt; 18 ? t.label.slice(0, 17) + '…' : t.label }}</text>
<line v-if="s.tip &amp;&amp; chart.kind === 'line'" class="dt-crosshair" :x1="s.tip.crossX" :x2="s.tip.crossX" :y1="chart.plot.y" :y2="chart.plot.y + chart.plot.h"></line>
<path v-for="(ser, si) in chart.series" :key="'p' + si" class="dt-line" :d="ser.path" :style="{ stroke: 'var(--dt-series-' + (si + 1) + ')' }"></path>
<template v-for="(ser, si) in chart.series" :key="'d' + si"><circle v-for="d in ser.dots" :key="d.i" class="dt-dot" :class="{ 'is-on': s.tip &amp;&amp; s.tip.index === d.i }" :cx="d.x" :cy="d.y" :r="s.tip &amp;&amp; s.tip.index === d.i ? 5 : 4" :style="{ fill: 'var(--dt-series-' + (si + 1) + ')' }"></circle></template>
<rect class="dt-hit" :x="chart.plot.x - 12" :y="chart.plot.y" :width="chart.plot.w + 24" :height="chart.plot.h" @pointermove="pointerAt($event)" @pointerdown="pointerAt($event)"></rect>
</template>
</svg>
<div class="dt-axis-label" v-if="chart &amp;&amp; !chart.empty"><template v-if="chart.kind === 'bar'">{{ chart.axisLabel }}</template><template v-else>{{ chart.yLabel ? chart.yLabel + ' by ' : 'By ' }}{{ chart.xLabel }}</template></div>
<div class="dt-tip" v-if="s.tip &amp;&amp; chart &amp;&amp; !chart.empty" :style="tipStyle" role="status">
<div class="dt-tip-title" v-if="s.tip.title"><template v-for="(seg, si) in redactParts(s.tip.title)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></div>
<div class="dt-tip-row" v-for="(r, ri) in s.tip.rows" :key="ri"><span class="dt-key is-line" :style="{ '--key': 'var(--dt-series-' + (ri + 1) + ')' }"></span><b>{{ r.value }}</b><span>{{ r.name }}</span></div>
<div class="dt-tip-note" v-if="s.tip.note">{{ s.tip.note }}</div>
</div>
</figure>
</template>
<template v-else>
<div class="csv-table-wrap dt-wrap" tabindex="0" role="region" :aria-label="'Table view of ' + (label || name || 'table')">
<table class="csv-table dt-table">
<thead><tr>
<th class="csv-rownum" scope="col" v-if="!groupColumn"><span class="sr-only">Row</span></th>
<th scope="col" v-for="c in table.columns" :key="c.index" :class="{ 'is-num': c.type === 'number', 'is-sorted': !!sortState(c) }" :aria-sort="ariaSort(c)">
<span class="dt-th"><button type="button" class="dt-sort" :title="'Sort by ' + c.name" @click="cycleSort(c)"><span class="dt-th-name"><template v-for="(seg, si) in redactParts(c.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="dt-th-agg" v-if="c.agg">{{ aggregateShort(c.agg) }}</span><svg class="dt-sort-icon" :class="sortState(c) ? 'is-' + sortState(c) : ''" viewBox="0 0 10 14" aria-hidden="true"><path class="up" d="M5 1.5 8.5 5.5h-7z"/><path class="down" d="M5 12.5 1.5 8.5h7z"/></svg></button><button type="button" class="dt-col-btn" :data-col="c.index" :class="{ 'is-on': s.menu &amp;&amp; s.menu.index === c.index }" :aria-label="'Stats and filters for ' + c.name" aria-haspopup="dialog" :aria-expanded="s.menu &amp;&amp; s.menu.index === c.index ? 'true' : 'false'" @click.stop="openMenu(c.index, $event)"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button></span>
</th>
</tr></thead>
<tbody v-if="sorted.length" v-html="bodyHtml"></tbody>
<tbody v-else><tr class="dt-empty-row"><td :colspan="table.columns.length + (groupColumn ? 0 : 1)">No rows match. <button type="button" class="dt-link" @click="clearFilters()">Clear the filters</button></td></tr></tbody>
<tfoot v-if="sorted.length">
<tr class="dt-summary">
<td class="csv-rownum" v-if="!groupColumn"><span aria-hidden="true">Σ</span><span class="sr-only">Summary</span></td>
<td v-for="(c, ci) in table.columns" :key="c.index" :class="{ 'is-num': summary[ci].kind === 'number' }">
<span class="dt-sum" v-if="summary[ci].kind === 'number'"><label class="dt-sum-fn"><span class="sr-only">Summary of {{ c.name }}</span><select :value="summary[ci].fn" @change="setSum(c, $event.target.value)"><option v-for="[fn, text] in AGGREGATES" :key="fn" :value="fn">{{ text }}</option></select><span class="dt-sum-fn-label" aria-hidden="true">{{ aggregateShort(summary[ci].fn) }}</span><svg class="ui-icon dt-sum-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></label><b class="dt-sum-value">{{ summary[ci].text }}</b></span>
<span class="dt-sum is-text" v-else-if="summary[ci].kind === 'distinct'">{{ summary[ci].text }}</span>
</td>
</tr>
</tfoot>
</table>
</div>
<div class="dt-more" v-if="sorted.length &gt; visible.length">
<span>Showing {{ formatNumber(visible.length) }} of {{ formatNumber(sorted.length) }} rows. Sums, filters and charts use all of them.</span>
<button type="button" class="btn btn-sm" @click="showMore()">Show {{ formatNumber(Math.min(PAGE_SIZE, sorted.length - visible.length)) }} more</button>
<button type="button" class="dt-link" @click="showAll()">Show all</button>
</div>
</template>
<div class="dt-menu" v-if="s.menu &amp;&amp; menuColumn &amp;&amp; menuStats" role="dialog" tabindex="-1" :aria-label="'Column ' + menuColumn.name" :style="{ left: s.menu.left + 'px', top: s.menu.top + 'px' }" @click.stop>
<div class="dt-menu-head"><b><template v-for="(seg, si) in redactParts(menuColumn.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></b><span>{{ menuStats.typeLabel }}</span></div>
<dl class="dt-stats"><div v-for="[k, v] in menuStats.rows" :key="k"><dt>{{ k }}</dt><dd>{{ v }}</dd></div></dl>
<figure class="dt-hist" v-if="menuStats.bars.length">
<svg width="218" height="42" viewBox="0 0 218 42" role="img" :aria-label="'Distribution of ' + menuColumn.name"><rect v-for="(b, bi) in menuStats.bars" :key="bi" :x="b.x" :y="42 - b.h" :width="b.w" :height="b.h" rx="1.5"><title>{{ b.title }}</title></rect></svg>
<figcaption><span>{{ menuStats.histFrom }}</span><span>{{ menuStats.histTo }}</span></figcaption>
</figure>
<ul class="dt-top" v-if="menuStats.top &amp;&amp; menuStats.top.length"><li v-for="t in menuStats.top" :key="t.value"><span class="dt-top-name"><template v-for="(seg, si) in redactParts(t.value)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="dt-top-bar" :style="{ width: Math.max(4, t.share) + '%' }"></span><span class="dt-top-n">{{ t.count }}</span></li></ul>
<div class="dt-menu-sec" v-if="!groupColumn &amp;&amp; menuColumn.identifier">
<button type="button" class="dt-menu-action" role="switch" :aria-checked="isMeasure(menuColumn) ? 'true' : 'false'" @click="treatAsNumber(menuColumn, !isMeasure(menuColumn))"><svg class="ui-icon" aria-hidden="true"><use :href="isMeasure(menuColumn) ? '#ui-icon-check' : '#ui-icon-list'"></use></svg>{{ isMeasure(menuColumn) ? 'Treated as a number · undo' : 'Treat as number' }}</button>
<p class="dt-menu-hint" v-if="!isMeasure(menuColumn)">Looks like an identifier, so it is left out of the summary row and group averages.</p>
</div>
<div class="dt-menu-sec">
<div class="seg-filter dt-menu-sort" role="group" aria-label="Sort">
<button type="button" class="seg-chip" :class="{ active: sortState(menuColumn) === 'asc' }" @click="setSort(menuColumn, sortState(menuColumn) === 'asc' ? null : 'asc')">{{ menuColumn.type === 'text' ? 'A → Z' : 'Low → high' }}</button>
<button type="button" class="seg-chip" :class="{ active: sortState(menuColumn) === 'desc' }" @click="setSort(menuColumn, sortState(menuColumn) === 'desc' ? null : 'desc')">{{ menuColumn.type === 'text' ? 'Z → A' : 'High → low' }}</button>
</div>
</div>
<div class="dt-menu-sec" v-if="sourceColumn(menuColumn) &amp;&amp; sourceColumn(menuColumn).type === 'number'">
<div class="dt-menu-label">Show rows between</div>
<div class="dt-range"><input type="text" inputmode="decimal" class="dt-range-input" placeholder="Min" aria-label="Minimum" :value="rangeValue(menuColumn, 0)" @change="setRange(menuColumn, 0, $event.target.value)" @keydown.enter="setRange(menuColumn, 0, $event.target.value)"><span>–</span><input type="text" inputmode="decimal" class="dt-range-input" placeholder="Max" aria-label="Maximum" :value="rangeValue(menuColumn, 1)" @change="setRange(menuColumn, 1, $event.target.value)" @keydown.enter="setRange(menuColumn, 1, $event.target.value)"></div>
</div>
<div class="dt-menu-sec" v-else-if="chipValues(menuColumn).length">
<div class="dt-menu-label">Show only</div>
<div class="dt-chips"><button type="button" class="dt-value-chip" v-for="v in chipValues(menuColumn)" :key="v.value" :class="{ 'is-on': chipOn(menuColumn, v.value) }" :aria-pressed="chipOn(menuColumn, v.value) ? 'true' : 'false'" @click="toggleChip(menuColumn, v.value)"><template v-for="(seg, si) in redactParts(v.label)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template><span class="dt-value-n">{{ v.count }}</span></button></div>
</div>
<div class="dt-menu-sec" v-if="!groupColumn &amp;&amp; groupable.some(g =&gt; g.name === menuColumn.name)">
<button type="button" class="dt-menu-action" @click="setGroup(menuColumn.name)"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-list"></use></svg>Group by {{ menuColumn.name }}</button>
</div>
<div class="dt-menu-sec" v-else-if="groupColumn &amp;&amp; menuColumn.index === 0">
<button type="button" class="dt-menu-action" @click="setGroup(null)"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-close"></use></svg>Ungroup</button>
</div>
</div>
</div>
+2 -7
View File
@@ -56,7 +56,7 @@
<h2 class="gist-file-name" :id="gistFileId(index) + '-name'"><template v-for="(seg, si) in redactParts(file?.filename)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></h2>
<span class="gist-file-meta">{{ gistToc()[index]?.language }}<span class="sep">·</span>{{ gistToc()[index]?.lines != null ? fmt.plural(gistToc()[index]?.lines, {'one': '1 line', 'other': '{} lines'}) : fmt.humanFileSize(file?.size || 0) }}</span>
<div class="gist-file-tools">
<div class="seg-filter gist-view-toggle" role="radiogroup" :aria-label="'View of ' + file?.filename" v-if="gistHasRendered(index)"><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'rendered' }" :aria-checked="gistView(index) === 'rendered' ? 'true' : 'false'" @click="setGistView(index, 'rendered')">{{ gistKind(index) === 'csv' ? 'Table' : 'Preview' }}</button><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'raw' }" :aria-checked="gistView(index) === 'raw' ? 'true' : 'false'" @click="setGistView(index, 'raw')">Source</button></div>
<div class="seg-filter gist-view-toggle" role="radiogroup" :aria-label="'View of ' + file?.filename" v-if="gistHasRendered(index)"><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'rendered' }" :aria-checked="gistView(index) === 'rendered' ? 'true' : 'false'" @click="setGistView(index, 'rendered')">{{ gistKind(index) === 'csv' ? 'Table' : 'Preview' }}</button><button type="button" role="radio" class="seg-chip" v-if="gistKind(index) === 'csv'" :class="{ active: gistView(index) === 'chart' }" :aria-checked="gistView(index) === 'chart' ? 'true' : 'false'" @click="setGistView(index, 'chart')">Chart</button><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'raw' }" :aria-checked="gistView(index) === 'raw' ? 'true' : 'false'" @click="setGistView(index, 'raw')">Source</button></div>
<div class="tb-file gist-file-actions" role="group" aria-label="File actions" v-if="!['too-large', 'hidden', 'empty', 'binary'].includes(gistKind(index))">
<a class="tb-seg-btn" :href="safeUrl(gistRawUrl(file))" target="_blank" rel="noopener" :title="file?.encoding === 'base64' ? 'Open the file' : 'Open the raw file'">Raw</a>
<button type="button" class="tb-seg-btn tb-seg-icon" v-if="file?.encoding !== 'base64'" :aria-label="gistCopied === index ? 'Copied' : 'Copy file contents'" :title="gistCopied === index ? 'Copied' : 'Copy file contents'" @click="copyGistFile(index)"><svg class="ui-icon" aria-hidden="true"><use :href="gistCopied === index ? '#ui-icon-check' : '#project-icon-copy'"></use></svg></button>
@@ -68,12 +68,7 @@
<gist-file v-if="gistKind(index) === 'markdown' &amp;&amp; gistView(index) === 'rendered'" :file="file" :reader="true" :id-prefix="gistFileId(index) + '-'" @outline="setFileOutline(index, $event)"></gist-file>
<gist-file v-else-if="gistKind(index) === 'code' || (gistHasRendered(index) &amp;&amp; gistView(index) === 'raw')" :file="gistSourceFile(index)" :reader="true"></gist-file>
<div class="notebook-body" v-else-if="gistKind(index) === 'notebook'"><notebook class="markdown-body" :content="file.content"></notebook></div>
<div class="csv-table-wrap" v-else-if="gistKind(index) === 'csv'" tabindex="0" role="region" :aria-label="'Table view of ' + file?.filename">
<table class="csv-table">
<thead><tr><th class="csv-rownum" scope="col"><span class="sr-only">Row</span></th><th scope="col" v-for="(cell, ci) in (gistCsvRows(file)[0] || [])" :key="ci" :class="{ 'is-num': gistCsvNumeric(file, ci) }"><template v-for="(seg, si) in redactParts(cell)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></th></tr></thead>
<tbody><tr v-for="(row, ri) in gistCsvRows(file).slice(1)" :key="ri"><td class="csv-rownum">{{ ri + 1 }}</td><td v-for="(cell, ci) in row" :key="ci" :class="{ 'is-num': gistCsvNumeric(file, ci) }"><template v-for="(seg, si) in redactParts(cell)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></td></tr></tbody>
</table>
</div>
<data-table v-else-if="gistKind(index) === 'csv'" :key="file?.filename" :rows="gistCsvRows(file)" :name="file?.filename" :state-key="'table-' + (index + 1)" :view="gistView(index) === 'chart' ? 'chart' : 'table'"></data-table>
<div class="media-stage" v-else-if="gistKind(index) === 'image' || gistKind(index) === 'svg'"><img class="image-content" :src="safeUrl(gistMediaUrl(file))" :alt="file?.filename"></div>
<div class="media-stage" v-else-if="gistKind(index) === 'video'"><video class="video-content" controls preload="metadata" playsinline :src="safeUrl(gistMediaUrl(file))"></video></div>
<div class="media-stage is-audio" v-else-if="gistKind(index) === 'audio'"><audio controls preload="metadata" :src="safeUrl(gistMediaUrl(file))"></audio></div>
+6 -11
View File
@@ -34,7 +34,7 @@
<span class="file-card-meta" v-if="type == 'html'"><template v-if="redactionCount()"><span class="meta-redact" :title="redactionCount() + ' redacted terms'">{{ redactionCount() }}<span class="meta-redact-word"> redacted</span></span><span class="sep">·</span></template>Markdown<template v-if="fileSize(filePath) != null"><span class="sep">·</span>{{ formatSize(fileSize(filePath)) }}</template></span>
<button type="button" class="rp-preserved-tag" v-if="preview &amp;&amp; previewPreserved()" @click="openPreserveFiles()">Left unredacted</button>
<div class="file-card-actions">
<div class="csv-toggle seg-filter" role="radiogroup" aria-label="CSV view" v-if="isCsv()"><button type="button" role="radio" class="seg-chip" :class="{ active: csvView === 'table' }" :aria-checked="csvView === 'table'" @click="csvView = 'table'">Table</button><button type="button" role="radio" class="seg-chip" :class="{ active: csvView === 'raw' }" :aria-checked="csvView === 'raw'" @click="csvView = 'raw'" title="Show the file as text with line numbers">Text</button></div>
<div class="csv-toggle seg-filter" role="radiogroup" aria-label="CSV view" v-if="isCsv()"><button type="button" role="radio" class="seg-chip" :class="{ active: csvView === 'table' }" :aria-checked="csvView === 'table'" @click="csvView = 'table'">Table</button><button type="button" role="radio" class="seg-chip" :class="{ active: csvView === 'chart' }" :aria-checked="csvView === 'chart'" @click="csvView = 'chart'" title="Chart the table">Chart</button><button type="button" role="radio" class="seg-chip" :class="{ active: csvView === 'raw' }" :aria-checked="csvView === 'raw'" @click="csvView = 'raw'" title="Show the file as text with line numbers">Text</button></div>
<div class="symbols" v-if="type != 'html' &amp;&amp; symbols().length &gt; 1">
<button type="button" class="btn btn-sm btn-ghost btn-symbols" :class="{ 'is-on': symbolsOpen }" :aria-expanded="symbolsOpen ? 'true' : 'false'" aria-haspopup="true" title="Symbols in this file" @click="symbolsOpen = !symbolsOpen"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-list"></use></svg><span class="btn-find-label">Symbols</span></button>
<div class="symbols-menu" v-if="symbolsOpen" role="menu">
@@ -43,7 +43,7 @@
</div>
</div>
<button type="button" class="btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find" v-if="type == 'html'" :class="{ 'is-on': mdFindOpen }" aria-label="Find on this page" :title="'Find on this page (' + (isMac ? '⌘' : 'Ctrl+') + 'F)'" @click="toggleMdFind()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-search"></use></svg></button>
<div class="tb-view" role="group" aria-label="View tools" v-if="type != 'html' &amp;&amp; !(isCsv() &amp;&amp; csvView === 'table')">
<div class="tb-view" role="group" aria-label="View tools" v-if="type != 'html' &amp;&amp; !(isCsv() &amp;&amp; csvView !== 'raw')">
<button type="button" class="btn btn-sm btn-ghost btn-icon-only btn-goto" v-if="type != 'html'" aria-label="Go to line" :title="'Go to line (' + (isMac ? '⌘' : 'Ctrl+') + 'G)'" @click="gotoLine()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-goto"></use></svg></button>
<button type="button" class="btn btn-sm btn-icon-only btn-ghost btn-toggle" v-if="type != 'html'" :class="{ 'is-on': wrapLines }" :aria-pressed="wrapLines ? 'true' : 'false'" aria-label="Wrap lines" :title="'Wrap lines (Alt+Z)'" @click="toggleWrap()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-wrap"></use></svg></button>
<button type="button" class="btn btn-sm btn-ghost btn-icon-only btn-find" v-if="type != 'html'" aria-label="Find in file" :title="'Find in file (' + (isMac ? '⌘' : 'Ctrl+') + 'F)'" @click="findInFile()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-search"></use></svg></button>
@@ -73,7 +73,7 @@
<button type="button" role="menuitem" v-if="type != 'html'" @click="findInFile()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-search"></use></svg>Find in file</button>
<button type="button" role="menuitem" v-if="type != 'html'" @click="gotoLine()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-goto"></use></svg>Go to line</button>
<button type="button" role="menuitemcheckbox" v-if="type != 'html'" :aria-checked="wrapLines ? 'true' : 'false'" @click="toggleWrap()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-wrap"></use></svg>Wrap lines<span class="tb-menu-check" v-if="wrapLines">✓</span></button>
<button type="button" role="menuitem" class="tb-csv-view" v-if="isCsv()" @click="csvView = csvView === 'table' ? 'raw' : 'table'; moreOpen = false"><svg class="ui-icon" aria-hidden="true"><use :href="csvView === 'table' ? '#ui-icon-code' : '#ui-icon-list'"></use></svg>{{ csvView === 'table' ? 'Show as text' : 'Show as table' }}</button>
<template v-if="isCsv()"><button type="button" role="menuitemradio" class="tb-csv-view" v-for="v in ['table', 'chart', 'raw']" :key="v" :aria-checked="csvView === v ? 'true' : 'false'" @click="csvView = v; moreOpen = false"><svg class="ui-icon" aria-hidden="true"><use :href="v === 'raw' ? '#ui-icon-code' : v === 'chart' ? '#ui-icon-chart' : '#ui-icon-list'"></use></svg>{{ v === 'raw' ? 'Show as text' : v === 'chart' ? 'Show as chart' : 'Show as table' }}<span class="tb-menu-check" v-if="csvView === v">✓</span></button></template>
<div class="tb-menu-sep" v-if="type != 'html'"></div>
<a role="menuitem" :target="preview ? '_blank' : '_self'" v-if="type == 'html' &amp;&amp; (!preview || url)" :href="safeUrl((url))"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg>View raw</a>
<a role="menuitem" :target="preview ? '_blank' : '_self'" v-if="type != 'html' &amp;&amp; (!preview || url)" :href="safeUrl((url))"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg>View raw</a>
@@ -94,13 +94,8 @@
<span class="goto-hint" :class="{ 'is-error': gotoError }">{{ gotoError || 'Line, or line:column' }}</span>
</form>
</header>
<div class="csv-table-wrap" v-if="isCsv() &amp;&amp; csvView === 'table'" tabindex="0" role="region" :aria-label="'Table view of ' + (paths?.[paths.length - 1] || 'file')">
<table class="csv-table">
<thead><tr><th class="csv-rownum" scope="col"><span class="sr-only">Row</span></th><th scope="col" v-for="(cell, ci) in (csvRows()[0] || [])" :key="ci" :class="{ 'is-num': csvNumCol(ci) }"><template v-for="(seg, si) in redactParts(cell)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></th></tr></thead>
<tbody><tr v-for="(row, ri) in csvRows().slice(1)" :key="ri"><td class="csv-rownum">{{ ri + 1 }}</td><td v-for="(cell, ci) in row" :key="ci" :class="{ 'is-num': csvNumCol(ci) }"><template v-for="(seg, si) in redactParts(cell)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></td></tr></tbody>
</table>
</div>
<div class="file-card-body" v-if="type != 'html' &amp;&amp; !(isCsv() &amp;&amp; csvView === 'table')" v-code-editor="{ content: content, options: aceOption }"></div>
<data-table v-if="isCsv() &amp;&amp; csvView !== 'raw'" :key="paths?.join('/')" :rows="csvRows()" :name="paths?.[paths.length - 1]" :state-key="preview ? null : 'table'" :view="csvView"></data-table>
<div class="file-card-body" v-if="type != 'html' &amp;&amp; !(isCsv() &amp;&amp; csvView !== 'raw')" v-code-editor="{ content: content, options: aceOption }"></div>
<div class="md-find-bar" v-if="type == 'html' &amp;&amp; mdFindOpen" role="search">
<input type="search" class="md-find-input" placeholder="Find on this page" aria-label="Find on this page" :value="mdFindQuery" @input="mdFindQuery = $event.target.value; runMdFind()" @keydown.enter.prevent="$event.shiftKey ? stepMdFind(-1) : stepMdFind(1)" @keydown.esc.prevent="toggleMdFind(false)">
<span class="md-find-nav"><button type="button" aria-label="Previous match" @click="stepMdFind(-1)" :disabled="!mdFindTotal"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chevron-left"></use></svg></button><button type="button" aria-label="Next match" @click="stepMdFind(1)" :disabled="!mdFindTotal"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chevron-right"></use></svg></button></span>
@@ -109,7 +104,7 @@
<button type="button" class="md-find-close" aria-label="Close find" @click="toggleMdFind(false)">&times;</button>
</div>
<div class="reading-layout" v-if="type == 'html'">
<div class="file-content markdown-body" v-html="renderReadme(sanitize(content))"></div>
<div class="file-content markdown-body" v-html="renderReadme(sanitize(content))" v-data-tables></div>
<aside class="readme-toc" v-if="tocCount() &gt;= 3" aria-label="On this page">
<div class="readme-toc-head">On this page</div>
<nav class="toc-rail"><a href="#" class="lvl-2 toc-top" :class="{ 'is-active': !activeHeading || activeHeading === tocTitle()?.id }" @click.prevent="scrollToHeading(null)"><template v-if="tocTitle()"><template v-for="(seg, si) in tocTitle().parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></template><template v-else>Introduction</template></a><a v-for="(h, i) in readmeToc()" :key="h.id" :href="'#' + h.id" :class="['lvl-' + (h.depth + 2), { 'is-active': activeHeading === h.id }]" :aria-current="activeHeading === h.id ? 'location' : null" @click.prevent="scrollToHeading(h.id)"><template v-for="(seg, si) in h.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></a></nav>
+5 -1
View File
@@ -6,6 +6,8 @@ import { slotRedactions } from "./app.js";
import { headingOutline, redactParts } from "./outline.js";
import { hangIndent } from "./formatters.js";
import { render as quotaUsageTemplate } from "../partials/quotaUsage.htm";
import { DataTable } from "./data-table.js";
import { enhanceTables } from "./table-enhance.js";
const QuotaUsage = {
props: ["quota", "fmt"],
@@ -73,6 +75,7 @@ const Markdown = {
heading.id = id;
});
}
enhanceTables(host.value);
props.onOutline?.(headingOutline(host.value));
};
onMounted(() => { render(); watch(() => [props.content, props.terms, props.options], render, { deep: true }); });
@@ -201,6 +204,7 @@ const Notebook = {
host.value.innerHTML = slotRedactions(DOMPurify.sanitize(nb.parse(json).render()));
host.value.querySelectorAll("pre code").forEach(el => window.Prism?.highlightElement(el));
markScrollableCode(host.value);
enhanceTables(host.value);
} catch (error) { if (current === generation && error.name !== "AbortError") host.value.textContent = "Unable to render the notebook."; }
};
onMounted(() => { render(); watch(() => [props.file, props.content], render); });
@@ -218,7 +222,7 @@ const Loc = {
};
},
};
export const components = { Markdown, GistFile, PrThread, DiffTable, Notebook, Loc, HtmlDoc, QuotaUsage, Pdfviewer: defineAsyncComponent(async () => {
export const components = { Markdown, GistFile, PrThread, DiffTable, Notebook, Loc, HtmlDoc, QuotaUsage, DataTable, Pdfviewer: defineAsyncComponent(async () => {
await loadLibrary("pdf");
pdfjsLib.GlobalWorkerOptions.workerSrc = "/script/external/pdf.worker.js";
return PdfViewer;
+391
View File
@@ -0,0 +1,391 @@
// The table viewer shared by CSV/TSV files (explorer, gists, the author's
// preview) and "Open as table" on Markdown and notebook tables: sort, filter,
// summary row, group by, column stats, charts and export. Everything runs on
// the anonymized text already in the page; nothing is sent anywhere.
import { reactive, computed, watch, ref, onMounted, onBeforeUnmount, nextTick, createApp, h } from "vue";
import {
analyzeTable, filterIndices, sortIndices, groupTable, summarize, columnStats, distinctValues,
formatKey, formatNumber, toDelimited, toMarkdown, readHashState, writeHashState, isTableHash,
AGGREGATES, AGGREGATE_LABEL, aggregateShort,
} from "./table-analysis.js";
import { buildChart, defaultChart, MAX_SERIES } from "./table-chart.js";
import { redactParts } from "./outline.js";
import { render as dataTableTemplate } from "../partials/dataTable.htm";
import { setTableOpener } from "./table-enhance.js";
export const PAGE_SIZE = 200;
const ESCAPES = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
const escapeHtml = (text) => String(text).replace(/[&<>"']/g, (ch) => ESCAPES[ch]);
export const cellHtml = (text) => {
const value = text == null ? "" : String(text);
if (value.indexOf("XXXX-") === -1) return escapeHtml(value);
return redactParts(value).map((seg) => (seg.n ? `<span class="redact-slot" role="img" aria-label="Redacted term ${seg.n}"><i>${seg.n}</i></span>` : escapeHtml(seg.t))).join("");
};
const CHIP_LIMIT = 24;
export const DataTable = {
name: "DataTable",
props: { rows: { type: Array, default: () => [] }, name: String, stateKey: String, view: { type: String, default: "table" }, label: String },
setup(props) {
const fromHash = props.stateKey ? readHashState(window.location.hash, props.stateKey) : null;
const s = reactive({
query: fromHash?.query || "", sort: fromHash?.sort || null, group: fromHash?.group || null, agg: fromHash?.agg || "mean",
ranges: fromHash?.ranges || {}, values: fromHash?.values || {}, sums: fromHash?.sums || {},
sum: fromHash?.sum || "mean", numeric: fromHash?.numeric || [],
chart: fromHash?.chart || null, x: fromHash?.x || null, y: fromHash?.y || [],
limit: PAGE_SIZE, menu: null, toolsOpen: false, copyOpen: false, copied: "", tip: null,
});
const base = computed(() => analyzeTable(props.rows));
const byName = (table, name) => table.columns.find((c) => c.name === name);
const indexed = (map) => Object.fromEntries(Object.entries(map).map(([name, v]) => [byName(base.value, name)?.index, v]).filter(([i]) => i != null));
const filtered = computed(() => filterIndices(base.value, { query: s.query, ranges: indexed(s.ranges), values: indexed(s.values) }));
const groupColumn = computed(() => (s.group ? byName(base.value, s.group) : null));
// Identifier columns (seed, run, fold...) are not measures unless the reader says so.
const isMeasure = (c) => c.type === "number" && (!c.identifier || (!table.value?.grouped && s.numeric.includes(c.name)));
const isBaseMeasure = (c) => c.type === "number" && (!c.identifier || s.numeric.includes(c.name));
const table = computed(() => (groupColumn.value ? groupTable(base.value, filtered.value, groupColumn.value.index, s.agg, isBaseMeasure) : base.value));
const rowsInView = computed(() => (groupColumn.value ? table.value.body.map((_, i) => i) : filtered.value));
const sortColumn = computed(() => (s.sort ? byName(table.value, s.sort.column) : null));
const sorted = computed(() => (sortColumn.value ? sortIndices(table.value, rowsInView.value, sortColumn.value.index, s.sort.dir) : rowsInView.value));
const visible = computed(() => sorted.value.slice(0, s.limit));
// Each numeric column picks its aggregate in its summary cell (Average by default).
const summary = computed(() => table.value.columns.map((c) => summarize(c, rowsInView.value, s.sums[c.name] || s.sum, isMeasure)));
const numericColumns = computed(() => table.value.columns.filter((c) => isMeasure(c)));
// ---- Sorting: ascending, descending, then the file's order ----
const sortState = (column) => (s.sort && s.sort.column === column.name ? s.sort.dir : null);
const cycleSort = (column) => {
const dir = sortState(column);
s.sort = dir === "asc" ? { column: column.name, dir: "desc" } : dir === "desc" ? null : { column: column.name, dir: "asc" };
};
const setSort = (column, dir) => { s.sort = dir ? { column: column.name, dir } : null; };
const ariaSort = (column) => ({ asc: "ascending", desc: "descending" })[sortState(column)] || "none";
// ---- Filters ----
const sourceColumn = (column) => (groupColumn.value ? (column.source != null ? base.value.columns[column.source] : null) : column);
const setRange = (column, end, value) => {
const source = sourceColumn(column);
if (!source) return;
const text = String(value ?? "").trim();
const number = text === "" ? null : Number(text.replace(/,/g, ""));
const current = s.ranges[source.name] || [null, null];
const next = end === 0 ? [Number.isFinite(number) ? number : null, current[1]] : [current[0], Number.isFinite(number) ? number : null];
const ranges = { ...s.ranges };
if (next[0] == null && next[1] == null) delete ranges[source.name]; else ranges[source.name] = next;
s.ranges = ranges;
};
const rangeValue = (column, end) => { const r = s.ranges[sourceColumn(column)?.name]; return r && r[end] != null ? String(r[end]) : ""; };
const chipValues = (column) => {
const source = sourceColumn(column);
if (!source || source.type === "number") return [];
const counts = distinctValues(source);
if (counts.size > CHIP_LIMIT) return [];
return [...counts.entries()].map(([value, count]) => ({ value, count, label: source.type === "date" ? formatKey(source, value) : value }));
};
const chipOn = (column, value) => (s.values[sourceColumn(column)?.name] || []).includes(String(value));
const toggleChip = (column, value) => {
const source = sourceColumn(column);
if (!source) return;
const list = new Set(s.values[source.name] || []);
const key = String(value);
if (list.has(key)) list.delete(key); else list.add(key);
const values = { ...s.values };
if (list.size) values[source.name] = [...list]; else delete values[source.name];
s.values = values;
};
const activeFilters = computed(() => [
...Object.entries(s.ranges).map(([name, [min, max]]) => {
const c = byName(base.value, name);
const f = (v) => formatNumber(v, Math.max(c?.decimals || 0, String(v).split(".")[1]?.length || 0), c?.unit || "");
return { key: "r:" + name, name, text: min != null && max != null ? `${f(min)}–${f(max)}` : min != null ? `≥ ${f(min)}` : `≤ ${f(max)}`, clear: () => { const r = { ...s.ranges }; delete r[name]; s.ranges = r; } };
}),
...Object.entries(s.values).map(([name, list]) => {
const c = byName(base.value, name);
const labels = list.map((v) => (c?.type === "date" ? formatKey(c, Number(v)) : v));
return { key: "v:" + name, name, text: labels.length <= 2 ? labels.join(", ") : `${labels.length} values`, clear: () => { const v = { ...s.values }; delete v[name]; s.values = v; } };
}),
]);
const clearFilters = () => { s.query = ""; s.ranges = {}; s.values = {}; };
const filtering = computed(() => !!(s.query || activeFilters.value.length));
// ---- Group by ----
// Text and dates, plus whole-number columns with few values (seed, fold, epoch).
const groupable = computed(() => base.value.columns.filter((c) => c.type !== "number" || (c.decimals === 0 && !c.unit && distinctValues(c).size <= 50)));
const setGroup = (name) => { s.group = name || null; s.sort = null; s.limit = PAGE_SIZE; s.menu = null; resetChartAxes(); };
const setAgg = (fn) => { s.agg = fn; };
const setSum = (column, fn) => {
const sums = { ...s.sums };
if (!fn || fn === s.sum) delete sums[column.name]; else sums[column.name] = fn;
s.sums = sums;
};
const treatAsNumber = (column, on) => {
const list = new Set(s.numeric);
if (on) list.add(column.name); else list.delete(column.name);
s.numeric = [...list];
};
// ---- Column menu (stats, sort, filter, group) ----
const menuColumn = computed(() => (s.menu ? table.value.columns[s.menu.index] : null));
const menuStats = computed(() => {
const column = menuColumn.value;
if (!column) return null;
const stats = columnStats(column, rowsInView.value);
const fmt = (v) => formatKey(column, v);
const peak = Math.max(1, ...(stats.histogram || []).map((b) => b.count));
return {
...stats,
typeLabel: column.type === "number" ? (column.identifier && !isMeasure(column) ? "Identifier" : column.decimals ? `Number · ${column.decimals} ${column.decimals === 1 ? "decimal" : "decimals"}` : "Whole number") + (column.unit ? " · %" : "") : column.type === "date" ? "Date" : "Text",
rows: [
["Values", formatNumber(stats.count)], ["Empty", formatNumber(stats.empty)], ["Distinct", formatNumber(stats.distinct)],
...(stats.min != null ? [["Min", fmt(stats.min)], ["Max", fmt(stats.max)]] : []),
...(stats.mean != null && isMeasure(column) ? [["Mean", formatKey(column, stats.mean, "mean")]] : []),
...(stats.std != null && isMeasure(column) ? [["Std dev", formatKey(column, stats.std, "std")]] : []),
],
bars: (stats.histogram || []).map((b, i, all) => ({ x: (i * 216) / all.length + 1, w: Math.max(1, 216 / all.length - 2), h: Math.max(b.count ? 2 : 0, (b.count / peak) * 40), count: b.count,
title: `${fmt(b.from)} – ${fmt(b.to)}: ${b.count} ${b.count === 1 ? "row" : "rows"}` })),
histFrom: stats.histogram ? fmt(stats.min) : "", histTo: stats.histogram ? fmt(stats.max) : "",
top: (stats.top || []).map(([value, count]) => ({ value, count, share: (count / Math.max(1, stats.count)) * 100 })),
};
});
const openMenu = (index, event) => {
if (s.menu?.index === index) { s.menu = null; return; }
const th = event.currentTarget.closest("th") || event.currentTarget;
const r = th.getBoundingClientRect();
const width = 260, vw = window.innerWidth;
s.menu = { index, left: Math.max(8, Math.min(r.left, vw - width - 8)), top: r.bottom + 4 };
nextTick(() => window.document.querySelector(".dt-menu")?.focus());
};
const closeMenus = () => { s.menu = null; s.toolsOpen = false; s.copyOpen = false; };
// ---- Export ----
const exportRows = () => {
const t = table.value;
const header = t.columns.map((c) => c.name);
const body = sorted.value.map((i) => t.columns.map((c) => t.body[i][c.index] ?? ""));
return { header, body };
};
const flash = (what) => { s.copied = what; window.setTimeout(() => { if (s.copied === what) s.copied = ""; }, 1600); };
const copyAs = async (format) => {
const { header, body } = exportRows();
const text = format === "md" ? toMarkdown(header, body, table.value.columns.map((c) => c.type === "number")) : toDelimited(header, body, ",");
closeMenus();
try { await window.navigator.clipboard.writeText(text); flash(format); } catch { flash("error"); }
};
const fileBase = () => String(props.name || "table").replace(/\.[^.]+$/, "") || "table";
const download = () => {
const { header, body } = exportRows();
const blob = new window.Blob([toDelimited(header, body, ",")], { type: "text/csv;charset=utf-8" });
const url = window.URL.createObjectURL(blob);
const a = window.document.createElement("a");
a.href = url;
a.download = fileBase() + (isChanged() ? "-view" : "") + ".csv";
window.document.body.appendChild(a);
a.click();
a.remove();
window.setTimeout(() => window.URL.revokeObjectURL(url), 1000);
closeMenus();
};
const isChanged = () => !!(filtering.value || s.sort || s.group);
// ---- Chart ----
const chartWidth = ref(0);
const chartHost = ref(null);
const chartSpec = computed(() => {
const fallback = defaultChart(table.value, !!groupColumn.value);
const x = s.x && byName(table.value, s.x) ? s.x : fallback.x;
const y = s.y.filter((n) => byName(table.value, n)?.type === "number");
return { type: s.chart || fallback.type, x, y: y.length ? y : fallback.y, agg: s.agg };
});
const chart = computed(() => (props.view === "chart" && chartWidth.value ? buildChart(table.value, sorted.value, chartSpec.value, { width: chartWidth.value }) : null));
const resetChartAxes = () => { s.x = null; s.y = []; };
watch(chart, () => { s.tip = null; });
const setChartType = (type) => { s.chart = type; s.tip = null; };
const setX = (name) => { s.x = name; s.tip = null; };
const yOn = (name) => chartSpec.value.y.includes(name);
const toggleY = (name) => {
const current = chartSpec.value.y;
const next = current.includes(name) ? current.filter((n) => n !== name) : [...current, name];
if (!next.length) return;
s.y = next.slice(-MAX_SERIES[chartSpec.value.type]);
s.tip = null;
};
const seriesIndex = (name) => chartSpec.value.y.indexOf(name);
let observer;
const observe = (el) => {
observer?.disconnect();
if (!el) return;
const measure = () => { const w = el.clientWidth; if (w && Math.abs(w - chartWidth.value) > 1) chartWidth.value = w; };
measure();
if (window.ResizeObserver) { observer = new window.ResizeObserver(measure); observer.observe(el); }
};
watch(chartHost, observe);
// Hover and keyboard: bars by category, lines by the nearest x, scatter by the nearest point.
const tipAt = (index, x, y) => {
const c = chart.value;
if (!c) return;
const item = c.kind === "bar" ? c.categories[index]?.tip : c.points[index];
if (!item) { s.tip = null; return; }
s.tip = { index, ...item, x, y, crossX: c.kind === "line" ? c.points[index].x : null };
};
const pointerAt = (event) => {
const c = chart.value;
const svg = event.currentTarget.ownerSVGElement || event.currentTarget;
const box = svg.getBoundingClientRect();
const px = event.clientX - box.left, py = event.clientY - box.top;
if (c.kind === "bar") {
const index = c.categories.findIndex((cat) => py >= cat.hit.y && py < cat.hit.y + cat.hit.h);
if (index < 0) { s.tip = null; return; }
tipAt(index, px, c.categories[index].y);
return;
}
let best = -1, bestD = Infinity;
if (c.kind === "scatter") {
c.series.forEach((ser) => ser.dots.forEach((d) => { const dd = (d.x - px) ** 2 + (d.y - py) ** 2; if (dd < bestD) { bestD = dd; best = d.i; } }));
if (bestD > 40 * 40) { s.tip = null; return; }
} else c.points.forEach((p, i) => { const dd = Math.abs(p.x - px); if (dd < bestD) { bestD = dd; best = i; } });
tipAt(best, c.kind === "scatter" ? c.points[best].x : c.points[best].x, py);
};
const keyStep = (event) => {
const c = chart.value;
if (!c || c.empty) return;
const count = c.kind === "bar" ? c.categories.length : c.points.length;
const delta = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1, Home: -Infinity, End: Infinity }[event.key];
if (event.key === "Escape") { s.tip = null; return; }
if (delta == null) return;
event.preventDefault();
const current = s.tip ? s.tip.index : -1;
const next = delta === -Infinity ? 0 : delta === Infinity ? count - 1 : Math.max(0, Math.min(count - 1, current + delta));
if (c.kind === "bar") tipAt(next, c.plot.x + 8, c.categories[next].y);
else tipAt(next, c.points[next].x, c.plot.y + 20);
};
const tipStyle = computed(() => {
if (!s.tip || !chart.value) return {};
const w = chartWidth.value, left = s.tip.x + 14;
return left + 200 > w ? { right: Math.max(4, w - s.tip.x + 14) + "px", top: s.tip.y + 8 + "px" } : { left: left + "px", top: s.tip.y + 8 + "px" };
});
const chartSummary = computed(() => {
const c = chart.value;
if (!c || c.empty) return "";
const what = c.series.map((x) => x.name).join(", ");
return `${{ bar: "Bar chart", line: "Line chart", scatter: "Scatter plot" }[c.kind]} of ${what} by ${c.x.name}`;
});
// ---- Shareable state in the URL fragment ----
const snapshot = () => ({
view: props.view, query: s.query, sort: s.sort, group: s.group, agg: s.agg, ranges: s.ranges, values: s.values,
sum: s.sum, sums: s.sums, numeric: s.numeric, chart: s.chart, x: s.x, y: s.y,
});
if (props.stateKey) {
let timer;
watch(() => JSON.stringify(snapshot()), () => {
window.clearTimeout(timer);
timer = window.setTimeout(() => {
const hash = writeHashState(props.stateKey, snapshot());
const current = window.location.hash;
// Leave other fragments (#L12, a heading) alone unless we are replacing our own.
if (!hash && !isTableHash(current)) return;
if (hash && current && !isTableHash(current) && current !== "#") return;
if (hash === current) return;
window.history.replaceState(window.history.state, "", window.location.pathname + window.location.search + hash);
}, 250);
});
}
// ---- Phone toolbar and menus ----
const onDocClick = (event) => {
if (!event.target.closest?.(".dt-menu, .dt-col-btn")) s.menu = null;
if (!event.target.closest?.(".dt-tools-menu, .dt-tools-btn")) s.toolsOpen = false;
if (!event.target.closest?.(".dt-copy-menu, .dt-copy-btn")) s.copyOpen = false;
};
const onKey = (event) => { if (event.key === "Escape" && (s.menu || s.toolsOpen || s.copyOpen)) { const back = s.menu ? window.document.querySelector(`.dt-col-btn[data-col="${s.menu.index}"]`) : null; closeMenus(); back?.focus(); } };
const onScroll = (event) => { if (s.menu && !event.target?.closest?.(".dt-menu")) s.menu = null; };
onMounted(() => {
window.document.addEventListener("click", onDocClick);
window.document.addEventListener("keydown", onKey);
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
});
onBeforeUnmount(() => {
window.document.removeEventListener("click", onDocClick);
window.document.removeEventListener("keydown", onKey);
window.removeEventListener("scroll", onScroll, { capture: true });
observer?.disconnect();
});
watch(() => [s.query, s.ranges, s.values], () => { s.limit = PAGE_SIZE; }, { deep: true });
// The visible rows as one HTML string: thousands of cells patch far faster
// this way than as component vnodes. Cell text is escaped; XXXX-n becomes
// the same slot as everywhere else in the viewer.
const bodyHtml = computed(() => {
const t = table.value, cols = t.columns, grouped = !!groupColumn.value;
const out = [];
for (const ri of visible.value) {
out.push("<tr>");
if (!grouped) out.push('<td class="csv-rownum">', String(ri + 1), "</td>");
const row = t.body[ri];
for (const c of cols) out.push(c.type === "number" ? '<td class="is-num">' : "<td>", cellHtml(row[c.index]), "</td>");
out.push("</tr>");
}
return out.join("");
});
const rowCountText = computed(() => {
const total = base.value.size, shown = filtered.value.length;
const rows = shown === total ? `${formatNumber(total)} ${total === 1 ? "row" : "rows"}` : `${formatNumber(shown)} of ${formatNumber(total)} rows`;
return groupColumn.value ? `${formatNumber(table.value.size)} ${table.value.size === 1 ? "group" : "groups"} · ${rows}` : rows;
});
return {
s, props, base, table, sorted, visible, summary, numericColumns, filtered, groupColumn, rowsInView,
redactParts, cycleSort, setSort, sortState, ariaSort, setRange, rangeValue, chipValues, chipOn, toggleChip,
activeFilters, clearFilters, filtering, groupable, setGroup, setAgg, setSum, treatAsNumber, isMeasure,
AGGREGATES, AGGREGATE_LABEL, aggregateShort,
menuColumn, menuStats, openMenu, closeMenus, sourceColumn, copyAs, download, isChanged, bodyHtml, rowCountText,
chart, chartSpec, chartHost, setChartType, setX, yOn, toggleY, seriesIndex, pointerAt, keyStep, tipStyle, chartSummary,
MAX_SERIES, PAGE_SIZE, formatNumber,
showMore: () => { s.limit += PAGE_SIZE; },
showAll: () => { s.limit = Infinity; },
leaveChart: () => { s.tip = null; },
};
},
render: dataTableTemplate,
};
// "Open as table" for a Markdown or notebook table: the full viewer in a dialog.
export function openTableDialog(rows, title) {
const host = window.document.createElement("div");
window.document.body.appendChild(host);
const opener = window.document.activeElement;
let app;
const close = () => { app.unmount(); host.remove(); window.document.removeEventListener("keydown", onKey); opener?.focus?.(); };
const onKey = (event) => {
if (event.key === "Escape" && !window.document.querySelector(".dt-menu, .dt-tools-menu, .dt-copy-menu")) close();
// Keep Tab inside the dialog.
if (event.key !== "Tab") return;
const items = [...host.querySelectorAll("button, select, input, [tabindex='0']")].filter((el) => !el.disabled && el.offsetParent !== null);
if (!items.length) return;
const first = items[0], last = items[items.length - 1], active = window.document.activeElement;
if (!host.contains(active) || (event.shiftKey ? active === first || active === host.querySelector(".dt-dialog") : active === last)) {
event.preventDefault();
(event.shiftKey ? last : first).focus();
}
};
window.document.addEventListener("keydown", onKey);
app = createApp({
setup() {
const view = ref("table");
onMounted(() => host.querySelector(".dt-dialog")?.focus());
return () => h("div", { class: "dt-dialog-backdrop", onClick: (e) => { if (e.target === e.currentTarget) close(); } },
h("div", { class: "dt-dialog", role: "dialog", "aria-modal": "true", "aria-label": title || "Table", tabindex: "-1" }, [
h("header", { class: "dt-dialog-head" }, [
h("span", { class: "dt-dialog-title" }, title || "Table"),
h("div", { class: "seg-filter dt-view-toggle", role: "radiogroup", "aria-label": "View" }, ["table", "chart"].map((v) =>
h("button", { type: "button", role: "radio", class: ["seg-chip", { active: view.value === v }], "aria-checked": view.value === v ? "true" : "false", onClick: () => { view.value = v; } }, v === "table" ? "Table" : "Chart"))),
h("button", { type: "button", class: "btn btn-sm btn-ghost btn-icon-only dt-dialog-close", "aria-label": "Close", onClick: close }, h("svg", { class: "ui-icon", "aria-hidden": "true" }, h("use", { href: "#project-icon-close" }))),
]),
h(DataTable, { rows, name: (title || "table").replace(/[^\w.-]+/g, "-").toLowerCase(), view: view.value, label: title }),
]));
},
});
app.mount(host);
return close;
}
setTableOpener(openTableDialog);
+7 -8
View File
@@ -3,6 +3,7 @@ import { parseDelimited } from "./formatters.js";
import { nextTick, markRaw } from "vue";
import { createTimers, createListeners } from "./state.js";
import { slotRedactions } from "./app.js";
import { readHashState } from "./table-analysis.js";
// Used by the reviewer page and the author's preview with pageView.htm.
export const setupFileViewer = function (state, events = state) {
@@ -322,9 +323,11 @@ export const setupFileViewer = function (state, events = state) {
jumpTo(id);
state.activeHeading = id;
};
// CSV/TSV files up to 1 MB render as a table (sticky header, rules, tabular
// figures) with a Raw toggle back to the code view.
state.csvView = "table";
// CSV/TSV files up to 1 MB open in the table viewer (data-table.js: sort,
// filter, summary, group by, charts) with a Text toggle back to the code view.
// A shared link can open the chart or text view (#table:view=chart).
const csvViewFromHash = () => (!state.preview && readHashState(window.location.hash, "table")?.view) || "table";
state.csvView = csvViewFromHash();
let csvCache = { content: null, rows: [] };
state.isCsv = () => typeof state.content === "string" && state.type !== "html"
&& /\.(csv|tsv)$/i.test(state.filePath || "") && state.content.length <= 1024 * 1024;
@@ -335,11 +338,6 @@ export const setupFileViewer = function (state, events = state) {
}
return csvCache.rows;
};
state.csvNumCol = (ci) => {
const rows = state.csvRows().slice(1).map((r) => r[ci]).filter((v) => v != null && String(v).trim() !== "");
return rows.length > 0 && rows.every((v) => state.csvNumeric(v));
};
state.csvNumeric = (value) => /^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(value) && /\d/.test(value);
state.redactParts = redactParts;
state.pathCopied = false;
state.copyPath = async function () {
@@ -407,6 +405,7 @@ export const setupFileViewer = function (state, events = state) {
state.prepareFile = function (path) {
state.showSource = false;
state.allowScripts = false;
state.csvView = csvViewFromHash();
state.imageSize = "";
state.filePath = path;
state.paths = path.split("/").filter(Boolean);
+2
View File
@@ -15,6 +15,7 @@ import translations from "../i18n/locale-en.json";
import { components, codeEditor, paperScrollspy } from "./components.js";
import Tree from "./tree.js";
import { fieldDirective, formDirective, submitForm } from "./forms.js";
import { dataTablesDirective } from "./table-enhance.js";
const sessionKey = Symbol("session");
export const serverPaths = /^\/(w|api|github)(\/|$)/;
@@ -133,6 +134,7 @@ export function mountApplication(target = "#app", options = {}) {
app.directive("form", formDirective);
app.directive("code-editor", codeEditor);
app.directive("paper-scrollspy", paperScrollspy);
app.directive("data-tables", dataTablesDirective);
app.use(router);
router.beforeEach(async to => {
if ((to.path === "/review-link" && !isolatedConsent) || (isolatedConsent && to.path !== "/review-link")) {
+22 -8
View File
@@ -4,6 +4,7 @@ import { nextTick, onScopeDispose } from "vue";
import { activeSection, jumpTo, redactParts } from "./outline.js";
import { parseDiff, hangIndent, parseDelimited } from "./formatters.js";
import { createListeners } from "./state.js";
import { readHashState } from "./table-analysis.js";
export const lineCount = (text) => (text ? String(text).replace(/\n$/, "").split("\n").length : 0);
export const isMarkdownFile = (file) => /\.(md|markdown|mdx)$/i.test(file?.filename || "") || file?.language === "Markdown";
@@ -78,10 +79,19 @@ const decodeBase64 = (text) => {
export function setupGistPage(state) {
// Rendered or raw, per file; the file's bytes as blob URLs for media, Raw and Download.
// A shared link can open a CSV file's chart (#table-2:view=chart).
state.gistViews = {};
const linked = /^#table-(\d+):/.exec(window.location.hash || "");
if (linked) {
const view = readHashState(window.location.hash, "table-" + linked[1])?.view;
if (view === "chart" || view === "raw") state.gistViews[+linked[1] - 1] = view;
}
state.gistKind = (index) => gistFileKind(state.details?.files?.[index]);
state.gistHasRendered = (index) => hasRenderedView(state.gistKind(index));
state.gistView = (index) => (state.gistHasRendered(index) && state.gistViews[index] !== "raw" ? "rendered" : "raw");
state.gistView = (index) => {
if (!state.gistHasRendered(index) || state.gistViews[index] === "raw") return "raw";
return state.gistViews[index] === "chart" && state.gistKind(index) === "csv" ? "chart" : "rendered";
};
state.setGistView = (index, view) => { state.gistViews = { ...state.gistViews, [index]: view }; };
state.gistSourceFile = (index) => {
const file = state.details?.files?.[index];
@@ -102,14 +112,18 @@ export function setupGistPage(state) {
};
state.gistMediaUrl = (file) => blobUrl(file, false);
state.gistRawUrl = (file) => blobUrl(file, true);
let csvCache = { content: null, rows: [] };
// Parsed once per file: the table viewer re-analyzes only when its rows change.
// Keyed by the file object: no 1 MB key string per render, and a reloaded
// gist's old files are released with it.
const csvCache = new WeakMap();
state.gistCsvRows = (file) => {
if (csvCache.content !== file?.content) csvCache = { content: file?.content, rows: parseDelimited(file?.content || "", extension(file?.filename) === "tsv" ? "\t" : ",") };
return csvCache.rows;
};
state.gistCsvNumeric = (file, ci) => {
const values = state.gistCsvRows(file).slice(1).map((r) => r[ci]).filter((v) => v != null && String(v).trim() !== "");
return values.length > 0 && values.every((v) => /^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(v) && /\d/.test(v));
if (!file) return [];
let entry = csvCache.get(file);
if (!entry || entry.content !== file.content || entry.filename !== file.filename) {
entry = { content: file.content, filename: file.filename, rows: parseDelimited(file.content || "", extension(file.filename) === "tsv" ? "\t" : ",") };
csvCache.set(file, entry);
}
return entry.rows;
};
state.gistCopied = null;
state.copyGistFile = async (index) => {
+433
View File
@@ -0,0 +1,433 @@
// Client-side analysis of a parsed table (CSV/TSV files, Markdown and notebook
// tables): type detection, sorting, filtering, grouping, aggregates, export and
// the shareable URL state. Pure functions, no DOM: everything runs on the
// anonymized text already on the page.
export const AGGREGATES = [
["mean", "Average"], ["sum", "Sum"], ["median", "Median"], ["min", "Min"],
["max", "Max"], ["count", "Count"], ["std", "Std dev"],
];
export const AGGREGATE_LABEL = Object.fromEntries(AGGREGATES);
const AGGREGATE_SHORT = { mean: "Avg", sum: "Sum", median: "Median", min: "Min", max: "Max", count: "Count", std: "Std dev" };
export const aggregateShort = (fn) => AGGREGATE_SHORT[fn] || fn;
// Cells that mean "no value" in exported numbers and dates (pandas, R,
// spreadsheets). In a text column they are real categories ("none" as an
// augmentation, a model called "None"), so there only a blank cell is empty.
const PLACEHOLDER = /^(?:na|n\/a|nan|null|none|-|—|–)$/i;
export const isBlank = (raw) => raw == null || String(raw).trim() === "";
export const isMissing = (raw) => isBlank(raw) || PLACEHOLDER.test(String(raw).trim());
// 1,234 · -0.5 · +3 · 12% · 1e-3 · −2 (Unicode minus) · .5 — one match gives
// the value, the decimals as written and the percent sign.
const NUMBER_RE = /^([-+]?)(\d{1,3}(?:,\d{3})+|\d*)(?:\.(\d+))?(?:e([-+]?\d+))?(%?)$/i;
export function scanNumber(raw) {
if (raw == null) return null;
if (typeof raw === "number") return Number.isFinite(raw) ? { value: raw, decimals: 0, percent: false } : null;
let text = String(raw).trim();
if (text.charCodeAt(0) === 0x2212) text = "-" + text.slice(1);
const m = NUMBER_RE.exec(text);
if (!m || (!m[2] && !m[3])) return null;
const value = Number(m[1] + (m[2] ? m[2].replace(/,/g, "") : "0") + (m[3] ? "." + m[3] : "") + (m[4] ? "e" + m[4] : ""));
if (!Number.isFinite(value)) return null;
return { value, decimals: Math.max(0, Math.min(10, (m[3] || "").length - (m[4] ? Number(m[4]) : 0))), percent: m[5] === "%", exponent: !!m[4], mantissa: (m[3] || "").length };
}
export const parseNumber = (raw) => scanNumber(raw)?.value ?? null;
// Digits after the decimal point, as written ("78.90" -> 2, "1e-3" -> 3).
export const decimalsOf = (raw) => scanNumber(raw)?.decimals ?? 0;
// Unambiguous dates only: ISO (2026-03-01, 2026-03-01T10:00Z, 2026/03/01) and
// written months with a year (Mar 1, 2026 · 1 March 2026). 03/01/2026 is left as text.
const ISO_DATE = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[T ](\d{1,2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?\s*(Z|[+-]\d{2}:?\d{2})?)?$/i;
const MONTHS = "jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec";
const WORD_DATE = new RegExp(`^(?:\\d{1,2}\\s+(?:${MONTHS})[a-z]*\\.?,?\\s+\\d{4}|(?:${MONTHS})[a-z]*\\.?\\s+\\d{1,2},?\\s+\\d{4})$`, "i");
export function parseDate(raw) {
if (raw == null) return null;
const text = String(raw).trim();
if (!text) return null;
const iso = ISO_DATE.exec(text);
if (iso) {
const [, y, mo, d, h = "0", mi = "0", s = "0", zone] = iso;
if (+mo < 1 || +mo > 12 || +d < 1 || +d > 31) return null;
if (zone) {
const t = Date.parse(`${y}-${mo.padStart(2, "0")}-${d.padStart(2, "0")}T${h.padStart(2, "0")}:${mi}:${s.padStart(2, "0")}${zone.length === 5 ? zone.slice(0, 3) + ":" + zone.slice(3) : zone}`);
return Number.isFinite(t) ? t : null;
}
return Date.UTC(+y, +mo - 1, +d, +h, +mi, +s);
}
if (WORD_DATE.test(text)) {
const t = Date.parse(text.replace(/\./g, "") + " UTC");
return Number.isFinite(t) ? t : null;
}
return null;
}
// "number" when every non-empty cell parses as a number, "date" when every one
// parses as a date, "text" otherwise (and for a column with no values).
export const detectType = (values) => makeColumn("", 0, values).type;
const collator = typeof Intl !== "undefined" ? new Intl.Collator(undefined, { numeric: true, sensitivity: "base" }) : null;
const compareText = collator ? collator.compare : (a, b) => (a < b ? -1 : a > b ? 1 : 0);
/**
* A table model from rows of strings (the first row is the header).
* Each column gets its detected type, precision (max decimals seen), unit ("%"
* when every value has one) and a key per row: a number for numbers and dates
* (null when empty), the cell text otherwise.
*/
export function analyzeTable(rows) {
const header = (rows && rows[0]) || [];
const body = rows ? rows.slice(1) : [];
const width = Math.max(header.length, ...body.slice(0, 2000).map((r) => r.length), 0);
const columns = [];
for (let ci = 0; ci < width; ci++) {
const values = body.map((r) => r[ci] ?? "");
columns.push(makeColumn(String(header[ci] ?? "").trim() || "Column " + (ci + 1), ci, values));
}
for (const c of columns) c.identifier = isIdentifier(c);
return { header: columns.map((c) => c.name), body, columns, size: body.length };
}
// Columns that name a run rather than measure it: seed, id, run, fold, index,
// year (by name), or small consecutive whole numbers that repeat across rows
// (1..5 for five seeds). They are left out of summaries and group aggregates;
// the column menu can still treat one as a number.
const ID_NAME = /(?:^|[\s_.\-/(])(?:seed|id|ids|run|runs|run_id|fold|folds|index|idx|year|trial|trials|rep|reps|repeat|split|#|no)s?(?:$|[\s_.\-/)])|^(?:seed|id|run|fold|index|idx|year|trial|rep|repeat)s?$|[a-z]Id$/i;
export function isIdentifier(column) {
if (!column || column.type !== "number") return false;
if (ID_NAME.test(column.name.trim())) return column.decimals === 0;
if (column.decimals !== 0 || column.unit) return false;
let min = Infinity, max = -Infinity, filled = 0;
const seen = new Set();
for (const k of column.keys) {
if (k == null) continue;
if (k < 0 || !Number.isInteger(k)) return false;
filled++;
seen.add(k);
if (k < min) min = k;
if (k > max) max = k;
if (seen.size > 12) return false;
}
// Consecutive keys (1..5, 0..9) each used at least twice.
return seen.size >= 2 && filled >= 2 * seen.size && max - min + 1 === seen.size && min <= 1;
}
export function makeColumn(name, index, values, forced) {
const n = values.length;
const keys = new Array(n);
let type = forced?.type, decimals = 0, empty = 0, percent = 0, filled = 0, exponent = 0, mantissa = 0;
for (let i = 0; i < n; i++) if (isMissing(values[i])) { keys[i] = null; empty++; } else filled++;
// One pass per candidate type, stopping at the first cell that doesn't fit.
if (!type || type === "number") {
let ok = filled > 0 || type === "number";
for (let i = 0; ok && i < n; i++) {
if (keys[i] === null) continue;
const scan = scanNumber(values[i]);
if (!scan) { ok = type === "number"; keys[i] = null; continue; }
keys[i] = scan.value;
if (scan.decimals > decimals) decimals = scan.decimals;
if (scan.percent) percent++;
if (scan.exponent) { exponent++; if (scan.mantissa > mantissa) mantissa = scan.mantissa; }
}
if (ok) type = "number";
}
if (!type || type === "date") {
let ok = filled > 0 || type === "date";
for (let i = 0; ok && i < n; i++) {
if (isMissing(values[i])) continue;
const t = parseDate(values[i]);
if (t == null) ok = type === "date";
keys[i] = t;
}
if (ok) type = "date";
}
if (!type || type === "text") {
type = "text";
empty = 0;
for (let i = 0; i < n; i++) {
keys[i] = isBlank(values[i]) ? null : String(values[i]).trim();
if (keys[i] === null) empty++;
}
}
return {
name, index, type, keys, empty,
decimals: forced?.decimals ?? decimals,
unit: forced?.unit ?? (type === "number" && filled && percent === filled ? "%" : ""),
// Written as 1.38e-3: aggregates keep scientific notation and its significant digits.
scientific: forced?.scientific ?? (type === "number" && exponent * 2 >= filled && exponent > 0 ? mantissa : null),
};
}
let distinctCache = new WeakMap();
export function distinctValues(column, indices) {
const all = !indices;
if (all && distinctCache.has(column)) return distinctCache.get(column);
const counts = new Map();
const list = indices || column.keys.map((_, i) => i);
for (const i of list) {
const k = column.keys[i];
if (k == null) continue;
counts.set(k, (counts.get(k) || 0) + 1);
}
if (all) distinctCache.set(column, counts);
return counts;
}
// Row order for the given column: ascending or descending, stable (ties keep
// their current order) and with empty cells last in both directions.
export function sortIndices(table, indices, columnIndex, direction) {
const column = table.columns[columnIndex];
if (!column || !direction) return indices.slice();
const sign = direction === "desc" ? -1 : 1;
const keys = column.keys;
const numeric = column.type !== "text";
const order = indices.map((row, position) => ({ row, position }));
order.sort((a, b) => {
const ka = keys[a.row], kb = keys[b.row];
if (ka == null || kb == null) return ka == null && kb == null ? a.position - b.position : ka == null ? 1 : -1;
const c = numeric ? ka - kb : compareText(ka, kb);
return c ? c * sign : a.position - b.position;
});
return order.map((o) => o.row);
}
// Rows matching the search text (any cell, case-insensitive), every numeric
// range { [column]: [min, max] } (either bound may be null) and every value set
// { [column]: [values] } (as text; a date is its timestamp).
export function filterIndices(table, { query = "", ranges = {}, values = {} } = {}) {
const needle = String(query || "").trim().toLowerCase();
const rangeList = Object.entries(ranges || {}).map(([ci, r]) => [table.columns[ci], r]).filter(([c, r]) => c && r && (r[0] != null || r[1] != null));
const valueList = Object.entries(values || {}).map(([ci, v]) => [table.columns[ci], new Set(v)]).filter(([c, v]) => c && v.size);
const out = [];
const haystack = needle ? searchText(table) : null;
for (let i = 0; i < table.size; i++) {
if (needle && haystack[i].indexOf(needle) === -1) continue;
let keep = true;
for (const [c, [min, max]] of rangeList) {
const k = c.keys[i];
if (k == null || (min != null && k < min) || (max != null && k > max)) { keep = false; break; }
}
if (!keep) continue;
for (const [c, set] of valueList) if (!set.has(c.keys[i] == null ? "" : String(c.keys[i]))) { keep = false; break; }
if (keep) out.push(i);
}
return out;
}
const searchCache = new WeakMap();
function searchText(table) {
if (!searchCache.has(table)) searchCache.set(table, table.body.map((r) => r.join("\u0001").toLowerCase()));
return searchCache.get(table);
}
// One aggregate over the non-empty keys of the given rows. null when undefined
// (no values; a standard deviation needs two).
export function aggregate(keys, indices, fn) {
const values = [];
for (const i of indices) { const k = keys[i]; if (k != null && Number.isFinite(k)) values.push(k); }
const n = values.length;
if (fn === "count") return n;
if (!n) return null;
if (fn === "sum") return values.reduce((s, v) => s + v, 0);
if (fn === "mean") return values.reduce((s, v) => s + v, 0) / n;
if (fn === "min") return values.reduce((m, v) => (v < m ? v : m), Infinity);
if (fn === "max") return values.reduce((m, v) => (v > m ? v : m), -Infinity);
if (fn === "median") {
values.sort((a, b) => a - b);
return n % 2 ? values[(n - 1) / 2] : (values[n / 2 - 1] + values[n / 2]) / 2;
}
if (fn === "std") {
if (n < 2) return null;
const mean = values.reduce((s, v) => s + v, 0) / n;
return Math.sqrt(values.reduce((s, v) => s + (v - mean) ** 2, 0) / (n - 1));
}
return null;
}
// Decimals shown for an aggregate: the column's own precision; an average,
// median or standard deviation of whole numbers keeps one decimal.
export const aggregateDecimals = (column, fn) => fn === "count" ? 0
: ["mean", "median", "std"].includes(fn) ? Math.max(column.decimals, 1) : column.decimals;
const formats = new Map();
const numberFormat = (d) => {
if (!formats.has(d)) formats.set(d, new Intl.NumberFormat("en-US", { minimumFractionDigits: d, maximumFractionDigits: d }));
return formats.get(d);
};
export function formatNumber(value, decimals = 0, unit = "") {
if (value == null || !Number.isFinite(value)) return "—";
const d = Math.max(0, Math.min(10, decimals));
const abs = Math.abs(value);
if (abs !== 0 && (abs >= 1e15 || (abs < 1e-6 && d <= 6))) return value.toExponential(Math.min(d, 3)) + unit;
return numberFormat(d).format(value) + unit;
}
const pad = (n) => String(n).padStart(2, "0");
export function formatDate(ms, withTime) {
if (ms == null || !Number.isFinite(ms)) return "—";
const d = new Date(ms);
const day = `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}`;
return withTime ? `${day} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}` : day;
}
const hasTime = (column) => column.keys.some((k) => k != null && k % 86400000 !== 0);
export function formatKey(column, key, fn) {
if (column.type === "number" && column.scientific != null && fn !== "count" && key != null && Number.isFinite(key) && key !== 0) return key.toExponential(column.scientific + (["mean", "median", "std"].includes(fn) ? 1 : 0)) + column.unit;
if (column.type === "date") return fn === "count" ? formatNumber(key, 0) : formatDate(key, hasTime(column));
if (column.type === "number" || fn) return formatNumber(key, fn ? aggregateDecimals(column, fn) : column.decimals, fn === "count" ? "" : column.unit);
return key == null ? "" : String(key);
}
// The summary cell of a column over the given rows: the selected aggregate for
// measures, the count of distinct values for text and dates, nothing for
// identifiers (seed, run...: an average of them means nothing).
export function summarize(column, indices, fn = "mean", isMeasure = (c) => !c.identifier) {
if (column.type !== "number") {
const distinct = distinctValues(column, indices).size;
return { kind: "distinct", value: distinct, text: distinct === 1 ? "1 distinct" : formatNumber(distinct) + " distinct" };
}
if (!isMeasure(column)) return { kind: "none", text: "" };
const value = aggregate(column.keys, indices, fn);
return { kind: "number", fn, value, text: formatKey(column, value, fn) };
}
/**
* Rows grouped by one column: the group's value, its row count, then every
* numeric column aggregated with fn. The result is a table model like
* analyzeTable's, so it can be sorted, summarized, charted and exported.
*/
export function groupTable(table, indices, groupIndex, fn = "mean", isMeasure = (c) => !c.identifier) {
const by = table.columns[groupIndex];
if (!by) return null;
const groups = new Map();
for (const i of indices) {
const key = by.keys[i] == null ? "" : by.keys[i];
if (!groups.has(key)) groups.set(key, []);
groups.get(key).push(i);
}
const numeric = table.columns.filter((c) => c.type === "number" && c.index !== groupIndex && isMeasure(c));
const entries = [...groups.entries()];
// Text groups keep the cell as written (first occurrence); numbers and dates are formatted.
const labels = entries.map(([key, rows]) => (key === "" ? "(empty)" : by.type === "text" ? table.body[rows[0]][groupIndex].trim() : formatKey(by, key)));
const groupColumn = makeColumn(by.name, 0, labels, { type: by.type, decimals: by.decimals, unit: by.unit });
groupColumn.keys = entries.map(([key]) => (key === "" ? null : key));
groupColumn.source = groupIndex;
groupColumn.identifier = by.type === "number";
const countColumn = makeColumn("Rows", 1, entries.map(([, rows]) => rows.length), { type: "number", decimals: 0, unit: "" });
const valueColumns = numeric.map((c, n) => {
const values = entries.map(([, rows]) => aggregate(c.keys, rows, fn));
const column = makeColumn(c.name, n + 2, values, { type: "number", decimals: aggregateDecimals(c, fn), unit: fn === "count" ? "" : c.unit, scientific: fn === "count" || c.scientific == null ? null : c.scientific + (["mean", "median", "std"].includes(fn) ? 1 : 0) });
column.source = c.index;
column.agg = fn;
return column;
});
const columns = [groupColumn, countColumn, ...valueColumns];
const body = entries.map((_, r) => columns.map((c) => (c === groupColumn ? labels[r] : formatKey(c, c.keys[r]))));
return { header: columns.map((c) => c.name), body, columns, size: body.length, grouped: { by: by.name, fn } };
}
// Quick facts for a column's menu: type, counts, range, mean and a histogram.
export function columnStats(column, indices, bins = 12) {
const stats = { type: column.type, count: 0, empty: 0, distinct: distinctValues(column, indices).size };
for (const i of indices) { if (column.keys[i] == null) stats.empty++; else stats.count++; }
if (column.type === "text") {
stats.top = [...distinctValues(column, indices).entries()].sort((a, b) => b[1] - a[1] || compareText(a[0], b[0])).slice(0, 5);
return stats;
}
stats.min = aggregate(column.keys, indices, "min");
stats.max = aggregate(column.keys, indices, "max");
if (column.type === "number") {
stats.mean = aggregate(column.keys, indices, "mean");
stats.std = aggregate(column.keys, indices, "std");
}
if (stats.count && stats.min != null) {
const n = stats.min === stats.max ? 1 : bins;
const width = (stats.max - stats.min) / n || 1;
const counts = new Array(n).fill(0);
for (const i of indices) {
const k = column.keys[i];
if (k == null) continue;
counts[Math.min(n - 1, Math.floor((k - stats.min) / width))]++;
}
stats.histogram = counts.map((count, b) => ({ count, from: stats.min + b * width, to: stats.min + (b + 1) * width }));
}
return stats;
}
// ---- Export -----------------------------------------------------------------
const csvCell = (value, sep) => {
const text = String(value ?? "");
return text.includes(sep) || /["\r\n]/.test(text) || /^\s|\s$/.test(text) ? '"' + text.replace(/"/g, '""') + '"' : text;
};
export const toDelimited = (header, rows, sep = ",") => [header, ...rows].map((r) => r.map((v) => csvCell(v, sep)).join(sep)).join("\n") + "\n";
const mdCell = (value) => String(value ?? "").replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
export function toMarkdown(header, rows, numeric = []) {
const lines = [
"| " + header.map(mdCell).join(" | ") + " |",
"| " + header.map((_, i) => (numeric[i] ? "---:" : "---")).join(" | ") + " |",
...rows.map((r) => "| " + header.map((_, i) => mdCell(r[i])).join(" | ") + " |"),
];
return lines.join("\n") + "\n";
}
// ---- Shareable state --------------------------------------------------------
// The analysis of a table lives in the URL fragment so a link can carry
// "grouped by model, average accuracy": #table:group=model&agg=mean (a single
// file) or #table-2:... (the second file of a gist). Columns are named, not
// numbered. Without the fragment the table opens as it always did.
export const DEFAULT_STATE = Object.freeze({ view: "table", query: "", sort: null, group: null, agg: "mean", sum: "mean", ranges: {}, values: {}, sums: {}, numeric: [], chart: null, x: null, y: [] });
export function encodeState(state) {
const p = new URLSearchParams();
if (state.view && state.view !== "table") p.set("view", state.view);
if (state.query) p.set("q", state.query);
if (state.sort?.column) p.set("sort", state.sort.column + (state.sort.dir === "desc" ? ":desc" : ""));
if (state.group) p.set("group", state.group);
if (state.group && state.agg && state.agg !== "mean") p.set("agg", state.agg);
for (const [name, [min, max]] of Object.entries(state.ranges || {})) if (min != null || max != null) p.set("range." + name, (min ?? "") + "~" + (max ?? ""));
for (const [name, list] of Object.entries(state.values || {})) for (const v of list || []) p.append("in." + name, v);
if (state.sum && state.sum !== "mean") p.set("sum", state.sum);
for (const [name, fn] of Object.entries(state.sums || {})) if (fn && fn !== (state.sum || "mean")) p.set("sum." + name, fn);
if (state.numeric?.length) p.set("num", state.numeric.join("|"));
if (state.chart) p.set("chart", state.chart);
if (state.x) p.set("x", state.x);
if (state.y?.length) p.set("y", state.y.join("|"));
return p.toString();
}
export function decodeState(text) {
const p = new URLSearchParams(text || "");
const out = { ...DEFAULT_STATE, ranges: {}, values: {}, sums: {}, numeric: [], y: [] };
const view = p.get("view");
if (["table", "chart", "raw"].includes(view)) out.view = view;
out.query = p.get("q") || "";
const sort = p.get("sort");
if (sort) { const m = /^(.*?)(?::(asc|desc))?$/.exec(sort); out.sort = { column: m[1], dir: m[2] || "asc" }; }
out.group = p.get("group") || null;
const agg = p.get("agg");
if (agg && AGGREGATE_LABEL[agg]) out.agg = agg;
for (const [key, value] of p.entries()) {
if (key.startsWith("range.")) {
const [min, max] = value.split("~").map((v) => (v === "" || v == null ? null : Number(v)));
out.ranges[key.slice(6)] = [Number.isFinite(min) ? min : null, Number.isFinite(max) ? max : null];
} else if (key.startsWith("in.")) (out.values[key.slice(3)] ||= []).push(value);
else if (key.startsWith("sum.") && AGGREGATE_LABEL[value]) out.sums[key.slice(4)] = value;
}
const sum = p.get("sum");
if (sum && AGGREGATE_LABEL[sum]) out.sum = sum;
out.numeric = (p.get("num") || "").split("|").filter(Boolean);
const chart = p.get("chart");
if (["bar", "line", "scatter"].includes(chart)) out.chart = chart;
out.x = p.get("x") || null;
out.y = (p.get("y") || "").split("|").filter(Boolean);
return out;
}
const hashPrefix = (key) => "#" + key + ":";
export function readHashState(hash, key) {
if (!key || typeof hash !== "string" || !hash.startsWith(hashPrefix(key))) return null;
try { return decodeState(hash.slice(hashPrefix(key).length)); } catch { return null; }
}
// The fragment for a state, "" when the state is the default (the link is then left clean).
export function writeHashState(key, state) {
const encoded = encodeState(state);
return encoded ? hashPrefix(key) + encoded.replace(/%3A/gi, ":").replace(/%7C/gi, "|").replace(/%7E/gi, "~").replace(/%2C/gi, ",") : "";
}
export const isTableHash = (hash) => /^#table(?:-\d+)?:/.test(hash || "");
+262
View File
@@ -0,0 +1,262 @@
// Chart geometry for the table viewer's Chart view, as plain data the template
// draws in inline SVG (no chart library). Bars are horizontal so category names
// stay readable on a phone; lines and scatter plots share one value axis.
import { aggregate, formatKey, formatNumber, formatDate } from "./table-analysis.js";
// Categorical slots, light and dark steps chosen and validated for this page's
// surfaces (dataviz reference palette, adjacent pairs; scatter uses the first three).
export const SERIES_LIGHT = ["#2a78d6", "#eb6834", "#1baf7a", "#eda100"];
export const SERIES_DARK = ["#3987e5", "#d95926", "#199e70", "#c98500"];
export const MAX_SERIES = { bar: 4, line: 4, scatter: 3 };
export const MAX_BARS = 40;
export const MAX_CATEGORIES = 500;
const MAX_POINTS = 2000;
const isIdLike = (column) => column.type === "number" && !!column.identifier;
// The default chart: a bar of the first measure by the first text column (the
// group column once grouped); a line when the x axis is a date or a number.
export function defaultChart(table, grouped) {
const cols = table.columns;
const x = grouped ? cols[0] : cols.find((c) => c.type === "text") || cols.find((c) => c.type === "date") || cols.find((c) => c.type === "number");
const measures = cols.filter((c) => c.type === "number" && c !== x && !(grouped && c.index === 1));
const y = measures.find((c) => !isIdLike(c)) || measures[0];
return { type: x && x.type !== "text" ? "line" : "bar", x: x?.name || null, y: y ? [y.name] : [] };
}
// Round axis bounds and 3-6 ticks at 1/2/5 steps.
export function niceTicks(min, max, count = 5) {
if (!Number.isFinite(min) || !Number.isFinite(max)) return { min: 0, max: 1, ticks: [0, 1], step: 1 };
if (min === max) { const pad = Math.abs(min) * 0.1 || 1; min -= pad; max += pad; }
const raw = (max - min) / count;
const mag = 10 ** Math.floor(Math.log10(raw));
const step = [1, 2, 2.5, 5, 10].map((m) => m * mag).find((s) => s >= raw) || 10 * mag;
const lo = Math.floor(min / step + 1e-9) * step, hi = Math.ceil(max / step - 1e-9) * step;
const ticks = [];
for (let v = lo; v <= hi + step / 2; v += step) ticks.push(Math.abs(v) < step / 1e6 ? 0 : +v.toPrecision(12));
return { min: lo, max: hi, ticks, step };
}
const stepDecimals = (step) => (String(+step.toPrecision(6)).split(".")[1] || "").length;
// Axis labels: full under 10,000, compact (12K, 1.5M) when the axis reaches it.
export function tickLabel(value, step, unit = "") {
const top = Math.abs(value);
if (top >= 10000) {
const [div, suffix] = top >= 1e9 ? [1e9, "B"] : top >= 1e6 ? [1e6, "M"] : [1e3, "K"];
return formatNumber(value / div, Math.max(0, stepDecimals(step / div))) + suffix + unit;
}
return formatNumber(value, stepDecimals(step)) + unit;
}
// Measured text is not available outside the page; an average Inter glyph at 11-12px is close enough to size gutters.
const textWidth = (text, size = 11.5) => String(text).length * size * 0.56;
/**
* table: a model from analyzeTable/groupTable; rows: row indices in view order;
* spec: { type, x, y: [names], agg }; box: { width, dark }.
*/
export function buildChart(table, rows, spec, box) {
const cols = table.columns;
const x = cols.find((c) => c.name === spec.x);
const type = spec.type || "bar";
const ys = (spec.y || []).map((n) => cols.find((c) => c.name === n && c.type === "number")).filter(Boolean).slice(0, MAX_SERIES[type]);
const palette = box.dark ? SERIES_DARK : SERIES_LIGHT;
const width = Math.max(260, Math.floor(box.width || 640));
const base = { type, width, x, ys, notes: [], series: ys.map((c, i) => ({ name: c.name, color: palette[i] })) };
if (!x) return { ...base, empty: "Pick a column for the x axis." };
if (!ys.length) return { ...base, empty: "Pick at least one numeric column to plot." };
if (!rows.length) return { ...base, empty: "No rows match the current filters." };
if ((spec.y || []).length > ys.length) base.notes.push(`Showing the first ${ys.length} series; a chart with more is hard to read.`);
// One value axis only: say so when the series live on very different scales.
const spans = ys.map((y) => Math.max(...rows.slice(0, 5000).map((r) => Math.abs(y.keys[r] ?? 0)))).filter((v) => v > 0);
if (spans.length > 1 && Math.max(...spans) / Math.min(...spans) > 20) base.notes.push("These columns have very different ranges; chart them one at a time to compare their values.");
return type === "bar" ? barChart(table, rows, x, ys, spec, base)
: type === "line" ? lineChart(table, rows, x, ys, spec, base)
: scatterChart(table, rows, x, ys, base);
}
// One entry per x value in first-seen order; repeated x values are combined
// with the chosen aggregate (a chart of "accuracy by model" over seeds).
function categories(table, rows, x, ys, agg) {
const map = new Map();
for (const r of rows) {
const key = x.keys[r] == null ? "" : x.keys[r];
if (!map.has(key)) map.set(key, { key, label: key === "" ? "(empty)" : x.type === "text" ? String(table.body[r][x.index]).trim() : formatKey(x, key), rows: [] });
map.get(key).rows.push(r);
}
const list = [...map.values()];
const repeated = list.some((c) => c.rows.length > 1);
for (const c of list) c.values = ys.map((y) => (repeated ? aggregate(y.keys, c.rows, agg) : y.keys[c.rows[0]]));
return { list, repeated };
}
function valueFormat(y, fn) { return (v) => formatKey(y, v, fn); }
function barChart(table, rows, x, ys, spec, base) {
const agg = spec.agg || "mean";
const { list: all, repeated } = categories(table, rows, x, ys, agg);
const list = all.slice(0, MAX_BARS);
if (repeated) base.notes.unshift(`${aggLabel(agg)} per ${x.name} over ${rows.length} rows.`);
if (all.length > list.length) base.notes.push(`First ${list.length} of ${all.length} ${x.name} values, in table order.`);
const values = list.flatMap((c) => c.values).filter((v) => v != null);
const lo = Math.min(0, ...values), hi = Math.max(0, ...values);
const scale = niceTicks(lo, hi, base.width < 480 ? 4 : 6);
const fmt = ys.map((y) => valueFormat(y, repeated ? agg : undefined));
const labelW = Math.min(Math.max(...list.map((c) => textWidth(c.label, 12))) + 12, Math.round(base.width * 0.38));
const valueW = Math.max(...list.flatMap((c) => c.values.map((v, i) => textWidth(fmt[i](v), 11.5)))) + 10;
const bar = ys.length > 2 ? 12 : 16, gap = 2, pad = 14;
const band = ys.length * bar + (ys.length - 1) * gap + pad;
const top = 8, axisH = 26;
const plot = { x: labelW, y: top, w: Math.max(80, base.width - labelW - valueW - 4), h: list.length * band };
const sx = (v) => plot.x + ((v - scale.min) / (scale.max - scale.min)) * plot.w;
const zero = sx(0);
const marks = [];
list.forEach((c, ci) => {
const y0 = plot.y + ci * band + pad / 2;
c.values.forEach((v, si) => {
if (v == null) return;
const x1 = sx(v), left = Math.min(zero, x1), w = Math.abs(x1 - zero);
marks.push({ key: ci + ":" + si, series: si, cat: ci, x: left, y: y0 + si * (bar + gap), w, h: bar, positive: v >= 0, color: base.series[si].color,
path: roundedBar(left, y0 + si * (bar + gap), w, bar, v >= 0),
label: fmt[si](v), lx: v >= 0 ? x1 + 6 : x1 - 6, anchor: v >= 0 ? "start" : "end", ly: y0 + si * (bar + gap) + bar / 2 });
});
});
return {
...base, kind: "bar", height: plot.y + plot.h + axisH, plot, zero,
categories: list.map((c, ci) => ({ label: c.label, y: plot.y + ci * band + band / 2, hit: { y: plot.y + ci * band, h: band },
tip: { title: c.label, rows: c.values.map((v, si) => ({ name: ys[si].name, color: base.series[si].color, value: fmt[si](v) })), note: repeated ? `${aggLabel(agg)} of ${c.rows.length} ${c.rows.length === 1 ? "row" : "rows"}` : "" } })),
marks, showValues: list.length <= 30,
xTicks: scale.ticks.map((v) => ({ v, x: sx(v), label: tickLabel(v, scale.step, ys.length === 1 ? ys[0].unit : "") })),
axisLabel: ys.length === 1 ? (repeated ? `${aggLabel(agg)} ${ys[0].name}` : measureName(ys[0])) : repeated ? aggLabel(agg) : "",
};
}
// 4px rounded data end, square at the baseline.
function roundedBar(x, y, w, h, positive) {
const r = Math.min(4, w / 2, h / 2);
if (w <= 0.5) return "";
return positive
? `M${x},${y}H${x + w - r}Q${x + w},${y} ${x + w},${y + r}V${y + h - r}Q${x + w},${y + h} ${x + w - r},${y + h}H${x}Z`
: `M${x + w},${y}H${x + r}Q${x},${y} ${x},${y + r}V${y + h - r}Q${x},${y + h} ${x + r},${y + h}H${x + w}Z`;
}
// A grouped table's columns are aggregates: "Average accuracy".
const measureName = (column) => (column.agg ? `${aggLabel(column.agg)} ${column.name}` : column.name);
const aggLabel = (fn) => ({ mean: "Average", sum: "Sum", median: "Median", min: "Min", max: "Max", count: "Count", std: "Std dev" })[fn] || fn;
function xAxis(points, x, plotW, continuous) {
if (continuous) {
const keys = points.map((p) => p.xv);
const scale = niceTicks(Math.min(...keys), Math.max(...keys), plotW < 360 ? 3 : 6);
let ticks = scale.ticks;
if (x.type === "date") {
const lo = Math.min(...keys), hi = Math.max(...keys), span = hi - lo || 86400000;
// Calendar steps: hours, days, weeks, months (30 days), years.
const HOUR = 3600000, DAY = 24 * HOUR;
const steps = [HOUR, 3 * HOUR, 6 * HOUR, 12 * HOUR, DAY, 2 * DAY, 7 * DAY, 14 * DAY, 30 * DAY, 91 * DAY, 182 * DAY, 365 * DAY, 730 * DAY, 1826 * DAY];
const want = plotW < 360 ? 3 : 6;
const step = steps.find((s) => span / s <= want) || steps[steps.length - 1];
ticks = [];
for (let t = Math.ceil(lo / step) * step; t <= hi; t += step) ticks.push(t);
if (!ticks.length) ticks = [lo];
return { min: lo, max: hi === lo ? lo + DAY : hi, ticks, label: (v) => formatDate(v, step < DAY) };
}
return { min: scale.min, max: scale.max, ticks, label: (v) => tickLabel(v, scale.step, x.unit) };
}
return null;
}
function lineChart(table, rows, x, ys, spec, base) {
const continuous = x.type !== "text";
let points;
if (continuous) {
const usable = rows.filter((r) => x.keys[r] != null);
const repeated = new Set(usable.map((r) => x.keys[r])).size < usable.length;
if (repeated) {
const { list } = categories(table, usable, x, ys, spec.agg || "mean");
points = list.map((c) => ({ xv: c.key, label: c.label, values: c.values, count: c.rows.length }));
base.notes.unshift(`${aggLabel(spec.agg || "mean")} per ${x.name}.`);
} else points = usable.map((r) => ({ xv: x.keys[r], label: formatKey(x, x.keys[r]), values: ys.map((y) => y.keys[r]), count: 1 }));
points.sort((a, b) => a.xv - b.xv);
} else {
const { list, repeated } = categories(table, rows, x, ys, spec.agg || "mean");
points = list.map((c) => ({ label: c.label, values: c.values, count: c.rows.length }));
if (repeated) base.notes.unshift(`${aggLabel(spec.agg || "mean")} per ${x.name}.`);
}
points = thin(points, base);
return xyChart(points, x, ys, base, continuous, "line", spec);
}
function scatterChart(table, rows, x, ys, base) {
const continuous = x.type !== "text";
let points = rows.filter((r) => x.keys[r] != null).map((r) => ({ xv: continuous ? x.keys[r] : null, label: x.type === "text" ? String(table.body[r][x.index]).trim() : formatKey(x, x.keys[r]), values: ys.map((y) => y.keys[r]), count: 1, row: r }));
if (!continuous) {
// Text on the x axis: one position per value in first-seen order.
const order = new Map();
points.forEach((p) => { if (!order.has(p.label)) order.set(p.label, order.size); p.xv = order.get(p.label); });
// An ID-like column has a label per row: no readable axis, and measuring
// every label would stall the tab.
if (order.size > MAX_CATEGORIES) return { ...base, empty: `The x column has ${order.size.toLocaleString("en-US")} different values; choose a number or date column, or group the rows first.` };
base.categoryLabels = [...order.keys()];
}
points = thin(points, base);
return xyChart(points, x, ys, base, true, "scatter");
}
// Long series keep every n-th point so the SVG stays light; the note says so.
function thin(points, base) {
if (points.length <= MAX_POINTS) return points;
const step = Math.ceil(points.length / MAX_POINTS);
base.notes.push(`Showing every ${step}th of ${points.length.toLocaleString("en-US")} points.`);
return points.filter((_, i) => i % step === 0);
}
function xyChart(points, x, ys, base, continuous, kind) {
const values = points.flatMap((p) => p.values).filter((v) => v != null);
if (!values.length) return { ...base, empty: "The selected columns have no values in these rows." };
const narrow = base.width < 480;
const yScale = niceTicks(values.reduce((a, v) => Math.min(a, v), Infinity), values.reduce((a, v) => Math.max(a, v), -Infinity), narrow ? 4 : 5);
const unit = ys.length === 1 ? ys[0].unit : "";
const yLabels = yScale.ticks.map((v) => tickLabel(v, yScale.step, unit));
const left = Math.max(...yLabels.map((l) => textWidth(l))) + 14;
const height = narrow ? 240 : 300;
const plot = { x: left, y: 10, w: base.width - left - 16, h: height - 10 - 30 };
const cats = base.categoryLabels;
let sxv, xTicks;
if (continuous && !cats) {
const axis = xAxis(points, x, plot.w, true);
const span = axis.max - axis.min || 1;
sxv = (v) => plot.x + ((v - axis.min) / span) * plot.w;
xTicks = axis.ticks.map((v) => ({ x: sxv(v), label: axis.label(v) }));
} else {
const n = cats ? cats.length : points.length;
const inset = n > 1 ? Math.min(24, plot.w / (2 * n)) : plot.w / 2;
const stepW = n > 1 ? (plot.w - 2 * inset) / (n - 1) : 0;
sxv = (i) => plot.x + inset + i * stepW;
if (!cats) points.forEach((p, i) => { p.xv = i; });
const labels = cats || points.map((p) => p.label);
const widest = labels.reduce((w, l) => Math.max(w, textWidth(l)), 0);
const maxLabels = Math.max(2, Math.floor(plot.w / (widest + 12)));
const every = Math.ceil(labels.length / maxLabels);
xTicks = labels.map((label, i) => ({ x: sxv(i), label, show: i % every === 0 })).filter((t) => t.show);
}
// Labels near the plot's edges are anchored inside it, never cut off.
xTicks.forEach((t) => { const half = textWidth(t.label) / 2; t.anchor = t.x - half < plot.x - 8 ? "start" : t.x + half > plot.x + plot.w + 12 ? "end" : "middle"; });
const sy = (v) => plot.y + plot.h - ((v - yScale.min) / (yScale.max - yScale.min || 1)) * plot.h;
const fmt = ys.map((y) => (v) => formatKey(y, v, undefined));
const dots = points.length <= 80 || kind === "scatter";
const series = base.series.map((s, si) => {
const pts = points.map((p, i) => (p.values[si] == null ? null : { i, x: sxv(p.xv), y: sy(p.values[si]) }));
let path = "", pen = false;
for (const pt of pts) { if (!pt) { pen = false; continue; } path += (pen ? "L" : "M") + pt.x.toFixed(1) + "," + pt.y.toFixed(1); pen = true; }
return { ...s, path: kind === "line" ? path : "", dots: dots ? pts.filter(Boolean) : [] };
});
const cols = points.map((p) => ({ x: sxv(p.xv), title: (x.type === "text" || cats ? "" : x.name + " ") + p.label,
rows: p.values.map((v, si) => ({ name: ys[si].name, color: base.series[si].color, value: v == null ? "—" : fmt[si](v) })),
note: p.count > 1 ? `${p.count} rows` : "" }));
return {
...base, kind, height, plot, series, points: cols,
yTicks: yScale.ticks.map((v, i) => ({ y: sy(v), label: yLabels[i] })),
xTicks, xLabel: x.name, yLabel: ys.length === 1 ? measureName(ys[0]) : "",
};
}
+188
View File
@@ -0,0 +1,188 @@
// Tables inside rendered Markdown and notebook outputs (pandas DataFrames) get
// a light version of the table viewer: click a header to sort, an optional Σ
// summary row, and "Open as table" for the full analysis view. Redaction slots
// stay in place (rows are moved, never re-rendered); sorting and the exported
// data use the anonymized text (XXXX-n).
import { analyzeTable, sortIndices, summarize, AGGREGATES, aggregateShort } from "./table-analysis.js";
// "Open as table" opens the full viewer; data-table.js registers it (kept out of
// this module so the extraction can be tested without the compiled template).
let openTable = null;
export const setTableOpener = (fn) => { openTable = fn; };
const SKIP = ".dt, .csv-table, pre, .diff-file-table, .md-table-off";
// A cell's text with its redaction chips or slots read back as XXXX-n.
export function cellText(cell) {
const copy = cell.cloneNode(true);
copy.querySelectorAll("mark.redact-chip[data-term]").forEach((m) => m.replaceWith(m.dataset.term));
copy.querySelectorAll(".redact-slot").forEach((m) => m.replaceWith("XXXX-" + (m.textContent || "").trim()));
copy.querySelectorAll(".md-sort").forEach((m) => m.remove());
return copy.textContent.replace(/\s+/g, " ").trim();
}
const spans = (row) => [...row.cells].some((c) => c.colSpan > 1 || c.rowSpan > 1);
// { header: [text], trs: [body <tr>], headerCells: [<th>] } or null for tables
// this light mode can't handle (merged cells, fewer than two data rows).
export function tableData(table) {
if (!table?.rows?.length || table.closest(SKIP) || table.parentElement?.closest?.("table")) return null;
let headRows = table.tHead ? [...table.tHead.rows] : [];
let trs = [...table.tBodies].flatMap((b) => [...b.rows]);
if (!headRows.length) {
const first = table.rows[0];
if (!first || ![...first.cells].every((c) => c.tagName === "TH")) return null;
headRows = [first];
trs = trs.filter((r) => r !== first);
}
if (trs.length < 2 || trs.some(spans)) return null;
// pandas writes the column names and the index name on two header rows.
if (headRows.some(spans) && headRows.length > 1) return null;
const width = Math.max(...trs.map((r) => r.cells.length), ...headRows.map((r) => r.cells.length));
if (headRows.some((r) => r.cells.length !== width && spans(r))) return null;
const header = Array.from({ length: width }, (_, i) => headRows.map((r) => (r.cells[i] ? cellText(r.cells[i]) : "")).filter(Boolean).join(" ") || (i === 0 ? "" : "Column " + (i + 1)));
const rows = [header, ...trs.map((r) => Array.from({ length: width }, (_, i) => (r.cells[i] ? cellText(r.cells[i]) : "")))];
return { rows, trs, headerCells: [...headRows[headRows.length - 1].cells] };
}
const SORT_ICON = '<svg class="dt-sort-icon" viewBox="0 0 10 14" aria-hidden="true"><path class="up" d="M5 1.5 8.5 5.5h-7z"/><path class="down" d="M5 12.5 1.5 8.5h7z"/></svg>';
function titleFor(table) {
const root = table.closest(".markdown-body, notebook, markdown") || table.ownerDocument.body;
let title = "";
for (const h of root.querySelectorAll("h1, h2, h3, h4")) {
if (h.compareDocumentPosition(table) & 4) title = h.textContent.replace(/\s+/g, " ").trim(); else break;
}
return title ? "Table · " + title : "Table";
}
function enhance(table) {
if (table.dataset.dtEnhanced) return;
const data = tableData(table);
if (!data) return;
table.dataset.dtEnhanced = "1";
const doc = table.ownerDocument;
const model = analyzeTable(data.rows);
const original = data.trs.slice();
const parentOf = new Map(original.map((tr) => [tr, tr.parentNode]));
let sort = null;
const wrap = doc.createElement("div");
wrap.className = "md-table";
table.parentNode.insertBefore(wrap, table);
wrap.appendChild(table);
const apply = () => {
const order = sort ? sortIndices(model, original.map((_, i) => i), sort.index, sort.dir) : original.map((_, i) => i);
order.forEach((i) => parentOf.get(original[i]).appendChild(original[i]));
data.headerCells.forEach((th, i) => {
const dir = sort && sort.index === i ? sort.dir : null;
th.setAttribute("aria-sort", dir === "asc" ? "ascending" : dir === "desc" ? "descending" : "none");
th.querySelector(".dt-sort-icon")?.setAttribute("class", "dt-sort-icon" + (dir ? " is-" + dir : ""));
});
};
data.headerCells.forEach((th, i) => {
if (i >= model.columns.length) return;
th.classList.add("md-sortable");
const button = doc.createElement("button");
button.type = "button";
button.className = "md-sort";
button.setAttribute("aria-label", "Sort by " + (model.columns[i].name || "column " + (i + 1)));
button.innerHTML = SORT_ICON;
th.appendChild(button);
th.addEventListener("click", (event) => {
if (event.target.closest("a")) return;
const dir = sort && sort.index === i ? sort.dir : null;
sort = dir === "asc" ? { index: i, dir: "desc" } : dir === "desc" ? null : { index: i, dir: "asc" };
apply();
});
});
apply();
// Σ: a footer row like the table viewer's: each measure with its own small
// aggregate select (Average first), distinct counts under text columns,
// nothing under identifiers. A first text column carries the Σ mark.
const measure = (c) => c.type === "number" && !c.identifier;
const numeric = model.columns.some(measure);
const markFirst = model.columns.length > 1 && model.columns[0].type !== "number";
const tools = doc.createElement("div");
tools.className = "md-table-tools";
let foot = null;
const fns = model.columns.map(() => "mean");
const aggCell = (c, i, all) => {
const wrap = doc.createElement("span");
wrap.className = "dt-sum";
const label = doc.createElement("label");
label.className = "dt-sum-fn";
const select = doc.createElement("select");
select.setAttribute("aria-label", "Summary of " + (c.name || "column " + (i + 1)));
AGGREGATES.forEach(([k, text]) => { const o = doc.createElement("option"); o.value = k; o.textContent = text; select.appendChild(o); });
select.value = fns[i];
select.addEventListener("change", () => { fns[i] = select.value; renderFoot(); });
const short = doc.createElement("span");
short.className = "dt-sum-fn-label";
short.setAttribute("aria-hidden", "true");
short.textContent = aggregateShort(fns[i]);
label.append(select, short);
label.insertAdjacentHTML("beforeend", '<svg class="ui-icon dt-sum-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg>');
const value = doc.createElement("b");
value.className = "dt-sum-value";
value.textContent = summarize(c, all, fns[i]).text;
wrap.append(label, value);
return wrap;
};
const renderFoot = () => {
if (!foot) return;
const all = original.map((_, i) => i);
const tr = foot.rows[0];
tr.textContent = "";
model.columns.forEach((c, i) => {
const td = doc.createElement("td");
if (i === 0 && markFirst) { td.className = "md-summary-label"; td.innerHTML = '<span aria-hidden="true">Σ</span><span class="sr-only">Summary</span>'; }
else if (measure(c)) { td.className = "is-num"; td.appendChild(aggCell(c, i, all)); }
else if (c.type !== "number") { td.className = "is-muted"; td.textContent = summarize(c, all).text; }
tr.appendChild(td);
});
};
if (numeric) {
const sigma = doc.createElement("button");
sigma.type = "button";
sigma.className = "md-table-btn md-sigma";
sigma.setAttribute("aria-pressed", "false");
sigma.title = "Show a summary row";
sigma.innerHTML = '<span aria-hidden="true">Σ</span><span class="md-table-btn-text">Summary</span>';
sigma.addEventListener("click", () => {
const on = !foot;
sigma.setAttribute("aria-pressed", on ? "true" : "false");
sigma.classList.toggle("is-on", on);
if (on) {
foot = doc.createElement("tfoot");
foot.className = "md-summary";
foot.appendChild(doc.createElement("tr"));
table.appendChild(foot);
renderFoot();
} else { foot.remove(); foot = null; }
});
tools.appendChild(sigma);
}
const open = doc.createElement("button");
open.type = "button";
open.className = "md-table-btn md-open";
open.innerHTML = '<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chart"></use></svg><span>Open as table</span>';
open.addEventListener("click", () => openTable?.(data.rows, titleFor(table)));
tools.appendChild(open);
wrap.appendChild(tools);
}
export function enhanceTables(root) {
if (!root?.querySelectorAll) return;
root.querySelectorAll("table:not([data-dt-enhanced])").forEach((table) => {
try { enhance(table); } catch { table.dataset.dtEnhanced = "error"; }
});
}
// v-data-tables on v-html Markdown: enhance after each render (idempotent).
export const dataTablesDirective = {
mounted(el) { enhanceTables(el); },
updated(el) { enhanceTables(el); },
};
+62 -58
View File
@@ -1,58 +1,62 @@
"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
"use strict";(()=>{var rd=Object.defineProperty;var ad=e=>{throw TypeError(e)};var _m=(e,t,s)=>t in e?rd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var zm=(e,t)=>{for(var s in t)rd(e,s,{get:t[s],enumerable:!0})};var lt=(e,t,s)=>_m(e,typeof t!="symbol"?t+"":t,s),ra=(e,t,s)=>t.has(e)||ad("Cannot "+s);var ue=(e,t,s)=>(ra(e,t,"read from private field"),s?s.call(e):t.get(e)),je=(e,t,s)=>t.has(e)?ad("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Ye=(e,t,s,i)=>(ra(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),Ge=(e,t,s)=>(ra(e,t,"access private method"),s);var ld=(e,t,s,i)=>({set _(o){Ye(e,t,o,s)},get _(){return ue(e,t,i)}});var we=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ke={markdown:"/script/markdown.6c8dfb7b1d.min.js",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 dd(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let s=new URLSearchParams(t);if([...s.keys()].length!==3||[...s.keys()].some(u=>!["clientId","intentId","token"].includes(u)))return null;let i=s.get("clientId"),o=s.get("intentId"),r=s.get("token");return!/^[a-f0-9]{32}$/.test(i||"")||!/^[a-f0-9]{32}$/.test(o||"")||!/^[a-f0-9]{64}$/.test(r||"")?null:{contract:"4open.artifacts/1",clientId:i,intentId:o,token:r}}function ud(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=r?{clientId:r.clientId,intentId:r.intentId}:null,p,d,h,m,y,v=!0,b,w=i.defer(),C=()=>[...o.crypto.getRandomValues(new Uint8Array(16))].map(F=>F.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:r?"":"Open a new artifact link from your submission. This link is missing or invalid."});let N=()=>v&&e.user?.username===y;function k(){v=!1,r=p=d=void 0,w.resolve(),o.clearTimeout(b)}e.on("dispose",k),e.on("routeLeave",k),e.watch(()=>e.user?.username,F=>{!y&&F?y=F:y&&F!==y&&(k(),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":d}}),D=F=>F?.status===404?"Artifact linking is not available on this server.":F?.status===401?"Sign in, then open a new artifact link from your submission.":F?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!v||!r||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let F=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(F)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,p=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,o.clearTimeout(b),m||(m=C());try{let z=(await s.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(d=z.csrf,e.handoffEnabled=z.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(d||""))throw new Error("invalid_csrf");let K=(await s.post("/api/review-consent/preview",{repositoryId:F,intent:{...r,requestId:m}},P())).data;if(!N())return;if(!K||typeof K.ticket!="string"||!K.ticket||K.ticket.length>8192||typeof K.repositoryName!="string"||!["restricted-review","anonymous-link"].iLine truncated
`))),e[Nn]=Ys(o);let r=i||o.props&&o.props.type==="number";Kn(e,t?"change":"input",u=>{u.target.composing||e[Nn](Wa(e.value,s,r))}),(s||r)&&Kn(e,"change",()=>{e.value=Wa(e.value,s,r)}),t||(Kn(e,"compositionstart",Gg),Kn(e,"compositionend",Ju),Kn(e,"change",Ju))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[ar];delete e[ar],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[Nn](Wa(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},u){if(e[Nn]=Ys(u),e.composing)return;let p=(r||e.type==="number")&&!/^0\d/.test(e.value)?_s(e.value):e.value,d=t??"";if(p===d)return;let h=e.getRootNode();(h instanceof Document||h instanceof ShadowRoot)&&h.activeElement===e&&e.type!=="range"&&(i&&t===s||o&&e.value.trim()===d)||(e.value=d)}},Ya={deep:!0,created(e,t,s){e[Nn]=Ys(s),Kn(e,"change",()=>{let i=e._modelValue,o=Qo(e),r=e.checked,u=e[Nn];if(Ve(i)){let p=Li(i,o),d=p!==-1;if(r&&!d)u(i.concat(o));else if(!r&&d){let h=[...i];h.splice(p,1),u(h)}}else if(rn(i)){let p=new Set(i);r?p.add(o):p.delete(o),u(p)}else u(nc(e,r))})},mounted:Qu,beforeUpdate(e,t,s){e[Nn]=Ys(s),Qu(e,t,s)}};function Qu(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Ve(t))o=Li(t,i.props.value)>-1;else if(rn(t))o=t.has(i.props.value);else{if(t===s)return;o=an(t,nc(e,!0))}e.checked!==o&&(e.checked=o)}var Dt={deep:!0,created(e,{value:t,modifiers:{number:s}},i){e._modelValue=t,Kn(e,"change",()=>{let o=Array.prototype.filter.call(e.options,d=>d.selected).map(d=>s?_s(Qo(d)):Qo(d)),r=e.multiple,u=r?rn(e._modelValue)?new Set(o):o:o[0],p=e._pendingValue=[r,r?Ve(u)?o.slice():o:u];try{e[Nn](u)}finally{Ke(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[Nn]=Ys(i)},mounted(e,{value:t}){Zu(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[Nn]=Ys(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!Wg(t,s[1],s[0]))&&Zu(e,t)}};function Wg(e,t,s){if(!s)return an(e,t);if(Ve(e))return an(e,t);if(rn(e)){if(e.size!==t.length)return!1;for(let i of t)if(!e.has(i))return!1;return!0}return!1}function Zu(e,t){let s=e.multiple,i=Ve(t);if(!(s&&!i&&!rn(t))){for(let o=0,r=e.options.length;o<r;o++){let u=e.options[o],p=Qo(u);if(s)if(i){let d=typeof p;d==="string"||d==="number"?u.selected=t.some(h=>String(h)===String(p)):u.selected=Li(t,p)>-1}else u.selected=t.has(p);else if(an(Qo(u),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Qo(e){return"_value"in e?e._value:e.value}function nc(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var Kg=["ctrl","shift","alt","meta"],Yg={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)=>Kg.some(s=>e[`${s}Key`]&&!t.includes(s))},de=(e,t)=>{if(!e)return e;let s=e._withMods||(e._withMods={}),i=t.join(".");return s[i]||(s[i]=((o,...r)=>{for(let u=0;u<t.length;u++){let p=Yg[t[u]];if(p&&p(o,t))return}return e(o,...r)}))},Xg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Tt=(e,t)=>{let s=e._withKeys||(e._withKeys={}),i=t.join(".");return s[i]||(s[i]=(o=>{if(!("key"in o))return;let r=gn(o.key);if(t.some(u=>u===r||Xg[u]===r))return e(o)}))},Jg=vt({patchProp:zg},Rg),xu;function Qg(){return xu||(xu=Ou(Jg))}var dr=((...e)=>{let t=Qg().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=xg(i);if(!o)return;let r=t._component;!$e(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let u=s(o,!1,Zg(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),u},t});function Zg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function xg(e){return mt(e)?document.querySelector(e):e}var ys=typeof document<"u";function oc(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function ev(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&oc(e.default)}var ot=Object.assign;function ur(e,t){let s={};for(let i in t){let o=t[i];s[i]=on(o)?o.map(e):e(o)}return s}var Js=()=>{},on=Array.isArray;function Qa(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var ic=/#/g,tv=/&/g,nv=/\//g,sv=/=/g,ov=/\?/g,rc=/\+/g,iv=/%5B/g,rv=/%5D/g,ac=/%5E/g,av=/%60/g,lc=/%7B/g,lv=/%7C/g,dc=/%7D/g,dv=/%20/g;function Za(e){return e==null?"":encodeURI(""+e).replace(lv,"|").replace(iv,"[").replace(rv,"]")}function uc(e){return Za(e).replace(lc,"{").replace(dc,"}").replace(ac,"^")}function Xa(e){return Za(e).replace(rc,"%2B").replace(dv,"+").replace(ic,"%23").replace(tv,"%26").replace(av,"`").replace(lc,"{").replace(dc,"}").replace(ac,"^")}function uv(e){return Xa(e).replace(sv,"%3D")}function cv(e){return ZLine truncated
${JSON.stringify(e)}${t?`
while being at
`+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]!=="")},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},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(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
`+JSON.stringify(t):""}`},[gt.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${wv(t)}" via a navigation guard.`},[gt.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[gt.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[gt.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function vs(e,t){return ot(new Error,{type:e,[bc]:!0},t)}function Rn(e,t){return e instanceof Error&&bc in e&&(t==null||!!(e.type&t))}var bv=["params","query","hash"];function wv(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of bv)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function wc(e){let t={};if(e===""||e==="?")return t;let s=(e[0]==="?"?e.slice(1):e).split("&");for(let i=0;i<s.length;++i){let o=s[i].replace(rc," "),r=o.indexOf("="),u=Xs(r<0?o:o.slice(0,r)),p=r<0?null:Xs(o.slice(r+1));if(u in t){let d=t[u];on(d)||(d=t[u]=[d]),d.push(p)}else t[u]=p}return t}function sl(e){let t="";for(let s in e){let i=e[s];if(s=uv(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(on(i)?i.map(o=>o&&Xa(o)):[i&&Xa(i)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+s,o!=null&&(t+="="+o))})}return t}function kc(e){let t={};for(let s in e){let i=e[s];i!==void 0&&(t[s]=on(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}var Cc=Symbol(""),ol=Symbol(""),mr=Symbol(""),hr=Symbol(""),gr=Symbol("");function Qs(){let e=[];function t(i){return e.push(i),()=>{let o=e.indexOf(i);o>-1&&e.splice(o,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function Bn(e,t,s,i,o,r=u=>u()){let u=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((p,d)=>{let h=v=>{v===!1?d(vs(gt.NAVIGATION_ABORTED,{from:s,to:t})):v instanceof Error?d(v):yv(v)?d(vs(gt.NAVIGATION_GUARD_REDIRECT,{from:t,to:v})):(u&&i.enterCallbacks[o]===u&&typeof v=="function"&&u.push(v),p())},m=r(()=>e.call(i&&i.instances[o],t,s,h)),y=Promise.resolve(m);e.length<3&&(y=y.then(h)),y.catch(v=>d(v))})}function vr(e,t,s,i,o=r=>r()){let r=[];for(let u of e)for(let p in u.components){let d=u.components[p];if(!(t!=="beforeRouteEnter"&&!u.instances[p]))if(oc(d)){let h=(d.__vccOpts||d)[t];h&&r.push(Bn(h,s,i,u,p,o))}else{let h=d();r.push(()=>h.then(m=>{if(!m)throw new Error(`Couldn't resolve component "${p}" at "${u.path}"`);let y=ev(m)?m.default:m;u.mods[p]=m,u.components[p]=y;let v=(y.__vccOpts||y)[t];return v&&Bn(v,s,i,u,p,o)()}))}}return r}function Sc(e,t){let s=[],i=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let u=0;u<r;u++){let p=t.matched[u];p&&(e.matched.find(h=>gs(h,p))?i.push(p):s.push(p));let d=e.matched[u];d&&(t.matched.find(h=>gs(h,d))||o.push(d))}return[s,i,o]}var kv=()=>location.protocol+"//"+location.host;function Vc(e,t){let{pathname:s,search:i,hash:o}=t,r=e.indexOf("#");if(r>-1){let u=o.includes(e.slice(r))?e.slice(r).length:1,p=o.slice(u);return p[0]!=="/"&&(p="/"+p),xa(p,"")}return xa(s,e)+i+o}function Cv(e,t,s,i){let o=[],r=[],u=null,p=({state:v})=>{let b=Vc(e,location),w=s.value,C=t.value,N=0;if(v){if(s.value=b,t.value=v,u&&u===w){u=null;return}N=C?v.position-C.position:0}else i(b);o.forEach(k=>{k(s.value,w,{delta:N,type:pr.pop,direction:N?N>0?fr.forward:fr.back:fr.unknown})})};function d(){u=s.value}function h(v){o.push(v);let b=()=>{let w=o.indexOf(v);w>-1&&o.splice(w,1)};return r.push(b),b}function m(){if(document.visibilityState==="hidden"){let{history:v}=window;if(!v.state)return;v.replaceState(ot({},v.state,{scroll:Zo()}),"")}}function y(){for(let v of r)v();r=[],window.removeEventListener("popstate",p),window.removeEventListener("pagehide",m),document.removeEventListener("visibilitychange",m)}return window.addEventListener("popstate",p),window.addEventListener("pagehide",m),document.addEventListener("visibilitychange",m),{pauseListeners:d,listen:h,destroy:y}}function Ec(e,t,s,i=!1,o=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:o?Zo():null}}function Sv(e){let{history:t,location:s}=window,i={value:Vc(e,s)},o={value:t.state};o.value||r(i.value,{back:null,current:i.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(d,h,m){let y=e.indexOf("#"),v=y>-1?(s.host&&document.querySelector("base")?e:e.slice(y))+d:kv()+e+d;try{t[m?"replaceState":"pushState"](h,"",v),o.value=h}catch(b){console.error(b),s[m?"replace":"assign"](v)}}function u(d,h){r(d,ot({},t.state,Ec(o.value.back,d,o.value.forward,!0),h,{position:o.value.position}),!0),i.value=d}function p(d,h){let m=ot({},o.value,t.state,{forward:d,scroll:Zo()});r(m.current,m,!0),r(d,ot({},Ec(i.value,d,null),{position:m.position+1},h),!1),i.value=d}return{location:i,state:o,push:p,replace:u}}function Lc(e){e=mc(e);let t=Sv(e),s=Cv(e,t.state,t.location,t.replace);function i(r,u=!0){u||s.pauseListeners(),history.go(r)}let o=ot({locatLine truncated
`);for(let m of h){if(s&&(r>0||u>0)&&/^([-+ ]|$)/.test(m)){m.startsWith("+")?(s.lines.push({kind:"add",oldNo:"",newNo:o++,text:m.slice(1)}),u--):m.startsWith("-")?(s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:m.slice(1)}),r--):(s.lines.push({kind:"ctx",oldNo:i++,newNo:o++,text:m.slice(1)}),r--,u--);continue}if(m.startsWith("diff --git")){p(),d();continue}if(m.startsWith("--- ")){s&&s.lines.length&&p(),d().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){d().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&&(i=parseInt(y[1],10),o=parseInt(y[3],10),r=y[2]==null?1:parseInt(y[2],10),u=y[4]==null?1:parseInt(y[4],10)),d().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}if(s)if(m.startsWith("+"))s.lines.push({kind:"add",oldNo:"",newNo:o++,text:m.slice(1)});else if(m.startsWith("-"))s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:m.slice(1)});else{if(m.startsWith("\\"))continue;s.lines.push({kind:"ctx",oldNo:i++,newNo:o++,text:m.startsWith(" ")?m.slice(1):m})}}}return p(),t}var xo=(e,t)=>{let s=[],i=[],o="",r=!1;for(let u=0;u<e.length;u++){let p=e[u];r?p==='"'?e[u+1]==='"'?(o+='"',u++):r=!1:o+=p:p==='"'&&o===""?r=!0:p===t?(i.push(o),o=""):p===`
`||p==="\r"?(p==="\r"&&e[u+1]===`
`&&u++,i.push(o),s.push(i),i=[],o=""):o+=p}return(o!==""||i.length)&&(i.push(o),s.push(i)),s.filter(u=>u.length>1||u[0]!=="")},Zs=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),Xv=(function(){let e=s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=s=>{let i=['<div class="diff-file-block">','<div class="diff-file-header"><span class="diff-file-icon"><i class="far fa-file-code"></i></span><span class="diff-file-name">'+e(s.path)+'</span><span class="diff-file-status diff-file-status-'+s.status+'">'+s.status+"</span></div>"];if(s.lines.length){i.push('<table class="diff-file-table"><tbody>');for(let o of s.lines)i.push('<tr class="diff-row diff-row-'+o.kind+'"><td class="diff-gutter diff-gutter-old">'+(o.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(o.newNo||"")+'</td><td class="diff-sign">'+(o.kind==="add"?"+":o.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+Zs(o.text)+'ch">'+e(o.text)+"</td></tr>");i.push("</tbody></table>")}return i.push("</div>"),i.join("")};return s=>s&&Rr(s).map(t).join("")})();function al(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Jv(e,t="EUR"){let s=Number(e)||0;return new Intl.NumberFormat(void 0,{style:"currency",currency:t,minimumFractionDigits:s%1?2:0,maximumFractionDigits:2}).format(s)}function Qv(e){return String(e??"").toUpperCase()}function Zv(e,t,s=0){return(e||[]).slice(s,s+t)}function xv(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function ey(e,t){if(!t)return e||[];let s=Array.isArray(t)?t:[t];return[...e||[]].sort((i,o)=>{for(let r of s){let u=r[0]==="-"?-1:1;r=r.replace(/^[+-]/,"");let p=r.split(".").reduce((h,m)=>h?.[m],i),d=r.split(".").reduce((h,m)=>h?.[m],o);if(typeof p=="string"&&(p=p.toLowerCase()),typeof d=="string"&&(d=d.toLowerCase()),p!==d)return(p==null?-1:d==null?1:p<d?-1:1)*u}return 0})}function Tr(e,t){if(!e)return"";let s=new Date(e);if(isNaN(s))return String(e);if(!t||t==="mediumDate")return s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let i={yyyy:s.getFullYear(),MMM:s.toLocaleDateString(void 0,{month:"short"}),MM:String(s.getMonth()+1).padStart(2,"0"),dd:String(s.getDate()).padStart(2,"0"),d:s.getDate(),HH:String(s.getHours()).padStart(2,"0"),mm:String(s.getMinutes()).padStart(2,"0"),ss:String(s.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,o=>i[o])}function ty(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function Pr(e){if(!e)return"";let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e)),s=t?new Date(+t[1],+t[2]-1,+t[3]):new Date(e);if(isNaN(s))return"";let i=s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),o=new Date;o.setHours(0,0,0,0);let r=Math.round((s-o)/864e5),u;if(r===0)u="today";else if(r===1)u="tomorrow";else if(r===-1)u="yesterday";else{let p=Math.abs(r),d=Math.round(p/30.44),h=p<14?[p,"day"]:p<60?[Math.round(p/7),"week"]:d<18?[d,"month"]:[Math.round(p/365.25),"year"],m=h[0]+" "+h[1]+(h[0]===1?"":"s");u=r>0?"in "+m:m+" ago"}return i+" \xB7 "+u}function Yn(e){if(e==null||e===""||isNaN(e))return"";e=Number(e);let t="\u202F";if(e<1e3)return+(e<10?e.toFixed(2):e<100?e.toFixed(1):Math.round(e))+t+"ms";let s=e/1e3;if(s<60)return+(s<10?s.toFixed(2):s.toFixed(1))+t+"s";let i=r=>String(r).padStart(2,"0"),o=Math.round(s);return o<3600?Math.floor(o/60)+"m "+i(o%60)+"s":Math.floor(o/3600)+"h "+i(Math.floor(o%3600/60))+"m"}function Ar(e){if(!e)return"";let t=new Date(e);if(isNaN(t))return"";let s={day:"numeric",month:"short"};return t.getFullYear()!==new Date().getFullYear()&&(s.year="numeric"),t.toLocaleDateString(void 0,s)}function Bc(e,t){return t?.split(".").reduce((s,i)=>s?.[i],e)}function ei(e=null,t=new Map){let s=ut({}),i=[],o=!1,r=new Proxy(s,{get(u,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(u,p)?Reflect.get(u,p):e?.[p]}});return Object.defineProperty(s,"parent",{value:e,configurable:!0}),Object.defineProperty(s,"viewState",{get:()=>r}),r.watch=(u,p,d=!1,h=!0)=>{let m=typeof u=="function"?()=>u(r):()=>Bc(r,u),y=dt(m,p,{deep:d,flush:"post"});return i.push(y),h&&Ke(()=>{o||p(m(),m())}),y},r.watchGroup=(u,p,d=!0)=>r.watch(()=>u.map(h=>Bc(r,h)),p,!0,d),r.on=(u,p)=>{if(u==="dispose")return i.push(p),()=>{};t.has(u)||t.set(u,new Set),t.get(u).add(p);let d=()=>t.get(u)?.delete(p);return i.push(d),d},r.emit=(u,...p)=>{for(let d of[...t.get(u)||[]])d({},...p)},r.dispose=()=>{o=!0,i.splice(0).reverse().forEach(u=>u())},Vn(r.dispose),r}function St(){let e=new Set,t=new Set,s=!1,i=(r,u=0)=>{if(s)return;let p=setTimeout(()=>{e.delete(p),r()},u);return e.add(p),p};i.cancel=r=>{clearTimeout(r),e.delete(r)};let o=(r,u)=>{if(s)return;let p=setInterval(r,u);return t.add(p),p};return o.cancel=r=>{clearInterval(r),t.delete(r)},Vn(()=>{s=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:i,interval:o}}function $t(){let e=new Set;return V Line truncated
`)+`
`,jc=e=>String(e??"").replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g," ");function Qc(e,t,s=[]){return["| "+e.map(jc).join(" | ")+" |","| "+e.map((o,r)=>s[r]?"---:":"---").join(" | ")+" |",...t.map(o=>"| "+e.map((r,u)=>jc(o[u])).join(" | ")+" |")].join(`
`)+`
`}var hy=Object.freeze({view:"table",query:"",sort:null,group:null,agg:"mean",sum:"mean",ranges:{},values:{},sums:{},numeric:[],chart:null,x:null,y:[]});function gy(e){let t=new URLSearchParams;e.view&&e.view!=="table"&&t.set("view",e.view),e.query&&t.set("q",e.query),e.sort?.column&&t.set("sort",e.sort.column+(e.sort.dir==="desc"?":desc":"")),e.group&&t.set("group",e.group),e.group&&e.agg&&e.agg!=="mean"&&t.set("agg",e.agg);for(let[s,[i,o]]of Object.entries(e.ranges||{}))(i!=null||o!=null)&&t.set("range."+s,(i??"")+"~"+(o??""));for(let[s,i]of Object.entries(e.values||{}))for(let o of i||[])t.append("in."+s,o);e.sum&&e.sum!=="mean"&&t.set("sum",e.sum);for(let[s,i]of Object.entries(e.sums||{}))i&&i!==(e.sum||"mean")&&t.set("sum."+s,i);return e.numeric?.length&&t.set("num",e.numeric.join("|")),e.chart&&t.set("chart",e.chart),e.x&&t.set("x",e.x),e.y?.length&&t.set("y",e.y.join("|")),t.toString()}function vy(e){var d,h;let t=new URLSearchParams(e||""),s={...hy,ranges:{},values:{},sums:{},numeric:[],y:[]},i=t.get("view");["table","chart","raw"].includes(i)&&(s.view=i),s.query=t.get("q")||"";let o=t.get("sort");if(o){let m=/^(.*?)(?::(asc|desc))?$/.exec(o);s.sort={column:m[1],dir:m[2]||"asc"}}s.group=t.get("group")||null;let r=t.get("agg");r&&ti[r]&&(s.agg=r);for(let[m,y]of t.entries())if(m.startsWith("range.")){let[v,b]=y.split("~").map(w=>w===""||w==null?null:Number(w));s.ranges[m.slice(6)]=[Number.isFinite(v)?v:null,Number.isFinite(b)?b:null]}else m.startsWith("in.")?((d=s.values)[h=m.slice(3)]||(d[h]=[])).push(y):m.startsWith("sum.")&&ti[y]&&(s.sums[m.slice(4)]=y);let u=t.get("sum");u&&ti[u]&&(s.sum=u),s.numeric=(t.get("num")||"").split("|").filter(Boolean);let p=t.get("chart");return["bar","line","scatter"].includes(p)&&(s.chart=p),s.x=t.get("x")||null,s.y=(t.get("y")||"").split("|").filter(Boolean),s}var pl=e=>"#"+e+":";function eo(e,t){if(!t||typeof e!="string"||!e.startsWith(pl(t)))return null;try{return vy(e.slice(pl(t).length))}catch{return null}}function Zc(e,t){let s=gy(t);return s?pl(e)+s.replace(/%3A/gi,":").replace(/%7C/gi,"|").replace(/%7E/gi,"~").replace(/%2C/gi,","):""}var hl=e=>/^#table(?:-\d+)?:/.test(e||"");var gl=function(e,t=e){let s=/\bXXXX-\d+\b/g;t.on("dark-mode",(L,S)=>{e.aceOption&&(e.aceOption.theme=S?"nord_dark":"chrome")});let i=St(),o=$t();e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent);let r={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},u=["license","txt"],p=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],d=["wav","mp3","ogg","wma","flac","aac","m4a"],h=["mp4","avi","webm","mov","mpg","mpeg","mkv","flv","wmv","3gp","3g2","m4v","f4v","f4p","f4a","f4b"];e.toggleSource=function(){e.showSource=!e.showSource},e.toggleAllowScripts=function(){e.allowScripts=!e.allowScripts};let m=(()=>{try{return window.localStorage?.getItem("wrapLines")}catch{return null}})();e.wrapLines=(m??(window.matchMedia?.("(max-width: 767px)").matches?"false":"true"))!=="false",e.toggleWrap=function(){e.wrapLines=!e.wrapLines;try{window.localStorage?.setItem("wrapLines",String(e.wrapLines))}catch{}e.codeEditor?.session.setUseWrapMode(e.wrapLines)};function y(){return window.document.querySelector(".reading-layout .markdown-body")}function v(){let L=y();L&&(L.querySelectorAll("mark.md-find").forEach(S=>{S.replaceWith(window.document.createTextNode(S.textContent))}),L.normalize())}e.runMdFind=function(){v(),e.mdFindTotal=0,e.mdFindIndex=0;let L=(e.mdFindQuery||"").trim(),S=y();if(!L||!S)return;let q=!!e.mdFindCase,Y=q?L:L.toLowerCase(),X=window.document.createTreeWalker(S,4),j=[];for(;X.nextNode();)(q?X.currentNode.nodeValue:X.currentNode.nodeValue.toLowerCase()).includes(Y)&&j.push(X.currentNode);let oe=0;for(let se of j){let fe=se.nodeValue,Ce=q?fe:fe.toLowerCase(),_e=window.document.createDocumentFragment(),et=0,ze;for(;(ze=Ce.indexOf(Y,et))!==-1;){_e.appendChild(window.document.createTextNode(fe.slice(et,ze)));let He=window.document.createElement("mark");He.className="md-find",He.textContent=fe.slice(ze,ze+L.length),_e.appendChild(He),oe++,et=ze+L.length}_e.appendChild(window.document.createTextNode(fe.slice(et))),se.parentNode.replaceChild(_e,se)}e.mdFindTotal=oe,oe&&e.stepMdFind(0)},e.stepMdFind=function(L){let S=y();if(!S||!e.mdFindTotal)return;let q=S.querySelectorAll("mark.md-find");e.mdFindIndex=(e.mdFindIndex+L+q.length)%q.length,q.forEach((Y,X)=>Y.classList.toggle("is-current",X===e.mdFindIndex)),q[e.mdFindIndex]?.scrollIntoView({block:"center",behavior:"smooth"})},e.toggleMdFind=function(L){if(e.mdFindOpen=L===void 0?!e.mdFindOpen:L,!e.mdFindOpen){v(),e.mdFindTotal=0;return}Ke(()=>window.document.querySelector(".md-find-input")?.focus())},e.findInFile=function(){let L=e.codeEditor;if(!L)return;L.focus(),L.execCommand("find");let S=()=>{let q=L.searchBox?.element;q&&(L.renderer.setScrollMargin(52,12,0,0),!q._dockObserver&&(q._dockObserver=new MutationObserver(()=>{L.renderer.setScrollMargin(q.style.display!=="none" Line truncated
`).forEach((S,q)=>{for(let[Y,X]of b){let j=Y.exec(S);if(j&&!/^(if|for|while|switch|return|catch)$/.test(j[1])){L.push({name:j[1],kind:X,line:q+1});break}}}),w={content:e.content,list:L.slice(0,300)},w.list},e.goToSymbol=function(L){e.symbolsOpen=!1;let S=e.codeEditor;S&&(S.scrollToLine(L-1,!0,!0,()=>{}),S.gotoLine(L,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+L),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 L=window.document.getElementById("goto-input");L&&(L.focus(),L.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let L=e.codeEditor;if(!L)return;let S=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),q=L.session.getLength();if(!S||+S[1]<1||+S[1]>q){e.gotoError="Enter a line from 1 to "+q;return}L.gotoLine(+S[1],S[2]?Math.max(0,+S[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",L.focus()},e.rootEntries=function(){return[...e.files||[]].sort((L,S)=>{let q=L.size==null,Y=S.size==null;return q!==Y?q?-1:1:L.name.localeCompare(S.name)})},e.formatSize=function(L){if(L==null)return"";if(L<1024)return L+" B";let S=L/1024,q=Y=>Y.toFixed(1).replace(/\.0$/,"");return S<1024?q(S)+" KB":S<1024*1024?q(S/1024)+" MB":q(S/1024/1024)+" GB"},e.fileSize=function(L){if(!L)return null;let S=L.replace(/^\/+/,""),q=(e.files||[]).find(Y=>(Y.path?Y.path+"/":"")+Y.name===S);return q&&q.size!=null?q.size:null},e.revealFolder=function(L){e.sidebarHidden=!1,e.sidebarCollapsed=!1,Ke(()=>{let S=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(L):L)+'"]');S&&(S.closest("li")?.classList.contains("open")||S.click(),S.scrollIntoView({block:"nearest"}),S.focus())})};let C={content:null,n:0},N=L=>{if(C.content===L)return C.n;let S=L;if(typeof S=="string")try{S=JSON.parse(S)}catch{S=null}let q=[],Y=j=>{Array.isArray(j)?q.push(j.join("")):typeof j=="string"&&q.push(j)};(S&&(S.cells||(S.worksheets||[]).flatMap(j=>j.cells||[]))||[]).forEach(j=>{Y(j?.source??j?.input),(j?.outputs||[]).forEach(oe=>{Y(oe?.text),oe?.data&&(Y(oe.data["text/plain"]),Y(oe.data["text/markdown"]),Y(oe.data["text/html"])),Y(oe?.traceback)})});let X=q.reduce((j,oe)=>j+(oe.match(s)||[]).length,0);return C={content:L,n:X},X};e.redactionCount=function(){return e.type==="IPython"?N(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(s)||[]).length},e.renderRedacted=to;let k=L=>L.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(L){let S=e.renderRedacted(L);if(!S||typeof window.DOMParser!="function")return S;let q=new window.DOMParser().parseFromString("<div>"+S+"</div>","text/html"),Y={};return q.querySelectorAll("h1, h2, h3").forEach(X=>{let j=X.id||k(X.textContent);Y[j]?j+="-"+ ++Y[j]:Y[j]=1,X.id=j}),q.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},D=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let L=Cr(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),S=L.length,q=null;if(L[0]?.level===1&&L.filter(Y=>Y.level===1).length===1){q=L[0],L=L.slice(1);let Y=Math.min(...L.map(X=>X.level));L=L.map(X=>({...X,depth:X.level-Y}))}return P={content:e.content,list:L,title:q,count:S},P};e.readmeToc=()=>D().list,e.tocTitle=()=>D().title,e.tocCount=()=>D().count,e.activeHeading=null,o(window,"scroll",()=>{let L=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let S=Sr(L.map(q=>q.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==S&&(e.activeHeading=S)},{capture:!0,passive:!0}),e.scrollToHeading=function(L){if(!L){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}Er(L),e.activeHeading=L};let F=()=>!e.preview&&eo(window.location.hash,"table")?.view||"table";e.csvView=F();let z={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(z.content!==e.content){let L=/\.tsv$/i.test(e.filePath||"")?" ":",";z={content:e.content,rows:xo(e.content,L)}}return z.rows},e.redactParts=Qt,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 L=e.content;if(e.type==="html"&&e.url)if(e.preview)L=e.sourceContent;else try{L=await(await window.fetch(e.url,{credentials:"same-origin"})).text()}catch{return}await window.navigato Line truncated
`).length:0,by=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function ep(e,t){let s=$t();e.redactParts=Qt,e.hangIndent=Zs,e.isRedactedName=o=>/^XXXX-\d+$/.test(String(o||"").trim()),e.tocOpen=!1,e.activeAnchor="";let i=()=>{let o=t();if(!o.length)return;let r=Sr(o,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==r&&(e.activeAnchor=r)};return s(window,"scroll",i,{capture:!0,passive:!0}),s(window,"resize",i,{passive:!0}),s(window.document,"click",o=>{e.tocOpen&&!o.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),s(window.document,"keydown",o=>{o.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=o=>{e.tocOpen=!1,Er(o)&&(e.activeAnchor=o)},i}var Lr=e=>(String(e||"").split(".").pop()||"").toLowerCase(),wy={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"},ky={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"},Cy=1024*1024;function no(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=wy[Lr(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>Cy?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var Sy=e=>["markdown","notebook","csv","svg"].includes(e),xc={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 Ey(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||Lr(e?.filename)||"none"}var Ny=e=>{let t=window.atob(e||""),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s};function tp(e){e.gistViews={};let t=/^#table-(\d+):/.exec(window.location.hash||"");if(t){let u=eo(window.location.hash,"table-"+t[1])?.view;(u==="chart"||u==="raw")&&(e.gistViews[+t[1]-1]=u)}e.gistKind=u=>no(e.details?.files?.[u]),e.gistHasRendered=u=>Sy(e.gistKind(u)),e.gistView=u=>!e.gistHasRendered(u)||e.gistViews[u]==="raw"?"raw":e.gistViews[u]==="chart"&&e.gistKind(u)==="csv"?"chart":"rendered",e.setGistView=(u,p)=>{e.gistViews={...e.gistViews,[u]:p}},e.gistSourceFile=u=>{let p=e.details?.files?.[u];return{...p,language:Ey(p,e.gistKind(u)),filename:"source.txt"}};let s=new Map;Vn(()=>{s.forEach(u=>window.URL.revokeObjectURL?.(u)),s.clear()});let i=(u,p)=>{if(!u||!window.URL?.createObjectURL)return null;let d=u.encoding==="base64",h=!p||d?ky[Lr(u.filename)]||(d?"application/octet-stream":"text/plain"):"text/plain",m=(u.filename||"")+"\0"+h+"\0"+(u.content||"").length;if(!s.has(m)){let y=d?Ny(u.content):u.content||"";s.set(m,window.URL.createObjectURL(new window.Blob([y],{type:h+(d?"":";charset=utf-8")})))}return s.get(m)};e.gistMediaUrl=u=>i(u,!1),e.gistRawUrl=u=>i(u,!0);let o=new WeakMap;e.gistCsvRows=u=>{if(!u)return[];let p=o.get(u);return(!p||p.content!==u.content||p.filename!==u.filename)&&(p={content:u.content,filename:u.filename,rows:xo(u.content||"",Lr(u.filename)==="tsv"?" ":",")},o.set(u,p)),p.rows},e.gistCopied=null,e.copyGistFile=async u=>{let p=e.details?.files?.[u];!p||p.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(p.content||""),e.gistCopied=u,window.setTimeout(()=>{e.gistCopied===u&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=u=>"file-"+(u+1),e.setFileOutline=(u,p)=>{let d=e.fileOutlines[u];d&&d.map(h=>h.id).join()===p.map(h=>h.id).join()||(e.fileOutlines={...e.fileOutlines,[u]:p})},e.gistToc=()=>(e.details?.files||[]).map((u,p)=>({id:e.gistFileId(p),index:p,parts:Qt(u.filename),kind:no(u),language:xc[no(u)]&&no(u)!=="csv"?xc[no(u)]:u.language||(no(u)==="csv"?"CSV":"Text"),lines:u.encoding==="base64"?null:yy(u.content),size:u.size,headings:by(u)&&e.gistView(p)==="rendered"?e.fileOutlines[p]||[]:[]}));let r=()=>e.gistToc().flatMap(u=>[u.id,...u.headings.map(p=>p.id)]);e.showGistToc=()=>{let u=e.gistToc();return e.tabState?.active==="files"&&(u.length>=2||(u[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let p=e.gistToc().find(d=>d.id===e.activeAnchor||d.headings.some(h=>h.id===e.activeAnchor));return p?p.index:0},ep(e,r)}var Ry=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function np(e){let t={diff:null,th Line truncated
`),p=i.date?e.fmt?.date(i.date):"",d=s[s.length-1];(!d||d.day!==p)&&s.push(d={day:p,commits:[]}),d.commits.push({...i,index:o+1,headline:r,detail:u.join(`
`).trim()})}),s},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let s=e.prFiles().find(i=>i.id===e.activeAnchor);return s?s.index:0},e.openTab=s=>{e.tabState={active:s},e.tocOpen=!1},e.showInDiff=s=>{s&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},Ke(()=>e.jumpToAnchor(s.id)))},e.jumpToFile=s=>{e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},e.jumpToAnchor(s.id)},ep(e,()=>e.tabState?.active==="files"?e.prFiles().map(s=>s.id):[])}function sp(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function vl(e,t,s){let i,o=!1,r="form-draft:"+s,u=()=>Object.fromEntries(t.map(v=>[v,e[v]])),p=()=>JSON.stringify(u()),d=v=>{for(let b of t)Object.prototype.hasOwnProperty.call(v,b)&&(e[b]=v[b]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},h=()=>{try{window.sessionStorage.removeItem(r)}catch{}},m=(v=!1)=>{if(i!==void 0){if(v&&document.querySelectorAll("input, select, textarea").forEach(b=>{b._field?.binding.state===e&&b._field.timer&&b._field.commit()}),e.unsavedChanges=p()!==i,e.draftSaved=!1,!e.unsavedChanges){h();return}try{window.sessionStorage.setItem(r,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:u()})),e.draftSaved=!0}catch{}}},y=()=>m(!0);return e.on("routeLeave",y),window.addEventListener("beforeunload",y),e.on("dispose",()=>window.removeEventListener("beforeunload",y)),{restore(){i=p();let v;try{v=JSON.parse(window.sessionStorage.getItem(r)||"null")}catch{}let b=v&&v.account===(e.user?.username||null)&&Date.now()-v.savedAt<30*6e4&&v.values;return b&&(d(v.values),e.draftRestored=!0),o||(o=!0,e.watch(()=>u(),()=>m(),!0)),e.unsavedChanges=p()!==i,!!b},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(v=>{v._field?.binding.state===e&&v._field.timer&&v._field.commit()}),JSON.parse(p())},accept(v){i=JSON.stringify(v),e.draftRestored=!1,m()},discard(){document.querySelectorAll("input, select, textarea").forEach(v=>{v._field?.binding.state!==e||!v._field.timer||(clearTimeout(v._field.timer),v._field.timer=null,v.value=v._field.binding.value??"")}),i!==void 0&&d(JSON.parse(i)),e.draftRestored=!1,m()},clear(){i=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,h()}}}function op(e,t){e.errorSource="central",e.logView={search:"",severity:"",sort:"recent"},e.selectedLog=null,e.logDetailTab="overview",e.logSeverity=y=>Number(y?.status||y?.httpStatus)>=500||["error","fatal"].includes(y?.severity)?"error":y?.severity==="warn"?"warn":"info",e.filteredLogGroups=()=>{let y=e.logView.search.trim().toLowerCase();return(e.logData?.groups||[]).filter(v=>(!e.logView.severity||e.logSeverity(v.sample)===e.logView.severity)&&(!y||Object.values(v.sample).join(" ").toLowerCase().includes(y))).slice().sort((v,b)=>e.logView.sort==="count"?b.count-v.count:Date.parse(b.last)-Date.parse(v.last))},e.shortLogId=y=>y?y.slice(0,8):"",e.isLogIdentifier=(y,v)=>typeof v=="string"&&v.length>16&&/(?:id|sha|release)$/i.test(y),e.compactLogValue=y=>String(y).slice(0,8)+"\u2026"+String(y).slice(-4),e.logCopyStatus="",e.copyLogValue=async y=>{try{await navigator.clipboard.writeText(String(y)),e.logCopyStatus="Full value copied"}catch{e.logCopyStatus="Copy unavailable. Expand the value to select it."}},e.logExplanation=y=>{let v=y.service||"The application",b={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 v+" "+b+(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((v,b)=>Date.parse(b.ts)-Date.parse(v.ts)),e.historyDetailFields=y=>{try{let v=JSON.parse(y?._detailJson||"{}");return v&&typeof v=="object"?Object.entries(v):[["value",v]]}catch{return[["record",y?._detailJson||""]]}},e.logFieldText=y=>typeof y=="object"?JSON.stringify(y):String(y??""),e.captureErrorScroll=y=>{let v=[];for(let b=y?.parentElement;b;b=b.parentElement)v.push({element:b,top:b.scrollTop,left:b.scrollLeft});return v},e.restoreErrorScroll=y=>y.forEach(({element:v,top:b,left:w})=>{v.isConnected&&(v.scrollTop=b,v.scrollLeft=w)});let s=null,i=null,o=null,r=[];e.selectLog=async(y,v)=>{if(i=v||document.activeElement, Line truncated
`+C.join(`
`)],{type:"text/csv"}),k=document.createElement("a");k.href=URL.createObjectURL(N),k.download=i.username+"-repositories.csv",k.click()},e.showStatusMessage=v=>{let b=v.statusMessage||"(no message)";window.prompt(`Status message for ${v.repoId} (${v.status}):`,b)},e.fetchGithubInfo=v=>{let b=window.open("","_blank");b&&b.document.write("<pre>Loading GitHub info for "+v.repoId+"...</pre>"),t.get("/api/admin/repos/"+v.repoId+"/github").then(w=>{b&&(b.document.open(),b.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>"),b.document.close())},w=>{let C=w&&w.data?JSON.stringify(w.data,null,2):String(w);b&&(b.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+C+"</pre>")})};function d(v){t.get("/api/admin/users/"+v+"/repos",{}).then(b=>{e.repositories=b.data},b=>{console.error(b)})}function h(v){t.get("/api/admin/users/"+v,{}).then(b=>{e.userInfo=b.data},b=>{console.error(b)})}h(i.username),d(i.username),e.banUser=()=>{confirm(`Ban user ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/ban`).then(()=>h(i.username),v=>console.error(v))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>h(i.username),v=>console.error(v))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>h(i.username),v=>console.error(v))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>h(i.username),v=>console.error(v))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(v=>{e.tokens=v.data||[]},v=>{v.status!==401&&v.status!==403&&console.error(v)})}m(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(v=>{e.tokenForm.plaintext=v.data.token,e.tokenForm.name="",m()},v=>console.error(v))},e.revokeToken=v=>{confirm(`Revoke token "${v.name}"?`)&&t.delete("/api/admin/tokens/"+v.id).then(()=>m(),b=>console.error(b))},e.removeCache=v=>{confirm("Remove cached files for "+v.repoId+"?")&&t.delete("/api/admin/repos/"+v.repoId).then(()=>d(i.username),b=>console.error(b))},e.removeRepository=v=>{confirm("Remove repository "+v.repoId+"?")&&t.delete("/api/repo/"+v.repoId+"/").then(()=>d(i.username),b=>console.error(b))},e.updateRepository=v=>{let b=ut({title:`Refreshing ${v.repoId}...`,date:new Date,body:`The repository ${v.repoId} is going to be refreshed.`});e.toasts.push(b),t.post(`/api/repo/${v.repoId}/refresh`).then(w=>{w.data.status=="ready"?b.title=`${v.repoId} is refreshed.`:b.title=`Refreshing of ${v.repoId}.`},w=>{b.title=`Error during the refresh of ${v.repoId}.`,b.body=w.body})},e.getGitHubRepositories=v=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(b=>{e.userInfo.repositories=b.data})};let y=null;e.watch("query",()=>{o.timeout.cancel(y),y=o.timeout(()=>{d(i.username)},500)},!0)},lp=function(e,t,s){let i=St(),o=$t();e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),e.conferences=[],e.total=-1,e.listLoaded=!1,e.listLoading=!0,e.totalPage=0,e.statusCounts=[];let r=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let C=document.querySelector('.admin-filter-toolbar input[type="search"]');C&&C.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let u=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let C=(e.statusCounts||[]).find(N=>N._id===w);return C?C.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let p="admin.conferences.filterPrefs",d={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},h=loadFilterPrefs(p)||{};e.query=Object.assign({},d,h,{page:1,search:""});let m=s.search();m.search&&(e.query.search=m.search);let y="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(y)||"[]"),e.savePreset=()=>{let 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!== Line truncated
`):typeof U.stack=="string"?U.stack:null;for(var G=[U.cause,U.err].filter(Boolean),L=0;!q&&L<G.length;L++)for(var S=G[L];!q&&S&&typeof S=="object";)typeof S.stack=="string"&&(q=S.stack),S=S.cause;V._stack=q}else V.displayMessage=V.message,V._status=null,V._url=null,V._stack=null;return V._bucket=v(U,V.level),V._detailJson=w(V,U),V}function w(V,U){let G=[],L=(X,j)=>{j==null||j===""||G.push([X,j])};for(let X of["service","event","severity","requestId","jobId"])L(X,U&&U[X]);L("name",U&&U.name),L("code",V.displayMessage||U&&U.message),V._bucket&&L("kind",V._bucket),L("httpStatus",U&&U.httpStatus),U&&U.status&&!U.httpStatus&&L("status",U.status),L("module",V.module);let S=U&&U.detail;if(typeof S=="string"){let X=S.trim();if(X[0]==="{"||X[0]==="[")try{S=JSON.parse(S)}catch{}}if(L("detail",S),L("repoId",U&&U.repoId),L("filePath",U&&U.filePath),L("upstreamStatus",U&&U.upstreamStatus),L("upstreamBody",U&&U.upstreamBody),L("url",V._url),L("err",U&&U.err),L("cause",U&&!U.err&&U.cause),L("ts",V.ts),!G.length)return JSON.stringify(V,null,2);let q=G.reduce((X,j)=>Math.max(X,j[0].length),0),Y=["{"];return G.forEach(([X,j],oe)=>{let fe=` ${`"${X}":`.padEnd(q+3," ")} `,Ce=oe<G.length-1?",":"",_e;if(j&&typeof j=="object"){let et=" ".repeat(fe.length);_e=JSON.stringify(j,null,2).split(`
`).map((ze,He)=>He===0?ze:et+ze).join(`
`)}else typeof j=="number"||typeof j=="boolean"?_e=String(j):_e=JSON.stringify(j);Y.push(`${fe}${_e}${Ce}`)}),Y.push("}"),Y.join(`
`)}function C(V){let U=[],G="",L=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,S=0,q;for(;q=L.exec(V);)G+=V.slice(S,q.index),S=L.lastIndex,U.push({key:q[1],op:q[2]||"=",val:q[3]});return G+=V.slice(S),{filters:U,free:G.trim().toLowerCase()}}function N(V,U){for(let G of U.filters){let L=(q,Y,X)=>{let j=parseFloat(q),oe=parseFloat(Y);return X==="="?String(q)===String(Y):X==="!="?String(q)!==String(Y):X===">="?j>=oe:X==="<="?j<=oe:X===">"?j>oe:X==="<"?j<oe:!0},S;if(G.key==="code")S=V.displayMessage;else if(G.key==="module")S=V.module;else if(G.key==="status")S=V._status;else if(G.key==="url")S=V._url;else if(G.key==="repo")S=V._repoId;else if(G.key==="level")S=V.level;else continue;if(S==null||!L(S,G.val,G.op))return!1}return!(U.free&&((V.displayMessage||"")+" "+(V.module||"")+" "+(V._url||"")+" "+JSON.stringify(V.raw||[])).toLowerCase().indexOf(U.free)===-1)}function k(){let V=C(e.query.search||"");e.parsedFilterCount=V.filters.length;let U=e.query.bucket,G=e.entries.filter(X=>U&&X._bucket!==U?!1:N(X,V)),L=e.query.group;if(L){let X=se=>JSON.stringify(L==="module"?[se.module,se._bucket]:[se.raw?.[0]?.service||"unknown",se.module,se.displayMessage||se.message||"_",se._bucket,se._status]),j=new Map;for(let se of G){let fe=X(se);if(j.has(fe)){let Ce=j.get(fe);Ce.count++,Ce._related.push(se),new Date(se.ts)>new Date(Ce.ts)&&(Ce.ts=se.ts,Ce._url=se._url,Ce._status=se._status),new Date(se.ts)<new Date(Ce._firstSeen)&&(Ce._firstSeen=se.ts)}else{let Ce=Object.assign({},se);Ce._key=`${L}:${fe}`,Ce._related=[se],Ce._firstSeen=se.ts,Ce._lastHourCount=0,Ce.count=1,j.set(fe,Ce)}}let oe=Date.now()-3600*1e3;for(let se of j.values())se._lastHourCount=se._related.filter(fe=>new Date(fe.ts).getTime()>=oe).length;G=Array.from(j.values())}else G=G.map((X,j)=>(X._key="row:"+j+":"+X.ts,X._related=[X],X._firstSeen=X.ts,X._lastHourCount=0,X.count=1,X));let S=X=>({error:0,warn:1,info:2})[X._bucket]??1;e.query.sort==="count"?G.sort((X,j)=>S(X)-S(j)||j.count-X.count||new Date(j.ts)-new Date(X.ts)):G.sort((X,j)=>S(X)-S(j)||new Date(j.ts)-new Date(X.ts)),e.visible=G;let q=!!(e.query.bucket||(e.query.search||"").trim()),Y=!q&&(e.stats?.severity?.error||0)>0&&!G.some(X=>X._bucket==="error")&&e.entries.length<1500;(q&&!G.length||Y)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,P(!0))}function P(V){if(V&&e.redisLoading)return;let U=++o;e.redisLoading=!0;let G=V?e.redisNextOffset||e.entries.length:0,L=V?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:G,limit:L}}).then(S=>{if(p||U!==o)return;e.redisLoading=!1;let q=(S.data.entries||[]).map(b);e.entries=V?e.entries.concat(q):q,e.redisRedacted=(V&&e.redisRedacted||0)+(S.data.redactedEntries||0),e.redisNextOffset=S.data.nextOffset??G+(S.data.entries||[]).length,e.available=!!S.data.available,e.redisCollecting=S.data.redisCollecting!==!1,e.cap=S.data.max||e.cap,e.total=S.data.total||e.entries.length,e._autoLoading=!1,k()},()=>{p||U!==o||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>P(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function D(V=!1){if(V&&u)return;let U=++r;u=!0,t.get("/api/admin/errors/stats").then(G=>{if(p||U!==r)return;u=!1;let L=G.data||{};e.redisStatsState=L.available===!1?"unavailable":"ready";let S=L.prev24h?Math.round((L.last24h-L.prev24h)/L.prev24h*100):0;e.stats={last24h:L.last24h||0,prev24h:L.prev24h||0,delta:S,severity:L.severity||{error:0,warn:0,info:0},unique:L.unique||{error:0,warn:0,info:0},buckets:L.buckets||[],dropped:L.dropped||0},k()},()=>{!p&&U===r&&(u=!1,e.redisStatsState="unavailable")})}function F(V=!1){(!V||!e.redisLoading)&&P(),D(V)}e.barPx=(V,U)=>{let G=e.stats.buckets||[],L=0,S=0;for(let j of G)L=Math.max(L,(j.error||0)+(j.warn||0)),S=Math.max(S,j.info||0);let q=V[U]||0;if(!q)return 0;if(U==="info")return S?Math.max(2,Math.round(q/S*(L?16:60))):0;let Y=(V.error||0)+(V.warn||0),X=Math.round(Y/L*44);return Math.max(4,Math.round(q/Y*X))},e.bucketTitle=V=>`${new Date(V.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${V.error||0} err \xB7 ${V.warn||0} warn \xB7 ${V.info||0} info`,e.toggle=async(V,U)=>{h=U||document.activeElement,m=e.captureErrorScroll(h),e.historySelected=V,e.historyView="overview",e.expanded={[V._key]:!0},await Ke(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=V=>{if(e.historyView="timeline",e.traceSelection)return;let U=["requestId","jobId"].find(G=>e.logTraceId(e.historySelected,G));U&&e.lookupTrace(U,e.logTraceId(e.historySelected,U),V,e.historySelected)},e.closeHistory=async()=>{let V=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await Ke(),(h?.isConnected?h:[...document.querySelectorAll("[data-history-key]")].find(G=>G.dataset.historyKey===V))?.focus({preventScroll:!0}),e.restoreError Line truncated
`)],{type:"text/csv;charset=utf-8"}),L=URL.createObjectURL(G),S=document.createElement("a");S.href=L,S.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(L)};function z(V){e.copyHint=`${V} copied`,d.timeout(()=>{e.copyHint=""},1500)}e.copyJson=V=>{navigator.clipboard.writeText(V._rawJson).then(()=>z("JSON"))},e.copyCurl=V=>{if(!V._url)return;let G=`curl -X ${V._method||"GET"} '${window.location.origin}${V._url}'`;navigator.clipboard.writeText(G).then(()=>z("curl"))},F();let K=i(()=>{e.query.autoRefresh&&F(!0)},15e3);e.on("dispose",()=>{p=!0,o++,r++,i.cancel(K)}),e.watch("query.search",k),e.watch("query.bucket",k),e.watch("query.sort",k),e.watch("query.group",k)},cp=function(e,t,s,i){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null){s.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.cacheReport=null,e.cacheError=null,e.cacheMinutes=60,e.cacheTraffic="all",e.ovView=["performance","cache"].includes((window.location.hash||"").slice(1))?window.location.hash.slice(1):"summary",e.setOvView=function(k){e.ovView=k;try{window.history.replaceState(null,"",k==="summary"?window.location.pathname:"#"+k)}catch{}};var o=!1;e.loadCache=function(){if(!o){o=!0;var k=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:k}}).then(function(P){k===e.cacheMinutes&&(e.cacheReport=P.data,e.cacheError=P.data.available?null:P.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){o=!1,k!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(k){return e.cacheTraffic==="all"||k.traffic===e.cacheTraffic})},e.cacheRate=function(k,P){var D=e.cacheRows(),F=function(V){return D.filter(function(U){return U.name===V}).reduce(function(U,G){return U+G[P]},0)},z=F(k+"_hit"),K=F(k+"_miss");return z+K?(100*z/(z+K)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(k){return k.replaceAll("_"," ")},e.cacheP95=function(k){var P=0,D=e.cacheReport?.latencyBucketsMs||[];if(!k.count)return"No samples";if(!k.ms)return"Not timed";for(var F=0;F<=D.length;F++)if(P+=k["b"+F]||0,P>=Math.ceil(k.count*.95))return F<D.length?"\u2264 "+Yn(D[F]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let k=e.data&&e.data.system||{},P=[["Memory",k.memPercent],["Disk",k.diskPercent]].filter(([,F])=>F>90);return P.length?P.map(([F,z])=>F+" is at "+z+"%").join(" and ")+". New anonymizations may fail until "+(P.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(k){return k==null?"":Yn(k)},e.latencyBound=function(k,P){return k.count?k[P]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(k[P]):"No samples"},e.firstByteBound=function(k){return e.latencyBound({count:k.firstByteCount,p95UpperMs:k.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(k){return Math.max(0,Math.round((Date.now()-k.sampledAt)/1e3))},e.peakRss=function(k){return(e.performance.runtimeSeries||[]).filter(function(P){return P.instance===k.instance}).reduce(function(P,D){return Math.max(P,D.rss)},k.memory.rss)},e.performanceWarning=function(k){return e.sampleAge(k)>45||k.droppedBatches||k.droppedMetrics||k.sockets?.closeWait>0||k.eventLoop?.p95Ms>100||k.memoryLimitBytes&&k.memory.rss>k.memoryLimitBytes*.8};var r=!1;e.loadPerformance=function(){var k=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==k&&(e.performance=null),!r&&(r=!0,t.get("/api/admin/performance",{params:{minutes:k}}).then(function(P){k===e.performanceMinutes&&(e.performance=P.data,e.performanceError=P.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){k===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){r=!1,k!==e.performanceMinutes&&e.loadPerformance()}))};function u(k){if(k==null)return"\u2014";for(var P=["B","KB","MB","GB","TB"],D=0,F=k;F>=1024&&D<P.length-1;)F/=1024,D++;return F.toFixed(D>0?1:0).replace(/\.0$/,"")+" "+P[D]}e.humanBytes=u;function p(k){if(!k)return"\u2014";var P=Math.floor(k/86400),D=Math.floor(k%86400/3600),F=Math.floor(k%3600/60);return P>0?P+"d "+(D<10?"0":"")+D+"h":D>0?D+"h "+(F<10?"0":"")+F+"m":F+"m"}e.humanDuration=p;function d(k){return k==null?"\u2014":k>=1e6?(k/1e6).toFixed(1)+"M":k>=1e3?(k/1e3).toFixed(1)+"K":String(k)}e.humanNum=d,e.queueTotal=function(k){return k?(k.waiting||0)+(k.active||0)+(k.delayed||0)+(k.failed||0):0},e.statusCount=function(k){if(!e.data||!e.data.repos)return 0;for(var P=e.data.repos.statusBreakdown||[],D=0;D<P.length;D++)if(P[D]._id===k)return P[D].count;return 0},e.barPct=function(k){var P=e.data&&e.data.repos?e.data.repos.total:0;if(!P)return 0;var D=[k];k==="expired"&&D.push("expiring"),k==="removed"&& 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=>(qr.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,k)=>N+(k[C]||0),0),e.familyMoney=(w,C,N)=>{if(!e.revenueOn())return"\u2014";let k=e.familyPlans(w);return k.some(P=>P[N]===!1)?"Incomplete":e.moneyText(k.reduce((P,D)=>r(P,D[C]),{}))},e.planTotals=()=>{let w=C=>(e.summary?.plans||[]).reduce((N,k)=>N+(k[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?Yn(w*1e3):"\u2014";let u=0;e.loadSummary=()=>{let w=++u;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(C=>{if(w!==u)return;e.summaryLoading=!1;let N=C.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},C=>{w===u&&(e.summaryLoading=!1,e.summaryError=C&&C.data&&C.data.error||"Could not load billing figures.")})},e.setPeriod=w=>{if(e.period!==w){e.period=w;try{localStorage.setItem("admin.billing.period",w)}catch{}e.loadSummary()}},e.grants=[],e.total=-1,e.totalPage=0,e.stateCounts={},e.statuses=[],e.grantsError=null,e.filtersOpen=!1,e.query={page:1,limit:25,search:"",plan:"",status:"",state:"",period:"",sort:"purchasedAt",direction:"desc"};let p=s.search();p.search&&(e.query.search=p.search),e.stateView=()=>e.query.state||"all",e.setStateView=w=>{e.query.state=w==="all"?"":w,e.query.page=1},e.stateCount=w=>w==="all"?["active","expired","revoked"].reduce((C,N)=>C+(e.stateCounts[N]||0),0):e.stateCounts[w]||0,e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let d=()=>{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=ws({[w.amount.currency]:w.amount.value})[0]||"\u2014";if(!w.amount.interval)return C;let N=w.amount.intervalCount>1?w.amount.intervalCount+" "+w.amount.interval+"s":w.amount.interval;return C+" / "+N},e.amountTitle=w=>w.amount?"Stripe list price"+(w.pack?" of the whole pack":""):{stripe_not_configured:"Revenue unavailable: Stripe is not configured on this server.",unresolved:"Revenue unavailable: this Stripe price could not be looked up.",unrecorded:"Revenue unavailable: no sale price was recorded for this subscription."}[w.amountMissing]||"Revenue unavailable.",e.endText=w=>{if(w.never)return"Never ends";if(!w.until)return"\u2014";let C=Tr(w.until);return w.state!=="active"?(new Date(w.until)<new Date?"Ended ":"Ends ")+C:w.subscription?(w.cancelAtPeriodEnd?"Ends ":"Renews ")+C:"Until "+C},e.packNote=w=>{let C=(w.parts||[]).find(N=>N.planId==="author_pass");return!w.pack||!C||!C.until?"":(new Date(C.until)<new Date?"Updates ended ":"Updates until ")+Tr(C.until)};let h={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=w=>(w.parts||[]).map(C=>h[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
`)},Rl=class{constructor(t){lt(this,"gen");lt(this,"threads",[]);lt(this,"match",!1);lt(this,"runs",[]);lt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Ap=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((s,i)=>s!==t.ids[i])?!1:e.runs.every(s=>t.runs.some(i=>i.neg===s.neg&&Ap(i.state,s.state))),Cp=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),Cs,ts,Tl,Pl,ai=class{constructor(t,s,i){je(this,ts);lt(this,"dots");lt(this,"dotStart");je(this,Cs);this.dots=t,this.dotStart=s,Ye(this,Cs,i)}state(){return new Rl(++ue(this,Cs).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(Nl.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!Ge(this,ts,Tl).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,o);return;case"neg":if(!Ge(this,ts,Tl).call(this,t,s))return;let r=this.state();return this.add(r,s.sub,i,!1),this.done(r),this.addRun(t,{t:"run",neg:s,state:r},i,o);case"star":if(this.restricted(i,o))return;Ge(this,ts,Pl).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:Ge(this,ts,Pl).call(this,t,s)}}addRun(t,s,i,o){for(let r of t.runs)if(r.neg===s.neg&&Ap(r.state,s.state))return;t.runs.push(s),s.state.match||this.add(t,s.neg.next,i,o)}step(t,s,i,o){let r=this.state();for(let u of t.threads)switch(u.t){case"lit":Il(u,s)&&this.add(r,u.next,i+1,o);break;case"any":this.restricted(i,o)||this.add(r,u.next,i+1,o);break;case"class":!this.restricted(i,o)&&u.re.test(s)&&this.add(r,u.next,i+1,o);break;case"star":this.restricted(i,o)||this.add(r,u,i+1,o)}if(!this.restricted(i,o))for(let u of t.runs){if(u.state.dead){this.addRun(r,u,i+1,o);continue}let p=this.step(u.state,s,i,!1);this.addRun(r,{t:"run",neg:u.neg,state:p},i+1,o)}return this.done(r)}};Cs=new WeakMap,ts=new WeakSet,Tl=function(t,s){let{seen:i}=ue(this,Cs);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},Pl=function(t,s){let{has:i}=ue(this,Cs);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var Dp=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${Dp(i.state)})`);return`${t}|${s.sort().join("|")}`},lb=1<<18,oo,io,Jn,Ss,Qn,Zn,xn,mn,Dl,_r,Ip,Al=class{constructor(t,s){je(this,mn);je(this,oo);je(this,io,new Map);je(this,Jn,0);je(this,Ss);je(this,Qn);je(this,Zn);je(this,xn);Ye(this,oo,t),Ye(this,Zn,new ai(!1,!1,s)),Ye(this,xn,new ai(!1,!0,s))}start(t){if(t){if(ue(this,Qn))return ue(this,Qn);let i=ue(this,xn).state();return ue(this,xn).add(i,ue(this,oo),0,!0),Ye(this,Qn,Ge(this,mn,Dl).call(this,ue(this,xn).done(i)))}if(ue(this,Ss))return ue(this,Ss);let s=ue(this,Zn).state();return ue(this,Zn).add(s,ue(this,oo),0,!0),Ye(this,Ss,Ge(this,mn,_r).call(this,ue(this,Zn).done(s)))}next(t,s){let i=s.charCodeAt(0),o=i<128?void 0:t.next.get(s);if(o)return o;let r=t===ue(this,Qn)?Ge(this,mn,_r).call(this,ue(this,xn).step(t.state,s,0,!0)):Ge(this,mn,_r).call(this,ue(this,Zn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),Ye(this,Jn,ue(this,Jn)+128)),t.ascii[i]=r):t.next.set(s,r),ld(this,Jn)._++,r}};oo=new WeakMap,io=new WeakMap,Jn=new WeakMap,Ss=new WeakMap,Qn=new WeakMap,Zn=new WeakMap,xn=new WeakMap,mn=new WeakSet,Dl=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},_r=function(t){let s=Dp(t),i=ue(this,io).get(s);if(i)return i;ue(this,Jn)>lb&&Ge(this,mn,Ip).call(this);let o=Ge(this,mn,Dl).call(this,t);return ue(this,io).set(s,o),Ye(this,Jn,ue(this,Jn)+(s.length+1)),o},Ip=function(){ue(this,io).clear(),Ye(this,Jn,0),Ye(this,Ss,void 0),Ye(this,Qn,void 0)};var db=e=>{let t=[];for(let s=e;s.t!=="match";s=s.next){if(s.t==="split"||s.t==="neg")return;t.push(s)}return t},ub=(e,t,s,i)=>{let o=0,r=s,u=-1,p=0;for(;r<i;){let d=e[o];if(d?.t==="star"){u=o++,p=r;continue}let h=t[r];if(d&&(d.t==="any"||d.t==="lit"&&Il(d,h)||d.t==="class"&&d.re.test(h))){o++,r++;continue}if(u===-1)return!1;o=u+1,r=++p}for(;e[o]?.t==="star";)o++;return o===e.length},Op=e=>{let t=0,s=0;for(let i of e){let[o,r]=cb(i);t+=o,s+=r}return[t,s]},cb=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(Op),s=Math.min(...t.map(r=>r[0])),i=Math.max(...t.map(r=>r[1])),o=i===0?0:1/0;return e.type==="@"?[s,i]:e.type==="?"?[0,i]:e.type==="*"?[0,o]:[s,o]},Sp=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!Il(e[i],t[s+i]))return!1;return!0},pb=/[/\ud800-\udfff]/,fb=/[\ud800-\udfff]/,Br=e=>fb.test(e)?[...e]:e,Ep=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},es,ro,Es,zr,Ns,di,Hr,Rs,ui,ci,pi,zn,Tn,ao,lo,fi,jr,fn,Ts,ri,li=class{constructor(t,s={}){je(this,Ts);lt(this,"pattern");lt(this,"options");je(this,es);je(this,ro);je(this,Es);je(this,zr);je(this,Ns);je(this,di,!1);je(this,Hr);je(this,Rs);je(this,ui,!1);je(this,ci,0);je(this,pi,1/0);je(this,zn,[]);je(this,Tn,[]);je(this,ao);je(this,lo);je(this,fi,!1);je(this,jr);je(this,fn);if(t.includes Line truncated
`).forEach((s,i)=>{let{term:o}=Hl(s.trim());if(!o)return;let r=[];for(let u=0;u<o.length;u++){if(o[u]==="\\"){u++;continue}Xp.has(o[u])&&!r.includes(o[u])&&r.push(o[u])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function Qp(e,t){let s=String(e||"").split(`
`),i=s[t];if(i===void 0)return e;let{term:o}=Hl(i.trim());if(!o)return e;let r="";for(let p=0;p<o.length;p++){if(o[p]==="\\"){r+=o.slice(p,p+2),p++;continue}r+=Xp.has(o[p])||o[p]==="."?"\\"+o[p]:o[p]}let u=i.indexOf(o);return s[t]=i.slice(0,u)+r+i.slice(u+o.length),s.join(`
`)}var as={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()})}d();let h=null;e.saveDefault=m=>{if(m&&m.preventDefault&&m.preventDefault(),e.saving)return;let y=p.checkpoint(),v={terms:e.terms.split(`
`).map(b=>b.trim()).filter(b=>b.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",v).then(()=>{p.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",h&&i.cancel(h),h=i(()=>{e.message=null},2500)},b=>{e.saving=!1;let w=b&&b.data&&b.data.error,C="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+w),s("ERRORS.unknown_error")]).then(([N,k])=>{e.error=w&&N!==k?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."}))}},sf=function(e,t,s){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(i=>{s.url("/dashboard")},i=>{e.error=i.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},of=function(e,t,s,i,o){e.user&&!e.user.status&&s.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&s.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(p){e.feature=p},e.featureHref=function(p){return p.needsUser&&!e.user?"/signin":p.href},e.featureTarget=function(p){return p.needsUser&&!e.user?"_self":p.target||void 0},e.featureKeydown=function(p,d){let h={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[p.key];if(h===void 0)return;p.preventDefault();let m=e.features.length,y=h==="first"?0:h==="last"?m-1:(d+h+m)%m;e.feature=e.features[y].key,o(()=>{let v=i.document.getElementById("feature-tab-"+e.feature);v&&v.focus()})},e.demoText=`# DeepLearnUtils
Developed by Jane Smith at MIT CSAIL.
See Smith et al., "Attention That Works," 2026.
Contact: jane.smith@mit.edu`,e.demoTerms="Jane Smith, Smith, MIT CSAIL, jane.smith@mit.edu",e.demoParts=function(){let p=(e.demoTerms||"").split(/[,\n]/).map(g=>g.trim()).filter(Boolean).sort((g,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
Contact: jane.smith@mit.edu`,e.demoTerms="Jane Smith, Smith, MIT CSAIL, jane.smith@mit.edu",e.demoParts=function(){let p=(e.demoTerms||"").split(/[,\n]/).map(v=>v.trim()).filter(Boolean).sort((v,b)=>b.length-v.length),d=v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let h=new RegExp("("+p.map(d).join("|")+")","gi"),m={},y=0;return(e.demoText||"").split(h).filter(v=>v!=="").map(v=>{let b=p.find(w=>w.toLowerCase()===v.toLowerCase());return b?(m[b.toLowerCase()]||(m[b.toLowerCase()]=++y),{text:String(m[b.toLowerCase()]),redacted:!0,original:v}):{text:v}})},e.demoCount=()=>e.demoParts().filter(p=>p.redacted).length,e.cards=[{key:"repositories",total:0,label:"repositories anonymized"},{key:"users",total:0,label:"researchers"},{key:"pageViews",total:0,label:"page views"},{key:"pullRequests",total:0,label:"pull requests"}],e.statsEmpty=()=>!!e.stat&&e.cards.every(p=>!p.total);function r(){t.get("/api/stat/").then(p=>{e.stat=p.data,e.cards[0].total=p.data.nbRepositories,e.cards[1].total=p.data.nbUsers,e.cards[2].total=p.data.nbPageViews,e.cards[3].total=p.data.nbPullRequests}).catch(()=>{})}r();function u(p){let d={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return d;let h=new Array(p.length-1);for(let C=1;C<p.length;C++)h[C-1]=p[C]-p[C-1];let m=h.length,y=Math.max.apply(null,h),v=Math.min.apply(null,h),b=Math.min(0,v),w=y-b||1;d.viewW=m*2,d.bars=new Array(m);for(let C=0;C<m;C++){let N=(h[C]-b)/w,k=Math.max(1.5,N*34);d.bars[C]={x:(C*2+.25).toFixed(2),y:(36-k).toFixed(2),w:"1.5",h:k.toFixed(2)}}if(d.deltaToday=h[m-1],m>=2){let C=h[m-2];C&&(d.pctChange=(d.deltaToday-C)/C*100)}return d.pctAbs=Math.round(Math.abs(d.pctChange)),d.isUp=d.pctChange>=0,d}e.history={repositories:u([]),users:u([]),pageViews:u([]),pullRequests:u([])},t.get("/api/stat/history?days=60").then(p=>{let d=p.data||[];e.history={repositories:u(d.map(h=>h.nbRepositories||0)),users:u(d.map(h=>h.nbUsers||0)),pageViews:u(d.map(h=>h.nbPageViews||0)),pullRequests:u(d.map(h=>h.nbPullRequests||0))}}).catch(()=>{})},rf=function(e,t,s,i,o,r){let u=St();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),u.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,Ke(()=>document.querySelector(".dashboard-quota > summary")?.focus())},$t()(document,"click",S=>{e.quotaExpanded&&!S.target.closest?.(".dashboard-quota")&&(e.quotaExpanded=!1)}),e.filtersExpanded=!1,e.projectView="all",e.selectedProject=null,e.projectName="",e.nameSaving=!1,e.nameError="",e.nameMessage="",e.needsAttention=S=>S.status==="error"||S._broken||d(S.status)==="progress"&&S._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=S=>{e.projectView=S,S==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=S=>{let q=rl(S?.anonymizeDate||S?.lastView)||"";return/ ago$/.test(q)?"No activity for "+q.replace(/ ago$/,""):"No activity since "+q.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=S=>"project-details-"+encodeURIComponent(S._type+":"+(S._id||S._source||"unknown")),e.showProjectDetails=async S=>{e.selectedProject=S,e.projectName=S.projectName||"",e.nameError="",e.nameMessage="",await Ke();let q=document.getElementById(e.projectDetailsId(S));q?.focus(),q?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=S=>{e.selectedProject=null,Ke(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(S._type+":"+S._id)}"]`)?.focus())},e.saveProjectName=async S=>{if(e.nameSaving||!S._id)return;let q=e.projectName.trim();if(q.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let Y=await t.post("/api/user/project-name",{type:S._type,id:S._id,name:q});S.projectName=Y.data.name,S._label=S.projectName||S._fallbackLabel,e.selectedProject===S&&(e.nameMessage=q?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await F(),e.selectedProject===S&&(e.selectedProject=e.items.find(X=>X._type===S._type&&X._id===S._id)||null))}catch{e.selectedProject===S&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async S=>{if(!S._viewUrl||e.copyingId)return;let q=new URL(S._viewUrl,o.location.origin).href;e.copyingId=S._type+":"+S._id;try{await jl(q),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:q})}finally{e.copyingId=null}},e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"Preparing",error:"Error",expired:"Expiring / expired",removed:"Removing / removed"};let p=["queue","download","downloaded","preparing","anonymizing"];function Line truncated
`)),e.options=Object.assign({},e.options,_.options),e.options.expirationDate=_.options&&_.options.expirationDate?new Date(_.options.expirationDate):V(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),E&&E()})}function ie(E,M,_){e.anonymize&&e.anonymize[E]&&e.anonymize[E].setValidity(M,_)}function ve(E){try{let M=parseGithubUrl(E);if(M&&M.owner&&M.repo)return M.owner+"/"+M.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!i.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||ve(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let E=v();try{let M=await t.get("/github/connections");if(e.githubConnections=M.data,!M.data.appEnabled)return;let _=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":M.data.csrf}});if(!y(E))return;e.error=null,_.data.fullName&&(e._originalFullName=_.data.fullName,e.source.fullName=_.data.fullName,e.sourceUrl="https://github.com/"+_.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(E)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,b(E)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.details=null,e.source.commit="",e.source.branch="",e.readme="",e.branches=[],xt.cancel(),An.cancel(),Dn.cancel(),e.previewStatus="idle",e.anonymize_readme="",td();try{await O()}catch{}}};function Ee(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:ve(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function De(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function I(){let E=new URLSearchParams(window.location.search).get("billingDraft");if(E){N.restore();try{let _=(await t.get("/api/billing/draft/"+encodeURIComponent(E))).data;if(_.path!==o.path())throw new Error("Wrong task");k=_.values.conference||null;for(let J of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(_.values,J)&&(e[J]=_.values[J]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=_.id,D=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await De(),o.replace?.(o.path()),!0}catch{e.billingError="The checkout draft could not be restored. Retry by reloading this page; any local draft is still available."}}let M;try{M=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!M||M.path!==o.path()||Date.now()-M.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await De(),!0):!1;N.restore();for(let _ of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(M.draft,_)&&(e[_]=M.draft[_]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await De(),sessionStorage.removeItem("github-access-draft"),!0}ge(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&u(I,0),i.repoId&&i.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=i.repoId,t.get("/api/repo/"+e.repoId).then(async E=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(E.data.status),e.githubConnection=E.data.connection||"oauth",e.sourceUrl="https://github.com/"+E.data.source.fullName,e._originalFullName=E.data.source.fullName,e.terms=E.data.options.terms.filter(M=>M).join(`
`),e.source=E.data.source,e.role=E.data.role||"owner",e._existingNever=E.data.options.expirationMode==="never",e._savedExpirationDate=E.data.options.expirationDate?new Date(E.data.options.expirationDate):null,e.coauthors=E.data.coauthors||[],e._originalBranch=E.data.source.branch,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,e.repositoryID=E.data.source.repositoryID,e._originalRepositoryID=E.data.source.repositoryID,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await I()&&(await Promise.all([O(),H()]),Os())},()=>{o.url("/404")})),i.pullRequestId&&i.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=i.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async E=>{if(e.githubConnection=E.data.connection||"oauth",e.sourceUrl="https://github.com/"+E.data.source.repositoryFullName+"/pull/"+E.data.source.pullRequestId,e.terms=E.data.options.terms.filter(M=>M).join(`
`),e.source=E.data.source,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await I())try{await od()}catch{}},()=>{o.url("/404")})),i.gistId&&i.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=i.gistId,t.get("/api/gist/"+e.gistId).then(async E=>{e.sourceUrl="https://gist.github.com/"+E.data.source.gistId,e.terms=E.data.options.terms.filter(M=>M).join(`
`),e.source=E.data.source,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await I()&&await id()},()=>{o.url("/404")}))}),t.get("/github/connections").then(E=>{e.githubConnections=E.data,!i.repoId&&!i.pullRequestId&&!i.gistId&&e.githubConnection===void 0&&E.data.appEnabled&&E.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&De())}).catch(()=>{}).finally(()=>{!h&&!i.repoId&&!i.pullRequestId&&!i.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(E=!1)=>{let M=++d;e.previousConfigurations=[],e.previousConfigurationId="";let _;try{_=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,it(),xt.cancel(),An.cancel(),Dn.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",ie("sourceUrl","github",!1);return}let J=C(_),pe=E||w===J;w=J,e.sourceUrlError="",ie("sourceUrl","github",!0),it();let Se=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let xe=window.document.getElementById("sourceUrl");if(xe){try{xe.setSelectionRange(0,0)}catch{}xe.scrollLeft=0}},50),Se&&u(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!pe&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],pe||(e.source={type:"GitHubStream",branch:"",commit:""}),xt.cancel(),An.cancel(),Dn.cancel(),Ms.clear(),Vs.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",td(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=pe;try{_.gistId&&!_.repo?(e.detectedType="gist",e.source={gistId:_.gistId},await id()):_.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:_.owner+"/"+_.repo,pullRequestId:_.pullRequestId},await od()):(e.detectedType="repo",et(),await Promise.all([O(),H()]),Os())}catch{}finally{M===d&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let E=e.branches.filter(_=>_.name==e.source.branch)[0];if(!E)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=E.commit),e.readme=E.readme,await H(),Os()}),e.getBranches=async E=>{let M=parseGithubUrl(e.sourceUrl),_=v();try{if(!e.details){await O(E);return}let J=await t.get(`/api/repo/${M.owner}/${M.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:E===!0||e.reconnectingSource?"1":"0",repositoryID:Ee()}});if(!y(_))return;e.branches=J.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let pe=e.branches.filter(Se=>Se.name==e.source.branch);pe.length>0&&(!(!e.reconnectingSource&&!E&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=pe[0].commit),e.readme=pe[0].readme,await H(E))}catch(J){if(!y(_))return;e.branches=[],e.sourceUnreachable=J&&(J.status===404||J.data&&J.data.error==="repo_not_found"),e.details=null,He(J)}finally{b(_)}};async function O(E=!1){let M=parseGithubUrl(e.sourceUrl),_=v();try{Ls(),it();let J=await t.get(`/api/repo/${M.owner}/${M.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,repositoryID:Ee(),force:"1"}});if(!y(_))return;e.details=J.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(E||e.reconnectingSource)}catch(J){if(!y(_))return;throw He(J),J}finally{b(_)}}async function H(E){if(e.readme&&!E)return e.readme;let M=parseGithubUrl(e.sourceUrl),_=v();try{let J=await t.get(`/api/repo/${M.owner}/${M.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:E===!0?"1":"0",branch:e.source.branch,repositoryID:Ee()}});y(_,!0)&&(e.readme=J.data)}catch{y(_,!0)&&(e.readme="")}finally{b(_)}}let te={magicalBraces:!0},Q=E=>E.startsWith("/")&&!E.endsWith("/")&&ns(Ps(E.slice(1),te),te)===E.slice(1),re=()=>Object.keys(e.preserve.picked).filter(E=>e.preserve.picked[E]).sort().map(E=>"/"+ns(E,te)),ce=E=>"/"+ns(E,te)+"/**",le=E=>"!/"+ns(E,te)+"/",ae=()=>String(e.preserve.patterns||"").split(`
`).map(E=>E.trim()).filter(Boolean),ee=null,Re=null,me=new Set,Pe=0,Me=null,Ue=()=>!1;function Ze(){let E=Pe+"\0"+e.preserve.patterns;if(E!==Me){Me=E;try{Ue=zl(_l([...re(),...ae()]))}catch{Ue=()=>!1}}return Ue}function Je(E){let M=new Map([["",{dirs:[],files:[]}]]);for(let _ of E){let J=_.split("/"),pe="";for(let Se=0;Se<J.length-1;Se++){let xe=J.slice(0,Se+1).join("/");M.has(xe)||(M.set(xe,{dirs:[],files:[]}),M.get(pe).dirs.push(xe)),pe=xe}M.get(pe).files.push(_)}for(let _ of M.values())_.dirs.sort();return{files:E,dirs:M,descendants:new Map}}function Te(E){return ee.descendants.has(E)||ee.descendants.set(E,ee.files.filter(M=>M.startsWith(E+"/"))),ee.descendants.get(E)}let Be=E=>Ze()(E);function W(E){let M=Te(E),_=0;for(let J of M)Be(J)&&_++;return _===0?"none":_===M.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let E=(e.options?.preserveFiles||[]).map(M=>String(M).trim()).filter(Boolean).map(M=>Q(M)?Ps(M.slice(1),te):M);return E.length?E.slice(0,2).join(", ")+(E.length>2?` and ${E.length-2} more`:""):"None. Every file is redacted."};async function x(){let E=e.source?.commit;if(!(ee&&e.preserve.commit===E)){e.preserve.loading=!0,e.preserve.error="",ee=null,Re=null;try{let M=parseGithubUrl(e.sourceUrl),_=await t.get(`/api/repo/${M.owner}/${M.repo}/tree`,{params:{commit:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ee()}});if(e.source?.commit!==E)return;let J=Array.isArray(_.data.binaryFiles)?_.data.binaryFiles:[];ee=kn(Je(_.data.files||[])),Re=J.length?kn(Je([..._.data.files||[],...J])):ee,me=kn(new Set(J)),e.preserve.commit=E,e.preserve.truncated=!!_.data.truncated,e.previewFile||xt()}catch{e.preserve.error="The file list could not be loaded from GitHub. You can still use patterns.",e.preserve.patternsOpen=!0}finally{e.preserve.loading=!1}}}e.watch("source.commit",E=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&E&&e.sourceUrl&&x().catch(()=>{})}),e.openPreserveFiles=()=>{let E={},M=[];for(let J of e.options?.preserveFiles||[]){let pe=String(J).trim();pe&&(!M.length&&Q(pe)?E[Ps(pe.slice(1),te)]=!0:M.push(pe))}let _={};for(let J of Object.keys(E)){let pe=J.split("/");for(let Se=1;Se<pe.length;Se++)_[pe.slice(0,Se).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:E,expanded:_,patterns:M.join(`
`),patternsOpen:M.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),Pe++,u(()=>{let J=document.getElementById("preserve-files-dialog");J?.showModal&&!J.open&&J.showModal(),document.getElementById("preserve-files-search")?.focus()},0),x()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=_l([...re(),...ae()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!ee)return[];let E=Ze(),M=(Se,xe,_t)=>{let yt=!!e.preserve.picked[Se],Ot=E(Se);return{kind:"file",path:Se,label:_t,depth:xe,state:Ot?"all":"none",locked:!yt&&Ot,note:!yt&&Ot?"matched by a pattern":yt&&!Ot?"excluded by a pattern":""}},_=String(e.preserve.search||"").trim().toLowerCase();if(_)return ee.files.filter(Se=>Se.toLowerCase().includes(_)).slice(0,300).map(Se=>M(Se,0,Se));let J=[],pe=(Se,xe)=>{let _t=ee.dirs.get(Se);for(let yt of _t.dirs){let Ot=!!e.preserve.expanded[yt],en=ae().includes(ce(yt));J.push({kind:"dir",path:yt,label:yt.slice(Se?Se.length+1:0)+"/",depth:xe,open:Ot,state:W(yt),locked:!1,note:en?"whole folder":""}),Ot&&pe(yt,xe+1)}for(let yt of _t.files)J.push(M(yt,xe,yt.slice(Se?Se.length+1:0)))};return pe("",0),J},e.preserveCount=()=>ee?ee.files.filter(Be).length:0,e.togglePreserveDir=E=>{e.preserve.expanded[E]=!e.preserve.expanded[E]},e.togglePreserveFile=E=>{e.preserve.picked[E]=!e.preserve.picked[E],Pe++},e.togglePreserveFolder=E=>{let M=ce(E),_=le(E),J=ae().filter(Se=>Se!==M&&Se!==_),pe=W(E)==="all"||ae().includes(M);for(let Se of Te(E))e.preserve.picked[Se]=!1;Pe++,e.preserve.patterns=(pe?J:[...J,M]).join(`
`),pe&&Te(E).some(Be)&&(e.preserve.patterns=[...J,_].join(`
`))};let he=/^readme(\.[^/]*)?$/i,Ne=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],be=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],Le=E=>{let M=Ie(E),_=M.indexOf("."),J=Ne.indexOf(_===-1?"":M.slice(_).toLowerCase());return J===-1?Ne.length:J},pt=()=>!!ee&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!pt())return"";for(let E of[".github","","docs"]){let M=(ee.dirs.get(E)?.files||[]).filter(_=>he.test(Ie(_)));if(M.length)return M.sort((_,J)=>Le(_)-Le(J)||ht(_,J))[0]}return""},e.readmeName=()=>Ie(e.readmePath())||"README.md";let It={key:null,fn:()=>!1},Ut=()=>{let E=(e.options?.preserveFiles||[]).map(_=>String(_).trim()).filter(Boolean),M=E.join(`
`);if(M!==It.key){let _=()=>!1;try{E.length&&(_=zl(E))}catch{}It={key:M,fn:_}}return It.fn};e.pathPreserved=E=>!!E&&Ut()(E),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let E=Ut();if(pt()){let M=e.readmePath();return!!M&&E(M)}return be.some(M=>E(M))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function Bt(){let E={terms:e.terms?e.terms.split(`
`):[],filePath:e.previewOpenPath()||"README.md",preserveFiles:e.options.preserveFiles||[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(E.branchName=e.source.branch);try{let M=parseGithubUrl(e.sourceUrl);E.repoName=`${M.owner}/${M.repo}`}catch{}return E}function Pn(E,M,_){let J=null,pe=0,Se=()=>{if(e.detectedType!==E)return;J&&u.cancel(J);let xe=++pe;e.previewStatus="loading",J=u(()=>{J=null;let _t=M();if(!_t){e.previewStatus="idle";return}t.post("/api/anonymize-preview",_t).then(yt=>{xe===pe&&(_(yt.data,_t),e.previewStatus="ready")}).catch(()=>{xe===pe&&(e.previewStatus="error")})},200)};return Se.cancel=()=>{pe++,J&&u.cancel(J),J=null},e.on("dispose",Se.cancel),Se}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof hn!="string"?nd(e.previewFile):xt()),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&Dn()};let at=kn(ei(e));Object.defineProperty(e,"previewViewer",{get:()=>at}),gl(at,e),Object.assign(at,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),at.preview=!0,at.fileSize=E=>E===at.filePath&&typeof hn=="string"?new Blob([hn]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,at.openPreserveFiles=()=>e.openPreserveFiles(),at.previewPreserved=()=>e.previewPreserved(),at.retryContent=()=>e.retryPreview();let Vm=E=>me.has(E)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(E),ta=(E="")=>({path:E,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=ta();let go=0,hn=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=E=>{if(E=E||"",E&&E===e.readmePath()&&(E=""),go++,hn=null,Ei(),xt.cancel(),e.previewFile=E,e.previewDoc=ta(E),at.sidebarCollapsed=!0,at.content=null,!E){e.readme?xt():e.previewStatus="idle";return}if(Vm(E)){na("binary"),e.previewStatus="ready";return}nd(E)};function td(){go++,hn=null,e.previewFile="",e.previewDoc=ta(),at.sidebarCollapsed=!0,at.content=null}function nd(E){let M=++go;hn=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let _;try{_=parseGithubUrl(e.sourceUrl)}catch{_=null}if(!_||!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/${_.owner}/${_.repo}/file`,{params:{commit:e.source.commit,path:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ee()},transformResponse:J=>J}).then(J=>{if(M!==go)return;e.previewDoc.loading=!1;let pe=typeof J.headers=="function"&&J.headers("content-type")||"";if(/json/i.test(pe)){let Se=null;try{Se=JSON.parse(J.data)}catch{}if(Se&&Se.binary===!0){na("binary"),e.previewStatus="ready";return}}hn=typeof J.data=="string"?J.data:"",xt()},J=>{if(M!==go)return;e.previewDoc.loading=!1;let pe=Xr(J);if(pe==="file_too_big"){na("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=as.ERRORS[pe]||"GitHub did not return this file.",e.previewStatus="error"})}let Si;function Ei(){Si&&window.URL.revokeObjectURL(Si),Si=void 0,at.url=void 0}e.on("dispose",Ei);function na(E){Ei(),e.previewDoc.note=E,at.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),at.type=E==="too_big"?"error":"binary",at.content=E==="too_big"?"file_too_big":"binary"}function Lm(E){try{let M=parseGithubUrl(e.sourceUrl),_=e.source.branch||e.details&&e.details.defaultBranch||"main",J=E&&E.includes("/")?E.slice(0,E.lastIndexOf("/")+1):"";return`https://github.com/${M.owner}/${M.repo}/raw/${_}/${J}`}catch{return""}}let sd=Pn("repo",()=>e.previewFile?typeof hn!="string"?null:{content:hn,options:Bt()}:e.readme?{content:e.readme,options:Bt()}:null,E=>{if(typeof E?.content!="string")throw Error("Invalid preview response");Ei(),window.URL?.createObjectURL&&(at.url=Si=window.URL.createObjectURL(new Blob([E.content],{type:"text/plain"})));let M=e.previewOpenPath()||e.readmeName();at.prepareFile(e.previewPathName(M)),at.fileBaseUrl=Lm(M),at.renderFileContent(E.content,at.type,at.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=E.content)}),xt=()=>{e.previewFile&&typeof hn!="string"||sd()};xt.cancel=sd.cancel;let Is=ut(new Map),sa=new Set,oa=new Set,vo="",yo=null,Ni=()=>String(e.terms||"").split(`
`).filter(E=>E.trim());function qm(){yo=null;let E=Ni(),M=E.join(`
`);M!==vo&&(Is.clear(),oa.clear(),vo=M);let _=[...sa].filter(J=>!Is.has(J));if(sa.clear(),!(!_.length||!E.length))for(let J=0;J<_.length;J+=400){let pe=_.slice(J,J+400);t.post("/api/anonymize-preview",{contents:pe,options:{terms:E,image:!0,link:!0}}).then(Se=>{if(vo!==M||Ni().join(`
`)!==M)return;let xe=Se.data?.contents;if(!Array.isArray(xe)||xe.length!==pe.length)throw Error("Invalid preview response");pe.forEach((_t,yt)=>Is.set(_t,typeof xe[yt]=="string"?xe[yt]:_t))}).catch(()=>{vo===M&&pe.forEach(Se=>oa.add(Se))})}}e.previewName=E=>{if(!E||!Ni().length)return E;if(vo===Ni().join(`
`)){if(Is.has(E))return Is.get(E);if(oa.has(E))return E}return sa.add(E),yo||(yo=u(qm,120)),E},e.previewPathName=E=>{E=String(E||"");let M=E.lastIndexOf("/");return M<0?e.previewName(E):e.previewName(E.slice(0,M))+"/"+e.previewName(E.slice(M+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{at.repoId=e.repoId||"repository",at.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),at.paths=at.filePath.split("/"),at.files=e.previewTreeFiles(),at.loadedFolders=Object.fromEntries([...Re?.dirs.keys()||[]].map(E=>[e.previewName(E),!0]))},!0),e.on("dispose",()=>{yo&&u.cancel(yo)});function Os(){!e.anonymize||!e.anonymize.terms||xt()}async function od(){let E=parseGithubUrl(e.sourceUrl),M=v();try{Ls(),it();let _=await t.get(`/api/pr/${E.owner}/${E.repo}/${E.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(M))return;e.details=_.data,e.pullRequestId||(e.pullRequestId=E.repo+"-PR"+E.pullRequestId+"-"+generateRandomId(4))}catch(_){if(!y(M))return;throw He(_),_}finally{b(M)}}let Ms=ut(new Map);function $m(){let E=new Set,M=e.details&&e.details.pullRequest;if(!M)return E;typeof M.title=="string"&&E.add(M.title),typeof M.body=="string"&&E.add(M.body),typeof M.diff=="string"&&E.add(M.diff);let _=M.comments||[];for(let J of _)typeof J.author=="string"&&E.add(J.author),typeof J.body=="string"&&E.add(J.body);return E}let An=Pn("pr",()=>{let E=$m(),M=Array.from(E);return M.length===0?null:{contents:M,options:Bt()}},(E,M)=>{if(!Array.isArray(E?.contents)||E.contents.length!==M.contents.length||E.contents.some(pe=>typeof pe!="string"))throw Error("Invalid preview response");let _=M.contents,J=new Map;for(let pe=0;pe<_.length&&pe<E.contents.length;pe++)J.set(_[pe],E.contents[pe]);Ms.clear(),J.forEach((pe,Se)=>Ms.set(Se,pe))});e.anonymizePrContent=function(E){return E&&(Ms.has(E)?Ms.get(E):"")};async function id(){let E=parseGithubUrl(e.sourceUrl),M=v();try{Ls(),it(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let _=await t.get(`/api/gist/source/${E.gistId}`);if(!y(M))return;e.details=_.data,e.gistId||(e.gistId="gist-"+E.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(_){if(!y(M))return;if(_.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,ie("sourceUrl","missing",!1);return}if(_.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,ie("sourceUrl","missing",!1);return}throw He(_),_}finally{b(M)}}let Vs=ut(new Map);function Fm(){let E=new Set,M=e.details&&e.details.gist;if(!M)return E;typeof M.description=="string"&&E.add(M.description),typeof M.ownerLogin=="string"&&E.add(M.ownerLogin);let _=M.files||[];for(let pe of _)typeof pe.filename=="string"&&E.add(pe.filename),typeof pe.content=="string"&&E.add(pe.content);let J=M.comments||[];for(let pe of J)typeof pe.author=="string"&&E.add(pe.author),typeof pe.body=="string"&&E.add(pe.body);return E}let Dn=Pn("gist",()=>{let E=Fm(),M=Array.from(E);return M.length===0?null:{contents:M,options:Bt()}},(E,M)=>{if(!Array.isArray(E?.contents)||E.contents.length!==M.contents.length||E.contents.some(pe=>typeof pe!="string"))throw Error("Invalid preview response");let _=M.contents,J=new Map;for(let pe=0;pe<_.length&&pe<E.contents.length;pe++)J.set(_[pe],E.contents[pe]);Vs.clear(),J.forEach((pe,Se)=>Vs.set(Se,pe)),ia()});e.anonymizeGistContent=function(E){return E&&(Vs.has(E)?Vs.get(E):"")},e.previewGistFiles=[];function ia(){let E=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=E.map(M=>({filename:e.anonymizeGistContent(M.filename),content:e.anonymizeGistContent(M.content),language:M.language}))}e.watch("details.gist.files",ia,!0),e.watch("terms",ia);function Um(){let E=e.conference;if(e.conference_data=null,!E)return;let M=E===k||e.isUpdate&&E===e._originalConference;E!==k&&(k=null),t.get("/api/conferences/"+E).then(_=>{e.conference===E&&(e.conference_data=_.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!M&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===E&&(e.conference_data=null)})}function Ls(){ie("repoId","used",!0),ie("repoId","format",!0),ie("pullRequestId","used",!0),ie("pullRequestId","format",!0),ie("gistId","used",!0),ie("gistId","format",!0),ie("sourceUrl","used",!0),ie("sourceUrl","missing",!0),ie("sourceUrl","access",!0),ie("sourceUrl","github",!0),ie("commit","exists",!0),ie("conference","activated",!0),ie("terms","format",!0),e.termHints=[]}function Ri(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let E=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||E&&E.invalid?(E&&E.setDirty&&E.setDirty(),e.error= Line truncated
`).filter(Se=>Se),connection:e.githubConnection,fullName:`${_.owner}/${_.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(J.options.pageSource=e.details.pageSource),Ls();let pe=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(pe,J,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},Se=>{if(Se.data){let xe=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(Se.data.error);xe||r("ERRORS."+Se.data.error).then(_t=>{e.error=_t},console.error),Ti(Se.data.error),xe&&(Se.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,Ke(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{M.disabled=!1})},e.anonymizeGist=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(Ri())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=E.currentTarget||E.target.closest?.("button")||E.target;M.disabled=!0;let _=parseGithubUrl(e.sourceUrl),J={gistId:e.gistId,terms:e.terms.trim().split(`
`).filter(Se=>Se),source:{gistId:_.gistId},options:e.options,conference:e.conference};Ls();let pe=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(pe,J,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},Se=>{Se.data&&(r("ERRORS."+Se.data.error).then(xe=>{e.error=xe},console.error),Ti(Se.data.error))}).finally(()=>{M.disabled=!1})},e.anonymizePullRequest=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(Ri())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=E.currentTarget||E.target.closest?.("button")||E.target;M.disabled=!0;let _=parseGithubUrl(e.sourceUrl),J={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
`).filter(Se=>Se),source:{repositoryFullName:`${_.owner}/${_.repo}`,pullRequestId:_.pullRequestId},options:e.options,conference:e.conference};Ls();let pe=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(pe,J,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},Se=>{Se.data&&(r("ERRORS."+Se.data.error).then(xe=>{e.error=xe},console.error),Ti(Se.data.error))}).finally(()=>{M.disabled=!1})},e.watch("conference",()=>{Um()}),e.termHints=[],e.matchTermAsWritten=E=>{e.terms=Qp(e.terms,E)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&xt()}),e.watch("terms",()=>{e.termHints=Jp(e.terms),e.detectedType==="repo"&&Os(),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&Dn()}),e.watch("options.image",()=>{e.detectedType==="repo"&&Os(),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&Dn()}),e.watch("options.link",()=>{e.detectedType==="repo"&&Os(),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&Dn()}),e.watch("details",()=>{e.detectedType==="pr"&&An(),e.detectedType==="gist"&&Dn()},!0)},Gl=function(e,t,s,i,o,r){gl(e);let u=St();Qr();let p=$t(),d=0,h=null,m=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){h&&(h.resolve(),h=null),m&&(u.timeout.cancel(m),m=null)}let v=!1;e.on("dispose",()=>{v=!0,d++,y(),b&&b.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,p(document,"click",G=>{e.symbolsOpen&&!G.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!G.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!G.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&G.target.isConnected&&!G.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!G.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!G.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",G=>{G.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(G.ctrlKey||G.metaKey)&&!G.altKey&&G.key&&G.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(G.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(G){if((G.metaKey||G.ctrlKey)&&G.key==="k"){G.preventDefault();var L=document.querySelector(".tree-search-input");L&&(L.focus(),L.select())}});var b=null;e.onFileSearchChange=function(){b&&(b.resolve(),b=null);let G=e.fileSearchQuery;if(!G||G.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let L=r.defer();b=L,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(G)}`,{timeout:L.promise}).then(function(S){if(!(v||b!==L)){b=null,e.fileSearchLoading=!1;var q={};e.files.forEach(function(Ie){q[(Ie.path||"")+"/"+Ie.name]=!0});for(var Y=[],X={},j=0;j<S.data.length;j++){var oe=S.data[j];if(oe.path)for(var se=oe.path.split("/"),fe="",Ce=0;Ce<se.length;Ce++){var _e=fe;fe=fe?fe+"/"+se[Ce]:se[Ce];var et=_e+"/"+se[Ce];!q[et]&&!X[et]&&(X[et]=!0,Y.push({name:se[Ce],path:_e}))}}Y.sort(function(Ie,Z){return(Ie.path||"").split("/").length-(Z.path||"").split("/").length}),Y.length>0&&e.files.push.apply(e.files,Y);for(var ze=[],He=0;He<S.data.length;He++){var it=S.data[He],ht=(it.path||"")+"/"+it.name;!q[ht]&&it.size!=null&&(ze.push(it),q[ht]=!0)}ze.length>0&&e.files.push.apply(e.files,ze),e.fileSearchResults=S.data}},function(){!v&&b===L&&(b=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(G,L){if(e.repoId!=i.repoId)return U();if((i.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=i.path||"",e.paths=e.filePath.split("/").filter(S=>S&&S.trim().length>0),V();for(let S=0;S<e.paths.length-1;S++){let q=S>0?e.paths.slice(0,S).join("/"):"";e.files.some(X=>X.path===q)||e.getFiles(q)}}});function w(){if(e.paths[0]!="")return;let G=["readme.md","readme.txt","readme.org","readme.1st","readme"],L={};for(let q of e.files)q.name.toLowerCase().indexOf("readme")>-1&&(L[q.name.toLowerCase()]=q.name);let S=null;for(let q of G)if(L[q]){S=q;break}if(!S&&Object.keys(L).length>0&&(S=Object.keys(L)[0]),S){let q=s.url();q[q.length-1]!="/"&&(q+="/"),s.url(q+encodePathForUrl(L[S]))}}e.fileCounts=null;let C=0,N=new Set,k=!1;e.getFiles=function(G,L=!1){let S=e.repoId,q=C;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(G)}&v=${e.options.lastUpdateDate}`).then(function(Y){if(v||S!==e.repoId||q!==C)return[];let X=G||"";return e.files=e.files.filter(j=>j.path!==X),e.files.push(...Y.data),e.loadedFolders={...e.loadedFolders,[X]:!0},P(X,q),Y.data},function(Y){if(v||S!==e.repoId||q!==C)return[];L||(e.type="error",e.content=Xr(Y),e.files=[])})};function P(G,L){if(k||N.has(G))return;N.add(G);let S=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(G)}`).then(function(q){v||S!==e.repoId||L!==C||(e.fileCounts={...e.fileCounts,...q.data})},function(){ Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
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
jane.smith@example.org`},null,10,Y6),[[u,{state:e.viewState,set:d=>{e.terms=d},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",X6,[t[127]||(t[127]=n("summary",null,"Regex & replacement syntax",-1)),t[128]||(t[128]=g()),n("small",J6,[t[121]||(t[121]=g("Regex is supported. Replaced by ",-1)),n("code",null,c(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[122]||(t[122]=g(", or use ",-1)),t[123]||(t[123]=n("code",null,"term=>replacement",-1)),t[124]||(t[124]=g(" to pick your own (e.g. ",-1)),t[125]||(t[125]=n("code",null,"Anonymous=>ABC",-1)),t[126]||(t[126]=g(").",-1))])]),(a(!0),l(R,null,B((e.termHints||[]).slice(0,3),d=>(a(),l("div",{class:"term-hint",key:d.line},[n("span",null,[t[129]||(t[129]=g("In ",-1)),n("code",null,c(d.term),1),t[130]||(t[130]=g(", ",-1)),n("code",null,c(d.symbols.join(" ")),1),g(" "+c(d.symbols.length>1?"are regex symbols":"is a regex symbol")+", so it may not match the text as written.",1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm",onClick:h=>e.matchTermAsWritten(d.line)},"Match as written",8,Q6)]))),128)),(e.termHints||[]).length>3?(a(),l("div",Z6,c(e.termHints.length-3)+" more "+c(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),A(n("div",x6,"Terms are in an invalid format.",512),[[ne,e.anonymize?.terms?.errors?.format]])]),A(n("div",eM,[n("div",tM,[t[133]||(t[133]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",nM,c(e.preserveSummary()),1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm","aria-describedby":"preserve-files-label",disabled:!e.source?.commit,onClick:t[26]||(t[26]=d=>e.openPreserveFiles())},c((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,sM)],512),[[ne,e.detectedType==="repo"]]),e.preserve?.open?(a(),l("dialog",{key:0,id:"preserve-files-dialog",class:"preserve-dialog","aria-labelledby":"preserve-files-title",onCancel:t[31]||(t[31]=de(d=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[30]||(t[30]=de(d=>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)),A(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]=d=>e.preserve.search=d)},null,512),[[ct,e.preserve.search]]),n("div",oM,[e.preserve.loading?(a(),l("p",iM,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",rM,c(e.preserve.error),1)):(a(),l(R,{key:2},[(a(!0),l(R,null,B(e.preserveRows(),(d,h)=>(a(),l("div",{class:"preserve-item",key:d.kind+":"+d.path,style:Oe({paddingLeft:d.depth*18+6+"px"})},[d.kind==="dir"?(a(),l("button",{key:0,type:"button",class:"preserve-caret","aria-expanded":d.open?"true":"false","aria-label":(d.open?"Collapse ":"Expand ")+d.label,onClick:m=>e.togglePreserveDir(d.path)},c(d.open?"\u25BE":"\u25B8"),9,aM)):(a(),l("span",lM)),n("input",{type:"checkbox",id:"pf-"+h,"aria-label":d.kind==="dir"?"Leave folder "+d.path+" unredacted":null,checked:d.state==="all",".indeterminate":d.state==="some",disabled:d.locked,onChange:m=>d.kind==="dir"?e.togglePreserveFolder(d.path):e.togglePreserveFile(d.path)},null,40,dM),n("label",{for:d.kind==="file"?"pf-"+h:null,class:"preserve-name",onClick:m=>d.kind==="dir"&&e.togglePreserveDir(d.path)},c(d.label),9,uM),d.note?(a(),l("span",cM,c(d.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",pM,c(e.preserve.search?"No file matches your search.":"No text files in this commit."),1)):f("v-if",!0)],64))]),e.preserve.truncated?(a(),l("p",fM,"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)),A(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
paper/appendix/**`,"onUpdate:modelValue":t[28]||(t[28]=d=>e.preserve.patterns=d)},null,512),[[ct,e.preserve.patterns]]),t[135]||(t[135]=n("small",{class:"form-text text-muted"},[g("One per line, as in .gitignore: "),n("code",null,"*.bib"),g(" matches in any folder; "),n("code",null,"/refs.bib"),g(" and "),n("code",null,"paper/refs.bib"),g(" match from the repository root; a folder name such as "),n("code",null,"drafts/"),g(" covers everything inside it; "),n("code",null,"!private.bib"),g(" excludes again.")],-1))],8,mM),n("div",hM,[n("span",gM,c(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",vM,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[29]||(t[29]=d=>e.closePreserveFiles())},"Cancel"),t[136]||(t[136]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[ne,e.detectedType&&e.sourceReady()]]),A(n("section",yM,[t[159]||(t[159]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),A(n("div",null,[n("div",bM,[A(n("input",wM,null,512),[[u,{state:e.viewState,set:d=>{e.options.link=d},value:e.options?.link,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",kM,[A(n("input",CM,null,512),[[u,{state:e.viewState,set:d=>{e.options.image=d},value:e.options?.image,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",SM,[A(n("input",EM,null,512),[[u,{state:e.viewState,set:d=>{e.options.pdf=d},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",NM,[A(n("input",RM,null,512),[[u,{state:e.viewState,set:d=>{e.options.notebook=d},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",TM,[A(n("input",{class:"form-check-input",type:"checkbox",id:"page",name:"page",disabled:!e.details?.hasPage||e.details?.pageSource&&e.details?.pageSource?.branch!==e.source?.branch},null,8,PM),[[u,{state:e.viewState,set:d=>{e.options.page=d},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",AM,c(e.fmt?.translate("WARNINGS.page_not_enabled_on_repo")),1)),e.details?.hasPage&&e.details?.pageSource?.branch&&e.source?.branch&&e.details.pageSource.branch!==e.source.branch?(a(),l("small",DM,c(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[ne,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",IM,[...t[145]||(t[145]=[g("Images and PDFs are served unchanged. Review their contents and metadata before sharing. ",-1),n("a",{href:"/faq#formats"},"Supported formats",-1)])])):f("v-if",!0),A(n("div",null,[n("div",OM,[A(n("input",MM,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},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",VM,[A(n("input",LM,null,512),[[u,{state:e.viewState,set:d=>{e.options.content=d},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",qM,[A(n("input",$M,null,512),[[u,{state:e.viewState,set:d=>{e.options.comments=d},value:e.options?.comments,form:"anonymize",options:{}}]]),t[148]||(t[148]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",FM,[A(n("input",UM,null,512),[[u,{state:e.viewState,set:d=>{e.options.username=d},value:e.options?.username,form:"anonymize",options:{}}]]),t[149]||(t[149]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",BM,[A(n("input",_M,null,512),[[u,{state:e.viewState,set:d=>{e.options.date=d},value:e.options?.date,form:"anonymize",options:{}}]]),t[150]||(t[150]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",zM,[A(n("input",HM,null,512),[[u,{state:e.viewState,set:d=>{e.options.origin=d},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),[[ne,e.detectedType==="gist"]]),A(n("div",null,[n("div",jM,[A(n("input",GM,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},value:e.options?.title,form:"anonymize",options:{}}]]),t[152]||(t[152]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",WM,[A(n("input",KM,null,512),[[u,{state:e.viewState,set:d=>{e.options.body=d},value:e.options?.body,form:"anonymize",options:{}}]]),t[153]||(t[153]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]) Line truncated
for the rows when a reload (tab, search, filter) has none of the new rows yet `),(a(),l(R,null,B([1,2,3,4],(r,u)=>(a(),l(R,null,[e.loading||e.refreshing&&e.filteredItems?.length==0?(a(),l("div",vB,[...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(R,null,B(e.filteredItems,(r,u)=>(a(),l(R,{key:r?._type+":"+(r?._id||u)},[e.loading?f("v-if",!0):(a(),l("div",{key:0,class:T(["paper-table-row",{"repo-inactive":r?._statusKey=="expired"||r?._statusKey=="removed","repo-error":r?.status=="error","row-clickable":!!r?._viewUrl}]),role:"row",onClick:p=>e.openItem(r,p)},[n("div",bB,[n("span",{class:"project-type-icon",role:"img","aria-label":r?._type==="repo"?"Repository":r?._type==="pr"?"Pull request":"Gist",title:r?._type==="repo"?"Repository":r?._type==="pr"?"Pull request":"Gist"},[(a(),l("svg",kB,[n("use",{href:"#project-type-"+r._type},null,8,CB)]))],8,wB),n("div",SB,[n("div",EB,[r?._viewUrl?(a(),l("a",{key:0,class:"repo-name",title:r._label,href:e.safeUrl(r?._viewUrl)},[(r?._label||"").indexOf("/")>0?(a(),l(R,{key:0},[n("span",RB,c(r._label.slice(0,r._label.indexOf("/")+1)),1),t[64]||(t[64]=n("wbr",null,null,-1)),n("span",TB,c(r._label.slice(r._label.indexOf("/")+1)),1)],64)):(a(),l(R,{key:1},[g(c(r?._label),1)],64))],8,NB)):f("v-if",!0),r?._viewUrl?f("v-if",!0):(a(),l("span",PB,[(r?._label||"").indexOf("/")>0?(a(),l(R,{key:0},[n("span",AB,c(r._label.slice(0,r._label.indexOf("/")+1)),1),t[65]||(t[65]=n("wbr",null,null,-1)),n("span",DB,c(r._label.slice(r._label.indexOf("/")+1)),1)],64)):(a(),l(R,{key:1},[g(c(r?._label),1)],64))])),r?.role==="coauthor"?(a(),l("span",IB,"Co-author")):f("v-if",!0)]),r?._id||r?._type==="repo"&&r?.source?.commit||r?.conference?(a(),l("div",OB,[r?._id?(a(),l("code",{key:0,class:"anonymous-id",title:r._id},[r._id.length>14?(a(),l(R,{key:0},[n("span",VB,c(r._id.slice(0,-6)),1),n("span",LB,c(r._id.slice(-6)),1)],64)):(a(),l(R,{key:1},[g(c(r._id),1)],64))],8,MB)):f("v-if",!0),r?._type==="repo"&&r?.source?.commit?(a(),l("span",{key:1,class:"commit-hash",title:r.source.commit},c(r.source.commit.substring(0,7)),9,qB)):f("v-if",!0),r?.conference?(a(),l("span",{key:2,class:"cell-conf conf-tag",title:"Conference: "+r.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:c(r?.conference)},null,8,FB)],8,$B)):f("v-if",!0)])):f("v-if",!0)])]),n("div",UB,[n("div",BB,[n("div",_B,[n("span",{class:T(["status-dot","status-"+r?._statusKey]),"aria-hidden":"true"},null,2),n("span",{class:"status-word",textContent:c(e.fmt?.statusLabel(r?.status))},null,8,zB),r?.status=="removed"?(a(),l(R,{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:de(p=>e.refreshItem(r),["stop"]),title:"Reviewers can no longer open this link"},"Enable again",8,HB)],64)):f("v-if",!0)]),r?.status=="error"&&r?.statusMessage?(a(),l("div",{key:0,class:"status-sub status-sub-error",textContent:c(e.fmt?.statusMsg(r?.statusMessage)),title:r?.statusMessage},null,8,jB)):f("v-if",!0),r?._stale?(a(),l("div",{key:1,class:"status-sub status-sub-warn",title:"Last activity "+e.fmt?.humanTime(r?.anonymizeDate||r?.lastView)},c(e.idleText(r)),9,GB)):f("v-if",!0),r.status==="error"&&r._editUrl?(a(),l("a",{key:2,class:"project-attention-action",href:e.safeUrl(r._editUrl)},"Fix source",8,WB)):f("v-if",!0),r._stale||r._broken?(a(),l("div",KB,[r._stale&&!r._broken?(a(),l("span",YB,[...t[68]||(t[68]=[g("May be stuck",-1),n("span",{"aria-hidden":"true"}," \xB7 ",-1)])])):f("v-if",!0),r._stale||r._broken?(a(),l("button",{key:1,type:"button",class:"project-attention-action",onClick:de(p=>e.showProjectDetails(r),["stop"]),"data-project-actions":r._broken?encodeURIComponent(r._type+":"+r._id):null,"aria-controls":r._broken?e.projectDetailsId(r):null,"aria-expanded":r._broken?e.selectedProject===r:null},c(r._broken?"Review details":"Check progress"),9,XB)):f("v-if",!0)])):f("v-if",!0),r?.status=="expired"?(a(),l("button",{key:4,type:"button",class:"project-attention-action",onClick:de(p=>e.extendItem(r),["stop"]),title:"Reviewers can no longer open this link"},"Extend 6 months",8,JB)):f("v-if",!0),r?.status=="removed"&&r?.anonymizeDate?(a(),l("div",QB,"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"})]),g("Limitations ")]),n("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-limitations",href:"#limitation","aria-expanded":"false","aria-controls":"limitation"}," What are the limitations of Anonymous GitHub? ")])]),n("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[n("div",{class:"panel-body p-3"},[n("ul",null,[n("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),n("li",null," Files larger than 8 MB are not supported. "),n("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),n("li",null," The anonymization of terms within source code may change the behavior of the program (e.g., if a replaced term appears in a string literal or identifier). ")])])])])]),f(" Privacy and security "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-shield"})]),g("Privacy and security ")]),n("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#data","aria-expanded":"false","aria-controls":"data"}," How is my data handled? ")])]),n("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[n("div",{class:"panel-body p-3"},[n("p",null," Repository data is used to provide the anonymization service. If you purchase a plan, Stripe processes payment and billing information. When a repository is removed or expires, only its configuration is retained. This makes it easy to restore the repository if needed and ensures that no future repository reuses the same ID. ")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#permissions","aria-expanded":"false","aria-controls":"permissions"}," Why does GitHub say Anonymous GitHub asks for write access? ")])]),n("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[n("div",{class:"panel-body p-3"},[n("p",null,[g("The GitHub App has read-only access to the repositories you choose. You can change repository access on your "),n("a",{href:"/connections"},"GitHub connections"),g(" page.")]),n("p",null,"Legacy GitHub OAuth includes write access to private repositories because GitHub's OAuth scopes do not offer a read-only option for them. Existing OAuth anonymizations and gists can still use this connection."),n("p",null,"Anonymous GitHub reads repository content. It never pushes, modifies, or deletes files on GitHub.")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#viewer","aria-expanded":"false","aria-controls":"viewer"}," Can repository owners see who viewed their anonymized repository? ")])]),n("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[n("div",{class:"panel-body p-3"},[n("p",null," No. Only the total number of views is tracked as an incremental counter. It is not possible for the repository owner or for Anonymous GitHub to identify individual viewers. Reviewer anonymity is fully preserved. ")])])])]),f(" Self-hosting "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#project-icon-storage"})]),g("Self"),n("span",{class:"serif-hy"},"-"),g("hosting ")]),n("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-hosting",href:"#deploy","aria-expanded":"false","aria-controls":"deploy"}," Can I deploy my own instance? ")])]),n("div",{id:"deploy",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingDeploy"},[n("div",{cla Line truncated
anonymized repository often think it is about the paper, so the
label names the service and the tooltip says who to contact. `),n("li",{class:R(["nav-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[19]||(t[19]=[n("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[n("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),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
label names the service and the tooltip says who to contact. `),n("li",{class:T(["nav-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[19]||(t[19]=[n("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[n("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),g("Report a bug ")],-1)])],2),n("li",{class:T(["nav-item nav-support-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[20]||(t[20]=[n("a",{class:"nav-link nav-support-inline",href:"https://ko-fi.com/tdurieux",target:"_blank",rel:"noopener",title:"Donate on Ko-fi to help cover hosting costs"},[n("svg",{class:"ui-icon nav-heart","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})]),g("Support ")],-1)])],2),e.isDarkMode?f("v-if",!0):(a(),l("li",Xj,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to dark mode","aria-label":"Switch to dark mode",onClick:t[1]||(t[1]=s=>{e.darkMode(!0)})},[...t[21]||(t[21]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-moon"})],-1)])])])),e.isDarkMode?(a(),l("li",Jj,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to light mode","aria-label":"Switch to light mode",onClick:t[2]||(t[2]=s=>{e.darkMode(!1)})},[...t[22]||(t[22]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sun"})],-1)])])])):f("v-if",!0),!e.user&&!e.isReviewerRoute?(a(),l("li",Qj,[...t[23]||(t[23]=[n("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[n("i",{class:"fab fa-github mr-1"}),g(" Sign in ")],-1)])])):f("v-if",!0),e.user?.username&&e.headerCanUpgrade&&!e.headerBillingPending?(a(),l("li",Zj,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=de(s=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",xj,[n("a",eG,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,tG)):f("v-if",!0),n("span",nG,c(e.user?.username),1)]),n("div",sG,[n("h6",oG,"Signed in as @"+c(e.user?.username),1),t[25]||(t[25]=Ae('<a class="dropdown-item" href="/profile"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg><span>Settings<small>Defaults, quotas, account</small></span></a><a class="dropdown-item" href="/connections"><i class="fab fa-github" aria-hidden="true"></i><span>GitHub connections<small>Repository access and OAuth</small></span></a><a class="dropdown-item" href="/claim"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-link"></use></svg><span>Claim an anonymization<small>Attach an existing mirror to your account</small></span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg><span>Report a bug<small>About this service, not a paper</small></span></a><a class="dropdown-item um-extra" href="https://github.com/tdurieux/anonymous_github/" target="_blank" rel="noopener"><i class="fab fa-github" aria-hidden="true"></i><span>Source code</span></a>',6)),e.headerShowSupport?(a(),l("a",iG,[...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,rG)):f("v-if",!0),e.emailPromptOpen?(a(),l("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[8]||(t[8]=de(s=>e.respondToEmailPrompt("later"),["prevent"]))},[n("form",{onSubmit:t[7]||(t[7]=de(s=>e.respondToEmailPrompt("save"),["prevent"]))},[t[30]||(t[30]=n("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[31]||(t[31]=n("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[32]||(t[32]=n("label",{for:"email-prompt-address"},"Email address",-1)),A(n("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[4]||(t[4]=s=>e.emailPromptAddress=s),disabled:e.emailPromptBusy},null,8,aG),[[ct,e.emailPromptAddress]]),e.emailPromptError?(a(),l("p Line truncated
python experiments/run.py`),n("p",null,[g("Contact: "),n("span",{class:"redact",role:"img","aria-label":"Redacted term 3"},[n("i",null,"3")])])])])])])],-1))]),f(" Live stats "),n("section",{class:T(["paper-stats paper-wrap",{"is-empty":e.statsEmpty()}]),id:"metrics","aria-label":"Usage over the last 60 days"},[n("div",bG,[e.statsEmpty()?f("v-if",!0):(a(),l("div",wG,[...t[11]||(t[11]=[n("span",{class:"paper-stats-dot","aria-hidden":"true"},null,-1),g(),n("span",null,[g("Live \xB7 last 60 days"),n("span",{class:"paper-stats-daily"}," \xB7 updated daily")],-1)])])),t[12]||(t[12]=n("div",{class:"paper-stats-meta-right"},"Used by authors at ICSE \xB7 FSE \xB7 OOPSLA",-1))]),e.statsEmpty()?f("v-if",!0):(a(),l("div",kG,[(a(!0),l(R,null,B(e.cards,(i,o)=>(a(),l("div",{class:"paper-stat-card",key:i?.key},[n("div",{class:T(["paper-stat-value",{"is-pending":!e.stat}])},c(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",CG,c(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",SG," +"+c(e.fmt?.number(e.history[i?.key].deltaToday))+" today ",1)):f("v-if",!0)]))),128))]))],2),f(" Before / after "),t[22]||(t[22]=n("section",{class:"paper-section-head paper-wrap"},[n("div",null,[n("div",{class:"paper-eyebrow"},"Try it"),n("h2",null,[g("The same repository, "),n("em",null,"minus you.")])]),n("p",null," Names, affiliations, emails, and any term you list are replaced across the README, source files, notebooks, and PDF links. Reviewers browse the real thing, not a zip. ")],-1)),n("div",EG,[n("div",NG,[t[13]||(t[13]=n("label",{for:"demo-terms"},[g("Terms to redact "),n("span",null,[g("comma-separated"),n("span",{class:"dt-try"},", try adding your own")])],-1)),A(n("textarea",{id:"demo-terms",class:"demo-terms-input",rows:"1","onUpdate:modelValue":t[0]||(t[0]=i=>e.demoTerms=i),spellcheck:"false",autocomplete:"off",onKeydown:t[1]||(t[1]=Tt(de(()=>{},["prevent"]),["enter"]))},null,544),[[ct,e.demoTerms]])]),n("div",RG,[n("div",TG,[t[15]||(t[15]=n("div",{class:"pane-header"},[n("span",{class:"pane-label"},[g("Your repository "),n("span",{class:"pane-edit-hint"},"\xB7 editable")]),n("span",{class:"pane-url"},"github.com/jane-smith/DeepLearnUtils")],-1)),n("div",PG,[n("div",AG,[(a(!0),l(R,null,B(e.demoParts(),(i,o)=>(a(),l(R,{key:o},[i.redacted?(a(),l("mark",DG,c(i.original),1)):(a(),l(R,{key:1},[g(c(i.text),1)],64))],64))),128)),t[14]||(t[14]=g("\u200B",-1))]),A(n("textarea",{class:"pane-body demo-input","onUpdate:modelValue":t[2]||(t[2]=i=>e.demoText=i),spellcheck:"false","aria-label":"Sample README to anonymize"},null,512),[[ct,e.demoText]])])]),n("div",IG,[n("div",OG,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",MG,[n("span",VG,c(e.demoCount())+" redacted",1)])]),n("div",LG,[(a(!0),l(R,null,B(e.demoParts(),(i,o)=>(a(),l(R,{key:o},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},c(i.text),9,qG)):(a(),l(R,{key:1},[g(c(i.text),1)],64))],64))),128))])])])]),f(" What you get: one screenshot, three tabs "),t[23]||(t[23]=n("section",{class:"paper-section-head paper-wrap",id:"about"},[n("div",null,[n("div",{class:"paper-eyebrow"},"What you get"),n("h2",null,"Anonymize, review, manage.")]),n("p",null," Terms are redacted in text files. Enabled images and PDFs are served unchanged, so review them for identifying content before sharing. Monitor your mirror, update it, or remove it when the review is over. ")],-1)),n("section",$G,[n("div",FG,[(a(!0),l(R,null,B(e.features,(i,o)=>(a(),l("div",{class:T(["paper-feature",{"is-on":e.feature===i?.key}]),key:i?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:r=>e.selectFeature(i.key),onKeydown:r=>e.featureKeydown(r,o),id:"feature-tab-"+i?.key,"aria-controls":"feature-panel-"+i?.key,"aria-selected":e.feature===i?.key,tabindex:e.feature===i?.key?0:-1},[n("span",BG,[n("span",_G,c(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",zG,c(i?.eyebrow),1)]),n("span",HG,[g(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",jG,"-")):f("v-if",!0),g(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)])],40,UG),n("div",GG,[n("span",WG,[g(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",KG,"-")):f("v-if",!0),g(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)]),n("p",null,c(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},c(i?.cta)+" \u2192",9,YG)])],2))),128))]),n("div",XG,[(a(!0),l(R,null,B(e.features,(i,o)=>A((a(),l("div",{class:"paper-feature-panel",role:"tabpanel",key:i?.key,id:"feature-panel-"+i?.key,"aria-labelledby":"feature-tab-"+i?.key},[n("div",QG,[n("div",ZG,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",xG,c(i?.url),1)]),n("div",{class:T(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",tW,[...t[19]||(t[19]=[Ae('<div class="fm-label">GitHub reposit Line truncated
<span class="ln">2</span><span class="c"># Author: <span class="redact">XXXX-1</span>, <span class="redact">XXXX-2</span></span>
<span class="ln">3</span><span class="k">import</span> torch
<span class="ln">4</span><span class="k">from</span> utils <span class="k">import</span> load_config
@@ -61,18 +65,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",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
<span class="ln">10</span> log(<span class="s">&quot;epoch %d: %.3f&quot;</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",sW,[...t[21]||(t[21]=[Ae('<div class="fm-dash-head"><span>Project</span><span>Status</span><span>Views</span><span>Expires</span></div><div class="fm-dash-row"><span><b>DeepLearnUtils</b><i>paper-7f2a \xB7 ICSE 2027</i></span><span class="st is-ready">Ready</span><span>41</span><span>Mar 31, 2027</span></div><div class="fm-dash-row"><span><b>vision-bench#212</b><i>pull request \xB7 FSE 2027</i></span><span class="st is-ready">Ready</span><span>12</span><span>Never</span></div><div class="fm-dash-row"><span><b>graph-repair</b><i>gr-91ab</i></span><span class="st is-progress">Updating</span><span>5</span><span>Jan 5, 2027</span></div><div class="fm-dash-row is-muted"><span><b>JarSift</b><i>OOPSLA 2025</i></span><span class="st is-expired">Expired</span><span>72</span><span>Sep 28, 2026</span></div>',5)])]))],10,eW)])],8,JG)),[[ne,e.feature===i?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=Ae('<section class="paper-qa paper-qa-r3 paper-wrap" aria-labelledby="qa-heading"><div class="qa-head"><div><div class="paper-eyebrow">Before you sign in</div><h2 id="qa-heading">The questions that come up most.</h2></div><a class="paper-link-arrow" href="/faq">Read the full FAQ \u2192</a></div><div class="qa-grid"><div class="q"><a href="/faq#permissions">What access does GitHub sign-in require?</a><p> The GitHub App has read-only access to gists and the repositories you choose. Legacy OAuth uses broader permissions. Anonymous GitHub never writes to your repositories. </p></div><div class="q"><a href="/faq#formats">Which file formats are supported?</a><p> Source code with syntax highlighting, Markdown, Jupyter notebooks, PDFs, images, and GitHub Pages sites. Text files are anonymized; enabled images and PDFs are served unchanged. </p></div><div class="q"><a href="/faq#expiration">What happens when an anonymized repository expires?</a><p> You choose: the mirror is removed, or visitors are redirected to the original GitHub repository once the review is over. </p></div></div></section><section class="paper-cta paper-wrap" aria-labelledby="cta-heading"><div><h2 id="cta-heading">Ready for review?</h2><p>Create an anonymous mirror in a couple of minutes. Reviewers just open the link.</p></div><div class="paper-cta-actions"><a class="btn-hero" href="/signin" target="_self"><i class="fab fa-github" aria-hidden="true"></i> Sign in with GitHub</a><a class="paper-link-arrow" target="_self" href="https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/">See an anonymized repository \u2192</a></div></section>',2)),Fe(s,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var oW={class:"paper-empty"},iW={class:"paper-empty-inner"},rW={key:0,class:"paper-eyebrow"},aW={key:1,class:"paper-eyebrow"},lW={key:2,class:"paper-empty-title"},dW=["textContent"];function Uf(e,t){return a(),l("div",oW,[n("div",iW,[e.error?f("v-if",!0):(a(),l("div",rW,"Working")),e.error?(a(),l("div",aW,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",lW,[...t[0]||(t[0]=[g(" Loading",-1),n("span",{class:"dot-anim"},"\u2026",-1)])])),e.error?(a(),l("h1",{key:3,class:"paper-empty-title",textContent:c(e.fmt.translate(e.error))},null,8,dW)):f("v-if",!0)])])}var uW={class:"container paper-page paper-settings"},cW={class:"paper-crumbs"},pW={class:"here"},fW={class:"paper-page-title"},mW={class:"paper-settings-body"},hW={class:"paper-settings-toc"},gW={href:"#conf-billing"},vW={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},yW={id:"conf-basics",class:"paper-settings-section"},bW={class:"form-group"},wW={class:"invalid-feedback"},kW={class:"invalid-feedback"},CW={class:"form-group"},SW={class:"invalid-feedback"},EW={class:"form-group"},NW={class:"invalid-feedback"},RW={class:"invalid-feedback"},TW={id:"conf-window",class:"paper-settings-section"},PW={class:"form-grid-2"},AW={class:"form-group"},DW={class:"invalid-feedback"},IW={class:"invalid-feedback"},OW={class:"form-group"},MW={class:"invalid-feedback"},VW={class:"invalid-feedback"},LW={id:"conf-rendering",class:"paper-settings-section"},qW={class:"form-check"},$W={class:"form-check-input",type:"checkbox",id:"link",name:"link"},FW={class:"form-check"},UW={class:"form-check-input",type:"checkbox",id:"image",name:"image"},BW={class:"form-check"},_W={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},zW={class:"form-check"},HW={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},jW={id:"conf-features",class:"paper-settings-section"},GW={class:"form-check"},WW={class:"form-check-input",type:"checkbox",id:"update",name:"update"},KW={class:"form-check"},YW={class:"form-check-input",type:"checkbox",id:"page",name:"page"},XW={id:"conf-plan",class:"paper-settings-section"},JW={key:0,class:"paper-section-copy"},QW={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"}Line truncated
`).length))+" lines",1)):f("v-if",!0)]),A(n("button",{type:"button",class:"btn btn-sm btn-icon-only btn-ghost copy-path-btn","aria-label":e.pathCopied?"Path copied":"Copy file path",title:e.pathCopied?"Path copied":"Copy file path",onClick:t[2]||(t[2]=d=>e.copyPath())},[(a(),l("svg",jK,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,GK)]))],8,HK),[[ne,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",WK,[e.redactionCount()?(a(),l(R,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,KK),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),g(c(e.languageName||"Text"),1),n("span",YK,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),g(c(e.content.length<1024?e.content.length+" B":(e.content.length/1024).toFixed(1)+" KB"),1)]),t[52]||(t[52]=n("span",{class:"sep"},"\xB7",-1)),g(c(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",XK,[e.redactionCount()?(a(),l(R,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,JK),t[54]||(t[54]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),t[56]||(t[56]=g("Markdown",-1)),e.fileSize(e.filePath)!=null?(a(),l(R,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),g(c(e.formatSize(e.fileSize(e.filePath))),1)],64)):f("v-if",!0)])):f("v-if",!0),e.preview&&e.previewPreserved()?(a(),l("button",{key:2,type:"button",class:"rp-preserved-tag",onClick:t[3]||(t[3]=d=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",QK,[e.isCsv()?(a(),l("div",ZK,[n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,xK),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="chart"}]),"aria-checked":e.csvView==="chart",onClick:t[5]||(t[5]=d=>e.csvView="chart"),title:"Chart the table"},"Chart",10,eY),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[6]||(t[6]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,tY)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",nY,[n("button",{type:"button",class:T(["btn btn-sm btn-ghost btn-symbols",{"is-on":e.symbolsOpen}]),"aria-expanded":e.symbolsOpen?"true":"false","aria-haspopup":"true",title:"Symbols in this file",onClick:t[7]||(t[7]=d=>e.symbolsOpen=!e.symbolsOpen)},[...t[57]||(t[57]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-list"})],-1),n("span",{class:"btn-find-label"},"Symbols",-1)])],10,sY),e.symbolsOpen?(a(),l("div",oY,[n("div",iY,c(e.symbols().length)+" "+c(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(R,null,B(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:h=>e.goToSymbol(d.line)},[n("span",{class:T(["symbols-kind","is-"+d.kind])},c(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",aY,c(d.name),1),n("span",lY,c(d.line),1)],8,rY))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:T(["btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find",{"is-on":e.mdFindOpen}]),"aria-label":"Find on this page",title:"Find on this page ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[8]||(t[8]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,dY)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?(a(),l("div",uY,[e.type!="html"?(a(),l("button",{key:0,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-goto","aria-label":"Go to line",title:"Go to line ("+(e.isMac?"\u2318":"Ctrl+")+"G)",onClick:t[9]||(t[9]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,cY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:T(["btn btn-sm btn-icon-only btn-ghost btn-toggle",{"is-on":e.wrapLines}]),"aria-pressed":e.wrapLines?"true":"false","aria-label":"Wrap lines",title:"Wrap lines (Alt+Z)",onClick:t[10]||(t[10]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,pY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:2,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-find","aria-label":"Find in file",title:"Find in file ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[11]||(t[11]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,fY)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",mY,[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,hY),typeof e.content=="string"?(a(),l("button",{key:0,type:"button",class:"tb-seg-btn tb-seg-icon","aria-label":e.contentCopied?"Copied":"Copy file contents",title:e.contentCopied?"Copied":"Copy file contents",onClick:t[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",vY,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,yY)]))],8,gY)):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,bY)])):f("v-if",!0),typeof e.content=="string"?(a(),l("button",{key:5,type:"button",class:"btn btn-sm btn-icon-only btn-ghost tb-copy-m","aria-label":e.contentCopied?"Copied Line truncated
`).length))+" lines",1)],64)):f("v-if",!0)])):f("v-if",!0),e.options?.publishedAt||e.options?.sourceCommitDate||e.options?.anonymizedAt||e.options?.lastUpdateDate?(a(),l("div",MY)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[18]||(t[18]=d=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),g("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",VY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[19]||(t[19]=d=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),g("Find in file",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:6,type:"button",role:"menuitem",onClick:t[20]||(t[20]=d=>e.gotoLine())},[...t[69]||(t[69]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1),g("Go to line",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:7,type:"button",role:"menuitemcheckbox","aria-checked":e.wrapLines?"true":"false",onClick:t[21]||(t[21]=d=>e.toggleWrap())},[t[70]||(t[70]=n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)),t[71]||(t[71]=g("Wrap lines",-1)),e.wrapLines?(a(),l("span",qY,"\u2713")):f("v-if",!0)],8,LY)):f("v-if",!0),e.isCsv()?(a(),l(R,{key:8},B(["table","chart","raw"],d=>n("button",{type:"button",role:"menuitemradio",class:"tb-csv-view",key:d,"aria-checked":e.csvView===d?"true":"false",onClick:h=>{e.csvView=d,e.moreOpen=!1}},[(a(),l("svg",FY,[n("use",{href:d==="raw"?"#ui-icon-code":d==="chart"?"#ui-icon-chart":"#ui-icon-list"},null,8,UY)])),g(c(d==="raw"?"Show as text":d==="chart"?"Show as chart":"Show as table"),1),e.csvView===d?(a(),l("span",BY,"\u2713")):f("v-if",!0)],8,$Y)),64)):f("v-if",!0),e.type!="html"?(a(),l("div",_Y)):f("v-if",!0),e.type=="html"&&(!e.preview||e.url)?(a(),l("a",{key:10,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[72]||(t[72]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),g("View raw",-1)])],8,zY)):f("v-if",!0),e.type!="html"&&(!e.preview||e.url)?(a(),l("a",{key:11,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[73]||(t[73]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),g("View raw",-1)])],8,HY)):f("v-if",!0),!e.preview||e.url?(a(),l("a",{key:12,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[74]||(t[74]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1),g("Download file",-1)])],8,jY)):f("v-if",!0),e.options?.hasWebsite?(a(),l("a",{key:13,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/w/"+e.repoId+"/")},[...t[75]||(t[75]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-globe"})],-1),g("Open website",-1)])],8,GY)):f("v-if",!0),e.options?.isAdmin||e.options?.isOwner?(a(),l("a",{key:14,role:"menuitem",href:e.safeUrl("/anonymize/"+e.repoId)},[...t[76]||(t[76]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-edit"})],-1),g("Edit anonymization",-1)])],8,WY)):f("v-if",!0),e.options?.download?(a(),l("a",{key:15,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/api/repo/"+e.repoId+"/zip")},[...t[77]||(t[77]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-archive"})],-1),g("Download ZIP",-1)])],8,KY)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=d=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),g("Copy file path",-1)])]),t[79]||(t[79]=n("div",{class:"tb-menu-sep"},null,-1)),t[80]||(t[80]=n("a",{role:"menuitem",href:"/faq"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-help"})]),g("FAQ")],-1)),t[81]||(t[81]=n("a",{role:"menuitem",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",target:"_blank",rel:"noopener"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),g("Report a bug")],-1))])):f("v-if",!0)])]),e.gotoOpen&&e.type!="html"?(a(),l("form",{key:3,class:"goto-pop",role:"dialog","aria-label":"Go to line",onSubmit:t[26]||(t[26]=de(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),A(n("input",{id:"goto-input",class:"goto-input",type:"text",inputmode:"numeric",autocomplete:"off",spellcheck:"false",placeholder:"1\u2013"+e.fmt?.number(typeof e.content=="string"?e.content.split(`
`).length:1),"aria-invalid":e.gotoError?"true":"false","onUpdate:modelValue":t[24]||(t[24]=d=>e.gotoValue=d),onKeydown:t[25]||(t[25]=Tt(de(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,YY),[[ct,e.gotoValue]]),n("span",{class:T(["goto-hint",{"is-error":e.gotoError}])},c(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView!=="raw"?(a(),Rt(s,{key:e.paths?.join("/"),rows:e.csvRows(),name:e.paths?.[e.paths.length-1],"state-key":e.preview?null:"table",view:e.csvView},null,8,["rows","name","state-key","view"])):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?A((a(),l("div",XY,null,512)),[[u,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",JY,[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]=Tt(de(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=Tt(de(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,QY),n("span",ZY,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[83]||(t[83]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,xY),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=d=>e.stepMdFind(1)),disabled:!e.mdFindTotal},[...t[84]||(t[84]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-right"})],-1)])],8,eX)]),n("span",tX,c(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:T(["md-find-opt",{"is-on":e.mdFindCase}]),"aria-pressed":e.mdFindCase?"true":"false",title:"Match case","aria-label":"Match case",onClick:t[32]||(t[32]=d=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,nX),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",sX,[A(n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,oX),[[p]]),e.tocCount()>=3?(a(),l("aside",iX,[t[85]||(t[85]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",rX,[n("a",{href:"#",class:T(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=de(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(R,{key:0},B(e.tocTitle().parts,(d,h)=>(a(),l(R,{key:h},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,c(d.n),1)],8,aX)):(a(),l(R,{key:1},[g(c(d.t),1)],64))],64))),128)):(a(),l(R,{key:1},[g("Introduction")],64))],2),(a(!0),l(R,null,B(e.readmeToc(),(d,h)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:T(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:de(m=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(R,null,B(d.parts,(m,y)=>(a(),l(R,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,dX)):(a(),l(R,{key:1},[g(c(m.t),1)],64))],64))),128))],10,lX))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Rt(i,{key:2,content:e.content,"base-url":e.fileBaseUrl,"allow-scripts":e.allowScripts},null,8,["content","base-url","allow-scripts"])):f("v-if",!0),e.fileFrame()?(a(),l("section",{key:3,class:T(["file-card file-card-media","view-"+e.type])},[n("header",uX,[n("div",cX,[n("button",{type:"button",class:T(["btn btn-sm btn-icon-only btn-ghost card-files-btn",{"is-needed":e.sidebarHidden}]),title:"Show file tree",onClick:t[35]||(t[35]=d=>e.sidebarHidden?e.sidebarHidden=!1:e.sidebarCollapsed=!1)},[...t[86]||(t[86]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sidebar"})],-1),n("span",{class:"card-files-label"},"Files",-1)])],2),n("ol",pX,[n("li",fX,[n("a",{href:e.safeUrl("/r/"+e.repoId+"/"),title:e.repoId,textContent:c(/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e.repoId||"")?"repository":e.repoId)},null,8,mX)]),(a(!0),l(R,null,B(e.paths,(d,h)=>(a(),l("li",{class:"breadcrumb-item","aria-current":h===e.paths.length-1?"page":null},[(a(!0),l(R,null,B(e.redactParts(d),(m,y)=>(a(),l(R,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,gX)):(a(),l(R,{key:1},[g(c(m.t),1)],64))],64))),128))],8,hX))),256))]),n("span",vX,[e.type=="IPython"&&e.redactionCount()?(a(),l("b",{key:0,class:"ms-item ms-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[87]||(t[87]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,yX)):f("v-if",!0),n("span",bX,c(e.fileKind()),1),e.imageSize?(a(),l("span",wX,c(e.imageSize),1)):f("v-if",!0),e.fileSi Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
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(`
`)}),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
jane.smith@example.org`},null,8,TQ),[[i,{state:e.viewState,set:r=>{e.terms=r},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",PQ,[t[25]||(t[25]=n("summary",null,"Regex & replacement syntax",-1)),n("p",null,[t[21]||(t[21]=g("Matches become ",-1)),n("code",null,c(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[22]||(t[22]=g(". Use ",-1)),t[23]||(t[23]=n("code",null,"term=>replacement",-1)),t[24]||(t[24]=g(" for a custom replacement. Regex is supported.",-1))])]),A(n("div",AQ,"Terms are in an invalid format.",512),[[ne,e.defaultsForm?.terms?.errors?.format]])])]),n("section",DQ,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",IQ,[n("label",OQ,[A(n("input",MQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.link=r},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=g("Keep links",-1))]),n("label",VQ,[A(n("input",LQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.image=r},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=g("Display images",-1))]),n("label",qQ,[A(n("input",$Q,null,512),[[i,{state:e.viewState,set:r=>{e.options.pdf=r},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=g("Display PDFs",-1))]),n("label",FQ,[A(n("input",UQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.notebook=r},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=g("Display notebooks",-1))]),n("label",BQ,[A(n("input",_Q,null,512),[[i,{state:e.viewState,set:r=>{e.options.loc=r},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=g("Show line counts",-1))]),n("label",zQ,[A(n("input",HQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.page=r},value:e.options?.page,form:"defaultsForm",options:{}}]]),t[32]||(t[32]=g("GitHub Pages",-1))])]),t[33]||(t[33]=n("p",{class:"settings-help"},"Images and PDFs are not anonymized.",-1)),t[34]||(t[34]=n("p",{class:"settings-help"},"GitHub Pages must use the anonymized branch.",-1))])]),n("section",jQ,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",GQ,[A(n("input",WQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.update=r},value:e.options?.update,form:"defaultsForm",options:{}}]]),t[36]||(t[36]=g("Auto-update from GitHub",-1))]),t[37]||(t[37]=n("p",{class:"settings-help"},"Latest commit, at most once an hour.",-1))])]),n("section",KQ,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[A((a(),l("select",YQ,[...t[39]||(t[39]=[n("option",{value:"redirect"},"Redirect visitors to the GitHub repository",-1),n("option",{value:"remove",selected:""},"Remove the anonymized repository",-1)])])),[[i,{state:e.viewState,set:r=>{e.options.expirationMode=r},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",XQ,c(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",JQ,[n("div",QQ,[e.draftRestored?(a(),l("span",ZQ,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",xQ,"Unsaved changes"+c(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",eZ,c(e.message?"Defaults saved":"No unsaved changes"),1))]),e.draftRestored||e.unsavedChanges?(a(),l("button",{key:0,type:"button",class:"draft-discard",onClick:t[0]||(t[0]=r=>e.discardDraft())},"Discard changes")):f("v-if",!0),n("button",{id:"save",type:"submit",class:T(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},c(e.saving?"Saving\u2026":"Save defaults"),11,tZ),e.error?(a(),l("div",nZ,c(e.error),1)):f("v-if",!0)])],32)),[[o,e.viewState]])],512),[[ne,e.settingsTab==="defaults"]]),A(n("section",{id:"settings-billing","aria-busy":e.billingLoading||e.billingBusy},[t[95]||(t[95]=n("p",{class:"settings-scope"},"Your plan and usage. Reviewer access is always free.",-1)),e.billingLoading?(a(),l("p",oZ,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",iZ,[g(c(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=r=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,rZ)])):f("v-if",!0),e.billingNotice?(a(),l("p",aZ,c(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",lZ,[t[42]||(t[42]=n("strong",null,"Confirming your payment",-1)),t[43]||(t[43]=n("p",null,"Your allowance will update after confirmation. Please do not pay again.",-1)),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[4]||(t[4]=r=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,dZ)])):f("v-if",!0),n("section",uZ,[n("div",cZ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",pZ,c(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",fZ,[g(c(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access Line truncated
`);t.innerHTML=s.map(i=>{let o=i.replace(/^(<[^>]+>)+/,"").charAt(0),r=i.startsWith("@@")?"hunk":o==="+"?"add":o==="-"?"remove":"";return`<span class="md-diff-line${r?" is-"+r:""}">${i||" "}</span>`}).join(`
`)}),hm=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},bm=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let s=t.querySelectorAll(".md-diff-line");if(s.length){s.forEach(o=>{o.classList.contains("is-hunk")||o.style.setProperty("--hang",hm(o.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let i=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
`).map(o=>{let r=i.join("");o.replace(/<\/?span\b[^>]*>/g,p=>(p.startsWith("</")?i.pop():i.push(p),p));let u=o.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${hm(u)}ch">${r}${o||" "}${"</span>".repeat(i.length)}</span>`}).join(`
`)})},nle=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",xl={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=bt(null),s=()=>{let i=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?to(i):i,ym(t.value),bm(t.value),e.idPrefix!=null){let o={};t.value.querySelectorAll("h1, h2, h3").forEach(r=>{let u=e.idPrefix+(r.id||nle(r.textContent));o[u]?u+="-"+ ++o[u]:o[u]=1,r.id=u})}ki(t.value),e.onOutline?.(Cr(t.value))};return Jt(()=>{s(),dt(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>ye("markdown",{ref:t,class:e.reader?"markdown-body":null})}},gm=e=>Qt(e).map(t=>t.n?ye("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},ye("i",t.n)):t.t),Zl=e=>/^XXXX-\d+$/.test(String(e||"").trim()),sle=(e,t="Reviewer")=>e?ye("span",{class:["pr-author",{"is-redacted":Zl(e)}],title:Zl(e)?"Redacted author":null},Zl(e)?gm(e):["@",...gm(e)]):ye("span",{class:"pr-author is-hidden"},t),wm={props:["comments","fmt"],setup(e){return()=>ye("div",{class:"pr-thread"},(e.comments||[]).map((t,s)=>ye("article",{class:["pr-thread-comment",{"is-reply":s>0}],key:s},[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"}))),sle(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(xl,{content:t.body,reader:!0})):null])))}},ole=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),ile=new Set(["add","remove","ctx","hunk"]),rle=e=>{let t=ile.has(e.kind)?e.kind:"ctx",s=Qt(e.text).map(i=>i.n?`<span class="redact-slot" role="img" aria-label="Redacted term ${Number(i.n)}"><i>${Number(i.n)}</i></span>`:ole(i.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: ${Zs(e.text)}ch">${s}</td></tr>`},ale={props:["file","fmt"],setup(e){return()=>{let t=[],s="",i=()=>{s&&t.push(ye("tbody",{key:"r"+t.length,innerHTML:s})),s=""};return(e.file?.lines||[]).forEach(o=>{s+=rle(o),o.threads?.length&&(i(),t.push(ye("tbody",{key:"t"+t.length},o.threads.map((r,u)=>ye("tr",{class:"diff-thread-row",key:u},[ye("td",{class:"diff-thread-gutter",colspan:3}),ye("td",{class:"diff-thread-cell"},ye(wm,{comments:r.comments,fmt:e.fmt}))])))))}),i(),ye("table",{class:"diff-file-table"},t)}}},lle={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=bt(null),s=()=>Ke(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),ym(t.value),bm(t.value)});return Jt(s),dt(()=>[e.file?.content,e.terms,e.options],s,{deep:!0}),()=>{let i=e.file||{},o=(i.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(o)||i.language==="Markdown")return ye("gist-file",{ref:t},ye(xl,{content:i.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));let r={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},u=(i.language||o||"none").toLowerCase();return ye("gist-file",{ref:t},ye("pre",{class:"line-numbers"},ye("code",{class:"language-"+(r[u]||u),key:i.content},i.content||"")))}}},dle=e=>e?.querySelectorAll(".nb-input pre").forEach(t=>{if(t.parentElement?.classList.contains("nb-code-scroll"))return;let s=document.createElement("div");s.className="nb-code-scroll",t.replaceWith(s),s.appendChild(t);let i=()=>{let o=t.scrollWidth-t.clientWidth>1;if(s.classList.toggle("is-overflowing",o),s.classList.toggle("is-at-end",o&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!o)return;let r=t.clientWidth-16,u=Math.max(24,r*t.clientWidth/t.scrollWidth);s.style.setProperty("--thumb-w",u+"px"),s.style.setProperty("--thumb-x",(r-u)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",i,{passive:!0}),window.ResizeObserver?new ResizeObserver(i).observe(t):i(),i()}),ule={props:["file","content"],setup(e){let t=bt(null),s=0,i,o=async()=>{let r=++s;i?.abort(),i=new AbortController;try{let u=e.content?JSON.parse(e.content):await fetch(e.file?.download_url||e.file,{signal:i.signal}).then(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await ls("notebook"),r!==s)return;t.value.innerHTML=to(DOMPurify.sanitize(nb.parse(u).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),dle(t.value),ki(t.value)}catch(u){r===s&&u.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return Jt(()=>{o(),dt(()=>[e.file,e.content],o)}),Fn(()=>{s++,i?.abort()}),()=>ye(Line truncated
/*! Bundled license information:
@vue/shared/dist/shared.esm-bundler.js:
+58 -3
View File
@@ -479,7 +479,60 @@ const galleryNotebook = JSON.stringify({
{ cell_type: "code", execution_count: 4, metadata: {}, source: ["ax = df.groupby(\"model\").accuracy.mean().plot.bar()\n", "ax.figure.savefig(\"figures/accuracy.png\")"], outputs: [{ output_type: "display_data", metadata: {}, data: { "image/png": galleryPng.toString("base64"), "text/plain": ["<Figure size 720x400 with 1 Axes>"] } }] },
],
}, null, 1);
// Table viewer fixtures (tables/): a per-seed results table, a TSV with dates and
// thousands separators, a table with redacted cells, a README with a Markdown
// results table, and a ~1 MB CSV for the viewer's timing. All deterministic.
const tableRng = (seed) => () => { seed = (seed * 1103515245 + 12345) % 2147483648; return seed / 2147483648; };
const tableFixtures = (() => {
const rnd = tableRng(42);
const models = [["Baseline", 71.2, 410], ["+ Aug.", 74.0, 447], ["+ Pretrain", 76.1, 471], ["Ours", 78.9, 503]];
const perSeed = ["model,dataset,seed,accuracy,precision,recall,plausible"];
for (const [model, acc, plaus] of models) for (const [dataset, shift] of [["Defects4J", 0], ["QuixBugs", 3.6]]) for (let seed = 1; seed <= 5; seed++) {
const a = acc + shift + (rnd() - 0.5) * 0.8;
perSeed.push([model, dataset, seed, a.toFixed(1), (a / 100 + 0.04 + (rnd() - 0.5) * 0.02).toFixed(3), (a / 100 - 0.03 + (rnd() - 0.5) * 0.02).toFixed(3),
model === "+ Aug." && dataset === "QuixBugs" && seed === 3 ? "" : Math.round(plaus + shift * 8 + (rnd() - 0.5) * 10)].join(","));
}
const runs = ["date\tmodel\taccuracy\truntime_s\tdelta\tgpu_share"];
const start = Date.UTC(2026, 2, 2);
for (let day = 0; day < 14; day++) for (const [model, acc] of models.slice(1)) {
const date = new Date(start + day * 86400000).toISOString().slice(0, 10);
const a = acc - 4 + day * 0.32 + (rnd() - 0.5) * 0.9;
runs.push([date, model, a.toFixed(1), Math.round(900 + rnd() * 900 + (model === "Ours" ? 400 : 0)).toLocaleString("en-US"), (rnd() - 0.4).toFixed(2), (40 + rnd() * 55).toFixed(1) + "%"].join("\t"));
}
const redacted = [
"run,author,cluster,model,accuracy,notes",
"1,XXXX-1,XXXX-2,Ours,78.7,first run",
"2,XXXX-1,XXXX-2,Ours,79.1,",
"3,XXXX-4,XXXX-2,Baseline,71.0,rerun by XXXX-4",
"4,XXXX-4,XXXX-5,Baseline,71.4,",
"5,XXXX-1,XXXX-5,+ Aug.,74.2,\"uses XXXX-3's split, seed 2\"",
];
const large = ["run_id,date,model,dataset,seed,accuracy,f1,loss,latency_ms,coverage"];
const datasets = ["Defects4J", "QuixBugs", "Bears", "BugsInPy", "ManyBugs"];
let size = large[0].length + 1, id = 0;
while (true) {
const [model, acc] = models[id % 4];
const dataset = datasets[Math.floor(id / 4) % 5];
const a = acc - (datasets.indexOf(dataset) * 2.1) + (rnd() - 0.5) * 3;
const row = [id + 1, new Date(start + Math.floor(id / 40) * 3600000).toISOString().slice(0, 16).replace("T", " "), model, dataset, (id % 10) + 1,
a.toFixed(2), (a / 100 - 0.02).toFixed(3), (rnd() * 0.004).toExponential(2), '"' + Math.round(800 + rnd() * 2400).toLocaleString("en-US") + '"', (50 + rnd() * 50).toFixed(1) + "%"].join(",");
if (size + row.length + 1 > 1000 * 1024) break;
large.push(row); size += row.length + 1; id++;
}
return {
"tables/per-seed.csv": perSeed.join("\n") + "\n",
"tables/runs.tsv": runs.join("\n") + "\n",
"tables/redacted.csv": redacted.join("\n") + "\n",
"tables/benchmark-1mb.csv": large.join("\n") + "\n",
"tables/README.md": "# Result tables\n\nAccuracy (%) on each benchmark, averaged over five seeds. Runs by XXXX-1 on the XXXX-2 cluster.\n\n"
+ "| Model | Defects4J | QuixBugs | Bears | Train time (h) |\n| --- | ---: | ---: | ---: | ---: |\n"
+ "| Baseline | 71.2 | 75.0 | 52.4 | 3.1 |\n| + Aug. | 74.0 | 78.1 | 55.0 | 3.4 |\n| + Pretrain | 76.1 | 80.2 | 58.7 | 6.2 |\n| XXXX-3 | 77.5 | 81.0 | 59.9 | 5.8 |\n| Ours | 78.9 | 82.5 | 61.2 | 6.0 |\n\n"
+ "`per-seed.csv` has the runs behind this table; `runs.tsv` tracks the nightly evaluation.\n",
};
})();
const galleryText = {
...tableFixtures,
"README.md": "# Replication package\n\nArtifact for *Learning Robust Repair Strategies from Developer Histories*, prepared by XXXX-1.\n\n| File | What it shows |\n| --- | --- |\n| `paper.pdf` | The submitted paper |\n| `analysis.ipynb` | Notebook that rebuilds Table 2 and Figure 1 |\n| `figures/` | Figures as PNG and SVG |\n| `demo/` | A short screen recording of a full run |\n\n![Accuracy](figures/accuracy.png)\n",
"results.csv": "model,seed,accuracy,plausible\nBaseline,1,71.0,410\nBaseline,2,71.4,414\n+ Aug.,1,73.8,445\n+ Aug.,2,74.2,449\n+ Pretrain,1,76.0,470\n+ Pretrain,2,76.2,472\nOurs,1,78.7,501\nOurs,2,79.1,505\n",
"figures/pipeline.svg": '<svg xmlns="http://www.w3.org/2000/svg" width="640" height="200" viewBox="0 0 640 200" font-family="Inter, Arial, sans-serif" font-size="14"><rect width="640" height="200" fill="#ffffff"/><g fill="#eef6f4" stroke="#1f6f66" stroke-width="1.5"><rect x="20" y="70" width="150" height="60" rx="8"/><rect x="245" y="70" width="150" height="60" rx="8"/><rect x="470" y="70" width="150" height="60" rx="8"/></g><g fill="#1b1a18" text-anchor="middle"><text x="95" y="105">Mine histories</text><text x="320" y="105">Pretrain on edits</text><text x="545" y="105">Rank patches</text></g><g stroke="#6f6a61" stroke-width="1.5" marker-end="url(#a)"><line x1="172" y1="100" x2="240" y2="100"/><line x1="397" y1="100" x2="465" y2="100"/></g><defs><marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0 0L10 5L0 10z" fill="#6f6a61"/></marker></defs></svg>\n',
@@ -495,7 +548,8 @@ const gallerySize = (name) =>
: name === "data/train.parquet" ? 312 * 1024 * 1024
: Buffer.byteLength(galleryText[name] || "");
const galleryTree = {
"": ["data", "demo", "figures", "logs", "models", "outputs", "README.md", "analysis.ipynb", "paper.pdf", "results.csv"],
"": ["data", "demo", "figures", "logs", "models", "outputs", "tables", "README.md", "analysis.ipynb", "paper.pdf", "results.csv"],
tables: ["README.md", "benchmark-1mb.csv", "per-seed.csv", "redacted.csv", "runs.tsv"],
data: ["train.parquet"],
demo: ["demo.mp4", "demo.webm"],
figures: ["accuracy.png", "pipeline.svg"],
@@ -511,7 +565,7 @@ app.get(`/api/repo/${GALLERY_ID}/options`, (req, res) =>
res.json({ url: null, download: true, lastUpdateDate: ago(5), anonymizedAt: ago(5), sourceCommitDate: ago(6), expirationDate: ahead(90), isAdmin: false, isOwner: false, hasWebsite: false, truncatedFolders: [], hasSubmodules: false })
);
app.get(`/api/repo/${GALLERY_ID}/files/counts`, (req, res) =>
res.json({ "": 13, data: 1, demo: 2, figures: 2, logs: 1, models: 1, outputs: 0 })
res.json({ "": 18, data: 1, demo: 2, figures: 2, logs: 1, models: 1, outputs: 0, tables: 5 })
);
app.get(`/api/repo/${GALLERY_ID}/files`, (req, res) => res.json(galleryFiles(req.query.path || "")));
app.get(`/api/repo/${GALLERY_ID}/file/{*rest}`, (req, res) => {
@@ -541,6 +595,7 @@ const sourceText = {
"src/jsmith-utils/io.js": "// Helpers shared by the evaluation scripts. Author: Jane Smith <jane.smith@csail.mit.edu>\nconst fs = require(\"fs\");\n\n/** Reads one JSON object per line. */\nfunction readJsonLines(path) {\n return fs.readFileSync(path, \"utf8\").split(\"\\n\").filter(Boolean).map((line) => JSON.parse(line));\n}\n\nmodule.exports = { readJsonLines, lab: \"MIT CSAIL\" };\n",
"paper/main.tex": "\\documentclass{article}\n\\title{Learning Robust Repair Strategies from Developer Histories}\n\\author{Jane Smith \\\\ MIT CSAIL}\n\n\\begin{document}\n\\maketitle\n\n\\section{Introduction}\nWe build on our earlier work~\\cite{smith2024repair}, done at MIT CSAIL.\n\n\\bibliographystyle{plain}\n\\bibliography{refs}\n\\end{document}\n",
"paper/refs.bib": "@inproceedings{smith2024repair,\n title = {Repairing Programs with Developer Histories},\n author = {Jane Smith and Ana Lopez},\n booktitle = {Proceedings of ICSE},\n year = {2024},\n note = {MIT CSAIL}\n}\n",
"results/per-seed.csv": "model,seed,accuracy,run_by\nBaseline,1,71.0,Jane Smith\nBaseline,2,71.4,Jane Smith\n+ Aug.,1,73.8,jsmith\n+ Aug.,2,74.2,jsmith\nOurs,1,78.7,MIT CSAIL\nOurs,2,79.1,MIT CSAIL\n",
"configs/base.yaml": "# Base configuration (Jane Smith)\ndata: data/train.jsonl\nmodel: transformer-small\nseed: 1\noutput: /home/jsmith/out\n",
"requirements.txt": "torch>=2.3\nnumpy\npyyaml\n",
LICENSE: "MIT License\n\nCopyright (c) 2026 Jane Smith\n",
@@ -1623,7 +1678,7 @@ const formatsGist = {
anonymizeDate: ago(2), isPublic: true, description: "Replication files for the XXXX-1 artifact, one of each format",
ownerLogin: "XXXX-3", creationDate: ago(12), updatedDate: ago(2),
files: [
{ filename: "README.md", language: "Markdown", type: "text/markdown", size: 320, content: "# Replication files\n\nOne file of each kind the reviewer page renders, prepared by XXXX-1.\n\n## Contents\n\n- `results.csv`: the per-seed table\n- `analysis.ipynb`: the notebook behind Figure 1\n\n## Contact\n\nThrough the conference system.\n" },
{ filename: "README.md", language: "Markdown", type: "text/markdown", size: 320, content: "# Replication files\n\nOne file of each kind the reviewer page renders, prepared by XXXX-1.\n\n## Contents\n\n- `results.csv`: the per-seed table\n- `analysis.ipynb`: the notebook behind Figure 1\n\n## Results\n\n| Model | Accuracy | Plausible |\n| --- | ---: | ---: |\n| Baseline | 71.2 | 412 |\n| + Aug. | 74.0 | 447 |\n| + Pretrain | 76.1 | 471 |\n| Ours | 78.9 | 503 |\n\n## Contact\n\nThrough the conference system.\n" },
{ filename: "results.csv", language: "CSV", type: "text/csv", size: galleryText["results.csv"].length, content: galleryText["results.csv"].replace("Baseline,1", "XXXX-2 baseline,1") },
{ filename: "analysis.ipynb", language: "Jupyter Notebook", type: "application/x-ipynb+json", size: galleryNotebook.length, content: galleryNotebook },
{ filename: "train.py", language: "Python", type: "application/x-python", size: 160, content: "# Copyright 2026 XXXX-1\nimport argparse\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--seed\", type=int, default=1)\n print(parser.parse_args())\n" },
+1 -1
View File
@@ -32,7 +32,7 @@ function harness(date) {
context.nextTick = fn => Promise.resolve().then(fn);
context.window.document = context.document;
// Modules the controllers import: outline helpers, the diff parser and the reviewer pages.
for (const name of ["outline.js", "formatters.js", "review-pages.js"]) {
for (const name of ["outline.js", "formatters.js", "table-analysis.js", "review-pages.js"]) {
const moduleSource = fs.readFileSync(path.join(__dirname, "../public/script", name), "utf8");
vm.runInNewContext(moduleSource.replace(/^import .*;$/gm, "").replace(/export function/g, "function").replace(/export const/g, "var"), context);
}
+259
View File
@@ -0,0 +1,259 @@
const { expect } = require("chai");
const { JSDOM } = require("jsdom");
const path = require("path");
const { pathToFileURL } = require("url");
const load = (name) => import(pathToFileURL(path.join(__dirname, "../public/script", name)).href);
describe("Table analysis", function () {
let T, chart, formatters;
before(async () => {
T = await load("table-analysis.js");
chart = await load("table-chart.js");
formatters = await load("formatters.js");
});
const table = (text, sep = ",") => T.analyzeTable(formatters.parseDelimited(text, sep));
const all = (t) => [...Array(t.size).keys()];
const RESULTS = "model,seed,accuracy,plausible\nBaseline,1,71.0,410\nBaseline,2,71.4,414\n+ Aug.,1,73.8,445\n+ Aug.,2,74.2,449\nOurs,1,78.7,501\nOurs,2,79.1,\n";
describe("numeric parsing", () => {
it("reads grouped thousands, percents, exponents, signs and the Unicode minus", () => {
expect(["1,234", "12%", "1e-3", "-0.5", "+3", "−2", ".5", " 7 ", "1,234.5"].map(T.parseNumber)).to.deep.equal([1234, 12, 0.001, -0.5, 3, -2, 0.5, 7, 1234.5]);
});
it("rejects text, misplaced separators and bare signs", () => {
expect(["1,2", "12,34", "abc", "-", "", "1.2.3", "0x10", "Infinity", "12 %"].map(T.parseNumber)).to.deep.equal([null, null, null, null, null, null, null, null, null]);
});
it("counts decimals as written, including exponents", () => {
expect(["78.90", "1e-3", "1.38e-3", "12", "2.5e2", "0.3"].map(T.decimalsOf)).to.deep.equal([2, 3, 5, 0, 0, 1]);
});
});
describe("type detection", () => {
it("detects numbers, dates and text, ignoring empty and NA cells", () => {
expect(T.detectType(["1", "2.5", "", "NA", "1,000"])).to.equal("number");
expect(T.detectType(["2026-03-01", "2026-03-02T10:00Z", "", "Mar 3, 2026"])).to.equal("date");
expect(T.detectType(["Baseline", "12"])).to.equal("text");
expect(T.detectType(["03/01/2026", "04/01/2026"])).to.equal("text");
expect(T.detectType(["", ""])).to.equal("text");
});
it("keeps a column's precision, unit and scientific notation", () => {
const t = table("a,b,c,d\n1,12%,1.38e-3,x\n2.25,8%,2.1e-4,y\n");
expect(t.columns.map((c) => [c.type, c.decimals, c.unit])).to.deep.equal([["number", 2, ""], ["number", 0, "%"], ["number", 5, ""], ["text", 0, ""]]);
expect(t.columns[2].scientific).to.equal(2);
expect(T.summarize(t.columns[2], all(t), "mean").text).to.equal("7.950e-4");
expect(T.summarize(t.columns[1], all(t), "mean").text).to.equal("10.0%");
});
it("parses unambiguous dates only", () => {
expect(T.parseDate("2026-03-01")).to.equal(Date.UTC(2026, 2, 1));
expect(T.parseDate("2026/3/1 10:30")).to.equal(Date.UTC(2026, 2, 1, 10, 30));
expect(T.parseDate("1 March 2026")).to.equal(Date.UTC(2026, 2, 1));
expect(T.parseDate("2026-13-01")).to.equal(null);
expect(T.parseDate("03/01/2026")).to.equal(null);
});
});
describe("aggregates", () => {
const keys = [3, null, 1, 4, 1, 5];
const rows = [0, 1, 2, 3, 4, 5];
it("skips empty cells", () => {
expect(T.aggregate(keys, rows, "count")).to.equal(5);
expect(T.aggregate(keys, rows, "sum")).to.equal(14);
expect(T.aggregate(keys, rows, "mean")).to.equal(2.8);
expect(T.aggregate(keys, rows, "min")).to.equal(1);
expect(T.aggregate(keys, rows, "max")).to.equal(5);
});
it("computes the median for odd and even counts", () => {
expect(T.aggregate(keys, rows, "median")).to.equal(3);
expect(T.aggregate([4, 1, 3, 2], [0, 1, 2, 3], "median")).to.equal(2.5);
});
it("uses the sample standard deviation and needs two values", () => {
expect(T.aggregate([2, 4, 4, 4, 5, 5, 7, 9], [0, 1, 2, 3, 4, 5, 6, 7], "std")).to.be.closeTo(2.138, 1e-3);
expect(T.aggregate([5, null], [0, 1], "std")).to.equal(null);
expect(T.aggregate([null], [0], "mean")).to.equal(null);
expect(T.aggregate([null], [0], "count")).to.equal(0);
});
it("formats a summary with the column's precision, over the given rows only", () => {
const t = table(RESULTS);
expect(T.summarize(t.columns[2], all(t), "mean").text).to.equal("74.7");
expect(T.summarize(t.columns[2], [0, 1], "mean").text).to.equal("71.2");
expect(T.summarize(t.columns[3], all(t), "mean").text).to.equal("443.8");
expect(T.summarize(t.columns[3], all(t), "count").text).to.equal("5");
expect(T.summarize(t.columns[3], all(t), "sum").text).to.equal("2,219");
// Text columns count distinct values; identifier columns stay empty.
expect(T.summarize(t.columns[0], all(t)).text).to.equal("3 distinct");
expect(T.summarize(t.columns[1], all(t), "mean").kind).to.equal("none");
expect(T.summarize(t.columns[1], all(t), "mean", () => true).text).to.equal("1.5");
});
});
describe("identifier columns", () => {
const ids = (text) => table(text).columns.map((c) => c.identifier);
it("recognizes seed, id, run, fold, index and year by name", () => {
expect(ids("seed,run_id,fold,index,year,Trial,accuracy\n1,10,0,5,2024,3,71.2\n2,11,1,6,2025,4,71.4\n")).to.deep.equal([true, true, true, true, true, true, false]);
expect(ids("modelId,seeds,n_runs\n4,1,7\n9,2,8\n")).to.deep.equal([true, true, true]);
});
it("recognizes small consecutive whole numbers that repeat across rows", () => {
expect(ids("k,v\n1,5\n2,9\n3,4\n1,7\n2,2\n3,1\n")).to.deep.equal([true, false]);
expect(ids("k\n0\n1\n0\n1\n")).to.deep.equal([true]);
});
it("leaves measures alone: decimals, percents, gaps, big ranges, negatives, unique values", () => {
expect(ids("a,b,c,d,e\n1.0,1%,1,410,-1\n2.0,2%,3,414,0\n1.0,1%,1,445,-1\n2.0,2%,3,449,0\n")).to.deep.equal([false, false, false, false, false]);
expect(ids("epochs,plausible\n10,410\n20,414\n")).to.deep.equal([false, false]);
expect(ids("seed,name\nx,y\n")).to.deep.equal([false, false]);
expect(ids("seed\n1.5\n2.5\n")).to.deep.equal([false]);
});
});
describe("sorting", () => {
it("sorts numbers numerically and keeps empty cells last in both directions", () => {
const t = table("k,v\na,10\nb,\nc,9\nd,-1\ne,1e1\n");
expect(T.sortIndices(t, all(t), 1, "asc")).to.deep.equal([3, 2, 0, 4, 1]);
expect(T.sortIndices(t, all(t), 1, "desc")).to.deep.equal([0, 4, 2, 3, 1]);
});
it("is stable: ties keep their current order", () => {
const t = table(RESULTS);
expect(T.sortIndices(t, all(t), 0, "asc")).to.deep.equal([2, 3, 0, 1, 4, 5]);
const bySeed = T.sortIndices(t, all(t), 1, "desc");
expect(bySeed).to.deep.equal([1, 3, 5, 0, 2, 4]);
expect(T.sortIndices(t, bySeed, 0, "asc")).to.deep.equal([3, 2, 1, 0, 5, 4]);
});
it("sorts text naturally and dates chronologically", () => {
const t = table("name,date\nrun 10,Mar 3 2026\nrun 2,2026-03-01\nRun 1,2026-02-28\n");
expect(T.sortIndices(t, all(t), 0, "asc")).to.deep.equal([2, 1, 0]);
expect(t.columns[1].type).to.equal("date");
expect(T.sortIndices(t, all(t), 1, "desc")).to.deep.equal([0, 1, 2]);
const d = table("date\n2026-03-10\n2026-02-28\n2026-03-01\n");
expect(T.sortIndices(d, all(d), 0, "asc")).to.deep.equal([1, 2, 0]);
});
});
describe("filtering", () => {
it("combines the search box, numeric ranges and value sets", () => {
const t = table(RESULTS);
expect(T.filterIndices(t, { query: "aug" })).to.deep.equal([2, 3]);
expect(T.filterIndices(t, { ranges: { 2: [74, null] } })).to.deep.equal([3, 4, 5]);
expect(T.filterIndices(t, { ranges: { 3: [null, 450] } })).to.deep.equal([0, 1, 2, 3]);
expect(T.filterIndices(t, { values: { 0: ["Ours", "Baseline"] }, ranges: { 1: [2, 2] } })).to.deep.equal([1, 5]);
});
});
describe("grouping", () => {
it("reproduces the mean per model over seeds", () => {
const t = table(RESULTS);
const g = T.groupTable(t, all(t), 0, "mean");
expect(g.header).to.deep.equal(["model", "Rows", "accuracy", "plausible"]);
expect(g.body).to.deep.equal([["Baseline", "2", "71.2", "412.0"], ["+ Aug.", "2", "74.0", "447.0"], ["Ours", "2", "78.9", "501.0"]]);
// "Treat as number" brings the seed back.
expect(T.groupTable(t, all(t), 0, "mean", () => true).header).to.deep.equal(["model", "Rows", "seed", "accuracy", "plausible"]);
expect(g.columns[2].agg).to.equal("mean");
expect(g.columns[2].keys[0]).to.be.closeTo(71.2, 1e-9);
});
it("groups only the filtered rows and can be sorted, counted and exported", () => {
const t = table(RESULTS);
const g = T.groupTable(t, T.filterIndices(t, { ranges: { 1: [1, 1] } }), 0, "max");
expect(g.body.map((r) => r[0])).to.deep.equal(["Baseline", "+ Aug.", "Ours"]);
const order = T.sortIndices(g, [0, 1, 2], 2, "desc");
expect(order.map((i) => g.body[i][0])).to.deep.equal(["Ours", "+ Aug.", "Baseline"]);
expect(T.toMarkdown(g.header, order.map((i) => g.body[i]), g.columns.map((c) => c.type === "number")).split("\n")[1]).to.equal("| --- | ---: | ---: | ---: |");
});
it("labels empty groups", () => {
const t = table("k,v\na,1\n,2\na,3\n");
expect(T.groupTable(t, all(t), 0, "sum").body).to.deep.equal([["a", "2", "4"], ["(empty)", "1", "2"]]);
});
it("keeps 'none', 'NA' and '-' as categories in text columns", () => {
const t = table("augmentation,acc\nnone,1\nflip,2\nnone,3\nNA,4\n-,5\n,6\n");
expect(t.columns[0].type).to.equal("text");
expect(t.columns[0].empty).to.equal(1);
expect(T.groupTable(t, all(t), 0, "sum").body.map((r) => r[0])).to.deep.equal(["none", "flip", "NA", "-", "(empty)"]);
// In a number column they still mean "no value".
expect(table("v\n1\nNA\n-\n3\n").columns[0]).to.include({ type: "number", empty: 2 });
});
});
describe("export", () => {
it("quotes CSV cells only when needed and escapes Markdown pipes", () => {
expect(T.toDelimited(["a", "b"], [["x,y", 'say "hi"'], ["plain", ""]])).to.equal('a,b\n"x,y","say ""hi"""\nplain,\n');
expect(T.toMarkdown(["a|b"], [["c|d"]])).to.equal("| a\\|b |\n| --- |\n| c\\|d |\n");
});
});
describe("shareable state", () => {
it("round-trips through the fragment and stays empty by default", () => {
expect(T.writeHashState("table", T.DEFAULT_STATE)).to.equal("");
const state = { ...T.DEFAULT_STATE, view: "chart", group: "model", agg: "median", sort: { column: "accuracy", dir: "desc" }, values: { model: ["Ours", "+ Aug."] }, ranges: { accuracy: [70, null] }, sums: { accuracy: "std" }, chart: "bar", y: ["accuracy", "plausible"] };
const hash = T.writeHashState("table-2", state);
expect(hash).to.match(/^#table-2:view=chart&sort=accuracy:desc&group=model&agg=median/);
const back = T.readHashState(hash, "table-2");
expect(back).to.deep.include({ view: "chart", group: "model", agg: "median", chart: "bar" });
expect(back.sort).to.deep.equal({ column: "accuracy", dir: "desc" });
expect(back.values).to.deep.equal({ model: ["Ours", "+ Aug."] });
expect(back.ranges).to.deep.equal({ accuracy: [70, null] });
expect(back.y).to.deep.equal(["accuracy", "plausible"]);
expect(T.readHashState(hash, "table")).to.equal(null);
expect(T.readHashState("#L12", "table")).to.equal(null);
expect(T.isTableHash("#L12")).to.equal(false);
});
});
describe("column stats and charts", () => {
it("summarizes a column with a histogram", () => {
const t = table(RESULTS);
const s = T.columnStats(t.columns[3], all(t), 4);
expect(s).to.include({ type: "number", count: 5, empty: 1, distinct: 5, min: 410, max: 501 });
expect(s.histogram.map((b) => b.count)).to.deep.equal([2, 2, 0, 1]);
expect(T.columnStats(t.columns[0], all(t)).top[0]).to.deep.equal(["+ Aug.", 2]);
});
it("defaults to a bar of the first measure by the first text column, skipping seeds", () => {
const t = table(RESULTS);
expect(chart.defaultChart(t, false)).to.deep.equal({ type: "bar", x: "model", y: ["accuracy"] });
const g = T.groupTable(t, all(t), 0, "mean");
expect(chart.defaultChart(g, true)).to.deep.equal({ type: "bar", x: "model", y: ["accuracy"] });
});
it("averages repeated categories in a bar chart and says so", () => {
const t = table(RESULTS);
const c = chart.buildChart(t, all(t), { type: "bar", x: "model", y: ["accuracy"], agg: "mean" }, { width: 600 });
expect(c.categories.map((x) => x.label)).to.deep.equal(["Baseline", "+ Aug.", "Ours"]);
expect(c.categories[2].tip.rows[0].value).to.equal("78.9");
expect(c.notes[0]).to.equal("Average per model over 6 rows.");
expect(c.marks.every((m) => m.h <= 24)).to.equal(true);
});
it("draws lines on a date axis in order and scatter points with their rows", () => {
const t = table("date\tv\n2026-03-03\t3\n2026-03-01\t1\n2026-03-02\t2\n", "\t");
const line = chart.buildChart(t, all(t), { type: "line", x: "date", y: ["v"] }, { width: 600 });
expect(line.points.map((p) => p.title)).to.deep.equal(["date 2026-03-01", "date 2026-03-02", "date 2026-03-03"]);
expect(line.series[0].path.startsWith("M")).to.equal(true);
const scatter = chart.buildChart(t, all(t), { type: "scatter", x: "v", y: ["v"] }, { width: 600 });
expect(scatter.series[0].dots).to.have.length(3);
// An ID-like text x column is refused instead of measuring every label.
const ids = table("id,v\n" + Array.from({ length: 200000 }, (_, i) => `row-${i},${i % 7}`).join("\n"));
const many = chart.buildChart(ids, all(ids), { type: "scatter", x: "id", y: ["v"] }, { width: 600 });
expect(many.empty).to.match(/200,000 different values/);
});
it("explains an empty chart", () => {
const t = table(RESULTS);
expect(chart.buildChart(t, [], { type: "bar", x: "model", y: ["accuracy"] }, { width: 600 }).empty).to.match(/No rows/);
expect(chart.buildChart(t, all(t), { type: "bar", x: "model", y: [] }, { width: 600 }).empty).to.match(/numeric/);
});
it("picks round ticks", () => {
expect(chart.niceTicks(0, 79.1, 5).ticks).to.deep.equal([0, 20, 40, 60, 80]);
expect(chart.tickLabel(25000, 5000)).to.equal("25K");
expect(chart.tickLabel(0.775, 0.025)).to.equal("0.775");
});
});
describe("Markdown and notebook tables", () => {
let dom;
before(() => { dom = new JSDOM("<!doctype html><body></body>"); global.window = dom.window; });
after(() => { delete global.window; dom.window.close(); });
it("reads redaction chips and slots back as XXXX-n and the pandas header rows", async () => {
const enhance = await load("table-enhance.js");
const doc = dom.window.document;
doc.body.innerHTML = '<table class="dataframe"><thead><tr><th></th><th>acc</th></tr><tr><th>model</th><th></th></tr></thead><tbody>'
+ '<tr><th>Ours</th><td>78.9</td></tr><tr><th><mark class="redact-chip" data-term="XXXX-2"><i>2</i></mark></th><td>71.2</td></tr></tbody></table>';
const data = enhance.tableData(doc.querySelector("table"));
expect(data.rows).to.deep.equal([["model", "acc"], ["Ours", "78.9"], ["XXXX-2", "71.2"]]);
doc.body.innerHTML = '<table><tr><td colspan="2">x</td></tr><tr><td>1</td><td>2</td></tr></table>';
expect(enhance.tableData(doc.querySelector("table"))).to.equal(null);
});
});
});
+124 -1
View File
@@ -3131,11 +3131,134 @@ describe("Vue 3 UI", function () {
expect(doc.querySelector(".page-toc .toc-heading")).to.equal(null);
preview.click(); await delay(60);
expect(body(0).querySelector("markdown h1")).to.not.equal(null);
doc.querySelectorAll(".gist-file-card")[1].querySelectorAll(".gist-view-toggle .seg-chip")[1].click(); await delay(40);
// CSV: Table, Chart and Source.
const csvChips = () => doc.querySelectorAll(".gist-file-card")[1].querySelectorAll(".gist-view-toggle .seg-chip");
expect([...csvChips()].map((c) => c.textContent)).to.deep.equal(["Table", "Chart", "Source"]);
csvChips()[1].click(); await delay(40);
expect(body(1).querySelector(".dt-chart")).to.not.equal(null);
expect(body(1).querySelector(".csv-table")).to.equal(null);
csvChips()[2].click(); await delay(40);
expect(body(1).querySelector(".csv-table")).to.equal(null);
expect(body(1).querySelector("pre code").textContent).to.equal(files[1].content);
expect(ui.errors).to.deep.equal([]);
});
describe("table analysis", function () {
const CSV = "model,seed,accuracy\nBaseline,1,71.0\nBaseline,2,71.4\nOurs,1,78.7\nOurs,2,79.1\nXXXX-2,1,\n";
const open = async (hash = "") => {
const page = await browser("/r/test/results.csv" + hash, {
"/api/repo/test/files/": [{ name: "results.csv", path: "", sha: "1", size: CSV.length }],
"/api/repo/test/file/results.csv": CSV,
});
await delay(120);
return page;
};
const cells = (doc, col) => [...doc.querySelectorAll(".dt-table tbody tr")].map((tr) => tr.cells[col].textContent);
const sortButton = (doc, name) => [...doc.querySelectorAll(".dt-sort")].find((b) => b.textContent.trim() === name);
it("sorts by a header, shows the summary row and keeps redaction slots", async function () {
ui = await open();
const doc = ui.window.document;
expect(cells(doc, 1)).to.deep.equal(["Baseline", "Baseline", "Ours", "Ours", "2"]);
expect(doc.querySelector(".dt-table tbody .redact-slot").textContent).to.equal("2");
// Σ, distinct count for text, nothing for the seed (an identifier), "Avg ▾ value" per measure.
const cellsOf = () => [...doc.querySelectorAll(".dt-summary td")];
expect(cellsOf()[0].textContent.trim()).to.match(/^Σ/);
expect(cellsOf()[1].textContent.trim()).to.equal("3 distinct");
expect(cellsOf()[2].textContent.trim()).to.equal("");
expect(doc.querySelectorAll(".dt-summary select")).to.have.length(1);
expect(doc.querySelector(".dt-sum-fn-label").textContent).to.equal("Avg");
const foot = () => [...doc.querySelectorAll(".dt-sum-value")].map((b) => b.textContent);
expect(foot()).to.deep.equal(["75.1"]);
sortButton(doc, "accuracy").click(); await delay(30);
expect(cells(doc, 3)).to.deep.equal(["71.0", "71.4", "78.7", "79.1", ""]);
sortButton(doc, "accuracy").click(); await delay(30);
expect(cells(doc, 3)).to.deep.equal(["79.1", "78.7", "71.4", "71.0", ""]);
expect(doc.querySelector("th[aria-sort=descending]").textContent).to.contain("accuracy");
sortButton(doc, "accuracy").click(); await delay(30);
expect(cells(doc, 3)).to.deep.equal(["71.0", "71.4", "78.7", "79.1", ""]);
expect(doc.querySelector("th[aria-sort=ascending], th[aria-sort=descending]")).to.equal(null);
const select = doc.querySelector(".dt-summary select");
select.value = "max"; select.dispatchEvent(new ui.window.Event("change")); await delay(30);
expect(foot()).to.deep.equal(["79.1"]);
expect(doc.querySelector(".dt-sum-fn-label").textContent).to.equal("Max");
expect(ui.errors).to.deep.equal([]);
});
it("filters rows, groups them and stores the view in the link", async function () {
ui = await open();
const doc = ui.window.document;
await ui.input(".dt-search-input", "ours");
expect(cells(doc, 1)).to.deep.equal(["Ours", "Ours"]);
expect(doc.querySelector(".dt-count").textContent).to.equal("2 of 5 rows");
expect([...doc.querySelectorAll(".dt-sum-value")].at(-1).textContent).to.equal("78.9");
await ui.input(".dt-search-input", "");
const group = doc.querySelector(".dt-tools .dt-select select");
group.value = "model"; group.dispatchEvent(new ui.window.Event("change")); await delay(30);
expect(cells(doc, 0)).to.deep.equal(["Baseline", "Ours", "2"]);
expect(doc.querySelector(".dt-table tbody tr:last-child .redact-slot")).to.not.equal(null);
expect(cells(doc, 2)).to.deep.equal(["71.2", "78.9", "—"]);
expect(doc.querySelector(".dt-count").textContent).to.equal("3 groups · 5 rows");
await delay(300);
expect(ui.window.location.hash).to.equal("#table:group=model");
expect(ui.errors).to.deep.equal([]);
});
it("opens a shared link on the grouped chart, with a tooltip on hover", async function () {
ui = await open("#table:view=chart&group=model");
const doc = ui.window.document;
expect(doc.querySelector(".csv-toggle .seg-chip.active").textContent).to.equal("Chart");
// jsdom has no layout: give the chart a width.
Object.defineProperty(ui.window.HTMLElement.prototype, "clientWidth", { configurable: true, get() { return this.classList.contains("dt-chart") ? 600 : 0; } });
doc.querySelector(".csv-toggle .seg-chip").click(); await delay(30);
doc.querySelectorAll(".csv-toggle .seg-chip")[1].click(); await delay(60);
const svg = doc.querySelector(".dt-svg");
expect(svg.getAttribute("aria-label")).to.equal("Bar chart of accuracy by model");
expect([...doc.querySelectorAll(".dt-cat")].map((t) => t.textContent)).to.deep.equal(["Baseline", "Ours", "XXXX-2"]);
svg.dispatchEvent(new ui.window.KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true })); await delay(30);
expect(doc.querySelector(".dt-tip b").textContent).to.equal("71.2");
expect(doc.querySelector(".dt-tip-title").textContent).to.equal("Baseline");
delete ui.window.HTMLElement.prototype.clientWidth;
expect(ui.errors).to.deep.equal([]);
});
it("copies the current view as Markdown", async function () {
ui = await open("#table:group=model&sort=accuracy:desc");
const copied = [];
Object.defineProperty(ui.window.navigator, "clipboard", { value: { writeText: async (text) => copied.push(text) }, configurable: true });
const doc = ui.window.document;
doc.querySelector(".dt-copy-btn").click(); await delay(20);
[...doc.querySelectorAll(".dt-copy-menu button")].find((b) => /Markdown/.test(b.textContent)).click(); await delay(30);
expect(copied[0].split("\n").slice(0, 4)).to.deep.equal(["| model | Rows | accuracy |", "| --- | ---: | ---: |", "| Ours | 2 | 78.9 |", "| Baseline | 2 | 71.2 |"]);
expect(ui.errors).to.deep.equal([]);
});
it("sorts a Markdown table, adds a summary row and opens it as a table", async function () {
const md = "# Results\n\n| Model | Accuracy |\n| --- | ---: |\n| Baseline | 71.2 |\n| XXXX-3 | 77.5 |\n| Ours | 78.9 |\n";
ui = await browser("/r/test/README.md", {
"/api/repo/test/files/": [{ name: "README.md", path: "", sha: "1", size: md.length }],
"/api/repo/test/file/README.md": md,
});
await delay(200);
const doc = ui.window.document;
const table = doc.querySelector(".markdown-body table");
expect(table.closest(".md-table")).to.not.equal(null);
const firstCol = () => [...table.querySelectorAll("tbody tr")].map((tr) => tr.cells[0].textContent.trim());
table.querySelectorAll("th")[1].click(); table.querySelectorAll("th")[1].click(); await delay(20);
expect(firstCol()).to.deep.equal(["Ours", "3", "Baseline"]);
expect(table.querySelector("tbody .redact-chip, tbody .redact-slot")).to.not.equal(null);
doc.querySelector(".md-sigma").click(); await delay(20);
expect(table.querySelector("tfoot td").textContent).to.match(/^Σ/);
expect(table.querySelector("tfoot .dt-sum-fn-label").textContent).to.equal("Avg");
expect(table.querySelector("tfoot .dt-sum-value").textContent).to.equal("75.9");
doc.querySelector(".md-open").click(); await delay(60);
const dialog = doc.querySelector(".dt-dialog");
expect(dialog.querySelector(".dt-dialog-title").textContent).to.equal("Table · Results");
expect([...dialog.querySelectorAll(".dt-table tbody tr")].map((tr) => tr.cells[1].textContent)).to.deep.equal(["Baseline", "3", "Ours"]);
dialog.querySelector(".dt-dialog-close").click(); await delay(20);
expect(doc.querySelector(".dt-dialog")).to.equal(null);
expect(ui.errors).to.deep.equal([]);
});
});
describe("workspace polish (r19)", () => {
it("keeps the dashboard tabs and counts rendered while a tab reloads", async () => {