redraft-local 0.1.0 → 0.3.0

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 (79) hide show
  1. package/README.md +24 -17
  2. package/dist/assets/{arc-BgLKgAzo.js → arc-Bx_jbFSO.js} +1 -1
  3. package/dist/assets/{architectureDiagram-3BPJPVTR-DUjZFSch.js → architectureDiagram-3BPJPVTR-DjViQx0O.js} +1 -1
  4. package/dist/assets/{blockDiagram-GPEHLZMM-B5lXfnYt.js → blockDiagram-GPEHLZMM-DTCH35T-.js} +1 -1
  5. package/dist/assets/{c4Diagram-AAUBKEIU-BvClm0qm.js → c4Diagram-AAUBKEIU-D5QclxBl.js} +1 -1
  6. package/dist/assets/channel-DVcOphtD.js +1 -0
  7. package/dist/assets/{chunk-2J33WTMH-CEHXzvmq.js → chunk-2J33WTMH-mfns4_-x.js} +1 -1
  8. package/dist/assets/{chunk-4BX2VUAB-DSC0P7-r.js → chunk-4BX2VUAB-B61uUGMe.js} +1 -1
  9. package/dist/assets/{chunk-55IACEB6--6omHD3y.js → chunk-55IACEB6-DA6e9MgI.js} +1 -1
  10. package/dist/assets/{chunk-727SXJPM-_oYajenN.js → chunk-727SXJPM-BpqsaEKK.js} +1 -1
  11. package/dist/assets/{chunk-AQP2D5EJ-CtBEk7Wt.js → chunk-AQP2D5EJ-BpA21YaX.js} +1 -1
  12. package/dist/assets/{chunk-FMBD7UC4-CUG06_Py.js → chunk-FMBD7UC4-B2Ooo6PY.js} +1 -1
  13. package/dist/assets/{chunk-ND2GUHAM-ByZ-QCVp.js → chunk-ND2GUHAM-BXrYGaJ8.js} +1 -1
  14. package/dist/assets/{chunk-QZHKN3VN-DyKKbGn5.js → chunk-QZHKN3VN-BibzV1lc.js} +1 -1
  15. package/dist/assets/classDiagram-4FO5ZUOK-Ba4S_4Bd.js +1 -0
  16. package/dist/assets/classDiagram-v2-Q7XG4LA2-Ba4S_4Bd.js +1 -0
  17. package/dist/assets/{cose-bilkent-S5V4N54A-DO1d36Xa.js → cose-bilkent-S5V4N54A-B3L_ap3d.js} +1 -1
  18. package/dist/assets/{dagre-BM42HDAG-CtijaGW4.js → dagre-BM42HDAG-DINnYhJj.js} +1 -1
  19. package/dist/assets/{diagram-2AECGRRQ-CLuIxwuH.js → diagram-2AECGRRQ-DKkMzolj.js} +1 -1
  20. package/dist/assets/{diagram-5GNKFQAL-C1SsZ_SX.js → diagram-5GNKFQAL-C-qGYHLO.js} +1 -1
  21. package/dist/assets/{diagram-KO2AKTUF-0Q55p83r.js → diagram-KO2AKTUF-D_YywoHO.js} +1 -1
  22. package/dist/assets/{diagram-LMA3HP47-Cxe6Lxmi.js → diagram-LMA3HP47-AEU6Wn4e.js} +1 -1
  23. package/dist/assets/{diagram-OG6HWLK6-DdRxQD4N.js → diagram-OG6HWLK6-YD2sPLDn.js} +1 -1
  24. package/dist/assets/{erDiagram-TEJ5UH35-Br4OpnN3.js → erDiagram-TEJ5UH35-D0LN3ezf.js} +1 -1
  25. package/dist/assets/{flowDiagram-I6XJVG4X-BiWm4cMT.js → flowDiagram-I6XJVG4X-CXlehrNY.js} +1 -1
  26. package/dist/assets/{ganttDiagram-6RSMTGT7-Brtf61gk.js → ganttDiagram-6RSMTGT7-C9nvnDAY.js} +1 -1
  27. package/dist/assets/{gitGraphDiagram-PVQCEYII-B_3TyVGw.js → gitGraphDiagram-PVQCEYII-D7ZroEN3.js} +1 -1
  28. package/dist/assets/{graph-DtBDQa9e.js → graph-CE-se89a.js} +1 -1
  29. package/dist/assets/{index-Df2jy_bv.js → index-1qrnqL9_.js} +1 -1
  30. package/dist/assets/{index-5ZUGo5ij.js → index-6NUw7hAj.js} +1 -1
  31. package/dist/assets/{index-BADfuR--.js → index-ASrd2Wik.js} +1 -1
  32. package/dist/assets/{index-Ds7udwcB.js → index-BCL8kGum.js} +1 -1
  33. package/dist/assets/{index-BR9BrISk.js → index-BGb5UavJ.js} +1 -1
  34. package/dist/assets/{index-B-96Htfw.js → index-BNihLXv8.js} +1 -1
  35. package/dist/assets/{index-MfTARqwV.css → index-Ba98D87M.css} +1 -1
  36. package/dist/assets/{index-CZY06TRX.js → index-BhuIF3I3.js} +168 -168
  37. package/dist/assets/{index-7FKqtxp0.js → index-Bmay4cy6.js} +1 -1
  38. package/dist/assets/{index-qn0Rsj7y.js → index-BrgcB8UX.js} +1 -1
  39. package/dist/assets/{index-2ky3dpil.js → index-C4PHx-Ir.js} +1 -1
  40. package/dist/assets/{index-Da6DydBE.js → index-DC2NcJNs.js} +1 -1
  41. package/dist/assets/{index-Ot1nLBuC.js → index-D_3FPuNW.js} +1 -1
  42. package/dist/assets/{index-4KK6bEqw.js → index-DhjaRjYm.js} +1 -1
  43. package/dist/assets/{index-PN8t7sGq.js → index-DujzHA84.js} +1 -1
  44. package/dist/assets/{index-CiPTn2KW.js → index-Mx22hCLl.js} +1 -1
  45. package/dist/assets/{index-BgooUBR3.js → index-_I9OSuqo.js} +1 -1
  46. package/dist/assets/{index-BD8MFdSo.js → index-da2592jx.js} +1 -1
  47. package/dist/assets/{index-BkakCAI-.js → index-drqy7sPe.js} +1 -1
  48. package/dist/assets/{index-CBjB7xM7.js → index-hKBKonfI.js} +1 -1
  49. package/dist/assets/{index-OT6ZQvoz.js → index-nFXe-aH0.js} +1 -1
  50. package/dist/assets/{index-CymWWySw.js → index-qsbINBhr.js} +1 -1
  51. package/dist/assets/{index-DKi-lLAL.js → index-rPcj-Gx2.js} +1 -1
  52. package/dist/assets/{index-BfnTu5JW.js → index-xGMsFCHl.js} +1 -1
  53. package/dist/assets/{infoDiagram-5YYISTIA-DXpolhhW.js → infoDiagram-5YYISTIA-CV6G_t-j.js} +1 -1
  54. package/dist/assets/{ishikawaDiagram-YF4QCWOH-CaMQv6HD.js → ishikawaDiagram-YF4QCWOH-D6sL9j9e.js} +1 -1
  55. package/dist/assets/{journeyDiagram-JHISSGLW-grFPpRCE.js → journeyDiagram-JHISSGLW-CI5swLIH.js} +1 -1
  56. package/dist/assets/{kanban-definition-UN3LZRKU-BXTf-nUc.js → kanban-definition-UN3LZRKU-D888RYZs.js} +1 -1
  57. package/dist/assets/{layout-BfOOH1Wh.js → layout-9d3Xovxi.js} +1 -1
  58. package/dist/assets/{linear-DzLvWW3N.js → linear-DQU338XI.js} +1 -1
  59. package/dist/assets/{mindmap-definition-RKZ34NQL-DnhBS8H1.js → mindmap-definition-RKZ34NQL-AksJikmW.js} +1 -1
  60. package/dist/assets/{pieDiagram-4H26LBE5-DjWB8MBQ.js → pieDiagram-4H26LBE5-DvIRic1J.js} +1 -1
  61. package/dist/assets/{quadrantDiagram-W4KKPZXB-AbXkFaom.js → quadrantDiagram-W4KKPZXB-CUzLA5Mr.js} +1 -1
  62. package/dist/assets/{requirementDiagram-4Y6WPE33-Dmvesc_X.js → requirementDiagram-4Y6WPE33-0lCsM2Z0.js} +1 -1
  63. package/dist/assets/{sankeyDiagram-5OEKKPKP-CTvY1DJo.js → sankeyDiagram-5OEKKPKP-CtZX8ASr.js} +1 -1
  64. package/dist/assets/{sequenceDiagram-3UESZ5HK-ejgTSjfJ.js → sequenceDiagram-3UESZ5HK-GETLRQod.js} +1 -1
  65. package/dist/assets/{stateDiagram-AJRCARHV-Drx8IQcv.js → stateDiagram-AJRCARHV-BtTa97TK.js} +1 -1
  66. package/dist/assets/stateDiagram-v2-BHNVJYJU-CtJkPcip.js +1 -0
  67. package/dist/assets/{timeline-definition-PNZ67QCA-DXznZ8i_.js → timeline-definition-PNZ67QCA-CvA7jkPZ.js} +1 -1
  68. package/dist/assets/{vennDiagram-CIIHVFJN-CLIExu7h.js → vennDiagram-CIIHVFJN-CMzWVwtX.js} +1 -1
  69. package/dist/assets/{wardley-L42UT6IY-CJGVDUi0.js → wardley-L42UT6IY-DbHZ1ZTL.js} +1 -1
  70. package/dist/assets/{wardleyDiagram-YWT4CUSO-DB0Z_Z7a.js → wardleyDiagram-YWT4CUSO-Beh7T2eb.js} +1 -1
  71. package/dist/assets/{xychartDiagram-2RQKCTM6-CLdNuotp.js → xychartDiagram-2RQKCTM6-B2ZT9iKb.js} +1 -1
  72. package/dist/index.html +2 -2
  73. package/dist-server/cli.mjs +229 -41
  74. package/package.json +8 -3
  75. package/bin/redraft.mjs +0 -5
  76. package/dist/assets/channel-7EQqZR3B.js +0 -1
  77. package/dist/assets/classDiagram-4FO5ZUOK-E-KsPQ0n.js +0 -1
  78. package/dist/assets/classDiagram-v2-Q7XG4LA2-E-KsPQ0n.js +0 -1
  79. package/dist/assets/stateDiagram-v2-BHNVJYJU-BWYCpSzu.js +0 -1
