local-diff-reviewer 1.0.5 → 1.0.7

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.
Files changed (73) hide show
  1. package/README.md +3 -1
  2. package/SKILL.md +4 -4
  3. package/dist/cli/start.js +41 -15
  4. package/dist/web/assets/{arc-DfZYUaz4.js → arc-FnFNT5Eh.js} +1 -1
  5. package/dist/web/assets/{architectureDiagram-3BPJPVTR-Un1C7dX5.js → architectureDiagram-3BPJPVTR-Co5Z_QNw.js} +1 -1
  6. package/dist/web/assets/{blockDiagram-GPEHLZMM-DoE66LOm.js → blockDiagram-GPEHLZMM-BNsiQyLf.js} +1 -1
  7. package/dist/web/assets/{c4Diagram-AAUBKEIU-Ch17mKwl.js → c4Diagram-AAUBKEIU-BAZdudVw.js} +1 -1
  8. package/dist/web/assets/channel-BPbPhJj8.js +1 -0
  9. package/dist/web/assets/{chunk-2J33WTMH-DsTTzQ06.js → chunk-2J33WTMH-B0vxrf0b.js} +1 -1
  10. package/dist/web/assets/{chunk-3OPIFGDE-C4BFnYAe.js → chunk-3OPIFGDE-DejuRnfm.js} +1 -1
  11. package/dist/web/assets/{chunk-4BX2VUAB-CBYOekG6.js → chunk-4BX2VUAB-Bg5xzq_y.js} +1 -1
  12. package/dist/web/assets/{chunk-55IACEB6-bkX7IfWj.js → chunk-55IACEB6-D0Fci-zx.js} +1 -1
  13. package/dist/web/assets/{chunk-5ZQYHXKU-DmYX07rl.js → chunk-5ZQYHXKU-BPK5ENee.js} +1 -1
  14. package/dist/web/assets/{chunk-727SXJPM-myW6yB1O.js → chunk-727SXJPM-7K2UgSc-.js} +1 -1
  15. package/dist/web/assets/{chunk-AQP2D5EJ-fa_HpDkc.js → chunk-AQP2D5EJ-BWk8xaA0.js} +1 -1
  16. package/dist/web/assets/{chunk-BSJP7CBP-NpOkPl8K.js → chunk-BSJP7CBP-qQ__7B7h.js} +1 -1
  17. package/dist/web/assets/{chunk-CSCIHK7Q-jWMYsJiR.js → chunk-CSCIHK7Q-CrFKiZka.js} +1 -1
  18. package/dist/web/assets/{chunk-FMBD7UC4-BuB89xp8.js → chunk-FMBD7UC4-DvZyaP9P.js} +1 -1
  19. package/dist/web/assets/{chunk-KSCS5N6A-BvSsBz45.js → chunk-KSCS5N6A-BbcBNuLx.js} +1 -1
  20. package/dist/web/assets/{chunk-L5ZTLDWV-Cslvwh3t.js → chunk-L5ZTLDWV-D9Jpxw4I.js} +1 -1
  21. package/dist/web/assets/{chunk-LZXEDZCA-lDGN1tUz.js → chunk-LZXEDZCA-C0KF6zNF.js} +2 -2
  22. package/dist/web/assets/{chunk-ND2GUHAM-DGtWurFf.js → chunk-ND2GUHAM-B4UYa5t-.js} +1 -1
  23. package/dist/web/assets/{chunk-NZK2D7GU-BhN9qm2L.js → chunk-NZK2D7GU-DwIixx-H.js} +1 -1
  24. package/dist/web/assets/{chunk-O5CBEL6O-DPNhEfdl.js → chunk-O5CBEL6O-B6AfXN2g.js} +1 -1
  25. package/dist/web/assets/chunk-QZHKN3VN-erTNME5J.js +1 -0
  26. package/dist/web/assets/chunk-WU5MYG2G-CbnTR5Pg.js +1 -0
  27. package/dist/web/assets/{chunk-XPW4576I-BRb6pBFA.js → chunk-XPW4576I-D15NjZ7Z.js} +1 -1
  28. package/dist/web/assets/classDiagram-4FO5ZUOK-CuafptIX.js +1 -0
  29. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BIT1gXn5.js +1 -0
  30. package/dist/web/assets/{cose-bilkent-S5V4N54A-DP7aCqjn.js → cose-bilkent-S5V4N54A-BNwgjIv3.js} +1 -1
  31. package/dist/web/assets/{dagre-BM42HDAG-DW8OoOF9.js → dagre-BM42HDAG-CpwwUyr_.js} +1 -1
  32. package/dist/web/assets/{diagram-2AECGRRQ-Dhr52Lcq.js → diagram-2AECGRRQ-Bw8x1vsX.js} +1 -1
  33. package/dist/web/assets/{diagram-5GNKFQAL-00RS5q-p.js → diagram-5GNKFQAL-BB2GXRx9.js} +1 -1
  34. package/dist/web/assets/{diagram-KO2AKTUF-CV1YsijI.js → diagram-KO2AKTUF-BgaaH0hW.js} +1 -1
  35. package/dist/web/assets/{diagram-LMA3HP47-Cu6hlhhL.js → diagram-LMA3HP47-BisC4uiR.js} +1 -1
  36. package/dist/web/assets/{diagram-OG6HWLK6-f8Aglkk5.js → diagram-OG6HWLK6-BDj48Uho.js} +1 -1
  37. package/dist/web/assets/{dist-BbvzfnQH.js → dist-D2UD_g6s.js} +1 -1
  38. package/dist/web/assets/{erDiagram-TEJ5UH35-BOpwL6Hq.js → erDiagram-TEJ5UH35-cBF6TfGh.js} +1 -1
  39. package/dist/web/assets/{flowDiagram-I6XJVG4X-JpfaqfMd.js → flowDiagram-I6XJVG4X-CYc4faT9.js} +1 -1
  40. package/dist/web/assets/{ganttDiagram-6RSMTGT7-_07N56My.js → ganttDiagram-6RSMTGT7-CvZHLnnj.js} +1 -1
  41. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-CW2hqk_8.js → gitGraphDiagram-PVQCEYII-B9EFahM9.js} +1 -1
  42. package/dist/web/assets/index-1vvZG57w.css +1 -0
  43. package/dist/web/assets/{index-CxFV1WHQ.js → index-wy40yeNf.js} +24 -24
  44. package/dist/web/assets/{infoDiagram-5YYISTIA-B35H3DgZ.js → infoDiagram-5YYISTIA-OwyPUHlr.js} +1 -1
  45. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-DxVWMRSB.js → ishikawaDiagram-YF4QCWOH-DWNJFp-G.js} +1 -1
  46. package/dist/web/assets/{journeyDiagram-JHISSGLW-C__VorSx.js → journeyDiagram-JHISSGLW-Fx_1G-6i.js} +1 -1
  47. package/dist/web/assets/{kanban-definition-UN3LZRKU-BKSCqg5P.js → kanban-definition-UN3LZRKU-Dq4CooCl.js} +1 -1
  48. package/dist/web/assets/{line-SFaTyCgO.js → line-HQcA7ihX.js} +1 -1
  49. package/dist/web/assets/{linear-CCDSib_A.js → linear-BZeIaDEq.js} +1 -1
  50. package/dist/web/assets/{mermaid-parser.core-B4q5D_X_.js → mermaid-parser.core-DJsgXM22.js} +1 -1
  51. package/dist/web/assets/{mermaid.core-DiPBDfaO.js → mermaid.core-CkAku_bb.js} +3 -3
  52. package/dist/web/assets/{mindmap-definition-RKZ34NQL-BJZedUBK.js → mindmap-definition-RKZ34NQL-BWRzwBxY.js} +1 -1
  53. package/dist/web/assets/{pieDiagram-4H26LBE5-DtkdCUA9.js → pieDiagram-4H26LBE5-woyVH6aA.js} +1 -1
  54. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-Cks8DI1_.js → quadrantDiagram-W4KKPZXB-DmMwbj7N.js} +1 -1
  55. package/dist/web/assets/{requirementDiagram-4Y6WPE33-DIJqz1Ht.js → requirementDiagram-4Y6WPE33-1vUYL3sj.js} +1 -1
  56. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-waqn6y15.js → sankeyDiagram-5OEKKPKP-BiRxghpn.js} +1 -1
  57. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-Cyzxtc0o.js → sequenceDiagram-3UESZ5HK-C-SgacOL.js} +1 -1
  58. package/dist/web/assets/{src-DboPYYAM.js → src-DMlkBZbY.js} +1 -1
  59. package/dist/web/assets/{stateDiagram-AJRCARHV-BIfp7CSY.js → stateDiagram-AJRCARHV-Ci958Ibo.js} +1 -1
  60. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BcqZc5a0.js +1 -0
  61. package/dist/web/assets/{timeline-definition-PNZ67QCA-5e-cw7ns.js → timeline-definition-PNZ67QCA-CQzVyH6s.js} +1 -1
  62. package/dist/web/assets/{vennDiagram-CIIHVFJN-H4TiL4fv.js → vennDiagram-CIIHVFJN-DjtlRdrY.js} +1 -1
  63. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-C9je1Qmh.js → wardleyDiagram-YWT4CUSO-Braalnw5.js} +1 -1
  64. package/dist/web/assets/{xychartDiagram-2RQKCTM6-CbnF4TLC.js → xychartDiagram-2RQKCTM6-YjueRiNp.js} +1 -1
  65. package/dist/web/index.html +2 -2
  66. package/package.json +1 -1
  67. package/dist/web/assets/channel-tS6_tEZH.js +0 -1
  68. package/dist/web/assets/chunk-QZHKN3VN-MdvGD9q1.js +0 -1
  69. package/dist/web/assets/chunk-WU5MYG2G-Cot-8ei2.js +0 -1
  70. package/dist/web/assets/classDiagram-4FO5ZUOK-Ba9dn90z.js +0 -1
  71. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-AkPgLlFm.js +0 -1
  72. package/dist/web/assets/index-CND5NAGY.css +0 -1
  73. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CBvj4HDj.js +0 -1
