agent-tower 0.5.3-beta.0 → 0.5.3-beta.2

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 (112) hide show
  1. package/dist/web/agent-icons/claude-code.svg +1 -0
  2. package/dist/web/agent-icons/codex.svg +1 -0
  3. package/dist/web/agent-icons/cursor-agent.svg +1 -0
  4. package/dist/web/agent-icons/gemini-cli.svg +1 -0
  5. package/dist/web/assets/AgentDemoPage-Cc1sKLmE.js +1 -0
  6. package/dist/web/assets/AgentLogo-DQId6FqS.js +1 -0
  7. package/dist/web/assets/{ConversationPage-Cyiw8Hra.js → ConversationPage-BXDIbwTR.js} +2 -2
  8. package/dist/web/assets/CreateTaskInput-CDynnXvO.js +2 -0
  9. package/dist/web/assets/{DemoPage-SywVXjL0.js → DemoPage-BeL28u5_.js} +2 -2
  10. package/dist/web/assets/{GeneralSettingsPage-CTymytF6.js → GeneralSettingsPage-CFc1CWWl.js} +1 -1
  11. package/dist/web/assets/{Icons-DmLVnVdg.js → Icons-EVcY239B.js} +1 -1
  12. package/dist/web/assets/LoadingPreviewPage-CRwEvHz_.js +1 -0
  13. package/dist/web/assets/{McpSettingsPage-DyolUN8C.js → McpSettingsPage-BujDKp8T.js} +1 -1
  14. package/dist/web/assets/{MemberAvatar-u6jTOiDY.js → MemberAvatar-Bvlu6rk3.js} +1 -1
  15. package/dist/web/assets/{NotificationSettingsPage-BBop2Bu4.js → NotificationSettingsPage-Dsn-5Uft.js} +1 -1
  16. package/dist/web/assets/{ProfileSettingsPage-Bw-eI0cF.js → ProfileSettingsPage-CuhQBP_t.js} +1 -1
  17. package/dist/web/assets/{ProjectKanbanPage-BFf2FZVz.js → ProjectKanbanPage-DiEo6BK_.js} +34 -34
  18. package/dist/web/assets/{ProjectSettingsPage-BJ4sOhMl.js → ProjectSettingsPage-Cj46vZYF.js} +1 -1
  19. package/dist/web/assets/ProviderSettingsPage-G7pPagR6.js +54 -0
  20. package/dist/web/assets/{SettingsMasterDetail-CdimTj5n.js → SettingsMasterDetail-_vE8P7ke.js} +1 -1
  21. package/dist/web/assets/{TeamSettingsPage-CqQTc5AI.js → TeamSettingsPage-CC_QgVbE.js} +1 -1
  22. package/dist/web/assets/arc-DWusz5nt.js +1 -0
  23. package/dist/web/assets/architectureDiagram-3BPJPVTR-BzUiKOFe.js +36 -0
  24. package/dist/web/assets/{arrow-left-B6KMicbE.js → arrow-left-C_pxdzZL.js} +1 -1
  25. package/dist/web/assets/{blockDiagram-GPEHLZMM-6_0hov2h.js → blockDiagram-GPEHLZMM-BGx2sLYW.js} +1 -1
  26. package/dist/web/assets/{c4Diagram-AAUBKEIU-Br6Tzu3R.js → c4Diagram-AAUBKEIU-BCihVD7R.js} +1 -1
  27. package/dist/web/assets/channel-BBvaRDfe.js +1 -0
  28. package/dist/web/assets/check-C7Na6M49.js +1 -0
  29. package/dist/web/assets/{chevron-down-Cur5jANy.js → chevron-down-DuZqUX3d.js} +1 -1
  30. package/dist/web/assets/{chevron-right-R3KVa8oQ.js → chevron-right-BTjA7BSq.js} +1 -1
  31. package/dist/web/assets/{chevron-up-DcLdFanO.js → chevron-up-BeZXjQ4W.js} +1 -1
  32. package/dist/web/assets/{chunk-2J33WTMH-D8zyttB-.js → chunk-2J33WTMH-BVhYZ0vK.js} +1 -1
  33. package/dist/web/assets/{chunk-4BX2VUAB-Cqi9xJ8M.js → chunk-4BX2VUAB-amtolJb4.js} +1 -1
  34. package/dist/web/assets/{chunk-55IACEB6-Dxjaitf1.js → chunk-55IACEB6-Bi5q9Evi.js} +1 -1
  35. package/dist/web/assets/{chunk-727SXJPM-CAn8Y9XB.js → chunk-727SXJPM-Bb_qV3PR.js} +1 -1
  36. package/dist/web/assets/{chunk-AQP2D5EJ-B4sECH9U.js → chunk-AQP2D5EJ-BhFBU2pH.js} +1 -1
  37. package/dist/web/assets/{chunk-FMBD7UC4-Ckd3e1dg.js → chunk-FMBD7UC4-CbBz10YF.js} +1 -1
  38. package/dist/web/assets/{chunk-ND2GUHAM-h5WBT7BK.js → chunk-ND2GUHAM-B930BNNl.js} +1 -1
  39. package/dist/web/assets/{chunk-QZHKN3VN-Cdzk46MK.js → chunk-QZHKN3VN-YlRfC0oD.js} +1 -1
  40. package/dist/web/assets/{circle-alert-OKyZ9U2p.js → circle-alert-DCm2E91k.js} +1 -1
  41. package/dist/web/assets/classDiagram-4FO5ZUOK-XuAtffBc.js +1 -0
  42. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-XuAtffBc.js +1 -0
  43. package/dist/web/assets/code-block-OCS4YCEC-ImXQka3_.js +2 -0
  44. package/dist/web/assets/{confirm-dialog-BAnxa2C9.js → confirm-dialog-Cc27tq8j.js} +1 -1
  45. package/dist/web/assets/{cose-bilkent-S5V4N54A-CbFey2pd.js → cose-bilkent-S5V4N54A-Di3PzbLp.js} +1 -1
  46. package/dist/web/assets/{dagre-BM42HDAG-Bd2eIyf3.js → dagre-BM42HDAG-DD7qiU9m.js} +1 -1
  47. package/dist/web/assets/{diagram-2AECGRRQ-CXONvVnW.js → diagram-2AECGRRQ-Bgr-CjRi.js} +1 -1
  48. package/dist/web/assets/{diagram-5GNKFQAL-B2E90mVs.js → diagram-5GNKFQAL-CvRORhH2.js} +1 -1
  49. package/dist/web/assets/{diagram-KO2AKTUF-ByaC99pb.js → diagram-KO2AKTUF-CkVyLyvM.js} +1 -1
  50. package/dist/web/assets/{diagram-LMA3HP47-DwVBF2fn.js → diagram-LMA3HP47-B-CPQQuU.js} +1 -1
  51. package/dist/web/assets/{diagram-OG6HWLK6-FWRddceo.js → diagram-OG6HWLK6-DXow9CgH.js} +1 -1
  52. package/dist/web/assets/{erDiagram-TEJ5UH35-ye6i3SGj.js → erDiagram-TEJ5UH35-BPLJJwjL.js} +1 -1
  53. package/dist/web/assets/{flowDiagram-I6XJVG4X-B6l7qTcg.js → flowDiagram-I6XJVG4X-ggyugmK6.js} +1 -1
  54. package/dist/web/assets/{folder-B0m3OL2U.js → folder-B35uD7uF.js} +1 -1
  55. package/dist/web/assets/{folder-picker-D5XrSfLA.js → folder-picker-DFxfUtH5.js} +1 -1
  56. package/dist/web/assets/{ganttDiagram-6RSMTGT7-BCCqDrep.js → ganttDiagram-6RSMTGT7-317n6mcW.js} +1 -1
  57. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-Ca4ANaSw.js → gitGraphDiagram-PVQCEYII-DTUyiJew.js} +1 -1
  58. package/dist/web/assets/{index-C9hQg1KT.js → index-BwKL3rKp.js} +5 -5
  59. package/dist/web/assets/index-DgO-2xBV.css +1 -0
  60. package/dist/web/assets/{index-DbO4YyUv.js → index-OY1TIdAK.js} +116 -9
  61. package/dist/web/assets/{infoDiagram-5YYISTIA-D1V1Tezr.js → infoDiagram-5YYISTIA-1GXYdkvW.js} +1 -1
  62. package/dist/web/assets/{input-Dqnd4oTj.js → input-6lLP89Y3.js} +1 -1
  63. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-DnGiJn9p.js → ishikawaDiagram-YF4QCWOH-DSGxwLxL.js} +1 -1
  64. package/dist/web/assets/{journeyDiagram-JHISSGLW-QFxbLfhN.js → journeyDiagram-JHISSGLW-Bk9wMzSo.js} +1 -1
  65. package/dist/web/assets/{kanban-definition-UN3LZRKU-BA2nBc7B.js → kanban-definition-UN3LZRKU-BW3QAONh.js} +4 -4
  66. package/dist/web/assets/{layers-CfFYGUtI.js → layers-CDcLPjE5.js} +1 -1
  67. package/dist/web/assets/{linear-DpASQZmA.js → linear-DTyT0tZy.js} +1 -1
  68. package/dist/web/assets/{loader-circle-B5Lfi46Y.js → loader-circle-DDrZegLO.js} +1 -1
  69. package/dist/web/assets/mermaid-NOHMQCX5-CeIvIbfU.js +122 -0
  70. package/dist/web/assets/{message-square-CEefL0sf.js → message-square-CunpcgQi.js} +1 -1
  71. package/dist/web/assets/{mindmap-definition-RKZ34NQL-C7QuD-ms.js → mindmap-definition-RKZ34NQL-CMuh1LCP.js} +2 -2
  72. package/dist/web/assets/{modal-CAB_bs-c.js → modal-D8uSzIAd.js} +1 -1
  73. package/dist/web/assets/{pencil-B__GQn9r.js → pencil-BTaYfjKo.js} +1 -1
  74. package/dist/web/assets/{pieDiagram-4H26LBE5-Bf5diCKb.js → pieDiagram-4H26LBE5-8PB3-bCK.js} +1 -1
  75. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-BMbcPnH3.js → quadrantDiagram-W4KKPZXB-Dpf14KEr.js} +1 -1
  76. package/dist/web/assets/{requirementDiagram-4Y6WPE33-CUPvJXMk.js → requirementDiagram-4Y6WPE33-ClTLx63o.js} +1 -1
  77. package/dist/web/assets/{rotate-ccw-5d-eMwsw.js → rotate-ccw-bVmcWqcA.js} +1 -1
  78. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-C77g6vmK.js → sankeyDiagram-5OEKKPKP-ChlGi0jn.js} +1 -1
  79. package/dist/web/assets/select-tNVeGe-v.js +1 -0
  80. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-xGOV8CdQ.js → sequenceDiagram-3UESZ5HK-6tJ810tk.js} +1 -1
  81. package/dist/web/assets/{stateDiagram-AJRCARHV-Bc0piegy.js → stateDiagram-AJRCARHV-Cc5dwA5r.js} +1 -1
  82. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-EVHRu9u3.js +1 -0
  83. package/dist/web/assets/{switch-bLlDOWNp.js → switch-7jE2n-KP.js} +1 -1
  84. package/dist/web/assets/{terminal-Bh2qSv0U.js → terminal-D5iU4zAj.js} +1 -1
  85. package/dist/web/assets/{textarea-BcVRpxhF.js → textarea-DVa2Yvj4.js} +1 -1
  86. package/dist/web/assets/{timeline-definition-PNZ67QCA-CcACRt_V.js → timeline-definition-PNZ67QCA-q32Hcn4m.js} +3 -3
  87. package/dist/web/assets/{trash-2-8Pu6lwnW.js → trash-2-z7TLHqpU.js} +1 -1
  88. package/dist/web/assets/{upload-DNwyW_bv.js → upload-DeI535ZH.js} +1 -1
  89. package/dist/web/assets/{use-profiles-BIqkQu69.js → use-profiles-BS_Mkp5d.js} +1 -1
  90. package/dist/web/assets/{use-providers-BOyY0DcV.js → use-providers-CWfLQ--R.js} +1 -1
  91. package/dist/web/assets/useNormalizedLogs-DW37m6Ji.js +1 -0
  92. package/dist/web/assets/{vennDiagram-CIIHVFJN-BC9RHBQ5.js → vennDiagram-CIIHVFJN-VxBXMI4P.js} +5 -5
  93. package/dist/web/assets/{wardley-L42UT6IY-BgPj73Dc.js → wardley-L42UT6IY-BvNOQGfh.js} +1 -1
  94. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-PbfDUndy.js → wardleyDiagram-YWT4CUSO-DMTZkLB4.js} +1 -1
  95. package/dist/web/assets/{xychartDiagram-2RQKCTM6-D87KYJUM.js → xychartDiagram-2RQKCTM6-BaJ2kymJ.js} +1 -1
  96. package/dist/web/index.html +2 -2
  97. package/package.json +1 -1
  98. package/dist/web/assets/AgentDemoPage-CUgqAjq9.js +0 -1
  99. package/dist/web/assets/CreateTaskInput-BILlpv9b.js +0 -2
  100. package/dist/web/assets/ProviderSettingsPage-BlLaN0i2.js +0 -54
  101. package/dist/web/assets/arc-Ddp5hhH6.js +0 -1
  102. package/dist/web/assets/architectureDiagram-3BPJPVTR-CpK7WDLU.js +0 -36
  103. package/dist/web/assets/channel-Bg_GO2e9.js +0 -1
  104. package/dist/web/assets/check-D9lM__p8.js +0 -1
  105. package/dist/web/assets/classDiagram-4FO5ZUOK-BeJctdRx.js +0 -1
  106. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BeJctdRx.js +0 -1
  107. package/dist/web/assets/code-block-OCS4YCEC-VMJOsrkF.js +0 -2
  108. package/dist/web/assets/index-C4twOgZR.css +0 -1
  109. package/dist/web/assets/log-adapter-CjgRCCYG.js +0 -1
  110. package/dist/web/assets/mermaid-NOHMQCX5-7FmPQynq.js +0 -122
  111. package/dist/web/assets/select-BJfNuuIV.js +0 -1
  112. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CiRT9t6d.js +0 -1