package/README.md CHANGED
@@ -2,11 +2,15 @@
2
2
 
3
3
  # ReDraft
4
4
 
5
- ReDraft is a proposal review workspace for markdown documents. It lets teams browse proposals, discuss them with inline comment threads, and edit them in either a rich-text editor or raw markdown — backed by GitHub in remote mode or the local filesystem in local mode.
5
+ [![npm](https://img.shields.io/npm/v/redraft-local)](https://www.npmjs.com/package/redraft-local)
6
+ [![npm downloads](https://img.shields.io/npm/dm/redraft-local)](https://www.npmjs.com/package/redraft-local)
7
+ [![CI](https://github.com/tcamise-gpsw/redraft/actions/workflows/ci.yml/badge.svg)](https://github.com/tcamise-gpsw/redraft/actions/workflows/ci.yml)
8
+
9
+ ReDraft is a review workspace for markdown documents. It lets teams browse repository docs, discuss them with inline comment threads, and edit them in either a rich-text editor or raw markdown — backed by GitHub in remote mode or the local filesystem in local mode.
6
10
 
7
11
  ## What it does
8
12
 
9
- - Organizes proposals from a `proposals/` directory
13
+ - Organizes markdown documents from anywhere in the repository
10
14
  - Renders markdown documents with comments, activity, and Mermaid diagrams
11
15
  - Supports inline comment threads, replies, and resolution
12
16
  - Lets different users work in the mode that fits them best
@@ -21,7 +25,7 @@ ReDraft is a proposal review workspace for markdown documents. It lets teams bro
21
25
 
22
26
  ## Remote mode — for reviewers and contributors
23
27
 
24
- Remote mode is the hosted GitHub-backed experience. You connect ReDraft to a repository that contains proposal files under `proposals/`.
28
+ Remote mode is the hosted GitHub-backed experience. You connect ReDraft to a repository and browse any markdown document in that repo.
25
29
 
26
30
  ### For non-technical reviewers
27
31
 
@@ -30,7 +34,7 @@ Use **View** and **WYSIWYG** modes when you want to read, comment, and make ligh
30
34
  Typical workflow:
31
35
  1. Open the hosted ReDraft site.
32
36
  2. Enter a fine-grained GitHub PAT and `owner/repo`.
33
- 3. Choose a proposal from the tree.
37
+ 3. Choose a document from the tree.
34
38
  4. Read in **View** mode or switch to **WYSIWYG**.
35
39
  5. Select text, add comments, reply to threads, and resolve feedback.
36
40
 
@@ -40,7 +44,7 @@ Use **Raw** mode when you want direct markdown control while still keeping the b
40
44
 
41
45
  Typical workflow:
42
46
  1. Connect to the target repository.
43
- 2. Open a proposal from the tree.
47
+ 2. Open a document from the tree.
44
48
  3. Switch between **View**, **WYSIWYG**, and **Raw** as needed.
45
49
  4. Edit markdown directly in **Raw** mode.
46
50
  5. Save changes back to GitHub with SHA-based conflict protection.
@@ -52,9 +56,9 @@ ReDraft expects a fine-grained GitHub PAT with:
52
56
  - **Metadata: Read**
53
57
 
54
58
  Repository conventions:
55
- - Proposal documents live under `proposals/`
56
- - Comment threads live in sidecar `*.comments.json` files
57
- - Proposal content and comment files are written with SHA checks for conflict detection
59
+ - Markdown documents can live anywhere in the repo
60
+ - Comment threads live under `.redraft/comments/<mirrored-path>.comments.json`
61
+ - Document content and comment files are written with SHA checks for conflict detection
58
62
 
59
63
  ---
60
64
 
@@ -67,14 +71,14 @@ Local mode serves the same UI from your machine, but reads and writes local file
67
71
  **Install once globally, or use directly via npx:**
68
72
 
69
73
  ```bash
70
- npx redraft-local ./proposals
74
+ npx redraft-local
71
75
  ```
72
76
 
73
77
  Or install globally and reuse:
74
78
 
75
79
  ```bash
76
80
  npm install -g redraft-local
77
- redraft-local ./proposals
81
+ redraft-local
78
82
  ```
79
83
 
80
84
  This starts a local ReDraft server at `http://127.0.0.1:4200` by default. The frontend is bundled into the package — no separate build step required.
@@ -91,34 +95,37 @@ redraft serve [directory] [options]
91
95
  --no-ui API-only mode, skip serving the frontend
92
96
  ```
93
97
 
98
+ `[directory]` is optional. Omit it to serve the current working directory.
99
+
94
100
  **Contributing / running from source:**
95
101
 
96
102
  ```bash
97
103
  npm install
98
104
  npm run build
99
- npm run serve -- ./proposals
105
+ npm run serve
100
106
  ```
101
107
 
102
108
  What local mode gives you:
103
109
  - No PAT prompt
104
- - Direct read/write access to local `.md` and `.comments.json` files
110
+ - Direct read/write access to local `.md` files
111
+ - Structured review threads stored under `.redraft/comments/`
105
112
  - Live UI updates when files change on disk
106
113
  - Optional git convenience endpoints for status and commits
107
114
 
108
115
  ### Working with AI agents
109
116
 
110
- Local mode is the intended environment for AI-assisted proposal workflows.
117
+ Local mode is the intended environment for AI-assisted document workflows.
111
118
 
112
119
  The design target is:
113
- - Agents edit proposal markdown directly on disk
120
+ - Agents edit markdown documents directly on disk
114
121
  - Agents use the local ReDraft API for structured comment operations
115
122
 
116
123
  Planned/common AI workflows include:
117
124
  - Review unresolved comment threads one by one
118
125
  - Draft or post replies
119
126
  - Resolve completed threads
120
- - Revise a proposal based on accumulated feedback
121
- - Summarize open discussions across proposals
127
+ - Revise a document based on accumulated feedback
128
+ - Summarize open discussions across the repo
122
129
 
123
130
  ---
124
131
 
@@ -128,7 +135,7 @@ ReDraft uses one React frontend across all modes.
128
135
 
129
136
  - In **remote mode**, the browser talks to the GitHub REST API.
130
137
  - In **local mode**, the browser talks to a local server that mimics the GitHub contents API while reading and writing the filesystem.
131
- - Comment threads are stored separately from proposal markdown, so review discussion remains structured and portable.
138
+ - Comment threads are stored separately from document markdown under `.redraft/comments/`, so review discussion remains structured and portable.
132
139
 
133
140
  For architecture details, see `docs/architecture.md`.
134
141
 
@@ -1 +1 @@
1
- import{a8 as ln,a9 as an,aa as g,ab as tn,ac as G,ad as j,ae as _,af as un,ag as rn,ah as K,ai as o,aj as z,ak as sn,al as on,am as fn}from"./index-CZY06TRX.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,B,a){var I=E-l,i=q-h,n=B-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 V(l,h,E,q,v,A,B){var a=l-E,I=h-q,i=(B?A:-A)/K(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,C=(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)*K(fn(0,T*T*R-P*P)),S=(P*y-m*O)/R,k=(-P*m-y*O)/R,w=(P*y+m*O)/R,p=(-P*m+y*O)/R,x=S-C,e=k-t,r=w-C,F=p-t;return x*x+e*e>r*r+F*F&&(S=w,k=p),{cx:S,cy:k,x01:-n,y01:-d,x11:S*(v/T-1),y11:k*(v/T-1)}}function hn(){var l=cn,h=gn,E=z(0),q=null,v=yn,A=dn,B=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)-an,c=A.apply(this,arguments)-an,C=un(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(C>tn-g)a.moveTo(s*G(f),s*j(f)),a.arc(0,0,s,f,c,!t),u>g&&(a.moveTo(u*G(c),u*j(c)),a.arc(0,0,u,c,f,t));else{var m=f,y=c,R=f,T=c,P=C,O=C,S=B.apply(this,arguments)/2,k=S>g&&(q?+q.apply(this,arguments):K(u*u+s*s)),w=_(un(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(k>g){var F=sn(k/u*j(S)),L=sn(k/s*j(S));(P-=F*2)>g?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(O-=L*2)>g?(L*=t?1:-1,m+=L,y-=L):(O=0,m=y=(f+c)/2)}var H=s*G(m),J=s*j(m),M=u*G(T),N=u*j(T);if(w>g){var Q=s*G(y),U=s*j(y),W=u*G(R),X=u*j(R),D;if(C<rn)if(D=pn(H,J,W,X,Q,U,M,N)){var Y=H-D[0],Z=J-D[1],$=Q-D[0],b=U-D[1],nn=1/j(on((Y*$+Z*b)/(K(Y*Y+Z*Z)*K($*$+b*b)))/2),en=K(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=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,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(H,J),a.arc(0,0,s,m,y,!t)):a.moveTo(H,J),!(u>g)||!(P>g)?a.lineTo(M,N):p>g?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,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[G(d)*n,j(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:z(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:z(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:z(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:z(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:z(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:z(+n),i):A},i.padAngle=function(n){return arguments.length?(B=typeof n=="function"?n:z(+n),i):B},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{a8 as ln,a9 as an,aa as g,ab as tn,ac as G,ad as j,ae as _,af as un,ag as rn,ah as K,ai as o,aj as z,ak as sn,al as on,am as fn}from"./index-BhuIF3I3.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,B,a){var I=E-l,i=q-h,n=B-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 V(l,h,E,q,v,A,B){var a=l-E,I=h-q,i=(B?A:-A)/K(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,C=(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)*K(fn(0,T*T*R-P*P)),S=(P*y-m*O)/R,k=(-P*m-y*O)/R,w=(P*y+m*O)/R,p=(-P*m+y*O)/R,x=S-C,e=k-t,r=w-C,F=p-t;return x*x+e*e>r*r+F*F&&(S=w,k=p),{cx:S,cy:k,x01:-n,y01:-d,x11:S*(v/T-1),y11:k*(v/T-1)}}function hn(){var l=cn,h=gn,E=z(0),q=null,v=yn,A=dn,B=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)-an,c=A.apply(this,arguments)-an,C=un(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(C>tn-g)a.moveTo(s*G(f),s*j(f)),a.arc(0,0,s,f,c,!t),u>g&&(a.moveTo(u*G(c),u*j(c)),a.arc(0,0,u,c,f,t));else{var m=f,y=c,R=f,T=c,P=C,O=C,S=B.apply(this,arguments)/2,k=S>g&&(q?+q.apply(this,arguments):K(u*u+s*s)),w=_(un(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(k>g){var F=sn(k/u*j(S)),L=sn(k/s*j(S));(P-=F*2)>g?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(O-=L*2)>g?(L*=t?1:-1,m+=L,y-=L):(O=0,m=y=(f+c)/2)}var H=s*G(m),J=s*j(m),M=u*G(T),N=u*j(T);if(w>g){var Q=s*G(y),U=s*j(y),W=u*G(R),X=u*j(R),D;if(C<rn)if(D=pn(H,J,W,X,Q,U,M,N)){var Y=H-D[0],Z=J-D[1],$=Q-D[0],b=U-D[1],nn=1/j(on((Y*$+Z*b)/(K(Y*Y+Z*Z)*K($*$+b*b)))/2),en=K(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=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,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(H,J),a.arc(0,0,s,m,y,!t)):a.moveTo(H,J),!(u>g)||!(P>g)?a.lineTo(M,N):p>g?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,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[G(d)*n,j(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:z(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:z(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:z(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:z(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:z(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:z(+n),i):A},i.padAngle=function(n){return arguments.length?(B=typeof n=="function"?n:z(+n),i):B},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};