tmex-cli 0.16.5 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +40 -4
  2. package/dist/runtime/server.js +702 -337
  3. package/package.json +2 -1
  4. package/resources/fe-dist/assets/DevicePage-B-4Wp5gx.js +24 -0
  5. package/resources/fe-dist/assets/{DevicesPage-XMtf7VIy.js → DevicesPage-D3GQd_MI.js} +1 -1
  6. package/resources/fe-dist/assets/{FilePage-C1_JLsEc.js → FilePage-C45pl7_F.js} +2 -2
  7. package/resources/fe-dist/assets/SettingsPage-DEkQrJzi.js +39 -0
  8. package/resources/fe-dist/assets/{agent-tab-BgvIAv35.js → agent-tab-BnKrqJP2.js} +2 -2
  9. package/resources/fe-dist/assets/api-5IhJ49aS.js +5 -0
  10. package/resources/fe-dist/assets/{arc-BX-Po9p7.js → arc-DBxiTdY2.js} +1 -1
  11. package/resources/fe-dist/assets/{architectureDiagram-3BPJPVTR-BneOtjGd.js → architectureDiagram-3BPJPVTR-Dcd70ntw.js} +1 -1
  12. package/resources/fe-dist/assets/{blockDiagram-GPEHLZMM-Dcf0shYG.js → blockDiagram-GPEHLZMM-LsFpH20h.js} +1 -1
  13. package/resources/fe-dist/assets/{c4Diagram-AAUBKEIU-Cwhji_wO.js → c4Diagram-AAUBKEIU-BswGzO6B.js} +1 -1
  14. package/resources/fe-dist/assets/{card-IkOsEv2J.js → card-Bav-X9c4.js} +1 -1
  15. package/resources/fe-dist/assets/channel-hAJp4tg-.js +1 -0
  16. package/resources/fe-dist/assets/{chunk-2J33WTMH-IFwQoyns.js → chunk-2J33WTMH-C0yl1OR1.js} +1 -1
  17. package/resources/fe-dist/assets/{chunk-4BX2VUAB-BZhwH7K2.js → chunk-4BX2VUAB-Dwo9vDDk.js} +1 -1
  18. package/resources/fe-dist/assets/{chunk-55IACEB6-pYNojBsx.js → chunk-55IACEB6-Dz9e7vav.js} +1 -1
  19. package/resources/fe-dist/assets/{chunk-727SXJPM-BwBn-X-G.js → chunk-727SXJPM-ZkqwcZ6G.js} +1 -1
  20. package/resources/fe-dist/assets/{chunk-AQP2D5EJ-Cv5U78aO.js → chunk-AQP2D5EJ-79MMuY3h.js} +1 -1
  21. package/resources/fe-dist/assets/{chunk-FMBD7UC4-DnaDXP2z.js → chunk-FMBD7UC4-Vw8e6XCy.js} +1 -1
  22. package/resources/fe-dist/assets/{chunk-ND2GUHAM-BCRcaTWl.js → chunk-ND2GUHAM-um7O2-xi.js} +1 -1
  23. package/resources/fe-dist/assets/{chunk-QZHKN3VN-1sPBtZCH.js → chunk-QZHKN3VN-D8FuV91c.js} +1 -1
  24. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-SSiS3KfC.js +1 -0
  25. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-SSiS3KfC.js +1 -0
  26. package/resources/fe-dist/assets/{copy-CJIriuQt.js → copy-Cawnv2-o.js} +1 -1
  27. package/resources/fe-dist/assets/{cose-bilkent-S5V4N54A-CY6ERT7s.js → cose-bilkent-S5V4N54A-gidx-z0G.js} +1 -1
  28. package/resources/fe-dist/assets/{dagre-BM42HDAG-c_oJjVCK.js → dagre-BM42HDAG-C54CUHrk.js} +1 -1
  29. package/resources/fe-dist/assets/{diagram-2AECGRRQ-g-DJAnzv.js → diagram-2AECGRRQ-DFGI1MJu.js} +1 -1
  30. package/resources/fe-dist/assets/{diagram-5GNKFQAL-0DikWL30.js → diagram-5GNKFQAL-D7POJY8A.js} +1 -1
  31. package/resources/fe-dist/assets/{diagram-KO2AKTUF-wWVJH7kq.js → diagram-KO2AKTUF-CvV1GMLL.js} +1 -1
  32. package/resources/fe-dist/assets/{diagram-LMA3HP47-UwQ9OpsG.js → diagram-LMA3HP47-BbfJVUKI.js} +1 -1
  33. package/resources/fe-dist/assets/{diagram-OG6HWLK6-ZFNNtnbo.js → diagram-OG6HWLK6-CV6Q6IxH.js} +1 -1
  34. package/resources/fe-dist/assets/download-ZSRF6UU6.js +6 -0
  35. package/resources/fe-dist/assets/en_US-xzwBD2oK.js +1 -0
  36. package/resources/fe-dist/assets/{erDiagram-TEJ5UH35-D3na7WWE.js → erDiagram-TEJ5UH35-BPgvqV_L.js} +1 -1
  37. package/resources/fe-dist/assets/{files-tab-1FVCHULV.js → files-tab-BQhhr5Wi.js} +15 -15
  38. package/resources/fe-dist/assets/{flowDiagram-I6XJVG4X-Dsbf9z99.js → flowDiagram-I6XJVG4X-CKXjL0zg.js} +1 -1
  39. package/resources/fe-dist/assets/{ganttDiagram-6RSMTGT7-CF3CKflH.js → ganttDiagram-6RSMTGT7-D58QnW85.js} +1 -1
  40. package/resources/fe-dist/assets/{gitGraphDiagram-PVQCEYII-CRpX3WPf.js → gitGraphDiagram-PVQCEYII-BwB9zJYk.js} +1 -1
  41. package/resources/fe-dist/assets/{index-U4iZ6Kxr.js → index-CxD8veUJ.js} +16 -16
  42. package/resources/fe-dist/assets/{index-C-RSAqjj.js → index-DDvqV24J.js} +1 -1
  43. package/resources/fe-dist/assets/{infoDiagram-5YYISTIA-DMCNm7PZ.js → infoDiagram-5YYISTIA-DGZZJ51K.js} +1 -1
  44. package/resources/fe-dist/assets/{ishikawaDiagram-YF4QCWOH-CMe-J41c.js → ishikawaDiagram-YF4QCWOH-DKEV0i-O.js} +1 -1
  45. package/resources/fe-dist/assets/ja_JP-Dd1FrxOk.js +1 -0
  46. package/resources/fe-dist/assets/{journeyDiagram-JHISSGLW-CxFZDT81.js → journeyDiagram-JHISSGLW-Dvt5MIiS.js} +1 -1
  47. package/resources/fe-dist/assets/{kanban-definition-UN3LZRKU-DwBxD_Gg.js → kanban-definition-UN3LZRKU-BrLCK6I8.js} +1 -1
  48. package/resources/fe-dist/assets/{linear-CBM17AV1.js → linear-LNJ3BF_d.js} +1 -1
  49. package/resources/fe-dist/assets/{markdown-preview-CVeuDkuY.js → markdown-preview-Cqdqjc1H.js} +3 -3
  50. package/resources/fe-dist/assets/{mermaid.core-CvSv2dqw.js → mermaid.core-Cy4PFTl-.js} +5 -5
  51. package/resources/fe-dist/assets/{mindmap-definition-RKZ34NQL-DUu53RHy.js → mindmap-definition-RKZ34NQL-JOcL1ZTP.js} +1 -1
  52. package/resources/fe-dist/assets/{pieDiagram-4H26LBE5-CAbw9YBY.js → pieDiagram-4H26LBE5-_1o-TTd6.js} +1 -1
  53. package/resources/fe-dist/assets/{quadrantDiagram-W4KKPZXB-NmJUURAz.js → quadrantDiagram-W4KKPZXB-7Ggy2jhO.js} +1 -1
  54. package/resources/fe-dist/assets/{requirementDiagram-4Y6WPE33-B45iu7jV.js → requirementDiagram-4Y6WPE33-CH_udJzB.js} +1 -1
  55. package/resources/fe-dist/assets/{sankeyDiagram-5OEKKPKP-af9JvT_p.js → sankeyDiagram-5OEKKPKP-DO9ymHJb.js} +1 -1
  56. package/resources/fe-dist/assets/{send-e_FTy5nC.js → send-D0SbMcl5.js} +1 -1
  57. package/resources/fe-dist/assets/{sequenceDiagram-3UESZ5HK-CSpSOeHp.js → sequenceDiagram-3UESZ5HK-BfxbUo5S.js} +1 -1
  58. package/resources/fe-dist/assets/{stateDiagram-AJRCARHV-vM6MSoBd.js → stateDiagram-AJRCARHV-ChJ5OE86.js} +1 -1
  59. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-yafZZKAc.js +1 -0
  60. package/resources/fe-dist/assets/terminal-settings-panel-CFkXHe7W.js +25 -0
  61. package/resources/fe-dist/assets/{timeline-definition-PNZ67QCA-A63tNc2d.js → timeline-definition-PNZ67QCA-CIlpfkBn.js} +1 -1
  62. package/resources/fe-dist/assets/{transfer-toast-CmSO0e95.js → transfer-toast-DvU8-v2e.js} +1 -1
  63. package/resources/fe-dist/assets/{triangle-alert-jNMwsJMj.js → triangle-alert-BI3hbdo6.js} +1 -1
  64. package/resources/fe-dist/assets/{vennDiagram-CIIHVFJN-BktPK2LC.js → vennDiagram-CIIHVFJN-NqSGMHBa.js} +1 -1
  65. package/resources/fe-dist/assets/{wardley-L42UT6IY-viU1xsE2.js → wardley-L42UT6IY-bOJt96SM.js} +1 -1
  66. package/resources/fe-dist/assets/{wardleyDiagram-YWT4CUSO-DICOr7Mv.js → wardleyDiagram-YWT4CUSO-DAgFPWOP.js} +1 -1
  67. package/resources/fe-dist/assets/{xychartDiagram-2RQKCTM6-bjue7pS9.js → xychartDiagram-2RQKCTM6-D5rVqEFB.js} +1 -1
  68. package/resources/fe-dist/assets/{zap-ClXbg92C.js → zap-D-Szn4JY.js} +1 -1
  69. package/resources/fe-dist/assets/zh_CN-DVIa9MQX.js +1 -0
  70. package/resources/fe-dist/index.html +1 -1
  71. package/resources/gateway-drizzle/0015_wise_mongu.sql +1 -0
  72. package/resources/gateway-drizzle/0016_cheerful_scarecrow.sql +17 -0
  73. package/resources/gateway-drizzle/meta/_journal.json +14 -0
  74. package/resources/fe-dist/assets/DevicePage-BIjGEtCP.js +0 -24
  75. package/resources/fe-dist/assets/SettingsPage-BAx39LyM.js +0 -39
  76. package/resources/fe-dist/assets/api-Dto6Spgl.js +0 -10
  77. package/resources/fe-dist/assets/channel-DD10rSnh.js +0 -1
  78. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-CEWAB_yV.js +0 -1
  79. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-CEWAB_yV.js +0 -1
  80. package/resources/fe-dist/assets/en_US-BihUhDmr.js +0 -1
  81. package/resources/fe-dist/assets/ja_JP-f5sXmz8W.js +0 -1
  82. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-8FQLtPkV.js +0 -1
  83. package/resources/fe-dist/assets/terminal-settings-panel-DU9rOuZd.js +0 -25
  84. package/resources/fe-dist/assets/zh_CN-CPdvelFW.js +0 -1
@@ -1,4 +1,4 @@
1
- import{s as zt,g as Lt,q as Tt,p as At,a as Xt,b as Et,_ as y,K as Yt,D as It,F as Q,l as et,I as Ft,e as Bt,z as Rt,c as V}from"./mermaid.core-CvSv2dqw.js";import{p as Ot}from"./chunk-4BX2VUAB-BZhwH7K2.js";import{p as Wt}from"./wardley-L42UT6IY-viU1xsE2.js";import"./index-U4iZ6Kxr.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(Ot(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,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}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Rt()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Et,getAccTitle:Xt,setDiagramTitle:At,getDiagramTitle:Tt,getAccDescription:Lt,setAccDescription:zt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var U,J;et.debug(`Rendering Wardley map
1
+ import{s as zt,g as Lt,q as Tt,p as At,a as Xt,b as Et,_ as y,K as Yt,D as It,F as Q,l as et,I as Ft,e as Bt,z as Rt,c as V}from"./mermaid.core-Cy4PFTl-.js";import{p as Ot}from"./chunk-4BX2VUAB-Dwo9vDDk.js";import{p as Wt}from"./wardley-L42UT6IY-bOJt96SM.js";import"./index-CxD8veUJ.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(Ot(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,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}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Rt()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Et,getAccTitle:Xt,setDiagramTitle:At,getDiagramTitle:Tt,getAccDescription:Lt,setAccDescription:zt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var U,J;et.debug(`Rendering Wardley map
2
2
  `+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),L=v.getDiagramTitle(),M=((U=g.size)==null?void 0:U.width)??r.width,k=((J=g.size)==null?void 0:J.height)??r.height,N=Ft(o);N.selectAll("*").remove(),Bt(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const F=M-r.padding*2,B=k-r.padding*2;L&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(L);const T=y(t=>r.padding+t/100*F,"projectX"),A=y(t=>k-r.padding-t/100*B,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+F/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+B/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+B/2})`).text(bt);const R=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(R.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===R.length){let i=0;n.forEach(h=>{s.push({start:i,end:h}),i=h})}else{const i=1/R.length;R.forEach((h,l)=>{s.push({start:l*i,end:(l+1)*i})})}R.forEach((i,h)=>{const l=s[h],x=r.padding+l.start*F,f=r.padding+l.end*F,u=(x+f)/2;h>0&&t.append("line").attr("x1",x).attr("x2",x).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+F*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-B*s).attr("y2",k-r.padding-B*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:T(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f<i.length-1;f++){const u=i[f],w=i[f+1];n.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",u.pos.x).attr("y1",u.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let h=1/0,l=-1/0,x=0;if(s.componentIds.forEach(f=>{const u=c.get(f);u&&(h=Math.min(h,u.x),l=Math.max(l,u.x),x=u.y)}),h!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=x-u/2,S=c.get(s.nodeId);if(S){const z=(h+l)/2;S.x=z,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",w).attr("width",l-h+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const K=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(K).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.x+l/f*h}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.y+x/f*h}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.x+l/f*h}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.y+x/f*h}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(K.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=s.y-n.y,l=s.x-n.x,x=Math.sqrt(l*l+h*h),f=8,u=h/x;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,h=s.x-n.x,l=s.y-n.y,x=Math.sqrt(h*h+l*l),f=8,u=-h/x;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=(n.y+s.y)/2,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x),u=8,w=x/f,S=-l/f,z=i+w*u,W=h+S*u;let Y=Math.atan2(x,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${z} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=T(t.targetX),i=A(t.targetY),h=s-n.x,l=i-n.y,x=Math.sqrt(h*h+l*l),f=r.nodeRadius+2,u=x>f?s-h/x*f:s,w=x>f?i-l/x*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:T(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i<s.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",s[i].x).attr("y1",s[i].y).attr("x2",s[i+1].x).attr("y2",s[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach(i=>{const h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=T(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,h=16,l=11,x=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const z=x.append("text").attr("x",n+i).attr("y",s+i+(S+1)*h).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(z)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const z=w+i*2+105,W=f.length*h+i*2+S/2,Y=r.padding,Pt=M-r.padding-z,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*h)}),x.insert("rect","text").attr("x",n).attr("y",s).attr("width",z).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=T(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=T(n.x),i=A(n.y),h=60,l=30,x=20,f=`
3
3
  M ${s} ${i-l/2}
4
4
  L ${s+h-x} ${i-l/2}
@@ -1,4 +1,4 @@
1
- import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Yt,I as mi,e as yi,z as bi,D as _t,i as Ai,F as Nt,G as wi,K as Ci,am as Si,R as Wt}from"./mermaid.core-CvSv2dqw.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-BENe2yWM.js";import{l as zt}from"./linear-CBM17AV1.js";import"./index-U4iZ6Kxr.js";import"./defaultLocale-DX6XiGOO.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var I=Ri(y).map(function(m){return v+o*m});return i(E?I.reverse():I)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=(function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],I=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var M,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((M===null||typeof M>"u")&&(M=Vt()),z=rt[q]&&rt[q][M]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
1
+ import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Yt,I as mi,e as yi,z as bi,D as _t,i as Ai,F as Nt,G as wi,K as Ci,am as Si,R as Wt}from"./mermaid.core-Cy4PFTl-.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-BENe2yWM.js";import{l as zt}from"./linear-LNJ3BF_d.js";import"./index-CxD8veUJ.js";import"./defaultLocale-DX6XiGOO.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var I=Ri(y).map(function(m){return v+o*m});return i(E?I.reverse():I)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=(function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],I=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var M,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((M===null||typeof M>"u")&&(M=Vt()),z=rt[q]&&rt[q][M]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&&gt.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
2
2
  `+D.showPosition()+`
