@imenam/mcp-documentor 1.0.49 → 1.0.52

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 (58) hide show
  1. package/README.md +28 -0
  2. package/dist/src/gui-worker.js +2 -2
  3. package/dist/src/index.js +3 -4
  4. package/dist/src/tools/upload-image.js +9 -20
  5. package/dist/src/version.d.ts +1 -1
  6. package/dist/src/version.js +1 -1
  7. package/gui/dist/assets/{arc-BKRFpV_X.js → arc-CCHCB-wD.js} +1 -1
  8. package/gui/dist/assets/{architectureDiagram-3BPJPVTR-g3ix86w4.js → architectureDiagram-3BPJPVTR-CY9HTuIq.js} +1 -1
  9. package/gui/dist/assets/{blockDiagram-GPEHLZMM-DJp0RySg.js → blockDiagram-GPEHLZMM-BOVxufIP.js} +1 -1
  10. package/gui/dist/assets/{c4Diagram-AAUBKEIU-Dv19Wb0P.js → c4Diagram-AAUBKEIU-D4gw0Vvh.js} +1 -1
  11. package/gui/dist/assets/channel-V0oafPxe.js +1 -0
  12. package/gui/dist/assets/{chunk-2J33WTMH-BBsfTgNR.js → chunk-2J33WTMH-D9MZap0G.js} +1 -1
  13. package/gui/dist/assets/{chunk-4BX2VUAB-CSXLRZh_.js → chunk-4BX2VUAB-DZp7afnZ.js} +1 -1
  14. package/gui/dist/assets/{chunk-55IACEB6-BvPtr-ne.js → chunk-55IACEB6--z45PUIk.js} +1 -1
  15. package/gui/dist/assets/{chunk-727SXJPM-CWUhOtR-.js → chunk-727SXJPM-BpzsGHwS.js} +1 -1
  16. package/gui/dist/assets/{chunk-AQP2D5EJ-BQ0HicF_.js → chunk-AQP2D5EJ-BHrif5nf.js} +1 -1
  17. package/gui/dist/assets/{chunk-FMBD7UC4-jHVVH30s.js → chunk-FMBD7UC4-BJnvL7mL.js} +1 -1
  18. package/gui/dist/assets/{chunk-ND2GUHAM-Bpfb395X.js → chunk-ND2GUHAM-B30rNlK9.js} +1 -1
  19. package/gui/dist/assets/{chunk-QZHKN3VN-Dx2Yi2S_.js → chunk-QZHKN3VN-C30k0U0w.js} +1 -1
  20. package/gui/dist/assets/classDiagram-4FO5ZUOK-BZlXnsXv.js +1 -0
  21. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-BZlXnsXv.js +1 -0
  22. package/gui/dist/assets/{cose-bilkent-S5V4N54A-Ds421Gqq.js → cose-bilkent-S5V4N54A-D_ZPLp5P.js} +1 -1
  23. package/gui/dist/assets/{dagre-BM42HDAG-DlN4DvzI.js → dagre-BM42HDAG-2XyC0YBj.js} +1 -1
  24. package/gui/dist/assets/{diagram-2AECGRRQ-egBqkNYN.js → diagram-2AECGRRQ-fNv6yQF_.js} +1 -1
  25. package/gui/dist/assets/{diagram-5GNKFQAL-De9QbkXT.js → diagram-5GNKFQAL-BUlxr0NW.js} +1 -1
  26. package/gui/dist/assets/{diagram-KO2AKTUF-B7ViWsaJ.js → diagram-KO2AKTUF-CtusNGfh.js} +1 -1
  27. package/gui/dist/assets/{diagram-LMA3HP47-CWI-hnKY.js → diagram-LMA3HP47-Dkq3FOEe.js} +1 -1
  28. package/gui/dist/assets/{diagram-OG6HWLK6-qstINSVL.js → diagram-OG6HWLK6-rjhcMJNr.js} +1 -1
  29. package/gui/dist/assets/{erDiagram-TEJ5UH35-CH3pg4ub.js → erDiagram-TEJ5UH35-Bqmogkqv.js} +1 -1
  30. package/gui/dist/assets/{flowDiagram-I6XJVG4X-DGKis5au.js → flowDiagram-I6XJVG4X-BcYYq0Bh.js} +1 -1
  31. package/gui/dist/assets/{ganttDiagram-6RSMTGT7-BiD0e5Ub.js → ganttDiagram-6RSMTGT7-BGmJltMK.js} +1 -1
  32. package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-7LNV7Qnv.js → gitGraphDiagram-PVQCEYII-JIYjcd0T.js} +1 -1
  33. package/gui/dist/assets/{index-DBOt1LJt.js → index-BwW5YDD1.js} +34 -34
  34. package/gui/dist/assets/{index-BYVxYY90.css → index-Cbo0HWer.css} +1 -1
  35. package/gui/dist/assets/{infoDiagram-5YYISTIA-CDjlLZyM.js → infoDiagram-5YYISTIA-CJKrfqe4.js} +1 -1
  36. package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-if4ogb8U.js → ishikawaDiagram-YF4QCWOH-Bu4wBvlL.js} +1 -1
  37. package/gui/dist/assets/{journeyDiagram-JHISSGLW-DOMmF1XD.js → journeyDiagram-JHISSGLW-B2CtojGV.js} +1 -1
  38. package/gui/dist/assets/{kanban-definition-UN3LZRKU-BeqZERBX.js → kanban-definition-UN3LZRKU-CKbuCL_h.js} +1 -1
  39. package/gui/dist/assets/{linear-BKJMMNN0.js → linear-BdHWi7h7.js} +1 -1
  40. package/gui/dist/assets/{mindmap-definition-RKZ34NQL-B2MDEpXz.js → mindmap-definition-RKZ34NQL-Dbf71zzi.js} +1 -1
  41. package/gui/dist/assets/{pieDiagram-4H26LBE5-Cykp2K6j.js → pieDiagram-4H26LBE5-P8RSqdBA.js} +1 -1
  42. package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-DLczui3d.js → quadrantDiagram-W4KKPZXB-mVsJmQan.js} +1 -1
  43. package/gui/dist/assets/{requirementDiagram-4Y6WPE33-VbvufLF4.js → requirementDiagram-4Y6WPE33-BfHNLWFb.js} +1 -1
  44. package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-BUOiIMns.js → sankeyDiagram-5OEKKPKP-CF28kVcG.js} +1 -1
  45. package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-CB63G6iO.js → sequenceDiagram-3UESZ5HK-Bvs2r29Y.js} +1 -1
  46. package/gui/dist/assets/{stateDiagram-AJRCARHV-DvGDV-mj.js → stateDiagram-AJRCARHV-Cbg-3kIx.js} +1 -1
  47. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-Cg1sS-MT.js +1 -0
  48. package/gui/dist/assets/{timeline-definition-PNZ67QCA-DVi9QtSX.js → timeline-definition-PNZ67QCA-ChYm8r8v.js} +1 -1
  49. package/gui/dist/assets/{vennDiagram-CIIHVFJN-BBbj4Tef.js → vennDiagram-CIIHVFJN-CPcYOWG6.js} +1 -1
  50. package/gui/dist/assets/{wardley-L42UT6IY-Ni3IxkS6.js → wardley-L42UT6IY-KWdiWaFE.js} +1 -1
  51. package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-8K4ncLPD.js → wardleyDiagram-YWT4CUSO-DAgBnDcZ.js} +1 -1
  52. package/gui/dist/assets/{xychartDiagram-2RQKCTM6-glUaKKLx.js → xychartDiagram-2RQKCTM6-DwOk_srp.js} +1 -1
  53. package/gui/dist/index.html +2 -2
  54. package/package.json +1 -1
  55. package/gui/dist/assets/channel-BrniWeCv.js +0 -1
  56. package/gui/dist/assets/classDiagram-4FO5ZUOK-B8_yXQAM.js +0 -1
  57. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-B8_yXQAM.js +0 -1
  58. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-CSlYTx4_.js +0 -1
