@imenam/mcp-documentor 1.0.79 → 1.0.80

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/dist/src/core/storage-engine.d.ts +15 -1
  2. package/dist/src/core/storage-engine.js +24 -10
  3. package/dist/src/index.js +7 -8
  4. package/dist/src/tools/check-freshness.js +7 -10
  5. package/dist/src/tools/list-docs.js +7 -9
  6. package/dist/src/version.d.ts +1 -1
  7. package/dist/src/version.js +1 -1
  8. package/gui/dist/assets/{arc-CsM5OJTM.js → arc-CdXRzMBT.js} +1 -1
  9. package/gui/dist/assets/{architectureDiagram-3BPJPVTR-BwIu1llT.js → architectureDiagram-3BPJPVTR-CGUnwe_I.js} +1 -1
  10. package/gui/dist/assets/{blockDiagram-GPEHLZMM-BVijVnPI.js → blockDiagram-GPEHLZMM-BCI5_vQE.js} +1 -1
  11. package/gui/dist/assets/{c4Diagram-AAUBKEIU-D-rcZUZu.js → c4Diagram-AAUBKEIU-Bm9a6HGg.js} +1 -1
  12. package/gui/dist/assets/channel-f0BgDIcS.js +1 -0
  13. package/gui/dist/assets/{chunk-2J33WTMH-ByfTGREe.js → chunk-2J33WTMH-c7xNwExL.js} +1 -1
  14. package/gui/dist/assets/{chunk-4BX2VUAB-B_5oCXyz.js → chunk-4BX2VUAB-CmcU4Q0o.js} +1 -1
  15. package/gui/dist/assets/{chunk-55IACEB6-Bc2Kq9HD.js → chunk-55IACEB6-K8rRjNKN.js} +1 -1
  16. package/gui/dist/assets/{chunk-727SXJPM-CVwmKEMQ.js → chunk-727SXJPM-DMPnL1bv.js} +1 -1
  17. package/gui/dist/assets/{chunk-AQP2D5EJ-BkMuEFxD.js → chunk-AQP2D5EJ-BeRIIft8.js} +1 -1
  18. package/gui/dist/assets/{chunk-FMBD7UC4-CU7EDl9I.js → chunk-FMBD7UC4-CN4It-fp.js} +1 -1
  19. package/gui/dist/assets/{chunk-ND2GUHAM-1b34Dtkn.js → chunk-ND2GUHAM-Dy-ZqPua.js} +1 -1
  20. package/gui/dist/assets/{chunk-QZHKN3VN-DnUfMecI.js → chunk-QZHKN3VN-CaV4seJw.js} +1 -1
  21. package/gui/dist/assets/classDiagram-4FO5ZUOK-tGvt4n1B.js +1 -0
  22. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-tGvt4n1B.js +1 -0
  23. package/gui/dist/assets/{cose-bilkent-S5V4N54A-D9OBrxKr.js → cose-bilkent-S5V4N54A-B1qt_j1Z.js} +1 -1
  24. package/gui/dist/assets/{dagre-BM42HDAG-zDqwL8xs.js → dagre-BM42HDAG-4x5JEBQG.js} +1 -1
  25. package/gui/dist/assets/{diagram-2AECGRRQ-ejbP8WIj.js → diagram-2AECGRRQ-Q7TvjRjv.js} +1 -1
  26. package/gui/dist/assets/{diagram-5GNKFQAL-Cv9WmtFO.js → diagram-5GNKFQAL-Dguj26bf.js} +1 -1
  27. package/gui/dist/assets/{diagram-KO2AKTUF-BI0ybJiN.js → diagram-KO2AKTUF-DBv6MoZF.js} +1 -1
  28. package/gui/dist/assets/{diagram-LMA3HP47-DlVGttLq.js → diagram-LMA3HP47-mfVXwL5q.js} +1 -1
  29. package/gui/dist/assets/{diagram-OG6HWLK6-DjoAH-Fq.js → diagram-OG6HWLK6-Bn3_yQWG.js} +1 -1
  30. package/gui/dist/assets/{erDiagram-TEJ5UH35-BVQHVGK4.js → erDiagram-TEJ5UH35-Bp4wnBw7.js} +1 -1
  31. package/gui/dist/assets/{flowDiagram-I6XJVG4X-oZP2Z-6T.js → flowDiagram-I6XJVG4X-CGk72E1Q.js} +1 -1
  32. package/gui/dist/assets/{ganttDiagram-6RSMTGT7-dy4QyEOP.js → ganttDiagram-6RSMTGT7-C1WQIgpu.js} +1 -1
  33. package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-BxgLy7Ln.js → gitGraphDiagram-PVQCEYII-DSIs1ZqI.js} +1 -1
  34. package/gui/dist/assets/{index-Dtv0slFQ.js → index-T7ZLHNgs.js} +4 -4
  35. package/gui/dist/assets/{infoDiagram-5YYISTIA-DNOdinpR.js → infoDiagram-5YYISTIA-DzHdfk5Y.js} +1 -1
  36. package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-C4pQ434G.js → ishikawaDiagram-YF4QCWOH-DLxqTmDU.js} +1 -1
  37. package/gui/dist/assets/{journeyDiagram-JHISSGLW-CBrVYW94.js → journeyDiagram-JHISSGLW-DYUPmZnf.js} +1 -1
  38. package/gui/dist/assets/{kanban-definition-UN3LZRKU-Df-rgiY8.js → kanban-definition-UN3LZRKU-f6km2MDT.js} +1 -1
  39. package/gui/dist/assets/{linear-B_6fRXVt.js → linear-DHhAaAXH.js} +1 -1
  40. package/gui/dist/assets/{mindmap-definition-RKZ34NQL-CRAd_VDM.js → mindmap-definition-RKZ34NQL-nergVxV3.js} +1 -1
  41. package/gui/dist/assets/{pieDiagram-4H26LBE5-CJkmLrDI.js → pieDiagram-4H26LBE5-D4IJAdGz.js} +1 -1
  42. package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-D-rDEcnF.js → quadrantDiagram-W4KKPZXB-B5yYdOsV.js} +1 -1
  43. package/gui/dist/assets/{requirementDiagram-4Y6WPE33-DE8MhSMe.js → requirementDiagram-4Y6WPE33-BrhJp07G.js} +1 -1
  44. package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-BwlxtrUs.js → sankeyDiagram-5OEKKPKP-CUBA4e7F.js} +1 -1
  45. package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-B4LjBzWg.js → sequenceDiagram-3UESZ5HK-DP0-rUie.js} +1 -1
  46. package/gui/dist/assets/{stateDiagram-AJRCARHV-Bv72afPK.js → stateDiagram-AJRCARHV-_BnVcpam.js} +1 -1
  47. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-B5Vwq56z.js +1 -0
  48. package/gui/dist/assets/{timeline-definition-PNZ67QCA-CBxgf8iW.js → timeline-definition-PNZ67QCA-crbYjsrq.js} +1 -1
  49. package/gui/dist/assets/{vennDiagram-CIIHVFJN-DPSdK06q.js → vennDiagram-CIIHVFJN-EOqENtE1.js} +1 -1
  50. package/gui/dist/assets/{wardley-L42UT6IY-JIAzuoPm.js → wardley-L42UT6IY-B1FVq-_Y.js} +1 -1
  51. package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-YDfaF1wT.js → wardleyDiagram-YWT4CUSO-D1DZwIH_.js} +1 -1
  52. package/gui/dist/assets/{xychartDiagram-2RQKCTM6-DHlPryZX.js → xychartDiagram-2RQKCTM6-B6Wr8_OJ.js} +1 -1
  53. package/gui/dist/index.html +1 -1
  54. package/package.json +1 -1
  55. package/gui/dist/assets/channel-DKPwwuQf.js +0 -1
  56. package/gui/dist/assets/classDiagram-4FO5ZUOK-CnCvVGW9.js +0 -1
  57. package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-CnCvVGW9.js +0 -1
  58. package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-BKJDOkkR.js +0 -1
