tmex-cli 0.16.1 → 0.16.3

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 (85) hide show
  1. package/CHANGELOG.md +10 -60
  2. package/dist/runtime/server.js +972 -330
  3. package/package.json +1 -1
  4. package/resources/fe-dist/assets/DevicePage-DtByPprm.js +24 -0
  5. package/resources/fe-dist/assets/{DevicesPage-sJHXbS_f.js → DevicesPage-WMW0FcaU.js} +1 -1
  6. package/resources/fe-dist/assets/{FilePage-7FFd1YcW.js → FilePage-C3yjgRDh.js} +1 -1
  7. package/resources/fe-dist/assets/SettingsPage-CKZEPwEq.js +39 -0
  8. package/resources/fe-dist/assets/agent-tab-B77EotmX.js +38 -0
  9. package/resources/fe-dist/assets/{api-DV7-9Pvt.js → api-DZDjPn8l.js} +1 -1
  10. package/resources/fe-dist/assets/{arc-PDHKfnGP.js → arc-DNrUdLWP.js} +1 -1
  11. package/resources/fe-dist/assets/{architectureDiagram-3BPJPVTR-BiPHTh1e.js → architectureDiagram-3BPJPVTR-B5DYf-5o.js} +1 -1
  12. package/resources/fe-dist/assets/{blockDiagram-GPEHLZMM-DP_BRHKg.js → blockDiagram-GPEHLZMM-DSgjcUbw.js} +1 -1
  13. package/resources/fe-dist/assets/{c4Diagram-AAUBKEIU-D16QYgyT.js → c4Diagram-AAUBKEIU-DKjqulHT.js} +1 -1
  14. package/resources/fe-dist/assets/{card-DmfNw0hd.js → card-DWQzPt-3.js} +1 -1
  15. package/resources/fe-dist/assets/channel-CpZANba-.js +1 -0
  16. package/resources/fe-dist/assets/{chunk-2J33WTMH-DOjtL7ww.js → chunk-2J33WTMH-DHQ_-AlN.js} +1 -1
  17. package/resources/fe-dist/assets/{chunk-4BX2VUAB-BbT67ZXa.js → chunk-4BX2VUAB-C7sszhBq.js} +1 -1
  18. package/resources/fe-dist/assets/{chunk-55IACEB6-CnnXwmY_.js → chunk-55IACEB6-BkPT2okv.js} +1 -1
  19. package/resources/fe-dist/assets/{chunk-727SXJPM-TyUdLEW5.js → chunk-727SXJPM-BsD5c54G.js} +1 -1
  20. package/resources/fe-dist/assets/{chunk-AQP2D5EJ-BMpK4dqa.js → chunk-AQP2D5EJ-Dx3mc4xO.js} +1 -1
  21. package/resources/fe-dist/assets/{chunk-FMBD7UC4-Dx0HVCZZ.js → chunk-FMBD7UC4-CyZO-UAp.js} +1 -1
  22. package/resources/fe-dist/assets/{chunk-ND2GUHAM-BQCoMEti.js → chunk-ND2GUHAM-DNxRBeA7.js} +1 -1
  23. package/resources/fe-dist/assets/{chunk-QZHKN3VN-ilmf5OgK.js → chunk-QZHKN3VN-DsPa138W.js} +1 -1
  24. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-BW09ep_0.js +1 -0
  25. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-BW09ep_0.js +1 -0
  26. package/resources/fe-dist/assets/{copy-Ct5TNzGp.js → copy-DwXKDgGT.js} +1 -1
  27. package/resources/fe-dist/assets/{cose-bilkent-S5V4N54A-CpWhM7Za.js → cose-bilkent-S5V4N54A-C1d180_v.js} +1 -1
  28. package/resources/fe-dist/assets/{dagre-BM42HDAG-CWJttTzC.js → dagre-BM42HDAG-Bv8hvnH7.js} +1 -1
  29. package/resources/fe-dist/assets/{diagram-2AECGRRQ-BD8ny_Yg.js → diagram-2AECGRRQ-DfbJBHI6.js} +1 -1
  30. package/resources/fe-dist/assets/{diagram-5GNKFQAL-CeHcPWRz.js → diagram-5GNKFQAL-COnOrAiu.js} +1 -1
  31. package/resources/fe-dist/assets/{diagram-KO2AKTUF-tVlrBE8C.js → diagram-KO2AKTUF-BOtU5EdV.js} +1 -1
  32. package/resources/fe-dist/assets/{diagram-LMA3HP47-DGUn-oQn.js → diagram-LMA3HP47-B-WcT-Mc.js} +1 -1
  33. package/resources/fe-dist/assets/{diagram-OG6HWLK6-xKCd1kwA.js → diagram-OG6HWLK6-BptGbu0F.js} +1 -1
  34. package/resources/fe-dist/assets/en_US-BihUhDmr.js +1 -0
  35. package/resources/fe-dist/assets/{erDiagram-TEJ5UH35-C6M5qkGl.js → erDiagram-TEJ5UH35-H06uoCHU.js} +1 -1
  36. package/resources/fe-dist/assets/{files-tab-BWkYfaye.js → files-tab-C841Mmn_.js} +1 -1
  37. package/resources/fe-dist/assets/{flowDiagram-I6XJVG4X-D0MZDHnB.js → flowDiagram-I6XJVG4X-QOk_IVWN.js} +1 -1
  38. package/resources/fe-dist/assets/{ganttDiagram-6RSMTGT7-YeduSSa_.js → ganttDiagram-6RSMTGT7-Q7s2jHyi.js} +1 -1
  39. package/resources/fe-dist/assets/{gitGraphDiagram-PVQCEYII-Nem1Mvvg.js → gitGraphDiagram-PVQCEYII-Q7tAtx1u.js} +1 -1
  40. package/resources/fe-dist/assets/{index-iee3U_rD.js → index-C2v9tHtI.js} +1 -1
  41. package/resources/fe-dist/assets/{index-B3ddLSja.js → index-Dc3Fwpho.js} +63 -63
  42. package/resources/fe-dist/assets/index-j9kTGUS5.css +1 -0
  43. package/resources/fe-dist/assets/{infoDiagram-5YYISTIA-Bh6bbh_V.js → infoDiagram-5YYISTIA-B9n7MrtF.js} +1 -1
  44. package/resources/fe-dist/assets/{ishikawaDiagram-YF4QCWOH-CsZHu48j.js → ishikawaDiagram-YF4QCWOH-oZeau8IS.js} +1 -1
  45. package/resources/fe-dist/assets/ja_JP-f5sXmz8W.js +1 -0
  46. package/resources/fe-dist/assets/{journeyDiagram-JHISSGLW-CPgnovXt.js → journeyDiagram-JHISSGLW-ClXjUmc1.js} +1 -1
  47. package/resources/fe-dist/assets/{kanban-definition-UN3LZRKU-D4OAuDsS.js → kanban-definition-UN3LZRKU-Cwn4VzH2.js} +1 -1
  48. package/resources/fe-dist/assets/{linear-CcA4wV7f.js → linear-BNOQBDiB.js} +1 -1
  49. package/resources/fe-dist/assets/{markdown-preview-CBGlxpTs.js → markdown-preview-BsYVAcJ1.js} +3 -3
  50. package/resources/fe-dist/assets/{mermaid.core-D-CshtYr.js → mermaid.core-C3nmuA6R.js} +5 -5
  51. package/resources/fe-dist/assets/{mindmap-definition-RKZ34NQL-DBpI1nMC.js → mindmap-definition-RKZ34NQL-BKstxajf.js} +1 -1
  52. package/resources/fe-dist/assets/{pieDiagram-4H26LBE5-D4kh0_Y0.js → pieDiagram-4H26LBE5-D_2bHoC9.js} +1 -1
  53. package/resources/fe-dist/assets/{quadrantDiagram-W4KKPZXB-DNw3oGHQ.js → quadrantDiagram-W4KKPZXB-D6K_QmUy.js} +1 -1
  54. package/resources/fe-dist/assets/{requirementDiagram-4Y6WPE33-DqtMaND0.js → requirementDiagram-4Y6WPE33-B1SWUDkA.js} +1 -1
  55. package/resources/fe-dist/assets/{sankeyDiagram-5OEKKPKP-D-m9Pyie.js → sankeyDiagram-5OEKKPKP-DPmalO0b.js} +1 -1
  56. package/resources/fe-dist/assets/{send-DaOB9hLq.js → send-J45szXFM.js} +1 -1
  57. package/resources/fe-dist/assets/{sequenceDiagram-3UESZ5HK-CjrimNJf.js → sequenceDiagram-3UESZ5HK-C08DcZug.js} +1 -1
  58. package/resources/fe-dist/assets/{stateDiagram-AJRCARHV-BT5d8Z8W.js → stateDiagram-AJRCARHV-K9bVAVhg.js} +1 -1
  59. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-DTGkSC6X.js +1 -0
  60. package/resources/fe-dist/assets/{terminal-settings-panel-DDhlnbRH.js → terminal-settings-panel-tZuaqdqz.js} +2 -2
  61. package/resources/fe-dist/assets/{timeline-definition-PNZ67QCA-BeocAFDX.js → timeline-definition-PNZ67QCA-DG0FtOvK.js} +1 -1
  62. package/resources/fe-dist/assets/{transfer-toast-DXl4RHsV.js → transfer-toast-D72q4082.js} +1 -1
  63. package/resources/fe-dist/assets/{triangle-alert-FQRTtbTP.js → triangle-alert-CagsqsWp.js} +1 -1
  64. package/resources/fe-dist/assets/{vennDiagram-CIIHVFJN-CYlmUB5_.js → vennDiagram-CIIHVFJN-CKBEKUkA.js} +1 -1
  65. package/resources/fe-dist/assets/{wardley-L42UT6IY-CTyaodt9.js → wardley-L42UT6IY-DTlpnptg.js} +1 -1
  66. package/resources/fe-dist/assets/{wardleyDiagram-YWT4CUSO-DNlEcEwQ.js → wardleyDiagram-YWT4CUSO-CnwEikRb.js} +1 -1
  67. package/resources/fe-dist/assets/{xychartDiagram-2RQKCTM6-7Zi-6P-I.js → xychartDiagram-2RQKCTM6-uaYRX4Ue.js} +1 -1
  68. package/resources/fe-dist/assets/{zap-BFIAXPXd.js → zap-DcJ8Gp1I.js} +1 -1
  69. package/resources/fe-dist/assets/zh_CN-CPdvelFW.js +1 -0
  70. package/resources/fe-dist/index.html +2 -2
  71. package/resources/gateway-drizzle/0012_naive_lizard.sql +8 -0
  72. package/resources/gateway-drizzle/0013_bored_blindfold.sql +1 -0
  73. package/resources/gateway-drizzle/0014_lucky_killraven.sql +1 -0
  74. package/resources/gateway-drizzle/meta/_journal.json +21 -0
  75. package/resources/fe-dist/assets/DevicePage-Ccz8gNji.js +0 -24
  76. package/resources/fe-dist/assets/SettingsPage-FrEtqZyI.js +0 -39
  77. package/resources/fe-dist/assets/agent-tab-9THUj7Cf.js +0 -38
  78. package/resources/fe-dist/assets/channel-Dzz9b4fW.js +0 -1
  79. package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-BB9_4XLL.js +0 -1
  80. package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-BB9_4XLL.js +0 -1
  81. package/resources/fe-dist/assets/en_US-CjVU4anP.js +0 -1
  82. package/resources/fe-dist/assets/index-CuFTSN9i.css +0 -1
  83. package/resources/fe-dist/assets/ja_JP-Bq-BwOH_.js +0 -1
  84. package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-kSh9IuUW.js +0 -1
  85. package/resources/fe-dist/assets/zh_CN-BuxyXhCT.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-D-CshtYr.js";import{p as Ot}from"./chunk-4BX2VUAB-BbT67ZXa.js";import{p as Wt}from"./wardley-L42UT6IY-CTyaodt9.js";import"./index-B3ddLSja.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-C3nmuA6R.js";import{p as Ot}from"./chunk-4BX2VUAB-C7sszhBq.js";import{p as Wt}from"./wardley-L42UT6IY-DTlpnptg.js";import"./index-Dc3Fwpho.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-D-CshtYr.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-BENe2yWM.js";import{l as zt}from"./linear-CcA4wV7f.js";import"./index-B3ddLSja.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-C3nmuA6R.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-BENe2yWM.js";import{l as zt}from"./linear-BNOQBDiB.js";import"./index-Dc3Fwpho.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-B3ddLSja.js";/**