package/README.md CHANGED
@@ -65,6 +65,8 @@ local-diff-reviewer --repo /path/to/project staged
65
65
  项目 B /diff-review -> http://127.0.0.1:<空闲端口> -> 项目 B diff
66
66
  ```
67
67
 
68
+ 页面打开后,代码 diff 和 Markdown 预览会固定为本次启动时的快照;工作区继续变动不会改写已打开页面里的代码内容。评论线程会在页面可见时持续同步。若需要审查最新工作区内容,请再次执行 `local-diff-reviewer` 或 `/diff-review` 打开新的 review 会话。
69
+
68
70
  注意:本地开发的 `--dev` 模式仍使用 Vite dev server,端口和 API proxy 是固定的;多项目并行审查请使用默认的构建页面模式。
69
71
 
70
72
  ## Skill 使用方式
@@ -83,7 +85,7 @@ local-diff-reviewer --repo /path/to/project staged
83
85
  npx skills add Mone-Lee/diff-review
84
86
  ```
85
87
 
86
- skill 会针对目标 workspace 运行 `npx --yes local-diff-reviewer --repo <workspace> [args...]`。
88
+ skill 会以目标 workspace 作为命令工作目录运行 `npx --yes local-diff-reviewer [args...]`,因此 `/diff-review` 会审查当前项目,而不是 skill 安装目录。
87
89
 