package/README.md CHANGED
@@ -13,6 +13,7 @@ Connect it to Cursor, Claude Desktop, or any MCP-compatible agent to let your AI
13
13
  - **GUI** — built-in web interface when a proxy is configured (`PROXY_URL`); without it, the GUI worker is not started
14
14
  - **Proxy-aware** — integrates with the [proxy-setup](https://github.com/Imena/proxy-setup) for GUI exposure
15
15
  - **Links & structure** — `check_links`, `get_doc_tree`, `move_doc`, and `git_diff_doc` for maintenance workflows
16
+ - **Image support** — upload images to a project's assets via `upload_image` (local file path) or directly from the GUI editor; images are stored per-project and rendered inline in the viewer and in PDF exports
16
17
 
17
18
  ## Installation
18
19
 
@@ -80,6 +81,33 @@ Optional `.env` at the package root (directory containing `package.json` discove
80
81
  | `check_links` | Validate `related_docs`, `doc://` links, and `#heading` anchors |
81
82
  | `list_projects` | List all documentation projects |
82
83
  | `set_project` | Switch the active project **for the GUI only** (not for MCP tools) |
84
+ | `upload_image` | Upload an image from a local file path to a project's assets; returns the markdown link to insert |
85
+
86
+ ## Images in documents
87
+
88
+ Images can be embedded in any documentation entry using standard markdown syntax:
89
+
90
+ ```markdown
91
+ ![alt text](/api/images/my-project/screenshot.png) <!-- local upload -->
92
+ ![alt text](https://example.com/diagram.png) <!-- external URL -->
93
+ ```
94
+
95
+ **Via the MCP tool** — use `upload_image` with the absolute path of the file on the server:
96
+
97
+ ```json
98
+ {
99
+ "filename": "screenshot.png",
100
+ "filePath": "/absolute/path/to/screenshot.png",
101
+ "alt": "Architecture diagram"
102
+ }
103
+ ```
104
+
105
+ The tool copies the file into `.docs-data/projects/{project}/assets/` and returns the ready-to-use markdown snippet.
106
+
107
+ **Via the GUI editor** — click the **🖼 Image** button in the editor toolbar to open the image panel:
108
+ - **Upload tab** — pick a local file; it is uploaded automatically and the markdown link is inserted at the cursor position
109
+ - **URL tab** — paste any external image URL; the markdown link is inserted at the cursor position
110
+ - **Project images gallery** — click any previously uploaded image to re-insert it
83
111
 
84
112
  ## Data Storage
85
113
 
@@ -585,7 +585,7 @@ app.post("/api/images", async (c) => {
585
585
  const finalName = resolveImageFilename(assetsDir, file.name ?? "image");
586
586
  const buffer = Buffer.from(await file.arrayBuffer());
587
587
  fs.writeFileSync(path.join(assetsDir, finalName), buffer);
588
- return c.json({ url: `/api/images/${project}/${finalName}`, filename: finalName });
588
+ return c.json({ url: `/api/images/${encodeURIComponent(project)}/${encodeURIComponent(finalName)}`, filename: finalName });
589
589
  });
590
590
  app.get("/api/images/:project", (c) => {
591
591
  const project = c.req.param("project");
@@ -593,7 +593,7 @@ app.get("/api/images/:project", (c) => {
593
593
  if (!fs.existsSync(assetsDir))
594
594
  return c.json([]);
595
595
  const files = fs.readdirSync(assetsDir).filter((f) => /\.(png|jpe?g|gif|webp|svg)$/i.test(f));
596
- return c.json(files.map((f) => ({ filename: f, url: `/api/images/${project}/${f}` })));
596
+ return c.json(files.map((f) => ({ filename: f, url: `/api/images/${encodeURIComponent(project)}/${encodeURIComponent(f)}` })));
597
597
  });
598
598
  app.get("/api/images/:project/:filename", (c) => {
599
599
  const project = c.req.param("project");
package/dist/src/index.js CHANGED
@@ -975,17 +975,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
975
975
  },
976
976
  {
977
977
  name: "upload_image",
978
- description: "Upload an image to a project's assets and get back the markdown link to insert in a document. Provide either 'content' (base64-encoded image) or 'filePath' (absolute path on the server). Returns the URL and a ready-to-use markdown snippet: ![alt](/api/images/{project}/{filename}).",
978
+ description: "Upload an image to a project's assets from a local file path and get back the markdown link to insert in a document. Returns the URL and a ready-to-use markdown snippet: ![alt](/api/images/{project}/{filename}).",
979
979
  inputSchema: {
980
980
  type: "object",
981
981
  properties: {
982
982
  filename: { type: "string", description: "Filename with extension, e.g. 'screenshot.png'" },
983
- content: { type: "string", description: "Base64-encoded image content (without data: prefix)" },
984
- filePath: { type: "string", description: "Absolute path to the image file on the server (alternative to content)" },
983
+ filePath: { type: "string", description: "Absolute path to the image file on the server" },
985
984
  project: { type: "string", description: "Target project (defaults to current project)" },
986
985
  alt: { type: "string", description: "Alt text for the markdown image link (optional)" },
987
986
  },
988
- required: ["filename"],
987
+ required: ["filename", "filePath"],
989
988
  },
990
989
  },
991
990
  ],
@@ -3,12 +3,9 @@ import path from "path";
3
3
  import { z } from "zod";
4
4
  const UploadImageArgsSchema = z.object({
5
5
  filename: z.string().min(1),
6
- content: z.string().optional(),
7
- filePath: z.string().optional(),
6
+ filePath: z.string(),
8
7
  project: z.string().optional(),
9
8
  alt: z.string().optional(),
10
- }).refine((d) => d.content !== undefined || d.filePath !== undefined, {
11
- message: "Either 'content' (base64) or 'filePath' must be provided",
12
9
  });
13
10
  function sanitizeFilename(name) {
14
11
  return name.replace(/[^a-zA-Z0-9._-]/g, "_");
@@ -29,25 +26,17 @@ export async function uploadImage(storageEngine, args) {
29
26
  const validated = UploadImageArgsSchema.parse(args);
30
27
  const config = storageEngine.getConfig();
31
28
  const project = validated.project ?? config.currentProject;
29
+ if (!fs.existsSync(validated.filePath)) {
30
+ return {
31
+ isError: true,
32
+ content: [{ type: "text", text: `File not found: ${validated.filePath}` }],
33
+ };
34
+ }
32
35
  const assetsDir = path.join(storageEngine.getDataDir(), "projects", project, "assets");
33
36
  fs.mkdirSync(assetsDir, { recursive: true });
34
37
  const finalName = resolveFilename(assetsDir, validated.filename);
35
- const targetPath = path.join(assetsDir, finalName);
36
- if (validated.content !== undefined) {
37
- const buffer = Buffer.from(validated.content, "base64");
38
- fs.writeFileSync(targetPath, buffer);
39
- }
40
- else {
41
- const src = validated.filePath;
42
- if (!fs.existsSync(src)) {
43
- return {
44
- isError: true,
45
- content: [{ type: "text", text: `File not found: ${src}` }],
46
- };
47
- }
48
- fs.copyFileSync(src, targetPath);
49
- }
50
- const url = `/api/images/${project}/${finalName}`;
38
+ fs.copyFileSync(validated.filePath, path.join(assetsDir, finalName));
39
+ const url = `/api/images/${encodeURIComponent(project)}/${encodeURIComponent(finalName)}`;
51
40
  const alt = validated.alt ?? "";
52
41
  const markdownLink = `![${alt}](${url})`;
53
42
  return {
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.49";
1
+ export declare const APP_VERSION = "1.0.52";
@@ -1,2 +1,2 @@
1
1
  // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.49';
2
+ export const APP_VERSION = '1.0.52';
@@ -1 +1 @@
1
- import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-DBOt1LJt.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(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,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(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-rn/2;return[H(d)*n,q(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?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},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};
1
+ import{a0 as ln,a1 as an,a2 as y,a3 as tn,a4 as H,a5 as q,a6 as _,a7 as un,a8 as rn,a9 as L,aa as o,ab as B,ac as sn,ad as on,ae as fn}from"./index-BwW5YDD1.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,C,a){var O=I-l,i=D-h,n=C-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function W(l,h,I,D,v,A,C){var a=l-I,O=h-D,i=(C?A:-A)/L(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,F=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*L(fn(0,T*T*R-P*P)),j=(P*g-m*S)/R,z=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=j-F,e=z-t,r=w-F,G=p-t;return x*x+e*e>r*r+G*G&&(j=w,z=p),{cx:j,cy:z,x01:-n,y01:-d,x11:j*(v/T-1),y11:z*(v/T-1)}}function hn(){var l=cn,h=yn,I=B(0),D=null,v=gn,A=dn,C=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,F=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(F>tn-y)a.moveTo(s*H(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*H(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=F,S=F,j=C.apply(this,arguments)/2,z=j>y&&(D?+D.apply(this,arguments):L(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(z>y){var G=sn(z/u*q(j)),M=sn(z/s*q(j));(P-=G*2)>y?(G*=t?1:-1,R+=G,T-=G):(P=0,R=T=(f+c)/2),(S-=M*2)>y?(M*=t?1:-1,m+=M,g-=M):(S=0,m=g=(f+c)/2)}var J=s*H(m),K=s*q(m),N=u*H(T),Q=u*q(T);if(w>y){var U=s*H(g),V=s*q(g),X=u*H(R),Y=u*q(R),E;if(F<rn)if(E=pn(J,K,X,Y,U,V,N,Q)){var Z=J-E[0],$=K-E[1],b=U-E[0],k=V-E[1],nn=1/q(on((Z*b+$*k)/(L(Z*Z+$*$)*L(b*b+k*k)))/2),en=L(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(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,g,!t)):a.moveTo(J,K),!(u>y)||!(P>y)?a.lineTo(N,Q):p>y?(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-rn/2;return[H(d)*n,q(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?(I=typeof n=="function"?n:B(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:B(+n),i):D},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};