1
+ import{Y as a}from"./index-Dc3Fwpho.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":"取消选择"},"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,8 +19,8 @@
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-B3ddLSja.js"></script>
23
- <link rel="stylesheet" crossorigin href="/assets/index-CuFTSN9i.css">
22
+ <script type="module" crossorigin src="/assets/index-Dc3Fwpho.js"></script>
23
+ <link rel="stylesheet" crossorigin href="/assets/index-j9kTGUS5.css">
24
24
  </head>
25
25
  <body>
26
26
  <div id="root"></div>
@@ -0,0 +1,8 @@
1
+ ALTER TABLE `site_settings` ADD `enable_notification_push` integer DEFAULT true NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE `site_settings` ADD `enable_bell_push` integer DEFAULT true NOT NULL;--> statement-breakpoint
3
+ ALTER TABLE `site_settings` ADD `enable_bell_sound` integer DEFAULT true NOT NULL;--> statement-breakpoint
4
+ ALTER TABLE `site_settings` DROP COLUMN `enable_browser_bell_toast`;--> statement-breakpoint
5
+ ALTER TABLE `site_settings` DROP COLUMN `enable_telegram_bell_push`;--> statement-breakpoint
6
+ ALTER TABLE `site_settings` DROP COLUMN `enable_telegram_notification_push`;--> statement-breakpoint
7
+ ALTER TABLE `site_settings` DROP COLUMN `enable_weixin_bell_push`;--> statement-breakpoint
8
+ ALTER TABLE `site_settings` DROP COLUMN `enable_weixin_notification_push`;
@@ -0,0 +1 @@
1
+ ALTER TABLE `agent_sessions` ADD `allow_control_chars` integer DEFAULT false NOT NULL;
@@ -0,0 +1 @@
1
+ ALTER TABLE `site_settings` ADD `theme` text DEFAULT 'dark' NOT NULL CHECK(`site_settings`.`theme` in ('dark', 'light'));
@@ -85,6 +85,27 @@
85
85
  "when": 1782709181895,
86
86
  "tag": "0011_stormy_sauron",
87
87
  "breakpoints": true
88
+ },
89
+ {
90
+ "idx": 12,
91
+ "version": "6",
92
+ "when": 1783154375824,
93
+ "tag": "0012_naive_lizard",
94
+ "breakpoints": true
95
+ },
96
+ {
97
+ "idx": 13,
98
+ "version": "6",
99
+ "when": 1783160120017,
100
+ "tag": "0013_bored_blindfold",
101
+ "breakpoints": true
102
+ },
103
+ {
104
+ "idx": 14,
105
+ "version": "6",
106
+ "when": 1783160120018,
107
+ "tag": "0014_lucky_killraven",
108
+ "breakpoints": true
88
109
  }
89
110
  ]
90
111
  }