88
90
  ### 预置 agent 评论
89
91
 
package/SKILL.md CHANGED
@@ -16,18 +16,18 @@ Use this skill when the user asks for `/diff-review`, wants to inspect current w
16
16
  - `/diff-review staged`: review staged diff.
17
17
  - `/diff-review <base> <target>`: review diff between two Git revisions.
18
18
 
19
- Do not ask the user to run a shell CLI manually. Determine the target workspace/repository from the user's active environment context, then pass it explicitly with `--repo`:
19
+ Do not ask the user to run a shell CLI manually. Determine the target workspace/repository from the user's active environment context, then run the package command with that repository as the command working directory:
20
20
 
21
21
  ```bash
22
- npx --yes local-diff-reviewer --repo /absolute/path/to/target/workspace [args...]
22
+ npx --yes local-diff-reviewer [args...]
23
23
  ```
24
24
 
25
- Do not use the skill package directory or this skill's install directory as the review target unless that is the workspace the user asked to review.
25
+ Set the shell/tool `cwd` to `/absolute/path/to/target/workspace` before running the command. Do not pass `--repo` from this skill; older published CLI versions treat unknown args as revision args. Do not use the skill package directory or this skill's install directory as the review target unless that is the workspace the user asked to review.
26
26
 
27
27
  When you have concrete review findings or answers to existing review comments, preload them with one `--comment` JSON argument per comment before launching the viewer:
28
28
 
29
29
  ```bash
30
- npx --yes local-diff-reviewer --repo /absolute/path/to/target/workspace [args...] \
30
+ npx --yes local-diff-reviewer [args...] \
31
31
  --comment '{"type":"thread","filePath":"src/foo.ts","position":{"side":"new","line":36},"body":"Explain the finding in the user language."}' \
32
32
  --comment '{"type":"reply","threadId":"existing-thread-id","body":"Answer the existing thread as the agent."}'
33
33
  ```
package/dist/cli/start.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/cli/start.ts
4
4
  import { spawn } from "node:child_process";
5
5
  import { existsSync as existsSync2 } from "node:fs";
6
- import { dirname as dirname2, join as join4, resolve as resolve2 } from "node:path";
6
+ import { basename as basename2, dirname as dirname2, join as join4, resolve as resolve2 } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
 
9
9
  // src/server/storage.ts
