junhost 0.2.1 → 0.2.4

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 (141) hide show
  1. package/bin/jun.js +55 -1
  2. package/dist/browser-mcp-server.js +1 -1
  3. package/dist/index.js +58 -59
  4. package/dist/mcp-server.js +11 -11
  5. package/package.json +1 -1
  6. package/ui-dist/assets/BrowserPage-SOejdSXd.js +1 -0
  7. package/ui-dist/assets/DashboardPage-DBSjArx4.js +1 -0
  8. package/ui-dist/assets/FilesPage-Co7w4yPV.js +64 -0
  9. package/ui-dist/assets/FormContext-CdQ9sDWR.js +1 -0
  10. package/ui-dist/assets/LogsPage-BPcYN5yl.js +1 -0
  11. package/ui-dist/assets/McpPage-DMSfd_bz.js +1 -0
  12. package/ui-dist/assets/MemoriesPage-BrZWQnNs.js +1 -0
  13. package/ui-dist/assets/{RunsPage-CK9pwAgz.js → RunsPage-DGPOmwHg.js} +50 -50
  14. package/ui-dist/assets/SchedulesPage-CGRBnO2D.js +1 -0
  15. package/ui-dist/assets/SettingsPage-C_hWawaj.js +1 -0
  16. package/ui-dist/assets/SkillsPage-CpF3t2F6.js +1 -0
  17. package/ui-dist/assets/api-DTaM-PBA.js +1 -0
  18. package/ui-dist/assets/architecture-7EHR7CIX-Dcu_L_tZ.js +1 -0
  19. package/ui-dist/assets/{architectureDiagram-3BPJPVTR-BP2MZYle.js → architectureDiagram-3BPJPVTR-CYwo6wbL.js} +1 -1
  20. package/ui-dist/assets/badge-Czi0QcSt.js +1 -0
  21. package/ui-dist/assets/{blockDiagram-GPEHLZMM-Af1ue8xv.js → blockDiagram-GPEHLZMM-ESzvgY_d.js} +1 -1
  22. package/ui-dist/assets/button-C5SbvNQM.js +1 -0
  23. package/ui-dist/assets/{c4Diagram-AAUBKEIU-AY7PqfkW.js → c4Diagram-AAUBKEIU-BFIF6RjX.js} +1 -1
  24. package/ui-dist/assets/channel-BCV_BwnR.js +1 -0
  25. package/ui-dist/assets/checkbox-CvgOimO2.js +1 -0
  26. package/ui-dist/assets/{chunk-2J33WTMH-h9HiYY_u.js → chunk-2J33WTMH-DHrqzPNv.js} +1 -1
  27. package/ui-dist/assets/{chunk-3OPIFGDE-BhRd3oVg.js → chunk-3OPIFGDE-D-OBfFax.js} +1 -1
  28. package/ui-dist/assets/{chunk-5ZQYHXKU-3UMjEqrw.js → chunk-5ZQYHXKU-D5zzqgKr.js} +1 -1
  29. package/ui-dist/assets/{chunk-727SXJPM-BcWt_3lo.js → chunk-727SXJPM-C3PXI115.js} +1 -1
  30. package/ui-dist/assets/{chunk-AQP2D5EJ-Cpch5yeN.js → chunk-AQP2D5EJ-Bpj50bQh.js} +1 -1
  31. package/ui-dist/assets/{chunk-BO2N2NFS-tci6_YFK.js → chunk-BO2N2NFS-CgXJ5x75.js} +4 -4
  32. package/ui-dist/assets/{chunk-CSCIHK7Q-B7WJrDNL.js → chunk-CSCIHK7Q-BtmPGR8Z.js} +3 -3
  33. package/ui-dist/assets/{chunk-KSCS5N6A-C_P0C3_7.js → chunk-KSCS5N6A-CopX8M46.js} +1 -1
  34. package/ui-dist/assets/{chunk-L5ZTLDWV-CgJ4GCaj.js → chunk-L5ZTLDWV-BviTnq5M.js} +1 -1
  35. package/ui-dist/assets/{chunk-LZXEDZCA-C2PsTcer.js → chunk-LZXEDZCA-BAENHcPD.js} +2 -2
  36. package/ui-dist/assets/{chunk-ND2GUHAM-CSipvS6t.js → chunk-ND2GUHAM-DZ9eeo3O.js} +1 -1
  37. package/ui-dist/assets/{chunk-NZK2D7GU-BmtPBmfa.js → chunk-NZK2D7GU-B-IcekpZ.js} +1 -1
  38. package/ui-dist/assets/{chunk-O5CBEL6O-DHg6U4bD.js → chunk-O5CBEL6O-uzui4fRc.js} +1 -1
  39. package/ui-dist/assets/{chunk-WU5MYG2G-Jao3JHnT.js → chunk-WU5MYG2G-CYvvOcUE.js} +1 -1
  40. package/ui-dist/assets/{circle-x-BSTd_gmE.js → circle-x-CAsSuVme.js} +1 -1
  41. package/ui-dist/assets/classDiagram-4FO5ZUOK-Dq-Bv-C-.js +1 -0
  42. package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-Dq-Bv-C-.js +1 -0
  43. package/ui-dist/assets/collapsible-DBUxLbzP.js +1 -0
  44. package/ui-dist/assets/{dagre-BM42HDAG-CmyaiNOn.js → dagre-BM42HDAG-BnZediLS.js} +1 -1
  45. package/ui-dist/assets/{diagram-2AECGRRQ-C8X3Dn_F.js → diagram-2AECGRRQ-R3SA74dj.js} +1 -1
  46. package/ui-dist/assets/{diagram-5GNKFQAL-D7FdDkBI.js → diagram-5GNKFQAL-BIFqDshR.js} +1 -1
  47. package/ui-dist/assets/{diagram-KO2AKTUF-DTvmbX9D.js → diagram-KO2AKTUF-BewO5gZn.js} +1 -1
  48. package/ui-dist/assets/{diagram-LMA3HP47-C4ytoinJ.js → diagram-LMA3HP47-VCDqO0nt.js} +1 -1
  49. package/ui-dist/assets/{diagram-OG6HWLK6-Ck8n45l9.js → diagram-OG6HWLK6-CqtMJ04I.js} +1 -1
  50. package/ui-dist/assets/dialog-DNn7-a_m.js +1 -0
  51. package/ui-dist/assets/{erDiagram-TEJ5UH35-DEdyi5kb.js → erDiagram-TEJ5UH35-DieBE3Rx.js} +1 -1
  52. package/ui-dist/assets/eventmodeling-FCH6USID-BSOzHW1O.js +1 -0
  53. package/ui-dist/assets/{external-link-DiZ5uX5z.js → external-link-DCXGJhiP.js} +1 -1
  54. package/ui-dist/assets/{flowDiagram-I6XJVG4X-DJh6JTpP.js → flowDiagram-I6XJVG4X-_gTMsbYe.js} +1 -1
  55. package/ui-dist/assets/{ganttDiagram-6RSMTGT7-40CbH6vs.js → ganttDiagram-6RSMTGT7-Ojxb0li0.js} +1 -1
  56. package/ui-dist/assets/{gitGraph-WXDBUCRP-Bb8N_3_Z.js → gitGraph-WXDBUCRP-CAGTBNn6.js} +1 -1
  57. package/ui-dist/assets/{gitGraphDiagram-PVQCEYII-CYO8lsXs.js → gitGraphDiagram-PVQCEYII-BCMq34-W.js} +1 -1
  58. package/ui-dist/assets/{highlighted-body-OFNGDK62-C9QojPJP.js → highlighted-body-OFNGDK62-CtSa94q8.js} +1 -1
  59. package/ui-dist/assets/{index-CZzHSXB1.css → index-CWOY_p-K.css} +1 -1
  60. package/ui-dist/assets/index-yyhnv7Ap.js +12 -0
  61. package/ui-dist/assets/{info-J43DQDTF-CuL2NM7A.js → info-J43DQDTF-gykbtpzn.js} +1 -1
  62. package/ui-dist/assets/{infoDiagram-5YYISTIA-BPLgO20D.js → infoDiagram-5YYISTIA-CAFjVe3v.js} +1 -1
  63. package/ui-dist/assets/input-CzAFDIdf.js +1 -0
  64. package/ui-dist/assets/{ishikawaDiagram-YF4QCWOH-CvaXogtI.js → ishikawaDiagram-YF4QCWOH-D3BdPtw9.js} +1 -1
  65. package/ui-dist/assets/{journeyDiagram-JHISSGLW-C1J-v-pE.js → journeyDiagram-JHISSGLW-BzT9Xthe.js} +1 -1
  66. package/ui-dist/assets/{kanban-definition-UN3LZRKU-CRmhIHz7.js → kanban-definition-UN3LZRKU-CQj8Taa5.js} +1 -1
  67. package/ui-dist/assets/katex-BX33ra8Y.js +1 -0
  68. package/ui-dist/assets/{key-round-D965pLEl.js → key-round-i_iJarVP.js} +1 -1
  69. package/ui-dist/assets/label-Bu19spuB.js +1 -0
  70. package/ui-dist/assets/{line-BdBKXCG0.js → line-BofMfFGW.js} +1 -1
  71. package/ui-dist/assets/mermaid-GHXKKRXX-CJkN8RLl.js +1 -0
  72. package/ui-dist/assets/{mermaid-parser.core-BS-vIFlR.js → mermaid-parser.core-B-NMEyis.js} +2 -2
  73. package/ui-dist/assets/{mindmap-definition-RKZ34NQL-1LEnd-Xo.js → mindmap-definition-RKZ34NQL-Co7nZa8L.js} +1 -1
  74. package/ui-dist/assets/{packet-YPE3B663-BYcxKrId.js → packet-YPE3B663-CUHl-3-z.js} +1 -1
  75. package/ui-dist/assets/{pause-h76ixDr5.js → pause-DhMeMeEd.js} +1 -1
  76. package/ui-dist/assets/{pie-LRSECV5Y-DYSxmFzY.js → pie-LRSECV5Y-66vPnpWw.js} +1 -1
  77. package/ui-dist/assets/{pieDiagram-4H26LBE5-EqE8umht.js → pieDiagram-4H26LBE5-anqqKj6T.js} +1 -1
  78. package/ui-dist/assets/play-D3mjFMmX.js +1 -0
  79. package/ui-dist/assets/{quadrantDiagram-W4KKPZXB-CEBlRqkN.js → quadrantDiagram-W4KKPZXB-CH1Wkvzf.js} +1 -1
  80. package/ui-dist/assets/{radar-GUYGQ44K-DloreDUf.js → radar-GUYGQ44K-C-aSbLx7.js} +1 -1
  81. package/ui-dist/assets/{requirementDiagram-4Y6WPE33-BtG32uo4.js → requirementDiagram-4Y6WPE33-BXgFmUPx.js} +1 -1
  82. package/ui-dist/assets/{rotate-cw-B1ZRM7VI.js → rotate-cw-BUTALXBe.js} +1 -1
  83. package/ui-dist/assets/{sankeyDiagram-5OEKKPKP-LFkiQmlj.js → sankeyDiagram-5OEKKPKP-BZJiw-wH.js} +1 -1
  84. package/ui-dist/assets/search-CKqhWG6h.js +1 -0
  85. package/ui-dist/assets/select-s2HSAntK.js +1 -0
  86. package/ui-dist/assets/{sequenceDiagram-3UESZ5HK-BFABrHKQ.js → sequenceDiagram-3UESZ5HK-C6ZDPDNO.js} +1 -1
  87. package/ui-dist/assets/square-COjZqkOL.js +1 -0
  88. package/ui-dist/assets/{stateDiagram-AJRCARHV-UZadGigl.js → stateDiagram-AJRCARHV-BNz2d_tV.js} +1 -1
  89. package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-C7n6nn-m.js +1 -0
  90. package/ui-dist/assets/tabs-grE19_AL.js +1 -0
  91. package/ui-dist/assets/textarea-CwL3B5t5.js +1 -0
  92. package/ui-dist/assets/{timeline-definition-PNZ67QCA-B0GbqI20.js → timeline-definition-PNZ67QCA-Ctli85zn.js} +1 -1
  93. package/ui-dist/assets/{trash-2-D4CnL8wv.js → trash-2-D5W0vize.js} +1 -1
  94. package/ui-dist/assets/{treeView-BLDUP644-COM1up3U.js → treeView-BLDUP644-DsKAQvGU.js} +1 -1
  95. package/ui-dist/assets/{treemap-LRROVOQU-CWvutEBH.js → treemap-LRROVOQU-DabIXs6O.js} +1 -1
  96. package/ui-dist/assets/useBaseUiId-DL38u1cQ.js +1 -0
  97. package/ui-dist/assets/useButton-kcIJA9wR.js +1 -0
  98. package/ui-dist/assets/useCompositeListItem-I_fNdF1_.js +1 -0
  99. package/ui-dist/assets/useRegisterFieldControl-DOObtV36.js +1 -0
  100. package/ui-dist/assets/{vennDiagram-CIIHVFJN-BU2bLP3c.js → vennDiagram-CIIHVFJN-DYyyOGXD.js} +1 -1
  101. package/ui-dist/assets/{wardley-L42UT6IY-DiQe6mxF.js → wardley-L42UT6IY-4pZOEfsT.js} +1 -1
  102. package/ui-dist/assets/{wardleyDiagram-YWT4CUSO-D4BuSn5f.js → wardleyDiagram-YWT4CUSO-Ba6H_8tB.js} +1 -1
  103. package/ui-dist/assets/{xychartDiagram-2RQKCTM6-CcKf_YnL.js → xychartDiagram-2RQKCTM6-DQSqwpal.js} +1 -1
  104. package/ui-dist/index.html +4 -4
  105. package/ui-dist/assets/BrowserPage-vw54Zy8i.js +0 -1
  106. package/ui-dist/assets/DashboardPage-Fae7MOCk.js +0 -1
  107. package/ui-dist/assets/FilesPage-DGMWNSyG.js +0 -64
  108. package/ui-dist/assets/FormContext-6Ydu-jal.js +0 -1
  109. package/ui-dist/assets/LogsPage-ChoGgfAX.js +0 -1
  110. package/ui-dist/assets/McpPage-CZ_0PAsI.js +0 -1
  111. package/ui-dist/assets/MemoriesPage-j2hFZJtC.js +0 -1
  112. package/ui-dist/assets/SchedulesPage-BdOov1_M.js +0 -1
  113. package/ui-dist/assets/SettingsPage-BawGPDde.js +0 -1
  114. package/ui-dist/assets/SkillsPage-BoDc74ND.js +0 -1
  115. package/ui-dist/assets/architecture-7EHR7CIX-4fzAtq46.js +0 -1
  116. package/ui-dist/assets/badge-DjyNiZCE.js +0 -1
  117. package/ui-dist/assets/button-Cg-0y2B2.js +0 -1
  118. package/ui-dist/assets/channel-COgxKgTn.js +0 -1
  119. package/ui-dist/assets/checkbox-B77q6yf0.js +0 -1
  120. package/ui-dist/assets/classDiagram-4FO5ZUOK-CxJD7YbT.js +0 -1
  121. package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-CxJD7YbT.js +0 -1
  122. package/ui-dist/assets/collapsible-CP1QD5GK.js +0 -1
  123. package/ui-dist/assets/dialog-CPRWiMQj.js +0 -1
  124. package/ui-dist/assets/eventmodeling-FCH6USID-CZSE8Xfh.js +0 -1
  125. package/ui-dist/assets/index-CqEDC1ie.js +0 -12
  126. package/ui-dist/assets/input-B0qeLI2E.js +0 -1
  127. package/ui-dist/assets/katex--eycYE9W.js +0 -1
  128. package/ui-dist/assets/label-CxX4-RmK.js +0 -1
  129. package/ui-dist/assets/mermaid-GHXKKRXX-CvI11iBs.js +0 -1
  130. package/ui-dist/assets/play-B4R5rXMZ.js +0 -1
  131. package/ui-dist/assets/search-09Pme-NO.js +0 -1
  132. package/ui-dist/assets/select-CF2SUxSi.js +0 -1
  133. package/ui-dist/assets/square-_9cV5Fet.js +0 -1
  134. package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-BeslXd68.js +0 -1
  135. package/ui-dist/assets/tabs-CpVOS0Mr.js +0 -1
  136. package/ui-dist/assets/textarea-5JHEEgU-.js +0 -1
  137. package/ui-dist/assets/useBaseUiId-dSIElxm7.js +0 -1
  138. package/ui-dist/assets/useButton-DKtiRcm8.js +0 -1
  139. package/ui-dist/assets/useCompositeListItem-CJiAiQsj.js +0 -1
  140. package/ui-dist/assets/useRegisterFieldControl-CbOBCC3j.js +0 -1
  141. package/ui-dist/assets/utils-BX1Diber.js +0 -1