@@ -1,24 +0,0 @@
1
- import{Y as Ye,u as Ie,j as i,aD as Tt,aE as Ct,aF as jt,aG as Nt,aH as Mt,at as Pt,r as n,d as O,af as pe,ai as ut,ah as dt,ag as kt,aj as It,aI as Lt,aJ as At,o as ke,aK as _t,D as zt,p as Dt,q as $t,s as Bt,aL as tt,aw as ft,b as ht,aM as nt,aN as Ft,c as rt,aC as mt,aO as je,aP as Wt,ay as Ht,aq as Ke,y as Ot,a2 as Xt,B as Ce,T as qt,aQ as Yt,aR as Ut,aS as Vt,aT as Kt,aU as Gt,$ as Qt,aV 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-B3ddLSja.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 wn,S as pn}from"./terminal-settings-panel-DDhlnbRH.js";import{e as gn}from"./selection-clipboard-D3gUQQ7L.js";import{C as xn}from"./copy-Ct5TNzGp.js";import{S as ct,K as vn}from"./send-DaOB9hLq.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=pt(s);return!c||s.pos!==t.length?null:{checksum:e,root:c}}function De(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 $e(t,e){return t.input[t.pos]!==e?!1:(t.pos+=1,!0)}function pt(t){const e=De(t);if(e===null||!$e(t,"x"))return null;const s=De(t);if(s===null||!$e(t,","))return null;const c=De(t);if(c===null||!$e(t,","))return null;const l=De(t);if(l===null)return null;const p=t.input[t.pos];if(p===","){t.pos+=1;const v=De(t);return v===null?null:{type:"leaf",paneNumId:v,width:e,height:s,x:c,y:l}}if(p==="{"||p==="["){const v=p==="{"?"}":"]";t.pos+=1;const b=[];for(;;){const R=pt(t);if(!R)return null;if(b.push(R),!$e(t,",")){if($e(t,v))break;return null}}return b.length<2?null:{type:p==="{"?"row":"column",width:e,height:s,x:c,y:l,children:b}}return null}function Ge(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=Ye("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=Ye("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 Cn=[["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"}]],jn=Ye("settings-2",Cn);/**
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"}]],Mn=Ye("smartphone",Nn);function Pn({open:t,onOpenChange:e}){const{t:s}=Ie();return i.jsx(Tt,{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(jt,{children:[i.jsx(Nt,{children:s("settings.terminal.title")}),i.jsx(Mt,{children:s("settings.terminal.savedInBrowser")})]}),i.jsx("div",{className:"px-4 pb-4",children:i.jsx(an,{})})]})})}function kn({visible:t,canPaste:e,onCopy:s,onPaste:c,onDismiss:l}){const{t:p}=Ie();if(!t)return null;const v=b=>{b.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:v,onClick:s,"data-testid":"terminal-selection-copy",children:[i.jsx(xn,{className:"h-4 w-4"}),p("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:v,onClick:c,"data-testid":"terminal-selection-paste",children:[i.jsx(ln,{className:"h-4 w-4"}),p("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:v,onClick:l,"aria-label":p("terminal.clearSelection"),"data-testid":"terminal-selection-dismiss",children:i.jsx(Pt,{className:"h-4 w-4"})})]})}function gt(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 In="\x1B[?1049h\x1B[H\x1B[2J";function Ln(t){return In+gt(t)}function An(t,e){let s=e,c=0;for(const b of t)b===10&&!s&&(c+=1),s=b===13;const l=s;if(c===0)return{normalized:t,endedWithCR:l};const p=new Uint8Array(t.length+c);let v=0;s=e;for(const b of t)b===10&&!s&&(p[v]=13,v+=1),p[v]=b,v+=1,s=b===13;return{normalized:p,endedWithCR:l}}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 p=0,v=null,b=!1,R=0,B=0,$=0,T=null,U=!1;const r=()=>{T!==null&&(clearTimeout(T),T=null)},ae=S=>S?!!(S.closest(".scrollbar")||S.closest(".slider")||S.closest(".xterm-scroll-area")):!1,V=(S,h,M)=>{const W=M instanceof Element?M:null;if(ae(W))return!0;const A=document.elementFromPoint(S,h);if(ae(A))return!0;const H=c.querySelector(".xterm");if(!(H instanceof HTMLElement))return!1;const u=H.getBoundingClientRect(),N=S>=u.left&&S<=u.right,X=h>=u.top&&h<=u.bottom;return!N||!X?!1:S>=u.right-zn},C=()=>[c.querySelector(".xterm-viewport"),c.querySelector(".xterm-scrollable-element")].filter(h=>h instanceof HTMLElement),le=S=>{if(v===null)return null;for(let h=0;h<S.length;h+=1){const M=S.item(h);if(M&&M.identifier===v)return M}return null},se=S=>{if(r(),S.touches.length!==1)return;const h=S.touches.item(0);h&&(v=h.identifier,p=h.clientY,R=0,b=V(h.clientX,h.clientY,S.target),B=h.clientX,$=h.clientY,U=!1,b||(T=setTimeout(()=>{var W;T=null;const M=(e==null?void 0:e())??null;(W=M==null?void 0:M.startTouchSelection)!=null&&W.call(M,B,$,"word")&&(U=!0)},Dn)))},de=S=>{var N,X,J,I,Y,te,me,fe,we;const h=le(S.touches)??S.touches.item(0);if(!h)return;if(U){const _=(e==null?void 0:e())??null;(N=_==null?void 0:_.updateTouchSelection)==null||N.call(_,h.clientX,h.clientY),S.cancelable&&S.preventDefault();return}if(T!==null&&Math.hypot(h.clientX-B,h.clientY-$)>$n&&r(),b||(b=V(h.clientX,h.clientY,S.target),b&&(R=0)),b)return;const M=h.clientY,W=p-M;if(p=M,W===0)return;let A=!1,H=!1;const u=(e==null?void 0:e())??null;if(u){const _=u==null?void 0:u._core,Q=((Y=(I=(J=(X=_==null?void 0:_._renderService)==null?void 0:X.dimensions)==null?void 0:J.css)==null?void 0:I.cell)==null?void 0:Y.height)??18;R+=W*_n;const Z=R>0?Math.floor(R/Q):Math.ceil(R/Q);if(typeof u.handleViewportGesture=="function")Z!==0&&(A=u.handleViewportGesture({source:"touch",deltaY:Z*Q,clientX:h.clientX,clientY:h.clientY}),R-=Z*Q);else if(Z!==0){const j=((me=(te=u.buffer)==null?void 0:te.active)==null?void 0:me.viewportY)??0;u.scrollLines(Z);const a=((we=(fe=u.buffer)==null?void 0:fe.active)==null?void 0:we.viewportY)??0;A=j!==a,H=Z<0&&j<=0&&a<=0,R-=Z*Q}}else{const _=C();if(_.length===0)return;for(const Q of _){const Z=Q.scrollTop;Q.scrollTop+=W;const j=Q.scrollTop;Math.abs(j-Z)>0&&(A=!0),W<0&&j<=0&&(H=!0)}if(!A){const Q=c.querySelector(".xterm");if(Q instanceof HTMLElement){const Z=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,deltaMode:WheelEvent.DOM_DELTA_PIXEL,deltaY:W}),j=Q.dispatchEvent(Z);A=Z.defaultPrevented||!j}}}S.cancelable&&(A||H)&&S.preventDefault()},re=S=>{var M;if(r(),!(v===null||!le(S.changedTouches))&&(v=null,R=0,b=!1,U)){U=!1;const W=(e==null?void 0:e())??null;(M=W==null?void 0:W.endTouchSelection)==null||M.call(W)}},f=S=>{U&&S.preventDefault()};return c.addEventListener("touchstart",se,{passive:!0}),c.addEventListener("touchmove",de,{passive:!1}),c.addEventListener("touchend",re,{passive:!0}),c.addEventListener("touchcancel",re,{passive:!0}),c.addEventListener("contextmenu",f),()=>{s.current=!1,r(),c.removeEventListener("touchstart",se),c.removeEventListener("touchmove",de),c.removeEventListener("touchend",re),c.removeEventListener("touchcancel",re),c.removeEventListener("contextmenu",f)}},[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 Wn({currentSize:t,containerSize:e,force:s=!1}){return s?!0:t.cols!==e.cols||t.rows!==e.rows}function Hn({deviceId:t,paneId:e,deviceConnected:s,isSelectionInvalid:c,sizingMode:l="report",onResize:p,onSync:v,getContainerRect:b}){const R=n.useRef(null),B=n.useRef(null),$=n.useRef(null),T=n.useRef(null),U=n.useRef(0),r=n.useRef([]),ae=n.useRef(null),V=n.useRef(null),C=n.useRef(b),le=n.useRef(!1),se=n.useRef(p),de=n.useRef(v);n.useEffect(()=>{se.current=p},[p]),n.useEffect(()=>{de.current=v},[v]),n.useEffect(()=>{C.current=b},[b]);const re=n.useCallback(()=>{var me,fe,we,_,Q,Z,j,a,m,E;const u=V.current,N=ae.current;if(!u||!N||!u.element)return null;let X;try{const y=N.proposeDimensions();if(!y)throw new Error("fitAddon.proposeDimensions() returned null");X=Math.max(2,y.cols)}catch{const y=u._core,q=((_=(we=(fe=(me=y==null?void 0:y._renderService)==null?void 0:me.dimensions)==null?void 0:fe.css)==null?void 0:we.cell)==null?void 0:_.width)??9,oe=(Q=C.current)==null?void 0:Q.call(C);if(!oe||oe.width===0)return null;X=Math.max(2,Math.floor(oe.width/q))}const J=(Z=C.current)==null?void 0:Z.call(C);if(!J||J.height===0)return null;const I=u._core,Y=((E=(m=(a=(j=I==null?void 0:I._renderService)==null?void 0:j.dimensions)==null?void 0:a.css)==null?void 0:m.cell)==null?void 0:E.height)??17,te=Math.max(2,Math.floor(J.height/Y));return{cols:X,rows:te}},[]),f=n.useCallback((u,N)=>{const X=V.current;X&&(X.cols===u&&X.rows===N||X.resize(u,N))},[]),S=n.useCallback((u,N=!1)=>{if(l==="follow"||!t||!e||!s||c&&u!=="sync"||!N&&Date.now()<U.current||!V.current)return!1;const J=re();if(!J)return!1;const{cols:I,rows:Y}=J,te=$.current;return!N&&te&&te.cols===I&&te.rows===Y?(f(I,Y),!0):(f(I,Y),u==="sync"?de.current(I,Y):se.current(I,Y),$.current={cols:I,rows:Y},T.current={cols:I,rows:Y,at:Date.now()},!0)},[f,s,t,c,re,e,l]),h=n.useCallback((u="resize",N={})=>{const{immediate:X=!1,force:J=!1}=N;B.current!==null&&(window.clearTimeout(B.current),B.current=null),R.current!==null&&(cancelAnimationFrame(R.current),R.current=null);const I=()=>{R.current=requestAnimationFrame(()=>{R.current=null,S(u,J)})};if(X){I();return}B.current=window.setTimeout(()=>{B.current=null,I()},150)},[S]),M=n.useCallback(()=>{for(const u of r.current)window.clearTimeout(u);r.current=[]},[]),W=n.useCallback(()=>{var N;M(),h("sync",{immediate:!0,force:!0});const u=window.setTimeout(()=>{h("sync",{immediate:!0,force:!0})},60);r.current.push(u),typeof document<"u"&&"fonts"in document&&((N=document.fonts)!=null&&N.ready)&&document.fonts.ready.then(()=>{h("sync",{immediate:!0,force:!0})}).catch(()=>{})},[M,h]);n.useEffect(()=>{let u=null;const N=()=>{u!==null&&cancelAnimationFrame(u),u=requestAnimationFrame(()=>{u=null,h("resize")})};return window.addEventListener("resize",N),()=>{window.removeEventListener("resize",N),u!==null&&cancelAnimationFrame(u)}},[h]),n.useEffect(()=>{const u=()=>{var me;const I=V.current,Y=re();if(!I||!Y)return;if(!Wn({currentSize:{cols:Math.max(2,I.cols),rows:Math.max(2,I.rows)},containerSize:Y})){(me=I.forceFullRepaint)==null||me.call(I);return}h("sync",{force:!0})},N=()=>{if(document.visibilityState!=="visible"){le.current=!0;return}le.current&&(le.current=!1,u())},X=()=>{le.current=!0},J=()=>{le.current&&(le.current=!1,u())};return document.addEventListener("visibilitychange",N),window.addEventListener("blur",X),window.addEventListener("focus",J),()=>{document.removeEventListener("visibilitychange",N),window.removeEventListener("blur",X),window.removeEventListener("focus",J)}},[re,h]),n.useEffect(()=>()=>{M(),B.current!==null&&window.clearTimeout(B.current),R.current!==null&&cancelAnimationFrame(R.current)},[M]);const A=n.useCallback(u=>{ae.current=u},[]),H=n.useCallback(u=>{V.current=u},[]);return{scheduleResize:h,runPostSelectResize:W,clearPostSelectResizeTimers:M,setFitAddon:A,setTerminal:H,lastReportedSize:$,pendingLocalSize:T,suppressLocalResizeUntil:U}}const On=1e4,Je="tmex:terminal-mode-cache";function Xn(t,e){try{const s=sessionStorage.getItem(Je);return s?JSON.parse(s)[`${t}:${e}`]??null:null}catch{return null}}function qn(t,e,s){try{const c=sessionStorage.getItem(Je),l=c?JSON.parse(c):{},p=`${t}:${e}`;s?l[p]=s:delete l[p],sessionStorage.setItem(Je,JSON.stringify(l))}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 st=n.forwardRef(({deviceId:t,paneId:e,theme:s,inputMode:c,deviceConnected:l,isSelectionInvalid:p,sizingMode:v="report",autoFocus:b=!0,focused:R=!0,onResize:B,onSync:$,children:T},U)=>{const[r,ae]=n.useState(null),[V,C]=n.useState(!1),le=O(d=>d.sendInput),se=pe(d=>d.terminalFontId),de=pe(d=>d.terminalFontSize),re=pe(d=>d.terminalLineHeight),{t:f}=Ie(),S=n.useMemo(()=>{switch(s){case"light":return dt;default:return ut}},[s]),h=n.useRef(null),M=n.useRef(null),W=n.useRef(null),A=n.useRef(t),H=n.useRef(e),u=n.useRef(t),N=n.useRef(e),X=n.useRef(l&&!p),J=n.useRef(c),I=n.useRef(S),Y=n.useRef(!1),te=n.useRef(!1),me=n.useRef(null),fe=n.useRef(!1),we=n.useCallback((d,x,L)=>{!(d!=null&&d.exportModeSnapshot)||!x||!L||qn(x,L,d.exportModeSnapshot())},[]),_=n.useCallback(()=>r,[r]);Bn(h,_),n.useEffect(()=>{A.current=t,H.current=e,te.current=!1},[t,e]),n.useEffect(()=>{X.current=l&&!p},[l,p]),n.useEffect(()=>{J.current=c},[c]),n.useEffect(()=>{I.current=S},[S]);const Q=n.useCallback(d=>{if(!d||c!=="direct"||!X.current)return;const x=A.current,L=H.current;!x||!L||le(x,L,d,!1)},[c,le]),{pendingLocalSize:Z,scheduleResize:j,runPostSelectResize:a,setFitAddon:m,setTerminal:E}=Hn({deviceId:t,paneId:e,deviceConnected:l,isSelectionInvalid:p,sizingMode:v,onResize:B,onSync:$,getContainerRect:()=>{const d=h.current;if(!d)return null;const x=d.getBoundingClientRect();return{width:x.width,height:x.height}}});n.useEffect(()=>{let d=!1,x=null;return(async()=>{if(await kt(se,de),d)return;const L=await un({fontFamily:It(se),fontSize:de,lineHeight:re,scrollback:On,theme:I.current,disableStdin:J.current==="editor"});if(d){L.dispose();return}x=L,M.current&&L.open(M.current),ae(L)})(),()=>{d=!0,ae(null),Kn(x),x==null||x.dispose()}},[se,de,re]),n.useEffect(()=>{!r||!b||Vn(r)},[r,b]),n.useEffect(()=>{var d;(d=r==null?void 0:r.setFocused)==null||d.call(r,R)},[r,R]),n.useEffect(()=>{!r||!("setTheme"in r)||r.setTheme(S)},[r,S]),n.useEffect(()=>{!r||!("setDisableStdin"in r)||r.setDisableStdin(c==="editor")},[r,c]),n.useEffect(()=>{if(!(r!=null&&r.getCursorViewportRect))return;const d=()=>{var x;return((x=r.getCursorViewportRect)==null?void 0:x.call(r))??null};return _t(d),()=>Lt(d)},[r]),n.useEffect(()=>{!r||c!=="direct"||!b||window.innerWidth<768||"ontouchstart"in window||r.focus()},[r,c,b]);const y=n.useMemo(()=>r?{onReset:()=>{we(r,u.current,N.current),fe.current=!0,r.reset(),Y.current=!1,a()},onApplyHistory:(d,x)=>{var P,ie;const L=Un(Xn(A.current,H.current),x);L&&((P=r.restoreModeSnapshot)==null||P.call(r,L));const z=x?Ln(d):gt(d);te.current=!0,r.write(z),(ie=r.forceFullRepaint)==null||ie.call(r),fe.current=!1,u.current=A.current,N.current=H.current,we(r,A.current,H.current)},onOutput:d=>{const x=An(d,Y.current);Y.current=x.endedWithCR,r.write(x.normalized),te.current&&(r.buffer.active.baseY<=1&&r.scrollToTop(),te.current=!1),u.current=A.current,N.current=H.current,we(r,A.current,H.current)}}:null,[r,we,a]);n.useEffect(()=>{r?me.current!==r&&(Y.current=!1,u.current=A.current,N.current=H.current,me.current=r):me.current=null},[r]),n.useEffect(()=>{if(!(!r||!t||!e))return()=>{if(fe.current){fe.current=!1;return}we(r,u.current,N.current)}},[t,r,e,we]),n.useEffect(()=>{if(!(!y||!t||!e))return At(t,e,y)},[y,t,e]),n.useEffect(()=>{if(!r){W.current=null,m(null),E(null);return}const d=new dn;return r.loadAddon(d),W.current=d,m(d),E(r),a(),()=>{try{d.dispose()}finally{W.current=null,m(null),E(null)}}},[r,a,m,E]),n.useEffect(()=>{const d=h.current;if(!d)return;let x=null;const L=new ResizeObserver(()=>{x!==null&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{x=null,j("resize")})});return L.observe(d),()=>{L.disconnect(),x!==null&&cancelAnimationFrame(x)}},[j]),n.useEffect(()=>{if(!r||!t||!e)return;const d=r.onData(x=>{!l||p||Q(x)});return r.attachCustomKeyEventHandler(x=>!l||p||x.type!=="keydown"||c!=="direct"?!0:x.shiftKey&&x.key==="Enter"?(x.preventDefault(),Q("\x1B[13;2u"),!1):!0),()=>{d.dispose(),r.attachCustomKeyEventHandler(()=>!0)}},[r,l,p,c,Q,t,e]),n.useEffect(()=>{if(!(r!=null&&r.onLinkActivated))return;const d=r.onLinkActivated(x=>{window.open(x,"_blank","noopener,noreferrer")});return()=>d.dispose()},[r]),n.useEffect(()=>{if(!(r!=null&&r.onSelectionChange)){C(!1);return}const d=r.onSelectionChange(x=>{C(!!x)});return()=>{d.dispose(),C(!1)}},[r]);const q=n.useCallback(()=>{var x;if(!r)return;const d=((x=r.getSelection)==null?void 0:x.call(r))??"";d&&gn(d).then(()=>{ke.success(f("terminal.copied"))}).catch(()=>{ke.error(f("terminal.copyFailed"))}).finally(()=>{var L;(L=r.clearSelection)==null||L.call(r),r.focus()})},[r,f]),oe=n.useCallback(()=>{var x;if(!r)return;((x=navigator.clipboard)!=null&&x.readText?navigator.clipboard.readText():Promise.reject(new Error("clipboard unavailable"))).then(L=>{var z;L&&r.paste(L),(z=r.clearSelection)==null||z.call(r),r.focus()}).catch(()=>{ke.error(f("terminal.pasteFailed"))})},[r,f]),he=n.useCallback(()=>{var d;(d=r==null?void 0:r.clearSelection)==null||d.call(r),r==null||r.focus()},[r]);return n.useImperativeHandle(U,()=>({write:d=>r==null?void 0:r.write(d),reset:()=>{r==null||r.reset(),Y.current=!1},scrollToBottom:()=>r==null?void 0:r.scrollToBottom(),resize:(d,x)=>r==null?void 0:r.resize(d,x),getTerminal:()=>r??null,getSize:()=>r?{cols:Math.max(2,r.cols),rows:Math.max(2,r.rows)}:null,runPostSelectResize:()=>a(),scheduleResize:(d,x)=>j(d,x),calculateSizeFromContainer:()=>{var ge,F,ee,D,K,G,ce,ye,Ee,xe,Pe,Le,_e,ue,Ae,Ne;const d=h.current,x=r,L=W.current;if(!d||!x)return null;const z=d.getBoundingClientRect();if(z.width===0||z.height===0)return null;const P=x._core;let ie;if(L)try{const Te=L.proposeDimensions();if(Te)ie=Math.max(2,Te.cols);else{const Fe=((D=(ee=(F=(ge=P==null?void 0:P._renderService)==null?void 0:ge.dimensions)==null?void 0:F.css)==null?void 0:ee.cell)==null?void 0:D.width)??9;ie=Math.max(2,Math.floor(z.width/Fe))}}catch{const Te=((ye=(ce=(G=(K=P==null?void 0:P._renderService)==null?void 0:K.dimensions)==null?void 0:G.css)==null?void 0:ce.cell)==null?void 0:ye.width)??9;ie=Math.max(2,Math.floor(z.width/Te))}else{const Te=((Le=(Pe=(xe=(Ee=P==null?void 0:P._renderService)==null?void 0:Ee.dimensions)==null?void 0:xe.css)==null?void 0:Pe.cell)==null?void 0:Le.width)??9;ie=Math.max(2,Math.floor(z.width/Te))}const Re=((Ne=(Ae=(ue=(_e=P==null?void 0:P._renderService)==null?void 0:_e.dimensions)==null?void 0:ue.css)==null?void 0:Ae.cell)==null?void 0:Ne.height)??17,Se=Math.max(2,Math.floor(z.height/Re));return{cols:ie,rows:Se}},getPendingLocalSize:()=>Z.current,getCellSize:()=>{var L,z,P;const d=r==null?void 0:r._core,x=(P=(z=(L=d==null?void 0:d._renderService)==null?void 0:L.dimensions)==null?void 0:z.css)==null?void 0:P.cell;return!(x!=null&&x.width)||!(x!=null&&x.height)?null:{width:x.width,height:x.height}}}),[r,Z,a,j]),i.jsxs("div",{className:"flex h-full w-full flex-col",style:{backgroundColor:S.background},"data-terminal-engine":wt,children:[i.jsxs("div",{ref:h,className:"relative min-h-0 w-full flex-1",children:[i.jsx("div",{ref:M,className:"absolute inset-0"}),i.jsx(kn,{visible:V,canPaste:c==="direct"&&l&&!p,onCopy:q,onPaste:oe,onDismiss:he})]}),T]})});st.displayName="Terminal";function Gn({window:t,currentPaneId:e,onSelectPane:s}){const{t:c}=Ie();return i.jsxs(zt,{children:[i.jsxs(Dt,{"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($t,{align:"end",backdrop:!0,className:"min-w-56 max-w-[80vw]","data-testid":"pane-switcher-menu",children:t.panes.map(l=>{const p=l.id===e;return i.jsxs(Bt,{"data-testid":"pane-switcher-item","data-pane-id":l.id,className:`py-2 [@media(any-pointer:coarse)]:py-2.5 ${p?"bg-primary/10 text-primary":l.active?"bg-accent text-accent-foreground":""}`,onClick:()=>{p||s(l.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:l.customName||l.title||c("window.pane")}),l.currentCommand&&i.jsx("span",{className:"font-mono text-[10.5px] leading-tight text-muted-foreground line-clamp-1 break-all",children:l.currentPath?`${l.currentCommand}@${l.currentPath}`:l.currentCommand})]}),p&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-primary"})]},l.id)})})]})}const We=2;function He(t){if(t.type==="leaf")return We;if(t.type==="row"){let s=t.children.length-1;for(const c of t.children)s+=He(c);return s}let e=We;for(const s of t.children)e=Math.max(e,He(s));return e}function Oe(t){if(t.type==="leaf")return We;if(t.type==="column"){let s=t.children.length-1;for(const c of t.children)s+=Oe(c);return s}let e=We;for(const s of t.children)e=Math.max(e,Oe(s));return e}function Ze(t){return t.type==="leaf"?t:t.type==="row"?Ze(t.children[t.children.length-1]):Ze(t.children[0])}function et(t){return t.type==="leaf"?t:t.type==="column"?et(t.children[t.children.length-1]):et(t.children[0])}function Qn(t,e){const s=[],c=[],l=p=>{if(p.type==="leaf"){s.push({paneId:Ge(p),cols:p.width,rows:p.height,rect:{left:p.x*e.width,top:p.y*e.height,width:p.width*e.width,height:p.height*e.height}});return}for(let v=0;v<p.children.length;v+=1){const b=p.children[v];if(l(b),v===p.children.length-1)continue;const R=p.children[v+1];if(p.type==="row"){const B=Ze(b);c.push({axis:"x",rect:{left:(b.x+b.width)*e.width,top:p.y*e.height,width:e.width,height:p.height*e.height},edgeLeafPaneId:Ge(B),edgeLeafSizeCells:B.width,minDeltaCells:-(b.width-He(b)),maxDeltaCells:R.width-He(R)})}else{const B=et(b);c.push({axis:"y",rect:{left:p.x*e.width,top:(b.y+b.height)*e.height,width:p.width*e.width,height:e.height},edgeLeafPaneId:Ge(B),edgeLeafSizeCells:B.height,minDeltaCells:-(b.height-Oe(b)),maxDeltaCells:R.height-Oe(R)})}}};return l(t),{panes:s,gutters:c}}function Xe(t){if(t.type==="leaf")return 1;if(t.type==="column"){let s=0;for(const c of t.children)s+=Xe(c);return s}let e=1;for(const s of t.children)e=Math.max(e,Xe(s));return e}function qe(t){if(t.type==="leaf")return 1;if(t.type==="row"){let s=0;for(const c of t.children)s+=qe(c);return s}let e=1;for(const s of t.children)e=Math.max(e,qe(s));return e}function Jn(t,e){const s=Xe(t),c=qe(t),l=Math.max(0,e.viewport.width-c*e.paneChrome.width),p=Math.max(0,e.viewport.height-s*e.paneChrome.height),v=Math.max(2,Math.floor(l/e.cell.width)),b=Math.max(2,Math.floor(p/e.cell.height));return{cols:v,rows:b}}function Zn(t,e){const s=Math.min(1,Math.max(0,t)),c=Math.min(1,Math.max(0,e)),l=[["left",s],["right",1-s],["top",c],["bottom",1-c]];return l.sort((p,v)=>p[1]-v[1]),l[0][0]}const at=150,er=200,tr=15,nr=46,rr=38,sr=12,or=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 ir(t){var c,l;const e=(c=t==null?void 0:t.currentCommand)==null?void 0:c.trim();if(!e)return null;const s=(l=t==null?void 0:t.currentPath)==null?void 0:l.trim();return s?`${e}@${s}`:e}const cr={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 ar({deviceId:t,window:e,focusedPaneId:s,theme:c,inputMode:l,deviceConnected:p,focusedTerminalRef:v,onUserSelectPane:b,onWindowResize:R}){var Q,Z,j;const B=n.useRef(null),$=n.useRef(new Map),[T,U]=n.useState(null),[r,ae]=n.useState(null),{t:V}=Ie(),C=O(a=>a.subscribePanes),le=O(a=>a.fetchPaneHistory),se=O(a=>a.resizePaneInWindow),de=O(a=>a.movePane),re=O(a=>a.breakPane),f=O(a=>a.closePane),S=n.useMemo(()=>{const a=new Map;for(const m of e.panes)a.set(m.id,m);return a},[e.panes]),h=n.useMemo(()=>e.layout?Sn(e.layout):null,[e.layout]),M=n.useMemo(()=>h?Qn(h.root,{width:1,height:1}):null,[h]),W=n.useRef(M);W.current=M;const A=(h==null?void 0:h.root.width)??1,H=(h==null?void 0:h.root.height)??1,u=e.panes.map(a=>a.id).join(",");n.useEffect(()=>(C(t,u?u.split(","):[]),()=>{C(t,[])}),[t,u,C]);const N=n.useRef({key:"",fetched:new Set});n.useEffect(()=>{const a=`${t}:${e.id}`;N.current.key!==a&&(N.current={key:a,fetched:new Set});for(const m of u?u.split(","):[])N.current.fetched.has(m)||m!==s&&(N.current.fetched.add(m),le(t,m))},[t,e.id,u,s,le]),n.useEffect(()=>{var m,E;l!=="direct"||window.innerWidth<768||"ontouchstart"in window||(E=(m=$.current.get(s))==null?void 0:m.getTerminal())==null||E.focus()},[s,l]);const X=n.useCallback(()=>{var a;for(const m of[s,...$.current.keys()]){const E=(a=$.current.get(m))==null?void 0:a.getCellSize();if(E)return E}return null},[s]);n.useEffect(()=>{var a;if(M)for(const m of M.panes)(a=$.current.get(m.paneId))==null||a.resize(m.cols,m.rows)},[M]);const J=n.useMemo(()=>h?Xe(h.root):1,[h]),I=n.useMemo(()=>h?qe(h.root):1,[h]),Y=n.useCallback(()=>{const a=B.current;if(!a||!h)return!1;const m=a.getBoundingClientRect();if(m.width<1||m.height<1)return!1;const E=X();if(!E)return!1;const{cols:y,rows:q}=Jn(h.root,{viewport:{width:m.width,height:m.height},cell:E,paneChrome:{width:sr,height:nr}});return R(y,q),!0},[X,h,R]),te=n.useRef(Y);n.useEffect(()=>{te.current=Y},[Y]),n.useEffect(()=>{const a=B.current;if(!a)return;let m=null,E=null,y=0;const q=()=>{if(te.current()){y=0;return}y<tr&&(y+=1,E=setTimeout(q,er))},oe=new ResizeObserver(()=>{m&&clearTimeout(m),m=setTimeout(q,at)});return oe.observe(a),()=>{oe.disconnect(),m&&clearTimeout(m),E&&clearTimeout(E)}},[]),n.useEffect(()=>{const a=setTimeout(()=>{te.current()},at);return()=>clearTimeout(a)},[J,I]);const me=n.useCallback((a,m,E)=>{E.preventDefault();const y=B.current;if(!y)return;const q=E.clientX,oe=E.clientY,he=E.currentTarget;he.setPointerCapture(E.pointerId),U({gutterIndex:a,deltaPx:0});const d=P=>{const ie=m.axis==="x"?P.clientX-q:P.clientY-oe;U({gutterIndex:a,deltaPx:ie})},x=(P,ie)=>{if(he.removeEventListener("pointermove",d),he.removeEventListener("pointerup",L),he.removeEventListener("pointercancel",z),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",z),U(null),!ie)return;const Re=X();if(!Re)return;const Se=m.axis==="x"?P.clientX-q:P.clientY-oe,ge=m.axis==="x"?Re.width:Re.height;if(ge<=0)return;const F=Math.round(Se/ge);if(F===0)return;const ee=y.querySelector(`[data-pane-id="${m.edgeLeafPaneId}"]`);if(!ee)return;const D=ee.getBoundingClientRect(),G=(m.axis==="x"?Math.floor(D.width/ge):Math.floor(D.height/ge))+F;G<2||(te.current(),se(t,m.edgeLeafPaneId,m.axis==="x"?{cols:G}:{rows:G}))},L=P=>x(P,!0),z=P=>x(P,!1);he.addEventListener("pointermove",d),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",z)},[t,X,se]),fe=n.useCallback((a,m)=>{const E=B.current,y=M;if(!E||!y)return;m.preventDefault();const q=m.clientX,oe=m.clientY,he=m.currentTarget;he.setPointerCapture(m.pointerId);let d=!1;const x=(F,ee)=>{const D=E.getBoundingClientRect();if(D.width<1||D.height<1)return null;const K=(F-D.left)/D.width*Math.max(1,A),G=(ee-D.top)/D.height*Math.max(1,H);for(const ce of y.panes)if(K>=ce.rect.left&&K<=ce.rect.left+ce.rect.width&&G>=ce.rect.top&&G<=ce.rect.top+ce.rect.height){const ye=(K-ce.rect.left)/Math.max(1e-6,ce.rect.width),Ee=(G-ce.rect.top)/Math.max(1e-6,ce.rect.height);return{paneId:ce.paneId,position:Zn(ye,Ee)}}return null},L=(F,ee,D)=>F>=D.left&&F<=D.right&&ee>=D.top&&ee<=D.bottom,z=(F,ee)=>{for(const D of Array.from(document.querySelectorAll('[data-testid^="window-item-"]'))){const K=D.getBoundingClientRect();if(K.width<1||!L(F,ee,K))continue;const G=(D.getAttribute("data-testid")??"").replace("window-item-","");return!G||G===e.id?null:{type:"window",windowId:G,rect:{left:K.left,top:K.top,width:K.width,height:K.height}}}for(const D of Array.from(document.querySelectorAll('[data-slot="sidebar"]'))){const K=D.getBoundingClientRect();if(!(K.width<1||!L(F,ee,K)))return{type:"break",rect:{left:K.left,top:K.top,width:K.width,height:K.height}}}return null},P=(F,ee)=>{const D=x(F,ee);return D?D.paneId===a?null:{type:"pane",...D}:z(F,ee)},ie=F=>{const ee=Math.hypot(F.clientX-q,F.clientY-oe);!d&&ee<or||(d=!0,ae({srcPaneId:a,active:!0,pointerX:F.clientX,pointerY:F.clientY,target:P(F.clientX,F.clientY)}))},Re=(F,ee)=>{var K,G;if(he.removeEventListener("pointermove",ie),he.removeEventListener("pointerup",Se),he.removeEventListener("pointercancel",ge),window.removeEventListener("pointerup",Se),window.removeEventListener("pointercancel",ge),ae(null),!ee||!d)return;const D=P(F.clientX,F.clientY);if(D){if(D.type==="pane"){de(t,a,D.paneId,D.position);return}if(D.type==="window"){const ce=(G=(K=O.getState().snapshots[t])==null?void 0:K.session)==null?void 0:G.windows,ye=ce==null?void 0:ce.find(xe=>xe.id===D.windowId),Ee=(ye==null?void 0:ye.panes.find(xe=>xe.active))??(ye==null?void 0:ye.panes[0]);Ee&&de(t,a,Ee.id,"right");return}re(t,a)}},Se=F=>Re(F,!0),ge=F=>Re(F,!1);he.addEventListener("pointermove",ie),window.addEventListener("pointerup",Se),window.addEventListener("pointercancel",ge)},[t,M,de,re,A,H,e.id]),we=n.useCallback(a=>m=>{var E;if(m){$.current.set(a,m);const y=(E=W.current)==null?void 0:E.panes.find(q=>q.paneId===a);y&&m.resize(y.cols,y.rows)}else $.current.delete(a);a===s&&v(m)},[s,v]);if(n.useEffect(()=>{v($.current.get(s)??null)},[s,v]),!M)return null;const _=(a,m)=>`${a/Math.max(1,m)*100}%`;return i.jsxs("div",{ref:B,className:"relative h-full w-full min-h-0 min-w-0","data-testid":"split-terminal-area",children:[M.panes.map(a=>{var he;const m=a.paneId===s,E=S.get(a.paneId),y=ir(E),q=(r==null?void 0:r.active)&&r.srcPaneId===a.paneId,oe=r!=null&&r.active&&((he=r.target)==null?void 0:he.type)==="pane"&&r.target.paneId===a.paneId?r.target.position:null;return i.jsxs("div",{className:`absolute flex flex-col overflow-hidden ${q?"opacity-60":""}`,"data-testid":"split-pane","data-pane-id":a.paneId,"data-focused":m||void 0,style:{left:_(a.rect.left,A),top:_(a.rect.top,H),width:_(a.rect.width,A),height:_(a.rect.height,H)},onPointerDownCapture:()=>{m||b(e.id,a.paneId)},children:[i.jsx("div",{className:"shrink-0 px-1.5 pt-1.5 pb-2",style:{height:rr},children:i.jsxs("div",{"data-testid":"split-pane-titlebar","data-active":m||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 ${m?"bg-foreground/10":"bg-foreground/[0.04]"}`,onPointerDown:d=>fe(a.paneId,d),children:[i.jsx("span",{className:`shrink-0 truncate font-mono text-[10.5px] leading-none ${m?"text-foreground/90":"text-foreground/50"}`,children:lt(E)}),y&&i.jsx("span",{className:`min-w-0 flex-1 truncate font-mono text-[10px] leading-none ${m?"text-muted-foreground":"text-muted-foreground/60"}`,children:y}),i.jsx("button",{type:"button","data-testid":`split-pane-close-${a.paneId}`,"aria-label":V("window.closePane"),title:V("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:d=>d.stopPropagation(),onClick:d=>{d.stopPropagation(),f(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(st,{ref:we(a.paneId),deviceId:t,paneId:a.paneId,theme:c,inputMode:l,deviceConnected:p,isSelectionInvalid:!1,sizingMode:"follow",autoFocus:m,focused:m,onResize:()=>{},onSync:()=>{}},`${t}:${a.paneId}`)}),oe&&i.jsx("div",{"data-testid":"split-pane-drop-preview","data-position":oe,className:`pointer-events-none absolute z-30 rounded-sm bg-primary/20 ring-1 ring-inset ring-primary/60 ${cr[oe]}`})]},a.paneId)}),(T!==null||(r==null?void 0:r.active))&&i.jsx("div",{"data-testid":"split-drag-shield",className:`absolute inset-0 z-30 ${T!==null?((Q=M.gutters[T.gutterIndex])==null?void 0:Q.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(S.get(r.srcPaneId))}),((Z=r.target)==null?void 0:Z.type)==="window"&&i.jsx("div",{className:"text-[9.5px] text-muted-foreground",children:V("window.moveToWindow")}),((j=r.target)==null?void 0:j.type)==="break"&&i.jsx("div",{className:"text-[9.5px] text-muted-foreground",children:V("window.breakToWindow")})]}),M.gutters.map((a,m)=>{const E=a.axis==="x",y=(T==null?void 0:T.gutterIndex)===m;return i.jsxs("div",{className:"absolute z-20",style:{left:_(a.rect.left,A),top:_(a.rect.top,H),width:_(E?1:a.rect.width,A),height:_(E?a.rect.height:1,H)},children:[i.jsx("div",{"data-testid":"split-gutter","data-axis":a.axis,className:`absolute touch-none select-none ${E?"-inset-x-1 inset-y-0 cursor-col-resize":"inset-x-0 -inset-y-1 cursor-row-resize"}`,onPointerDown:q=>me(m,a,q),children:i.jsx("div",{className:`absolute bg-foreground/[0.08] transition-colors hover:bg-primary/50 ${E?"inset-y-0 left-1/2 w-px -translate-x-1/2":"inset-x-0 top-1/2 h-px -translate-y-1/2"} ${y?"bg-primary":""}`})}),y&&T&&i.jsx("div",{className:"pointer-events-none absolute bg-primary/70",style:E?{top:0,bottom:0,width:2,left:`calc(50% + ${T.deltaPx}px)`}:{left:0,right:0,height:2,top:`calc(50% + ${T.deltaPx}px)`}})]},`${e.layout??""}:${m}`)})]})}const lr=1200,ur=2e3;function Me(t,e){return!t||!e?!1:t.windowId===e.windowId&&t.paneId===e.paneId}function xt(t,e){const s=t.filter(c=>e-c.at<lr);return s.length===0?null:s.reduce((c,l)=>l.at>c.at?l:c)}function Be(t,e=Date.now()){return!t||e-t.at>ur?null:t}function dr(t){const e=t.now??Date.now(),s=xt(t.recentSelectRequests,e),c=p=>!!(p&&p.paneId===t.activePaneFromEvent.paneId&&p.windowId!==t.activePaneFromEvent.windowId);if(s&&!Me(s,t.activePaneFromEvent)&&!c(s)||Me(t.currentRoute,t.activePaneFromEvent)||Me(t.lastHandledActive,t.activePaneFromEvent))return!0;const l=Be(t.pendingUserSelection,e);return!!(l&&!Me(l,t.activePaneFromEvent)&&!c(l))}function fr(t){const e=t.now??Date.now(),s=xt(t.recentSelectRequests,e),c=Be(t.pendingUserSelection,e);return!!(c&&!Me(c,t.snapshotActive)||s&&!Me(s,t.snapshotActive))}function hr(t){const e=t.now??Date.now(),s=Be(t.pendingUserSelection,e);return!(s&&Me(s,t.routeTarget)||t.snapshotActive&&Me(t.snapshotActive,t.routeTarget))}const Qe=n.memo(function({onActivate:e,disabled:s}){const{data:c}=rt({queryKey:wn,queryFn:mn,staleTime:6e4}),l=(c==null?void 0:c.items)??[];return l.length===0?null:i.jsx("div",{className:"terminal-shortcuts-strip","data-testid":"terminal-shortcuts-strip",children:i.jsx(pn,{items:l,useIcons:(c==null?void 0:c.useIcons)??!1,onActivate:e,disabled:s,preventFocusSteal:!0,rowTestId:"terminal-shortcuts-row",idPrefix:"terminal-shortcut"})})});function vr(){var it;const{t}=Ie(),{deviceId:e,windowId:s,paneId:c}=tt(),l=ft(),p=n.useRef(null),v=n.useRef(null),b=n.useRef(null),R=n.useRef(null),B=n.useRef(!1),$=n.useRef(!1),T=n.useRef(null),U=O(o=>o.selectPane),r=O(o=>o.focusPane),ae=O(o=>e?o.snapshots[e]:void 0),V=O(o=>{var g;return e?(g=o.deviceErrors)==null?void 0:g[e]:void 0}),C=O(o=>{var g;return e?((g=o.deviceConnected)==null?void 0:g[e])??!1:!1}),se=!!O(o=>{var g;return e?(g=o.deviceReconnecting)==null?void 0:g[e]:void 0}),de=O(o=>e?o.connectedDevices.has(e):!1),re=ht(o=>{var g;return((g=o.settings)==null?void 0:g.siteName)??"tmex"}),f=n.useMemo(()=>nt(c),[c]),S=n.useMemo(()=>e&&f?`${e}:${f}`:null,[e,f]),[h,M]=n.useState(!1),W=n.useRef(!1);n.useEffect(()=>{W.current=h},[h]);const[A,H]=n.useState(""),u=n.useRef(!1),N=!C||!f,[X,J]=n.useState(!1),I=pe(o=>o.inputMode),Y=pe(o=>o.theme),te=pe(o=>o.editorSendWithEnter),me=pe(o=>o.setEditorSendWithEnter),fe=pe(o=>o.addEditorHistory),we=pe(o=>o.setEditorDraft),_=pe(o=>o.removeEditorDraft),Q=pe(o=>S?o.editorDrafts[S]??"":""),Z=n.useMemo(()=>Ft(),[]),j=(it=ae==null?void 0:ae.session)==null?void 0:it.windows,a=Y==="light"?dt:ut,{data:m}=rt({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}),E=n.useMemo(()=>{if(e)return m==null?void 0:m.devices.find(o=>o.id===e)},[e,m==null?void 0:m.devices]),y=n.useMemo(()=>{if(!(!s||!j))return j.find(o=>o.id===s)},[s,j]),q=n.useMemo(()=>{if(!(!f||!y))return y.panes.find(o=>o.id===f)},[f,y]),oe=!!j,x=oe&&!!s&&!y?t("terminal.windowClosed"):oe&&!!s&&!!f&&!!y&&!q?t("terminal.paneClosed"):null,L=!!x,z=!!(C&&f&&!L),P=!!(!h&&y&&y.panes.length>1&&y.layout&&!L),ie=n.useRef(P);n.useEffect(()=>{ie.current=P},[P]);const Re=n.useMemo(()=>{if(!y||!q)return null;const o=(E==null?void 0:E.name)??e;return mt({paneCustomName:q.customName,paneTitle:q.title,windowName:y.name,windowCustomName:y.customName,deviceName:o})},[E==null?void 0:E.name,e,q,y]),Se=n.useMemo(()=>{if(!j||j.length===0)return null;const o=j.find(w=>w.active),g=o==null?void 0:o.panes.find(w=>w.active);return!o||!g?null:{windowId:o.id,paneId:g.id}},[j]),ge=h&&y&&y.panes.length>1?y.id:null,F=n.useRef(ge);n.useEffect(()=>{F.current=ge},[ge]);const ee=n.useRef(!1);n.useEffect(()=>{ee.current=!!j&&!!s},[j,s]);const D=n.useCallback((o,g)=>{if(!e||!f)return;const w=F.current;if(w){O.getState().applyStackedLayout(e,w,o,g);return}W.current&&!ee.current||O.getState().resizePane(e,f,o,g)},[e,f]),K=n.useCallback((o,g)=>{if(!e||!f)return;const w=F.current;if(w){O.getState().applyStackedLayout(e,w,o,g);return}W.current&&!ee.current||O.getState().syncPaneSize(e,f,o,g)},[e,f]),G=n.useCallback((o,g)=>{var ze;const w=R.current;if(ie.current){const be=(ze=p.current)==null?void 0:ze.getBoundingClientRect(),Ve=w==null?void 0:w.getCellSize();return be&&Ve&&be.width>0&&be.height>0?{cols:Math.max(2,Math.floor(be.width/Ve.width)),rows:Math.max(2,Math.floor(be.height/Ve.height))}:void 0}if(W.current)return;const k=(w==null?void 0:w.calculateSizeFromContainer())??(w==null?void 0:w.getSize())??void 0;if(k)return k;if(!o||!g||!j)return;const ne=j.find(be=>be.id===o),ve=ne==null?void 0:ne.panes.find(be=>be.id===g);if(!(!ve||ve.width<=1||ve.height<=1))return{cols:ve.width,rows:ve.height}},[j]),ce=n.useCallback((o,g)=>{e&&(T.current={windowId:o,paneId:g,at:Date.now()},l(`/devices/${e}/windows/${o}/panes/${je(g)}`,{replace:!0}))},[e,l]),ye=n.useCallback(o=>{R.current=o},[]);n.useEffect(()=>{const o=()=>{M(window.innerWidth<768||"ontouchstart"in window)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),n.useEffect(()=>{if(!h||!Z||$.current)return;$.current=!0;const o=()=>{window.scrollTo(0,1)},g=window.requestAnimationFrame(o),w=window.setTimeout(o,120),k=window.setTimeout(o,420);return()=>{window.cancelAnimationFrame(g),window.clearTimeout(w),window.clearTimeout(k)}},[Z,h]),n.useEffect(()=>{e&&(B.current=!1,Ae.current=null,Ne.current=null,T.current=null,Ee.current=[])},[e]),n.useEffect(()=>{C||(B.current=!1)},[C]),n.useEffect(()=>{if(!e||!C||!s||!j)return;if(j.length===0){l("/devices",{replace:!0});return}const o=j.find(w=>w.id===s);if(!o)return;if(!f){const w=o.panes.find(k=>k.active)??o.panes[0];w&&l(`/devices/${e}/windows/${s}/panes/${je(w.id)}`,{replace:!0});return}if(!o.panes.find(w=>w.id===f)){const w=j.find(ne=>ne.panes.some(ve=>ve.id===f));if(w){l(`/devices/${e}/windows/${w.id}/panes/${je(f)}`,{replace:!0});return}const k=o.panes.find(ne=>ne.active)??o.panes[0];k&&l(`/devices/${e}/windows/${s}/panes/${je(k.id)}`,{replace:!0});return}},[e,C,j,s,f,l]),n.useEffect(()=>{if(!e||!C||!j||j.length===0||s&&f||B.current)return;const o=j.find(w=>w.active)??j[0],g=o.panes.find(w=>w.active)??o.panes[0];g&&(B.current=!0,l(`/devices/${e}/windows/${o.id}/panes/${je(g.id)}`,{replace:!0}))},[C,e,l,f,s,j]);const Ee=n.useRef([]),xe=n.useCallback((o,g)=>{const w=Date.now(),k=[...Ee.current.filter(ne=>w-ne.at<2e3),{windowId:o,paneId:g,at:w}];Ee.current=k.slice(-8)},[]),Pe=n.useRef(null);n.useEffect(()=>{Pe.current=null},[e,f]);const Le=n.useRef(null),_e=n.useRef(P);n.useEffect(()=>{_e.current!==P&&(_e.current=P,Pe.current=null,Le.current=null)},[P]),n.useEffect(()=>{if(!e||!s||!f||N||!C)return;const o=`${e}:${s}:${f}`;if(Pe.current===o)return;Pe.current=o;const g=P&&Le.current===`${e}:${s}`&&!!(y!=null&&y.panes.some(k=>k.id===f));if(xe(s,f),g){r(e,s,f);return}const w=G(s,f);U(e,s,f,w),Le.current=`${e}:${s}`},[C,e,r,G,N,P,xe,f,U,y,s]),n.useEffect(()=>{if(!e||!C||!s||!f)return;const o={windowId:s,paneId:f};hr({routeTarget:o,snapshotActive:Se,pendingUserSelection:T.current})&&(T.current={windowId:o.windowId,paneId:o.paneId,at:Date.now()})},[C,e,f,Se,s]);const ue=O(o=>e?o.activePaneFromEvent[e]:void 0),Ae=n.useRef(null);n.useEffect(()=>{if(!e||!C||!s||!f||!ue)return;const o=Date.now(),g=Be(T.current,o);if(T.current=g,dr({now:o,pendingUserSelection:g,activePaneFromEvent:ue,currentRoute:{windowId:s,paneId:f},recentSelectRequests:Ee.current,lastHandledActive:Ae.current}))return;if(Ae.current={...ue},g&&g.windowId===ue.windowId&&g.paneId===ue.paneId&&(T.current=null),!(ie.current&&ue.windowId===s)){const k=G(ue.windowId,ue.paneId);xe(ue.windowId,ue.paneId),U(e,ue.windowId,ue.paneId,k)}l(`/devices/${e}/windows/${ue.windowId}/panes/${je(ue.paneId)}`,{replace:!0})},[e,C,s,f,ue,xe,G,U,l]);const Ne=n.useRef(null);n.useEffect(()=>{if(!e||!C||!j||j.length===0)return;const o=Ee.current,g=j.find(be=>be.active);if(!g)return;const w=g.panes.find(be=>be.active);if(!w)return;const k={windowId:g.id,paneId:w.id},ne=Date.now(),ve=Be(T.current,ne);if(T.current=ve,fr({now:ne,pendingUserSelection:ve,snapshotActive:k,recentSelectRequests:o})||Ne.current&&Ne.current.windowId===k.windowId&&Ne.current.paneId===k.paneId||(Ne.current={...k},ve&&ve.windowId===k.windowId&&ve.paneId===k.paneId&&(T.current=null),s===k.windowId&&f===k.paneId))return;if(!(ie.current&&k.windowId===s)){const be=G(k.windowId,k.paneId);xe(k.windowId,k.paneId),U(e,k.windowId,k.paneId,be)}l(`/devices/${e}/windows/${k.windowId}/panes/${je(k.paneId)}`,{replace:!0})},[e,C,j,s,f,xe,G,U,l]);const Te=O(o=>e?o.pendingCreateWindowAt[e]:void 0);n.useEffect(()=>{if(!e||!C||!Te)return;const o=5e3,g=Date.now()-Te;if(g>o){O.getState().clearPendingCreateWindow(e);return}if(!Se){const ne=window.setTimeout(()=>{O.getState().clearPendingCreateWindow(e)},o-g);return()=>window.clearTimeout(ne)}const w=Se;if(s===w.windowId&&f===w.paneId){const ne=window.setTimeout(()=>{O.getState().clearPendingCreateWindow(e)},o-g);return()=>window.clearTimeout(ne)}T.current={windowId:w.windowId,paneId:w.paneId,at:Date.now()};const k=G(w.windowId,w.paneId);xe(w.windowId,w.paneId),U(e,w.windowId,w.paneId,k),l(`/devices/${e}/windows/${w.windowId}/panes/${je(w.paneId)}`,{replace:!0}),O.getState().clearPendingCreateWindow(e)},[e,C,Te,Se,s,f,xe,G,U,l]),n.useEffect(()=>{if(P||!z||!q||N)return;const o=R.current,g=o==null?void 0:o.getTerminal();if(!g)return;const w=Math.max(2,Math.floor(q.width||0)),k=Math.max(2,Math.floor(q.height||0));if(!w||!k)return;const ne=Date.now(),ve={cols:w,rows:k},ze=(o==null?void 0:o.getPendingLocalSize())??null;Fn({now:ne,remoteSize:ve,pendingLocalSize:ze})&&(g.cols===w&&g.rows===k||g.resize(w,k))},[z,N,P,q]),n.useEffect(()=>{const o=window.requestAnimationFrame(()=>{var w;(w=R.current)==null||w.scrollToBottom()}),g=window.setTimeout(()=>{var w;(w=R.current)==null||w.scrollToBottom()},120);return()=>{window.cancelAnimationFrame(o),window.clearTimeout(g)}},[I]),n.useEffect(()=>{V!=null&&V.message&&ke.error(V.message)},[V==null?void 0:V.message]),n.useEffect(()=>(document.title=Wt(Re),()=>{document.title=re}),[re,Re]),n.useEffect(()=>{const o=()=>{var g;(g=R.current)==null||g.scrollToBottom()};return window.addEventListener("tmex:jump-to-latest",o),()=>{window.removeEventListener("tmex:jump-to-latest",o)}},[]),n.useEffect(()=>{const o=g=>{const{deviceId:w,windowId:k,paneId:ne}=g.detail;w===e&&(T.current={windowId:k,paneId:ne,at:Date.now()})};return window.addEventListener("tmex:user-initiated-selection",o),()=>{window.removeEventListener("tmex:user-initiated-selection",o)}},[e]),n.useEffect(()=>{H(Q)},[Q]);const Fe=n.useCallback(o=>{if(!e||!f||!z)return;O.getState().sendInput(e,f,o,!1)},[z,e,f]),Ue=n.useCallback(o=>{var g,w;if(o.type==="action"){if(o.action==="toggleKeyboard"){pe.getState().setInputMode(I==="direct"?"editor":"direct");return}if(o.action==="scrollToBottom"){(g=R.current)==null||g.scrollToBottom();return}}if(o.type==="send"){o.payload&&Fe(o.payload);return}if(!(!e||!f||!z))switch(o.action){case"paste":{((w=navigator.clipboard)!=null&&w.readText?navigator.clipboard.readText():Promise.reject(new Error("clipboard unavailable"))).then(ne=>{ne&&O.getState().paste(e,f,ne)}).catch(()=>ke.error(t("terminal.pasteFailed")));break}case"newAgentSession":Ht.getState().startDraft(e,f,null),pe.getState().setSidebarCollapsed(!1),pe.getState().setSidebarTab("agent");break}},[z,e,Fe,I,f,t]),vt=n.useCallback(()=>{if(!z){ke.error(t("wsError.checkGateway"));return}if(!e||!f||!A.trim())return;J(!0),window.setTimeout(()=>J(!1),150);const o=te?`${A}\r`:A;O.getState().sendInput(e,f,o,!1),fe(A),S&&_(S),H("")},[fe,z,e,S,te,A,_,f,t]),bt=n.useCallback(()=>{if(!z){ke.error(t("wsError.checkGateway"));return}if(!e||!f||!A.trim())return;J(!0),window.setTimeout(()=>J(!1),150);const o=A.split(/\r?\n/),g=O.getState();for(const w of o)w.trim()&&g.sendInput(e,f,`${w}\r`,!1);fe(A),S&&_(S),H("")},[fe,z,e,S,A,_,f,t]),St=n.useCallback(()=>{var o;(o=b.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 yt=!!f&&!L&&(C||se),Et=C&&!!f&&!L&&!q,Rt=de&&!C&&!V&&!se,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(Ke,{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 ${h&&I==="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:a.background},children:[L?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:x})]})}):yt&&f?P&&y?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:p,className:"relative min-h-0 flex-1",children:i.jsx(ar,{deviceId:e,window:y,focusedPaneId:f,theme:Y,inputMode:I,deviceConnected:C,focusedTerminalRef:ye,onUserSelectPane:ce,onWindowResize:D},`${e}:${y.id}`)}),I==="direct"&&i.jsx("div",{className:"kb-floating-shortcuts",style:{backgroundColor:a.background},children:i.jsx(Qe,{onActivate:Ue,disabled:!z})})]}):i.jsx("div",{ref:p,className:"flex-1 h-full min-h-0 w-full","data-virtual-keyboard-avoid":!0,children:i.jsx(st,{ref:R,deviceId:e,paneId:f,theme:Y,inputMode:I,deviceConnected:C,isSelectionInvalid:L,onResize:D,onSync:K,children:I==="direct"&&i.jsx("div",{className:"kb-floating-shortcuts",style:{backgroundColor:a.background},children:i.jsx(Qe,{onActivate:Ue,disabled:!z})})},`${e}:${f}`)}):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:Rt?ot:!C&&!se?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")})]})})}),se&&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"})}),Et&&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")})]})})]})}),I==="editor"&&i.jsxs("div",{ref:v,"data-virtual-keyboard-avoid":!0,className:"editor-mode-input bg-card/85 backdrop-blur-sm",children:[h&&i.jsx(Qe,{onActivate:o=>{Ue(o),o.type==="send"&&St()},disabled:!z}),i.jsx("textarea",{ref:b,"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 g=o.target.value;if(H(g),!!S){if(g){we(S,g);return}_(S)}},placeholder:t("terminal.inputPlaceholder"),onCompositionStart:()=>{u.current=!0},onCompositionEnd:()=>{u.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(Xt,{size:"sm",checked:te,onCheckedChange:o=>me(!!o)}),i.jsx("span",{children:t("terminal.editorSendWithEnter")})]}),i.jsxs(Ce,{variant:"outline",size:"sm","data-testid":"editor-clear",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;H(""),S&&_(S),h&&I==="editor"&&((o=b.current)==null||o.focus({preventScroll:!0}))},title:t("terminal.clear"),children:[i.jsx(qt,{className:"h-4 w-4"}),t("terminal.clear")]}),i.jsxs(Ce,{variant:"secondary",size:"sm","data-testid":"editor-send-line-by-line",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;bt(),h&&I==="editor"&&((o=b.current)==null||o.focus({preventScroll:!0}))},disabled:!z||X,children:[X?i.jsx(Ke,{className:"h-4 w-4 animate-spin"}):i.jsx(ct,{className:"h-4 w-4"}),t("terminal.editorSendLineByLine")]}),i.jsxs(Ce,{variant:"default",size:"sm","data-testid":"editor-send",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;vt(),h&&I==="editor"&&((o=b.current)==null||o.focus({preventScroll:!0}))},disabled:!z||X,children:[X?i.jsx(Ke,{className:"h-4 w-4 animate-spin"}):i.jsx(ct,{className:"h-4 w-4"}),t("common.send")]})]})})]})]})}function br(){const{deviceId:t,windowId:e,paneId:s}=tt(),c=s?nt(s):void 0,l=O($=>$.snapshots),p=ht($=>{var T;return((T=$.settings)==null?void 0:T.siteName)??"tmex"}),v=t?l[t]:void 0,b=n.useMemo(()=>{var $;if(!(!e||!(($=v==null?void 0:v.session)!=null&&$.windows)))return v.session.windows.find(T=>T.id===e)},[e,v]),R=n.useMemo(()=>{if(!(!c||!b))return b.panes.find($=>$.id===c)},[c,b]),B=n.useMemo(()=>b&&R?mt({paneCustomName:R.customName,paneTitle:R.title,windowName:b.name,windowCustomName:b.customName,deviceName:p}):t??"",[b,R,p,t]);return i.jsx(i.Fragment,{children:B})}function Sr(){const{t}=Ie(),{deviceId:e,windowId:s,paneId:c}=tt(),l=ft(),p=Yt(),v=c?nt(c):void 0,b=pe(u=>u.inputMode),R=pe(u=>u.setInputMode),B=O(u=>{var N;return e?((N=u.deviceConnected)==null?void 0:N[e])??!1:!1}),$=O(u=>e?u.snapshots[e]:void 0),T=n.useMemo(()=>{var u;if(!(!s||!((u=$==null?void 0:$.session)!=null&&u.windows)))return $.session.windows.find(N=>N.id===s)},[s,$]),U=n.useCallback(u=>{!e||!s||l(`/devices/${e}/windows/${s}/panes/${je(u)}`,{replace:!0})},[e,s,l]),r=n.useMemo(()=>{if(!(!v||!T))return T.panes.find(u=>u.id===v)},[v,T]),ae=n.useCallback(u=>{!e||!v||O.getState().splitPane(e,v,u,r==null?void 0:r.currentPath)},[e,v,r==null?void 0:r.currentPath]),[V,C]=n.useState(!1),[le,se]=n.useState(!1),[de,re]=n.useState(!1),f=!!(v&&B),h=(rt({queryKey:Vt(e??"",v??""),queryFn:()=>Ut(e??"",v??""),enabled:!!(e&&v),throwOnError:!1}).data??[]).some(u=>u.enabled),M=()=>{R(b==="direct"?"editor":"direct")},W=()=>{window.dispatchEvent(new CustomEvent("tmex:jump-to-latest"))},A=()=>{C(!0)},H=()=>{window.location.reload()};return i.jsxs(i.Fragment,{children:[p&&v&&T&&T.panes.length>1&&i.jsx(Gn,{window:T,currentPaneId:v,onSelectPane:U}),!p&&i.jsxs(i.Fragment,{children:[i.jsx(Ce,{variant:"ghost",size:"icon-sm",onClick:()=>ae("right"),disabled:!f,"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(Ce,{variant:"ghost",size:"icon-sm",onClick:()=>ae("down"),disabled:!f,"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(Ce,{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(Ce,{variant:"ghost",size:"icon-sm",onClick:M,disabled:!f,"data-testid":"terminal-input-mode-toggle","aria-label":t(b==="direct"?"nav.switchToEditor":"nav.switchToDirect"),title:t(b==="direct"?"nav.switchToEditor":"nav.switchToDirect"),children:b==="direct"?i.jsx(vn,{className:"h-4 w-4"}):i.jsx(Mn,{className:"h-4 w-4"})}),i.jsx(Ce,{variant:"ghost",size:"icon-sm",onClick:W,disabled:!f,"aria-label":t("nav.jumpToLatest"),title:t("nav.jumpToLatest"),children:i.jsx(hn,{className:"h-4 w-4"})}),i.jsxs(Ce,{variant:"ghost",size:"icon-sm",className:"relative",onClick:()=>se(!0),disabled:!v,"data-testid":"watch-open-button","aria-label":t("watch.title"),title:t("watch.title"),children:[i.jsx(Qt,{className:"h-4 w-4"}),h&&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(Ce,{variant:"ghost",size:"icon-sm",onClick:()=>re(!0),"data-testid":"keyboard-behavior-open-button","aria-label":t("settings.terminal.title"),title:t("settings.terminal.title"),children:i.jsx(jn,{className:"h-4 w-4"})}),i.jsx(Pn,{open:de,onOpenChange:re}),e&&v&&i.jsx(Jt,{open:le,onOpenChange:se,deviceId:e,paneId:v}),i.jsx(Zt,{open:V,onOpenChange:C,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:()=>C(!1),children:t("common.cancel")}),i.jsx(cn,{onClick:H,children:t("common.confirm")})]})]})})]})}export{Sr as PageActions,br as PageTitle,vr as default};