@@ -1,9 +1,14 @@
1
- import type { DocEntry, DocSummary, ExportBundle } from "../../shared/schemas/doc.schema.js";
1
+ import type { DocEntry, DocSummary, TrackedFile, ExportBundle } from "../../shared/schemas/doc.schema.js";
2
2
  import type { HistoryStore } from "./history-store.js";
3
3
  interface GlobalConfig {
4
4
  projects: string[];
5
5
  foldersMigrated?: boolean;
6
6
  }
7
+ /** One doc as a project listing yields it: the GUI-facing summary, plus what it tracks. */
8
+ export interface DocListing {
9
+ summary: DocSummary;
10
+ tracked_files: TrackedFile[];
11
+ }
7
12
  /**
8
13
  * GitHub sync settings. Sourced exclusively from environment variables — the
9
14
  * repository, branch and token are administration concerns and must never be
@@ -43,6 +48,15 @@ export declare class StorageEngine {
43
48
  saveDoc(doc: DocEntry, project: string, changeType?: "create" | "update" | "patch"): Promise<void>;
44
49
  getDoc(id: string, project: string): Promise<DocEntry | null>;
45
50
  listDocs(project: string): Promise<DocSummary[]>;
51
+ /**
52
+ * Same listing, plus the tracked files parsed from the very same read.
53
+ *
54
+ * Freshness has to know what each doc tracks, and fetching that with `getDoc` per summary read
55
+ * and re-parsed every file of the project a second time. Callers that scan a whole project use
56
+ * this instead; `tracked_files` stays out of `DocSummary` so it is never shipped to the GUI,
57
+ * which only needs the stale/broken flags.
58
+ */
59
+ listDocsDetailed(project: string): Promise<DocListing[]>;
46
60
  deleteDoc(id: string, project: string): Promise<boolean>;
