tmex-cli 0.16.2 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -18
- package/dist/runtime/server.js +826 -243
- package/package.json +1 -1
- package/resources/fe-dist/assets/DevicePage-DxFUn3eM.js +24 -0
- package/resources/fe-dist/assets/{DevicesPage-B_jvUZtl.js → DevicesPage-CJF229QB.js} +1 -1
- package/resources/fe-dist/assets/{FilePage-DTSmWM1D.js → FilePage-CkEaJiW3.js} +1 -1
- package/resources/fe-dist/assets/{SettingsPage-LTHV37Rj.js → SettingsPage-BjsRYOBG.js} +4 -4
- package/resources/fe-dist/assets/{agent-tab-vPjPGa5f.js → agent-tab-6MAsxcE4.js} +1 -1
- package/resources/fe-dist/assets/{api-D_FToAy0.js → api-B3b18azE.js} +1 -1
- package/resources/fe-dist/assets/{arc-BSCyoyGW.js → arc-BAINpc3Q.js} +1 -1
- package/resources/fe-dist/assets/{architectureDiagram-3BPJPVTR-CBO0dAe2.js → architectureDiagram-3BPJPVTR-CWFap8y8.js} +1 -1
- package/resources/fe-dist/assets/{blockDiagram-GPEHLZMM-0ONANm30.js → blockDiagram-GPEHLZMM-BnR3WVDx.js} +1 -1
- package/resources/fe-dist/assets/{c4Diagram-AAUBKEIU-DpvhCnF8.js → c4Diagram-AAUBKEIU-BT4ZOccY.js} +1 -1
- package/resources/fe-dist/assets/{card-CD9i-fLq.js → card-TMGETMIE.js} +1 -1
- package/resources/fe-dist/assets/channel-C_D-Pin5.js +1 -0
- package/resources/fe-dist/assets/{chunk-2J33WTMH-MmS9_ur_.js → chunk-2J33WTMH-B4Tvbi6K.js} +1 -1
- package/resources/fe-dist/assets/{chunk-4BX2VUAB-CLd4Yxwh.js → chunk-4BX2VUAB-e7mC2fAZ.js} +1 -1
- package/resources/fe-dist/assets/{chunk-55IACEB6-DgCH4WwT.js → chunk-55IACEB6-CIYZgFr_.js} +1 -1
- package/resources/fe-dist/assets/{chunk-727SXJPM-B9DM5PB4.js → chunk-727SXJPM-Cp8xQ_Up.js} +1 -1
- package/resources/fe-dist/assets/{chunk-AQP2D5EJ-DQwC9D9W.js → chunk-AQP2D5EJ-C-NtHCtH.js} +1 -1
- package/resources/fe-dist/assets/{chunk-FMBD7UC4-BnvyNYGh.js → chunk-FMBD7UC4-DmjdaPSW.js} +1 -1
- package/resources/fe-dist/assets/{chunk-ND2GUHAM-BzcZgEWG.js → chunk-ND2GUHAM-Zg5krkW_.js} +1 -1
- package/resources/fe-dist/assets/{chunk-QZHKN3VN-C9BaHIUI.js → chunk-QZHKN3VN-BIuK8Di1.js} +1 -1
- package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-BKAkOexI.js +1 -0
- package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-BKAkOexI.js +1 -0
- package/resources/fe-dist/assets/{copy-DzIk8AxV.js → copy-BfbLkQQH.js} +1 -1
- package/resources/fe-dist/assets/{cose-bilkent-S5V4N54A-NkTc0ObP.js → cose-bilkent-S5V4N54A-DjsBN2Gw.js} +1 -1
- package/resources/fe-dist/assets/{dagre-BM42HDAG-BdFDBfE_.js → dagre-BM42HDAG-EHYEOgd4.js} +1 -1
- package/resources/fe-dist/assets/{diagram-2AECGRRQ-Ba4Y0igR.js → diagram-2AECGRRQ-DP2qaS44.js} +1 -1
- package/resources/fe-dist/assets/{diagram-5GNKFQAL-B4_Or8Vp.js → diagram-5GNKFQAL-CXjsd6rW.js} +1 -1
- package/resources/fe-dist/assets/{diagram-KO2AKTUF-DbmmHTYj.js → diagram-KO2AKTUF-C3imvzg0.js} +1 -1
- package/resources/fe-dist/assets/{diagram-LMA3HP47-CRrd6lc4.js → diagram-LMA3HP47-BWfVIlqx.js} +1 -1
- package/resources/fe-dist/assets/{diagram-OG6HWLK6-BOEazFIu.js → diagram-OG6HWLK6-DjPzNtRm.js} +1 -1
- package/resources/fe-dist/assets/{erDiagram-TEJ5UH35-Dk-UowK8.js → erDiagram-TEJ5UH35-B0NYaEtR.js} +1 -1
- package/resources/fe-dist/assets/{files-tab-D2vddvsj.js → files-tab-BFIlXST7.js} +1 -1
- package/resources/fe-dist/assets/{flowDiagram-I6XJVG4X-BhbGYx-g.js → flowDiagram-I6XJVG4X-CdStxlad.js} +1 -1
- package/resources/fe-dist/assets/{ganttDiagram-6RSMTGT7-iezClDTv.js → ganttDiagram-6RSMTGT7-DdEyq_eg.js} +1 -1
- package/resources/fe-dist/assets/{gitGraphDiagram-PVQCEYII-Ncqf3CQw.js → gitGraphDiagram-PVQCEYII-DVt7acpU.js} +1 -1
- package/resources/fe-dist/assets/{index-UoApkLSY.js → index-C1akMMWP.js} +63 -63
- package/resources/fe-dist/assets/{index-DOfY8kwB.js → index-c9jmHxDX.js} +1 -1
- package/resources/fe-dist/assets/{infoDiagram-5YYISTIA-CUg3PkAb.js → infoDiagram-5YYISTIA-BfBQlpuG.js} +1 -1
- package/resources/fe-dist/assets/{ishikawaDiagram-YF4QCWOH-DU0ekJw5.js → ishikawaDiagram-YF4QCWOH-DUn8fG3F.js} +1 -1
- package/resources/fe-dist/assets/{journeyDiagram-JHISSGLW-Ji7WtMH7.js → journeyDiagram-JHISSGLW-D1YteFVs.js} +1 -1
- package/resources/fe-dist/assets/{kanban-definition-UN3LZRKU-B8zVyM8Q.js → kanban-definition-UN3LZRKU-Do0o8nlT.js} +1 -1
- package/resources/fe-dist/assets/{linear-tNPPicfI.js → linear-Bmap7qQK.js} +1 -1
- package/resources/fe-dist/assets/{markdown-preview-CzbcKxcJ.js → markdown-preview-ByBN48Ac.js} +3 -3
- package/resources/fe-dist/assets/{mermaid.core-BoNU6G1d.js → mermaid.core-CloKtMOb.js} +5 -5
- package/resources/fe-dist/assets/{mindmap-definition-RKZ34NQL-D_v1LaNP.js → mindmap-definition-RKZ34NQL-BFPgS54r.js} +1 -1
- package/resources/fe-dist/assets/{pieDiagram-4H26LBE5-B1CHCpFf.js → pieDiagram-4H26LBE5-DwY4DDxv.js} +1 -1
- package/resources/fe-dist/assets/{quadrantDiagram-W4KKPZXB-DvA3zgR7.js → quadrantDiagram-W4KKPZXB-3jSLHV3z.js} +1 -1
- package/resources/fe-dist/assets/{requirementDiagram-4Y6WPE33-BCna6ZG5.js → requirementDiagram-4Y6WPE33-DHrqJmHL.js} +1 -1
- package/resources/fe-dist/assets/{sankeyDiagram-5OEKKPKP-KEllFLAf.js → sankeyDiagram-5OEKKPKP-CIaPmx-2.js} +1 -1
- package/resources/fe-dist/assets/{send-BgCF67Uc.js → send-CAJeq7VS.js} +1 -1
- package/resources/fe-dist/assets/{sequenceDiagram-3UESZ5HK-DRsq_jg_.js → sequenceDiagram-3UESZ5HK-DhRU1sO_.js} +1 -1
- package/resources/fe-dist/assets/{stateDiagram-AJRCARHV-DhATBo8D.js → stateDiagram-AJRCARHV-DZWC0te0.js} +1 -1
- package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-BJcIn84l.js +1 -0
- package/resources/fe-dist/assets/{terminal-settings-panel-DsMMZFBi.js → terminal-settings-panel-BiDSWGtf.js} +2 -2
- package/resources/fe-dist/assets/{timeline-definition-PNZ67QCA-Det7AzPd.js → timeline-definition-PNZ67QCA-Y0cAlUby.js} +1 -1
- package/resources/fe-dist/assets/{transfer-toast-CHcCj3qf.js → transfer-toast-yJBQc29j.js} +1 -1
- package/resources/fe-dist/assets/{triangle-alert-BjHP6Ipw.js → triangle-alert-Bs89Dzy0.js} +1 -1
- package/resources/fe-dist/assets/{vennDiagram-CIIHVFJN-BF4R466L.js → vennDiagram-CIIHVFJN-BVWElA6Q.js} +1 -1
- package/resources/fe-dist/assets/{wardley-L42UT6IY-DLHZ_6-V.js → wardley-L42UT6IY-BBf8FmIs.js} +1 -1
- package/resources/fe-dist/assets/{wardleyDiagram-YWT4CUSO-CekN3Ye6.js → wardleyDiagram-YWT4CUSO-Cyk4va1x.js} +1 -1
- package/resources/fe-dist/assets/{xychartDiagram-2RQKCTM6-CJD3yg0M.js → xychartDiagram-2RQKCTM6-DmEvYdFT.js} +1 -1
- package/resources/fe-dist/assets/{zap-Dx7JTXJN.js → zap-B28XlJER.js} +1 -1
- package/resources/fe-dist/index.html +1 -1
- package/resources/gateway-drizzle/0014_lucky_killraven.sql +1 -0
- package/resources/gateway-drizzle/meta/_journal.json +7 -0
- package/resources/fe-dist/assets/DevicePage-CgDkuNLp.js +0 -24
- package/resources/fe-dist/assets/channel-DBhb6_En.js +0 -1
- package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-9V2iXOG7.js +0 -1
- package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-9V2iXOG7.js +0 -1
- package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-Dn_gMFVD.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-
|
|
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-CloKtMOb.js";import{p as Ot}from"./chunk-4BX2VUAB-e7mC2fAZ.js";import{p as Wt}from"./wardley-L42UT6IY-BBf8FmIs.js";import"./index-C1akMMWP.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-
|
|
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-CloKtMOb.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-BENe2yWM.js";import{l as zt}from"./linear-Bmap7qQK.js";import"./index-C1akMMWP.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&>.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()+`
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<link rel="apple-touch-icon" href="/tmex.png" />
|
|
20
20
|
<meta name="description" content="tmex - Web 接入多设备 tmux 的终端控制平台" />
|
|
21
21
|
<title>tmex</title>
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-C1akMMWP.js"></script>
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/index-j9kTGUS5.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `site_settings` ADD `theme` text DEFAULT 'dark' NOT NULL CHECK(`site_settings`.`theme` in ('dark', 'light'));
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{Y as Oe,u as ke,j as i,aD as Tt,aE as jt,aF as Ct,aG as Nt,aH as Pt,at as kt,r as n,d as W,af as ge,ai as lt,ah as ut,ag as It,aj as Mt,aI as Lt,aJ as At,o as Me,aK as _t,D as zt,p as Dt,q as $t,s as Bt,ay as dt,aL as Je,aM as Ze,aw as ft,b as ht,aN as et,aO as Ft,c as tt,aC as mt,aP as Ne,aQ as Wt,aq as Ye,y as Ht,a2 as Ot,B as je,T as Xt,aR as qt,aS as Yt,aT as Ut,aU as Vt,aV as Kt,$ as Gt,aW as Qt,A as Jt,f as Zt,g as en,i as tn,k as nn,l as rn,m as sn,n as on}from"./index-UoApkLSY.js";import{T as cn,C as an,c as ln,F as un,a as wt,R as dn,A as fn,f as hn,t as mn,S as wn}from"./terminal-settings-panel-DsMMZFBi.js";import{e as pn}from"./selection-clipboard-D3gUQQ7L.js";import{C as gn}from"./copy-DzIk8AxV.js";import{S as it,K as xn}from"./send-BgCF67Uc.js";const vn=/^[0-9a-fA-F]{4}$/;function bn(t){if(typeof t!="string"||t.length<6)return null;const e=t.slice(0,4);if(!vn.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 $e(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 Be(t,e){return t.input[t.pos]!==e?!1:(t.pos+=1,!0)}function pt(t){const e=$e(t);if(e===null||!Be(t,"x"))return null;const s=$e(t);if(s===null||!Be(t,","))return null;const c=$e(t);if(c===null||!Be(t,","))return null;const l=$e(t);if(l===null)return null;const g=t.input[t.pos];if(g===","){t.pos+=1;const v=$e(t);return v===null?null:{type:"leaf",paneNumId:v,width:e,height:s,x:c,y:l}}if(g==="{"||g==="["){const v=g==="{"?"}":"]";t.pos+=1;const b=[];for(;;){const T=pt(t);if(!T)return null;if(b.push(T),!Be(t,",")){if(Be(t,v))break;return null}}return b.length<2?null:{type:g==="{"?"row":"column",width:e,height:s,x:c,y:l,children:b}}return null}function Ue(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 Sn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],yn=Oe("columns-2",Sn);/**
|
|
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 En=[["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"}]],Rn=Oe("search-x",En);/**
|
|
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 Tn=[["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=Oe("settings-2",Tn);/**
|
|
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 Cn=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Nn=Oe("smartphone",Cn);function Pn({open:t,onOpenChange:e}){const{t:s}=ke();return i.jsx(Tt,{open:t,onOpenChange:e,children:i.jsxs(jt,{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(Ct,{children:[i.jsx(Nt,{children:s("settings.terminal.title")}),i.jsx(Pt,{children:s("settings.terminal.savedInBrowser")})]}),i.jsx("div",{className:"px-4 pb-4",children:i.jsx(cn,{})})]})})}function kn({visible:t,canPaste:e,onCopy:s,onPaste:c,onDismiss:l}){const{t:g}=ke();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(gn,{className:"h-4 w-4"}),g("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(an,{className:"h-4 w-4"}),g("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":g("terminal.clearSelection"),"data-testid":"terminal-selection-dismiss",children:i.jsx(kt,{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 Mn(t){return In+gt(t)}function Ln(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 g=new Uint8Array(t.length+c);let v=0;s=e;for(const b of t)b===10&&!s&&(g[v]=13,v+=1),g[v]=b,v+=1,s=b===13;return{normalized:g,endedWithCR:l}}const An=1.3,_n=36,zn=500,Dn=12;function $n(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 g=0,v=null,b=!1,T=0,Y=0,U=0,E=null,O=!1;const r=()=>{E!==null&&(clearTimeout(E),E=null)},ae=S=>S?!!(S.closest(".scrollbar")||S.closest(".slider")||S.closest(".xterm-scroll-area")):!1,G=(S,h,P)=>{const B=P instanceof Element?P:null;if(ae(B))return!0;const A=document.elementFromPoint(S,h);if(ae(A))return!0;const F=c.querySelector(".xterm");if(!(F instanceof HTMLElement))return!1;const u=F.getBoundingClientRect(),N=S>=u.left&&S<=u.right,H=h>=u.top&&h<=u.bottom;return!N||!H?!1:S>=u.right-_n},j=()=>[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 P=S.item(h);if(P&&P.identifier===v)return P}return null},se=S=>{if(r(),S.touches.length!==1)return;const h=S.touches.item(0);h&&(v=h.identifier,g=h.clientY,T=0,b=G(h.clientX,h.clientY,S.target),Y=h.clientX,U=h.clientY,O=!1,b||(E=setTimeout(()=>{var B;E=null;const P=(e==null?void 0:e())??null;(B=P==null?void 0:P.startTouchSelection)!=null&&B.call(P,Y,U,"word")&&(O=!0)},zn)))},de=S=>{var N,H,J,M,q,te,we,fe,pe;const h=le(S.touches)??S.touches.item(0);if(!h)return;if(O){const z=(e==null?void 0:e())??null;(N=z==null?void 0:z.updateTouchSelection)==null||N.call(z,h.clientX,h.clientY),S.cancelable&&S.preventDefault();return}if(E!==null&&Math.hypot(h.clientX-Y,h.clientY-U)>Dn&&r(),b||(b=G(h.clientX,h.clientY,S.target),b&&(T=0)),b)return;const P=h.clientY,B=g-P;if(g=P,B===0)return;let A=!1,F=!1;const u=(e==null?void 0:e())??null;if(u){const z=u==null?void 0:u._core,Q=((q=(M=(J=(H=z==null?void 0:z._renderService)==null?void 0:H.dimensions)==null?void 0:J.css)==null?void 0:M.cell)==null?void 0:q.height)??18;T+=B*An;const Z=T>0?Math.floor(T/Q):Math.ceil(T/Q);if(typeof u.handleViewportGesture=="function")Z!==0&&(A=u.handleViewportGesture({source:"touch",deltaY:Z*Q,clientX:h.clientX,clientY:h.clientY}),T-=Z*Q);else if(Z!==0){const C=((we=(te=u.buffer)==null?void 0:te.active)==null?void 0:we.viewportY)??0;u.scrollLines(Z);const a=((pe=(fe=u.buffer)==null?void 0:fe.active)==null?void 0:pe.viewportY)??0;A=C!==a,F=Z<0&&C<=0&&a<=0,T-=Z*Q}}else{const z=j();if(z.length===0)return;for(const Q of z){const Z=Q.scrollTop;Q.scrollTop+=B;const C=Q.scrollTop;Math.abs(C-Z)>0&&(A=!0),B<0&&C<=0&&(F=!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:B}),C=Q.dispatchEvent(Z);A=Z.defaultPrevented||!C}}}S.cancelable&&(A||F)&&S.preventDefault()},re=S=>{var P;if(r(),!(v===null||!le(S.changedTouches))&&(v=null,T=0,b=!1,O)){O=!1;const B=(e==null?void 0:e())??null;(P=B==null?void 0:B.endTouchSelection)==null||P.call(B)}},f=S=>{O&&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 Bn({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 Fn({currentSize:t,containerSize:e,force:s=!1}){return s?!0:t.cols!==e.cols||t.rows!==e.rows}function Wn({deviceId:t,paneId:e,deviceConnected:s,isSelectionInvalid:c,sizingMode:l="report",onResize:g,onSync:v,getContainerRect:b}){const T=n.useRef(null),Y=n.useRef(null),U=n.useRef(null),E=n.useRef(null),O=n.useRef(0),r=n.useRef([]),ae=n.useRef(null),G=n.useRef(null),j=n.useRef(b),le=n.useRef(!1),se=n.useRef(g),de=n.useRef(v);n.useEffect(()=>{se.current=g},[g]),n.useEffect(()=>{de.current=v},[v]),n.useEffect(()=>{j.current=b},[b]);const re=n.useCallback(()=>{var we,fe,pe,z,Q,Z,C,a,m,R;const u=G.current,N=ae.current;if(!u||!N||!u.element)return null;let H;try{const y=N.proposeDimensions();if(!y)throw new Error("fitAddon.proposeDimensions() returned null");H=Math.max(2,y.cols)}catch{const y=u._core,X=((z=(pe=(fe=(we=y==null?void 0:y._renderService)==null?void 0:we.dimensions)==null?void 0:fe.css)==null?void 0:pe.cell)==null?void 0:z.width)??9,oe=(Q=j.current)==null?void 0:Q.call(j);if(!oe||oe.width===0)return null;H=Math.max(2,Math.floor(oe.width/X))}const J=(Z=j.current)==null?void 0:Z.call(j);if(!J||J.height===0)return null;const M=u._core,q=((R=(m=(a=(C=M==null?void 0:M._renderService)==null?void 0:C.dimensions)==null?void 0:a.css)==null?void 0:m.cell)==null?void 0:R.height)??17,te=Math.max(2,Math.floor(J.height/q));return{cols:H,rows:te}},[]),f=n.useCallback((u,N)=>{const H=G.current;H&&(H.cols===u&&H.rows===N||H.resize(u,N))},[]),S=n.useCallback((u,N=!1)=>{if(l==="follow"||!t||!e||!s||c&&u!=="sync"||!N&&Date.now()<O.current||!G.current)return!1;const J=re();if(!J)return!1;const{cols:M,rows:q}=J,te=U.current;return!N&&te&&te.cols===M&&te.rows===q?(f(M,q),!0):(f(M,q),u==="sync"?de.current(M,q):se.current(M,q),U.current={cols:M,rows:q},E.current={cols:M,rows:q,at:Date.now()},!0)},[f,s,t,c,re,e,l]),h=n.useCallback((u="resize",N={})=>{const{immediate:H=!1,force:J=!1}=N;Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),T.current!==null&&(cancelAnimationFrame(T.current),T.current=null);const M=()=>{T.current=requestAnimationFrame(()=>{T.current=null,S(u,J)})};if(H){M();return}Y.current=window.setTimeout(()=>{Y.current=null,M()},150)},[S]),P=n.useCallback(()=>{for(const u of r.current)window.clearTimeout(u);r.current=[]},[]),B=n.useCallback(()=>{var N;P(),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(()=>{})},[P,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 we;const M=G.current,q=re();if(!M||!q)return;if(!Fn({currentSize:{cols:Math.max(2,M.cols),rows:Math.max(2,M.rows)},containerSize:q})){(we=M.forceFullRepaint)==null||we.call(M);return}h("sync",{force:!0})},N=()=>{if(document.visibilityState!=="visible"){le.current=!0;return}le.current&&(le.current=!1,u())},H=()=>{le.current=!0},J=()=>{le.current&&(le.current=!1,u())};return document.addEventListener("visibilitychange",N),window.addEventListener("blur",H),window.addEventListener("focus",J),()=>{document.removeEventListener("visibilitychange",N),window.removeEventListener("blur",H),window.removeEventListener("focus",J)}},[re,h]),n.useEffect(()=>()=>{P(),Y.current!==null&&window.clearTimeout(Y.current),T.current!==null&&cancelAnimationFrame(T.current)},[P]);const A=n.useCallback(u=>{ae.current=u},[]),F=n.useCallback(u=>{G.current=u},[]);return{scheduleResize:h,runPostSelectResize:B,clearPostSelectResizeTimers:P,setFitAddon:A,setTerminal:F,lastReportedSize:U,pendingLocalSize:E,suppressLocalResizeUntil:O}}const Hn=1e4,Ke="tmex:terminal-mode-cache";function On(t,e){try{const s=sessionStorage.getItem(Ke);return s?JSON.parse(s)[`${t}:${e}`]??null:null}catch{return null}}function Xn(t,e,s){try{const c=sessionStorage.getItem(Ke),l=c?JSON.parse(c):{},g=`${t}:${e}`;s?l[g]=s:delete l[g],sessionStorage.setItem(Ke,JSON.stringify(l))}catch{}}function qn(){return{mouseX10:!1,mouseNormal:!0,mouseButton:!1,mouseAny:!1,mouseUtf8:!1,mouseSgr:!0,mouseSgrPixels:!1,mouseUrxvt:!1,altScroll:!0,altScreen1047:!1,altScreen1049:!1}}function Yn(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=qn();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 Un(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 Vn(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 nt=n.forwardRef(({deviceId:t,paneId:e,theme:s,inputMode:c,deviceConnected:l,isSelectionInvalid:g,sizingMode:v="report",autoFocus:b=!0,focused:T=!0,onResize:Y,onSync:U,children:E},O)=>{const[r,ae]=n.useState(null),[G,j]=n.useState(!1),le=W(d=>d.sendInput),se=ge(d=>d.terminalFontId),de=ge(d=>d.terminalFontSize),re=ge(d=>d.terminalLineHeight),{t:f}=ke(),S=n.useMemo(()=>{switch(s){case"light":return ut;default:return lt}},[s]),h=n.useRef(null),P=n.useRef(null),B=n.useRef(null),A=n.useRef(t),F=n.useRef(e),u=n.useRef(t),N=n.useRef(e),H=n.useRef(l&&!g),J=n.useRef(c),M=n.useRef(S),q=n.useRef(!1),te=n.useRef(!1),we=n.useRef(null),fe=n.useRef(!1),pe=n.useCallback((d,x,L)=>{!(d!=null&&d.exportModeSnapshot)||!x||!L||Xn(x,L,d.exportModeSnapshot())},[]),z=n.useCallback(()=>r,[r]);$n(h,z),n.useEffect(()=>{A.current=t,F.current=e,te.current=!1},[t,e]),n.useEffect(()=>{H.current=l&&!g},[l,g]),n.useEffect(()=>{J.current=c},[c]),n.useEffect(()=>{M.current=S},[S]);const Q=n.useCallback(d=>{if(!d||c!=="direct"||!H.current)return;const x=A.current,L=F.current;!x||!L||le(x,L,d,!1)},[c,le]),{pendingLocalSize:Z,scheduleResize:C,runPostSelectResize:a,setFitAddon:m,setTerminal:R}=Wn({deviceId:t,paneId:e,deviceConnected:l,isSelectionInvalid:g,sizingMode:v,onResize:Y,onSync:U,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 It(se,de),d)return;const L=await ln({fontFamily:Mt(se),fontSize:de,lineHeight:re,scrollback:Hn,theme:M.current,disableStdin:J.current==="editor"});if(d){L.dispose();return}x=L,P.current&&L.open(P.current),ae(L)})(),()=>{d=!0,ae(null),Vn(x),x==null||x.dispose()}},[se,de,re]),n.useEffect(()=>{!r||!b||Un(r)},[r,b]),n.useEffect(()=>{var d;(d=r==null?void 0:r.setFocused)==null||d.call(r,T)},[r,T]),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:()=>{pe(r,u.current,N.current),fe.current=!0,r.reset(),q.current=!1,a()},onApplyHistory:(d,x)=>{var k,ie;const L=Yn(On(A.current,F.current),x);L&&((k=r.restoreModeSnapshot)==null||k.call(r,L));const D=x?Mn(d):gt(d);te.current=!0,r.write(D),(ie=r.forceFullRepaint)==null||ie.call(r),fe.current=!1,u.current=A.current,N.current=F.current,pe(r,A.current,F.current)},onOutput:d=>{const x=Ln(d,q.current);q.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=F.current,pe(r,A.current,F.current)}}:null,[r,pe,a]);n.useEffect(()=>{r?we.current!==r&&(q.current=!1,u.current=A.current,N.current=F.current,we.current=r):we.current=null},[r]),n.useEffect(()=>{if(!(!r||!t||!e))return()=>{if(fe.current){fe.current=!1;return}pe(r,u.current,N.current)}},[t,r,e,pe]),n.useEffect(()=>{if(!(!y||!t||!e))return At(t,e,y)},[y,t,e]),n.useEffect(()=>{if(!r){B.current=null,m(null),R(null);return}const d=new un;return r.loadAddon(d),B.current=d,m(d),R(r),a(),()=>{try{d.dispose()}finally{B.current=null,m(null),R(null)}}},[r,a,m,R]),n.useEffect(()=>{const d=h.current;if(!d)return;let x=null;const L=new ResizeObserver(()=>{x!==null&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{x=null,C("resize")})});return L.observe(d),()=>{L.disconnect(),x!==null&&cancelAnimationFrame(x)}},[C]),n.useEffect(()=>{if(!r||!t||!e)return;const d=r.onData(x=>{!l||g||Q(x)});return r.attachCustomKeyEventHandler(x=>!l||g||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,g,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)){j(!1);return}const d=r.onSelectionChange(x=>{j(!!x)});return()=>{d.dispose(),j(!1)}},[r]);const X=n.useCallback(()=>{var x;if(!r)return;const d=((x=r.getSelection)==null?void 0:x.call(r))??"";d&&pn(d).then(()=>{Me.success(f("terminal.copied"))}).catch(()=>{Me.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 D;L&&r.paste(L),(D=r.clearSelection)==null||D.call(r),r.focus()}).catch(()=>{Me.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(O,()=>({write:d=>r==null?void 0:r.write(d),reset:()=>{r==null||r.reset(),q.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)=>C(d,x),calculateSizeFromContainer:()=>{var me,$,ee,_,V,ce,K,be,Ce,Se,Re,Ie,Le,_e,ue,Ae;const d=h.current,x=r,L=B.current;if(!d||!x)return null;const D=d.getBoundingClientRect();if(D.width===0||D.height===0)return null;const k=x._core;let ie;if(L)try{const ye=L.proposeDimensions();if(ye)ie=Math.max(2,ye.cols);else{const ze=((_=(ee=($=(me=k==null?void 0:k._renderService)==null?void 0:me.dimensions)==null?void 0:$.css)==null?void 0:ee.cell)==null?void 0:_.width)??9;ie=Math.max(2,Math.floor(D.width/ze))}}catch{const ye=((be=(K=(ce=(V=k==null?void 0:k._renderService)==null?void 0:V.dimensions)==null?void 0:ce.css)==null?void 0:K.cell)==null?void 0:be.width)??9;ie=Math.max(2,Math.floor(D.width/ye))}else{const ye=((Ie=(Re=(Se=(Ce=k==null?void 0:k._renderService)==null?void 0:Ce.dimensions)==null?void 0:Se.css)==null?void 0:Re.cell)==null?void 0:Ie.width)??9;ie=Math.max(2,Math.floor(D.width/ye))}const Ee=((Ae=(ue=(_e=(Le=k==null?void 0:k._renderService)==null?void 0:Le.dimensions)==null?void 0:_e.css)==null?void 0:ue.cell)==null?void 0:Ae.height)??17,Te=Math.max(2,Math.floor(D.height/Ee));return{cols:ie,rows:Te}},getPendingLocalSize:()=>Z.current,getCellSize:()=>{var L,D,k;const d=r==null?void 0:r._core,x=(k=(D=(L=d==null?void 0:d._renderService)==null?void 0:L.dimensions)==null?void 0:D.css)==null?void 0:k.cell;return!(x!=null&&x.width)||!(x!=null&&x.height)?null:{width:x.width,height:x.height}}}),[r,Z,a,C]),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:P,className:"absolute inset-0"}),i.jsx(kn,{visible:G,canPaste:c==="direct"&&l&&!g,onCopy:X,onPaste:oe,onDismiss:he})]}),E]})});nt.displayName="Terminal";function Kn({window:t,currentPaneId:e,onSelectPane:s}){const{t:c}=ke();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(yn,{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 g=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 ${g?"bg-primary/10 text-primary":l.active?"bg-accent text-accent-foreground":""}`,onClick:()=>{g||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})]}),g&&i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-primary"})]},l.id)})})]})}function Gn(t,e){return dt(s=>{for(const c of Object.values(s.sessions))if(!(!c||c.deviceId!==t||c.paneId!==e)&&!(c.status==="stopped"||c.status==="error")){if(c.status==="running"){const l=s.inProgress[c.id];return l&&(l.texts.length>0||l.toolCalls.length>0||l.reasonings.length>0),"generating"}return"bound"}return"none"})}function Ge(t){return t.type==="leaf"?t:t.type==="row"?Ge(t.children[t.children.length-1]):Ge(t.children[0])}function Qe(t){return t.type==="leaf"?t:t.type==="column"?Qe(t.children[t.children.length-1]):Qe(t.children[0])}function Qn(t,e){const s=[],c=[],l=g=>{if(g.type==="leaf"){s.push({paneId:Ue(g),cols:g.width,rows:g.height,rect:{left:g.x*e.width,top:g.y*e.height,width:g.width*e.width,height:g.height*e.height}});return}for(let v=0;v<g.children.length;v+=1){const b=g.children[v];if(l(b),v!==g.children.length-1)if(g.type==="row"){const T=Ge(b);c.push({axis:"x",rect:{left:(b.x+b.width)*e.width,top:g.y*e.height,width:e.width,height:g.height*e.height},edgeLeafPaneId:Ue(T)})}else{const T=Qe(b);c.push({axis:"y",rect:{left:g.x*e.width,top:(b.y+b.height)*e.height,width:g.width*e.width,height:e.height},edgeLeafPaneId:Ue(T)})}}};return l(t),{panes:s,gutters:c}}function We(t){if(t.type==="leaf")return 1;if(t.type==="column"){let s=0;for(const c of t.children)s+=We(c);return s}let e=1;for(const s of t.children)e=Math.max(e,We(s));return e}function He(t){if(t.type==="leaf")return 1;if(t.type==="row"){let s=0;for(const c of t.children)s+=He(c);return s}let e=1;for(const s of t.children)e=Math.max(e,He(s));return e}function Jn(t,e){const s=We(t),c=He(t),l=Math.max(0,e.viewport.width-c*e.paneChrome.width),g=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(g/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((g,v)=>g[1]-v[1]),l[0][0]}const ct=150,er=200,tr=15,nr=46,rr=38,sr=12,or=6;function at(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}function cr({paneId:t}){return Je(s=>!!s.ringingPanes[t])?i.jsx("span",{className:"bell-blink shrink-0",children:"🔔 "}):null}function ar({deviceId:t,paneId:e}){const{t:s}=ke(),c=Gn(t,e);return c==="none"?null:c==="generating"?i.jsxs("span",{className:"shrink-0 select-none text-xs",title:s("agent.paneBadge.generating"),"aria-label":s("agent.paneBadge.generating"),children:["🤖",i.jsx("span",{className:"ml-0.5 text-[10px] animate-pulse",children:"✨"})]}):i.jsx("span",{className:"text-muted-foreground/60 shrink-0 select-none text-xs grayscale",title:s("agent.paneBadge.bound"),"aria-label":s("agent.paneBadge.bound"),children:"🤖"})}const lr={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 ur({deviceId:t,window:e,focusedPaneId:s,theme:c,inputMode:l,deviceConnected:g,focusedTerminalRef:v,onUserSelectPane:b,onWindowResize:T}){var Q,Z,C;const Y=n.useRef(null),U=n.useRef(new Map),[E,O]=n.useState(null),[r,ae]=n.useState(null),{t:G}=ke(),j=W(a=>a.subscribePanes),le=W(a=>a.fetchPaneHistory),se=W(a=>a.resizePaneInWindow),de=W(a=>a.movePane),re=W(a=>a.breakPane),f=W(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?bn(e.layout):null,[e.layout]),P=n.useMemo(()=>h?Qn(h.root,{width:1,height:1}):null,[h]),B=n.useRef(P);B.current=P;const A=(h==null?void 0:h.root.width)??1,F=(h==null?void 0:h.root.height)??1,u=e.panes.map(a=>a.id).join(",");n.useEffect(()=>(j(t,u?u.split(","):[]),()=>{j(t,[])}),[t,u,j]);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,R;l!=="direct"||window.innerWidth<768||"ontouchstart"in window||(R=(m=U.current.get(s))==null?void 0:m.getTerminal())==null||R.focus()},[s,l]);const H=n.useCallback(()=>{var a;for(const m of[s,...U.current.keys()]){const R=(a=U.current.get(m))==null?void 0:a.getCellSize();if(R)return R}return null},[s]);n.useEffect(()=>{var a;if(P)for(const m of P.panes)(a=U.current.get(m.paneId))==null||a.resize(m.cols,m.rows)},[P]);const J=n.useMemo(()=>h?We(h.root):1,[h]),M=n.useMemo(()=>h?He(h.root):1,[h]),q=n.useCallback(()=>{const a=Y.current;if(!a||!h)return!1;const m=a.getBoundingClientRect();if(m.width<1||m.height<1)return!1;const R=H();if(!R)return!1;const{cols:y,rows:X}=Jn(h.root,{viewport:{width:m.width,height:m.height},cell:R,paneChrome:{width:sr,height:nr}});return T(y,X),!0},[H,h,T]),te=n.useRef(q);n.useEffect(()=>{te.current=q},[q]),n.useEffect(()=>{const a=Y.current;if(!a)return;let m=null,R=null,y=0;const X=()=>{if(te.current()){y=0;return}y<tr&&(y+=1,R=setTimeout(X,er))},oe=new ResizeObserver(()=>{m&&clearTimeout(m),m=setTimeout(X,ct)});return oe.observe(a),()=>{oe.disconnect(),m&&clearTimeout(m),R&&clearTimeout(R)}},[]),n.useEffect(()=>{const a=setTimeout(()=>{te.current()},ct);return()=>clearTimeout(a)},[J,M]);const we=n.useCallback((a,m,R)=>{R.preventDefault();const y=Y.current;if(!y)return;const X=R.clientX,oe=R.clientY,he=R.currentTarget;he.setPointerCapture(R.pointerId),O({gutterIndex:a,deltaPx:0});const d=k=>{const ie=m.axis==="x"?k.clientX-X:k.clientY-oe;O({gutterIndex:a,deltaPx:ie})},x=(k,ie)=>{if(he.removeEventListener("pointermove",d),he.removeEventListener("pointerup",L),he.removeEventListener("pointercancel",D),window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",D),O(null),!ie)return;const Ee=H();if(!Ee)return;const Te=m.axis==="x"?k.clientX-X:k.clientY-oe,me=m.axis==="x"?Ee.width:Ee.height;if(me<=0)return;const $=Math.round(Te/me);if($===0)return;const ee=y.querySelector(`[data-pane-id="${m.edgeLeafPaneId}"]`);if(!ee)return;const _=ee.getBoundingClientRect(),ce=(m.axis==="x"?Math.floor(_.width/me):Math.floor(_.height/me))+$;ce<2||(te.current(),se(t,m.edgeLeafPaneId,m.axis==="x"?{cols:ce}:{rows:ce}))},L=k=>x(k,!0),D=k=>x(k,!1);he.addEventListener("pointermove",d),window.addEventListener("pointerup",L),window.addEventListener("pointercancel",D)},[t,H,se]),fe=n.useCallback((a,m)=>{const R=Y.current,y=P;if(!R||!y)return;m.preventDefault();const X=m.clientX,oe=m.clientY,he=m.currentTarget;he.setPointerCapture(m.pointerId);let d=!1;const x=($,ee)=>{const _=R.getBoundingClientRect();if(_.width<1||_.height<1)return null;const V=($-_.left)/_.width*Math.max(1,A),ce=(ee-_.top)/_.height*Math.max(1,F);for(const K of y.panes)if(V>=K.rect.left&&V<=K.rect.left+K.rect.width&&ce>=K.rect.top&&ce<=K.rect.top+K.rect.height){const be=(V-K.rect.left)/Math.max(1e-6,K.rect.width),Ce=(ce-K.rect.top)/Math.max(1e-6,K.rect.height);return{paneId:K.paneId,position:Zn(be,Ce)}}return null},L=($,ee,_)=>$>=_.left&&$<=_.right&&ee>=_.top&&ee<=_.bottom,D=($,ee)=>{for(const _ of Array.from(document.querySelectorAll('[data-testid^="window-item-"]'))){const V=_.getBoundingClientRect();if(V.width<1||!L($,ee,V))continue;const ce=(_.getAttribute("data-testid")??"").replace("window-item-","");return!ce||ce===e.id?null:{type:"window",windowId:ce,rect:{left:V.left,top:V.top,width:V.width,height:V.height}}}for(const _ of Array.from(document.querySelectorAll('[data-slot="sidebar"]'))){const V=_.getBoundingClientRect();if(!(V.width<1||!L($,ee,V)))return{type:"break",rect:{left:V.left,top:V.top,width:V.width,height:V.height}}}return null},k=($,ee)=>{const _=x($,ee);return _?_.paneId===a?null:{type:"pane",..._}:D($,ee)},ie=$=>{const ee=Math.hypot($.clientX-X,$.clientY-oe);!d&&ee<or||(d=!0,ae({srcPaneId:a,active:!0,pointerX:$.clientX,pointerY:$.clientY,target:k($.clientX,$.clientY)}))},Ee=($,ee)=>{var V,ce;if(he.removeEventListener("pointermove",ie),he.removeEventListener("pointerup",Te),he.removeEventListener("pointercancel",me),window.removeEventListener("pointerup",Te),window.removeEventListener("pointercancel",me),ae(null),!ee||!d)return;const _=k($.clientX,$.clientY);if(_){if(_.type==="pane"){de(t,a,_.paneId,_.position);return}if(_.type==="window"){const K=(ce=(V=W.getState().snapshots[t])==null?void 0:V.session)==null?void 0:ce.windows,be=K==null?void 0:K.find(Se=>Se.id===_.windowId),Ce=(be==null?void 0:be.panes.find(Se=>Se.active))??(be==null?void 0:be.panes[0]);Ce&&de(t,a,Ce.id,"right");return}re(t,a)}},Te=$=>Ee($,!0),me=$=>Ee($,!1);he.addEventListener("pointermove",ie),window.addEventListener("pointerup",Te),window.addEventListener("pointercancel",me)},[t,P,de,re,A,F,e.id]),pe=n.useCallback(a=>m=>{var R;if(m){U.current.set(a,m);const y=(R=B.current)==null?void 0:R.panes.find(X=>X.paneId===a);y&&m.resize(y.cols,y.rows)}else U.current.delete(a);a===s&&v(m)},[s,v]);if(n.useEffect(()=>{v(U.current.get(s)??null)},[s,v]),!P)return null;const z=(a,m)=>`${a/Math.max(1,m)*100}%`;return i.jsxs("div",{ref:Y,className:"relative h-full w-full min-h-0 min-w-0","data-testid":"split-terminal-area",children:[P.panes.map(a=>{var he;const m=a.paneId===s,R=S.get(a.paneId),y=ir(R),X=(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 ${X?"opacity-60":""}`,"data-testid":"split-pane","data-pane-id":a.paneId,"data-focused":m||void 0,style:{left:z(a.rect.left,A),top:z(a.rect.top,F),width:z(a.rect.width,A),height:z(a.rect.height,F)},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(cr,{paneId:a.paneId}),i.jsx(ar,{deviceId:t,paneId:a.paneId}),i.jsx("span",{className:`shrink-0 truncate font-mono text-[10.5px] leading-none ${m?"text-foreground/90":"text-foreground/50"}`,children:at(R)}),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":G("window.closePane"),title:G("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(nt,{ref:pe(a.paneId),deviceId:t,paneId:a.paneId,theme:c,inputMode:l,deviceConnected:g,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 ${lr[oe]}`})]},a.paneId)}),(E!==null||(r==null?void 0:r.active))&&i.jsx("div",{"data-testid":"split-drag-shield",className:`absolute inset-0 z-30 ${E!==null?((Q=P.gutters[E.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:at(S.get(r.srcPaneId))}),((Z=r.target)==null?void 0:Z.type)==="window"&&i.jsx("div",{className:"text-[9.5px] text-muted-foreground",children:G("window.moveToWindow")}),((C=r.target)==null?void 0:C.type)==="break"&&i.jsx("div",{className:"text-[9.5px] text-muted-foreground",children:G("window.breakToWindow")})]}),P.gutters.map((a,m)=>{const R=a.axis==="x",y=(E==null?void 0:E.gutterIndex)===m;return i.jsxs("div",{className:"absolute z-20",style:{left:z(a.rect.left,A),top:z(a.rect.top,F),width:z(R?1:a.rect.width,A),height:z(R?a.rect.height:1,F)},children:[i.jsx("div",{"data-testid":"split-gutter","data-axis":a.axis,className:`absolute touch-none select-none ${R?"-inset-x-1 inset-y-0 cursor-col-resize":"inset-x-0 -inset-y-1 cursor-row-resize"}`,onPointerDown:X=>we(m,a,X),children:i.jsx("div",{className:`absolute bg-foreground/[0.08] transition-colors hover:bg-primary/50 ${R?"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&&E&&i.jsx("div",{className:"pointer-events-none absolute bg-primary/70",style:R?{top:0,bottom:0,width:2,left:`calc(50% + ${E.deltaPx}px)`}:{left:0,right:0,height:2,top:`calc(50% + ${E.deltaPx}px)`}})]},`${e.layout??""}:${m}`)})]})}const dr=1200,fr=2e3;function Pe(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<dr);return s.length===0?null:s.reduce((c,l)=>l.at>c.at?l:c)}function Fe(t,e=Date.now()){return!t||e-t.at>fr?null:t}function hr(t){const e=t.now??Date.now(),s=xt(t.recentSelectRequests,e),c=g=>!!(g&&g.paneId===t.activePaneFromEvent.paneId&&g.windowId!==t.activePaneFromEvent.windowId);if(s&&!Pe(s,t.activePaneFromEvent)&&!c(s)||Pe(t.currentRoute,t.activePaneFromEvent)||Pe(t.lastHandledActive,t.activePaneFromEvent))return!0;const l=Fe(t.pendingUserSelection,e);return!!(l&&!Pe(l,t.activePaneFromEvent)&&!c(l))}function mr(t){const e=t.now??Date.now(),s=xt(t.recentSelectRequests,e),c=Fe(t.pendingUserSelection,e);return!!(c&&!Pe(c,t.snapshotActive)||s&&!Pe(s,t.snapshotActive))}function wr(t){const e=t.now??Date.now(),s=Fe(t.pendingUserSelection,e);return!(s&&Pe(s,t.routeTarget)||t.snapshotActive&&Pe(t.snapshotActive,t.routeTarget))}const Ve=n.memo(function({onActivate:e,disabled:s}){const{data:c}=tt({queryKey:mn,queryFn:hn,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(wn,{items:l,useIcons:(c==null?void 0:c.useIcons)??!1,onActivate:e,disabled:s,preventFocusSteal:!0,rowTestId:"terminal-shortcuts-row",idPrefix:"terminal-shortcut"})})});function Sr(){var ot;const{t}=ke(),{deviceId:e,windowId:s,paneId:c}=Ze(),l=ft(),g=n.useRef(null),v=n.useRef(null),b=n.useRef(null),T=n.useRef(null),Y=n.useRef(!1),U=n.useRef(!1),E=n.useRef(null),O=W(o=>o.selectPane),r=W(o=>o.focusPane),ae=W(o=>e?o.snapshots[e]:void 0),G=W(o=>{var w;return e?(w=o.deviceErrors)==null?void 0:w[e]:void 0}),j=W(o=>{var w;return e?((w=o.deviceConnected)==null?void 0:w[e])??!1:!1}),se=!!W(o=>{var w;return e?(w=o.deviceReconnecting)==null?void 0:w[e]:void 0}),de=W(o=>e?o.connectedDevices.has(e):!1),re=ht(o=>{var w;return((w=o.settings)==null?void 0:w.siteName)??"tmex"}),f=n.useMemo(()=>et(c),[c]),S=n.useMemo(()=>e&&f?`${e}:${f}`:null,[e,f]),[h,P]=n.useState(!1),B=n.useRef(!1);n.useEffect(()=>{B.current=h},[h]);const[A,F]=n.useState(""),u=n.useRef(!1),N=!j||!f,[H,J]=n.useState(!1),M=ge(o=>o.inputMode),q=ge(o=>o.theme),te=ge(o=>o.editorSendWithEnter),we=ge(o=>o.setEditorSendWithEnter),fe=ge(o=>o.addEditorHistory),pe=ge(o=>o.setEditorDraft),z=ge(o=>o.removeEditorDraft),Q=ge(o=>S?o.editorDrafts[S]??"":""),Z=n.useMemo(()=>Ft(),[]),C=(ot=ae==null?void 0:ae.session)==null?void 0:ot.windows,a=q==="light"?ut:lt,{data:m}=tt({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}),R=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||!C))return C.find(o=>o.id===s)},[s,C]),X=n.useMemo(()=>{if(!(!f||!y))return y.panes.find(o=>o.id===f)},[f,y]),oe=!!C,x=oe&&!!s&&!y?t("terminal.windowClosed"):oe&&!!s&&!!f&&!!y&&!X?t("terminal.paneClosed"):null,L=!!x,D=!!(j&&f&&!L),k=!!(!h&&y&&y.panes.length>1&&y.layout&&!L),ie=n.useRef(k);n.useEffect(()=>{ie.current=k},[k]);const Ee=Je(o=>o.ringingPanes),Te=n.useMemo(()=>{if(!y||!X)return null;const o=(R==null?void 0:R.name)??e,w=mt({paneCustomName:X.customName,paneTitle:X.title,windowName:y.name,windowCustomName:y.customName,deviceName:o});return Ee[X.id]?`🔔 ${w}`:w},[R==null?void 0:R.name,e,X,y,Ee]),me=n.useMemo(()=>{if(!C||C.length===0)return null;const o=C.find(p=>p.active),w=o==null?void 0:o.panes.find(p=>p.active);return!o||!w?null:{windowId:o.id,paneId:w.id}},[C]),$=h&&y&&y.panes.length>1?y.id:null,ee=n.useRef($);n.useEffect(()=>{ee.current=$},[$]);const _=n.useRef(!1);n.useEffect(()=>{_.current=!!C&&!!s},[C,s]);const V=n.useCallback((o,w)=>{if(!e||!f)return;const p=ee.current;if(p){W.getState().applyStackedLayout(e,p,o,w);return}B.current&&!_.current||W.getState().resizePane(e,f,o,w)},[e,f]),ce=n.useCallback((o,w)=>{if(!e||!f)return;const p=ee.current;if(p){W.getState().applyStackedLayout(e,p,o,w);return}B.current&&!_.current||W.getState().syncPaneSize(e,f,o,w)},[e,f]),K=n.useCallback((o,w)=>{var De;const p=T.current;if(ie.current){const ve=(De=g.current)==null?void 0:De.getBoundingClientRect(),qe=p==null?void 0:p.getCellSize();return ve&&qe&&ve.width>0&&ve.height>0?{cols:Math.max(2,Math.floor(ve.width/qe.width)),rows:Math.max(2,Math.floor(ve.height/qe.height))}:void 0}if(B.current)return;const I=(p==null?void 0:p.calculateSizeFromContainer())??(p==null?void 0:p.getSize())??void 0;if(I)return I;if(!o||!w||!C)return;const ne=C.find(ve=>ve.id===o),xe=ne==null?void 0:ne.panes.find(ve=>ve.id===w);if(!(!xe||xe.width<=1||xe.height<=1))return{cols:xe.width,rows:xe.height}},[C]),be=n.useCallback((o,w)=>{e&&(E.current={windowId:o,paneId:w,at:Date.now()},l(`/devices/${e}/windows/${o}/panes/${Ne(w)}`,{replace:!0}))},[e,l]),Ce=n.useCallback(o=>{T.current=o},[]);n.useEffect(()=>{const o=()=>{P(window.innerWidth<768||"ontouchstart"in window)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),n.useEffect(()=>{if(!h||!Z||U.current)return;U.current=!0;const o=()=>{window.scrollTo(0,1)},w=window.requestAnimationFrame(o),p=window.setTimeout(o,120),I=window.setTimeout(o,420);return()=>{window.cancelAnimationFrame(w),window.clearTimeout(p),window.clearTimeout(I)}},[Z,h]),n.useEffect(()=>{e&&(Y.current=!1,Ae.current=null,ye.current=null,E.current=null,Se.current=[])},[e]),n.useEffect(()=>{j||(Y.current=!1)},[j]),n.useEffect(()=>{if(!e||!j||!s||!C)return;if(C.length===0){l("/devices",{replace:!0});return}const o=C.find(p=>p.id===s);if(!o)return;if(!f){const p=o.panes.find(I=>I.active)??o.panes[0];p&&l(`/devices/${e}/windows/${s}/panes/${Ne(p.id)}`,{replace:!0});return}if(!o.panes.find(p=>p.id===f)){const p=C.find(ne=>ne.panes.some(xe=>xe.id===f));if(p){l(`/devices/${e}/windows/${p.id}/panes/${Ne(f)}`,{replace:!0});return}const I=o.panes.find(ne=>ne.active)??o.panes[0];I&&l(`/devices/${e}/windows/${s}/panes/${Ne(I.id)}`,{replace:!0});return}},[e,j,C,s,f,l]),n.useEffect(()=>{if(!e||!j||!C||C.length===0||s&&f||Y.current)return;const o=C.find(p=>p.active)??C[0],w=o.panes.find(p=>p.active)??o.panes[0];w&&(Y.current=!0,l(`/devices/${e}/windows/${o.id}/panes/${Ne(w.id)}`,{replace:!0}))},[j,e,l,f,s,C]);const Se=n.useRef([]),Re=n.useCallback((o,w)=>{const p=Date.now(),I=[...Se.current.filter(ne=>p-ne.at<2e3),{windowId:o,paneId:w,at:p}];Se.current=I.slice(-8)},[]),Ie=n.useRef(null);n.useEffect(()=>{Ie.current=null},[e,f]);const Le=n.useRef(null),_e=n.useRef(k);n.useEffect(()=>{_e.current!==k&&(_e.current=k,Ie.current=null,Le.current=null)},[k]),n.useEffect(()=>{if(!e||!s||!f||N||!j)return;const o=`${e}:${s}:${f}`;if(Ie.current===o)return;Ie.current=o;const w=k&&Le.current===`${e}:${s}`&&!!(y!=null&&y.panes.some(I=>I.id===f));if(Re(s,f),w){r(e,s,f);return}const p=K(s,f);O(e,s,f,p),Le.current=`${e}:${s}`},[j,e,r,K,N,k,Re,f,O,y,s]),n.useEffect(()=>{if(!e||!j||!s||!f)return;const o={windowId:s,paneId:f};wr({routeTarget:o,snapshotActive:me,pendingUserSelection:E.current})&&(E.current={windowId:o.windowId,paneId:o.paneId,at:Date.now()})},[j,e,f,me,s]);const ue=W(o=>e?o.activePaneFromEvent[e]:void 0),Ae=n.useRef(null);n.useEffect(()=>{if(!e||!j||!s||!f||!ue)return;const o=Date.now(),w=Fe(E.current,o);if(E.current=w,hr({now:o,pendingUserSelection:w,activePaneFromEvent:ue,currentRoute:{windowId:s,paneId:f},recentSelectRequests:Se.current,lastHandledActive:Ae.current}))return;if(Ae.current={...ue},w&&w.windowId===ue.windowId&&w.paneId===ue.paneId&&(E.current=null),!(ie.current&&ue.windowId===s)){const I=K(ue.windowId,ue.paneId);Re(ue.windowId,ue.paneId),O(e,ue.windowId,ue.paneId,I)}l(`/devices/${e}/windows/${ue.windowId}/panes/${Ne(ue.paneId)}`,{replace:!0})},[e,j,s,f,ue,Re,K,O,l]);const ye=n.useRef(null);n.useEffect(()=>{if(!e||!j||!C||C.length===0)return;const o=Se.current,w=C.find(ve=>ve.active);if(!w)return;const p=w.panes.find(ve=>ve.active);if(!p)return;const I={windowId:w.id,paneId:p.id},ne=Date.now(),xe=Fe(E.current,ne);if(E.current=xe,mr({now:ne,pendingUserSelection:xe,snapshotActive:I,recentSelectRequests:o})||ye.current&&ye.current.windowId===I.windowId&&ye.current.paneId===I.paneId||(ye.current={...I},xe&&xe.windowId===I.windowId&&xe.paneId===I.paneId&&(E.current=null),s===I.windowId&&f===I.paneId))return;if(!(ie.current&&I.windowId===s)){const ve=K(I.windowId,I.paneId);Re(I.windowId,I.paneId),O(e,I.windowId,I.paneId,ve)}l(`/devices/${e}/windows/${I.windowId}/panes/${Ne(I.paneId)}`,{replace:!0})},[e,j,C,s,f,Re,K,O,l]);const ze=W(o=>e?o.pendingCreateWindowAt[e]:void 0);n.useEffect(()=>{if(!e||!j||!ze)return;const o=5e3,w=Date.now()-ze;if(w>o){W.getState().clearPendingCreateWindow(e);return}if(!me){const ne=window.setTimeout(()=>{W.getState().clearPendingCreateWindow(e)},o-w);return()=>window.clearTimeout(ne)}const p=me;if(s===p.windowId&&f===p.paneId){const ne=window.setTimeout(()=>{W.getState().clearPendingCreateWindow(e)},o-w);return()=>window.clearTimeout(ne)}E.current={windowId:p.windowId,paneId:p.paneId,at:Date.now()};const I=K(p.windowId,p.paneId);Re(p.windowId,p.paneId),O(e,p.windowId,p.paneId,I),l(`/devices/${e}/windows/${p.windowId}/panes/${Ne(p.paneId)}`,{replace:!0}),W.getState().clearPendingCreateWindow(e)},[e,j,ze,me,s,f,Re,K,O,l]),n.useEffect(()=>{if(k||!D||!X||N)return;const o=T.current,w=o==null?void 0:o.getTerminal();if(!w)return;const p=Math.max(2,Math.floor(X.width||0)),I=Math.max(2,Math.floor(X.height||0));if(!p||!I)return;const ne=Date.now(),xe={cols:p,rows:I},De=(o==null?void 0:o.getPendingLocalSize())??null;Bn({now:ne,remoteSize:xe,pendingLocalSize:De})&&(w.cols===p&&w.rows===I||w.resize(p,I))},[D,N,k,X]),n.useEffect(()=>{const o=window.requestAnimationFrame(()=>{var p;(p=T.current)==null||p.scrollToBottom()}),w=window.setTimeout(()=>{var p;(p=T.current)==null||p.scrollToBottom()},120);return()=>{window.cancelAnimationFrame(o),window.clearTimeout(w)}},[M]),n.useEffect(()=>{G!=null&&G.message&&Me.error(G.message)},[G==null?void 0:G.message]),n.useEffect(()=>(document.title=Wt(Te),()=>{document.title=re}),[re,Te]),n.useEffect(()=>{const o=()=>{var w;(w=T.current)==null||w.scrollToBottom()};return window.addEventListener("tmex:jump-to-latest",o),()=>{window.removeEventListener("tmex:jump-to-latest",o)}},[]),n.useEffect(()=>{const o=w=>{const{deviceId:p,windowId:I,paneId:ne}=w.detail;p===e&&(E.current={windowId:I,paneId:ne,at:Date.now()})};return window.addEventListener("tmex:user-initiated-selection",o),()=>{window.removeEventListener("tmex:user-initiated-selection",o)}},[e]),n.useEffect(()=>{F(Q)},[Q]);const rt=n.useCallback(o=>{if(!e||!f||!D)return;W.getState().sendInput(e,f,o,!1)},[D,e,f]),Xe=n.useCallback(o=>{var w,p;if(o.type==="action"){if(o.action==="toggleKeyboard"){ge.getState().setInputMode(M==="direct"?"editor":"direct");return}if(o.action==="scrollToBottom"){(w=T.current)==null||w.scrollToBottom();return}}if(o.type==="send"){o.payload&&rt(o.payload);return}if(!(!e||!f||!D))switch(o.action){case"paste":{((p=navigator.clipboard)!=null&&p.readText?navigator.clipboard.readText():Promise.reject(new Error("clipboard unavailable"))).then(ne=>{ne&&W.getState().paste(e,f,ne)}).catch(()=>Me.error(t("terminal.pasteFailed")));break}case"newAgentSession":dt.getState().startDraft(e,f,null),ge.getState().setSidebarCollapsed(!1),ge.getState().setSidebarTab("agent");break}},[D,e,rt,M,f,t]),vt=n.useCallback(()=>{if(!D){Me.error(t("wsError.checkGateway"));return}if(!e||!f||!A.trim())return;J(!0),window.setTimeout(()=>J(!1),150);const o=te?`${A}\r`:A;W.getState().sendInput(e,f,o,!1),fe(A),S&&z(S),F("")},[fe,D,e,S,te,A,z,f,t]),bt=n.useCallback(()=>{if(!D){Me.error(t("wsError.checkGateway"));return}if(!e||!f||!A.trim())return;J(!0),window.setTimeout(()=>J(!1),150);const o=A.split(/\r?\n/),w=W.getState();for(const p of o)p.trim()&&w.sendInput(e,f,`${p}\r`,!1);fe(A),S&&z(S),F("")},[fe,D,e,S,A,z,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&&(j||se),Et=j&&!!f&&!L&&!X,Rt=de&&!j&&!G&&!se,st=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(Ye,{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&&M==="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(Rn,{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?k&&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:g,className:"relative min-h-0 flex-1",children:i.jsx(ur,{deviceId:e,window:y,focusedPaneId:f,theme:q,inputMode:M,deviceConnected:j,focusedTerminalRef:Ce,onUserSelectPane:be,onWindowResize:V},`${e}:${y.id}`)}),M==="direct"&&i.jsx("div",{className:"kb-floating-shortcuts",style:{backgroundColor:a.background},children:i.jsx(Ve,{onActivate:Xe,disabled:!D})})]}):i.jsx("div",{ref:g,className:"flex-1 h-full min-h-0 w-full","data-virtual-keyboard-avoid":!0,children:i.jsx(nt,{ref:T,deviceId:e,paneId:f,theme:q,inputMode:M,deviceConnected:j,isSelectionInvalid:L,onResize:V,onSync:ce,children:M==="direct"&&i.jsx("div",{className:"kb-floating-shortcuts",style:{backgroundColor:a.background},children:i.jsx(Ve,{onActivate:Xe,disabled:!D})})},`${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?st:!j&&!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?st: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(Ht,{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")})]})})]})}),M==="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(Ve,{onActivate:o=>{Xe(o),o.type==="send"&&St()},disabled:!D}),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 w=o.target.value;if(F(w),!!S){if(w){pe(S,w);return}z(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(Ot,{size:"sm",checked:te,onCheckedChange:o=>we(!!o)}),i.jsx("span",{children:t("terminal.editorSendWithEnter")})]}),i.jsxs(je,{variant:"outline",size:"sm","data-testid":"editor-clear",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;F(""),S&&z(S),h&&M==="editor"&&((o=b.current)==null||o.focus({preventScroll:!0}))},title:t("terminal.clear"),children:[i.jsx(Xt,{className:"h-4 w-4"}),t("terminal.clear")]}),i.jsxs(je,{variant:"secondary",size:"sm","data-testid":"editor-send-line-by-line",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;bt(),h&&M==="editor"&&((o=b.current)==null||o.focus({preventScroll:!0}))},disabled:!D||H,children:[H?i.jsx(Ye,{className:"h-4 w-4 animate-spin"}):i.jsx(it,{className:"h-4 w-4"}),t("terminal.editorSendLineByLine")]}),i.jsxs(je,{variant:"default",size:"sm","data-testid":"editor-send",onMouseDown:o=>o.preventDefault(),onClick:()=>{var o;vt(),h&&M==="editor"&&((o=b.current)==null||o.focus({preventScroll:!0}))},disabled:!D||H,children:[H?i.jsx(Ye,{className:"h-4 w-4 animate-spin"}):i.jsx(it,{className:"h-4 w-4"}),t("common.send")]})]})})]})]})}function yr(){const{deviceId:t,windowId:e,paneId:s}=Ze(),c=s?et(s):void 0,l=W(E=>E.snapshots),g=ht(E=>{var O;return((O=E.settings)==null?void 0:O.siteName)??"tmex"}),v=t?l[t]:void 0,b=n.useMemo(()=>{var E;if(!(!e||!((E=v==null?void 0:v.session)!=null&&E.windows)))return v.session.windows.find(O=>O.id===e)},[e,v]),T=n.useMemo(()=>{if(!(!c||!b))return b.panes.find(E=>E.id===c)},[c,b]),Y=n.useMemo(()=>b&&T?mt({paneCustomName:T.customName,paneTitle:T.title,windowName:b.name,windowCustomName:b.customName,deviceName:g}):t??"",[b,T,g,t]),U=Je(E=>c?!!E.ringingPanes[c]:!1);return i.jsxs(i.Fragment,{children:[U&&i.jsx("span",{className:"bell-blink",children:"🔔 "}),Y]})}function Er(){const{t}=ke(),{deviceId:e,windowId:s,paneId:c}=Ze(),l=ft(),g=qt(),v=c?et(c):void 0,b=ge(u=>u.inputMode),T=ge(u=>u.setInputMode),Y=W(u=>{var N;return e?((N=u.deviceConnected)==null?void 0:N[e])??!1:!1}),U=W(u=>e?u.snapshots[e]:void 0),E=n.useMemo(()=>{var u;if(!(!s||!((u=U==null?void 0:U.session)!=null&&u.windows)))return U.session.windows.find(N=>N.id===s)},[s,U]),O=n.useCallback(u=>{!e||!s||l(`/devices/${e}/windows/${s}/panes/${Ne(u)}`,{replace:!0})},[e,s,l]),r=n.useMemo(()=>{if(!(!v||!E))return E.panes.find(u=>u.id===v)},[v,E]),ae=n.useCallback(u=>{!e||!v||W.getState().splitPane(e,v,u,r==null?void 0:r.currentPath)},[e,v,r==null?void 0:r.currentPath]),[G,j]=n.useState(!1),[le,se]=n.useState(!1),[de,re]=n.useState(!1),f=!!(v&&Y),h=(tt({queryKey:Ut(e??"",v??""),queryFn:()=>Yt(e??"",v??""),enabled:!!(e&&v),throwOnError:!1}).data??[]).some(u=>u.enabled),P=()=>{T(b==="direct"?"editor":"direct")},B=()=>{window.dispatchEvent(new CustomEvent("tmex:jump-to-latest"))},A=()=>{j(!0)},F=()=>{window.location.reload()};return i.jsxs(i.Fragment,{children:[g&&v&&E&&E.panes.length>1&&i.jsx(Kn,{window:E,currentPaneId:v,onSelectPane:O}),!g&&i.jsxs(i.Fragment,{children:[i.jsx(je,{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(Vt,{className:"h-4 w-4"})}),i.jsx(je,{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(Kt,{className:"h-4 w-4"})})]}),i.jsx(je,{variant:"ghost",size:"icon-sm",onClick:A,"aria-label":t("nav.refreshPage"),title:t("nav.refreshPage"),children:i.jsx(dn,{className:"h-4 w-4"})}),i.jsx(je,{variant:"ghost",size:"icon-sm",onClick:P,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(xn,{className:"h-4 w-4"}):i.jsx(Nn,{className:"h-4 w-4"})}),i.jsx(je,{variant:"ghost",size:"icon-sm",onClick:B,disabled:!f,"aria-label":t("nav.jumpToLatest"),title:t("nav.jumpToLatest"),children:i.jsx(fn,{className:"h-4 w-4"})}),i.jsxs(je,{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(Gt,{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(je,{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(Qt,{open:le,onOpenChange:se,deviceId:e,paneId:v}),i.jsx(Jt,{open:G,onOpenChange:j,children:i.jsxs(Zt,{children:[i.jsxs(en,{children:[i.jsx(tn,{children:t("nav.refreshPage")}),i.jsx(nn,{children:t("nav.refreshPageConfirm")})]}),i.jsxs(rn,{children:[i.jsx(sn,{onClick:()=>j(!1),children:t("common.cancel")}),i.jsx(on,{onClick:F,children:t("common.confirm")})]})]})})]})}export{Er as PageActions,yr as PageTitle,Sr as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ai as o,aj as n}from"./mermaid.core-BoNU6G1d.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-727SXJPM-B9DM5PB4.js";import{_ as i}from"./mermaid.core-BoNU6G1d.js";import"./chunk-FMBD7UC4-BnvyNYGh.js";import"./chunk-ND2GUHAM-BzcZgEWG.js";import"./chunk-55IACEB6-DgCH4WwT.js";import"./chunk-2J33WTMH-MmS9_ur_.js";import"./index-UoApkLSY.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-727SXJPM-B9DM5PB4.js";import{_ as i}from"./mermaid.core-BoNU6G1d.js";import"./chunk-FMBD7UC4-BnvyNYGh.js";import"./chunk-ND2GUHAM-BzcZgEWG.js";import"./chunk-55IACEB6-DgCH4WwT.js";import"./chunk-2J33WTMH-MmS9_ur_.js";import"./index-UoApkLSY.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as e,b as r,a,S as s}from"./chunk-AQP2D5EJ-DQwC9D9W.js";import{_ as i}from"./mermaid.core-BoNU6G1d.js";import"./chunk-55IACEB6-DgCH4WwT.js";import"./chunk-2J33WTMH-MmS9_ur_.js";import"./index-UoApkLSY.js";var p={parser:a,get db(){return new s(2)},renderer:r,styles:e,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{p as diagram};
|