@@ -1,4 +1,4 @@
1
- import{g as e,h as t}from"./src-D-NMWEou.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,v as l,w as u,x as d,y as f}from"./chunk-CSCIHK7Q-B7WJrDNL.js";import{i as p}from"./chunk-5ZQYHXKU-3UMjEqrw.js";import{t as m}from"./chunk-WU5MYG2G-Jao3JHnT.js";import{t as h}from"./mermaid-parser.core-BS-vIFlR.js";import{t as g}from"./chunk-4BX2VUAB-C0kf5ycP.js";var _=t((e,t)=>{let n=e<=1?e*100:e;if(n<0||n>100)throw Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return n},`toPercent`),v=t((e,t,n)=>({x:_(t,`${n} evolution`),y:_(e,`${n} visibility`)}),`toCoordinates`),y=t(e=>{if(e){if(e===`+<>`)return`bidirectional`;if(e===`+<`)return`backward`;if(e===`+>`)return`forward`}},`getFlowFromPort`),b=t(e=>{if(!e?.startsWith(`+`))return{};let t=/^\+'([^']*)'/.exec(e)?.[1];return e.includes(`<>`)?{flow:`bidirectional`,label:t}:e.includes(`<`)?{flow:`backward`,label:t}:e.includes(`>`)?{flow:`forward`,label:t}:{label:t}},`extractFlowFromArrow`),x=t((e,t)=>{if(g(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let n=e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),r=e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary);t.updateAxes({stages:n,stageBoundaries:r})}if(e.anchors.forEach(e=>{let n=v(e.visibility,e.evolution,`Anchor "${e.name}"`);t.addNode(e.name,e.name,n.x,n.y,`anchor`)}),e.components.forEach(e=>{let n=v(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,a=e.decorator?.strategy;t.addNode(e.name,e.name,n.x,n.y,`component`,r,i,e.inertia,a)}),e.notes.forEach(e=>{let n=v(e.visibility,e.evolution,`Note "${e.text}"`);t.addNote(e.text,n.x,n.y)}),e.pipelines.forEach(e=>{let n=t.getNode(e.parent);if(!n||typeof n.y!=`number`)throw Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);let r=n.y;t.startPipeline(e.parent),e.components.forEach(n=>{let i=`${e.parent}_${n.name}`,a=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,o=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,s=_(n.evolution,`Pipeline component "${n.name}" evolution`);t.addNode(i,n.name,s,r,`pipeline-component`,a,o),t.addPipelineComponent(e.parent,i)})}),e.links.forEach(e=>{let n=!!e.arrow&&(e.arrow.includes(`-.->`)||e.arrow.includes(`.-.`)),r=y(e.fromPort)??y(e.toPort),{flow:i,label:a}=b(e.arrow);!r&&i&&(r=i);let o=e.linkLabel,s=a??o;t.addLink(t.resolveNodeId(e.from),t.resolveNodeId(e.to),n,s,r)}),e.evolves.forEach(e=>{let n=t.getNode(e.component);if(n?.y!==void 0){let r=_(e.target,`Evolve target for "${e.component}"`);t.addTrend(e.component,r,n.y)}}),e.annotations.length>0){let n=e.annotations[0],r=v(n.x,n.y,`Annotations box`);t.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(e=>{let n=v(e.x,e.y,`Annotation ${e.number}`);t.addAnnotation(e.number,[{x:n.x,y:n.y}],e.text)}),e.accelerators.forEach(e=>{let n=v(e.x,e.y,`Accelerator "${e.name}"`);t.addAccelerator(e.name,n.x,n.y)}),e.deaccelerators.forEach(e=>{let n=v(e.x,e.y,`Deaccelerator "${e.name}"`);t.addDeaccelerator(e.name,n.x,n.y)})},`populateDb`),S={parser:{yy:void 0},parse:t(async t=>{let n=await h(`wardley`,t);e.debug(n);let r=S.parser?.yy;if(!r||typeof r.addNode!=`function`)throw 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.`);x(n,r)},`parse`)},C=new 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={}}static{t(this,`WardleyBuilder`)}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},n={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,n)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let n=this.pipelines.get(e);n&&n.componentIds.push(t);let r=this.nodes.get(t);r&&(r.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,n]of this.nodes)if(n.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,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}};function w(){return d()[`wardley-beta`]}t(w,`getConfig`);function T(e,t,n,r,i,a,o,s,c){C.addNode({id:e,label:t,x:n,y:r,className:i,labelOffsetX:a,labelOffsetY:o,inertia:s,sourceStrategy:c})}t(T,`addNode`);function E(e,t,n=!1,r,i){C.addLink({source:e,target:t,dashed:n,label:r,flow:i})}t(E,`addLink`);function D(e,t,n){C.addTrend({nodeId:e,targetX:t,targetY:n})}t(D,`addTrend`);function O(e,t,n){C.addAnnotation({number:e,coordinates:t,text:n})}t(O,`addAnnotation`);function k(e,t,n){C.addNote({text:e,x:t,y:n})}t(k,`addNote`);function A(e,t,n){C.addAccelerator({name:e,x:t,y:n})}t(A,`addAccelerator`);function j(e,t,n){C.addDeaccelerator({name:e,x:t,y:n})}t(j,`addDeaccelerator`);function M(e,t){C.setAnnotationsBox(e,t)}t(M,`setAnnotationsBox`);function N(e,t){C.setSize(e,t)}t(N,`setSize`);function P(e){C.startPipeline(e)}t(P,`startPipeline`);function F(e,t){C.addPipelineComponent(e,t)}t(F,`addPipelineComponent`);function I(e){C.setAxes(e)}t(I,`updateAxes`);function L(e){return C.getNode(e)}t(L,`getNode`);function R(e){return C.resolveNodeId(e)}t(R,`resolveNodeId`);function z(){return C.build()}t(z,`getWardleyData`);function B(){C.clear(),o()}t(B,`clear`);var V={getConfig:w,addNode:T,addLink:E,addTrend:D,addAnnotation:O,addNote:k,addAccelerator:A,addDeaccelerator:j,setAnnotationsBox:M,setSize:N,startPipeline:P,addPipelineComponent:F,updateAxes:I,getNode:L,resolveNodeId:R,getWardleyData:z,clear:B,setAccTitle:a,getAccTitle:f,setDiagramTitle:i,getDiagramTitle:u,getAccDescription:l,setAccDescription:r},H=[`Genesis`,`Custom Built`,`Product`,`Commodity`],U=t(()=>{let{themeVariables:e}=d();return{backgroundColor:e.wardley?.backgroundColor??e.background??`#fff`,axisColor:e.wardley?.axisColor??`#000`,axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??`#222`,gridColor:e.wardley?.gridColor??`rgba(100, 100, 100, 0.2)`,componentFill:e.wardley?.componentFill??`#fff`,componentStroke:e.wardley?.componentStroke??`#000`,componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??`#222`,linkStroke:e.wardley?.linkStroke??`#000`,evolutionStroke:e.wardley?.evolutionStroke??`#dc3545`,annotationStroke:e.wardley?.annotationStroke??`#000`,annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??`#222`,annotationFill:e.wardley?.annotationFill??e.background??`#fff`}},`getTheme`),W=t(()=>{let e=d()[`wardley-beta`];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},`getConfigValues`),G={parser:S,db:V,renderer:{draw:t((n,r,i,a)=>{e.debug(`Rendering Wardley map
1
+ import{g as e,h as t}from"./src-D-NMWEou.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,v as l,w as u,x as d,y as f}from"./chunk-CSCIHK7Q-BtmPGR8Z.js";import{i as p}from"./chunk-5ZQYHXKU-D5zzqgKr.js";import{t as m}from"./chunk-WU5MYG2G-CYvvOcUE.js";import{t as h}from"./mermaid-parser.core-B-NMEyis.js";import{t as g}from"./chunk-4BX2VUAB-C0kf5ycP.js";var _=t((e,t)=>{let n=e<=1?e*100:e;if(n<0||n>100)throw Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return n},`toPercent`),v=t((e,t,n)=>({x:_(t,`${n} evolution`),y:_(e,`${n} visibility`)}),`toCoordinates`),y=t(e=>{if(e){if(e===`+<>`)return`bidirectional`;if(e===`+<`)return`backward`;if(e===`+>`)return`forward`}},`getFlowFromPort`),b=t(e=>{if(!e?.startsWith(`+`))return{};let t=/^\+'([^']*)'/.exec(e)?.[1];return e.includes(`<>`)?{flow:`bidirectional`,label:t}:e.includes(`<`)?{flow:`backward`,label:t}:e.includes(`>`)?{flow:`forward`,label:t}:{label:t}},`extractFlowFromArrow`),x=t((e,t)=>{if(g(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let n=e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),r=e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary);t.updateAxes({stages:n,stageBoundaries:r})}if(e.anchors.forEach(e=>{let n=v(e.visibility,e.evolution,`Anchor "${e.name}"`);t.addNode(e.name,e.name,n.x,n.y,`anchor`)}),e.components.forEach(e=>{let n=v(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,a=e.decorator?.strategy;t.addNode(e.name,e.name,n.x,n.y,`component`,r,i,e.inertia,a)}),e.notes.forEach(e=>{let n=v(e.visibility,e.evolution,`Note "${e.text}"`);t.addNote(e.text,n.x,n.y)}),e.pipelines.forEach(e=>{let n=t.getNode(e.parent);if(!n||typeof n.y!=`number`)throw Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);let r=n.y;t.startPipeline(e.parent),e.components.forEach(n=>{let i=`${e.parent}_${n.name}`,a=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,o=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,s=_(n.evolution,`Pipeline component "${n.name}" evolution`);t.addNode(i,n.name,s,r,`pipeline-component`,a,o),t.addPipelineComponent(e.parent,i)})}),e.links.forEach(e=>{let n=!!e.arrow&&(e.arrow.includes(`-.->`)||e.arrow.includes(`.-.`)),r=y(e.fromPort)??y(e.toPort),{flow:i,label:a}=b(e.arrow);!r&&i&&(r=i);let o=e.linkLabel,s=a??o;t.addLink(t.resolveNodeId(e.from),t.resolveNodeId(e.to),n,s,r)}),e.evolves.forEach(e=>{let n=t.getNode(e.component);if(n?.y!==void 0){let r=_(e.target,`Evolve target for "${e.component}"`);t.addTrend(e.component,r,n.y)}}),e.annotations.length>0){let n=e.annotations[0],r=v(n.x,n.y,`Annotations box`);t.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(e=>{let n=v(e.x,e.y,`Annotation ${e.number}`);t.addAnnotation(e.number,[{x:n.x,y:n.y}],e.text)}),e.accelerators.forEach(e=>{let n=v(e.x,e.y,`Accelerator "${e.name}"`);t.addAccelerator(e.name,n.x,n.y)}),e.deaccelerators.forEach(e=>{let n=v(e.x,e.y,`Deaccelerator "${e.name}"`);t.addDeaccelerator(e.name,n.x,n.y)})},`populateDb`),S={parser:{yy:void 0},parse:t(async t=>{let n=await h(`wardley`,t);e.debug(n);let r=S.parser?.yy;if(!r||typeof r.addNode!=`function`)throw 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.`);x(n,r)},`parse`)},C=new 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={}}static{t(this,`WardleyBuilder`)}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},n={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,n)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let n=this.pipelines.get(e);n&&n.componentIds.push(t);let r=this.nodes.get(t);r&&(r.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,n]of this.nodes)if(n.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,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}};function w(){return d()[`wardley-beta`]}t(w,`getConfig`);function T(e,t,n,r,i,a,o,s,c){C.addNode({id:e,label:t,x:n,y:r,className:i,labelOffsetX:a,labelOffsetY:o,inertia:s,sourceStrategy:c})}t(T,`addNode`);function E(e,t,n=!1,r,i){C.addLink({source:e,target:t,dashed:n,label:r,flow:i})}t(E,`addLink`);function D(e,t,n){C.addTrend({nodeId:e,targetX:t,targetY:n})}t(D,`addTrend`);function O(e,t,n){C.addAnnotation({number:e,coordinates:t,text:n})}t(O,`addAnnotation`);function k(e,t,n){C.addNote({text:e,x:t,y:n})}t(k,`addNote`);function A(e,t,n){C.addAccelerator({name:e,x:t,y:n})}t(A,`addAccelerator`);function j(e,t,n){C.addDeaccelerator({name:e,x:t,y:n})}t(j,`addDeaccelerator`);function M(e,t){C.setAnnotationsBox(e,t)}t(M,`setAnnotationsBox`);function N(e,t){C.setSize(e,t)}t(N,`setSize`);function P(e){C.startPipeline(e)}t(P,`startPipeline`);function F(e,t){C.addPipelineComponent(e,t)}t(F,`addPipelineComponent`);function I(e){C.setAxes(e)}t(I,`updateAxes`);function L(e){return C.getNode(e)}t(L,`getNode`);function R(e){return C.resolveNodeId(e)}t(R,`resolveNodeId`);function z(){return C.build()}t(z,`getWardleyData`);function B(){C.clear(),o()}t(B,`clear`);var V={getConfig:w,addNode:T,addLink:E,addTrend:D,addAnnotation:O,addNote:k,addAccelerator:A,addDeaccelerator:j,setAnnotationsBox:M,setSize:N,startPipeline:P,addPipelineComponent:F,updateAxes:I,getNode:L,resolveNodeId:R,getWardleyData:z,clear:B,setAccTitle:a,getAccTitle:f,setDiagramTitle:i,getDiagramTitle:u,getAccDescription:l,setAccDescription:r},H=[`Genesis`,`Custom Built`,`Product`,`Commodity`],U=t(()=>{let{themeVariables:e}=d();return{backgroundColor:e.wardley?.backgroundColor??e.background??`#fff`,axisColor:e.wardley?.axisColor??`#000`,axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??`#222`,gridColor:e.wardley?.gridColor??`rgba(100, 100, 100, 0.2)`,componentFill:e.wardley?.componentFill??`#fff`,componentStroke:e.wardley?.componentStroke??`#000`,componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??`#222`,linkStroke:e.wardley?.linkStroke??`#000`,evolutionStroke:e.wardley?.evolutionStroke??`#dc3545`,annotationStroke:e.wardley?.annotationStroke??`#000`,annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??`#222`,annotationFill:e.wardley?.annotationFill??e.background??`#fff`}},`getTheme`),W=t(()=>{let e=d()[`wardley-beta`];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},`getConfigValues`),G={parser:S,db:V,renderer:{draw:t((n,r,i,a)=>{e.debug(`Rendering Wardley map
2
2
  `+n);let o=W(),s=U(),l=o.nodeRadius*1.6,u=a.db,d=u.getWardleyData(),f=u.getDiagramTitle(),p=d.size?.width??o.width,h=d.size?.height??o.height,g=m(r);g.selectAll(`*`).remove(),c(g,h,p,o.useMaxWidth),g.attr(`viewBox`,`0 0 ${p} ${h}`);let _=g.append(`g`).attr(`class`,`wardley-map`),v=g.append(`defs`);v.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`,s.evolutionStroke).attr(`stroke`,`none`),v.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`,s.linkStroke).attr(`stroke`,`none`),v.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`,s.linkStroke).attr(`stroke`,`none`),_.append(`rect`).attr(`class`,`wardley-background`).attr(`width`,p).attr(`height`,h).attr(`fill`,s.backgroundColor);let y=p-o.padding*2,b=h-o.padding*2;f&&_.append(`text`).attr(`class`,`wardley-title`).attr(`x`,p/2).attr(`y`,o.padding/2).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize*1.05).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(f);let x=t(e=>o.padding+e/100*y,`projectX`),S=t(e=>h-o.padding-e/100*b,`projectY`),C=_.append(`g`).attr(`class`,`wardley-axes`);C.append(`line`).attr(`x1`,o.padding).attr(`x2`,p-o.padding).attr(`y1`,h-o.padding).attr(`y2`,h-o.padding).attr(`stroke`,s.axisColor).attr(`stroke-width`,1),C.append(`line`).attr(`x1`,o.padding).attr(`x2`,o.padding).attr(`y1`,o.padding).attr(`y2`,h-o.padding).attr(`stroke`,s.axisColor).attr(`stroke-width`,1);let w=d.axes.xLabel??`Evolution`,T=d.axes.yLabel??`Visibility`;C.append(`text`).attr(`class`,`wardley-axis-label wardley-axis-label-x`).attr(`x`,o.padding+y/2).attr(`y`,h-o.padding/4).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).text(w),C.append(`text`).attr(`class`,`wardley-axis-label wardley-axis-label-y`).attr(`x`,o.padding/3).attr(`y`,o.padding+b/2).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).attr(`transform`,`rotate(-90 ${o.padding/3} ${o.padding+b/2})`).text(T);let E=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:H;if(E.length>0){let e=_.append(`g`).attr(`class`,`wardley-stages`),t=d.axes.stageBoundaries,n=[];if(t&&t.length===E.length){let e=0;t.forEach(t=>{n.push({start:e,end:t}),e=t})}else{let e=1/E.length;E.forEach((t,r)=>{n.push({start:r*e,end:(r+1)*e})})}E.forEach((t,r)=>{let i=n[r],a=o.padding+i.start*y,c=(a+(o.padding+i.end*y))/2;r>0&&e.append(`line`).attr(`x1`,a).attr(`x2`,a).attr(`y1`,o.padding).attr(`y2`,h-o.padding).attr(`stroke`,`#000`).attr(`stroke-width`,1).attr(`stroke-dasharray`,`5 5`).attr(`opacity`,.8),e.append(`text`).attr(`class`,`wardley-stage-label`).attr(`x`,c).attr(`y`,h-o.padding/1.5).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize-2).attr(`text-anchor`,`middle`).text(t)})}if(o.showGrid){let e=_.append(`g`).attr(`class`,`wardley-grid`);for(let t=1;t<4;t++){let n=t/4,r=o.padding+y*n;e.append(`line`).attr(`x1`,r).attr(`x2`,r).attr(`y1`,o.padding).attr(`y2`,h-o.padding).attr(`stroke`,s.gridColor).attr(`stroke-dasharray`,`2 6`),e.append(`line`).attr(`x1`,o.padding).attr(`x2`,p-o.padding).attr(`y1`,h-o.padding-b*n).attr(`y2`,h-o.padding-b*n).attr(`stroke`,s.gridColor).attr(`stroke-dasharray`,`2 6`)}}let D=new Map;if(d.nodes.forEach(e=>{D.set(e.id,{x:x(e.x),y:S(e.y),node:e})}),d.pipelines.length>0){let e=_.append(`g`).attr(`class`,`wardley-pipelines`),t=_.append(`g`).attr(`class`,`wardley-pipeline-links`);d.pipelines.forEach(n=>{if(n.componentIds.length===0)return;let r=n.componentIds.map(e=>({id:e,pos:D.get(e),node:d.nodes.find(t=>t.id===e)})).filter(e=>e.pos&&e.node).sort((e,t)=>e.node.x-t.node.x);for(let e=0;e<r.length-1;e++){let n=r[e],i=r[e+1];t.append(`line`).attr(`class`,`wardley-pipeline-evolution-link`).attr(`x1`,n.pos.x).attr(`y1`,n.pos.y).attr(`x2`,i.pos.x).attr(`y2`,i.pos.y).attr(`stroke`,s.linkStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,`4 4`)}let i=1/0,a=-1/0,c=0;if(n.componentIds.forEach(e=>{let t=D.get(e);t&&(i=Math.min(i,t.x),a=Math.max(a,t.x),c=t.y)}),i!==1/0&&a!==-1/0){let t=o.nodeRadius*4,r=c-t/2,u=D.get(n.nodeId);u&&(u.x=(i+a)/2,u.y=r-l/6),e.append(`rect`).attr(`class`,`wardley-pipeline-box`).attr(`x`,i-15).attr(`y`,r).attr(`width`,a-i+30).attr(`height`,t).attr(`fill`,`none`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`rx`,4).attr(`ry`,4)}})}let O=_.append(`g`).attr(`class`,`wardley-links`),k=new Map;d.pipelines.forEach(e=>{k.set(e.nodeId,new Set(e.componentIds))});let A=d.links.filter(e=>!(!D.has(e.source)||!D.has(e.target)||k.get(e.target)?.has(e.source)));O.selectAll(`line`).data(A).enter().append(`line`).attr(`class`,e=>`wardley-link${e.dashed?` wardley-link--dashed`:``}`).attr(`x1`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.source).isPipelineParent?l/Math.sqrt(2):o.nodeRadius,i=n.x-t.x,a=n.y-t.y,s=Math.sqrt(i*i+a*a);return t.x+i/s*r}).attr(`y1`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.source).isPipelineParent?l/Math.sqrt(2):o.nodeRadius,i=n.x-t.x,a=n.y-t.y,s=Math.sqrt(i*i+a*a);return t.y+a/s*r}).attr(`x2`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.target).isPipelineParent?l/Math.sqrt(2):o.nodeRadius,i=t.x-n.x,a=t.y-n.y,s=Math.sqrt(i*i+a*a);return n.x+i/s*r}).attr(`y2`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.target).isPipelineParent?l/Math.sqrt(2):o.nodeRadius,i=t.x-n.x,a=t.y-n.y,s=Math.sqrt(i*i+a*a);return n.y+a/s*r}).attr(`stroke`,s.linkStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,e=>e.dashed?`6 6`:null).attr(`marker-end`,e=>e.flow===`forward`||e.flow===`bidirectional`?`url(#link-arrow-end-${r})`:null).attr(`marker-start`,e=>e.flow===`backward`||e.flow===`bidirectional`?`url(#link-arrow-start-${r})`:null),O.selectAll(`text`).data(A.filter(e=>e.label)).enter().append(`text`).attr(`class`,`wardley-link-label`).attr(`x`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.x+n.x)/2,i=n.y-t.y,a=n.x-t.x;return r+i/Math.sqrt(a*a+i*i)*8}).attr(`y`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.y+n.y)/2,i=n.x-t.x,a=n.y-t.y,o=Math.sqrt(i*i+a*a);return r+-i/o*8}).attr(`fill`,s.axisTextColor).attr(`font-size`,o.labelFontSize).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).attr(`transform`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.x+n.x)/2,i=(t.y+n.y)/2,a=n.x-t.x,o=n.y-t.y,s=Math.sqrt(a*a+o*o),c=o/s,l=-a/s,u=r+c*8,d=i+l*8,f=Math.atan2(o,a)*180/Math.PI;return(f>90||f<-90)&&(f+=180),`rotate(${f} ${u} ${d})`}).text(e=>e.label);let j=_.append(`g`).attr(`class`,`wardley-trends`),M=d.trends.map(e=>{let t=D.get(e.nodeId);if(!t)return null;let n=x(e.targetX),r=S(e.targetY),i=n-t.x,a=r-t.y,s=Math.sqrt(i*i+a*a),c=o.nodeRadius+2;return{origin:t,targetX:n,targetY:r,adjustedX2:s>c?n-i/s*c:n,adjustedY2:s>c?r-a/s*c:r}}).filter(e=>e!==null);j.selectAll(`line`).data(M).enter().append(`line`).attr(`class`,`wardley-trend`).attr(`x1`,e=>e.origin.x).attr(`y1`,e=>e.origin.y).attr(`x2`,e=>e.adjustedX2).attr(`y2`,e=>e.adjustedY2).attr(`stroke`,s.evolutionStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,`4 4`).attr(`marker-end`,`url(#arrow-${r})`);let N=_.append(`g`).attr(`class`,`wardley-nodes`).selectAll(`g`).data(d.nodes).enter().append(`g`).attr(`class`,e=>[`wardley-node`,e.className?`wardley-node--${e.className}`:``].filter(Boolean).join(` `));N.filter(e=>e.sourceStrategy===`outsource`).append(`circle`).attr(`class`,`wardley-outsource-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#666`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.sourceStrategy===`buy`).append(`circle`).attr(`class`,`wardley-buy-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#ccc`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.sourceStrategy===`build`).append(`circle`).attr(`class`,`wardley-build-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#eee`).attr(`stroke`,`#000`).attr(`stroke-width`,1);let P=N.filter(e=>e.sourceStrategy===`market`);P.append(`circle`).attr(`class`,`wardley-market-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>!e.isPipelineParent&&e.sourceStrategy!==`market`&&e.className!==`anchor`).append(`circle`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius).attr(`fill`,s.componentFill).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1);let F=o.nodeRadius*.7,I=o.nodeRadius*1.2;if(P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x).attr(`y1`,e=>D.get(e.id).y-I).attr(`x2`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`y2`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`y1`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`x2`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`y2`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`y1`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`x2`,e=>D.get(e.id).x).attr(`y2`,e=>D.get(e.id).y-I).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y-I).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`cy`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`cy`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),N.filter(e=>e.isPipelineParent===!0).append(`rect`).attr(`x`,e=>D.get(e.id).x-l/2).attr(`y`,e=>D.get(e.id).y-l/2).attr(`width`,l).attr(`height`,l).attr(`fill`,s.componentFill).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.inertia===!0).append(`line`).attr(`class`,`wardley-inertia`).attr(`x1`,e=>{let t=D.get(e.id),n=e.isPipelineParent?l/2+15:o.nodeRadius+15;return e.sourceStrategy&&(n+=o.nodeRadius+10),t.x+n}).attr(`y1`,e=>{let t=D.get(e.id),n=e.isPipelineParent?l:o.nodeRadius*2;return t.y-n/2}).attr(`x2`,e=>{let t=D.get(e.id),n=e.isPipelineParent?l/2+15:o.nodeRadius+15;return e.sourceStrategy&&(n+=o.nodeRadius+10),t.x+n}).attr(`y2`,e=>{let t=D.get(e.id),n=e.isPipelineParent?l:o.nodeRadius*2;return t.y+n/2}).attr(`stroke`,s.componentStroke).attr(`stroke-width`,6),N.append(`text`).attr(`x`,e=>{let t=D.get(e.id);if(e.className===`anchor`)return e.labelOffsetX===void 0?t.x:t.x+e.labelOffsetX;let n=o.nodeLabelOffset;e.sourceStrategy&&e.labelOffsetX===void 0&&(n+=10);let r=e.labelOffsetX??n;return t.x+r}).attr(`y`,e=>{let t=D.get(e.id);if(e.className===`anchor`)return e.labelOffsetY===void 0?t.y-3:t.y+e.labelOffsetY;let n=-o.nodeLabelOffset;e.sourceStrategy&&e.labelOffsetY===void 0&&(n-=10);let r=e.labelOffsetY??n;return t.y+r}).attr(`class`,`wardley-node-label`).attr(`fill`,e=>e.className===`evolved`?s.evolutionStroke:e.className===`anchor`?`#000`:s.componentLabelColor).attr(`font-size`,o.labelFontSize).attr(`font-weight`,e=>e.className===`anchor`?`bold`:`normal`).attr(`text-anchor`,e=>e.className===`anchor`?`middle`:`start`).attr(`dominant-baseline`,e=>e.className===`anchor`?`middle`:`auto`).text(e=>e.label),d.annotations.length>0){let e=_.append(`g`).attr(`class`,`wardley-annotations`);if(d.annotations.forEach(t=>{let n=t.coordinates.map(e=>({x:x(e.x),y:S(e.y)}));if(n.length>1)for(let t=0;t<n.length-1;t++)e.append(`line`).attr(`class`,`wardley-annotation-line`).attr(`x1`,n[t].x).attr(`y1`,n[t].y).attr(`x2`,n[t+1].x).attr(`y2`,n[t+1].y).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`stroke-dasharray`,`4 4`);n.forEach(n=>{let r=e.append(`g`).attr(`class`,`wardley-annotation`);r.append(`circle`).attr(`cx`,n.x).attr(`cy`,n.y).attr(`r`,10).attr(`fill`,`white`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5),r.append(`text`).attr(`x`,n.x).attr(`y`,n.y).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`central`).attr(`font-size`,10).attr(`fill`,s.axisTextColor).attr(`font-weight`,`bold`).text(t.number)})}),d.annotationsBox){let t=x(d.annotationsBox.x),n=S(d.annotationsBox.y),r=e.append(`g`).attr(`class`,`wardley-annotations-box`),i=[...d.annotations].filter(e=>e.text).sort((e,t)=>e.number-t.number),a=[];if(i.forEach((e,i)=>{let o=r.append(`text`).attr(`x`,t+10).attr(`y`,n+10+(i+1)*16).attr(`font-size`,11).attr(`fill`,s.axisTextColor).attr(`text-anchor`,`start`).attr(`dominant-baseline`,`middle`).text(`${e.number}. ${e.text}`);a.push(o)}),a.length>0){let e=0,c=0;a.forEach(t=>{let n=t.node(),r=n.getComputedTextLength();e=Math.max(e,r);let i=n.getBBox();c=Math.max(c,i.height)});let l=e+20+105,u=i.length*16+20+c/2,d=o.padding,f=p-o.padding-l,m=o.padding,g=h-o.padding-u;t=Math.max(d,Math.min(t,f)),n=Math.max(m,Math.min(n,g)),a.forEach((e,r)=>{e.attr(`x`,t+10).attr(`y`,n+10+(r+1)*16)}),r.insert(`rect`,`text`).attr(`x`,t).attr(`y`,n).attr(`width`,l).attr(`height`,u).attr(`fill`,`white`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`rx`,4).attr(`ry`,4)}}}if(d.notes.length>0){let e=_.append(`g`).attr(`class`,`wardley-notes`);d.notes.forEach(t=>{let n=x(t.x),r=S(t.y);e.append(`text`).attr(`x`,n).attr(`y`,r).attr(`text-anchor`,`start`).attr(`font-size`,11).attr(`fill`,s.axisTextColor).attr(`font-weight`,`bold`).text(t.text)})}if(d.accelerators.length>0){let e=_.append(`g`).attr(`class`,`wardley-accelerators`);d.accelerators.forEach(t=>{let n=x(t.x),r=S(t.y),i=`
3
3
  M ${n} ${r-30/2}
4
4
  L ${n+60-20} ${r-30/2}
@@ -1,4 +1,4 @@
1
- import{g as e,h as t}from"./src-D-NMWEou.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,f as l,v as u,w as d,y as f,z as p}from"./chunk-CSCIHK7Q-B7WJrDNL.js";import{t as m}from"./linear-BktLjFGX.js";import{t as h}from"./ordinal-hYBb2elL.js";import{t as g}from"./init-D6jRqBbL.js";import{i as _}from"./chunk-5ZQYHXKU-3UMjEqrw.js";import{t as v}from"./line-BdBKXCG0.js";import{t as y}from"./chunk-WU5MYG2G-Jao3JHnT.js";import{t as b}from"./chunk-O5CBEL6O-DHg6U4bD.js";function x(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function S(){var e=h().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=x(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return S(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},g.apply(d(),arguments)}var C=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,10,12,14,16,18,19,21,23],r=[2,6],i=[1,3],a=[1,5],o=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,34,35,36],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,34,35,36],E=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],D=[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],O=[1,64],k={trace:t(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:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:this.$=[Number(a[s-2]),...a[s]];break;case 21:this.$=[Number(a[s])];break;case 22:r.setXAxisTitle(a[s]);break;case 23:r.setXAxisTitle(a[s-1]);break;case 24:r.setXAxisTitle({type:`text`,text:``});break;case 25:r.setXAxisBand(a[s]);break;case 26:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 27:this.$=a[s-1];break;case 28:this.$=[a[s-2],...a[s]];break;case 29:this.$=[a[s]];break;case 30:r.setYAxisTitle(a[s]);break;case 31:r.setYAxisTitle(a[s-1]);break;case 32:r.setYAxisTitle({type:`text`,text:``});break;case 33:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 37:this.$={text:a[s],type:`text`};break;case 38:this.$={text:a[s],type:`text`};break;case 39:this.$={text:a[s],type:`markdown`};break;case 40:this.$=a[s];break;case 41:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[e(n,r,{3:1,4:2,7:4,5:i,34:a,35:o,36:s}),{1:[3]},e(n,r,{4:2,7:4,3:8,5:i,34:a,35:o,36:s}),e(n,r,{4:2,7:4,6:9,3:10,5:i,8:[1,11],34:a,35:o,36:s}),{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(c,[2,34]),e(c,[2,35]),e(c,[2,36]),{1:[2,1]},e(n,r,{4:2,7:4,3:21,5:i,34:a,35:o,36:s}),{1:[2,3]},e(c,[2,5]),e(n,[2,7],{4:22,34:a,35:o,36:s}),{11:23,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:39,13:38,24:x,27:S,29:40,30:41,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:45,15:44,27:C,33:46,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:49,17:48,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:52,17:51,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{20:[1,53]},{22:[1,54]},e(T,[2,18]),{1:[2,2]},e(T,[2,8]),e(T,[2,9]),e(E,[2,37],{40:55,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b}),e(E,[2,38]),e(E,[2,39]),e(D,[2,40]),e(D,[2,42]),e(D,[2,43]),e(D,[2,44]),e(D,[2,45]),e(D,[2,46]),e(D,[2,47]),e(D,[2,48]),e(D,[2,49]),e(D,[2,50]),e(D,[2,51]),e(T,[2,10]),e(T,[2,22],{30:41,29:56,24:x,27:S}),e(T,[2,24]),e(T,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,11]),e(T,[2,30],{33:60,27:C}),e(T,[2,32]),{31:[1,61]},e(T,[2,12]),{17:62,24:w},{25:63,27:O},e(T,[2,14]),{17:65,24:w},e(T,[2,16]),e(T,[2,17]),e(D,[2,41]),e(T,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(T,[2,31]),{27:[1,69]},e(T,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(T,[2,15]),e(T,[2,26]),e(T,[2,27]),{11:59,32:72,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,33]),e(T,[2,19]),{25:73,27:O},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{g as e,h as t}from"./src-D-NMWEou.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,f as l,v as u,w as d,y as f,z as p}from"./chunk-CSCIHK7Q-BtmPGR8Z.js";import{t as m}from"./linear-BktLjFGX.js";import{t as h}from"./ordinal-hYBb2elL.js";import{t as g}from"./init-D6jRqBbL.js";import{i as _}from"./chunk-5ZQYHXKU-D5zzqgKr.js";import{t as v}from"./line-BofMfFGW.js";import{t as y}from"./chunk-WU5MYG2G-CYvvOcUE.js";import{t as b}from"./chunk-O5CBEL6O-uzui4fRc.js";function x(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function S(){var e=h().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=x(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return S(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},g.apply(d(),arguments)}var C=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,10,12,14,16,18,19,21,23],r=[2,6],i=[1,3],a=[1,5],o=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,34,35,36],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,34,35,36],E=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],D=[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],O=[1,64],k={trace:t(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:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:this.$=[Number(a[s-2]),...a[s]];break;case 21:this.$=[Number(a[s])];break;case 22:r.setXAxisTitle(a[s]);break;case 23:r.setXAxisTitle(a[s-1]);break;case 24:r.setXAxisTitle({type:`text`,text:``});break;case 25:r.setXAxisBand(a[s]);break;case 26:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 27:this.$=a[s-1];break;case 28:this.$=[a[s-2],...a[s]];break;case 29:this.$=[a[s]];break;case 30:r.setYAxisTitle(a[s]);break;case 31:r.setYAxisTitle(a[s-1]);break;case 32:r.setYAxisTitle({type:`text`,text:``});break;case 33:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 37:this.$={text:a[s],type:`text`};break;case 38:this.$={text:a[s],type:`text`};break;case 39:this.$={text:a[s],type:`markdown`};break;case 40:this.$=a[s];break;case 41:this.$=a[s-1]+``+a[s];break}},`anonymous`),table:[e(n,r,{3:1,4:2,7:4,5:i,34:a,35:o,36:s}),{1:[3]},e(n,r,{4:2,7:4,3:8,5:i,34:a,35:o,36:s}),e(n,r,{4:2,7:4,6:9,3:10,5:i,8:[1,11],34:a,35:o,36:s}),{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(c,[2,34]),e(c,[2,35]),e(c,[2,36]),{1:[2,1]},e(n,r,{4:2,7:4,3:21,5:i,34:a,35:o,36:s}),{1:[2,3]},e(c,[2,5]),e(n,[2,7],{4:22,34:a,35:o,36:s}),{11:23,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:39,13:38,24:x,27:S,29:40,30:41,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:45,15:44,27:C,33:46,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:49,17:48,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{11:52,17:51,24:w,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},{20:[1,53]},{22:[1,54]},e(T,[2,18]),{1:[2,2]},e(T,[2,8]),e(T,[2,9]),e(E,[2,37],{40:55,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b}),e(E,[2,38]),e(E,[2,39]),e(D,[2,40]),e(D,[2,42]),e(D,[2,43]),e(D,[2,44]),e(D,[2,45]),e(D,[2,46]),e(D,[2,47]),e(D,[2,48]),e(D,[2,49]),e(D,[2,50]),e(D,[2,51]),e(T,[2,10]),e(T,[2,22],{30:41,29:56,24:x,27:S}),e(T,[2,24]),e(T,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,11]),e(T,[2,30],{33:60,27:C}),e(T,[2,32]),{31:[1,61]},e(T,[2,12]),{17:62,24:w},{25:63,27:O},e(T,[2,14]),{17:65,24:w},e(T,[2,16]),e(T,[2,17]),e(D,[2,41]),e(T,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(T,[2,31]),{27:[1,69]},e(T,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(T,[2,15]),e(T,[2,26]),e(T,[2,27]),{11:59,32:72,37:24,38:l,39:u,40:27,41:d,42:f,43:p,44:m,45:h,46:g,47:_,48:v,49:y,50:b},e(T,[2,33]),e(T,[2,19]),{25:73,27:O},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};k.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,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:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=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),n.length-1&&(this.yylineno-=n.length-1);var i=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:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(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:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -5,13 +5,13 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <title>Jun</title>
8
- <script type="module" crossorigin src="/assets/index-CqEDC1ie.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-yyhnv7Ap.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-Cyuzqnbw.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-DssaXR6m.js">
11
- <link rel="modulepreload" crossorigin href="/assets/utils-BX1Diber.js">
12
- <link rel="modulepreload" crossorigin href="/assets/useBaseUiId-dSIElxm7.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/api-DTaM-PBA.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/useBaseUiId-DL38u1cQ.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/react-dom-Bm-PY09n.js">
14
- <link rel="stylesheet" crossorigin href="/assets/index-CZzHSXB1.css">
14
+ <link rel="stylesheet" crossorigin href="/assets/index-CWOY_p-K.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,L as i,V as a,t as o}from"./utils-BX1Diber.js";import{x as s}from"./useBaseUiId-dSIElxm7.js";import{t as c}from"./pause-h76ixDr5.js";import{t as l}from"./play-B4R5rXMZ.js";import{t as u}from"./rotate-cw-B1ZRM7VI.js";import{t as d}from"./square-_9cV5Fet.js";import{Yt as f,t as p}from"./index-CqEDC1ie.js";import{t as m}from"./button-Cg-0y2B2.js";import{t as h}from"./input-B0qeLI2E.js";var ee=s(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),g=s(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),_=s(`bot`,[[`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`}]]),v=s(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),y=s(`mouse-pointer`,[[`path`,{d:`M12.586 12.586 19 19`,key:`ea5xo7`}],[`path`,{d:`M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z`,key:`277e5u`}]]),b=e(t(),1),x=n(),S={width:1280,height:720},C=[{value:`agent`,label:`Agent`,icon:_},{value:`user`,label:`You`,icon:y},{value:`paused`,label:`Paused`,icon:c}];function w(e){return!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0)}var T=[`left`,`middle`,`right`];function E(){let[e,t]=(0,b.useState)(null),[n,s]=(0,b.useState)([]),[c,_]=(0,b.useState)(``),[E,D]=(0,b.useState)(null),[O,te]=(0,b.useState)(null),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),N=(0,b.useRef)(null),P=(0,b.useRef)(null),F=(0,b.useRef)(null),I=(0,b.useRef)(null),L=(0,b.useCallback)(()=>{let e=I.current;if(!e)return;let t=S.width/S.height,n=e.clientWidth,r=e.clientHeight;if(n===0||r===0)return;let i=n,a=n/t;a>r&&(a=r,i=r*t);let o={w:Math.floor(i),h:Math.floor(a)};te(e=>e?.w===o.w&&e?.h===o.h?e:o)},[]);(0,b.useEffect)(()=>{L();let e=new ResizeObserver(L);return I.current&&e.observe(I.current),()=>e.disconnect()},[L]);let R=(0,b.useRef)(!1),z=(0,b.useRef)(0),B=e?.streaming??!1,V=e?.running??!1,H=e?.controller??`agent`,U=H===`user`,W=(0,b.useCallback)(async()=>{try{let[{status:e},{actions:n}]=await Promise.all([r(`/api/browser/status`),r(`/api/browser/actions`)]);t(e),s(n),!R.current&&e.url&&e.url!==`about:blank`&&_(e.url),M(null)}catch(e){M(e instanceof Error?e.message:String(e))}},[]);p(W,5e3),(0,b.useEffect)(()=>{U&&F.current?.focus()},[U]),(0,b.useEffect)(()=>{if(!B){D(null);return}let e=!1,t=null,n=0,r=()=>{let i=a(`/api/browser/stream`);N.current=i,i.onmessage=e=>{try{let t=JSON.parse(String(e.data));t.type===`frame`&&t.data&&(n=0,D(`data:image/jpeg;base64,${t.data}`))}catch{}},i.onclose=()=>{if(N.current===i&&(N.current=null),e)return;let a=Math.min(1e3*2**n,1e4);n+=1,t=setTimeout(r,a)}};return r(),()=>{e=!0,t&&clearTimeout(t),N.current?.close(),N.current=null}},[B]);let G=(0,b.useCallback)(async e=>{A(!0),M(null);try{await e(),await W()}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[W]),K=()=>G(()=>i(`/api/browser/start`,{url:c.trim()||void 0})),q=()=>G(()=>i(`/api/browser/stop`)),J=()=>{let e=c.trim();if(!e)return;let t=/^[a-z]+:\/\//i.test(e)?e:`https://${e}`;return G(()=>i(`/api/browser/navigate`,{url:t}))},Y=e=>G(()=>i(`/api/browser/${e}`)),ne=()=>G(()=>i(`/api/browser/screenshot`)),X=e=>G(()=>i(`/api/browser/control`,{controller:e})),Z=e=>{let t=N.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},re=e=>{let t=P.current;if(!t)return null;let n=t.getBoundingClientRect();return n.width===0||n.height===0?null:{x:Math.round((e.clientX-n.left)/n.width*S.width),y:Math.round((e.clientY-n.top)/n.height*S.height)}},Q=(e,t,n={})=>{if(!U)return;let r=re(e);r&&(e.preventDefault(),Z({type:`input_mouse`,eventType:t,...r,button:T[e.button]??`left`,clickCount:e.detail||1,modifiers:w(e),...n}))},ie=e=>{let t=performance.now();t-z.current<33||(z.current=t,Q(e,`mouseMoved`))},ae=e=>{let t=e.ctrlKey||e.metaKey||e.altKey;if(e.key.length===1&&!t)return null;let n=[];return e.ctrlKey&&n.push(`Control`),e.shiftKey&&n.push(`Shift`),e.altKey&&n.push(`Alt`),e.metaKey&&n.push(`Meta`),n.push(e.key===` `?`Space`:e.key),n.join(`+`)},$=(e,t)=>{if(!U)return;e.preventDefault();let n=ae(e);if(n){t===`keyDown`&&i(`/api/browser/key`,{key:n}).catch(()=>{});return}Z({type:`input_keyboard`,eventType:t,key:e.key,code:e.code,text:t===`keyDown`?e.key:void 0,modifiers:w(e)})};return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 p-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`back`),children:(0,x.jsx)(ee,{})}),(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`forward`),children:(0,x.jsx)(g,{})}),(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`reload`),children:(0,x.jsx)(u,{})})]}),(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,x.jsx)(h,{placeholder:`https://example.com`,value:c,onChange:e=>_(e.target.value),onFocus:()=>R.current=!0,onBlur:()=>R.current=!1,onKeyDown:e=>{e.key===`Enter`&&(V?J:K)()}}),(0,x.jsx)(m,{size:`sm`,variant:`outline`,disabled:k||c.trim().length===0,onClick:()=>V?J():K(),children:`Go`})]}),(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:ne,title:`Screenshot → workspace/screenshots`,children:(0,x.jsx)(v,{})}),(0,x.jsx)(`div`,{className:`flex items-center rounded-md border p-0.5`,children:C.map(({value:e,label:t,icon:n})=>(0,x.jsxs)(m,{size:`sm`,variant:H===e?`secondary`:`ghost`,className:`h-7 gap-1.5 px-2`,disabled:k,onClick:()=>X(e),children:[(0,x.jsx)(n,{className:`size-3.5`}),t]},e))}),V?(0,x.jsxs)(m,{size:`sm`,variant:`outline`,className:`text-destructive hover:text-destructive`,disabled:k,onClick:q,children:[(0,x.jsx)(d,{className:`size-3.5`}),` Stop`]}):(0,x.jsxs)(m,{size:`sm`,disabled:k,onClick:K,children:[(0,x.jsx)(l,{className:`size-3.5`}),` Start`]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:o(`inline-block size-2 rounded-full`,V?`bg-emerald-500`:`bg-neutral-300`)}),V?e?.title||e?.url||`Browser running`:`Browser stopped`,U&&V&&(0,x.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 font-medium text-primary`,children:`You have control — click the page and type`})]}),j&&(0,x.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}),(0,x.jsx)(`div`,{ref:I,className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,x.jsxs)(`div`,{ref:F,style:O?{width:O.w,height:O.h}:void 0,className:o(`group relative flex items-center justify-center overflow-hidden rounded-lg border bg-neutral-950/95 outline-none`,U&&`ring-2 ring-primary/60`),tabIndex:0,onMouseDown:()=>{U&&F.current?.focus()},onKeyDown:e=>$(e,`keyDown`),onKeyUp:e=>$(e,`keyUp`),children:[E?(0,x.jsx)(`img`,{ref:P,src:E,alt:`Browser viewport`,draggable:!1,className:o(`h-full w-full select-none object-contain`,U?`cursor-crosshair`:`cursor-default`),onMouseDown:e=>Q(e,`mousePressed`),onMouseUp:e=>Q(e,`mouseReleased`),onMouseMove:ie,onContextMenu:e=>U&&e.preventDefault(),onWheel:e=>Q(e,`mouseWheel`,{deltaX:e.deltaX,deltaY:e.deltaY})}):(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-sm text-neutral-400`,children:[(0,x.jsx)(f,{className:`size-8`}),V?`Waiting for viewport frames…`:`Start the browser to see the live viewport.`]}),!U&&E&&(0,x.jsx)(`div`,{className:`absolute inset-0 flex items-end justify-center pb-4 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,x.jsxs)(m,{size:`sm`,className:`shadow-lg`,onClick:()=>X(`user`),children:[(0,x.jsx)(y,{className:`size-3.5`}),` Take control`]})})]})})]}),(0,x.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-l`,children:[(0,x.jsx)(`div`,{className:`border-b px-3 py-2 text-sm font-semibold`,children:`Action log`}),(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-auto p-2`,children:[n.map(e=>(0,x.jsxs)(`div`,{className:`rounded-md px-2 py-1.5 text-xs hover:bg-muted/60`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:e.kind}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),e.detail&&(0,x.jsx)(`div`,{className:`truncate text-muted-foreground`,title:e.detail,children:e.detail})]},e.id)),n.length===0&&(0,x.jsx)(`p`,{className:`px-2 py-4 text-xs text-muted-foreground`,children:`No actions yet. Start the browser or navigate somewhere.`})]})]})]})}export{E as BrowserPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,t as i}from"./utils-BX1Diber.js";import{tn as a}from"./index-CqEDC1ie.js";import{t as o}from"./button-Cg-0y2B2.js";import{t as s}from"./badge-DjyNiZCE.js";var c=e(t(),1),l=n();function u({className:e,size:t=`default`,...n}){return(0,l.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:i(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function d({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-header`,className:i(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function f({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-title`,className:i(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function p({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-description`,className:i(`text-sm text-muted-foreground`,e),...t})}function m({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-content`,className:i(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function h(){let[e,t]=(0,c.useState)(null),[n,i]=(0,c.useState)(null);return(0,c.useEffect)(()=>{r(`/api/status`).then(t).catch(()=>{}),r(`/api/runs`).then(({runs:e})=>i(e.filter(e=>[`queued`,`starting`,`running`,`waiting_approval`].includes(e.status)).length)).catch(()=>{})},[]),(0,l.jsxs)(`div`,{className:`page`,children:[(0,l.jsx)(`h1`,{children:`Dashboard`}),(0,l.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Daemon`,(0,l.jsx)(s,{variant:e?`default`:`destructive`,children:e?`online`:`offline`})]}),(0,l.jsx)(p,{children:`Local Jun control plane`})]}),(0,l.jsx)(m,{className:`text-sm text-muted-foreground`,children:e?(0,l.jsxs)(`p`,{className:`truncate`,title:e.workspaceRoot,children:[`project `,(0,l.jsx)(`span`,{className:`text-foreground`,children:e.projectId}),` · up `,e.uptimeSeconds,`s`]}):(0,l.jsx)(`p`,{children:`Waiting for daemon…`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Codex runs`,n!==null&&(0,l.jsxs)(s,{variant:n>0?`default`:`secondary`,children:[n,` active`]})]}),(0,l.jsx)(p,{children:`Agent activity in this workspace`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{size:`sm`,render:(0,l.jsx)(a,{to:`/runs`}),children:`Open Runs`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsx)(f,{children:`Dynamic widgets`}),(0,l.jsx)(p,{children:`JSON Render widgets arrive in Phase 7 — this grid is their home.`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{variant:`secondary`,size:`sm`,render:(0,l.jsx)(a,{to:`/files`}),children:`Browse workspace`})})]})]})]})}export{h as DashboardPage};
@@ -1,64 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{B as r,H as i,I as a,L as o,V as s,t as c,z as l}from"./utils-BX1Diber.js";import{x as u}from"./useBaseUiId-dSIElxm7.js";import{i as d,n as f,r as p,t as m}from"./collapsible-CP1QD5GK.js";import{Xt as h,en as ee}from"./index-CqEDC1ie.js";var g=u(`file`,[[`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`}]]),_=u(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),v=e(t(),1),y=n(),b=(0,v.createContext)({expandedPaths:new Set,togglePath:()=>{}}),x=({expanded:e,defaultExpanded:t=new Set,selectedPath:n,onSelect:r,onExpandedChange:i,className:a,children:o,...s})=>{let[l,u]=(0,v.useState)(t),d=e??l,f=(0,v.useCallback)(e=>{let t=new Set(d);t.has(e)?t.delete(e):t.add(e),u(t),i?.(t)},[d,i]),p=(0,v.useMemo)(()=>({expandedPaths:d,onSelect:r,selectedPath:n,togglePath:f}),[d,r,n,f]);return(0,y.jsx)(b.Provider,{value:p,children:(0,y.jsx)(`div`,{className:c(`rounded-lg border bg-background font-mono text-sm`,a),role:`tree`,...s,children:(0,y.jsx)(`div`,{className:`p-2`,children:o})})})},S=({className:e,children:t,...n})=>(0,y.jsx)(`span`,{className:c(`shrink-0`,e),...n,children:t}),C=({className:e,children:t,...n})=>(0,y.jsx)(`span`,{className:c(`truncate`,e),...n,children:t}),w=(0,v.createContext)({isExpanded:!1,name:``,path:``}),T=({path:e,name:t,className:n,children:r,...i})=>{let{expandedPaths:a,togglePath:o,selectedPath:s,onSelect:l}=(0,v.useContext)(b),u=a.has(e),ee=s===e,g=(0,v.useCallback)(()=>{o(e)},[o,e]),x=(0,v.useCallback)(()=>{l?.(e)},[l,e]),T=(0,v.useMemo)(()=>({isExpanded:u,name:t,path:e}),[u,t,e]);return(0,y.jsx)(w.Provider,{value:T,children:(0,y.jsx)(m,{onOpenChange:g,open:u,children:(0,y.jsxs)(`div`,{className:c(``,n),role:`treeitem`,tabIndex:0,...i,children:[(0,y.jsxs)(`div`,{className:c(`flex w-full items-center gap-1 rounded px-2 py-1 text-left transition-colors hover:bg-muted/50`,ee&&`bg-muted`),children:[(0,y.jsx)(p,{className:`flex shrink-0 cursor-pointer items-center border-none bg-transparent p-0`,children:(0,y.jsx)(d,{className:c(`size-4 shrink-0 text-muted-foreground transition-transform`,u&&`rotate-90`)})}),(0,y.jsxs)(`button`,{className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1 border-none bg-transparent p-0 text-left`,onClick:x,type:`button`,children:[(0,y.jsx)(S,{children:u?(0,y.jsx)(h,{className:`size-4`}):(0,y.jsx)(_,{className:`size-4`})}),(0,y.jsx)(C,{children:t})]})]}),(0,y.jsx)(f,{children:(0,y.jsx)(`div`,{className:`ml-4 border-l pl-2`,children:r})})]})})})},E=(0,v.createContext)({name:``,path:``}),D=({path:e,name:t,icon:n,className:r,children:i,...a})=>{let{selectedPath:o,onSelect:s}=(0,v.useContext)(b),l=o===e,u=(0,v.useCallback)(()=>{s?.(e)},[s,e]),d=(0,v.useCallback)(t=>{(t.key===`Enter`||t.key===` `)&&s?.(e)},[s,e]),f=(0,v.useMemo)(()=>({name:t,path:e}),[t,e]);return(0,y.jsx)(E.Provider,{value:f,children:(0,y.jsx)(`div`,{className:c(`flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50`,l&&`bg-muted`,r),onClick:u,onKeyDown:d,role:`treeitem`,tabIndex:0,...a,children:i??(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`size-4 shrink-0`}),(0,y.jsx)(S,{children:n??(0,y.jsx)(g,{className:`size-4 text-muted-foreground`})}),(0,y.jsx)(C,{children:t})]})})})};function te({root:e,selectedPath:t,expanded:n,onSelect:r,onToggle:i}){let a=new Map;return ne(e,a),(0,y.jsx)(x,{className:`ai-file-tree`,expanded:n,selectedPath:t??void 0,onExpandedChange:e=>{let t=re(n,e);t&&i(t)},onSelect:e=>{let t=a.get(e);t&&r(t)},children:(e.children??[]).map(e=>(0,y.jsx)(O,{node:e},e.path))})}function O({node:e}){return e.type===`dir`?(0,y.jsx)(T,{name:e.name,path:e.path,children:(e.children??[]).map(e=>(0,y.jsx)(O,{node:e},e.path))}):(0,y.jsx)(D,{name:e.name,path:e.path})}function ne(e,t){t.set(e.path,e);for(let n of e.children??[])ne(n,t)}function re(e,t){for(let n of t)if(!e.has(n))return n;for(let n of e)if(!t.has(n))return n;return null}function k(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=k();function ie(e){A=e}var j={exec:()=>null};function M(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function N(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(P.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ae=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),P={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:M(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:M(e=>RegExp(`^ {0,${e}}>`))},oe=/^(?:[ \t]*(?:\n|$))+/,se=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ce=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,F=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,le=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ue=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,fe=N(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),pe=N(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),me=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,he=/^[^\n]+/,I=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ge=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,I).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_e=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ue).getRegex(),L=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,R=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ve=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,R).replace(`tag`,L).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye=N(me).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex(),z={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ye).getRegex(),code:se,def:ge,fences:ce,heading:le,hr:F,html:ve,lheading:fe,list:_e,newline:oe,paragraph:ye,table:j,text:he},be=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex(),xe={...z,lheading:pe,table:be,paragraph:N(me).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,be).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,L).getRegex()},Se={...z,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,R).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(me).replace(`hr`,F).replace(`heading`,` *#{1,6} *[^
2
- ]`).replace(`lheading`,fe).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Ce=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,we=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Te=/^( {2,}|\\)\n(?!\s*$)/,Ee=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,B=/[\p{P}\p{S}]/u,V=/[\s\p{P}\p{S}]/u,De=/[^\s\p{P}\p{S}]/u,Oe=N(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,V).getRegex(),ke=/(?!~)[\p{P}\p{S}]/u,Ae=/(?!~)[\s\p{P}\p{S}]/u,je=/(?:[^\s\p{P}\p{S}]|~)/u,Me=N(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ae?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ne=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Pe=N(Ne,`u`).replace(/punct/g,B).getRegex(),Fe=N(Ne,`u`).replace(/punct/g,ke).getRegex(),Ie=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Le=N(Ie,`gu`).replace(/notPunctSpace/g,De).replace(/punctSpace/g,V).replace(/punct/g,B).getRegex(),Re=N(Ie,`gu`).replace(/notPunctSpace/g,je).replace(/punctSpace/g,Ae).replace(/punct/g,ke).getRegex(),ze=N(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,De).replace(/punctSpace/g,V).replace(/punct/g,B).getRegex(),Be=N(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,B).getRegex(),Ve=N(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,De).replace(/punctSpace/g,V).replace(/punct/g,B).getRegex(),He=N(/\\(punct)/,`gu`).replace(/punct/g,B).getRegex(),Ue=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),We=N(R).replace(`(?:-->|$)`,`-->`).getRegex(),Ge=N(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,We).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),H=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ke=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,H).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qe=N(/^!?\[(label)\]\[(ref)\]/).replace(`label`,H).replace(`ref`,I).getRegex(),Je=N(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,I).getRegex(),Ye=N(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,qe).replace(`nolink`,Je).getRegex(),Xe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ze={_backpedal:j,anyPunctuation:He,autolink:Ue,blockSkip:Me,br:Te,code:we,del:j,delLDelim:j,delRDelim:j,emStrongLDelim:Pe,emStrongRDelimAst:Le,emStrongRDelimUnd:ze,escape:Ce,link:Ke,nolink:Je,punctuation:Oe,reflink:qe,reflinkSearch:Ye,tag:Ge,text:Ee,url:j},Qe={...Ze,link:N(/^!?\[(label)\]\((.*?)\)/).replace(`label`,H).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,H).getRegex()},$e={...Ze,emStrongRDelimAst:Re,emStrongLDelim:Fe,delLDelim:Be,delRDelim:Ve,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Xe).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:N(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Xe).getRegex()},et={...$e,br:N(Te).replace(`{2,}`,`*`).getRegex(),text:N($e.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},U={normal:z,gfm:xe,pedantic:Se},W={normal:Ze,gfm:$e,breaks:et,pedantic:Qe},tt={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},nt=e=>tt[e];function G(e,t){if(t){if(P.escapeTest.test(e))return e.replace(P.escapeReplace,nt)}else if(P.escapeTestNoEncode.test(e))return e.replace(P.escapeReplaceNoEncode,nt);return e}function rt(e){try{e=encodeURI(e).replace(P.percentDecode,`%`)}catch{return null}return e}function it(e,t){let n=e.replace(P.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(P.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(P.slashPipe,`|`);return n}function K(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function at(e){let t=e.split(`
3
- `),n=t.length-1;for(;n>=0&&P.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
4
- `)}function ot(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function st(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function ct(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function lt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
5
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
6
- `)}var q=class{options;rules;lexer;constructor(e){this.options=e||A}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:at(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=lt(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=K(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:K(t[0],`
7
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:K(t[0],`
8
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=K(t[0],`
9
- `).split(`
10
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
11
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
12
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
13
- ${s}`:s,r=r?`${r}
14
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
15
- `+e.join(`
16
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
17
- `+e.join(`
18
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
19
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=st(t[2].split(`
20
- `,1)[0],t[1].length),l=e.split(`
21
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
22
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
23
- `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
24
- `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
25
- `+l}u=!l.trim(),r+=p+`
26
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=at(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:K(t[0],`
27
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=it(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
28
- `):[],a={type:`table`,raw:K(t[0],`
29
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(it(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:K(t[0],`
30
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
31
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=K(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=ot(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),ct(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return ct(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},J=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||A,this.options.tokenizer=this.options.tokenizer||new q,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:P,block:U.normal,inline:W.normal};this.options.pedantic?(t.block=U.pedantic,t.inline=W.pedantic):this.options.gfm&&(t.block=U.gfm,this.options.breaks?t.inline=W.breaks:t.inline=W.gfm),this.tokenizer.rules=t}static get rules(){return{block:U,inline:W}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(P.carriageReturn,`
32
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(P.tabCharGlobal,` `).replace(P.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
33
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
34
- `)?``:`
35
- `)+i.raw,n.text+=`
36
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
37
- `)?``:`
38
- `)+i.raw,n.text+=`
39
- `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
40
- `)?``:`
41
- `)+i.raw,r.text+=`
42
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
43
- `)?``:`
44
- `)+i.raw,n.text+=`
45
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Y=class{options;parser;constructor(e){this.options=e||A}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(P.notSpaceStart)?.[0],i=e.replace(P.endingNewline,``)+`
46
- `;return r?`<pre><code class="language-`+G(r)+`">`+(n?i:G(i,!0))+`</code></pre>
47
- `:`<pre><code>`+(n?i:G(i,!0))+`</code></pre>
48
- `}blockquote({tokens:e}){return`<blockquote>
49
- ${this.parser.parse(e)}</blockquote>
50
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
51
- `}hr(e){return`<hr>
52
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
53
- `+r+`</`+i+`>
54
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
55
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
56
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
57
- <thead>
58
- `+t+`</thead>
59
- `+r+`</table>
60
- `}tablerow({text:e}){return`<tr>
61
- ${e}</tr>
62
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
63
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${G(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=rt(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+G(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=rt(e);if(i===null)return G(n);e=i;let a=`<img src="${e}" alt="${G(n)}"`;return t&&(a+=` title="${G(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:G(e.text)}},ut=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},X=class e{options;renderer;textRenderer;constructor(e){this.options=e||A,this.options.renderer=this.options.renderer||new Y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ut}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Z=class{options;block;constructor(e){this.options=e||A}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?J.lex:J.lexInline}provideParser(e=this.block){return e?X.parse:X.parseInline}},Q=new class{defaults=k();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=X;Renderer=Y;TextRenderer=ut;Lexer=J;Tokenizer=q;Hooks=Z;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Y(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new q(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Z;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Z.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return J.lex(e,t??this.defaults)}parser(e,t){return X.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?J.lex:J.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?X.parse:X.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?J.lex:J.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?X.parse:X.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
64
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+G(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Q.parse(e,t)}$.options=$.setOptions=function(e){return Q.setOptions(e),$.defaults=Q.defaults,ie($.defaults),$},$.getDefaults=k,$.defaults=A,$.use=function(...e){return Q.use(...e),$.defaults=Q.defaults,ie($.defaults),$},$.walkTokens=function(e,t){return Q.walkTokens(e,t)},$.parseInline=Q.parseInline,$.Parser=X,$.parser=X.parse,$.Renderer=Y,$.TextRenderer=ut,$.Lexer=J,$.lexer=J.lex,$.Tokenizer=q,$.Hooks=Z,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,X.parse,J.lex;function dt({file:e}){return e.kind===`image`?(0,y.jsx)(`div`,{className:`preview-pane`,children:(0,y.jsx)(`img`,{className:`preview-image`,src:r(e.path),alt:e.path})}):e.kind===`binary`?(0,y.jsx)(`div`,{className:`preview-pane`,children:(0,y.jsxs)(`p`,{className:`page-hint`,children:[`Binary file (`,e.size,` bytes).`,` `,(0,y.jsx)(`a`,{href:r(e.path),children:`Download`})]})}):e.kind===`markdown`?(0,y.jsx)(ft,{content:e.content??``}):e.kind===`json`?(0,y.jsx)(pt,{content:e.content??``}):(0,y.jsx)(`div`,{className:`preview-pane`,children:(0,y.jsx)(`pre`,{className:`code-block`,children:e.content??``})})}function ft({content:e}){return(0,y.jsx)(`div`,{className:`preview-pane markdown-body`,dangerouslySetInnerHTML:{__html:(0,v.useMemo)(()=>$.parse(e,{async:!1}),[e])}})}function pt({content:e}){return(0,y.jsx)(`div`,{className:`preview-pane`,children:(0,y.jsx)(`pre`,{className:`code-block`,children:(0,v.useMemo)(()=>{try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}},[e])})})}function mt(){let{activeProjectId:e}=ee(),[t,n]=(0,v.useState)(null),[c,u]=(0,v.useState)(new Set),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(``),[_,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(`edit`),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(null),D=(0,v.useRef)(null),O=(0,v.useCallback)(async()=>{try{n(await a(i(`/api/files/tree`,e))),w(null)}catch(e){w(e instanceof Error?e.message:String(e))}},[e]);(0,v.useEffect)(()=>{O()},[O]),(0,v.useEffect)(()=>{f(null),m(null),u(new Set)},[e]),(0,v.useEffect)(()=>{let e=s(`/api/files/watch`),t=null;return e.onmessage=()=>{t&&clearTimeout(t),t=setTimeout(O,400)},()=>{t&&clearTimeout(t),e.close()}},[O]);let ne=(0,v.useCallback)(async t=>{if(f(t),E(null),t.type!==`file`){m(null);return}try{let n=await a(i(`/api/files/read?path=${encodeURIComponent(t.path)}`,e));m(n),g(n.content??``),b(!1),S(n.kind===`markdown`||n.kind===`json`?`preview`:`edit`),w(null)}catch(e){m(null),w(e instanceof Error?e.message:String(e))}},[e]),re=(0,v.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),k=()=>{if(!d)return`.`;if(d.type===`dir`)return d.path;let e=d.path.lastIndexOf(`/`);return e===-1?`.`:d.path.slice(0,e)},A=async(e,t)=>{try{await e(),w(null),t&&E(t),await O()}catch(e){w(e instanceof Error?e.message:String(e))}},ie=()=>{let t=window.prompt(`New file name (relative to selected folder):`);if(!t)return;let n=ht(k(),t);A(()=>o(i(`/api/files/write`,e),{path:n,content:``}),`Created ${n}`)},j=()=>{let t=window.prompt(`New folder name:`);if(!t)return;let n=ht(k(),t);A(()=>o(i(`/api/files/mkdir`,e),{path:n}),`Created ${n}/`)},M=()=>{if(!d)return;let t=window.prompt(`New path:`,d.path);if(!t||t===d.path)return;let n=d.path;A(async()=>{await o(i(`/api/files/rename`,e),{from:n,to:t}),f(null),m(null)},`Renamed to ${t}`)},N=()=>{if(!d||!window.confirm(`Delete ${d.path}? This cannot be undone.`))return;let t=d.path;A(async()=>{await o(i(`/api/files/delete`,e),{path:t}),f(null),m(null)},`Deleted ${t}`)},ae=t=>{if(!t||t.length===0)return;let n=new FormData;n.set(`path`,k());for(let e of Array.from(t))n.append(`file`,e);A(()=>l(i(`/api/files/upload`,e),n),`Uploaded ${t.length} file(s)`)},P=()=>{p&&A(async()=>{await o(i(`/api/files/write`,e),{path:p.path,content:h}),m({...p,content:h}),b(!1)},`Saved ${p.path}`)},oe=p&&p.kind!==`image`&&p.kind!==`binary`;return(0,y.jsxs)(`div`,{className:`files-page`,children:[(0,y.jsxs)(`aside`,{className:`files-sidebar`,children:[(0,y.jsxs)(`div`,{className:`files-toolbar`,children:[(0,y.jsx)(`button`,{onClick:ie,children:`+ File`}),(0,y.jsx)(`button`,{onClick:j,children:`+ Folder`}),(0,y.jsx)(`button`,{onClick:()=>D.current?.click(),children:`Upload`}),(0,y.jsx)(`button`,{onClick:O,children:`Refresh`}),(0,y.jsx)(`input`,{ref:D,type:`file`,multiple:!0,hidden:!0,onChange:e=>{ae(e.target.files),e.target.value=``}})]}),t?(0,y.jsx)(te,{root:t,selectedPath:d?.path??null,expanded:c,onSelect:ne,onToggle:re}):(0,y.jsx)(`p`,{className:`page-hint`,children:`Loading workspace…`})]}),(0,y.jsxs)(`section`,{className:`files-content`,children:[C&&(0,y.jsx)(`div`,{className:`banner error`,children:C}),T&&!C&&(0,y.jsx)(`div`,{className:`banner notice`,children:T}),d?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`files-header`,children:[(0,y.jsxs)(`span`,{className:`files-path`,title:d.path,children:[d.path,_?` •`:``]}),(0,y.jsxs)(`div`,{className:`files-actions`,children:[oe&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{className:x===`edit`?`active`:``,onClick:()=>S(`edit`),children:`Edit`}),(0,y.jsx)(`button`,{className:x===`preview`?`active`:``,onClick:()=>S(`preview`),children:`Preview`}),(0,y.jsx)(`button`,{disabled:!_,onClick:P,children:`Save`})]}),d.type===`file`&&(0,y.jsx)(`a`,{className:`button-link`,href:r(d.path,e),children:`Download`}),(0,y.jsx)(`button`,{onClick:M,children:`Rename`}),(0,y.jsx)(`button`,{className:`danger`,onClick:N,children:`Delete`})]})]}),d.type===`dir`?(0,y.jsx)(`p`,{className:`page-hint`,children:`Folder selected. New files, folders, and uploads land here.`}):p?x===`edit`&&oe?(0,y.jsx)(`textarea`,{className:`file-editor`,value:h,spellCheck:!1,onChange:e=>{g(e.target.value),b(!0)}}):(0,y.jsx)(dt,{file:_?{...p,content:h}:p}):(0,y.jsx)(`p`,{className:`page-hint`,children:`Loading file…`})]}):(0,y.jsx)(`p`,{className:`page-hint`,children:`Select a file from the workspace tree to view or edit it.`})]})]})}function ht(e,t){let n=t.replace(/^[/\\]+/,``);return e===`.`?n:`${e}/${n}`}export{mt as FilesPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t}from"./bundle-mjs-DssaXR6m.js";import{f as n}from"./utils-BX1Diber.js";import{x as r}from"./useBaseUiId-dSIElxm7.js";var i=r(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),a=e(t()),o=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:n,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function s(){return a.useContext(o)}export{i as n,s as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,V as i}from"./utils-BX1Diber.js";import{x as a}from"./useBaseUiId-dSIElxm7.js";import{t as o}from"./pause-h76ixDr5.js";import{t as s}from"./play-B4R5rXMZ.js";import{t as c}from"./trash-2-D4CnL8wv.js";import{t as l}from"./button-Cg-0y2B2.js";import{t as u}from"./input-B0qeLI2E.js";var d=a(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),f=e(t(),1),p=n(),m=2e3,h=[{key:`all`,label:`All`},{key:`warn`,label:`Warnings`},{key:`error`,label:`Errors`}],g={info:0,warn:1,error:2},_={info:`var(--muted-foreground)`,warn:`oklch(0.62 0.17 75)`,error:`oklch(0.58 0.22 27)`};function v(){let[e,t]=(0,f.useState)([]),[n,a]=(0,f.useState)(`all`),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(!0),[S,C]=(0,f.useState)(!1),w=(0,f.useRef)(null),T=(0,f.useRef)(null);(0,f.useEffect)(()=>{let e=!0,n=null,a=null;r(`/api/logs?limit=1000`).then(n=>e&&t(n.logs)).catch(()=>{});let o=()=>{n=i(`/api/logs/stream`),n.onopen=()=>e&&C(!0),n.onclose=()=>{e&&(C(!1),a=setTimeout(o,1500))},n.onmessage=e=>{try{let n=JSON.parse(e.data);t(e=>{if(e.length&&e[e.length-1].seq>=n.seq)return e;let t=[...e,n];return t.length>m?t.slice(-2e3):t})}catch{}}};return o(),()=>{e=!1,a&&clearTimeout(a),n?.close()}},[]);let E=(0,f.useMemo)(()=>{let t=n===`all`?0:g[n],r=v.trim().toLowerCase();return e.filter(e=>g[e.level]>=t&&(!r||e.text.toLowerCase().includes(r)))},[e,n,v]);return(0,f.useEffect)(()=>{b&&w.current?.scrollIntoView({block:`end`})},[E,b]),(0,p.jsxs)(`div`,{className:`flex h-full flex-col gap-3 p-6`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`h1`,{className:`mr-2 text-lg font-semibold`,children:`Logs`}),(0,p.jsx)(`div`,{className:`flex items-center gap-1 rounded-md border p-0.5`,style:{borderColor:`var(--border)`},children:h.map(e=>(0,p.jsx)(`button`,{onClick:()=>a(e.key),className:`rounded px-2 py-1 text-xs`,style:{background:n===e.key?`var(--primary)`:`transparent`,color:n===e.key?`var(--primary-foreground)`:`var(--muted-foreground)`},children:e.label},e.key))}),(0,p.jsx)(u,{value:v,onChange:e=>y(e.target.value),placeholder:`Filter…`,className:`h-8 w-48`}),(0,p.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs`,style:{color:`var(--muted-foreground)`},children:[(0,p.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:S?`oklch(0.7 0.17 145)`:`var(--muted-foreground)`}}),S?`live`:`reconnecting…`,` · `,E.length,` lines`]}),(0,p.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>x(e=>!e),children:[b?(0,p.jsx)(o,{className:`size-4`}):(0,p.jsx)(s,{className:`size-4`}),b?`Pause scroll`:`Resume`]}),(0,p.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>{w.current?.scrollIntoView({block:`end`}),x(!0)},children:[(0,p.jsx)(d,{className:`size-4`}),` Bottom`]}),(0,p.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>t([]),children:[(0,p.jsx)(c,{className:`size-4`}),` Clear`]})]}),(0,p.jsx)(`div`,{ref:T,onScroll:()=>{let e=T.current;e&&x(e.scrollHeight-e.scrollTop-e.clientHeight<40)},className:`min-h-0 flex-1 overflow-auto rounded-md border font-mono text-xs leading-relaxed`,style:{borderColor:`var(--border)`,background:`var(--card)`},children:E.length===0?(0,p.jsxs)(`div`,{className:`p-4`,style:{color:`var(--muted-foreground)`},children:[`No log lines`,v||n!==`all`?` match the filter`:` yet`,`.`]}):(0,p.jsxs)(`div`,{className:`p-2`,children:[E.map(e=>(0,p.jsxs)(`div`,{className:`flex gap-2 whitespace-pre-wrap break-words px-1 py-0.5`,children:[(0,p.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.ts.slice(11,23)}),(0,p.jsx)(`span`,{style:{color:_[e.level],minWidth:`2.6rem`},children:e.level}),(0,p.jsx)(`span`,{style:{color:e.level===`error`?_.error:`var(--foreground)`},children:e.text})]},e.seq)),(0,p.jsx)(`div`,{ref:w})]})})]})}export{v as LogsPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as r,I as i,L as a,R as o,t as s}from"./utils-BX1Diber.js";import{x as c}from"./useBaseUiId-dSIElxm7.js";import{i as l,n as u,r as d,t as f}from"./collapsible-CP1QD5GK.js";import{t as p}from"./circle-x-BSTd_gmE.js";import{t as m}from"./key-round-D965pLEl.js";import{a as h,i as g,n as _,r as v,t as y}from"./tabs-CpVOS0Mr.js";import{E as b}from"./useCompositeListItem-CJiAiQsj.js";import{t as x}from"./rotate-cw-B1ZRM7VI.js";import{t as S}from"./trash-2-D4CnL8wv.js";import{a as C,i as w,o as T,r as E,s as D,t as O}from"./dialog-CPRWiMQj.js";import{qt as k}from"./index-CqEDC1ie.js";import{t as A}from"./button-Cg-0y2B2.js";import{t as j}from"./input-B0qeLI2E.js";import{t as M}from"./badge-DjyNiZCE.js";import{t as N}from"./label-CxX4-RmK.js";import{t as P}from"./textarea-5JHEEgU-.js";var F=c(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),I=c(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),L=e(t(),1),R=n();function z({server:e}){if(!e.enabled)return(0,R.jsx)(M,{variant:`outline`,children:`disabled`});switch(e.startupState){case`ready`:return(0,R.jsxs)(M,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(F,{className:`size-3 text-emerald-600`}),` ready`]});case`starting`:return(0,R.jsxs)(M,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(h,{className:`size-3 animate-spin`}),` starting`]});case`failed`:case`cancelled`:return(0,R.jsxs)(M,{variant:`outline`,className:`gap-1 text-destructive`,children:[(0,R.jsx)(p,{className:`size-3`}),` `,e.startupState]});default:return(0,R.jsxs)(M,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(I,{className:`size-3`}),` not connected`]})}}function B(){let[e,t]=(0,L.useState)([]),[n,c]=(0,L.useState)(``),[p,h]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(!1),[D,O]=(0,L.useState)(null),[j,N]=(0,L.useState)(!1),F=(0,L.useCallback)(async()=>{try{let[{servers:e},{toml:n}]=await Promise.all([i(`/api/mcp`),i(`/api/mcp/config`)]);t(e),p||c(n),w(null)}catch(e){w(e instanceof Error?e.message:String(e))}},[p]);(0,L.useEffect)(()=>{F()},[F]);let I=(0,L.useCallback)(async e=>{E(!0),w(null);try{await e(),await F()}catch(e){w(e instanceof Error?e.message:String(e))}finally{E(!1)}},[F]),B=()=>I(()=>a(`/api/mcp/reload`)),H=()=>I(async()=>{await o(`/api/mcp/config`,{toml:n}),h(!1),await a(`/api/mcp/reload`)}),U=e=>I(async()=>{await a(`/api/mcp/servers/${e.name}/enable`,{enabled:!e.enabled}),await a(`/api/mcp/reload`)}),W=e=>I(async()=>{window.confirm(`Remove MCP server "${e}"?`)&&(await r(`/api/mcp/servers/${e}`),await a(`/api/mcp/reload`))});return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`h1`,{className:`text-base font-semibold`,children:`MCP servers`}),(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,R.jsxs)(A,{size:`sm`,variant:`outline`,onClick:B,disabled:T,children:[(0,R.jsx)(x,{className:`size-3.5`}),` Reload`]}),(0,R.jsxs)(A,{size:`sm`,onClick:()=>N(!0),disabled:T,children:[(0,R.jsx)(b,{className:`size-3.5`}),` Add server`]})]})]}),C&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:C}),(0,R.jsxs)(y,{defaultValue:`servers`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(v,{children:[(0,R.jsx)(g,{value:`servers`,children:`Servers`}),(0,R.jsx)(g,{value:`toml`,children:`config.toml`})]}),(0,R.jsx)(_,{value:`servers`,className:`min-h-0 flex-1 overflow-auto pt-2`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.map(e=>(0,R.jsx)(`div`,{className:`rounded-lg border bg-card`,children:(0,R.jsxs)(f,{open:D===e.name,onOpenChange:t=>O(t?e.name:null),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,R.jsx)(k,{className:`size-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,R.jsx)(z,{server:e}),e.tools.length>0&&(0,R.jsxs)(M,{variant:`outline`,children:[e.tools.length,` tools`]}),e.authStatus===`notLoggedIn`&&(0,R.jsxs)(M,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(m,{className:`size-3`}),` login required`]})]}),(0,R.jsx)(`code`,{className:`block truncate text-xs text-muted-foreground`,children:e.url??[e.command,...e.args??[]].join(` `)}),e.envKeys&&e.envKeys.length>0&&(0,R.jsxs)(`div`,{className:`text-xs text-muted-foreground/70`,children:[`env: `,e.envKeys.map(e=>`${e}=••••`).join(` `)]})]}),(0,R.jsx)(A,{size:`sm`,variant:`outline`,onClick:()=>U(e),disabled:T,children:e.enabled?`Disable`:`Enable`}),(0,R.jsx)(A,{size:`icon-sm`,variant:`ghost`,className:`text-destructive hover:text-destructive`,onClick:()=>W(e.name),disabled:T,children:(0,R.jsx)(S,{})}),e.tools.length>0&&(0,R.jsx)(d,{className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted`,children:(0,R.jsx)(l,{className:s(`size-4 transition-transform`,D===e.name&&`rotate-90`)})})]}),(0,R.jsx)(u,{children:(0,R.jsx)(`div`,{className:`grid gap-1 border-t p-3 sm:grid-cols-2`,children:e.tools.map(e=>(0,R.jsxs)(`div`,{className:`rounded-md bg-muted/40 px-2 py-1.5`,children:[(0,R.jsx)(`code`,{className:`text-xs font-medium`,children:e.name}),e.description&&(0,R.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,title:e.description,children:e.description})]},e.name))})})]})},e.name)),e.length===0&&(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-12 text-center text-sm text-muted-foreground`,children:[(0,R.jsx)(k,{className:`size-8`}),`No MCP servers configured. Add one to give Codex extra tools.`]})]})}),(0,R.jsxs)(_,{value:`toml`,className:`flex min-h-0 flex-1 flex-col gap-2 pt-2`,children:[(0,R.jsx)(P,{value:n,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{c(e.target.value),h(!0)}}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(A,{size:`sm`,onClick:H,disabled:!p||T,children:T?`Saving…`:`Save & reload`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Editing here preserves your comments; structured edits reformat the file.`})]})]})]}),(0,R.jsx)(V,{open:j,onOpenChange:N,onAdded:()=>I(()=>a(`/api/mcp/reload`))})]})}function V({open:e,onOpenChange:t,onAdded:n}){let[r,i]=(0,L.useState)(``),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(!1);return(0,R.jsx)(O,{open:e,onOpenChange:t,children:(0,R.jsxs)(E,{children:[(0,R.jsxs)(T,{children:[(0,R.jsx)(D,{children:`Add MCP server`}),(0,R.jsxs)(w,{children:[`A stdio command server (e.g. `,(0,R.jsx)(`code`,{children:`npx -y @scope/pkg`}),`). For URL or advanced transports, use the config.toml tab.`]})]}),f&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:f}),(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-name`,children:`Name`}),(0,R.jsx)(j,{id:`mcp-name`,value:r,placeholder:`context7`,onChange:e=>i(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-command`,children:`Command`}),(0,R.jsx)(j,{id:`mcp-command`,value:o,placeholder:`npx`,onChange:e=>s(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-args`,children:`Args (space-separated)`}),(0,R.jsx)(j,{id:`mcp-args`,value:c,placeholder:`-y @upstash/context7-mcp`,onChange:e=>l(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-env`,children:`Env (KEY=value per line)`}),(0,R.jsx)(P,{id:`mcp-env`,value:u,rows:3,placeholder:`API_KEY=sk-…`,onChange:e=>d(e.target.value)})]})]}),(0,R.jsxs)(C,{children:[(0,R.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,R.jsx)(A,{onClick:async()=>{h(!0),p(null);try{let e={};for(let t of u.split(/\r?\n/)){let n=t.indexOf(`=`);n>0&&(e[t.slice(0,n).trim()]=t.slice(n+1).trim())}await a(`/api/mcp/servers`,{name:r.trim(),command:o.trim()||void 0,args:c.trim()?c.trim().split(/\s+/):void 0,env:Object.keys(e).length>0?e:void 0}),t(!1),i(``),s(``),l(``),d(``),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}},disabled:m||r.trim().length===0||o.trim().length===0,children:m?`Adding…`:`Add & reload`})]})]})})}export{B as McpPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as r,I as i,R as a,t as o}from"./utils-BX1Diber.js";import{t as s}from"./checkbox-B77q6yf0.js";import{t as c}from"./rotate-cw-B1ZRM7VI.js";import{t as l}from"./trash-2-D4CnL8wv.js";import{Qt as u}from"./index-CqEDC1ie.js";import{t as d}from"./button-Cg-0y2B2.js";import{t as f}from"./input-B0qeLI2E.js";import{t as p}from"./badge-DjyNiZCE.js";import{t as m}from"./label-CxX4-RmK.js";import{t as h}from"./textarea-5JHEEgU-.js";var g=e(t(),1),_=n();function v(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function y(){let[e,t]=(0,g.useState)(null),[n,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),A=(0,g.useCallback)(async()=>{try{let e=await i(`/api/memories`);t(e),k(e.settings.minRateLimitRemainingPercent===void 0?``:String(e.settings.minRateLimitRemainingPercent)),y(null)}catch(e){y(e instanceof Error?e.message:String(e))}},[]);(0,g.useEffect)(()=>{A()},[A]);let j=(0,g.useCallback)(async e=>{x(!0),y(null);try{await e(),await A()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(!1)}},[A]),M=()=>j(()=>a(`/api/memories/config`,{enabled:!e?.enabled})),N=e=>j(()=>a(`/api/memories/config`,{settings:e})),P=()=>{let e=Number(O);if(!Number.isFinite(e)||e<0||e>100){y(`Rate-limit threshold must be a number between 0 and 100`);return}N({minRateLimitRemainingPercent:e})},F=e=>j(async()=>{let t=await i(`/api/memories/file?path=${encodeURIComponent(e.path)}`);C(t.path),T(t.content),D(!1)}),I=()=>j(async()=>{S&&(await a(`/api/memories/file`,{path:S,content:w}),D(!1))}),L=e=>j(async()=>{window.confirm(`Delete memory file "${e}"?`)&&(await r(`/api/memories/file?path=${encodeURIComponent(e)}`),S===e&&(C(null),T(``),D(!1)))}),R=e?.enabled??!1,z=e?.settings??{},B=e?.files??[];return(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h1`,{className:`text-base font-semibold`,children:`Memories`}),(0,_.jsx)(p,{variant:`outline`,children:`beta`}),e&&e.liveEnabled!==null&&e.liveEnabled!==R&&(0,_.jsx)(p,{variant:`outline`,className:`text-amber-600`,children:`engine state differs — restart pending`}),(0,_.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,_.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>A(),disabled:b,children:[(0,_.jsx)(c,{className:`size-3.5`}),` Refresh`]}),(0,_.jsx)(d,{size:`sm`,onClick:M,disabled:b||!e,children:R?`Disable`:`Enable`})]})]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Codex turns useful context from past sessions into local memory files and brings them into new conversations. Memories are global across workspaces (they live in the shared Codex home) and are generated in the background — new files can take a while to appear.`}),n&&(0,_.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:n}),(0,_.jsxs)(`div`,{className:o(`flex flex-col gap-3`,!R&&`opacity-60`),children:[(0,_.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,_.jsx)(`div`,{className:`mb-2 text-sm font-medium`,children:`Behavior`}),(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.generateMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({generateMemories:e===!0})}),`Generate memories from new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.useMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({useMemories:e===!0})}),`Use existing memories in new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{checked:z.disableOnExternalContext===!0,disabled:b||!R,onCheckedChange:e=>N({disableOnExternalContext:e===!0})}),`Skip sessions that used external context (MCP tools, web search)`]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(m,{htmlFor:`mem-rate`,className:`font-normal`,children:`Pause generation below`}),(0,_.jsx)(f,{id:`mem-rate`,type:`number`,min:0,max:100,placeholder:`25`,className:`h-7 w-20`,value:O,disabled:b||!R,onChange:e=>k(e.target.value),onBlur:()=>{O!==``&&P()},onKeyDown:e=>{e.key===`Enter`&&O!==``&&P()}}),(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`% rate limit remaining`})]})]}),(0,_.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:`Behavior settings are read by the engine at startup; the on/off toggle applies immediately.`})]}),(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex w-72 shrink-0 flex-col gap-1 overflow-auto`,children:[(0,_.jsxs)(`div`,{className:`text-sm font-medium`,children:[`Memory files`,B.length>0&&` (${B.length})`]}),B.map(e=>(0,_.jsxs)(`div`,{className:o(`group flex cursor-pointer items-center gap-2 rounded-md border px-2 py-1.5`,S===e.path?`border-foreground/30 bg-muted/60`:`bg-card hover:bg-muted/40`),onClick:()=>F(e),children:[(0,_.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`truncate text-sm`,title:e.path,children:e.path}),(0,_.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[v(e.size),` · `,new Date(e.modifiedAt).toLocaleString()]})]}),(0,_.jsx)(d,{size:`icon-sm`,variant:`ghost`,className:`invisible text-destructive hover:text-destructive group-hover:visible`,disabled:b,onClick:t=>{t.stopPropagation(),L(e.path)},children:(0,_.jsx)(l,{})})]},e.path)),B.length===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,_.jsx)(u,{className:`size-8`}),R?`No memories yet. Codex builds them in the background from finished sessions.`:`Enable memories to let Codex remember context across sessions.`]})]}),(0,_.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2`,children:S?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`code`,{className:`truncate text-xs text-muted-foreground`,children:S}),(0,_.jsx)(d,{size:`sm`,className:`ml-auto`,onClick:I,disabled:!E||b,children:b?`Saving…`:`Save`})]}),(0,_.jsx)(h,{value:w,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{T(e.target.value),D(!0)}})]}):(0,_.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Select a memory file to inspect or edit it`})})]})]})]})}export{y as MemoriesPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as r,H as i,I as a,L as o,R as s,t as c}from"./utils-BX1Diber.js";import{a as l,i as u,n as d,r as f,t as p}from"./select-CF2SUxSi.js";import{t as m}from"./checkbox-B77q6yf0.js";import{t as h}from"./play-B4R5rXMZ.js";import{E as g}from"./useCompositeListItem-CJiAiQsj.js";import{t as _}from"./rotate-cw-B1ZRM7VI.js";import{t as v}from"./trash-2-D4CnL8wv.js";import{Zt as y,en as b}from"./index-CqEDC1ie.js";import{t as x}from"./button-Cg-0y2B2.js";import{t as S}from"./input-B0qeLI2E.js";import{t as C}from"./badge-DjyNiZCE.js";import{t as w}from"./label-CxX4-RmK.js";import{t as T}from"./textarea-5JHEEgU-.js";var E=e(t(),1),D=n(),O={unattended:{label:`Unattended`,hint:`A Codex subagent approves for you · workspace-write (recommended for 24/7)`,mode:{sandbox:`workspaceWrite`,approvalPolicy:`onRequest`,approvalsReviewer:`auto_review`}},all:{label:`Allow everything`,hint:`⚠ No approvals + full disk/network access. Use with care.`,mode:{sandbox:`dangerFullAccess`,approvalPolicy:`never`,approvalsReviewer:`user`}}};function k(e){for(let t of Object.keys(O)){let n=O[t].mode;if(e.sandbox===n.sandbox&&e.approvalPolicy===n.approvalPolicy&&e.approvalsReviewer===n.approvalsReviewer)return t}return`unattended`}var A=[{label:`Every hour`,cron:`0 * * * *`},{label:`Daily 9am`,cron:`0 9 * * *`},{label:`Weekdays 9am`,cron:`0 9 * * 1-5`},{label:`Mondays 8am`,cron:`0 8 * * 1`},{label:`1st of month`,cron:`0 9 1 * *`}];function j(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function M(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}var N=Intl.DateTimeFormat().resolvedOptions().timeZone;function P(){return{name:``,prompt:``,kind:`cron`,cron:`0 9 * * *`,runAtLocal:``,tz:N,modeKey:`unattended`,model:``,effort:``,resume:!1,enabled:!0}}function F(e){return{name:e.name,prompt:e.prompt,kind:e.kind,cron:e.cron??`0 9 * * *`,runAtLocal:j(e.runAt),tz:e.tz??``,modeKey:k(e.mode),model:e.mode.model??``,effort:e.mode.effort??``,resume:e.resume??!1,enabled:e.enabled}}function I(){let{activeProjectId:e,activeProject:t}=b(),[n,k]=(0,E.useState)([]),[j,I]=(0,E.useState)([]),[L,R]=(0,E.useState)(null),[z,B]=(0,E.useState)(!1),[V,H]=(0,E.useState)(P),[U,W]=(0,E.useState)(null),[G,K]=(0,E.useState)(!1),q=(0,E.useCallback)(async()=>{try{let{schedules:t}=await a(i(`/api/schedules`,e));k(t),W(null)}catch(e){W(e instanceof Error?e.message:String(e))}},[e]);(0,E.useEffect)(()=>{q()},[q]),(0,E.useEffect)(()=>{a(`/api/models`).then(({models:e})=>I(e)).catch(()=>{})},[]),(0,E.useEffect)(()=>{R(null),B(!1)},[e]);let J=()=>{R(null),B(!0),H(P()),W(null)},ee=e=>{R(e.id),B(!1),H(F(e)),W(null)},Y=(0,E.useCallback)(async e=>{K(!0),W(null);try{await e(),await q()}catch(e){W(e instanceof Error?e.message:String(e))}finally{K(!1)}},[q]),te=()=>{let t=O[V.modeKey].mode;return{name:V.name,prompt:V.prompt,projectId:e,kind:V.kind,cron:V.kind===`cron`?V.cron:void 0,runAt:V.kind===`once`&&V.runAtLocal?new Date(V.runAtLocal).toISOString():void 0,tz:V.tz||void 0,mode:{...t,model:V.model||void 0,effort:V.effort||void 0},resume:V.resume,enabled:V.enabled}},ne=()=>{if(!V.name.trim()){W(`Name is required`);return}if(!V.prompt.trim()){W(`Prompt is required`);return}Y(async()=>{let t=te();if(z){let{schedule:n}=await o(i(`/api/schedules`,e),t);R(n.id),B(!1),H(F(n))}else if(L){let{schedule:e}=await s(`/api/schedules/${L}`,t);H(F(e))}})},re=e=>Y(()=>s(`/api/schedules/${e.id}`,{enabled:!e.enabled})),X=e=>Y(()=>o(`/api/schedules/${e.id}/run`)),ie=e=>Y(async()=>{window.confirm(`Delete schedule "${e.name}"?`)&&(await r(`/api/schedules/${e.id}`),L===e.id&&(R(null),B(!1)))}),Z=(0,E.useMemo)(()=>n.find(e=>e.id===L)??null,[n,L]),ae=z||Z!==null,Q=j.find(e=>e.model===V.model),oe=Q?.supportedReasoningEfforts??[],$=(e,t)=>H(n=>({...n,[e]:t}));return(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`h1`,{className:`text-base font-semibold`,children:`Schedules`}),(0,D.jsx)(C,{variant:`outline`,children:t?.name??e}),(0,D.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,D.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>q(),disabled:G,children:[(0,D.jsx)(_,{className:`size-3.5`}),` Refresh`]}),(0,D.jsxs)(x,{size:`sm`,onClick:J,disabled:G,children:[(0,D.jsx)(g,{className:`size-3.5`}),` New schedule`]})]})]}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Run a prompt automatically on a cron schedule or once at a set time. Scheduled runs fire in the background and appear in the Runs page — they default to Unattended mode so approvals don't block while no one is watching.`}),U&&(0,D.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:U}),(0,D.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex w-80 shrink-0 flex-col gap-1 overflow-auto`,children:[n.map(e=>(0,D.jsxs)(`div`,{className:c(`group flex cursor-pointer items-start gap-2 rounded-md border px-2 py-2`,L===e.id?`border-foreground/30 bg-muted/60`:`bg-card hover:bg-muted/40`),onClick:()=>ee(e),children:[(0,D.jsx)(y,{className:c(`mt-0.5 size-4 shrink-0`,e.enabled?`text-foreground`:`text-muted-foreground`)}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),!e.enabled&&(0,D.jsx)(C,{variant:`outline`,className:`text-muted-foreground`,children:`paused`})]}),(0,D.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.kind===`cron`?(0,D.jsx)(`code`,{children:e.cron}):`once · ${M(e.runAt)}`}),(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.enabled?`next: ${M(e.nextRunAt)}`:`paused`}),e.lastError&&(0,D.jsxs)(`div`,{className:`truncate text-xs text-destructive`,title:e.lastError,children:[`last error: `,e.lastError]})]}),(0,D.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-1`,children:[(0,D.jsx)(x,{size:`icon-sm`,variant:`ghost`,title:`Run now`,disabled:G,onClick:t=>{t.stopPropagation(),X(e)},children:(0,D.jsx)(h,{})}),(0,D.jsx)(x,{size:`icon-sm`,variant:`ghost`,className:`text-destructive hover:text-destructive`,title:`Delete`,disabled:G,onClick:t=>{t.stopPropagation(),ie(e)},children:(0,D.jsx)(v,{})})]})]},e.id)),n.length===0&&(0,D.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,D.jsx)(y,{className:`size-8`}),`No schedules in this workspace yet. Create one to run a prompt on a timer.`]})]}),(0,D.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-auto`,children:ae?(0,D.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border bg-card p-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-sm font-medium`,children:z?`New schedule`:`Edit schedule`}),Z&&(0,D.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,D.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>X(Z),disabled:G,children:[(0,D.jsx)(h,{className:`size-3.5`}),` Run now`]}),(0,D.jsx)(x,{size:`sm`,variant:`outline`,onClick:()=>re(Z),disabled:G,children:Z.enabled?`Pause`:`Resume`})]})]}),(0,D.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,D.jsx)(w,{htmlFor:`sch-name`,children:`Name`}),(0,D.jsx)(S,{id:`sch-name`,value:V.name,placeholder:`Morning report`,onChange:e=>$(`name`,e.target.value)})]}),(0,D.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,D.jsx)(w,{htmlFor:`sch-prompt`,children:`Prompt`}),(0,D.jsx)(T,{id:`sch-prompt`,value:V.prompt,placeholder:`What should the agent do each time?`,className:`min-h-24 resize-y font-mono text-sm`,onChange:e=>$(`prompt`,e.target.value)})]}),(0,D.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,D.jsx)(w,{children:`When`}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsxs)(p,{value:V.kind,onValueChange:e=>$(`kind`,e??`cron`),children:[(0,D.jsx)(u,{size:`sm`,className:`w-32`,children:(0,D.jsx)(l,{children:V.kind===`cron`?`Repeating`:`One-off`})}),(0,D.jsxs)(d,{children:[(0,D.jsx)(f,{value:`cron`,children:`Repeating (cron)`}),(0,D.jsx)(f,{value:`once`,children:`One-off`})]})]}),V.kind===`cron`?(0,D.jsx)(S,{value:V.cron,placeholder:`0 9 * * *`,className:`w-44 font-mono`,onChange:e=>$(`cron`,e.target.value)}):(0,D.jsx)(S,{type:`datetime-local`,value:V.runAtLocal,className:`w-56`,onChange:e=>$(`runAtLocal`,e.target.value)})]}),V.kind===`cron`&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:A.map(e=>(0,D.jsx)(x,{size:`sm`,variant:`outline`,className:`h-6 text-xs`,onClick:()=>$(`cron`,e.cron),children:e.label},e.cron))}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(w,{htmlFor:`sch-tz`,className:`font-normal text-muted-foreground`,children:`Timezone`}),(0,D.jsx)(S,{id:`sch-tz`,value:V.tz,placeholder:N,className:`h-7 w-56`,onChange:e=>$(`tz`,e.target.value)})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Cron fields: minute hour day-of-month month day-of-week. Times are evaluated in the timezone above (defaults to the daemon's local time if blank).`})]}),(0,D.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,D.jsx)(w,{children:`Run mode`}),(0,D.jsxs)(p,{value:V.modeKey,onValueChange:e=>$(`modeKey`,e??`unattended`),children:[(0,D.jsx)(u,{size:`sm`,className:`w-full`,children:(0,D.jsx)(l,{children:O[V.modeKey].label})}),(0,D.jsx)(d,{children:Object.keys(O).map(e=>(0,D.jsx)(f,{value:e,children:(0,D.jsxs)(`span`,{className:`channel-mode-item`,children:[(0,D.jsx)(`span`,{className:`channel-mode-label`,children:O[e].label}),(0,D.jsx)(`span`,{className:`channel-mode-hint`,children:O[e].hint})]})},e))})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,D.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[(0,D.jsx)(w,{children:`Model`}),(0,D.jsxs)(p,{value:V.model||`__default`,onValueChange:e=>$(`model`,e===`__default`?``:e??``),children:[(0,D.jsx)(u,{size:`sm`,className:`w-full`,children:(0,D.jsx)(l,{children:Q?.displayName??`Engine default`})}),(0,D.jsxs)(d,{children:[(0,D.jsx)(f,{value:`__default`,children:`Engine default`}),j.map(e=>(0,D.jsxs)(f,{value:e.model,children:[e.displayName,e.isDefault?` · default`:``]},e.id))]})]})]}),(0,D.jsxs)(`div`,{className:`grid flex-1 gap-1.5`,children:[(0,D.jsx)(w,{children:`Reasoning effort`}),(0,D.jsxs)(p,{value:V.effort||`__default`,onValueChange:e=>$(`effort`,e===`__default`?``:e??``),children:[(0,D.jsx)(u,{size:`sm`,className:`w-full`,children:(0,D.jsx)(l,{children:V.effort||`Default (medium)`})}),(0,D.jsxs)(d,{children:[(0,D.jsx)(f,{value:`__default`,children:`Default (medium)`}),oe.map(e=>(0,D.jsx)(f,{value:e.reasoningEffort,children:e.reasoningEffort},e.reasoningEffort))]})]})]})]}),(0,D.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,D.jsx)(m,{checked:V.resume,onCheckedChange:e=>$(`resume`,e===!0)}),`Resume one persistent conversation each fire (context accumulates across runs)`]}),(0,D.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,D.jsx)(m,{checked:V.enabled,onCheckedChange:e=>$(`enabled`,e===!0)}),`Enabled`]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(x,{onClick:ne,disabled:G,children:G?`Saving…`:z?`Create schedule`:`Save changes`}),(0,D.jsx)(x,{variant:`ghost`,onClick:()=>{B(!1),R(null)},disabled:G,children:`Cancel`})]}),Z&&(0,D.jsxs)(`div`,{className:`mt-1 grid gap-0.5 border-t pt-2 text-xs text-muted-foreground`,children:[(0,D.jsxs)(`div`,{children:[`Next run: `,M(Z.nextRunAt)]}),(0,D.jsxs)(`div`,{children:[`Last run: `,M(Z.lastRunAt)]}),Z.lastRunId&&(0,D.jsxs)(`div`,{children:[`Last run id: `,Z.lastRunId]}),Z.lastError&&(0,D.jsxs)(`div`,{className:`text-destructive`,children:[`Last error: `,Z.lastError]})]})]}):(0,D.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Select a schedule to edit, or create a new one.`})})]})]})}export{I as SchedulesPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{I as r,L as i,R as a}from"./utils-BX1Diber.js";import{x as o}from"./useBaseUiId-dSIElxm7.js";import{t as s}from"./external-link-DiZ5uX5z.js";import{t as c}from"./key-round-D965pLEl.js";import{t as l}from"./rotate-cw-B1ZRM7VI.js";import{Yt as u}from"./index-CqEDC1ie.js";import{t as d}from"./button-Cg-0y2B2.js";import{t as f}from"./input-B0qeLI2E.js";import{t as p}from"./badge-DjyNiZCE.js";var m=o(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),h=o(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),g=o(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),_=e(t(),1),v=n(),y=2e3;function b(){let[e,t]=(0,_.useState)(null),[n,o]=(0,_.useState)(null),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(null),[k,A]=(0,_.useState)(null),[j,M]=(0,_.useState)(``),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(!1),z=(0,_.useCallback)(async()=>{try{let e=await r(`/api/account`);return o(e),x(null),e}catch(e){return x(e instanceof Error?e.message:String(e)),null}},[]);(0,_.useEffect)(()=>{r(`/api/status`).then(t).catch(()=>{}),r(`/api/settings`).then(e=>{A(e),P(e.browserProxy.noProxy??``)}).catch(()=>{}),z()},[z]);let B=(0,_.useCallback)(async e=>{I(!0),x(null);try{let t=await a(`/api/settings/browser-proxy`,e);A(t),M(``),P(t.browserProxy.noProxy??``),R(!0)}catch(e){x(e instanceof Error?e.message:String(e))}finally{I(!1)}},[]),V=()=>{let e={noProxy:N.trim()||null};return j.trim()&&(e.proxyUrl=j.trim()),B(e)},H=()=>B({proxyUrl:null,noProxy:null}),U=async()=>{I(!0),x(null);try{await i(`/api/browser/stop`),await i(`/api/browser/start`),R(!1)}catch(e){x(e instanceof Error?e.message:String(e))}finally{I(!1)}};(0,_.useEffect)(()=>{if(!n?.pendingLogin){O.current!==null&&(window.clearInterval(O.current),O.current=null);return}if(O.current===null)return O.current=window.setInterval(z,y),()=>{O.current!==null&&(window.clearInterval(O.current),O.current=null)}},[n?.pendingLogin,z]);let W=(0,_.useCallback)(async e=>{C(!0),x(null);try{o(await e())}catch(e){x(e instanceof Error?e.message:String(e))}finally{C(!1)}},[]),G=()=>W(async()=>{let e=await i(`/api/account/login`,{type:`chatgpt`});return e.pendingLogin?.authUrl&&window.open(e.pendingLogin.authUrl,`_blank`,`noopener`),e}),K=()=>W(()=>i(`/api/account/login`,{type:`chatgptDeviceCode`})),q=()=>W(async()=>{let e=await i(`/api/account/login`,{type:`apiKey`,apiKey:w.trim()});return T(``),D(!1),e}),J=()=>W(()=>i(`/api/account/login/cancel`)),Y=()=>W(()=>i(`/api/account/logout`)),X=n?.pendingLogin??null,Z=n?.lastLoginResult??null;return(0,v.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 overflow-auto p-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`h1`,{className:`text-base font-semibold`,children:`Settings`}),(0,v.jsx)(`div`,{className:`ml-auto`,children:(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>z(),disabled:S,children:[(0,v.jsx)(l,{className:`size-3.5`}),` Refresh`]})})]}),b&&(0,v.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:b}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsx)(`div`,{className:`mb-1 text-sm font-medium`,children:`Codex account`}),(0,v.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`The engine's sign-in — shared by every workspace. Auth is stored in the Jun Codex home, separate from your personal `,(0,v.jsx)(`code`,{children:`~/.codex`}),`.`]}),n?n.account?(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(g,{className:`size-4 text-muted-foreground`}),n.account.type===`chatgpt`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-sm`,children:n.account.email}),(0,v.jsxs)(p,{variant:`outline`,children:[`ChatGPT · `,n.account.planType]})]}):n.account.type===`apiKey`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-sm`,children:`Signed in with an OpenAI API key`}),(0,v.jsx)(p,{variant:`outline`,children:`API key`})]}):(0,v.jsx)(p,{variant:`outline`,children:`Amazon Bedrock`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,className:`ml-auto`,onClick:Y,disabled:S,children:[(0,v.jsx)(m,{className:`size-3.5`}),` Sign out`]})]}):X?(0,v.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[X.type===`chatgpt`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`p`,{className:`text-sm`,children:`Finish signing in to ChatGPT in the browser tab that just opened.`}),X.authUrl&&(0,v.jsxs)(`a`,{href:X.authUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-muted-foreground underline underline-offset-2`,children:[`Open the sign-in page again `,(0,v.jsx)(s,{className:`size-3.5`})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The sign-in callback lands on this machine — if Jun runs on a remote server, cancel and use the device code instead.`})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`p`,{className:`text-sm`,children:[`Sign in at`,` `,X.verificationUrl?(0,v.jsx)(`a`,{href:X.verificationUrl,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2`,children:X.verificationUrl}):`the verification page`,` `,`and enter this code:`]}),(0,v.jsx)(`div`,{className:`w-fit rounded-md border bg-muted/40 px-4 py-2 font-mono text-xl tracking-widest`,children:X.userCode})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Waiting for sign-in…`}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:J,disabled:S,children:`Cancel`})]})]}):(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[Z&&!Z.success&&(0,v.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[`Sign-in failed`,Z.error?`: ${Z.error}`:`.`]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsxs)(d,{size:`sm`,onClick:K,disabled:S,children:[(0,v.jsx)(h,{className:`size-3.5`}),` Sign in with ChatGPT`]}),(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:G,disabled:S,children:`Browser sign-in (local only)`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>D(e=>!e),disabled:S,children:[(0,v.jsx)(c,{className:`size-3.5`}),` Use an API key`]})]}),E&&(0,v.jsxs)(`div`,{className:`flex max-w-md items-center gap-2`,children:[(0,v.jsx)(f,{type:`password`,placeholder:`sk-…`,value:w,autoComplete:`off`,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w.trim()&&q()}}),(0,v.jsx)(d,{size:`sm`,onClick:q,disabled:S||!w.trim(),children:`Sign in`})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sign-in uses a device code: open the link on any device, enter the code — works headless (VPS). Browser sign-in needs its callback to reach this machine, so use it only when Jun runs locally.`})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-sm font-medium`,children:[(0,v.jsx)(u,{className:`size-4 text-muted-foreground`}),` Browser proxy`]}),(0,v.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`Routes the agent browser through a proxy (e.g. a residential exit when the host IP is datacenter space sites block). Browser traffic only — Codex API traffic is never proxied. Applies when the browser session (re)starts.`}),k?(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:k.browserProxy.proxyUrl?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`code`,{className:`rounded bg-muted/40 px-2 py-1 text-xs`,children:k.browserProxy.proxyUrl}),(0,v.jsx)(p,{variant:`outline`,children:k.browserProxy.source===`settings`?`from settings`:`from environment`}),k.browserProxy.source===`settings`&&(0,v.jsx)(d,{size:`sm`,variant:`outline`,onClick:H,disabled:F,children:`Clear`})]}):(0,v.jsx)(`span`,{className:`text-muted-foreground`,children:`No proxy configured — the browser uses the host connection directly.`})}),(0,v.jsxs)(`div`,{className:`flex max-w-xl flex-col gap-2`,children:[(0,v.jsx)(f,{type:`password`,placeholder:k.browserProxy.proxyUrl?`Replace proxy URL: http://user:pass@host:port`:`http://user:pass@host:port`,value:j,autoComplete:`off`,onChange:e=>M(e.target.value)}),(0,v.jsx)(f,{placeholder:`Bypass list (optional), e.g. localhost,*.internal`,value:N,onChange:e=>P(e.target.value)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(d,{size:`sm`,onClick:V,disabled:F||!j.trim()&&(N.trim()||``)===(k.browserProxy.noProxy??``),children:`Save`}),L&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saved — restart the browser session to apply.`}),(0,v.jsxs)(d,{size:`sm`,variant:`outline`,onClick:U,disabled:F,children:[(0,v.jsx)(l,{className:`size-3.5`}),` Restart browser`]})]})]})]})]}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,v.jsx)(`div`,{className:`mb-2 text-sm font-medium`,children:`Daemon status`}),e?(0,v.jsx)(`pre`,{className:`overflow-auto rounded-md bg-muted/40 p-2 text-xs`,children:JSON.stringify(e,null,2)}):(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})]})]})}export{b as SettingsPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{F as ee,H as r,I as i,L as a,R as te,t as ne}from"./utils-BX1Diber.js";import{x as o}from"./useBaseUiId-dSIElxm7.js";import{t as re}from"./external-link-DiZ5uX5z.js";import{a as s,i as c,n as l,r as ie,t as ae}from"./tabs-CpVOS0Mr.js";import{E as oe}from"./useCompositeListItem-CJiAiQsj.js";import{t as se}from"./search-09Pme-NO.js";import{t as ce}from"./trash-2-D4CnL8wv.js";import{a as le,i as u,o as d,r as ue,s as f,t as p}from"./dialog-CPRWiMQj.js";import{$t as m,en as de,tn as fe}from"./index-CqEDC1ie.js";import{t as h}from"./button-Cg-0y2B2.js";import{t as g}from"./input-B0qeLI2E.js";import{t as _}from"./badge-DjyNiZCE.js";import{t as v}from"./label-CxX4-RmK.js";import{t as y}from"./textarea-5JHEEgU-.js";var pe=o(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),me=o(`download`,[[`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`}]]),he=o(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),ge=o(`store`,[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]),b=e(t(),1),x=n();function S({className:e,...t}){return(0,x.jsx)(s,{role:`status`,"aria-label":`Loading`,className:ne(`size-4 animate-spin`,e),...t})}function _e(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(e.replace(/^/,``));if(!t)return{name:``,description:``,body:e,ok:!1};let n={};for(let e of t[1].split(/\r?\n/)){let t=/^([A-Za-z_][\w-]*):\s*(.*)$/.exec(e);t&&(n[t[1].toLowerCase()]=t[2].trim().replace(/^["']|["']$/g,``))}return{name:n.name??``,description:n.description??``,body:t[2].replace(/^\r?\n/,``),ok:!0}}function C(e,t,n){return`---\nname: ${e}\ndescription: ${t}\n---\n\n${n.trim()}\n`}function w(){let{activeProjectId:e,activeProject:t}=de(),[n,o]=(0,b.useState)([]),[s,w]=(0,b.useState)(null),[T,E]=(0,b.useState)(null),[D,O]=(0,b.useState)(``),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(!1),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(null),[ve,L]=(0,b.useState)(!1),[R,z]=(0,b.useState)(``),[B,V]=(0,b.useState)(``),[H,ye]=(0,b.useState)(``),[be,U]=(0,b.useState)(null),[W,G]=(0,b.useState)(!1),[xe,Se]=(0,b.useState)(!1),[K,Ce]=(0,b.useState)(``),[we,Te]=(0,b.useState)([]),[q,Ee]=(0,b.useState)(!1),[De,Oe]=(0,b.useState)(!1),[ke,J]=(0,b.useState)(null),[Y,Ae]=(0,b.useState)(null),[je,Me]=(0,b.useState)(new Set),X=(0,b.useCallback)(async()=>{try{let{skills:t}=await i(r(`/api/skills`,e));o(t),I(null)}catch(e){I(e instanceof Error?e.message:String(e))}},[e]);(0,b.useEffect)(()=>{X()},[X]),(0,b.useEffect)(()=>{w(null),E(null)},[e]);let Z=(0,b.useCallback)(async t=>{w(t),E(null),U(null),M(!0);try{let{skill:n}=await i(r(`/api/skills/${t}`,e));E(n),O(n.content),A(!1)}catch(e){I(e instanceof Error?e.message:String(e))}finally{M(!1)}},[e]),Q=(0,b.useMemo)(()=>_e(D),[D]),Ne=async()=>{if(!(!s||N)){P(!0),I(null);try{let{skill:t}=await te(r(`/api/skills/${s}`,e),{content:D});E(t),O(t.content),A(!1),await X()}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}},Pe=async()=>{let t=R.trim(),n=B.trim();if(!(!t||!n)){I(null);try{let{skill:ee}=await a(r(`/api/skills`,e),{name:t,description:n});L(!1),z(``),V(``),await X(),await Z(ee.info.id)}catch(e){I(e instanceof Error?e.message:String(e))}}},Fe=async()=>{if(s&&window.confirm(`Delete skill "${s}"? This removes its folder.`))try{await ee(r(`/api/skills/${s}`,e)),w(null),E(null),await X()}catch(e){I(e instanceof Error?e.message:String(e))}},Ie=async()=>{if(!(!s||!T))try{await a(r(`/api/skills/${s}/enable`,e),{enabled:!T.info.enabled}),await X(),await Z(s)}catch(e){I(e instanceof Error?e.message:String(e))}},Le=async()=>{if(!(!s||W)){G(!0),U(null),I(null);try{let{run:t}=await a(r(`/api/skills/${s}/test`,e),{prompt:H.trim()||void 0});U(t)}catch(e){I(e instanceof Error?e.message:String(e))}finally{G(!1)}}},Re=async()=>{let e=K.trim();if(!(!e||q)){Ee(!0),J(null);try{let{results:t}=await i(`/api/skills/registry/search?q=${encodeURIComponent(e)}`);Te(t),Oe(!0)}catch(e){J(e instanceof Error?e.message:String(e))}finally{Ee(!1)}}},ze=async t=>{if(!Y){Ae(t),J(null);try{let n=await a(r(`/api/skills/registry/install`,e),{source:t});Me(e=>new Set(e).add(t)),o(n.skills)}catch(e){J(e instanceof Error?e.message:String(e))}finally{Ae(null)}}},$=(e,t)=>{O(e===`description`?C(Q.name||s||``,t,Q.body):C(Q.name||s||``,Q.description,t)),A(!0)};return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,x.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-r`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,x.jsx)(`span`,{className:`text-sm font-semibold`,children:`Skills`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,x.jsxs)(h,{size:`sm`,variant:`outline`,onClick:()=>Se(!0),children:[(0,x.jsx)(ge,{className:`size-3.5`}),` Browse`]}),(0,x.jsx)(h,{size:`icon-sm`,variant:`outline`,onClick:()=>L(!0),children:(0,x.jsx)(oe,{})})]})]}),(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[n.map(e=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>Z(e.id),className:ne(`w-full rounded-md px-2.5 py-2 text-left transition-colors hover:bg-muted/60`,e.id===s&&`bg-muted`),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),e.errors.length>0&&(0,x.jsx)(pe,{className:`size-3.5 shrink-0 text-destructive`}),!e.enabled&&(0,x.jsx)(_,{variant:`outline`,className:`shrink-0`,children:`disabled`})]}),(0,x.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.description||`No description`})]},e.id)),n.length===0&&(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,x.jsx)(m,{className:`size-8`}),`No skills in the `,t?.name??e,` workspace yet. Create one — it becomes a folder with a SKILL.md, available to runs in this workspace.`]})]})]}),(0,x.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col gap-3 p-4`,children:[F&&(0,x.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:F}),!s&&(0,x.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,x.jsx)(m,{className:`size-8`}),`Select a skill or create a new one.`]}),s&&j&&(0,x.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,x.jsx)(S,{})}),s&&T&&!j&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsx)(`h2`,{className:`text-base font-semibold`,children:T.info.name}),(0,x.jsx)(_,{variant:T.info.enabled?`secondary`:`outline`,children:T.info.enabled?`enabled`:`disabled`}),(0,x.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,x.jsx)(h,{size:`sm`,variant:`outline`,onClick:Ie,children:T.info.enabled?`Disable`:`Enable`}),(0,x.jsxs)(h,{size:`sm`,variant:`outline`,className:`text-destructive hover:text-destructive`,onClick:Fe,children:[(0,x.jsx)(ce,{className:`size-3.5`}),` Delete`]}),(0,x.jsx)(h,{size:`sm`,onClick:Ne,disabled:!k||N,children:N?`Saving…`:k?`Save`:`Saved`})]})]}),T.info.errors.length>0&&(0,x.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:T.info.errors.map(e=>(0,x.jsx)(`div`,{children:e},e))}),(0,x.jsxs)(ae,{defaultValue:Q.ok?`simple`:`advanced`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,x.jsxs)(ie,{children:[(0,x.jsx)(c,{value:`simple`,disabled:!Q.ok,children:`Simple`}),(0,x.jsx)(c,{value:`advanced`,children:`Advanced`}),(0,x.jsxs)(c,{value:`test`,children:[(0,x.jsx)(he,{className:`size-3.5`}),` Test`]})]}),(0,x.jsxs)(l,{value:`simple`,className:`flex min-h-0 flex-1 flex-col gap-3 pt-2`,children:[(0,x.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,x.jsx)(v,{htmlFor:`skill-description`,children:`Description`}),(0,x.jsx)(g,{id:`skill-description`,value:Q.description,placeholder:`When should Codex reach for this skill?`,onChange:e=>$(`description`,e.target.value)}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Codex reads this to decide when the skill applies.`})]}),(0,x.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-1.5`,children:[(0,x.jsx)(v,{htmlFor:`skill-instructions`,children:`Instructions`}),(0,x.jsx)(y,{id:`skill-instructions`,value:Q.body,placeholder:`Step-by-step instructions for Codex…`,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>$(`body`,e.target.value)})]})]}),(0,x.jsxs)(l,{value:`advanced`,className:`flex min-h-0 flex-1 flex-col gap-2 pt-2`,children:[(0,x.jsx)(y,{value:D,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{O(e.target.value),A(!0)}}),T.files.length>0&&(0,x.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Extra files: `,T.files.join(`, `),` (edit via the Files page)`]})]}),(0,x.jsxs)(l,{value:`test`,className:`flex flex-col gap-3 pt-2`,children:[(0,x.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,x.jsx)(v,{htmlFor:`test-prompt`,children:`Test prompt`}),(0,x.jsx)(y,{id:`test-prompt`,value:H,rows:3,placeholder:`Leave empty for a default prompt that exercises "${T.info.name}".`,onChange:e=>ye(e.target.value)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,x.jsx)(h,{size:`sm`,onClick:Le,disabled:W,children:W?`Starting…`:`Run test with Codex`}),be&&(0,x.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Test run started —`,` `,(0,x.jsx)(fe,{to:`/runs`,className:`text-primary underline-offset-2 hover:underline`,children:`watch it in Runs`})]})]}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The run loads this skill explicitly, so Codex follows its instructions even for a generic prompt.`})]})]})]})]}),(0,x.jsx)(p,{open:ve,onOpenChange:L,children:(0,x.jsxs)(ue,{children:[(0,x.jsxs)(d,{children:[(0,x.jsx)(f,{children:`New skill`}),(0,x.jsxs)(u,{children:[`Creates `,(0,x.jsx)(`code`,{children:`.agents/skills/<name>/SKILL.md`}),` in the`,` `,t?.name??e,` workspace.`]})]}),(0,x.jsxs)(`div`,{className:`grid gap-3`,children:[(0,x.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,x.jsx)(v,{htmlFor:`new-skill-name`,children:`Name`}),(0,x.jsx)(g,{id:`new-skill-name`,value:R,placeholder:`my-skill (lowercase, dashes)`,onChange:e=>z(e.target.value)})]}),(0,x.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,x.jsx)(v,{htmlFor:`new-skill-description`,children:`Description`}),(0,x.jsx)(g,{id:`new-skill-description`,value:B,placeholder:`What this skill does and when to use it`,onChange:e=>V(e.target.value)})]})]}),(0,x.jsxs)(le,{children:[(0,x.jsx)(h,{variant:`outline`,onClick:()=>L(!1),children:`Cancel`}),(0,x.jsx)(h,{onClick:Pe,disabled:R.trim().length===0||B.trim().length===0,children:`Create`})]})]})}),(0,x.jsx)(p,{open:xe,onOpenChange:Se,children:(0,x.jsxs)(ue,{className:`flex max-h-[80vh] flex-col sm:max-w-2xl`,children:[(0,x.jsxs)(d,{children:[(0,x.jsx)(f,{children:`Browse skills.sh`}),(0,x.jsxs)(u,{children:[`Search the`,` `,(0,x.jsx)(`a`,{href:`https://skills.sh`,target:`_blank`,rel:`noreferrer`,className:`text-primary underline-offset-2 hover:underline`,children:`skills.sh`}),` `,`registry and install into the`,` `,t?.name??e,` workspace. Skills run with full agent permissions — review before use.`]})]}),(0,x.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),Re()},children:[(0,x.jsx)(g,{autoFocus:!0,value:K,placeholder:`Search skills (e.g. react, deploy, postgres)…`,onChange:e=>Ce(e.target.value)}),(0,x.jsxs)(h,{type:`submit`,disabled:q||K.trim().length===0,children:[q?(0,x.jsx)(S,{className:`size-4`}):(0,x.jsx)(se,{className:`size-4`}),`Search`]})]}),ke&&(0,x.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm whitespace-pre-wrap text-destructive`,children:ke}),(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[De&&we.length===0&&!q&&(0,x.jsxs)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:[`No skills found for “`,K.trim(),`”.`]}),(0,x.jsx)(`div`,{className:`flex flex-col gap-2`,children:we.map(e=>{let t=je.has(e.source);return(0,x.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border px-3 py-2`,children:[(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.name}),e.installs&&(0,x.jsx)(_,{variant:`outline`,className:`shrink-0`,children:e.installs})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,children:[e.repo,e.url&&(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center hover:text-foreground`,children:(0,x.jsx)(re,{className:`size-3`})})]})]}),(0,x.jsx)(h,{size:`sm`,variant:t?`secondary`:`outline`,disabled:t||Y!==null,onClick:()=>ze(e.source),children:Y===e.source?(0,x.jsx)(S,{className:`size-4`}):t?`Installed`:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(me,{className:`size-3.5`}),` Install`]})})]},e.source)})})]})]})})]})}export{w as SkillsPage};
@@ -1 +0,0 @@
1
- import"./chunk-NNHCCRGN-DlpIbxXb.js";import{x as e}from"./mermaid-parser.core-BS-vIFlR.js";export{e as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{i as e,n as t,t as n}from"./utils-BX1Diber.js";import{n as r}from"./button-Cg-0y2B2.js";function i(e){return t(e.defaultTagName??`div`,e,e)}var a=r(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function o({className:t,variant:r=`default`,render:o,...s}){return i({defaultTagName:`span`,props:e({className:n(a({variant:r}),t)},s),render:o,state:{slot:`badge`,variant:r}})}export{o as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,n,r}from"./bundle-mjs-DssaXR6m.js";import{n as i,t as a}from"./utils-BX1Diber.js";import{t as o}from"./useButton-DKtiRcm8.js";var s=e(t()).forwardRef(function(e,t){let{render:n,className:r,disabled:a=!1,focusableWhenDisabled:s=!1,nativeButton:c=!0,style:l,...u}=e,{getButtonProps:d,buttonRef:f}=o({disabled:a,focusableWhenDisabled:s,native:c});return i(`button`,e,{state:{disabled:a},ref:[t,f],props:[u,d]})}),c=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,l=n,u=(e,t)=>n=>{if(t?.variants==null)return l(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=c(t)||c(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return l(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},d=r(),f=u(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function p({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,d.jsx)(s,{"data-slot":`button`,className:a(f({variant:t,size:n,className:e})),...r})}export{u as n,p as t};
@@ -1 +0,0 @@
1
- import{at as e,ot as t}from"./chunk-CSCIHK7Q-B7WJrDNL.js";var n=(n,r)=>t.lang.round(e.parse(n)[r]);export{n as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{M as r,N as i,P as a,d as o,f as s,i as c,l,n as ee,t as u,x as d}from"./utils-BX1Diber.js";import{h as f,i as p,t as m,x as h}from"./useBaseUiId-dSIElxm7.js";import{n as g,t as te}from"./FormContext-6Ydu-jal.js";import{M as _,N as v,k as y,vt as ne,yt as re}from"./index-CqEDC1ie.js";import{t as ie}from"./useButton-DKtiRcm8.js";import{a as b,i as ae,r as oe,t as se}from"./useRegisterFieldControl-CbOBCC3j.js";import{t as ce}from"./useControlled-t2_qXo7Q.js";import{n as le}from"./label-CxX4-RmK.js";var ue=h(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),x=e(t());function de(e,t,n,r=!0,a){let[o,s]=x.useState(),c=m(a?`${a}-label`:void 0),l=e??t??o;return i(()=>{let i=e||t||!r?void 0:S(n.current,c);o!==i&&s(i)}),l}function S(e,t){let n=C(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function C(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var w=x.createContext({disabled:!1});function fe(){return x.useContext(w)}var pe=x.createContext(void 0);function me(e=!0){let t=x.useContext(pe);if(t===void 0&&!e)throw Error(r(3));return t}function he(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var T=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function E(e){return x.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[T.checked]:``}:{[T.unchecked]:``}},...b}),[e.indeterminate])}var D=x.createContext(void 0);function O(){let e=x.useContext(D);if(e===void 0)throw Error(r(14));return e}var k=n(),ge=`data-parent`,A=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:u=!1,"aria-labelledby":h,disabled:g=!1,form:_,id:v,indeterminate:y=!1,inputRef:b,name:ue,onCheckedChange:S,parent:C=!1,readOnly:w=!1,render:pe,required:T=!1,uncheckedValue:O,value:A,nativeButton:j=!1,style:_e,...ve}=e,{clearErrors:ye}=te(),{disabled:be,name:xe,setDirty:Se,setFilled:M,setFocused:N,setTouched:Ce,state:P,validationMode:we,validityData:Te,shouldValidateOnChange:Ee,validation:De}=ae(),Oe=fe(),{labelId:ke,controlId:Ae,registerControlId:F,getDescriptionProps:I}=oe(),L=me(),R=L?.parent,z=R&&L.allValues,B=be||Oe.disabled||L?.disabled||g,V=xe??ue,H=A??V,je=m(),Me=m(),U=Ae;z?U=C?Me:`${R.id}-${H}`:v&&(U=v);let W={};z&&(C?W=L.parent.getParentProps():H&&(W=L.parent.getChildProps(H)));let{checked:Ne=n,indeterminate:G=y,onCheckedChange:Pe,...Fe}=W,K=L?.value,Ie=L?.setValue,Le=L?.defaultValue,q=x.useRef(null),J=a(()=>Symbol(`checkbox-control`)),Y=x.useRef(!1),{getButtonProps:Re,buttonRef:ze}=ie({disabled:B,native:j}),X=L?.validation??De,[Z,Be]=ce({controlled:H&&K&&!C?K.includes(H):Ne,default:H&&Le&&!C?Le.includes(H):u,name:`Checkbox`,state:`checked`});i(()=>{F!==s&&(Y.current=!0,F(J.current,U))},[U,F,J]),x.useEffect(()=>{let e=J.current;return()=>{!Y.current||F===s||(Y.current=!1,F(e,void 0))}},[F,J]),se(q,je,Z,void 0,!L);let Q=x.useRef(null),Ve=l(b,Q,X.inputRef),He=de(h,ke,Q,!j,U??void 0);i(()=>{Q.current&&(Q.current.indeterminate=G,Z&&M(!0))},[Z,G,M]),le(Z,()=>{L&&!C||(ye(V),M(Z),Se(Z!==Te.initialValue),Ee()?X.commit(Z):X.commit(Z,!0))});let Ue=c({checked:Z,disabled:B,form:_,name:C?void 0:V,id:j?void 0:U??void 0,required:T,ref:Ve,style:V?re:ne,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(w){e.preventDefault();return}let t=e.currentTarget.checked,n=p(f,e.nativeEvent);Pe?.(t,n),S?.(t,n),!n.isCanceled&&(Be(t),H&&K&&Ie&&!C&&!z&&Ie(t?[...K,H]:K.filter(e=>e!==H),n))},onFocus(){q.current?.focus()}},A===void 0?o:{value:(L?Z&&A:A)||``},I,L?X.getValidationProps:X.getInputValidationProps),We=z?!!Ne:Z,Ge=z&&G||y;x.useEffect(()=>{if(!R||!H)return;let e=R.disabledStatesRef.current;return e.set(H,B),()=>{e.delete(H)}},[R,B,H]);let $=x.useMemo(()=>({...P,checked:We,disabled:B,readOnly:w,required:T,indeterminate:Ge}),[P,We,B,w,T,Ge]),Ke=E($),qe=ee(`span`,e,{state:$,ref:[ze,q,t,L?.registerControlRef],props:[{id:j?U??void 0:je,role:`checkbox`,"aria-checked":G?`mixed`:Z,"aria-readonly":w||void 0,"aria-required":T||void 0,"aria-labelledby":He,[ge]:C?``:void 0,onFocus(){N(!0)},onBlur(){let e=Q.current;e&&(Ce(!0),N(!1),we===`onBlur`&&X.commit(L?K:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),d(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||he(t)?.click()})},onClick(e){if(w||B)return;e.preventDefault();let t=Q.current;t&&t.dispatchEvent(new(d(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},I,X.getValidationProps,ve,Fe,Re],stateAttributesMapping:Ke});return(0,k.jsxs)(D.Provider,{value:$,children:[qe,!Z&&!L&&V&&!C&&O!==void 0&&(0,k.jsx)(`input`,{type:`hidden`,form:_,name:V,value:O}),(0,k.jsx)(`input`,{...Ue,suppressHydrationWarning:!0})]})}),j=x.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=O(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=v(c),f=x.useRef(null),p={...s,transitionStatus:u};y({open:c,ref:f,onComplete(){c||d(!1)}});let m={...E(s),..._,...b},h=a||l,g=ee(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function _e({className:e,...t}){return(0,k.jsx)(A,{"data-slot":`checkbox`,className:u(`peer inline-flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-neutral-300 bg-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-neutral-900 data-[checked]:bg-neutral-900 data-[checked]:text-white data-[indeterminate]:border-neutral-900 data-[indeterminate]:bg-neutral-900 data-[indeterminate]:text-white`,e),...t,children:(0,k.jsx)(j,{className:`flex items-center justify-center`,children:t.indeterminate?(0,k.jsx)(ue,{className:`size-3`}):(0,k.jsx)(g,{className:`size-3`})})})}export{_e as t};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-D-NMWEou.js";import"./chunk-CSCIHK7Q-B7WJrDNL.js";import"./chunk-5ZQYHXKU-3UMjEqrw.js";import"./chunk-BSJP7CBP-DIpfLhEz.js";import"./chunk-L5ZTLDWV-CgJ4GCaj.js";import"./chunk-NZK2D7GU-BmtPBmfa.js";import"./chunk-O5CBEL6O-DHg6U4bD.js";import"./chunk-3OPIFGDE-BhRd3oVg.js";import"./chunk-KSCS5N6A-C_P0C3_7.js";import"./chunk-LZXEDZCA-C2PsTcer.js";import"./chunk-FMBD7UC4-C9D6P7Uq.js";import"./chunk-ND2GUHAM-CSipvS6t.js";import"./chunk-55IACEB6-QyFAFTWp.js";import"./chunk-2J33WTMH-h9HiYY_u.js";import{i as t,n,r,t as i}from"./chunk-727SXJPM-BcWt_3lo.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
@@ -1 +0,0 @@
1
- import{h as e}from"./src-D-NMWEou.js";import"./chunk-CSCIHK7Q-B7WJrDNL.js";import"./chunk-5ZQYHXKU-3UMjEqrw.js";import"./chunk-BSJP7CBP-DIpfLhEz.js";import"./chunk-L5ZTLDWV-CgJ4GCaj.js";import"./chunk-NZK2D7GU-BmtPBmfa.js";import"./chunk-O5CBEL6O-DHg6U4bD.js";import"./chunk-3OPIFGDE-BhRd3oVg.js";import"./chunk-KSCS5N6A-C_P0C3_7.js";import"./chunk-LZXEDZCA-C2PsTcer.js";import"./chunk-FMBD7UC4-C9D6P7Uq.js";import"./chunk-ND2GUHAM-CSipvS6t.js";import"./chunk-55IACEB6-QyFAFTWp.js";import"./chunk-2J33WTMH-h9HiYY_u.js";import{i as t,n,r,t as i}from"./chunk-727SXJPM-BcWt_3lo.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};