47
61
  moveDoc(oldId: string, newId: string, project: string): Promise<boolean>;
48
62
  getBundles(): ExportBundle[];
@@ -151,11 +151,22 @@ export class StorageEngine {
151
151
  };
152
152
  }
153
153
  async listDocs(project) {
154
+ return (await this.listDocsDetailed(project)).map((listing) => listing.summary);
155
+ }
156
+ /**
157
+ * Same listing, plus the tracked files parsed from the very same read.
158
+ *
159
+ * Freshness has to know what each doc tracks, and fetching that with `getDoc` per summary read
160
+ * and re-parsed every file of the project a second time. Callers that scan a whole project use
161
+ * this instead; `tracked_files` stays out of `DocSummary` so it is never shipped to the GUI,
162
+ * which only needs the stale/broken flags.
163
+ */
164
+ async listDocsDetailed(project) {
154
165
  const projectDir = this.getProjectDir(project);
155
166
  if (!fs.existsSync(projectDir))
156
167
  return [];
157
168
  const files = this.walkMdFiles(projectDir);
158
- const summaries = [];
169
+ const listings = [];
159
170
  for (const filePath of files) {
160
171
  try {
161
172
  const raw = fs.readFileSync(filePath, "utf-8");
@@ -164,21 +175,24 @@ export class StorageEngine {
164
175
  const relPath = path.relative(projectDir, filePath);
165
176
  const id = relPath.replace(/\.md$/, "").split(path.sep).join("/");
166
177
  const folder = id.includes("/") ? id.split("/").slice(0, -1).join("/") : undefined;
167
- summaries.push({
168
- id,
169
- title: data.title ?? "",
170
- createdAt: stat.birthtime.toISOString(),
171
- updatedAt: data.updatedAt ?? "",
172
- tags: (data.tags ?? []),
173
- folder,
174
- isStale: false,
178
+ listings.push({
179
+ summary: {
180
+ id,
181
+ title: data.title ?? "",
182
+ createdAt: stat.birthtime.toISOString(),
183
+ updatedAt: data.updatedAt ?? "",
184
+ tags: (data.tags ?? []),
185
+ folder,
186
+ isStale: false,
187
+ },
188
+ tracked_files: (data.tracked_files ?? []),
175
189
  });
176
190
  }
177
191
  catch (err) {
178
192
  logger.warn(`Failed to read doc ${filePath}: ${err}`);
179
193
  }
180
194
  }
181
- return summaries;
195
+ return listings;
182
196
  }
183
197
  // resolveDoc() (first project whose tree contained the path) was removed on purpose:
184
198
  // it silently sent reads and writes to the wrong project when the same doc path
package/dist/src/index.js CHANGED
@@ -204,16 +204,15 @@ function requireProjectFromIPC(msg) {
204
204
  }
205
205
  /** Loads one project's summaries and flags each entry as stale/broken. */
206
206
  async function listDocsWithFreshness(project) {
207
- const docs = await storageEngine.listDocs(project);
208
- await mapWithConcurrency(docs, DOC_CONCURRENCY, async (doc) => {
209
- const full = await storageEngine.getDoc(doc.id, project);
210
- if (!full || full.tracked_files.length === 0)
207
+ const listings = await storageEngine.listDocsDetailed(project);
208
+ await mapWithConcurrency(listings, DOC_CONCURRENCY, async ({ summary, tracked_files }) => {
209
+ if (tracked_files.length === 0)
211
210
  return;
212
- const report = await computeFreshness(full.tracked_files, project);
213
- doc.isStale = report.status === "stale" || report.status === "broken";
214
- doc.isBroken = report.status === "broken";
211
+ const report = await computeFreshness(tracked_files, project);
212
+ summary.isStale = report.status === "stale" || report.status === "broken";
213
+ summary.isBroken = report.status === "broken";
215
214
  });
216
- return docs;
215
+ return listings.map((listing) => listing.summary);
217
216
  }
218
217
  /**
219
218
  * Tells every connected GUI that one project's docs changed. Clients showing
@@ -153,9 +153,9 @@ function renderUntrackedList(titles, heading) {
153
153
  return `\n\n${heading}\n${shown.join("\n")}${suffix}`;
154
154
  }
155
155
  async function scanProjectFreshness(storageEngine, project) {
156
- const summaries = await storageEngine.listDocs(project);
156
+ const listings = await storageEngine.listDocsDetailed(project);
157
157
  const scan = {
158
- docCount: summaries.length,
158
+ docCount: listings.length,
159
159
  stale: [],
160
160
  noTracking: [],
161
161
  broken: [],
@@ -163,14 +163,11 @@ async function scanProjectFreshness(storageEngine, project) {
163
163
  unverifiable: 0,
164
164
  source: getCodeSource(project).label,
165
165
  };
166
- const checked = await mapWithConcurrency(summaries, DOC_CONCURRENCY, async (summary) => {
167
- const doc = await storageEngine.getDoc(summary.id, project);
168
- return doc ? { doc, report: await computeFreshness(doc.tracked_files, project) } : undefined;
169
- });
170
- for (const entry of checked) {
171
- if (!entry)
172
- continue;
173
- const { doc, report } = entry;
166
+ const checked = await mapWithConcurrency(listings, DOC_CONCURRENCY, async ({ summary, tracked_files }) => ({
167
+ doc: summary,
168
+ report: await computeFreshness(tracked_files, project),
169
+ }));
170
+ for (const { doc, report } of checked) {
174
171
  if (report.sourceError)
175
172
  scan.sourceError = report.sourceError;
176
173
  if (report.status === "broken") {
@@ -4,15 +4,15 @@ import { mapWithConcurrency } from "../core/concurrency.js";
4
4
  * Fills in each summary's staleness flags, checking several docs at once — a listing is a
5
5
  * whole-project scan, and doing it one doc at a time is what made large projects time out.
6
6
  */
7
- async function flagStaleness(storageEngine, summaries, project) {
8
- await mapWithConcurrency(summaries, DOC_CONCURRENCY, async (summary) => {
9
- const doc = await storageEngine.getDoc(summary.id, project);
10
- if (!doc || doc.tracked_files.length === 0)
7
+ async function flagStaleness(listings, project) {
8
+ await mapWithConcurrency(listings, DOC_CONCURRENCY, async ({ summary, tracked_files }) => {
9
+ if (tracked_files.length === 0)
11
10
  return;
12
- const report = await computeFreshness(doc.tracked_files, project);
11
+ const report = await computeFreshness(tracked_files, project);
13
12
  summary.isStale = report.status === "stale";
14
13
  summary.isBroken = report.status === "broken";
15
14
  });
15
+ return listings.map((listing) => listing.summary);
16
16
  }
17
17
  function renderProjectDocs(summaries, totalLabel) {
18
18
  if (summaries.length === 0)
@@ -52,8 +52,7 @@ export async function listDocs(storageEngine, args) {
52
52
  const isMultiProject = projectsToList.length > 1;
53
53
  if (!isMultiProject) {
54
54
  const proj = projectsToList[0];
55
- const summaries = await storageEngine.listDocs(proj);
56
- await flagStaleness(storageEngine, summaries, proj);
55
+ const summaries = await flagStaleness(await storageEngine.listDocsDetailed(proj), proj);
57
56
  if (summaries.length === 0) {
58
57
  return { content: [{ type: "text", text: `No documentation entries found in project "${proj}".` }] };
59
58
  }
@@ -64,8 +63,7 @@ export async function listDocs(storageEngine, args) {
64
63
  const lines = [];
65
64
  let grandTotal = 0;
66
65
  for (const proj of projectsToList) {
67
- const summaries = await storageEngine.listDocs(proj);
68
- await flagStaleness(storageEngine, summaries, proj);
66
+ const summaries = await flagStaleness(await storageEngine.listDocsDetailed(proj), proj);
69
67
  grandTotal += summaries.length;
70
68
  lines.push(`\n🗂 ${proj} (${summaries.length})`);
71
69
  lines.push(renderProjectDocs(summaries, ""));
@@ -1 +1 @@
1
- export declare const APP_VERSION = "1.0.79";
1
+ export declare const APP_VERSION = "1.0.80";
@@ -1,2 +1,2 @@
1
1
  // Auto-generated version file - do not edit manually
2
- export const APP_VERSION = '1.0.79';
2
+ export const APP_VERSION = '1.0.80';
@@ -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-Dtv0slFQ.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-T7ZLHNgs.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};