@fullstackhouse/cerber 1.8.0-pr.96.dceae59 → 1.8.1-pr.97.a0eade4
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.
- package/dist/core/diff.js +108 -20
- package/dist/core/gh.js +3 -1
- package/package.json +1 -1
- package/web/dist/assets/{abnfDiagram-WEYOIA3C-D10i0Fk4.js → abnfDiagram-WEYOIA3C-Coc3eF3K.js} +1 -1
- package/web/dist/assets/{arc-B5ga0H8m.js → arc-BXjKxPqj.js} +1 -1
- package/web/dist/assets/{architectureDiagram-ZHVYKT53-x2zdXnvl.js → architectureDiagram-ZHVYKT53-2xfMvLgb.js} +1 -1
- package/web/dist/assets/{blockDiagram-RJAE7QA3-Z7gomAL7.js → blockDiagram-RJAE7QA3-D6ok8v1n.js} +1 -1
- package/web/dist/assets/{c4Diagram-XDPPPE54-Cu1Iokok.js → c4Diagram-XDPPPE54-C02OMSU5.js} +1 -1
- package/web/dist/assets/channel-Defyg_Ju.js +1 -0
- package/web/dist/assets/{chunk-2E7WHVMD-4yl3bb80.js → chunk-2E7WHVMD-BKFucSt7.js} +1 -1
- package/web/dist/assets/{chunk-2Q5K7J3B-DiKc1Fld.js → chunk-2Q5K7J3B-RelKRqC4.js} +1 -1
- package/web/dist/assets/{chunk-4EMNKR2T-sunERkqu.js → chunk-4EMNKR2T-QLWPFEsG.js} +1 -1
- package/web/dist/assets/{chunk-55XCU76K-DemyJLup.js → chunk-55XCU76K-BPlNsecs.js} +1 -1
- package/web/dist/assets/{chunk-5VM5RSS4-BKXlAHQ7.js → chunk-5VM5RSS4-kPDglZ-A.js} +1 -1
- package/web/dist/assets/{chunk-JWPE2WC7-BmcEDaqq.js → chunk-JWPE2WC7-C1ogpIcr.js} +1 -1
- package/web/dist/assets/{chunk-VQ5W62QI-wg8nmOu3.js → chunk-VQ5W62QI-CHykshjb.js} +1 -1
- package/web/dist/assets/{chunk-XXDRQBXY-BukzxnBk.js → chunk-XXDRQBXY-DkcS3nad.js} +1 -1
- package/web/dist/assets/{chunk-ZCHMQSOR-7OtIzz4N.js → chunk-ZCHMQSOR-CohQZI47.js} +2 -2
- package/web/dist/assets/{classDiagram-v2-4MYWR3UA-CfkUjjPD.js → classDiagram-v2-4MYWR3UA-HukOXLlu.js} +1 -1
- package/web/dist/assets/{cose-bilkent-JH36ORCC-_EeUeZ5c.js → cose-bilkent-JH36ORCC-DlFEXu5b.js} +1 -1
- package/web/dist/assets/{cynefin-EF2NZ3EQ-qMfZVfHE.js → cynefin-EF2NZ3EQ-Crrm-6N_.js} +1 -1
- package/web/dist/assets/{cynefinDiagram-WF24UDRP-CRmWz52V.js → cynefinDiagram-WF24UDRP-BwUkdfE1.js} +1 -1
- package/web/dist/assets/{dagre-NK4GIZVX-CwR6pdAy.js → dagre-NK4GIZVX-BribOMJx.js} +1 -1
- package/web/dist/assets/{diagram-CBK3MWTC-Dd4uE_55.js → diagram-CBK3MWTC-B43-SeiP.js} +1 -1
- package/web/dist/assets/{diagram-I5XIIV2D-DSoOK4Vx.js → diagram-I5XIIV2D-ChWQtP2E.js} +1 -1
- package/web/dist/assets/{diagram-ODIL2UCW-FpoB5aEt.js → diagram-ODIL2UCW-Bs1KcnAv.js} +1 -1
- package/web/dist/assets/{diagram-PFBEJUXE-CCXqGzBU.js → diagram-PFBEJUXE-B7rsr-hl.js} +1 -1
- package/web/dist/assets/{diagram-RJA3I4VV-CgO0hacv.js → diagram-RJA3I4VV-DDaLNA44.js} +1 -1
- package/web/dist/assets/{diagram-TYUNFSNR-EYIwi1Zv.js → diagram-TYUNFSNR-DpDkn40w.js} +1 -1
- package/web/dist/assets/{ebnfDiagram-V4P3TTPT-l4CRlQ6o.js → ebnfDiagram-V4P3TTPT-Dv0e2tQq.js} +1 -1
- package/web/dist/assets/{elk-QONTBCTQ-T6x4U2O7.js → elk-QONTBCTQ-D5SUuCnc.js} +1 -1
- package/web/dist/assets/{erDiagram-KYQIGQAA-B08O5mz-.js → erDiagram-KYQIGQAA-CHdKd0S2.js} +1 -1
- package/web/dist/assets/{flowDiagram-IUGLLWBU-A739PklO.js → flowDiagram-IUGLLWBU-BnRBvd-F.js} +1 -1
- package/web/dist/assets/{ganttDiagram-R7GPNTJY-B1LL_OMj.js → ganttDiagram-R7GPNTJY-BEjAz1EF.js} +1 -1
- package/web/dist/assets/{gitGraphDiagram-PDYL7XHY-BSsa7c83.js → gitGraphDiagram-PDYL7XHY-lXh0lO5b.js} +1 -1
- package/web/dist/assets/{index-CTnVng4P.js → index-CKVBoOBa.js} +82 -80
- package/web/dist/assets/{index-C-BR2leN.css → index-CO_iVlhC.css} +1 -1
- package/web/dist/assets/{infoDiagram-MVDRKAX5-I7BRQCM1.js → infoDiagram-MVDRKAX5-DmD8PNEZ.js} +1 -1
- package/web/dist/assets/{ishikawaDiagram-HPEHV2GE-BcSSrt_z.js → ishikawaDiagram-HPEHV2GE-CD9bNfPS.js} +1 -1
- package/web/dist/assets/{journeyDiagram-BOSHW7O7-CVHMRSZi.js → journeyDiagram-BOSHW7O7-C6cs20Jg.js} +1 -1
- package/web/dist/assets/{kanban-definition-FNSA4HC5-BZZaZi1t.js → kanban-definition-FNSA4HC5-D6vRfZ0-.js} +1 -1
- package/web/dist/assets/{linear-DpWQdyua.js → linear-D8ooaMGA.js} +1 -1
- package/web/dist/assets/{mermaid.core-NK1xeSV-.js → mermaid.core-CUd92QA6.js} +4 -4
- package/web/dist/assets/{mindmap-definition-6OY57UG3-tm16t4gG.js → mindmap-definition-6OY57UG3-CEmzy4f9.js} +1 -1
- package/web/dist/assets/{pegDiagram-ECIUJNBX-BJ260inJ.js → pegDiagram-ECIUJNBX-DByTj_cN.js} +1 -1
- package/web/dist/assets/{pieDiagram-GNMPY74T-Dpug2e0J.js → pieDiagram-GNMPY74T-DtTy9bER.js} +1 -1
- package/web/dist/assets/{quadrantDiagram-D57K4MC3-OxkyHKWl.js → quadrantDiagram-D57K4MC3-vW2gf6HS.js} +1 -1
- package/web/dist/assets/{railroadDiagram-Y72NRBL7-C6xhRWzR.js → railroadDiagram-Y72NRBL7-DIM5EDbI.js} +1 -1
- package/web/dist/assets/{requirementDiagram-EQYSW5RA-D6FLyEcm.js → requirementDiagram-EQYSW5RA-DghRtcqM.js} +1 -1
- package/web/dist/assets/{sankeyDiagram-SY24JHO5-XOx61ybk.js → sankeyDiagram-SY24JHO5-DWxE-dsD.js} +1 -1
- package/web/dist/assets/{sequenceDiagram-BLEHNHQU-B-qAT2Ch.js → sequenceDiagram-BLEHNHQU-C7PpBGw9.js} +1 -1
- package/web/dist/assets/{sizeCapture-INFHLROL-B8a6nsmL.js → sizeCapture-INFHLROL-Dh5TIsQG.js} +1 -1
- package/web/dist/assets/{stateDiagram-v2-A6IESKWZ-Dj7iw6i8.js → stateDiagram-v2-A6IESKWZ-BfapimEh.js} +1 -1
- package/web/dist/assets/{swimlanes-B3ENRKFQ-DF2f6S4P.js → swimlanes-B3ENRKFQ-CACdprBj.js} +1 -1
- package/web/dist/assets/swimlanesDiagram-AYQRV4AK-Byb0X2PT.js +8 -0
- package/web/dist/assets/{timeline-definition-JXYKGLGB-CvOnT6rX.js → timeline-definition-JXYKGLGB-C2NdLqTY.js} +1 -1
- package/web/dist/assets/{usecaseDiagram-WPOLBNNX-b0SGlraJ.js → usecaseDiagram-WPOLBNNX-vjC9KXvs.js} +1 -1
- package/web/dist/assets/{vennDiagram-Q3Y3IDCW-naUU9l0m.js → vennDiagram-Q3Y3IDCW-Bx1jq7qf.js} +1 -1
- package/web/dist/assets/{wardleyDiagram-IVAIDKWA-CKpbhXQi.js → wardleyDiagram-IVAIDKWA-DrylENNo.js} +1 -1
- package/web/dist/assets/{xychartDiagram-4URNHDU4-CgV1U4YM.js → xychartDiagram-4URNHDU4-Cklc7lJ2.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/channel-CDmLjdnX.js +0 -1
- package/web/dist/assets/swimlanesDiagram-AYQRV4AK-Cs4J3Zdo.js +0 -8
package/dist/core/diff.js
CHANGED
|
@@ -1,39 +1,127 @@
|
|
|
1
1
|
export function splitDiffByFile(diff) {
|
|
2
2
|
const patches = [];
|
|
3
|
-
const lines = diff.split("\n");
|
|
4
3
|
let current = null;
|
|
5
|
-
let
|
|
4
|
+
let inHeader = false;
|
|
6
5
|
const flush = () => {
|
|
7
|
-
if (current
|
|
8
|
-
|
|
6
|
+
if (current) {
|
|
7
|
+
const path = pathOf(current);
|
|
8
|
+
if (path)
|
|
9
|
+
patches.push({ path, patch: current.join("\n") });
|
|
9
10
|
}
|
|
10
11
|
current = null;
|
|
11
|
-
currentPath = null;
|
|
12
12
|
};
|
|
13
|
-
for (const line of
|
|
13
|
+
for (const line of diff.split("\n")) {
|
|
14
14
|
if (line.startsWith("diff --git ")) {
|
|
15
15
|
flush();
|
|
16
|
-
current = [line];
|
|
17
|
-
|
|
18
|
-
const m = line.match(/^diff --git a\/(.+?) b\/(.+)$/);
|
|
19
|
-
currentPath = m ? m[2] : line.slice("diff --git ".length);
|
|
16
|
+
current = [unquoteHeader(line)];
|
|
17
|
+
inHeader = true;
|
|
20
18
|
}
|
|
21
19
|
else if (current) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (line === "+++ /dev/null") {
|
|
28
|
-
const minus = current.find((l) => l.startsWith("--- a/"));
|
|
29
|
-
if (minus)
|
|
30
|
-
currentPath = minus.slice("--- a/".length);
|
|
31
|
-
}
|
|
20
|
+
if (line.startsWith("@@"))
|
|
21
|
+
inHeader = false;
|
|
22
|
+
// Only the header names files; inside a hunk a `--- a/x` is a removed
|
|
23
|
+
// `-- a/x`, and it stays exactly as written.
|
|
24
|
+
current.push(inHeader ? unquoteHeader(line) : line);
|
|
32
25
|
}
|
|
33
26
|
}
|
|
34
27
|
flush();
|
|
35
28
|
return patches;
|
|
36
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A file's path, read off its (already unquoted) header: the new side from
|
|
32
|
+
* `+++ b/…`, the old side when the file is deleted. A header without the pair
|
|
33
|
+
* — a binary, a pure rename, a mode change — names it in `rename to`, or in the
|
|
34
|
+
* `diff --git a/P b/P` line, which is split down the middle rather than at the
|
|
35
|
+
* first ` b/`, because a path can contain one.
|
|
36
|
+
*/
|
|
37
|
+
function pathOf(lines) {
|
|
38
|
+
const firstHunk = lines.findIndex((l) => l.startsWith("@@"));
|
|
39
|
+
const header = firstHunk < 0 ? lines : lines.slice(0, firstHunk);
|
|
40
|
+
const field = (prefix) => header.find((l) => l.startsWith(prefix))?.slice(prefix.length);
|
|
41
|
+
const plus = field("+++ ");
|
|
42
|
+
if (plus?.startsWith("b/"))
|
|
43
|
+
return plus.slice(2);
|
|
44
|
+
if (plus === "/dev/null") {
|
|
45
|
+
const minus = field("--- a/");
|
|
46
|
+
if (minus)
|
|
47
|
+
return minus;
|
|
48
|
+
}
|
|
49
|
+
const renamed = field("rename to ") ?? field("copy to ");
|
|
50
|
+
if (renamed)
|
|
51
|
+
return renamed;
|
|
52
|
+
const both = lines[0].slice("diff --git ".length);
|
|
53
|
+
const half = (both.length - 1) / 2;
|
|
54
|
+
if (Number.isInteger(half)) {
|
|
55
|
+
const [a, b] = [both.slice(0, half), both.slice(half + 1)];
|
|
56
|
+
if (a.startsWith("a/") && b.startsWith("b/") && a.slice(2) === b.slice(2))
|
|
57
|
+
return b.slice(2);
|
|
58
|
+
}
|
|
59
|
+
const m = both.match(/^a\/(.+?) b\/(.+)$/);
|
|
60
|
+
return m ? m[2] : both || null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The diff with every file header naming its files plainly — what the review
|
|
64
|
+
* run reads, so the path it writes on a comment is the one the rest of cerber
|
|
65
|
+
* (and GitHub's comment API) knows the file by. Hunks are left as written.
|
|
66
|
+
*/
|
|
67
|
+
export function plainPaths(diff) {
|
|
68
|
+
let inHeader = false;
|
|
69
|
+
return diff
|
|
70
|
+
.split("\n")
|
|
71
|
+
.map((line) => {
|
|
72
|
+
if (line.startsWith("diff --git "))
|
|
73
|
+
inHeader = true;
|
|
74
|
+
else if (line.startsWith("@@"))
|
|
75
|
+
inHeader = false;
|
|
76
|
+
return inHeader ? unquoteHeader(line) : line;
|
|
77
|
+
})
|
|
78
|
+
.join("\n");
|
|
79
|
+
}
|
|
80
|
+
const C_ESCAPES = { a: 7, b: 8, t: 9, n: 10, v: 11, f: 12, r: 13, '"': 34, "\\": 92 };
|
|
81
|
+
/**
|
|
82
|
+
* A path as git writes it into a header: wrapped in quotes, with C escapes and
|
|
83
|
+
* every byte outside ASCII spelled in octal, whenever it holds one — so a file
|
|
84
|
+
* named `zażółć.md` arrives as `"a/za\305\274\303\263\305\202\304\207.md"`.
|
|
85
|
+
* GitHub's diffs do the same.
|
|
86
|
+
*/
|
|
87
|
+
export function unquoteGitPath(quoted) {
|
|
88
|
+
if (!(quoted.length >= 2 && quoted.startsWith('"') && quoted.endsWith('"')))
|
|
89
|
+
return quoted;
|
|
90
|
+
const bytes = [];
|
|
91
|
+
const body = quoted.slice(1, -1);
|
|
92
|
+
for (let i = 0; i < body.length; i++) {
|
|
93
|
+
const ch = body[i];
|
|
94
|
+
if (ch !== "\\") {
|
|
95
|
+
bytes.push(...new TextEncoder().encode(ch));
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const next = body[i + 1] ?? "";
|
|
99
|
+
const octal = body.slice(i + 1, i + 4);
|
|
100
|
+
if (/^[0-7]{3}$/.test(octal)) {
|
|
101
|
+
bytes.push(parseInt(octal, 8));
|
|
102
|
+
i += 3;
|
|
103
|
+
}
|
|
104
|
+
else if (next in C_ESCAPES) {
|
|
105
|
+
bytes.push(C_ESCAPES[next]);
|
|
106
|
+
i += 1;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
bytes.push(92);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return new TextDecoder().decode(new Uint8Array(bytes));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A header line with every quoted path written out plainly, so the rest of the
|
|
116
|
+
* cockpit — and diff2html, which prints the quotes and octal as they are —
|
|
117
|
+
* sees the file's real name. The tab git ends a `---`/`+++` line with goes
|
|
118
|
+
* too, or it becomes part of the name.
|
|
119
|
+
*/
|
|
120
|
+
function unquoteHeader(line) {
|
|
121
|
+
// git also ends a name holding a space with a tab, quoted or not.
|
|
122
|
+
const bare = /^(---|\+\+\+) /.test(line) ? line.replace(/\t$/, "") : line;
|
|
123
|
+
return bare.includes('"') ? bare.replace(/"(?:[^"\\]|\\.)*"/g, (q) => unquoteGitPath(q)) : bare;
|
|
124
|
+
}
|
|
37
125
|
/** Concatenate the patches of the given files (order = diff order). */
|
|
38
126
|
export function patchForFiles(diff, files) {
|
|
39
127
|
const wanted = new Set(files);
|
package/dist/core/gh.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
import { PrInfoSchema, artifactId } from "./artifact.js";
|
|
4
|
+
import { plainPaths } from "./diff.js";
|
|
4
5
|
const execFileAsync = promisify(execFile);
|
|
5
6
|
const MAX_BUFFER = 64 * 1024 * 1024;
|
|
6
7
|
/**
|
|
@@ -104,7 +105,8 @@ async function membershipCheck(args) {
|
|
|
104
105
|
*/
|
|
105
106
|
export async function fetchPrDiff(ref) {
|
|
106
107
|
try {
|
|
107
|
-
|
|
108
|
+
// GitHub, like git, quotes a path with anything outside ASCII in it.
|
|
109
|
+
return plainPaths(await gh(["pr", "diff", String(ref.number), "--repo", `${ref.owner}/${ref.repo}`]));
|
|
108
110
|
}
|
|
109
111
|
catch (err) {
|
|
110
112
|
// Matched on GitHub's own `too_large` signature rather than the bare 406:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstackhouse/cerber",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1-pr.97.a0eade4",
|
|
4
4
|
"description": "AI code-review cockpit: Claude reviews your PRs into local artifacts; nothing reaches GitHub until you say so.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
package/web/dist/assets/{abnfDiagram-WEYOIA3C-D10i0Fk4.js → abnfDiagram-WEYOIA3C-Coc3eF3K.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-2E7WHVMD-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-2E7WHVMD-BKFucSt7.js";import{p as f}from"./chunk-JWPE2WC7-C1ogpIcr.js";import{_ as n,l as o}from"./mermaid.core-CUd92QA6.js";import{M as c,b as d}from"./cynefin-EF2NZ3EQ-Crrm-6N_.js";import"./index-CKVBoOBa.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a5 as ln,a6 as an,a7 as H,a8 as j,a9 as B,aa as un,ab as g,ac as tn,ad as L,ae as _,af as rn,ag as o,ah as on,ai as sn,aj as fn}from"./mermaid.core-
|
|
1
|
+
import{a5 as ln,a6 as an,a7 as H,a8 as j,a9 as B,aa as un,ab as g,ac as tn,ad as L,ae as _,af as rn,ag as o,ah as on,ai as sn,aj as fn}from"./mermaid.core-CUd92QA6.js";function cn(l){return l.innerRadius}function gn(l){return l.outerRadius}function yn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,E,q,v,A,C,a){var I=E-l,i=q-h,n=C-v,d=a-A,u=d*I-n*i;if(!(u*u<g))return u=(n*(h-A)-d*(l-v))/u,[l+u*I,h+u*i]}function W(l,h,E,q,v,A,C){var a=l-E,I=h-q,i=(C?A:-A)/L(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,F=(u+f)/2,t=(s+c)/2,m=f-u,y=c-s,R=m*m+y*y,T=v-A,P=u*c-f*s,O=(y<0?-1:1)*L(on(0,T*T*R-P*P)),S=(P*y-m*O)/R,z=(-P*m-y*O)/R,w=(P*y+m*O)/R,p=(-P*m+y*O)/R,x=S-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(S=w,z=p),{cx:S,cy:z,x01:-n,y01:-d,x11:S*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=gn,E=B(0),q=null,v=yn,A=dn,C=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,F=rn(c-f),t=c>f;if(a||(a=n=I()),s<u&&(d=s,s=u,u=d),!(s>g))a.moveTo(0,0);else if(F>tn-g)a.moveTo(s*H(f),s*j(f)),a.arc(0,0,s,f,c,!t),u>g&&(a.moveTo(u*H(c),u*j(c)),a.arc(0,0,u,c,f,t));else{var m=f,y=c,R=f,T=c,P=F,O=F,S=C.apply(this,arguments)/2,z=S>g&&(q?+q.apply(this,arguments):L(u*u+s*s)),w=_(rn(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(z>g){var G=sn(z/u*j(S)),M=sn(z/s*j(S));(P-=G*2)>g?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(O-=M*2)>g?(M*=t?1:-1,m+=M,y-=M):(O=0,m=y=(f+c)/2)}var J=s*H(m),K=s*j(m),N=u*H(T),Q=u*j(T);if(w>g){var U=s*H(y),V=s*j(y),X=u*H(R),Y=u*j(R),D;if(F<an)if(D=pn(J,K,X,Y,U,V,N,Q)){var Z=J-D[0],$=K-D[1],b=U-D[0],k=V-D[1],nn=1/j(fn((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(D[0]*D[0]+D[1]*D[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}O>g?x>g?(e=W(X,Y,J,K,s,x,t),r=W(U,V,N,Q,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(J,K),a.arc(0,0,s,m,y,!t)):a.moveTo(J,K),!(u>g)||!(P>g)?a.lineTo(N,Q):p>g?(e=W(N,Q,U,V,u,-p,t),r=W(J,K,X,Y,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[H(d)*n,j(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:B(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:B(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:B(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:B(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:B(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:B(+n),i):A},i.padAngle=function(n){return arguments.length?(C=typeof n=="function"?n:B(+n),i):C},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|