3
3
  Expecting `+gt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":yt="Parse error on line "+(ct+1)+": Unexpected "+(M==Mt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(yt,{text:D.match,token:this.terminals_[M]||M,line:D.yylineno,loc:pt,expected:gt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+M);switch(z[0]){case 1:g.push(M),C.push(D.yytext),r.push(D.yylloc),g.push(z[1]),M=null,It=D.yyleng,d=D.yytext,ct=D.yylineno,pt=D.yylloc;break;case 2:if(N=this.productions_[z[1]][1],G.$=C[C.length-N],G._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ci&&(G._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(G,[d,It,ct,$.yy,z[1],C,r].concat(li)),typeof mt<"u")return mt;N&&(g=g.slice(0,-1*N*2),C=C.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[z[1]][0]),C.push(G.$),r.push(G._$),Bt=rt[g[g.length-2]][g[g.length-1]],g.push(Bt);break;case 3:return!0}}return!0},"parse")},k=(function(){var F={EOF:1,parseError:a(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:a(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var c=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{Y as a}from"./index-U4iZ6Kxr.js";/**
1
+ import{Y as a}from"./index-CxD8veUJ.js";/**
2
2
  * @license lucide-react v0.564.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ const e=JSON.parse('{"common":{"loading":"加载中...","save":"保存","saving":"保存中...","cancel":"取消","add":"添加","delete":"删除","edit":"修改","confirm":"确认","close":"关闭","expand":"展开","collapse":"收起","refresh":"刷新","test":"测试","send":"发送","success":"成功","error":"错误","warning":"警告","info":"信息","yes":"是","no":"否","enabled":"已启用","disabled":"已禁用","pending":"待授权","authorized":"已授权","unknown":"未知","empty":"空","none":"无","default":"默认","optional":"可选","required":"必填","pwaInstallTitle":"安装为应用","pwaInstallHintIOSSafari":"iOS Safari 不会自动弹出安装提示。请点击「分享」,再选择「添加到主屏幕」。","pwaInstallHintIOSChrome":"iOS Chrome 不会自动弹出安装提示。请点击「分享」,再选择「添加到主屏幕」"},"nav":{"manageDevices":"管理设备","settings":"设置","sidebarExpand":"展开侧边栏","sidebarCollapse":"收起侧边栏","openSidebar":"打开侧边栏","closeSidebar":"关闭侧边栏","jumpToLatest":"跳转到最新","switchToEditor":"切换到编辑器输入","switchToDirect":"切换到直接输入","refreshPage":"刷新页面","refreshPageConfirm":"确定要刷新页面吗?未保存的内容将会丢失。"},"device":{"title":"设备管理","devices":"设备","addDevice":"添加设备","addDeviceDescription":"填写设备信息并选择连接方式","addFirstDevice":"添加第一个设备","editDevice":"修改设备","editDeviceDescription":"更新设备配置","sectionBasic":"基本信息","sectionConnection":"连接信息","sectionAuth":"认证信息","noDevices":"暂无设备","noDevicesDescription":"添加本地或 SSH 设备开始使用","name":"设备名称","namePlaceholder":"例如:我的服务器","type":"类型","typeLocal":"本地设备","typeSSH":"SSH 远程设备","typeSSHBadge":"SSH","host":"主机","hostPlaceholder":"example.com","port":"端口","username":"用户名","usernamePlaceholder":"root","session":"Tmux 会话名称","sessionPlaceholder":"tmex","sessionHint":"留空将使用默认值 \\"tmex\\"","defaultWorkingDir":"默认工作目录","defaultWorkingDirPlaceholder":"留空使用用户 home 目录","authMode":"认证方式","authPassword":"密码","authKey":"私钥","authAgent":"SSH Agent","authConfigRef":"SSH Config","sshConfigRefPlaceholder":"Host 别名,如 my-server","sshConfigRefHint":"填 ssh config 里的 Host 别名,经 `ssh -G` 解析;不是 config 文件路径。","password":"密码","privateKey":"私钥","privateKeyPlaceholder":"-----BEGIN OPENSSH PRIVATE KEY-----","privateKeyPassphrase":"私钥密码(可选)","passphrase":"私钥密码(可选)","connect":"连接","connected":"已连接","disconnect":"断开","disconnected":"已断开","connecting":"连接中...","dragHandle":"拖动以调整设备顺序","reorderFailed":"设备排序失败","deleteConfirm":"删除此设备?","deleteDescription":"设备 \\"{{name}}\\" 将被永久移除,此操作无法撤销。","deleteSuccess":"设备已删除","createSuccess":"设备已创建","updateSuccess":"设备已更新","deleteFailed":"删除设备失败","createFailed":"创建设备失败","updateFailed":"更新设备失败","loadFailed":"加载设备列表失败","localDevice":"本地设备","subtitle":"{{username}}@{{host}}:{{port}}","modify":"修改设备","delete":"删除"},"terminal":{"keyboardBehavior":{"title":"键盘行为","description":"选择手机键盘弹出时页面的避让方式","modeLift":"页面平移","modeLiftDesc":"键盘弹出时整页上移,终端大小不变","modeResize":"终端缩放","modeResizeDesc":"缩小终端铺满键盘上方区域(会调整远端窗口行数)","modeFollow":"光标对齐","modeFollowDesc":"按光标位置上移,光标始终在键盘正上方,终端大小不变"},"initializing":"初始化终端...","connecting":"连接设备...","initFailed":"终端初始化失败","inputPlaceholder":"在此输入命令...","clear":"清空","deviceError":"设备错误","deviceErrorWithType":"[{{type}}] 设备错误","noDeviceSelected":"未选择设备","windowClosed":"当前窗口已关闭,请在侧边栏重新选择窗口。","paneClosed":"当前 Pane 已关闭,请在侧边栏重新选择 Pane。","bellNotification":"终端 Bell","bellDescriptionWithTitle":"窗口 {{window}} · {{paneLabel}}","bellFallback":"收到 tmux bell","notificationFallbackTitle":"终端通知","notificationSourceLabel":"来自 {{source}}","notificationFallbackDetail":"终端通知","paneTitle":"Pane {{index}}","activePane":"当前 pane","activeWindow":"当前窗口","editorPlaceholder":"在此输入命令...","editorClear":"清空","editorSendWithEnter":"发送附带回车","editorSendLineByLine":"逐行发送","editorSend":"发送","sendShortcut":"发送 {{key}}","inputModeDirect":"直接输入","inputModeEditor":"编辑器","newWindow":"新建窗口","closeWindow":"关闭窗口","closePane":"关闭 pane","copy":"复制","paste":"粘贴","copied":"已复制到剪贴板","copyFailed":"复制失败","pasteFailed":"无法读取剪贴板,请检查浏览器权限","clearSelection":"取消选择","fileLinkNotFound":"文件不存在或无法访问"},"settings":{"title":"系统设置","siteSettings":"站点设置","siteName":"站点名称","siteNamePlaceholder":"tmex","siteUrl":"站点访问 URL","siteUrlPlaceholder":"http://localhost:3000","bellThrottle":"Bell 频控(秒)","notificationThrottle":"通知频控(秒)","enableBrowserNotificationToast":"开启浏览器通知 Toast","enableNotificationPush":"开启通知推送","enableBellPush":"开启 Bell 推送","enableBellSound":"开启 Bell 提示音","sshReconnectRetries":"SSH 重连次数","sshReconnectDelay":"SSH 重连等待(秒)","language":"语言","languagePlaceholder":"选择语言","language_en_US":"English","language_zh_CN":"简体中文","language_ja_JP":"日本語","theme":"深色模式","themeLight":"浅色","themeDark":"深色","siteTab":"站点","notificationsTab":"通知","tabGroup":{"general":"通用","devicesAndFiles":"设备与文件","notifications":"通知","ai":"AI","terminal":"终端"},"terminal":{"title":"终端设置","description":"调整终端的字号、行高、字体与手机键盘避让行为。字体选择对全应用所有等宽文本生效。","fontSize":"字号","lineHeight":"行高","fontFamily":"字体","preview":"预览","savedInBrowser":"这些设置仅保存在当前浏览器中。","shortcuts":{"title":"自定义快捷键","savedOnServer":"保存在服务器、多端共享——修改后需点「保存」才生效。","preview":"预览","useIcons":"用图标展示快捷键","useIconsDesc":"把 Ctrl/Shift/回车 等按键名替换为苹果风格符号(⌃⇧⏎)。","dragHandle":"拖动排序","delete":"删除","labelPlaceholder":"显示文字","payloadPlaceholder":"序列,如 \\\\x1b[A","addShortcut":"添加快捷键","capturePrompt":"请按下目标组合键……","captureHint":"点此,然后按下要录制的按键","advanced":"高级:手动输入序列","add":"添加","reset":"重置为默认","save":"保存","saved":"快捷键已保存","saveFailed":"保存快捷键失败","loading":"加载中……","action":{"paste":"粘贴","toggleKeyboard":"切换文本框/键盘","newAgentSession":"新建 Agent 会话","scrollToBottom":"终端回到最下方"},"loadFailed":"加载快捷键失败","retry":"重试"}},"deviceManagement":{"title":"设备管理","description":"添加、编辑并连接你的本地与 SSH 设备。","openButton":"打开设备管理"},"refreshToApply":"刷新后生效","saveSettings":"保存设置","settingsSaved":"站点设置已保存","saveFailed":"保存设置失败","loadFailed":"加载设置失败","restartGateway":"重启 Gateway","restartScheduled":"Gateway 重启请求已发送","restartConfirm":"确定要重启 Gateway 吗?这将中断所有活动连接。","restartFailed":"重启请求失败","sshReconnectMaxRetries":"SSH 重连次数","llm":{"title":"LLM 提供商","name":"名称","namePlaceholder":"如 OpenAI","baseUrl":"Base URL","baseUrlPlaceholder":"https://api.openai.com","baseUrlHint":"默认自动补全 /v1;以 / 结尾则按原路径不补 /v1","protocol":"协议","apiKey":"API Key","apiKeyPlaceholder":"输入 API Key","apiKeySetPlaceholder":"已设置,留空不修改","addProvider":"添加提供商","editProvider":"编辑供应商","formHint":"配置供应商连接信息","models":"模型","modelsTitle":"{{name}} 的模型","modelsHint":"管理该供应商可用的模型,启停与手动添加","modelManual":"手动","addModelPlaceholder":"添加模型 ID","empty":"暂无提供商","refreshModels":"刷新模型","modelsCount":"{{total}} 个模型","modelsNotFetched":"尚未获取模型列表","modelsFetchFailed":"模型列表获取失败:{{error}}","deleteProvider":"删除提供商","deleteConfirm":"确定要删除提供商「{{name}}」吗?","defaults":"全局默认","defaultProvider":"默认提供商","defaultProviderNone":"未设置","defaultModel":"默认模型","defaultModelPlaceholder":"输入或选择模型 ID","saveDefaults":"保存默认设置","loadFailed":"加载 LLM 提供商失败","createFailed":"创建提供商失败","updateFailed":"更新提供商失败","deleteFailed":"删除提供商失败","refreshModelsFailed":"刷新模型失败","settingsLoadFailed":"加载 LLM 设置失败","settingsSaveFailed":"保存 LLM 设置失败"},"search":{"title":"搜索","provider":"搜索提供商","responsesApiHint":"若 LLM Provider 使用 OpenAI Responses API 协议,可直接使用其内置的 hosted 搜索工具;下方第三方搜索为可选补充。","providerNone":"不启用","tavilyApiKey":"Tavily API Key","braveApiKey":"Brave API Key","keyPlaceholder":"输入 API Key","keySetPlaceholder":"已设置,留空不修改","clearKey":"清除","clearKeyConfirm":"确定要清除此 API Key 吗?清除后需要重新填写。","loadFailed":"加载搜索设置失败","saveFailed":"保存搜索设置失败"},"files":{"title":"文件","description":"配置各设备下可在「文件」标签页浏览的目录。本地设备直接读取,SSH 设备走 rsync。","addRoot":"添加目录","roots":"目录","empty":"尚未配置任何目录","missing":"设备已失效","modalAddTitle":"添加目录","modalEditTitle":"编辑目录","device":"设备","devicePlaceholder":"选择设备","noDevices":"还没有设备,请先添加设备","path":"路径","pathPlaceholder":"/绝对路径/到/目录","pathHint":"所选设备上的绝对路径。","enabled":"启用","addFailed":"添加目录失败","updateFailed":"更新目录失败","deleteFailed":"移除目录失败","toggleFailed":"更新目录失败","deleteTitle":"移除目录?","deleteDesc":"将「{{path}}」移出白名单?该目录下的文件将不再可访问。"},"version":{"title":"版本与更新","currentVersion":"当前版本","installMethod":"安装方式","installMethodCli":"通过 CLI 安装","installMethodNonCli":"非 CLI 安装","deployment":"部署方式","deploymentLaunchd":"launchd(macOS)","deploymentSystemd":"systemd(Linux)","deploymentNone":"无","checkUpdate":"检查更新","checking":"检查中…","upToDate":"已是最新版本。","updateAvailable":"有可用更新:{{version}}","changelog":"更新日志","changelogUnavailable":"该版本暂无更新日志。","publishedAt":"发布于 {{date}}","upgrade":"立即升级","upgradeDisabledDev":"非 production 环境已禁用程序内更新。","upgradeDisabledNonCli":"程序内更新仅在通过 CLI 安装时可用。","upgradeWarningTitle":"确认升级","upgradeWarningBody":"升级会重启服务并中断当前访问,还可能影响该服务托管的 tmux 进程的存活。是否继续?","upgradeStarted":"升级已开始","stateDownloading":"正在下载新版本…","stateExecuting":"正在执行升级,服务即将重启…","interruptNotice":"服务重启期间连接会断开,稍候即可恢复。","checkFailed":"检查更新失败","terminalHint":"或通过终端升级:npx tmex-cli@<version> upgrade"}},"telegram":{"title":"Telegram Bot 管理","botName":"Bot 名称","botNamePlaceholder":"如:ops-bot","botToken":"Bot Token","botTokenPlaceholder":"123456:AA...","addBot":"新增 Bot","editBot":"编辑 Bot","enableBot":"启用 Bot","allowAuthRequests":"允许申请授权","pendingChats":"待授权","chats":"已授权","authorizedChats":"已授权","noPendingChats":"暂无待授权 chat","noAuthorizedChats":"暂无已授权 chat","approve":"批准","authorize":"授权","reject":"拒绝","revokeAuth":"撤销授权","testMessage":"测试消息","sendTestMessage":"发送测试消息","deleteBot":"删除 Bot","tokenOptional":"Token(留空不改)","tokenPlaceholder":"输入新 token","botCreated":"Bot 已创建","botUpdated":"Bot 已更新","botDeleted":"Bot 已删除","authApproved":"授权已批准","chatRemoved":"chat 已移除","testMessageSent":"测试消息已发送","createFailed":"新增 Bot 失败","updateFailed":"更新 Bot 失败","deleteFailed":"删除 Bot 失败","approveFailed":"批准授权失败","removeFailed":"删除 chat 失败","testMessageFailed":"发送测试消息失败","loadBotsFailed":"加载 Bot 列表失败","loadChatsFailed":"加载 chat 列表失败","noBots":"暂无 Bot,先添加一个。","expand":"展开","collapse":"收起","authCount":"已授权 {{authorized}} / 待授权 {{pending}}(总上限 8)","chatId":"chatId","applyTime":"申请时间","gatewayOnline":"🟢 Gateway online @ {{siteName}}","deviceConnectionError":"🔴 {{siteName}}:设备「{{deviceName}}」({{host}}) 连接异常 [{{category}}]\\n{{error}}","agentCredentialWarning":"⚠️ {{siteName}}:Agent 会话「{{sessionTitle}}」的一条消息疑似包含凭证({{types}})。该内容将发送至 LLM 并存储,存在泄露风险。","authSuccess":"✅ 已授权,可接收通知。","authPending":"⏳ 已收到授权申请,请在 tmex 设置页审批。","authFailed":"❌ 授权申请失败,请联系管理员。","testMessageTemplate":"🧪 测试消息\\n站点:{{siteName}}\\n时间:{{time}}","approveMessageTemplate":"✅ 已通过 tmex 授权。\\nBot:{{botName}}\\n时间:{{time}}","botNotFound":"Bot 未启动或不可用","botNotRunning":"Bot 未启动或不可用"},"weixin":{"title":"微信 (ClawBot) 管理","subtitle":"通过 iLink bot 协议把 tmex 告警推送到你的个人微信。","replyOnlyNotice":"iLink 只能在会话激活窗口内回复——先给 bot 发条消息激活,告警随后复用该会话;闲置过久会话会过期,需再给 bot 发条消息重新激活。","accountName":"账号名称","accountNamePlaceholder":"如:我的微信","addAccount":"添加账号","editAccount":"编辑账号","enableAccount":"启用账号","allowAuthRequests":"允许授权申请","scanToLogin":"扫码登录","relogin":"重新登录(重新扫码)","loggedIn":"已登录","notLoggedIn":"未登录","scanQrcodeHint":"打开微信扫描二维码,并在手机上确认。","loginPending":"等待扫码…","loginConfirmed":"登录已确认。","loginExpired":"二维码已过期,请重试。","loginError":"登录失败:{{message}}","loginFailed":"登录失败","refreshQrcode":"刷新二维码","closeLogin":"关闭","pendingUsers":"待授权","authorizedUsers":"已授权用户","noPendingUsers":"暂无待授权用户","noAuthorizedUsers":"暂无已授权用户","needsReactivation":"会话已过期","reactivationHint":"请该用户给 bot 发条消息以重新激活告警。","approve":"批准","revokeAuth":"撤销授权","removeUser":"移除","testMessage":"测试消息","sendTestMessage":"发送测试消息","deleteAccount":"删除账号","accountCreated":"账号已创建","accountUpdated":"账号已更新","accountDeleted":"账号已删除","authApproved":"授权已批准","userRemoved":"用户已移除","testMessageSent":"测试消息已发送","createFailed":"创建账号失败","updateFailed":"更新账号失败","deleteFailed":"删除账号失败","approveFailed":"批准失败","removeFailed":"移除用户失败","testMessageFailed":"发送测试消息失败","loadAccountsFailed":"加载账号列表失败","loadUsersFailed":"加载用户列表失败","noAccounts":"还没有账号,先添加一个。","userCount":"{{authorized}} 已授权 / {{pending}} 待授权(上限 16)","userId":"微信用户 ID","applyTime":"首次联系时间","expand":"展开","collapse":"收起","accountNameRequired":"账号名称不能为空","accountNotFound":"账号不存在或不可用","accountNotRunning":"账号未登录或未运行","userNotFound":"用户不存在","authSuccess":"✅ 已授权,你将开始收到通知。","authPending":"⏳ 已收到授权申请,请在 tmex 设置中批准。","testMessageTemplate":"🧪 测试消息\\n站点:{{siteName}}\\n时间:{{time}}","approveMessageTemplate":"✅ 已通过 tmex 授权。\\n账号:{{accountName}}\\n时间:{{time}}","keepalivePrompt":"【tmex】为确保你能正常收到通知,请回复任意内容即可保持连接 🙏","scanConfirmedSendHint":"扫码成功!请在微信里给该 bot 发送任意一条消息以完成绑定。","bindingInProgress":"已收到消息,正在完成绑定…","bindSuccess":"微信已绑定,开始接收通知。","bound":"已绑定","unbound":"未绑定","bindAction":"扫码绑定","gatewayOnline":"🟢 tmex 已上线 @ {{siteName}}"},"webhook":{"title":"Webhooks","url":"Webhook 地址","secret":"密钥","secretPlaceholder":"用于签名(HMAC-SHA256)","enabled":"启用","eventMask":"事件","add":"添加 Webhook","empty":"暂无 Webhook。","createFailed":"创建 Webhook 失败","deleteFailed":"删除 Webhook 失败","loadFailed":"加载 Webhook 失败"},"sshError":{"sshConfigRefNotSupported":"当前版本暂不支持 SSH Config 引用,请改为填写 host + username,并选择 Agent/私钥/密码认证","configRefNotSupported":"当前版本暂不支持 SSH Config 引用,请改为填写 host + username,并选择 Agent/私钥/密码认证","agentUnavailable":"SSH Agent 不可用:未检测到 SSH_AUTH_SOCK,请检查 agent 环境","agentNoIdentity":"SSH Agent 未加载可用密钥,请先执行 ssh-add","agentNoIdentities":"SSH Agent 未加载可用密钥,请先执行 ssh-add","authFailed":"认证失败:用户名、密码或密钥不正确,请检查设备配置","authFailedGeneric":"认证失败:用户名、密码或密钥不正确,请检查设备配置","networkUnreachable":"网络不可达:请检查路由、防火墙或 VPN 配置","connectionRefused":"连接被拒绝:无法连接到目标主机,请检查主机地址和端口是否正确","timeout":"连接超时:无法连接到设备,请检查网络或防火墙设置","connectionTimeout":"连接超时:无法连接到设备,请检查网络或防火墙设置","hostNotFound":"主机未找到:无法解析主机地址,请检查 DNS 或主机名是否正确","handshakeFailed":"握手失败:无法建立安全连接,可能是密钥交换算法不兼容","tmuxUnavailable":"远端 tmux 不可用或启动失败,请检查远端是否已安装 tmux,且远端 shell PATH 可找到 tmux","connectionClosed":"连接已断开,尝试重连中","unknown":"连接失败:{{message}}","reconnecting":"连接中断,{{delay}} 秒后自动重连({{attempt}}/{{maxRetries}})","reconnectFailed":"自动重连失败,请手动重试","reconnected":"设备已自动重连"},"deviceStatus":{"reconnecting":"重连中 {{delay}}s","offline":"离线","errorBadge":{"authFailed":"认证失败","agentUnavailable":"Agent 不可用","agentNoIdentity":"Agent 无密钥","configRefNotSupported":"不支持 SSH Config","networkUnreachable":"网络不可达","connectionRefused":"连接被拒","timeout":"连接超时","hostNotFound":"主机未找到","handshakeFailed":"握手失败","tmuxUnavailable":"tmux 不可用","connectionClosed":"连接已断开","unknown":"连接异常"}},"websocket":{"error":"WebSocket 连接错误","checkGateway":"请检查 Gateway 状态","upgradeFailed":"Upgrade failed","invalidMessage":"Invalid message format","reconnecting":"重连中","reconnect":"重新连接"},"wsError":{"checkGateway":"请检查 Gateway 状态"},"apiError":{"siteNameRequired":"站点名称不能为空","siteUrlInvalid":"站点 URL 必须以 http:// 或 https:// 开头","bellThrottleInvalid":"Bell 频控秒数需在 0-300 之间","sshRetriesInvalid":"SSH 重连次数需在 0-20 之间","sshDelayInvalid":"SSH 重连等待时间需在 1-300 秒之间","languageInvalid":"语言必须是受支持的区域设置之一","botNameRequired":"Bot 名称不能为空","botTokenRequired":"Bot token 不能为空","missingFields":"缺少必填字段","sshRequiresHost":"SSH 设备需要 host 或 sshConfigRef","invalidRequest":"请求无效","deviceNotFound":"Device not found","botNotFound":"Bot 不存在","chatNotFound":"Chat 不存在","urlAndSecretRequired":"URL and secret required","notFound":"Not found","llmProviderNameRequired":"Provider 名称不能为空","llmProviderProtocolInvalid":"协议必须是 openai-chat 或 openai-responses","llmProviderBaseUrlInvalid":"Base URL 必须以 http:// 或 https:// 开头","llmProviderApiKeyRequired":"API key 不能为空","llmProviderNotFound":"LLM provider 不存在","llmProviderDisabled":"LLM provider {{name}} 已被禁用","llmNoDefaultProvider":"未指定 LLM provider 且未配置默认 provider","llmNoDefaultModel":"未指定模型且未配置默认模型","llmDefaultProviderNotFound":"默认 provider 不存在","llmSearchProviderInvalid":"搜索服务必须是 none、tavily 或 brave","llmFetchModelsFailed":"拉取模型列表失败:{{detail}}","agentSessionNotFound":"Agent 会话不存在","agentSessionBusy":"Agent 会话正在运行中,请先停止或等待完成","agentSessionAwaitingConfirmation":"Agent 会话有待处理的确认请求,请先处理","agentDeviceRequired":"必须指定设备","agentPaneRequired":"必须指定终端 pane","agentWriteModeInvalid":"写入模式必须是 confirm 或 auto","agentMaxStepsInvalid":"每回合最大步数必须在 1-100 之间","agentProviderWebSearchRequiresResponses":"Provider 内置搜索仅支持 openai-responses 协议","agentHostedToolUnknown":"未知的 hosted 工具:{{name}}","agentHostedToolRequiresResponses":"Provider hosted 工具仅支持 openai-responses 协议","agentSessionOrphaned":"该 Agent 会话已孤立(绑定终端已不存在),仅可只读查看","agentQueuedMessageNotFound":"排队消息不存在","agentConfirmationNotFound":"确认请求不存在","agentConfirmationAlreadyDecided":"确认请求已被处理","agentMessageTextRequired":"消息内容不能为空","watchRuleNotFound":"Watch 规则不存在","watchNameRequired":"规则名称不能为空","watchTriggerTypeInvalid":"触发类型必须是 match、unchanged 或 llm","watchPatternRequired":"match/unchanged 规则必须提供正则表达式","watchPatternInvalid":"正则表达式无效:{{detail}}","watchUnchangedMinutesInvalid":"unchanged 规则的未变化分钟数必须大于 0","watchExtractGroupInvalid":"捕获组序号必须是不小于 0 的整数","watchConditionPromptRequired":"llm 规则必须提供条件描述","watchIntervalInvalid":"采样间隔不能小于 {{min}} 秒","watchNoMatchBehaviorInvalid":"无命中行为必须是 reset 或 ignore","watchFireModeInvalid":"触发模式必须是 once 或 repeat","watchCooldownInvalid":"冷却秒数必须是不小于 0 的整数","watchAssistDescriptionRequired":"请描述要匹配的内容","watchAssistModelUnavailable":"模型调用失败:{{detail}}","fileRootInvalid":"路径必须是已存在的绝对目录","fileOutsideRoots":"路径不在允许的目录范围内","fileNotADirectory":"不是目录","fileTooLarge":"文件过大","fileBinary":"不支持二进制文件","fileRootDeviceInvalid":"无效或未知的设备","fileRootDuplicate":"该设备下已添加过此目录","upgradeNotAllowed":"当前安装方式不支持程序内更新。","upgradeInProgress":"已有升级任务正在进行。","upgradeVersionRequired":"缺少目标版本号。","updateCheckFailed":"查询 npm registry 失败。","terminalShortcutsTooMany":"快捷键数量过多","terminalShortcutInvalid":"快捷键配置不合法"},"notification":{"clickToJump":"点击跳转到对应 Pane","eventType":{"terminal_bell":"🔔 终端 Bell","terminal_notification":"🔔 终端通知","tmux_window_close":"🪟 窗口关闭","tmux_pane_close":"📱 Pane 关闭","device_tmux_missing":"⚠️ Tmux 不可用","device_disconnect":"🔌 设备断开","session_created":"🆕 会话创建","session_closed":"🚪 会话关闭","agent_confirmation_pending":"🤖 Agent 等待确认","agent_turn_finished":"🤖 Agent 回合完成","agent_error":"🤖 Agent 错误","watch_triggered":"👁️ Watch 规则触发","watch_model_unavailable":"👁️ Watch 模型不可用","watch_rule_error":"👁️ Watch 规则错误"},"site":"站点","device":"设备","window":"窗口","pane":"Pane","time":"时间","directLink":"直达","message":"信息","paneTitle":"标题","process":"进程","telegramBell":{"title":"🔔 来自 {{siteName}} 的 Bell:{{terminalTopbarLabel}}","viewLink":"点击查看","terminalTopbarLabel":"窗口 {{window}} · Pane {{pane}} @ {{device}}"},"telegramNotification":{},"agent":{"confirmationPending":"Agent「{{title}}」请求执行工具 {{toolName}},等待确认","turnFinished":"Agent「{{title}}」回合完成","error":"Agent「{{title}}」出错:{{message}}"},"watch":{"matchTriggered":"监控「{{name}}」命中:{{text}}","unchangedTriggered":"监控「{{name}}」的值「{{value}}」已 {{minutes}} 分钟未变化","llmTriggered":"监控「{{name}}」条件满足:{{reason}}","summaryTriggered":"监控「{{name}}」:{{summary}}","unconfirmedSuffix":"(模型不可用,未经 LLM 二次确认)","modelUnavailable":"监控「{{name}}」模型调用失败:{{message}}","ruleError":"监控「{{name}}」连续失败 {{count}} 次,已自动停用:{{message}}","paneGone":"监控「{{name}}」的 Pane({{paneId}})已销毁,规则已自动删除"}},"sidebar":{"noWindows":"暂无窗口","noDevices":"暂无设备","addDeviceLink":"添加设备","openSettingsLink":"打开设置","openSettings":"打开设置","manageDevices":"管理设备","settings":"设置","currentWindow":"当前窗口","currentPane":"当前 pane","newWindow":"新建窗口","closeWindow":"关闭窗口","closePane":"关闭 pane","addDevice":"添加设备","tab":{"panes":"Panes","agent":"Agent","files":"Files"},"orphanedSessions":"孤立会话"},"agent":{"error":{"streamStalled":"模型停止响应(上游流无响应),请重试。"},"model":{"select":"选择模型","placeholder":"模型","noProviders":"暂无模型 — 请先在设置中配置供应商"},"queue":{"title":"队列({{count}})","steer":"立即注入","steerHint":"中断当前步骤并立即注入队列","withdraw":"撤回"},"orphan":{"readonly":"该会话已孤立(绑定终端已不存在),仅可只读查看","title":"孤立会话","process":"进程","startedAt":"创建于"},"files":{"comingSoon":"Coming Soon"},"panel":{"title":"Agent","empty":"选择或创建一个会话","inputPlaceholder":"输入消息…","send":"发送","stop":"停止","retry":"重试","scrollToBottom":"回到底部"},"welcome":{"title":"新建 Agent 对话","subtitle":"向 Agent 描述你的需求,开始在所选终端中协作"},"session":{"none":"未选择会话","new":"新建 Agent 会话","switch":"切换会话","selectPaneHint":"请在 Panes 标签中选择一个 pane 来开启会话","noSessions":"暂无会话","showAll":"显示全部会话","rename":"重命名会话","renameTitle":"重命名会话","renamePlaceholder":"会话标题","save":"保存","cancel":"取消","delete":"删除会话","deleteTitle":"删除此会话?","deleteDesc":"“{{title}}”及其全部消息将被永久删除。","deleteConfirm":"删除","createDisabledNoPane":"请先打开一个终端 pane 再创建会话","privacyNotice":"会话将把终端屏幕内容发送给配置的 LLM 服务。"},"binding":{"invalid":"已失效","mismatchTitle":"此会话绑定的 pane 与当前终端不一致","goTo":"跳转过去","rebind":"重绑到当前"},"writeMode":{"confirm":"写入需确认","auto":"自动执行"},"confirm":{"title":"等待确认","approve":"允许","deny":"拒绝"},"tool":{"input":"输入","details":"详情","close":"关闭","result":"结果","screen":"屏幕快照","send_input":"发送输入","read_screen":"读取屏幕","web_search":"网络搜索","fetch_url":"抓取网页","get_pane_info":"获取面板信息","run_command":"运行命令","denied":"已拒绝"},"paneBadge":{"bound":"Agent 已绑定","generating":"Agent 输出中"},"controlChars":{"label":"控制字符","hint":"允许 agent 通过 send_input 发送原始控制字符(C0)。默认关闭;仅在必要时开启。"},"reasoning":{"title":"思考过程"},"toast":{"errorTitle":"Agent“{{title}}”出错","credentialWarningTitle":"消息疑似包含凭证","credentialWarningDescription":"检测到 {{types}}。内容不会被修改,但会发送至 LLM 并存储,存在泄露风险。"}},"window":{"noWindows":"暂无窗口","new":"新建窗口","newInCwd":"在此目录新建窗口","close":"关闭窗口","closePane":"关闭面板","closeConfirmTitle":"关闭此窗口?","closePaneConfirmTitle":"关闭此面板?","closeConfirmDesc":"\\"{{name}}\\" 中运行的进程将被终止,此操作无法撤销。","menu":"窗口操作","dragHandle":"拖动以调整窗口顺序","dragHandlePane":"拖动以调整 pane 顺序","rename":"重命名窗口","renamePlaceholder":"输入名称","renameDesc":"自定义名称会覆盖终端设置的标题,并保留至 gateway 重启。","renameReset":"恢复自动名称","switchPane":"切换 Pane","splitRight":"向右分屏","splitDown":"向下分屏","paneCount":"{{count}} 个 pane","pane":"Pane","moveToWindow":"移入此窗口","breakToWindow":"拆为独立窗口"},"watch":{"title":"监控规则","dialogDesc":"监控该终端屏幕,条件满足时发送通知","openMonitor":"监控此终端","rules":{"empty":"该终端还没有监控规则","addRule":"新建规则","edit":"编辑","delete":"删除","viewState":"状态","lastTriggered":"最近触发:{{time}}","neverTriggered":"从未触发","deleteTitle":"删除该规则?","deleteDesc":"“{{name}}”将被永久删除。","deleteConfirm":"删除"},"type":{"match":"匹配","unchanged":"卡住","llm":"LLM"},"typeDesc":{"match":"正则命中屏幕内容时触发","unchanged":"提取值连续 N 分钟不变时触发(如下载卡住)","llm":"由 LLM 周期查看屏幕并判断自然语言条件"},"form":{"createTitle":"新建监控规则","editTitle":"编辑监控规则","name":"规则名称","namePlaceholder":"如:下载卡住提醒","triggerType":"触发类型","pattern":"正则表达式","patternPlaceholder":"如:(\\\\d+)%","flags":"标志","flagsPlaceholder":"如:i","extractGroup":"捕获组序号","extractGroupHint":"0 = 整个匹配;该组的值将被持续跟踪","unchangedMinutes":"不变持续(分钟)","noMatchBehavior":"无命中时","noMatchReset":"重置计时(进度行消失视为任务结束)","noMatchIgnore":"忽略(保留上次值)","conditionPrompt":"条件(自然语言)","conditionPromptPlaceholder":"如:构建因编译错误而失败","model":"模型","followGlobalDefault":"跟随全局默认","modelPlaceholder":"模型 ID","modelRequiredHint":"该规则会调用 LLM,请确保所选(或全局默认)模型可用。","confirmWithLlm":"通知前 LLM 二次确认","confirmWithLlmDesc":"减少误报;模型不可用时直接通知","summarizeWithLlm":"LLM 生成通知摘要","summarizeWithLlmDesc":"由模型总结屏幕内容作为通知正文","intervalSeconds":"采样间隔(秒)","intervalHint":"最低 {{min}} 秒","fireMode":"触发模式","fireOnce":"单次(触发后自动停用)","fireRepeat":"重复","cooldownSeconds":"冷却时间(秒)","enabled":"启用","assistLabel":"用描述生成正则","assistPlaceholder":"如:匹配下载进度百分比","assistButton":"生成","assistExplanation":"说明","assistPreview":"当前屏幕命中","assistPreviewEmpty":"当前屏幕样本无命中","create":"创建","save":"保存","providerUnavailable":"原提供商已不可用","providerDisabled":"已禁用"},"validation":{"nameRequired":"规则名称不能为空","patternRequired":"正则表达式不能为空","patternInvalid":"正则表达式无效:{{detail}}","unchangedMinutesInvalid":"不变持续分钟数必须大于 0","conditionPromptRequired":"条件描述不能为空","intervalMin":"采样间隔不能低于 {{min}} 秒"},"state":{"title":"规则状态","back":"返回","lastSampledAt":"最近采样","lastValue":"最近值","lastValueChangedAt":"值最近变化","lastTriggeredAt":"最近触发","consecutiveErrors":"连续错误次数","lastError":"最近错误","samples":"近期样本","samplesEmpty":"暂无样本","hit":"命中","none":"—"},"toast":{"created":"监控规则已创建","updated":"监控规则已更新","deleted":"监控规则已删除","triggeredTitle":"监控触发","openTerminal":"打开终端","modelUnavailableTitle":"监控模型不可用","modelUnavailableHint":"规则将以降级方式继续运行。","ruleErrorTitle":"监控规则已自动停用"},"notifPermission":{"title":"启用浏览器通知?","desc":"即使页面在后台,监控触发时也能收到通知。","enable":"启用","dismiss":"暂不"}},"validation":{"deviceNameRequired":"设备名称为必填项","hostRequired":"SSH 设备需要填写主机地址","portRequired":"SSH 设备需要填写有效端口","usernameRequired":"SSH 设备需要填写用户名","sshConfigRequired":"SSH 设备需要填写 ssh config 路径"},"files":{"title":"文件","refresh":"刷新文件列表","noRoots":"没有可访问的目录。请在「设置 → 文件」中添加。","emptyDir":"空目录","truncated":"条目过多,列表已截断","download":"下载","error":{"invalid":"无效请求","outside_roots":"路径超出允许的目录范围","not_found":"已不存在","not_a_directory":"不是目录","is_directory":"这是一个目录","too_large":"文件过大,无法预览","binary":"二进制文件无法预览","permission_denied":"无访问权限","device_not_found":"设备不存在","root_not_found":"目录项不存在","root_disabled":"该目录已禁用","connection_failed":"连接设备失败","auth_unsupported":"该设备的认证方式不支持文件访问(请用密钥或 ssh-agent)","rsync_missing_local":"服务器上未安装 rsync","rsync_missing_remote":"远程设备上未安装 rsync","timeout":"已超时","unknown":"加载失败"},"retry":"重试(收起后再展开)","menu":{"copyAbsolute":"复制绝对位置","copyRelative":"复制相对位置","sendToAgent":"发送到 Agent","expand":"展开","collapse":"收起","upload":"上传文件到这个文件夹","open":"打开"},"copied":"已复制到剪贴板","copyFailed":"复制失败","sendToAgent":{"prompt":"请处理这个路径:`{{path}}`"},"upload":{"uploading":"正在上传 {{name}}…","success":"已上传 {{name}}","fail":"上传 {{name}} 失败"},"transfer":{"legUserToTmex":"用户 → tmex","legTmexToServer":"tmex → 服务器","legServerToTmex":"服务器 → tmex","legTmexToUser":"tmex → 用户","cancel":"取消","canceled":"已取消 {{name}}","downloaded":"已下载 {{name}}","downloadFailed":"下载 {{name}} 失败","dragDownloadStarted":"已开始下载 {{name}}(由浏览器接管)","tooLarge":"{{name}} 超过大小上限({{max}})"},"agentLaunch":{"connectFailed":"连接设备失败","windowFailed":"创建窗口失败"},"install":{"button":"安装 rsync","scopeLocal":"服务器","scopeRemote":"远程","prompt":"设备 {{device}}({{scope}})上未检测到 rsync。请根据系统选择合适的命令安装 rsync(例如 `brew install rsync`、`sudo apt-get install -y rsync` 或 `sudo yum install -y rsync`),安装完成后回复我。"}},"file":{"invalidRef":"无效的文件引用","notFound":"文件已不存在","accessDenied":"无访问权限","loadFailed":"加载文件失败","isDirectory":"这是一个目录","notPreviewable":"该文件类型不支持预览","tooLarge":"文件过大,无法预览","binary":"二进制文件无法预览","download":"下载","openRaw":"打开原始文件"}}'),t={translation:e};export{t as default,e as translation};
@@ -19,7 +19,7 @@
19
19
  <link rel="apple-touch-icon" href="/tmex.png" />
20
20
  <meta name="description" content="tmex - Web 接入多设备 tmux 的终端控制平台" />
21
21
  <title>tmex</title>
22
- <script type="module" crossorigin src="/assets/index-U4iZ6Kxr.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-CxD8veUJ.js"></script>
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-C4Fdxowt.css">
24
24
  </head>
25
25
  <body>
@@ -0,0 +1 @@
1
+ ALTER TABLE `site_settings` ADD `disabled_notification_channels` text DEFAULT '[]' NOT NULL;
@@ -0,0 +1,17 @@
1
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
2
+ CREATE TABLE `__new_agent_settings` (
3
+ `id` integer PRIMARY KEY NOT NULL,
4
+ `search_provider` text DEFAULT 'none' NOT NULL,
5
+ `tavily_api_key_enc` text,
6
+ `brave_api_key_enc` text,
7
+ `default_provider_id` text,
8
+ `default_model_id` text,
9
+ `updated_at` text NOT NULL,
10
+ FOREIGN KEY (`default_provider_id`) REFERENCES `llm_providers`(`id`) ON UPDATE no action ON DELETE set null,
11
+ CONSTRAINT "agent_settings_singleton_check" CHECK("id" = 1)
12
+ );
13
+ --> statement-breakpoint
14
+ INSERT INTO `__new_agent_settings`("id", "search_provider", "tavily_api_key_enc", "brave_api_key_enc", "default_provider_id", "default_model_id", "updated_at") SELECT "id", "search_provider", "tavily_api_key_enc", "brave_api_key_enc", "default_provider_id", "default_model_id", "updated_at" FROM `agent_settings`;--> statement-breakpoint
15
+ DROP TABLE `agent_settings`;--> statement-breakpoint
16
+ ALTER TABLE `__new_agent_settings` RENAME TO `agent_settings`;--> statement-breakpoint
17
+ PRAGMA foreign_keys=ON;
@@ -106,6 +106,20 @@
106
106
  "when": 1783160120018,
107
107
  "tag": "0014_lucky_killraven",
108
108
  "breakpoints": true
109
+ },
110
+ {
111
+ "idx": 15,
112
+ "version": "6",
113
+ "when": 1783203940167,
114
+ "tag": "0015_wise_mongu",
115
+ "breakpoints": true
116
+ },
117
+ {
118
+ "idx": 16,
119
+ "version": "6",
120
+ "when": 1783204150777,
121
+ "tag": "0016_cheerful_scarecrow",
122
+ "breakpoints": true
109
123
  }
110
124
  ]
111
125
  }
@@ -1,24 +0,0 @@
1
- import{Y as qe,u as Ie,j as i,aD as jt,aE as Ct,aF as Nt,aG as Pt,aH as kt,at as It,r as n,d as H,af as ge,ai as ut,ah as dt,ag as Mt,aj as Lt,aI as At,aJ as _t,o as Le,aK as zt,D as Dt,p as $t,q as Bt,s as Ft,ay as ft,aL as Ze,aM as et,aw as ht,b as mt,aN as tt,aO as Ht,c as nt,aC as pt,aP as Pe,aQ as Wt,aq as Ue,y as Ot,a2 as qt,B as Ne,T as Xt,aR as Yt,aS as Ut,aT as Vt,aU as Kt,aV as Gt,$ as Qt,aW as Jt,A as Zt,f as en,g as tn,i as nn,k as rn,l as sn,m as on,n as cn}from"./index-U4iZ6Kxr.js";import{T as an,C as ln,c as un,F as dn,a as wt,R as fn,A as hn,f as mn,t as pn,S as wn}from"./terminal-settings-panel-DU9rOuZd.js";import{e as gn}from"./selection-clipboard-D3gUQQ7L.js";import{C as xn}from"./copy-CJIriuQt.js";import{S as ct,K as vn}from"./send-e_FTy5nC.js";const bn=/^[0-9a-fA-F]{4}$/;function Sn(t){if(typeof t!="string"||t.length<6)return null;const e=t.slice(0,4);if(!bn.test(e)||t[4]!==",")return null;const s={input:t,pos:5},c=gt(s);return!c||s.pos!==t.length?null:{checksum:e,root:c}}function Be(t){const e=t.pos;for(;t.pos<t.input.length;){const s=t.input.charCodeAt(t.pos);if(s<48||s>57)break;t.pos+=1}return t.pos===e?null:Number.parseInt(t.input.slice(e,t.pos),10)}function Fe(t,e){return t.input[t.pos]!==e?!1:(t.pos+=1,!0)}function gt(t){const e=Be(t);if(e===null||!Fe(t,"x"))return null;const s=Be(t);if(s===null||!Fe(t,","))return null;const c=Be(t);if(c===null||!Fe(t,","))return null;const u=Be(t);if(u===null)return null;const w=t.input[t.pos];if(w===","){t.pos+=1;const g=Be(t);return g===null?null:{type:"leaf",paneNumId:g,width:e,height:s,x:c,y:u}}if(w==="{"||w==="["){const g=w==="{"?"}":"]";t.pos+=1;const x=[];for(;;){const I=gt(t);if(!I)return null;if(x.push(I),!Fe(t,",")){if(Fe(t,g))break;return null}}return x.length<2?null:{type:w==="{"?"row":"column",width:e,height:s,x:c,y:u,children:x}}return null}function Ve(t){return`%${t.paneNumId}`}/**
2
- * @license lucide-react v0.564.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const yn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],En=qe("columns-2",yn);/**
7
- * @license lucide-react v0.564.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Rn=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Tn=qe("search-x",Rn);/**
12
- * @license lucide-react v0.564.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const jn=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Cn=qe("settings-2",jn);/**
17
- * @license lucide-react v0.564.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const Nn=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Pn=qe("smartphone",Nn);function kn({open:t,onOpenChange:e}){const{t:s}=Ie();return i.jsx(jt,{open:t,onOpenChange:e,children:i.jsxs(Ct,{side:"bottom",className:"max-h-[88dvh] overflow-y-auto pb-[var(--tmex-safe-area-bottom)] sm:mx-auto sm:max-w-md sm:rounded-t-2xl sm:border sm:border-b-0","data-testid":"keyboard-behavior-sheet",children:[i.jsxs(Nt,{children:[i.jsx(Pt,{children:s("settings.terminal.title")}),i.jsx(kt,{children:s("settings.terminal.savedInBrowser")})]}),i.jsx("div",{className:"px-4 pb-4",children:i.jsx(an,{})})]})})}function In({visible:t,canPaste:e,onCopy:s,onPaste:c,onDismiss:u}){const{t:w}=Ie();if(!t)return null;const g=x=>{x.preventDefault()};return i.jsxs("div",{className:"absolute top-2 left-1/2 z-20 flex -translate-x-1/2 items-center gap-1 rounded-lg border bg-background/95 p-1 shadow-md backdrop-blur","data-testid":"terminal-selection-toolbar",children:[i.jsxs("button",{type:"button",className:"flex h-9 items-center gap-1.5 rounded-md px-3 text-sm font-medium hover:bg-accent hover:text-accent-foreground",onMouseDown:g,onClick:s,"data-testid":"terminal-selection-copy",children:[i.jsx(xn,{className:"h-4 w-4"}),w("terminal.copy")]}),e&&i.jsxs("button",{type:"button",className:"flex h-9 items-center gap-1.5 rounded-md px-3 text-sm font-medium hover:bg-accent hover:text-accent-foreground",onMouseDown:g,onClick:c,"data-testid":"terminal-selection-paste",children:[i.jsx(ln,{className:"h-4 w-4"}),w("terminal.paste")]}),i.jsx("button",{type:"button",className:"flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground",onMouseDown:g,onClick:u,"aria-label":w("terminal.clearSelection"),"data-testid":"terminal-selection-dismiss",children:i.jsx(It,{className:"h-4 w-4"})})]})}function xt(t){if(!t)return t;const e=t.replace(/\r\n/g,`
22
- `);return(e.endsWith(`
23
- `)?e.slice(0,-1):e).replace(/\n/g,`\r
24
- `)}const Mn="\x1B[?1049h\x1B[H\x1B[2J";function Ln(t){return Mn+xt(t)}function An(t,e){let s=e,c=0;for(const x of t)x===10&&!s&&(c+=1),s=x===13;const u=s;if(c===0)return{normalized:t,endedWithCR:u};const w=new Uint8Array(t.length+c);let g=0;s=e;for(const x of t)x===10&&!s&&(w[g]=13,g+=1),w[g]=x,g+=1,s=x===13;return{normalized:w,endedWithCR:u}}const _n=1.3,zn=36,Dn=500,$n=12;function Bn(t,e){const s=n.useRef(!1);return n.useEffect(()=>{const c=t.current;if(!c||!(window.innerWidth<768||navigator.maxTouchPoints>0||"ontouchstart"in window))return;s.current=!0;let w=0,g=null,x=!1,I=0,V=0,X=0,E=null,M=!1;const Z=()=>{E!==null&&(clearTimeout(E),E=null)},r=v=>v?!!(v.closest(".scrollbar")||v.closest(".slider")||v.closest(".xterm-scroll-area")):!1,oe=(v,b,T)=>{const C=T instanceof Element?T:null;if(r(C))return!0;const A=document.elementFromPoint(v,b);if(r(A))return!0;const W=c.querySelector(".xterm");if(!(W instanceof HTMLElement))return!1;const S=W.getBoundingClientRect(),Y=v>=S.left&&v<=S.right,R=b>=S.top&&b<=S.bottom;return!Y||!R?!1:v>=S.right-zn},P=()=>[c.querySelector(".xterm-viewport"),c.querySelector(".xterm-scrollable-element")].filter(b=>b instanceof HTMLElement),ce=v=>{if(g===null)return null;for(let b=0;b<v.length;b+=1){const T=v.item(b);if(T&&T.identifier===g)return T}return null},ee=v=>{if(Z(),v.touches.length!==1)return;const b=v.touches.item(0);b&&(g=b.identifier,w=b.clientY,I=0,x=oe(b.clientX,b.clientY,v.target),V=b.clientX,X=b.clientY,M=!1,x||(E=setTimeout(()=>{var C;E=null;const T=(e==null?void 0:e())??null;(C=T==null?void 0:T.startTouchSelection)!=null&&C.call(T,V,X,"word")&&(M=!0)},Dn)))},we=v=>{var Y,R,_,z,te,L,K,ne,ue;const b=ce(v.touches)??v.touches.item(0);if(!b)return;if(M){const q=(e==null?void 0:e())??null;(Y=q==null?void 0:q.updateTouchSelection)==null||Y.call(q,b.clientX,b.clientY),v.cancelable&&v.preventDefault();return}if(E!==null&&Math.hypot(b.clientX-V,b.clientY-X)>$n&&Z(),x||(x=oe(b.clientX,b.clientY,v.target),x&&(I=0)),x)return;const T=b.clientY,C=w-T;if(w=T,C===0)return;let A=!1,W=!1;const S=(e==null?void 0:e())??null;if(S){const q=S==null?void 0:S._core,ie=((te=(z=(_=(R=q==null?void 0:q._renderService)==null?void 0:R.dimensions)==null?void 0:_.css)==null?void 0:z.cell)==null?void 0:te.height)??18;I+=C*_n;const O=I>0?Math.floor(I/ie):Math.ceil(I/ie);if(typeof S.handleViewportGesture=="function")O!==0&&(A=S.handleViewportGesture({source:"touch",deltaY:O*ie,clientX:b.clientX,clientY:b.clientY}),I-=O*ie);else if(O!==0){const N=((K=(L=S.buffer)==null?void 0:L.active)==null?void 0:K.viewportY)??0;S.scrollLines(O);const pe=((ue=(ne=S.buffer)==null?void 0:ne.active)==null?void 0:ue.viewportY)??0;A=N!==pe,W=O<0&&N<=0&&pe<=0,I-=O*ie}}else{const q=P();if(q.length===0)return;for(const ie of q){const O=ie.scrollTop;ie.scrollTop+=C;const N=ie.scrollTop;Math.abs(N-O)>0&&(A=!0),C<0&&N<=0&&(W=!0)}if(!A){const ie=c.querySelector(".xterm");if(ie instanceof HTMLElement){const O=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,deltaMode:WheelEvent.DOM_DELTA_PIXEL,deltaY:C}),N=ie.dispatchEvent(O);A=O.defaultPrevented||!N}}}v.cancelable&&(A||W)&&v.preventDefault()},ae=v=>{var T;if(Z(),!(g===null||!ce(v.changedTouches))&&(g=null,I=0,x=!1,M)){M=!1;const C=(e==null?void 0:e())??null;(T=C==null?void 0:C.endTouchSelection)==null||T.call(C)}},h=v=>{M&&v.preventDefault()};return c.addEventListener("touchstart",ee,{passive:!0}),c.addEventListener("touchmove",we,{passive:!1}),c.addEventListener("touchend",ae,{passive:!0}),c.addEventListener("touchcancel",ae,{passive:!0}),c.addEventListener("contextmenu",h),()=>{s.current=!1,Z(),c.removeEventListener("touchstart",ee),c.removeEventListener("touchmove",we),c.removeEventListener("touchend",ae),c.removeEventListener("touchcancel",ae),c.removeEventListener("contextmenu",h)}},[t,e]),s}function Fn({now:t,remoteSize:e,pendingLocalSize:s,ttlMs:c=2e3}){return!s||t-s.at>c?!0:s.cols===e.cols&&s.rows===e.rows}function Hn({currentSize:t,containerSize:e,force:s=!1}){return s?!0:t.cols!==e.cols||t.rows!==e.rows}function Wn({deviceId:t,paneId:e,deviceConnected:s,isSelectionInvalid:c,sizingMode:u="report",onResize:w,onSync:g,onResizeSettled:x,getContainerRect:I}){const V=n.useRef(null),X=n.useRef(null),E=n.useRef(null),M=n.useRef(null),Z=n.useRef(0),r=n.useRef([]),oe=n.useRef(null),P=n.useRef(null),ce=n.useRef(I),ee=n.useRef(!1),we=n.useRef(w),ae=n.useRef(g),h=n.useRef(x);n.useEffect(()=>{we.current=w},[w]),n.useEffect(()=>{ae.current=g},[g]),n.useEffect(()=>{h.current=x},[x]),n.useEffect(()=>{ce.current=I},[I]);const v=n.useCallback(()=>{var ue,q,ie,O,N,pe,fe,a,l,y;const R=P.current,_=oe.current;if(!R||!_||!R.element)return null;let z;try{const $=_.proposeDimensions();if(!$)throw new Error("fitAddon.proposeDimensions() returned null");z=Math.max(2,$.cols)}catch{const $=R._core,le=((O=(ie=(q=(ue=$==null?void 0:$._renderService)==null?void 0:ue.dimensions)==null?void 0:q.css)==null?void 0:ie.cell)==null?void 0:O.width)??9,he=(N=ce.current)==null?void 0:N.call(ce);if(!he||he.width===0)return null;z=Math.max(2,Math.floor(he.width/le))}const te=(pe=ce.current)==null?void 0:pe.call(ce);if(!te||te.height===0)return null;const L=R._core,K=((y=(l=(a=(fe=L==null?void 0:L._renderService)==null?void 0:fe.dimensions)==null?void 0:a.css)==null?void 0:l.cell)==null?void 0:y.height)??17,ne=Math.max(2,Math.floor(te.height/K));return{cols:z,rows:ne}},[]),b=n.useCallback((R,_)=>{const z=P.current;z&&(z.cols===R&&z.rows===_||z.resize(R,_))},[]),T=n.useCallback((R,_=!1)=>{var ue;if(u==="follow"||!t||!e||!s||c&&R!=="sync"||!_&&Date.now()<Z.current||!P.current)return!1;const te=v();if(!te)return!1;const{cols:L,rows:K}=te,ne=E.current;return!_&&ne&&ne.cols===L&&ne.rows===K?(b(L,K),!0):(b(L,K),R==="sync"?ae.current(L,K):we.current(L,K),E.current={cols:L,rows:K},M.current={cols:L,rows:K,at:Date.now()},(ue=h.current)==null||ue.call(h,L,K),!0)},[b,s,t,c,v,e,u]),C=n.useCallback((R="resize",_={})=>{const{immediate:z=!1,force:te=!1}=_;X.current!==null&&(window.clearTimeout(X.current),X.current=null),V.current!==null&&(cancelAnimationFrame(V.current),V.current=null);const L=()=>{V.current=requestAnimationFrame(()=>{V.current=null,T(R,te)})};if(z){L();return}X.current=window.setTimeout(()=>{X.current=null,L()},150)},[T]),A=n.useCallback(()=>{for(const R of r.current)window.clearTimeout(R);r.current=[]},[]),W=n.useCallback(()=>{var _;A(),C("sync",{immediate:!0,force:!0});const R=window.setTimeout(()=>{C("sync",{immediate:!0,force:!0})},60);r.current.push(R),typeof document<"u"&&"fonts"in document&&((_=document.fonts)!=null&&_.ready)&&document.fonts.ready.then(()=>{C("sync",{immediate:!0,force:!0})}).catch(()=>{})},[A,C]);n.useEffect(()=>{let R=null;const _=()=>{R!==null&&cancelAnimationFrame(R),R=requestAnimationFrame(()=>{R=null,C("resize")})};return window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_),R!==null&&cancelAnimationFrame(R)}},[C]),n.useEffect(()=>{const R=()=>{var ue;const L=P.current,K=v();if(!L||!K)return;if(!Hn({currentSize:{cols:Math.max(2,L.cols),rows:Math.max(2,L.rows)},containerSize:K})){(ue=L.forceFullRepaint)==null||ue.call(L);return}C("sync",{force:!0})},_=()=>{if(document.visibilityState!=="visible"){ee.current=!0;return}ee.current&&(ee.current=!1,R())},z=()=>{ee.current=!0},te=()=>{ee.current&&(ee.current=!1,R())};return document.addEventListener("visibilitychange",_),window.addEventListener("blur",z),window.addEventListener("focus",te),()=>{document.removeEventListener("visibilitychange",_),window.removeEventListener("blur",z),window.removeEventListener("focus",te)}},[v,C]),n.useEffect(()=>()=>{A(),X.current!==null&&window.clearTimeout(X.current),V.current!==null&&cancelAnimationFrame(V.current)},[A]);const S=n.useCallback(R=>{oe.current=R},[]),Y=n.useCallback(R=>{P.current=R},[]);return{scheduleResize:C,runPostSelectResize:W,clearPostSelectResizeTimers:A,setFitAddon:S,setTerminal:Y,lastReportedSize:E,pendingLocalSize:M,suppressLocalResizeUntil:Z}}const On=1e4,Ge="tmex:terminal-mode-cache";function qn(t,e){try{const s=sessionStorage.getItem(Ge);return s?JSON.parse(s)[`${t}:${e}`]??null:null}catch{return null}}function Xn(t,e,s){try{const c=sessionStorage.getItem(Ge),u=c?JSON.parse(c):{},w=`${t}:${e}`;s?u[w]=s:delete u[w],sessionStorage.setItem(Ge,JSON.stringify(u))}catch{}}function Yn(){return{mouseX10:!1,mouseNormal:!0,mouseButton:!1,mouseAny:!1,mouseUtf8:!1,mouseSgr:!0,mouseSgrPixels:!1,mouseUrxvt:!1,altScroll:!0,altScreen1047:!1,altScreen1049:!1}}function Un(t,e){if(!e)return t?{...t,mouseX10:!1,mouseNormal:!1,mouseButton:!1,mouseAny:!1,mouseUtf8:!1,mouseSgrPixels:!1,mouseUrxvt:!1,altScreen1047:!1,altScreen1049:!1}:null;const s=Yn();if(!t)return s;const c=t.mouseNormal||t.mouseButton||t.mouseAny;return{...t,mouseX10:!1,mouseUtf8:!1,mouseSgr:!0,mouseSgrPixels:!1,mouseUrxvt:!1,altScroll:!0,altScreen1047:!1,altScreen1049:!1,mouseNormal:c?t.mouseNormal:s.mouseNormal}}function Vn(t){var s;const e=globalThis;e.__tmexE2eXterm=t,e.__tmexE2eTerminal=t,e.__tmexE2eTerminalEngine=wt,e.__tmexE2eTerminalRenderer=((s=t.getRendererKind)==null?void 0:s.call(t))??null}function Kn(t){if(!t)return;const e=globalThis;e.__tmexE2eTerminal!==t&&e.__tmexE2eXterm!==t||(e.__tmexE2eXterm=null,e.__tmexE2eTerminal=null,e.__tmexE2eTerminalEngine=null,e.__tmexE2eTerminalRenderer=null,e.__tmexE2eTerminalSelectionText=null)}const rt=n.forwardRef(({deviceId:t,paneId:e,theme:s,inputMode:c,deviceConnected:u,isSelectionInvalid:w,sizingMode:g="report",autoFocus:x=!0,focused:I=!0,onResize:V,onSync:X,onResizeSettled:E,children:M},Z)=>{const[r,oe]=n.useState(null),[P,ce]=n.useState(!1),ee=H(d=>d.sendInput),we=ge(d=>d.terminalFontId),ae=ge(d=>d.terminalFontSize),h=ge(d=>d.terminalLineHeight),{t:v}=Ie(),b=n.useMemo(()=>{switch(s){case"light":return dt;default:return ut}},[s]),T=n.useRef(null),C=n.useRef(null),A=n.useRef(null),W=n.useRef(t),S=n.useRef(e),Y=n.useRef(t),R=n.useRef(e),_=n.useRef(u&&!w),z=n.useRef(c),te=n.useRef(b),L=n.useRef(!1),K=n.useRef(!1),ne=n.useRef(null),ue=n.useRef(!1),q=n.useCallback((d,f,j)=>{!(d!=null&&d.exportModeSnapshot)||!f||!j||Xn(f,j,d.exportModeSnapshot())},[]),ie=n.useCallback(()=>r,[r]);Bn(T,ie),n.useEffect(()=>{W.current=t,S.current=e,K.current=!1},[t,e]),n.useEffect(()=>{_.current=u&&!w},[u,w]),n.useEffect(()=>{z.current=c},[c]),n.useEffect(()=>{te.current=b},[b]);const O=n.useCallback(d=>{if(!d||c!=="direct"||!_.current)return;const f=W.current,j=S.current;!f||!j||ee(f,j,d,!1)},[c,ee]),{pendingLocalSize:N,scheduleResize:pe,runPostSelectResize:fe,setFitAddon:a,setTerminal:l}=Wn({deviceId:t,paneId:e,deviceConnected:u,isSelectionInvalid:w,sizingMode:g,onResize:V,onSync:X,onResizeSettled:E,getContainerRect:()=>{const d=T.current;if(!d)return null;const f=d.getBoundingClientRect();return{width:f.width,height:f.height}}});n.useEffect(()=>{let d=!1,f=null;return(async()=>{if(await Mt(we,ae),d)return;const j=await un({fontFamily:Lt(we),fontSize:ae,lineHeight:h,scrollback:On,theme:te.current,disableStdin:z.current==="editor"});if(d){j.dispose();return}f=j,C.current&&j.open(C.current),oe(j)})(),()=>{d=!0,oe(null),Kn(f),f==null||f.dispose()}},[we,ae,h]),n.useEffect(()=>{!r||!x||Vn(r)},[r,x]),n.useEffect(()=>{var d;(d=r==null?void 0:r.setFocused)==null||d.call(r,I)},[r,I]),n.useEffect(()=>{!r||!("setTheme"in r)||r.setTheme(b)},[r,b]),n.useEffect(()=>{!r||!("setDisableStdin"in r)||r.setDisableStdin(c==="editor")},[r,c]),n.useEffect(()=>{if(!(r!=null&&r.getCursorViewportRect))return;const d=()=>{var f;return((f=r.getCursorViewportRect)==null?void 0:f.call(r))??null};return zt(d),()=>At(d)},[r]),n.useEffect(()=>{!r||c!=="direct"||!x||window.innerWidth<768||"ontouchstart"in window||r.focus()},[r,c,x]);const y=n.useMemo(()=>r?{onReset:()=>{q(r,Y.current,R.current),ue.current=!0,r.reset(),L.current=!1,fe()},onApplyHistory:(d,f)=>{var U,J;const j=Un(qn(W.current,S.current),f);j&&((U=r.restoreModeSnapshot)==null||U.call(r,j));const B=f?Ln(d):xt(d);K.current=!0,r.write(B),(J=r.forceFullRepaint)==null||J.call(r),ue.current=!1,Y.current=W.current,R.current=S.current,q(r,W.current,S.current)},onOutput:d=>{const f=An(d,L.current);L.current=f.endedWithCR,r.write(f.normalized),K.current&&(r.buffer.active.baseY<=1&&r.scrollToTop(),K.current=!1),Y.current=W.current,R.current=S.current,q(r,W.current,S.current)}}:null,[r,q,fe]);n.useEffect(()=>{r?ne.current!==r&&(L.current=!1,Y.current=W.current,R.current=S.current,ne.current=r):ne.current=null},[r]),n.useEffect(()=>{if(!(!r||!t||!e))return()=>{if(ue.current){ue.current=!1;return}q(r,Y.current,R.current)}},[t,r,e,q]),n.useEffect(()=>{if(!(!y||!t||!e))return _t(t,e,y)},[y,t,e]),n.useEffect(()=>{if(!r){A.current=null,a(null),l(null);return}const d=new dn;return r.loadAddon(d),A.current=d,a(d),l(r),fe(),()=>{try{d.dispose()}finally{A.current=null,a(null),l(null)}}},[r,fe,a,l]),n.useEffect(()=>{const d=T.current;if(!d)return;let f=null;const j=new ResizeObserver(()=>{f!==null&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=null,pe("resize")})});return j.observe(d),()=>{j.disconnect(),f!==null&&cancelAnimationFrame(f)}},[pe]),n.useEffect(()=>{if(!r||!t||!e)return;const d=r.onData(f=>{!u||w||O(f)});return r.attachCustomKeyEventHandler(f=>!u||w||f.type!=="keydown"||c!=="direct"?!0:f.shiftKey&&f.key==="Enter"?(f.preventDefault(),O("\x1B[13;2u"),!1):!0),()=>{d.dispose(),r.attachCustomKeyEventHandler(()=>!0)}},[r,u,w,c,O,t,e]),n.useEffect(()=>{if(!(r!=null&&r.onLinkActivated))return;const d=r.onLinkActivated(f=>{window.open(f,"_blank","noopener,noreferrer")});return()=>d.dispose()},[r]),n.useEffect(()=>{if(!(r!=null&&r.onSelectionChange)){ce(!1);return}const d=r.onSelectionChange(f=>{ce(!!f)});return()=>{d.dispose(),ce(!1)}},[r]);const $=n.useCallback(()=>{var f;if(!r)return;const d=((f=r.getSelection)==null?void 0:f.call(r))??"";d&&gn(d).then(()=>{Le.success(v("terminal.copied"))}).catch(()=>{Le.error(v("terminal.copyFailed"))}).finally(()=>{var j;(j=r.clearSelection)==null||j.call(r),r.focus()})},[r,v]),le=n.useCallback(()=>{var f;if(!r)return;((f=navigator.clipboard)!=null&&f.readText?navigator.clipboard.readText():Promise.reject(new Error("clipboard unavailable"))).then(j=>{var B;j&&r.paste(j),(B=r.clearSelection)==null||B.call(r),r.focus()}).catch(()=>{Le.error(v("terminal.pasteFailed"))})},[r,v]),he=n.useCallback(()=>{var d;(d=r==null?void 0:r.clearSelection)==null||d.call(r),r==null||r.focus()},[r]);return n.useImperativeHandle(Z,()=>({write:d=>r==null?void 0:r.write(d),reset:()=>{r==null||r.reset(),L.current=!1},scrollToBottom:()=>r==null?void 0:r.scrollToBottom(),resize:(d,f)=>r==null?void 0:r.resize(d,f),getTerminal:()=>r??null,getSize:()=>r?{cols:Math.max(2,r.cols),rows:Math.max(2,r.rows)}:null,runPostSelectResize:()=>fe(),scheduleResize:(d,f)=>pe(d,f),calculateSizeFromContainer:()=>{var Te,xe,F,re,D,G,Q,de,Ee,Re,ve,Me,Ae,ze,me,_e;const d=T.current,f=r,j=A.current;if(!d||!f)return null;const B=d.getBoundingClientRect();if(B.width===0||B.height===0)return null;const U=f._core;let J;if(j)try{const je=j.proposeDimensions();if(je)J=Math.max(2,je.cols);else{const De=((re=(F=(xe=(Te=U==null?void 0:U._renderService)==null?void 0:Te.dimensions)==null?void 0:xe.css)==null?void 0:F.cell)==null?void 0:re.width)??9;J=Math.max(2,Math.floor(B.width/De))}}catch{const je=((de=(Q=(G=(D=U==null?void 0:U._renderService)==null?void 0:D.dimensions)==null?void 0:G.css)==null?void 0:Q.cell)==null?void 0:de.width)??9;J=Math.max(2,Math.floor(B.width/je))}else{const je=((Me=(ve=(Re=(Ee=U==null?void 0:U._renderService)==null?void 0:Ee.dimensions)==null?void 0:Re.css)==null?void 0:ve.cell)==null?void 0:Me.width)??9;J=Math.max(2,Math.floor(B.width/je))}const Ce=((_e=(me=(ze=(Ae=U==null?void 0:U._renderService)==null?void 0:Ae.dimensions)==null?void 0:ze.css)==null?void 0:me.cell)==null?void 0:_e.height)??17,ye=Math.max(2,Math.floor(B.height/Ce));return{cols:J,rows:ye}},getPendingLocalSize:()=>N.current,getCellSize:()=>{var j,B,U;const d=r==null?void 0:r._core,f=(U=(B=(j=d==null?void 0:d._renderService)==null?void 0:j.dimensions)==null?void 0:B.css)==null?void 0:U.cell;return!(f!=null&&f.width)||!(f!=null&&f.height)?null:{width:f.width,height:f.height}}}),[r,N,fe,pe]),i.jsxs("div",{className:"flex h-full w-full flex-col",style:{backgroundColor:b.background},"data-terminal-engine":wt,children:[i.jsxs("div",{ref:T,className:"relative min-h-0 w-full flex-1",children:[i.jsx("div",{ref:C,className:"absolute inset-0"}),i.jsx(In,{visible:P,canPaste:c==="direct"&&u&&!w,onCopy:$,onPaste:le,onDismiss:he})]}),M]})});rt.displayName="Terminal";function Gn({window:t,currentPaneId:e,onSelectPane:s}){const{t:c}=Ie();return i.jsxs(Dt,{children:[i.jsxs($t,{"data-testid":"pane-switcher-button","aria-label":c("window.switchPane"),title:c("window.switchPane"),className:"relative inline-flex size-7 items-center justify-center rounded-[min(var(--radius-md),12px)] text-sm hover:bg-muted hover:text-foreground data-popup-open:bg-muted",children:[i.jsx(En,{className:"h-4 w-4"}),i.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary px-0.5 text-[9px] font-medium leading-none text-primary-foreground",children:t.panes.length})]}),i.jsx(Bt,{align:"end",backdrop:!0,className:"min-w-56 max-w-[80vw]","data-testid":"pane-switcher-menu",children:t.panes.map(u=>{const w=u.id===e;return i.jsxs(Ft,{"data-testid":"pane-switcher-item","data-pane-id":u.id,className:`py-2 [@media(any-pointer:coarse)]:py-2.5 ${w?"bg-primary/10 text-primary":u.active?"bg-accent text-accent-foreground":""}`,onClick:()=>{w||s(u.id)},children:[i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"font-mono text-[11px] leading-tight font-medium line-clamp-2 [overflow-wrap:break-word]",children:u.customName||u.title||c("window.pane")}),u.currentCommand&&i.jsx("span",{className:"font-mono text-[10.5px] leading-tight text-muted-foreground line-clamp-1 break-all",children:u.currentPath?`${u.currentCommand}@${u.currentPath}`:u.currentCommand})]}),w&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-primary"})]},u.id)})})]})}function Qn(t,e){return ft(s=>{for(const c of Object.values(s.sessions))if(!(!c||c.deviceId!==t||c.paneId!==e)&&!(c.status==="stopped"||c.status==="error")){if(c.status==="running"){const u=s.inProgress[c.id];return u&&(u.texts.length>0||u.toolCalls.length>0||u.reasonings.length>0),"generating"}return"bound"}return"none"})}function Qe(t){return t.type==="leaf"?t:t.type==="row"?Qe(t.children[t.children.length-1]):Qe(t.children[0])}function Je(t){return t.type==="leaf"?t:t.type==="column"?Je(t.children[t.children.length-1]):Je(t.children[0])}function Jn(t,e){const s=[],c=[],u=w=>{if(w.type==="leaf"){s.push({paneId:Ve(w),cols:w.width,rows:w.height,rect:{left:w.x*e.width,top:w.y*e.height,width:w.width*e.width,height:w.height*e.height}});return}for(let g=0;g<w.children.length;g+=1){const x=w.children[g];if(u(x),g!==w.children.length-1)if(w.type==="row"){const I=Qe(x);c.push({axis:"x",rect:{left:(x.x+x.width)*e.width,top:w.y*e.height,width:e.width,height:w.height*e.height},edgeLeafPaneId:Ve(I)})}else{const I=Je(x);c.push({axis:"y",rect:{left:w.x*e.width,top:(x.y+x.height)*e.height,width:w.width*e.width,height:e.height},edgeLeafPaneId:Ve(I)})}}};return u(t),{panes:s,gutters:c}}function We(t){if(t.type==="leaf")return 1;if(t.type==="column"){let s=0;for(const c of t.children)s+=We(c);return s}let e=1;for(const s of t.children)e=Math.max(e,We(s));return e}function Oe(t){if(t.type==="leaf")return 1;if(t.type==="row"){let s=0;for(const c of t.children)s+=Oe(c);return s}let e=1;for(const s of t.children)e=Math.max(e,Oe(s));return e}function Zn(t,e){const s=We(t),c=Oe(t),u=Math.max(0,e.viewport.width-c*e.paneChrome.width),w=Math.max(0,e.viewport.height-s*e.paneChrome.height),g=Math.max(2,Math.floor(u/e.cell.width)),x=Math.max(2,Math.floor(w/e.cell.height));return{cols:g,rows:x}}function er(t){return t?t.panes.map(e=>`${e.paneId}:${e.cols}x${e.rows}`).join("|"):""}function tr(t,e){const s=Math.min(1,Math.max(0,t)),c=Math.min(1,Math.max(0,e)),u=[["left",s],["right",1-s],["top",c],["bottom",1-c]];return u.sort((w,g)=>w[1]-g[1]),u[0][0]}const at=150,nr=200,rr=15,sr=46,or=38,ir=12,cr=6;function lt(t){var e,s;return((e=t==null?void 0:t.customName)==null?void 0:e.trim())||((s=t==null?void 0:t.title)==null?void 0:s.trim())||"Pane"}function ar(t){var c,u;const e=(c=t==null?void 0:t.currentCommand)==null?void 0:c.trim();if(!e)return null;const s=(u=t==null?void 0:t.currentPath)==null?void 0:u.trim();return s?`${e}@${s}`:e}function lr({paneId:t}){return Ze(s=>!!s.ringingPanes[t])?i.jsx("span",{className:"bell-blink shrink-0",children:"🔔 "}):null}function ur({deviceId:t,paneId:e}){const{t:s}=Ie(),c=Qn(t,e);return c==="none"?null:c==="generating"?i.jsxs("span",{className:"shrink-0 select-none text-xs",title:s("agent.paneBadge.generating"),"aria-label":s("agent.paneBadge.generating"),children:["🤖",i.jsx("span",{className:"ml-0.5 text-[10px] animate-pulse",children:"✨"})]}):i.jsx("span",{className:"text-muted-foreground/60 shrink-0 select-none text-xs grayscale",title:s("agent.paneBadge.bound"),"aria-label":s("agent.paneBadge.bound"),children:"🤖"})}const dr={left:"left-0 top-0 bottom-0 w-1/2",right:"right-0 top-0 bottom-0 w-1/2",top:"left-0 right-0 top-0 h-1/2",bottom:"left-0 right-0 bottom-0 h-1/2"};function fr({deviceId:t,window:e,focusedPaneId:s,theme:c,inputMode:u,deviceConnected:w,focusedTerminalRef:g,onUserSelectPane:x,onWindowResize:I,onWindowResizeSettled:V}){var N,pe,fe;const X=n.useRef(null),E=n.useRef(new Map),[M,Z]=n.useState(null),[r,oe]=n.useState(null),{t:P}=Ie(),ce=H(a=>a.subscribePanes),ee=H(a=>a.fetchPaneHistory),we=H(a=>a.resizePaneInWindow),ae=H(a=>a.movePane),h=H(a=>a.breakPane),v=H(a=>a.closePane),b=n.useMemo(()=>{const a=new Map;for(const l of e.panes)a.set(l.id,l);return a},[e.panes]),T=n.useMemo(()=>e.layout?Sn(e.layout):null,[e.layout]),C=n.useMemo(()=>T?Jn(T.root,{width:1,height:1}):null,[T]),A=n.useRef(C);A.current=C;const W=(T==null?void 0:T.root.width)??1,S=(T==null?void 0:T.root.height)??1,Y=e.panes.map(a=>a.id).join(",");n.useEffect(()=>(ce(t,Y?Y.split(","):[]),()=>{ce(t,[])}),[t,Y,ce]);const R=n.useRef({key:"",fetched:new Set});n.useEffect(()=>{const a=`${t}:${e.id}`;R.current.key!==a&&(R.current={key:a,fetched:new Set});for(const l of Y?Y.split(","):[])R.current.fetched.has(l)||l!==s&&(R.current.fetched.add(l),ee(t,l))},[t,e.id,Y,s,ee]),n.useEffect(()=>{var l,y;u!=="direct"||window.innerWidth<768||"ontouchstart"in window||(y=(l=E.current.get(s))==null?void 0:l.getTerminal())==null||y.focus()},[s,u]);const _=n.useCallback(()=>{var a;for(const l of[s,...E.current.keys()]){const y=(a=E.current.get(l))==null?void 0:a.getCellSize();if(y)return y}return null},[s]),z=er(C);n.useEffect(()=>{var l;const a=A.current;if(a)for(const y of a.panes)(l=E.current.get(y.paneId))==null||l.resize(y.cols,y.rows)},[z]);const te=n.useMemo(()=>T?We(T.root):1,[T]),L=n.useMemo(()=>T?Oe(T.root):1,[T]),K=n.useCallback(()=>{const a=X.current;if(!a||!T)return!1;const l=a.getBoundingClientRect();if(l.width<1||l.height<1)return!1;const y=_();if(!y)return!1;const{cols:$,rows:le}=Zn(T.root,{viewport:{width:l.width,height:l.height},cell:y,paneChrome:{width:ir,height:sr}});return I($,le),V==null||V($,le),!0},[_,T,I,V]),ne=n.useRef(K);n.useEffect(()=>{ne.current=K},[K]),n.useEffect(()=>{const a=X.current;if(!a)return;let l=null,y=null,$=0;const le=()=>{if(ne.current()){$=0;return}$<rr&&($+=1,y=setTimeout(le,nr))},he=new ResizeObserver(()=>{l&&clearTimeout(l),l=setTimeout(le,at)});return he.observe(a),()=>{he.disconnect(),l&&clearTimeout(l),y&&clearTimeout(y)}},[]),n.useEffect(()=>{const a=setTimeout(()=>{ne.current()},at);return()=>clearTimeout(a)},[te,L]);const ue=n.useCallback((a,l,y)=>{y.preventDefault();const $=X.current;if(!$)return;const le=y.clientX,he=y.clientY,d=y.currentTarget;d.setPointerCapture(y.pointerId),Z({gutterIndex:a,deltaPx:0});const f=J=>{const Ce=l.axis==="x"?J.clientX-le:J.clientY-he;Z({gutterIndex:a,deltaPx:Ce})},j=(J,Ce)=>{if(d.removeEventListener("pointermove",f),d.removeEventListener("pointerup",B),d.removeEventListener("pointercancel",U),window.removeEventListener("pointerup",B),window.removeEventListener("pointercancel",U),Z(null),!Ce)return;const ye=_();if(!ye)return;const Te=l.axis==="x"?J.clientX-le:J.clientY-he,xe=l.axis==="x"?ye.width:ye.height;if(xe<=0)return;const F=Math.round(Te/xe);if(F===0)return;const re=$.querySelector(`[data-pane-id="${l.edgeLeafPaneId}"]`);if(!re)return;const D=re.getBoundingClientRect(),Q=(l.axis==="x"?Math.floor(D.width/xe):Math.floor(D.height/xe))+F;Q<2||(ne.current(),we(t,l.edgeLeafPaneId,l.axis==="x"?{cols:Q}:{rows:Q}))},B=J=>j(J,!0),U=J=>j(J,!1);d.addEventListener("pointermove",f),window.addEventListener("pointerup",B),window.addEventListener("pointercancel",U)},[t,_,we]),q=n.useCallback((a,l)=>{const y=X.current,$=C;if(!y||!$)return;l.preventDefault();const le=l.clientX,he=l.clientY,d=l.currentTarget;d.setPointerCapture(l.pointerId);let f=!1;const j=(F,re)=>{const D=y.getBoundingClientRect();if(D.width<1||D.height<1)return null;const G=(F-D.left)/D.width*Math.max(1,W),Q=(re-D.top)/D.height*Math.max(1,S);for(const de of $.panes)if(G>=de.rect.left&&G<=de.rect.left+de.rect.width&&Q>=de.rect.top&&Q<=de.rect.top+de.rect.height){const Ee=(G-de.rect.left)/Math.max(1e-6,de.rect.width),Re=(Q-de.rect.top)/Math.max(1e-6,de.rect.height);return{paneId:de.paneId,position:tr(Ee,Re)}}return null},B=(F,re,D)=>F>=D.left&&F<=D.right&&re>=D.top&&re<=D.bottom,U=(F,re)=>{for(const D of Array.from(document.querySelectorAll('[data-testid^="window-item-"]'))){const G=D.getBoundingClientRect();if(G.width<1||!B(F,re,G))continue;const Q=(D.getAttribute("data-testid")??"").replace("window-item-","");return!Q||Q===e.id?null:{type:"window",windowId:Q,rect:{left:G.left,top:G.top,width:G.width,height:G.height}}}for(const D of Array.from(document.querySelectorAll('[data-slot="sidebar"]'))){const G=D.getBoundingClientRect();if(!(G.width<1||!B(F,re,G)))return{type:"break",rect:{left:G.left,top:G.top,width:G.width,height:G.height}}}return null},J=(F,re)=>{const D=j(F,re);return D?D.paneId===a?null:{type:"pane",...D}:U(F,re)},Ce=F=>{const re=Math.hypot(F.clientX-le,F.clientY-he);!f&&re<cr||(f=!0,oe({srcPaneId:a,active:!0,pointerX:F.clientX,pointerY:F.clientY,target:J(F.clientX,F.clientY)}))},ye=(F,re)=>{var G,Q;if(d.removeEventListener("pointermove",Ce),d.removeEventListener("pointerup",Te),d.removeEventListener("pointercancel",xe),window.removeEventListener("pointerup",Te),window.removeEventListener("pointercancel",xe),oe(null),!re||!f)return;const D=J(F.clientX,F.clientY);if(D){if(D.type==="pane"){ae(t,a,D.paneId,D.position);return}if(D.type==="window"){const de=(Q=(G=H.getState().snapshots[t])==null?void 0:G.session)==null?void 0:Q.windows,Ee=de==null?void 0:de.find(ve=>ve.id===D.windowId),Re=(Ee==null?void 0:Ee.panes.find(ve=>ve.active))??(Ee==null?void 0:Ee.panes[0]);Re&&ae(t,a,Re.id,"right");return}h(t,a)}},Te=F=>ye(F,!0),xe=F=>ye(F,!1);d.addEventListener("pointermove",Ce),window.addEventListener("pointerup",Te),window.addEventListener("pointercancel",xe)},[t,C,ae,h,W,S,e.id]),ie=n.useCallback(a=>l=>{var y;if(l){E.current.set(a,l);const $=(y=A.current)==null?void 0:y.panes.find(le=>le.paneId===a);$&&l.resize($.cols,$.rows)}else E.current.delete(a);a===s&&g(l)},[s,g]);if(n.useEffect(()=>{g(E.current.get(s)??null)},[s,g]),!C)return null;const O=(a,l)=>`${a/Math.max(1,l)*100}%`;return i.jsxs("div",{ref:X,className:"relative h-full w-full min-h-0 min-w-0","data-testid":"split-terminal-area",children:[C.panes.map(a=>{var d;const l=a.paneId===s,y=b.get(a.paneId),$=ar(y),le=(r==null?void 0:r.active)&&r.srcPaneId===a.paneId,he=r!=null&&r.active&&((d=r.target)==null?void 0:d.type)==="pane"&&r.target.paneId===a.paneId?r.target.position:null;return i.jsxs("div",{className:`absolute flex flex-col overflow-hidden ${le?"opacity-60":""}`,"data-testid":"split-pane","data-pane-id":a.paneId,"data-focused":l||void 0,style:{left:O(a.rect.left,W),top:O(a.rect.top,S),width:O(a.rect.width,W),height:O(a.rect.height,S)},onPointerDownCapture:()=>{l||x(e.id,a.paneId)},children:[i.jsx("div",{className:"shrink-0 px-1.5 pt-1.5 pb-2",style:{height:or},children:i.jsxs("div",{"data-testid":"split-pane-titlebar","data-active":l||void 0,className:`flex h-6 cursor-grab touch-none select-none items-center gap-1.5 rounded-md px-2.5 transition-colors active:cursor-grabbing ${l?"bg-foreground/10":"bg-foreground/[0.04]"}`,onPointerDown:f=>q(a.paneId,f),children:[i.jsx(lr,{paneId:a.paneId}),i.jsx(ur,{deviceId:t,paneId:a.paneId}),i.jsx("span",{className:`shrink-0 truncate font-mono text-[10.5px] leading-none ${l?"text-foreground/90":"text-foreground/50"}`,children:lt(y)}),$&&i.jsx("span",{className:`min-w-0 flex-1 truncate font-mono text-[10px] leading-none ${l?"text-muted-foreground":"text-muted-foreground/60"}`,children:$}),i.jsx("button",{type:"button","data-testid":`split-pane-close-${a.paneId}`,"aria-label":P("window.closePane"),title:P("window.closePane"),className:"ml-auto flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground/50 hover:bg-foreground/10 hover:text-foreground",onPointerDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),v(t,a.paneId)},children:i.jsx("span",{className:"text-xs leading-none",children:"×"})})]})}),i.jsx("div",{className:"relative min-h-0 flex-1 overflow-hidden px-1.5 pb-2","data-pane-content-id":a.paneId,children:i.jsx(rt,{ref:ie(a.paneId),deviceId:t,paneId:a.paneId,theme:c,inputMode:u,deviceConnected:w,isSelectionInvalid:!1,sizingMode:"follow",autoFocus:l,focused:l,onResize:()=>{},onSync:()=>{}},`${t}:${a.paneId}`)}),he&&i.jsx("div",{"data-testid":"split-pane-drop-preview","data-position":he,className:`pointer-events-none absolute z-30 rounded-sm bg-primary/20 ring-1 ring-inset ring-primary/60 ${dr[he]}`})]},a.paneId)}),(M!==null||(r==null?void 0:r.active))&&i.jsx("div",{"data-testid":"split-drag-shield",className:`absolute inset-0 z-30 ${M!==null?((N=C.gutters[M.gutterIndex])==null?void 0:N.axis)==="x"?"cursor-col-resize":"cursor-row-resize":"cursor-grabbing"}`}),(r==null?void 0:r.active)&&r.target&&r.target.type!=="pane"&&i.jsx("div",{"data-testid":"split-pane-sidebar-drop","data-drop-type":r.target.type,className:"pointer-events-none fixed z-40 rounded-lg bg-primary/15 ring-1 ring-inset ring-primary/50",style:{left:r.target.rect.left,top:r.target.rect.top,width:r.target.rect.width,height:r.target.rect.height}}),(r==null?void 0:r.active)&&i.jsxs("div",{className:"pointer-events-none fixed z-50 rounded border border-primary/40 bg-popover/95 px-2 py-1 font-mono text-[10.5px] text-popover-foreground shadow-md",style:{left:r.pointerX+12,top:r.pointerY+12},children:[i.jsx("div",{children:lt(b.get(r.srcPaneId))}),((pe=r.target)==null?void 0:pe.type)==="window"&&i.jsx("div",{className:"text-[9.5px] text-muted-foreground",children:P("window.moveToWindow")}),((fe=r.target)==null?void 0:fe.type)==="break"&&i.jsx("div",{className:"text-[9.5px] text-muted-foreground",children:P("window.breakToWindow")})]}),C.gutters.map((a,l)=>{const y=a.axis==="x",$=(M==null?void 0:M.gutterIndex)===l;return i.jsxs("div",{className:"absolute z-20",style:{left:O(a.rect.left,W),top:O(a.rect.top,S),width:O(y?1:a.rect.width,W),height:O(y?a.rect.height:1,S)},children:[i.jsx("div",{"data-testid":"split-gutter","data-axis":a.axis,className:`absolute touch-none select-none ${y?"-inset-x-1 inset-y-0 cursor-col-resize":"inset-x-0 -inset-y-1 cursor-row-resize"}`,onPointerDown:le=>ue(l,a,le),children:i.jsx("div",{className:`absolute bg-foreground/[0.08] transition-colors hover:bg-primary/50 ${y?"inset-y-0 left-1/2 w-px -translate-x-1/2":"inset-x-0 top-1/2 h-px -translate-y-1/2"} ${$?"bg-primary":""}`})}),$&&M&&i.jsx("div",{className:"pointer-events-none absolute bg-primary/70",style:y?{top:0,bottom:0,width:2,left:`calc(50% + ${M.deltaPx}px)`}:{left:0,right:0,height:2,top:`calc(50% + ${M.deltaPx}px)`}})]},`${e.layout??""}:${l}`)})]})}const hr=1200,mr=2e3;function ke(t,e){return!t||!e?!1:t.windowId===e.windowId&&t.paneId===e.paneId}function vt(t,e){const s=t.filter(c=>e-c.at<hr);return s.length===0?null:s.reduce((c,u)=>u.at>c.at?u:c)}function He(t,e=Date.now()){return!t||e-t.at>mr?null:t}function pr(t){const e=t.now??Date.now(),s=vt(t.recentSelectRequests,e),c=w=>!!(w&&w.paneId===t.activePaneFromEvent.paneId&&w.windowId!==t.activePaneFromEvent.windowId);if(s&&!ke(s,t.activePaneFromEvent)&&!c(s)||ke(t.currentRoute,t.activePaneFromEvent)||ke(t.lastHandledActive,t.activePaneFromEvent))return!0;const u=He(t.pendingUserSelection,e);return!!(u&&!ke(u,t.activePaneFromEvent)&&!c(u))}function wr(t){const e=t.now??Date.now(),s=vt(t.recentSelectRequests,e),c=He(t.pendingUserSelection,e);return!!(c&&!ke(c,t.snapshotActive)||s&&!ke(s,t.snapshotActive))}function gr(t){const e=t.now??Date.now(),s=He(t.pendingUserSelection,e);return!(s&&ke(s,t.routeTarget)||t.snapshotActive&&ke(t.snapshotActive,t.routeTarget))}const Ke=n.memo(function({onActivate:e,disabled:s}){const{data:c}=nt({queryKey:pn,queryFn:mn,staleTime:6e4}),u=(c==null?void 0:c.items)??[];return u.length===0?null:i.jsx("div",{className:"terminal-shortcuts-strip","data-testid":"terminal-shortcuts-strip",children:i.jsx(wn,{items:u,useIcons:(c==null?void 0:c.useIcons)??!1,onActivate:e,disabled:s,preventFocusSteal:!0,rowTestId:"terminal-shortcuts-row",idPrefix:"terminal-shortcut"})})});function Er(){var it;const{t}=Ie(),{deviceId:e,windowId:s,paneId:c}=et(),u=ht(),w=n.useRef(null),g=n.useRef(null),x=n.useRef(null),I=n.useRef(null),V=n.useRef(!1),X=n.useRef(!1),E=n.useRef(null),M=H(o=>o.selectPane),Z=H(o=>o.focusPane),r=H(o=>e?o.snapshots[e]:void 0),oe=H(o=>{var m;return e?(m=o.deviceErrors)==null?void 0:m[e]:void 0}),P=H(o=>{var m;return e?((m=o.deviceConnected)==null?void 0:m[e])??!1:!1}),ee=!!H(o=>{var m;return e?(m=o.deviceReconnecting)==null?void 0:m[e]:void 0}),we=H(o=>e?o.connectedDevices.has(e):!1),ae=mt(o=>{var m;return((m=o.settings)==null?void 0:m.siteName)??"tmex"}),h=n.useMemo(()=>tt(c),[c]),v=n.useMemo(()=>e&&h?`${e}:${h}`:null,[e,h]),[b,T]=n.useState(!1),C=n.useRef(!1);n.useEffect(()=>{C.current=b},[b]);const[A,W]=n.useState(""),S=n.useRef(!1),Y=!P||!h,[R,_]=n.useState(!1),z=ge(o=>o.inputMode),te=ge(o=>o.theme),L=ge(o=>o.editorSendWithEnter),K=ge(o=>o.setEditorSendWithEnter),ne=ge(o=>o.addEditorHistory),ue=ge(o=>o.setEditorDraft),q=ge(o=>o.removeEditorDraft),ie=ge(o=>v?o.editorDrafts[v]??"":""),O=n.useMemo(()=>Ht(),[]),N=(it=r==null?void 0:r.session)==null?void 0:it.windows,pe=te==="light"?dt:ut,{data:fe}=nt({queryKey:["devices"],queryFn:async()=>{const o=await fetch("/api/devices");if(!o.ok)throw new Error("Failed to fetch devices");return o.json()},throwOnError:!1}),a=n.useMemo(()=>{if(e)return fe==null?void 0:fe.devices.find(o=>o.id===e)},[e,fe==null?void 0:fe.devices]),l=n.useMemo(()=>{if(!(!s||!N))return N.find(o=>o.id===s)},[s,N]),y=n.useMemo(()=>{if(!(!h||!l))return l.panes.find(o=>o.id===h)},[h,l]),$=!!N,d=$&&!!s&&!l?t("terminal.windowClosed"):$&&!!s&&!!h&&!!l&&!y?t("terminal.paneClosed"):null,f=!!d,j=!!(P&&h&&!f),B=!!(!b&&l&&l.panes.length>1&&l.layout&&!f),U=n.useRef(B);n.useEffect(()=>{U.current=B},[B]);const J=Ze(o=>o.ringingPanes),Ce=n.useMemo(()=>{if(!l||!y)return null;const o=(a==null?void 0:a.name)??e,m=pt({paneCustomName:y.customName,paneTitle:y.title,windowName:l.name,windowCustomName:l.customName,deviceName:o});return J[y.id]?`🔔 ${m}`:m},[a==null?void 0:a.name,e,y,l,J]),ye=n.useMemo(()=>{if(!N||N.length===0)return null;const o=N.find(p=>p.active),m=o==null?void 0:o.panes.find(p=>p.active);return!o||!m?null:{windowId:o.id,paneId:m.id}},[N]),Te=b&&l&&l.panes.length>1?l.id:null,xe=n.useRef(Te);n.useEffect(()=>{xe.current=Te},[Te]);const F=n.useRef(!1);n.useEffect(()=>{F.current=!!N&&!!s},[N,s]);const re=n.useCallback((o,m)=>{if(!e||!h)return;const p=xe.current;if(p){H.getState().applyStackedLayout(e,p,o,m);return}C.current&&!F.current||H.getState().resizePane(e,h,o,m)},[e,h]),D=n.useCallback((o,m)=>{if(!e||!h)return;const p=xe.current;if(p){H.getState().applyStackedLayout(e,p,o,m);return}C.current&&!F.current||H.getState().syncPaneSize(e,h,o,m)},[e,h]),G=n.useCallback(()=>{e&&H.getState().syncThemeAfterResize(e)},[e]),Q=n.useCallback((o,m)=>{var $e;const p=I.current;if(U.current){const Se=($e=w.current)==null?void 0:$e.getBoundingClientRect(),Ye=p==null?void 0:p.getCellSize();return Se&&Ye&&Se.width>0&&Se.height>0?{cols:Math.max(2,Math.floor(Se.width/Ye.width)),rows:Math.max(2,Math.floor(Se.height/Ye.height))}:void 0}if(C.current)return;const k=(p==null?void 0:p.calculateSizeFromContainer())??(p==null?void 0:p.getSize())??void 0;if(k)return k;if(!o||!m||!N)return;const se=N.find(Se=>Se.id===o),be=se==null?void 0:se.panes.find(Se=>Se.id===m);if(!(!be||be.width<=1||be.height<=1))return{cols:be.width,rows:be.height}},[N]),de=n.useCallback((o,m)=>{e&&(E.current={windowId:o,paneId:m,at:Date.now()},u(`/devices/${e}/windows/${o}/panes/${Pe(m)}`,{replace:!0}))},[e,u]),Ee=n.useCallback(o=>{I.current=o},[]);n.useEffect(()=>{const o=()=>{T(window.innerWidth<768||"ontouchstart"in window)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),n.useEffect(()=>{if(!b||!O||X.current)return;X.current=!0;const o=()=>{window.scrollTo(0,1)},m=window.requestAnimationFrame(o),p=window.setTimeout(o,120),k=window.setTimeout(o,420);return()=>{window.cancelAnimationFrame(m),window.clearTimeout(p),window.clearTimeout(k)}},[O,b]),n.useEffect(()=>{e&&(V.current=!1,_e.current=null,je.current=null,E.current=null,Re.current=[])},[e]),n.useEffect(()=>{P||(V.current=!1)},[P]),n.useEffect(()=>{if(!e||!P||!s||!N)return;if(N.length===0){u("/devices",{replace:!0});return}const o=N.find(p=>p.id===s);if(!o)return;if(!h){const p=o.panes.find(k=>k.active)??o.panes[0];p&&u(`/devices/${e}/windows/${s}/panes/${Pe(p.id)}`,{replace:!0});return}if(!o.panes.find(p=>p.id===h)){const p=N.find(se=>se.panes.some(be=>be.id===h));if(p){u(`/devices/${e}/windows/${p.id}/panes/${Pe(h)}`,{replace:!0});return}const k=o.panes.find(se=>se.active)??o.panes[0];k&&u(`/devices/${e}/windows/${s}/panes/${Pe(k.id)}`,{replace:!0});return}},[e,P,N,s,h,u]),n.useEffect(()=>{if(!e||!P||!N||N.length===0||s&&h||V.current)return;const o=N.find(p=>p.active)??N[0],m=o.panes.find(p=>p.active)??o.panes[0];m&&(V.current=!0,u(`/devices/${e}/windows/${o.id}/panes/${Pe(m.id)}`,{replace:!0}))},[P,e,u,h,s,N]);const Re=n.useRef([]),ve=n.useCallback((o,m)=>{const p=Date.now(),k=[...Re.current.filter(se=>p-se.at<2e3),{windowId:o,paneId:m,at:p}];Re.current=k.slice(-8)},[]),Me=n.useRef(null);n.useEffect(()=>{Me.current=null},[e,h]);const Ae=n.useRef(null),ze=n.useRef(B);n.useEffect(()=>{ze.current!==B&&(ze.current=B,Me.current=null,Ae.current=null)},[B]),n.useEffect(()=>{if(!e||!s||!h||Y||!P)return;const o=`${e}:${s}:${h}`;if(Me.current===o)return;Me.current=o;const m=B&&Ae.current===`${e}:${s}`&&!!(l!=null&&l.panes.some(k=>k.id===h));if(ve(s,h),m){Z(e,s,h);return}const p=Q(s,h);M(e,s,h,p),Ae.current=`${e}:${s}`},[P,e,Z,Q,Y,B,ve,h,M,l,s]),n.useEffect(()=>{if(!e||!P||!s||!h)return;const o={windowId:s,paneId:h};gr({routeTarget:o,snapshotActive:ye,pendingUserSelection:E.current})&&(E.current={windowId:o.windowId,paneId:o.paneId,at:Date.now()})},[P,e,h,ye,s]);const me=H(o=>e?o.activePaneFromEvent[e]:void 0),_e=n.useRef(null);n.useEffect(()=>{if(!e||!P||!s||!h||!me)return;const o=Date.now(),m=He(E.current,o);if(E.current=m,pr({now:o,pendingUserSelection:m,activePaneFromEvent:me,currentRoute:{windowId:s,paneId:h},recentSelectRequests:Re.current,lastHandledActive:_e.current}))return;if(_e.current={...me},m&&m.windowId===me.windowId&&m.paneId===me.paneId&&(E.current=null),!(U.current&&me.windowId===s)){const k=Q(me.windowId,me.paneId);ve(me.windowId,me.paneId),M(e,me.windowId,me.paneId,k)}u(`/devices/${e}/windows/${me.windowId}/panes/${Pe(me.paneId)}`,{replace:!0})},[e,P,s,h,me,ve,Q,M,u]);const je=n.useRef(null);n.useEffect(()=>{if(!e||!P||!N||N.length===0)return;const o=Re.current,m=N.find(Se=>Se.active);if(!m)return;const p=m.panes.find(Se=>Se.active);if(!p)return;const k={windowId:m.id,paneId:p.id},se=Date.now(),be=He(E.current,se);if(E.current=be,wr({now:se,pendingUserSelection:be,snapshotActive:k,recentSelectRequests:o})||je.current&&je.current.windowId===k.windowId&&je.current.paneId===k.paneId||(je.current={...k},be&&be.windowId===k.windowId&&be.paneId===k.paneId&&(E.current=null),s===k.windowId&&h===k.paneId))return;if(!(U.current&&k.windowId===s)){const Se=Q(k.windowId,k.paneId);ve(k.windowId,k.paneId),M(e,k.windowId,k.paneId,Se)}u(`/devices/${e}/windows/${k.windowId}/panes/${Pe(k.paneId)}`,{replace:!0})},[e,P,N,s,h,ve,Q,M,u]);const De=H(o=>e?o.pendingCreateWindowAt[e]:void 0);n.useEffect(()=>{if(!e||!P||!De)return;const o=5e3,m=Date.now()-De;if(m>o){H.getState().clearPendingCreateWindow(e);return}if(!ye){const se=window.setTimeout(()=>{H.getState().clearPendingCreateWindow(e)},o-m);return()=>window.clearTimeout(se)}const p=ye;if(s===p.windowId&&h===p.paneId){const se=window.setTimeout(()=>{H.getState().clearPendingCreateWindow(e)},o-m);return()=>window.clearTimeout(se)}E.current={windowId:p.windowId,paneId:p.paneId,at:Date.now()};const k=Q(p.windowId,p.paneId);ve(p.windowId,p.paneId),M(e,p.windowId,p.paneId,k),u(`/devices/${e}/windows/${p.windowId}/panes/${Pe(p.paneId)}`,{replace:!0}),H.getState().clearPendingCreateWindow(e)},[e,P,De,ye,s,h,ve,Q,M,u]),n.useEffect(()=>{if(B||!j||!y||Y)return;const o=I.current,m=o==null?void 0:o.getTerminal();if(!m)return;const p=Math.max(2,Math.floor(y.width||0)),k=Math.max(2,Math.floor(y.height||0));if(!p||!k)return;const se=Date.now(),be={cols:p,rows:k},$e=(o==null?void 0:o.getPendingLocalSize())??null;Fn({now:se,remoteSize:be,pendingLocalSize:$e})&&(m.cols===p&&m.rows===k||m.resize(p,k))},[j,Y,B,y]),n.useEffect(()=>{const o=window.requestAnimationFrame(()=>{var p;(p=I.current)==null||p.scrollToBottom()}),m=window.setTimeout(()=>{var p;(p=I.current)==null||p.scrollToBottom()},120);return()=>{window.cancelAnimationFrame(o),window.clearTimeout(m)}},[z]),n.useEffect(()=>{oe!=null&&oe.message&&Le.error(oe.message)},[oe==null?void 0:oe.message]),n.useEffect(()=>(document.title=Wt(Ce),()=>{document.title=ae}),[ae,Ce]),n.useEffect(()=>{const o=()=>{var m;(m=I.current)==null||m.scrollToBottom()};return window.addEventListener("tmex:jump-to-latest",o),()=>{window.removeEventListener("tmex:jump-to-latest",o)}},[]),n.useEffect(()=>{const o=m=>{const{deviceId:p,windowId:k,paneId:se}=m.detail;p===e&&(E.current={windowId:k,paneId:se,at:Date.now()})};return window.addEventListener("tmex:user-initiated-selection",o),()=>{window.removeEventListener("tmex:user-initiated-selection",o)}},[e]),n.useEffect(()=>{W(ie)},[ie]);const st=n.useCallback(o=>{if(!e||!h||!j)return;H.getState().sendInput(e,h,o,!1)},[j,e,h]),Xe=n.useCallback(o=>{var m,p;if(o.type==="action"){if(o.action==="toggleKeyboard"){ge.getState().setInputMode(z==="direct"?"editor":"direct");return}if(o.action==="scrollToBottom"){(m=I.current)==null||m.scrollToBottom();return}}if(o.type==="send"){o.payload&&st(o.payload);return}if(!(!e||!h||!j))switch(o.action){case"paste":{((p=navigator.clipboard)!=null&&p.readText?navigator.clipboard.readText():Promise.reject(new Error("clipboard unavailable"))).then(se=>{se&&H.getState().paste(e,h,se)}).catch(()=>Le.error(t("terminal.pasteFailed")));break}case"newAgentSession":ft.getState().startDraft(e,h,null),ge.getState().setSidebarCollapsed(!1),ge.getState().setSidebarTab("agent");break}},[j,e,st,z,h,t]),bt=n.useCallback(()=>{if(!j){Le.error(t("wsError.checkGateway"));return}if(!e||!h||!A.trim())return;_(!0),window.setTimeout(()=>_(!1),150);const o=L?`${A}\r`:A;H.getState().sendInput(e,h,o,!1),ne(A),v&&q(v),W("")},[ne,j,e,v,L,A,q,h,t]),St=n.useCallback(()=>{if(!j){Le.error(t("wsError.checkGateway"));return}if(!e||!h||!A.trim())return;_(!0),window.setTimeout(()=>_(!1),150);const o=A.split(/\r?\n/),m=H.getState();for(const p of o)p.trim()&&m.sendInput(e,h,`${p}\r`,!1);ne(A),v&&q(v),W("")},[ne,j,e,v,A,q,h,t]),yt=n.useCallback(()=>{var o;(o=x.current)==null||o.focus({preventScroll:!0})},[]);if(!e)return i.jsx("div",{className:"flex h-full items-center justify-center p-4",children:i.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground",children:t("device.noDevices")})});const Et=!!h&&!f&&(P||ee),Rt=P&&!!h&&!f&&!y,Tt=we&&!P&&!oe&&!ee,ot=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:i.jsx(Ue,{className:"h-6 w-6 text-muted-foreground animate-spin"})}),i.jsx("h3",{className:"text-lg font-medium",children:t("terminal.connecting")})]});return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background","data-testid":"device-page",children:[i.jsx("div",{className:`flex-1 relative overflow-hidden min-h-0 min-w-0 ${b&&z==="editor"?"pb-1":""}`,children:i.jsxs("div",{className:"h-full px-3 py-1 min-h-0 min-w-0 w-full relative flex rounded-xl",style:{backgroundColor:pe.background},children:[f?i.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-8 text-center",children:i.jsxs("div",{className:"max-w-sm space-y-4",children:[i.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:i.jsx(Tn,{className:"h-6 w-6 text-muted-foreground"})}),i.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"terminal-selection-invalid",children:d})]})}):Et&&h?B&&l?i.jsxs("div",{className:"flex h-full min-h-0 w-full flex-1 flex-col","data-virtual-keyboard-avoid":!0,children:[i.jsx("div",{ref:w,className:"relative min-h-0 flex-1",children:i.jsx(fr,{deviceId:e,window:l,focusedPaneId:h,theme:te,inputMode:z,deviceConnected:P,focusedTerminalRef:Ee,onUserSelectPane:de,onWindowResize:re,onWindowResizeSettled:G},`${e}:${l.id}`)}),z==="direct"&&i.jsx("div",{className:"kb-floating-shortcuts",style:{backgroundColor:pe.background},children:i.jsx(Ke,{onActivate:Xe,disabled:!j})})]}):i.jsx("div",{ref:w,className:"flex-1 h-full min-h-0 w-full","data-virtual-keyboard-avoid":!0,children:i.jsx(rt,{ref:I,deviceId:e,paneId:h,theme:te,inputMode:z,deviceConnected:P,isSelectionInvalid:f,onResize:re,onSync:D,onResizeSettled:G,children:z==="direct"&&i.jsx("div",{className:"kb-floating-shortcuts",style:{backgroundColor:pe.background},children:i.jsx(Ke,{onActivate:Xe,disabled:!j})})},`${e}:${h}`)}):i.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-8 text-center",children:i.jsx("div",{className:"max-w-sm space-y-4",children:Tt?ot:!P&&!ee?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:i.jsx("span",{className:"text-2xl text-muted-foreground",children:"🔌"})}),i.jsx("h3",{className:"text-lg font-medium",children:t("device.disconnected")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:t("device.connectToStart")})]}):s?ot:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center mx-auto",children:i.jsx("span",{className:"text-2xl text-muted-foreground",children:"📋"})}),i.jsx("h3",{className:"text-lg font-medium",children:t("window.noWindowSelected")}),i.jsx("p",{className:"text-sm text-muted-foreground",children:t("window.selectWindowToStart")})]})})}),ee&&i.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-2 z-10 flex justify-center","data-testid":"terminal-reconnecting-indicator",children:i.jsx(Ot,{deviceId:e,className:"shadow-sm"})}),Rt&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/85 backdrop-blur-sm","data-testid":"terminal-status-overlay",children:i.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-lg border border-border bg-card/90 px-4 py-3 shadow-sm",children:[i.jsx("div",{className:"h-7 w-7 rounded-full border-2 border-primary border-t-transparent animate-spin"}),i.jsx("span",{className:"text-xs text-muted-foreground","data-testid":"terminal-status-text",children:t("terminal.connecting")})]})})]})}),z==="editor"&&i.jsxs("div",{ref:g,"data-virtual-keyboard-avoid":!0,className:"editor-mode-input bg-card/85 backdrop-blur-sm",children:[b&&i.jsx(Ke,{onActivate:o=>{Xe(o),o.type==="send"&&yt()},disabled:!j}),i.jsx("textarea",{ref:x,"data-testid":"editor-input",className:"min-h-[88px] max-h-[28vh] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground shadow-xs outline-none transition-colors focus:border-ring",value:A,onChange:o=>{const m=o.target.value;if(W(m),!!v){if(m){ue(v,m);return}q(v)}},placeholder:t("terminal.inputPlaceholder"),onCompositionStart:()=>{S.current=!0},onCompositionEnd:()=>{S.current=!1}}),i.jsx("div",{className:"actions mt-2",children:i.jsxs("div",{className:"send-row flex flex-wrap items-center justify-end gap-2","data-testid":"editor-send-row",children:[i.jsxs("div",{className:"send-with-enter-toggle mr-auto flex items-center gap-2 text-xs text-muted-foreground","data-testid":"editor-send-with-enter-toggle",children:[i.jsx(qt,{size:"sm",checked:L,onCheckedChange:o=>K(!!o)}),i.jsx("span",{children:t("terminal.editorSendWithEnter")})]}),i.jsxs(Ne,{variant:"outline",size:"sm","data-testid":"editor-clear",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;W(""),v&&q(v),b&&z==="editor"&&((o=x.current)==null||o.focus({preventScroll:!0}))},title:t("terminal.clear"),children:[i.jsx(Xt,{className:"h-4 w-4"}),t("terminal.clear")]}),i.jsxs(Ne,{variant:"secondary",size:"sm","data-testid":"editor-send-line-by-line",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;St(),b&&z==="editor"&&((o=x.current)==null||o.focus({preventScroll:!0}))},disabled:!j||R,children:[R?i.jsx(Ue,{className:"h-4 w-4 animate-spin"}):i.jsx(ct,{className:"h-4 w-4"}),t("terminal.editorSendLineByLine")]}),i.jsxs(Ne,{variant:"default",size:"sm","data-testid":"editor-send",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;bt(),b&&z==="editor"&&((o=x.current)==null||o.focus({preventScroll:!0}))},disabled:!j||R,children:[R?i.jsx(Ue,{className:"h-4 w-4 animate-spin"}):i.jsx(ct,{className:"h-4 w-4"}),t("common.send")]})]})})]})]})}function Rr(){const{deviceId:t,windowId:e,paneId:s}=et(),c=s?tt(s):void 0,u=H(E=>E.snapshots),w=mt(E=>{var M;return((M=E.settings)==null?void 0:M.siteName)??"tmex"}),g=t?u[t]:void 0,x=n.useMemo(()=>{var E;if(!(!e||!((E=g==null?void 0:g.session)!=null&&E.windows)))return g.session.windows.find(M=>M.id===e)},[e,g]),I=n.useMemo(()=>{if(!(!c||!x))return x.panes.find(E=>E.id===c)},[c,x]),V=n.useMemo(()=>x&&I?pt({paneCustomName:I.customName,paneTitle:I.title,windowName:x.name,windowCustomName:x.customName,deviceName:w}):t??"",[x,I,w,t]),X=Ze(E=>c?!!E.ringingPanes[c]:!1);return i.jsxs(i.Fragment,{children:[X&&i.jsx("span",{className:"bell-blink",children:"🔔 "}),V]})}function Tr(){const{t}=Ie(),{deviceId:e,windowId:s,paneId:c}=et(),u=ht(),w=Yt(),g=c?tt(c):void 0,x=ge(S=>S.inputMode),I=ge(S=>S.setInputMode),V=H(S=>{var Y;return e?((Y=S.deviceConnected)==null?void 0:Y[e])??!1:!1}),X=H(S=>e?S.snapshots[e]:void 0),E=n.useMemo(()=>{var S;if(!(!s||!((S=X==null?void 0:X.session)!=null&&S.windows)))return X.session.windows.find(Y=>Y.id===s)},[s,X]),M=n.useCallback(S=>{!e||!s||u(`/devices/${e}/windows/${s}/panes/${Pe(S)}`,{replace:!0})},[e,s,u]),Z=n.useMemo(()=>{if(!(!g||!E))return E.panes.find(S=>S.id===g)},[g,E]),r=n.useCallback(S=>{!e||!g||H.getState().splitPane(e,g,S,Z==null?void 0:Z.currentPath)},[e,g,Z==null?void 0:Z.currentPath]),[oe,P]=n.useState(!1),[ce,ee]=n.useState(!1),[we,ae]=n.useState(!1),h=!!(g&&V),b=(nt({queryKey:Vt(e??"",g??""),queryFn:()=>Ut(e??"",g??""),enabled:!!(e&&g),throwOnError:!1}).data??[]).some(S=>S.enabled),T=()=>{I(x==="direct"?"editor":"direct")},C=()=>{window.dispatchEvent(new CustomEvent("tmex:jump-to-latest"))},A=()=>{P(!0)},W=()=>{window.location.reload()};return i.jsxs(i.Fragment,{children:[w&&g&&E&&E.panes.length>1&&i.jsx(Gn,{window:E,currentPaneId:g,onSelectPane:M}),!w&&i.jsxs(i.Fragment,{children:[i.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:()=>r("right"),disabled:!h,"data-testid":"split-right-button","aria-label":t("window.splitRight"),title:t("window.splitRight"),children:i.jsx(Kt,{className:"h-4 w-4"})}),i.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:()=>r("down"),disabled:!h,"data-testid":"split-down-button","aria-label":t("window.splitDown"),title:t("window.splitDown"),children:i.jsx(Gt,{className:"h-4 w-4"})})]}),i.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:A,"aria-label":t("nav.refreshPage"),title:t("nav.refreshPage"),children:i.jsx(fn,{className:"h-4 w-4"})}),i.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:T,disabled:!h,"data-testid":"terminal-input-mode-toggle","aria-label":t(x==="direct"?"nav.switchToEditor":"nav.switchToDirect"),title:t(x==="direct"?"nav.switchToEditor":"nav.switchToDirect"),children:x==="direct"?i.jsx(vn,{className:"h-4 w-4"}):i.jsx(Pn,{className:"h-4 w-4"})}),i.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:C,disabled:!h,"aria-label":t("nav.jumpToLatest"),title:t("nav.jumpToLatest"),children:i.jsx(hn,{className:"h-4 w-4"})}),i.jsxs(Ne,{variant:"ghost",size:"icon-sm",className:"relative",onClick:()=>ee(!0),disabled:!g,"data-testid":"watch-open-button","aria-label":t("watch.title"),title:t("watch.title"),children:[i.jsx(Qt,{className:"h-4 w-4"}),b&&i.jsx("span",{className:"absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary","data-testid":"watch-active-indicator"})]}),i.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:()=>ae(!0),"data-testid":"keyboard-behavior-open-button","aria-label":t("settings.terminal.title"),title:t("settings.terminal.title"),children:i.jsx(Cn,{className:"h-4 w-4"})}),i.jsx(kn,{open:we,onOpenChange:ae}),e&&g&&i.jsx(Jt,{open:ce,onOpenChange:ee,deviceId:e,paneId:g}),i.jsx(Zt,{open:oe,onOpenChange:P,children:i.jsxs(en,{children:[i.jsxs(tn,{children:[i.jsx(nn,{children:t("nav.refreshPage")}),i.jsx(rn,{children:t("nav.refreshPageConfirm")})]}),i.jsxs(sn,{children:[i.jsx(on,{onClick:()=>P(!1),children:t("common.cancel")}),i.jsx(cn,{onClick:W,children:t("common.confirm")})]})]})})]})}export{Tr as PageActions,Rr as PageTitle,Er as default};