margin-api 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {margin_api-0.1.2 → margin_api-0.1.3}/.gitignore +3 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/CHANGELOG.md +18 -1
- {margin_api-0.1.2 → margin_api-0.1.3}/PKG-INFO +1 -1
- {margin_api-0.1.2 → margin_api-0.1.3}/pyproject.toml +1 -1
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/__init__.py +1 -1
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/app.py +10 -1
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/files.py +6 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/jobs.py +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/DetectorIntro-CZqT1q7b.css +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/DetectorIntro-oYcans9E.js +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/DetectorResult-Bl7coSts.js +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/DetectorResult-C4-rIW-m.css +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/HistoryResult-DQAIY3S5.js +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/HistoryResult-H34WYgcB.css +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/StorytellerResult-B16gafwk.css +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/StorytellerResult-CZQJD__F.js +1 -0
- margin_api-0.1.3/src/margin_api/ui/assets/index-B3Snzalk.js +12 -0
- margin_api-0.1.3/src/margin_api/ui/assets/index-DjLxjAZZ.css +1 -0
- margin_api-0.1.2/src/margin_api/ui/fonts/OFL-fraunces.txt → margin_api-0.1.3/src/margin_api/ui/fonts/OFL-archivo.txt +1 -1
- margin_api-0.1.2/src/margin_api/ui/fonts/OFL-instrument-sans.txt → margin_api-0.1.3/src/margin_api/ui/fonts/OFL-newsreader.txt +3 -3
- margin_api-0.1.3/src/margin_api/ui/fonts/archivo-latin-ext.woff2 +0 -0
- margin_api-0.1.3/src/margin_api/ui/fonts/archivo-latin.woff2 +0 -0
- margin_api-0.1.3/src/margin_api/ui/fonts/newsreader-italic-latin-ext.woff2 +0 -0
- margin_api-0.1.3/src/margin_api/ui/fonts/newsreader-italic-latin.woff2 +0 -0
- margin_api-0.1.3/src/margin_api/ui/fonts/newsreader-latin-ext.woff2 +0 -0
- margin_api-0.1.3/src/margin_api/ui/fonts/newsreader-latin.woff2 +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/ui/index.html +2 -2
- margin_api-0.1.3/src/margin_api/ui/mark.svg +1 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/tests/test_api.py +16 -0
- margin_api-0.1.2/src/margin_api/ui/assets/index-9-YUxWG8.css +0 -1
- margin_api-0.1.2/src/margin_api/ui/assets/index-DZlrymYA.js +0 -11
- margin_api-0.1.2/src/margin_api/ui/fonts/fraunces-latin-ext.woff2 +0 -0
- margin_api-0.1.2/src/margin_api/ui/fonts/fraunces-latin.woff2 +0 -0
- margin_api-0.1.2/src/margin_api/ui/fonts/instrument-sans-latin-ext.woff2 +0 -0
- margin_api-0.1.2/src/margin_api/ui/fonts/instrument-sans-latin.woff2 +0 -0
- margin_api-0.1.2/src/margin_api/ui/mark.svg +0 -1
- {margin_api-0.1.2 → margin_api-0.1.3}/LICENSE +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/README.md +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/llm_settings.py +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/main.py +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/py.typed +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/settings.py +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/ui/fonts/OFL-jetbrains-mono.txt +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/ui/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- {margin_api-0.1.2 → margin_api-0.1.3}/src/margin_api/ui/fonts/jetbrains-mono-latin.woff2 +0 -0
|
@@ -4,7 +4,24 @@ All notable changes to this package are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
-
## [
|
|
7
|
+
## [0.1.3] - 2026-11-20
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `RunView.input`: the input as the caller sent it, without the run's own output folder.
|
|
11
|
+
Sending it again repeats the run; the web UI uses it for "Run again".
|
|
12
|
+
- The bundled web UI names each browser tab after its page; a run's tab shows its progress or
|
|
13
|
+
that it needs an answer.
|
|
14
|
+
- The bundled web UI has a view for the Commit Graph agent: the history drawn as a tree with
|
|
15
|
+
notes in the margin, a replay slider, chapters, and findings or a file lit up on the tree.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- The bundled web UI is redesigned around a ruled margin: notes on the left, content on the
|
|
19
|
+
right, red for what was flagged and blue for what was checked.
|
|
20
|
+
- Result views load only when first shown.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- An upload named after a Windows device, such as `NUL` or `con.csv`, gets a `_` in front, so
|
|
24
|
+
Windows saves it as a file instead of throwing it away.
|
|
8
25
|
|
|
9
26
|
## [0.1.2] - 2026-11-02
|
|
10
27
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: margin-api
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: margin's HTTP API and web UI: run agents in the background, follow them live, read their evidence.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Waddah0-0/margin
|
|
6
6
|
Project-URL: Source, https://github.com/Waddah0-0/margin/tree/main/packages/api
|
|
@@ -90,6 +90,11 @@ class RunView(BaseModel):
|
|
|
90
90
|
default_factory=list,
|
|
91
91
|
description="Files the run wrote to its own folder; download from /runs/{id}/files/{name}.",
|
|
92
92
|
)
|
|
93
|
+
input: dict[str, Any] = Field(
|
|
94
|
+
default_factory=dict,
|
|
95
|
+
description="The input as the caller sent it, without the run's own output folder. "
|
|
96
|
+
"Send it again to repeat the run.",
|
|
97
|
+
)
|
|
93
98
|
|
|
94
99
|
|
|
95
100
|
class Upload(BaseModel):
|
|
@@ -281,6 +286,7 @@ def create_app(
|
|
|
281
286
|
finished_at=run.finished_at, result=run.result,
|
|
282
287
|
llm=llm, question=run.question, last_event=run.last_event,
|
|
283
288
|
files=store.run_files(run.id) if run.status == "done" else [],
|
|
289
|
+
input=run.input,
|
|
284
290
|
) # fmt: skip
|
|
285
291
|
|
|
286
292
|
@app.get("/health", tags=["meta"])
|
|
@@ -315,9 +321,11 @@ def create_app(
|
|
|
315
321
|
) -> RunCreated:
|
|
316
322
|
cls = agent_class(agent_id)
|
|
317
323
|
run_id = uuid.uuid4().hex
|
|
324
|
+
output_fields = fields_with_format(cls.InputModel.model_json_schema(), OUTPUT_FORMAT)
|
|
325
|
+
sent = {k: v for k, v in body.items() if k not in output_fields}
|
|
318
326
|
# an output folder is always the run's own, so its files can be downloaded and a caller
|
|
319
327
|
# can't write over files elsewhere on this machine
|
|
320
|
-
for name in
|
|
328
|
+
for name in output_fields:
|
|
321
329
|
if body.get(name) not in (None, ""):
|
|
322
330
|
raise HTTPException(
|
|
323
331
|
422, f"{name} can't be set over HTTP: each run writes to its own folder"
|
|
@@ -337,6 +345,7 @@ def create_app(
|
|
|
337
345
|
raise HTTPException(422, f"Cannot use that model: {exc}") from exc
|
|
338
346
|
logger.warning("No model client for %s: %s", agent_id, exc)
|
|
339
347
|
run = manager.submit(cls, parsed, llm=llm, provider=resolved, run_id=run_id)
|
|
348
|
+
run.input = sent
|
|
340
349
|
return RunCreated(
|
|
341
350
|
run_id=run.id,
|
|
342
351
|
status=run.status,
|
|
@@ -22,6 +22,10 @@ UPLOAD_FORMAT = "file-path" # the UI offers to upload a file and fills in where
|
|
|
22
22
|
OUTPUT_FORMAT = "output-dir" # left empty, the API fills in the run's own folder
|
|
23
23
|
|
|
24
24
|
_UNSAFE = re.compile(r"[^\w.\- ()]+")
|
|
25
|
+
# names Windows keeps for devices: a file called NUL is thrown away as it's written
|
|
26
|
+
_DEVICES = frozenset(
|
|
27
|
+
{"CON", "PRN", "AUX", "NUL", *(f"COM{i}" for i in range(10)), *(f"LPT{i}" for i in range(10))}
|
|
28
|
+
)
|
|
25
29
|
|
|
26
30
|
|
|
27
31
|
class RunFile(BaseModel):
|
|
@@ -33,6 +37,8 @@ def safe_name(name: str) -> str:
|
|
|
33
37
|
"""A file name with no folders and no characters that mean something to a shell or OS."""
|
|
34
38
|
base = re.split(r"[\\/]", name)[-1]
|
|
35
39
|
cleaned = _UNSAFE.sub("_", base).strip(" .")[:120]
|
|
40
|
+
if cleaned.split(".")[0].rstrip().upper() in _DEVICES:
|
|
41
|
+
cleaned = "_" + cleaned
|
|
36
42
|
return cleaned or "upload"
|
|
37
43
|
|
|
38
44
|
|
|
@@ -59,6 +59,7 @@ class Run:
|
|
|
59
59
|
id: str
|
|
60
60
|
agent_id: str
|
|
61
61
|
pool: str
|
|
62
|
+
input: dict[str, Any] = field(default_factory=dict) # as the caller sent it
|
|
62
63
|
status: RunStatus = "queued"
|
|
63
64
|
created_at: datetime = field(default_factory=lambda: datetime.now(UTC))
|
|
64
65
|
started_at: datetime | None = None
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._intro_gl36d_1{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);align-items:start;gap:32px 56px;display:grid}._steps_gl36d_8{counter-reset:step;gap:16px;display:grid}._steps_gl36d_8 li{color:var(--ink-2);counter-increment:step;padding-left:30px;font-size:14.5px;line-height:22px;position:relative}._steps_gl36d_8 li:before{content:counter(step);font-family:var(--font-mono);color:var(--ink-3);font-size:12px;position:absolute;left:0}._steps_gl36d_8 b{color:var(--ink)}._specimen_gl36d_36 figcaption{color:var(--ink-3);margin-top:8px;font-size:12px;line-height:17px}._sheet_gl36d_43{border:1px solid var(--rule-2);border-radius:var(--radius);background:var(--paper-raised);grid-template-columns:minmax(0,1fr) 200px;font-size:12px;line-height:20px;display:grid}._lines_gl36d_53{padding-block:10px;overflow:hidden}._line_gl36d_53{border-left:2px solid #0000;grid-template-columns:40px minmax(0,1fr);display:grid}._line_gl36d_53 span{font-family:var(--font-mono);color:var(--ink-3);text-align:right;padding-right:10px}._line_gl36d_53 code{white-space:pre;font-size:12px}._line_gl36d_53[data-side=for]{border-left-color:var(--red);background:var(--red-tint)}._line_gl36d_53[data-side=against]{border-left-color:var(--blue);background:var(--blue-tint)}._notes_gl36d_86{border-left:1px solid var(--margin-line);color:var(--ink-2);grid-template-rows:repeat(6,20px);margin-block:10px;padding-left:12px;font-size:11.5px;line-height:14px;display:grid}._notes_gl36d_86 p{padding-top:3px}._notes_gl36d_86 b{font-family:var(--font-mono);font-weight:500}._notes_gl36d_86 [data-side=for] b{color:var(--red)}._notes_gl36d_86 [data-side=against] b{color:var(--blue)}._caveat_gl36d_114{max-width:760px;color:var(--ink-2);margin-top:28px;font-size:13.5px}._caveat_gl36d_114 .icon{margin-left:4px}@media (width<=1000px){._intro_gl36d_1{grid-template-columns:minmax(0,1fr)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,f as t,l as n}from"./index-B3Snzalk.js";var r={intro:`_intro_gl36d_1`,steps:`_steps_gl36d_8`,specimen:`_specimen_gl36d_36`,sheet:`_sheet_gl36d_43`,lines:`_lines_gl36d_53`,line:`_line_gl36d_53`,notes:`_notes_gl36d_86`,caveat:`_caveat_gl36d_114`},i=t(),a=`https://github.com/Waddah0-0/margin/blob/main/docs/methodology.md`,o=[{no:41,text:`def total(items):`},{no:42,text:` # add up the prices`,side:`for`},{no:43,text:` result = 0`},{no:44,text:` for item in items:`},{no:45,text:` result += item.price * 1.0825`,side:`against`},{no:46,text:` return result`}];function s(){return(0,i.jsxs)(n,{label:`How it reads code`,note:`It estimates; it never proves`,children:[(0,i.jsxs)(`div`,{className:r.intro,children:[(0,i.jsxs)(`ol`,{className:r.steps,children:[(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`b`,{children:`A local model reads a sample of files`}),` and points at lines that suggest AI or a person. The quotes come from the file itself, never from the model.`]}),(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`b`,{children:`Every Python, JavaScript and TypeScript file is checked`}),` for habits such as comments that restate the code or leftover debugging.`]}),(0,i.jsxs)(`li`,{children:[(0,i.jsx)(`b`,{children:`The answer is a range, not a verdict`}),`, with a confidence level and the reasons for it. Evidence for and against is shown side by side.`]})]}),(0,i.jsxs)(`figure`,{className:r.specimen,"aria-hidden":`true`,children:[(0,i.jsxs)(`div`,{className:r.sheet,children:[(0,i.jsx)(`div`,{className:r.lines,children:o.map(e=>(0,i.jsxs)(`div`,{className:r.line,"data-side":e.side,children:[(0,i.jsx)(`span`,{children:e.no}),(0,i.jsx)(`code`,{children:e.text})]},e.no))}),(0,i.jsxs)(`div`,{className:r.notes,children:[(0,i.jsxs)(`p`,{"data-side":`for`,style:{gridRow:2},children:[(0,i.jsx)(`b`,{children:`+0.42`}),` comment restates the code`]}),(0,i.jsxs)(`p`,{"data-side":`against`,style:{gridRow:5},children:[(0,i.jsx)(`b`,{children:`−0.18`}),` hand-tuned constant`]})]})]}),(0,i.jsx)(`figcaption`,{children:`What a result looks like: marked lines, and the reason beside each.`})]})]}),(0,i.jsxs)(`p`,{className:r.caveat,children:[`Use it to start a conversation, not to accuse anyone.`,` `,(0,i.jsxs)(`a`,{className:`link`,href:a,target:`_blank`,rel:`noreferrer`,children:[`How it scores, and how well it did in testing`,(0,i.jsx)(e,{name:`open`,size:12})]})]})]})}export{s as DetectorIntro};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,d as n,f as r,i,l as a,m as o,n as s,o as c,p as l,r as u,s as d,t as f}from"./index-B3Snzalk.js";var p=o(l(),1),m={header:`_header_rubu9_6`,caption:`_caption_rubu9_13`,bigNumber:`_bigNumber_rubu9_20`,range:`_range_rubu9_30`,scale:`_scale_rubu9_45`,scaleRange:`_scaleRange_rubu9_57`,scaleValue:`_scaleValue_rubu9_67`,scaleLabels:`_scaleLabels_rubu9_88`,confidence:`_confidence_rubu9_107`,confidenceHead:`_confidenceHead_rubu9_113`,steps:`_steps_rubu9_122`,reasons:`_reasons_rubu9_137`,stats:`_stats_rubu9_146`,methodology:`_methodology_rubu9_178`,caveat:`_caveat_rubu9_184`,markers:`_markers_rubu9_196`,markersLead:`_markersLead_rubu9_200`,markersWhy:`_markersWhy_rubu9_207`,markerList:`_markerList_rubu9_213`,columns:`_columns_rubu9_238`,column:`_column_rubu9_238`,columnTitle:`_columnTitle_rubu9_256`,columnCount:`_columnCount_rubu9_268`,columnEmpty:`_columnEmpty_rubu9_275`,entries:`_entries_rubu9_280`,entry:`_entry_rubu9_284`,entryText:`_entryText_rubu9_303`,entryQuote:`_entryQuote_rubu9_308`,entryMeta:`_entryMeta_rubu9_320`,entrySource:`_entrySource_rubu9_340`,entryWeight:`_entryWeight_rubu9_347`,more:`_more_rubu9_353`,anchor:`_anchor_rubu9_359`,explorer:`_explorer_rubu9_365`,treePane:`_treePane_rubu9_372`,treeTools:`_treeTools_rubu9_378`,search:`_search_rubu9_383`,toggles:`_toggles_rubu9_415`,tree:`_tree_rubu9_372`,treeRow:`_treeRow_rubu9_451`,treeChevron:`_treeChevron_rubu9_488`,treeName:`_treeName_rubu9_498`,treeFlag:`_treeFlag_rubu9_505`,treeScore:`_treeScore_rubu9_514`,dot:`_dot_rubu9_529`,legend:`_legend_rubu9_551`,fileView:`_fileView_rubu9_567`,fileHead:`_fileHead_rubu9_575`,filePath:`_filePath_rubu9_584`,fileMeta:`_fileMeta_rubu9_597`,fileScores:`_fileScores_rubu9_603`,fileScore:`_fileScore_rubu9_603`,touch:`_touch_rubu9_619`,verdict:`_verdict_rubu9_626`,verdictLabel:`_verdictLabel_rubu9_635`,verdictLine:`_verdictLine_rubu9_641`,uncertainty:`_uncertainty_rubu9_654`,code:`_code_rubu9_662`,codeScroll:`_codeScroll_rubu9_667`,lineNo:`_lineNo_rubu9_684`,lineText:`_lineText_rubu9_694`,find:`_find_rubu9_1`,gap:`_gap_rubu9_735`,notes:`_notes_rubu9_743`,note:`_note_rubu9_743`,noteHead:`_noteHead_rubu9_779`,noteText:`_noteText_rubu9_797`,truncated:`_truncated_rubu9_802`,noExcerpt:`_noExcerpt_rubu9_803`,signals:`_signals_rubu9_814`,signalsLabel:`_signalsLabel_rubu9_819`,signalId:`_signalId_rubu9_838`,signalText:`_signalText_rubu9_843`,timeline:`_timeline_rubu9_885`,axis:`_axis_rubu9_890`,tick:`_tick_rubu9_896`,axisLabels:`_axisLabels_rubu9_919`,timelineLegend:`_timelineLegend_rubu9_929`,notable:`_notable_rubu9_951`,notableDate:`_notableDate_rubu9_965`,notableSubject:`_notableSubject_rubu9_975`,notableTags:`_notableTags_rubu9_981`,tagTool:`_tagTool_rubu9_987`,tagLarge:`_tagLarge_rubu9_988`},h=r(),g=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`});function _({commits:e,total:t}){let n=[...e].sort((e,t)=>Date.parse(e.date)-Date.parse(t.date)),r=Date.parse(n[0]?.date??``),i=Date.parse(n[n.length-1]?.date??``),a=Math.max(i-r,1),o=Math.max(...e.map(e=>e.files_changed),1),s=e.filter(e=>e.tools.length||e.large).slice(0,12),c=e.filter(e=>e.tools.length).length,l=e.filter(e=>e.large).length;return(0,h.jsxs)(`div`,{className:m.timeline,children:[(0,h.jsx)(`div`,{className:m.axis,children:n.map(t=>{let n=e.length===1?.5:(Date.parse(t.date)-r)/a,i=.18+.82*(Math.log1p(t.files_changed)/Math.log1p(o)),s=t.tools.length?`tool`:t.large?`large`:t.merge?`merge`:`plain`;return(0,h.jsx)(`span`,{className:m.tick,"data-kind":s,style:{"--x":n,"--h":i},title:`${g.format(new Date(t.date))} · ${t.subject} · ${t.files_changed} files${t.tools.length?` · ${t.tools.join(`, `)}`:``}`},t.sha)})}),(0,h.jsxs)(`div`,{className:m.axisLabels,children:[(0,h.jsx)(`span`,{children:g.format(new Date(r))}),(0,h.jsxs)(`span`,{className:m.timelineLegend,children:[(0,h.jsx)(`span`,{"data-kind":`tool`}),` names an AI tool (`,c,`)`,(0,h.jsx)(`span`,{"data-kind":`large`}),` large commit (`,l,`)`,(0,h.jsx)(`span`,{"data-kind":`plain`}),` other`]}),(0,h.jsx)(`span`,{children:g.format(new Date(i))})]}),t>e.length&&(0,h.jsxs)(`p`,{className:`body-s muted`,children:[`Showing the newest `,e.length,` of `,t,` commits.`]}),s.length>0&&(0,h.jsx)(`ul`,{className:m.notable,children:s.map(e=>(0,h.jsxs)(`li`,{children:[(0,h.jsx)(`span`,{className:m.notableDate,children:g.format(new Date(e.date))}),(0,h.jsx)(`code`,{children:e.sha.slice(0,7)}),(0,h.jsx)(`span`,{className:m.notableSubject,children:e.subject}),(0,h.jsxs)(`span`,{className:m.notableTags,children:[e.tools.map(e=>(0,h.jsx)(`span`,{className:m.tagTool,children:e},e)),e.large&&(0,h.jsxs)(`span`,{className:m.tagLarge,children:[e.files_changed,` files`]})]})]},e.sha))})]})}var v=e=>typeof e==`number`&&Number.isFinite(e);function y(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.estimate_range;return!v(t.estimate)||!Array.isArray(n)||n.length!==2||!n.every(v)||typeof t.confidence!=`string`||!Array.isArray(t.files)?null:{confidence_reasons:[],metadata_markers:[],repo_signals:[],languages:{},unsupported_languages:{},excerpts:[],commits:[],commits_total:0,unscored_files:[],unscored_truncated:!1,files_analyzed:t.files.length,files_skipped:0,methodology_version:``,...t}}function b(e){if(!e)return null;let t=/^(.+?):(\d+)(?:-\d+)?$/.exec(e);return t?.[1]&&t[2]?{path:t[1],line:Number(t[2])}:{path:e}}function x(e){return e.judge?{value:e.judge.likelihood_ai,byModel:!0}:{value:e.probability,byModel:!1}}function S(e,{includeUnscored:t=!1,query:n=``}={}){let r={kind:`folder`,name:``,path:``,children:[],scored:0},i=new Set(e.excerpts.map(e=>e.path)),a=n.trim().toLowerCase(),o=e.files.map(e=>({kind:`file`,name:``,path:e.path,probability:x(e).value,byModel:x(e).byModel,hasExcerpt:i.has(e.path)}));if(t)for(let t of e.unscored_files)o.push({kind:`file`,name:``,path:t.path,probability:null,byModel:!1,reason:t.reason,hasExcerpt:!1});for(let e of o){if(a&&!e.path.toLowerCase().includes(a))continue;let t=e.path.endsWith(`/`),n=e.path.replace(/\/$/,``).split(`/`),i=r;for(let[r,a]of n.entries()){if(r===n.length-1){i.children.push({...e,name:t?`${a}/`:a});break}let o=n.slice(0,r+1).join(`/`),s=i.children.find(e=>e.kind===`folder`&&e.name===a);s||(s={kind:`folder`,name:a,path:o,children:[],scored:0},i.children.push(s)),i=s}}return C(r),r}function C(e){let t=0;for(let n of e.children)n.kind===`folder`?t+=C(n):n.probability!==null&&(t+=1);return e.children.sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`folder`?-1:1),e.scored=t,t}function w(e){let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}var T=`Evidence toward AI assistance`,E=`Evidence toward human authorship`;function D(e,t){let n={for:[],against:[]},r=[...e.files].filter(e=>e.judge).sort((e,t)=>(t.judge?.likelihood_ai??0)-(e.judge?.likelihood_ai??0));for(let e of r)for(let[t,r]of[[`for`,e.judge?.evidence_for??[]],[`against`,e.judge?.evidence_against??[]]])for(let i of r)n[t].push({side:t,source:`judge`,text:i.why,quote:i.quote,path:e.path,line:i.line_start,location:`${e.path}:${i.line_start}`});for(let[e,r]of[[`for`,T],[`against`,E]]){let i=t.find(e=>e.title===r);for(let t of i?.evidence??[]){let r=b(t.location);n[e].push({side:e,source:`signal`,text:t.detail,path:r&&t.kind===`file`?r.path:void 0,line:r?.line,location:t.location??void 0,weight:t.weight??void 0})}}return n}var O=new Set([`Estimated likelihood of AI assistance`,`AI tool usage confirmed by metadata`,T,E,`How to read this result`]);function k(e){let t=Math.max(0,Math.min(1,e)),n=Math.round(Math.abs(t-.5)*200);return`color-mix(in oklab, var(${t>=.5?`--red`:`--blue`}) ${n}%, var(--ink-3))`}var A={for:`Toward AI`,against:`Toward a human`,context:`Context only`},j={unsupported_language:`language not analysed`,test_file:`test file (not scored by default)`,too_small:`too small to judge`,unparseable:`could not be parsed`,unreadable:`could not be read`,lockfile:`lockfile`,binary:`binary file`,minified:`minified`,generated:`generated code`,vendored:`vendored code`,too_large:`too large`,ignored_dir:`ignored folder`,ignored_glob:`ignored by pattern`,symlink:`symlink`};function M({p:e,byModel:t=!0}){return(0,h.jsx)(`span`,{className:m.dot,"data-unscored":e===null,"data-signals":e!==null&&!t,style:e===null?void 0:{"--c":k(e)}})}function N({folder:e,depth:t,open:r,toggle:i,selected:a,onSelect:o}){return(0,h.jsx)(h.Fragment,{children:e.children.map(e=>{let s={"--depth":t};if(e.kind===`folder`){let c=r.has(e.path);return(0,h.jsxs)(p.Fragment,{children:[(0,h.jsxs)(`button`,{type:`button`,className:m.treeRow,style:s,onClick:()=>i(e.path),"aria-expanded":c,children:[(0,h.jsx)(n,{name:`chevronRight`,size:11,className:m.treeChevron}),(0,h.jsxs)(`span`,{className:m.treeName,children:[e.name,`/`]})]}),c&&(0,h.jsx)(N,{folder:e,depth:t+1,open:r,toggle:i,selected:a,onSelect:o})]},e.path)}let c=e.probability===null;return(0,h.jsxs)(`button`,{type:`button`,className:m.treeRow,style:s,"data-file":!0,"data-unscored":c,"aria-current":e.path===a||void 0,disabled:c,title:c?`Not scored: ${j[e.reason??``]??e.reason}`:e.path,onClick:()=>o(e.path),children:[(0,h.jsx)(M,{p:e.probability,byModel:e.byModel}),(0,h.jsx)(`span`,{className:m.treeName,children:e.name}),e.hasExcerpt&&(0,h.jsx)(`span`,{className:m.treeFlag,title:`Has marked lines`}),(0,h.jsx)(`span`,{className:m.treeScore,children:c?j[e.reason??``]??e.reason:e.probability?.toFixed(2)})]},e.path)})})}function P(e,t){let n={for:0,against:1,context:2};return e.filter(e=>e.line_start<=t&&t<=e.line_end).sort((e,t)=>n[e.side]-n[t.side])[0]}function F(e,t){for(let n of e.hunks){let e=n.start_line+n.lines.length-1;if(!(t.line_end<n.start_line||t.line_start>e))return Math.max(t.line_start,n.start_line)}return t.line_start}var I=e=>e.line_start===e.line_end?`${e.line_start}`:`${e.line_start}–${e.line_end}`;function L({excerpt:e,focusLine:t,focusAt:n}){let r=(0,p.useRef)(null),i=(0,p.useRef)(new Map),a=(0,p.useRef)(null),[o,s]=(0,p.useState)([]),c=(0,p.useMemo)(()=>e.marks.map(t=>({mark:t,anchor:F(e,t)})).sort((e,t)=>e.anchor-t.anchor),[e]);return(0,p.useEffect)(()=>{r.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[t,n]),(0,p.useLayoutEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=e.children[0];if(t&&getComputedStyle(t).position!==`absolute`){e.style.minHeight=``;return}let n=e.getBoundingClientRect().top,r=0,a=c.map(({anchor:t},a)=>{let o=i.current.get(t),s=o?o.getBoundingClientRect().top-n:r,c=Math.max(s,r);return r=c+(e.children[a]?.offsetHeight??0)+8,Math.round(c)});e.style.minHeight=`${Math.round(r)}px`,s(e=>e.length===a.length&&e.every((e,t)=>e===a[t])?e:a)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[c]),(0,h.jsxs)(`div`,{className:m.code,children:[(0,h.jsx)(`div`,{className:m.codeScroll,children:(0,h.jsx)(`table`,{children:(0,h.jsx)(`tbody`,{children:e.hunks.map((n,a)=>{let o=a>0?(e.hunks[a-1]?.start_line??0)+(e.hunks[a-1]?.lines.length??0):1,s=n.start_line-o;return(0,h.jsxs)(p.Fragment,{children:[s>0&&(0,h.jsx)(`tr`,{className:m.gap,children:(0,h.jsxs)(`td`,{colSpan:2,children:[a===0?`lines 1–${n.start_line-1}`:`${s} line${s===1?``:`s`}`,` `,`not shown`]})}),n.lines.map((a,o)=>{let s=n.start_line+o,c=P(e.marks,s);return(0,h.jsxs)(`tr`,{ref:e=>{e?i.current.set(s,e):i.current.delete(s),s===t&&(r.current=e)},"data-side":c?.side,"data-focus":s===t||void 0,children:[(0,h.jsx)(`td`,{className:m.lineNo,children:s}),(0,h.jsx)(`td`,{className:m.lineText,children:a||` `})]},s)})]},n.start_line)})})})}),c.length>0&&(0,h.jsx)(`ol`,{ref:a,className:m.notes,"aria-label":`Notes on the marked lines`,children:c.map(({mark:e},t)=>(0,h.jsxs)(`li`,{className:m.note,"data-side":e.side,style:{top:o[t]??0},children:[(0,h.jsxs)(`span`,{className:m.noteHead,children:[(0,h.jsx)(`b`,{children:A[e.side]}),(0,h.jsxs)(`span`,{children:[e.source===`judge`?`model`:e.source.replaceAll(`_`,` `),` · line`,` `,I(e)]})]}),(0,h.jsx)(`span`,{className:m.noteText,children:e.note})]},`${e.source}-${e.line_start}-${e.note}`))}),e.truncated&&(0,h.jsx)(`p`,{className:m.truncated,children:`Some marked lines were left out to keep the report small.`})]})}function R({file:e,excerpt:n,selection:r}){let i=r?.path===e.path?r.line:void 0,a=x(e);return(0,h.jsxs)(`article`,{className:m.fileView,children:[(0,h.jsxs)(`header`,{className:m.fileHead,children:[(0,h.jsxs)(`div`,{className:m.filePath,children:[(0,h.jsx)(`code`,{children:e.path}),(0,h.jsxs)(`span`,{className:m.fileMeta,children:[e.language??`unknown language`,` · `,e.lines,` lines of code`,e.is_test?` · test file`:``]})]}),(0,h.jsxs)(`span`,{className:m.fileScores,children:[(0,h.jsx)(`span`,{className:m.fileScore,style:{"--c":k(a.value)},children:a.value.toFixed(2)}),(0,h.jsx)(`span`,{className:m.fileMeta,children:e.judge?`the model's verdict`:`signals only`}),e.judge&&(0,h.jsxs)(`span`,{className:m.fileMeta,children:[`signals `,e.probability.toFixed(2)]})]})]}),e.ai_commit_touches>0&&(0,h.jsxs)(`p`,{className:m.touch,children:[`Changed by `,e.ai_commit_touches,` commit`,e.ai_commit_touches===1?``:`s`,` whose metadata names an AI tool.`]}),e.judge&&(0,h.jsxs)(`div`,{className:m.verdict,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:m.verdictLabel,children:`The model read this file`}),(0,h.jsxs)(`p`,{className:m.verdictLine,children:[`Likelihood `,e.judge.likelihood_ai.toFixed(2),(0,h.jsxs)(`span`,{children:[` · its confidence `,e.judge.confidence.toFixed(2)]})]})]}),e.judge.uncertainty_notes&&(0,h.jsxs)(`p`,{className:m.uncertainty,children:[`“`,e.judge.uncertainty_notes,`”`]})]}),n?(0,h.jsx)(L,{excerpt:n,focusLine:i,focusAt:r?.at}):(0,h.jsx)(`p`,{className:m.noExcerpt,children:`No code excerpt: the model did not read this file, and no signal pointed at specific lines.`}),e.signals.length>0&&(0,h.jsxs)(`div`,{className:m.signals,children:[(0,h.jsx)(`p`,{className:m.signalsLabel,children:`Signals that fired (+ reads AI-like, − reads human-like)`}),(0,h.jsx)(`ul`,{children:e.signals.map(e=>(0,h.jsxs)(`li`,{children:[(0,h.jsx)(`span`,{className:m.signalId,children:e.signal_id.replaceAll(`_`,` `)}),(0,h.jsx)(`span`,{className:m.signalText,children:e.explanation}),(0,h.jsx)(t,{weight:e.strength})]},`${e.signal_id}-${e.explanation}`))})]})]})}function z({data:e,selection:t,onSelect:r}){let[i,a]=(0,p.useState)(``),[o,s]=(0,p.useState)(!1),[c,l]=(0,p.useState)(`tree`),u=(0,p.useMemo)(()=>new Map(e.excerpts.map(e=>[e.path,e])),[e]),d=(0,p.useMemo)(()=>new Map(e.files.map(e=>[e.path,e])),[e]),f=(0,p.useMemo)(()=>S(e,{includeUnscored:o,query:i}),[e,o,i]),g=[...e.files].filter(e=>u.has(e.path)&&!e.is_test).sort((e,t)=>Number(!!t.judge)-Number(!!e.judge)||x(t).value-x(e).value)[0]??e.files[0],_=t?.path??g?.path,[v,y]=(0,p.useState)(()=>{let e=new Set;for(let t of f.children)t.kind===`folder`&&e.add(t.path);for(let t of w(_??``))e.add(t);return e});(0,p.useEffect)(()=>{t&&y(e=>new Set([...e,...w(t.path)]))},[t]);let b=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),C=e=>r({path:e,at:Date.now()}),T=_?d.get(_):void 0,E=(0,p.useMemo)(()=>e.files.filter(e=>!i||e.path.toLowerCase().includes(i.toLowerCase())).sort((e,t)=>x(t).value-x(e).value),[e,i]);return e.files.length?(0,h.jsxs)(`div`,{className:m.explorer,children:[(0,h.jsxs)(`div`,{className:m.treePane,children:[(0,h.jsxs)(`div`,{className:m.treeTools,children:[(0,h.jsxs)(`label`,{className:m.search,children:[(0,h.jsx)(n,{name:`search`,size:14}),(0,h.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Filter files`,spellCheck:!1})]}),(0,h.jsxs)(`div`,{className:m.toggles,children:[(0,h.jsx)(`button`,{type:`button`,"aria-pressed":c===`tree`,onClick:()=>l(`tree`),children:`Folders`}),(0,h.jsx)(`button`,{type:`button`,"aria-pressed":c===`score`,onClick:()=>l(`score`),children:`By score`}),c===`tree`&&(0,h.jsx)(`button`,{type:`button`,className:m.unscoredToggle,"aria-pressed":o,onClick:()=>s(!o),children:`Unscored`})]})]}),(0,h.jsx)(`div`,{className:m.tree,children:c===`tree`?(0,h.jsx)(N,{folder:f,depth:0,open:i?new Set(B(f)):v,toggle:b,selected:_,onSelect:C}):E.map(e=>(0,h.jsxs)(`button`,{type:`button`,className:m.treeRow,"data-file":!0,"aria-current":e.path===_||void 0,onClick:()=>C(e.path),style:{"--depth":0},children:[(0,h.jsx)(M,{p:x(e).value,byModel:x(e).byModel}),(0,h.jsx)(`span`,{className:m.treeName,title:e.path,children:e.path}),u.has(e.path)&&(0,h.jsx)(`span`,{className:m.treeFlag,title:`Has marked lines`}),(0,h.jsx)(`span`,{className:m.treeScore,children:x(e).value.toFixed(2)})]},e.path))}),(0,h.jsxs)(`p`,{className:m.legend,children:[(0,h.jsxs)(`span`,{children:[(0,h.jsx)(M,{p:0}),` human-like`]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(M,{p:1}),` AI-like`]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(M,{p:.5,byModel:!1}),` signals only`]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(M,{p:null}),` not scored`]}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`span`,{className:m.treeFlag}),` marked lines`]})]})]}),T?(0,h.jsx)(R,{file:T,excerpt:u.get(T.path),selection:t}):(0,h.jsx)(`p`,{className:`muted`,children:`Pick a file.`})]}):(0,h.jsx)(`p`,{className:`muted`,children:`No file could be scored.`})}function B(e){return e.children.flatMap(e=>e.kind===`folder`?[e.path,...B(e)]:[])}var V={low:1,medium:2,high:3};function H({data:e,children:t}){let[n,r]=e.estimate_range,i=e.confidence;return(0,h.jsxs)(a,{label:`Estimate`,note:e.methodology_version?(0,h.jsx)(`span`,{className:m.methodology,children:e.methodology_version}):void 0,children:[(0,h.jsxs)(`div`,{className:m.header,children:[(0,h.jsxs)(`div`,{className:m.estimate,children:[(0,h.jsx)(`p`,{className:m.caption,children:`Estimated likelihood of AI assistance`}),(0,h.jsx)(`p`,{className:m.bigNumber,children:e.estimate.toFixed(2)}),(0,h.jsxs)(`p`,{className:m.range,children:[`plausibly between `,(0,h.jsx)(`b`,{children:n.toFixed(2)}),` and `,(0,h.jsx)(`b`,{children:r.toFixed(2)})]}),(0,h.jsxs)(`div`,{className:m.scale,style:{"--low":n,"--high":r,"--value":e.estimate},role:`img`,"aria-label":`Estimate ${e.estimate.toFixed(2)} on a scale from 0 to 1, range ${n.toFixed(2)} to ${r.toFixed(2)}`,children:[(0,h.jsx)(`span`,{className:m.scaleRange}),(0,h.jsx)(`span`,{className:m.scaleValue})]}),(0,h.jsxs)(`div`,{className:m.scaleLabels,children:[(0,h.jsx)(`span`,{"data-side":`against`,children:`0 · reads like people wrote it`}),(0,h.jsx)(`span`,{"data-side":`for`,children:`reads like AI wrote it · 1`})]})]}),(0,h.jsxs)(`div`,{className:m.confidence,children:[(0,h.jsxs)(`div`,{className:m.confidenceHead,children:[(0,h.jsx)(`span`,{className:m.steps,"aria-hidden":`true`,children:[1,2,3].map(e=>(0,h.jsx)(`span`,{"data-on":e<=V[i]},e))}),(0,h.jsxs)(`span`,{children:[i.charAt(0).toUpperCase()+i.slice(1),` confidence`]})]}),e.confidence_reasons.length>0&&(0,h.jsx)(`ul`,{className:m.reasons,children:e.confidence_reasons.map(e=>(0,h.jsxs)(`li`,{children:[e.charAt(0).toUpperCase()+e.slice(1),`.`]},e))}),(0,h.jsxs)(`dl`,{className:m.stats,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{children:`Files scored`}),(0,h.jsx)(`dd`,{children:e.files_analyzed})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{children:`Not scored`}),(0,h.jsx)(`dd`,{children:e.files_skipped})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{children:`Commits`}),(0,h.jsx)(`dd`,{children:e.commits_total})]})]})]})]}),(0,h.jsx)(`p`,{className:m.caveat,children:`This is an estimate, not proof. Clean human code can look machine-made, and edited AI code can look human. Use it to start a conversation, never as the only basis for accusing anyone.`}),t]})}function U({data:e}){if(!e.metadata_markers.length)return null;let t=[...new Set(e.metadata_markers.map(e=>e.tool))];return(0,h.jsx)(a,{label:`Metadata`,note:`Reported, never scored`,children:(0,h.jsxs)(`div`,{className:m.markers,children:[(0,h.jsxs)(`p`,{className:m.markersLead,children:[`The repository's own metadata names AI tools: `,t.join(`, `)]}),(0,h.jsx)(`p`,{className:m.markersWhy,children:`This proves the tools were used, not how much of the code they wrote, so it is not part of the estimate.`}),(0,h.jsx)(`ul`,{className:m.markerList,children:e.metadata_markers.map(e=>(0,h.jsxs)(`li`,{children:[(0,h.jsx)(`span`,{className:`tag`,children:e.tool}),(0,h.jsx)(`span`,{children:e.detail}),(0,h.jsx)(`code`,{children:e.kind===`config_file`?e.location:e.location.slice(0,10)})]},`${e.kind}-${e.tool}-${e.location}`))})]})})}var W=6;function G({side:e,entries:t,onPick:n}){let[r,i]=(0,p.useState)(!1),a=r?t:t.slice(0,W);return(0,h.jsxs)(`div`,{className:m.column,"data-side":e,children:[(0,h.jsxs)(`h3`,{className:m.columnTitle,children:[e===`for`?`Toward AI`:`Toward a human`,(0,h.jsx)(`span`,{className:m.columnCount,children:t.length})]}),t.length===0?(0,h.jsx)(`p`,{className:m.columnEmpty,children:`Nothing pointed this way.`}):(0,h.jsx)(`ul`,{className:m.entries,children:a.map((e,t)=>(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,className:m.entry,onClick:()=>n(e),disabled:!e.path,title:e.path?`Show this in the file`:void 0,children:[(0,h.jsx)(`span`,{className:m.entryText,children:e.text.charAt(0).toUpperCase()+e.text.slice(1)}),e.quote&&(0,h.jsx)(`code`,{className:m.entryQuote,children:e.quote}),(0,h.jsxs)(`span`,{className:m.entryMeta,children:[(0,h.jsx)(`span`,{className:m.entrySource,children:e.source===`judge`?`model`:`signal`}),e.location&&(0,h.jsx)(`code`,{children:e.location}),e.weight!==void 0&&(0,h.jsxs)(`span`,{className:m.entryWeight,children:[e.weight>=0?`+`:`−`,Math.abs(e.weight).toFixed(2)]})]})]})},t))}),t.length>W&&(0,h.jsx)(`button`,{type:`button`,className:`link ${m.more}`,onClick:()=>i(!r),children:r?`Show fewer`:`Show all ${t.length}`})]})}function K({run:t,result:n,data:r}){let a=n.findings??[],o=(0,p.useMemo)(()=>D(r,a),[r,a]),l=a.filter(e=>!O.has(e.title)),u=(0,p.useRef)(null),[g,v]=(0,p.useState)(null),y=e=>{e.path&&(v({path:e.path,line:e.line,at:Date.now()}),u.current?.scrollIntoView({behavior:`smooth`,block:`start`}))};return(0,h.jsxs)(e,{children:[(0,h.jsx)(d,{result:n}),(0,h.jsx)(H,{data:r,children:(0,h.jsx)(f,{run:t,result:n})}),(0,h.jsx)(U,{data:r}),(0,h.jsx)(c,{title:`Evidence`,note:`For and against, side by side. Pick one to see it in its file.`,children:(0,h.jsxs)(`div`,{className:m.columns,children:[(0,h.jsx)(G,{side:`for`,entries:o.for,onPick:y}),(0,h.jsx)(G,{side:`against`,entries:o.against,onPick:y})]})}),(0,h.jsx)(`div`,{ref:u,className:m.anchor,children:(0,h.jsx)(c,{title:`Files`,count:r.files.length,children:(0,h.jsx)(z,{data:r,selection:g,onSelect:v})})}),r.commits.length>0&&(0,h.jsx)(c,{title:`History`,count:r.commits_total,note:`Authors are left out on purpose`,children:(0,h.jsx)(_,{commits:r.commits,total:r.commits_total})}),l.length>0&&(0,h.jsx)(c,{title:`Also in the report`,children:(0,h.jsx)(s,{findings:l})}),(0,h.jsx)(i,{result:n})]})}function q(e){let t=e.result.status===`error`?null:y(e.result.data);return t?(0,h.jsx)(K,{...e,data:t}):(0,h.jsx)(u,{...e})}export{q as DetectorResult};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._header_rubu9_6{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);align-items:start;gap:32px 64px;display:grid}._caption_rubu9_13{color:var(--ink-2);font-size:13px;line-height:20px}._bigNumber_rubu9_20{font-family:var(--font-serif);letter-spacing:-.045em;font-variant-numeric:lining-nums;margin:14px 0 0 -5px;font-size:136px;font-weight:350;line-height:124px}._range_rubu9_30{color:var(--ink-2);margin-top:4px;font-size:15px;line-height:22px}._range_rubu9_30 b{font-family:var(--font-mono);color:var(--ink);font-size:14px;font-weight:500}._scale_rubu9_45{border-right:1px solid var(--ink-3);border-bottom:1px solid var(--ink);background:repeating-linear-gradient(90deg, var(--ink-3) 0 1px, transparent 1px 10%) bottom / 100% 9px no-repeat, repeating-linear-gradient(90deg, var(--rule-2) 0 1px, transparent 1px 2%) bottom / 100% 4px no-repeat;max-width:520px;height:38px;margin-top:22px;position:relative}._scaleRange_rubu9_57{bottom:0;left:calc(var(--low) * 100%);width:calc((var(--high) - var(--low)) * 100%);border-inline:1px solid var(--ink);background:color-mix(in srgb, var(--ink) 16%, transparent);height:14px;position:absolute}._scaleValue_rubu9_67{bottom:0;left:calc(var(--value) * 100%);background:var(--ink);width:2px;height:36px;margin-left:-1px;position:absolute}._scaleValue_rubu9_67:before{content:"";background:var(--ink);width:8px;height:8px;position:absolute;top:0;left:-3px;rotate:45deg}._scaleLabels_rubu9_88{justify-content:space-between;gap:16px;max-width:520px;margin-top:8px;font-size:12px;line-height:16px;display:flex}._scaleLabels_rubu9_88 [data-side=against]{color:var(--blue)}._scaleLabels_rubu9_88 [data-side=for]{color:var(--red);text-align:right}._confidence_rubu9_107{gap:14px;padding-top:22px;display:grid}._confidenceHead_rubu9_113{align-items:center;gap:10px;font-size:16px;font-weight:650;line-height:22px;display:flex}._steps_rubu9_122{gap:3px;display:inline-flex}._steps_rubu9_122 span{border:1px solid var(--ink);width:9px;height:9px}._steps_rubu9_122 span[data-on=true]{background:var(--ink)}._reasons_rubu9_137{max-width:440px;color:var(--ink-2);gap:6px;font-size:14px;line-height:21px;display:grid}._stats_rubu9_146{border-top:1px solid var(--rule);margin-top:6px;display:flex}._stats_rubu9_146>div{flex:1;gap:2px;padding:12px 16px 0 0;display:grid}._stats_rubu9_146>div+div{border-left:1px solid var(--rule);padding-left:16px}._stats_rubu9_146 dt{color:var(--ink-3);font-size:12px;line-height:16px}._stats_rubu9_146 dd{font-family:var(--font-mono);letter-spacing:-.02em;font-size:22px;font-weight:400;line-height:28px}._methodology_rubu9_178{font-family:var(--font-mono);font-size:10.5px;line-height:15px}._caveat_rubu9_184{border-left:2px solid var(--ink);max-width:760px;color:var(--ink-2);margin-top:36px;padding-left:14px;font-size:14px;line-height:21px}._markers_rubu9_196{max-width:860px}._markersLead_rubu9_200{letter-spacing:-.008em;font-size:16px;font-weight:650;line-height:23px}._markersWhy_rubu9_207{max-width:var(--measure);color:var(--ink-2);margin-top:4px}._markerList_rubu9_213{border-top:1px solid var(--rule);margin-top:16px}._markerList_rubu9_213 li{border-bottom:1px solid var(--rule);grid-template-columns:110px minmax(0,1fr) auto;align-items:baseline;gap:16px;padding:9px 0;display:grid}._markerList_rubu9_213 .tag{justify-self:start}._markerList_rubu9_213 code{color:var(--ink-3);font-size:12px}._columns_rubu9_238{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:40px;display:grid}._column_rubu9_238{--side:var(--red);--side-tint:var(--red-tint);min-width:0}._column_rubu9_238[data-side=against]{--side:var(--blue);--side-tint:var(--blue-tint)}._columnTitle_rubu9_256{border-bottom:2px solid var(--side);color:var(--side);align-items:baseline;gap:8px;padding-bottom:8px;font-size:15px;font-weight:650;line-height:22px;display:flex}._columnCount_rubu9_268{font-family:var(--font-mono);margin-left:auto;font-size:12px;font-weight:400}._columnEmpty_rubu9_275{color:var(--ink-3);padding-top:12px}._entries_rubu9_280>li+li{border-top:1px solid var(--rule)}._entry_rubu9_284{box-sizing:content-box;text-align:left;width:100%;transition:background-color var(--fast) var(--ease);gap:6px;margin-inline:-10px;padding:11px 10px;display:grid}._entry_rubu9_284:hover:not(:disabled){background:var(--side-tint)}._entry_rubu9_284:disabled{cursor:default}._entryText_rubu9_303{font-size:14px;line-height:20px}._entryQuote_rubu9_308{border-left:2px solid var(--side);background:var(--side-tint);text-overflow:ellipsis;white-space:nowrap;padding:4px 8px;font-size:12px;line-height:18px;display:block;overflow:hidden}._entryMeta_rubu9_320{min-width:0;color:var(--ink-3);align-items:baseline;gap:10px;font-size:11.5px;line-height:16px;display:flex}._entryMeta_rubu9_320 code{text-overflow:ellipsis;white-space:nowrap;text-align:left;direction:rtl;min-width:0;font-size:11.5px;overflow:hidden}._entrySource_rubu9_340{letter-spacing:.05em;text-transform:uppercase;font-size:10.5px;font-weight:600}._entryWeight_rubu9_347{font-family:var(--font-mono);color:var(--side);margin-left:auto}._more_rubu9_353{color:var(--ink-2);margin-top:10px;font-size:13px}._anchor_rubu9_359{scroll-margin-top:16px}._explorer_rubu9_365{grid-template-columns:256px minmax(0,1fr);align-items:start;gap:28px;display:grid}._treePane_rubu9_372{gap:10px;min-width:0;display:grid}._treeTools_rubu9_378{gap:8px;display:grid}._search_rubu9_383{border:1px solid var(--rule-2);border-radius:var(--radius);background:var(--paper-raised);height:32px;color:var(--ink-3);align-items:center;gap:8px;padding:0 10px;display:flex}._search_rubu9_383:focus-within{border-color:var(--ink);box-shadow:0 0 0 3px var(--blue-tint)}._search_rubu9_383 input{min-width:0;color:var(--ink);background:0 0;border:0;outline:none;flex:1;padding:0;font-size:13px}._search_rubu9_383 input::placeholder{color:var(--ink-3)}._toggles_rubu9_415{border:1px solid var(--rule-2);border-radius:var(--radius);background:var(--paper-raised);display:flex}._toggles_rubu9_415 button{color:var(--ink-2);flex:1;padding:0 8px;font-size:12px;font-weight:550;line-height:24px}._toggles_rubu9_415 button+button{border-left:1px solid var(--rule-2)}._toggles_rubu9_415 button:hover{color:var(--ink)}._toggles_rubu9_415 button[aria-pressed=true]{background:var(--ink);color:var(--on-ink)}._tree_rubu9_372{border-block:1px solid var(--rule);max-height:520px;padding-block:4px;overflow:auto}._treeRow_rubu9_451{width:100%;height:24px;padding:0 6px 0 calc(var(--depth) * 13px + 6px);font-family:var(--font-mono);color:var(--ink-2);text-align:left;align-items:center;gap:7px;font-size:12px;display:flex}._treeRow_rubu9_451:hover:not(:disabled){background:var(--paper-sunk);color:var(--ink)}._treeRow_rubu9_451[data-file]{color:var(--ink)}._treeRow_rubu9_451[aria-current=true],._treeRow_rubu9_451[aria-current=true]:hover{background:var(--ink);color:var(--on-ink)}._treeRow_rubu9_451[data-unscored=true]{color:var(--ink-3);cursor:default}._treeChevron_rubu9_488{width:8px;color:var(--ink-3);transition:rotate var(--fast) var(--ease)}._treeRow_rubu9_451[aria-expanded=true] ._treeChevron_rubu9_488{rotate:90deg}._treeName_rubu9_498{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._treeFlag_rubu9_505{opacity:.6;background:currentColor;flex-shrink:0;width:8px;height:2px;display:inline-block}._treeScore_rubu9_514{opacity:.75;white-space:nowrap;margin-left:auto;padding-left:8px;font-size:11px}._treeRow_rubu9_451[data-unscored=true] ._treeScore_rubu9_514{max-width:55%;font-family:var(--font-sans);text-overflow:ellipsis;overflow:hidden}._dot_rubu9_529{border:1.5px solid var(--c);background:var(--c);flex-shrink:0;width:8px;height:8px;display:inline-block}._dot_rubu9_529[data-signals=true]{background:0 0}._dot_rubu9_529[data-unscored=true]{border:1px dashed var(--rule-2);background:0 0}._treeRow_rubu9_451[aria-current=true] ._dot_rubu9_529{outline:1px solid var(--on-ink)}._legend_rubu9_551{color:var(--ink-3);flex-wrap:wrap;gap:4px 12px;font-size:11px;line-height:16px;display:flex}._legend_rubu9_551>span{align-items:center;gap:5px;display:inline-flex}._fileView_rubu9_567{border:1px solid var(--rule-2);border-radius:var(--radius);background:var(--paper-raised);min-width:0;container-type:inline-size}._fileHead_rubu9_575{border-bottom:1px solid var(--rule);justify-content:space-between;align-items:start;gap:20px;padding:14px 16px;display:flex}._filePath_rubu9_584{gap:2px;min-width:0;display:grid}._filePath_rubu9_584 code{overflow-wrap:anywhere;font-size:13px;font-weight:600;line-height:20px}._fileMeta_rubu9_597{color:var(--ink-3);font-size:12px;line-height:17px}._fileScores_rubu9_603{white-space:nowrap;flex-shrink:0;justify-items:end;display:grid}._fileScore_rubu9_603{font-family:var(--font-mono);letter-spacing:-.02em;color:var(--c);font-size:22px;font-weight:500;line-height:26px}._touch_rubu9_619{border-bottom:1px solid var(--rule);color:var(--ink-2);padding:8px 16px;font-size:12.5px}._verdict_rubu9_626{border-bottom:1px solid var(--rule);grid-template-columns:auto minmax(0,1fr);align-items:center;gap:24px;padding:12px 16px;display:grid}._verdictLabel_rubu9_635{color:var(--ink-3);font-size:12px;line-height:16px}._verdictLine_rubu9_641{font-size:15px;font-weight:650;line-height:22px}._verdictLine_rubu9_641 span{color:var(--ink-2);font-size:13px;font-weight:400}._uncertainty_rubu9_654{font-family:var(--font-serif);color:var(--ink-2);font-size:15.5px;font-style:italic;line-height:22px}._code_rubu9_662{grid-template-columns:minmax(0,1fr) 236px;display:grid}._codeScroll_rubu9_667{padding-block:8px;overflow-x:auto}._code_rubu9_662 table{border-collapse:collapse;min-width:100%;font-family:var(--font-mono);font-size:12px;line-height:20px}._code_rubu9_662 td{padding:0}._code_rubu9_662 td._lineNo_rubu9_684{width:1%;color:var(--ink-3);text-align:right;white-space:nowrap;-webkit-user-select:none;user-select:none;border-left:2px solid #0000;padding:0 12px 0 16px}._code_rubu9_662 td._lineText_rubu9_694{white-space:pre;tab-size:4;padding-right:20px}._code_rubu9_662 tr[data-side=for]{background:var(--red-tint)}._code_rubu9_662 tr[data-side=for] ._lineNo_rubu9_684{border-left-color:var(--red);color:var(--red)}._code_rubu9_662 tr[data-side=against]{background:var(--blue-tint)}._code_rubu9_662 tr[data-side=against] ._lineNo_rubu9_684{border-left-color:var(--blue);color:var(--blue)}._code_rubu9_662 tr[data-side=context]{background:var(--paper-sunk)}._code_rubu9_662 tr[data-side=context] ._lineNo_rubu9_684{border-left-color:var(--ink-3)}._code_rubu9_662 tr[data-focus]{animation:_find_rubu9_1 1.6s var(--ease) 1}@keyframes _find_rubu9_1{0%,40%{box-shadow:inset 0 0 0 1px var(--ink)}to{box-shadow:inset 0 0 0 1px #0000}}._code_rubu9_662 ._gap_rubu9_735 td{font-family:var(--font-sans);color:var(--ink-3);padding:4px 16px;font-size:11.5px}._notes_rubu9_743{border-left:1px solid var(--margin-line);margin-block:8px;position:relative}._note_rubu9_743{--side:var(--ink-3);transition:top var(--med) var(--ease);gap:1px;font-size:12px;line-height:16px;display:grid;position:absolute;left:14px;right:12px}._note_rubu9_743[data-side=for]{--side:var(--red)}._note_rubu9_743[data-side=against]{--side:var(--blue)}._note_rubu9_743:before{content:"";background:var(--side);width:9px;height:1px;position:absolute;top:9px;left:-14px}._noteHead_rubu9_779{flex-wrap:wrap;align-items:baseline;gap:0 8px;line-height:20px;display:flex}._noteHead_rubu9_779 b{color:var(--side);font-weight:650}._noteHead_rubu9_779 span{color:var(--ink-3);font-size:11px}._noteText_rubu9_797{color:var(--ink-2);overflow-wrap:anywhere}._truncated_rubu9_802,._noExcerpt_rubu9_803{color:var(--ink-3);grid-column:1/-1;padding:12px 16px;font-size:12.5px}._truncated_rubu9_802{border-top:1px solid var(--rule)}._signals_rubu9_814{border-top:1px solid var(--rule);padding:14px 16px 6px}._signalsLabel_rubu9_819{color:var(--ink-3);margin-bottom:4px;font-size:12px;line-height:16px}._signals_rubu9_814 li{grid-template-columns:150px minmax(0,1fr) auto;align-items:baseline;gap:16px;padding:8px 0;display:grid}._signals_rubu9_814 li+li{border-top:1px solid var(--rule)}._signalId_rubu9_838{font-size:13px;font-weight:600}._signalText_rubu9_843{color:var(--ink-2);font-size:13px;line-height:19px}@container (width<=600px){._code_rubu9_662{display:block}._notes_rubu9_743{border-top:1px solid var(--rule);border-left:0;gap:10px;margin:0;padding:12px 16px;display:grid}._note_rubu9_743{border-left:2px solid var(--side);padding-left:10px;position:static}._note_rubu9_743:before{display:none}._signals_rubu9_814 li{grid-template-columns:minmax(0,1fr) auto}._signalText_rubu9_843{grid-area:2/1/auto/-1}}._timeline_rubu9_885{gap:10px;display:grid}._axis_rubu9_890{border-bottom:1px solid var(--ink);height:76px;position:relative}._tick_rubu9_896{bottom:0;left:calc(var(--x) * (100% - 2px));width:2px;height:calc(var(--h) * 100%);background:var(--rule-2);position:absolute}._tick_rubu9_896[data-kind=merge]{background:var(--rule)}._tick_rubu9_896[data-kind=large]{z-index:1;background:var(--ink)}._tick_rubu9_896[data-kind=tool]{z-index:2;background:var(--red)}._axisLabels_rubu9_919{color:var(--ink-3);flex-wrap:wrap;justify-content:space-between;gap:4px 16px;font-size:12px;line-height:16px;display:flex}._timelineLegend_rubu9_929{flex-wrap:wrap;align-items:center;gap:4px 6px;display:inline-flex}._timelineLegend_rubu9_929 span{background:var(--rule-2);width:2px;height:10px;margin-left:10px}._timelineLegend_rubu9_929 span[data-kind=tool]{background:var(--red)}._timelineLegend_rubu9_929 span[data-kind=large]{background:var(--ink)}._notable_rubu9_951{border-top:1px solid var(--rule);margin-top:14px}._notable_rubu9_951 li{border-bottom:1px solid var(--rule);grid-template-columns:96px 64px minmax(0,1fr) auto;align-items:baseline;gap:16px;padding:8px 0;display:grid}._notableDate_rubu9_965{color:var(--ink-3);font-size:12.5px}._notable_rubu9_951 code{color:var(--ink-2);font-size:12px}._notableSubject_rubu9_975{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._notableTags_rubu9_981{align-items:center;gap:6px;display:inline-flex}._tagTool_rubu9_987,._tagLarge_rubu9_988{border:1px solid var(--rule-2);border-radius:var(--radius);color:var(--ink-2);white-space:nowrap;padding:0 5px;font-size:11px;font-weight:600;line-height:16px}._tagTool_rubu9_987{border-color:color-mix(in srgb, var(--red) 55%, transparent);color:var(--red)}@media (width<=1000px){._header_rubu9_6{grid-template-columns:minmax(0,1fr)}._confidence_rubu9_107{padding-top:0}._explorer_rubu9_365{grid-template-columns:minmax(0,1fr)}._tree_rubu9_372{max-height:260px}}@media (width<=760px){._bigNumber_rubu9_20{font-size:104px;line-height:96px}._columns_rubu9_238{grid-template-columns:minmax(0,1fr);gap:28px}._markerList_rubu9_213 li{grid-template-columns:minmax(0,1fr) auto}._markerList_rubu9_213 li>:nth-child(2){grid-area:2/1/auto/-1}._notable_rubu9_951 li{grid-template-columns:auto auto minmax(0,1fr);gap:2px 12px}._notableSubject_rubu9_975{white-space:normal;grid-area:2/1/auto/-1}._verdict_rubu9_626{grid-template-columns:minmax(0,1fr);gap:8px}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,f as t,i as n,l as r,m as i,o as a,p as o,r as s,s as c,t as l,u}from"./index-B3Snzalk.js";var d=i(o(),1),f={lead:`_lead_52n2l_3`,sub:`_sub_52n2l_11`,branch:`_branch_52n2l_18`,anchor:`_anchor_52n2l_24`,chapters:`_chapters_52n2l_30`,chapter:`_chapter_52n2l_30`,chapterNo:`_chapterNo_52n2l_44`,chapterTitle:`_chapterTitle_52n2l_51`,prose:`_prose_52n2l_69`,cite:`_cite_52n2l_77`,chapterMeta:`_chapterMeta_52n2l_90`,groups:`_groups_52n2l_99`,groupTitle:`_groupTitle_52n2l_105`,groupWhy:`_groupWhy_52n2l_111`,items:`_items_52n2l_118`,item:`_item_52n2l_118`,plainItem:`_plainItem_52n2l_125`,itemWhat:`_itemWhat_52n2l_134`,itemDetail:`_itemDetail_52n2l_147`,follow:`_follow_52n2l_155`,followInput:`_followInput_52n2l_164`,tree:`_tree_52n2l_183`,column:`_column_52n2l_188`,bar:`_bar_52n2l_193`,replay:`_replay_52n2l_214`,slider:`_slider_52n2l_220`,replayAt:`_replayAt_52n2l_226`,lit:`_lit_52n2l_234`,detail:`_detail_52n2l_250`,detailHead:`_detailHead_52n2l_256`,detailSubject:`_detailSubject_52n2l_263`,detailMeta:`_detailMeta_52n2l_270`,detailFiles:`_detailFiles_52n2l_277`,detailNotes:`_detailNotes_52n2l_282`,rows:`_rows_52n2l_303`,lines:`_lines_52n2l_307`,row:`_row_52n2l_303`,chapterRow:`_chapterRow_52n2l_342`,hang:`_hang_52n2l_368`,subject:`_subject_52n2l_397`,ref:`_ref_52n2l_404`,meta:`_meta_52n2l_409`,chapterRowTitle:`_chapterRowTitle_52n2l_437`,chapterRowDates:`_chapterRowDates_52n2l_446`,date:`_date_52n2l_459`},p=9;function m(e){return p+Math.min(e,15)*14}function h(e){let t=new Map(e.chapters.map(e=>[e.first_row,e.index])),n=[],r=new Map,i=0;e.commits.forEach((a,o)=>{let s=t.get(o);s!==void 0&&e.chapters.length>1&&(r.set(s,i),i+=46),n.push(i),i+=30});let a=Math.min(Math.max(e.repo.lanes,1),16);return{top:n,chapterTop:r,height:i,lanesWidth:18+(a-1)*14}}function g(e){return e.toFixed(1)}function _(e,t,n,r,i){if(i-t<=30.5)return`M${g(e)} ${g(t)}C${g(e)} ${g(t+15)} ${g(r)} ${g(i-15)} ${g(r)} ${g(i)}`;let a=t+30,o=i-30;return`M${g(e)} ${g(t)}C${g(e)} ${g(t+15)} ${g(n)} ${g(a-15)} ${g(n)} ${g(a)}L${g(n)} ${g(o)}C${g(n)} ${g(o+15)} ${g(r)} ${g(i-15)} ${g(r)} ${g(i)}`}function v(e,t,n=0){let r=new Map(e.commits.map((e,t)=>[e.hash,t])),i=[];return e.commits.forEach((a,o)=>{if(o<n)return;let s=m(a.lane),c=(t.top[o]??0)+15;for(let n of a.edges){let a=r.get(n.to),o=a===void 0?void 0:e.commits[a];if(a===void 0||!o){let e=m(n.lane);i.push(`M${g(s)} ${g(c)}C${g(s)} ${g(c+15)} ${g(e)} ${g(c+15)} ${g(e)} ${g(c+30)}L${g(e)} ${g(t.height)}`)}else i.push(_(s,c,m(n.lane),m(o.lane),(t.top[a]??0)+15))}}),i.join(``)}var y=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function b(e){let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e??``);return t?`${Number(t[3])} ${y[Number(t[2])-1]} ${t[1]}`:``}function x(e,t){let[n,r]=[b(e),b(t)];return n===r?n:`${n} to ${r}`}function S(e,t){return e===1?`1 ${t}`:`${e} ${t}s`}function C(e){return{label:e.path,rows:new Map(e.events.map(e=>[e.row,e.kind]))}}function w(e,t,n,r){let i=new Set(n),a=new Map;return e.commits.forEach((e,t)=>{i.has(e.hash)&&a.set(t,r)}),{label:t,rows:a}}function T(e,t){let n=new Map;return e.commits.forEach((e,r)=>{e.ai_tools.includes(t)&&n.set(r,t)}),{label:`Marked as made with ${t}`,rows:n}}function E(e,t,n,r){let i=`${t} + ${n}`,a=e.files.find(e=>e.path===t),o=e.files.find(e=>e.path===n);if(!a||!o)return w(e,i,r,`together`);let s=new Set(o.events.map(e=>e.row)),c=new Map;for(let e of a.events)s.has(e.row)&&c.set(e.row,`together`);return{label:i,rows:c}}function D(e,t){let n=t=>e.events.filter(e=>e.kind===t).length,r=e.events[e.events.length-1],i=[];r?.kind===`added`?i.push(`added ${b(t[r.row]?.date)}`):i.push(`here before the oldest commit shown`),n(`changed`)&&i.push(`changed ${S(n(`changed`),`time`)}`);let a=e.events.filter(e=>e.kind===`renamed`&&e.was),o=a[a.length-1];return o&&i.push(`renamed from ${o.was}`),i.push(e.alive?`still there`:`deleted ${b(t[e.events[0]?.row??-1]?.date)}`),`${i.join(`, `)}.`}function O(e){if(!e||typeof e!=`object`)return null;let t=e;return!t.repo||typeof t.repo.name!=`string`||!Array.isArray(t.commits)||!Array.isArray(t.chapters)||t.commits.some(e=>!e||typeof e.hash!=`string`||!Array.isArray(e.edges))?null:{...t,hotspots:t.hotspots??[],couplings:t.couplings??[],fix_chains:t.fix_chains??[],one_person_areas:t.one_person_areas??[],files:t.files??[],ai_marks:t.ai_marks??[]}}var k=t(),A=12e3;function j({parts:e,onCommit:t}){return(0,k.jsx)(k.Fragment,{children:e.map((e,n)=>e.commit?(0,k.jsx)(`button`,{type:`button`,className:f.cite,onClick:()=>t(e.commit),title:`Show this commit on the tree`,children:e.text},n):(0,k.jsx)(`span`,{children:e.text},n))})}function M({data:e,onCommit:t,onChapter:n}){let r=e.chapters.some(e=>e.written_by===`model`);return(0,k.jsx)(a,{title:`Chapters`,count:e.chapters.length,note:r?`Written by the model from the commit messages`:`Written from a template`,children:(0,k.jsx)(`ol`,{className:f.chapters,children:e.chapters.map(e=>(0,k.jsxs)(`li`,{className:f.chapter,children:[(0,k.jsx)(`span`,{className:f.chapterNo,children:String(e.index).padStart(2,`0`)}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h3`,{className:f.chapterTitle,children:(0,k.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:`Go to this chapter on the tree`,children:e.title})}),(0,k.jsx)(`p`,{className:f.prose,children:(0,k.jsx)(j,{parts:e.summary,onCommit:t})}),(0,k.jsxs)(`p`,{className:f.chapterMeta,children:[x(e.start,e.end),` · `,S(e.commits,`commit`),e.areas.length>0&&` · ${e.areas.map(e=>e.path).join(`, `)}`]})]})]},e.index))})})}function N({title:e,why:t,items:n,onShow:r}){return n.length?(0,k.jsxs)(`div`,{className:f.group,children:[(0,k.jsx)(`h3`,{className:f.groupTitle,children:e}),(0,k.jsx)(`p`,{className:f.groupWhy,children:t}),(0,k.jsx)(`ul`,{className:f.items,children:n.map(e=>(0,k.jsx)(`li`,{children:(0,k.jsxs)(`button`,{type:`button`,className:f.item,onClick:()=>r(e.show()),title:`Show on the tree`,children:[(0,k.jsx)(`code`,{className:f.itemWhat,children:e.what}),(0,k.jsx)(`span`,{className:f.itemDetail,children:e.detail})]})},e.key))})]}):null}function P({data:e,onShow:t}){let n=(t,n)=>()=>{let r=e.files.find(e=>e.path===t);return r?C(r):w(e,t,n,`changed`)};return e.hotspots.length+e.couplings.length+e.fix_chains.length+e.one_person_areas.length+e.ai_marks.length?(0,k.jsx)(a,{title:`What it shows`,note:`Counted from the history. Pick one to see it on the tree.`,children:(0,k.jsxs)(`div`,{className:f.groups,children:[(0,k.jsx)(N,{title:`Files that change the most`,why:`Large code files that keep changing are where bugs tend to be.`,onShow:t,items:e.hotspots.map(e=>({key:e.path,what:e.path,detail:`${S(e.touches,`commit`)}${e.lines?`, ${S(e.lines,`line`)} long`:``}`,show:n(e.path,e.commits)}))}),(0,k.jsx)(N,{title:`Files that change together`,why:`In different folders, but nearly always in the same commit. A change to one probably needs the other.`,onShow:t,items:e.couplings.map(t=>({key:`${t.a}+${t.b}`,what:(0,k.jsxs)(k.Fragment,{children:[t.a,(0,k.jsx)(`br`,{}),t.b]}),detail:`Together in ${t.together} of the ${t.a_touches+t.b_touches-t.together} commits that changed either`,show:()=>E(e,t.a,t.b,t.commits)}))}),(0,k.jsx)(N,{title:`Runs of quick fixes`,why:`A commit followed within the hour by fix after fix to the same files.`,onShow:t,items:e.fix_chains.map(t=>({key:t.commits.join(),what:(t.commits[0]??``).slice(0,7),detail:`${t.commits.length-1} fixes within ${S(t.minutes,`minute`)}${t.files.length?`, in ${t.files.join(`, `)}`:``}`,show:()=>w(e,`A run of quick fixes`,t.commits,`fix`)}))}),e.one_person_areas.length>0&&(0,k.jsxs)(`div`,{className:f.group,children:[(0,k.jsx)(`h3`,{className:f.groupTitle,children:`Areas with one author`}),(0,k.jsx)(`p`,{className:f.groupWhy,children:`Nearly every change here was made by the same person. Nobody else has worked on these parts.`}),(0,k.jsx)(`ul`,{className:f.items,children:e.one_person_areas.map(e=>(0,k.jsxs)(`li`,{className:f.plainItem,children:[(0,k.jsx)(`code`,{className:f.itemWhat,children:e.path}),(0,k.jsxs)(`span`,{className:f.itemDetail,children:[`One person made `,Math.round(e.share*100),`% of `,e.touches,` file changes`]})]},e.path))})]}),(0,k.jsx)(N,{title:`AI tool marks`,why:`Commits whose message says an AI tool took part. Reported as found, never scored: a mark does not say how much the tool wrote.`,onShow:t,items:e.ai_marks.map(t=>({key:t.tool,what:t.tool,detail:`${S(t.commits,`commit`)}, first on ${b(t.first_seen)}`,show:()=>T(e,t.tool)}))})]})}):null}function F({commit:e,onClose:t}){let n=e.files_changed-e.files.length;return(0,k.jsxs)(`div`,{className:f.detail,children:[(0,k.jsxs)(`div`,{className:f.detailHead,children:[(0,k.jsx)(`p`,{className:f.detailSubject,children:e.subject}),(0,k.jsx)(u,{variant:`text`,size:`s`,icon:`close`,onClick:t,"aria-label":`Close the commit`,children:`Close`})]}),(0,k.jsxs)(`p`,{className:f.detailMeta,children:[(0,k.jsx)(`code`,{children:e.short}),` · `,e.author,` · `,b(e.date),e.parents.length>1&&` · a merge`]}),e.notes.length>0&&(0,k.jsx)(`ul`,{className:f.detailNotes,children:e.notes.map(e=>(0,k.jsx)(`li`,{"data-flagged":e.flagged||void 0,children:e.text},e.text))}),e.files.length>0&&(0,k.jsxs)(`p`,{className:f.detailFiles,children:[e.files.map(e=>(0,k.jsx)(`code`,{children:e},e)),n>0&&(0,k.jsxs)(`span`,{children:[`and `,n,` more`]})]})]})}function I({data:e,geo:t,upTo:n,selected:r,highlight:i,onSelect:a}){let o=(0,d.useMemo)(()=>v(e,t,n),[e,t,n]),s=new Map(e.chapters.map(e=>[e.index,e]));return(0,k.jsxs)(`div`,{className:f.rows,style:{height:t.height},children:[(0,k.jsxs)(`svg`,{className:f.lines,width:t.lanesWidth,height:t.height,viewBox:`0 0 ${t.lanesWidth} ${t.height}`,"aria-hidden":`true`,children:[(0,k.jsx)(`path`,{d:o}),e.commits.map((e,a)=>a<n?null:(0,k.jsx)(`circle`,{cx:m(e.lane),cy:(t.top[a]??0)+15,r:e.hash===r||i?.rows.has(a)?5:3.5,"data-merge":e.parents.length>1||void 0,"data-flagged":e.notes.some(e=>e.flagged)||void 0,"data-lit":i?.rows.has(a)||void 0},e.hash))]}),[...t.chapterTop].map(([e,r])=>{let i=s.get(e);return i?(0,k.jsxs)(`div`,{className:f.chapterRow,style:{top:r,height:46,paddingLeft:t.lanesWidth+8},"data-hidden":i.last_row<n||void 0,"data-chapter":e,children:[(0,k.jsxs)(`span`,{className:f.hang,children:[`Chapter `,e]}),(0,k.jsx)(`span`,{className:f.chapterRowTitle,children:i.title}),(0,k.jsx)(`span`,{className:f.chapterRowDates,children:x(i.start,i.end)})]},`chapter-${e}`):null}),e.commits.map((e,o)=>{let s=i?.rows.get(o),c=e.notes.some(e=>e.flagged),l=e.notes.filter(e=>e.kind!==`ai`);return(0,k.jsxs)(`button`,{type:`button`,className:f.row,style:{top:t.top[o],height:30,paddingLeft:t.lanesWidth+8},"data-row":o,"data-selected":e.hash===r||void 0,"data-hidden":o<n||void 0,"data-dim":i&&s===void 0||void 0,"aria-pressed":e.hash===r,onClick:()=>a(e),children:[(s||l.length>0)&&(0,k.jsx)(`span`,{className:f.hang,"data-flagged":!s&&c||void 0,"data-lit":!!s||void 0,children:s??l.map(e=>e.text).join(` · `)}),(0,k.jsx)(`span`,{className:f.subject,children:e.subject}),e.tags.map(e=>(0,k.jsx)(`span`,{className:`tag ${f.ref}`,"data-tone":`ink`,children:e},e)),e.ai_tools.map(e=>(0,k.jsx)(`span`,{className:`tag ${f.ref}`,children:e},e)),(0,k.jsxs)(`span`,{className:f.meta,children:[(0,k.jsx)(`code`,{children:e.short}),(0,k.jsx)(`span`,{className:f.date,children:b(e.date)})]})]},e.hash)})]})}function L({run:t,result:i,data:a}){let o=a.commits.length,s=(0,d.useMemo)(()=>h(a),[a]),p=(0,d.useRef)(null),[m,g]=(0,d.useState)(null),[_,v]=(0,d.useState)(null),[y,w]=(0,d.useState)(0),[T,E]=(0,d.useState)(!1),[O,j]=(0,d.useState)(``),N=(e,t=`center`)=>{p.current?.querySelector(`[data-row="${e}"]`)?.scrollIntoView?.({behavior:`smooth`,block:t})};(0,d.useEffect)(()=>{if(!T)return;let e=Math.max(1,Math.ceil(o/600)),t=window.setInterval(()=>{w(t=>{let n=Math.max(0,t-e);return n===0&&E(!1),p.current?.querySelector(`[data-row="${n}"]`)?.scrollIntoView?.({behavior:`auto`,block:`center`}),n})},Math.min(250,Math.max(16,A/o*e)));return()=>window.clearInterval(t)},[T,o]);let L=()=>{if(T)return E(!1);y===0&&w(o-1),E(!0)},R=e=>{let t=a.commits.findIndex(t=>t.hash===e);t<0||(g(e),t<y&&w(0),N(t))},z=e=>{v(e),w(0),E(!1);let t=Math.min(...e.rows.keys());Number.isFinite(t)?N(t):p.current?.scrollIntoView?.({behavior:`smooth`,block:`start`})},B=e=>{j(e);let t=a.files.find(t=>t.path===e);t&&z(C(t))},V=a.repo,H=a.commits[y],U=_?a.files.find(e=>e.path===_.label):void 0,W=m?a.commits.find(e=>e.hash===m):void 0;return(0,k.jsxs)(e,{children:[(0,k.jsx)(c,{result:i}),(0,k.jsxs)(r,{label:`History`,note:(0,k.jsxs)(k.Fragment,{children:[V.branch&&(0,k.jsx)(`span`,{className:f.branch,children:V.branch}),V.renames_followed===`exact`&&(0,k.jsx)(`span`,{children:`Renames followed only when the file did not change`})]}),children:[(0,k.jsx)(`p`,{className:f.lead,children:V.name}),(0,k.jsxs)(`p`,{className:f.sub,children:[V.truncated?`The newest ${V.shown} of ${V.total_commits} commits`:S(V.shown,`commit`),V.first_date&&V.last_date&&`, ${x(V.first_date,V.last_date)}`,V.authors>0&&`, by ${S(V.authors,`person`).replace(`persons`,`people`)}`]}),(0,k.jsx)(l,{run:t,result:i})]}),o>0&&(0,k.jsx)(M,{data:a,onCommit:R,onChapter:e=>{w(0),N(e.first_row,`start`)}}),(0,k.jsx)(P,{data:a,onShow:z}),o>0&&(0,k.jsxs)(`div`,{ref:p,className:f.anchor,children:[(0,k.jsx)(r,{label:`Tree`,count:o,note:`Newest first. Pick a commit to read it.`,children:a.files.length>0&&(0,k.jsxs)(`label`,{className:f.follow,children:[(0,k.jsx)(`span`,{children:`Follow a file`}),(0,k.jsx)(`input`,{className:f.followInput,list:`history-files`,value:O,placeholder:`Type a path`,onChange:e=>B(e.target.value)}),(0,k.jsx)(`datalist`,{id:`history-files`,children:[...new Set(a.files.map(e=>e.path))].map(e=>(0,k.jsx)(`option`,{value:e},e))})]})}),(0,k.jsxs)(`div`,{className:`m-grid ${f.tree}`,children:[(0,k.jsx)(`div`,{}),(0,k.jsxs)(`div`,{className:f.column,children:[(0,k.jsxs)(`div`,{className:f.bar,children:[(0,k.jsxs)(`div`,{className:f.replay,children:[(0,k.jsx)(u,{variant:`outlined`,size:`s`,icon:T?void 0:`play`,onClick:L,children:T?`Pause`:y===0?`Replay`:`Play`}),(0,k.jsx)(`input`,{type:`range`,className:f.slider,min:0,max:o-1,value:o-1-y,"aria-label":`Replay the history`,onChange:e=>{let t=o-1-Number(e.target.value);E(!1),w(t),p.current?.querySelector(`[data-row="${t}"]`)?.scrollIntoView?.({behavior:`auto`,block:`center`})}}),(0,k.jsx)(`span`,{className:f.replayAt,children:y===0?`The whole history`:`Up to ${b(H?.date)} · chapter ${H?.chapter}`})]}),_&&(0,k.jsxs)(`p`,{className:f.lit,children:[(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`code`,{children:_.label}),U?`: ${D(U,a.commits)}`:`: ${S(_.rows.size,`commit`)}`]}),(0,k.jsx)(u,{variant:`text`,size:`s`,icon:`close`,onClick:()=>{v(null),j(``)},children:`Clear`})]}),W&&(0,k.jsx)(F,{commit:W,onClose:()=>g(null)})]}),(0,k.jsx)(I,{data:a,geo:s,upTo:y,selected:m,highlight:_,onSelect:e=>g(e.hash===m?null:e.hash)})]})]})]}),(0,k.jsx)(n,{result:i})]})}function R(e){let t=e.result.status===`error`?null:O(e.result.data);return t?(0,k.jsx)(L,{...e,data:t}):(0,k.jsx)(s,{...e})}export{R as HistoryResult};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._lead_52n2l_3{letter-spacing:-.028em;font-size:30px;font-weight:700;font-stretch:96%;line-height:36px}._sub_52n2l_11{color:var(--ink-2);margin:6px 0 18px;font-size:15px;line-height:22px}._branch_52n2l_18{font-family:var(--font-mono);font-size:11.5px;display:block}._anchor_52n2l_24{scroll-margin-top:16px}._chapters_52n2l_30{gap:22px;margin:0;padding:0;list-style:none;display:grid}._chapter_52n2l_30{grid-template-columns:28px minmax(0,1fr);column-gap:10px;display:grid}._chapterNo_52n2l_44{font-family:var(--font-mono);color:var(--ink-3);padding-top:3px;font-size:12px}._chapterTitle_52n2l_51{letter-spacing:-.012em;font-size:17px;font-weight:650;line-height:24px}._chapterTitle_52n2l_51 button{text-align:left}._chapterTitle_52n2l_51 button:hover{text-underline-offset:3px;text-decoration:underline;text-decoration-thickness:1px}._prose_52n2l_69{max-width:var(--measure);font-family:var(--font-serif);margin-top:4px;font-size:17px;line-height:26px}._cite_52n2l_77{font-family:var(--font-mono);text-decoration:underline;-webkit-text-decoration-color:var(--rule-2);text-decoration-color:var(--rule-2);text-underline-offset:3px;font-size:.8em;text-decoration-thickness:1px}._cite_52n2l_77:hover{text-decoration-color:currentColor}._chapterMeta_52n2l_90{color:var(--ink-3);margin-top:6px;font-size:12px;line-height:18px}._groups_52n2l_99{grid-template-columns:repeat(auto-fit,minmax(min(320px,100%),1fr));gap:30px 40px;display:grid}._groupTitle_52n2l_105{font-size:14px;font-weight:650;line-height:20px}._groupWhy_52n2l_111{color:var(--ink-2);margin-top:2px;font-size:13px;line-height:19px}._items_52n2l_118{margin:10px 0 0;padding:0;list-style:none}._item_52n2l_118,._plainItem_52n2l_125{border-top:1px solid var(--rule);text-align:left;gap:1px;width:100%;padding:7px 0;display:grid}._item_52n2l_118:hover ._itemWhat_52n2l_134{text-underline-offset:3px;text-decoration:underline;text-decoration-thickness:1px}._itemWhat_52n2l_134{font-family:var(--font-mono);overflow-wrap:anywhere;font-size:12px;line-height:18px}._itemDetail_52n2l_147{color:var(--ink-3);font-size:12.5px;line-height:18px}._follow_52n2l_155{flex-wrap:wrap;align-items:center;gap:10px;font-size:13px;font-weight:550;display:flex}._followInput_52n2l_164{border:1px solid var(--rule-2);border-radius:var(--radius);background:var(--paper-raised);max-width:460px;height:34px;font-family:var(--font-mono);color:var(--ink);flex:240px;padding:0 10px;font-size:12.5px;font-weight:400}._followInput_52n2l_164:focus{border-color:var(--ink);outline:none}._tree_52n2l_183{margin-top:-22px;padding-bottom:44px}._column_52n2l_188{min-width:0}._bar_52n2l_193{z-index:3;border-bottom:1px solid var(--rule);background:var(--paper);margin-bottom:10px;padding:10px 0;position:sticky;top:0}._bar_52n2l_193:before{content:"";top:0;right:calc(100% + var(--gutter) * 2);width:var(--margin-w);background:var(--paper);position:absolute;bottom:0}._replay_52n2l_214{align-items:center;gap:12px;display:flex}._slider_52n2l_220{min-width:0;accent-color:var(--ink);flex:1}._replayAt_52n2l_226{min-width:150px;color:var(--ink-3);text-align:right;flex-shrink:0;font-size:12px}._lit_52n2l_234{justify-content:space-between;align-items:start;gap:12px;margin-top:8px;font-size:13px;line-height:20px;display:flex}._lit_52n2l_234 code{font-family:var(--font-mono);overflow-wrap:anywhere;font-size:12px}._detail_52n2l_250{border-top:1px solid var(--rule);margin-top:10px;padding-top:10px}._detailHead_52n2l_256{justify-content:space-between;align-items:start;gap:12px;display:flex}._detailSubject_52n2l_263{overflow-wrap:anywhere;font-size:15px;font-weight:600;line-height:22px}._detailMeta_52n2l_270{color:var(--ink-3);margin-top:2px;font-size:12.5px}._detailMeta_52n2l_270 code,._detailFiles_52n2l_277 code{font-family:var(--font-mono);font-size:11.5px}._detailNotes_52n2l_282{margin:6px 0 0;padding:0;font-size:13px;line-height:20px;list-style:none}._detailNotes_52n2l_282 [data-flagged]{color:var(--red)}._detailFiles_52n2l_277{color:var(--ink-2);flex-wrap:wrap;gap:2px 14px;margin-top:6px;font-size:12px;display:flex}._rows_52n2l_303{position:relative}._lines_52n2l_307{z-index:1;pointer-events:none;position:absolute;top:0;left:0}._lines_52n2l_307 path{fill:none;stroke:var(--ink-3);stroke-width:1.25px}._lines_52n2l_307 circle{fill:var(--ink);stroke:var(--paper);stroke-width:1.5px}._lines_52n2l_307 circle[data-merge]{fill:var(--paper);stroke:var(--ink)}._lines_52n2l_307 circle[data-flagged]{fill:var(--red)}._lines_52n2l_307 circle[data-merge][data-flagged]{fill:var(--paper);stroke:var(--red)}._row_52n2l_303,._chapterRow_52n2l_342{gap:8px;display:flex;position:absolute;left:0;right:0}._row_52n2l_303{border-radius:var(--radius);text-align:left;align-items:center;padding-right:6px;font-size:13.5px}._row_52n2l_303:hover,._row_52n2l_303[data-selected]{background:var(--paper-sunk)}._row_52n2l_303[data-hidden],._chapterRow_52n2l_342[data-hidden]{visibility:hidden}._row_52n2l_303[data-dim]>:not(._hang_52n2l_368){opacity:.36}._hang_52n2l_368{top:50%;right:calc(100% + var(--gutter) * 2);width:var(--margin-w);color:var(--ink-3);text-align:right;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;position:absolute;overflow:hidden;transform:translateY(-50%)}._hang_52n2l_368[data-flagged]{color:var(--red)}._hang_52n2l_368[data-lit]{color:var(--ink);font-weight:600}._subject_52n2l_397{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._ref_52n2l_404{font-family:var(--font-mono);flex-shrink:0}._meta_52n2l_409{color:var(--ink-3);flex-shrink:0;gap:12px;margin-left:auto;padding-left:8px;font-size:12px;display:flex}._meta_52n2l_409 code{font-family:var(--font-mono);font-size:11.5px}._chapterRow_52n2l_342{border-top:1px solid var(--rule);align-items:baseline;padding-top:18px}._chapterRow_52n2l_342 ._hang_52n2l_368{color:var(--ink);font-weight:600;top:18px;transform:none}._chapterRowTitle_52n2l_437{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:15px;font-weight:650;overflow:hidden}._chapterRowDates_52n2l_446{color:var(--ink-3);flex-shrink:0;font-size:12px}@media (width<=760px){._tree_52n2l_183{margin-top:0}._hang_52n2l_368,._date_52n2l_459,._replayAt_52n2l_226,._bar_52n2l_193:before{display:none}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._storyTitle_1ne3g_5{max-width:820px;font-family:var(--font-serif);letter-spacing:-.028em;font-size:52px;font-weight:400;line-height:56px}._hint_1ne3g_14{color:var(--ink-3);margin-top:14px;font-size:13px}._numberSample_1ne3g_20{color:var(--ink-2);text-decoration:underline;-webkit-text-decoration-color:var(--blue);text-decoration-color:var(--blue);text-underline-offset:3px;text-decoration-thickness:2px}._context_1ne3g_28{max-width:var(--measure);color:var(--ink-2);margin-top:10px}._pageNo_1ne3g_36{font-family:var(--font-mono);color:var(--ink-2);font-size:12px;font-weight:400}._pageTitle_1ne3g_43{max-width:760px;font-family:var(--font-serif);letter-spacing:-.018em;font-size:32px;font-weight:400;line-height:38px}._nobreak_1ne3g_52{white-space:nowrap}._headline_1ne3g_56{max-width:var(--measure);font-family:var(--font-serif);margin-top:12px;font-size:20px;line-height:30px}._together_1ne3g_64{white-space:nowrap}._number_1ne3g_20{font:inherit;font-variant-numeric:lining-nums tabular-nums;color:var(--ink);text-decoration:underline;-webkit-text-decoration-color:var(--blue);text-decoration-color:var(--blue);text-underline-offset:3px;transition:background-color var(--fast) var(--ease);border-radius:1px;font-weight:500;text-decoration-thickness:2px}._number_1ne3g_20:hover{background:var(--blue-tint)}._charts_1ne3g_85{grid-template-columns:repeat(2,minmax(0,1fr));gap:36px 40px;margin-top:32px;display:grid}._charts_1ne3g_85[data-count="1"]{grid-template-columns:minmax(0,1fr)}._charts_1ne3g_85[data-count="3"]>:first-child{grid-column:1/-1}._body_1ne3g_100{max-width:var(--measure);font-family:var(--font-serif);color:var(--ink-2);gap:12px;margin-top:28px;font-size:17.5px;line-height:27px;display:grid}._actions_1ne3g_111{border-top:1px solid var(--rule);counter-reset:action;max-width:760px;margin-top:24px;display:grid}._actions_1ne3g_111 li{border-bottom:1px solid var(--rule);counter-increment:action;gap:3px;padding:14px 0 14px 34px;display:grid;position:relative}._actions_1ne3g_111 li:before{content:counter(action);font-family:var(--font-mono);color:var(--ink-3);font-size:12px;position:absolute;top:16px;left:0}._actionText_1ne3g_138{font-family:var(--font-serif);font-size:18.5px;line-height:26px}._actionCheck_1ne3g_144{color:var(--ink-2);font-size:13.5px;line-height:20px}._actionCheck_1ne3g_144 b{color:var(--ink);font-weight:600}._figure_1ne3g_157{border-top:1px solid var(--ink);align-content:start;gap:12px;min-width:0;padding-top:12px;display:grid}._figHead_1ne3g_166{flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:4px 16px;display:flex}._figActions_1ne3g_174{gap:14px;display:inline-flex}._link_1ne3g_179{color:var(--ink-3);text-decoration:underline;-webkit-text-decoration-color:var(--rule-2);text-decoration-color:var(--rule-2);text-underline-offset:3px;white-space:nowrap;font-size:12px}._link_1ne3g_179:hover{color:var(--ink);text-decoration-color:currentColor}._plot_1ne3g_193{min-width:0;position:relative}._svg_1ne3g_198{touch-action:pan-y;width:100%;height:auto;display:block;overflow:visible}._grid_1ne3g_206{stroke:var(--rule);stroke-width:1px;shape-rendering:crispedges}._tick_1ne3g_212{fill:var(--ink-3);font-family:var(--font-mono);font-size:10.5px}._rowLabel_1ne3g_218{fill:var(--ink-2);font-family:var(--font-sans);font-size:12.5px}._valueLabel_1ne3g_224{fill:var(--ink);font-family:var(--font-mono);font-size:11.5px;font-weight:500}._area_1ne3g_231{fill:color-mix(in srgb, var(--ink) 6%, transparent)}._line_1ne3g_235{fill:none;stroke:var(--ink);stroke-width:1.75px;stroke-linejoin:round;stroke-linecap:round}._endDot_1ne3g_243{fill:var(--ink);stroke:var(--paper);stroke-width:2px}._highlightDot_1ne3g_250{fill:var(--red);stroke:var(--paper);stroke-width:2px}._crosshair_1ne3g_256{stroke:var(--ink-3);stroke-width:1px;stroke-dasharray:2 3}._bar_1ne3g_262{fill:var(--rule-2)}._barStrong_1ne3g_266{fill:var(--ink)}._stem_1ne3g_270{stroke-width:2px}._soft_1ne3g_274 ._stem_1ne3g_270{stroke:var(--rule-2)}._soft_1ne3g_274 ._hollow_1ne3g_278{fill:var(--paper);stroke:var(--ink-3);stroke-width:1.5px}._soft_1ne3g_274 ._solid_1ne3g_284{fill:var(--ink-3)}._strong_1ne3g_288 ._stem_1ne3g_270{stroke:var(--ink)}._strong_1ne3g_288 ._hollow_1ne3g_278{fill:var(--paper);stroke:var(--ink);stroke-width:1.5px}._strong_1ne3g_288 ._solid_1ne3g_284{fill:var(--ink)}._strong_1ne3g_288 ._rowLabel_1ne3g_218{fill:var(--ink);font-weight:600}._legend_1ne3g_307{color:var(--ink-3);gap:16px;margin-bottom:6px;font-size:12px;display:flex}._legend_1ne3g_307>span{align-items:center;gap:6px;display:inline-flex}._keyHollow_1ne3g_321,._keySolid_1ne3g_322{border:1.5px solid var(--ink);border-radius:50%;width:9px;height:9px}._keySolid_1ne3g_322{background:var(--ink)}._tooltip_1ne3g_333{z-index:2;border-radius:var(--radius);background:var(--ink);color:var(--on-ink);white-space:nowrap;pointer-events:none;padding:5px 9px;font-size:11.5px;line-height:16px;display:grid;position:absolute;translate:-50% -100%}._tooltip_1ne3g_333 strong{font-family:var(--font-mono);font-weight:500}._tooltip_1ne3g_333 span{opacity:.7}._meter_1ne3g_357{gap:8px;display:grid}._meterValue_1ne3g_362{font-family:var(--font-serif);letter-spacing:-.03em;font-variant-numeric:lining-nums;font-size:64px;line-height:64px}._track_1ne3g_370{background:var(--rule);height:6px}._track_1ne3g_370 span{background:var(--ink);height:100%;display:block}._note_1ne3g_381{max-width:var(--measure)}._tableWrap_1ne3g_387{overflow-x:auto}._table_1ne3g_387{border-collapse:collapse;width:100%;font-size:13.5px;line-height:20px}._table_1ne3g_387 th,._table_1ne3g_387 td{border-bottom:1px solid var(--rule);text-align:left;vertical-align:baseline;padding:7px 16px 7px 0}._table_1ne3g_387 thead th{border-bottom-color:var(--ink);color:var(--ink-2);font-size:12px;font-weight:600}._table_1ne3g_387 tbody th{white-space:nowrap;font-weight:600}._table_1ne3g_387 td{color:var(--ink-2)}._figure_1ne3g_157 ._table_1ne3g_387 td{font-family:var(--font-mono);text-align:right;font-size:12.5px}._figure_1ne3g_157 ._table_1ne3g_387 thead th:not(:first-child){text-align:right}._table_1ne3g_387 tr[data-highlight] th,._table_1ne3g_387 tr[data-highlight] td{color:var(--ink);background:var(--paper-sunk)}._personal_1ne3g_438{margin-left:8px}._colNotes_1ne3g_442{font-size:12.5px}._cleaning_1ne3g_448{gap:16px;max-width:860px;display:grid}._cleaningLead_1ne3g_454{font-family:var(--font-mono);font-size:13px}._steps_1ne3g_459{border-top:1px solid var(--rule)}._steps_1ne3g_459 li{border-bottom:1px solid var(--rule);grid-template-columns:124px minmax(0,1fr);align-items:baseline;gap:6px 16px;padding:10px 0;display:grid}._steps_1ne3g_459 .tag{justify-self:start}._examples_1ne3g_476{flex-wrap:wrap;grid-column:2;gap:4px 20px;display:flex}._examples_1ne3g_476 code{color:var(--ink-3);font-size:11.5px}._checks_1ne3g_488{color:var(--ink-2);gap:4px;font-size:13px;display:grid}._checks_1ne3g_488 li{align-items:baseline;gap:8px;display:flex}._checks_1ne3g_488 .icon{color:var(--blue);align-self:center}._refused_1ne3g_506{max-width:760px;color:var(--ink-2);gap:8px;font-size:13px;line-height:19px;display:grid}._panel_1ne3g_517{z-index:10;border-left:1px solid var(--ink);background:var(--paper-raised);width:min(420px,100vw);box-shadow:var(--shadow-pop);animation:_slip_1ne3g_1 var(--med) var(--ease) both;align-content:start;gap:14px;padding:20px 24px 32px;display:grid;position:fixed;top:0;bottom:0;right:0;overflow-y:auto}@keyframes _slip_1ne3g_1{0%{opacity:0;translate:24px}}._panelHead_1ne3g_539{justify-content:space-between;align-items:center;display:flex}._factId_1ne3g_545{font-family:var(--font-mono);color:var(--blue);font-size:12px}._close_1ne3g_551{border-radius:var(--radius);width:28px;height:28px;color:var(--ink-2);place-items:center;margin-right:-6px;display:grid}._close_1ne3g_551:hover{background:var(--paper-sunk);color:var(--ink)}._factTitle_1ne3g_566{color:var(--ink-2);font-size:13px;font-weight:600;line-height:19px}._factStatement_1ne3g_573{font-family:var(--font-serif);letter-spacing:-.008em;font-size:21px;line-height:29px}._factFacts_1ne3g_580{border-top:1px solid var(--rule);margin-top:4px;display:grid}._factFacts_1ne3g_580>div{border-bottom:1px solid var(--rule);gap:2px;padding:10px 0;display:grid}._factFacts_1ne3g_580 dt{color:var(--ink-3);font-size:12px;line-height:16px}._factFacts_1ne3g_580 dd{font-size:14px;line-height:21px}._factRows_1ne3g_604{font-family:var(--font-mono)}._confidence_1ne3g_608{text-transform:capitalize;font-weight:600}._confidence_1ne3g_608[data-level=low]{color:var(--red)}._checked_1ne3g_617{color:var(--blue);align-items:baseline;gap:6px;display:inline-flex}._checked_1ne3g_617 .icon{align-self:center}._caveats_1ne3g_628{color:var(--ink-2);gap:8px;font-size:13px;line-height:19px;display:grid}._caveats_1ne3g_628 li{border-left:2px solid var(--red);padding-left:12px}._sql_1ne3g_641 summary{cursor:pointer;font-size:13px;font-weight:600}._sql_1ne3g_641 pre{border:1px solid var(--rule);border-radius:var(--radius);background:var(--paper);margin-top:10px;padding:10px 12px;font-size:11.5px;line-height:17px;overflow-x:auto}@media (width<=900px){._charts_1ne3g_85{grid-template-columns:minmax(0,1fr)}}@media (width<=760px){._storyTitle_1ne3g_5{font-size:36px;line-height:40px}._pageTitle_1ne3g_43{font-size:26px;line-height:32px}._steps_1ne3g_459 li{grid-template-columns:minmax(0,1fr)}._examples_1ne3g_476{grid-column:1}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,d as t,f as n,i as r,l as i,m as a,o,p as s,r as c,s as l,t as u}from"./index-B3Snzalk.js";var d=a(s(),1),f={storyTitle:`_storyTitle_1ne3g_5`,hint:`_hint_1ne3g_14`,numberSample:`_numberSample_1ne3g_20`,context:`_context_1ne3g_28`,pageNo:`_pageNo_1ne3g_36`,pageTitle:`_pageTitle_1ne3g_43`,nobreak:`_nobreak_1ne3g_52`,headline:`_headline_1ne3g_56`,together:`_together_1ne3g_64`,number:`_number_1ne3g_20`,charts:`_charts_1ne3g_85`,body:`_body_1ne3g_100`,actions:`_actions_1ne3g_111`,actionText:`_actionText_1ne3g_138`,actionCheck:`_actionCheck_1ne3g_144`,figure:`_figure_1ne3g_157`,figHead:`_figHead_1ne3g_166`,figActions:`_figActions_1ne3g_174`,link:`_link_1ne3g_179`,plot:`_plot_1ne3g_193`,svg:`_svg_1ne3g_198`,grid:`_grid_1ne3g_206`,tick:`_tick_1ne3g_212`,rowLabel:`_rowLabel_1ne3g_218`,valueLabel:`_valueLabel_1ne3g_224`,area:`_area_1ne3g_231`,line:`_line_1ne3g_235`,endDot:`_endDot_1ne3g_243`,highlightDot:`_highlightDot_1ne3g_250`,crosshair:`_crosshair_1ne3g_256`,bar:`_bar_1ne3g_262`,barStrong:`_barStrong_1ne3g_266`,stem:`_stem_1ne3g_270`,soft:`_soft_1ne3g_274`,hollow:`_hollow_1ne3g_278`,solid:`_solid_1ne3g_284`,strong:`_strong_1ne3g_288`,legend:`_legend_1ne3g_307`,keyHollow:`_keyHollow_1ne3g_321`,keySolid:`_keySolid_1ne3g_322`,tooltip:`_tooltip_1ne3g_333`,meter:`_meter_1ne3g_357`,meterValue:`_meterValue_1ne3g_362`,track:`_track_1ne3g_370`,note:`_note_1ne3g_381`,tableWrap:`_tableWrap_1ne3g_387`,table:`_table_1ne3g_387`,personal:`_personal_1ne3g_438`,colNotes:`_colNotes_1ne3g_442`,cleaning:`_cleaning_1ne3g_448`,cleaningLead:`_cleaningLead_1ne3g_454`,steps:`_steps_1ne3g_459`,examples:`_examples_1ne3g_476`,checks:`_checks_1ne3g_488`,refused:`_refused_1ne3g_506`,panel:`_panel_1ne3g_517`,slip:`_slip_1ne3g_1`,panelHead:`_panelHead_1ne3g_539`,factId:`_factId_1ne3g_545`,close:`_close_1ne3g_551`,factTitle:`_factTitle_1ne3g_566`,factStatement:`_factStatement_1ne3g_573`,factFacts:`_factFacts_1ne3g_580`,factRows:`_factRows_1ne3g_604`,confidence:`_confidence_1ne3g_608`,checked:`_checked_1ne3g_617`,caveats:`_caveats_1ne3g_628`,sql:`_sql_1ne3g_641`};function p(e){if(!e||typeof e!=`object`)return null;let t=e;return!t.source||!t.cleaning||!Array.isArray(t.columns)||!Array.isArray(t.cleaning.steps)||t.story&&!Array.isArray(t.story.pages)?null:t}function m(e,t,n){if(e==null||Number.isNaN(e))return`no value`;let r=e=>e.replace(/\.0$/,``);if(t===`percent`)return`${r((e*100).toFixed(1))}%`;if(t===`change`)return`${e>=0?`+`:``}${r((e*100).toFixed(1))}%`;if(t===`ratio`)return`${e.toFixed(1)} times`;if(t===`count`)return Math.round(e).toLocaleString(`en-US`);let i=Math.abs(e),a;return a=i>=1e9?`${(e/1e9).toFixed(2)}B`:i>=1e6?`${(e/1e6).toFixed(2)}M`:i>=1e4?Math.round(e).toLocaleString(`en-US`):i>=1?e.toLocaleString(`en-US`,{maximumFractionDigits:2}):Number(e.toPrecision(3)).toString(),n&&n!==`%`?n.length===1?`${n}${a}`:`${a} ${n}`:a}function h(e,t){if(t===`percent`)return`${Math.round(e*100)}%`;let n=Math.abs(e);return n>=1e6?`${Number((e/1e6).toFixed(1))}M`:n>=1e3?`${Number((e/1e3).toFixed(1))}K`:`${Number(e.toFixed(2))}`}var g=n();function _(){let e=(0,d.useRef)(null),[t,n]=(0,d.useState)(640);return(0,d.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(([e])=>{let t=Math.round(e?.contentRect.width??0);t>0&&n(t)});return r.observe(t),()=>r.disconnect()},[]),[e,t]}function v(e){let t=e.points.some(e=>Math.abs(e.value)>=1e3)&&e.format===`number`;return n=>m(t&&n!=null?Math.round(n):n,e.format,e.unit)}function y({tip:e}){return e?(0,g.jsxs)(`div`,{className:f.tooltip,style:{left:e.x,top:e.y},role:`status`,"aria-live":`polite`,children:[e.lines.map(e=>(0,g.jsx)(`strong`,{children:e},e)),(0,g.jsx)(`span`,{children:e.title})]}):null}function b(e){if(e<=0)return 1;let t=10**Math.floor(Math.log10(e));for(let n of[1,1.2,1.5,2,2.5,3,4,5,6,8,10])if(n*t>=e)return n*t;return 10*t}function x(e,t){let n=t=>((e[t]?.label.length??0)*6.6+12)/2,r=e.length-1,i=[r,0,...e.flatMap((e,t)=>e.highlight?[t]:[])],a=Math.max(1,Math.round(e.length/12));for(let e=a;e<r;e+=a)i.push(e);let o=new Set;for(let e of i)[...o].every(r=>Math.abs(t(e)-t(r))>=n(e)+n(r))&&o.add(e);return o}function S({chart:e}){let{points:t,format:n,unit:r}=e,[i,a]=_(),o=Math.round(Math.min(260,Math.max(180,a*.36))),s={l:44,r:64,t:18,b:30},c=v(e),l=t.map(e=>e.value),u=Math.min(0,...l),p=b(Math.max(...l)),S=e=>s.l+(t.length<2?0:e/(t.length-1)*(a-s.l-s.r)),C=e=>s.t+(1-(e-u)/(p-u||1))*(o-s.t-s.b),w=[0,.25,.5,.75,1].map(e=>u+e*(p-u)),T=t.map((e,t)=>`${t?`L`:`M`}${S(t).toFixed(1)},${C(e.value).toFixed(1)}`).join(` `),E=`${T} L${S(t.length-1)},${C(Math.max(u,0))} L${S(0)},${C(Math.max(u,0))} Z`,D=x(t,S),O=t.length-1,[k,A]=(0,d.useState)(null),j=(0,d.useRef)(null),M=e=>{let n=j.current?.getBoundingClientRect();if(!n)return;let r=(e.clientX-n.left)/n.width*a,i=0;t.forEach((e,t)=>{Math.abs(S(t)-r)<Math.abs(S(i)-r)&&(i=t)}),A(i)},N=k===null?null:t[k];return(0,g.jsxs)(`div`,{ref:i,className:f.plot,children:[(0,g.jsxs)(`svg`,{ref:j,viewBox:`0 0 ${a} ${o}`,className:f.svg,role:`img`,"aria-label":`${e.title}: from ${m(t[0]?.value,n,r)} in ${t[0]?.label} to ${m(t[O]?.value,n,r)} in ${t[O]?.label}. The table view lists every value.`,onPointerMove:M,onPointerLeave:()=>A(null),children:[w.map(e=>(0,g.jsxs)(`g`,{children:[(0,g.jsx)(`line`,{className:f.grid,x1:s.l,x2:a-s.r,y1:C(e),y2:C(e)}),(0,g.jsx)(`text`,{className:f.tick,x:s.l-8,y:C(e),textAnchor:`end`,dominantBaseline:`middle`,children:h(e,n)})]},e)),(0,g.jsx)(`path`,{d:E,className:f.area}),(0,g.jsx)(`path`,{d:T,className:f.line}),t.map((e,t)=>D.has(t)?(0,g.jsx)(`text`,{className:f.tick,x:S(t),y:o-8,textAnchor:`middle`,children:e.label},e.label):null),t.map((e,t)=>e.highlight?(0,g.jsxs)(`g`,{children:[(0,g.jsx)(`circle`,{className:f.highlightDot,cx:S(t),cy:C(e.value),r:5.5}),(0,g.jsx)(`text`,{className:f.valueLabel,x:S(t),y:C(e.value)-12,textAnchor:`middle`,children:c(e.value)})]},`h-${e.label}`):null),t[O]&&!t[O]?.highlight&&(0,g.jsxs)(`g`,{children:[(0,g.jsx)(`circle`,{className:f.endDot,cx:S(O),cy:C(t[O].value),r:4.5}),(0,g.jsx)(`text`,{className:f.valueLabel,x:S(O)+10,y:C(t[O].value),dominantBaseline:`middle`,children:c(t[O].value)})]}),N&&k!==null&&(0,g.jsxs)(`g`,{pointerEvents:`none`,children:[(0,g.jsx)(`line`,{className:f.crosshair,x1:S(k),x2:S(k),y1:s.t,y2:o-s.b}),(0,g.jsx)(`circle`,{className:f.endDot,cx:S(k),cy:C(N.value),r:4.5})]})]}),(0,g.jsx)(y,{tip:N&&k!==null?{x:S(k),y:C(N.value)-8,title:N.label,lines:[m(N.value,n,r)]}:null})]})}function C({chart:e}){let[t,n]=_(),{points:r}=e,i=v(e),a=Math.min(170,Math.round(n*.32)),o=r.length*32+8,s=Math.max(...r.map(e=>Math.abs(e.value)),1e-9),c=e=>Math.abs(e)/s*(n-a-76),l=Math.floor(a/7.5);return(0,g.jsx)(`div`,{ref:t,className:f.plot,children:(0,g.jsx)(`svg`,{viewBox:`0 0 ${n} ${o}`,className:f.svg,role:`img`,"aria-label":`${e.title}, as bars`,children:r.map((e,t)=>{let n=t*32+6,r=Math.max(c(e.value),8);return(0,g.jsxs)(`g`,{children:[(0,g.jsx)(`text`,{className:f.rowLabel,x:a-10,y:n+10,textAnchor:`end`,dominantBaseline:`middle`,children:e.label.length>l?`${e.label.slice(0,l-1)}…`:e.label}),(0,g.jsx)(`path`,{className:e.highlight?f.barStrong:f.bar,d:`M${a},${n} h${r-4} a4,4 0 0 1 4,4 v12 a4,4 0 0 1 -4,4 h${-(r-4)} Z`}),(0,g.jsx)(`text`,{className:f.valueLabel,x:a+r+8,y:n+10,dominantBaseline:`middle`,children:i(e.value)})]},e.label)})})})}function w({chart:e}){let{points:t,format:n}=e,[r,i]=_(),a=v(e),o=i<440,s=o?54:36,c=o?0:Math.min(150,Math.round(i*.28)),l=o?56:70,u=t.length*s+26,d=t.flatMap(e=>[e.value,e.before??e.value]),p=Math.min(0,...d),m=b(Math.max(...d)),y=e=>c+l+(e-p)/(m-p||1)*(i-c-2*l);return(0,g.jsxs)(`div`,{ref:r,className:f.plot,children:[(0,g.jsxs)(`div`,{className:f.legend,children:[(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`span`,{className:f.keyHollow,"aria-hidden":`true`}),` `,e.before_label??`Before`]}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`span`,{className:f.keySolid,"aria-hidden":`true`}),` `,e.after_label??`After`]})]}),(0,g.jsxs)(`svg`,{viewBox:`0 0 ${i} ${u}`,className:f.svg,role:`img`,"aria-label":`${e.title}, before and after`,children:[[0,.5,1].map(e=>{let t=p+e*(m-p);return(0,g.jsxs)(`g`,{children:[(0,g.jsx)(`line`,{className:f.grid,x1:y(t),x2:y(t),y1:4,y2:u-22}),(0,g.jsx)(`text`,{className:f.tick,x:y(t),y:u-6,textAnchor:`middle`,children:h(t,n)})]},e)}),t.map((e,t)=>{let n=t*s+(o?38:20),r=e.before??e.value,i=e.highlight?f.strong:f.soft,l=e.value>=r;return(0,g.jsxs)(`g`,{className:i,children:[(0,g.jsx)(`text`,{className:f.rowLabel,x:o?0:c-12,y:o?n-20:n,textAnchor:o?`start`:`end`,dominantBaseline:`middle`,children:e.label}),(0,g.jsx)(`line`,{className:f.stem,x1:y(r),x2:y(e.value),y1:n,y2:n}),(0,g.jsx)(`circle`,{className:f.hollow,cx:y(r),cy:n,r:5}),(0,g.jsx)(`circle`,{className:f.solid,cx:y(e.value),cy:n,r:5.5}),e.before!=null&&(0,g.jsx)(`text`,{className:f.tick,x:y(r)+(l?-11:11),y:n,textAnchor:l?`end`:`start`,dominantBaseline:`middle`,children:a(r)}),(0,g.jsx)(`text`,{className:f.valueLabel,x:y(e.value)+(l?12:-12),y:n,textAnchor:l?`start`:`end`,dominantBaseline:`middle`,children:a(e.value)})]},e.label)})]})]})}function T({chart:e}){let t=e.points[0];if(!t)return null;let n=Math.max(0,Math.min(1,t.value));return(0,g.jsxs)(`div`,{className:f.meter,children:[(0,g.jsx)(`p`,{className:f.meterValue,children:m(t.value,`percent`)}),(0,g.jsx)(`meter`,{className:`visually-hidden`,min:0,max:1,value:n,"aria-label":t.label,children:m(t.value,`percent`)}),(0,g.jsx)(`div`,{className:f.track,"aria-hidden":`true`,children:(0,g.jsx)(`span`,{style:{width:`${n*100}%`}})}),(0,g.jsx)(`p`,{className:`body-m muted`,children:t.label})]})}function E({chart:e}){let t=e.kind===`dumbbell`,n=t=>m(t,e.format,e.unit);return(0,g.jsxs)(`table`,{className:f.table,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{scope:`col`,children:e.kind===`line`?`Period`:`Group`}),t&&(0,g.jsx)(`th`,{scope:`col`,children:e.before_label??`Before`}),(0,g.jsx)(`th`,{scope:`col`,children:t?e.after_label??`After`:`Value`})]})}),(0,g.jsx)(`tbody`,{children:e.points.map(r=>(0,g.jsxs)(`tr`,{"data-highlight":r.highlight||void 0,children:[(0,g.jsx)(`th`,{scope:`row`,children:r.label}),t&&(0,g.jsx)(`td`,{children:n(r.before)}),(0,g.jsx)(`td`,{children:e.kind===`meter`?m(r.value,`percent`):n(r.value)})]},r.label))})]})}var D={line:S,bars:C,dumbbell:w,meter:T};function O({chart:e,onFact:t}){let[n,r]=(0,d.useState)(!1),i=(0,d.useId)(),a=D[e.kind],o=(0,d.useMemo)(()=>n?(0,g.jsx)(E,{chart:e}):(0,g.jsx)(a,{chart:e}),[n,e,a]);return(0,g.jsxs)(`figure`,{className:f.figure,"aria-labelledby":i,children:[(0,g.jsxs)(`figcaption`,{className:f.figHead,children:[(0,g.jsx)(`span`,{id:i,className:`title-m`,children:e.title}),(0,g.jsxs)(`span`,{className:f.figActions,children:[(0,g.jsx)(`button`,{type:`button`,className:f.link,onClick:()=>r(e=>!e),children:n?`Show the chart`:`Show as a table`}),(0,g.jsx)(`button`,{type:`button`,className:f.link,onClick:()=>t(e.fact_id),children:`How it was computed`})]})]}),o,e.note&&(0,g.jsx)(`p`,{className:`body-s muted ${f.note}`,children:e.note})]})}var k={rule:`By rule`,user:`You chose`,preset:`Given with the run`,default:`Assumed`},A={pulse:`The pulse`,drivers:`What drives it`,nuance:`The nuance`,actions:`Next`};function j(e){let t=/^[^\s]*/.exec(e)?.[0]??``,n=e.slice(t.length),r=/[^\s]*$/.exec(n)?.[0]??``;return{lead:n.slice(0,n.length-r.length),head:t,tail:r}}var M=/(\d{4}-(?:W\d{2}|\d{2}(?:-\d{2})?))/;function N(e){let t=e.split(M);return t.length===1?e:t.map((e,t)=>t%2?(0,g.jsx)(`span`,{className:f.nobreak,children:e},t):e)}function P({sentence:e,onFact:t}){let n=e.parts?.length?e.parts:[{text:e.text,fact_id:null}],r=n.map(e=>e.fact_id?null:j(e.text));return(0,g.jsx)(g.Fragment,{children:n.map((e,i)=>{let a=r[i-1],o=r[i+1];if(e.fact_id)return(0,g.jsxs)(`span`,{className:f.together,children:[a?.tail,(0,g.jsx)(`button`,{type:`button`,className:f.number,onClick:()=>t(e.fact_id),title:`Where this number comes from`,children:e.text}),o?.head]},i);let s=r[i],c=n[i-1]?.fact_id?``:s.head,l=n[i+1]?.fact_id?``:s.tail;return(0,g.jsx)(`span`,{children:N(c+s.lead+l)},i)})})}function F({fact:e,onClose:n}){return(0,d.useEffect)(()=>{let e=e=>e.key===`Escape`&&n();return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,g.jsxs)(`aside`,{className:f.panel,"aria-label":`Fact ${e.id}`,children:[(0,g.jsxs)(`div`,{className:f.panelHead,children:[(0,g.jsx)(`span`,{className:f.factId,children:e.id}),(0,g.jsx)(`button`,{type:`button`,className:f.close,onClick:n,"aria-label":`Close`,children:(0,g.jsx)(t,{name:`close`,size:16})})]}),(0,g.jsx)(`h3`,{className:f.factTitle,children:e.title}),(0,g.jsx)(`p`,{className:f.factStatement,children:e.statement}),(0,g.jsxs)(`dl`,{className:f.factFacts,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`dt`,{children:`How it was computed`}),(0,g.jsx)(`dd`,{children:e.method})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`dt`,{children:`Rows behind it`}),(0,g.jsx)(`dd`,{className:f.factRows,children:e.n.toLocaleString(`en-US`)})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`dt`,{children:`Confidence`}),(0,g.jsx)(`dd`,{className:f.confidence,"data-level":e.confidence,children:e.confidence})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`dt`,{children:`Checked`}),(0,g.jsx)(`dd`,{children:e.checked?(0,g.jsxs)(`span`,{className:f.checked,children:[(0,g.jsx)(t,{name:`check`,size:14}),` Recomputed in DuckDB from separate SQL: the same`]}):`Not recomputed`})]})]}),e.caveats.length>0&&(0,g.jsx)(`ul`,{className:f.caveats,children:e.caveats.map(e=>(0,g.jsx)(`li`,{children:e},e))}),(e.sql||e.points_sql)&&(0,g.jsxs)(`details`,{className:f.sql,children:[(0,g.jsx)(`summary`,{children:`The SQL that checked it`}),e.sql&&(0,g.jsx)(`pre`,{children:e.sql}),e.points_sql&&(0,g.jsx)(`pre`,{children:e.points_sql})]})]})}function I({data:e,onFact:t}){let n=e.story;return n?(0,g.jsx)(g.Fragment,{children:n.pages.map((e,r)=>(0,g.jsx)(i,{level:0,label:(0,g.jsxs)(`span`,{className:f.pageNo,children:[r+1,` / `,n.pages.length]}),note:A[e.role],children:(0,g.jsxs)(`section`,{className:f.page,"aria-labelledby":`page-${e.id}`,children:[(0,g.jsx)(`h2`,{id:`page-${e.id}`,className:f.pageTitle,children:N(e.title)}),(0,g.jsx)(`p`,{className:f.headline,children:(0,g.jsx)(P,{sentence:e.headline,onFact:t})}),e.charts&&e.charts.length>0&&(0,g.jsx)(`div`,{className:f.charts,"data-count":e.charts.length,children:e.charts.map(e=>(0,g.jsx)(O,{chart:e,onFact:t},`${e.kind}-${e.fact_id}`))}),e.body.length>0&&(0,g.jsx)(`ul`,{className:f.body,children:e.body.map((e,n)=>(0,g.jsx)(`li`,{children:(0,g.jsx)(P,{sentence:e,onFact:t})},n))}),e.actions.length>0&&(0,g.jsx)(`ol`,{className:f.actions,children:e.actions.map(e=>(0,g.jsxs)(`li`,{children:[(0,g.jsx)(`p`,{className:f.actionText,children:e.text}),(0,g.jsxs)(`p`,{className:f.actionCheck,children:[(0,g.jsx)(`b`,{children:`How to test it:`}),` `,e.check]})]},e.text))})]})},e.id))}):null}function L({data:e}){let n=e.cleaning;return(0,g.jsxs)(`div`,{className:f.cleaning,children:[(0,g.jsxs)(`p`,{className:f.cleaningLead,children:[n.rows_in.toLocaleString(`en-US`),` rows in, `,n.rows_out.toLocaleString(`en-US`),` out; `,n.columns_in,` `,`columns in, `,n.columns_out,` out.`]}),n.steps.length===0?(0,g.jsx)(`p`,{className:`muted`,children:`Nothing needed changing.`}):(0,g.jsx)(`ul`,{className:f.steps,children:n.steps.map(e=>(0,g.jsxs)(`li`,{children:[(0,g.jsx)(`span`,{className:`tag`,"data-tone":e.decided_by==="default"?`red`:void 0,children:k[e.decided_by]}),(0,g.jsxs)(`span`,{children:[e.summary,`.`]}),e.examples.length>0&&(0,g.jsx)(`span`,{className:f.examples,children:e.examples.slice(0,3).map(e=>(0,g.jsxs)(`code`,{children:[`row `,e.row,`: `,e.before,` → `,e.after??`empty`]},`${e.row}-${e.before}`))})]},e.id))}),(0,g.jsx)(`ul`,{className:f.checks,children:n.check.map(e=>(0,g.jsxs)(`li`,{children:[(0,g.jsx)(t,{name:`check`,size:14}),` `,e]},e))})]})}function R({data:e}){return(0,g.jsx)(`div`,{className:f.tableWrap,children:(0,g.jsxs)(`table`,{className:f.table,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{scope:`col`,children:`Column`}),(0,g.jsx)(`th`,{scope:`col`,children:`Holds`}),(0,g.jsx)(`th`,{scope:`col`,children:`Adds up by`}),(0,g.jsx)(`th`,{scope:`col`,children:`Empty`}),(0,g.jsx)(`th`,{scope:`col`,children:`Notes`})]})}),(0,g.jsx)(`tbody`,{children:e.columns.map(e=>(0,g.jsxs)(`tr`,{children:[(0,g.jsxs)(`th`,{scope:`row`,children:[e.name,e.personal&&(0,g.jsx)(`span`,{className:`tag ${f.personal}`,"data-tone":`red`,children:`personal`})]}),(0,g.jsxs)(`td`,{children:[e.type,`, `,e.role.replace(`_`,` `)]}),(0,g.jsx)(`td`,{children:e.aggregation.replace(`_`,` `)}),(0,g.jsx)(`td`,{children:e.missing.toLocaleString(`en-US`)}),(0,g.jsx)(`td`,{className:f.colNotes,children:e.notes.join(` `)||e.reason})]},e.name))})]})})}function z({run:t,result:n}){let a=(0,d.useMemo)(()=>p(n.data),[n.data]),[s,m]=(0,d.useState)(null),h=(0,d.useMemo)(()=>new Map((a?.facts?.facts??[]).map(e=>[e.id,e])),[a]);if(!a?.story)return(0,g.jsx)(c,{run:t,result:n});let _=a.story,v=s?h.get(s):void 0,y=a.facts?.facts.filter(e=>e.checked).length??0;return(0,g.jsxs)(e,{children:[(0,g.jsx)(l,{result:n}),(0,g.jsx)(i,{label:`The story`,level:0,note:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`p`,{children:[`in `,a.source.file]}),(0,g.jsx)(`p`,{children:_.written_by===`model`?`Written by ${_.model??`a model`}${_.attempts>1?` in ${_.attempts} drafts`:``}`:`Written from a template`}),(0,g.jsxs)(`p`,{children:[y,` facts, each computed twice`]})]}),children:(0,g.jsxs)(`header`,{className:f.storyHead,children:[(0,g.jsx)(`h1`,{className:f.storyTitle,children:_.title}),(0,g.jsxs)(`p`,{className:f.hint,children:[`Every `,(0,g.jsx)(`span`,{className:f.numberSample,children:`underlined number`}),` opens the fact behind it.`]}),_.context&&(0,g.jsxs)(`p`,{className:f.context,children:[(0,g.jsx)(`b`,{children:`Your context:`}),` `,_.context]}),(0,g.jsx)(u,{run:t,result:n})]})}),(0,g.jsx)(I,{data:a,onFact:m}),(0,g.jsx)(o,{title:`Cleaning`,count:a.cleaning.steps.length,note:`Every change made to the data`,children:(0,g.jsx)(L,{data:a})}),(0,g.jsx)(o,{title:`Columns`,count:a.columns.length,children:(0,g.jsx)(R,{data:a})}),_.rejected.length>0&&(0,g.jsx)(o,{title:`Refused drafts`,count:_.rejected.length,note:`What the checks turned down`,children:(0,g.jsx)(`ul`,{className:f.refused,children:_.rejected.map(e=>(0,g.jsx)(`li`,{children:e},e))})}),(0,g.jsx)(r,{result:n}),v&&(0,g.jsx)(F,{fact:v,onClose:()=>m(null)})]})}export{z as StorytellerResult};
|