@@ -1,4 +1,4 @@
1
- import{s as Mt,g as Nt,q as zt,p as Lt,a as Tt,b as At,_ as u,K as Xt,D as Et,F as U,l as Q,I as Yt,e as It,z as Ft,c as V}from"./index-C9hQg1KT.js";import{p as Bt}from"./chunk-4BX2VUAB-Cqi9xJ8M.js";import{p as Rt}from"./wardley-L42UT6IY-BgPj73Dc.js";import"./index-DbO4YyUv.js";var G=u((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),A=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),J=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Bt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{const h=A(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{const h=A(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,w=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,w)}),o.notes.forEach(e=>{const h=A(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const w=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(w,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,w)})}),o.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=J(e.fromPort)??J(e.toPort);const{flow:d,label:w}=Ot(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,g=w??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{const h=r.getNode(e.component);if(h?.y!==void 0){const a=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){const e=o.annotations[0],h=A(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{const h=A(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{const h=A(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{const h=A(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void 0},parse:u(async o=>{const r=await Rt("wardley",o);Q.debug(r);const e=tt.parser?.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},E,Dt=(E=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,h]of this.nodes)if(h.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},u(E,"WardleyBuilder"),E),k=new Dt;function et(){return V()["wardley-beta"]}u(et,"getConfig");function at(o,r,e,h,a,d,w,C,g){k.addNode({id:o,label:r,x:e,y:h,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(at,"addNode");function rt(o,r,e=!1,h,a){k.addLink({source:o,target:r,dashed:e,label:h,flow:a})}u(rt,"addLink");function ot(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}u(ot,"addTrend");function nt(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}u(nt,"addAnnotation");function st(o,r,e){k.addNote({text:o,x:r,y:e})}u(st,"addNote");function it(o,r,e){k.addAccelerator({name:o,x:r,y:e})}u(it,"addAccelerator");function dt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}u(dt,"addDeaccelerator");function lt(o,r){k.setAnnotationsBox(o,r)}u(lt,"setAnnotationsBox");function ct(o,r){k.setSize(o,r)}u(ct,"setSize");function pt(o){k.startPipeline(o)}u(pt,"startPipeline");function ft(o,r){k.addPipelineComponent(o,r)}u(ft,"addPipelineComponent");function ht(o){k.setAxes(o)}u(ht,"updateAxes");function xt(o){return k.getNode(o)}u(xt,"getNode");function gt(o){return k.resolveNodeId(o)}u(gt,"resolveNodeId");function yt(){return k.build()}u(yt,"getWardleyData");function ut(){k.clear(),Ft()}u(ut,"clear");var Gt={getConfig:et,addNode:at,addLink:rt,addTrend:ot,addAnnotation:nt,addNote:st,addAccelerator:it,addDeaccelerator:dt,setAnnotationsBox:lt,setSize:ct,startPipeline:pt,addPipelineComponent:ft,updateAxes:ht,getNode:xt,resolveNodeId:gt,getWardleyData:yt,clear:ut,setAccTitle:At,getAccTitle:Tt,setDiagramTitle:Lt,getDiagramTitle:zt,getAccDescription:Nt,setAccDescription:Mt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{const{themeVariables:o}=V();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=u(()=>{const o=V()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=u((o,r,e,h)=>{Q.debug(`Rendering Wardley map
1
+ import{s as Mt,g as Nt,q as zt,p as Lt,a as Tt,b as At,_ as u,K as Xt,D as Et,F as U,l as Q,I as Yt,e as It,z as Ft,c as V}from"./index-BwKL3rKp.js";import{p as Bt}from"./chunk-4BX2VUAB-amtolJb4.js";import{p as Rt}from"./wardley-L42UT6IY-BvNOQGfh.js";import"./index-OY1TIdAK.js";var G=u((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),A=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),J=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Bt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{const h=A(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{const h=A(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,w=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,w)}),o.notes.forEach(e=>{const h=A(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const w=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(w,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,w)})}),o.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=J(e.fromPort)??J(e.toPort);const{flow:d,label:w}=Ot(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,g=w??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{const h=r.getNode(e.component);if(h?.y!==void 0){const a=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){const e=o.annotations[0],h=A(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{const h=A(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{const h=A(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{const h=A(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void 0},parse:u(async o=>{const r=await Rt("wardley",o);Q.debug(r);const e=tt.parser?.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},E,Dt=(E=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,h]of this.nodes)if(h.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},u(E,"WardleyBuilder"),E),k=new Dt;function et(){return V()["wardley-beta"]}u(et,"getConfig");function at(o,r,e,h,a,d,w,C,g){k.addNode({id:o,label:r,x:e,y:h,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(at,"addNode");function rt(o,r,e=!1,h,a){k.addLink({source:o,target:r,dashed:e,label:h,flow:a})}u(rt,"addLink");function ot(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}u(ot,"addTrend");function nt(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}u(nt,"addAnnotation");function st(o,r,e){k.addNote({text:o,x:r,y:e})}u(st,"addNote");function it(o,r,e){k.addAccelerator({name:o,x:r,y:e})}u(it,"addAccelerator");function dt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}u(dt,"addDeaccelerator");function lt(o,r){k.setAnnotationsBox(o,r)}u(lt,"setAnnotationsBox");function ct(o,r){k.setSize(o,r)}u(ct,"setSize");function pt(o){k.startPipeline(o)}u(pt,"startPipeline");function ft(o,r){k.addPipelineComponent(o,r)}u(ft,"addPipelineComponent");function ht(o){k.setAxes(o)}u(ht,"updateAxes");function xt(o){return k.getNode(o)}u(xt,"getNode");function gt(o){return k.resolveNodeId(o)}u(gt,"resolveNodeId");function yt(){return k.build()}u(yt,"getWardleyData");function ut(){k.clear(),Ft()}u(ut,"clear");var Gt={getConfig:et,addNode:at,addLink:rt,addTrend:ot,addAnnotation:nt,addNote:st,addAccelerator:it,addDeaccelerator:dt,setAnnotationsBox:lt,setSize:ct,startPipeline:pt,addPipelineComponent:ft,updateAxes:ht,getNode:xt,resolveNodeId:gt,getWardleyData:yt,clear:ut,setAccTitle:At,getAccTitle:Tt,setDiagramTitle:Lt,getDiagramTitle:zt,getAccDescription:Nt,setAccDescription:Mt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{const{themeVariables:o}=V();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=u(()=>{const o=V()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=u((o,r,e,h)=>{Q.debug(`Rendering Wardley map
2
2
  `+o);const a=jt(),d=Ht(),w=a.nodeRadius*1.6,C=h.db,g=C.getWardleyData(),R=C.getDiagramTitle(),S=g.size?.width??a.width,b=g.size?.height??a.height,Y=Yt(r);Y.selectAll("*").remove(),It(Y,b,S,a.useMaxWidth),Y.attr("viewBox",`0 0 ${S} ${b}`);const v=Y.append("g").attr("class","wardley-map"),q=Y.append("defs");q.append("marker").attr("id",`arrow-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${r}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);const I=S-a.padding*2,F=b-a.padding*2;R&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(R);const z=u(t=>a.padding+t/100*I,"projectX"),L=u(t=>b-a.padding-t/100*F,"projectY"),O=v.append("g").attr("class","wardley-axes");O.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const wt=g.axes.xLabel??"Evolution",mt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+I/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(wt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+F/2})`).text(mt);const B=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:qt;if(B.length>0){const t=v.append("g").attr("class","wardley-stages"),s=g.axes.stageBoundaries,n=[];if(s&&s.length===B.length){let i=0;s.forEach(p=>{n.push({start:i,end:p}),i=p})}else{const i=1/B.length;B.forEach((p,l)=>{n.push({start:l*i,end:(l+1)*i})})}B.forEach((i,p)=>{const l=n[p],f=a.padding+l.start*I,x=a.padding+l.end*I,y=(f+x)/2;p>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){const t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const n=s/4,i=a.padding+I*n;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-F*n).attr("y2",b-a.padding-F*n).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:z(t.x),y:L(t.y),node:t})}),g.pipelines.length>0){const t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(n=>{if(n.componentIds.length===0)return;const i=n.componentIds.map(x=>({id:x,pos:c.get(x),node:g.nodes.find(y=>y.id===x)})).filter(x=>x.pos&&x.node).sort((x,y)=>x.node.x-y.node.x);for(let x=0;x<i.length-1;x++){const y=i[x],m=i[x+1];s.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",y.pos.x).attr("y1",y.pos.y).attr("x2",m.pos.x).attr("y2",m.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let p=1/0,l=-1/0,f=0;if(n.componentIds.forEach(x=>{const y=c.get(x);y&&(p=Math.min(p,y.x),l=Math.max(l,y.x),f=y.y)}),p!==1/0&&l!==-1/0){const y=a.nodeRadius*4,m=f-y/2,P=c.get(n.nodeId);if(P){const N=(p+l)/2;P.x=N,P.y=m-w/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",m).attr("width",l-p+30).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=v.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const K=g.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||Z.get(t.target)?.has(t.source)));_.selectAll("line").data(K).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.x+l/x*p}).attr("y1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.y+f/x*p}).attr("x2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.x+l/x*p}).attr("y2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.y+f/x*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${r})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${r})`:null),_.selectAll("text").data(K.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=n.y-s.y,l=n.x-s.x,f=Math.sqrt(l*l+p*p),x=8,y=p/f;return i+y*x}).attr("y",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.y+n.y)/2,p=n.x-s.x,l=n.y-s.y,f=Math.sqrt(p*p+l*l),x=8,y=-p/f;return i+y*x}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=(s.y+n.y)/2,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f),y=8,m=f/x,P=-l/x,N=i+m*y,W=p+P*y;let X=Math.atan2(f,l)*180/Math.PI;return(X>90||X<-90)&&(X+=180),`rotate(${X} ${N} ${W})`}).text(t=>t.label);const kt=v.append("g").attr("class","wardley-trends"),bt=g.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const n=z(t.targetX),i=L(t.targetY),p=n-s.x,l=i-s.y,f=Math.sqrt(p*p+l*l),x=a.nodeRadius+2,y=f>x?n-p/f*x:n,m=f>x?i-l/f*x:i;return{origin:s,targetX:n,targetY:i,adjustedX2:y,adjustedY2:m}}).filter(t=>t!==null);kt.selectAll("line").data(bt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${r})`);const M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const T=M.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-w/2).attr("y",t=>c.get(t.id).y-w/2).attr("width",w).attr("height",w).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let n=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y1",t=>{const s=c.get(t.id),n=t.isPipelineParent?w:a.nodeRadius*2;return s.y-n/2}).attr("x2",t=>{const s=c.get(t.id);let n=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y2",t=>{const s=c.get(t.id),n=t.isPipelineParent?w:a.nodeRadius*2;return s.y+n/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let n=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(n+=10);const i=t.labelOffsetX??n;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let n=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(n-=10);const i=t.labelOffsetY??n;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=v.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(s=>{const n=s.coordinates.map(i=>({x:z(i.x),y:L(i.y)}));if(n.length>1)for(let i=0;i<n.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",n[i].x).attr("y1",n[i].y).attr("x2",n[i+1].x).attr("y2",n[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach(i=>{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),g.annotationsBox){let s=z(g.annotationsBox.x),n=L(g.annotationsBox.y);const i=10,p=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),x=[...g.annotations].filter(m=>m.text).sort((m,P)=>m.number-P.number),y=[];if(x.forEach((m,P)=>{const N=f.append("text").attr("x",s+i).attr("y",n+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${m.number}. ${m.text}`);y.push(N)}),y.length>0){let m=0,P=0;y.forEach(j=>{const D=j.node(),Ct=D.getComputedTextLength();m=Math.max(m,Ct);const St=D.getBBox();P=Math.max(P,St.height)});const N=m+i*2+105,W=x.length*p+i*2+P/2,X=a.padding,$t=S-a.padding-N,vt=a.padding,Pt=b-a.padding-W;s=Math.max(X,Math.min(s,$t)),n=Math.max(vt,Math.min(n,Pt)),y.forEach((j,D)=>{j.attr("x",s+i).attr("y",n+i+(D+1)*p)}),f.insert("rect","text").attr("x",s).attr("y",n).attr("width",N).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=v.append("g").attr("class","wardley-notes");g.notes.forEach(s=>{const n=z(s.x),i=L(s.y);t.append("text").attr("x",n).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(g.accelerators.length>0){const t=v.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(s=>{const n=z(s.x),i=L(s.y),p=60,l=30,f=20,x=`
3
3
  M ${n} ${i-l/2}
4
4
  L ${n+p-f} ${i-l/2}
@@ -1,4 +1,4 @@
1
- import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Yt,I as mi,e as yi,z as bi,D as _t,i as Ai,F as Nt,G as wi,K as Ci,am as Si,R as Wt}from"./index-C9hQg1KT.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-Cboi1Yqb.js";import{l as zt}from"./linear-DpASQZmA.js";import"./index-DbO4YyUv.js";import"./defaultLocale-DX6XiGOO.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var I=Ri(y).map(function(m){return v+o*m});return i(E?I.reverse():I)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=(function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],I=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var M,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((M===null||typeof M>"u")&&(M=Vt()),z=rt[q]&&rt[q][M]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
1
+ import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Yt,I as mi,e as yi,z as bi,D as _t,i as Ai,F as Nt,G as wi,K as Ci,am as Si,R as Wt}from"./index-BwKL3rKp.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-Cboi1Yqb.js";import{l as zt}from"./linear-DTyT0tZy.js";import"./index-OY1TIdAK.js";import"./defaultLocale-DX6XiGOO.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var I=Ri(y).map(function(m){return v+o*m});return i(E?I.reverse():I)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=(function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],I=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var M,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((M===null||typeof M>"u")&&(M=Vt()),z=rt[q]&&rt[q][M]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
2
2
  `+D.showPosition()+`
3
3
  Expecting `+gt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":yt="Parse error on line "+(ct+1)+": Unexpected "+(M==Mt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(yt,{text:D.match,token:this.terminals_[M]||M,line:D.yylineno,loc:pt,expected:gt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+M);switch(z[0]){case 1:g.push(M),C.push(D.yytext),r.push(D.yylloc),g.push(z[1]),M=null,It=D.yyleng,d=D.yytext,ct=D.yylineno,pt=D.yylloc;break;case 2:if(N=this.productions_[z[1]][1],G.$=C[C.length-N],G._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ci&&(G._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(G,[d,It,ct,$.yy,z[1],C,r].concat(li)),typeof mt<"u")return mt;N&&(g=g.slice(0,-1*N*2),C=C.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[z[1]][0]),C.push(G.$),r.push(G._$),Bt=rt[g[g.length-2]][g[g.length-1]],g.push(Bt);break;case 3:return!0}}return!0},"parse")},k=(function(){var F={EOF:1,parseError:a(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:a(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var c=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" type="image/x-icon" href="/favicon.ico" sizes="any" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
7
7
  <title>Agent Tower</title>
8
- <script type="module" crossorigin src="/assets/index-DbO4YyUv.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-C4twOgZR.css">
8
+ <script type="module" crossorigin src="/assets/index-OY1TIdAK.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-DgO-2xBV.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-tower",
3
- "version": "0.5.3-beta.0",
3
+ "version": "0.5.3-beta.2",
4
4
  "description": "AI Agent Task Management Dashboard",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- import{h as H,u as Q,r as n,m as b,j as e,B as y,L as X,K as Y}from"./index-DbO4YyUv.js";import{u as Z,a as ee,b as te,T as se,P as ne,S as re}from"./mermaid-NOHMQCX5-7FmPQynq.js";import"./log-adapter-CjgRCCYG.js";import{I as L,a as ae,b as le,A as ie,G as oe}from"./Icons-DmLVnVdg.js";import{d as ce}from"./use-profiles-BIqkQu69.js";import{C as de}from"./chevron-up-DcLdFanO.js";import{C as xe}from"./chevron-down-Cur5jANy.js";import"./chevron-right-R3KVa8oQ.js";import"./check-D9lM__p8.js";const me=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ue=H("hash",me);const pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],he=H("send",pe),ge=!0;function ke(){const{t:s}=Q(),[w,U]=n.useState([]),[i,S]=n.useState(""),[x,A]=n.useState("DEFAULT"),[o,k]=n.useState(""),[a,D]=n.useState(null),[l,c]=n.useState("idle"),[g,E]=n.useState(!1),[m,j]=n.useState(""),C=n.useRef(null),$=n.useRef(null),u=n.useRef(null),{data:p}=ce(i),F=p?Object.keys(p):["DEFAULT"],V=t=>{S(t),A("DEFAULT")},_=n.useCallback(t=>{c(t===0?"stopped":"error")},[]),B=n.useCallback(t=>{console.error("Agent error:",t),c("error")},[]),{isConnected:h,isAttached:f,logs:v,entries:G,agentSessionId:I,attach:z,clearLogs:P}=Z({sessionId:a||"",onExit:_,onError:B}),{todos:R}=ee(G);n.useEffect(()=>{b.get("/demo/agents").then(t=>{U(t.agents);const r=t.agents.find(N=>N.available);r&&S(r.type)})},[]),n.useEffect(()=>{C.current?.scrollToBottom("smooth")},[v]),n.useEffect(()=>{console.log(`[AgentDemoPage:useEffect] t=${Date.now()} sessionId=${a} isConnected=${h} isAttached=${f}`),a&&h&&!f&&(console.log(`[AgentDemoPage:useEffect] t=${Date.now()} calling attach()`),z())},[a,h,f,z]);const M=t=>{if(j(t.target.value),u.current){u.current.style.height="auto";const N=Math.min(u.current.scrollHeight,210);u.current.style.height=`${N}px`}},K=async()=>{if(!i||!o.trim())return;const t=Date.now();console.log(`[AgentDemoPage:handleStart] t=${t} starting...`),c("starting"),P();try{const r=await b.post("/demo/start",{agentType:i,prompt:o.trim(),variant:x});ge&&console.log(`[AgentDemoPage:handleStart] t=${Date.now()} apiTime=${Date.now()-t}ms sessionId=${r.sessionId}`),D(r.sessionId),c("running")}catch(r){console.error("Start failed:",r),c("error")}},T=async()=>{if(!a||!m.trim())return;const t=m.trim();j("");try{await b.post(`/demo/${a}/message`,{message:t})}catch(r){console.error("Send failed:",r)}},O=async()=>{if(a)try{await b.post(`/demo/${a}/stop`),c("stopped")}catch(t){console.error("Stop failed:",t)}},q=()=>{D(null),c("idle"),k(""),j(""),P()},J=l==="running",d=a!==null,W=w.find(t=>t.type===i);return e.jsxs("div",{className:"flex flex-col h-full bg-white",children:[e.jsxs("div",{className:"px-8 py-5 border-b border-neutral-100 bg-white transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-base font-medium text-blue-600",children:"Agent Demo"}),e.jsx("span",{className:"text-neutral-300 text-sm",children:"/"}),e.jsx("span",{className:"text-xl font-bold text-neutral-900 tracking-tight",children:d?o.slice(0,50)+(o.length>50?"...":""):s("新会话")})]}),e.jsxs("div",{className:"flex items-center",children:[l==="running"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-blue-50 text-blue-700 rounded-full text-xs font-medium border border-blue-100",children:[e.jsx(L,{className:"w-3.5 h-3.5 animate-pulse"}),e.jsx("span",{children:"Running"})]}),l==="stopped"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-emerald-50 text-emerald-700 rounded-full text-xs font-medium border border-emerald-100",children:[e.jsx(ae,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Done"})]}),l==="idle"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-neutral-100 text-neutral-600 rounded-full text-xs font-medium border border-neutral-200",children:[e.jsx(le,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Idle"})]}),l==="starting"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-amber-50 text-amber-700 rounded-full text-xs font-medium border border-amber-100",children:[e.jsx(L,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"Starting..."})]}),l==="error"&&e.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-red-50 text-red-700 rounded-full text-xs font-medium border border-red-100",children:e.jsx("span",{children:"Error"})})]})]}),d&&e.jsxs("div",{className:"mt-1.5 flex items-start gap-2 group max-w-4xl",children:[e.jsx("div",{className:`text-sm text-neutral-600 leading-relaxed cursor-pointer transition-all ${g?"":"truncate"}`,onClick:()=>E(!g),children:o}),e.jsx("button",{onClick:()=>E(!g),className:"mt-0.5 text-neutral-400 opacity-0 group-hover:opacity-100 hover:text-neutral-600 transition-opacity",children:g?e.jsx(de,{size:14}):e.jsx(xe,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Agent"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-900 font-medium bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:W?.name||i||s("未选择")})]}),x!=="DEFAULT"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Variant"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-700 font-medium bg-blue-50 px-2 py-1 rounded border border-blue-100",children:x})]}),I&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Session"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-700 font-mono bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:[I.slice(0,8),"..."]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:s("连接")}),e.jsx("div",{className:`flex items-center gap-1.5 font-medium px-2 py-1 rounded border ${h?"text-emerald-700 bg-emerald-50 border-emerald-100":"text-neutral-500 bg-neutral-50 border-neutral-100"}`,children:s(h?f?"已连接":"连接中...":"未连接")})]}),d&&e.jsx(y,{variant:"outline",size:"sm",onClick:q,className:"ml-auto",children:s("新会话")}),e.jsxs(X,{to:"/settings/profiles",className:`flex items-center gap-1.5 text-xs text-neutral-500 hover:text-neutral-900 transition-colors ${d?"":"ml-auto"}`,children:[e.jsx(Y,{size:14}),e.jsx("span",{children:s("Profiles 设置")})]})]})]}),e.jsx("div",{ref:$,className:"flex-1 overflow-y-auto px-8 py-6",children:d?e.jsx("div",{className:"min-h-[200px]",children:v.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8",children:s("等待 Agent 响应...")}):e.jsx(te,{ref:C,logs:v,scrollElementRef:$})}):e.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("选择 Agent")}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:w.map(t=>e.jsxs(y,{variant:i===t.type?"default":"outline",disabled:!t.available,onClick:()=>V(t.type),children:[t.name,t.available&&t.version&&` (${t.version})`,!t.available&&s(" (不可用)")]},t.type))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("配置变体 (Profile Variant)")}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:F.map(t=>e.jsx("button",{onClick:()=>A(t),className:`px-3 py-1.5 rounded-full text-sm font-medium border transition-colors ${x===t?"bg-neutral-900 text-white border-neutral-900":"bg-white text-neutral-600 border-neutral-200 hover:border-neutral-400"}`,children:t},t))}),p&&p[x]&&e.jsx("p",{className:"mt-2 text-xs text-neutral-500 font-mono",children:Object.entries(p[x]).map(([t,r])=>`${t}: ${JSON.stringify(r)}`).join(", ")})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("输入任务")}),e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{value:o,onChange:t=>k(t.target.value),rows:4,placeholder:s("描述你想让 Agent 完成的任务..."),className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm"}),e.jsx("div",{className:"flex items-center justify-end px-3 pb-3 pt-1",children:e.jsx(y,{onClick:K,disabled:l==="starting"||!i||!o.trim(),children:s(l==="starting"?"启动中...":"开始")})})]})]})]})}),d&&R.length>0&&e.jsx("div",{className:"px-8 py-2 bg-white border-t border-neutral-100",children:e.jsx(se,{todos:R})}),d&&e.jsx("div",{className:"px-8 py-6 border-t border-neutral-100 bg-white",children:e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{ref:u,value:m,onChange:M,rows:3,placeholder:s("发送消息给 Agent..."),className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm scrollbar-thin scrollbar-thumb-neutral-200 scrollbar-track-transparent",style:{minHeight:"80px",maxHeight:"210px"},onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),T())}}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1 border-t border-transparent",children:[e.jsxs("div",{className:"flex items-center gap-1 text-neutral-400",children:[e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Attach File",children:e.jsx(ne,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Mention",children:e.jsx(ie,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Reference Issue",children:e.jsx(ue,{size:18})}),e.jsx("div",{className:"w-px h-4 bg-neutral-200 mx-1"}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Search Web",children:e.jsx(oe,{size:18})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[J&&e.jsxs("button",{onClick:O,className:"flex items-center gap-2 px-3 py-2 text-xs font-semibold text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",children:[e.jsx(re,{size:12,fill:"currentColor"}),e.jsx("span",{children:s("停止")})]}),e.jsxs("button",{onClick:T,disabled:!m.trim(),className:`flex items-center gap-2 px-3 py-2 text-xs font-semibold rounded-lg transition-all ${m.trim()?"bg-neutral-900 text-white hover:bg-black shadow-sm":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:[e.jsx("span",{children:s("发送")}),e.jsx(he,{size:14})]})]})]})]})})]})}export{ke as AgentDemoPage};
@@ -1,2 +0,0 @@
1
- import{h as P,r,j as e,u as ae,Y as ye,Z as ke,X as Me,i as $e,m as Be,s as Ue,v as We,L as we,g as v,_ as qe}from"./index-DbO4YyUv.js";import{C as Q}from"./chevron-down-Cur5jANy.js";import{C as V}from"./check-D9lM__p8.js";import{W as F}from"./log-adapter-CjgRCCYG.js";import{L as ee}from"./loader-circle-B5Lfi46Y.js";import{M as Te}from"./MemberAvatar-u6jTOiDY.js";import{u as Ke}from"./use-providers-BOyY0DcV.js";import{P as He}from"./trash-2-8Pu6lwnW.js";import{P as Ye}from"./mermaid-NOHMQCX5-7FmPQynq.js";import{F as Ve}from"./folder-B0m3OL2U.js";const Ge=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ut=P("arrow-down",Ge);const Xe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ze=P("arrow-up",Xe);const Je=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Qe=P("bot",Je);const et=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],tt=P("file-text",et);const st=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],rt=P("gauge",st);const nt=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],at=P("git-branch",nt);const ot=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],it=P("image",ot);const lt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Wt=P("search",lt);const ct=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],dt=P("shield",ct);const ut=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],qt=P("square-pen",ut);const mt=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ft=P("zap",mt);const xt={damping:.7,stiffness:.05,mass:1.25},pt=70,ht=1e3/60,gt=350;let oe=!1;globalThis.document?.addEventListener("mousedown",()=>{oe=!0});globalThis.document?.addEventListener("mouseup",()=>{oe=!1});globalThis.document?.addEventListener("click",()=>{oe=!1});const Kt=(s={})=>{const[o,l]=r.useState(!1),[c,h]=r.useState(s.initial!==!1),[b,f]=r.useState(!1),k=r.useRef(null);k.current=s;const x=r.useCallback(()=>{if(!oe)return!1;const i=window.getSelection();if(!i||!i.rangeCount)return!1;const p=i.getRangeAt(0);return p.commonAncestorContainer.contains(m.current)||m.current?.contains(p.commonAncestorContainer)},[]),j=r.useCallback(i=>{t.isAtBottom=i,h(i)},[]),g=r.useCallback(i=>{t.escapedFromLock=i,l(i)},[]),t=r.useMemo(()=>{let i;return{escapedFromLock:o,isAtBottom:c,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return m.current?.scrollTop??0},set scrollTop(p){m.current&&(m.current.scrollTop=p,t.ignoreScrollToTop=m.current.scrollTop)},get targetScrollTop(){return!m.current||!R.current?0:m.current.scrollHeight-1-m.current.clientHeight},get calculatedTargetScrollTop(){if(!m.current||!R.current)return 0;const{targetScrollTop:p}=this;if(!s.targetScrollTop)return p;if(i?.targetScrollTop===p)return i.calculatedScrollTop;const d=Math.max(Math.min(s.targetScrollTop(p,{scrollElement:m.current,contentElement:R.current}),p),0);return i={targetScrollTop:p,calculatedScrollTop:d},requestAnimationFrame(()=>{i=void 0}),d},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=pt}}},[]),N=r.useCallback((i={})=>{typeof i=="string"&&(i={animation:i}),i.preserveScrollPosition||j(!0);const p=Date.now()+(Number(i.wait)||0),d=ue(k.current,i.animation),{ignoreEscapes:M=!1}=i;let w,E=t.calculatedTargetScrollTop;i.duration instanceof Promise?i.duration.finally(()=>{w=Date.now()}):w=p+(i.duration??0);const L=async()=>{const $=new Promise(requestAnimationFrame).then(()=>{if(!t.isAtBottom)return t.animation=void 0,!1;const{scrollTop:O}=t,q=performance.now(),U=(q-(t.lastTick??q))/ht;if(t.animation||(t.animation={behavior:d,promise:$,ignoreEscapes:M}),t.animation.behavior===d&&(t.lastTick=q),x()||p>Date.now())return L();if(O<Math.min(E,t.calculatedTargetScrollTop)){if(t.animation?.behavior===d){if(d==="instant")return t.scrollTop=t.calculatedTargetScrollTop,L();t.velocity=(d.damping*t.velocity+d.stiffness*t.scrollDifference)/d.mass,t.accumulated+=t.velocity*U,t.scrollTop+=t.accumulated,t.scrollTop!==O&&(t.accumulated=0)}return L()}return w>Date.now()?(E=t.calculatedTargetScrollTop,L()):(t.animation=void 0,t.scrollTop<t.calculatedTargetScrollTop?N({animation:ue(k.current,k.current.resize),ignoreEscapes:M,duration:Math.max(0,w-Date.now())||void 0}):t.isAtBottom)});return $.then(O=>(requestAnimationFrame(()=>{t.animation||(t.lastTick=void 0,t.velocity=0)}),O))};return i.wait!==!0&&(t.animation=void 0),t.animation?.behavior===d?t.animation.promise:L()},[j,x,t]),u=r.useCallback(()=>{g(!0),j(!1)},[g,j]),C=r.useCallback(({target:i})=>{if(i!==m.current)return;const{scrollTop:p,ignoreScrollToTop:d}=t;let{lastScrollTop:M=p}=t;t.lastScrollTop=p,t.ignoreScrollToTop=void 0,d&&d>p&&(M=d),f(t.isNearBottom),setTimeout(()=>{if(t.resizeDifference||p===d)return;if(x()){g(!0),j(!1);return}const w=p>M,E=p<M;if(t.animation?.ignoreEscapes){t.scrollTop=M;return}E&&(g(!0),j(!1)),w&&g(!1),!t.escapedFromLock&&t.isNearBottom&&j(!0)},1)},[g,j,x,t]),S=r.useCallback(({target:i,deltaY:p})=>{let d=i;for(;!["scroll","auto"].includes(getComputedStyle(d).overflow);){if(!d.parentElement)return;d=d.parentElement}d===m.current&&p<0&&m.current.scrollHeight>m.current.clientHeight&&!t.animation?.ignoreEscapes&&(g(!0),j(!1))},[g,j,t]),m=Ce(i=>{m.current?.removeEventListener("scroll",C),m.current?.removeEventListener("wheel",S),i?.addEventListener("scroll",C,{passive:!0}),i?.addEventListener("wheel",S,{passive:!0})},[]),R=Ce(i=>{if(t.resizeObserver?.disconnect(),!i)return;let p;t.resizeObserver=new ResizeObserver(([d])=>{const{height:M}=d.contentRect,w=M-(p??M);if(t.resizeDifference=w,t.scrollTop>t.targetScrollTop&&(t.scrollTop=t.targetScrollTop),f(t.isNearBottom),w>=0){const E=ue(k.current,p?k.current.resize:k.current.initial);N({animation:E,wait:!0,preserveScrollPosition:!0,duration:E==="instant"?void 0:gt})}else t.isNearBottom&&(g(!1),j(!0));p=M,requestAnimationFrame(()=>{setTimeout(()=>{t.resizeDifference===w&&(t.resizeDifference=0)},1)})}),t.resizeObserver?.observe(i)},[]);return{contentRef:R,scrollRef:m,scrollToBottom:N,stopScroll:u,isAtBottom:c||b,isNearBottom:b,escapedFromLock:o,state:t}};function Ce(s,o){const l=r.useCallback(c=>(l.current=c,s(c)),o);return l}const de=new Map;function ue(...s){const o={...xt};let l=!1;for(const h of s){if(h==="instant"){l=!0;continue}typeof h=="object"&&(l=!1,o.damping=h.damping??o.damping,o.stiffness=h.stiffness??o.stiffness,o.mass=h.mass??o.mass)}const c=JSON.stringify(o);return de.has(c)||de.set(c,Object.freeze(o)),l?"instant":de.get(c)}function bt({content:s,children:o,className:l="",side:c="top"}){const h=c==="bottom"?"top-full mt-2":"bottom-full mb-2",b=c==="bottom"?"bottom-full border-b-neutral-900":"top-full border-t-neutral-900";return e.jsxs("div",{className:`group/tooltip relative ${l}`,children:[o,e.jsxs("div",{className:`absolute ${h} left-1/2 -translate-x-1/2 px-3 py-2 bg-neutral-900 text-white text-xs rounded-lg opacity-0 group-hover/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-[100] shadow-lg`,children:[s,e.jsx("div",{className:`absolute ${b} left-1/2 -translate-x-1/2 border-4 border-transparent`})]})]})}function ne(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function vt(s){return s>=.9?"text-red-500":s>=.7?"text-amber-500":"text-neutral-400"}function Ht({usage:s,tooltipSide:o="top"}){const{t:l}=ae();if(!s)return null;const c=s.modelContextWindow,h=c?s.totalTokens/c:0,b=c?Math.min(Math.round(h*100),100):null,f=c?vt(h):"text-neutral-400",k=c?e.jsx("span",{children:l("上下文: {used} / {max} tokens",{used:ne(s.totalTokens),max:ne(c)})}):e.jsx("span",{children:l("已使用: {used} tokens",{used:ne(s.totalTokens)})});return e.jsx(bt,{content:k,side:o,children:e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs rounded-lg hover:bg-neutral-100 transition-colors cursor-default select-none",children:[e.jsx(rt,{size:14,className:f}),e.jsxs("span",{className:`tabular-nums ${f}`,children:[ne(s.totalTokens),b!==null&&e.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",b,"%"]})]})]})})}function Yt({providers:s,currentProviderId:o,agentType:l,onSelect:c}){const{t:h}=ae(),[b,f]=r.useState(!1),k=r.useRef(null),x=s.filter(g=>String(g.provider.agentType)===l),j=s.find(g=>g.provider.id===o);return r.useEffect(()=>{function g(t){k.current&&!k.current.contains(t.target)&&f(!1)}if(b)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[b]),x.length<=1?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral-400 px-2 py-1.5 select-none cursor-default",children:[e.jsx(ye,{size:14,className:"shrink-0"}),e.jsx("span",{children:j?.provider.name?ke(j.provider.name,12):l})]}):e.jsxs("div",{className:"relative",ref:k,children:[e.jsxs("button",{onClick:()=>f(!b),className:"flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg transition-colors cursor-pointer hover:bg-neutral-100 text-neutral-400 hover:text-neutral-600",title:`Provider: ${j?.provider.name??l} (click to change)`,children:[e.jsx(ye,{size:14,className:"shrink-0"}),e.jsx("span",{children:j?.provider.name?ke(j.provider.name,12):l}),e.jsx(Q,{size:12,className:`shrink-0 transition-transform ${b?"rotate-180":""}`})]}),b&&e.jsxs("div",{className:"absolute bottom-full right-0 mb-1 bg-white rounded-lg border border-neutral-200 shadow-lg py-1 min-w-[160px] z-50",children:[e.jsx("div",{className:"px-2 py-1 text-xs text-neutral-400 border-b border-neutral-100",children:h("切换渠道")}),x.map(g=>e.jsxs("button",{onClick:()=>{c(g.provider.id),f(!1)},className:`w-full flex items-center justify-between px-3 py-2 text-sm text-left hover:bg-neutral-50 transition-colors ${g.provider.id===o?"bg-blue-50 text-blue-600":"text-neutral-700"}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate max-w-[120px]",children:g.provider.name}),g.provider.isDefault&&e.jsx("span",{className:"text-xs text-neutral-400",children:h("(默认)")})]}),g.provider.id===o&&e.jsx(V,{size:14,className:"shrink-0"})]},g.provider.id))]})]})}const jt="/api";function Nt(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}function yt({files:s,onRemove:o}){return s.length===0?null:e.jsx("div",{"aria-label":"Attachments",className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:s.map(l=>e.jsx(kt,{item:l,onRemove:o},l.tempId))})}function kt({item:s,onRemove:o}){const l=s.file.type.startsWith("image/"),c=s.status==="error",h=s.status==="uploading";return e.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${c?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[l&&s.status==="done"&&s.attachment?e.jsx("img",{src:`${jt}${s.attachment.url}`,alt:s.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):e.jsx("span",{className:"flex-shrink-0",children:h?e.jsx(ee,{size:16,className:"animate-spin text-neutral-400"}):l?e.jsx(it,{size:16,className:"text-neutral-400"}):e.jsx(tt,{size:16,className:"text-neutral-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:s.file.name}),c?e.jsx("div",{className:"truncate text-red-500",children:s.error}):e.jsx("div",{className:"text-neutral-400",children:Nt(s.file.size)})]}),e.jsx("button",{onClick:()=>o(s.tempId),className:"absolute -top-1.5 -right-1.5 hidden group-hover:flex items-center justify-center w-5 h-5 rounded-full bg-neutral-700 text-white hover:bg-neutral-900 transition-colors",children:e.jsx(Me,{size:10})})]})}const wt="/api";async function Tt(s){const o=new FormData;o.append("file",s);const l=await fetch(`${wt}/attachments/upload`,{method:"POST",body:o});if(!l.ok){const c=await l.json().catch(()=>({}));throw new Error(c.error||`Upload failed (${l.status})`)}return l.json()}let Ct=0;function St(){const[s,o]=r.useState([]),l=r.useRef(s);l.current=s;const c=r.useCallback(async t=>{const N=t.map(u=>({tempId:`tmp-${++Ct}`,file:u,progress:0,status:"uploading"}));o(u=>[...u,...N]),await Promise.allSettled(N.map(async u=>{try{const C=await Tt(u.file);o(S=>S.map(m=>m.tempId===u.tempId?{...m,status:"done",progress:100,attachment:C}:m))}catch(C){o(S=>S.map(m=>m.tempId===u.tempId?{...m,status:"error",error:C instanceof Error?C.message:"Upload failed"}:m))}}))},[]),h=r.useCallback(()=>l.current.filter(t=>t.status==="done"&&t.attachment).map(t=>t.attachment),[]),b=r.useCallback(t=>{o(N=>N.filter(u=>u.tempId!==t))},[]),f=r.useCallback(()=>{o([])},[]),k=r.useCallback(t=>{t.length!==0&&o(N=>{const u=new Set(N.map(S=>S.attachment?.id??S.tempId)),C=t.filter(S=>{const m=S.attachment?.id??S.tempId;return u.has(m)?!1:(u.add(m),!0)});return C.length>0?[...N,...C]:N})},[]),x=r.useCallback(()=>{const t=h();return t.length===0?"":t.map(N=>`${N.mimeType.startsWith("image/")?"!":""}[${N.originalName}](${N.storagePath})`).join(`
2
- `)},[h]),j=s.length>0,g=s.some(t=>t.status==="uploading");return{files:s,addFiles:c,removeFile:b,clear:f,restoreFiles:k,buildMarkdownLinks:x,getDoneAttachments:h,hasFiles:j,isUploading:g}}function Vt(s){const o=r.useMemo(()=>Array.from(new Set(s.filter(Boolean))),[s]);return $e({queryKey:["attachments","metadata",o],queryFn:()=>Be.get("/attachments/metadata",{params:{ids:o.join(",")}}),enabled:o.length>0,staleTime:300*1e3})}function Gt(s,o){return r.useMemo(()=>{for(let l=s.length-1;l>=0;l--){const c=s[l];if(c.tokenUsage&&typeof c.tokenUsage.totalTokens=="number"&&c.tokenUsage.totalTokens>0)return{totalTokens:c.tokenUsage.totalTokens,modelContextWindow:c.tokenUsage.modelContextWindow}}return o??null},[s,o])}function Se(s,o,l,c){if(l.filter(f=>f===c).length<=1)return s;const b=l.slice(0,o+1).filter(f=>f===c).length;return`${s} #${b}`}function Mt(s){return Object.values(s).filter(Boolean).length}function Et({mode:s,setMode:o,selectedTemplateId:l,setSelectedTemplateId:c,selectedMemberPresetIds:h,setSelectedMemberPresetIds:b,disabled:f=!1,compact:k=!1}){const{t:x}=ae(),[j,g]=r.useState(!1),{data:t}=Ke(),{data:N,isError:u,isFetching:C,isLoading:S,refetch:m}=Ue(),{data:R,isError:i,isFetching:p,isLoading:d,refetch:M}=We(),w=r.useMemo(()=>new Map((t??[]).map(({provider:a,availability:y})=>[a.id,a.name+(y.type==="NOT_FOUND"?x(" (不可用)"):"")])),[t,x]),E=r.useMemo(()=>new Map((N??[]).map(a=>[a.id,a])),[N]),L=r.useMemo(()=>new Map((R??[]).map(a=>[a.id,a])),[R]),$=r.useMemo(()=>h.map(a=>E.get(a)).filter(a=>!!a),[E,h]);r.useEffect(()=>{N!==void 0&&b(a=>{const y=a.filter(_=>E.has(_));return y.length===a.length&&y.every((_,D)=>_===a[D])?a:y})},[N,E,b]),r.useEffect(()=>{R!==void 0&&c(a=>!a||L.has(a)?a:null)},[c,L,R]);const O=a=>{f||c(y=>y===a?null:a)},q=a=>{f||b(y=>[...y,a])},U=a=>{f||b(y=>y.filter((_,D)=>D!==a))},te=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:x("团队模板")}),i?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:x("团队模板加载失败")}),e.jsx("button",{type:"button",onClick:()=>{M()},disabled:f||p,className:"ml-2 underline hover:no-underline",children:x("重试")})]}):d?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(ee,{size:12,className:"animate-spin"}),x("加载中...")]}):(R??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[x("当前没有团队模板"),e.jsx(we,{to:"/settings/team",className:"ml-1.5 text-info hover:underline",children:x("去创建")})]}):e.jsx("div",{className:v("space-y-1.5",k&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(R??[]).map(a=>{const y=a.id===l,_=a.members?.length??0,D=a.members?.map(B=>B.memberPresetId)??[],W=a.members?.slice(0,3).map((B,X)=>Se(B.memberPreset?.name??B.memberPresetId,X,D,B.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>O(a.id),disabled:f,className:v("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",y?"bg-background border-foreground/20 shadow-sm":"bg-background border-border/60 hover:border-border hover:bg-accent"),children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:v("text-xs truncate",y?"font-medium text-foreground":"text-foreground"),children:a.name}),e.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[_,x("人")]})]}),W&&e.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground truncate",children:W})]}),y&&e.jsx(V,{size:13,className:"shrink-0 text-foreground"})]})},a.id)})})]}),se=$.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:$.map((a,y)=>{const _=Se(a.name,y,h,a.id);return e.jsxs("div",{className:"inline-flex items-center gap-1 pl-1 pr-0.5 py-0.5 rounded-md border border-border/60 bg-background text-[10px] text-foreground",children:[e.jsx(Te,{name:a.name,avatar:a.avatar,className:"h-3.5 w-3.5 text-[7px]"}),e.jsx("span",{className:"max-w-[80px] truncate",children:_}),e.jsx("button",{type:"button",onClick:()=>U(y),disabled:f,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(Me,{size:9})})]},`${a.id}-${y}`)})}),G=u?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:x("成员预设加载失败")}),e.jsx("button",{type:"button",onClick:()=>{m()},disabled:f||C,className:"ml-2 underline hover:no-underline",children:x("重试")})]}):S?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(ee,{size:12,className:"animate-spin"}),x("加载中...")]}):(N??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[x("当前没有成员预设"),e.jsx(we,{to:"/settings/team",className:"ml-1.5 text-info hover:underline",children:x("去创建")})]}):e.jsx("div",{className:"space-y-1 max-h-[180px] overflow-y-auto pr-1",children:(N??[]).map(a=>{const y=h.filter(W=>W===a.id).length,_=w.get(a.providerId)??a.providerId,D=Mt(a.capabilities);return e.jsxs("button",{type:"button",onClick:()=>q(a.id),disabled:f,className:v("flex items-center gap-2 w-full px-2 py-1.5 rounded-lg text-left border border-transparent transition-all",f&&"cursor-not-allowed opacity-60","bg-background hover:bg-accent hover:border-border/60"),children:[e.jsx(Te,{name:a.name,avatar:a.avatar,className:"h-6 w-6 text-[9px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:a.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground truncate",children:[_," · ",D,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[y>0&&e.jsxs("span",{className:"text-[10px] text-foreground font-semibold",children:["×",y]}),e.jsx(He,{size:12,className:"text-muted-foreground"})]})]},a.id)})}),K=$.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-primary text-[10px] font-semibold text-primary-foreground px-1.5",children:$.length}),H=e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground shrink-0",children:x("执行模式")}),e.jsxs("div",{className:"inline-flex items-center h-7 rounded-md border border-border/70 bg-background p-0.5",children:[e.jsxs("button",{type:"button",onClick:()=>!f&&o("AUTO"),disabled:f,className:v("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",s==="AUTO"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(ft,{size:11}),x("自动模式")]}),e.jsxs("button",{type:"button",onClick:()=>!f&&o("CONFIRM"),disabled:f,className:v("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",s==="CONFIRM"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(dt,{size:11}),x("确认模式")]})]})]});return k?e.jsxs("div",{className:"space-y-3",children:[H,te,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!f&&g(a=>!a),disabled:f,"aria-expanded":j,className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(Q,{size:12,className:v("transition-transform",j?"":"-rotate-90")}),x("追加独立成员"),K]}),j&&e.jsxs("div",{className:"mt-2",children:[se,G]})]})]}):e.jsxs("div",{className:"space-y-3.5",children:[H,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[te,e.jsxs("section",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:x("追加成员")}),K]}),se,G]})]})]})}const At="/assets/agent-tower-logo-COx9gy77.png";function Xt({className:s="h-7 w-7"}){return e.jsx("img",{src:At,alt:"Agent Tower",className:`block shrink-0 object-contain ${s}`})}function Zt({className:s=""}){return e.jsx("span",{className:`font-semibold text-foreground tracking-tight text-base ${s}`,children:"Agent Tower"})}const It={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."};function Jt({variant:s="task",projects:o,providers:l,isProvidersLoading:c,onSubmit:h,defaultProjectId:b="",defaultProviderId:f="",onProjectChange:k,createStep:x,placeholder:j,submitLabel:g,pendingLabel:t,submitTitle:N}){const{t:u}=ae(),[C,S]=r.useState(""),[m,R]=r.useState(b),[i,p]=r.useState(f),[d,M]=r.useState("SOLO"),[w,E]=r.useState(F.WORKTREE),[L,$]=r.useState("AUTO"),[O,q]=r.useState(null),[U,te]=r.useState([]),[se,G]=r.useState(!1),[K,H]=r.useState(!1),[a,y]=r.useState(!1),[_,D]=r.useState(!1),W=r.useRef(null),B=r.useRef(null),X=r.useRef(null),Ee=r.useRef(null),me=r.useRef(null),{files:fe,addFiles:Y,removeFile:Ae,clear:xe,buildMarkdownLinks:pe,getDoneAttachments:he,isUploading:re}=St(),A=s==="conversation",T=s==="task"||s==="conversation",Ie=g??u(A?"开始":"创建");r.useEffect(()=>{R(b),k?.(b)},[b,k]),r.useEffect(()=>{p(f)},[f]),r.useEffect(()=>{if(!K)return;const n=I=>{W.current&&!W.current.contains(I.target)&&H(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[K]),r.useEffect(()=>{if(!a)return;const n=I=>{B.current&&!B.current.contains(I.target)&&y(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[a]),r.useEffect(()=>{if(!_)return;const n=I=>{X.current&&!X.current.contains(I.target)&&D(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[_]);const ie=r.useMemo(()=>o.find(n=>n.id===m),[o,m]),ge=r.useMemo(()=>l.find(n=>n.id===i),[l,i]),_e=w===F.MAIN_DIRECTORY?u("本地模式"):u("工作树模式"),z=x!=="idle",be=!!O||U.length>0,Z=!z&&!re&&C.trim().length>0&&(A?!!i:!!m&&(d==="SOLO"?!!i:be)),le=r.useCallback(async()=>{if(!Z)return;const n=T?pe():"",I=T?he().map(J=>J.id):[];try{await h({title:C.trim(),description:"",projectId:A?"":m,providerId:i,mode:A?"SOLO":d,workspaceMode:!A&&d==="SOLO"?w:F.WORKTREE,teamRunMode:A?"AUTO":L,teamTemplateId:A?null:O,memberPresetIds:A?[]:U,attachmentLinks:n,attachmentIds:I}),S(""),T&&xe()}catch{}},[Z,T,pe,he,h,C,A,m,i,d,w,L,O,U,xe]),ze=r.useCallback(n=>{n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),le())},[le]),Re=r.useCallback(n=>{const I=n.target.files;I&&I.length>0&&Y(Array.from(I)),n.target.value=""},[Y]),Le=r.useCallback(n=>{R(n),k?.(n),H(!1)},[k]),De=r.useCallback(n=>{if(!T)return;const I=n.clipboardData.items,J=[];for(const je of I)if(je.kind==="file"){const Ne=je.getAsFile();Ne&&J.push(Ne)}J.length>0&&(n.preventDefault(),Y(J))},[Y,T]),[ve,ce]=r.useState(!1),Oe=r.useCallback(n=>{T&&(n.preventDefault(),ce(!0))},[T]),Fe=r.useCallback(n=>{T&&(n.preventDefault(),ce(!1))},[T]),Pe=r.useCallback(n=>{if(!T)return;n.preventDefault(),ce(!1);const I=n.dataTransfer.files;I.length>0&&Y(Array.from(I))},[Y,T]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:v("relative bg-background rounded-xl border transition-all duration-200","shadow-[0_1px_2px_rgba(0,0,0,0.04)]","hover:border-foreground/15 hover:shadow-[0_2px_6px_rgba(0,0,0,0.05)]","focus-within:border-foreground/25 focus-within:shadow-[0_2px_8px_rgba(0,0,0,0.06)]",ve?"border-info/40 bg-info/5 ring-2 ring-info/15":"border-border",z&&"opacity-80"),onDragOver:T?Oe:void 0,onDragLeave:T?Fe:void 0,onDrop:T?Pe:void 0,children:[T&&fe.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(yt,{files:fe,onRemove:Ae})}),e.jsx("textarea",{ref:Ee,value:C,onChange:n=>S(n.target.value),onKeyDown:ze,onPaste:T?De:void 0,placeholder:u(j||"Describe your task..."),disabled:z,autoFocus:!0,rows:1,className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-[15px] text-foreground placeholder:text-muted-foreground/80 leading-relaxed",style:{minHeight:"76px",maxHeight:"220px",fieldSizing:"content"}}),T&&ve&&e.jsx("div",{className:"px-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-center py-3 border border-dashed border-info/40 rounded-lg text-xs font-medium text-info",children:u("Drop files here")})}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:T?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>me.current?.click(),disabled:z||re,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:u("Attach files"),children:e.jsx(Ye,{size:18})}),e.jsx("input",{ref:me,type:"file",multiple:!0,onChange:Re,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[T&&re&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ee,{size:14,className:"animate-spin"}),u("Uploading...")]}),z&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ee,{size:14,className:"animate-spin"}),u(t??It[x])]}),!A&&!z&&!re&&d==="TEAM"&&!be&&C.trim().length>0&&e.jsx("span",{className:"text-[11px] text-warning",children:u("请选择团队模板或追加成员")}),Z&&e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 text-[11px] text-muted-foreground/80 select-none",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded border border-border bg-muted/60 text-[10px] font-medium text-muted-foreground leading-none",children:"⏎"}),Ie]}),e.jsx("button",{type:"button",onClick:le,disabled:!Z,className:v("flex items-center justify-center size-8 rounded-lg transition-all duration-200",Z?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm":"bg-muted text-muted-foreground/40 cursor-not-allowed"),title:u(N||"Create & Start"),children:e.jsx(Ze,{size:16,strokeWidth:2.5})})]})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!A&&e.jsxs("div",{className:"relative",ref:W,children:[e.jsxs("button",{type:"button",onClick:()=>{z||H(n=>!n)},disabled:z,className:v("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",ie?"text-foreground":"text-muted-foreground"),children:[e.jsx(Ve,{size:14,className:"shrink-0",style:{color:ie?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:ie?.name??u("Project")}),e.jsx(Q,{size:12,className:v("text-muted-foreground transition-transform",K&&"rotate-180")})]}),K&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 max-h-[240px] overflow-y-auto z-50",children:o.map(n=>e.jsxs("button",{type:"button",onClick:()=>Le(n.id),className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx("span",{className:"size-2 rounded-full shrink-0 mr-2",style:{backgroundColor:n.color??"var(--muted-foreground)"}}),e.jsx("span",{className:v("truncate flex-1",n.id===m?"text-foreground font-medium":"text-muted-foreground"),children:n.name}),e.jsx(V,{size:14,className:v("ml-2 shrink-0 text-foreground",n.id===m?"opacity-100":"opacity-0")})]},n.id))})]}),(A||d==="SOLO")&&e.jsxs("div",{className:"relative",ref:B,children:[e.jsxs("button",{type:"button",onClick:()=>{z||y(n=>!n)},disabled:z,className:v("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",ge?"text-foreground":"text-muted-foreground"),children:[e.jsx(Qe,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[120px] truncate",children:ge?.name??u(c?"Loading...":"Agent")}),e.jsx(Q,{size:12,className:v("text-muted-foreground transition-transform",a&&"rotate-180")})]}),a&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 max-h-[240px] overflow-y-auto z-50",children:l.map(n=>e.jsxs("button",{type:"button",disabled:!n.available,onClick:()=>{p(n.id),y(!1)},className:v("flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",!n.available&&"opacity-40 cursor-not-allowed"),children:[e.jsx(V,{size:14,className:v("mr-2 shrink-0 text-foreground",n.id===i?"opacity-100":"opacity-0")}),e.jsxs("span",{className:v("truncate",n.id===i?"text-foreground font-medium":"text-muted-foreground"),children:[n.name,n.available?"":u(" (unavailable)")]})]},n.id))})]}),!A&&d==="SOLO"&&e.jsxs("div",{className:"relative",ref:X,children:[e.jsxs("button",{type:"button",onClick:()=>{z||D(n=>!n)},disabled:z,className:v("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-foreground"),children:[e.jsx(at,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:_e}),e.jsx(Q,{size:12,className:v("text-muted-foreground transition-transform",_&&"rotate-180")})]}),_&&e.jsxs("div",{className:"absolute top-full left-0 mt-1.5 w-44 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 z-50",children:[e.jsxs("button",{type:"button",onClick:()=>{E(F.WORKTREE),D(!1)},className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(V,{size:14,className:v("mr-2 shrink-0 text-foreground",w===F.WORKTREE?"opacity-100":"opacity-0")}),e.jsx("span",{className:v("truncate",w===F.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:u("工作树模式")})]}),e.jsxs("button",{type:"button",onClick:()=>{E(F.MAIN_DIRECTORY),D(!1)},className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(V,{size:14,className:v("mr-2 shrink-0 text-foreground",w===F.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsx("span",{className:v("truncate",w===F.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:u("本地模式")})]})]})]}),!A&&e.jsxs("button",{type:"button",role:"switch","aria-checked":d==="TEAM",onClick:()=>{z||(d==="TEAM"?(M("SOLO"),G(!1)):(M("TEAM"),D(!1),E(F.WORKTREE),G(!0)))},disabled:z,className:v("ml-auto flex items-center gap-2 h-7 pl-2 pr-2 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",d==="TEAM"?"text-foreground":"text-muted-foreground"),title:u("启用团队模式"),children:[e.jsx(qe,{size:14,className:d==="TEAM"?"text-foreground":"text-muted-foreground"}),e.jsx("span",{children:u("团队模式")}),e.jsx("span",{className:v("relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors",d==="TEAM"?"bg-primary":"bg-border"),children:e.jsx("span",{className:v("inline-block size-3 rounded-full bg-background shadow-sm transition-transform",d==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})]}),!A&&d==="SOLO"&&w===F.MAIN_DIRECTORY&&e.jsx("div",{className:"mt-2.5",children:e.jsx("div",{className:"rounded-lg border border-warning/25 bg-warning/8 px-3 py-2 text-xs leading-relaxed text-warning/90",children:u("Agent 将直接修改项目主目录;不会自动提交,也不能使用 Merge、Rebase 或冲突解决流程。")})}),!A&&d==="TEAM"&&se&&e.jsx("div",{className:"mt-2.5 rounded-xl border border-border/60 bg-muted/40 p-3 animate-[fadeInUp_0.25s_cubic-bezier(0.16,1,0.3,1)]",children:e.jsx(Et,{mode:L,setMode:$,selectedTemplateId:O,setSelectedTemplateId:q,selectedMemberPresetIds:U,setSelectedMemberPresetIds:te,disabled:z,compact:!0})})]})}export{Ut as A,Xt as B,Jt as C,tt as F,at as G,it as I,Yt as P,qt as S,Ht as T,ft as Z,Gt as a,St as b,yt as c,Ze as d,Zt as e,Wt as f,Vt as g,Et as h,dt as i,Kt as u};
@@ -1,54 +0,0 @@
1
- import{h as Ne,i as Ce,q as Ee,m as ke,u as _,r as v,j as n,g as S,S as te,M as Pe,d as Oe,B as N,n as Ie,Y as _e,t as P,f as K,U as ne}from"./index-DbO4YyUv.js";import{u as Se,a as Te,b as Ae,c as De,d as Le,e as Re,f as Fe}from"./use-providers-BOyY0DcV.js";import{C as Me}from"./confirm-dialog-BAnxa2C9.js";import{I as M}from"./input-Dqnd4oTj.js";import{M as q,T as Ue}from"./modal-CAB_bs-c.js";import{S as le}from"./select-BJfNuuIV.js";import{C as ze,S as Be}from"./switch-bLlDOWNp.js";import{T as ae}from"./textarea-BcVRpxhF.js";import{A as w}from"./log-adapter-CjgRCCYG.js";import{C as oe}from"./chevron-down-Cur5jANy.js";import{S as Ge}from"./SettingsMasterDetail-CdimTj5n.js";import{U as Ke,C as Xe}from"./upload-DNwyW_bv.js";import{P as Z,T as ce}from"./trash-2-8Pu6lwnW.js";import{P as Ve}from"./pencil-B__GQn9r.js";import{R as Ze}from"./rotate-ccw-5d-eMwsw.js";import"./check-D9lM__p8.js";import"./arrow-left-B6KMicbE.js";const $e=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ye=Ne("download",$e);function qe(e,t){let l=e.slice(0,t).split(/\r\n|\n|\r/g);return[l.length,l.pop().length+1]}function He(e,t,l){let a=e.split(/\r\n|\n|\r/g),s="",i=(Math.log10(t+1)|0)+1;for(let r=t-1;r<=t+1;r++){let o=a[r-1];o&&(s+=r.toString().padEnd(i," "),s+=": ",s+=o,s+=`
2
- `,r===t&&(s+=" ".repeat(i+l+2),s+=`^
3
- `))}return s}class p extends Error{line;column;codeblock;constructor(t,l){const[a,s]=qe(l.toml,l.ptr),i=He(l.toml,a,s);super(`Invalid TOML document: ${t}
4
-
5
- ${i}`,l),this.line=a,this.column=s,this.codeblock=i}}function Je(e,t){let l=0;for(;e[t-++l]==="\\";);return--l&&l%2}function $(e,t=0,l=e.length){let a=e.indexOf(`
6
- `,t);return e[a-1]==="\r"&&a--,a<=l?a:-1}function U(e,t){for(let l=t;l<e.length;l++){let a=e[l];if(a===`
7
- `)return l;if(a==="\r"&&e[l+1]===`
8
- `)return l+1;if(a<" "&&a!==" "||a==="")throw new p("control characters are not allowed in comments",{toml:e,ptr:t})}return e.length}function I(e,t,l,a){let s;for(;(s=e[t])===" "||s===" "||!l&&(s===`
9
- `||s==="\r"&&e[t+1]===`
10
- `);)t++;return a||s!=="#"?t:I(e,U(e,t),l)}function We(e,t,l,a,s=!1){if(!a)return t=$(e,t),t<0?e.length:t;for(let i=t;i<e.length;i++){let r=e[i];if(r==="#")i=$(e,i);else{if(r===l)return i+1;if(r===a||s&&(r===`
11
- `||r==="\r"&&e[i+1]===`
12
- `))return i}}throw new p("cannot find end of structure",{toml:e,ptr:t})}function de(e,t){let l=e[t],a=l===e[t+1]&&e[t+1]===e[t+2]?e.slice(t,t+3):l;t+=a.length-1;do t=e.indexOf(a,++t);while(t>-1&&l!=="'"&&Je(e,t));return t>-1&&(t+=a.length,a.length>1&&(e[t]===l&&t++,e[t]===l&&t++)),t}let Qe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class A extends Date{#t=!1;#n=!1;#e=null;constructor(t){let l=!0,a=!0,s="Z";if(typeof t=="string"){let i=t.match(Qe);i?(i[1]||(l=!1,t=`0000-01-01T${t}`),a=!!i[2],a&&t[10]===" "&&(t=t.replace(" ","T")),i[2]&&+i[2]>23?t="":(s=i[3]||null,t=t.toUpperCase(),!s&&a&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=l,this.#n=a,this.#e=s)}isDateTime(){return this.#t&&this.#n}isLocal(){return!this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let l=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return l=this.#e[0]==="-"?l:-l,new Date(this.getTime()-l*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,l="Z"){let a=new A(t);return a.#e=l,a}static wrapAsLocalDateTime(t){let l=new A(t);return l.#e=null,l}static wrapAsLocalDate(t){let l=new A(t);return l.#n=!1,l.#e=null,l}static wrapAsLocalTime(t){let l=new A(t);return l.#t=!1,l.#e=null,l}}let et=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,tt=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,nt=/^[+-]?0[0-9_]/,rt=/^[0-9a-f]{2,8}$/i,re={b:"\b",t:" ",n:`
13
- `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function ue(e,t=0,l=e.length){let a=e[t]==="'",s=e[t++]===e[t]&&e[t]===e[t+1];s&&(l-=2,e[t+=2]==="\r"&&t++,e[t]===`
14
- `&&t++);let i=0,r,o="",d=t;for(;t<l-1;){let c=e[t++];if(c===`
15
- `||c==="\r"&&e[t]===`
16
- `){if(!s)throw new p("newlines are not allowed in strings",{toml:e,ptr:t-1})}else if(c<" "&&c!==" "||c==="")throw new p("control characters are not allowed in strings",{toml:e,ptr:t-1});if(r){if(r=!1,c==="x"||c==="u"||c==="U"){let f=e.slice(t,t+=c==="x"?2:c==="u"?4:8);if(!rt.test(f))throw new p("invalid unicode escape",{toml:e,ptr:i});try{o+=String.fromCodePoint(parseInt(f,16))}catch{throw new p("invalid unicode escape",{toml:e,ptr:i})}}else if(s&&(c===`
17
- `||c===" "||c===" "||c==="\r")){if(t=I(e,t-1,!0),e[t]!==`
18
- `&&e[t]!=="\r")throw new p("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:i});t=I(e,t)}else if(c in re)o+=re[c];else throw new p("unrecognized escape sequence",{toml:e,ptr:i});d=t}else!a&&c==="\\"&&(i=t-1,r=!0,o+=e.slice(d,i))}return o+e.slice(d,l-1)}function st(e,t,l,a){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return a?0n:0;let s=et.test(e);if(s||tt.test(e)){if(nt.test(e))throw new p("leading zeroes are not allowed",{toml:t,ptr:l});e=e.replace(/_/g,"");let r=+e;if(isNaN(r))throw new p("invalid number",{toml:t,ptr:l});if(s){if((s=!Number.isSafeInteger(r))&&!a)throw new p("integer value cannot be represented losslessly",{toml:t,ptr:l});(s||a===!0)&&(r=BigInt(e))}return r}const i=new A(e);if(!i.isValid())throw new p("invalid value",{toml:t,ptr:l});return i}function it(e,t,l){let a=e.slice(t,l),s=a.indexOf("#");return s>-1&&(U(e,s),a=a.slice(0,s)),[a.trimEnd(),s]}function H(e,t,l,a,s){if(a===0)throw new p("document contains excessively nested structures. aborting.",{toml:e,ptr:t});let i=e[t];if(i==="["||i==="{"){let[d,c]=i==="["?ot(e,t,a,s):at(e,t,a,s);if(l){if(c=I(e,c),e[c]===",")c++;else if(e[c]!==l)throw new p("expected comma or end of structure",{toml:e,ptr:c})}return[d,c]}let r;if(i==='"'||i==="'"){r=de(e,t);let d=ue(e,t,r);if(l){if(r=I(e,r),e[r]&&e[r]!==","&&e[r]!==l&&e[r]!==`
19
- `&&e[r]!=="\r")throw new p("unexpected character encountered",{toml:e,ptr:r});r+=+(e[r]===",")}return[d,r]}r=We(e,t,",",l);let o=it(e,t,r-+(e[r-1]===","));if(!o[0])throw new p("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return l&&o[1]>-1&&(r=I(e,t+o[1]),r+=+(e[r]===",")),[st(o[0],e,t,s),r]}let lt=/^[a-zA-Z0-9-_]+[ \t]*$/;function Y(e,t,l="="){let a=t-1,s=[],i=e.indexOf(l,t);if(i<0)throw new p("incomplete key-value: cannot find end of key",{toml:e,ptr:t});do{let r=e[t=++a];if(r!==" "&&r!==" ")if(r==='"'||r==="'"){if(r===e[t+1]&&r===e[t+2])throw new p("multiline strings are not allowed in keys",{toml:e,ptr:t});let o=de(e,t);if(o<0)throw new p("unfinished string encountered",{toml:e,ptr:t});a=e.indexOf(".",o);let d=e.slice(o,a<0||a>i?i:a),c=$(d);if(c>-1)throw new p("newlines are not allowed in keys",{toml:e,ptr:t+a+c});if(d.trimStart())throw new p("found extra tokens after the string part",{toml:e,ptr:o});if(i<o&&(i=e.indexOf(l,o),i<0))throw new p("incomplete key-value: cannot find end of key",{toml:e,ptr:t});s.push(ue(e,t,o))}else{a=e.indexOf(".",t);let o=e.slice(t,a<0||a>i?i:a);if(!lt.test(o))throw new p("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:t});s.push(o.trimEnd())}}while(a+1&&a<i);return[s,I(e,i+1,!0,!0)]}function at(e,t,l,a){let s={},i=new Set,r;for(t++;(r=e[t++])!=="}"&&r;){if(r===",")throw new p("expected value, found comma",{toml:e,ptr:t-1});if(r==="#")t=U(e,t);else if(r!==" "&&r!==" "&&r!==`
20
- `&&r!=="\r"){let o,d=s,c=!1,[f,j]=Y(e,t-1);for(let x=0;x<f.length;x++){if(x&&(d=c?d[o]:d[o]={}),o=f[x],(c=Object.hasOwn(d,o))&&(typeof d[o]!="object"||i.has(d[o])))throw new p("trying to redefine an already defined value",{toml:e,ptr:t});!c&&o==="__proto__"&&Object.defineProperty(d,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new p("trying to redefine an already defined value",{toml:e,ptr:t});let[h,m]=H(e,j,"}",l-1,a);i.add(h),d[o]=h,t=m}}if(!r)throw new p("unfinished table encountered",{toml:e,ptr:t});return[s,t]}function ot(e,t,l,a){let s=[],i;for(t++;(i=e[t++])!=="]"&&i;){if(i===",")throw new p("expected value, found comma",{toml:e,ptr:t-1});if(i==="#")t=U(e,t);else if(i!==" "&&i!==" "&&i!==`
21
- `&&i!=="\r"){let r=H(e,t-1,"]",l-1,a);s.push(r[0]),t=r[1]}}if(!i)throw new p("unfinished array encountered",{toml:e,ptr:t});return[s,t]}function se(e,t,l,a){let s=t,i=l,r,o=!1,d;for(let c=0;c<e.length;c++){if(c){if(s=o?s[r]:s[r]={},i=(d=i[r]).c,a===0&&(d.t===1||d.t===2))return null;if(d.t===2){let f=s.length-1;s=s[f],i=i[f].c}}if(r=e[c],(o=Object.hasOwn(s,r))&&i[r]?.t===0&&i[r]?.d)return null;o||(r==="__proto__"&&(Object.defineProperty(s,r,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(i,r,{enumerable:!0,configurable:!0,writable:!0})),i[r]={t:c<e.length-1&&a===2?3:a,d:!1,i:0,c:{}})}if(d=i[r],d.t!==a&&!(a===1&&d.t===3)||(a===2&&(d.d||(d.d=!0,s[r]=[]),s[r].push(s={}),d.c[d.i++]=d={t:1,d:!1,i:0,c:{}}),d.d))return null;if(d.d=!0,a===1)s=o?s[r]:s[r]={};else if(a===0&&o)return null;return[r,s,d.c]}function ct(e,{maxDepth:t=1e3,integersAsBigInt:l}={}){let a={},s={},i=a,r=s;for(let o=I(e,0);o<e.length;){if(e[o]==="["){let d=e[++o]==="[",c=Y(e,o+=+d,"]");if(d){if(e[c[1]-1]!=="]")throw new p("expected end of table declaration",{toml:e,ptr:c[1]-1});c[1]++}let f=se(c[0],a,s,d?2:1);if(!f)throw new p("trying to redefine an already defined table or value",{toml:e,ptr:o});r=f[2],i=f[1],o=c[1]}else{let d=Y(e,o),c=se(d[0],i,r,0);if(!c)throw new p("trying to redefine an already defined table or value",{toml:e,ptr:o});let f=H(e,d[1],void 0,t,l);c[1][c[0]]=f[0],o=f[1]}if(o=I(e,o,!0),e[o]&&e[o]!==`
22
- `&&e[o]!=="\r")throw new p("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:o});o=I(e,o)}return a}function dt(){return Ce({queryKey:Ee.system.cursorAgentModels,queryFn:()=>ke.get("/system/cursor-agent-models"),staleTime:1e3*60*10})}function ut({value:e,onChange:t}){const{t:l}=_(),{data:a,isLoading:s,isError:i}=dt(),r=a?.models??[],[o,d]=v.useState(!1),[c,f]=v.useState(""),j=v.useMemo(()=>{const h=c.trim().toLowerCase();return h?r.filter(m=>m.id.toLowerCase().includes(h)||m.label.toLowerCase().includes(h)):r},[r,c]);return n.jsxs("div",{className:"flex flex-col gap-2 flex-1 min-w-0",children:[n.jsx("input",{type:"text",value:e,onChange:h=>{const m=h.target.value;t(m===""?void 0:m)},placeholder:l("留空为 auto;或直接输入模型 ID(与 cursor-agent --model 一致)"),className:"w-full px-3 py-1.5 text-sm border border-neutral-200 rounded focus:outline-none focus:ring-1 focus:ring-neutral-900 font-mono"}),n.jsxs("button",{type:"button",onClick:()=>d(h=>!h),disabled:s,className:"flex items-center gap-1 text-xs text-neutral-600 hover:text-neutral-900 disabled:opacity-50 w-fit",children:[n.jsx(oe,{size:14,className:S("transition-transform",o&&"rotate-180")}),s?l("正在加载 cursor-agent 模型列表…"):o?l("收起列表"):l("从本机 cursor-agent 选择({count} 个)",{count:r.length})]}),o&&!s&&n.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white shadow-sm overflow-hidden",children:[n.jsx("input",{type:"text",value:c,onChange:h=>f(h.target.value),placeholder:l("筛选模型…"),className:"w-full px-3 py-2 text-sm border-b border-neutral-100 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-neutral-300"}),n.jsxs("div",{className:"max-h-[min(50vh,22rem)] overflow-y-auto py-1",children:[n.jsx("button",{type:"button",onClick:()=>{t(void 0),d(!1),f("")},className:S("w-full px-3 py-2 text-left text-sm hover:bg-neutral-50",e?"text-neutral-700":"bg-neutral-50 font-medium"),children:l("默认 (auto)")}),j.map(h=>n.jsxs("button",{type:"button",onClick:()=>{t(h.id),d(!1),f("")},className:S("w-full px-3 py-2 text-left text-sm hover:bg-neutral-50 border-t border-neutral-100",e===h.id?"bg-blue-50/80":""),children:[n.jsx("div",{className:"font-mono text-xs text-neutral-900 break-all",children:h.id}),n.jsx("div",{className:"text-xs text-neutral-500 mt-0.5 break-words",children:h.label})]},h.id)),j.length===0&&n.jsx("div",{className:"px-3 py-4 text-xs text-neutral-400 text-center",children:l("无匹配项")})]})]}),(i||a?.error)&&n.jsxs("p",{className:"text-xs text-amber-700",children:[l("无法从本机加载模型列表({error})。仍可手动输入;或在安装 cursor-agent 的机器上运行",{error:a?.error??l("请求失败")}),n.jsx("code",{className:"mx-0.5 bg-neutral-100 px-1 rounded text-[11px]",children:"cursor-agent --list-models"}),l("查看 ID。")]})]})}const z={CLAUDE_CODE:"Claude Code",GEMINI_CLI:"Gemini CLI",CURSOR_AGENT:"Cursor Agent",CODEX:"Codex"},F={key:"appendPrompt",label:"追加 Prompt",type:"textarea",rows:3,placeholder:"追加到每次 prompt 末尾的文本"},J={[w.CLAUDE_CODE]:[{key:"dangerouslySkipPermissions",label:"跳过权限确认",type:"switch"},{key:"model",label:"模型",type:"input",placeholder:"claude-sonnet-4-20250514"},{key:"effort",label:"推理强度",type:"select",options:[{value:"",label:"默认"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"XHigh"},{value:"max",label:"Max"}]},F],[w.GEMINI_CLI]:[{key:"yolo",label:"跳过权限确认",type:"switch"},{key:"model",label:"模型",type:"input",placeholder:"gemini-2.5-pro"},F],[w.CURSOR_AGENT]:[{key:"force",label:"强制执行",type:"switch"},{key:"model",label:"模型",type:"cursor_model"},F],[w.CODEX]:[{key:"dangerouslyBypassApprovalsAndSandbox",label:"跳过所有确认和沙盒",type:"switch"},{key:"model",label:"模型",type:"input",placeholder:"o3"},{key:"profile",label:"Profile",type:"input",placeholder:"~/.codex/config.toml 中的 profile 名称"},F]};function ie(){return{}}function W(e,t){return{...t}}const mt=JSON.stringify({env:{ANTHROPIC_API_KEY:"",ANTHROPIC_BASE_URL:""}},null,2),xt=`# Codex config.toml 配置片段 — 通过 -c 参数注入,不会修改 ~/.codex/config.toml
23
- # 参考: https://developers.openai.com/codex/config-sample
24
-
25
- # ─── 模型与推理 ─────────────────────────────────────────────
26
- # model_reasoning_effort = "medium" # minimal | low | medium | high | xhigh
27
- # model_reasoning_summary = "auto" # auto | concise | detailed | none
28
- # model_verbosity = "medium" # low | medium | high
29
- # service_tier = "flex" # fast | flex
30
-
31
- # ─── 自定义 Model Provider ──────────────────────────────────
32
- # model_provider = "azure"
33
- #
34
- # [model_providers.azure]
35
- # name = "Azure OpenAI"
36
- # base_url = "https://YOUR_PROJECT.openai.azure.com/openai"
37
- # env_key = "AZURE_OPENAI_API_KEY"
38
- # env_key_instructions = "Set AZURE_OPENAI_API_KEY in Provider env"
39
- # wire_api = "responses"
40
- # query_params = { api-version = "2025-04-01-preview" }
41
-
42
- # ─── OpenAI 数据驻留 ────────────────────────────────────────
43
- # [model_providers.openai-us]
44
- # name = "OpenAI US"
45
- # base_url = "https://us.api.openai.com/v1"
46
- # wire_api = "responses"
47
- # requires_openai_auth = true
48
-
49
- # ─── 本地 OSS (Ollama) ──────────────────────────────────────
50
- # [model_providers.ollama]
51
- # name = "Ollama"
52
- # base_url = "http://localhost:11434/v1"
53
- # wire_api = "responses"
54
- `;function X(e){return e===w.CLAUDE_CODE?mt:e===w.CODEX?xt:""}function ft(e){return e===w.CLAUDE_CODE||e===w.CODEX}const pt=Object.values(J).flat().reduce((e,t)=>(e[t.key]||(e[t.key]=t.label),e),{}),ht=Object.values(J).flat().reduce((e,t)=>(t.options&&(e[t.key]=Object.fromEntries(t.options.map(l=>[l.value,l.label]))),e),{});function gt(e,t){return typeof t=="boolean"?t?ne("是"):ne("否"):typeof t=="string"&&t?ht[e]?.[t]??t:String(t)}function T(e,t){return e instanceof Error?e.message:t}function bt(e){return`agent-tower-provider-backup-${e.replace(/[:.]/g,"-")}.json`}function vt(e,t){const l=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),a=URL.createObjectURL(l),s=document.createElement("a");s.href=a,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a)}function yt(e){switch(e){case"CREATE":return{label:"新增",className:"bg-success/10 text-success"};case"OVERWRITE":return{label:"覆盖",className:"bg-warning/10 text-warning"};case"SKIP":return{label:"跳过",className:"bg-muted text-muted-foreground"}}}function jt({type:e}){const t=e==="LOGIN_DETECTED"||e==="INSTALLATION_FOUND";return n.jsx("span",{className:S("inline-block h-2 w-2 rounded-full shrink-0",t?"bg-success":"bg-border"),title:t?"Available":"Unavailable",children:n.jsx("span",{className:"sr-only",children:t?"Available":"Unavailable"})})}function wt({type:e}){const{t}=_();return e==="LOGIN_DETECTED"||e==="INSTALLATION_FOUND"?n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-[11px] font-medium text-success",children:[n.jsx(ze,{size:11,"aria-hidden":"true"}),t("可用")]}):n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:[n.jsx(Xe,{size:11,"aria-hidden":"true"}),t("不可用")]})}function V({title:e,defaultOpen:t=!1,children:l}){const[a,s]=v.useState(t);return n.jsxs("div",{className:"rounded-lg border border-border",children:[n.jsxs("button",{type:"button",onClick:()=>s(i=>!i),"aria-expanded":a,className:"w-full flex items-center justify-between rounded-lg px-4 py-2.5 text-sm font-medium text-foreground transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset",children:[e,n.jsx(oe,{size:14,"aria-hidden":"true",className:S("text-muted-foreground transition-transform motion-reduce:transition-none",a&&"rotate-180")})]}),a&&n.jsx("div",{className:"px-4 pb-4 space-y-3",children:l})]})}function Nt({agentType:e,config:t,onChange:l}){const{t:a}=_(),s=J[e]??[];if(s.length===0)return n.jsx("p",{className:"text-xs text-muted-foreground",children:a("该类型暂无运行配置")});const i=(r,o)=>{l({...t,[r]:o})};return n.jsx("div",{className:"space-y-3",children:s.map(r=>r.type==="textarea"?n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-sm text-foreground",children:a(r.label)}),n.jsx(ae,{value:t[r.key]??"",onChange:o=>i(r.key,o.target.value||void 0),placeholder:r.placeholder?a(r.placeholder):void 0,rows:r.rows??3,className:"py-1.5"})]},r.key):r.type==="cursor_model"?n.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start",children:[n.jsx("label",{className:"w-32 shrink-0 text-sm text-foreground sm:pt-2",children:a(r.label)}),n.jsx(ut,{value:t[r.key]??"",onChange:o=>i(r.key,o)})]},r.key):n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("label",{className:"w-32 shrink-0 text-sm text-foreground",children:a(r.label)}),r.type==="switch"&&n.jsx(Be,{checked:!!t[r.key],onCheckedChange:o=>i(r.key,o),"aria-label":a(r.label)}),r.type==="input"&&n.jsx(M,{value:t[r.key]??"",onChange:o=>i(r.key,o.target.value||void 0),placeholder:r.placeholder?a(r.placeholder):void 0,className:"flex-1 py-1.5"}),r.type==="select"&&r.options&&n.jsx(le,{value:t[r.key]??"",onChange:o=>i(r.key,o||void 0),options:r.options,placeholder:a("选择...")})]},r.key))})}function Ct({isOpen:e,onClose:t,initialData:l,onSave:a}){const{t:s}=_(),[i,r]=v.useState(l??{name:"",agentType:w.CLAUDE_CODE,config:ie(),settings:"",env:[],isDefault:!1}),[o,d]=v.useState("");v.useEffect(()=>{if(!l&&!i.settings){const m=X(i.agentType);m&&r(x=>({...x,settings:m}))}},[]);const c=m=>{r(x=>({...x,agentType:m,config:ie(),settings:X(m)}))},f=()=>{d("");const m=W(i.agentType,i.config),x={};for(const[O,k]of Object.entries(m))k!==void 0&&k!==""&&(x[O]=k);const y=i.settings.trim();if(y){if(i.agentType===w.CODEX)try{ct(y)}catch(O){d(s("TOML 语法错误: {message}",{message:O instanceof Error?O.message:String(O)}));return}else if(i.agentType===w.CLAUDE_CODE)try{JSON.parse(y)}catch{d(s("JSON 语法错误"));return}}const b={};for(const{key:O,value:k}of i.env){const D=O.trim();D&&(b[D]=k)}const E=!!l,B={name:i.name,agentType:i.agentType,config:x,settings:E?y||"":y||void 0,env:E||Object.keys(b).length>0?b:void 0,isDefault:i.isDefault};a(B)};if(!e)return null;const j=ft(i.agentType),h=i.agentType===w.CODEX;return n.jsx(q,{isOpen:e,onClose:t,title:s(l?"编辑 Provider":"新建 Provider"),className:"max-w-2xl",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:"provider-name",className:"mb-1 block text-xs font-medium text-foreground",children:s("名称")}),n.jsx(M,{id:"provider-name",value:i.name,onChange:m=>r(x=>({...x,name:m.target.value})),placeholder:s("例如: Claude Code (官方)")})]}),!l&&n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-foreground",children:s("Agent 类型")}),n.jsx(le,{value:i.agentType,onChange:m=>c(m),options:Object.values(w).map(m=>({value:m,label:z[m]??m})),placeholder:s("选择 Agent 类型")})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"checkbox",id:"isDefault",checked:i.isDefault,onChange:m=>r(x=>({...x,isDefault:m.target.checked})),className:"h-4 w-4 rounded border-border accent-primary"}),n.jsx("label",{htmlFor:"isDefault",className:"text-sm text-foreground",children:s("设为该类型的默认 Provider")})]}),n.jsx(V,{title:s("运行配置"),defaultOpen:!0,children:n.jsx(Nt,{agentType:i.agentType,config:i.config,onChange:m=>r(x=>({...x,config:m}))})}),n.jsxs(V,{title:s("环境变量"),defaultOpen:i.env.length>0,children:[n.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:[s("注入到 Agent 进程的环境变量。Codex 的")," ",n.jsx("code",{className:"rounded bg-muted px-1",children:"env_key"})," ",s("指定的是变量名,实际值需在此处设置。")]}),n.jsxs("div",{className:"space-y-2",children:[i.env.map((m,x)=>n.jsxs("div",{className:"flex gap-2 items-center",children:[n.jsx(M,{value:m.key,onChange:y=>{const b=[...i.env];b[x]={...b[x],key:y.target.value},r(E=>({...E,env:b}))},placeholder:s("变量名,如 AZURE_OPENAI_API_KEY"),className:"flex-1 py-1.5 font-mono"}),n.jsx(M,{value:m.value,onChange:y=>{const b=[...i.env];b[x]={...b[x],value:y.target.value},r(E=>({...E,env:b}))},placeholder:s("值"),className:"flex-1 py-1.5 font-mono"}),n.jsx("button",{type:"button",onClick:()=>{const y=i.env.filter((b,E)=>E!==x);r(b=>({...b,env:y}))},"aria-label":s("删除"),className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:n.jsx(ce,{size:14})})]},x)),n.jsxs(N,{variant:"outline",size:"sm",onClick:()=>r(m=>({...m,env:[...m.env,{key:"",value:""}]})),children:[n.jsx(Z,{size:12,className:"mr-1"}),s("添加变量")]})]})]}),j&&n.jsxs(V,{title:s(h?"CLI 原生配置 (config.toml)":"CLI 原生配置 (settings.json)"),children:[n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:h?n.jsxs(n.Fragment,{children:[s("直接填写 Codex")," ",n.jsx("code",{className:"rounded bg-muted px-1",children:"config.toml"})," ",s("格式的配置片段,通过")," ",n.jsx("code",{className:"rounded bg-muted px-1",children:"-c"})," ",s("参数注入。不会修改你的")," ",n.jsx("code",{className:"rounded bg-muted px-1",children:"~/.codex/config.toml"})," ",s("文件。")]}):n.jsxs(n.Fragment,{children:[s("对应 Claude Code 的")," ",n.jsx("code",{className:"rounded bg-muted px-1",children:"~/.claude/settings.json"}),",",s("通过")," ",n.jsx("code",{className:"rounded bg-muted px-1",children:"--settings"})," ",s("参数注入。在")," ",n.jsx("code",{className:"rounded bg-muted px-1",children:"env"})," ",s("中设置 ANTHROPIC_API_KEY、ANTHROPIC_BASE_URL 等。")]})}),n.jsx(ae,{value:i.settings,onChange:m=>{r(x=>({...x,settings:m.target.value})),d("")},rows:10,className:"font-mono",placeholder:X(i.agentType),"aria-invalid":!!o}),o&&n.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:o})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx(N,{variant:"outline",onClick:t,children:s("取消")}),n.jsx(N,{onClick:f,disabled:!i.name.trim(),children:s("保存")})]})]})})}function Et({isOpen:e,onClose:t,onConfirm:l,acknowledged:a,onAcknowledgedChange:s,isLoading:i}){const{t:r}=_();return n.jsx(q,{isOpen:e,onClose:t,title:r("导出 Provider 备份"),className:"max-w-xl",action:n.jsxs(n.Fragment,{children:[n.jsx(N,{variant:"outline",onClick:t,disabled:i,children:r("取消")}),n.jsx(N,{onClick:l,disabled:!a||i,children:r(i?"导出中...":"导出备份")})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-warning/30 bg-warning/10 px-4 py-3 text-sm text-foreground",children:[n.jsx(Ue,{size:15,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{children:r("导出的备份文件将包含完整的 Provider 配置,包括环境变量、CLI settings 等敏感信息。任何拿到文件的人都可能直接使用这些 Provider。")})]}),n.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[n.jsx("p",{children:r("这个功能用于备份和迁移,不用于分享配置。")}),n.jsx("p",{children:r("导出内容只包含用户层配置:自定义 Provider,以及对内置 Provider 的覆盖。")})]}),n.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border px-4 py-3 text-sm text-foreground",children:[n.jsx("input",{type:"checkbox",checked:a,onChange:o=>s(o.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),n.jsx("span",{children:r("我已知晓该备份文件包含敏感信息,只会保存在安全位置。")})]})]})})}function kt({isOpen:e,onClose:t,preview:l,backup:a,onConfirm:s,isLoading:i}){const{t:r}=_();if(!l||!a)return null;const o=l.summary.create+l.summary.overwrite,d=[...l.items].sort((c,f)=>{const j={CREATE:0,OVERWRITE:1,SKIP:2};return j[c.action]-j[f.action]});return n.jsx(q,{isOpen:e,onClose:t,title:r("导入 Provider 备份"),className:"max-w-3xl",action:n.jsxs(n.Fragment,{children:[n.jsx(N,{variant:"outline",onClick:t,disabled:i,children:r("取消")}),n.jsx(N,{onClick:s,disabled:o===0||i,children:i?r("导入中..."):r("确认导入 {count} 项",{count:o})})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm text-muted-foreground",children:[n.jsx("div",{children:r("导出时间:{value}",{value:new Date(a.exportedAt).toLocaleString()})}),n.jsx("div",{children:r("模式:完整备份(含敏感信息)")}),n.jsx("div",{children:r("文件内 Provider 数量:{count}",{count:a.providers.length})})]}),n.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[n.jsxs("div",{className:"rounded-lg border border-success/25 bg-success/10 px-4 py-3",children:[n.jsx("div",{className:"text-xs font-medium text-success",children:r("新增")}),n.jsx("div",{className:"text-lg font-semibold text-foreground",children:l.summary.create})]}),n.jsxs("div",{className:"rounded-lg border border-warning/25 bg-warning/10 px-4 py-3",children:[n.jsx("div",{className:"text-xs font-medium text-warning",children:r("覆盖")}),n.jsx("div",{className:"text-lg font-semibold text-foreground",children:l.summary.overwrite})]}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 px-4 py-3",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:r("跳过")}),n.jsx("div",{className:"text-lg font-semibold text-foreground",children:l.summary.skip})]})]}),n.jsx("div",{className:"max-h-[420px] overflow-y-auto space-y-3 pr-1",children:d.map(c=>{const f=yt(c.action);return n.jsxs("div",{className:"rounded-lg border border-border px-4 py-3",children:[n.jsx("div",{className:"flex items-center justify-between gap-3",children:n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"truncate text-sm font-medium text-foreground",children:c.incoming.name}),n.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-[11px] font-medium ${f.className}`,children:r(f.label)})]}),n.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[z[c.incoming.agentType]??c.incoming.agentType," · ",n.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:c.incoming.id})]})]})}),c.action==="OVERWRITE"&&c.existing&&n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:r("将覆盖当前已有的 Provider:{name}",{name:c.existing.name})}),c.action==="SKIP"&&n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:r("当前同 ID Provider 配置一致,本次不会重复写入。")}),c.action==="CREATE"&&n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:r("当前不存在同 ID Provider,将直接新增。")})]},c.incoming.id)})})]})})}function Pt({item:e,onEdit:t,onDelete:l}){const{t:a}=_(),s=e.provider,i=e.availability,r=W(s.agentType,s.config),o=Object.entries(r).filter(([c])=>c!=="cmd"),d=Object.keys(s.env||{});return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("h3",{className:"text-base font-semibold text-foreground",children:s.name}),n.jsx(wt,{type:i.type})]}),n.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[n.jsx("span",{children:z[s.agentType]??s.agentType}),s.isDefault&&n.jsx("span",{className:"rounded-full bg-primary/[0.06] px-2 py-0.5 text-[11px] font-medium text-primary",children:a("默认")}),s.builtIn&&n.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:a("内置")})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsxs(N,{size:"sm",variant:"outline",onClick:t,children:[n.jsx(Ve,{size:13}),a("编辑")]}),n.jsxs(N,{size:"sm",variant:s.builtIn?"outline":"destructive",onClick:l,disabled:s.deletable===!1,children:[s.builtIn?n.jsx(Ze,{size:13}):n.jsx(ce,{size:13}),s.builtIn?a("恢复默认"):a("删除")]})]})]}),o.length>0&&n.jsxs("div",{children:[n.jsx(K,{className:"mb-3",children:a("运行配置")}),n.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-border bg-border/60",children:o.map(([c,f])=>n.jsxs("div",{className:"flex items-center gap-4 bg-background px-4 py-2.5",children:[n.jsx("span",{className:"w-32 shrink-0 text-[13px] text-muted-foreground",children:a(pt[c]??c)}),n.jsx("span",{className:"font-mono text-[13px] text-foreground",children:gt(c,f)})]},c))})]}),d.length>0&&n.jsxs("div",{children:[n.jsx(K,{className:"mb-3",children:a("环境变量")}),n.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-border bg-border/60",children:d.map(c=>n.jsxs("div",{className:"flex items-center gap-4 bg-background px-4 py-2.5",children:[n.jsx("span",{className:"font-mono text-[13px] text-foreground",children:c}),n.jsx("span",{className:"text-[13px] text-muted-foreground","aria-label":"hidden",children:"•••••"})]},c))})]}),s.settings?.trim()&&n.jsxs("div",{children:[n.jsx(K,{className:"mb-3",children:a("CLI 配置")}),n.jsx("div",{className:"rounded-lg border border-border bg-muted/40 p-4",children:n.jsx("pre",{className:"max-h-[200px] overflow-y-auto whitespace-pre-wrap break-all font-mono text-xs text-muted-foreground",children:s.settings})})]}),o.length===0&&d.length===0&&!s.settings?.trim()&&n.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:a('该 Provider 未配置额外参数。点击"编辑"添加运行配置、环境变量或 CLI 配置。')})]})}function Vt(){const{t:e}=_(),{data:t,isLoading:l}=Se(),a=Te(),s=Ae(),i=De(),r=Le(),o=Re(),d=Fe(),c=v.useRef(null),[f,j]=v.useState(null),[h,m]=v.useState(null),[x,y]=v.useState(null),[b,E]=v.useState(!1),[B,O]=v.useState(!1),[k,D]=v.useState(null),[me,G]=v.useState(!1),L=t??[];v.useEffect(()=>{!f&&L.length>0&&j(L[0].provider.id)},[L,f]);const xe=u=>{a.mutate(u,{onSuccess:()=>m(null),onError:g=>P.error(T(g,e("创建 Provider 失败")))})},fe=(u,g)=>{s.mutate({id:u,data:g},{onSuccess:()=>m(null),onError:C=>P.error(T(C,e("更新 Provider 失败")))})},pe=u=>{if(!(u.deletable??!u.builtIn)){P.error(e("系统内置 Provider 不可删除"));return}y({id:u.id,name:u.name,builtIn:u.builtIn})},he=()=>{x&&i.mutate(x.id,{onSuccess:()=>{P.success(x.builtIn?e("已恢复默认 Provider 配置"):e("Provider 已删除")),f===x.id&&j(null),y(null),G(!1)},onError:u=>P.error(T(u,e("删除 Provider 失败")))})},Q=()=>{E(!1),O(!1)},ee=()=>D(null),ge=()=>{r.mutate(void 0,{onSuccess:u=>{vt(bt(u.exportedAt),u),P.success(e("Provider 备份已导出")),Q()},onError:u=>P.error(T(u,e("导出 Provider 备份失败")))})},be=()=>{c.current&&(c.current.value="",c.current.click())},ve=async u=>{const g=u.target.files?.[0];if(u.target.value="",!g)return;let C;try{C=JSON.parse(await g.text())}catch{P.error(e("备份文件不是有效的 JSON"));return}o.mutate(C,{onSuccess:R=>D({backup:C,preview:R}),onError:R=>P.error(T(R,e("导入预览失败")))})},ye=()=>{k&&d.mutate(k.backup,{onSuccess:u=>{const g=u.summary.create+u.summary.overwrite;P.success(g===0?e("导入完成,当前配置无需变更"):e("导入完成:新增 {create},覆盖 {overwrite},跳过 {skip}",{create:u.summary.create,overwrite:u.summary.overwrite,skip:u.summary.skip})),ee()},onError:u=>P.error(T(u,e("导入 Provider 备份失败")))})},je=u=>{const g=u.provider,C=g.env?Object.entries(g.env).map(([R,we])=>({key:R,value:we})):[];m({id:g.id,data:{name:g.name,agentType:g.agentType,config:W(g.agentType,g.config),settings:g.settings??"",env:C,isDefault:g.isDefault}})};return l?n.jsx(te,{className:"max-w-5xl",children:n.jsx(Pe,{})}):n.jsxs(te,{className:"max-w-5xl",children:[n.jsx("input",{ref:c,type:"file",accept:".json,application/json",className:"hidden",onChange:ve}),n.jsx(Oe,{title:e("Agent 配置"),actions:n.jsxs(n.Fragment,{children:[n.jsxs(N,{variant:"outline",size:"sm",onClick:be,disabled:o.isPending||d.isPending,children:[n.jsx(Ke,{size:13}),e("导入")]}),n.jsxs(N,{variant:"outline",size:"sm",onClick:()=>E(!0),disabled:r.isPending,children:[n.jsx(Ye,{size:13}),e("导出")]}),n.jsxs(N,{size:"sm",onClick:()=>m({}),children:[n.jsx(Z,{size:13,className:"mr-1"}),e("新建")]})]})}),L.length===0?n.jsx(Ie,{icon:_e,message:e("暂无 Agent 配置"),action:n.jsxs(N,{size:"sm",onClick:()=>m({}),children:[n.jsx(Z,{size:13,className:"mr-1"}),e("新建配置")]})}):n.jsx(Ge,{items:L,selectedId:f,onSelectItem:u=>{j(u),G(!0)},getItemId:u=>u.provider.id,mobileShowDetail:me,onMobileBack:()=>G(!1),renderListItem:(u,g)=>{const C=u.provider;return n.jsxs(n.Fragment,{children:[n.jsx(jt,{type:u.availability.type}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-[13px] font-medium",children:C.name}),n.jsx("div",{className:S("truncate text-[11px]",g?"text-primary-foreground/60":"text-muted-foreground"),children:z[C.agentType]??C.agentType})]}),C.isDefault&&n.jsx("span",{className:S("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",g?"bg-white/20 text-primary-foreground":"bg-primary/[0.06] text-primary"),children:e("默认")})]})},renderDetail:u=>u?n.jsx("div",{className:"p-5",children:n.jsx(Pt,{item:u,onEdit:()=>je(u),onDelete:()=>pe(u.provider)})}):n.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:e("选择一个 Provider 查看详情")})}),h&&n.jsx(Ct,{isOpen:!0,onClose:()=>m(null),initialData:h.data,onSave:u=>{h.id?fe(h.id,u):xe(u)}}),n.jsx(Me,{isOpen:x!==null,onClose:()=>{i.isPending||y(null)},onConfirm:he,title:x?.builtIn?e("恢复默认 Provider"):e("删除 Provider"),description:x?.builtIn?e('确定删除 "{name}" 的自定义覆盖,并恢复系统默认配置?',{name:x?.name}):e('确定删除 "{name}"?此操作不可撤销。',{name:x?.name}),confirmText:x?.builtIn?e("恢复默认"):e("删除"),cancelText:e("取消"),variant:"danger",isLoading:i.isPending}),n.jsx(Et,{isOpen:b,onClose:Q,onConfirm:ge,acknowledged:B,onAcknowledgedChange:O,isLoading:r.isPending}),n.jsx(kt,{isOpen:!!k,onClose:ee,preview:k?.preview??null,backup:k?.backup??null,onConfirm:ye,isLoading:d.isPending})]})}export{Vt as ProviderSettingsPage};
@@ -1 +0,0 @@
1
- import{a0 as ln,a1 as an,a2 as H,a3 as q,a4 as B,a5 as un,a6 as y,a7 as tn,a8 as L,a9 as _,aa as rn,ab as o,ac as on,ad as sn,ae as fn}from"./index-C9hQg1KT.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(on(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)-un,c=A.apply(this,arguments)-un,F=rn(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=_(rn(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<an)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(fn((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-an/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};