@@ -513,6 +513,7 @@ function binaryAddedDiff(path) {
513
513
  // src/server/index.ts
514
514
  import express from "express";
515
515
  import { existsSync } from "node:fs";
516
+ import { createServer } from "node:http";
516
517
  import { join as join3, normalize as normalize2, resolve, sep } from "node:path";
517
518
 
518
519
  // src/core/markdown-source-map.ts
@@ -621,6 +622,7 @@ function getAnchorLine(thread) {
621
622
 
622
623
  // src/server/index.ts
623
624
  async function startServer(state, port = 4966) {
625
+ const markdownPreviews = await buildMarkdownPreviewCache(state);
624
626
  const app = express();
625
627
  app.use(express.json({ limit: "2mb" }));
626
628
  app.get("/api/session", (_req, res) => {
@@ -629,21 +631,22 @@ async function startServer(state, port = 4966) {
629
631
  app.get("/api/diff", (_req, res) => {
630
632
  res.json({ files: state.diffFiles });
631
633
  });
634
+ app.get("/api/review-state", async (_req, res, next) => {
635
+ try {
636
+ const comments = await readComments(state.session.repoRoot);
637
+ res.json({ session: state.session, files: state.diffFiles, threads: comments.threads });
638
+ } catch (error) {
639
+ next(error);
640
+ }
641
+ });
632
642
  app.get("/api/markdown-preview", async (req, res, next) => {
633
643
  try {
634
644
  const filePath = String(req.query.path ?? "");
635
- const file = state.diffFiles.find((item) => item.path === filePath || item.oldPath === filePath);
636
- if (!file || !file.isMarkdown) {
645
+ const preview = markdownPreviews.get(filePath);
646
+ if (!preview) {
637
647
  res.status(404).json({ error: "Markdown file not found in diff" });
638
648
  return;
639
649
  }
640
- const { content, deleted } = await readFileForPreview(file, state.session.mode, state.session.repoRoot);
641
- const preview = {
642
- filePath: file.path,
643
- content,
644
- deleted,
645
- blocks: buildMarkdownBlocks(content)
646
- };
647
650
  res.json(preview);
648
651
  } catch (error) {
649
652
  next(error);
@@ -862,13 +865,26 @@ async function startServer(state, port = 4966) {
862
865
  });
863
866
  return listen(app, port);
864
867
  }
868
+ async function buildMarkdownPreviewCache(state) {
869
+ const previews = /* @__PURE__ */ new Map();
870
+ await Promise.all(
871
+ state.diffFiles.filter((file) => file.isMarkdown).map(async (file) => {
872
+ const { content, deleted } = await readFileForPreview(file, state.session.mode, state.session.repoRoot);
873
+ const preview = {
874
+ filePath: file.path,
875
+ content,
876
+ deleted,
877
+ blocks: buildMarkdownBlocks(content)
878
+ };
879
+ previews.set(file.path, preview);
880
+ previews.set(file.oldPath, preview);
881
+ })
882
+ );
883
+ return previews;
884
+ }
865
885
  function listen(app, port) {
866
886
  return new Promise((resolve3, reject) => {
867
- const server = app.listen(port, "127.0.0.1", () => {
868
- const address = server.address();
869
- const actualPort = typeof address === "object" && address ? address.port : port;
870
- resolve3(`http://127.0.0.1:${actualPort}`);
871
- });
887
+ const server = createServer(app);
872
888
  server.once("error", (error) => {
873
889
  if (error.code === "EADDRINUSE" && port !== 0) {
874
890
  listen(app, 0).then(resolve3, reject);
@@ -876,6 +892,11 @@ function listen(app, port) {
876
892
  }
877
893
  reject(error);
878
894
  });
895
+ server.listen(port, "127.0.0.1", () => {
896
+ const address = server.address();
897
+ const actualPort = typeof address === "object" && address ? address.port : port;
898
+ resolve3(`http://127.0.0.1:${actualPort}`);
899
+ });
879
900
  });
880
901
  }
881
902
  function selectPromptThreads(threads, scope) {
@@ -897,6 +918,7 @@ async function main() {
897
918
  const diffFiles = parseUnifiedDiff(diff);
898
919
  const session = {
899
920
  id: crypto.randomUUID(),
921
+ repoName: basename2(repoRoot),
900
922
  repoRoot,
901
923
  mode,
902
924
  diffHash: diffHash(diff),
@@ -912,6 +934,10 @@ async function main() {
912
934
  }
913
935
  openBrowser(uiUrl);
914
936
  console.log(`Diff Review is running: ${uiUrl}`);
937
+ console.log(`Repo: ${session.repoName} (${repoRoot})`);
938
+ if (!useVite && uiUrl !== "http://127.0.0.1:4966") {
939
+ console.log(`Default port 4966 is busy; using ${uiUrl}`);
940
+ }
915
941
  console.log(`Mode: ${modeLabel(mode)}`);
916
942
  console.log(`Files: ${diffFiles.length}`);
917
943
  if (comments.length > 0) {
@@ -1 +1 @@
1
- import{n as e,t}from"./path-BJQEcSo7.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-BbvzfnQH.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
1
+ import{n as e,t}from"./path-BJQEcSo7.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-D2UD_g6s.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i)if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};